2004-05-04 08:25:23 +00:00
|
|
|
#include <applicat.h>
|
|
|
|
#include <automask.h>
|
|
|
|
#include <defmask.h>
|
|
|
|
#include <execp.h>
|
|
|
|
#include <form.h>
|
2004-06-08 10:00:49 +00:00
|
|
|
#include <modaut.h>
|
2004-05-04 08:25:23 +00:00
|
|
|
#include <prefix.h>
|
2004-05-07 10:27:35 +00:00
|
|
|
#include <report.h>
|
2004-05-04 08:25:23 +00:00
|
|
|
|
|
|
|
#include "ba8400.h"
|
|
|
|
|
2004-05-18 13:49:41 +00:00
|
|
|
#include <rdoc.h>
|
|
|
|
|
2004-05-04 08:25:23 +00:00
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// TFormer_mask
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class TFormer_mask : public TAutomask
|
|
|
|
{
|
2004-05-06 09:21:18 +00:00
|
|
|
bool _doc;
|
2004-05-24 12:50:35 +00:00
|
|
|
int _qta_decimals;
|
2004-05-06 09:21:18 +00:00
|
|
|
|
2004-05-04 08:25:23 +00:00
|
|
|
protected:
|
2004-05-18 13:49:41 +00:00
|
|
|
void run_app(const char* app) const;
|
2004-05-04 08:25:23 +00:00
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
2004-05-24 12:50:35 +00:00
|
|
|
void add_array_message(const TString& msg, TReport_field& rf) const;
|
2004-05-06 09:21:18 +00:00
|
|
|
void parse_field_line(const TString& line, TReport_field& rf) const;
|
|
|
|
void import_section(TScanner& scan, TReport_section& rs) const;
|
2004-05-24 12:50:35 +00:00
|
|
|
void import_general(TScanner& scan, TReport& rep);
|
|
|
|
void import_sections(TScanner& scan, TReport& rep);
|
2004-05-06 09:21:18 +00:00
|
|
|
void import_use(TScanner& scan, TReport& rep) const;
|
2004-05-04 08:25:23 +00:00
|
|
|
void import();
|
|
|
|
|
|
|
|
public:
|
|
|
|
TFormer_mask();
|
|
|
|
};
|
|
|
|
|
2004-05-06 09:21:18 +00:00
|
|
|
void TFormer_mask::import_use(TScanner& scan, TReport& rep) const
|
2004-05-04 08:25:23 +00:00
|
|
|
{
|
|
|
|
TString use;
|
|
|
|
int parse_use = 0;
|
|
|
|
while (scan.ok())
|
|
|
|
{
|
|
|
|
const TString& line = scan.line();
|
|
|
|
if (line.empty())
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (parse_use == 0 && line.starts_with("US"))
|
|
|
|
parse_use = 1;
|
|
|
|
|
|
|
|
if (parse_use == 1)
|
|
|
|
{
|
|
|
|
if (line.starts_with("EN"))
|
|
|
|
{
|
|
|
|
parse_use = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
use << line << '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!use.blank())
|
|
|
|
rep.set_recordset(use);
|
|
|
|
}
|
|
|
|
|
2004-05-24 12:50:35 +00:00
|
|
|
void TFormer_mask::add_array_message(const TString& line, TReport_field& rf) const
|
|
|
|
{
|
|
|
|
TToken_string head(line, ' ');
|
|
|
|
|
|
|
|
TString_array list;
|
|
|
|
rf.get_list(list);
|
|
|
|
const int index = list.last();
|
|
|
|
TToken_string item = list.row(index);
|
|
|
|
|
|
|
|
head.add("MESSAGE", 0);
|
|
|
|
TString msg = item.get(2);
|
|
|
|
msg.trim();
|
|
|
|
if (!msg.empty())
|
|
|
|
item << '\n';
|
|
|
|
msg << head;
|
|
|
|
item.add(msg,2);
|
|
|
|
|
|
|
|
list.add(item, index);
|
|
|
|
rf.set_list(list);
|
|
|
|
}
|
|
|
|
|
2004-05-06 09:21:18 +00:00
|
|
|
void TFormer_mask::parse_field_line(const TString& line, TReport_field& rf) const
|
2004-05-04 08:25:23 +00:00
|
|
|
{
|
2004-05-06 09:21:18 +00:00
|
|
|
TToken_string head(line, ' ');
|
|
|
|
head.trim();
|
2005-09-27 12:00:58 +00:00
|
|
|
head.strip_double_spaces();
|
2004-05-06 09:21:18 +00:00
|
|
|
|
2004-05-24 12:50:35 +00:00
|
|
|
if (head.starts_with("DR"))
|
|
|
|
{
|
|
|
|
if (rf.type() == 'V' || rf.type() == 'P')
|
|
|
|
rf.set_codval(head.get(1));
|
|
|
|
} else
|
2004-05-06 09:21:18 +00:00
|
|
|
if (head.starts_with("FI"))
|
|
|
|
{
|
2004-05-06 15:50:57 +00:00
|
|
|
TString fld = head.get(1);
|
2004-05-18 13:49:41 +00:00
|
|
|
const int arrow = fld.find("->");
|
|
|
|
if (arrow > 0)
|
2004-05-06 15:50:57 +00:00
|
|
|
{
|
2004-05-18 13:49:41 +00:00
|
|
|
const TString& right = fld.mid(arrow+2);
|
|
|
|
fld.cut(arrow);
|
|
|
|
fld << '.' << right;
|
2004-05-06 15:50:57 +00:00
|
|
|
}
|
2004-05-18 13:49:41 +00:00
|
|
|
if (rf.field().blank())
|
|
|
|
rf.set_field(fld);
|
|
|
|
else
|
|
|
|
rf.set_alternate_field(fld);
|
2004-05-06 09:21:18 +00:00
|
|
|
} else
|
|
|
|
if (head.starts_with("FL"))
|
|
|
|
{
|
|
|
|
const TString& flags = head.get(1);
|
|
|
|
for (int i = 0; flags[i]; i++)
|
|
|
|
{
|
|
|
|
switch (flags[i])
|
|
|
|
{
|
2004-05-18 13:49:41 +00:00
|
|
|
case 'D': rf.deactivate(); break;
|
2004-05-06 09:21:18 +00:00
|
|
|
case 'H': rf.hide(); break;
|
2004-05-06 15:50:57 +00:00
|
|
|
case 'U':
|
|
|
|
if (rf.type() == 'V')
|
|
|
|
rf.set_type('P'); // Trasforma da Valuta a Prezzo
|
|
|
|
break;
|
2004-05-06 09:21:18 +00:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else
|
2004-05-18 13:49:41 +00:00
|
|
|
if (head.starts_with("GR"))
|
|
|
|
{
|
|
|
|
TString g = rf.groups();
|
|
|
|
for (int i = head.items()-1; i > 0; i--)
|
|
|
|
g << ' ' << head.get(i);
|
|
|
|
rf.set_groups(g);
|
2004-05-24 12:50:35 +00:00
|
|
|
if (_doc && rf.type() == 'N')
|
|
|
|
{
|
|
|
|
if (rf.in_group(29)) // PREZZO
|
|
|
|
{
|
|
|
|
rf.set_type('P');
|
|
|
|
rf.set_codval("33.CODVAL");
|
|
|
|
} else
|
|
|
|
if (rf.in_group(30)) // QTA
|
|
|
|
{
|
|
|
|
TString pic = rf.picture().before(",");
|
|
|
|
if (_qta_decimals > 0)
|
|
|
|
{
|
|
|
|
pic << ',';
|
|
|
|
for (int d = 0; d < _qta_decimals; d++)
|
|
|
|
pic << '@';
|
|
|
|
}
|
|
|
|
const int extra = pic.len() - rf.get_rect().width() / 100;
|
|
|
|
if (extra > 0)
|
|
|
|
pic = pic.mid(extra);
|
|
|
|
rf.set_picture(pic);
|
|
|
|
} else
|
|
|
|
if (rf.in_group(31)) // IMPORTO
|
|
|
|
{
|
|
|
|
rf.set_type('V');
|
|
|
|
rf.set_codval("33.CODVAL");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
if (head.starts_with("IT"))
|
|
|
|
{
|
|
|
|
const int apicia = head.find('"')+1;
|
|
|
|
if (apicia > 0 && rf.type() == 'A')
|
|
|
|
{
|
|
|
|
const int apicic = head.find('"', apicia);
|
|
|
|
TToken_string item(head.sub(apicia, apicic), SAFE_PIPE_CHR);
|
|
|
|
item.replace('|', SAFE_PIPE_CHR);
|
|
|
|
TString_array list;
|
|
|
|
rf.get_list(list);
|
|
|
|
list.add(item);
|
|
|
|
rf.set_list(list);
|
|
|
|
|
|
|
|
const int msg = head.find(" ME", apicic);
|
|
|
|
if (msg > 0)
|
|
|
|
add_array_message(head.mid(msg+1), rf);
|
|
|
|
}
|
2004-05-18 13:49:41 +00:00
|
|
|
} else
|
2004-05-06 09:21:18 +00:00
|
|
|
if (head.starts_with("ME"))
|
|
|
|
{
|
2004-05-18 13:49:41 +00:00
|
|
|
if (head.find("NUMEXPR") > 0 || head.find("STREXPR") > 0)
|
|
|
|
{
|
|
|
|
const int pos = head.find(',')+1;
|
|
|
|
rf.set_field(head.mid(pos));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-05-24 12:50:35 +00:00
|
|
|
if (rf.type() == 'A')
|
|
|
|
add_array_message(head, rf);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
head.add("MESSAGE", 0);
|
|
|
|
TString me = rf.prescript();
|
|
|
|
if (me.not_empty())
|
|
|
|
me << '\n';
|
|
|
|
me << head;
|
|
|
|
rf.set_prescript(me);
|
|
|
|
}
|
2004-05-18 13:49:41 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
if (head.starts_with("PI"))
|
|
|
|
{
|
|
|
|
const int apici = head.find('"');
|
|
|
|
if (apici > 0)
|
|
|
|
{
|
|
|
|
TString pic = head.mid(apici);
|
|
|
|
pic.strip("\"");
|
|
|
|
pic.insert(rf.picture());
|
|
|
|
rf.set_picture(pic);
|
2004-11-30 22:02:59 +00:00
|
|
|
const int len = pic.len() * 100;
|
|
|
|
const int field_len = rf.get_rect().width();
|
|
|
|
if (len > 400 && len < field_len)
|
|
|
|
rf.set_width(len);
|
2004-05-18 13:49:41 +00:00
|
|
|
}
|
2004-05-06 09:21:18 +00:00
|
|
|
} else
|
|
|
|
if (head.starts_with("PR"))
|
|
|
|
{
|
|
|
|
const int x = 100*(head.get_int(1)-1);
|
|
|
|
const int y = 100*(head.get_int()-1);
|
|
|
|
rf.set_pos(x, y);
|
2004-05-18 13:49:41 +00:00
|
|
|
const int apici = head.find('"');
|
|
|
|
if (apici > 0)
|
|
|
|
{
|
|
|
|
TString prompt = head.mid(apici);
|
|
|
|
if (rf.type() == 'I')
|
|
|
|
rf.set_field(prompt);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prompt.strip("\"");
|
|
|
|
rf.set_picture(prompt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-24 12:50:35 +00:00
|
|
|
void TFormer_mask::import_general(TScanner& scan, TReport& rep)
|
2004-05-18 13:49:41 +00:00
|
|
|
{
|
|
|
|
TString expr;
|
|
|
|
while (scan.ok())
|
|
|
|
{
|
|
|
|
TString& line = scan.line();
|
|
|
|
if (line.empty() || line.starts_with("EN"))
|
|
|
|
break;
|
2004-05-24 12:50:35 +00:00
|
|
|
if (_doc)
|
2004-05-18 13:49:41 +00:00
|
|
|
{
|
2004-05-24 12:50:35 +00:00
|
|
|
if (line.starts_with("EXCLUDE"))
|
|
|
|
{
|
|
|
|
TToken_string exclude(50, ',');
|
|
|
|
exclude = line.after('"');
|
|
|
|
exclude.strip("\""); exclude.trim();
|
2004-11-30 22:02:59 +00:00
|
|
|
const TString4 tipo = exclude.get(0);
|
|
|
|
if (!tipo.blank())
|
2004-05-24 12:50:35 +00:00
|
|
|
{
|
2004-11-30 22:02:59 +00:00
|
|
|
TString cond;
|
|
|
|
cond << "(34.TIPORIGA='" << tipo << "\')";
|
|
|
|
TString codart = exclude.get(1);
|
|
|
|
if (!codart.blank())
|
|
|
|
{
|
|
|
|
cond.insert("(");
|
|
|
|
cond << "&&(34.CODART?='" << codart << "')";
|
|
|
|
cond << ')';
|
|
|
|
}
|
|
|
|
if (expr.not_empty())
|
|
|
|
expr << "||";
|
|
|
|
expr << cond;
|
2004-05-24 12:50:35 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
if (line.starts_with("QTA_DECIMALS"))
|
2004-05-18 13:49:41 +00:00
|
|
|
{
|
2004-05-24 12:50:35 +00:00
|
|
|
_qta_decimals = atoi(line.mid(13));
|
2004-05-18 13:49:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_doc && expr.not_empty())
|
|
|
|
{
|
|
|
|
expr.insert("!(");
|
|
|
|
expr << ')';
|
|
|
|
rep.section('B', 1).set_condition(expr);
|
2004-05-06 09:21:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFormer_mask::import_section(TScanner& scan, TReport_section& rs) const
|
|
|
|
{
|
|
|
|
TToken_string head(256, ' ');
|
|
|
|
|
|
|
|
int in_field = 0;
|
|
|
|
TReport_field* cur_field = NULL;
|
|
|
|
|
|
|
|
while (scan.ok())
|
|
|
|
{
|
|
|
|
TString& line = scan.line();
|
|
|
|
if (line.empty())
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (line.starts_with("BE"))
|
|
|
|
{
|
|
|
|
in_field++;
|
|
|
|
if (in_field == 1)
|
|
|
|
{
|
|
|
|
head.trim();
|
2005-09-27 12:00:58 +00:00
|
|
|
head.strip_double_spaces();
|
2004-05-06 09:21:18 +00:00
|
|
|
const TString16 str_type = head.get(0);
|
|
|
|
char type = ' ';
|
|
|
|
if (str_type.starts_with("FI"))
|
2004-05-24 12:50:35 +00:00
|
|
|
type = 'I'; else
|
|
|
|
if (str_type.starts_with("LI"))
|
|
|
|
type = 'A';
|
2004-05-06 15:50:57 +00:00
|
|
|
else
|
|
|
|
type = str_type[0];
|
2004-05-06 09:21:18 +00:00
|
|
|
|
|
|
|
if (type > ' ')
|
|
|
|
{
|
|
|
|
const int id = head.get_int(1);
|
|
|
|
const int width = 100*head.get_int();
|
2004-05-24 12:50:35 +00:00
|
|
|
const int height = 100*head.get_int();
|
2004-05-06 09:21:18 +00:00
|
|
|
|
|
|
|
cur_field = new TReport_field(&rs);
|
|
|
|
cur_field->set_type(type);
|
|
|
|
if (id > 0)
|
|
|
|
cur_field->set_id(id);
|
|
|
|
if (width > 0)
|
|
|
|
cur_field->set_width(width);
|
2004-05-24 12:50:35 +00:00
|
|
|
if (height > 0)
|
|
|
|
{
|
2004-05-18 13:49:41 +00:00
|
|
|
cur_field->set_height(height);
|
2004-05-24 12:50:35 +00:00
|
|
|
if (_doc && type == 'S' && height >= 500 && rs.type() == 'B')
|
|
|
|
cur_field->set_dynamic_height(true); // Altezza descrizione automatica
|
|
|
|
}
|
2004-05-06 15:50:57 +00:00
|
|
|
if (strchr("NVP", type) != NULL)
|
2004-05-18 13:49:41 +00:00
|
|
|
{
|
2004-05-06 15:50:57 +00:00
|
|
|
cur_field->set_horizontal_alignment('R');
|
2004-05-18 13:49:41 +00:00
|
|
|
cur_field->hide_zeroes(true);
|
|
|
|
}
|
2004-05-06 09:21:18 +00:00
|
|
|
|
|
|
|
rs.add(cur_field);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
if (line.starts_with("EN"))
|
|
|
|
{
|
|
|
|
if (in_field >= 0)
|
|
|
|
{
|
2004-05-18 13:49:41 +00:00
|
|
|
if (cur_field != NULL)
|
|
|
|
{
|
|
|
|
// Trasforma in testi fissi i campi stringa senza sorgente
|
2004-05-24 12:50:35 +00:00
|
|
|
if (cur_field->type() == 'S' && !cur_field->picture().blank() &&
|
|
|
|
cur_field->field().blank() && cur_field->prescript().blank())
|
2004-05-18 13:49:41 +00:00
|
|
|
cur_field->set_type('T');
|
|
|
|
}
|
2004-05-06 09:21:18 +00:00
|
|
|
in_field--; // END of field
|
|
|
|
cur_field = NULL;
|
|
|
|
}
|
|
|
|
if (in_field < 0)
|
|
|
|
break; // END of section
|
|
|
|
} else
|
|
|
|
if (cur_field != NULL)
|
|
|
|
{
|
|
|
|
parse_field_line(line, *cur_field);
|
|
|
|
}
|
|
|
|
|
|
|
|
head = line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-24 12:50:35 +00:00
|
|
|
void TFormer_mask::import_sections(TScanner& scan, TReport& rep)
|
2004-05-06 09:21:18 +00:00
|
|
|
{
|
|
|
|
while (scan.ok())
|
|
|
|
{
|
|
|
|
TString& line = scan.line();
|
|
|
|
if (line.empty())
|
|
|
|
break;
|
2004-05-18 13:49:41 +00:00
|
|
|
|
|
|
|
if (line.starts_with("GE"))
|
|
|
|
import_general(scan, rep);
|
2004-05-06 09:21:18 +00:00
|
|
|
|
|
|
|
if (line.starts_with("SE"))
|
|
|
|
{
|
|
|
|
line.trim();
|
2005-09-27 12:00:58 +00:00
|
|
|
line.strip_double_spaces();
|
2004-05-06 09:21:18 +00:00
|
|
|
TToken_string head(line, ' ');
|
|
|
|
const TString16 str_name = head.get(1);
|
|
|
|
const TString16 str_type = head.get();
|
|
|
|
int height = 100*head.get_int();
|
|
|
|
char type = ' ';
|
|
|
|
int level = 0;
|
|
|
|
if (str_name.starts_with("BO"))
|
|
|
|
{
|
|
|
|
if (str_type.starts_with("OD"))
|
|
|
|
{ type = 'B'; level = 1; height = 0; }
|
|
|
|
}
|
|
|
|
if (str_name.starts_with("FO"))
|
|
|
|
{
|
|
|
|
if (str_type.starts_with("LA"))
|
|
|
|
{ type = 'F'; level = 1; }
|
|
|
|
if (str_type.starts_with("OD"))
|
|
|
|
{ type = 'F'; level = 0; }
|
|
|
|
} else
|
|
|
|
if (str_name.starts_with("GR"))
|
|
|
|
{
|
|
|
|
if (str_type.starts_with("OD"))
|
|
|
|
{ type = 'B'; level = 0; }
|
|
|
|
} else
|
|
|
|
if (str_name.starts_with("HE"))
|
|
|
|
{
|
|
|
|
if (str_type.starts_with("FI"))
|
|
|
|
{ type = 'H'; level = 1; }
|
|
|
|
if (str_type.starts_with("OD"))
|
|
|
|
{ type = 'H'; level = 0; }
|
|
|
|
}
|
|
|
|
if (type > ' ')
|
|
|
|
{
|
|
|
|
TReport_section& cur_sec = rep.section(type, level);
|
|
|
|
if (height >= 0)
|
|
|
|
cur_sec.set_height(height);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (type == 'F')
|
|
|
|
{
|
2009-11-02 14:53:05 +00:00
|
|
|
const TReport_pnt abolute_footer_pos(0, -height);
|
2004-05-06 09:21:18 +00:00
|
|
|
cur_sec.set_pos(abolute_footer_pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
import_section(scan, cur_sec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* hf = "HF";
|
|
|
|
for (int i = 0; hf[i]; i++)
|
|
|
|
{
|
|
|
|
TReport_section* sec = rep.find_section(hf[i], 0);
|
|
|
|
if (sec != NULL)
|
|
|
|
{
|
|
|
|
const bool yes = rep.find_section(hf[i], 1) != NULL;
|
|
|
|
sec->hide_if_needed(yes);
|
|
|
|
}
|
|
|
|
}
|
2004-05-04 08:25:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TFormer_mask::import()
|
|
|
|
{
|
2004-05-06 09:21:18 +00:00
|
|
|
_doc = get_bool(F_DOC);
|
|
|
|
TScanner scan(get(F_FORM));
|
2004-05-04 08:25:23 +00:00
|
|
|
TReport rep;
|
2004-05-06 09:21:18 +00:00
|
|
|
import_use(scan, rep);
|
|
|
|
import_sections(scan, rep);
|
|
|
|
if (_doc)
|
2005-09-27 12:00:58 +00:00
|
|
|
{
|
|
|
|
rep.set_command_line("ve1 -2");
|
2004-05-18 13:49:41 +00:00
|
|
|
rep.set_libraries("ve1300");
|
2005-09-27 12:00:58 +00:00
|
|
|
}
|
2004-05-04 08:25:23 +00:00
|
|
|
rep.save(get(F_REPORT));
|
|
|
|
}
|
|
|
|
|
2004-05-18 13:49:41 +00:00
|
|
|
void TFormer_mask::run_app(const char* app) const
|
|
|
|
{
|
2005-09-27 12:00:58 +00:00
|
|
|
TFilename output = get(F_REPORT);
|
|
|
|
if (output.custom_path())
|
2004-05-18 13:49:41 +00:00
|
|
|
{
|
2005-09-27 12:00:58 +00:00
|
|
|
TString cmd = app;
|
|
|
|
if (cmd.starts_with("ba8"))
|
|
|
|
cmd << ' ' << output.name();
|
2004-05-18 13:49:41 +00:00
|
|
|
TExternal_app app(cmd);
|
|
|
|
app.run();
|
|
|
|
}
|
|
|
|
else
|
2005-09-27 12:00:58 +00:00
|
|
|
::error_box(TR("Il file %s non esiste"), output.name());
|
2004-05-18 13:49:41 +00:00
|
|
|
}
|
|
|
|
|
2004-05-04 08:25:23 +00:00
|
|
|
bool TFormer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
{
|
|
|
|
switch (o.dlg())
|
|
|
|
{
|
|
|
|
case F_FORM:
|
2004-05-24 12:50:35 +00:00
|
|
|
if (e == fe_modify || (e == fe_init && !o.empty()))
|
2004-05-04 08:25:23 +00:00
|
|
|
{
|
|
|
|
TFilename output = get(F_REPORT);
|
|
|
|
TFilename path = output.path();
|
|
|
|
if (path.empty())
|
|
|
|
{
|
|
|
|
path = firm2dir(-1);
|
|
|
|
path.add("custom");
|
|
|
|
}
|
2004-05-18 13:49:41 +00:00
|
|
|
TFilename input = o.get();
|
|
|
|
input.ext("frm");
|
|
|
|
input.custom_path();
|
|
|
|
o.set(input);
|
2004-05-24 12:50:35 +00:00
|
|
|
|
|
|
|
const TString name = input.name();
|
2004-05-18 13:49:41 +00:00
|
|
|
|
2004-05-04 08:25:23 +00:00
|
|
|
output = path;
|
2004-05-24 12:50:35 +00:00
|
|
|
output.add(name);
|
2004-05-04 08:25:23 +00:00
|
|
|
output.ext("rep");
|
|
|
|
output.lower();
|
2004-05-24 12:50:35 +00:00
|
|
|
|
2004-05-18 13:49:41 +00:00
|
|
|
set(F_REPORT, output, true);
|
2004-05-04 08:25:23 +00:00
|
|
|
enable(DLG_ELABORA, input.exist());
|
2004-05-24 12:50:35 +00:00
|
|
|
set(F_DOC, isdigit(name[2]) ? "" : "X");
|
2004-05-04 08:25:23 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case F_REPORT:
|
2004-05-24 12:50:35 +00:00
|
|
|
if (e == fe_modify || e == fe_init)
|
2004-05-04 08:25:23 +00:00
|
|
|
{
|
|
|
|
const TFilename output = get(F_REPORT);
|
2004-05-18 13:49:41 +00:00
|
|
|
const bool yes = output.exist();
|
|
|
|
enable(DLG_EDIT, yes);
|
|
|
|
enable(DLG_PRINT, yes);
|
2004-05-04 08:25:23 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DLG_ELABORA:
|
|
|
|
if (e == fe_button)
|
|
|
|
{
|
|
|
|
const TFilename output = get(F_REPORT);
|
|
|
|
if (output.exist())
|
|
|
|
{
|
|
|
|
if (!yesno_box(TR("Il file %s esiste gia':\nSi desidera sovrascriverlo?"), (const char*)output))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
import();
|
|
|
|
enable(DLG_PRINT, output.exist());
|
|
|
|
}
|
|
|
|
break;
|
2004-05-18 13:49:41 +00:00
|
|
|
case DLG_EDIT:
|
|
|
|
if (e == fe_button)
|
|
|
|
run_app("ba8 -2");
|
|
|
|
break;
|
2004-05-04 08:25:23 +00:00
|
|
|
case DLG_PRINT:
|
|
|
|
if (e == fe_button)
|
|
|
|
{
|
2004-05-18 13:49:41 +00:00
|
|
|
if (get_bool(F_DOC))
|
|
|
|
run_app("ve1 -2");
|
2004-05-04 08:25:23 +00:00
|
|
|
else
|
2004-05-18 13:49:41 +00:00
|
|
|
run_app("ba8 -2");
|
2004-05-04 08:25:23 +00:00
|
|
|
}
|
2004-05-18 13:49:41 +00:00
|
|
|
return false;
|
2004-05-04 08:25:23 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2004-05-24 12:50:35 +00:00
|
|
|
TFormer_mask::TFormer_mask()
|
|
|
|
: TAutomask("ba8400a"), _qta_decimals(0)
|
2004-05-04 08:25:23 +00:00
|
|
|
{
|
2004-05-24 12:50:35 +00:00
|
|
|
#ifdef DBG
|
2004-06-10 16:00:47 +00:00
|
|
|
set(F_FORM, "d:/clienti/newcelltop/custom/nctfat.frm");
|
2004-05-24 12:50:35 +00:00
|
|
|
#endif
|
2004-05-04 08:25:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// TFormer_app
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class TFormer_app : public TSkeleton_application
|
|
|
|
{
|
|
|
|
protected:
|
2004-06-08 10:00:49 +00:00
|
|
|
virtual bool create();
|
2004-05-04 08:25:23 +00:00
|
|
|
virtual void main_loop();
|
|
|
|
};
|
|
|
|
|
2004-06-08 10:00:49 +00:00
|
|
|
bool TFormer_app::create()
|
|
|
|
{
|
|
|
|
if (!has_module(RSAUT))
|
|
|
|
return error_box(TR("Modulo non autorizzato"));
|
|
|
|
|
|
|
|
return TSkeleton_application::create();
|
|
|
|
}
|
|
|
|
|
2004-05-04 08:25:23 +00:00
|
|
|
void TFormer_app::main_loop()
|
|
|
|
{
|
|
|
|
TFormer_mask m;
|
|
|
|
m.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
int ba8400(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
TFormer_app app;
|
|
|
|
app.run(argc, argv, TR("Form Converter"));
|
|
|
|
return 0;
|
|
|
|
}
|