Patch level : 10.0 1050
Files correlati : fe0.exe fe0100a.msk Ricompilazione Demo : [ ] Commento : Corretto calcolo totale contratto git-svn-id: svn://10.65.10.50/branches/R_10_00@22377 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
cc8cff00df
commit
53ee9f53f2
@ -87,23 +87,26 @@ bool importo_contratto(const TRectype& c, int anno, real& importo, real& imposta
|
||||
if (c.empty() || anno < 2010)
|
||||
return false;
|
||||
|
||||
const int primo_anno = c.get_int("I0");
|
||||
int offset = (anno - primo_anno)*2;
|
||||
if (offset < 0) offset = 0;
|
||||
if (offset > 6) offset = 6;
|
||||
|
||||
for (int r = offset; r >= 0; r-=2)
|
||||
// Determina l'indice i [0..3] degli importi del contratto per l'anno richiesto
|
||||
char fld[] = "I3";
|
||||
int i = 3;
|
||||
for (i = 3; i > 0; i--)
|
||||
{
|
||||
char erre[3] = { 'R', r+'0', '\0' };
|
||||
importo = c.get_real(erre);
|
||||
if (importo > ZERO)
|
||||
{
|
||||
erre[1]++;
|
||||
imposta = c.get_real(erre);
|
||||
return true;
|
||||
}
|
||||
fld[1] = '0'+i;
|
||||
const int y = c.get_int(fld);
|
||||
if (y > 0 && y <= anno)
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Determina il nome del campo importo corrispondente all'indice i: 0 -> R0; 1 -> R2; 2 -> R4; 3 -> R6
|
||||
fld[0] = 'R';
|
||||
fld[1] = '0'+(i*2);
|
||||
importo = c.get_real(fld);
|
||||
|
||||
fld[1]++; // Il campo imposta è sempre quello successivo a quello dell'importo
|
||||
imposta = c.get_real(fld);
|
||||
|
||||
return importo > ZERO;
|
||||
}
|
||||
|
||||
bool importo_figli_contratto(const TRectype& c, int anno, real& importo, real& imposta)
|
||||
@ -684,7 +687,7 @@ bool TDati_rilevanti_msk::convalida_mov(const TRectype& mov, TLog_report& log) c
|
||||
|
||||
|
||||
bool TDati_rilevanti_msk::salva_allegato(const TRectype& mov, TFast_isamfile& falleg, TRecnotype& progr,
|
||||
const real& corrispettivo, const real& imposta, int natope, int tipope,
|
||||
const real& importo, const real& imposta, int natope, int tipope,
|
||||
TLog_report& log)
|
||||
{
|
||||
bool update_contract = false;
|
||||
@ -738,7 +741,7 @@ bool TDati_rilevanti_msk::salva_allegato(const TRectype& mov, TFast_isamfile& fa
|
||||
if (update_contract)
|
||||
{
|
||||
// Mi limito ad incrementare gli importi
|
||||
alleg.add(ALL_IMPORTO, corrispettivo);
|
||||
alleg.add(ALL_IMPORTO, importo);
|
||||
alleg.add(ALL_IMPOSTA, imposta);
|
||||
err = falleg.rewrite();
|
||||
}
|
||||
@ -752,7 +755,7 @@ bool TDati_rilevanti_msk::salva_allegato(const TRectype& mov, TFast_isamfile& fa
|
||||
alleg.put(ALL_OCFPI, mov.get(MOV_OCFPI));
|
||||
alleg.put(ALL_NATOPE, natope);
|
||||
alleg.put(ALL_TIPOPE, tipope);
|
||||
alleg.put(ALL_IMPORTO, corrispettivo);
|
||||
alleg.put(ALL_IMPORTO, importo);
|
||||
alleg.put(ALL_IMPOSTA, imposta);
|
||||
|
||||
if (contratto.full())
|
||||
@ -1045,6 +1048,32 @@ bool TDati_rilevanti_msk::send_fatt(const TISAM_recordset& alleg, TDati_rilevant
|
||||
{
|
||||
const TAnagrafica anag(alleg.cursor()->curr());
|
||||
|
||||
const real importo = alleg.get(ALL_IMPORTO).as_real();
|
||||
const real imposta = alleg.get(ALL_IMPOSTA).as_real();
|
||||
const real importo_tot = alleg.get(ALL_IMPORTOTOT).as_real();
|
||||
const real imposta_tot = alleg.get(ALL_IMPOSTATOT).as_real();
|
||||
const TString& paiv = anag.partita_IVA();
|
||||
|
||||
if (!_send_all)
|
||||
{
|
||||
bool send = false;
|
||||
const int anno = alleg.get(ALL_ANNO).as_int();
|
||||
if (!anag.stato_estero() && paiv.blank())
|
||||
{
|
||||
// Se l'importo dello scontrino o l'importo del contratto superano la soglia ...
|
||||
const real limit = 3600;
|
||||
send = anno > 2010 && ((importo+imposta) >= limit || (importo_tot+imposta_tot) >= limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Se l'importo della fattura o l'importo del contratto superano la soglia ...
|
||||
const real limit = anno == 2010 ? 25000 : 3000;
|
||||
send = importo >= limit || importo_tot >= limit;
|
||||
}
|
||||
if (!send)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (anag.stato_estero() > 0)
|
||||
{
|
||||
operaz.new_rec("3"); // Operazioni con soggetti non residenti
|
||||
@ -1066,30 +1095,25 @@ bool TDati_rilevanti_msk::send_fatt(const TISAM_recordset& alleg, TDati_rilevant
|
||||
}
|
||||
operaz.set(12, alleg.get(ALL_DATAREG).as_date());
|
||||
operaz.set(13, alleg.get(ALL_MODPAG).as_int());
|
||||
operaz.set(14, alleg.get(ALL_IMPORTO).as_real());
|
||||
operaz.set(15, alleg.get(ALL_IMPOSTA).as_real());
|
||||
operaz.set(14, importo);
|
||||
operaz.set(15, imposta);
|
||||
operaz.set(16, alleg.get(ALL_NATOPE).as_int());
|
||||
operaz.set(17, alleg.get(ALL_TIPOPE).as_int());
|
||||
operaz.set(18, alleg.get(ALL_IMPORTOTOT).as_real());
|
||||
operaz.set(19, alleg.get(ALL_IMPOSTATOT).as_real());
|
||||
operaz.set(18, importo_tot);
|
||||
operaz.set(19, imposta_tot);
|
||||
}
|
||||
else
|
||||
{
|
||||
const TString& paiv = anag.partita_IVA();
|
||||
if (paiv.blank())
|
||||
{
|
||||
operaz.new_rec("1"); // Operazioni con soggetti residenti non titolari di partita IVA
|
||||
operaz.set(2, anag.codice_fiscale());
|
||||
operaz.set(3, alleg.get(ALL_DATAREG).as_date());
|
||||
operaz.set(4, alleg.get(ALL_MODPAG).as_int());
|
||||
real importo = alleg.get(ALL_IMPORTO).as_real();
|
||||
importo += alleg.get(ALL_IMPOSTA).as_real();
|
||||
operaz.set(5, importo);
|
||||
operaz.set(5, real(importo+imposta));
|
||||
operaz.set(6, alleg.get(ALL_NATOPE).as_int());
|
||||
operaz.set(7, alleg.get(ALL_TIPOPE).as_int());
|
||||
importo = alleg.get(ALL_IMPORTOTOT).as_real();
|
||||
importo += alleg.get(ALL_IMPOSTATOT).as_real();
|
||||
operaz.set(8, importo);
|
||||
operaz.set(8, real(importo_tot+imposta_tot));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1101,8 +1125,8 @@ bool TDati_rilevanti_msk::send_fatt(const TISAM_recordset& alleg, TDati_rilevant
|
||||
operaz.set(6, alleg.get(ALL_IMPOSTA).as_real());
|
||||
operaz.set(7, alleg.get(ALL_NATOPE).as_int());
|
||||
operaz.set(8, alleg.get(ALL_TIPOPE).as_int());
|
||||
operaz.set(9, alleg.get(ALL_IMPORTOTOT).as_real());
|
||||
operaz.set(10,alleg.get(ALL_IMPOSTATOT).as_real());
|
||||
operaz.set(9, importo_tot);
|
||||
operaz.set(10,imposta_tot);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -1122,10 +1146,12 @@ bool TDati_rilevanti_msk::send_rec(const TISAM_recordset& alleg, TDati_rilevanti
|
||||
bool TDati_rilevanti_msk::send_alleg()
|
||||
{
|
||||
const int anno = get_int(F_ANNO);
|
||||
_send_all = get_bool(F_SENDALL);
|
||||
|
||||
TFilename temp; temp.tempdir();
|
||||
temp.add("datiril.txt");
|
||||
|
||||
TDati_rilevanti_set recset(get_int(F_ANNO));
|
||||
TDati_rilevanti_set recset(anno);
|
||||
recset.add_control_rec(0);
|
||||
|
||||
TString query;
|
||||
|
@ -148,7 +148,7 @@ BEGIN
|
||||
PROMPT 0 10 ""
|
||||
ITEM "Riga@6F"
|
||||
ITEM "Non\nInv.@2@F"
|
||||
ITEM "C/F@3F"
|
||||
ITEM "C/F@2F"
|
||||
ITEM "Codice@F"
|
||||
ITEM "Occasionale@16F"
|
||||
ITEM "Ragione Sociale@24"
|
||||
@ -160,8 +160,8 @@ BEGIN
|
||||
ITEM "Nat.\nOper.@4"
|
||||
ITEM "Tipo.\nOper.@4"
|
||||
ITEM "Contratto@18"
|
||||
ITEM "Importo Totale\nOperazione@12"
|
||||
ITEM "Imposte Totali\nOperazione@12"
|
||||
ITEM "Importo Tot.\nOperazione@12"
|
||||
ITEM "Imposta Tot.\nOperazione@12"
|
||||
ITEM "N. Reg.\nrettif.@7"
|
||||
ITEM "Partita IVA@15"
|
||||
ITEM "Codice Fiscale@17"
|
||||
|
Loading…
x
Reference in New Issue
Block a user