From c7264b933e4f02932e02ad68a4b58e707a5e21dd Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 8 Nov 1995 16:18:13 +0000 Subject: [PATCH] Corretti errori sui mastrini, estr. vers. e plafond git-svn-id: svn://10.65.10.50/trunk@2113 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg3200.cpp | 62 ++++++++++++++++------- cg/cg4302.cpp | 129 +++++++++++++++++++++++++++++------------------- cg/cg4304.cpp | 37 +++++++++----- cg/cg4305.cpp | 37 +++++++++++--- cg/cg4800.cpp | 134 +++++++++++++++++++++++++------------------------- 5 files changed, 245 insertions(+), 154 deletions(-) diff --git a/cg/cg3200.cpp b/cg/cg3200.cpp index 6325ca269..00a04bb6b 100755 --- a/cg/cg3200.cpp +++ b/cg/cg3200.cpp @@ -74,6 +74,7 @@ class TMastrini_application : public TPrintapp long _sottocontocontr; bool _stampaprogre,_stampatotiva,_stampatot,_prima_volta,_stampa_mov_prov; + bool _stampato; int _annomsk,_annoesmsk,_annoes,_annomsksucc,_tipo_mask,_anno_ghost; int _anno_corrente,_anno_precedente,_indbil,_numero_pag; @@ -1832,7 +1833,7 @@ bool TMastrini_application::preprocess_page(int file, int counter) if (_sezione == "D") { _totale_periodo_dare += _importo; - //_riporto_parziale_dare += _importo; + _riporto_parziale_dare += _importo; if (_numcarat == 1) // Stampa 132 caratteri set_row (_rw,"@85g%s", (const char*) _importo_str); @@ -1847,7 +1848,7 @@ bool TMastrini_application::preprocess_page(int file, int counter) else if (_sezione == "A") { _totale_periodo_avere += _importo; - //_riporto_parziale_avere += _importo; + _riporto_parziale_avere += _importo; if (_numcarat == 1) // Stampa 132 caratteri set_row (_rw,"@101g%s", (const char*) _importo_str); @@ -1860,6 +1861,9 @@ bool TMastrini_application::preprocess_page(int file, int counter) } } + const int righe_rimaste = printer().rows_left(); + _stampato = righe_rimaste >= 1; + _saldo_progressivi_str=_saldo_progressivi.string("###.###.###.###"); _saldo_movimenti_str=_saldo_movimenti.string("###.###.###.###"); if (_numcarat == 2) @@ -2072,10 +2076,10 @@ print_action TMastrini_application::postprocess_page(int file, int counter) return REPEAT_PAGE; } case LF_RMOV: - if (_sezione == "D") - _riporto_parziale_dare += _importo; - else if (_sezione == "A") - _riporto_parziale_avere += _importo; +// if (_sezione == "D") +// _riporto_parziale_dare += _importo; +// else if (_sezione == "A") +// _riporto_parziale_avere += _importo; force_setpage(); break; default: @@ -2583,18 +2587,25 @@ void TMastrini_application::crea_intestazione() { _riporto_dare += _riporto_parziale_dare; _riporto_avere += _riporto_parziale_avere; + + real dep_dare,dep_avere,imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d; + dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a; + if (_numcarat == 1) { - TString string = _riporto_dare.string("###.###.###.###"); + TString string = dep_dare.string("###.###.###.###"); set_header (10,"@32gA RIPORTO@85g%15s",(const char*) string); - string = _riporto_avere.string("###.###.###.###"); + string = dep_avere.string("###.###.###.###"); set_header (10,"@101g%15s",(const char*) string); } if (_numcarat == 2) { - TString string = _riporto_dare.string("###.###.###.###"); + TString string = dep_dare.string("###.###.###.###"); set_header (10,"@32gA RIPORTO@101g%15s",(const char*) string); - string = _riporto_avere.string("###.###.###.###"); + string = dep_avere.string("###.###.###.###"); set_header (10,"@117g%15s",(const char*) string); } _riporto_parziale_dare = ZERO; @@ -2739,18 +2750,25 @@ void TMastrini_application::stampa_progre_riporto() { _riporto_dare += _riporto_parziale_dare; _riporto_avere += _riporto_parziale_avere; + + real dep_dare,dep_avere,imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d; + dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a; + if (_numcarat == 1) { - TString string = _riporto_dare.string("###.###.###.###"); + TString string = dep_dare.string("###.###.###.###"); set_row (_rw,"@32gA RIPORTO@85g%15s",(const char*) string); - string = _riporto_avere.string("###.###.###.###"); + string = dep_avere.string("###.###.###.###"); set_row (_rw++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { - TString string = _riporto_dare.string("###.###.###.###"); + TString string = dep_dare.string("###.###.###.###"); set_row (_rw,"@32gA RIPORTO@101g%15s",(const char*) string); - string = _riporto_avere.string("###.###.###.###"); + string = dep_avere.string("###.###.###.###"); set_row (_rw++,"@117g%15s",(const char*) string); } _riporto_parziale_dare = ZERO; @@ -2784,18 +2802,25 @@ int TMastrini_application::stampa_progre_riporto(int start_riga) { _riporto_dare += _riporto_parziale_dare; _riporto_avere += _riporto_parziale_avere; + + real dep_dare,dep_avere,imp_d,imp_a; + imp_d = _sezione == "D" ? _importo : ZERO; + imp_a = _sezione == "A" ? _importo : ZERO; + dep_dare = _stampato ? _riporto_dare : _riporto_dare - imp_d; + dep_avere = _stampato ? _riporto_avere : _riporto_avere - imp_a; + if (_numcarat == 1) { - TString string = _riporto_dare.string("###.###.###.###"); + TString string = dep_dare.string("###.###.###.###"); set_row (r,"@32gA RIPORTO@85g%15s",(const char*) string); - string = _riporto_avere.string("###.###.###.###"); + string = dep_avere.string("###.###.###.###"); set_row (r++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { - TString string = _riporto_dare.string("###.###.###.###"); + TString string = dep_dare.string("###.###.###.###"); set_row (r,"@32gA RIPORTO@101g%15s",(const char*) string); - string = _riporto_avere.string("###.###.###.###"); + string = dep_avere.string("###.###.###.###"); set_row (r++,"@117g%15s",(const char*) string); } _riporto_parziale_dare = ZERO; @@ -3677,3 +3702,4 @@ int cg3200(int argc, char* argv[]) return 0; } + diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index 25c275df6..f7b3674a8 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -421,6 +421,13 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) // codici tributo, concessione, conto fiscale anche se la // delega esiste gia' + // Molto pericoloso chiamare con create = TRUE: + // se e' gia' stata fatta l'estrazione versamenti + // e l'utente cambia titcf e isdel sull'anagrafica + // sono c... suoi!!! (Maurizio) + // deve rifarsi la delega con l'ESTRAZIONE VERSAMENTI + // io l'ho lasciato per rispetto del lavoro altrui + long ditta = _nditte->curr().get_long("CODDITTA"); _del->zero(); (*_del_ditta) = format("%05ld", ditta); @@ -438,7 +445,8 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) _del->zero(); _del->put("CODTAB",ctab); } - if (create) + + if (create) { // vedi se titolare conto fiscale bool titcf = FALSE; @@ -454,91 +462,110 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) isdel = anag.get_long("TIPOSTDEL") == 0l; uffiva = anag.get_int("UFFIVA"); } - if (!titcf || isdel) { // non titolare conto fiscale oppure paga con delega: // cerca banca // codici ABI e CAB da anagrafica ditte TString16 abi, cab; - if (!ok) - { - abi = _nditte->lfile().get("ABIBAN"); - cab = _nditte->lfile().get("CABBAN"); - } - else - { - abi = _del->get("S7"); - cab = _del->get("S8"); - } + abi = _nditte->lfile().get("ABIBAN"); + cab = _nditte->lfile().get("CABBAN"); if (abi.empty()) { /* abi = anag.get("CODABI"); cab = anag.get("CODCAB"); - */ + */ TConfig c (CONFIG_STUDIO, "cg"); abi = c.get("CodABI"); cab = c.get("CodCAB"); - } - + } _del->put("S7", abi); _del->put("S8", cab); - - // descrizione banca - TTable ban("%BAN"); - ban.zero(); - TString codban = format("%05ld", atol(abi)); - if (!cab.empty()) codban << format("%05ld", atol(cab)); - ban.put("CODTAB", codban); - if (ban.read() == NOERR) - { - TString desban(ban.get("S0")); - _del->put("S1", desban); - } - //che rottura: ogni giorno alla prassi cambiano idea!!! - TTable uiv("%UIV"); - uiv.zero(); - TString16 coduff = format("%03d", uffiva); - uiv.put("CODTAB", coduff); - if (uiv.read() == NOERR) - { - TString desiva(uiv.get("S0")); - _del->put("S2", desiva); - } - } - else + _del->put("S9", ""); // per sicurezza! (visto che non devono mai + } // esistere entrambe + else { // non usa delega bensi' bollettino o distinta: // cerca concessione comune // infila ufficio concessione in S9 // e descrizione comune in S2 TString16 con; - if (ok) con = _del->get("S9"); TString uva; if (look_conc(con, uva)) { _del->put("S9", con); _del->put("S2", uva); + _del->put("S7", ""); + _del->put("S8", ""); } } + } //fine create + + // le descrizioni sulla delega non vengono + // memorizzate dai vari programmi di gestione + // e estrazione ma solo qui. + if (ok) + { + int uffiva; + TLocalisamfile anag(LF_ANAG); + anag.zero(); + anag.put("TIPOA", _nditte->lfile().get("TIPOA")); + anag.put("CODANAGR", _nditte->lfile().get("CODANAGR")); + if (anag.read() == NOERR) + uffiva = anag.get_int("UFFIVA"); - // scrive codice tributo - int ctri = 6000; - if (month == 13 && type == 7) - ctri = 6035; // acconto IVA annuale (trimestrali?) - else if (month == 13 && type == 1) - ctri = 6099; // IVA annuale - else if (month < 13 && type == 7) + TString16 abi = _del->get("S7"); + TString16 cab = _del->get("S8"); + TString16 con = _del->get("S9"); + + // descrizione banca + if (abi.not_empty()) + { + TTable ban("%BAN"); + ban.zero(); + TString codban = format("%05ld", atol(abi)); + if (!cab.empty()) codban << format("%05ld", atol(cab)); + ban.put("CODTAB", codban); + if (ban.read() == NOERR) + { + TString desban(ban.get("S0")); + _del->put("S1", desban); + } + //che rottura: ogni giorno alla prassi cambiano idea!!! + TTable uiv("%UIV"); + uiv.zero(); + TString16 coduff = format("%03d", uffiva); + uiv.put("CODTAB", coduff); + if (uiv.read() == NOERR) + { + TString desiva(uiv.get("S0")); + _del->put("S2", desiva); + } + } + else if (con.not_empty()) + { + TString uva; + if (look_conc(con, uva)) + _del->put("S2", uva); + } + } + // scrive codice tributo + int ctri = 6000; + if (month == 13 && type == 7) + ctri = 6035; // acconto IVA annuale (trimestrali?) + else if (month == 13 && type == 1) + ctri = 6099; // IVA annuale + else if (month < 13 && type == 7) ctri = 6013; // acconto mensile else if (month < 13 && type == 1) // regular ctri = _freqviva == "M" ? 6000 + month : 6030 + (month/3); - _del->put("S6", format("%d",ctri)); + _del->put("S6", format("%d",ctri)); + + if (!ok) _del->write(); + else _del->rewrite(); - if (!ok) _del->write(); - else _del->rewrite(); - } return ok; } diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index 83919df1e..66624c145 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -834,7 +834,7 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) } // altrimenti lascia tutto in bianco e ci scriveranno i dati a mano } return d; - */ + */ bool stampa_vers = FALSE; if (_lim->get_real("R0") > ZERO) { @@ -852,9 +852,13 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) _DescrItem* d = new _DescrItem(DELEGA); - look_del(month,month == 13 ? 2 : 1,TRUE); - //{ - d->_f0 = (_del->get("S7").not_empty() || _del->get("S8").not_empty()); + d->_f0 = 0; + + if (look_del(month,month == 13 ? 2 : 1)) + { + if (_del->get("S9").not_empty()) + d->_f0 = 2; + else d->_f0 = 1; if (_del->get_bool("B0")) { d->_s0 = _del->get("S2"); // ufficio iva/concessione @@ -864,14 +868,16 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) d->_r0 = _del->get_real("R0"); d->_d0 = _del->get_date("D0"); } // altrimenti lascia tutto in bianco e ci scriveranno i dati a mano - //} + } if ( (month == 12 && (_freqviva == "M" || (_isbenzinaro && _gest4))) || (_isannual && _freqviva == "T" && !(_isbenzinaro && _gest4)) ) if (look_del(12,7)) { d->_s4 = "ACC"; - d->_f0 = (_del->get("S7").not_empty() || _del->get("S8").not_empty()); + if (_del->get("S9").not_empty()) + d->_f1 = 2; + else d->_f1 = 1; TToken_string t; if (_del->get_bool("B0")) { @@ -883,7 +889,8 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) t.add(_del->get("D0")); } d->_s5 = t; - } + } + return d; } @@ -1056,7 +1063,8 @@ void TLiquidazione_app::set_att(_DescrItem& d) void TLiquidazione_app::set_plafond(_DescrItem& d) { - if (_isregis) return; + //if (_isregis) return; + if (_isregis && _isfinal) return; set_bookmark("Quadro plafond", _att_bookmark); @@ -1643,14 +1651,14 @@ void TLiquidazione_app::set_grand(_DescrItem& d) set_row(rw, "Versamento di L. %s effettuato il %s", (const char*)vr, (const char*)dt); - if (di._f0) + if (di._f1 == 1) { set_row(rw++, "@68gdiretto all'ufficio IVA di %s", (const char*)loc); set_row(rw++, "@68gtramite %s", (const char*)ban); set_row(rw++, "@68gcodice azienda %s codice dipendenza %s", (const char*)abi, (const char*)cab); } - else + else if (di._f1 == 2) { set_row(rw++, "@68gdiretto al Ministero delle Finanze"); set_row(rw++, "@68gConcessione %s", (const char*)loc); @@ -1663,7 +1671,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d) set_row(rw, "Versamento di L. %s effettuato il %s", (const char*)vr, (const char*)dt); - if (di._f0) + if (di._f0 == 1) { set_row(rw++, "@68gdiretto all'ufficio IVA di %s", (const char*)(di._s0)); @@ -1671,10 +1679,15 @@ void TLiquidazione_app::set_grand(_DescrItem& d) set_row(rw++, "@68gcodice azienda %s codice dipendenza %s", (const char*)(di._s2), (const char*)(di._s3)); } - else + else if (di._f0 == 2) { set_row(rw++, "@68gdiretto al Ministero delle Finanze"); set_row(rw++, "@68gConcessione %s", (const char*)(di._s0)); + } + else + { + set_row(rw++, "@68gdiretto"); + set_row(rw++, "@68gtramite"); } } } diff --git a/cg/cg4305.cpp b/cg/cg4305.cpp index f43a5368e..06cba4862 100755 --- a/cg/cg4305.cpp +++ b/cg/cg4305.cpp @@ -179,6 +179,7 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc) //bool wasdel = look_del(month, _isannual ? 2 : 1); bool wasdel = look_del(month, 1); + //la stampa deve essere fatta sia se a credito che a debito if (!topay.is_zero()) { tt = new TToken_string(80); @@ -192,7 +193,8 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc) //if (topay.sign() > 0) if (versare) { - look_del(month, 1, TRUE); + look_del(month, 1, TRUE); //ci mette abi, cab o con + //che legge dall'anagrafica!!! bool stampato = _del->get_bool("B0"); if (stampato) //se esiste e stampato si richiede conferma aggiornamento { @@ -212,11 +214,34 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc) tt->add(_del->get("S9")); tt->add(_nditte->curr().get("PTEL")); tt->add(_nditte->curr().get("TEL")); + /*** TString desc(_del->get("S1")); if (desc.not_empty()) tt->add(desc); else tt->add(_del->get("S2")); - } + ***/ + TString desc; + if (_del->get("S9").not_empty()) + { + TTable ucc("%UCC"); + ucc.zero(); + ucc.put("CODTAB", _del->get("S9")); + if (ucc.read() == NOERR) + desc = ucc.get("S0"); + } + else if (_del->get("S7").not_empty()) + { + TTable ban("%BAN"); + TString16 cod; + cod = _del->get("S7"); + if (_del->get("S8").not_empty()) cod << _del->get("S8"); + ban.zero(); + ban.put("CODTAB", cod); + if (ban.read() == NOERR) + desc = ban.get("S0"); + } + tt->add(desc); + } else if (wasdel) //se esiste e no versare _del->remove(); } @@ -567,14 +592,14 @@ else if (_basecalc == incorso) tipo_acc = "A"; //flag per dire che si e' utilizzato il metodo analitico //stop } -else error = 1; + else error = 1; // pulisci il water _comp_acconto = FALSE; _isprint = FALSE; /* update_firm(12); - */ + */ for (int i = 1; i <= _month; i++) if (is_month_plain(i)) update_firm(i); @@ -584,8 +609,8 @@ else error = 1; _lim->rewrite(); if (look_lim(13)) { - _lim->put("B0",""); - _lim->rewrite(); + _lim->put("B0",""); + _lim->rewrite(); } //fine _isprint = TRUE; diff --git a/cg/cg4800.cpp b/cg/cg4800.cpp index a97a9beb7..326fba41e 100755 --- a/cg/cg4800.cpp +++ b/cg/cg4800.cpp @@ -210,8 +210,8 @@ bool VersAcc_app::menu(MENU_TAG) vers_acc(); if (_print) { - enable_menu_item(M_FILE_PRINT); - print(); + enable_menu_item(M_FILE_PRINT); + print(); } } else warning_box("Nessuna ditta selezionata!"); @@ -239,20 +239,20 @@ bool VersAcc_app::check_acc() switch (k) { - case DLG_SELECT: - _ditte->run(); - for (j = 0l; j < _ditte->items(); j++) - if (_ditte->checked(j)) _selected.set(j); - break; + case DLG_SELECT: + _ditte->run(); + for (j = 0l; j < _ditte->items(); j++) + if (_ditte->checked(j)) _selected.set(j); + break; - case BUT_CGB_ALL: - _ditte->check(-1); - for (j = 0l; j < _ditte->items(); j++) - if (_ditte->checked(j) && !_ditte->disabled(j)) - _selected.set(j); - _calcall = TRUE; - k = K_ENTER; - break; + case BUT_CGB_ALL: + _ditte->check(-1); + for (j = 0l; j < _ditte->items(); j++) + if (_ditte->checked(j) && !_ditte->disabled(j)) + _selected.set(j); + _calcall = TRUE; + k = K_ENTER; + break; } } @@ -291,7 +291,7 @@ void VersAcc_app::vers_acc() _nditte->curr().zero(); _nditte->curr().put("CODDITTA",_ditte->row(l).get(1)); _nditte->read(); - + if (!look_lia()) continue; sprintf (buf,"Creazione vers. acconti:\nditta %s\n ", @@ -307,7 +307,7 @@ void VersAcc_app::vers_acc() crea_riga_stampa(tipo); _print = TRUE; //relativo alla stampa finale } - + _prind->addstatus(1); } delete _prind; @@ -422,7 +422,7 @@ void VersAcc_app::lettura_delega() else //non esiste la delega { if (_diff >= ACCONTO_SENZA_CREDITO) - //creo record delega + //creo record delega { crea_delega(); _da_stampare = TRUE; @@ -462,7 +462,7 @@ void VersAcc_app::lettura_anagrafica(bool* tipo) { TLocalisamfile& anag = _nditte->lfile(LF_ANAG); TLocalisamfile& com = _nditte->lfile(LF_COMUNI); // Comune residenza fiscale - + const bool cf = anag.get_bool("TITCF"); const int isdel = anag.get_int("TIPOSTDEL"); @@ -490,7 +490,7 @@ void VersAcc_app::lettura_anagrafica(bool* tipo) } } } - + bool VersAcc_app::video_conferma() { TMask m("cg4800b"); @@ -510,25 +510,25 @@ bool VersAcc_app::video_conferma() switch(k) { - case K_SAVE: - { - KEY k = yesnocancel_box("Delega gia' stampata. Si desidera ugualmente confermare l'aggiornamento?"); - if (k == K_YES) - { - _da_stampare = TRUE; - _del->put("R0",_diff); - _del->put("B0", ""); - _del->rewrite(); - } - if (k == K_YES || k == K_NO) - stop = TRUE; - } - break; - case K_ESC: - //case K_QUIT: - stop = TRUE; - break; - } + case K_SAVE: + { + KEY k = yesnocancel_box("Delega gia' stampata. Si desidera ugualmente confermare l'aggiornamento?"); + if (k == K_YES) + { + _da_stampare = TRUE; + _del->put("R0",_diff); + _del->put("B0", ""); + _del->rewrite(); + } + if (k == K_YES || k == K_NO) + stop = TRUE; + } + break; + case K_ESC: + //case K_QUIT: + stop = TRUE; + break; + } } return TRUE; } @@ -542,37 +542,37 @@ void VersAcc_app::crea_riga_stampa(bool tipost) { if (_con.not_empty()) { - TTable ucc("%UCC"); - ucc.zero(); - ucc.put("CODTAB", _con); - if (ucc.read() == NOERR) - desc = ucc.get("S0"); + TTable ucc("%UCC"); + ucc.zero(); + ucc.put("CODTAB", _con); + if (ucc.read() == NOERR) + desc = ucc.get("S0"); } } -else //prendo la descrizione della banca -{ - if (_abi.not_empty()) + else //prendo la descrizione della banca { - TTable ban("%BAN"); - TString16 cod; - cod = _abi; cod << _cab; - ban.zero(); - ban.put("CODTAB", cod); - if (ban.read() == NOERR) - desc = ban.get("S0"); - } -} - -tt->add(_nditte->lfile().get("CODDITTA")); -tt->add(_nditte->lfile().get("RAGSOC")); -tt->add(_diff.string()); -tt->add(_abi); -tt->add(_cab); -tt->add(_con); -tt->add(desc); -tt->add(tipost); - -if (tt != NULL) _desc.add(tt); + if (_abi.not_empty()) + { + TTable ban("%BAN"); + TString16 cod; + cod = _abi; if (!_cab.empty()) cod << _cab; + ban.zero(); + ban.put("CODTAB", cod); + if (ban.read() == NOERR) + desc = ban.get("S0"); + } + } + + tt->add(_nditte->lfile().get("CODDITTA")); + tt->add(_nditte->lfile().get("RAGSOC")); + tt->add(_diff.string()); + tt->add(_abi); + tt->add(_cab); + tt->add(_con); + tt->add(desc); + tt->add(tipost); + + if (tt != NULL) _desc.add(tt); } int cg4800(int argc, char* argv[])