corretto errore MI6114

git-svn-id: svn://10.65.10.50/trunk@3876 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1996-11-07 14:02:39 +00:00
parent 404b811fe1
commit 39416e0d06

@ -32,10 +32,11 @@ struct _LineTotal : public TObject //Oggetto di base per i TAssoc_array dei tot
_s3, // Scaglione 3
_s4, // Scaglione 4
_s5, // Scaglione 5
_s6; // Scaglione 6
_s6, // Scaglione 6
_s7; // scaglione 7
virtual TObject* dup() const { return new _LineTotal(*this); }
_LineTotal() {_rd = 0.0; _ns = 0.0; _bf = 0.0; _s1 = 0.0;
_s2 = 0.0; _s3 = 0.0; _s4 = 0.0; _s5 = 0.0; _s6 = 0.0;}
_s2 = 0.0; _s3 = 0.0; _s4 = 0.0; _s5 = 0.0; _s6 = 0.0; _s7 = 0.0;}
};
class TStampaScaduto : public TPrintapp
@ -54,7 +55,7 @@ class TStampaScaduto : public TPrintapp
_ordcod; // VERO=ordine per codice, FALSO=ordine per ragione sociale
TString _anno,_numdoc,_protiva,_datadoc,_codval,_residuo,
_nonscad,_buonfin,_sc_1,_sc_2,_sc_3,_sc_4,_sc_5,
_sc_6, _cod, _cod_pre, _des;
_sc_6, _sc_7, _cod, _cod_pre, _des;
TDate _limop, _limscad, _datas, _limbf; // Data limite operazione, data limite scaduto e data di stampa
int _gcr; // Giorni per Calcolo Rischio (valido solo per stampa clienti)
real _unsnc,_uns; // Unassigned per partita.
@ -80,7 +81,7 @@ public:
void print_totali(int& nriga);
void print_header();
void update_totals(bool what,real& res,real& non,real& buo,
real& s1,real& s2,real& s3,real& s4,real& s5, real& s6);
real& s1,real& s2,real& s3,real& s4,real& s5, real& s6, real& s7);
void compute_unassigned(TPartita& p);
void compute_all(TPartita& p);
TStampaScaduto();
@ -106,8 +107,9 @@ bool TStampaScaduto::fil_function(const TRelation *r)
return rt;
}
void TStampaScaduto::update_totals(bool what, real& res, real& non, real& buo,
real& s1, real& s2, real& s3, real& s4, real& s5, real& s6)
void TStampaScaduto::update_totals(bool what, real& res, real& non, real& buo,
real& s1, real& s2, real& s3, real& s4, real& s5,
real& s6, real& s7)
{
TAssoc_array& a = (TAssoc_array&) _t[what];
const bool is_key = a.is_key(_codval);
@ -122,6 +124,7 @@ void TStampaScaduto::update_totals(bool what, real& res, real& non, real& buo,
ll._s4 += s4;
ll._s5 += s5;
ll._s6 += s6;
ll._s7 += s7;
a.add(_codval,ll,is_key);
}
@ -144,9 +147,9 @@ void TStampaScaduto::compute_unassigned(TPartita& p)
void TStampaScaduto::compute_all(TPartita& p)
{
real residuo,nonscad,buonf,s1,s2,s3,s4,s5,s6,res_pagati;
real residuo,nonscad,buonf,s1,s2,s3,s4,s5,s6,s7,res_pagati;
residuo = 0.0; nonscad = 0.0; buonf = 0.0; s1 = 0.0;
s2 = 0.0; s3 = 0.0; s4 = 0.0; s5 = 0.0; s6 = 0.0;
s2 = 0.0; s3 = 0.0; s4 = 0.0; s5 = 0.0; s6 = 0.0; s7 = 0.0;
res_pagati = 0.0;
compute_unassigned(p);
for (int r = p.last(); r > 0; r = p.pred(r)) // Browse all rows (partite)
@ -259,10 +262,12 @@ void TStampaScaduto::compute_all(TPartita& p)
s4 += res;
if (_tipost == fornitori)
{
if (d < (TDate&)_s_date[3] && d > (TDate&)_s_date[4])
if (d < (TDate&)_s_date[3] && d >= (TDate&)_s_date[4])
s5 += res;
if (d < (TDate&)_s_date[4])
if (d < (TDate&)_s_date[4] && d >= (TDate&)_s_date[5])
s6 += res;
if (d < (TDate&)_s_date[5])
s7 += res;
}
else
{
@ -317,11 +322,16 @@ void TStampaScaduto::compute_all(TPartita& p)
if (_stvaluta && _codval != " ") _sc_6 = s6.string(".3");
else _sc_6 = s6.string(".");
}
// Aggiorna i totali...
if (residuo!=0.0 || nonscad!=0.0 || buonf!=0.0 || s1!=0.0 || s2!=0.0 || s3!=0.0 || s4!= 0.0 || s5!= 0.0 || s6!=0.0)
if (s7 != 0.0)
{
update_totals(0, residuo, nonscad, buonf, s1, s2, s3, s4, s5, s6); // Singolo...
update_totals(1, residuo, nonscad, buonf, s1, s2, s3, s4, s5, s6); // ...Generale
if (_stvaluta && _codval != " ") _sc_7 = s7.string(".3");
else _sc_7 = s7.string(".");
}
// Aggiorna i totali...
if (residuo!=0.0 || nonscad!=0.0 || buonf!=0.0 || s1!=0.0 || s2!=0.0 || s3!=0.0 || s4!= 0.0 || s5!= 0.0 || s6!=0.0 || s7!=0.0)
{
update_totals(0, residuo, nonscad, buonf, s1, s2, s3, s4, s5, s6, s7); // Singolo...
update_totals(1, residuo, nonscad, buonf, s1, s2, s3, s4, s5, s6, s7); // ...Generale
}
}
@ -395,6 +405,7 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
_sc_4 = "";
_sc_5 = "";
_sc_6 = "";
_sc_7 = "";
if (r > 0) //Skip next partita if no fatture!
{
@ -414,7 +425,8 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
// Se c'e' qualcosa da stampare (ovvero almeno un importo non nullo)
const bool to_print = !_residuo.empty() || !_nonscad.empty() || !_sc_1.empty() || !_sc_2.empty() ||
!_sc_3.empty() || !_sc_4.empty() || !_sc_5.empty() || !_sc_6.empty() || (_tipost == clienti && !_buonfin.empty());
!_sc_3.empty() || !_sc_4.empty() || !_sc_5.empty() || !_sc_6.empty() || !_sc_7.empty() ||
(_tipost == clienti && !_buonfin.empty());
if (to_print)
{
if (curr.get_int(PART_NRIGA) == 1)
@ -472,7 +484,7 @@ bool TStampaScaduto::user_create()
_scad = new TLocalisamfile(LF_SCADENZE);
_pagsca = new TLocalisamfile(LF_PAGSCA);
_t.add(new TAssoc_array);_t.add(new TAssoc_array);
for (int i = 0; i < 5; i++)
for (int i = 0; i < 6; i++)
_s_date.add(new TDate);
TConfig conf (CONFIG_DITTA,"cg");
@ -524,7 +536,7 @@ bool TStampaScaduto::set_print(int)
_anno.cut(0);_numdoc.cut(0);_protiva.cut(0);_datadoc.cut(0);
_codval.cut(0);_residuo.cut(0);_nonscad.cut(0);_buonfin.cut(0);
_cod.cut(0); _des.cut(0); _cod_pre.cut(0);
_sc_1.cut(0);_sc_2.cut(0);_sc_3.cut(0);_sc_4.cut(0);_sc_5.cut(0);_sc_6.cut(0);
_sc_1.cut(0);_sc_2.cut(0);_sc_3.cut(0);_sc_4.cut(0);_sc_5.cut(0);_sc_6.cut(0);_sc_7.cut(0);
for (int it=0; it < _t.items(); it++)
{
TAssoc_array& aa = (TAssoc_array&) _t[it];
@ -580,10 +592,10 @@ bool TStampaScaduto::set_print(int)
if (_tipost == clienti)
inc = 30l;
long nday = inc;
for (int j = 0; j < 5; j++)
for (int j = 0; j < 6; j++)
{
TDate* d = (TDate *)_s_date.objptr(j);
if (_tipost == fornitori && j == 4 )
if (_tipost == fornitori && (j == 4 || j == 5) )
nday += inc;
*d = _limscad - nday;
nday += inc;
@ -643,6 +655,10 @@ void TStampaScaduto::print_totali_rows(int& nriga, bool what)
else value = v._s6.string(".");
if (v._s6 != 0.0)
set_row(nriga,"@193g%18s",(const char*) value);
if (_stvaluta && k != " ") value = v._s7.string(".3");
else value = v._s7.string(".");
if (v._s7 != 0.0)
set_row(nriga,"@212g%18s",(const char*) value);
set_row(++nriga,"");
}
xassoc.destroy(); // Distrugge il totale appena stampato
@ -687,8 +703,8 @@ void TStampaScaduto::print_header()
case fornitori:
case clienti:
{
TString rw(211);
TString s1,s2;
TString rw(230);
TString s1,s2, s3;
int o = 0; // Offset per scaglioni.
set_header (soh++, "Ditta : %ld %s@158gData@163g%s @190gPag. @#",
firm, (const char *)s, (const char *)datas);
@ -696,11 +712,12 @@ void TStampaScaduto::print_header()
{
set_header(soh++,"@72g** SCADUTO FORNITORI **");
s1 = ""; s2 = scaglioni[7]; // +90 gg per fornitori
s3 = scaglioni[8]; // +120 gg per fornitori
}
else
{
set_header(soh++,"@73g** SCADUTO CLIENTI **");
s1 ="In Attesa B.F."; s2 ="";
s1 ="In Attesa B.F."; s2 = ""; s3 = "";
o = 4;
}
set_header (soh++,"@73gAl %s Operazioni al %s",(const char*)limscad, (const char*)limop);
@ -708,12 +725,12 @@ void TStampaScaduto::print_header()
set_header(soh++, (const char *) rw);
set_header(soh++,"CODICE@18gC O G N O M E E N O M E ");
set_header(soh++,"Riferim.@12gNumero@20gNumero@27gData@50gResiduo@102g"
"---------------------------------------------- S C A D U T O "
"----------------------------------------------");
"-------------------------------------------------------- S C A D U T O "
"-------------------------------------------------------");
set_header(soh++,"partita@12gDocum.@20gProt.@27gDocumento@38gValuta"
"@50gDocumento@67gNon Scaduto@86g%s@112g%s@129g%s@148g%s@167g%s@185g%s@204g%s",
"@50gDocumento@67gNon Scaduto@86g%s@112g%s@129g%s@148g%s@167g%s@185g%s@204g%s@223g%s",
(const char*)s1,scaglioni[0],scaglioni[1+o],scaglioni[2+o],
scaglioni[3+o],scaglioni[4+o],(const char*) s2);
scaglioni[3+o],scaglioni[4+o],(const char*) s2, (const char*) s3);
set_header(soh++,(const char *)rw);
break;
}
@ -765,6 +782,7 @@ void TStampaScaduto::set_page_part(int& nriga)
set_row(nriga,"@155g#18t",&_sc_4);
set_row(nriga,"@174g#18t",&_sc_5);
set_row(nriga,"@193g#18t",&_sc_6);
set_row(nriga,"@212g#18t",&_sc_7);
}
void TStampaScaduto::set_page(int file, int counter)