diff --git a/sc/sc2100.cpp b/sc/sc2100.cpp index 6d3eca1a0..01ceb2fea 100755 --- a/sc/sc2100.cpp +++ b/sc/sc2100.cpp @@ -246,7 +246,7 @@ void TEC_row::print_on(TPrint_section& body) TForm_item& causale = body.find_field(PEC_CODCAUS); causale.set(_causale); - TForm_item& descr = body.find_field(PEC_DESCR1); + TForm_item& descr = body.find_field(PEC_DESCR); if (num_reg() > 0) // Riga di partita vera e propria (non totale parziale) { diff --git a/sc/sc21pec.h b/sc/sc21pec.h index 42d51f67e..543fe1b98 100755 --- a/sc/sc21pec.h +++ b/sc/sc21pec.h @@ -7,9 +7,7 @@ #define PEC_MEMO 103 #define PEC_CODCAUS 201 -#define PEC_DESCR1 202 -#define PEC_DESCR2 203 -#define PEC_DESCR3 204 +#define PEC_DESCR 202 #define PEC_DATADOC 205 #define PEC_NUMDOC 206 #define PEC_PROTIVA 207 diff --git a/sc/sc2401.cpp b/sc/sc2401.cpp index 47639b89b..73b3dfc40 100755 --- a/sc/sc2401.cpp +++ b/sc/sc2401.cpp @@ -158,7 +158,7 @@ void TESSL_row::print_on(TPrint_section& body) _descrizione = causali.decode(_causale); } - TForm_item& descr = body.find_field(PEC_DESCR1); + TForm_item& descr = body.find_field(PEC_DESCR); if (num_reg() > 0) // Riga di partita vera e propria (non totale parziale) { TString s(80); s = descr.prompt(); @@ -505,22 +505,10 @@ void TESSL_form::stampa_testata(TPrinter& pr) head.update(); const word r = head.height()-1; - TPrintrow& head_row = head.row(r-1); - - TPrint_section& body = section('B'); - for (int f = body.fields()-1; f >= 0; f--) - { - // Leggi lo special e stampalo - TForm_item& fi = body.field(f); - if (fi.shown()) - { - const int x = offset_x() + fi.x() - 1; // Le TPrintrow partono da 0, bestia! - head_row.put(fi.key(), x); - } - } for (word j = 0; j <= r; j++) pr.setheaderline(j, head.row(j)); + } static int tot_compare(const void* o1, const void* o2) @@ -553,9 +541,9 @@ void TESSL_form::stampa_riporti(TPrinter& pr) THash_object* tot[MAXTOT]; _num_rip = ordina_totali_per_valuta(tot); - const word maxtot = section('F').height() - 1; - if (_num_rip > maxtot) - _num_rip = maxtot; +// const word maxtot = section('F').height() - 1; + if (_num_rip > _maxtot) + _num_rip = _maxtot; const TString& riporto = describe(PEC_RIPORTO); @@ -654,6 +642,8 @@ void TESSL_form::print_total(int riga, const THash_object& o) TString_array prompt(MAXID); TPrint_section& foot = section('F'); + TPrint_section& body = section('B'); + const TForm_item& bdesc = body.find_field(PEC_DESCR); // Sostituisce magic-names nei prompt TString s(80); @@ -666,6 +656,8 @@ void TESSL_form::print_total(int riga, const THash_object& o) prompt.add(s, i); change_magic_footer(o, s); desc_field.set_prompt(s); + if (desc_field.x() <= 0) + desc_field.x() = bdesc.x(); } } @@ -673,7 +665,6 @@ void TESSL_form::print_total(int riga, const THash_object& o) const TImporto& imp = t.importo(); TForm_item& dare = foot.find_field(PEC_DARE); TForm_item& avere = foot.find_field(PEC_AVERE); - TPrint_section& body = section('B'); if (dare.x() <= 0 || avere.x() <= 0) { @@ -744,9 +735,9 @@ void TESSL_form::stampa_pedata(TPrinter& pr) // La prima riga del footer deve essere lasciata libera per la fincatura // Ogni sottosezione di totale occupa _total_rows righe: per cui devo calcolare // quanti totali ci stanno nelle righe riservate al footer - const word maxtot = (section('F').height()-1) / _total_rows; - if (num_rip > maxtot) - num_rip = maxtot; +// const word maxtot = (section('F').height()-1) / _total_rows; + if (num_rip > _maxtot) + num_rip = _maxtot; for (word j = 0; j < num_rip; j++) print_total(j*_total_rows+1, *tot[j]); @@ -885,11 +876,6 @@ void TESSL_form::init_header(const TMask& m) fi.set(f.get("TESTO")); } - if (_fincatura) - { - TPrint_section& fink = section('G'); - if (fink.fields() > 0) fink.update(); // Setta il backgroud di stampa - } } TESSL_form::TESSL_form(const TESSL_mask& m, bool gesval, short id_datalim, short id_datascad, @@ -898,7 +884,7 @@ TESSL_form::TESSL_form(const TESSL_mask& m, bool gesval, short id_datalim, short _in_valuta(FALSE), _num_rip(0), _total_rows(0), _causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR), _movimenti(LF_MOV, MOV_NUMREG, MOV_DESCR), - _valute("%VAL"), _giorni_rischio(0) + _valute("%VAL"), _giorni_rischio(0), _maxtot(1) { _form = this; @@ -929,6 +915,7 @@ TESSL_form::TESSL_form(const TESSL_mask& m, bool gesval, short id_datalim, short TToken_string f(flags.prompt()); _in_valuta = gesval && f.get_char(0) == 'X'; // Il profilo e' in valuta se c'e' il flag di valuta _fincatura = f.get_int(1); + genera_intestazioni(odd_page, head.height() - 1); init_header(m); // Set fixed text pr.setfooterhandler(footer_handler); @@ -945,6 +932,21 @@ TESSL_form::TESSL_form(const TESSL_mask& m, bool gesval, short id_datalim, short if (y > _total_rows) _total_rows = y; } + } + _maxtot = f.get_int(3); + if (_maxtot <= 0 || _maxtot > ((int)foot.height() - 2) / _total_rows) + _maxtot = (foot.height() - 2) / _total_rows; + + int rows[] = { (int)head.height(), (int)(pr.formlen() - foot.height() + 1), 0}; + if (_fincatura) + { + TPrint_section& fink = section('G'); + + genera_fincatura(odd_page, rows[0] - 2, rows[1] + (_maxtot * _total_rows) + 2, rows); + if (fink.fields() > 0) + { + fink.update(); // Setta il backgroud di stampa + } } } diff --git a/sc/sc2401.h b/sc/sc2401.h index 0187ba4d8..9e8ba4cd3 100755 --- a/sc/sc2401.h +++ b/sc/sc2401.h @@ -63,8 +63,8 @@ class TESSL_row : public TSortable real _esposto; // Importo esposto bool _salvo_buon_fine; // Importo esposto salvo buon fine real _totale; // Totale documento - TValuta _valuta; // Codice valuta, data cambio e cambio - + TValuta _valuta; // Codice valuta, data cambio e cambio + protected: // TSortable virtual int compare(const TSortable& s) const; void set_imp(TForm_item& fi, const real& imp, bool valuta) const; @@ -127,6 +127,7 @@ class TESSL_form : public TForm int _fincatura; // 0 = nessuna, 1 = testo, 2 = grafica word _num_rip; // numero di righe usate per i riporti word _total_rows; // numero di righe usate per i totali + int _maxtot; // numero massimo di totali char _who; protected: