Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Statistiche: corretto selezine da sez/sot a sez/sot + possibilita' di fare solo riepilogo finale


git-svn-id: svn://10.65.10.50/trunk@7707 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1999-01-26 14:22:35 +00:00
parent 7f9719e130
commit efb6a266af
2 changed files with 115 additions and 74 deletions

View File

@ -91,6 +91,7 @@ class TRiepilogoPunto : public TApplication
TAssoc_array* _punti; TAssoc_array* _punti;
TArray _righe; // array per riepilogo donazioni TArray _righe; // array per riepilogo donazioni
TString16 _sezini, _sotini, _sezfin, _sotfin; TString16 _sezini, _sotini, _sezfin, _sotfin;
bool _solotot;
protected: protected:
virtual bool create(); virtual bool create();
@ -191,6 +192,7 @@ bool TRiepilogoPunto::menu(MENU_TAG m)
{ {
_dataini = msk.get(F_DATAINI); _dataini = msk.get(F_DATAINI);
_datafin = msk.get(F_DATAFIN); _datafin = msk.get(F_DATAFIN);
_solotot = msk.get_bool(F_SOLOTOT);
_sezini = _msk->get(F_SEZINI); _sezini = _msk->get(F_SEZINI);
_sotini = _msk->get(F_SOTINI); _sotini = _msk->get(F_SOTINI);
_sezfin = _msk->get(F_SEZFIN); _sezfin = _msk->get(F_SEZFIN);
@ -229,7 +231,8 @@ void TRiepilogoPunto::crea_intestazione()
row.reset(); row.reset();
sep = "Punto di prelievo "; sep = "Punto di prelievo ";
TTable tdn("TDN"); TTable tdn("TDN");
int pos = 27; //int pos = 37;
int pos = 57;
for (tdn.first(); !tdn.eof(); tdn.next()) for (tdn.first(); !tdn.eof(); tdn.next())
{ {
sep.overwrite((const char*)tdn.get("CODTAB"),pos); sep.overwrite((const char*)tdn.get("CODTAB"),pos);
@ -239,7 +242,8 @@ void TRiepilogoPunto::crea_intestazione()
row.put(sep); row.put(sep);
printer().setheaderline(5, row); printer().setheaderline(5, row);
sep = ""; sep = "";
sep.fill('-'); sep.fill('-',80);
sep.cut(pos+6);
row.reset(); row.reset();
row.put(sep); row.put(sep);
printer().setheaderline(6, row); printer().setheaderline(6, row);
@ -254,7 +258,7 @@ bool TRiepilogoPunto::stampa()
TCursor* curstat = new TCursor(relstat, "", 1); TCursor* curstat = new TCursor(relstat, "", 1);
TString16 oldsez = "**"; TString16 oldsez = "**";
TString16 oldsot = "**"; TString16 oldsot = "**";
double numero; long numero;
TString16 actsez, actsot; TString16 actsez, actsot;
TString16 tipodon, punto; TString16 tipodon, punto;
long last = curstat->items(); long last = curstat->items();
@ -264,7 +268,7 @@ bool TRiepilogoPunto::stampa()
actsot = curstat->curr().get(ATS_CODSOT); actsot = curstat->curr().get(ATS_CODSOT);
tipodon = curstat->curr().get(ATS_TIPODON); tipodon = curstat->curr().get(ATS_TIPODON);
punto = curstat->curr().get(ATS_PUNTO); punto = curstat->curr().get(ATS_PUNTO);
numero = (double)curstat->curr().get_int(ATS_NUMERO); numero = curstat->curr().get_long(ATS_NUMERO);
if (actsez != oldsez || actsot != oldsot) if (actsez != oldsez || actsot != oldsot)
{ {
if (oldsez != "**" && oldsot != "**") if (oldsez != "**" && oldsot != "**")
@ -313,6 +317,10 @@ void TRiepilogoPunto::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 SELEZIONATE";
else
{
rigastampa = "Sezione: "; rigastampa = "Sezione: ";
rigastampa << codsez; rigastampa << codsez;
if (codsot.not_empty()) if (codsot.not_empty())
@ -337,6 +345,7 @@ void TRiepilogoPunto::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);
@ -349,7 +358,8 @@ void TRiepilogoPunto::stampa_sezione(TString16 codsez, TString16 codsot)
row.reset(); row.reset();
rigastampa = "Senza punto"; rigastampa = "Senza punto";
totalepunto = ZERO; totalepunto = ZERO;
int pos = 21; //int pos = 31;
int pos = 51;
for (int i=0;i<_colonne->items();i++) for (int i=0;i<_colonne->items();i++)
{ {
rigatotali.aggiorna_valore(i,riga[i]); rigatotali.aggiorna_valore(i,riga[i]);
@ -378,8 +388,11 @@ void TRiepilogoPunto::stampa_sezione(TString16 codsez, TString16 codsot)
rigastampa << punto; rigastampa << punto;
rigastampa << " "; rigastampa << " ";
rigastampa << ldn.get("S0"); rigastampa << ldn.get("S0");
//rigastampa.cut(30);
rigastampa.cut(55);
totalepunto = ZERO; totalepunto = ZERO;
int pos = 21; //int pos = 31;
int pos = 51;
for (int i=0;i<_colonne->items();i++) for (int i=0;i<_colonne->items();i++)
{ {
rigatotali.aggiorna_valore(i,riga[i]); rigatotali.aggiorna_valore(i,riga[i]);
@ -400,7 +413,8 @@ void TRiepilogoPunto::stampa_sezione(TString16 codsez, TString16 codsot)
} }
// stampa totali per sezione // stampa totali per sezione
rigastampa = ""; rigastampa = "";
rigastampa.fill('-'); rigastampa.fill('-',80);
rigastampa.cut(pos+4+8);
row.reset(); row.reset();
row.put(rigastampa); row.put(rigastampa);
printer().print(row); printer().print(row);
@ -408,7 +422,8 @@ void TRiepilogoPunto::stampa_sezione(TString16 codsez, TString16 codsot)
rigastampa = ""; rigastampa = "";
rigastampa = "Totale "; rigastampa = "Totale ";
totalepunto = ZERO; totalepunto = ZERO;
pos = 21; //pos = 31;
pos = 51;
for (i=0;i<_colonne->items();i++) for (i=0;i<_colonne->items();i++)
{ {
totalepunto+=rigatotali[i]; totalepunto+=rigatotali[i];
@ -444,47 +459,41 @@ bool TRiepilogoPunto::riepilogo()
a.put(DON_DATADON, _datafin); a.put(DON_DATADON, _datafin);
_cur = new TCursor(_rel, "", 2, &da, &a); _cur = new TCursor(_rel, "", 2, &da, &a);
TString256 filtro = ""; TString256 filtro = "";
// 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("(92->CODSEZ > \"%s\")",(const char*)_sezini);
else filtro << " || ";
{ filtro << "(" << format("(92->CODSEZ == \"%s\")",(const char*)_sezini);
filtro << " && "; filtro << " && ";
filtro << format("(90->CODSOT >= \"%s\")",(const char*)_sotini); filtro << format("(92->CODSOT >= \"%s\")",(const char*)_sotini);
} filtro << ")";
filtro << ")";
} }
else
filtro << format("(92->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("(92->CODSEZ < \"%s\")",(const char*)_sezfin);
else filtro << " || ";
{ filtro << "(" << format("(92->CODSEZ == \"%s\")",(const char*)_sezfin);
filtro << " && "; filtro << " && ";
filtro << format("(90->CODSOT <= \"%s\")",(const char*)_sotfin); filtro << format("(92->CODSOT <= \"%s\")",(const char*)_sotfin);
} filtro << ")";
filtro << ")";
} }
else
filtro << format("(92->CODSEZ <= \"%s\")",(const char*)_sezfin);
} }
_cur->setfilter((const char*) filtro, TRUE); _cur->setfilter((const char*) filtro, TRUE);
TString16 codsez, codsot, tipodon, punto; TString16 codsez, codsot, tipodon, punto;
@ -505,6 +514,8 @@ bool TRiepilogoPunto::riepilogo()
} }
tipodon = recdon.get(DON_TIPODON); tipodon = recdon.get(DON_TIPODON);
punto = recdon.get(DON_LUOGODON); punto = recdon.get(DON_LUOGODON);
if (!_solotot)
{
stat.zero(); stat.zero();
stat.put(ATS_CODSEZ, codsez); stat.put(ATS_CODSEZ, codsez);
stat.put(ATS_CODSOT, codsot); stat.put(ATS_CODSOT, codsot);
@ -529,6 +540,30 @@ bool TRiepilogoPunto::riepilogo()
int err = stat.write(); int err = stat.write();
} }
} }
stat.zero();
stat.put(ATS_CODSEZ, "ZZ");
stat.put(ATS_CODSOT, "ZZ");
stat.put(ATS_TIPODON, tipodon);
stat.put(ATS_PUNTO, punto);
if (stat.read() == NOERR)
{
numero = stat.get_long(ATS_NUMERO);
numero++;
stat.put(ATS_NUMERO, numero);
int err = stat.rewrite();
}
else
{
stat.zero();
stat.put(ATS_CODSEZ, "ZZ");
stat.put(ATS_CODSOT, "ZZ");
stat.put(ATS_TIPODON, tipodon);
stat.put(ATS_PUNTO, punto);
numero = 1;
stat.put(ATS_NUMERO, numero);
int err = stat.write();
}
}
return (stat.eod() > 0); return (stat.eod() > 0);
} }
else else

View File

@ -117,7 +117,7 @@ BEGIN
HELP "Sottogruppo finale" HELP "Sottogruppo finale"
END END
GROUPBOX DLG_NULL 77 3 GROUPBOX DLG_NULL 77 4
BEGIN BEGIN
PROMPT 1 5 "Opzioni per il riepilogo" PROMPT 1 5 "Opzioni per il riepilogo"
END END
@ -134,6 +134,12 @@ BEGIN
HELP "Data finale" HELP "Data finale"
END END
BOOLEAN F_SOLOTOT
BEGIN
PROMPT 2 7 "Stampa solo totale finale (non stampa il dettaglio per sezione)"
END
BUTTON DLG_OK 9 2 BUTTON DLG_OK 9 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""