From 4dafef59bf4d51c3be6109698a2add90ceb31d28 Mon Sep 17 00:00:00 2001 From: luca Date: Wed, 12 May 2004 14:48:33 +0000 Subject: [PATCH] Patch level :2.1 040 Files correlati :cg4.exe Ricompilazione Demo : [ ] Commento : Bug 0000045 Sia per la stampa di prova che per il bollato indicare i totali progressivi e i totali a riporto git-svn-id: svn://10.65.10.50/trunk@12070 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg4400.cpp | 92 +++++++++++++++++++++++++++++++++++++++++++++------ cg/cg4400.h | 6 ++-- 2 files changed, 85 insertions(+), 13 deletions(-) diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index 0ab3782ad..da6479a5e 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -34,7 +34,7 @@ static enum tipo_sospensione { nessuna, normale, vol_affari, liquidazione }; inline TStampa_registri_app& app() { return (TStampa_registri_app&)main_app(); } -#define RIGHE_FOOTER 1 // Righe da saltare nel footer per evitare di scrivere sulla perforazione +#define RIGHE_FOOTER 3 // Righe da saltare nel footer per evitare di scrivere sulla perforazione bool TStampa_registri_app::filter_func (const TRelation * r) @@ -1537,7 +1537,15 @@ void TStampa_registri_app::set_page_tot_reg() int rr=1; rr = stampa_prospetto(rr, FALSE); - + //*****deve azzerare i totali progressivi dei riporti e segnalare all'header di non stampare + //la riga di riporto + _totali_stampati = true; //siamo in stampa totali, quindi... + _riporti_stampati = false; //inoltre non deve stapare riporti mentre stampa i totali + + _totdoc_prog = 0; + _totimpn_prog = 0; + _totimps_prog = 0; + if (_esiste_riga_iva && _stampa) { for (int prospetto = 0; prospetto < 2; prospetto++) @@ -1996,6 +2004,8 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) { _auto_intraf = FALSE; printer().formfeed(); + _totali_stampati = false; //siamo al cambio periodo (mese/trimestre),quindi resetto il flag di stampa totali + _riporti_stampati = false;//e pure quello dei riporti,visto che "A Riporto" non va nella prima pagina del mese } _dataregp = _datareg; @@ -2100,6 +2110,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) //setto le righe di stampa _r = 1; + if (!_stampa_data_reg) set_row(_r, "%s", (const char* ) _datareg.string(brief, '/')); set_row(_r, "@9g%5ld", protiva); @@ -2113,7 +2124,11 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) set_row(_r, "@68g%2s", (const char*) _tipodoc); if (_stampa_width == 132) set_row(_r, "@70g%r", &totdoc); - else set_row(_r, "@78g%r", &totdoc); + else + set_row(_r, "@78g%r", &totdoc); + //*****aggiornamento del totale documento progressivo + _totdoc_prog += totdoc; + if (_tipo_stampa == prova) //in caso di stampa di prova { if (! (_tipo_reg == vendita && _corrispettivi)) //e se non si tratta di registro vendite corrispettivi @@ -2178,10 +2193,16 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) if (_stampa_width == 132) { set_row(rr, "@85g%r", &riga._imponibile); + //*****aggiornamento del totale imponibile progressivo + _totimpn_prog += riga._imponibile; + set_row(rr, "@101g%4s",(const char*)riga._codiva); if (_tipo_reg == acquisto) set_row(rr, "@106g%d", riga._tipodet); set_row(rr, "@107g%r", &riga._imposta); + //*****aggiornamento del totale imposta progressivo + _totimps_prog += riga._imposta; + set_row(rr, "@123g%d", riga._tipocr); if (_tipoatt == "E" && _tipo_reg != acquisto) set_row(rr, "@125g%d", riga._tipoatt); @@ -2191,10 +2212,16 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) else //stampa a 198 { set_row(rr, "@93g%r", &riga._imponibile); + //*****aggiornamento del totale imponibile progressivo + _totimpn_prog += riga._imponibile; + set_row(rr, "@109g%4s",(const char*)riga._codiva); if (_tipo_reg == acquisto) set_row(rr, "@114g%d", riga._tipodet); set_row(rr, "@116g%r", &riga._imposta); + //*****aggiornamento del totale imposta progressivo + _totimps_prog += riga._imposta; + if (_tipoatt == "E" && _tipo_reg != acquisto) set_row(rr, "@132g%d", riga._tipoatt); set_row(rr, "@134g%d", riga._tipocr); @@ -2274,7 +2301,7 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter) if (counter) //dopo aver fatto un REPEAT_PAGE (cioe' dopo aver stampato //le righe settate in set_page_tot_reg()), in pratica a rottura di mese o alla fine { - reset_print(); + reset_print(); TRecnotype pos = _cur->pos(); long items = _cur->items(); @@ -2469,7 +2496,8 @@ void TStampa_registri_app::preprocess_header() // cosi' sono sicura che l'aggiornamento viene fatto ad ogni salto pagina // (cioe' a rottura di mese) - if (_tipo_stampa != prova) aggiorna_reg(_ok_vidi); + if (_tipo_stampa != prova) + aggiorna_reg(_ok_vidi); r++; @@ -2478,7 +2506,8 @@ void TStampa_registri_app::preprocess_header() if (_intesta_liq) set_header(r, FR("Registro IVA: %s %s %s"), (const char*)_codreg, (const char*)_desc_lib, (const char*) data); - else set_header(r, FR("Registro IVA: %s %s %s Attivita\' %s %s"), + else + set_header(r, FR("Registro IVA: %s %s %s Attivita\' %s %s"), (const char*) _codreg, (const char*) _desc_lib, (const char*) data, (const char*) _codatt, (const char*) _attivita); @@ -2498,8 +2527,8 @@ void TStampa_registri_app::preprocess_header() if (!_intesta_liq) { r++; - set_header(r, riga); - r++; + set_header(r++, riga); + if (_tipo_reg == vendita) //registro vendite { cor = 'R'; @@ -2581,11 +2610,45 @@ void TStampa_registri_app::preprocess_header() if (_tipo_reg != riepilogativo) if (_stampa_ind_comp && !_intesta_vidi) set_header(r++, FR("@38gGeneralita'")); - - set_header(r, riga); + + set_header(r++, riga); + + //*****valori della riga Riporto + if (_riporti_stampati) + { + if (_stampa_width == 132) + set_header(r++, FR("@0gRiporto progressivi@70g%s@85g%s@107g%s"), _totdoc_prog.stringa(15,2), _totimpn_prog.stringa(15,2), _totimps_prog.stringa(15,2)); + if (_stampa_width == 198) + set_header(r++, FR("@0gRiporto progressivi@78g%s@93g%s@116g%s"), _totdoc_prog.stringa(15,2), _totimpn_prog.stringa(15,2), _totimps_prog.stringa(15,2)); + + set_header(r++, riga); + _totali_stampati = false; + } } } +void TStampa_registri_app::preprocess_footer() +{ + reset_footer(); + + if (!_totali_stampati) + { + int r=1; + TString riga(_stampa_width); + riga.fill('-'); + set_footer(r++, riga); + if (_stampa_width == 132) + set_footer(r++, FR("@0gTotale progressivi@70g%s@85g%s@107g%s"), _totdoc_prog.stringa(15,2), _totimpn_prog.stringa(15,2), _totimps_prog.stringa(15,2)); + if (_stampa_width == 198) + set_footer(r++, FR("@0gTotale progressivi@78g%s@93g%s@116g%s"), _totdoc_prog.stringa(15,2), _totimpn_prog.stringa(15,2), _totimps_prog.stringa(15,2)); + + set_footer(r++, riga); + _riporti_stampati = true; + } + else + _riporti_stampati = false; +} + bool TStampa_registri_app::stampo_liquidazione(int mese) { //test tradotti alla lettera da AS/400 @@ -3151,7 +3214,7 @@ void TStampa_registri_app::send_message(char tipo, const TFilename& nome, int me if (_riep_liq) ss.add('X'); else ss.add(' '); - //ss.add(_size_header+RIGHE_FOOTER); + ss.add(printer().formlen() - _size_header - RIGHE_FOOTER); TMessage liq (app, "RCL", ss); @@ -3191,6 +3254,13 @@ bool TStampa_registri_app::set_print(int n) { if (_selected.ones() > 0l) { + //*****azzeramento dei totali progressivi e dei flag di controllo della loro stampa + _totdoc_prog = 0; + _totimpn_prog = 0; + _totimps_prog = 0; + _riporti_stampati = false; + _totali_stampati = false; + _annoes = m.get_int(ANNO);//in realta' e' l'anno IVA !!! _tipo_stampa = (tipo_stampa) m.get_int(TIPO_STAMPA); _stampa_width = m.get_int(STAMPA_WIDTH); diff --git a/cg/cg4400.h b/cg/cg4400.h index 3465076dd..cadc018eb 100755 --- a/cg/cg4400.h +++ b/cg/cg4400.h @@ -52,6 +52,7 @@ class TStampa_registri_app : public TPrintapp bool _rif_vid, _intesta_vidi, _intesta_liq, _stampa_data_reg, _ok_vidi, _stampa_num_pag; bool _sosp_imposta, _riep_liq; bool _st_tot_fin; + bool _riporti_stampati, _totali_stampati; char _frequiva, _tipo_riepilogativo, _freq_riepilogo; TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg; TDate _u_data; @@ -61,6 +62,7 @@ class TStampa_registri_app : public TPrintapp int _annoes, _r, _stampa_width, _mese_ultima_liq, _mese_credito; int _stampa_len, _stampa_mese, _size_header; real _totale_doc, _credito; + real _totdoc_prog, _totimpn_prog, _totimps_prog; //totali progressivi TString _codreg, _desc_lib, _codatt, _attivita, _tipoatt; TString _tipodoc, _descr_doc, _codlib, _codice_vidi; TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis; @@ -87,7 +89,6 @@ protected: public: const char* desc_attivita (const TString&); - //const char* desc_attivita (); const char* tipo_attivita (); const char* descr_doc (); const char* descr_iva (const char*); @@ -150,7 +151,8 @@ public: virtual bool user_create(); virtual bool user_destroy(); virtual print_action postprocess_page (int, int); - virtual void preprocess_header(); + virtual void preprocess_header(); + virtual void preprocess_footer(); TStampa_registri_app() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100), _test(FALSE) {} virtual ~TStampa_registri_app() {}