diff --git a/src/m770/777200.cpp b/src/m770/777200.cpp index 948bf968e..7a971b9ee 100755 --- a/src/m770/777200.cpp +++ b/src/m770/777200.cpp @@ -650,6 +650,7 @@ bool TTrasferimentoCU::append_record_d(const TRectype& qla, TLog_report& log) rec.set(11, false); // Conferma singola certificazione const TAnagrafica sost(LF_NDITTE, _cod_ditta); + rec.np_put("DA001001", cod_fis_dic()); if (sost.fisica()) { @@ -1073,32 +1074,37 @@ public: void TCU_mask::fill_row(TMask & m, const char * tipoa, long percip) { - TSheet_field & sh = m.sfield(F_SHEET); - const int nrow = sh.set_row_cell(S_SELECTED, !ini_get_bool(CONFIG_DITTA, "CU", format("%1s%6ld", tipoa, percip))); + const bool da_inviare = !ini_get_bool(CONFIG_DITTA, "CU", format("%1s%6ld", tipoa, percip)); - sh.set_row_cell(S_TIPOA, tipoa, nrow); - sh.set_row_cell(S_CODANAGR, percip, nrow); + if (da_inviare || get_bool(F_INVIATE)) + { + TSheet_field & sh = m.sfield(F_SHEET); + const int nrow = sh.set_row_cell(S_SELECTED, da_inviare); - TToken_string key(tipoa); - TString email; + sh.set_row_cell(S_TIPOA, tipoa, nrow); + sh.set_row_cell(S_CODANAGR, percip, nrow); - key.add(percip); + TToken_string key(tipoa); + TString email; - const TRectype & cli = cache().get(LF_CLIFO, key, 7); + key.add(percip); - email = cli.get(CLI_PEC); - if (email.blank()) - email = cli.get(CLI_MAIL); - if (email.blank()) - email = cli.get(CLI_DOCMAIL); - if (email.blank()) - sh.set_row_cell(S_SELECTED, false, nrow); - sh.set_row_cell(S_EMAIL, email, nrow); + const TRectype & cli = cache().get(LF_CLIFO, key, 7); - TString ragsoc = cache().get(LF_ANAG, key, ANA_RAGSOC); + email = cli.get(CLI_PEC); + if (email.blank()) + email = cli.get(CLI_MAIL); + if (email.blank()) + email = cli.get(CLI_DOCMAIL); + if (email.blank()) + sh.set_row_cell(S_SELECTED, false, nrow); + sh.set_row_cell(S_EMAIL, email, nrow); - ragsoc.strip_double_spaces(); - sh.set_row_cell(S_RAGSOC, ragsoc, nrow); + TString ragsoc = cache().get(LF_ANAG, key, ANA_RAGSOC); + + ragsoc.strip_double_spaces(); + sh.set_row_cell(S_RAGSOC, ragsoc, nrow); + } } bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) @@ -1143,7 +1149,7 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) { TFilename tmp = get(F_PATH); TLog_report log("Invio certificazione unica"); - + tmp.add(CU_DEFAULT_NAME); if (tmp.exist()) { @@ -1157,11 +1163,13 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) TString email; TString4 tipoa; long percip; + const long save_ditta = main_app().get_firm(); for (long codditta = daditta; codditta <= aditta; codditta++) { TString query; + main_app().set_firm(codditta); query.format("USE %d SELECT (ANNO=%d)\nBY TIPOA CODANAGR CAUSALE\nFROM CODDITTA=%ld\nTO CODDITTA=%ld", LF_QUALA, anno, codditta, codditta); @@ -1178,6 +1186,8 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) { last_tipoa = tipoa; last_percip = percip; + if (get_bool(F_RESET)) + ini_set_bool(CONFIG_DITTA, "CU", format("%1s%6ld", (const char *)tipoa, percip), false); fill_row(m, tipoa, percip); } } @@ -1186,6 +1196,7 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) if (m.run() == K_ENTER) { set_test_mail(m.get(F_TESTEMAIL)); + FOR_EACH_SHEET_ITEM(sh, r) { if (sh.get_bool_row_cell(r, S_SELECTED)) @@ -1202,11 +1213,13 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) TISAM_recordset perc(query); TString ragsoc = sh.get_str_row_cell(r, S_RAGSOC); - send_cu(perc, quality, simple, anno, tipoa, percip, email, m.get(F_CCNEMAIL), ragsoc, m.get_bool(F_RECEIPT), log); + send_cu(perc, quality, simple, anno, tipoa, percip, email, m.get(F_CCNEMAIL), ragsoc, + m.get_bool(F_RECEIPT), m.get(F_TESTEMAIL).full(), log); } } } } + main_app().set_firm(save_ditta); } else cantread_box(tmp); @@ -1252,6 +1265,7 @@ void TCU_app::main_loop() // Eseguo controllo adeguamento database 2017 isUpdated(); + m.reset(F_RESET); while (m.run() == K_ENTER) { diff --git a/src/m770/777200.h b/src/m770/777200.h index 191a3dda9..acc8fb515 100644 --- a/src/m770/777200.h +++ b/src/m770/777200.h @@ -87,7 +87,7 @@ public: void print_cu(const TFilename& datafile, int quality, bool simple); void send_cu(TISAM_recordset& perc, int quality, bool syntetic, int anno, const char * tipoa, long percip, - const char * email, const char * ccnemail, const char * ragsoc, bool receipt, TLog_report & log); + const char * email, const char * ccnemail, const char * ragsoc, bool receipt, bool test, TLog_report & log); void edit_cu(const TFilename& datafile, int quality, bool simple); #endif \ No newline at end of file diff --git a/src/m770/777200a.h b/src/m770/777200a.h index 77a093320..72244ebd0 100644 --- a/src/m770/777200a.h +++ b/src/m770/777200a.h @@ -9,7 +9,9 @@ #define F_INVIO 115 #define F_IDENTIFICATIVO 116 - +#define F_INVIATE 117 +#define F_RESET 118 + #define F_INTER_CODFIS 120 #define F_INTER_RAGSOC 121 #define F_INTER_DATA 122 diff --git a/src/m770/777200a.uml b/src/m770/777200a.uml index 0e53031d0..64054e152 100644 --- a/src/m770/777200a.uml +++ b/src/m770/777200a.uml @@ -130,7 +130,7 @@ BEGIN FLAGS "D" END -GROUPBOX DLG_NULL 78 3 +GROUPBOX DLG_NULL 78 4 BEGIN PROMPT 1 11 "@bParametri di stampa" END @@ -145,14 +145,25 @@ BEGIN PROMPT 42 12 "Modello sintetico" END +BOOLEAN F_INVIATE +BEGIN + PROMPT 2 13 "Visualizza le certificazioni inviate" +END + + +BOOLEAN F_RESET +BEGIN + PROMPT 42 13 "Azzera Invio" +END + GROUPBOX DLG_NULL 78 4 BEGIN - PROMPT 1 14 "@bParametri di invio" + PROMPT 1 15 "@bParametri di invio" END LIST F_INVIO 1 12 BEGIN - PROMPT 2 15 "Tipo operazione " + PROMPT 2 16 "Tipo operazione " ITEM " |Normale" MESSAGE DISABLE,F_IDENTIFICATIVO ITEM "A|Annullamento" MESSAGE ENABLE,F_IDENTIFICATIVO ITEM "S|Sostituzione" MESSAGE ENABLE,F_IDENTIFICATIVO @@ -160,7 +171,7 @@ END STRING F_IDENTIFICATIVO 17 BEGIN - PROMPT 2 16 "Identificativo invio " + PROMPT 2 17 "Identificativo invio " FLAGS "RZ" CHECKTYPE REQUIRED END diff --git a/src/m770/777201.cpp b/src/m770/777201.cpp index 708b4101a..eddca3ec0 100644 --- a/src/m770/777201.cpp +++ b/src/m770/777201.cpp @@ -1,7 +1,9 @@ #include "777200.h" +#include #include #include #include +#include #include #include @@ -924,7 +926,8 @@ void print_cu(const TFilename& datafile, int quality, bool syntetic) xvtil_statbar_set(NULL); } -void send_cu(TISAM_recordset& perc, int quality, bool syntetic, int anno, const char * tipoa, long percip, const char * email, const char * ccnemail, const char * ragsoc, bool receipt, TLog_report & log) +void send_cu(TISAM_recordset& perc, int quality, bool syntetic, int anno, const char * tipoa, long percip, + const char * email, const char * ccnemail, const char * ragsoc, bool receipt, bool test, TLog_report & log) { TCU_report cur(quality, syntetic, true); TFilename datafile; @@ -938,7 +941,9 @@ void send_cu(TISAM_recordset& perc, int quality, bool syntetic, int anno, const pdf.temp("cu", "pdf"); { TTrasferimentoCU t(datafile, 'w'); + const TRectype & base = cache().get(LF_BASE, format("|%ld", main_app().get_firm())); + t.read_codfis_dic(base); for (bool ok = perc.move_first(); ok; ok = perc.move_next()) { t.append_record_d(rec, log); @@ -962,7 +967,8 @@ void send_cu(TISAM_recordset& perc, int quality, bool syntetic, int anno, const if (!send_mail(to, cc, ccn, subj, message, attachment, false, receipt)) msg << " non "; else - ini_set_bool(CONFIG_DITTA, "CU", format("%1s%6ld", (const char *)tipoa, percip), true); + if (!test && to.full()) + ini_set_bool(CONFIG_DITTA, "CU", format("%1s%6ld", (const char *)tipoa, percip), true); msg << " riuscito"; log.log(0, msg); xvtil_statbar_set(NULL);