diff --git a/m770/77stba.cpp b/m770/77stba.cpp index 9eb60a525..57a13ac1b 100755 --- a/m770/77stba.cpp +++ b/m770/77stba.cpp @@ -142,7 +142,7 @@ void TBase1::stampa_soci(TPrinter& pr) sDataNa=c->file(LF_ANAGFIS).get("DATANASC"); sSesso=c->file(LF_ANAGFIS).get("SESSO"); sComuneNa=c->file(LF_COMUNI).get("DENCOM"); - sComuneNa.cut(28); + sComuneNa.cut(23); sProvNa=c->file(LF_COMUNI).get("PROVCOM"); if (sRagsoc.len() > 30 && sRagsoc[30] != ' ') { @@ -153,6 +153,7 @@ void TBase1::stampa_soci(TPrinter& pr) sRagsoc = sCognome; sRagsoc << " " << sNome; } + sRagsoc.cut(28); rg.put(sRagsoc,fut.field(0).x()-1); fut.field(1).set(sSesso); rg.put(sSesso,fut.field(1).x()-1); @@ -258,20 +259,20 @@ void TBase3::stampa_testata(TPrinter& pr) progind()->addstatus(1); } -int TBase3::stampa_L(TPrinter& pr,const int iChiaveL) +int TBase3::stampa_L(TPrinter& pr) { long codit=0L; TPrint_section& body = section('B', odd_page); body.reset(); TCursor& cur = *cursor(); -// Le chiavi nel file e nel .ini sono saggiamente scambiate - if (iChiaveL==2) + +/* if (iChiaveL==2) cur.setkey(1); else cur.setkey(2); -// filtra(_codditta); + filtra(_codditta); */ bool finito=FALSE; int righe=0; @@ -299,6 +300,15 @@ int TBase3::stampa_L(TPrinter& pr,const int iChiaveL) return righe; } +void TBase3::reset_totali_L() +{ + TPrint_section& hh = section('F', last_page); + TForm_item& t1 = hh.find_field(1); + TForm_item& t2 = hh.find_field(2); + t1.set(""); + t2.set(""); +} + void TBase3::stampa_totali_L(TPrinter& pr) { // La sezione f last contiene solo due totali aggiornati con add nel form @@ -321,16 +331,26 @@ bool TBase3::print(const long codditta, const long NumFis, const long NumNoFis) TCursor* cur = cursor(); TPrinter& pr = printer(); _codditta=codditta; - filtra(codditta); +// filtra(codditta); + reset_totali_L(); _RigaCorr=0; - (*cur)=0L; + jump_to_line(pr, prima_riga(PRIMA)); // Stampa i codici concessione e tesoreria stampa_testata(pr); // Legge dai par.studio l'ordinamento da usare per L TConfig conf(CONFIG_STUDIO); const int iChiaveL = (int)conf.get_long("FlStQl", "77"); - const int righe_stampate=stampa_L(pr,iChiaveL); +// Le chiavi nel file e nel .ini sono saggiamente scambiate + if (iChiaveL==2) + cur->setkey(1); + else + cur->setkey(2); + + filtra(_codditta); + (*cur)=0L; + + const int righe_stampate=stampa_L(pr); // Se la stampa prosegue i totali vanno sull'aggiuntivo NON qui if (!_bAggiuntivoL) { @@ -1048,10 +1068,12 @@ bool TQuadroL::stampa_L(TPrinter& pr,const long lStartRec,const int iRecL) return TRUE; else cur=lStartRec; - bool finito=FALSE; + bool bFinitaPagina=FALSE; int righe=0; - - while (!finito) + const long items = cur.items(); + +// while (!finito && !eof) + while ( (cur.pos() < items) && !bFinitaPagina ) { body.update(); const int body_righe = body.height(); @@ -1066,9 +1088,10 @@ bool TQuadroL::stampa_L(TPrinter& pr,const long lStartRec,const int iRecL) progind()->addstatus(1); righe++; ++cur; - eof=cur.pos()==cur.items()-1; - finito = (righe==iRecL) || eof; - } +// eof=cur.pos()==cur.items(); + bFinitaPagina = (righe==iRecL); + } + eof=cur.pos() >= items-1; return eof; } @@ -1103,8 +1126,10 @@ void TQuadroL::stampa_totali_L(TPrinter& pr) real rTotVer(totVer.get()); rTotEff += _rTotEff; rTotVer += _rTotVer; - totEff.set(_rTotEff.string()); - totVer.set(_rTotVer.string()); + totEff.set(rTotEff.string()); + totVer.set(rTotVer.string()); + totEff.update(); + totVer.update(); const int lasty = calcola_firma(); const int hhr = hh.height(); for (int i = 0; i < hhr; i++) @@ -1116,7 +1141,8 @@ void TQuadroL::stampa_totali_L(TPrinter& pr) progind()->addstatus(1); } -const int _START_AGG_L=17; +const int _START_AGG_L=16; + const int _REC_PRIMA_AGG_L=12; const int _REC_SECONDA_AGG_L=14; const int _RIGA_TOTALI_AGG_L=60; @@ -1125,13 +1151,19 @@ void TQuadroL::calcola_totali_precedenti() { TCursor* cur = cursor(); _rTotEff = _rTotVer = ZERO; - for ((*cur)=0L; cur->pos() < _START_AGG_L-1; ++(*cur) ) + for ((*cur)=0L; cur->pos() < _START_AGG_L; ++(*cur) ) { _rTotEff += cur->curr().get_real("QLRITEFF"); _rTotVer += cur->curr().get_real("QLRITVER"); } } +void TQuadroL::reset_totali_L() +{ + TPrint_section& hh = section('F', last_page); + hh.reset(); +} + bool TQuadroL::print(const long codditta, const long NumFis, const long NumNoFis) { TCursor* cur = cursor(); @@ -1141,11 +1173,9 @@ bool TQuadroL::print(const long codditta, const long NumFis, const long NumNoFis return FALSE; // Non stampare se non ci sono record - if (cur->items() < _START_AGG_L-1) + if (cur->items() < _START_AGG_L) return FALSE; - calcola_totali_precedenti(); - // Legge dai par.studio l'ordinamento da usare per L TConfig conf(CONFIG_STUDIO); const int iChiaveL = (int)conf.get_long("FlStQl", "77"); @@ -1154,9 +1184,11 @@ bool TQuadroL::print(const long codditta, const long NumFis, const long NumNoFis else cur->setkey(2); + calcola_totali_precedenti(); + pr.formlen(dic_form_len()); -// int lOffsetL=_START_AGG_L; - int lOffsetL=15; + int lOffsetL=_START_AGG_L-1; +// int lOffsetL=15; (*cur)=lOffsetL; bool finito=FALSE; while (!finito) @@ -1564,12 +1596,12 @@ bool TQuadroN::print(const long codditta, const long NumFis, const long NumNoFis _PaginaPosizionamento=FALSE; next_page(pr); pr.formlen(TDicForm::dic_form_len()); - bool FinitoN = ptrN == _righeN.items(); - bool FinitoP = ptrP == _righeP.items(); - bool FinitoQ = ptrQ == _righeQ.items(); - bool FinitoR = ptrR == _righeR.items(); - bool FinitoS = ptrS == _righeS.items(); - bool FinitoT = ptrT == _righeT.items(); + bool FinitoN = ptrN >= _righeN.items(); + bool FinitoP = ptrP >= _righeP.items(); + bool FinitoQ = ptrQ >= _righeQ.items(); + bool FinitoR = ptrR >= _righeR.items(); + bool FinitoS = ptrS >= _righeS.items(); + bool FinitoT = ptrT >= _righeT.items(); done = FinitoN && FinitoP && FinitoQ && FinitoR && FinitoS && FinitoT; } close_print(); diff --git a/m770/77stba.h b/m770/77stba.h index 2cd10a47d..ebb56f878 100755 --- a/m770/77stba.h +++ b/m770/77stba.h @@ -56,8 +56,9 @@ class TBase3 : public TDicForm protected: void stampa_testata(TPrinter& pr); void stampa_totali_L(TPrinter& pr); + void reset_totali_L(); bool aggiuntivoL() const { return _bAggiuntivoL; } - int stampa_L(TPrinter& pr,const int iChiaveL); + int stampa_L(TPrinter& pr); virtual int dic_form_len() const { return BASE_FORMLEN; } virtual void next_page(TPrinter& pr) { fill_page(pr, -1); } virtual void set_body(TPrinter& pr, const char tipo) {} @@ -255,6 +256,7 @@ class TQuadroL : public TDicForm long _codditta; real _rTotEff, _rTotVer; int _num_foglio; + void reset_totali_L(); void calcola_totali_precedenti(); protected: void stampa_testata(TPrinter& pr);