Patch level : 10.0 254
Files correlati : 770.exe Ricompilazione Demo : [ ] Commento : Modificato l'aggiornamento pagamenti per non aggiornare i pagamenti già aggiornati git-svn-id: svn://10.65.10.50/trunk@18462 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9bb6dd2588
commit
6d5b515801
@ -361,25 +361,6 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
|
||||
const real h_PercCommitInps = cau.get_real("R3");
|
||||
|
||||
|
||||
const int rows = sc.pag_items();
|
||||
int rowpag = -1;
|
||||
|
||||
for (int i = 0; rowpag < 0 && i < rows; i++)
|
||||
{
|
||||
const TRectype & pagrec = sc.pag(i);
|
||||
if (numreg == pagrec.get_long(PAG_NUMREG))
|
||||
rowpag = i;
|
||||
}
|
||||
if (rowpag >= 0)
|
||||
{
|
||||
TRectype & pagrec = sc.pag(rowpag);
|
||||
|
||||
pagrec.zero(PAG_COMPENSO);
|
||||
pagrec.zero(PAG_SPESA);
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (TPartita * p = partarr.first(); p != NULL; p =partarr.next())
|
||||
{
|
||||
const int row = p->prima_fattura(numreg);
|
||||
@ -393,8 +374,11 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
|
||||
for (int r = 1; r <= nrate; r++)
|
||||
{
|
||||
TRiga_scadenze & ratapart = rigapart.rata(r);
|
||||
TImporto tot;
|
||||
long numregp = 0L;
|
||||
TImporto tot[10];
|
||||
long numregp[10] = {0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
|
||||
int lastsch = 0;
|
||||
|
||||
const int rows = sc.pag_items();
|
||||
|
||||
for (int rowp = ratapart.last(); rowp > 0; rowp = ratapart.pred(rowp))
|
||||
{
|
||||
@ -402,16 +386,38 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
|
||||
const TRiga_partite& sum = p->riga(rowp); // Riga partite
|
||||
const char sez = sum.sezione();
|
||||
TImporto imppag(sez, pag.get_real(PAGSCA_IMPORTO));
|
||||
const long num = sum.get_long(PART_NREG);
|
||||
if(lastsch == 0 && numregp[0] == 0L)
|
||||
{
|
||||
numregp[lastsch] = num;
|
||||
tot[lastsch].reset();
|
||||
}
|
||||
if(num != numregp[lastsch])
|
||||
{
|
||||
numregp[++lastsch] = num;
|
||||
tot[lastsch].reset();
|
||||
}
|
||||
if (lastsch > 9)
|
||||
{
|
||||
message_box("Attenzione! Troppi pagamenti diversi per la registrazione %ld.", numreg);
|
||||
break;
|
||||
}
|
||||
|
||||
if (numregp == 0L)
|
||||
numregp = sum.get_long(PART_NREG);
|
||||
bool found = false;
|
||||
for (int i = 0; !found &&i < rows; i++)
|
||||
{
|
||||
const TRectype & pagrec = sc.pag(i);
|
||||
found = num == pagrec.get_long(PAG_NUMREG);
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
imppag += TImporto(sez, pag.get_real(PAGSCA_RITENUTE));
|
||||
imppag += TImporto(sum.sezione_ritsoc(), pag.get_real(PAGSCA_RITSOC));
|
||||
real abbuoni = pag.get_real(PAGSCA_ABBUONI);
|
||||
real abb = pag.get_real(PAGSCA_ABBUONI);
|
||||
if (!abb.is_zero())
|
||||
imppag += TImporto(sez, abb);
|
||||
tot += imppag;
|
||||
tot[lastsch] += imppag;
|
||||
if (!datapag.ok())
|
||||
datapag = sum.get_date(PART_DATADOC);
|
||||
if (!datapag.ok())
|
||||
@ -419,26 +425,23 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
|
||||
if (!datapag.ok())
|
||||
datapag = sum.get_date(PART_DATAPAG);
|
||||
}
|
||||
|
||||
tot.normalize('D');
|
||||
if (rowpag < 0)
|
||||
}
|
||||
for (int j = 0; j < 10 && numregp[j] > 0L; j++)
|
||||
{
|
||||
if (tot.valore() == ZERO)
|
||||
tot[j].normalize('D');
|
||||
if (tot[j].valore() == ZERO)
|
||||
break;
|
||||
rowpag = rows;
|
||||
|
||||
TRectype & pagrec = sc.pag(rowpag);
|
||||
TRectype & pagrec = sc.pag(rows);
|
||||
|
||||
pagrec.put(PAG_CODDITTA, sc.lfile().get(SCH_CODDITTA));
|
||||
pagrec.put(PAG_TIPOA, sc.lfile().get(SCH_TIPOA));
|
||||
pagrec.put(PAG_CODANAGR, sc.lfile().get(SCH_CODANAGR));
|
||||
pagrec.put(PAG_NPROG, sc.lfile().get(SCH_NPROG));
|
||||
pagrec.put(PAG_NRIGA, rowpag + 1);
|
||||
pagrec.put(PAG_NRIGA, rows + 1);
|
||||
pagrec.put(PAG_NUMVERS, -1);
|
||||
}
|
||||
TRectype & pagrec = sc.pag(rowpag);
|
||||
real spesepag = tot.valore() * spperc;
|
||||
real ivapag = tot.valore() * ivaperc;
|
||||
real spesepag = tot[j].valore() * spperc;
|
||||
real ivapag = tot[j].valore() * ivaperc;
|
||||
|
||||
spesepag.round(TCurrency::get_firm_dec());
|
||||
if (abs(spesepag) > abs(spese))
|
||||
@ -447,7 +450,7 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
|
||||
if (abs(ivapag) > abs(iva))
|
||||
ivapag = iva;
|
||||
|
||||
real compensopag = tot.valore() - spesepag - ivapag;
|
||||
real compensopag = tot[j].valore() - spesepag - ivapag;
|
||||
|
||||
compensopag += compensopag * h_PercRitenuta;
|
||||
compensopag.round(TCurrency::get_firm_dec());
|
||||
@ -458,14 +461,17 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
|
||||
pagrec.put(PAG_COMPENSO, compensopag);
|
||||
pagrec.put(PAG_SPESA, spesepag);
|
||||
pagrec.put(PAG_DATAPAG, datapag);
|
||||
sc.lfile().put(SCH_ANNOC, datapag.year());
|
||||
sc.lfile().put(SCH_MESEC, datapag.month());
|
||||
pagrec.put(PAG_PERC, h_PercRitenuta); // percentuale ritenuta acconto
|
||||
pagrec.put(PAG_ALQIMP10, h_PercAssImpInps);// percentuale 10% INPS
|
||||
pagrec.put(PAG_NUMREG, numregp);
|
||||
pagrec.put(PAG_NUMREG, numregp[j]);
|
||||
pagrec.put(PAG_COD10, "C");
|
||||
calcola_riga_pag(pagrec, h_PercAssImp, h_PercCassaPrev, h_PercRitenuta, h_PercInps, h_PercAssImpInps, h_PercCommitInps);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sc.rewrite();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user