diff --git a/cg/cg0400.cpp b/cg/cg0400.cpp index 7ac5adb0e..27083e936 100755 --- a/cg/cg0400.cpp +++ b/cg/cg0400.cpp @@ -297,7 +297,7 @@ void TProgressivi_iva::look_pim() if (anno != _anno) continue; if (_st_inizio_anno) - if (mese > _mese) + if ((mese > _mese) || (_mese == 13 && mese < 13)) continue; if (!_st_inizio_anno) diff --git a/cg/cg4.cpp b/cg/cg4.cpp index 2c6a1414b..4e910e396 100755 --- a/cg/cg4.cpp +++ b/cg/cg4.cpp @@ -33,8 +33,8 @@ int main(int argc,char** argv) default: error_box(usage, argv[0]); } - - return n < 0; + exit(0); + return 0; } diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index c3d556bd1..ef76dc8c5 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -17,33 +17,32 @@ #include -// Methods of _BolgArray -bool _BolgArray::add(const real& val, const char* fld_name, int num_file) +// Methods of _Iva11Array +bool _Iva11Array::add(const real& val, const char* fld_name, int num_file) { - _BolgItem bolg; + _Iva11Item iva11; const bool is_key = TAssoc_array::is_key(fld_name); - _BolgItem& bi = is_key ? (_BolgItem&)find(fld_name) : bolg; + _Iva11Item& bi = is_key ? (_Iva11Item&)find(fld_name) : iva11; bi.value() += val; if (num_file != LF_TAB1100A) bi.file() = num_file; return TAssoc_array::add(fld_name,bi,is_key); } -bool _BolgArray::sub(const real& val, const char* fld_name, int num_file) +bool _Iva11Array::sub(const real& val, const char* fld_name, int num_file) { const real v1 = val * (-1.0); return add(v1,fld_name, num_file); } -void _BolgArray::zero(const char* fld_name) +void _Iva11Array::zero(const char* fld_name) { - _BolgItem bolg; + _Iva11Item iva11; const bool is_key = TAssoc_array::is_key(fld_name); - _BolgItem& bi = is_key ? (_BolgItem&)find(fld_name) : bolg; + _Iva11Item& bi = is_key ? (_Iva11Item&)find(fld_name) : iva11; bi.value() = 0.0; TAssoc_array::add(fld_name,bi,is_key); } - // Methods of application! real TLiquidazione_app::CENTO(100.0); @@ -422,10 +421,8 @@ bool TLiquidazione_app::set_print(int) break; case 2: // estrazione deleghe _isprint = FALSE; - //12/12/1995 _selected.reset(); _ditte->check(-1, FALSE); - //fine build_ditte_sheet(all); while (set_deleghe()) { @@ -449,10 +446,8 @@ bool TLiquidazione_app::set_print(int) case 3: // calcolo acconto _isprint = TRUE; _month = 12; - //12/12/1995 _selected.reset(); _ditte->check(-1, FALSE); - //fine build_ditte_sheet(all); real inf; real ina; // cotale obbrobrio non fu da me cercato, ne' mai condiviso while (set_acconto(inf, ina)) @@ -635,26 +630,6 @@ bool TLiquidazione_app::what_freq_handler(TMask_field& f, KEY key) return TRUE; } -bool TLiquidazione_app::lst_tm_handler(TMask_field& f, KEY key) -{ - if (key == K_SPACE) - { - TString s(f.get()); - if (s == "13") - { - f.mask().field(CG43_LST_CALC_13A).show(); - f.mask().field(CG43_LST_CALC).hide(); - f.mask().field(CG43_LST_CALC).set("3"); - } - else - { - f.mask().field(CG43_LST_CALC_13A).hide(); - f.mask().field(CG43_LST_CALC).show(); - } - } - return TRUE; -} - bool TLiquidazione_app::select_button(TMask_field& f, KEY key) { if (key == K_SPACE) @@ -748,8 +723,6 @@ bool TLiquidazione_app::set_liquidazione() m.set_handler(CG43_FLD_DFR, fr_ditt_handler); m.set_handler(CG43_RDB_VERS, what_freq_handler); m.set_handler(CG43_FLD_ANNO, ch_year_handler); - m.set_handler(CG43_LST_MESE, lst_tm_handler); - m.set_handler(CG43_LST_TRIM, lst_tm_handler); m.set_handler(CG43_BUT_SEL, select_button); m.set_handler(CG43_BUT_ANN, reset_button); diff --git a/cg/cg4300.h b/cg/cg4300.h index 859513247..e8783abdc 100755 --- a/cg/cg4300.h +++ b/cg/cg4300.h @@ -175,31 +175,30 @@ public: virtual ~_ErrItem() {} }; -// _BolgItem e' una contrazione di Bolgia, serve per memorizzare gli elementi -// da trasferire su tab1100 -class _BolgItem : public TObject +// _Iva11Item serve per memorizzare gli elementi da trasferire su tab1100 +class _Iva11Item : public TObject { real _value; int _file; public: - virtual TObject* dup() const { return new _BolgItem(*this); } + virtual TObject* dup() const { return new _Iva11Item(*this); } real& value() { return _value; } int& file() { return _file; } void zero() { _value = 0.0; _file = LF_TAB1100A; } - _BolgItem() { _file = LF_TAB1100A; } - virtual ~_BolgItem() {} + _Iva11Item() { _file = LF_TAB1100A; } + virtual ~_Iva11Item() {} }; -// Definisco solo i metodi add e sub, per aggiungere elementi _BolgItem +// Definisco solo i metodi add e sub, per aggiungere elementi _Iva11Item // per il resto e' un normalissimo TAssoc_array -class _BolgArray : public TAssoc_array +class _Iva11Array : public TAssoc_array { public: bool add(const real& val, const char* fld_name, int num_file = LF_TAB1100A); bool sub(const real& val, const char* fld_name, int num_file = LF_TAB1100A); void zero(const char* fld_name); - _BolgArray() {} - virtual ~_BolgArray() {} + _Iva11Array() {} + virtual ~_Iva11Array() {} }; // ------------------------------------------------------------------------ @@ -264,7 +263,7 @@ class TLiquidazione_app : public TPrint_application TAssoc_array _reg_arr; // cache dei registri. TAssoc_array _iva11_arr; // array contenente le informazioni da trasferire. // La chiave di ordinamento e' sul codice attivita'. - // Ogni elemento dell'array e' un _BolgArray + // Ogni elemento dell'array e' un _Iva11Array // La cui chiave e' a sua volta sul nome campo // totali vari per attivita' @@ -283,7 +282,7 @@ class TLiquidazione_app : public TPrint_application TCursor* _cur; // files, tables - TRelation* _tab11; // un giorno tab1100a e tab1100b sarano un unico file! + TRelation* _tab11; // un giorno tab1100a e tab1100b saranno un unico file! TRelation* _nditte; TLocalisamfile* _mov; TLocalisamfile* _rmoviva; diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 7dc5896d1..73e3272df 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -76,15 +76,6 @@ bool TLiquidazione_app::recalc_all() // riaggiusta relazione _nditte->read(); - // decidi per stocazzo di annuale - // ***************** Previous kasin *************************** - // per QUALSIASI annuale il mese diventa 13 -// _isannual = (_month == 12 && !mens && !_isbenzinaro) || -// (_month == 13 && (mens || _isbenzinaro)); -// _isriepilogo = _month == 13 && !mens; -// if (_isannual) _month = 13; // che ti piaccia o no - // ************************************************************ - // strasemplificato: per l'annuale si sceglie annuale, altrimenti // e' la 12ma anche per le trimestrali. _isannual = _isriepilogo = _month == 13; @@ -99,14 +90,15 @@ bool TLiquidazione_app::recalc_all() _canprint = is_month_ok_strict(_month) || _month == 13; /* -------------------------------------------------------------- - * Ricalcola i mesi necessari, tutti se annuale + * Ricalcola i mesi necessari: annuale e' un mese unico da 1/1 al 31/12 * -------------------------------------------------------------- */ int need_refresh = FALSE; if (_recalc != ever) { - for (int m = 1; m < _month; m++) + int m = _month == 13 ? _month : 1; + for (; m < _month; m++) if (is_month_ok_strict(m) && (!look_lim(m) || !_lim->get_bool("B0"))) { need_refresh = TRUE; @@ -158,19 +150,12 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) // stato effettuato per scelta dello stronzo commercialista. look_lim(liq_month(month), TRUE); - //modifica del 19/01/1996 - //if (_isfinal && _lim->get_bool("B1")) // && _month != 13) - // return TRUE; - //fine { TConfig cnf(CONFIG_DITTA, "cg"); - //MI3262... - //_isdiffacc = cnf.get_bool("GeLiDi"); //usato per stampa acconto in coda ai registri _isdiffacc = is_differita(); - - _isdifferita = _isdiffacc;// && _month != 13; + _isdifferita = _isdiffacc; _isintr = !cnf.get_bool("InTrTr") && _freqviva != "M"; if (_isbenzinaro) _gest4 = cnf.get_bool("GesT74"); @@ -178,7 +163,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) // nel caso, differita va a FALSE _monthinatt = 1; } - TDate inatt(_nditte->lfile().get("DINIZIOATT")); + TDate inatt(_nditte->lfile().get("DINIZIOATT")); { if (is_in_liq_period(inatt)) _isdifferita = FALSE; if (inatt.year() == atoi(_year)) _monthinatt = inatt.month(); @@ -201,10 +186,8 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) zero_firm(month); // casini per stampa minchie in coda ai registri - //22/12/1995 bool riepliq = _isregis ? _riepilogo : FALSE; bool stliq = TRUE; - //fine _nditte->save_status(); if (_nditte->is_first_match(LF_ATTIV)) @@ -230,9 +213,10 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) if (_prind) _prind->set_text(buf); // se ricalcola l'annuale si tiene tutte le vendite e corrispettivi di - // tutti i lerci mesi - // Analogamente se sta calcolando una trimestrale - if (!(_month == 13 && month > 1 || _freqviva == "T" && (month != 4 && month != 7 && month != 10))) + // tutti i lerci mesi. Analogamente se sta calcolando una trimestrale. + // Nel caso di trimestrale con ricalcolo trimestri precedenti azzera + // ad ogni inizio di trimestre. + if (!(_freqviva == "T" && (month != 4 && month != 7 && month != 10 && month != 13))) { _vend_arr.destroy(); _corr_arr.destroy(); @@ -285,15 +269,10 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) for (_reg->first(); _reg->good(); _reg->next()) { - //22/12/1995 - //if (codatt == _reg->get("S8") || quater) if (codatt == _reg->get("S8")) { - //if (!riepliq) riepliq = _reg->get_bool("B6"); - //if (!stliq) stliq = _reg->get_bool("B7"); if (_reg->get_int("I0") == 2) if (!_isvent) _isvent = _reg->get_bool("B3"); - //fine } } @@ -307,10 +286,8 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) if (!update_att(month, cattiv) && stliq) describe_error("Attivita' non ricalcolate: possibili errori", codatt); - //13/12/1995 if (month == 13) recalc_annual(cattiv); - //fine // vediamo se c'e' qualcosa da raccontare gheravergot = _isannual || _isriepilogo; @@ -337,11 +314,6 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) // sui files adibiti a mantenere le informazioni per IVA 11: tab1100a e tab1100b if (_is_interactive && month == 13) iva11_set_arr_pim(codatt); // scorre tutti i maledetti PIM di questa ditta/attivita' per completare _iva11_arr - // Ehm. Ehmm... Nota da fare in futuro non appena si ha un poco di tempo. - // Attualmente iva11_set_arr() scorre tutti i PIM. Tale funzione viene chiamata per ogni - // attivita' della ditta corrente. - // Si potrebbe ottimizzare il tutto scorrendo PIM una sola volta per tutte le ditte e tutte le - // attivita' (ovviamente solo per il mese 13). } while (_nditte->next_match(LF_ATTIV)); @@ -362,7 +334,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) // Se siamo in annuale e se non e' stato indicato di ricalcolare (stampa liquidazione chiamata // dalla stampa registri) non riscrivere i risultati delle liquidazioni, - if ((is_month_ok_strict(month) && _month != 13 && _recalc != never) || month == 13) + if ((is_month_ok_strict(month) && _month != 13 && _recalc != never) || _is_interactive /*month == 13*/ ) write_liq(month, atts); // rimborso infraannuale @@ -422,13 +394,12 @@ bool TLiquidazione_app::update_att(int month, const char* codatt, { zero_att(month,codatt); recalc_att(month,codatt); - if (_freqviva == "M" || (_freqviva == "T" && is_trim(month)) || _month == 13) + // Ricalcolo ventilazione: + // - tutti i mesi se e' mensile + // - nei mesi 3,6,9,12 se trimestrale + if (_freqviva == "M" || (_freqviva == "T" && is_trim(month))) recalc_ventilation(month, codatt); recalc_corrispettivi(month, codatt); - //13/12/1995 - // if (month == 13) - // recalc_annual(codatt); - //fine } return ok || calc; @@ -550,7 +521,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) real agr_imp = 0.0; real agr_iva = 0.0; - if (!_isviaggio) + // Spiegazione dell'arcano segreto sulle agenzie viaggio: + // non viene applicata la setregion() al cursore perche' e' necessario + // tenere conto della DATA74TER se presente. + if (!_isviaggio) { TRectype from(_cur->curr()); from.zero(); TRectype to(from); @@ -651,7 +625,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) TString codiva = _iva->get("CODTAB"); TString tipoiva = _iva->get("S1"); - TString riga11_v = _iva->get("S0"); TString tipoes_v = _iva->get("S2"); TString tipoes_a = _iva->get("S9"); int tipoagr = atoi(_iva->get("S4")); @@ -689,31 +662,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) * considerano (Scudler 1994) */ - /* - * In liq. annuale si totalizzano - * solo le stranezze che seguono - */ - if (month == 13) - { - // Filling dell'array per IVA11 - if (_is_interactive && _month == 13) - iva11_set_arr(trueatt); - - - // si contano soltanto le vendite. - bool okc = tipomov == vendita; - // purche' ... - bool cond1 = (rcs.get_bool("AUTOFATT") && tipoiva == "NS" && tipodoc == "AF"); - // oppure ... - bool cond2 = (rcs.get_bool("AUTOFATT") && tipoiva == "NS" && tipodoc != "AF" && - rcs.get_bool("INTRACOM") && rcs.get_bool("VALINTRA")); - /* - * Fatture in ritardo vengono considerate solo in dichiarazione - * annuale, ma vanno comunque sommate per i porci registri - */ - if (!(okc && (cond1 || cond2)) && !fattrit) - continue; - } + // Filling dell'array per IVA11 + if (_is_interactive && month == 13) + iva11_set_arr(trueatt); if (noninc) // non incassati: non devono entrare in nessun altro calcolo { @@ -1003,7 +954,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) * possono anche essere sul registro vendite. Indi le schiaffo dentro * a R5 e R6 anche nel caso vi sia un documento FS registrato sul registro * delle vendite. Nel caso in futuro si accorgessero finalmente della puttanata - * galattiche che mi hanno fatto fare basta eliminare il controllo su FS + * galattica che mi hanno fatto fare basta eliminare il controllo su FS * nel caso si tratti di non corrispettivi (vedi sotto). * Da togliere anche nella :describe_pim() in cg4304.cpp. * @@ -1150,68 +1101,66 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) } imp += imponibile; ivp += imposta; - //fci += imponibile; - //fcv += imposta; - _pim->put("I0",NETTO); - } - } // if corrisp - else // non corrisp - { // imponibile e imposta separata - imp += imponibile; - ivp += imposta; - if (tipodoc == "FS") // Questo e' per l'errore MI3404 - { // Dicono che una volta funzionasse, ci credo poco... - ifs += imponibile; // Anyway, comincio a condividere appieno i commenti sparsi qua e - vfs += imposta; // la da Ferdinando... - } _pim->put("I0",NETTO); } + } // if corrisp + else // non corrisp + { // imponibile e imposta separata + imp += imponibile; + ivp += imposta; + if (tipodoc == "FS") // Questo e' per l'errore MI3404 + { + ifs += imponibile; + vfs += imposta; + } + _pim->put("I0",NETTO); + } - if (autodafe) // autofatture non residenti art, 17 - { - /* - * Si devono riportare a parte in annuale - * e non comparire nel riepilogo del codice IVA - * corrispondente, solo se la liq. e' annuale - * Li metto in R7/R8 di pim e li sommo anche nelle - * vendite; la describe_pim() dovra' sommarli su tutti i - * pim, scorporarli dalle rispettive vendite - * e assegnarli al codice IVA AF in caso di liq. annuale - */ - adf += imponibile; - adi += imposta; - } + if (autodafe) // autofatture non residenti art, 17 + { + /* + * Si devono riportare a parte in annuale + * e non comparire nel riepilogo del codice IVA + * corrispondente, solo se la liq. e' annuale + * Li metto in R7/R8 di pim e li sommo anche nelle + * vendite; la describe_pim() dovra' sommarli su tutti i + * pim, scorporarli dalle rispettive vendite + * e assegnarli al codice IVA AF in caso di liq. annuale + */ + adf += imponibile; + adi += imposta; + } - if (art40) // ammontare acq. intr. art40 c. 5/6/8 - { // Analogamente alle autofatture, si devono riportare a parte in annuale - // Vengono piazzati in una TToken_string con separatore = a '!'. - // La TToken_string viene registrata in S0. - // La describe_pim() sommera' tutte le storie, scorporandoli - // dalle vendite e assegnandoli al codice A13 in caso di liq annuale. - a13i += imponibile; - a13v += imposta; - } + if (art40) // ammontare acq. intr. art40 c. 5/6/8 + { // Analogamente alle autofatture, si devono riportare a parte in annuale + // Vengono piazzati in una TToken_string con separatore = a '!'. + // La TToken_string viene registrata in S0. + // La describe_pim() sommera' tutte le storie, scorporandoli + // dalle vendite e assegnandoli al codice A13 in caso di liq annuale. + a13i += imponibile; + a13v += imposta; + } - if (corrisp && !true_corrisp) - { - fci += imponibile; - fcv += imposta; - } + if (corrisp && !true_corrisp) + { + fci += imponibile; + fcv += imposta; + } - if (!ign) - { - _pim->put("R0",imp); - _pim->put("R1",ivp); - _pim->put("R2",lor); - _pim->put("R3",lorcor); // Corrispettivi, non inclusi quelli da ventilare - _pim->put("R5",ifs); - _pim->put("R6",vfs); - _pim->put("R7",adf); - _pim->put("R8",adi); - _pim->put("R9",bdi); - _pim->put("R10",bdv); - _pim->put("R13",fci); - _pim->put("R14",fcv); + if (!ign) + { + _pim->put("R0",imp); + _pim->put("R1",ivp); + _pim->put("R2",lor); + _pim->put("R3",lorcor); // Corrispettivi, non inclusi quelli da ventilare + _pim->put("R5",ifs); + _pim->put("R6",vfs); + _pim->put("R7",adf); + _pim->put("R8",adi); + _pim->put("R9",bdi); + _pim->put("R10",bdv); + _pim->put("R13",fci); + _pim->put("R14",fcv); } // questi servono per i ricalcoli altrui (classify_pim) o @@ -1290,9 +1239,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) if (!_prorata.is_zero() && month != 13) { prorata = acquisti_iva * (_prorata / CENTO); - //13/12/1995 - //prorata.round(ROUND_MILLELIRE); - //fine acquisti_iva -= prorata; } look_plm(month, codatt, TRUE); @@ -1444,9 +1390,9 @@ void TLiquidazione_app::iva11_set_arr(const TString& codatt) const bool is_acquisto = tipomov == acquisto; - _BolgArray b_arr; + _Iva11Array b_arr; const bool is_key = _iva11_arr.is_key(codatt); - _BolgArray& array = is_key ? (_BolgArray&)_iva11_arr.find(codatt) : b_arr; + _Iva11Array& array = is_key ? (_Iva11Array&)_iva11_arr.find(codatt) : b_arr; // TAB11_RQA34 ovvero "RQA34" non viene trasferito! @@ -1612,56 +1558,11 @@ void TLiquidazione_app::iva11_set_arr(const TString& codatt) if (is_vendita) { if (corrisp && tipoiva != "VE" && (tipodoc == "CR" || tipodoc == "RF" || tipodoc == "SC") ) -// x13 return; -/* - { - return; - real p = ali/CENTO; - lordo2netto(imponibile,imposta,p);// In tal caso scorpora l'iva dall'imponibile... - } -*/ -// fine x13 if (tipodoc == "CN" || tipodoc == "SN" || tipodoc == "RN") // salta i non incassati return; if (!valintra) { -// x13 -/* if (tipodoc != "AF" && ((_isagricolo && tipoagr==2) || !_isagricolo)) - { - if (ali == 4.00) - { - array.add(imponibile,TAB11_EC101); - array.add(imposta,TAB11_EC201); - } - else if (ali == 9.00) - { - array.add(imponibile,TAB11_EC102); - array.add(imposta,TAB11_EC202); - } - else if (ali == 10.00) - { - array.add(imponibile,TAB11_EC103); - array.add(imposta,TAB11_EC203); - } - else if (ali == 13.00) - { - array.add(imponibile,TAB11_EC104); - array.add(imposta,TAB11_EC204); - } - else if (ali == 16.00) - { - array.add(imponibile,TAB11_EC105); - array.add(imposta,TAB11_EC205); - } - else if (ali == 19.00) - { - array.add(imponibile,TAB11_EC106); - array.add(imposta,TAB11_EC206); - } - } -*/ -// fine x13 if (tipoes_v == "24") array.add(imponibile,TAB11_EC107); if (tipoes_v == "21") @@ -1777,9 +1678,9 @@ void TLiquidazione_app::iva11_set_arr_pim(const TString& codatt) int tipocr,tipodet,tagr; real aliq, imp, iva, vtot, atot, ivav, ivaa, adf, adi, a13i, a13v; TString16 cur_att; - _BolgArray b_arr; + _Iva11Array b_arr; const bool is_key = _iva11_arr.is_key(codatt); - _BolgArray& array = is_key ? (_BolgArray&)_iva11_arr.find(codatt) : b_arr; + _Iva11Array& array = is_key ? (_Iva11Array&)_iva11_arr.find(codatt) : b_arr; // Scorporo corretto dei corrispettivi in R3 TAssoc_array corr_ann; _CorrItem cx,*cc; @@ -1788,6 +1689,7 @@ void TLiquidazione_app::iva11_set_arr_pim(const TString& codatt) for (_pim->first(); !_pim->eof(); _pim->next()) { if (_year != *_pim_anno) continue; + if (*_pim_mese != "13") continue; cur_att = *_pim_codatt; cur_att.rtrim(1); if (codatt != cur_att) continue; // considera solo quelli dell'anno, obviously. @@ -2017,13 +1919,12 @@ void TLiquidazione_app::iva11_set_arr_pim(const TString& codatt) } - // Hisss... Rettifica l'importo di EC115: EC115 = EC116 + EC117 + EC115 - // Va beh... + // Mmmhh.. Rettifica l'importo di EC115: EC115 = EC116 + EC117 + EC115 real r16, r17; if (array.is_key(TAB11_EC116)) - r16 = ((_BolgItem&)array[TAB11_EC116]).value(); + r16 = ((_Iva11Item&)array[TAB11_EC116]).value(); if (array.is_key(TAB11_EC117)) - r17 = ((_BolgItem&)array[TAB11_EC117]).value(); + r17 = ((_Iva11Item&)array[TAB11_EC117]).value(); r17+=r16; array.add(r17,TAB11_EC115); @@ -2035,8 +1936,7 @@ void TLiquidazione_app::iva11_set_arr_pim(const TString& codatt) array.add(ala,TAB11_R1,LF_TAB1100B); array.add(alv,TAB11_R2,LF_TAB1100B); - // Uargh, Uargh. Mo' mi pappo i PLM per compilare T1, T1C, T2, T2C, T3, T5 e T6 - // Ah, Ah, Ah! + // Mo' si pappa i PLM per compilare T1, T1C, T2, T2C, T3, T5 e T6 // ATTENZIONE: solo per i regimi 74ter (ag. viaggio) for (_plm->first();!_plm->eof();_plm->next()) { @@ -2067,11 +1967,11 @@ void TLiquidazione_app::iva11_write(bool reset_r1r2) TString ditta,attiv,fld_name; - _BolgArray * bolg_arr; - _BolgItem * bolg; + _Iva11Array * iva11_arr; + _Iva11Item * iva11; int i=0,err; // Ciclo sulle attivita' - for (bolg_arr = (_BolgArray *) _iva11_arr.first_item(); bolg_arr != NULL && i < items; i++,bolg_arr = (_BolgArray*)_iva11_arr.succ_item()) + for (iva11_arr = (_Iva11Array *) _iva11_arr.first_item(); iva11_arr != NULL && i < items; i++,iva11_arr = (_Iva11Array*)_iva11_arr.succ_item()) { // Setta i campi chiave per entrambi i files della relazione ditta.format("%05ld",_nditte->curr().get_long(NDT_CODDITTA)); @@ -2085,14 +1985,14 @@ void TLiquidazione_app::iva11_write(bool reset_r1r2) tab1100b.put(TAB11_TADITT,ditta); tab1100b.put(TAB11_TACATT,attiv); - const int bolg_items = bolg_arr->items(); + const int iva11_items = iva11_arr->items(); int j=0; // Ciclo sugli elementi per compilare i campi della relazione - for (bolg = (_BolgItem *)bolg_arr->first_item(); bolg != NULL && jsucc_item()) + for (iva11 = (_Iva11Item *)iva11_arr->first_item(); iva11 != NULL && jsucc_item()) { - fld_name = bolg_arr->get_hashobj()->key(); + fld_name = iva11_arr->get_hashobj()->key(); if (reset_r1r2 && (fld_name == TAB11_R1 || fld_name == TAB11_R2)) continue; // salta R1/R2 se devono rimanere a zero - _tab11->lfile(bolg->file()).put(fld_name,bolg->value()); + _tab11->lfile(iva11->file()).put(fld_name,iva11->value()); } if (_tab11->write() != NOERR) @@ -2183,8 +2083,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) differita = FALSE; } } - - for (int m = 1; m <= 13; m++) + // Modifiche per PIM13 + int m = (month == 13) ? 13 : 1; + for (; m <= 13; m++) { // ciclo su tutti i mesi del caso (1 o 3; // tutti se annuale) @@ -2428,9 +2329,11 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) look_pla(att, TRUE); _pla->put("R8", prorata); _pla->rewrite(); - look_lia(); - _lia->put("R5", cred_cost); - _lia->rewrite(); + if (look_lia(0l, TRUE)) + { + _lia->put("R5", cred_cost); + _lia->rewrite(); + } _year = yr; } } @@ -2477,8 +2380,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) /* * acconto dicembre se previsto */ - //if ((month == 12 && _isbenzinaro) || - // (month >= 12 && _freqviva == "M")) if (((month+deltam) >= 12 && _freqviva == "M") || //solo freq. M puo' (month == 12 && _isbenzinaro && _gest4) || //essere differita (month == 13 && _freqviva == "T")) @@ -2518,7 +2419,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) * FALSE per ditte mensili e liq. annuale * Ulteriormente smentito e rettificato */ - //if (_isintr && month < 13) bool true_trim = (month == 3 || month == 6 || month == 9); if (_isintr && ( true_trim || (month == 12 && _isbenzinaro && _gest4) || (month == 13 && !(_isbenzinaro && _gest4)) )) @@ -2530,7 +2430,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) } //questo serve anche per la visualizzazione e per l'estrazione deleghe - //if (_isintr && month < 13) if (_isintr && ( true_trim || (month == 12 && _isbenzinaro && _gest4) || (month == 13 && !(_isbenzinaro && _gest4)) )) _lim->put("R10",interesse_trimestrale(_month)); @@ -2547,19 +2446,13 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) _lim->put("R12", res_cred); _lim->put("R13", res_debt); - //modifica del 19/01/1996 - //if (!_recalc_only) if (!_recalc_only && _recalc != never) { _lim->put("B0","X"); _lim->put("B1","X"); } - //fine - //modifica del 19/01/1996 - //if (_isfinal) _lim->put("B1", "X"); if (_recalc_only) _lim->put("B1", "X"); - //fine if (wasdifferita) _isdifferita = TRUE; @@ -2571,18 +2464,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) if (month == 13) { // molto codice duplicato, ma ne val la pena (vedi sopra) - //iva_vend.round(ROUND_MILLELIRE); - //iva_acq.round(ROUND_MILLELIRE); - //detrazioni.round(ROUND_MILLELIRE); - //versamenti.round(ROUND_MILLELIRE); - //vers_int.round(ROUND_MILLELIRE); - //rimborsi.round(ROUND_MILLELIRE); - //rettifiche.round(ROUND_MILLELIRE); - //deb_mens.round(ROUND_MILLELIRE); - //cred_prec.round(ROUND_MILLELIRE); - //tot_cong.round(ROUND_MILLELIRE); - //acc_dec.round(ROUND_MILLELIRE); - //debt_precd.round(ROUND_MILLELIRE); round_mille_lire(iva_vend); round_mille_lire(iva_acq); round_mille_lire(detrazioni); @@ -2608,19 +2489,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) if (!_isagricolo) res_cred += detrazioni; -// res_debt.round(); -// res_cred.round(); - -// TString r1(res_debt.string()); -// TString r2(res_cred.string()); - -// real rd(r1); -// real rc(r2); - risultato = res_debt - res_cred; -// TString r3(risultato.string()); - // tut ricalcule', riscrivem _lim->put("R0", risultato); _lim->put("R2", cred_cost); @@ -2686,7 +2556,8 @@ void TLiquidazione_app::recalc_annual(const char* att) for (_pim->first(); !_pim->eof(); _pim->next()) { - if (_year != *_pim_anno) continue; + if (_year != *_pim_anno || _month != atoi(*_pim_mese)) // In questo caso _month vale sempre 13 + continue; int tipocr = atoi(*_pim_tipocr); codiva = *_pim_codiva; @@ -2745,7 +2616,7 @@ void TLiquidazione_app::recalc_annual(const char* att) // calcola esenti, cessioni, lordo vendite, prorata pagato // e IVA acquisti dai plm/ptm/pum/pam/pom - for (int i = 1; i <= 13; i++) + for (int i = 1; i <= 12; i++) { if (!look_plm(i,aaa)) continue; @@ -2758,6 +2629,19 @@ void TLiquidazione_app::recalc_annual(const char* att) cess_amm += _pum->get_real("R0"); pro_pag += _plm->get_real("R2"); } + + // Modifiche per PIM13 + if (look_plm(13,aaa)) + { + // Nota: + // l'iva acquisti del mese 13 memorizzata in PLM->R1, e' si' la sommatoria + // di tutte le imposte relative agli acquisti di tutti i mesi, ma andrebbe sottratto il + // totale prorata pagato (pro_pag), reperibile dai mesi precedenti (PLM->R2) + real iv = _plm->get_real("R1"); // Iva acquisti annuale + iv -= pro_pag; // Si sottraggano i prorata pagati + _plm->put("R1",iv); // Si riscriva il tutto + _plm->rewrite(); + } _pla->put("R0", vendite); _pla->put("R1", es_b1); diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index 8cac27c03..89256c1fb 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -183,16 +183,7 @@ void TLiquidazione_app::add_corrisp(int month, const char* codreg, real& r, void TLiquidazione_app::lordo2netto(const real& totale, real& imponibile, real& imposta, const real& aliquota) { - /* *** Questo e' stato preso da recalc_corrispettivi() - real imposta = (abs(ci->_totale) * ci->_aliquota)/(ci->_aliquota + 1.00); - imposta.ceil(); - if (ci->_totale.sign() < 0) imposta = -imposta; - real imponibile = ci->_totale - imposta; - // quadratura del cerchione - real delta = ci->_totale - imponibile - imposta; - if (!delta.is_zero()) - imposta += delta; - */ + /* *** Questo e' stato preso da recalc_corrispettivi() */ imposta = (abs(totale) * aliquota)/(aliquota + 1.00); imposta.ceil(); if (totale.sign() < 0) imposta = -imposta; @@ -271,7 +262,6 @@ bool TLiquidazione_app::look_pum(int m, const char* a, bool create) bool ok = FALSE; _pum->zero(); - //(*_pum_codatt) = format("%06ld", atol(a)); (*_pum_codatt) = format("%6s", a); (*_pum_mese) = format("%02d",m); (*_pum_anno) = _year; @@ -294,7 +284,6 @@ bool TLiquidazione_app::look_pom(int m, const char* a, bool create) bool ok = FALSE; _pom->zero(); - //(*_pom_codatt) = format("%06ld", atol(a)); (*_pom_codatt) = format("%6s", a); (*_pom_mese) = format("%02d",m); (*_pom_anno) = _year; @@ -317,7 +306,6 @@ bool TLiquidazione_app::look_pam(int m, const char* a, bool create) bool ok = FALSE; _pam->zero(); - //(*_pam_codatt) = format("%06ld", atol(a)); (*_pam_codatt) = format("%6s", a); (*_pam_mese) = format("%02d",m); (*_pam_anno) = _year; @@ -452,7 +440,6 @@ bool TLiquidazione_app::look_ppa(int month, const char* codatt, int type, bool c _ppa->zero(); (*_ppa_year) = _year; (*_ppa_month) = format("%02d",month); - //(*_ppa_codatt) = format("%06ld", atol(codatt)); (*_ppa_codatt) = format("%6s", codatt); (*_ppa_kind) = type; TString ctab = _ppa_r->get("CODTAB"); @@ -527,10 +514,6 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) 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"); @@ -726,14 +709,11 @@ real TLiquidazione_app::versamenti_IVA(int month, const char* types, bool intr) int tp = typ.get_int(i); if (look_del(month,tp)) { - //if (_del->get_bool("B0") || _is_visliq) // solo se stampata, a meno - // che non sia per visliq real importo_dovuto_non_arrotondato(_del->get_real("R2")); real interessi(_del->get_real("R1")); real importo_dovuto_arrotondato(_del->get_real("R0")); real work(importo_dovuto_non_arrotondato); - //work.round(ROUND_MILLELIRE); round_mille_lire(work); if (_month == 13 && _freqviva == "T" && importo_dovuto_arrotondato == work) ret += importo_dovuto_non_arrotondato; // Questo e' l'importo lordo non arrotondato!! @@ -839,10 +819,5 @@ bool TLiquidazione_app::look_conc(TString& uffcon, TString& uffiva) 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/cg4303.cpp b/cg/cg4303.cpp index 1eb8de9fe..02970608f 100755 --- a/cg/cg4303.cpp +++ b/cg/cg4303.cpp @@ -6,22 +6,6 @@ #include "cg4300.h" -class Annual_item : public TObject -{ - real _imposta; - real _imponibile; - TString _codiva; - TString _other; -public: - virtual TObject* dup() const { return new Annual_item(*this); } - real& imposta() { return _imposta;} - real& imponibile() { return _imponibile;} - TString& codiva() { return _codiva;} - TString& other() { return _other;} - Annual_item() { _imposta = 0.0; _imponibile = 0.0; _codiva = ""; _other = ""; } - virtual ~Annual_item() {} -}; - void TLiquidazione_app::add_plafond(int month, const char* codatt, int type, real& howmuch, bool intra) { @@ -35,13 +19,6 @@ void TLiquidazione_app::add_plafond(int month, const char* codatt, int type, if (intra) r1 += howmuch; else r0 += howmuch; - //06/12/1995 - /* - if (r2 < (r0+r1)) - describe_error("Acquisti in eccesso rispetto al plafond disponibile", - att.cut(5)); - */ - //fine _ppa_r->put("R0",r0); _ppa_r->put("R1",r1); _ppa->rewrite(); @@ -100,44 +77,13 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt) const int items = _corr_arr.items(); if (items == 0) return; real imponibile,imposta; - // Nota: i commenti marcati con x13 indicano modifiche da rimuovere non appena implementato - // correttamente il mese 13 - // x13 - TString key; - bool is_key; - TAssoc_array corr_ann; // Contiene corrispettivi annuali (temporaneo, da correggere - // non appena implementato correttamente il mese 13) - _CorrItem cx; - // Se siamo in annuale non aggiornare i PIM/PAM/PLM dei mesi calcolati - if (_month == 13 && month < 13) return; - // fine x13 // ricalcola (solo per il mese in corso!) operando sull'array for (int i = 0; i < items; i++) { _CorrItem* ci = (_CorrItem*)&_corr_arr[i]; // memorizza per codiva - // x13 - if ((month != 13 && ci->_month != month) || ci->_codatt != codatt) continue; - - key = ci->_codiva; - is_key = corr_ann.is_key(key); - cx._totale = 0; - _CorrItem& ca = is_key ? (_CorrItem&) corr_ann[key] : cx; - ca._totale += ci->_totale; - if (!is_key) // se non c'e' lo aggiunge - { - ca._aliquota = ci->_aliquota; -/* - ca._codreg = ci->_codreg; - ca._tipodet = ci->_tipodet; -*/ - corr_ann.add(key,ca); - } -/* - continue; - // fine x13 if (ci->_month != month || ci->_codatt != codatt) continue; @@ -154,54 +100,7 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt) vaf += imponibile; _pam->put("R1", vaf); _pam->rewrite(); - - // Aggiorno i luridi pim - look_pim(month, codatt, ci->_codreg, "", ci->_codiva, ci->_tipodet, TRUE); - - imponibile += _pim->get_real("R0"); - imposta += _pim->get_real("R1"); - _pim->put("R0", imponibile); - _pim->put("R1", imposta); - _pim->rewrite(); -*/ } - // Dopo aver calcolato la somma dei corrispettivi annualmente, li scorpora - // x13 - // if (month == 13) - //{ - real imp,iva,imp1,iva1; - _CorrItem* cc; - // Per le prossime scritture(PAM e PLM) uso impropriamente il mese 12, lo so e' terribile... - // ma non appena possibile il mese 13 sara' disponibile tutto sara' piu' bello. - //const int m = month == 13 ? 12 : month; - for (cc = (_CorrItem *)corr_ann.first_item(); cc != NULL; cc = (_CorrItem *)corr_ann.succ_item()) - { - lordo2netto(cc->_totale, imp, iva, cc->_aliquota); - imponibile += imp; - imposta += iva; -/* - look_pim(m, codatt, cc->_codreg, "", corr_ann.get_hashobj()->key(), cc->_tipodet, TRUE); - imp1 = _pim->get_real("R0"); - iva1 = _pim->get_real("R1"); - imp1 += imp; - iva1 += iva; - _pim->put("R0",imp1); - _pim->put("R1",iva1); - _pim->rewrite(); -*/ - //} - } - look_plm(month, codatt); // Aggiorna l'iva vendite in PLM... - real ive = _plm->get_real("R0"); - ive += imposta; - _plm->put("R0",ive); - // ed il volume d'affari in PAM - real vaf = _pam->get_real("R1"); - vaf += imponibile; - _pam->put("R1",vaf); - _plm->rewrite(); - _pam->rewrite(); - // fine x13 } // ricalcolo della malefica ventilazione @@ -210,9 +109,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) if (!_isvent || _isagricolo || _isviaggio || _vend_arr.items() == 0) return; TString att(codatt); - - TArray annual_vent; - Annual_item a_item; + // 1) ricalcola i pim dei mesi dal primo al corrente se necessario recalc rcl = _recalc; @@ -223,7 +120,9 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) _vent_arr.destroy(); - for (m = 1; m <= month; m++) + m = month == 13 ? 13 : 1; // In annuale legge solo il PIM13 + + for (; m <= month; m++) { // aggiunge gli acquisti del mese m operando sui pim for (_pim->first(); !_pim->eof(); _pim->next()) @@ -275,33 +174,23 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) real totacq = 0.0; real totven = 0.0; - for (int j = 0; j < _vent_arr.items(); j++) + const int vent_items = _vent_arr.items(); + for (int j = 0; j < vent_items; j++) { _VentItem& vv = (_VentItem&)_vent_arr[j]; totacq += vv._totale; } - const bool is_annual_or_trim = (_month == 13 && month == 13) || (_freqviva == "T"); - for (j = 0; is_annual_or_trim && j < _vend_arr.items(); j++) - { - _VendItem& vi = (_VendItem&)_vend_arr[j]; - totven += vi._totale; - } - // 3) ricalcola (solo per il mese in corso!) operando sull'array - for (int i = 0; i < _vend_arr.items(); i++) + const int vend_items = _vend_arr.items(); + for (int i = 0; i < vend_items; i++) { _VendItem* vi = (_VendItem*)&_vend_arr[i]; - if (vi->_month != month && !is_annual_or_trim) - continue; - - // questo serve solo per il prospettino di m. - if (!is_annual_or_trim) totven += vi->_totale; // 3.2) calcola percentuali di ripartizione e prepara l'affettatrice - TDistrib dst(!is_annual_or_trim ? vi->_totale : totven,ROUND_LIRA); - for (j = 0; j < _vent_arr.items(); j++) + TDistrib dst(vi->_totale, ROUND_LIRA); + for (j = 0; j < vent_items; j++) { _VentItem* vv = (_VentItem*)&_vent_arr[j]; dst.add(vv->_totale/totacq); @@ -310,7 +199,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) // 3.3) affetta l'importo real tlor = 0.0; - for (j = 0; j < _vent_arr.items(); j++) + for (j = 0; j < vent_items; j++) { _VentItem* vv = (_VentItem*)&_vent_arr[j]; real imponibile = dst.get(); @@ -331,115 +220,37 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) if ((totven - tlor) == real(1.0)) imposta += real(1.0); - if (is_annual_or_trim) - { - // memorizza i dati della ventilazione annuale in un TArray - a_item.imposta() = imposta; - a_item.imponibile() = imponibile; - a_item.codiva() = vv->_codiva; - a_item.other() = vv->_other; - annual_vent.add(a_item); - continue; - } else if (_month != 13) - { - // aggiusto l'IVA vendite nei plm - look_plm(month, codatt); - real ive = _plm->get_real("R0"); - ive += imposta; - _plm->put("R0",ive); - _plm->rewrite(); - // .. e il volume di affari nei pam - real vaf = _pam->get_real("R1"); - vaf += imponibile; - _pam->put("R1", vaf); - _pam->rewrite(); + // aggiusto l'IVA vendite nei plm + look_plm(month, codatt); + real ive = _plm->get_real("R0"); + ive += imposta; + _plm->put("R0",ive); + _plm->rewrite(); + // .. e il volume di affari nei pam + real vaf = _pam->get_real("R1"); + vaf += imponibile; + _pam->put("R1", vaf); + _pam->rewrite(); - // Aggiorno i luridi pim - bool was = look_pim(month, codatt, vi->_codreg, "0", vv->_codiva, vi->_tipodet, TRUE); + // Aggiorno i luridi pim + bool was = look_pim(month, codatt, vi->_codreg, "0", vv->_codiva, vi->_tipodet, TRUE); - imponibile += _pim->get_real("R0"); - imposta += _pim->get_real("R1"); - _pim->put("R0", imponibile); - _pim->put("R1", imposta); - _pim->put("S4", vv->_other); - // segnale per comodita' in stampa prospetto - _pim->put("B1","X"); - // se e' nuovo, il segnale per usare l'importo nel calcolo del rimborso - // viene amorosamente messo a quanto il codice IVA prevede - if (!was) - { - look_iva(vv->_codiva); - _pim->put("I1", (long)vendita); - if (!_iva->get_bool("B4")) _pim->put("B3", "X"); - } - _pim->rewrite(); + imponibile += _pim->get_real("R0"); + imposta += _pim->get_real("R1"); + _pim->put("R0", imponibile); + _pim->put("R1", imposta); + _pim->put("S4", vv->_other); + // segnale per comodita' in stampa prospetto + _pim->put("B1","X"); + // se e' nuovo, il segnale per usare l'importo nel calcolo del rimborso + // viene amorosamente messo a quanto il codice IVA prevede + if (!was) + { + look_iva(vv->_codiva); + _pim->put("I1", (long)vendita); + if (!_iva->get_bool("B4")) _pim->put("B3", "X"); } - } - if (is_annual_or_trim) - { - // Cazzeggia e riscrive i PIM/PAM/PLM (veid sopra) ripartendo equamente gli importi annuali - // tra i vari mesi, tipodet e codici IVA. - const int slices = _vend_arr.items(); - const int a_items = annual_vent.items(); - real perc(1.0),imp_fetta, iva_fetta, tot_imp, tot_iva, delta; - perc /= slices; - for (i = 0; i < a_items; i++) - { - Annual_item& item = (Annual_item&) annual_vent[i]; - TDistrib imp_s(item.imponibile(),ROUND_LIRA); - TDistrib iva_s(item.imposta(),ROUND_LIRA); - tot_imp = 0.0; tot_iva = 0.0; - for (j = 0; j < slices; j++) - { - imp_s.add(perc); iva_s.add(perc); - } - for (j = 0; j < slices; j++) - { - _VendItem * vi = (_VendItem*) &_vend_arr[j]; - imp_fetta = imp_s.get(); - iva_fetta = iva_s.get(); - tot_imp += imp_fetta; tot_iva += iva_fetta; // Serve per eventuali perdite di lirette... - if (j == (slices - 1)) - { - delta = item.imponibile() - tot_imp; - if (!delta.is_zero()) imp_fetta += delta; // Aggiusta l'ultima fetta(IVA e IMPONIBILE) - delta = item.imposta() - tot_iva; // per eventali perdite di lire nella ripartizione - if (!delta.is_zero()) iva_fetta += delta; - } - // aggiusto l'IVA vendite nei plm - look_plm(vi->_month, codatt); - real ive = _plm->get_real("R0"); - ive += iva_fetta; - _plm->put("R0",ive); - _plm->rewrite(); - // .. e il volume di affari nei pam - real vaf = _pam->get_real("R1"); - vaf += imp_fetta; - _pam->put("R1", vaf); - _pam->rewrite(); - // Aggiorno i luridi pim - bool was = look_pim(vi->_month, codatt, vi->_codreg, "0", item.codiva(), vi->_tipodet, TRUE); - - imp_fetta += _pim->get_real("R0"); - iva_fetta += _pim->get_real("R1"); - _pim->put("R0", imp_fetta); - _pim->put("R1", iva_fetta); - _pim->put("S4", item.other()); - // segnale per comodita' in stampa prospetto - _pim->put("B1","X"); - // se e' nuovo, il segnale per usare l'importo nel calcolo del rimborso - // viene amorosamente messo a quanto il codice IVA prevede - if (!was) - { - look_iva(item.codiva()); - _pim->put("I1", (long)vendita); - if (!_iva->get_bool("B4")) _pim->put("B3", "X"); - } - _pim->rewrite(); - } - } - totven = 0.0; // Questa va azzerato, poiche' quando ancora non era prevista - break; // la ventilazione annuale , registrava totven come 0.0 + _pim->rewrite(); } } @@ -452,22 +263,6 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) _pam->rewrite(); } - -// questa servIVA per il rimborso secondo le -// nuove cazzonorme, mai entrate in vigore ma -// devotamente programmate -//class rObj : public TObject -//{ -//public: -// real _imp; -// real _iva; -// real _perc; -// -// rObj() {} -// virtual ~rObj() {} -//}; - - _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, bool stliq) { @@ -490,8 +285,8 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, if (is_mens) m = month; // per le mensili considera solo il mese attuale else m = next_trim(month)-2; // per le trimestrali considera i mesi del trimestre - if (month == 13) m = 1; // se annuale considera tutti i mesi - + if (month == 13) m = 13; // se annuale considera solo il mese 13 + // variabili per condizione 2 real vtot = 0.0; real atot = 0.0; @@ -533,127 +328,6 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, d->_r1 = vol_aff; } - // ---------------------- condizione 2 - // u' casinu pazzescu d'u nuiu guvernu - - - /*********************************************************************** - Sembra che sia stato annullato subito dopo che ho finito di scrivere - queste 150 righe di casino - *********************************************************************** - // due array dove ficcare i totali per - // codiva in ordine di imponibile - TArray varr, aarr; - - // scorri i bellissimi progressivi mensili rimborso - for (_rmb->first(); !_rmb->eof(); _rmb->next()) - { - int year = atoi((const char*)_year); - int ryear = atoi((const char*)(*_rmb_anno)); - int rmese = atoi((const char*)(*_rmb_mese)); - - if (year != ryear || (rmese < (month - 2) || rmese > month)) - continue; - - real imp = _rmb->get("R0"); - real iva = _rmb->get("R1"); - real per = _rmb->get("R2"); - - rObj* rb = new rObj; - rb->_imp = imp; - rb->_iva = iva; - rb->_perc = per; - - TArray& arr = (tiporeg)atoi((const char*)(*_rmb_tiporeg)) == vendita ? varr : aarr; - - for (int i = 0; i < arr.items(); i++) - { - rObj& robj = (rObj&)arr[i]; - if (robj._imp < imp) - break; - } - arr.insert(rb, i); - - // totali imponibili - if ((tiporeg)atoi((const char*)(*_rmb_tiporeg)) == vendita) - vtot += imp; - else - atot += imp; - } - - // se ci sono due o piu' imponibili uguali devo - // sostituire l'imposta con la media delle aliquote - // ciclo uguale sui due array - for (int w = 0; w < 2; w++) - { - TArray& arr = w == 0 ? varr : aarr; - for (int i = 0; i < arr.items(); i++) - { - rObj& robj = (rObj&)arr[i]; - real impref = robj._imp; - real perc = robj._perc; - - for (int j = i+1; j < arr.items(); j++) - { - rObj& rbj = (rObj&)arr[j]; - if (rbj._imp != impref) - break; - perc += rbj._perc; - } - // riaggiustesbimo - if (j > i+1) - { - // funzionerebbe comunque ma risparmiamo una - // divisione per 1 - real ndiv(j-i); - perc /= ndiv; - for (; i < j; i++) - { - rObj& rbj = (rObj&)arr[i]; - rbj._iva = rbj._imp * (perc/CENTO); - rbj._iva.round(ROUND_LIRA); - } - i --; - } - } - } - - // 51 per cento - vtot *= PERC_IMP_RIMBORSABILE; - atot *= PERC_IMP_RIMBORSABILE; - - for (w = 0; w < 2; w++) - { - TArray& arr = w == 0 ? varr : aarr; - real timp = w == 0 ? vtot : atot; - real tiva = 0.0; - - for (int i = 0; i < arr.items(); i++) - { - rObj& robj = (rObj&)arr[i]; - if (timp >= robj._imp) - { - tiva += robj._iva; - timp -= robj._imp; - } - else - { - real perc = timp/robj._imp; - if (!perc.is_zero()) - { - real ttiv = robj._iva * perc; - ttiv.round(ROUND_LIRA); - tiva += ttiv; - } - break; - } - } - if (w == 0) ivav = tiva; - else ivaa = tiva; - } - - **************************************************************************/ - // Condizione 2... // scorri i bellissimi progressivi mensili // Nota: i valori ricavati vanno poi integrati con R3, dove sono memorizzati i corrispettivi da scorporare @@ -681,10 +355,10 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, if (!is_mens) // Trimestrali { if (year != ryear || - (month != 13 && (rmese < (next_trim(month)-2) || rmese > month))) + (rmese < (next_trim(month)-2) || rmese > month)) continue; } else // Mensili - if (year != ryear || (month != rmese && month != 13)) + if (year != ryear || month != rmese) continue; int tipomov = (tiporeg)_pim->get_long("I1"); diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index 6e4574871..b930962d7 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -119,8 +119,7 @@ void TLiquidazione_app::describe_att(int month, const char* codatt, describe_agricolo(month, codatt); if (atts.items() == 1 && _isviaggio) describe_viaggio(month, codatt); - if (/* isresult || month == 13 */ TRUE) - describe_pims(month,codatt); + describe_pims(month,codatt); if (atts.items() == 1) describe_consistence(codatt); } @@ -256,8 +255,9 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt) real imposta = _pim->get_real("R1"); tiporeg tipomov = (tiporeg)_reg->get_long("I0"); TString tipoiva = _iva->get("S1"); - - if (_year != *_pim_anno) continue; + + if (_year != *_pim_anno || (month == 13 && mese < 13)) + continue; if (imponibile.is_zero() && imposta.is_zero()) continue; @@ -335,24 +335,17 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt) { _DescrItem* d = new _DescrItem(REGAGR); - for (int mese = 1; mese <= month; mese++) - { - if (!is_month_ok(mese,month)) - continue; - - if (!look_plm(mese, codatt)) - continue; + look_plm(month,codatt); - d->_r0 += _plm->get_real("R5"); - d->_r1 += _plm->get_real("R6"); - d->_r2 += _plm->get_real("R7"); - d->_r3 += _plm->get_real("R8"); - d->_r4 += _plm->get_real("R9"); - d->_r5 += _plm->get_real("R10"); - d->_r6 += _plm->get_real("R11"); - d->_r7 += _pum->get_real("R10"); - d->_r8 += _pum->get_real("R11"); - } + d->_r0 += _plm->get_real("R5"); + d->_r1 += _plm->get_real("R6"); + d->_r2 += _plm->get_real("R7"); + d->_r3 += _plm->get_real("R8"); + d->_r4 += _plm->get_real("R9"); + d->_r5 += _plm->get_real("R10"); + d->_r6 += _plm->get_real("R11"); + d->_r7 += _pum->get_real("R10"); + d->_r8 += _pum->get_real("R11"); // Aggiungo anche questi per comodita' futura. // in caso di ditta a regime agricolo // alias: @@ -374,19 +367,15 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt) _DescrItem* d = new _DescrItem(REGVIA); - for (int mese = 1; mese <= month; mese++) - { - if (!is_month_ok(mese,month) || !look_plm(mese, codatt)) - continue; + look_plm(month, codatt); - d->_r0 += _plm->get_real("R5"); // corrispettivi CEE - d->_r1 += _plm->get_real("R9"); // corrispettivi misti CEE - d->_r2 += _plm->get_real("R6"); // corrispettivi fuori CE - d->_r3 += _plm->get_real("R7"); // acquisti CEE - d->_r4 += _plm->get_real("R10"); // acquisti misti parte CEE - d->_r5 += _plm->get_real("R8"); // acquisti fuori CEE - d->_r6 += _plm->get_real("R11"); // acquisti misti parte fuori CEE - } + d->_r0 += _plm->get_real("R5"); // corrispettivi CEE + d->_r1 += _plm->get_real("R9"); // corrispettivi misti CEE + d->_r2 += _plm->get_real("R6"); // corrispettivi fuori CE + d->_r3 += _plm->get_real("R7"); // acquisti CEE + d->_r4 += _plm->get_real("R10"); // acquisti misti parte CEE + d->_r5 += _plm->get_real("R8"); // acquisti fuori CEE + d->_r6 += _plm->get_real("R11"); // acquisti misti parte fuori CEE // credito di costo precedente (CHECK annuale) d->_r8 = credito_costo_prec(month); @@ -394,14 +383,6 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt) // Solita minchiatina dell'arrotondamento alle 1000 lirette se siamo in annuale if (month == 13) { - //d->_r0.round(ROUND_MILLELIRE); - //d->_r1.round(ROUND_MILLELIRE); - //d->_r2.round(ROUND_MILLELIRE); - //d->_r3.round(ROUND_MILLELIRE); - //d->_r4.round(ROUND_MILLELIRE); - //d->_r5.round(ROUND_MILLELIRE); - //d->_r6.round(ROUND_MILLELIRE); - //d->_r8.round(ROUND_MILLELIRE); round_mille_lire(d->_r0); round_mille_lire(d->_r1); round_mille_lire(d->_r2); @@ -416,7 +397,6 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt) d->_r9 = (d->_r1 * d->_r7)/CENTO; if (month==13) - //d->_r9.round(ROUND_MILLELIRE); round_mille_lire(d->_r9); else d->_r9.round(ROUND_LIRA); @@ -429,7 +409,6 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt) { d->_r11 = (d->_r10/(alcnt/CENTO)) * (aliva/CENTO); // iva dovuta if (month == 13) - //d->_r11.round(ROUND_MILLELIRE); round_mille_lire(d->_r11); else d->_r11.ceil(ROUND_LIRA); } @@ -534,7 +513,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt) continue; if (strcmp((const char*)*_pim_codatt, att) == 0 && - (is_month_ok(atoi(*_pim_mese),month)) && + (is_month_plain(atoi(*_pim_mese))) && _year == (const char*)*_pim_anno) { // vedi se c'e' gia' un item corrispondente @@ -599,12 +578,10 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt) real cvv = _pim->get_real("R1"); // iva totale real cfi = _pim->get_real("R13"); // imp. falsi corrispettivi real cfv = _pim->get_real("R14"); // iva falsi corrispettivi - // Qui comincia la modifica per l'errore MI3404... + // MI3404... // Giochiamo sopra la particolarita' che se non e' un registro di corrispettivi // allora se R5 o R6 sono <> 0 significa che trattasi di documento FS, - // che pertanto va stornato dal totale corrispettivi. (Cosi' vuole Vladimiro, - // anche se sono sempre piu' convinto che sia una trojata). - // Va beh, OBBEDISCO. + // che pertanto va stornato dal totale corrispettivi. (Cosi' volle Vladimiro) real ifs(_pim->get_real("R5")); // imp. fatture con scontrino real vfs(_pim->get_real("R6")); // iva fatture con scontrino if (!corrisp) @@ -756,8 +733,11 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt) t->_f1 = isfirst; // per il form feed TToken_string ttm("0|0|0"); - - for (int m = 1; m <= month && m < 13; m++) + + const bool annual = month == 13; + const int limit = annual ? 13 : month; + int m = annual ? month : 1; + for (; m <= limit; m++) { if (!is_month_ok(m,month)) continue; @@ -866,22 +846,15 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt) if (pr > 0.0) { topay = (iaq + ppg) * (pr / CENTO); - //topay.round(ROUND_MILLELIRE); round_mille_lire(topay); } co = topay - ppg; - //co.round(ROUND_MILLELIRE); round_mille_lire(co); - } _DescrItem* dd = new _DescrItem(ANNUAL); // MonsterFish: arrotonda alle 1000 LIRE B1,B2,B3,B4 - //e1.round(ROUND_MILLELIRE); - //e2.round(ROUND_MILLELIRE); - //e3.round(ROUND_MILLELIRE); - //ris.round(ROUND_MILLELIRE); round_mille_lire(e1); round_mille_lire(e2); round_mille_lire(e3); @@ -977,18 +950,11 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) { real iva = _lim->get_real("R0") + _lim->get_real("R14"); if (month == 13) - //iva.round(ROUND_MILLELIRE); round_mille_lire(iva); if (iva >= IVA_DA_RIPORTARE) _stampa_vers = TRUE; } - /***13/02/1996 - int mese = month; - if (_freqviva == "T" && _isannual) mese = 12; - if (!look_del(mese,7) && !stampa_vers) return NULL; - ***/ - _stampa_acc = (month == 12 && (_freqviva == "M" || (_isbenzinaro && _gest4))) ||(month == 13 && _freqviva == "T" && !(_isbenzinaro && _gest4)); @@ -1077,10 +1043,7 @@ void TLiquidazione_app::describe_consistence(const char* codatt) void TLiquidazione_app::describe_error(const char* err, const char* codatt) { - //if (!_isprint || !_canprint) return; - //06/12/1995 if (!_isprint || !_canprint || (_isregis && _isfinal)) return; - //fine _errors.add(new _ErrItem(err,codatt,_nditte->curr().get("CODDITTA"))); } @@ -1212,7 +1175,6 @@ void TLiquidazione_app::set_att(_DescrItem& d) void TLiquidazione_app::set_plafond(_DescrItem& d) { - //if (_isregis) return; if (_isregis && _isfinal) return; set_bookmark("Quadro plafond", _att_bookmark); @@ -1254,7 +1216,8 @@ void TLiquidazione_app::set_plafond(_DescrItem& d) void TLiquidazione_app::set_liqacc(_DescrItem& d) { real r1 = d._r0 + d._r1 + d._r2 + d._r4; - real r2 = d._r5;// + d._r10; //MI2258 (A me sembra una cagata, ma con certa gente non si riesce a parlare) + //real r2 = d._r5 + d._r10; + real r2 = d._r5; //MI2258 (A me sembra una cagata, ma con certa gente non si riesce a parlare) real r3 = r2 + d._r9 + d._r7; if ((d._r3).sign() > 0) r1 += d._r3; else r3 += abs(d._r3); @@ -1522,7 +1485,7 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d) printed = TRUE; real prc(dp.get(0)); - set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r", + set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@58g%r", (const char*)prc.string(), &(d._r11)); } @@ -1543,11 +1506,11 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d) "@77gimposta@91gdetrazione"); set_row(4,""); } - else /* if (!d._f1) */ + else set_row(1,""); // form feed - /* if (printed || !d._f1) */ set_auto_ff(TRUE); + set_auto_ff(TRUE); } void TLiquidazione_app::set_grand(_DescrItem& d) @@ -1644,7 +1607,6 @@ void TLiquidazione_app::set_grand(_DescrItem& d) { real iva = abs(risultato); if (_isannual || _isriepilogo) - //iva.round(ROUND_MILLELIRE); round_mille_lire(iva); set_row(rw++,"@23gCREDITO ATTUALE@58g%r",&iva); if (_is_visliq) @@ -1657,11 +1619,9 @@ void TLiquidazione_app::set_grand(_DescrItem& d) else { if (_month == 13) - //interessi.round(ROUND_MILLELIRE); round_mille_lire(interessi); real iva = risultato + interessi; if (_isannual || _isriepilogo) - // iva.round(ROUND_MILLELIRE); round_mille_lire(iva); if (!iva.is_zero()) { @@ -1708,12 +1668,10 @@ void TLiquidazione_app::set_grand(_DescrItem& d) // rapportini per rimborso infraannuale // non si stampano se la stampa serve per la visualizz. - //modifica del 07/07/1995 - //*** solo in st.di prova in coda ai registri deve scendere + // solo in st.di prova in coda ai registri deve scendere // il prospetto di rimborso - //*** sempre (cioe' in bollato e in prova) deve scendere - // il prospettino versamento (boh???????????????????) - //if (d._arr.items() > 0 && !_is_visliq && !_isregis) + // sempre (cioe' in bollato e in prova) deve scendere + // il prospettino versamento if (d._arr.items() > 0 && !_is_visliq) { for (int i = 0; i < d._arr.items(); i++) @@ -1774,11 +1732,6 @@ void TLiquidazione_app::set_grand(_DescrItem& d) else if (di._flags == DELEGA) { int rr = rw; - /* - if (rw < (printer().formlen() - 10)) - rw = printer().formlen() - 10; - */ - //11/10/1995 int cont = 10; if (di._s4 == "ACC") { @@ -1788,7 +1741,6 @@ void TLiquidazione_app::set_grand(_DescrItem& d) } if (rw < (printer().formlen() - cont)) rw = printer().formlen() - cont; - //fine for (int i = rr; i < rw; i++) set_row(i,""); @@ -1800,7 +1752,6 @@ void TLiquidazione_app::set_grand(_DescrItem& d) // la cincia non vuole lo zero if (atof(vr) == 0.0 && vr[vr.len()-1] == '0') vr[vr.len()-1] = ' '; - //11/10/1995 if (di._s4 == "ACC") { TToken_string ac(di._s5); @@ -1831,7 +1782,6 @@ void TLiquidazione_app::set_grand(_DescrItem& d) set_row(rw++, "@68gConcessione %s", (const char*)loc); } } - //if (_stampa_vers) set_row(rw++, "- SALDO -"); } if (_stampa_acc && _stampa_vers) set_row(rw++, "- SALDO -"); @@ -1877,17 +1827,14 @@ bool TLiquidazione_app::set_annual(_DescrItem& d) bool ret = FALSE; int row = get_maxrow()+1; - //14/12/1995. Correzione errore MI0952 if (row == 1) row = 4; - //fine if (d._f0 & IS_PRORATA) { // non lo ha stampato prima se annuale, perche' vladimiro il nefido // pretende l'assurdo aggiornamento della perc. a quella nuova - //set_row(++row, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r", - // (const char*)(d._r2.string()), &(d._r6)); + row++; set_row(++row,"CALCOLO DELLA PERCENTUALE DI INDETRAIBILITA'"); row++; @@ -1896,20 +1843,18 @@ bool TLiquidazione_app::set_annual(_DescrItem& d) ret = TRUE; set_print_zero(TRUE); set_row(row++,""); - //set_row(row++,"CALCOLO DELLA PERCENTUALE DI INDETRAIBILITA'"); - set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r", + set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@58g%r", (const char*)(d._r2.string()), &(d._r6)); - //set_row(row++,""); set_row(row++,"B1 - Operazioni esenti, escluse da nr. 1 a 9 e 11 art. 10 %r", &(d._r1)); set_row(row++,"B2 - Operazioni esenti, di cui nr. 11 art. 10 %r", &(d._r4)); set_row(row++,"B3 - Operazioni esenti da nr. 1 a 9 art. 10 %r", &(d._r5)); set_row(row++,"Volume d'affari - B3 %r", &(d._r0)); - set_row(row++,"Indetraibilita'@30g%r%%", &(d._r2)); + set_row(row++,"Indetraibilita'@58g%r%%", &(d._r2)); if (!(d._r3.is_zero())) { const char* sss = d._r3.sign() < 0 ? "credito" : "debito"; real ccc = abs(d._r3); - set_row(row++,"Conguaglio a %s@30g%r", sss, &ccc); + set_row(row++,"Conguaglio a %s@58g%r", sss, &ccc); } set_print_zero(FALSE); } @@ -1982,7 +1927,6 @@ void TLiquidazione_app::set_regagr(_DescrItem& d) real ivadt_amm = agr_1 + agr_3 + ivadt; // percentuale detraibilita' - // real pdetr = (); set_bookmark("Prospetto regime agricolo", _att_bookmark); set_row(1,"@50gPROSPETTO REGIME AGRICOLO"); @@ -2065,19 +2009,14 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) real& cred_cos = d._r8; real& ivm = d._r9; - //real perc_r = (acq_misCEE * CENTO)/(acq_misCEE + acq_misnoCEE); perc_r.round(2); - //real ivm = (corr_misCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA); real tc = (corr_CEE + ivm); real ta = (acq_CEE + acq_misCEE); - //real bi = tc - ta - cred_cos; real& bi = d._r10; real& dovuta = d._r11; real tcc = corr_CEE + corr_noCEE + corr_misCEE; real tco = acq_CEE + acq_noCEE + acq_misCEE + acq_misnoCEE; real tma = acq_CEE + acq_misCEE; - // real rip = perc_r; rip.round(2); - // real cim = (d._r1 * d._r7)/CENTO; cim.round(ROUND_LIRA); set_print_zero(TRUE); @@ -2198,8 +2137,6 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) { real aliva = aliquota_agvia(); real alcnt = aliva + CENTO; - //real dovuta = (bi/(alcnt/CENTO)) * (aliva/CENTO); - //dovuta.ceil(ROUND_LIRA); // ceil voluto da MI3074 tmp = bi.string(REAL_PICTURE); tmp.ltrim(); up = tmp; @@ -2228,48 +2165,35 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) void TLiquidazione_app::set_acconto_p(_DescrItem& d) { - //set_print_zero(TRUE); const char* errmsg[3] = { {"manca la tabella risultati liquidazione per l'anno corrente"}, -{"manca la tabella risultati liquidazione per l'anno precedente"}, -{"manca la tabella dichiarazione annuale per l'anno precedente"}}; + {"manca la tabella risultati liquidazione per l'anno precedente"}, + {"manca la tabella dichiarazione annuale per l'anno precedente"}}; -set_row(1,"%t@7g%t",&(d._s0), &(d._s1)); -if (d._f2) - set_row(1,"@50g@b*** %s ***@r", errmsg[d._f2 -1]); -else -{ - if (d._f0) // base anno in corso + set_row(1,"%t@7g%t",&(d._s0), &(d._s1)); + if (d._f2) + set_row(1,"@50g@b*** %s ***@r", errmsg[d._f2 -1]); + else { - if (d._f1) // stampa base di calcolo + if (d._f0) // base anno in corso { - /*** - real bc = d._r0; - if (bc.sign() < 0) - { - bc = abs(bc); - set_row(1,"@73g%r@86g%r@119g%s", &bc, &d._r1, - d._f3 ? "Si" : "No"); - } - else - set_row(1,"@55g%r@86g%r@119g%s", &bc, &(d._r1), - d._f3 ? "Si" : "No"); - ***/ - set_row(1,"@58g%r@74g%r@96g%r@122g%s", &(d._r3), + if (d._f1) // stampa base di calcolo + { + set_row(1,"@58g%r@74g%r@96g%r@122g%s", &(d._r3), &(d._r2), &(d._r1), d._f3 ? "Si" : "No"); + } + else + set_row(1,"@62g%r@91g%s", &(d._r1), d._f3 ? "Si" : "No"); + } + else //metodo storico + { + 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)); } - else set_row(1,"@62g%r@91g%s", &(d._r1), d._f3 ? "Si" : "No"); } - else //metodo storico - { - 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)); - } -} -//set_print_zero(FALSE); } void TLiquidazione_app::set_acchead_p(_DescrItem& d) @@ -2383,8 +2307,6 @@ void TLiquidazione_app::set_deltab(_DescrItem& d, bool iscred) tel << tt.get(9); TString desc(tt.get(10)); - //tp += in; //comprendeva gia' gli interessi! - set_row(rw++, "%-5s@8g%-30s@40g%1s %s @55g%r %5s %5s %3s %-.45s", (const char*)cod, (const char*)diocantaro, (const char*)frq, (const char*)tel, &tp, (const char*)abi, diff --git a/cg/cg4305.cpp b/cg/cg4305.cpp index 7bd35b8c8..53533d6c4 100755 --- a/cg/cg4305.cpp +++ b/cg/cg4305.cpp @@ -106,8 +106,6 @@ bool TLiquidazione_app::extract_deleghe() { _isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74_4"); bool mens = _freqviva == "M"; - //_isannual = (_month == 12 && !mens && !_isbenzinaro) || - // (_month == 13 && (mens || _isbenzinaro)); _isriepilogo = _month == 13; _isendliq = _isannual || _isriepilogo; @@ -179,7 +177,6 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc) real nrnd = topay; topay.round(-3); // importo totale del versamento arrotondato - //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 @@ -193,7 +190,6 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc) tt->add(""); } - //if (topay.sign() > 0) if (versare) { look_del(month, 1, TRUE); //ci mette abi, cab o con @@ -219,12 +215,6 @@ 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()) { @@ -355,9 +345,6 @@ bool TLiquidazione_app::set_acconto(real& inf, real& ina) _isbase = m.get_bool(CHK_CGC_BASE); _basecalc = (tbc)m.get_long(RDB_CGC_BASE); - //inf = real(m.get(FLD_CGC_INF)); - //ina = real(m.get(FLD_CGC_INA)); - inf = ina = ZERO; switch (k) @@ -456,11 +443,7 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) real acq_intr = 0.0; bool isdifferita = FALSE; bool error = FALSE; - // MI3262 - //{ - // TConfig cnf(CONFIG_DITTA, "cg"); - // isdifferita = cnf.get_bool("GeLiDi"); - //} + // MI3262... isdifferita = is_differita(); TString16 tipo_acc; @@ -598,9 +581,6 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) // calcola l'acconto if (look_lim(12)) //posiziona anche la tabella lam { - // bc = result_liq(12); - // somma i non fatturati/non annotati - // bc += inf + ina; cre = _lim->get_real("R12"); //quando calcolo la 12° ci vado a sommare il @@ -613,7 +593,6 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) if (bc.sign() > 0) acc = bc; - // 11/09/1995 iva_ven = _lam->get_real("R0"); //iva sulle vendite annotate fino al 20/12 iva_acq = _lam->get_real("R1"); //iva sugli acquisti annotati fino al 20/12 cre_pre = _lam->get_real("R2"); //credito precedente @@ -650,14 +629,10 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) // 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); - //18/10/1995 _lim->put("B0",""); _lim->rewrite(); if (look_lim(13))