Patch level : 12.0 1048

Files correlati     : 777.exe 777200a.msk 777200c.msk f20.trr f20.dir
Commento        :

Invio Certificazione unica per email
This commit is contained in:
Alessandro Bonazzi 2021-04-01 01:01:10 +02:00
parent 2221c7ba10
commit f3a8ba10fb
5 changed files with 46 additions and 10 deletions

View File

@ -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)
@ -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,6 +1210,7 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
}
else
cantread_box(tmp);
if (log.rows() > 0)
log.print_or_preview();
return false; // don't close mask
}

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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);