Patch level : 12.0 384
Files correlati : tf Commento : Raggiunta conoscenza globale tabella PRM: - Ottimizzato controllo registro (prendo campi I1) - Trovato come capire se un valore è detraibile o meno dalla chiave - Sistemato calcolo ivaes e ivadet - Rimpiazzate funzioni stoi con atoi git-svn-id: svn://10.65.10.50/branches/R_10_00@23776 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
aed296f652
commit
28f385b562
@ -161,12 +161,6 @@ int calc_inc_diff(int anno, int mese, int tipoiva, real& imponibile_diff, real&
|
||||
return flag;
|
||||
}
|
||||
|
||||
int getTipoReg(int anno, TString codReg)
|
||||
{
|
||||
TString key; key << anno << codReg;
|
||||
return stoi(cache().get("REG", key, "I0"));
|
||||
}
|
||||
|
||||
class ComLiqPerIva_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
@ -410,18 +404,20 @@ void ComLiqPerIva_mask::extractinator() // Per gli amici GTFO
|
||||
TRectype to(rprm.curr()); to.put("COD" , "PRM");to.put("CODTAB", anno);
|
||||
|
||||
TCursor curPrm(&rprm, "", 1, &from, &to);
|
||||
|
||||
for(curPrm = 0; curPrm.pos() < curPrm.items(); ++curPrm)
|
||||
{
|
||||
TRectype rowPrm = curPrm.curr();
|
||||
// Controllo il mese
|
||||
TString codtab = rowPrm.get("CODTAB");
|
||||
int app = stoi(rowPrm.get("CODTAB").sub(13,15)); // Da togliere
|
||||
if(stoi(rowPrm.get("CODTAB").sub(13,15)) != start) continue;
|
||||
if(atoi(rowPrm.get("CODTAB").sub(13,15)) != start) continue;
|
||||
|
||||
|
||||
// Verifico su che registro mi trovo
|
||||
int tiporeg = getTipoReg(anno, rowPrm.get("CODTAB").sub(10,13));
|
||||
if(tiporeg == reg_att)
|
||||
int tiporeg = rowPrm.get_int("I1");
|
||||
bool detraibile = atoi(rowPrm.get("CODTAB").mid(20,1)) == 0; // Se > è indetraibile
|
||||
if(!detraibile) continue; // Non mi interessa
|
||||
|
||||
if(tiporeg == reg_att)
|
||||
{
|
||||
totopatt = totopatt + rowPrm.get_real("R0");
|
||||
}
|
||||
@ -440,7 +436,7 @@ void ComLiqPerIva_mask::extractinator() // Per gli amici GTFO
|
||||
calc_inc_diff(anno, start, reg_att, imponibile_diff, imposta_diff, imponibile_xcas, imposta_xcas);
|
||||
totopattxc = totopattxc + imponibile_xcas;
|
||||
ivaesxc = ivaesxc + imposta_xcas;
|
||||
ivaesdiff = ivaesdiff + imposta_xcas;
|
||||
ivaesdiff = ivaesdiff + imposta_diff;
|
||||
|
||||
// IVA detraibile
|
||||
imponibile_diff = imposta_diff = imponibile_xcas = imposta_xcas = ZERO;
|
||||
@ -448,14 +444,14 @@ void ComLiqPerIva_mask::extractinator() // Per gli amici GTFO
|
||||
calc_inc_diff(anno, start, reg_pas, imponibile_diff, imposta_diff, imponibile_xcas, imposta_xcas);
|
||||
totoppasxc = totoppasxc + imponibile_xcas;
|
||||
ivadetxc = ivadetxc + imposta_xcas;
|
||||
ivadetdiff = ivadetdiff + imposta_xcas;
|
||||
ivadetdiff = ivadetdiff + imposta_diff;
|
||||
}
|
||||
|
||||
/** Resto *****************************************************************************************************/
|
||||
|
||||
TRectype rowLam = getLAM(anno, start);
|
||||
ivaes = ivaes + rowLam.get_real("R0");
|
||||
ivadet = ivadet + rowLam.get_real("R1");
|
||||
ivaes = ivaes + rowLam.get_real("R0") + ivaesxc + ivaesdiff;
|
||||
ivadet = ivadet + rowLam.get_real("R1") + ivadetxc + ivadetdiff;
|
||||
|
||||
rettifiche = rettifiche + rowLim.get_real("R5");
|
||||
varimp = varimp + rowLim.get_real("R17");
|
||||
@ -498,15 +494,19 @@ void ComLiqPerIva_mask::extractinator() // Per gli amici GTFO
|
||||
/* Per calcolare il credito dell'anno precedente inizio a leggere i record precedenti su IVALIQ
|
||||
* fino a quando ne trovo uno >= 0.
|
||||
* Questi geni hanno messo la possibilità di mettere un valore <0 se voglio utilizzare del credito precedente */
|
||||
if(start > 1 && (mensile || (!mensile && ((start - 1) % 3) == 0)))
|
||||
if(mensile || (!mensile && ((start - 1) % 3) == 0))
|
||||
{
|
||||
TRelation ivaLiq(LF_IVALIQ);
|
||||
TRectype filter(ivaLiq.curr()); filter.put("ANNO", anno);
|
||||
TSorted_cursor curLiq(&ivaLiq, "MESE-", "GENERATA!=\"G\"", 1, &filter, &filter);
|
||||
TRectype from(ivaLiq.curr()); from.put("ANNO", anno); from.put("MESE", 1);
|
||||
// Fino al mese precedente
|
||||
TRectype to(ivaLiq.curr()); to.put("ANNO", anno); to.put("MESE", start - 1);
|
||||
|
||||
TSorted_cursor curLiq(&ivaLiq, "MESE-", "GENERATA!=\"G\"", 1, &from, &to);
|
||||
bool trovato = false;
|
||||
for(curLiq = 0; curLiq.pos() < curLiq.items() && !trovato; ++curLiq)
|
||||
{
|
||||
TRectype rowLiq = curLiq.curr();
|
||||
if(rowLiq.get_int("MESE") >= start) continue; // Perchè li prende lo stesso?
|
||||
creaprec = creaprec + rowLiq.get_real("CREAPREC") - rowLiq.get_real("IVADOV");
|
||||
|
||||
// Se è > 0 Ho trovato il primo valore messo nella dichiarazione
|
||||
|
Loading…
x
Reference in New Issue
Block a user