Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Statistiche: corretto selezione da sez/sot a sez/sot + stampa riepilogo finale a fine stampa


git-svn-id: svn://10.65.10.50/trunk@7708 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1999-01-26 14:23:33 +00:00
parent efb6a266af
commit fb5a8ede64

View File

@ -263,7 +263,7 @@ void TStatisticaSog::crea_intestazione()
row.put(sep); row.put(sep);
printer().setheaderline(5, row); printer().setheaderline(5, row);
sep = ""; sep = "";
sep.fill('-'); sep.fill('-',80);
row.reset(); row.reset();
row.put(sep); row.put(sep);
printer().setheaderline(6, row); printer().setheaderline(6, row);
@ -353,6 +353,10 @@ void TStatisticaSog::stampa_sezione(TString16 codsez, TString16 codsot)
{ {
TPrintrow row; TPrintrow row;
TString256 rigastampa; TString256 rigastampa;
if (codsez == "ZZ" && codsot == "ZZ")
rigastampa = "RIEPILOGO TOTALE PER TUTTE LE SEZIONI STAMPATE";
else
{
rigastampa = "Sezione: "; rigastampa = "Sezione: ";
rigastampa << codsez; rigastampa << codsez;
if (codsot.not_empty()) if (codsot.not_empty())
@ -377,6 +381,7 @@ void TStatisticaSog::stampa_sezione(TString16 codsez, TString16 codsot)
rigastampa << den; rigastampa << den;
} }
} }
}
rigastampa.center_just(80); rigastampa.center_just(80);
row.put(rigastampa); row.put(rigastampa);
printer().setheaderline(1, row); printer().setheaderline(1, row);
@ -434,10 +439,9 @@ void TStatisticaSog::stampa_sezione(TString16 codsez, TString16 codsot)
} }
} }
} }
// stampa totali per sezione // stampa totali per sezione
rigastampa = ""; rigastampa = "";
rigastampa.fill('-'); rigastampa.fill('-',80);
row.reset(); row.reset();
row.put(rigastampa); row.put(rigastampa);
printer().print(row); printer().print(row);
@ -474,73 +478,41 @@ bool TStatisticaSog::riepilogo()
stat.setkey(1); stat.setkey(1);
_cur = new TCursor(_rel, "", 1); _cur = new TCursor(_rel, "", 1);
TString256 filtro = ""; TString256 filtro = "";
/*
// filtro per categoria
if (_catdon.not_empty())
{
if (filtro.empty())
filtro = format("(90->CATDON == \"%s\")",(const char*)_catdon);
else
{
filtro << " && ";
filtro << format("(90->CATDON == \"%s\")",(const char*)_catdon);
}
if (_data.ok())
{
TTable ctd("CTD");
ctd.put("CODTAB",_catdon);
if (ctd.read() == NOERR)
{
bool dimissione = ctd.get_bool("B0");
if (dimissione)
filtro << " && (ANSI(90->DATADIM)<=" << _data.string(ANSI) << ")";
else
filtro << " && (ANSI(90->DATAISC)<=" << _data.string(ANSI) << ")";
}
}
}
*/
// filtro per sezione/sottogruppo // filtro per sezione/sottogruppo
if (_sezini.not_empty()) if (_sezini.not_empty())
{ {
if (filtro.empty())
filtro = format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
else
{
filtro << " && ";
filtro << format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
}
if (_sotini.not_empty()) if (_sotini.not_empty())
{ {
if (filtro.empty()) filtro << "(";
filtro = format("(90->CODSOT >= \"%s\")",(const char*)_sotini); filtro << format("(90->CODSEZ > \"%s\")",(const char*)_sezini);
else filtro << " || ";
{ filtro << "(" << format("(90->CODSEZ == \"%s\")",(const char*)_sezini);
filtro << " && "; filtro << " && ";
filtro << format("(90->CODSOT >= \"%s\")",(const char*)_sotini); filtro << format("(90->CODSOT >= \"%s\")",(const char*)_sotini);
filtro << ")";
filtro << ")";
} }
} else
filtro << format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
} }
if (_sezfin.not_empty()) if (_sezfin.not_empty())
{ {
if (filtro.empty()) if (filtro.not_empty())
filtro = format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
else
{
filtro << " && "; filtro << " && ";
filtro << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
}
if (_sotfin.not_empty()) if (_sotfin.not_empty())
{ {
if (filtro.empty()) filtro << "(";
filtro = format("(90->CODSOT <= \"%s\")",(const char*)_sotfin); filtro << format("(90->CODSEZ < \"%s\")",(const char*)_sezfin);
else filtro << " || ";
{ filtro << "(" << format("(90->CODSEZ == \"%s\")",(const char*)_sezfin);
filtro << " && "; filtro << " && ";
filtro << format("(90->CODSOT <= \"%s\")",(const char*)_sotfin); filtro << format("(90->CODSOT <= \"%s\")",(const char*)_sotfin);
filtro << ")";
filtro << ")";
} }
} else
filtro << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
} }
_cur->setfilter((const char*) filtro, TRUE); _cur->setfilter((const char*) filtro, TRUE);
TString16 codsez, codsot, catdon, catcoll; TString16 codsez, codsot, catdon, catcoll;
@ -624,6 +596,30 @@ bool TStatisticaSog::riepilogo()
stat.put(ATSS_NUMERO, numero); stat.put(ATSS_NUMERO, numero);
stat.write(); stat.write();
} }
stat.zero();
stat.put(ATSS_CODSEZ, "ZZ");
stat.put(ATSS_CODSOT, "ZZ");
stat.put(ATSS_SESSO, sesso);
stat.put(ATSS_GRUPPO, gruppo);
stat.put(ATSS_RH, rh);
if (stat.read() == NOERR)
{
numero = stat.get_long(ATSS_NUMERO);
numero++;
stat.put(ATSS_NUMERO, numero);
stat.rewrite();
}
else
{
stat.put(ATSS_CODSEZ, "ZZ");
stat.put(ATSS_CODSOT, "ZZ");
stat.put(ATSS_SESSO, sesso);
stat.put(ATSS_GRUPPO, gruppo);
stat.put(ATSS_RH, rh);
numero = 1;
stat.put(ATSS_NUMERO, numero);
stat.write();
}
} }
} }
return (stat.eod() > 0); return (stat.eod() > 0);