From e984dffae4bc5f9713178c0635caa9af243ff1c5 Mon Sep 17 00:00:00 2001 From: cris Date: Tue, 26 Jan 1999 14:24:43 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : Statistiche: corretto selezione da sez/sot a sez/sot + possibilita' di fare solo ripeilogo finale git-svn-id: svn://10.65.10.50/trunk@7709 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- at/at3600.cpp | 198 +++++++++++++++++++++++++++++++------------------ at/at3600a.h | 1 + at/at3600a.uml | 7 +- 3 files changed, 133 insertions(+), 73 deletions(-) diff --git a/at/at3600.cpp b/at/at3600.cpp index 4ace8482b..9f118affc 100755 --- a/at/at3600.cpp +++ b/at/at3600.cpp @@ -94,6 +94,7 @@ class TStatDonGrRh : public TApplication TArray _righe; // array per riepilogo donazioni TString16 _sezini, _sotini, _sezfin, _sotfin; TAssoc_array* _asoggetti; + bool _solotot; protected: virtual bool create(); @@ -235,6 +236,7 @@ bool TStatDonGrRh::menu(MENU_TAG m) _dataini = msk.get(F_DATAINI); _datafin = msk.get(F_DATAFIN); _tipodon = msk.get(F_TIPODON); + _solotot = msk.get_bool(F_SOLOTOT); _sezini = msk.get(F_SEZINI); _sotini = msk.get(F_SOTINI); _sezfin = msk.get(F_SEZFIN); @@ -287,7 +289,7 @@ void TStatDonGrRh::crea_intestazione() row.put(sep); printer().setheaderline(6, row); sep = ""; - sep.fill('-'); + sep.fill('-',80); row.reset(); row.put(sep); printer().setheaderline(7, row); @@ -393,30 +395,35 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) { TPrintrow row; TString256 rigastampa; - rigastampa = "Sezione: "; - rigastampa << codsez; - if (codsot.not_empty()) + if (codsez == "ZZ" && codsot == "ZZ") + rigastampa = "RIEPILOGO TOTALE PER TUTTE LE SEZIONI SELEZIONATE"; + else { - rigastampa << "/"; - rigastampa << codsot; - } - rigastampa << " "; - TLocalisamfile sezioni(LF_SEZIONI); - sezioni.setkey(1); - sezioni.zero(); - sezioni.put(SEZ_CODSEZ,codsez); - sezioni.put(SEZ_CODSOT,codsot); - if (sezioni.read() == NOERR) - { - TString80 den = sezioni.get(SEZ_DENSEZ); - rigastampa << den; - den = sezioni.get(SEZ_DENSOT); - if (den.not_empty()) + rigastampa = "Sezione: "; + rigastampa << codsez; + if (codsot.not_empty()) { rigastampa << "/"; + rigastampa << codsot; + } + rigastampa << " "; + TLocalisamfile sezioni(LF_SEZIONI); + sezioni.setkey(1); + sezioni.zero(); + sezioni.put(SEZ_CODSEZ,codsez); + sezioni.put(SEZ_CODSOT,codsot); + if (sezioni.read() == NOERR) + { + TString80 den = sezioni.get(SEZ_DENSEZ); rigastampa << den; + den = sezioni.get(SEZ_DENSOT); + if (den.not_empty()) + { + rigastampa << "/"; + rigastampa << den; + } } - } + } rigastampa.center_just(80); row.put(rigastampa); printer().setheaderline(1, row); @@ -539,7 +546,7 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) } // stampa totali per sezione rigastampa = ""; - rigastampa.fill('-'); + rigastampa.fill('-',80); row.reset(); row.put(rigastampa); printer().print(row); @@ -642,58 +649,53 @@ bool TStatDonGrRh::riepilogo() a.put(DON_DATADON, _datafin); _cur = new TCursor(_rel, "", 2, &da, &a); TString256 filtro = ""; + // filtro per sezione/sottogruppo + if (_sezini.not_empty()) + { + if (_sotini.not_empty()) + { + filtro << "("; + filtro << format("(92->CODSEZ > \"%s\")",(const char*)_sezini); + filtro << " || "; + filtro << "(" << format("(92->CODSEZ == \"%s\")",(const char*)_sezini); + filtro << " && "; + filtro << format("(92->CODSOT >= \"%s\")",(const char*)_sotini); + filtro << ")"; + filtro << ")"; + } + else + filtro << format("(92->CODSEZ >= \"%s\")",(const char*)_sezini); + } + if (_sezfin.not_empty()) + { + if (filtro.not_empty()) + filtro << " && "; + + if (_sotfin.not_empty()) + { + filtro << "("; + filtro << format("(92->CODSEZ < \"%s\")",(const char*)_sezfin); + filtro << " || "; + filtro << "(" << format("(92->CODSEZ == \"%s\")",(const char*)_sezfin); + filtro << " && "; + filtro << format("(92->CODSOT <= \"%s\")",(const char*)_sotfin); + filtro << ")"; + filtro << ")"; + } + else + filtro << format("(92->CODSEZ <= \"%s\")",(const char*)_sezfin); + } // filtro per tipo donazione if (_tipodon.not_empty()) { if (filtro.empty()) - filtro = format("(92->TIPODON == \"%s\")",(const char*)_tipodon); + filtro = format("(92->TIPODON==\"%s\")",(const char*)_tipodon); else { filtro << " && "; - filtro << format("(92->TIPODON == \"%s\")",(const char*)_tipodon); + filtro << format("(92->TIPODON==\"%s\")",(const char*)_tipodon); } } - // filtro per sezione/sottogruppo - 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 (filtro.empty()) - filtro = format("(90->CODSOT >= \"%s\")",(const char*)_sotini); - else - { - filtro << " && "; - filtro << format("(90->CODSOT >= \"%s\")",(const char*)_sotini); - } - } - } - if (_sezfin.not_empty()) - { - if (filtro.empty()) - filtro = format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin); - else - { - filtro << " && "; - filtro << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin); - } - if (_sotfin.not_empty()) - { - if (filtro.empty()) - filtro = format("(90->CODSOT <= \"%s\")",(const char*)_sotfin); - else - { - filtro << " && "; - filtro << format("(90->CODSOT <= \"%s\")",(const char*)_sotfin); - } - } - } _cur->setfilter((const char*) filtro, TRUE); TString16 codsez, codsot, tipodon, sesso; TDate datadon; @@ -728,15 +730,67 @@ bool TStatDonGrRh::riepilogo() gruppo = "A"; if (gruppo == "A1B" || gruppo == "A2B") gruppo = "AB"; - rh = recsog.get(SOG_RHANTID); + if (!_solotot) + { + stat.zero(); + stat.put(ATS_CODSEZ, codsez); + stat.put(ATS_CODSOT, codsot); + stat.put(ATS_GRUPPO, gruppo); + stat.put(ATS_RH, rh); + if (stat.read() == NOERR) + { + if (sesso == "1") + numero = stat.get_long(ATS_NUMERO); + else + numero = stat.get_long(ATS_NUMERO2); + numero++; + if (sesso == "1") + stat.put(ATS_NUMERO, numero); + else + stat.put(ATS_NUMERO2, numero); + if (!esiste) + { + if (sesso == "1") + numero = stat.get_long(ATS_NUMPRIME); + else + numero = stat.get_long(ATS_NUMPRIME2); + numero++; + if (sesso == "1") + stat.put(ATS_NUMPRIME, numero); + else + stat.put(ATS_NUMPRIME2, numero); + } + stat.rewrite(); + } + else + { + stat.zero(); + stat.put(ATS_CODSEZ, codsez); + stat.put(ATS_CODSOT, codsot); + stat.put(ATS_GRUPPO, gruppo); + stat.put(ATS_RH, rh); + numero = 1; + if (sesso == "1") + { + stat.put(ATS_NUMERO, numero); + stat.put(ATS_NUMPRIME, numero); + } + else + { + stat.put(ATS_NUMERO2, numero); + stat.put(ATS_NUMPRIME2, numero); + } + stat.write(); + } + } stat.zero(); - stat.put(ATS_CODSEZ, codsez); - stat.put(ATS_CODSOT, codsot); + stat.put(ATS_CODSEZ, "ZZ"); + stat.put(ATS_CODSOT, "ZZ"); stat.put(ATS_GRUPPO, gruppo); stat.put(ATS_RH, rh); if (stat.read() == NOERR) - { + { if (sesso == "1") numero = stat.get_long(ATS_NUMERO); else @@ -758,13 +812,13 @@ bool TStatDonGrRh::riepilogo() else stat.put(ATS_NUMPRIME2, numero); } - stat.rewrite(); + int err = stat.rewrite(); } else { stat.zero(); - stat.put(ATS_CODSEZ, codsez); - stat.put(ATS_CODSOT, codsot); + stat.put(ATS_CODSEZ, "ZZ"); + stat.put(ATS_CODSOT, "ZZ"); stat.put(ATS_GRUPPO, gruppo); stat.put(ATS_RH, rh); numero = 1; @@ -778,7 +832,7 @@ bool TStatDonGrRh::riepilogo() stat.put(ATS_NUMERO2, numero); stat.put(ATS_NUMPRIME2, numero); } - stat.write(); + int err = stat.write(); } } return (stat.eod() > 0); diff --git a/at/at3600a.h b/at/at3600a.h index 994d6bd06..136624b10 100755 --- a/at/at3600a.h +++ b/at/at3600a.h @@ -14,3 +14,4 @@ #define F_DATAFIN 302 #define F_TIPODON 303 #define F_D_TIPODON 304 +#define F_SOLOTOT 305 diff --git a/at/at3600a.uml b/at/at3600a.uml index 9d298dc80..bb95163bd 100755 --- a/at/at3600a.uml +++ b/at/at3600a.uml @@ -117,7 +117,7 @@ BEGIN HELP "Sottogruppo finale" END -GROUPBOX DLG_NULL 77 4 +GROUPBOX DLG_NULL 77 5 BEGIN PROMPT 1 5 "Opzioni per la statistica" END @@ -154,6 +154,11 @@ BEGIN FLAGS "D" END +BOOLEAN F_SOLOTOT +BEGIN + PROMPT 2 8 "Stampa solo totale finale (non stampa il dettaglio per sezione)" +END + BUTTON DLG_OK 9 2 BEGIN PROMPT -12 -1 ""