Corretta la cagata del rimborso infraanale (MI0452)
git-svn-id: svn://10.65.10.50/trunk@1004 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
88c4f0ce3c
commit
9b6ce7f444
@ -79,7 +79,7 @@ bool TLiquidazione_app::is_date_ok(TDate& d, int month)
|
||||
|
||||
|
||||
void TLiquidazione_app::add_ventilation(real iva, real howmuch,
|
||||
const char* codiva, const char* other)
|
||||
const char* codiva, const char* other)
|
||||
{
|
||||
_VentItem* vi = NULL;
|
||||
for (int i = 0; i < _vent_arr.items(); i++)
|
||||
|
@ -419,8 +419,15 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts)
|
||||
}
|
||||
|
||||
// finalmente
|
||||
alv = vtot/ivav; alv.round(2);
|
||||
ala = atot/ivaa; ala.round(2);
|
||||
alv = ivav/vtot; alv.round(2);
|
||||
ala = ivaa/atot; ala.round(2);
|
||||
|
||||
TString alvs = alv.string();
|
||||
TString alas = ala.string();
|
||||
TString vtots = vtot.string();
|
||||
TString atots = atot.string();
|
||||
TString ivavs = ivav.string();
|
||||
TString ivaas = ivaa.string();
|
||||
|
||||
if (ala > alv)
|
||||
{
|
||||
|
@ -9,12 +9,12 @@ BEGIN
|
||||
PROMPT -24 -1 "Ri~calcola"
|
||||
MESSAGE EXIT,K_INS
|
||||
END
|
||||
|
||||
|
||||
BUTTON DLG_CANCEL 8 2
|
||||
BEGIN
|
||||
PROMPT -34 -1 ""
|
||||
END
|
||||
|
||||
|
||||
BUTTON DLG_QUIT 8 2
|
||||
BEGIN
|
||||
PROMPT -44 -1 ""
|
||||
|
424
cg/classpim.cpp
424
cg/classpim.cpp
@ -2,220 +2,220 @@
|
||||
// funzione per classificare i PIM e sommare tutto cio' che contengono
|
||||
#include "classpim.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t)
|
||||
{
|
||||
static int last_checked = -1;
|
||||
|
||||
// parse CODTAB of pim record
|
||||
TString ctab = pimr.get("CODTAB");
|
||||
|
||||
const int tipocr = atoi(ctab.mid(15,1)); // tipo costo_ricavo
|
||||
const int tipodet = atoi(ctab.mid(20,1)); // tipo detraibilita'
|
||||
const int corrisp = (int)pimr.get_long("I0"); // netto = 1, lordo = 2
|
||||
const int tipomov = (int)pimr.get_long("I1"); // 1 = vendita, 2 = acquisto
|
||||
static int last_checked = -1;
|
||||
|
||||
// parse CODTAB of pim record
|
||||
TString ctab = pimr.get("CODTAB");
|
||||
|
||||
const int tipocr = atoi(ctab.mid(15,1)); // tipo costo_ricavo
|
||||
const int tipodet = atoi(ctab.mid(20,1)); // tipo detraibilita'
|
||||
const int corrisp = (int)pimr.get_long("I0"); // netto = 1, lordo = 2
|
||||
const int tipomov = (int)pimr.get_long("I1"); // 1 = vendita, 2 = acquisto
|
||||
|
||||
const bool vola = pimr.get_bool("B2");
|
||||
const bool rimb = pimr.get_bool("B3");
|
||||
const bool ricl = pimr.get_bool("B4");
|
||||
|
||||
TString tipoiva = pimr.get("S5");
|
||||
|
||||
// cominciamo cosi'
|
||||
imp = ZERO; iva = ZERO;
|
||||
|
||||
for (int i = last_checked + 1; i <= MAX_TIPOREC; i++)
|
||||
{
|
||||
tiporec tocheck = (tiporec)i;
|
||||
bool found = FALSE;
|
||||
|
||||
const bool vola = pimr.get_bool("B2");
|
||||
const bool rimb = pimr.get_bool("B3");
|
||||
const bool ricl = pimr.get_bool("B4");
|
||||
|
||||
TString tipoiva = pimr.get("S5");
|
||||
|
||||
// cominciamo cosi'
|
||||
imp = ZERO; iva = ZERO;
|
||||
|
||||
for (int i = last_checked + 1; i <= MAX_TIPOREC; i++)
|
||||
{
|
||||
tiporec tocheck = (tiporec)i;
|
||||
bool found = FALSE;
|
||||
|
||||
switch(tocheck)
|
||||
{
|
||||
case acq_norm:
|
||||
found = tipomov == 2 && tipoiva != "NS";
|
||||
found &= (tipodet == 0 || tipodet == 1 || tipodet == 3 ||
|
||||
tipodet == 5 || tipodet == 9);
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
}
|
||||
break;
|
||||
case vend_norm:
|
||||
found = tipomov == 1 && corrisp == 1 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
}
|
||||
break;
|
||||
case acq_simp:
|
||||
if (tipomov == 2)
|
||||
{
|
||||
imp = pimr.get_real("R11");
|
||||
iva = pimr.get_real("R12");
|
||||
}
|
||||
found = !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case vend_simp:
|
||||
if (tipomov == 1 && corrisp == 1)
|
||||
{
|
||||
imp = pimr.get_real("R11");
|
||||
iva = pimr.get_real("R12");
|
||||
}
|
||||
found = !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case bolle_doganali:
|
||||
if (tipomov == 2 && tipoiva != "NS")
|
||||
{
|
||||
imp = pimr.get_real("R9");
|
||||
iva = pimr.get_real("R10");
|
||||
}
|
||||
found = !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case base_ventilazione:
|
||||
found = (tipomov == 2 && tipodet != 9 && tipocr == 1);
|
||||
found &= (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES");
|
||||
found &= (ricl ? TRUE : tipodet == 3);
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
}
|
||||
found &= !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case acq_beni_riv:
|
||||
found = (tipomov == 2 && tipodet != 9 &&
|
||||
(tipocr == 1 || (tipocr == 5 && tipodet == 3)));
|
||||
found &= tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES";
|
||||
found &= (ricl ? TRUE : tipodet == 3);
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
}
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
break;
|
||||
case corr_norm:
|
||||
found = tipomov == 1 && corrisp == 2 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case corr_simp:
|
||||
if (tipomov == 1 && corrisp == 2)
|
||||
{
|
||||
imp = pimr.get_real("R11");
|
||||
iva = pimr.get_real("R12");
|
||||
}
|
||||
found = !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case acq_beni_ammort:
|
||||
found = tipomov == 2 && tipocr == 2 &&
|
||||
tipodet == 0 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_beni_ammort_nd:
|
||||
found = tipomov == 2 && tipocr ==2 &&
|
||||
tipodet != 0 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_beni_leasing:
|
||||
found = tipomov == 2 && tipocr == 8 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_amm_ultdetr:
|
||||
found = tipomov == 2 && tipocr == 3 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_ind_op_es:
|
||||
found = tipomov == 2 && tipodet == 1 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_ind_pass_int:
|
||||
found = tipomov == 2 && tipodet == 3 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_ind_art_19:
|
||||
found = tipomov == 2 && tipodet == 9 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case cess_amm:
|
||||
found = tipomov == 1 && tipocr == 4 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case vend_rimborso:
|
||||
found = tipomov == 1 && rimb && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_rimborso:
|
||||
found = tipomov == 2 && rimb && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MAX_TIPOREC)
|
||||
last_checked = -1;
|
||||
else if (found)
|
||||
{
|
||||
t = tocheck;
|
||||
last_checked = i;
|
||||
break;
|
||||
switch(tocheck)
|
||||
{
|
||||
case acq_norm:
|
||||
found = tipomov == 2 && tipoiva != "NS";
|
||||
found &= (tipodet == 0 || tipodet == 1 || tipodet == 3 ||
|
||||
tipodet == 5 || tipodet == 9);
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
}
|
||||
}
|
||||
|
||||
return last_checked != -1;
|
||||
break;
|
||||
case vend_norm:
|
||||
found = tipomov == 1 && corrisp == 1 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
}
|
||||
break;
|
||||
case acq_simp:
|
||||
if (tipomov == 2)
|
||||
{
|
||||
imp = pimr.get_real("R11");
|
||||
iva = pimr.get_real("R12");
|
||||
}
|
||||
found = !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case vend_simp:
|
||||
if (tipomov == 1 && corrisp == 1)
|
||||
{
|
||||
imp = pimr.get_real("R11");
|
||||
iva = pimr.get_real("R12");
|
||||
}
|
||||
found = !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case bolle_doganali:
|
||||
if (tipomov == 2 && tipoiva != "NS")
|
||||
{
|
||||
imp = pimr.get_real("R9");
|
||||
iva = pimr.get_real("R10");
|
||||
}
|
||||
found = !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case base_ventilazione:
|
||||
found = (tipomov == 2 && tipodet != 9 && tipocr == 1);
|
||||
found &= (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES");
|
||||
found &= (ricl ? TRUE : tipodet == 3);
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
}
|
||||
found &= !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case acq_beni_riv:
|
||||
found = (tipomov == 2 && tipodet != 9 &&
|
||||
(tipocr == 1 || (tipocr == 5 && tipodet == 3)));
|
||||
found &= tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES";
|
||||
found &= (ricl ? TRUE : tipodet == 3);
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
}
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
break;
|
||||
case corr_norm:
|
||||
found = tipomov == 1 && corrisp == 2 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case corr_simp:
|
||||
if (tipomov == 1 && corrisp == 2)
|
||||
{
|
||||
imp = pimr.get_real("R11");
|
||||
iva = pimr.get_real("R12");
|
||||
}
|
||||
found = !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case acq_beni_ammort:
|
||||
found = tipomov == 2 && tipocr == 2 &&
|
||||
tipodet == 0 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_beni_ammort_nd:
|
||||
found = tipomov == 2 && tipocr ==2 &&
|
||||
tipodet != 0 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_beni_leasing:
|
||||
found = tipomov == 2 && tipocr == 8 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_amm_ultdetr:
|
||||
found = tipomov == 2 && tipocr == 3 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_ind_op_es:
|
||||
found = tipomov == 2 && tipodet == 1 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_ind_pass_int:
|
||||
found = tipomov == 2 && tipodet == 3 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_ind_art_19:
|
||||
found = tipomov == 2 && tipodet == 9 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case cess_amm:
|
||||
found = tipomov == 1 && tipocr == 4 && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case vend_rimborso:
|
||||
found = tipomov == 1 && rimb && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
case acq_rimborso:
|
||||
found = tipomov == 2 && rimb && tipoiva != "NS";
|
||||
if (found)
|
||||
{
|
||||
imp = pimr.get_real("R0");
|
||||
iva = pimr.get_real("R1");
|
||||
found &= (!imp.is_zero() || !iva.is_zero());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MAX_TIPOREC)
|
||||
last_checked = -1;
|
||||
else if (found)
|
||||
{
|
||||
t = tocheck;
|
||||
last_checked = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return last_checked != -1;
|
||||
}
|
||||
|
@ -15,30 +15,30 @@
|
||||
|
||||
// per ora ci si fotte di agenzie viaggio e di
|
||||
// regimi agricoli
|
||||
|
||||
|
||||
enum tiporec { acq_norm = 0, vend_norm = 1, // acquisti e vendite normali
|
||||
acq_simp = 2, vend_simp = 3, // acq. e vend. sosp. imposta
|
||||
bolle_doganali = 4, // bolle doganali (acquisti)
|
||||
acq_beni_riv = 5, // acq. beni per rivendita
|
||||
base_ventilazione = 6, // base calcolo per ventil.
|
||||
corr_norm = 7, corr_simp = 8, // corrispettivi n. e s. imp.
|
||||
acq_beni_ammort = 9, // acq. beni ammortizz. detr.
|
||||
acq_beni_ammort_nd = 10, // beni ammort. non detraibili
|
||||
acq_beni_leasing = 11, // beni strum. acq in leasing
|
||||
acq_amm_ultdetr = 12, // beni amm. ult. detr 6%
|
||||
acq_ind_op_es = 13, // acq. indetr. su op.es.
|
||||
acq_ind_pass_int = 14, // passaggi interni
|
||||
acq_ind_art_19 = 15, // indetr. art. 19
|
||||
cess_amm = 16, // cessioni amministrative
|
||||
vend_rimborso = 17, // vendite valide per rimborso
|
||||
acq_rimborso = 18 // acq. validi per rimborso
|
||||
// ACHTUNG: se si aggiunge, cambiare sotto!!!
|
||||
};
|
||||
acq_simp = 2, vend_simp = 3, // acq. e vend. sosp. imposta
|
||||
bolle_doganali = 4, // bolle doganali (acquisti)
|
||||
acq_beni_riv = 5, // acq. beni per rivendita
|
||||
base_ventilazione = 6, // base calcolo per ventil.
|
||||
corr_norm = 7, corr_simp = 8, // corrispettivi n. e s. imp.
|
||||
acq_beni_ammort = 9, // acq. beni ammortizz. detr.
|
||||
acq_beni_ammort_nd = 10, // beni ammort. non detraibili
|
||||
acq_beni_leasing = 11, // beni strum. acq in leasing
|
||||
acq_amm_ultdetr = 12, // beni amm. ult. detr 6%
|
||||
acq_ind_op_es = 13, // acq. indetr. su op.es.
|
||||
acq_ind_pass_int = 14, // passaggi interni
|
||||
acq_ind_art_19 = 15, // indetr. art. 19
|
||||
cess_amm = 16, // cessioni amministrative
|
||||
vend_rimborso = 17, // vendite valide per rimborso
|
||||
acq_rimborso = 18 // acq. validi per rimborso
|
||||
// ACHTUNG: se si aggiunge, cambiare sotto!!!
|
||||
};
|
||||
|
||||
// questo serve nel cpp ma lo metto qua se no
|
||||
// non lo cambiero' mai quando serve
|
||||
const int MAX_TIPOREC = 18;
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// "classifica" un record progressivo IVA passato per reference
|
||||
// mette l'imponibile in imp, l'imposta in iva, e in t mette
|
||||
@ -83,4 +83,4 @@ const int MAX_TIPOREC = 18;
|
||||
|
||||
bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user