From 4d1845e1c4c12426d8c182439e2f66c05edff46c Mon Sep 17 00:00:00 2001 From: nik Date: Fri, 5 Jan 1996 11:55:13 +0000 Subject: [PATCH] Corretti errori MI0921 e MI0939 e segnalazione con fax da VLADIMIRO del 14.12.95 git-svn-id: svn://10.65.10.50/trunk@2393 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg3400.cpp | 74 +++++++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/cg/cg3400.cpp b/cg/cg3400.cpp index 68d2ffd34..da4052faf 100755 --- a/cg/cg3400.cpp +++ b/cg/cg3400.cpp @@ -115,7 +115,8 @@ class CG3400_application : public TPrintapp static bool filter_func(const TRelation * r); static bool filtra_reg (const TRelation * r); - + int righe_rimaste() const; + private: TRelation* _rel; TCursor* _cur; @@ -133,8 +134,7 @@ private: long _num_rig; real _importo; char _sezione; - // TParagraph_string* _descr_conto; - + int _pagine_contate; // cnt pag. stampate. public: TDate _inizioEs, _fineEs; // date inizio e fine esercizio TRigaiva_array _iva_array; @@ -168,15 +168,14 @@ public: TLocalisamfile * _com, *_clifo,*_pconti,*_nditte,*_anag, *_causali; TLocalisamfile* _attiv; // da togliere in futuro (?) - TTable *_tabreg, *_tabval, *_tabes, *_tabiva; public: - virtual void preprocess_header(); virtual void preprocess_footer(); virtual bool preprocess_page(int, int); virtual print_action postprocess_page(int, int); + virtual print_action postprocess_print(int, int); virtual bool preprocess_print(int, int); virtual void postclose_print(); // virtual bool cancel_hook(); @@ -219,7 +218,7 @@ public: void update_totals (char sezione, real& importo); void set_reg_filter(TMask& m); - CG3400_application() {}; + CG3400_application() : _pagine_contate(0) {}; virtual ~CG3400_application() {}; }; @@ -505,8 +504,7 @@ void CG3400_application::postclose_print() { if (_stampa_definitiva) { - const int ultima_fatta = printer().getcurrentpage() - 1; - + const int ultima_fatta = _pagine_contate; if (yesno_box("La stampa e' corretta ?")) { aggiorna_mov (); @@ -543,8 +541,7 @@ void CG3400_application::preprocess_footer() // 2. Sono sull'ultima riga // - const bool riporta = _forza_ariportare || - (!_gia_settato_ariportare && _cur->pos() < _cur->items()-1); + const bool riporta = _forza_ariportare || (!_gia_settato_ariportare && _cur->pos() < _cur->items()-1); if (riporta) { @@ -588,8 +585,6 @@ int CG3400_application::set_totali_pagina(int righe) ap = TRUE; } - // SONO SULL'ULTIMO ???????????? SI O NO ???????????? - // if (_cur->pos() >= _cur->items()-1) // se sono sull'ultimo if (_cur->pos() == _cur->items()-1) // se sono sull'ultimo { // I totali distinti tra anno precedente e corrente SOLO SE STAMPA DI PROVA @@ -610,7 +605,7 @@ int CG3400_application::set_totali_pagina(int righe) ); set_row (r++, (const char*) riga); - + if (ap) { riga.format("@b@%dgTotale progressivi anno precedente @%dg%c %s @%dg%c @%dg%s", @@ -625,8 +620,8 @@ int CG3400_application::set_totali_pagina(int righe) ); set_row (r++, (const char*) riga); } - } // !stampa_definitiva - + } // stampa_definitiva + _tot_dare_generale = _tot_dare_progr + _tot_dare_progr_ap; _tot_avere_generale = _tot_avere_progr + _tot_avere_progr_ap; dts = _tot_dare_generale.string (TOT_PICTURE); @@ -647,10 +642,13 @@ int CG3400_application::set_totali_pagina(int righe) } else // Non ancora totale generale { -// Se il movimento ha righe che continuano nella pagina successiva -// "A riportare" viene stampato dalla preprocess_footer senno' qui +// Determina se le righe settate finora stanno in questa pagina oppure no + _gia_settato_ariportare = righe_rimaste() > righe; - _gia_settato_ariportare = TRUE; +// La fill_page mette forza_ariportare a TRUE +// nel caso di pagine con solo i totali (v. fax VLADIMIRO) bisogna impedire +// che venga stampato di nuovo "Totale ..." nella preprocess_footer + _forza_ariportare = FALSE; dt = _tot_dare_progr + _tot_dare_progr_ap; at = _tot_avere_progr + _tot_avere_progr_ap; @@ -780,7 +778,7 @@ void CG3400_application::preprocess_header() TString256 riporto; real riporto_dare, riporto_avere; - _gia_settato_ariportare = FALSE; +// _gia_settato_ariportare = FALSE; if (pag > 0) // Stampa riporti { @@ -864,6 +862,14 @@ bool CG3400_application::preprocess_print(int file, int counter) } ***/ +int CG3400_application::righe_rimaste() const +{ + int rows_left = printer().rows_left(); + if (rows_left <= 0) + rows_left = printer().formlen() - (printer().headersize()+1) - printer().footersize(); + return rows_left; +} + void CG3400_application::fill_page(int start_riga, int righe_iva_settate) { TString256 rigas; @@ -875,15 +881,8 @@ void CG3400_application::fill_page(int start_riga, int righe_iva_settate) _forza_ariportare = TRUE; } int r_l = rows_left - start_riga - righe_iva_settate; -/******* - if (r_l < 0) - { - // Tolgo l'intestazione + la riga con i riporti - r_l += printer().formlen() - (printer().headersize() + 1); - _forza_ariportare = TRUE; - } -****/ - // Se sono rimaste righe da riempire + +// Se sono rimaste righe da riempire if (r_l > 0) { rigas.fill('=', _stampa_width); @@ -902,6 +901,13 @@ void CG3400_application::fill_page(int start_riga, int righe_iva_settate) } } +print_action CG3400_application::postprocess_print(int file, int counter) +{ + if (file == LF_MOV) + _pagine_contate = printer().getcurrentpage() - 1; + return NEXT_PAGE; +} + print_action CG3400_application::postprocess_page(int file, int counter) { int righe_iva_settate=0; @@ -910,7 +916,7 @@ print_action CG3400_application::postprocess_page(int file, int counter) if (counter) { if (_nuovo_mese) { - if (!_stampa_definitiva) // su bollato ho gia' barrato il foglio fino in fondo +// if (!_stampa_definitiva) // su bollato ho gia' barrato il foglio fino in fondo printer().formfeed(); _nuovo_mese = FALSE; } @@ -920,7 +926,6 @@ print_action CG3400_application::postprocess_page(int file, int counter) switch (file) { case LF_MOV: - reset_print(); righe_iva_settate = 0; if (_libro_giornale_iva_unico) @@ -963,6 +968,7 @@ print_action CG3400_application::postprocess_page(int file, int counter) // Sposto qui per evitare di aggiornare i progressivi con una riga della // pagina dopo update_totals(_sezione, _importo); + _gia_settato_ariportare = FALSE; break; default: break; @@ -1295,8 +1301,12 @@ int CG3400_application::setta_righe_iva() { TRigaiva& riga = (TRigaiva&)_iva_array[j]; r = j+1; - set_row(r, " Imponibile@15g%r", &riga._imponibile); - set_row(r, "@31gImposta@39g%r", &riga._imposta); + TString impon_str(riga._imponibile.string(REAL_PICTURE)); + TString impos_str(riga._imposta.string(REAL_PICTURE)); +// set_row(r, " Imponibile@15g%15r", &riga._imponibile); +// set_row(r, "@31gImposta@39g%15r", &riga._imposta); + set_row(r, " Imponibile@15g%15s", (const char*)impon_str); + set_row(r, "@31gImposta@39g%15s", (const char*)impos_str); // set_row(r, "@58gCod.Iva@68g%3s", (const char*)riga._codiva); set_row(r, "@56gCod.Iva %3s", (const char*)riga._codiva); const TString80 codiva_des(get_codiva_des(riga._codiva));