diff --git a/cg/cg1100.cpp b/cg/cg1100.cpp index 1140b5e75..50d0f74bf 100755 --- a/cg/cg1100.cpp +++ b/cg/cg1100.cpp @@ -862,16 +862,21 @@ void CG1100_application::set_con_ana() if (_codcbl_da_stamp != _codcbl_stamp) { set_row (_i,"@0g%10s", (const char*) _codcbl_da_stamp); - set_row (_i,"@12g%s", (const char*) descrizione); + set_row (_i,"@11g%s", (const char*) descrizione); } set_row (_i,"@62g$[r]%3d$[n]", _gruppo); - set_row (_i,"@65g$[r]%3d$[n]", _conto); + + if (_conto != 0) + set_row (_i,"@66g$[r]%3d$[n]", _conto); if (_sottoc != 0) - set_row (_i,"@68g$[r]%6ld$[n]", _sottoc); - - set_row (_i,"@76g%.40s", (const char*) descr); + set_row (_i,"@70g$[r]%6ld$[n]", _sottoc); + + if (_gruppo > 99 || _conto > 99) + set_row(_i,"@76g*"); + + set_row (_i,"@78g%.40s", (const char*) descr); if (conto != 0 && sottoc == 0l) set_row (_i, "@121g%s", (const char*) val); @@ -1230,6 +1235,12 @@ bool CG1100_application::set_print(int) _resetta_righe_stampa = TRUE; + reset_footer(); + if (_tipo_stampa == con_ana_bil) + set_footer(2,"* Conti collegati ma non trasferibili"); + else + set_footer(2,""); + if (_tipo_stampa == senza_IV_direttiva) { _conto_classificato = TRUE; @@ -1325,22 +1336,23 @@ void CG1100_application::intesta (stampe tipo) break; case completa_bil: - soh++; - s.fill('-'); + set_header (soh++, "@20gStampa completa per analisi di bilancio"); + s.fill('-'); + set_header (soh++, (const char *) s); set_header (soh++, "Conto@60gCod.tabella@75gTipo@86gNo Dettaglio@104gT@107gSpesa@118gDet.alleg.bil."); set_header (soh++, "Sottoconto @16gDescrizione@60gAnalis.bil.@75gConto@81gC/F@86gBilancio@97gComp.@104gA@107gRicavo@114gSez@118gSot.con * Mov."); break; case con_ana_bil: - soh++; + set_header (soh++, "@20gStampa conti riclassificati per analisi di bilancio"); s.fill('-'); set_header (soh++, (const char *) s); - set_header (soh++, "Codice @63gCodici Piano@118gDet.alleg.bil."); - set_header (soh++, "Tabella@12gDescrizione@63gdei Conti @76gDescrizione@118gSot.con * Mov."); + set_header (soh++, "Codice @62gCodici Piano@118gDet.alleg.bil."); + set_header (soh++, "Tabella@11gDescrizione@62gdei Conti @78gDescrizione@118gSot.con * Mov."); break; case senza_ana_bil: - soh++; + set_header (soh++, "@20gStampa conti non collegati per analisi di bilancio"); s.fill('-'); set_header (soh++, (const char *) s); set_header (soh++, "Conto@74gTipo@86gNo Dettaglio@107gSpesa@114gT@116gDett.alleg.bil."); diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 2db27aa25..3b6305d6f 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -1638,10 +1638,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) */ //if ((month == 12 && _isbenzinaro) || // (month >= 12 && _freqviva == "M")) - if ((month >= 12 && _freqviva == "M") || - (month == 12 && _isbenzinaro && _gest4) || - (_isannual && _freqviva == "T" && !_isbenzinaro) || - (_isannual && _isbenzinaro && !_gest4)) + if (((month+deltam) >= 12 && _freqviva == "M") || //solo freq. M puo' + (month == 12 && _isbenzinaro && _gest4) || //essere differita + (_isannual && _freqviva == "T")) { risultato -= versamenti_IVA(12,"7"); acc_dec = versamenti_IVA(12,"7"); @@ -1676,9 +1675,11 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) * Era anche non benzinari, smentito da Cinzia (MI0853); * Ora gestito esplicitamente nei parametri ditta, forzato * FALSE per ditte mensili e liq. annuale + * Ulteriormente smentito e rettificato */ //if (_isintr && month < 13) - if ((_isintr && ((month != 12 || (_isbenzinaro && !_gest4))))) + if ((_isintr && ( (month == 13 && !(_isbenzinaro && _gest4)) || + (month != 12 || (_isbenzinaro && _gest4)) ))) { real interesse = interesse_trimestrale(_month); real ivi = risultato * (interesse / CENTO); @@ -1686,9 +1687,10 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) _lim->put("R14", ivi); } - // questo serve anche per la visualizzazione e per l'estrazione deleghe - //if (_isintr && month < 13z) - if ((_isintr && ((month != 12 || (_isbenzinaro && !_gest4))))) + //questo serve anche per la visualizzazione e per l'estrazione deleghe + //if (_isintr && month < 13) + if ((_isintr && ( (month == 13 && !(_isbenzinaro && _gest4)) || + (month != 12 || (_isbenzinaro && _gest4)) ))) _lim->put("R10",interesse_trimestrale(_month)); // totale conguaglio su tutte le attivita' @@ -1735,7 +1737,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) res_cred = iva_acq + versamenti + vers_int + cred_prec + acc_dec; res_debt = iva_vend + rimborsi + deb_mens + debt_precd; - if (tot_cong.sign() > 0) res_debt += tot_cong; else res_cred -= tot_cong; diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index 0e95521e3..f4a612d85 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -461,6 +461,7 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) // vedi se titolare conto fiscale bool titcf = FALSE; bool isdel = FALSE; + int uffiva; TLocalisamfile anag(LF_ANAG); anag.zero(); anag.put("TIPOA", _nditte->lfile().get("TIPOA")); @@ -468,7 +469,8 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) if (anag.read() == NOERR) { titcf = anag.get_bool("TITCF"); - isdel = anag.get_long("TIPOSTDEL") == 0l; + isdel = anag.get_long("TIPOSTDEL") == 0l; + uffiva = anag.get_int("UFFIVA"); } if (!titcf || isdel) @@ -476,9 +478,17 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) // non titolare conto fiscale oppure paga con delega: // cerca banca // codici ABI e CAB da anagrafica ditte - TString abi = _nditte->lfile().get("ABIBAN"); - TString cab = _nditte->lfile().get("CABBAN"); - + TString16 abi, cab; + if (!ok) + { + abi = _nditte->lfile().get("ABIBAN"); + cab = _nditte->lfile().get("CABBAN"); + } + else + { + abi = _del->get("S7"); + cab = _del->get("S8"); + } if (abi.empty()) { /* @@ -504,6 +514,16 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) 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 { @@ -511,7 +531,9 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) // cerca concessione comune // infila ufficio concessione in S9 // e descrizione comune in S2 - TString16 con; TString uva; + TString16 con; + if (ok) con = _del->get("S9"); + TString uva; if (look_conc(con, uva)) { _del->put("S9", con); @@ -697,10 +719,21 @@ bool TLiquidazione_app::look_conc(TString& uffcon, TString& uffiva) comuni.put("COM", com); if (comuni.read() != NOERR) return FALSE; - uffcon = comuni.get("UFFCONC"); - uffiva = comuni.get("DENCOM"); - if (!comuni.get("PROVCOM").empty()) - uffiva << " (" << comuni.get("PROVCOM") << ")"; - + const int uffa = comuni.get_int("UFFCONC"); + if (uffcon.empty()) + uffcon = format("%03d",uffa); + if (uffcon.not_empty()) + { + TTable ucc("%UCC"); + ucc.zero(); + ucc.put("CODTAB", uffcon); + if (ucc.read() == NOERR) + uffiva = ucc.get("S0"); + } + /* + uffiva = comuni.get("DENCOM"); + if (!comuni.get("PROVCOM").empty()) + uffiva << " (" << comuni.get("PROVCOM") << ")"; + */ return TRUE; } diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index e68ea2e9f..8cbc742f9 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -844,28 +844,30 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) stampa_vers = TRUE; } - if (_freqviva == "T" && _isannual) month = 12; + int mese = month; + if (_freqviva == "T" && _isannual) mese = 12; - if (!look_del(month,1) && !look_del(month,7) && !stampa_vers) return NULL; + if (!look_del(month,month == 13 ? 2 : 1) && + !look_del(mese,7) && !stampa_vers) return NULL; _DescrItem* d = new _DescrItem(DELEGA); - if (look_del(month,1)) + if (look_del(month,month == 13 ? 2 : 1,TRUE)) { if (_del->get_bool("B0")) { - d->_s0 = _del->get("S2"); // localita' - d->_s1 = _del->get("S1"); // banca + d->_s0 = _del->get("S2"); // ufficio iva/concessione + d->_s1 = _del->get("S1"); // descrizione banca d->_s2 = _del->get("S7"); // ABI - d->_s3 = _del->get("S8"); // CAB + d->_s3 = _del->get("S8"); // CAB 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 (_freqviva == "M" || - (_freqviva == "T" && _isannual)) - if (look_del(month,7)) + if ((month == 12 && (_freqviva == "M" || (_isbenzinaro && _gest4))) + || (_freqviva == "T" && _isannual)) + if (look_del(12,7,TRUE)) { d->_s4 = "ACC"; TToken_string t; @@ -1092,9 +1094,11 @@ void TLiquidazione_app::set_plafond(_DescrItem& d) void TLiquidazione_app::set_liqacc(_DescrItem& d) { - real r1 = d._r0 + d._r1 + d._r2 + d._r3 + d._r4; + real r1 = d._r0 + d._r1 + d._r2 + d._r4; real r2 = d._r5 + d._r10; - real r3 = r2 + d._r9 + d._r7 + abs(d._r3); + real r3 = r2 + d._r9 + d._r7; + if ((d._r3).sign() > 0) r1 += d._r3; + else r3 += abs(d._r3); set_row(1,""); set_row(2,""); set_row(3,""); set_row(4,""); set_row(5,"@11gCALCOLO ACCONTO SU OPERAZIONI EFFETTUATE"); @@ -1419,7 +1423,6 @@ void TLiquidazione_app::set_grand(_DescrItem& d) set_row(5,"@11g@bCALCOLO LIQUIDAZIONE D'IMPOSTA@r"); set_row(6,""); int rw = 7; set_row(rw++," @66gCredito@84gDebito"); set_row(rw++,""); - if (_isannual) iva_vend.round(ROUND_MILLELIRE); set_row(rw++,"@11gIva sulle operazioni di vendita@75g%r", &iva_vend); set_row(rw++,"%s@11gRettifiche IVA a debito%s@75g%r", _is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &rett_debt); @@ -1427,34 +1430,27 @@ void TLiquidazione_app::set_grand(_DescrItem& d) _is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &rimborso); // conguaglio prorata - if (conguaglio.sign() > 0) + if (conguaglio.sign() > 0) set_row(rw++,"@11gConguaglio pro-rata@75g%r", &conguaglio); // debito liq. precedente < 50000 if (debt_prec > ZERO) set_row(rw++,"@11gDebito da liquidazione precedente@75g%r", &debt_prec); - if (_isannual) res_debt.round(ROUND_MILLELIRE); set_row(rw++,"@11gRISULTATO@75g%r", &res_debt); - if (_isannual) iva_acq.round(ROUND_MILLELIRE); set_row(rw++,"@11gIva sulle operazioni di acquisto@58g%r", &iva_acq); - if (_isannual) cred_prec.round(ROUND_MILLELIRE); if (_isannual || d._f1) set_row(rw++,"@11gCredito inizio anno@58g%r", &cred_prec); else set_row(rw++,"@11gCredito precedente@58g%r", &cred_prec); if (!acc_dec.is_zero()) - { - if (_isannual) acc_dec.round(ROUND_MILLELIRE); set_row(rw++,"%s@11gVersamento acconto dicembre%s@58g%r", _is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &acc_dec); - } + if (!detrazioni.is_zero()) - { - if (_isannual) detrazioni.round(ROUND_MILLELIRE); set_row(rw++,"@11gUlteriori detrazioni@58g%r", &detrazioni); - } + set_row(rw++,"%s@11gRettifiche IVA a credito%s@58g%r", _is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &rett_cred); @@ -1477,7 +1473,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d) cg = -cg; set_row(rw++,"@11gConguaglio pro-rata@58g%r", &cg); } - if (_isannual) res_cred.round(ROUND_MILLELIRE); + set_row(rw++,"@11gRISULTATO@58g%r", &res_cred); // se non c'e' nulla da versare stampa solo una riga vuota @@ -1642,25 +1638,42 @@ void TLiquidazione_app::set_grand(_DescrItem& d) TString cab (ac.get(3)); if (atof(vr) == 0.0 && vr[vr.len()-1] == '0') vr[vr.len()-1] = ' '; set_row(rw++, "- ACCONTO DICEMBRE -"); - set_row(rw++, "Versamento di L. %s effettuato il %s@68gdiretto all'ufficio IVA di %s", + set_row(rw, "Versamento di L. %s effettuato il %s", (const char*)vr, - (const char*)dt, - (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); + (const char*)dt); + if (abi.not_empty() || cab.not_empty()) + { + 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 + { + set_row(rw++, "@68gdiretto al Ministero delle Finanze"); + set_row(rw++, "@68gConcessione %s", (const char*)loc); + } } set_row(rw++, "- SALDO -"); } //fine - set_row(rw++, "Versamento di L. %s effettuato il %s@68gdiretto all'ufficio IVA di %s", + set_row(rw, "Versamento di L. %s effettuato il %s", (const char*)vr, - (const char*)dt, - (const char*)(di._s0)); - set_row(rw++, "@68gtramite %s", (const char*)(di._s1)); - set_row(rw++, "@68gcodice azienda %s codice dipendenza %s", - (const char*)(di._s2), (const char*)(di._s3)); + (const char*)dt); + if ((di._s2).not_empty() || (di._s3).not_empty()) + { + set_row(rw++, "@68gdiretto all'ufficio IVA di %s", + (const char*)(di._s0)); + set_row(rw++, "@68gtramite %s", (const char*)(di._s1)); + set_row(rw++, "@68gcodice azienda %s codice dipendenza %s", + (const char*)(di._s2), (const char*)(di._s3)); + } + else + { + set_row(rw++, "@68gdiretto al Ministero delle Finanze"); + set_row(rw++, "@68gConcessione %s", (const char*)(di._s0)); + } } } } @@ -2042,9 +2055,9 @@ else } else set_row(1,"@62g%r@91g%s", &(d._r1), d._f3 ? "Si" : "No"); } - else + else //metodo storico { - if (d._f1) // stampa base di calcolo + if (d._f1 && (d._r0).sign()>0) // stampa base di calcolo set_row(1,"@58g%r@88g%r", &(d._r0), &(d._r1)); else set_row(1,"@87g%r",&(d._r1)); diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index 773746cbc..dd973047a 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -2658,7 +2658,10 @@ bool CG4400_application::setta_mask(long i) if (_u_data.ok()) mb.set(U_DATA, _u_data.string()); KEY tasto = mb.run(); - if (tasto != K_ENTER) return FALSE; + if (tasto != K_ENTER) return FALSE; + //correzione errore MI3213 + _pagine_stampate = mb.get_long(U_PAGINA); + // } return TRUE; }