Patch level : nopatch

Files correlati     :
Commento        :

Fido
This commit is contained in:
Alessandro Bonazzi 2022-02-07 00:27:56 +01:00
parent 7346ddc573
commit 496ce96167

View File

@ -876,6 +876,7 @@ static real calcola_esposto_da_saldaconto (const char tipocf, const long codcf,c
// //data considerante i giorni di rischio ammessi dall'utonto
TDate data_sbf = to;
TImporto esposto; //importone somma degli importi delle righe del recordset
TAssoc_array parts;
//estrae le righe partita relative a pagamenti successivi alla data di rischio (e con tipopag >2,<7)
TString query;
@ -886,65 +887,36 @@ static real calcola_esposto_da_saldaconto (const char tipocf, const long codcf,c
TISAM_recordset partite(query);
data_sbf -= riskdays;
for (bool ok = partite.move_first(); ok; ok = partite.move_next())
{
const TDate datadoc = partite.get_date(PART_DATADOC);
const int anno = partite.get_int(PART_ANNO);
const TString& npart = partite.get_string(PART_NUMPART);
const long nreg = partite.get_long(PART_NREG);
for (bool ok = partite.move_first(); ok; ok = partite.move_next())
{
const TDate datareg = partite.get_date(PART_DATAREG);
if (datadoc>= from)
{
TBill bill(0, 0, codcf, 'C');
TPartita part(bill,anno, npart);
for (int r = part.last(); r > 0; r = part.pred(r)) {
const TRiga_partite& row = part.riga(r);
bool is_esposto;
TImporto imp = row.esposto(false, to, data_sbf, is_esposto);
if (between(datareg, from, to))
{
TBill bill(0, 0, codcf, 'C');
const int anno = partite.get_int(PART_ANNO);
const TString& npart = partite.get_string(PART_NUMPART);
TToken_string key;
if (is_esposto)
esposto += imp;
key.add(anno);
key.add(npart);
}
if (anno == 2021 && (atoi(npart) > 2000))
int i = 1;
if (!parts.is_key(key))
parts.add(key, new TPartita(bill, anno, npart));
}
}
/*
TImporto importo_riga;
bool is_esposto;
//fatture,note di credito,pagamenti
TImporto importo_partita = get_importo(partite, PART_SEZ, PART_IMPORTO);
FOR_EACH_ASSOC_OBJECT(parts, ho, key, o)
{
const TPartita & p = (const TPartita &)*o;
importo_riga += importo_partita;
const tipo_movimento tipo_mov = (tipo_movimento)partite.get_int(PART_TIPOMOV);
const tipo_pagamento tipo_pag = (tipo_pagamento)partite.get_int(PART_TIPOPAG);
TDate data = partite.get_date(PART_DATAPAG);
const long codcf = partite.get_long(PART_SOTTOCONTO);
if (!data.ok())
data = partite.get_date(PART_DATAREG);
//pagamenti (tm=3), insoluti (tm=5), pagamenti insoluti(tm=6)
if ((tipo_mov >= tm_pagamento) &&
(tipo_pag >= tp_tratta && tipo_pag <= tp_rid) &&
((data >= data_sbf) && (data <= to)))
{
TImporto importo_abbuono = get_importo(partite, PART_SEZABB, PART_ABBUONI);
importo_riga += importo_abbuono;
if (!partite.get(PART_CODVAL).is_empty()) // pagamenti in valuta
{
TImporto importo_diff_cambio = get_importo(partite, PART_SEZDIFCAM, PART_DIFFCAM);
importo_riga += importo_diff_cambio;
}
//somma importi presenti sulla riga partita (fatture, pagamenti, insoluti, pagamenti insoluti)
esposto += importo_riga;
}
*/
}
if (p.anno() == 2021 && atoi(p.numero()) > 2000)
int i = 1;
esposto += p.esposto(false, to, data_sbf, is_esposto);
}
//la normalizzazione del totale delle partite va fatta in base al fatto che si parli di 'C'liente o 'F'ornitore
const char sezione_finale = (tipocf == 'C') ? 'A' : 'D';