Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Pharmatex - PD6292 previsione incassi e pagamenti Calcolo pagamenti e note di credito non assegnate git-svn-id: svn://10.65.10.50/trunk@20564 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
549c365808
commit
60cc31fd8c
116
ps/pd6292100.cpp
116
ps/pd6292100.cpp
@ -101,6 +101,7 @@ class TProspettoScadenze : public TPrintapp
|
|||||||
int _gcr, // Giorni per Calcolo Rischio (valido solo per stampa clienti)
|
int _gcr, // Giorni per Calcolo Rischio (valido solo per stampa clienti)
|
||||||
_sfasce,
|
_sfasce,
|
||||||
_nsfasce;
|
_nsfasce;
|
||||||
|
TDate _unsdscd;
|
||||||
real _unsnc,_uns, _unsesp; // Unassigned per partita.
|
real _unsnc,_uns, _unsesp; // Unassigned per partita.
|
||||||
TArray _conti_cf, // array per conti mastro
|
TArray _conti_cf, // array per conti mastro
|
||||||
_t, // Array per i totali
|
_t, // Array per i totali
|
||||||
@ -136,6 +137,7 @@ public:
|
|||||||
|
|
||||||
int calc_last_column();
|
int calc_last_column();
|
||||||
void update_totals(bool what, real& esp, real s[NUMERO_FASCE], real ns[NUMERO_FASCE]);
|
void update_totals(bool what, real& esp, real s[NUMERO_FASCE], real ns[NUMERO_FASCE]);
|
||||||
|
void compute_antic(TPartita& p, const TDate & datalim);
|
||||||
void compute_unassigned(TPartita& p, const TDate & datalim);
|
void compute_unassigned(TPartita& p, const TDate & datalim);
|
||||||
void compute_all(TPartita& p, TBill& bill);
|
void compute_all(TPartita& p, TBill& bill);
|
||||||
void print_real(TString& dest, const real& num);
|
void print_real(TString& dest, const real& num);
|
||||||
@ -191,11 +193,64 @@ void TProspettoScadenze::update_totals(bool what, real& esp,
|
|||||||
ll->_es += esp;
|
ll->_es += esp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TProspettoScadenze::compute_antic(TPartita& p, const TDate & datalim)
|
||||||
|
{
|
||||||
|
real s[NUMERO_FASCE];
|
||||||
|
real ns[NUMERO_FASCE];
|
||||||
|
|
||||||
|
for (int r = p.last(); r > 0; r = p.pred(r)) // Browse all rows (partite)
|
||||||
|
{
|
||||||
|
const TRiga_partite& rp = p.riga(r);
|
||||||
|
const char * field = (_stvaluta && rp.in_valuta() ? PART_IMPORTOVAL : PART_IMPORTO);
|
||||||
|
const TDate & d = rp.get_date(PART_DATAPAG);
|
||||||
|
|
||||||
|
if (d > _limscad)
|
||||||
|
{
|
||||||
|
if (_nsinfasce)
|
||||||
|
{
|
||||||
|
for (int i = _nsfasce - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
const TDate & limdate = (TDate&)_ns_date[i];
|
||||||
|
if (limdate.ok() && d > limdate)
|
||||||
|
{
|
||||||
|
ns[i] -= rp.get_real(field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ns[0] += rp.get_real(field);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_sinfasce)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int i = _sfasce - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
const TDate & limdate = (TDate&)_s_date[i];
|
||||||
|
if (limdate.ok() && d <= limdate)
|
||||||
|
{
|
||||||
|
s[i] += rp.get_real(field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
s[0] += rp.get_real(field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
real esposto;
|
||||||
|
update_totals(0, esposto, s, ns); // Singolo...
|
||||||
|
update_totals(1, esposto, s, ns); // ...Generale
|
||||||
|
}
|
||||||
|
|
||||||
void TProspettoScadenze::compute_unassigned(TPartita& p, const TDate & datalim)
|
void TProspettoScadenze::compute_unassigned(TPartita& p, const TDate & datalim)
|
||||||
{
|
{
|
||||||
TRecord_array& ra = p.unassigned();
|
TRecord_array& ra = p.unassigned();
|
||||||
|
|
||||||
_uns = _unsnc = _unsesp = ZERO;
|
_uns = _unsnc = _unsesp = ZERO;
|
||||||
|
_unsdscd = datalim;
|
||||||
for (int r = ra.last_row(); r > 0; r = ra.pred_row(r))
|
for (int r = ra.last_row(); r > 0; r = ra.pred_row(r))
|
||||||
{
|
{
|
||||||
const TRectype& rec = ra.row(r);
|
const TRectype& rec = ra.row(r);
|
||||||
@ -205,6 +260,7 @@ void TProspettoScadenze::compute_unassigned(TPartita& p, const TDate & datalim)
|
|||||||
|
|
||||||
if ((datascad <= datalim))
|
if ((datascad <= datalim))
|
||||||
{
|
{
|
||||||
|
_unsdscd = datascad;
|
||||||
if (sum.get_int(PART_TIPOMOV) == 2) // Is it a credit note ?
|
if (sum.get_int(PART_TIPOMOV) == 2) // Is it a credit note ?
|
||||||
_unsnc += rec.get_real(field);
|
_unsnc += rec.get_real(field);
|
||||||
else
|
else
|
||||||
@ -297,7 +353,7 @@ void TProspettoScadenze::compute_all(TPartita& p, TBill& bill)
|
|||||||
if (prima_riga_pagamento > -1 && prima_riga_pagamento == pp)
|
if (prima_riga_pagamento > -1 && prima_riga_pagamento == pp)
|
||||||
data_pag = d; // Se e' il primo pagamento(in ordine di data) di questa rata
|
data_pag = d; // Se e' il primo pagamento(in ordine di data) di questa rata
|
||||||
// prende la data di scadenza relativa.
|
// prende la data di scadenza relativa.
|
||||||
if (data_pag > _limbf) // && data_pag <= _limscad)
|
if (data_pag > _limbf && data_pag <= _limscad)
|
||||||
bf += TImporto(sez,pg.get_real(field));
|
bf += TImporto(sez,pg.get_real(field));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,6 +383,7 @@ void TProspettoScadenze::compute_all(TPartita& p, TBill& bill)
|
|||||||
{
|
{
|
||||||
real gap = (_unsnc > rscd ? rscd : _unsnc);
|
real gap = (_unsnc > rscd ? rscd : _unsnc);
|
||||||
rscd -= gap;
|
rscd -= gap;
|
||||||
|
res -= gap;
|
||||||
_unsnc -= gap;
|
_unsnc -= gap;
|
||||||
}
|
}
|
||||||
if (rscd == ZERO) // Se le scadenze sono a zero, vuol dire che sono state stornate
|
if (rscd == ZERO) // Se le scadenze sono a zero, vuol dire che sono state stornate
|
||||||
@ -368,9 +425,8 @@ void TProspettoScadenze::compute_all(TPartita& p, TBill& bill)
|
|||||||
s[0] += res;
|
s[0] += res;
|
||||||
}
|
}
|
||||||
residuo += res;
|
residuo += res;
|
||||||
bool sbf;
|
bf.normalize(pag_sez);
|
||||||
TImporto esp = rs.esposto(_stvaluta, _limscad, _limbf, sbf);
|
esposto += bf.valore();
|
||||||
esposto += esp.valore();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,6 +531,58 @@ bool TProspettoScadenze::preprocess_page(int file, int counter)
|
|||||||
// Now performing fulkrum...
|
// Now performing fulkrum...
|
||||||
compute_all(p, bill);
|
compute_all(p, bill);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
compute_unassigned(p, _limbf);
|
||||||
|
|
||||||
|
real residuo;
|
||||||
|
real s[NUMERO_FASCE];
|
||||||
|
real ns[NUMERO_FASCE];
|
||||||
|
real esposto;
|
||||||
|
const TDate d(_unsdscd);
|
||||||
|
real res = - _uns - _unsnc;
|
||||||
|
|
||||||
|
|
||||||
|
if (d > _limscad)
|
||||||
|
{
|
||||||
|
if (_nsinfasce)
|
||||||
|
{
|
||||||
|
for (int i = _nsfasce - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
const TDate & limdate = (TDate&)_ns_date[i];
|
||||||
|
if (limdate.ok() && d > limdate)
|
||||||
|
{
|
||||||
|
ns[i] += res;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ns[0] += res;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_sinfasce)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int i = _sfasce - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
const TDate & limdate = (TDate&)_s_date[i];
|
||||||
|
if (limdate.ok() && d <= limdate)
|
||||||
|
{
|
||||||
|
s[i] += res;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
s[0] += res;
|
||||||
|
}
|
||||||
|
residuo += res;
|
||||||
|
esposto = _unsesp;
|
||||||
|
update_totals(0, esposto, s, ns); // Singolo...
|
||||||
|
update_totals(1, esposto, s, ns); // ...Generale
|
||||||
|
}
|
||||||
current_cursor()->repos(); // Very, very necessary...
|
current_cursor()->repos(); // Very, very necessary...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user