diff --git a/src/m770/777200.cpp b/src/m770/777200.cpp index 6200efeac..948bf968e 100755 --- a/src/m770/777200.cpp +++ b/src/m770/777200.cpp @@ -1016,6 +1016,18 @@ TTrasferimentoCU::TTrasferimentoCU(const char* path, char mode) TTrasferimentoCU::~TTrasferimentoCU() { } + +HIDDEN bool key_handler(TMask& m, KEY k) +{ + // Per ora facciamo che il SHIFT+F12 attiva sempre il campo 3 + if (k == K_SHIFT + K_F12) + { + m.reset(F_TESTEMAIL); + m.show(F_TESTEMAIL, !m.field(F_TESTEMAIL).shown()); + } + return true; +} + /////////////////////////////////////////////////////////// // TCU_mask /////////////////////////////////////////////////////////// @@ -1026,7 +1038,7 @@ protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); public: - TInvio_CU_mask() : TAutomask("777200c") {} + TInvio_CU_mask() : TAutomask("777200c") { set_handler(key_handler); } }; bool TInvio_CU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) @@ -1056,7 +1068,7 @@ protected: void fill_row(TMask & m, const char * tipoa, long percip); public: - TCU_mask() : TAutomask("777200a") {} + TCU_mask() : TAutomask("777200a") { } }; void TCU_mask::fill_row(TMask & m, const char * tipoa, long percip) @@ -1106,6 +1118,7 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) TFilename f = o.get(); f.add(CU_DEFAULT_NAME); enable(DLG_PREVIEW, f.exist()); + enable(DLG_EMAIL, f.exist()); } break; case DLG_PREVIEW: @@ -1172,6 +1185,7 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) fill_row(m, tipoa, percip); 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)) @@ -1181,13 +1195,14 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) email = sh.get_str_row_cell(r, S_EMAIL); TString query; + query.format("USE %d SELECT (ANNO=%d)&&(TIPOA==\"%s\")&&(CODANAGR==%ld)\nBY TIPOA CODANAGR CAUSALE\nFROM CODDITTA=%ld\nTO CODDITTA=%ld", LF_QUALA, anno, (const char *) tipoa, percip, codditta, codditta); TISAM_recordset perc(query); TString ragsoc = sh.get_str_row_cell(r, S_RAGSOC); - send_cu(perc, quality, simple, anno, tipoa, percip, email, ragsoc, log); + send_cu(perc, quality, simple, anno, tipoa, percip, email, m.get(F_CCNEMAIL), ragsoc, m.get_bool(F_RECEIPT), log); } } } @@ -1195,7 +1210,8 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) } else cantread_box(tmp); - log.print_or_preview(); + if (log.rows() > 0) + log.print_or_preview(); return false; // don't close mask } break; diff --git a/src/m770/777200.h b/src/m770/777200.h index 2679eee53..191a3dda9 100644 --- a/src/m770/777200.h +++ b/src/m770/777200.h @@ -86,7 +86,8 @@ 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 * ragsoc, 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, 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/777200c.h b/src/m770/777200c.h index 58fda9f12..6c3444818 100644 --- a/src/m770/777200c.h +++ b/src/m770/777200c.h @@ -1,4 +1,7 @@ #define F_SHEET 201 +#define F_CCNEMAIL 202 +#define F_RECEIPT 203 +#define F_TESTEMAIL 204 #define S_SELECTED 101 #define S_EMAIL 102 diff --git a/src/m770/777200c.uml b/src/m770/777200c.uml index fd86a12cf..ad17d27ff 100644 --- a/src/m770/777200c.uml +++ b/src/m770/777200c.uml @@ -20,9 +20,25 @@ ENDPAGE PAGE "Invio Certificazione unica" 0 2 0 0 +STRING F_CCNEMAIL 50 +BEGIN + PROMPT 1 1 "Email conoscenza " +END + +BOOLEAN F_RECEIPT +BEGIN + PROMPT 70 1 "Ricevuta" +END + +STRING F_TESTEMAIL 50 +BEGIN + PROMPT 1 2 "Email prova " + FLAGS "H" +END + SPREADSHEET F_SHEET -1 -1 BEGIN - PROMPT 0 2 "" + PROMPT 0 4 "" ITEM "@1" ITEM "Email@50" ITEM "Tipo" diff --git a/src/m770/777201.cpp b/src/m770/777201.cpp index 0584a20c7..708b4101a 100644 --- a/src/m770/777201.cpp +++ b/src/m770/777201.cpp @@ -924,7 +924,7 @@ 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 * ragsoc, 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, TLog_report & log) { TCU_report cur(quality, syntetic, true); TFilename datafile; @@ -951,15 +951,15 @@ void send_cu(TISAM_recordset& perc, int quality, bool syntetic, int anno, const b.export_pdf(pdf, false); - TToken_string to(email, ';'), cc("", ';'), ccn("", ';'), attachment(pdf, ';'); + TToken_string to(email, ';'), cc("", ';'), ccn(ccnemail, ';'), attachment(pdf, ';'); TString msg("Invio a "); TString subj("Certificazione unica anno "); TString message("Certificazione anno "); subj << anno + 1; - message << anno + 1 << " di " << ragsoc; + message << anno + 1 << " di " << ragsoc << " (" << email << ")"; msg << email; - if (!send_mail(to, cc, ccn, subj, message, attachment)) + 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);