diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index 61cd22dae..aac67cbac 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -99,10 +99,13 @@ bool TLiquidazione_app::user_create() _cur = new TCursor(_rel, "", 2); _pim = new TTable("PIM"); + _pum = new TTable("PUM"); + _pam = new TTable("PAM"); + _pom = new TTable("POM"); _ppa = new TTable("PPA"); _plm = new TTable("PLM"); - _ptm = new TTable("PTM"); _lim = new TTable("LIM"); + _lam = new TTable("LAM"); _pla = new TTable("PLA"); _reg = new TTable("REG"); _iva = new TTable("%IVA"); @@ -115,10 +118,13 @@ bool TLiquidazione_app::user_create() _pim_r = &(_pim->curr()); _plm_r = &(_plm->curr()); - _ptm_r = &(_ptm->curr()); + _pum_r = &(_pum->curr()); + _pam_r = &(_pam->curr()); + _pom_r = &(_pom->curr()); _iva_r = &(_iva->curr()); _del_r = &(_del->curr()); _lim_r = &(_lim->curr()); + _lam_r = &(_lam->curr()); _pla_r = &(_pla->curr()); _ppa_r = &(_ppa->curr()); _rmb_r = &(_rmb->curr()); @@ -138,6 +144,15 @@ bool TLiquidazione_app::user_create() _pim_tipocr = new TRecfield(*_pim_r,"CODTAB",15,15); _pim_codiva = new TRecfield(*_pim_r,"CODTAB",16,19); _pim_tipodet = new TRecfield(*_pim_r,"CODTAB",20,20); + _pum_anno = new TRecfield(*_pum_r,"CODTAB",0,3); + _pum_codatt = new TRecfield(*_pum_r,"CODTAB",4,9); + _pum_mese = new TRecfield(*_pum_r,"CODTAB",10,11); + _pam_anno = new TRecfield(*_pam_r,"CODTAB",0,3); + _pam_codatt = new TRecfield(*_pam_r,"CODTAB",4,9); + _pam_mese = new TRecfield(*_pam_r,"CODTAB",10,11); + _pom_anno = new TRecfield(*_pom_r,"CODTAB",0,3); + _pom_codatt = new TRecfield(*_pom_r,"CODTAB",4,9); + _pom_mese = new TRecfield(*_pom_r,"CODTAB",10,11); _ppa_year = new TRecfield(*_ppa_r,"CODTAB",0,3); _ppa_codatt = new TRecfield(*_ppa_r,"CODTAB",4,9); _ppa_month = new TRecfield(*_ppa_r,"CODTAB",10,11); @@ -145,9 +160,6 @@ bool TLiquidazione_app::user_create() _plm_anno = new TRecfield(*_plm_r,"CODTAB",0,3); _plm_codatt = new TRecfield(*_plm_r,"CODTAB",4,9); _plm_mese = new TRecfield(*_plm_r,"CODTAB",10,11); - _ptm_anno = new TRecfield(*_ptm_r,"CODTAB",0,3); - _ptm_codatt = new TRecfield(*_ptm_r,"CODTAB",4,9); - _ptm_mese = new TRecfield(*_ptm_r,"CODTAB",10,11); _pla_anno = new TRecfield(*_pla_r,"CODTAB",0,3); _pla_codatt = new TRecfield(*_pla_r,"CODTAB",4,9); _del_ditta = new TRecfield(*_del_r,"CODTAB",0,4); @@ -156,6 +168,8 @@ bool TLiquidazione_app::user_create() _del_tipo = new TRecfield(*_del_r,"CODTAB",11,11); _lim_anno = new TRecfield(*_lim_r,"CODTAB",0,3); _lim_mese = new TRecfield(*_lim_r,"CODTAB",4,6); + _lam_anno = new TRecfield(*_lam_r,"CODTAB",0,3); + _lam_mese = new TRecfield(*_lam_r,"CODTAB",4,6); _rmb_anno = new TRecfield(*_rmb_r,"CODTAB",0,3); _rmb_mese = new TRecfield(*_rmb_r,"CODTAB",4,6); _rmb_codiva = new TRecfield(*_rmb_r,"CODTAB",7,10); @@ -234,11 +248,19 @@ bool TLiquidazione_app::user_destroy() delete _plm_anno; delete _plm_codatt; delete _plm_mese; - delete _ptm_anno; - delete _ptm_codatt; - delete _ptm_mese; + delete _pum_anno; + delete _pum_codatt; + delete _pum_mese; + delete _pam_codatt; + delete _pam_anno; + delete _pam_mese; + delete _pom_codatt; + delete _pom_anno; + delete _pom_mese; delete _lim_anno; delete _lim_mese; + delete _lam_anno; + delete _lam_mese; delete _pla_anno; delete _pla_codatt; delete _pim_codatt; @@ -248,10 +270,13 @@ bool TLiquidazione_app::user_destroy() delete _del_tipo; delete _pim; + delete _pum; + delete _pam; + delete _pom; delete _ppa; delete _plm; - delete _ptm; delete _lim; + delete _lam; delete _pla; delete _del; diff --git a/cg/cg4300.h b/cg/cg4300.h index 11acec051..7f3e836ba 100755 --- a/cg/cg4300.h +++ b/cg/cg4300.h @@ -220,9 +220,12 @@ class TLiquidazione_app : public TPrint_application TLocalisamfile* _rmoviva; TTable* _pim; + TTable* _pum; + TTable* _pam; + TTable* _pom; TTable* _plm; - TTable* _ptm; TTable* _lim; + TTable* _lam; TTable* _pla; TTable* _ppa; TTable* _reg; @@ -236,13 +239,16 @@ class TLiquidazione_app : public TPrint_application TRectype* _rmoviva_r; TRectype* _iva_r; TRectype* _pim_r; + TRectype* _pum_r; + TRectype* _pam_r; + TRectype* _pom_r; TRectype* _reg_r; TRectype* _nditte_r; TRectype* _pla_r; TRectype* _plm_r; - TRectype* _ptm_r; TRectype* _ppa_r; TRectype* _lim_r; + TRectype* _lam_r; TRectype* _del_r; TRectype* _att_r; TRectype* _rmb_r; @@ -255,6 +261,15 @@ class TLiquidazione_app : public TPrint_application TRecfield* _pim_tipocr; TRecfield* _pim_codiva; TRecfield* _pim_tipodet; + TRecfield* _pum_anno; + TRecfield* _pum_codatt; + TRecfield* _pum_mese; + TRecfield* _pam_anno; + TRecfield* _pam_codatt; + TRecfield* _pam_mese; + TRecfield* _pom_anno; + TRecfield* _pom_codatt; + TRecfield* _pom_mese; TRecfield* _ppa_year; TRecfield* _ppa_codatt; TRecfield* _ppa_month; @@ -262,9 +277,6 @@ class TLiquidazione_app : public TPrint_application TRecfield* _plm_anno; TRecfield* _plm_codatt; TRecfield* _plm_mese; - TRecfield* _ptm_anno; - TRecfield* _ptm_codatt; - TRecfield* _ptm_mese; TRecfield* _pla_anno; TRecfield* _pla_codatt; TRecfield* _del_ditta; @@ -273,6 +285,8 @@ class TLiquidazione_app : public TPrint_application TRecfield* _del_tipo; TRecfield* _lim_anno; TRecfield* _lim_mese; + TRecfield* _lam_anno; + TRecfield* _lam_mese; TRecfield* _rmb_anno; TRecfield* _rmb_mese; TRecfield* _rmb_codiva; @@ -388,17 +402,20 @@ public: void set_firm(_DescrItem& d); void set_att(_DescrItem& d); void set_pim(_DescrItem& d); + void set_pumpam(_DescrItem& d); void set_plm(_DescrItem& d); - void set_ptm(_DescrItem& d); bool set_annual(_DescrItem& d); void set_grand(_DescrItem& d); // cercapalle in tabelle con opzione di creazione se serve bool look_pim(int m, const char* a, const char* r, const char* cr, const char* i, int tipodet = 0, bool create = FALSE); + bool look_pum(int m, const char* a, bool create = FALSE); + bool look_pam(int m, const char* a, bool create = FALSE); + bool look_pom(int m, const char* a, bool create = FALSE); bool look_plm(int m, const char* a, bool create = FALSE); - bool look_ptm(int m, const char* a, bool create = FALSE); bool look_lim(int m, bool create = FALSE); + bool look_lam(int m, bool create = FALSE); bool look_pla(const char* a, bool create = FALSE); bool look_ppa(int m, const char* a, int t, bool create = FALSE); bool look_del(int month, int type, bool create = FALSE); diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index c54c18d3e..18c055930 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -900,62 +900,48 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) acquisti_iva = agr_3 - agr_4; } - // COSA MI TOCCA FARE (per campare, of course) - // due numeri nello stesso campo ma e' sempre meglio - // del TIPO RECORD - TToken_string s(40); - - _plm->put("R0", vendite_iva); - _plm->put("R1", acquisti_iva); - _plm->put("R3", ult_detr); + _plm->put("R0", vendite_iva); + _plm->put("R1", acquisti_iva); + _plm->put("R3", ult_detr); // probabilmente R4 serviva per il decalage e non si usera' _plm->put("R12", _prorata); // per comodita' in stampa - _plm->put("B0", "X"); // calcolato (invalidato dalla primanota) - _plm->put("S1", for_rimb.string()); - - // si riempiano le stringhe di coppie di real - s.add(acq_ies.string()); - s.add(acq_ies_iva.string()); - _plm->put("S2", (const char*)s); - s = ""; - s.add(acq_pint.string()); - s.add(acq_pint_iva.string()); - _plm->put("S3", (const char*)s); - s = ""; - s.add(spgen.string()); - s.add(spgen_iva.string()); - _plm->put("S4", (const char*)s); - _plm->rewrite(); + _plm->put("B0", "X"); // calcolato (invalidato dalla primanota) + _pom->put("R9", acq_ies); + _pom->put("R10", acq_ies_iva); + _pum->put("R8", acq_pint); + _pum->put("R9", acq_pint_iva); + _pam->put("R10", spgen); + _pam->put("R11", spgen_iva); + _pom->put("R0", totintra); + _pom->put("R1", nond19_imp); + _pom->put("R2", nond19_iva); + _pom->put("R3", ammort); + _pom->put("R4", ammort_iva); + _pom->put("R5", acq_riv); + _pom->put("R6", acq_riv_iva); + _pom->put("R7", leasing); + _pom->put("R8", leasing_iva); + _pum->put("R0", cess_amm); + _pum->put("R1", cess_amm_iva); + _pum->put("R2", ammort_6); + _pum->put("R3", ammort_6_iva); + _pum->put("R4", esenti_b1); + _pum->put("R5", esenti_b2); + _pum->put("R6", esenti_b3); + _pum->put("R7", esenti_b14); + _pam->put("R0", acquisti); + _pam->put("R1", vendite); - // salva gli altri totali para no ponernos locos despues - look_ptm(month, codatt, TRUE); - _ptm->put("R0", totintra); - _ptm->put("R1", nond19_imp); - _ptm->put("R2", nond19_iva); - _ptm->put("R3", ammort); - _ptm->put("R4", ammort_iva); - _ptm->put("R5", ammort_6); - _ptm->put("R6", acq_riv); - _ptm->put("R7", acq_riv_iva); - _ptm->put("R8", leasing); - _ptm->put("R9", leasing_iva); - _ptm->put("R10", cess_amm); - _ptm->put("R11", cess_amm_iva); - _ptm->put("R12", ammort_6_iva); - _ptm->put("R13", esenti_b1); - _ptm->put("R14", esenti_b2); - _ptm->put("S0", esenti_b3.string()); - _ptm->put("S1", esenti_b14.string()); - _ptm->put("S2", acquisti.string()); - _ptm->put("S3", vendite.string()); - _ptm->rewrite(); + _plm->rewrite(); + _pam->rewrite(); + _pum->rewrite(); + _pom->rewrite(); } void TLiquidazione_app::write_liq(int month, const char* codatts) // Calcolo liq. mensili e liq. annuali { TToken_string atts(codatts); - TToken_string tt(60); const char* tmpatt; real risultato = 0.0; @@ -1015,22 +1001,22 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) { if (attc == 0) { - risultato = result_liq(12); - deb_mens = _lim->get_real("R3"); - detrazioni= _lim->get_real("R6"); - perc_r = _lim->get_real("R4"); - cred_cost = _lim->get_real("R2"); - rettifiche= _lim->get_real("R5"); - rimborsi = _lim->get_real("R1"); + risultato = result_liq(12); + deb_mens = _lim->get_real("R3"); + detrazioni = _lim->get_real("R6"); + perc_r = _lim->get_real("R4"); + cred_cost = _lim->get_real("R2"); + rettifiche = _lim->get_real("R5"); + rimborsi = _lim->get_real("R1"); // leggi anche tutti gli altri totali - tt = _lim->get("S2"); - iva_vend = tt.get(0); iva_acq = tt.get(1); - cred_prec = tt.get(2); debt_precd = tt.get(3); - - res_debt = (const char*)_lim->get("S5"); - res_cred = (const char*)_lim->get("S4"); - acc_dec = (const char*)_lim->get("S3"); - _year = format("%d", atoi(_year)+1); + acc_dec = _lim->get_real("R11"); + res_cred = _lim->get_real("R12"); + res_debt = _lim->get_real("R13"); + iva_vend = _lam->get_real("R0"); + iva_acq = _lam->get_real("R1"); + cred_prec = _lam->get_real("R2"); + debt_precd = _lam->get_real("R3"); + _year = format("%d", atoi(_year)+1); } } else @@ -1042,7 +1028,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) if (!is_month_ok(m, month)) continue; - look_plm(m, att); look_ptm(m,att); + look_plm(m, att); bool is_lim = look_lim(m); // gia' conteggiato: prorata @@ -1189,11 +1175,10 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) if (tipoatt == 1) // su PLA l'attivita' e' sempre 1 { look_pla(att); - TToken_string tt(_pla->get("S1")); - real vf1(tt.get(0)); - real vf2(tt.get(1)); - real iaq(_pla->get("S2")); // IVA acquisti - real ppg(_pla->get("S3")); // pro-rata pagato + real vf1 = _pla->get_real("R14"); + real vf2(_pla->get("S1")); + real iaq = _pla->get_real("R11"); // IVA acquisti + real ppg = _pla->get_real("R12"); // pro-rata pagato vol_aff_1 += vf1; vol_aff_2 += vf2; @@ -1239,7 +1224,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) _lia->put("R2", vol_aff_1); _lia->put("R3", vol_aff_2); _lia->put("R4", acc_dec); - _lia->put("R5", cred_cost); + _lia->put("R5", cred_cost); _lia->rewrite(); } @@ -1252,8 +1237,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) // azzeriamo tutto (tranne r1, r5, s7) TString codtab = _lim->get("CODTAB"); - real r5(_lim->get("R5")), r1(_lim->get("R1")); - TString s7(_lim->get("S7")); + real r5 = _lim->get("R5"); + real r1 = _lim->get("R1"); + TString s7 = _lim->get("S7"); _lim->zero(); _lim->put("CODTAB", codtab); @@ -1306,7 +1292,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) real interesse = interesse_trimestrale(_month); real ivi = risultato * (interesse / CENTO); ivi.ceil(ROUND_LIRA); - _lim->put("R11", ivi); + _lim->put("R14", ivi); _lim->put("R10",interesse_trimestrale(_month)); } @@ -1314,25 +1300,23 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) _lim->put("R7", tot_cong); _lim->put("R8", versamenti); _lim->put("R9", vers_int); - - // scrivi: totali IVA vendite e acquisti, credito prec, - // debito prec, acconto, totale conguaglio prorata - // cosi' si fa una volta sola in stampa - tt = iva_vend.string(); tt.add(iva_acq.string()); - tt.add(cred_prec.string()); tt.add(debt_precd.string()); - - _lim->put("S2", tt); - _lim->put("S3", acc_dec.string()); - _lim->put("S4", res_cred.string()); - _lim->put("S5", res_debt.string()); + _lam->put("R0", iva_vend); + _lam->put("R1", iva_acq); + _lam->put("R2", cred_prec); + _lam->put("R3", debt_precd); + _lim->put("R11", acc_dec); + _lim->put("R12", res_cred); + _lim->put("R13", res_debt); _lim->put("B0","X"); - if (_isfinal) - _lim->put("B1", "X"); + if (_isfinal) _lim->put("B1", "X"); + _lim->rewrite(); + _lam->rewrite(); } +//* void TLiquidazione_app::recalc_annual(const char* att) { @@ -1353,16 +1337,15 @@ void TLiquidazione_app::recalc_annual(const char* att) TString aaa(att); look_pla(aaa); - TToken_string tt(_pla->get("S1")); - volaff1 = tt.get(0); - volaff1 = tt.get(1); + volaff1 = _pla->get_real("R14"); + volaff2 = (const char*)_pla->get("S1"); vendite = _pla->get_real("R0"); es_b1 = _pla->get_real("R1"); es_b2 = _pla->get_real("R2"); es_b3 = _pla->get_real("R3"); cess_amm = _pla->get_real("R4"); - pro_pag = (const char*)_pla->get("S3"); - iva_acq = (const char*)_pla->get("S2"); + pro_pag = _pla->get_real("R12"); + iva_acq = _pla->get_real("R11"); // 1) Calcola volume di affari dai PIM, controllando il // flag B2 settato da update_att per i progressivi che @@ -1384,31 +1367,27 @@ void TLiquidazione_app::recalc_annual(const char* att) for (int i = 1; i <= 13; i++) { - if (!look_ptm(i,aaa) || !look_plm(i,aaa)) + if (!look_plm(i,aaa)) continue; - - // vendite lorde; sa la madonna a cosa servono - real vend(_ptm->get("S3")); - ven_lrd += vend; + + ven_lrd += _pam->get_real("R1"); iva_acq += _plm->get_real("R1"); - real eb3(_ptm->get("S0")); - es_b1 += _ptm->get_real("R13"); - es_b2 += _ptm->get_real("R14"); - es_b3 += eb3; - cess_amm += _ptm->get_real("R10"); + es_b1 += _pum->get_real("R4"); + es_b2 += _pum->get_real("R5"); + es_b3 += _pum->get_real("R6"); + cess_amm += _pum->get_real("R0"); pro_pag += _plm->get_real("R2"); } - - tt = volaff1.string(); tt.add(volaff2.string()); - _pla->put("R0", ven_lrd); - _pla->put("R1", es_b1); - _pla->put("R2", es_b2); - _pla->put("R3", es_b3); - _pla->put("R4", cess_amm); - _pla->put("S1", tt); - _pla->put("S2", iva_acq.string()); - _pla->put("S3", pro_pag.string()); + _pla->put("R0", ven_lrd); + _pla->put("R1", es_b1); + _pla->put("R2", es_b2); + _pla->put("R3", es_b3); + _pla->put("R4", cess_amm); + _pla->put("R11", iva_acq); + _pla->put("R12", pro_pag); + _pla->put("R14", volaff1); + _pla->put("S1", volaff2.string()); _pla->rewrite(); } diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index 9cad36dd4..f97d3c422 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -10,34 +10,34 @@ #include "cg4300.h" bool TLiquidazione_app::is_trim(int x) - // TRUE se il mese passato e' un trimestre + // TRUE se il mese passato e' un trimestre { return x == 3 || x == 6 || x == 9 || x == 12; } bool TLiquidazione_app::is_month_ok_strict(int x, int month) - // TRUE se il mese passato e' compatibile con il regime - // di liquidazione e (opz) non e' maggiore di quello scelto + // TRUE se il mese passato e' compatibile con il regime + // di liquidazione e (opz) non e' maggiore di quello scelto { if (month == -1) month = x; return _freqviva == "M" ? ( x > 0 && x <= month) : - ( x <= month && is_trim(x)); + ( x <= month && is_trim(x)); } bool TLiquidazione_app::is_month_ok(int x, int mtocalc) - // TRUE se il mese passato e' compatibile con il mese da calcolare - // rispetto al regime di liquidazione scelto + // TRUE se il mese passato e' compatibile con il mese da calcolare + // rispetto al regime di liquidazione scelto { bool ret = x == mtocalc; if (!ret && _freqviva == "T" && mtocalc != 13) { - // aggiusta al trimestre il mese da calcolare - mtocalc += 2 - ((mtocalc-1) % 3); - ret = x > (mtocalc - 3) && x <= mtocalc; + // aggiusta al trimestre il mese da calcolare + mtocalc += 2 - ((mtocalc-1) % 3); + ret = x > (mtocalc - 3) && x <= mtocalc; } else if (!ret && mtocalc == 13) { // per l'annuale ritorna TRUE per tutti i mesi da liquidare - ret = x <= 13; + ret = x <= 13; } return ret; } @@ -46,9 +46,9 @@ int TLiquidazione_app::liq_month(int x) // ritorna il mese da liquidare (= LIM presente) // che corrisponde al mese passato { - if (x == 13 || _freqviva == "M") - return x; - else return x + (2 - ((x-1) % 3)); + if (x == 13 || _freqviva == "M") + return x; + else return x + (2 - ((x-1) % 3)); } bool TLiquidazione_app::is_first_month(int m) @@ -66,10 +66,10 @@ int TLiquidazione_app::previous_month(int m) } bool TLiquidazione_app::is_date_ok(TDate& d, int month) -// TRUE se la data (di mov o pim) passata va considerata nel -// ricalcolo dei progressivi mensili per il mese e anno -// selezionati; se month == 13 vanno bene tutte purche' -// sia giusto l'anno + // TRUE se la data (di mov o pim) passata va considerata nel + // ricalcolo dei progressivi mensili per il mese e anno + // selezionati; se month == 13 vanno bene tutte purche' + // sia giusto l'anno { if (d.month() > month || d.year() != atoi(_year)) return FALSE; @@ -82,77 +82,77 @@ void TLiquidazione_app::add_ventilation(real iva, real howmuch, const char* cod { _VentItem* vi = NULL; for (int i = 0; i < _vent_arr.items(); i++) - { - vi = (_VentItem*)&_vent_arr[i]; - if (vi->_codiva == codiva) - break; - } + { + vi = (_VentItem*)&_vent_arr[i]; + if (vi->_codiva == codiva) + break; + } if (i == _vent_arr.items()) - { - _vent_arr.add(vi = new _VentItem); - vi->_aliquota = iva; - vi->_codiva = codiva; - } + { + _vent_arr.add(vi = new _VentItem); + vi->_aliquota = iva; + vi->_codiva = codiva; + } vi->_totale += howmuch; } void TLiquidazione_app::add_vendite(int month, const char* codreg, - int tipodet, real& r) + int tipodet, real& r) { _VendItem* vi = NULL; - + for (int i = 0; i < _vend_arr.items(); i++) - { - vi = (_VendItem*)&_vend_arr[i]; - if (vi->_codreg == codreg && vi->_month == month && vi->_tipodet == tipodet) - break; - } + { + vi = (_VendItem*)&_vend_arr[i]; + if (vi->_codreg == codreg && vi->_month == month && vi->_tipodet == tipodet) + break; + } if (i == _vend_arr.items()) - { - _vend_arr.add(vi = new _VendItem); - vi->_codreg = codreg; - vi->_month = month; - vi->_tipodet = tipodet; - } + { + _vend_arr.add(vi = new _VendItem); + vi->_codreg = codreg; + vi->_month = month; + vi->_tipodet = tipodet; + } vi->_totale += r; } void TLiquidazione_app::add_corrisp(int month, const char* codreg, real& r, - real& p, int tipodet, const char * codiva) + real& p, int tipodet, const char * codiva) { _CorrItem* ci = NULL; - const int nitems = _corr_arr.items(); - + const int nitems = _corr_arr.items(); + for (int i = 0; i < nitems; i++) - { - ci = (_CorrItem*)&_corr_arr[i]; - if (ci->_codreg == codreg && ci->_month == month && - ci->_codiva == codiva && ci->_tipodet == tipodet) - break; - } + { + ci = (_CorrItem*)&_corr_arr[i]; + if (ci->_codreg == codreg && ci->_month == month && + ci->_codiva == codiva && ci->_tipodet == tipodet) + break; + } if (i == nitems) - { - _corr_arr.add(ci = new _CorrItem); - ci->_codreg = codreg; - ci->_month = month; - ci->_codiva = codiva; - ci->_tipodet = tipodet; - ci->_aliquota = p; - } + { + _corr_arr.add(ci = new _CorrItem); + ci->_codreg = codreg; + ci->_month = month; + ci->_codiva = codiva; + ci->_tipodet = tipodet; + ci->_aliquota = p; + } ci->_totale += r; } bool TLiquidazione_app::look_pim(int month, const char* codatt, const char* codreg, - const char* tipocr, const char* codiva, int tipodet, - bool create) - // ritorna il PIM corrispondente alla chiave passata; se - // create = TRUE lo crea se non lo trova. Ritorna se c'era + const char* tipocr, const char* codiva, int tipodet, + bool create) + // ritorna il PIM corrispondente alla chiave passata; se + // create = TRUE lo crea se non lo trova. Ritorna se c'era { bool ok = FALSE; _pim_r->zero(); (*_pim_anno) = _year; - (*_pim_mese) = format("%d", month); + (*_pim_mese) = format("%02d", month); (*_pim_codreg) = codreg; (*_pim_codiva) = codiva; (*_pim_codatt) = codatt; @@ -165,11 +165,11 @@ bool TLiquidazione_app::look_pim(int month, const char* codatt, const char* codr ok = _pim->good(); if (!ok && create) - { - _pim_r->zero(); - _pim_r->put("CODTAB",s); - _pim->write(); - } + { + _pim_r->zero(); + _pim_r->put("CODTAB",s); + _pim->write(); + } return ok; } @@ -178,8 +178,8 @@ bool TLiquidazione_app::look_plm(int m, const char* a, bool create) bool ok = FALSE; _plm_r->zero(); - (*_plm_codatt) = a; - (*_plm_mese) = format("%d",m); + (*_plm_codatt) = format("%06ld", atol(a)); + (*_plm_mese) = format("%02d",m); (*_plm_anno) = _year; TString s = _plm_r->get("CODTAB"); @@ -187,33 +187,81 @@ bool TLiquidazione_app::look_plm(int m, const char* a, bool create) ok = _plm->good(); if (!ok && create) - { - _plm_r->zero(); - _plm_r->put("CODTAB",s); - _plm->write(); - } + { + _plm_r->zero(); + _plm_r->put("CODTAB",s); + _plm->write(); + } + // crea/posiziona tabelle gemelle PAM, PUM, POM + look_pam(m,a,!ok); + look_pum(m,a,!ok); + look_pom(m,a,!ok); return ok; } -bool TLiquidazione_app::look_ptm(int m, const char* a, bool create) +bool TLiquidazione_app::look_pum(int m, const char* a, bool create) { bool ok = FALSE; - _ptm->zero(); - (*_ptm_codatt) = a; - (*_ptm_mese) = format("%d",m); - (*_ptm_anno) = _year; + _pum->zero(); + (*_pum_codatt) = format("%06ld", atol(a)); + (*_pum_mese) = format("%02d",m); + (*_pum_anno) = _year; - TString s = _ptm->get("CODTAB"); - _ptm->read(); - ok = _ptm->good(); + TString s = _pum->get("CODTAB"); + _pum->read(); + ok = _pum->good(); if (!ok && create) - { - _ptm->zero(); - _ptm->put("CODTAB",s); - _ptm->write(); - } + { + _pum->zero(); + _pum->put("CODTAB",s); + _pum->write(); + } + return ok; +} + +bool TLiquidazione_app::look_pom(int m, const char* a, bool create) +{ + bool ok = FALSE; + + _pom->zero(); + (*_pom_codatt) = format("%06ld", atol(a)); + (*_pom_mese) = format("%02d",m); + (*_pom_anno) = _year; + + TString s = _pom->get("CODTAB"); + _pom->read(); + ok = _pom->good(); + + if (!ok && create) + { + _pom->zero(); + _pom->put("CODTAB",s); + _pom->write(); + } + return ok; +} + +bool TLiquidazione_app::look_pam(int m, const char* a, bool create) +{ + bool ok = FALSE; + + _pam->zero(); + (*_pam_codatt) = format("%06ld", atol(a)); + (*_pam_mese) = format("%02d",m); + (*_pam_anno) = _year; + + TString s = _pam->get("CODTAB"); + _pam->read(); + ok = _pam->good(); + + if (!ok && create) + { + _pam->zero(); + _pam->put("CODTAB",s); + _pam->write(); + } return ok; } @@ -222,7 +270,7 @@ bool TLiquidazione_app::look_lim(int m, bool create) bool ok = FALSE; _lim_r->zero(); - (*_lim_mese) = format("%d",m); + (*_lim_mese) = format("%02d",m); (*_lim_anno) = _year; TString s = _lim_r->get("CODTAB"); @@ -230,11 +278,36 @@ bool TLiquidazione_app::look_lim(int m, bool create) ok = _lim->good(); if (!ok && create) - { - _lim_r->zero(); - _lim_r->put("CODTAB",s); - _lim->write(); - } + { + _lim_r->zero(); + _lim_r->put("CODTAB",s); + _lim->write(); + } + + // crea o posiziona la tabella gemella LAM + look_lam(m, !ok); + + return ok; +} + +bool TLiquidazione_app::look_lam(int m, bool create) +{ + bool ok = FALSE; + + _lam_r->zero(); + (*_lam_mese) = format("%02d",m); + (*_lam_anno) = _year; + + TString s = _lam_r->get("CODTAB"); + _lam->read(); + ok = _lam->good(); + + if (!ok && create) + { + _lam_r->zero(); + _lam_r->put("CODTAB",s); + _lam->write(); + } return ok; } @@ -247,7 +320,7 @@ bool TLiquidazione_app::look_pla(const char* a, bool create) char buf[10]; strcpy(buf,a); buf[strlen(buf) - 1] = '1'; - (*_pla_codatt) = buf; + (*_pla_codatt) = format("%06ld", atol(buf)); (*_pla_anno) = _year; TString s = _pla_r->get("CODTAB"); @@ -255,30 +328,28 @@ bool TLiquidazione_app::look_pla(const char* a, bool create) ok = _pla->good(); if (!ok && create) + { + real es_b1, es_b2, es_b3, prorata; + // alla creazione del PLA + // si prendono i valori di prorata e plafond dall'anno scorso + _pla_r->zero(); + (*_pla_codatt) = format("%06ld", atol(buf)); + (*_pla_anno) = atoi(_year) - 1; + if (_pla->read() == NOERR) { - real es_b1, es_b2, es_b3, prorata; - // alla creazione del PLA - // si prendono i valori di prorata e plafond dall'anno scorso - // e (TBI) si controllano incompatibilita' con la normativa - - _pla_r->zero(); - (*_pla_codatt) = buf; - (*_pla_anno) = atoi(_year) - 1; - if (_pla->read() == NOERR) - { - es_b1 = _pla->get_real("R1"); - es_b2 = _pla->get_real("R2"); - es_b3 = _pla->get_real("R3"); - es_b1 = _pla->get_real("R9"); - } - _pla->zero(); - _pla_r->put("CODTAB",s); - _pla->put("R5",es_b1); - _pla->put("R6",es_b2); - _pla->put("R7",es_b3); - _pla->put("R8",prorata); - _pla->write(); + es_b1 = _pla->get_real("R1"); + es_b2 = _pla->get_real("R2"); + es_b3 = _pla->get_real("R3"); + es_b1 = _pla->get_real("R9"); } + _pla->zero(); + _pla_r->put("CODTAB",s); + _pla->put("R5",es_b1); + _pla->put("R6",es_b2); + _pla->put("R7",es_b3); + _pla->put("R8",prorata); + _pla->write(); + } return ok; } @@ -303,8 +374,8 @@ bool TLiquidazione_app::look_ppa(int month, const char* codatt, int type, bool c { _ppa->zero(); (*_ppa_year) = _year; - (*_ppa_month) = month; - (*_ppa_codatt) = codatt; + (*_ppa_month) = format("%02d",month); + (*_ppa_codatt) = format("%06ld", atol(codatt)); (*_ppa_kind) = type; TString ctab = _ppa_r->get("CODTAB"); _ppa->read(); @@ -312,11 +383,11 @@ bool TLiquidazione_app::look_ppa(int month, const char* codatt, int type, bool c bool ok = _ppa->good(); if (!ok && create) - { - _ppa_r->zero(); - _ppa_r->put("CODTAB",ctab); - _ppa->write(); - } + { + _ppa_r->zero(); + _ppa_r->put("CODTAB",ctab); + _ppa->write(); + } return ok; } @@ -324,7 +395,7 @@ bool TLiquidazione_app::look_rmb(int month, const char* codiva, tiporeg tr, bool { _rmb->zero(); (*_rmb_anno) = _year; - (*_rmb_mese) = month; + (*_rmb_mese) = format("%02d",month); (*_rmb_codiva) = codiva; (*_rmb_tiporeg) = (int)tr; TString ctab = _rmb->get("CODTAB"); @@ -333,11 +404,11 @@ bool TLiquidazione_app::look_rmb(int month, const char* codiva, tiporeg tr, bool bool ok = _rmb->good(); if (!ok && create) - { - _rmb->zero(); - _rmb->put("CODTAB",ctab); - _rmb->write(); - } + { + _rmb->zero(); + _rmb->put("CODTAB",ctab); + _rmb->write(); + } return ok; } @@ -356,26 +427,26 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) bool ok = _del->good(); if (!ok && create) - { - _del->zero(); - _del->put("CODTAB",ctab); + { + _del->zero(); + _del->put("CODTAB",ctab); - // TBI infila ufficio concessione in S9 - - // sistema 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->write(); - } + // TBI infila ufficio concessione in S9 + + // sistema 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->write(); + } return ok; } @@ -383,7 +454,7 @@ bool TLiquidazione_app::look_lia(bool create, int year) { if (year == 0) year = atoi(_year); TString16 y; y << year; - + _lia->zero(); _lia->put("CODTAB", y); _lia->read(); @@ -393,23 +464,23 @@ bool TLiquidazione_app::look_lia(bool create, int year) _lia->zero(); _lia->put("CODTAB", y); _lia->put("S7", _freqviva); - _lia->write(); - } - return ok; + _lia->write(); + } + return ok; } real TLiquidazione_app::result_liq(int month) -// risultato esatto della liquidazione del mese month, <0 a credito -// > 0 a debito; comprende TUTTI, anche il conguaglio prorata in annuale + // risultato esatto della liquidazione del mese month, <0 a credito + // > 0 a debito; comprende TUTTI, anche il conguaglio prorata in annuale { - real r(0.0); - // ulteriori detrazioni, acconti, versamenti, - // rettifiche sono gia' comprese in R0 - if (look_lim(month)) - r = _lim->get_real("R0"); - return r; + real r(0.0); + // ulteriori detrazioni, acconti, versamenti, + // rettifiche, conguagli sono gia' compresi in R0 + if (look_lim(month)) + r = _lim->get_real("R0"); + return r; } - + real TLiquidazione_app::debt_prec(int month) { @@ -428,7 +499,7 @@ real TLiquidazione_app::debt_prec(int month) real TLiquidazione_app::credito_prec(int month) -// ritorna l'appropriato credito precedente al mese in corso + // ritorna l'appropriato credito precedente al mese in corso { real c(0.0); @@ -437,38 +508,38 @@ real TLiquidazione_app::credito_prec(int month) // credito inizio anno if (look_lia()) c = _lia->get_real("R0"); - // e' positivo o 0 - } - else - { - c = result_liq(previous_month(month)); - if (c.sign() < 0) c = abs(c); - else c = real(0.0); + // e' positivo o 0 } +else +{ + c = result_liq(previous_month(month)); + if (c.sign() < 0) c = abs(c); + else c = real(0.0); +} - return c; +return c; } real TLiquidazione_app::credito_costo_prec(int month) -// ritorna l'appropriato credito di costo precedente al mese in corso -// (travel agency only) + // ritorna l'appropriato credito di costo precedente al mese in corso + // (travel agency only) { real c(0.0); if (is_first_month(month)) - { - int yr = atoi(_year)-1; - _lim->zero(); - *_lim_anno = yr; - *_lim_mese = 12; - if (_lim->read() == NOERR) - c = _lim->get_real("R2"); - } + { + int yr = atoi(_year)-1; + _lim->zero(); + *_lim_anno = yr; + *_lim_mese = 12; + if (_lim->read() == NOERR) + c = _lim->get_real("R2"); + } else - { - if (look_lim(previous_month(month))) + { + if (look_lim(previous_month(month))) // qui il rimborso non c'e' - c = _lim->get_real("R2"); - } + c = _lim->get_real("R2"); + } look_lim(month); return c; } @@ -483,7 +554,7 @@ 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 + // che non sia per visliq { ret += _del->get_real("R0"); if (intr) ret += _del->get_real("R1"); @@ -507,4 +578,4 @@ real TLiquidazione_app::interesse_trimestrale(int month) TConfig cnf(CONFIG_STUDIO); real r(cnf.get("InTr", NULL, month)); return r; -} \ No newline at end of file +} diff --git a/cg/cg4303.cpp b/cg/cg4303.cpp index cf36d62eb..fab67434f 100755 --- a/cg/cg4303.cpp +++ b/cg/cg4303.cpp @@ -235,10 +235,12 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) } } // memorizza totali per il prospettino di m. - look_ptm(month, codatt); - _ptm->put("S4",totacq.string()); - _ptm->put("S5",totven.string()); - _ptm->rewrite(); + look_plm(month, codatt); + + // TBI PAM e PUM + _pam->put("R2",totacq); + _pam->put("R3",totven); + _pam->rewrite(); } @@ -276,12 +278,10 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts) att = tmpatt; for (int m = month - 2; m <= month; m++) { - if (!look_plm(m,att) || !look_ptm(m,att)) continue; + if (!look_plm(m,att)) continue; - real tvol(_ptm->get("S3")); - vol_aff += tvol; - real esni(_plm->get("S1")); - es_ni += esni; + vol_aff += _pam->get_real("R1"); + es_ni += _pum->get_real("R6"); } } @@ -416,8 +416,8 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts) } // finalmente - alv = vtot/ivav; - ala = atot/ivaa; + alv = vtot/ivav; alv.round(2); + ala = atot/ivaa; ala.round(2); if (ala > alv) { diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index ebc040a69..89ab5fba3 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -39,8 +39,8 @@ void TLiquidazione_app::set_page(int file, int cnt) case CHG_PARMS: set_att(d); break; case SET_FIRM: set_firm(d); break; case PIM_ROW: set_pim(d); break; + case MISC_LIQ: set_pumpam(d); break; case TOT_ROW: set_plm(d); break; - case MISC_LIQ: set_ptm(d); break; case PLAFOND: set_plafond(d); break; case VENTILA: set_ventila(d); break; case REGAGR: set_regagr(d); break; @@ -164,9 +164,10 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt) _DescrItem* d = new _DescrItem(VENTILA); TString att(codatt); - look_ptm(month, att); - real r0(_ptm->get("S4")); - real r1(_ptm->get("S5")); + look_plm(month, att); + real r0 = _pam->get("R2"); + real r1 = _pam->get("R3"); + d->_r0 = r0; d->_r1 = r1; for (_pim->first(); !_pim->eof(); _pim->next()) @@ -366,9 +367,9 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt) { isnew = TRUE; _DescrItem* dd = new _DescrItem(PIM_ROW); - // CiccioPrassi li vuole in ordine crescente + // CicciaPrassi li vuole in ordine crescente _descr_arr.insert(dd,i); - // che cazzo di due marroni: se quello dopo + // che Cazzo di due Marroni: se quello dopo // era il primo, quello prima e' dopo if (d->_f0) { @@ -479,55 +480,43 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt) while ((tmpatt = atts.get()) != NULL) { TString att(tmpatt); - look_ptm(m, att); - d->_r6 += _ptm->get_real("R0"); // acq. intracomunitari - d->_r7 += _ptm->get_real("R1"); // inded. art 19 - d->_r8 += _ptm->get_real("R2"); // IVA su inded. art. 19 - t->_r0 += _ptm->get_real("R3"); // acq. ammortizz. - t->_r1 += _ptm->get_real("R4"); // IVA acq. ammort. - t->_r2 += _ptm->get_real("R5"); // ammort. detr. 6% - t->_r3 += _ptm->get_real("R12"); // IVA ammort detr. 6% - t->_r4 += _ptm->get_real("R6"); // acq. beni rivendita - t->_r5 += _ptm->get_real("R7"); // IVA acq. beni rivendita - t->_r6 += _ptm->get_real("R8"); // acq. leasing - t->_r7 += _ptm->get_real("R9"); // IVA acq. leasing - t->_r8 += _ptm->get_real("R10"); // cessioni beni ammort. - t->_r9 += _ptm->get_real("R11"); // IVA su cessioni ammort. - t->_r10 += _ptm->get_real("R13"); // tot. esenti IVA - look_plm(m, att); + + // TBI rifare per pam e pum + d->_r6 += _pom->get_real("R0"); // acq. intracomunitari + d->_r7 += _pom->get_real("R1"); // inded. art 19 + d->_r8 += _pom->get_real("R2"); // IVA su inded. art. 19 + t->_r0 += _pom->get_real("R3"); // acq. ammortizz. + t->_r1 += _pom->get_real("R4"); // IVA acq. ammort. + t->_r2 += _pum->get_real("R2"); // ammort. detr. 6% + t->_r3 += _pum->get_real("R3"); // IVA ammort detr. 6% + t->_r4 += _pom->get_real("R5"); // acq. beni rivendita + t->_r5 += _pom->get_real("R6"); // IVA acq. beni rivendita + t->_r6 += _pom->get_real("R7"); // acq. leasing + t->_r7 += _pom->get_real("R8"); // IVA acq. leasing + t->_r8 += _pum->get_real("R0"); // cessioni beni ammort. + t->_r9 += _pum->get_real("R1"); // IVA su cessioni ammort. + t->_r10 += _pum->get_real("R4"); // tot. esenti IVA t->_r11 += _plm->get_real("R2"); // pro-rata indetraibile t->_s0 = (_plm->get_real("R12")).string(); // % pro-rata - t->_f0 = !_prorata.is_zero(); // flag per segnalare l'esistenza - - // minchie indeducibili su ricavi esenti - TToken_string s(_plm->get("S2")); - - real aie(s.get(0)); // acq. inded. su ricavi esenti - real aiev(s.get(1)); // IVA acq. inded. su ricavi esenti - d->_r9 += aie; - d->_r10 += aiev; - + t->_f0 = !_prorata.is_zero(); // flag per segnalare l'esistenza + d->_r9 += _pom->get_real("R9"); // acq. inded. su ricavi esenti + d->_r10 += _pom->get_real("R10"); // IVA acq. inded. su ricavi esenti + // passaggi interni - s = _plm->get("S3"); - real aipi(s.get(0)); // acq. inded. per pass. int. - real aipiv(s.get(1)); // IVA acq. inded. per pass. int. real aipip(d->_s0); // progressivo ... real aipivp(d->_s1); // ... (che mazzata sulle palle...) - aipip += aipi; // ricalcolo ... - aipivp += aipiv; // ... + aipip += _pum->get_real("R8"); // acq. inded. per pass. int + aipivp += _pum->get_real("R9"); // IVA acq. inded. per pass. int d->_s0 = aipip.string(); // risbatto ... d->_s1 = aipivp.string(); // .. // spese generali. - s = _plm->get("S4"); - real spgn(s.get(0)); // spese generali. - real spgnv(s.get(1)); // IVA spese generali real spgnp(t->_s2); // progressivo ... real spgnvp(t->_s3); // ... (che doppia mazzata sulle palle...) - spgnp += spgn; // ricalcolo ... - spgnvp += spgnv; // ... + spgnp += _pam->get_real("R10"); // spese generali. + spgnvp += _pam->get_real("R11"); // IVA spese generali. t->_s2 = spgnp.string(); // risbatto ... t->_s3 = spgnvp.string(); // .. } // while (attivita') @@ -540,8 +529,8 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt) // calcolo del prorata o del nuovo plafond o .... if (look_pla(codatt)) { - TToken_string tt(_pla->get("S1")); - real v1 = tt.get(0); real v2 = tt.get(1); + real v1 = _pla->get_real("R14"); + real v2(_pla->get("S1")); real v = v1 + v2; real e1 = _pla->get_real("R1"); real e2 = _pla->get_real("R2"); @@ -586,13 +575,20 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts, d->_r4 = _lim->get_real("R4"); d->_r5 = _lim->get_real("R5"); d->_r6 = _lim->get_real("R6"); - d->_r7 = _lim->get_real("R11"); + d->_r7 = _lim->get_real("R14"); d->_r9 = _lim->get_real("R9"); d->_r10 = _lim->get_real("R7"); // totale conguaglio prorata - d->_s0 = _lim->get("S2"); - d->_s1 = _lim->get("S3"); - d->_s2 = _lim->get("S4"); - d->_s3 = _lim->get("S5"); + + TToken_string tt(80); + tt.add(_lam->get_real("R0").string()); + tt.add(_lam->get_real("R1").string()); + tt.add(_lam->get_real("R2").string()); + tt.add(_lam->get_real("R3").string()); + + d->_s0 = tt; + d->_s1 = _lim->get_real("R11").string(); + d->_s2 = _lim->get_real("R12").string(); + d->_s3 = _lim->get_real("R13").string(); d->_r11 = (const char*)_lim->get("R10"); // tasso di interesse if (_is_visliq) @@ -879,9 +875,8 @@ void TLiquidazione_app::set_plm(_DescrItem& d) } -void TLiquidazione_app::set_ptm(_DescrItem& d) +void TLiquidazione_app::set_pumpam(_DescrItem& d) { - bool printed = FALSE; real spgn(d._s2); @@ -1081,7 +1076,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d) if (iva >= IVA_DA_RIPORTARE || _isannual || _isriepilogo) set_row(rw++,"@23gIVA DA VERSARE@75g%r",&iva); else - set_row(rw++,"@23gIVA A DEBITO DA NON VERSARE@75g%r",iva); + set_row(rw++,"@23gIVA A DEBITO DA NON VERSARE@75g%r",&iva); } } } diff --git a/cg/cg4305.cpp b/cg/cg4305.cpp index 991487c8c..b25cc6ec5 100755 --- a/cg/cg4305.cpp +++ b/cg/cg4305.cpp @@ -117,7 +117,7 @@ bool TLiquidazione_app::extract_delega(int month) if (look_lim(month)) { real topay = result_liq(month); - real intr = _lim->get_real("R11"); + real intr = _lim->get_real("R14"); if (topay.sign() <= 0) return TRUE; diff --git a/cg/cg5500.cpp b/cg/cg5500.cpp index 3839feb43..a443b7d7b 100755 --- a/cg/cg5500.cpp +++ b/cg/cg5500.cpp @@ -723,7 +723,7 @@ bool Visliq_app::vis_one(int m) TDate date(TODAY); TString cab(5), abi(5), con(5); - bool is_delega = FALSE; + bool is_delega = FALSE, was_delega = FALSE; if (is_delega = look_del(m,1)) { @@ -859,8 +859,8 @@ bool Visliq_app::vis_one(int m) { if (!is_delega) { - look_del(m,1,TRUE); - is_delega = TRUE; + was_delega = look_del(m,1,TRUE); + is_delega = TRUE; } _del->put("D0",msk.get(F_DELDATE)); write_del = TRUE; @@ -925,8 +925,10 @@ bool Visliq_app::vis_one(int m) _lia->rewrite(); if (write_del && k == K_SAVE) - _del->rewrite(); - + { + if (!was_delega) _del->write(); + else _del->rewrite(); + } if ((write_lim || write_lia) && k == K_SAVE) { _lim->put("B0", ""); diff --git a/cg/cg5500d.uml b/cg/cg5500d.uml index edecb6b9b..cd6329cb3 100755 --- a/cg/cg5500d.uml +++ b/cg/cg5500d.uml @@ -30,7 +30,7 @@ BEGIN END -BROWSEFILE F_VISFLQ 80 11 +BROWSEFILE F_VISFLQ 0 11 BEGIN PROMPT 0 3 "" END