From f41ad98528506b42ce5d2f7d493aad882adfe014 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Mon, 5 Jun 2023 14:54:26 +0200 Subject: [PATCH] Patch level : 12.00 1264 Files correlati : lv0.exe lv2.exe Commento : Invio postino con ODBC --- src/lv/lv0400.cpp | 111 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 110 insertions(+), 1 deletion(-) diff --git a/src/lv/lv0400.cpp b/src/lv/lv0400.cpp index a0c1e6d6e..2be8c1cc4 100755 --- a/src/lv/lv0400.cpp +++ b/src/lv/lv0400.cpp @@ -968,6 +968,9 @@ protected: bool elimina_planning(const long& codcont, const long& codcf) const; bool kill_planning (TISAM_recordset& selrighe) const; bool menu(MENU_TAG mt); + + virtual void ini2sheet(TConfig& ini, TSheet_field &sheet); + virtual void sheet2ini(TSheet_field &sheet, TConfig& ini); }; //SAVE_ROWS: questo metodo salva effettivamente le righe vislualizzate sullo sheet sul file @@ -1168,7 +1171,7 @@ int TContratti_app::read(TMask& m) TISAM_recordset righeset(build_query(m)); const TRectype& rec = righeset.cursor()->curr(); - //instanzio un TLcalisamfile su LF_CLIFOGIAC + //instanzio un TLocalisamfile su LF_CLIFOGIAC TLocalisamfile magcli(LF_CLIFOGIAC); //setto alcune variabili di interesse @@ -1269,6 +1272,7 @@ int TContratti_app::rewrite(const TMask& m) bool TContratti_app::protected_record(TRectype & rec) { TLaundry_contract cont(rec); + return !cont.can_be_deleted(); } @@ -1440,6 +1444,111 @@ bool TContratti_app::menu(MENU_TAG mt) return ok; } +void TContratti_app::ini2sheet(TConfig& ini, TSheet_field &sheet) +{ + const int lognum = LF_LVRCONDV; + const TMask& sm = sheet.sheet_mask(); + TString16 defpar; // scrive le righe nello sheet associato + + for (int r = 1; ; r++) + { + bool found = false; + + defpar.format("%d,%d", lognum, r); + for (int i = 0; i < 3 && !(found = ini.set_paragraph(defpar)); i++) + { + const int pos = defpar.find(','); + + if (pos > 0) + defpar.insert("0", pos + 1); + } + if (found) + { + TToken_string& row = sheet.row(r - 1); + for (int sf = sm.fields() - 1; sf >= 0; sf--) + { + TMask_field& campo = sm.fld(sf); + const TFieldref* fref = campo.field(); + if (fref) + { + const TString& str = fref->read(ini, defpar); + row.add(str, sheet.cid2index(campo.dlg())); + } + } + sheet.check_row(r - 1); + } + else + break; + } +} + +void TContratti_app::sheet2ini(TSheet_field &sheet, TConfig& ini) +{ + const int lognum = LF_LVRCONDV; + const TMask& sm = sheet.sheet_mask(); + const TMask & m = sheet.mask(); + TString16 defpar; // scrive le righe degli sheet associati + TString str; + int r; + + for (r = 1; r <= sheet.items(); r++) + { + bool found = false; + + defpar.format("%d,%d", lognum, r); + for (int i = 0; i < 3 && !(found = ini.set_paragraph(defpar)); i++) + { + const int pos = defpar.find(','); + + if (pos > 0) + defpar.insert("0", pos + 1); + } + if (found) + if (ini.set_paragraph(defpar)) + ini.remove_all(); + defpar.format("%d,%04d", lognum, r); + + const TFieldref* fcli = m.field(F_CODCF).field(); + const TFieldref* fcont = m.field(F_CODCONT).field(); + + fcli->write(ini, defpar, m.get(F_CODCF)); + fcont->write(ini, defpar, m.get(F_CODCONT)); + TToken_string& row = sheet.row(r - 1); + const char* value; + int i; + + for (i = 0, value = row.get(0); value; i++, value = row.get()) + { + const TMask_field& campo = sm.field(FIRST_FIELD + i); + const TFieldref* fr = campo.field(); + if (fr) + { + if (value == nullptr || *value == '\0') + value = " "; + // ini.set(fr->name(), value, defpar); + fr->write(ini, defpar, value); + } + } + } + for (r = sheet.items() + 1; ; r++) + { + defpar.format("%d,%d", lognum, r); + bool found = false; + + defpar.format("%d,%d", lognum, r); + for (int i = 0; i < 3 && !(found = ini.set_paragraph(defpar)); i++) + { + const int pos = defpar.find(','); + + if (pos > 0) + defpar.insert("0", pos + 1); + } + if (ini.set_paragraph(defpar)) + ini.remove_all(); + else + break; + } +} int lv0400(int argc, char* argv[]) {