From f3ab5bca70ae51e1447bd6492d1094ae8ef182c2 Mon Sep 17 00:00:00 2001 From: cris <cris@c028cbd2-c16b-5b4b-a496-9718f37d4682> Date: Tue, 20 Jul 2004 12:00:26 +0000 Subject: [PATCH] Patch level : 1.7 at Files correlati : at1200a.msk at1.exe Ricompilazione Demo : [ ] Commento : attribuzione complessiva benemerenze: possibilita di fare la stampa dell ben. previste (chiesto da Luzzara) git-svn-id: svn://10.65.10.50/trunk@12249 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- at/at1200.cpp | 87 +++++++++++++++++++++++++++++++++++++++++--------- at/at1200a.h | 1 + at/at1200a.uml | 24 +++++++++----- 3 files changed, 89 insertions(+), 23 deletions(-) diff --git a/at/at1200.cpp b/at/at1200.cpp index e0ada3e8d..6b253e969 100755 --- a/at/at1200.cpp +++ b/at/at1200.cpp @@ -39,11 +39,13 @@ class TAttribuzioneBenemerenze : public TPrintapp TString16 _gruppoazie, _oldben; int _bonus; TDate _dataela, _datapre; - bool _attgruppi,_anchegruppi; + bool _attgruppi,_anchegruppi, _prevista; bool _definitiva; TParagraph_string _cognome_nome; + int _numdon; int _contatore; int _progope; + protected: virtual bool user_create(); virtual bool user_destroy(); @@ -84,7 +86,7 @@ void TAttribuzioneBenemerenze::postclose_print() } bool TAttribuzioneBenemerenze::preprocess_page(int file, int counter) -{ +{ if (file==LF_ATROPERA) { TRectype& recsog = current_cursor()->curr(LF_SOGGETTI); @@ -92,6 +94,35 @@ bool TAttribuzioneBenemerenze::preprocess_page(int file, int counter) nome << " "; nome << recsog.get(SOG_NOME); _cognome_nome = nome; + + if (_prevista) + { + int numdon = recsog.get_int(SOG_TOTDON); + if (_prevista) + { + // aggiungo le donazioni che puo' fare da oggi alla data elaborazione + const TDate oggi(TODAY); + const long giorni = _dataela - oggi; + int intervallo = 0; + if (giorni > 0) + { + const int intsi = recsog.get_int(SOG_INTSI); + const int intaf = recsog.get_int(SOG_INTAF); + if (intsi == 0) + intervallo = intaf; + else + { + if (intaf == 0) + intervallo = intsi; + else + intervallo = min(intsi, intaf); + } + if (intervallo > 0) + numdon = numdon + int(giorni / intervallo); + } + } + _numdon = numdon; + } // salto pagina se cambio benemerenza const TString16 tipoben = current_cursor()->curr().get(ROP_S0); if (tipoben!=_oldben) @@ -140,6 +171,8 @@ void TAttribuzioneBenemerenze::set_page(int file, int cnt) set_row(1,"@26g@S", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(1,"@29g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS)); set_row(1,"@39g@pn", FLD(LF_SOGGETTI,SOG_TOTDON,"###")); + if (_prevista) + set_row(1,"@48g#3d", &_numdon); } else set_row(1,""); @@ -164,7 +197,8 @@ bool TAttribuzioneBenemerenze::set_print(int) if (tasto == K_ENTER) { _oldben = "**"; - _contatore = 0; + _contatore = 0; + _prevista = (_msk->get(F_SITUAZIONE)[0] == 'P'); _dataela = _msk->get(F_DATAELA); _datapre = _msk->get(F_DATAPRE); _attgruppi = _msk->get_bool(F_ATTGRUPPI); @@ -241,10 +275,6 @@ bool TAttribuzioneBenemerenze::set_print(int) atopera.put(OPE_TIPOOPE,'B'); atopera.write(); TLocalisamfile atropera(LF_ATROPERA); - // cancelliamo l'elaborazione precedente - // NO! non la cancelliamo piu' cosi' perche ci possono essere le righe di altre elaborazioni (es. tessere!) - //for (atropera.first(); !atropera.eof(); atropera.next()) - // atropera.remove(); TRectype& sog = _cur->curr(); long last = _cur->items(); _benem->setkey(3); @@ -270,11 +300,6 @@ bool TAttribuzioneBenemerenze::set_print(int) { int precsi = sog.get_int(SOG_DONPRECSI); int precaf = sog.get_int(SOG_DONPRECAF); - //int numdon = 0; - //if (precsi!=0) - //numdon = numdon+precsi; - //if (precaf!=0) - // numdon = numdon+precaf; int numdon = precsi + precaf; for (int r=1; r<=_sdonazioni->rows(); r++) { @@ -283,6 +308,29 @@ bool TAttribuzioneBenemerenze::set_print(int) if (datadon<=_dataela) numdon++; } + if (_prevista) + { + // aggiungo le donazioni che puo' fare da oggi alla data elaborazione + const TDate oggi(TODAY); + const long giorni = _dataela - oggi; + int intervallo = 0; + if (giorni > 0) + { + const int intsi = sog.get_int(SOG_INTSI); + const int intaf = sog.get_int(SOG_INTAF); + if (intsi == 0) + intervallo = intaf; + else + { + if (intaf == 0) + intervallo = intsi; + else + intervallo = min(intsi, intaf); + } + if (intervallo > 0) + numdon = numdon + int(giorni / intervallo); + } + } TString16 ultben = "**"; TRectype* key = new TRectype(LF_BENEM); key->put(BEN_CODICE, codice); @@ -314,7 +362,6 @@ bool TAttribuzioneBenemerenze::set_print(int) if (numdon >= bonus) { // controllo che non abbia ricevuto la benemerenza - //const char* tipoben = _tabben.get_hashobj()->key(); _benem->zero(); _benem->put(BEN_CODICE, codice); _benem->put(BEN_TIPOBEN, tipoben); @@ -356,6 +403,8 @@ void TAttribuzioneBenemerenze::crea_intestazione() TString sep(132); sep = "ATTRIBUZIONE BENEMERENZE "; + if (_prevista) + sep << " PREVISTE "; if (_definitiva) sep << "DEFINITIVA"; else @@ -371,8 +420,16 @@ void TAttribuzioneBenemerenze::crea_intestazione() sep = ""; sep.fill('-'); set_header(3, (const char *) sep); - set_header(4,"@0gCognome e nome@26gC.@29gTessera@39gTot.don."); - set_header(5,"@0-------------------------@26g--@29g--------@39g--------"); + if (_prevista) + { + set_header(4,"@0gCognome e nome@26gC.@29gTessera@39gTot.don.@48gDon.pre."); + set_header(5,"@0-------------------------@26g--@29g--------@39g--------@48g--------"); + } + else + { + set_header(4,"@0gCognome e nome@26gC.@29gTessera@39gTot.don."); + set_header(5,"@0-------------------------@26g--@29g--------@39g--------"); + } } bool TAttribuzioneBenemerenze::user_create() diff --git a/at/at1200a.h b/at/at1200a.h index bc0eadce5..4f1b5b00a 100755 --- a/at/at1200a.h +++ b/at/at1200a.h @@ -19,6 +19,7 @@ #define F_CAT6 211 #define F_D_CAT6 212 +#define F_SITUAZIONE 308 #define F_DATAELA 309 #define F_DATAPRE 310 #define F_ATTGRUPPI 311 diff --git a/at/at1200a.uml b/at/at1200a.uml index 4bf5541f4..307062b9d 100755 --- a/at/at1200a.uml +++ b/at/at1200a.uml @@ -201,34 +201,42 @@ BEGIN FLAGS "D" END -GROUPBOX DLG_NULL 77 8 +GROUPBOX DLG_NULL 77 9 BEGIN PROMPT 1 9 "Opzioni per l'attribuzione" END +LISTBOX F_SITUAZIONE 10 +BEGIN + PROMPT 2 10 "Situazione " + FLAGS "U" + ITEM "A|Attuale" + ITEM "P|Prevista" +END + DATE F_DATAELA BEGIN - PROMPT 2 10 "Data elaborazione " + PROMPT 2 11 "Data elaborazione " CHECKTYPE REQUIRED HELP "Data di riferimento per l'attribuzione delle benemerenze" END DATE F_DATAPRE BEGIN - PROMPT 2 11 "Data prevista consegna " + PROMPT 2 12 "Data prevista consegna " HELP "Data di prevista consegna" END BOOLEAN F_ATTGRUPPI BEGIN - PROMPT 2 12 "Attribuzione fatta dai gruppi aziendali" + PROMPT 2 13 "Attribuzione fatta dai gruppi aziendali" MESSAGE TRUE ENABLE,1@|RESET,F_ANCHEGRUPPI|DISABLE,F_ANCHEGRUPPI MESSAGE FALSE RESET,1@|DISABLE,1@|ENABLE,F_ANCHEGRUPPI END STRING F_GRUPPOAZIE 4 BEGIN - PROMPT 2 13 "Gruppo az. che attribuisce " + PROMPT 2 14 "Gruppo az. che attribuisce " FLAGS "U" USE GAZ INPUT CODTAB F_GRUPPOAZIE @@ -246,7 +254,7 @@ END STRING F_D_GRUPPOAZIE 30 BEGIN - PROMPT 37 13 "" + PROMPT 37 14 "" FLAGS "U" USE GAZ KEY 2 INPUT S0 F_D_GRUPPOAZIE @@ -261,12 +269,12 @@ END BOOLEAN F_ANCHEGRUPPI BEGIN - PROMPT 2 14 "Includi soggetti appartenenti a gruppi aziendali" + PROMPT 2 15 "Includi soggetti appartenenti a gruppi aziendali" END BOOLEAN F_DEFINITIVA BEGIN - PROMPT 2 15 "Attribuzione definitiva" + PROMPT 2 16 "Attribuzione definitiva" HELP "Se attribuzione definitiva, le benemerenze stampate verranno registrate" END