From 5a42e7550c0b00bab6caae10c7c9f90ab9c1ab90 Mon Sep 17 00:00:00 2001 From: cris Date: Wed, 24 Mar 1999 10:32:39 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : Visualizza messaggio anche se inserisco una donaziione con data <= ultima donazione del soggetto git-svn-id: svn://10.65.10.50/trunk@7965 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- at/at0200.cpp | 97 ++++++--------------------------------------------- 1 file changed, 10 insertions(+), 87 deletions(-) diff --git a/at/at0200.cpp b/at/at0200.cpp index e732aa199..eaa429c82 100755 --- a/at/at0200.cpp +++ b/at/at0200.cpp @@ -343,7 +343,6 @@ int TGiornalieroDC::write(TSheet_field& s) { TRectype* recc = new TRectype(LF_CONTSAN); recc->put(CON_CODICE, row.get(0)); - //recc->put(CON_DATACON, _datadon); recc->put(CON_DATACON, datadonazione); recc->put(CON_TIPOCON, tipocon); if (modstato_tcs(tipocon) == 'I') @@ -459,15 +458,8 @@ int TGiornalieroDC::write(TSheet_field& s) } if (!exist) { - //if (insert) - //{ - //err = _sdonazioni->row(_sdonazioni->rows()).write(*_donaz); - //} - //else - err = _sdonazioni->write(TRUE); - + err = _sdonazioni->write(TRUE); // controllo se è idoneo - bool ctrlsi = FALSE; //devo controllare se è idoneo SI bool ctrlaf = FALSE; //devo controllare se è idoneo AF bool id_si = FALSE; // il soggetto è idoneo per si? @@ -687,12 +679,9 @@ int TGiornalieroDC::write(TSheet_field& s) const int zeroconv = 0; sog.put(SOG_NUMCONV, zeroconv); } - - // controllo la sua categoria // se dimesso diventa della categoria collegata // se non c'e' la categoria collegata ??? - TTable ctd("CTD"); TString16 catdon = sog.get(SOG_CATDON); ctd.put("CODTAB",catdon); @@ -722,7 +711,6 @@ int TGiornalieroDC::write(TSheet_field& s) sog.put(SOG_DATAISC,riga.get(DON_DATADON)); } } - // aggiorno data e utente ultimo aggiornamento const TDate oggi(TODAY); sog.put(SOG_DATAULTAGG,oggi); @@ -738,9 +726,7 @@ int TGiornalieroDC::write(TSheet_field& s) } } } - delete pi; - return NOERR; } @@ -761,12 +747,11 @@ bool TGiornalieroDC::soggetti_notify(TSheet_field& s, int r, KEY k) case K_INS: // richiesta inserimento riga if (app()._ricerca) - { ok = s.error_box("Fase di ricerca: impossibile inserire donazioni"); - //ok = FALSE; - } break; case K_DEL: + // richiesta cancellazione riga + break; case K_CTRL+K_DEL: // avvenuta cancellazione riga break; @@ -803,6 +788,7 @@ bool TGiornalieroDC::soggetti_notify(TSheet_field& s, int r, KEY k) const long codsog = row.get_long(0); const long etichetta = row.get_long(6); if (codsog != 0) + { for (int i=s.items()-1; i>=0; i--) { if (i != r) @@ -836,12 +822,12 @@ bool TGiornalieroDC::soggetti_notify(TSheet_field& s, int r, KEY k) if ((etichetta==etic) && (anno==datadon.year())) return s.sheet_mask().field(F_S_ETICHETTA).error_box("Etichetta sacca gia' inserita"); } } + } else { const char* cognome = row.get(1); if ((cognome != NULL) && (cognome != "\0")) s.sheet_mask().field(F_S_NOME).set_focusdirty(); - //s.set_focus_cell(r,2); } } break; @@ -886,67 +872,9 @@ bool TGiornalieroDC::codice_handler(TMask_field& f, KEY k) m.set(F_S_CODSEZ, sog.get(SOG_CODSEZ)); m.set(F_S_CODSOT, sog.get(SOG_CODSOT)); m.set(F_S_CATDON, sog.get(SOG_CATDON)); - /* - if (!(app()._ricerca)) - { - const int totdon = sog.get_int(SOG_TOTDON); - if (totdon == 0) - m.set(F_S_PRIMADON, 'X'); - if (!app()._nomessage) - { - TTable ctd("CTD"); - ctd.zero(); - ctd.put("CODTAB", sog.get(SOG_CATDON)); - if (ctd.read() == NOERR) - { - bool dimissione = ctd.get_bool("B0"); - if (dimissione) - { - TString16 catcoll = ctd.get("S6"); - if (catcoll.empty()) - messaggio << "Soggetto dimesso senza categoria collegata\n"; - else - messaggio << "Soggetto dimesso, cambio categoria automatico\n"; - } - } - TString16 stato = sog.get(SOG_STATO); - char modstato = modstato_tcs(stato); - if (modstato == 'I' || modstato == 'F') // il soggetto è idoneo - { - TDate datapros(NULLDATE); - TString16 tipodon = app().get_mask().get(F_TIPODON); - TDate datadon = app().get_mask().get_date(F_DATADON); - if (is_donaz(tipodon,IDON_SI)) - datapros = sog.get_date(SOG_DATAPROSSI); - else - datapros = sog.get_date(SOG_DATAPROSAF); - if (datapros.empty()) - messaggio << "Soggetto non idoneo al tipo donazione\n"; - else - if (datapros > datadon) - messaggio << "Il soggetto ha donato prima della scadenza del " << datapros.string() << "\n"; - } - else - { - messaggio << "Stato soggetto " << stato << " non compatibile con la donazione\n"; - TTable tcs("TCS"); - tcs.put("CODTAB",stato); - if (tcs.read() == NOERR) - { - if (tcs.get("S7").empty()) - messaggio << "Verificare la situazione del soggetto"; - else - messaggio << "Cambio stato automatico"; - } - } - } - } - */ } else ok = FALSE; // codice non esistente - //if (messaggio.not_empty() && !app()._ricerca && !app()._nomessage) - // warning_box(messaggio); } } return ok; @@ -969,15 +897,6 @@ bool TGiornalieroDC::tipodon_handler(TMask_field& f, KEY k) int err = sog.read(); if (err == NOERR) { - /* - m.set(F_S_COGNOME, sog.get(SOG_COGNOME)); - m.set(F_S_NOME, sog.get(SOG_NOME)); - m.set(F_S_DATANASC, sog.get(SOG_DATANASC)); - m.set(F_S_TESSAVIS, sog.get(SOG_TESSAVIS)); - m.set(F_S_CODSEZ, sog.get(SOG_CODSEZ)); - m.set(F_S_CODSOT, sog.get(SOG_CODSOT)); - m.set(F_S_CATDON, sog.get(SOG_CATDON)); - */ if (!(app()._ricerca)) { const int totdon = sog.get_int(SOG_TOTDON); @@ -1038,13 +957,17 @@ bool TGiornalieroDC::tipodon_handler(TMask_field& f, KEY k) } } } + else + if (datadon == dataultdon) + messaggio << "Donazione gia' inserita per il soggetto"; + else + messaggio << "Attenzione: donazione precedente all'ultima donazione del soggetto"; } } } else ok = FALSE; // codice non esistente if (messaggio.not_empty() && !app()._ricerca && !app()._nomessage) - //f.message_box(messaggio); warning_box(messaggio); } }