From c4abf9b089c26558808aafb05fa2a18d980b2a63 Mon Sep 17 00:00:00 2001 From: luca83 Date: Fri, 29 Jan 2010 10:19:33 +0000 Subject: [PATCH] Patch level : NO PATCH Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@20018 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- lv/lv2400.cpp | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/lv/lv2400.cpp b/lv/lv2400.cpp index a69703e01..8cd016a31 100755 --- a/lv/lv2400.cpp +++ b/lv/lv2400.cpp @@ -948,24 +948,41 @@ bool TGenera_documenti_app::transfer() if (_msk->get_bool(F_STAMPA)) { - //preparo il pezzo fisso della linea di comando per richiamare la stampa dei documenti - TDoc_key kd(documenti.get_hashobj()->key()); - const TString4 codnum = kd.codnum(); - const int anno = kd.anno(); - const char provv = kd.provv(); + TFilename tmp; + tmp.temp("", "ini"); - TDoc_key& dk1 = *(TDoc_key*)documenti.first_item(); - const int dandoc = dk1.ndoc(); + // Ensure that the ofstream is well closed before ve1 call + if (tmp.full()) // dummy test + { + TDoc_key kd(documenti.get_hashobj()->key()); + TString16 chiavedoc; // Parte della chiave comune a tutti i documenti + chiavedoc << kd.provv() << '|' << kd.anno() << '|' << kd.codnum() << '|'; - TDoc_key& dk2 = *(TDoc_key*)documenti.last_item(); - const int andoc = dk2.ndoc(); + ofstream outf(tmp); + outf << "[Transaction]" << endl; // Transaction header + outf << "Action=S" << endl; // 'S'tampa o 'A'nteprima + outf << "Mode=D" << endl; // Definitive (always?) + outf << "NoPrintDlg=X" << endl; // Dont' prompt the user with the print dialog + outf << endl; + outf << "[33]" << endl; // Transaction body + long nx = 0; // Document counter + + FOR_EACH_ASSOC_OBJECT(documenti, obj, r, riga) + { + TDoc_key& kdoc = *(TDoc_key*)riga; + outf << "Doc(" << (nx++) << ")="; + int cazzone = kdoc.ndoc(); + outf << chiavedoc << kdoc.ndoc() << endl; + } + } - //lancia la stampa dei documenti ve1 -2 da documento a documento - TString80 str; - str << "ve1 -2 " << codnum << ' ' << anno << ' ' << provv << ' ' << dandoc << '-' << andoc << " S D"; - - TExternal_app stampa(str); - stampa.run(); + if (tmp.exist()) + { + TString cmdline; cmdline << "ve1 -2 -i" << tmp; + TExternal_app app(cmdline); + app.run(); + tmp.fremove(); + } } if (adata < TODAY && _msk->get_int(F_TPGEN) == 0)