diff --git a/ve/ve0100.cpp b/ve/ve0100.cpp index bce7dc00a..705f75633 100755 --- a/ve/ve0100.cpp +++ b/ve/ve0100.cpp @@ -933,7 +933,7 @@ void TMotore_application::print() const TTipo_documento& tipo = doc.tipo(); TFilename rep; - if (tipo.main_print_profile(rep)) + if (tipo.main_print_profile(rep, 0)) { const bool da_stampare = doc.stampabile(); diff --git a/ve/ve1100.cpp b/ve/ve1100.cpp index 48b1f11ed..0aa8c8317 100755 --- a/ve/ve1100.cpp +++ b/ve/ve1100.cpp @@ -176,7 +176,7 @@ TDocumento_form::TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, const TString4 tipodoc(doc.get(DOC_TIPODOC)); bool found = false; TFilename nomeform; - const TTipo_documento & tipo = cached_tipodoc(tipodoc); + const TTipo_documento& tipo = cached_tipodoc(tipodoc); if (tipo.empty()) { @@ -186,9 +186,9 @@ TDocumento_form::TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, if (tipo.printable()) { // se non ci sono errori procede con la stampa if (aggiuntivo) - tipo.additional_print_profile(nomeform); + tipo.additional_print_profile(nomeform, 1); else - tipo.main_print_profile(nomeform); // legge il nome del form di stampa + tipo.main_print_profile(nomeform, 1); // legge il nome del form di stampa nomeform.trim(); TFilename test(nomeform); test.ext("frm"); @@ -1446,13 +1446,11 @@ void TStampaDoc_application::print_selected() extdoc.summary_reset(); extdoc.scadenze_reset(); + const int ncopie2 = extdoc.tipo().get_int("I2"); // Stampa eventuali documenti allegati TFilename formagg; - - extdoc.tipo().additional_print_profile(formagg); - const int ncopie2 = extdoc.tipo().get_int("I2"); - - if (!formagg.blank() && ncopie2 > 0) // Se esiste un tipo documento da accodare + // Se esiste un tipo documento da accodare + if (ncopie2 > 0 && extdoc.tipo().additional_print_profile(formagg, 1)) { TDocumento_form* secform = new TDocumento_form(cur.curr(), *_firmrel, _definitiva, _interattivo, true); if (secform->valid()) diff --git a/ve/ve1300.cpp b/ve/ve1300.cpp index 20896fa9f..7764d1257 100755 --- a/ve/ve1300.cpp +++ b/ve/ve1300.cpp @@ -997,12 +997,10 @@ bool TReport_doc_app::print_loop(const TString& query, bool send_by_mail) const TString& tipodoc = doc.get(DOC_TIPODOC).as_string(); const TTipo_documento& tipo = cached_tipodoc(tipodoc); - TFilename profilo; - tipo.main_print_profile(profilo); const bool send_mail = send_by_mail && get_mail_address().full(); - profilo.ext("rep"); - if (profilo.custom_path()) // Tenta di costruirsi il nome del report + TFilename profilo; + if (tipo.main_print_profile(profilo, 2)) // Tenta di costruirsi il nome del report { int copies = _msk->get_int(F_NCOPIE); if (copies <= 0 && is_definitive) @@ -1031,40 +1029,29 @@ bool TReport_doc_app::print_loop(const TString& query, bool send_by_mail) else { TString msg; msg << TR("Report inesistente") << " : " << profilo; - statbar_set_title(TASK_WIN, msg); beep(2); continue; } // Stampa eventuali allegati - tipo.additional_print_profile(profilo); - if (profilo.full()) + if (tipo.additional_print_profile(profilo, 2)) { - profilo.ext("rep"); - if (profilo.custom_path()) - { - int copies = tipo.additional_ncopie(); - if (copies <= 0) copies = 1; + int copies = tipo.additional_ncopie(); + if (copies <= 0) copies = 1; - TReport_doc& allegato = reports.get(profilo); - // Cambio _codnum per non sovrascrivere il pdf precedente - if (arc) - { - _codnum = profilo.name(); - _codnum = _codnum.before("."); - } - // Il flag di definitvo deve essere false altrimenti riaggiorna lo stato e ristampa i documenti allegati - if (send_mail) - allegato.print(doc, *mail_book, false, 1, false, arc); - else - allegato.print(doc, book, false, copies, false, arc); - } - else - { - TString msg; msg << TR("Report allegato inesistente") << " : " << profilo; - statbar_set_title(TASK_WIN, msg); - } + TReport_doc& allegato = reports.get(profilo); + // Cambio _codnum per non sovrascrivere il pdf precedente + if (arc) + { + _codnum = profilo.name(); + _codnum = _codnum.before("."); + } + // Il flag di definitvo deve essere false altrimenti riaggiorna lo stato e ristampa i documenti allegati + if (send_mail) + allegato.print(doc, *mail_book, false, 1, false, arc); + else + allegato.print(doc, book, false, copies, false, arc); } if (mail_book != NULL) @@ -1122,7 +1109,6 @@ void TReport_doc_app::main_loop() else { KEY k; - while ((k = _msk->run()) != K_QUIT) // Stampa interattiva print_selection(k != K_ENTER); } diff --git a/ve/velib.h b/ve/velib.h index 3d9ad9914..ccac07b2e 100755 --- a/ve/velib.h +++ b/ve/velib.h @@ -304,9 +304,9 @@ public: bool stato_with_mov_mag(const char stato) const; bool scarica_residuo() const; bool clifo_optional() const { return get_bool("B5"); } - bool printable() const { return get("S5").not_empty(); } - bool main_print_profile(TFilename& report) const; - bool additional_print_profile(TFilename& report) const; + bool printable() const { return get("S5").full(); } + bool main_print_profile(TFilename& report, int filter) const; + bool additional_print_profile(TFilename& report, int filter) const; bool is_costo() const ; bool is_ricavo() const ; const TString & module() const { return _module; } diff --git a/ve/velib03a.cpp b/ve/velib03a.cpp index 87d231643..33f22f38d 100755 --- a/ve/velib03a.cpp +++ b/ve/velib03a.cpp @@ -62,18 +62,21 @@ const TFilename& TTipo_documento::profile_name(TFilename& profile) const return profile; } -bool TTipo_documento::main_print_profile(TFilename& report) const +bool TTipo_documento::main_print_profile(TFilename& report, int filter) const { - TString16 base = get("S5"); - base.cut(8); + TString8 base = get("S5").left(8); base.trim(); - bool ok = base.not_empty(); + bool ok = base.full(); if (ok) { - report = base; - report.ext("rep"); - ok = report.custom_path(); - if (!ok) + ok = false; + if (filter != 1) + { + report = base; + report.ext("rep"); + ok = report.custom_path(); + } + if (!ok && filter != 2) { report = base; report.ext("frm"); @@ -83,17 +86,21 @@ bool TTipo_documento::main_print_profile(TFilename& report) const return ok; } -bool TTipo_documento::additional_print_profile(TFilename& report) const +bool TTipo_documento::additional_print_profile(TFilename& report, int filter) const { - TString16 base = get("S5"); - base.ltrim(8); base.rtrim(); - bool ok = base.not_empty(); + TString8 base = get("S5").mid(8, 8); + base.trim(); + bool ok = base.full(); if (ok) { - report = base; - report.ext("rep"); - ok = report.custom_path(); - if (!ok) + ok = false; + if (filter != 1) // Non voglio i soli frm + { + report = base; + report.ext("rep"); + ok = report.custom_path(); + } + if (!ok && filter != 2) // Non voglio i soli rep { report = base; report.ext("frm"); diff --git a/ve/velib06.cpp b/ve/velib06.cpp index b056be2b8..42b7851a1 100755 --- a/ve/velib06.cpp +++ b/ve/velib06.cpp @@ -1039,7 +1039,7 @@ TVariable_mask* TDocumento_mask::riga_mask(int numriga) const int pos = m->id2pos(FR_CODART); if (pos >= 0) { - const TMask_field & f = m->field(FR_CODART); + const TMask_field & f = m->fld(pos); if (f.is_edit()) { TBrowse * browse = ((TEdit_field &) f).browse();