diff --git a/at/at0300.cpp b/at/at0300.cpp index 87bd2a029..9ccc22d8b 100755 --- a/at/at0300.cpp +++ b/at/at0300.cpp @@ -55,7 +55,7 @@ protected: bool check_sog_sheet(const char* codsog); static bool nome_handler(TMask_field& f, KEY k); static bool codice_handler(TMask_field& f, KEY k); - //static bool tipocon_handler(TMask_field& f, KEY k); + static bool tipocon_handler(TMask_field& f, KEY k); static bool soggetti_notify(TSheet_field& s, int r, KEY k); void add_rows_soggetti(TSheet_field& s, int count = 20, int start = 0); @@ -95,7 +95,7 @@ bool TGiornalieroC::create() ss.sheet_mask().set_handler(F_S_NOME,nome_handler); ss.sheet_mask().set_handler(F_S_CODICE,codice_handler); - //ss.sheet_mask().set_handler(F_S_TIPOCON,tipocon_handler); + ss.sheet_mask().set_handler(F_S_TIPOCON,tipocon_handler); dispatch_e_menu(BAR_ITEM(1)); @@ -224,9 +224,9 @@ int TGiornalieroC::write(TSheet_field& s) recc->put(CON_DATACON, datagen); recc->put(CON_TIPOCON, tipocon); recc->put(CON_IDON1, idon1); - recc->put(CON_IDON1, idon2); - recc->put(CON_IDON1, idon3); - recc->put(CON_IDON1, idon4); + recc->put(CON_IDON2, idon2); + recc->put(CON_IDON3, idon3); + recc->put(CON_IDON4, idon4); recc->put(CON_INTSI, intsi); recc->put(CON_INTAF, intaf); recc->put(CON_PROSSTIPO, prosstipo); @@ -431,6 +431,16 @@ bool TGiornalieroC::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)); + TString16 tipogen = app()._msk->get(F_TIPOCON); + if (tipogen == "ID") + { + m.set(F_S_IDON1, sog.get(SOG_IDON1)); + m.set(F_S_IDON2, sog.get(SOG_IDON2)); + m.set(F_S_IDON3, sog.get(SOG_IDON3)); + m.set(F_S_IDON4, sog.get(SOG_IDON4)); + m.set(F_S_INTSI, sog.get(SOG_INTSI)); + m.set(F_S_INTAF, sog.get(SOG_INTAF)); + } } else ok = FALSE; // codice non esistente @@ -439,65 +449,47 @@ bool TGiornalieroC::codice_handler(TMask_field& f, KEY k) return ok; } -/* bool TGiornalieroC::tipocon_handler(TMask_field& f, KEY k) { - bool ok = TRUE; - if (k == K_TAB && !f.focusdirty()) + bool ok = TRUE; + //if (k == K_TAB && !f.focusdirty()) + if ((k==K_TAB) && (f.to_check(k))) { - const TString16 tipo = m.get(F_S_TIPOCON); + TMask& m = f.mask(); + TString16 tipo = m.get(F_S_TIPOCON); + if (tipo.empty()) + tipo = app()._msk->get(F_TIPOCON); const char modstato = modstato_tcs(tipo); if ( modstato == 'I' || modstato == 'M') - { - m.field(F_S_IDON1).enable(); - m.field(F_S_IDON2).enable(); - m.field(F_S_IDON3).enable(); - m.field(F_S_IDON4).enable(); - m.field(F_S_INTSI).disable(); - m.field(F_S_INTAF).disable(); - const TString16 idon1 = m.get(F_S_IDON1); - const TString16 idon2 = m.get(F_S_IDON2); - const TString16 idon3 = m.get(F_S_IDON3); - const TString16 idon4 = m.get(F_S_IDON4); - if (is_idon(idon1,idon2,idon3,idon4,IDON_SI)) - m.field(F_S_INTSI).enable(); - else - m.field(F_S_INTSI).reset(); - if (is_idon(idon1,idon2,idon3,idon4,IDON_AF)) - m.field(F_S_INTAF).enable(); - else - m.field(F_S_INTAF).reset(); + { + TString16 idon1 = m.get(F_S_IDON1); + TString16 idon2 = m.get(F_S_IDON2); + TString16 idon3 = m.get(F_S_IDON3); + TString16 idon4 = m.get(F_S_IDON4); + // propongo i dati precedenti per idoneita' if (idon1.empty() && idon2.empty() && idon3.empty() && idon4.empty()) { - const TMask& mask = *(app().get_mask()); - m.set(F_S_IDON1,mask.get(F_IDON1)); - m.set(F_S_IDON2,mask.get(F_IDON2)); - m.set(F_S_IDON3,mask.get(F_IDON3)); - m.set(F_S_IDON4,mask.get(F_IDON4)); - m.set(F_S_INTSI,mask.get(F_INTSI)); - m.set(F_S_INTAF,mask.get(F_INTAF)); - } - } - else - { - m.field(F_S_IDON1).reset(); - m.field(F_S_IDON1).disable(); - m.field(F_S_IDON2).reset(); - m.field(F_S_IDON2).disable(); - m.field(F_S_IDON3).reset(); - m.field(F_S_IDON3).disable(); - m.field(F_S_IDON4).reset(); - m.field(F_S_IDON4).disable(); - m.field(F_S_INTSI).reset(); - m.field(F_S_INTSI).disable(); - m.field(F_S_INTAF).reset(); - m.field(F_S_INTAF).disable(); - } + TLocalisamfile& sog = app().get_relation()->lfile(); + sog.setkey(1); + sog.zero(); + sog.put(SOG_CODICE, m.get_long(F_S_CODICE)); + int err = sog.read(); + if (err == NOERR) + { + m.set(F_S_IDON1,sog.get(SOG_IDON1)); + m.set(F_S_IDON2,sog.get(SOG_IDON2)); + m.set(F_S_IDON3,sog.get(SOG_IDON3)); + m.set(F_S_IDON4,sog.get(SOG_IDON4)); + m.set(F_S_INTSI,sog.get(SOG_INTSI)); + m.set(F_S_INTAF,sog.get(SOG_INTAF)); + } + } + } } return TRUE; } -*/ + int at0300(int argc, char* argv[]) {