Patch level : 2.2
Files correlati : ve0 ve1 Ricompilazione Demo : [ ] Commento : Corretta gestione nome dei profili di stampa (principale ed aggiuntivo) Non funzionanva corretamente in presenza di profilo principale lungo meno di 8 caratteri quando si specificava anche un profilo aggiuntivo (non vuoto). Attenzione: ricompilare per benino anche vedoc.lib git-svn-id: svn://10.65.10.50/trunk@13496 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f22e8df6d2
commit
cc5fcc3c2e
@ -547,37 +547,39 @@ void TMotore_application::print()
|
||||
if (_print_directly || save(TRUE)) // Registra il record corrente
|
||||
{
|
||||
TDocumento& doc = (TDocumento&)get_relation()->curr();
|
||||
const bool da_stampare = doc.stampabile();
|
||||
|
||||
const TTipo_documento& tipo = doc.tipo();
|
||||
TFilename rep(tipo.main_print_profile());
|
||||
rep.ext("rep");
|
||||
|
||||
TString commandline;
|
||||
if (rep.custom_path()) // Esiste il nuovo report :-)
|
||||
commandline = "ve1 -2";
|
||||
else // Esiste il vecchio form :-(
|
||||
commandline = "ve1 -0";
|
||||
|
||||
commandline << ' ' << doc.get(DOC_CODNUM) << ' ' << doc.get(DOC_ANNO) << ' ';
|
||||
commandline << doc.get(DOC_PROVV) << ' ' << doc.get(DOC_NDOC) << ' ' << doc.get(DOC_NDOC);
|
||||
commandline << ' ' << (da_stampare ? 'D' : 'P');
|
||||
|
||||
const int ncopie = tipo.ncopie();
|
||||
if (ncopie > 0)
|
||||
commandline << ' ' << ncopie;
|
||||
|
||||
TExternal_app interattivo( commandline );
|
||||
if (interattivo.run() == NOERR)
|
||||
TFilename rep;
|
||||
if (tipo.main_print_profile(rep))
|
||||
{
|
||||
if (da_stampare) // Aggiorna stato documento se necessario
|
||||
{
|
||||
const char s[2] = { tipo.stato_finale_stampa(), '\0' };
|
||||
TDocumento_mask & m = edit_mask();
|
||||
const bool da_stampare = doc.stampabile();
|
||||
|
||||
doc.put(DOC_STATO, s);
|
||||
TString commandline;
|
||||
if (rep.ends_with(".rep"))
|
||||
commandline = "ve1 -2"; // Esiste il nuovo report :-)
|
||||
else
|
||||
commandline = "ve1 -0"; // Esiste il vecchio form :-(
|
||||
|
||||
commandline << ' ' << doc.get(DOC_CODNUM) << ' ' << doc.get(DOC_ANNO) << ' ';
|
||||
commandline << doc.get(DOC_PROVV) << ' ' << doc.get(DOC_NDOC) << ' ' << doc.get(DOC_NDOC);
|
||||
commandline << ' ' << (da_stampare ? 'D' : 'P');
|
||||
|
||||
const int ncopie = tipo.ncopie();
|
||||
if (ncopie > 0)
|
||||
commandline << ' ' << ncopie;
|
||||
|
||||
TExternal_app interattivo( commandline );
|
||||
if (interattivo.run() == NOERR)
|
||||
{
|
||||
if (da_stampare) // Aggiorna stato documento se necessario
|
||||
{
|
||||
const char s[2] = { tipo.stato_finale_stampa(), '\0' };
|
||||
TDocumento_mask & m = edit_mask();
|
||||
|
||||
doc.put(DOC_STATO, s);
|
||||
|
||||
m.set(F_STATO, s, TRUE);
|
||||
m.set(F_STATO, s, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,35 +167,32 @@ void TDocumento_form::set_doc_ext(TRectype* doc)
|
||||
static TTipi_documento_cache __tipi;
|
||||
|
||||
TDocumento_form::TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, bool interattivo, bool aggiuntivo)
|
||||
: _firmrel(rel), _sorted_cur(NULL), _docfile(NULL), _rdocfile(NULL), _doc(NULL), _valid(FALSE)
|
||||
: _firmrel(rel), _sorted_cur(NULL), _docfile(NULL), _rdocfile(NULL), _doc(NULL), _valid(false)
|
||||
{
|
||||
_form = this;
|
||||
|
||||
const TString4 tipodoc(doc.get(DOC_TIPODOC));
|
||||
TFilename nomeform;
|
||||
const TTipo_documento & tipo = __tipi.tipo(tipodoc);
|
||||
|
||||
if (tipo.empty())
|
||||
const TTipo_documento& tipo = __tipi.tipo(tipodoc);
|
||||
if (tipo.empty())
|
||||
{
|
||||
error_box(FR("Tipo di documento non valido: '%s'"), (const char*)tipodoc);
|
||||
return;
|
||||
}
|
||||
if (tipo.printable())
|
||||
{ // se non ci sono errori procede con la stampa
|
||||
nomeform = aggiuntivo ? tipo.additional_print_profile() : tipo.main_print_profile(); // legge il nome del form di stampa
|
||||
nomeform.trim();
|
||||
|
||||
TFilename test(nomeform); test.ext("frm");
|
||||
if (!test.custom_path())
|
||||
{
|
||||
error_box(FR("Nome form di stampa '%s' non valido per il tipo documento %s"), (const char*)nomeform, (const char*)tipodoc);
|
||||
return;
|
||||
}
|
||||
bool found = false;
|
||||
TFilename nomeform;
|
||||
if (aggiuntivo)
|
||||
found = tipo.additional_print_profile(nomeform);
|
||||
else
|
||||
found = tipo.main_print_profile(nomeform);
|
||||
found &= nomeform.ends_with(".frm");
|
||||
if (!found)
|
||||
{
|
||||
error_box(FR("Nome form di stampa '%s' non valido per il tipo documento %s"), (const char*)nomeform, (const char*)tipodoc);
|
||||
return;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
_valid = TRUE;
|
||||
_valid = true;
|
||||
read(nomeform);
|
||||
_cli_loaded= FALSE;
|
||||
set_doc_ext(&doc); // istanzia TDocumentoEsteso
|
||||
@ -1439,22 +1436,25 @@ void TStampaDoc_application::print_selected()
|
||||
extdoc.scadenze_reset();
|
||||
|
||||
// Stampa eventuali documenti allegati
|
||||
const TFilename formagg = extdoc.tipo().additional_print_profile();
|
||||
const int ncopie2 = extdoc.tipo().get_int("I2");
|
||||
|
||||
if (!formagg.blank() && ncopie2 > 0) // Se esiste un tipo documento da accodare
|
||||
TFilename formagg;
|
||||
if (extdoc.tipo().additional_print_profile(formagg))
|
||||
{
|
||||
TDocumento_form* secform = new TDocumento_form(cur.curr(), *_firmrel, _definitiva, _interattivo, TRUE);
|
||||
if (secform->valid())
|
||||
{
|
||||
for (int i = 0; i < ncopie2; i++)
|
||||
{
|
||||
print_documento(*secform);
|
||||
extdoc.summary_reset();
|
||||
extdoc.scadenze_reset();
|
||||
}
|
||||
}
|
||||
delete secform;
|
||||
const int ncopie2 = extdoc.tipo().get_int("I2");
|
||||
|
||||
if (ncopie2 > 0) // Se esiste un tipo documento da accodare
|
||||
{
|
||||
TDocumento_form* secform = new TDocumento_form(cur.curr(), *_firmrel, _definitiva, _interattivo, true);
|
||||
if (secform->valid())
|
||||
{
|
||||
for (int i = 0; i < ncopie2; i++)
|
||||
{
|
||||
print_documento(*secform);
|
||||
extdoc.summary_reset();
|
||||
extdoc.scadenze_reset();
|
||||
}
|
||||
}
|
||||
delete secform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -804,48 +804,26 @@ bool TReport_doc_app::print_loop(const TString& query)
|
||||
doc.move_to(i);
|
||||
const TString& tipodoc = doc.get(DOC_TIPODOC).as_string();
|
||||
const TTipo_documento& tipo = _tipi_cache.tipo(tipodoc);
|
||||
TString16 codprof(tipo.main_print_profile());
|
||||
|
||||
codprof.trim();
|
||||
if (!codprof.blank())
|
||||
TFilename profilo;
|
||||
if (tipo.main_print_profile(profilo) && profilo.ends_with(".rep"))
|
||||
{
|
||||
TFilename profilo(codprof); profilo.ext("rep");
|
||||
|
||||
if (profilo.custom_path()) // Tenta di costruirsi il nome del report
|
||||
{
|
||||
TReport_doc& report = reports.get(profilo);
|
||||
if (!report.print(doc, book, is_definitive))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
TString msg; msg << TR("Report inesistente") << " : " << codprof;
|
||||
statbar_set_title(TASK_WIN, msg);
|
||||
beep(2);
|
||||
continue;
|
||||
}
|
||||
TReport_doc& report = reports.get(profilo);
|
||||
if (!report.print(doc, book, is_definitive))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
TString msg; msg << TR("Report inesistente") << " : " << profilo;
|
||||
statbar_set_title(TASK_WIN, msg);
|
||||
beep(2);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Stampa eventuali allegati
|
||||
TString16 codalleg(tipo.additional_print_profile());
|
||||
|
||||
codalleg.trim();
|
||||
if (!codalleg.blank())
|
||||
if (tipo.additional_print_profile(profilo) && profilo.ends_with(".rep"))
|
||||
{
|
||||
TFilename profilo(codalleg); profilo.ext("rep");
|
||||
|
||||
if (profilo.custom_path())
|
||||
{
|
||||
TReport_doc& allegato = reports.get(profilo);
|
||||
allegato.print(doc, book, is_definitive);
|
||||
}
|
||||
else
|
||||
{
|
||||
TString msg; msg << TR("Report allegato inesistente") << " : " << codalleg;
|
||||
statbar_set_title(TASK_WIN, msg);
|
||||
}
|
||||
TReport_doc& allegato = reports.get(profilo);
|
||||
allegato.print(doc, book, is_definitive);
|
||||
}
|
||||
}
|
||||
|
||||
|
10
ve/velib.h
10
ve/velib.h
@ -288,12 +288,12 @@ 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").empty(); }
|
||||
const TString & main_print_profile() const { return get("S5").left(8); }
|
||||
const TString & additional_print_profile() const { return get("S5").mid(8); }
|
||||
bool printable() const { return get("S5").not_empty(); }
|
||||
bool main_print_profile(TFilename& report) const;
|
||||
bool additional_print_profile(TFilename& report) const;
|
||||
|
||||
TFormula_documento * first_formula() { return succ_formula(true); }
|
||||
TFormula_documento * succ_formula(bool restart = FALSE);
|
||||
TFormula_documento* first_formula() { return succ_formula(true); }
|
||||
TFormula_documento* succ_formula(bool restart = FALSE);
|
||||
|
||||
const int ncopie() const { return get_int("I0"); }
|
||||
bool spese_aut() const { return get_bool("B0"); }
|
||||
|
@ -51,6 +51,47 @@ const TFilename& TTipo_documento::profile_name(TFilename& profile) const
|
||||
return profile;
|
||||
}
|
||||
|
||||
bool TTipo_documento::main_print_profile(TFilename& report) const
|
||||
{
|
||||
TString16 base = get("S5");
|
||||
base.cut(8);
|
||||
base.trim();
|
||||
bool ok = base.not_empty();
|
||||
if (ok)
|
||||
{
|
||||
report = base;
|
||||
report.ext("rep");
|
||||
ok = report.custom_path();
|
||||
if (!ok)
|
||||
{
|
||||
report = base;
|
||||
report.ext("frm");
|
||||
ok = report.custom_path();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TTipo_documento::additional_print_profile(TFilename& report) const
|
||||
{
|
||||
TString16 base = get("S5");
|
||||
base.ltrim(8); base.rtrim();
|
||||
bool ok = base.not_empty();
|
||||
if (ok)
|
||||
{
|
||||
report = base;
|
||||
report.ext("rep");
|
||||
ok = report.custom_path();
|
||||
if (!ok)
|
||||
{
|
||||
report = base;
|
||||
report.ext("frm");
|
||||
ok = report.custom_path();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
const char TTipo_documento::tipocf() const
|
||||
{
|
||||
if (_tipocf < ' ')
|
||||
|
Loading…
x
Reference in New Issue
Block a user