From 39fbd01ef58df86ade39f15b6942b9bdeaa1b838 Mon Sep 17 00:00:00 2001 From: cris Date: Tue, 26 Jan 1999 14:31:47 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : Statistica riepilogo giorn. don.: possibilita' di fare la stampa per sezione o per punto e in questo caso di selezionare il punto git-svn-id: svn://10.65.10.50/trunk@7710 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- at/at3500.cpp | 195 +++++++++++++++++++++++++++++++++---------------- at/at3500a.h | 3 + at/at3500a.uml | 36 ++++++++- 3 files changed, 169 insertions(+), 65 deletions(-) diff --git a/at/at3500.cpp b/at/at3500.cpp index 2151960ee..fdd7f74e9 100755 --- a/at/at3500.cpp +++ b/at/at3500.cpp @@ -1,5 +1,4 @@ #include -//#include #include #include #include @@ -92,7 +91,8 @@ class TRiepilogoGiornaliero : public TApplication TAssoc_array* _colonne; TArray _righe; // array per riepilogo donazioni TArray _righe_prime; // array per riepilogo prime don - TString16 _sezini, _sotini, _sezfin, _sotfin; + TString16 _sezini, _sotini, _sezfin, _sotfin, _punto; + char _suddivisa; protected: virtual bool create(); @@ -107,6 +107,8 @@ protected: bool crea_righe(); void azzera_righe(); void stampa_sezione(TString16 codsez, TString16 codsot); + void stampa_punto(TString16 punto); + void stampa_tutto(); void crea_intestazione(); public: TRiepilogoGiornaliero() {} @@ -179,10 +181,12 @@ bool TRiepilogoGiornaliero::menu(MENU_TAG m) _dataini = msk.get(F_DATAINI); _datafin = msk.get(F_DATAFIN); _primedon = msk.get_bool(F_PRIMEDON); - _sezini = _msk->get(F_SEZINI); - _sotini = _msk->get(F_SOTINI); - _sezfin = _msk->get(F_SEZFIN); - _sotfin = _msk->get(F_SOTFIN); + _suddivisa = msk.get(F_SUDDIVISA)[0]; + _punto = msk.get(F_PUNTO); + _sezini = msk.get(F_SEZINI); + _sotini = msk.get(F_SOTINI); + _sezfin = msk.get(F_SEZFIN); + _sotfin = msk.get(F_SOTFIN); if (riepilogo()) stampa(); } @@ -223,7 +227,7 @@ void TRiepilogoGiornaliero::crea_intestazione() row.put(sep); printer().setheaderline(5, row); sep = ""; - sep.fill('-'); + sep.fill('-',80); row.reset(); row.put(sep); printer().setheaderline(6, row); @@ -235,32 +239,51 @@ bool TRiepilogoGiornaliero::stampa() { crea_intestazione(); TRelation* relstat = new TRelation(LF_ATSTATD); - TCursor* curstat = new TCursor(relstat, "", 1); + TSorted_cursor* curstat = new TSorted_cursor(relstat,"","", 1); + if (_suddivisa == 'P') + curstat->change_order("121->PUNTO|121->GIORNO|121->TIPODON"); TString16 oldsez = "**"; TString16 oldsot = "**"; + TString16 oldpunto = "**"; double numero, numprime; - TString16 actsez, actsot; + TString16 actsez, actsot, actpunto; TString16 tipodon; TDate data; long last = curstat->items(); for ( *curstat=0; curstat->pos() < last; ++(*curstat) ) { + actpunto = curstat->curr().get(ATS_PUNTO); actsez = curstat->curr().get(ATS_CODSEZ); actsot = curstat->curr().get(ATS_CODSOT); data = curstat->curr().get_date(ATS_DATA); tipodon = curstat->curr().get(ATS_TIPODON); numero = (double)curstat->curr().get_int(ATS_NUMERO); numprime = (double)curstat->curr().get_int(ATS_NUMPRIME); - if (actsez != oldsez || actsot != oldsot) - { - if (oldsez != "**" && oldsot != "**") - { - stampa_sezione(oldsez,oldsot); - azzera_righe(); - } - oldsez = actsez; - oldsot = actsot; - } + if (_suddivisa == 'S') + { + if (actsez != oldsez || actsot != oldsot) + { + if (oldsez != "**" && oldsot != "**") + { + stampa_sezione(oldsez,oldsot); + azzera_righe(); + } + oldsez = actsez; + oldsot = actsot; + } + } + else + { + if (actpunto != oldpunto) + { + if (oldpunto != "**") + { + stampa_punto(oldpunto); + azzera_righe(); + } + oldpunto = actpunto; + } + } TRigaG& riga = (TRigaG&)_righe[data2row(data)]; real& colonna = (real&)_colonne->find((const char*)tipodon); real n = numero; @@ -271,9 +294,17 @@ bool TRiepilogoGiornaliero::stampa() n = numprime; riga_prime.aggiorna_valore((int) colonna.integer(), n); } - } - if (oldsez != "**" && oldsot != "**") - stampa_sezione(oldsez,oldsot); + } + if (_suddivisa == 'S') + { + if (oldsez != "**" && oldsot != "**") + stampa_sezione(oldsez,oldsot); + } + else + { + if (oldpunto != "**") + stampa_punto(oldpunto); + } delete curstat; delete relstat; printer().close(); @@ -299,6 +330,23 @@ void TRiepilogoGiornaliero::azzera_righe() } } +void TRiepilogoGiornaliero::stampa_punto(TString16 punto) +{ + TPrintrow row; + TString256 rigastampa; + rigastampa = "Punto: "; + rigastampa << punto; + rigastampa << " "; + TTable ldn("LDN"); + ldn.put("CODTAB",punto); + if (ldn.read() == NOERR) + rigastampa << ldn.get("S0"); + rigastampa.center_just(80); + row.put(rigastampa); + printer().setheaderline(1, row); + stampa_tutto(); +} + void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot) { TPrintrow row; @@ -330,7 +378,13 @@ void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot) rigastampa.center_just(80); row.put(rigastampa); printer().setheaderline(1, row); - + stampa_tutto(); +} + +void TRiepilogoGiornaliero::stampa_tutto() +{ + TPrintrow row; + TString256 rigastampa; TRigaG rigatotali(NULLDATE); TDate data = _dataini; real totaledata = ZERO; @@ -361,7 +415,7 @@ void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot) } // stampa totali per sezione rigastampa = ""; - rigastampa.fill('-'); + rigastampa.fill('-',80); row.reset(); row.put(rigastampa); printer().print(row); @@ -415,7 +469,7 @@ void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot) } // stampa totali per sezione rigastampa = ""; - rigastampa.fill('-'); + rigastampa.fill('-',80); row.reset(); row.put(rigastampa); printer().print(row); @@ -460,50 +514,54 @@ bool TRiepilogoGiornaliero::riepilogo() a.put(DON_DATADON, _datafin); _cur = new TCursor(_rel, "", 2, &da, &a); TString256 filtro = ""; - // 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 (_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); } - if (_sezfin.not_empty()) + if (_punto.not_empty()) { if (filtro.empty()) - filtro = format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin); + filtro = format("(92->LUOGODON == \"%s\")",(const char*)_punto); else { filtro << " && "; - filtro << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin); + filtro << format("(92->LUOGODON == \"%s\")",(const char*)_punto); } - 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; + TString16 codsez, codsot, punto, tipodon; int anno, mese, giorno; TDate data; long numero; @@ -515,6 +573,7 @@ bool TRiepilogoGiornaliero::riepilogo() for ( *_cur=0; _cur->pos() < last; ++(*_cur) ) { prg.addstatus(1); + punto = recdon.get(DON_LUOGODON); codsez = recdon.get(DON_CODSEZ); codsot = recdon.get(DON_CODSOT); if (codsez.empty()) @@ -529,8 +588,13 @@ bool TRiepilogoGiornaliero::riepilogo() tipodon = recdon.get(DON_TIPODON); primadon = recdon.get_bool(DON_PRIMADON); stat.zero(); - stat.put(ATS_CODSEZ, codsez); - stat.put(ATS_CODSOT, codsot); + if (_suddivisa == 'S') + { + stat.put(ATS_CODSEZ, codsez); + stat.put(ATS_CODSOT, codsot); + } + else + stat.put(ATS_PUNTO, punto); //stat.put(ATS_DATA, data); stat.put(ATS_ANNO, anno); stat.put(ATS_MESE, mese); @@ -552,8 +616,13 @@ bool TRiepilogoGiornaliero::riepilogo() else { stat.zero(); - stat.put(ATS_CODSEZ, codsez); - stat.put(ATS_CODSOT, codsot); + if (_suddivisa == 'S') + { + stat.put(ATS_CODSEZ, codsez); + stat.put(ATS_CODSOT, codsot); + } + else + stat.put(ATS_PUNTO, punto); stat.put(ATS_ANNO, anno); stat.put(ATS_MESE, mese); stat.put(ATS_GIORNO, giorno); diff --git a/at/at3500a.h b/at/at3500a.h index f1f54fcd7..f66669b5a 100755 --- a/at/at3500a.h +++ b/at/at3500a.h @@ -13,3 +13,6 @@ #define F_DATAINI 301 #define F_DATAFIN 302 #define F_PRIMEDON 303 +#define F_SUDDIVISA 304 +#define F_PUNTO 305 +#define F_D_PUNTO 306 diff --git a/at/at3500a.uml b/at/at3500a.uml index 6a160f0a2..027d83b7f 100755 --- a/at/at3500a.uml +++ b/at/at3500a.uml @@ -1,6 +1,6 @@ #include "at3500a.h" -PAGE "Riepilogo giornaliero donazioni" -1 -1 78 12 +PAGE "Riepilogo giornaliero donazioni" -1 -1 78 15 GROUPBOX DLG_NULL 77 4 BEGIN @@ -117,7 +117,7 @@ BEGIN HELP "Sottogruppo finale" END -GROUPBOX DLG_NULL 77 4 +GROUPBOX DLG_NULL 77 8 BEGIN PROMPT 1 5 "Opzioni per il riepilogo" END @@ -139,6 +139,38 @@ BEGIN PROMPT 2 7 "Riepilogo per prime donazioni" END +RADIOBUTTON F_SUDDIVISA 75 +BEGIN + FLAG "Z" + PROMPT 2 8 "Stampa per" + ITEM "S|Sezione/Sottogruppo" + MESSAGE CLEAR, F_PUNTO + MESSAGE DISABLE, F_PUNTO + ITEM "P|Punto di prelievo" + MESSAGE ENABLE, F_PUNTO +END + +STRING F_PUNTO 4 +BEGIN + PROMPT 2 11 "Punto " + FLAGS "U" + USE LDN + INPUT CODTAB F_PUNTO + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@40" S0 + OUTPUT F_PUNTO CODTAB + OUTPUT F_D_PUNTO S0 + CHECKTYPE NORMAL + WARNING "Codice punto di prelievo non presente" + HELP "Punto di prelievo" +END + +STRING F_D_PUNTO 50 +BEGIN + PROMPT 15 11 "" + FLAGS "D" +END + BUTTON DLG_OK 9 2 BEGIN PROMPT -12 -1 ""