Patch level :4.0 nopatch x ora
Files correlati :cg7.exe Ricompilazione Demo : [ ] Commento :tentativo di correggere errori enrichettici git-svn-id: svn://10.65.10.50/trunk@14706 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d4fc7c73aa
commit
75ab480d62
117
cg/cg7200.cpp
117
cg/cg7200.cpp
@ -273,7 +273,7 @@ protected:
|
||||
bool i_proforma_clifor(char tipocf = 'C');
|
||||
bool i_proforma_conti();
|
||||
|
||||
real totale_documento(const TRectype& mov) const;
|
||||
real totale_documento(TMovimentoPN& pn) const;
|
||||
void lettura_conti(TAssoc_array& assoc, const char tipoconto);
|
||||
bool cerca_conto(const TBill& bill, const TAssoc_array& assoc, const char tipoconto) const;
|
||||
bool cerca_fiscali(const TBill& bill) const;
|
||||
@ -822,25 +822,54 @@ void TInvioP::stringa_grcosot(TRecord_text& recrighe, const TString& zio)
|
||||
|
||||
// Calcola il totale del documento tenendo conto del segno della prima riga e di quella delle
|
||||
// ritenute sociali sulla causale
|
||||
real TInvioP::totale_documento(const TRectype& mov) const
|
||||
real TInvioP::totale_documento(TMovimentoPN& pn) const
|
||||
{
|
||||
real tot = mov.get_real(MOV_TOTDOC); // Legge totale
|
||||
const real ritfis = mov.get_real(MOV_RITFIS);
|
||||
tot += ritfis; // Somma ritenute fiscali
|
||||
|
||||
const real ritsoc = mov.get_real(MOV_RITSOC);
|
||||
//testata del movimento di prima nota
|
||||
const TRectype& mov = pn.curr();
|
||||
|
||||
if (!ritsoc.is_zero())
|
||||
real tot = mov.get_real(MOV_TOTDOC); // Legge totale
|
||||
//i conti sulle ritenute li deve fare solo se il movimento e' iva!!
|
||||
if (pn.iva_items() > 0)
|
||||
{
|
||||
const real ritfis = mov.get_real(MOV_RITFIS);
|
||||
tot += ritfis; // Somma ritenute fiscali
|
||||
|
||||
const real ritsoc = mov.get_real(MOV_RITSOC);
|
||||
|
||||
if (!ritsoc.is_zero())
|
||||
{
|
||||
TCausale caus(mov.get(MOV_CODCAUS));
|
||||
const bool swapt = test_swap(caus, false); // Totale invertito ?
|
||||
const bool swaps = test_swap(caus, true); // Ritenute sociali invertite ?
|
||||
if (swapt ^ swaps) // Somma ritenute sociali con segno
|
||||
tot -= ritsoc;
|
||||
else
|
||||
tot += ritsoc;
|
||||
}
|
||||
}
|
||||
else //movimenti non iva; calcolo delle ritenute
|
||||
{
|
||||
TCausale caus(mov.get(MOV_CODCAUS));
|
||||
const bool swapt = test_swap(caus, false); // Totale invertito ?
|
||||
const bool swaps = test_swap(caus, true); // Ritenute sociali invertite ?
|
||||
if (swapt ^ swaps) // Somma ritenute sociali con segno
|
||||
tot -= ritsoc;
|
||||
else
|
||||
tot += ritsoc;
|
||||
const char sez = caus.sezione_clifo();
|
||||
bool tot_is_zero = tot.is_zero();
|
||||
TImporto totdoc(sez, tot);
|
||||
for (int i = 0; i < pn.cg_items(); i++)
|
||||
{
|
||||
const TRectype& rmov = pn.cg(i);
|
||||
const TBill conto(rmov);
|
||||
const TImporto importo(rmov.get_char(RMV_SEZIONE), rmov.get_real(RMV_IMPORTO));
|
||||
if (cerca_fiscali(conto) || cerca_sociali(conto))
|
||||
{
|
||||
totdoc += importo; //valore da stampare nella colonna Tot.fattura con ritenute
|
||||
}
|
||||
else //non si puo' avere un conto C/F tra quelli fiscali e sociali!
|
||||
{
|
||||
if (tot_is_zero && rmov.get_char(RMV_TIPOC) > ' ')
|
||||
totdoc += importo;
|
||||
}
|
||||
}
|
||||
tot = totdoc.valore();
|
||||
}
|
||||
|
||||
return tot;
|
||||
}
|
||||
|
||||
@ -891,11 +920,17 @@ int TInvioP::cerca_pagamento(const TBill& bill) const
|
||||
|
||||
bool TInvioP::cerca_fiscali(const TBill& bill) const
|
||||
{
|
||||
if (bill.tipo() > ' ') //non si vogliono i conti tipo Cliente Fornitore
|
||||
return false;
|
||||
|
||||
return cerca_conto(bill, _fiscali, 'F');
|
||||
}
|
||||
|
||||
bool TInvioP::cerca_sociali(const TBill& bill) const
|
||||
{
|
||||
if (bill.tipo() > ' ') //non si vogliono i conti tipo Cliente Fornitore
|
||||
return false;
|
||||
|
||||
return cerca_conto(bill, _sociali, 'S');
|
||||
}
|
||||
|
||||
@ -962,40 +997,28 @@ bool TInvioP::calcola_imponibile_totdoc(const long nreg, const TRectype& pag_rec
|
||||
imposta += iva;
|
||||
}
|
||||
}
|
||||
totdoc = totale_documento(pn.curr()); //tot doc con ritenute fiscali + ritenute sociali (da stampare)
|
||||
} //if pn.iva_items()..
|
||||
else //movimento NON iva
|
||||
{
|
||||
for (int i = 0; i < pn.cg_items(); i++)
|
||||
{
|
||||
const TRectype& rmov = pn.cg(i);
|
||||
const TBill conto(rmov);
|
||||
totdoc = totale_documento(pn); //tot doc con ritenute fiscali + ritenute sociali
|
||||
|
||||
TImporto importo(rmov.get_char(RMV_SEZIONE), rmov.get_real(RMV_IMPORTO));
|
||||
importo.normalize('D');
|
||||
} //if pn.iva_items()..
|
||||
else //NON iva
|
||||
{
|
||||
totdoc = totale_documento(pn); //tot doc con ritenute fiscali + ritenute sociali
|
||||
imponibile = totdoc; //nel caso di non iva
|
||||
|
||||
if (conto.tipo() > ' ') //e' un conto cliente/fornitore...
|
||||
totdoc -= importo.valore();
|
||||
else //..e' un conto normale
|
||||
{
|
||||
if (cerca_fiscali(conto) || cerca_sociali(conto))
|
||||
totdoc -= importo.valore(); //valore da stampare nella colonna Tot.fattura con ritenute
|
||||
else
|
||||
{
|
||||
if (rmov.get_char(RMV_ROWTYPE) != 'T' && conto.indicatore_bilancio() != 5)
|
||||
{
|
||||
imponibile += importo.valore();
|
||||
totdoc += importo.valore();
|
||||
}
|
||||
}
|
||||
} //else di if (conto.tipo()
|
||||
} //for (int i = 0...
|
||||
//tanti calcoli per nulla?
|
||||
const real totdoc_testata = totale_documento(pn.curr());
|
||||
if (totdoc_testata != ZERO)
|
||||
totdoc = totdoc_testata;
|
||||
|
||||
} //end di else pn.iva_items()...
|
||||
TCausale caus(pn.curr().get(MOV_CODCAUS));
|
||||
TImporto totpag(caus.sezione_clifo(), totpagato);
|
||||
for (int i = 0; i < pn.cg_items(); i++)
|
||||
{
|
||||
const TRectype& rmov = pn.cg(i);
|
||||
const TBill conto(rmov);
|
||||
if (cerca_fiscali(conto) || cerca_sociali(conto))
|
||||
{
|
||||
const TImporto importo(rmov.get_char(RMV_SEZIONE), rmov.get_real(RMV_IMPORTO));
|
||||
totpag += importo; //valore da stampare nella colonna Tot.fattura con ritenute
|
||||
}
|
||||
}
|
||||
totpagato = totpag.valore();
|
||||
}
|
||||
} //if (pn.read() == NOERR
|
||||
return ok;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user