Patch level : 2.1 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Corretta stampa documenti con nuovi report


git-svn-id: svn://10.65.10.50/trunk@12167 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-06-08 13:13:27 +00:00
parent 2fb82efac7
commit 1f95d09817
4 changed files with 47 additions and 32 deletions

View File

@ -3,12 +3,11 @@
\ Messaggi specifici per stampa documenti \ Messaggi specifici per stampa documenti
: MESSAGE_DESCRIGA ( ... -- ) : MESSAGE_DESCRIGA ( ... -- )
#RDOC.DESCR @ \ Legge campo descrizione riga "34.DESCR" @ \ Legge campo descrizione riga
#RDOC.DESCLUNGA @ \ Se e' presente una descrizione estesa "34.DESCLUNGA" @ \ Se e' presente una descrizione estesa
EMPTY= "X" =
NEGATE
IF IF
#RDOC.DESCEST @ \ Legge memo descrizione "34.DESCEST" @ \ Legge memo descrizione
+ \ Lo somma alla descrizione normale + \ Lo somma alla descrizione normale
THEN THEN
BEGIN \ Ciclo sugli eventuali parametri successivi BEGIN \ Ciclo sugli eventuali parametri successivi

View File

@ -1,5 +1,6 @@
#include <applicat.h> #include <applicat.h>
#include <automask.h> #include <automask.h>
#include <modaut.h>
#include <postman.h> #include <postman.h>
#include <printer.h> #include <printer.h>
#include <progind.h> #include <progind.h>
@ -787,6 +788,9 @@ void TReport_doc_app::add_filter(TString& query, bool from) const
bool TReport_doc_app::create() bool TReport_doc_app::create()
{ {
if (!has_module(RSAUT))
return error_box(TR("Modulo non autorizzato"));
_msk = new TReport_doc_mask; _msk = new TReport_doc_mask;
return TSkeleton_application::create(); return TSkeleton_application::create();
} }
@ -845,7 +849,6 @@ bool TReport_doc_app::print_loop(const TString& query)
return true; return true;
} }
void TReport_doc_app::main_loop() void TReport_doc_app::main_loop()
{ {
while (_msk->run() == K_ENTER) while (_msk->run() == K_ENTER)

View File

@ -20,7 +20,8 @@ class TIndustriosa_app : public TSkeleton_application
protected: protected:
const TString& conto_industriale(const TRiga_documento& row, TString& conto) const; const TString& conto_industriale(const TRiga_documento& row, TString& conto) const;
void trim_and_cut(TString& val, int len) const; void trim_and_cut(TString& val, int len) const;
void get_field(const TDocumento& doc, const TRectype& mov, const TRectype& rec, const char* field, TString& val) const; void get_field(const TDocumento& doc, const TRectype& mov, TCausale& causale,
const TRectype& rec, const char* field, TString& val) const;
bool filerr(const char* name) const; bool filerr(const char* name) const;
bool get_mci_path(TFilename& shell) const; bool get_mci_path(TFilename& shell) const;
bool call_mci(TDocumento& doc, const TRectype& movimento); bool call_mci(TDocumento& doc, const TRectype& movimento);
@ -69,7 +70,8 @@ void TIndustriosa_app::trim_and_cut(TString& val, int len) const
val.cut(0); val.cut(0);
} }
void TIndustriosa_app::get_field(const TDocumento& doc, const TRectype& mov, const TRectype& rec, const char* field, TString& val) const void TIndustriosa_app::get_field(const TDocumento& doc, const TRectype& mov, TCausale& causale,
const TRectype& rec, const char* field, TString& val) const
{ {
if (field[0] == '"' || field[0] == '\'') if (field[0] == '"' || field[0] == '\'')
{ {
@ -80,7 +82,7 @@ void TIndustriosa_app::get_field(const TDocumento& doc, const TRectype& mov, con
if (field[0] == '_') if (field[0] == '_')
{ {
val.cut(0); val.cut(0);
if (xvt_str_compare_ignoring_case(field, "_CANTIERE") == 0) if (stricmp(field, "_CANTIERE") == 0)
{ {
TString cms, fas; TString cms, fas;
cms = rec.get(RDOC_CODCMS); cms = rec.get(RDOC_CODCMS);
@ -95,17 +97,21 @@ void TIndustriosa_app::get_field(const TDocumento& doc, const TRectype& mov, con
trim_and_cut(fas, _len_fase); trim_and_cut(fas, _len_fase);
val << cms << fas; val << cms << fas;
} else } else
if (xvt_str_compare_ignoring_case(field, "_CONINDU") == 0) if (stricmp(field, "_CODCAUS") == 0)
{
val = causale.codice();
} else
if (stricmp(field, "_CONINDU") == 0)
{ {
conto_industriale((TRiga_documento&)rec, val); conto_industriale((TRiga_documento&)rec, val);
} else } else
if (xvt_str_compare_ignoring_case(field, "_IMPORTO") == 0) if (stricmp(field, "_IMPORTO") == 0)
{ {
TCurrency_documento imp(((TRiga_documento&)rec).importo(TRUE, FALSE), doc); TCurrency_documento imp(((TRiga_documento&)rec).importo(TRUE, FALSE), doc);
imp.change_to_firm_val(); imp.change_to_firm_val();
val = imp.get_num().stringa(); val = imp.get_num().stringa();
} else } else
if (xvt_str_compare_ignoring_case(field, "_IMPORTOVAL") == 0) if (stricmp(field, "_IMPORTOVAL") == 0)
{ {
if (doc.in_valuta()) if (doc.in_valuta())
{ {
@ -113,7 +119,7 @@ void TIndustriosa_app::get_field(const TDocumento& doc, const TRectype& mov, con
val = imp.get_num().stringa(); val = imp.get_num().stringa();
} }
} else } else
if (xvt_str_compare_ignoring_case(field, "_IMPOSTADOC") == 0) if (stricmp(field, "_IMPOSTADOC") == 0)
{ {
TString16 conto; TString16 conto;
real impval; real impval;
@ -128,13 +134,12 @@ void TIndustriosa_app::get_field(const TDocumento& doc, const TRectype& mov, con
imposta.change_to_firm_val(); imposta.change_to_firm_val();
val = imposta.get_num().stringa(); val = imposta.get_num().stringa();
} else } else
if (xvt_str_compare_ignoring_case(field, "_SEZIONE") == 0) if (stricmp(field, "_SEZIONE") == 0)
{ {
TCausale causale(mov.get(MOV_CODCAUS)); const char str[2] = { causale.sezione(2), '\0' };
const char str[2] = { causale.sezione_clifo(), '\0' };
val = str; val = str;
} else } else
if (xvt_str_compare_ignoring_case(field, "_TOTDOC") == 0) if (stricmp(field, "_TOTDOC") == 0)
{ {
TString16 conto; TString16 conto;
real totval; real totval;
@ -148,6 +153,8 @@ void TIndustriosa_app::get_field(const TDocumento& doc, const TRectype& mov, con
TCurrency_documento tot(totval, doc); TCurrency_documento tot(totval, doc);
tot.change_to_firm_val(); tot.change_to_firm_val();
val = tot.get_num().stringa(); val = tot.get_num().stringa();
if (val[0] == '-')
val.ltrim(1);
} }
} }
else else
@ -180,7 +187,11 @@ void TIndustriosa_app::get_field(const TDocumento& doc, const TRectype& mov, con
{ {
const real n(r->get(field)); const real n(r->get(field));
if (!n.is_zero()) if (!n.is_zero())
{
val = n.stringa(); val = n.stringa();
if (r->num() == LF_MOV && field == MOV_TOTDOC && val[0] == '-')
val.ltrim(1);
}
else else
val.cut(0); val.cut(0);
} }
@ -197,16 +208,14 @@ bool TIndustriosa_app::filerr(const char* name) const
bool TIndustriosa_app::get_mci_path(TFilename& shell) const bool TIndustriosa_app::get_mci_path(TFilename& shell) const
{ {
bool ok = FALSE;
#ifdef WIN32
char winpath[_MAX_PATH]; char winpath[_MAX_PATH];
::GetWindowsDirectory(winpath, sizeof(winpath)); ::GetWindowsDirectory(winpath, sizeof(winpath));
shell = winpath; shell = winpath;
shell.add("mci4.ini"); shell.add("mci4.ini");
bool ok = FALSE;
if (shell.exist()) if (shell.exist())
{ {
TConfig mci4(shell, "Paths"); TConfig mci4(shell, "Paths");
@ -238,7 +247,6 @@ bool TIndustriosa_app::get_mci_path(TFilename& shell) const
else else
filerr(shell); filerr(shell);
#endif
return ok; return ok;
} }
@ -266,9 +274,13 @@ bool TIndustriosa_app::call_mci(TDocumento& doc, const TRectype& movimento)
TAssoc_array& hvar = mci.list_variables(para.row(0)); TAssoc_array& hvar = mci.list_variables(para.row(0));
ini.set_paragraph(para.row(0)); ini.set_paragraph(para.row(0));
const TTipo_documento& td = doc.tipo();
const TString4 codcaus = td.causale();
TCausale causale(codcaus);
FOR_EACH_ASSOC_STRING(hvar, obj, key, field) FOR_EACH_ASSOC_STRING(hvar, obj, key, field)
{ {
get_field(doc, movimento, movimento, field, val); get_field(doc, movimento, causale, movimento, field, val);
ini.set(key, val); ini.set(key, val);
} }
@ -287,14 +299,15 @@ bool TIndustriosa_app::call_mci(TDocumento& doc, const TRectype& movimento)
ini.set_paragraph(pr); ini.set_paragraph(pr);
FOR_EACH_ASSOC_STRING(rvar, obj, key, field) FOR_EACH_ASSOC_STRING(rvar, obj, key, field)
{ {
get_field(doc, movimento, doc[r], field, val); get_field(doc, movimento, causale, doc[r], field, val);
ini.set(key, val); ini.set(key, val);
} }
} }
} }
mci.set_paragraph(para.row(0)); // Forza scrittura ultima riga
} }
else else
error_box("Il file 've6600.ini' non e' valido"); error_box("Il file ve6600.ini non e' valido");
if (ininame.exist()) if (ininame.exist())
{ {
@ -334,7 +347,7 @@ void TIndustriosa_app::main_loop()
if (ininame.exist()) if (ininame.exist())
{ {
open_files(LF_TAB, LF_TABCOM, LF_DOC, LF_RIGHEDOC, LF_CLIFO, LF_CFVEN, LF_MOV, LF_ANAMAG, 0); open_files(LF_TAB, LF_TABCOM, LF_CAUSALI, LF_RCAUSALI, LF_DOC, LF_RIGHEDOC, LF_CLIFO, LF_CFVEN, LF_MOV, LF_ANAMAG, 0);
TString8 para; para.format("%d", LF_DOC); TString8 para; para.format("%d", LF_DOC);
TConfig ini(ininame, para); TConfig ini(ininame, para);