From 0295c4868b3668f0e17416262c363e249300bf10 Mon Sep 17 00:00:00 2001 From: mtollari Date: Mon, 8 May 2017 15:52:29 +0000 Subject: [PATCH] Patch level : 12.0 384 Files correlati : cg4.exe Commento : Corretto in funzionamento per fatture per cassa pagate in anticipo e calcolo pro-rata per le fatture per cassa. git-svn-id: svn://10.65.10.50/branches/R_10_00@23795 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- src/cg/cg4304.cpp | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/cg/cg4304.cpp b/src/cg/cg4304.cpp index f4cb9f39f..b9171785a 100755 --- a/src/cg/cg4304.cpp +++ b/src/cg/cg4304.cpp @@ -2514,21 +2514,35 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw) real xcasinc_iva = d._ra6; real xcasinc_iva_acq = d._ra8; - if (has_module(ICAUT) && (!diffinc_iva.is_zero() || !diffinc_iva_acq.is_zero())) - { - real dimp, diva, ximp, xiva; + real perc_prorata; -// if (!diffinc_iva.is_zero() && calc_inc_diff(1, dimp, diva, ximp, xiva)) -// { -// diffinc_iva = _imposta_inc_diff_ven; -// xcasinc_iva = _imposta_inc_cassa_ven; -// } -// if (!diffinc_iva_acq.is_zero() && calc_inc_diff(2, dimp, diva, ximp, xiva)) -// { -// diffinc_iva_acq = _imposta_inc_diff_acq; -// xcasinc_iva_acq = _imposta_inc_cassa_acq; -// } - } + TString query = "USE PLM"; + query << "\nFROM CODTAB=" << _year << "\nTO CODTAB=" << _year; + TISAM_recordset ip(query); + const TRectype& recp = ip.cursor()->curr(); + for (bool ok = ip.move_first(); ok && perc_prorata == ZERO; ok = ip.move_next()) + { + int m = atoi(ip.get("CODTAB").as_string().mid(10)); + real p = ip.get("R12").as_real(); + if (m == _month && (p > ZERO && p <= CENTO)) + perc_prorata = p; + } + + if (perc_prorata > ZERO) + { + if (diffinc_iva_acq != ZERO) + { + real ind = diffinc_iva_acq * perc_prorata / CENTO; + ind.round(TCurrency::get_firm_dec()); + diffinc_iva_acq -= ind; + } + if (xcasinc_iva_acq != ZERO) + { + real ind = xcasinc_iva_acq * perc_prorata / CENTO; + ind.round(TCurrency::get_firm_dec()); + xcasinc_iva_acq -= ind; + } + } TToken_string tt(d._s0); real iva_vend(tt.get(0));