diff --git a/cg/cg3400.cpp b/cg/cg3400.cpp index 6f2bdbc28..ff5b8cfcd 100755 --- a/cg/cg3400.cpp +++ b/cg/cg3400.cpp @@ -29,10 +29,6 @@ #include "cg3400b.h" HIDDEN const char* REAL_PICTURE = "###.###.###.###"; -HIDDEN const char* REAL_TOT_PIC = "#.###.###.###.###"; -HIDDEN const char* RIP_TOT_PIC = "###.###.###.###"; - -HIDDEN const int RIGHE_MODULO = 66; HIDDEN const int RIGHE_FOOTER = 3; @@ -48,7 +44,7 @@ HIDDEN const int AVERE198 = 174; HIDDEN TString256 tmp; -HIDDEN int date2esc(const TDate& d, int* prevesc = NULL); +HIDDEN int date2esc(const TDate& d, int* prevesc = NULL); HIDDEN enum descr { causale, conto, operazione }; @@ -175,6 +171,9 @@ public: // TString16 _caus; TLocalisamfile * _com, *_clifo,*_pconti,*_nditte,*_anag, *_causali; + + TLocalisamfile* _attiv; // da togliere in futuro (?) + TTable *_tabreg, *_tabval, *_tabes, *_tabiva; public: @@ -251,6 +250,11 @@ bool CG3400_application::filter_func(const TRelation * r) const TRectype& recmov = r->lfile().curr(); TRectype& recrmov = r->lfile(LF_RMOV).curr(); const long numreg = recmov.get_long("NUMREG"); + + // Scarto SEMPRE i provvisori + TString16 provvis = recmov.get(MOV_PROVVIS); + if (provvis.trim().not_empty()) + return FALSE; // In caso di NO libro con iva scarta quelli che non hanno righe contabili if (!app()._libro_giornale_iva_unico) @@ -323,15 +327,6 @@ void CG3400_application::get_dati_ditta () codanagr = _nditte->curr().get(NDT_CODANAGR); tipoa = _nditte->curr().get_char(NDT_TIPOA); - if (tipoa == 'F') - { - /*TString80 cognome = _ragsoc; - const char* nome = cognome.mid(31); - cognome.cut(30); - _ragsoc = cognome; - _ragsoc << " " << nome; */ - } - _anag->setkey(1); _anag->zero(); _anag->put (ANA_TIPOA, tipoa); @@ -381,10 +376,8 @@ bool CG3400_application::user_create() _clifo = new TLocalisamfile(LF_CLIFO); _pconti = new TLocalisamfile(LF_PCON); _causali = new TLocalisamfile(LF_CAUSALI); - - // _descr_conto = new TParagraph_string ("", 50); - // disable_print_menu(); - + _attiv = new TLocalisamfile(LF_ATTIV); // da togliere + _rel = new TRelation (LF_MOV); _rel->add (LF_RMOV, "NUMREG=NUMREG"); _rel->add (LF_RMOVIVA, "NUMREG=NUMREG"); @@ -413,7 +406,8 @@ bool CG3400_application::user_destroy() delete _nditte; delete _anag; delete _tabreg; delete _tabes; delete _tabval; delete _tabiva; - // delete _descr_conto; + delete _attiv; // da togliere in futuro + delete _nditte; delete _anag; return TRUE; @@ -458,12 +452,6 @@ void CG3400_application::aggiorna_mov() // mov.reread(_unlock); } - -// NB -// Se si usa un codice @g dopo un -// @b (bold) il primo pezzo perde qualche carattere in visualizzazione -// (in stampa su carta non ho provato) -// int CG3400_application::set_totali_giorno(const TDate& data, const int righeiva) { int r; @@ -479,12 +467,13 @@ int CG3400_application::set_totali_giorno(const TDate& data, const int righeiva) TString td(_tot_dare_gg.string(REAL_PICTURE)); TString ta(_tot_avere_gg.string(REAL_PICTURE)); - sprintf(dep, "@b@%dgTotale operazioni del %s @%dg%c %s %c @%dg%s", + sprintf(dep, "@b@%dgTotale operazioni del %s @%dg%c %s @%dg%c @%dg%s", _stampa_width == 132 ? DARE132-STACC : DARE198-STACC, data.string(), _stampa_width == 132 ? DARE132-3 : DARE198-2, 'D', (const char*)td, + _stampa_width == 132 ? DARE132+16 : DARE198+20, 'A', _stampa_width == 132 ? AVERE132 : AVERE198, (const char*)ta @@ -499,12 +488,13 @@ int CG3400_application::set_totali_giorno(const TDate& data, const int righeiva) TString tdp(_tot_dare_gg_ap.string(REAL_PICTURE)); TString tap(_tot_avere_gg_ap.string(REAL_PICTURE)); - sprintf (dep, "@b@%dgTotale operazioni del %s Anno precedente @%dg%c %s %c @%dg%s", + sprintf (dep, "@b@%dgTotale operazioni del %s Anno precedente @%dg%c %s @%dg%c @%dg%s", _stampa_width == 132 ? DARE132-STACC : DARE198-STACC, data.string(), _stampa_width == 132 ? DARE132-3 : DARE198-2, 'D', - (const char*)tdp, + (const char*)tdp, + _stampa_width == 132 ? DARE132+16 : DARE198+20, 'A', _stampa_width == 132 ? AVERE132 : AVERE198, (const char*)tap @@ -523,11 +513,9 @@ void CG3400_application::postclose_print() if (_stampa_definitiva) { const int ultima_fatta = printer().getcurrentpage() - 1; - // const int stampate = ultima_fatta - _pagina_da + 1; if (yesno_box("La stampa e' corretta ? ")) { - // _pagina_da = -1; aggiorna_mov (); aggiorna_tabreg (_pagina_da, ultima_fatta); } @@ -569,12 +557,13 @@ void CG3400_application::preprocess_footer() dts = dt.string(REAL_PICTURE); ats = at.string(REAL_PICTURE); - riga.format ("@b@%dg%s@%dg%c %s %c @%dg%s", + riga.format ("@b@%dg%s@%dg%c %s @%dg%c @%dg%s", _stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB, _nuovo_mese ? "Totale progressivi generali " : "A riportare ", _stampa_width == 132 ? DARE132-3 : DARE198, 'D', - (const char *) dts, + (const char *) dts, + _stampa_width == 132 ? DARE132+16 : DARE198+20, 'A', _stampa_width == 132 ? AVERE132 : AVERE198, (const char *) ats); @@ -612,11 +601,12 @@ int CG3400_application::set_totali_pagina(int righe) progr_dare = _tot_dare_progr.string(REAL_PICTURE); progr_avere = _tot_avere_progr.string(REAL_PICTURE); riga = ""; - riga.format("@b@%dgTotale progressivi @%dg%c %s %c @%dg%s", + riga.format("@b@%dgTotale progressivi @%dg%c %s @%dg%c @%dg%s", _stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB, _stampa_width == 132 ? DARE132-3 : DARE198-2, 'D', (const char *) progr_dare, + _stampa_width == 132 ? DARE132+16 : DARE198+20, 'A', _stampa_width == 132 ? AVERE132 : AVERE198, (const char *) progr_avere @@ -626,11 +616,12 @@ int CG3400_application::set_totali_pagina(int righe) if (ap) { - riga.format("@b@%dgTotale progressivi anno precedente @%dg%c %s %c @%dg%s", + riga.format("@b@%dgTotale progressivi anno precedente @%dg%c %s @%dg%c @%dg%s", _stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB, _stampa_width == 132 ? DARE132-3 : DARE198-2, 'D', (const char *) progr_dare_ap, + _stampa_width == 132 ? DARE132+16 : DARE198+20, 'A', _stampa_width == 132 ? AVERE132 : AVERE198, (const char *) progr_avere_ap @@ -644,11 +635,12 @@ int CG3400_application::set_totali_pagina(int righe) dts = _tot_dare_generale.string(REAL_PICTURE); ats = _tot_avere_generale.string(REAL_PICTURE); - riga.format("@b@%dgTotale progressivi generali @%dg%c %s %c @%dg%s", + riga.format("@b@%dgTotale progressivi generali @%dg%c %s @%dg%c @%dg%s", _stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB, _stampa_width == 132 ? DARE132-3 : DARE198-2, 'D', (const char *) dts, + _stampa_width == 132 ? DARE132+16 : DARE198+20, 'A', _stampa_width == 132 ? AVERE132 : AVERE198, (const char *) ats @@ -671,11 +663,12 @@ int CG3400_application::set_totali_pagina(int righe) // "Se il mese e' finito devo scrivere Totale progressivi generali // invece che A riportare" - riga.format ("@b@%dgTotale progressivi generali @%dg%c %s %c @%dg%s", + riga.format ("@b@%dgTotale progressivi generali @%dg%c %s @%dg%c @%dg%s", _stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB, _stampa_width == 132 ? DARE132-3 : DARE198-2, 'D', - (const char *) dts, + (const char *) dts, + _stampa_width == 132 ? DARE132+16 : DARE198+20, 'A', _stampa_width == 132 ? AVERE132 : AVERE198, (const char *) ats); @@ -806,11 +799,10 @@ void CG3400_application::preprocess_header() return; } - TString dare (riporto_dare.string(RIP_TOT_PIC)); - TString avere(riporto_avere.string(RIP_TOT_PIC)); - // RIP_TOT_PIC adesso e' lunga 15 + TString dare (riporto_dare.string(REAL_PICTURE)); + TString avere(riporto_avere.string(REAL_PICTURE)); - riporto.format("@b@%dgRiporto: %c @%dg%15s %c @%dg%15s", + riporto.format("@b@%dgRiporto: %c @%dg%15s %c@%dg%15s", _stampa_width == 132 ? 83 : DARE198-11, _stampa_width == 132 ? 'D' : ' ', _stampa_width == 132 ? DARE132-1 : DARE198, @@ -821,8 +813,6 @@ void CG3400_application::preprocess_header() ); set_header (r++, "%s", (const char *) riporto); - - // set_header (r, ""); NON LASCIARE RIGHE VUOTE } } @@ -1033,10 +1023,6 @@ void CG3400_application::set_rows (int file, int counter) switch (file) { case LF_MOV: - /* - if (_libro_giornale_iva_unico) - { - */ reset_row(1); reset_row(2); @@ -1094,22 +1080,11 @@ void CG3400_application::set_rows (int file, int counter) set_row(r+1, " (R.IVA @b%3s@r Prot. @b%ld@r) ", (const char*)_reg,protiva); } - /************** - } - else - if (!_gia_settata_riga_mov) - { - set_row (r, "Operazioni del %s", datareg); - _gia_settata_riga_mov = TRUE; - } - ****/ - break; case LF_RMOV: _num_rig++; - // if (!_libro_giornale_iva_unico) _nprog_mov++; reset_print(); @@ -1129,10 +1104,6 @@ void CG3400_application::set_rows (int file, int counter) rmv_descr = _cur->file(LF_RMOV).get(RMV_DESCR); - /* - if (_libro_giornale_iva_unico) - { - */ r=1; // Num. progressivo di operazione. Azzerato in preprocess_page @@ -1146,21 +1117,6 @@ void CG3400_application::set_rows (int file, int counter) if (s != 0L) set_row (r, "%06ld", s); - /************* - } - else // no libro_giornale_iva_unico - { - if (_stampa_definitiva) - set_row (r, "%-3ld", _nprog_mov); - else - set_row (r, "%3ld", numreg); - set_row (r, "@4g@d", (const char*)datareg); - set_row (r, "@13g%02d.", g); - set_row (r, "%02d.", c); - set_row (r, "%06d", s); - } - *******************************************************/ - tc.set(g,c,s,cf,NULL,-1,_occfpi); if (_stampa_width == 132) @@ -1219,14 +1175,8 @@ bool CG3400_application::preprocess_page(int file, int counter) _annoEsMov = _anno_iva = 0; _iva_array.destroy(); - // _MovGiaStampato = _cur->file(LF_MOV).get_bool(MOV_STAMPATO); - - // Deve essere gia' stato scartato prima - // if (_MovGiaStampato && _stampa_definitiva) return FALSE; - *_RecArrivoA = _cur->file(LF_MOV).curr(); - // if (_libro_giornale_iva_unico) _nprog_mov++; _nprog_mov++; // Il numero di operazione deve ripartire da 0 per ogni movimento _num_rig = 0; @@ -1853,8 +1803,6 @@ void CG3400_application::init_print() { if (_stampa_len != 0) printer().formlen(_stampa_len); - else - printer().formlen(RIGHE_MODULO); printer().footerlen(RIGHE_FOOTER);