2016-09-09 13:58:28 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include <isam.h>
|
|
|
|
|
|
|
|
// funzione per classificare i PIM e sommare tutto cio' che contengono
|
|
|
|
#include "cgpim.h"
|
|
|
|
|
|
|
|
bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool tipost)
|
|
|
|
{
|
Patch level : 12.0 348
Files correlati : cg7.exe cg7600a.png cg7600a.rep cg7700a.png cg7700a.rep
cg7700a.png cg7700b.rep cg7800a.png cg7800a.rep
cg7700b.rep cg7700b.png
Quadri Ve VF e VJ della dichiarazioone IVA
Aggiunti ai regimi speciali sulle causali
6 Acquisti di rottami e mat.di di recupero art. 74, commi 7 e 8
7 Acquisti di oro industriale e argento puro (art. 17, comma 5)
8 Acquisti di oro da investimento imp.per opzione (art. 17, comma 5)
9 Acquisti intrac. di CPU,PC, tablet,cellulari,console,microproc.
10 Importazioni rottami e altri mat.di recupero imposta non è versata
14 Acquisti di fabbricati (art. 17, comma 6, lett. a-bis)
15 Acquisti di telefoni cellulari (art. 17, comma 6, lett. b)
16 Acquisti di prodotti elettronici (art. 17, comma 6, lett. c)
17 Acquisti di servizi del comp.edile e sett.connessi art. 17,comma 6, lett. a-ter
18 Acquisti di beni e servizi del sett.energetico art. 17, c.6 d-bis,ter,d-quater
19 Acquisti delle P.A., titolari di partita IVA art. 17-ter
git-svn-id: svn://10.65.10.50/branches/R_10_00@23639 c028cbd2-c16b-5b4b-a496-9718f37d4682
2017-02-20 14:41:21 +00:00
|
|
|
int last_checked = 0;
|
2016-09-09 13:58:28 +00:00
|
|
|
|
|
|
|
// parse CODTAB of pim record
|
|
|
|
const TString80 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");
|
|
|
|
|
|
|
|
const TString4 tipoiva = pimr.get("S5");
|
|
|
|
|
|
|
|
// cominciamo cosi'
|
|
|
|
imp = ZERO; iva = ZERO;
|
Patch level : 12.0 348
Files correlati : cg7.exe cg7600a.png cg7600a.rep cg7700a.png cg7700a.rep
cg7700a.png cg7700b.rep cg7800a.png cg7800a.rep
cg7700b.rep cg7700b.png
Quadri Ve VF e VJ della dichiarazioone IVA
Aggiunti ai regimi speciali sulle causali
6 Acquisti di rottami e mat.di di recupero art. 74, commi 7 e 8
7 Acquisti di oro industriale e argento puro (art. 17, comma 5)
8 Acquisti di oro da investimento imp.per opzione (art. 17, comma 5)
9 Acquisti intrac. di CPU,PC, tablet,cellulari,console,microproc.
10 Importazioni rottami e altri mat.di recupero imposta non è versata
14 Acquisti di fabbricati (art. 17, comma 6, lett. a-bis)
15 Acquisti di telefoni cellulari (art. 17, comma 6, lett. b)
16 Acquisti di prodotti elettronici (art. 17, comma 6, lett. c)
17 Acquisti di servizi del comp.edile e sett.connessi art. 17,comma 6, lett. a-ter
18 Acquisti di beni e servizi del sett.energetico art. 17, c.6 d-bis,ter,d-quater
19 Acquisti delle P.A., titolari di partita IVA art. 17-ter
git-svn-id: svn://10.65.10.50/branches/R_10_00@23639 c028cbd2-c16b-5b4b-a496-9718f37d4682
2017-02-20 14:41:21 +00:00
|
|
|
bool found = false;
|
2016-09-09 13:58:28 +00:00
|
|
|
|
Patch level : 12.0 348
Files correlati : cg7.exe cg7600a.png cg7600a.rep cg7700a.png cg7700a.rep
cg7700a.png cg7700b.rep cg7800a.png cg7800a.rep
cg7700b.rep cg7700b.png
Quadri Ve VF e VJ della dichiarazioone IVA
Aggiunti ai regimi speciali sulle causali
6 Acquisti di rottami e mat.di di recupero art. 74, commi 7 e 8
7 Acquisti di oro industriale e argento puro (art. 17, comma 5)
8 Acquisti di oro da investimento imp.per opzione (art. 17, comma 5)
9 Acquisti intrac. di CPU,PC, tablet,cellulari,console,microproc.
10 Importazioni rottami e altri mat.di recupero imposta non è versata
14 Acquisti di fabbricati (art. 17, comma 6, lett. a-bis)
15 Acquisti di telefoni cellulari (art. 17, comma 6, lett. b)
16 Acquisti di prodotti elettronici (art. 17, comma 6, lett. c)
17 Acquisti di servizi del comp.edile e sett.connessi art. 17,comma 6, lett. a-ter
18 Acquisti di beni e servizi del sett.energetico art. 17, c.6 d-bis,ter,d-quater
19 Acquisti delle P.A., titolari di partita IVA art. 17-ter
git-svn-id: svn://10.65.10.50/branches/R_10_00@23639 c028cbd2-c16b-5b4b-a496-9718f37d4682
2017-02-20 14:41:21 +00:00
|
|
|
for (int i = 0; i <= stop_tiporec; i++)
|
2016-09-09 13:58:28 +00:00
|
|
|
{
|
|
|
|
tiporec tocheck = (tiporec)i;
|
|
|
|
|
|
|
|
switch(tocheck)
|
|
|
|
{
|
|
|
|
case acq_norm:
|
|
|
|
//found = tipomov == 2 && tipoiva != "NS";
|
|
|
|
found = tipomov == 2;
|
|
|
|
found &= (tipodet == 0 /* || tipodet == 1 || tipodet == 3 ||
|
|
|
|
tipodet == 5 || tipodet == 9 */);
|
|
|
|
if (found)
|
|
|
|
{
|
|
|
|
if (tipost) //stampa
|
|
|
|
{
|
|
|
|
imp = pimr.get_real("R0") - pimr.get_real("R9");
|
|
|
|
iva = pimr.get_real("R1") - pimr.get_real("R10");
|
|
|
|
}
|
|
|
|
else //visualizza
|
|
|
|
{
|
|
|
|
imp = pimr.get_real("R0");
|
|
|
|
iva = pimr.get_real("R1");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case vend_norm:
|
|
|
|
//found = tipomov == 1 /* && corrisp == 1 */ && tipoiva != "NS";
|
|
|
|
found = tipomov == 1 /* && corrisp == 1 */;
|
|
|
|
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")
|
|
|
|
if (tipomov == 2 && tipodet != 9) // scarta le bolle doganali con tipo detr. == 9
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
*/
|
|
|
|
found = (tipomov == 2 && (tipocr == 1 || tipocr == 5));
|
|
|
|
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";
|
|
|
|
found = tipomov == 2 && tipocr == 2 && tipodet == 0;
|
|
|
|
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";
|
|
|
|
found = tipomov == 2 && tipocr ==2 && tipodet != 0;
|
|
|
|
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";
|
|
|
|
found = tipomov == 2 && tipocr == 8;
|
|
|
|
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";
|
|
|
|
found = tipomov == 2 && tipocr == 3;
|
|
|
|
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") - pimr.get_real("R9"); // toglie le bolle doganali (sono a parte)
|
|
|
|
iva = pimr.get_real("R1") - pimr.get_real("R10");
|
|
|
|
found &= (!imp.is_zero() || !iva.is_zero());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case cess_amm:
|
|
|
|
//found = tipomov == 1 && tipocr == 4 && tipoiva != "NS";
|
|
|
|
found = tipomov == 1 && tipocr == 4;
|
|
|
|
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;
|
|
|
|
case acq_bd_ind_art_19:
|
|
|
|
found = tipomov == 2 && tipodet == 9 && tipoiva != "NS";
|
|
|
|
if (found)
|
|
|
|
{
|
|
|
|
imp = pimr.get_real("R9");
|
|
|
|
iva = pimr.get_real("R10");
|
|
|
|
found &= (!imp.is_zero() || !iva.is_zero());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
Patch level : 12.0 348
Files correlati : cg7.exe cg7600a.png cg7600a.rep cg7700a.png cg7700a.rep
cg7700a.png cg7700b.rep cg7800a.png cg7800a.rep
cg7700b.rep cg7700b.png
Quadri Ve VF e VJ della dichiarazioone IVA
Aggiunti ai regimi speciali sulle causali
6 Acquisti di rottami e mat.di di recupero art. 74, commi 7 e 8
7 Acquisti di oro industriale e argento puro (art. 17, comma 5)
8 Acquisti di oro da investimento imp.per opzione (art. 17, comma 5)
9 Acquisti intrac. di CPU,PC, tablet,cellulari,console,microproc.
10 Importazioni rottami e altri mat.di recupero imposta non è versata
14 Acquisti di fabbricati (art. 17, comma 6, lett. a-bis)
15 Acquisti di telefoni cellulari (art. 17, comma 6, lett. b)
16 Acquisti di prodotti elettronici (art. 17, comma 6, lett. c)
17 Acquisti di servizi del comp.edile e sett.connessi art. 17,comma 6, lett. a-ter
18 Acquisti di beni e servizi del sett.energetico art. 17, c.6 d-bis,ter,d-quater
19 Acquisti delle P.A., titolari di partita IVA art. 17-ter
git-svn-id: svn://10.65.10.50/branches/R_10_00@23639 c028cbd2-c16b-5b4b-a496-9718f37d4682
2017-02-20 14:41:21 +00:00
|
|
|
if (found)
|
2016-09-09 13:58:28 +00:00
|
|
|
{
|
|
|
|
t = tocheck;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Patch level : 12.0 348
Files correlati : cg7.exe cg7600a.png cg7600a.rep cg7700a.png cg7700a.rep
cg7700a.png cg7700b.rep cg7800a.png cg7800a.rep
cg7700b.rep cg7700b.png
Quadri Ve VF e VJ della dichiarazioone IVA
Aggiunti ai regimi speciali sulle causali
6 Acquisti di rottami e mat.di di recupero art. 74, commi 7 e 8
7 Acquisti di oro industriale e argento puro (art. 17, comma 5)
8 Acquisti di oro da investimento imp.per opzione (art. 17, comma 5)
9 Acquisti intrac. di CPU,PC, tablet,cellulari,console,microproc.
10 Importazioni rottami e altri mat.di recupero imposta non è versata
14 Acquisti di fabbricati (art. 17, comma 6, lett. a-bis)
15 Acquisti di telefoni cellulari (art. 17, comma 6, lett. b)
16 Acquisti di prodotti elettronici (art. 17, comma 6, lett. c)
17 Acquisti di servizi del comp.edile e sett.connessi art. 17,comma 6, lett. a-ter
18 Acquisti di beni e servizi del sett.energetico art. 17, c.6 d-bis,ter,d-quater
19 Acquisti delle P.A., titolari di partita IVA art. 17-ter
git-svn-id: svn://10.65.10.50/branches/R_10_00@23639 c028cbd2-c16b-5b4b-a496-9718f37d4682
2017-02-20 14:41:21 +00:00
|
|
|
return found;
|
2016-09-09 13:58:28 +00:00
|
|
|
}
|