Patch level : 12.00 1382
Files correlati : 777.exe 777200a.msk 777200c.msk Bug : Commento: Certificazione Unica 2025 - Invio forfettari e minimi - invio per email
This commit is contained in:
parent
213b08a83e
commit
22b74f84c6
@ -987,7 +987,7 @@ void TTrasferimentoCU::remove()
|
||||
|
||||
TTrasferimentoCU::TTrasferimentoCU(const char* path, char mode)
|
||||
: _save_headers(true), _data_imp(TODAY), _data_tra(TODAY),
|
||||
_tipo_operazione(' ')
|
||||
_tipo_operazione(' '), _certificazione(0L)
|
||||
{
|
||||
if (mode == 'r')
|
||||
load(path);
|
||||
@ -1008,10 +1008,7 @@ 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;
|
||||
}
|
||||
|
||||
@ -1019,6 +1016,28 @@ HIDDEN bool key_handler(TMask& m, KEY k)
|
||||
// TCU_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
int sort(TSheet_field & s, int r1, int r2)
|
||||
{
|
||||
int key = s.mask().get_int(F_SORT);
|
||||
int res = 0;
|
||||
|
||||
if (key == 1)
|
||||
{
|
||||
int cod1 = s.get_long_row_cell(r1, S_CODANAGR);
|
||||
int cod2 = s.get_long_row_cell(r2, S_CODANAGR);
|
||||
|
||||
res = cod1 - cod2;
|
||||
}
|
||||
else
|
||||
{
|
||||
const TString & rag1 = s.get_str_row_cell(r1, S_RAGSOC);
|
||||
const TString & rag2 = s.get_str_row_cell(r2, S_RAGSOC);
|
||||
|
||||
res = _stricmp(rag1, rag2);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
class TInvio_CU_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
@ -1032,14 +1051,40 @@ bool TInvio_CU_mask::on_field_event(TOperable_field& o, TField_event e, long jol
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case DLG_ALL:
|
||||
case F_SORT:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TSheet_field & sh = sfield(F_SHEET);
|
||||
|
||||
sh.sort(sort);
|
||||
sh.force_update();
|
||||
}
|
||||
break;
|
||||
case F_SHEET:
|
||||
if (e == se_leave)
|
||||
{
|
||||
TSheet_field & sh = (TSheet_field &)o;
|
||||
const int row = jolly;
|
||||
TString email = sh.get_str_row_cell(row, S_EMAIL);
|
||||
const bool on = email.full();
|
||||
|
||||
sh.enable_cell(row, S_SELECTED, on);
|
||||
sh.set_row_cell(S_SELECTED, on, row);
|
||||
sh.force_update(row);
|
||||
}
|
||||
break;
|
||||
case DLG_ALL:
|
||||
if (e == fe_button)
|
||||
{
|
||||
TSheet_field & sh = sfield(F_SHEET);
|
||||
|
||||
FOR_EACH_SHEET_ITEM(sh, nrow)
|
||||
if (*sh.get_str_row_cell(nrow, S_EMAIL) > ' ')
|
||||
sh.set_row_cell(S_SELECTED, !sh.get_bool_row_cell(nrow, S_SELECTED), nrow);
|
||||
FOR_EACH_SHEET_ITEM(sh, nrow)
|
||||
{
|
||||
TString email = sh.get_str_row_cell(nrow, S_EMAIL);
|
||||
|
||||
if (email.full())
|
||||
sh.set_row_cell(S_SELECTED, !sh.get_bool_row_cell(nrow, S_SELECTED), nrow);
|
||||
}
|
||||
sh.force_update();
|
||||
}
|
||||
break;
|
||||
@ -1065,11 +1110,6 @@ void TCU_mask::fill_row(TMask & m, const char * tipoa, long percip)
|
||||
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);
|
||||
|
||||
sh.set_row_cell(S_TIPOA, tipoa, nrow);
|
||||
sh.set_row_cell(S_CODANAGR, percip, nrow);
|
||||
|
||||
TToken_string key(tipoa);
|
||||
TString email;
|
||||
|
||||
@ -1082,9 +1122,14 @@ void TCU_mask::fill_row(TMask & m, const char * tipoa, long percip)
|
||||
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 int nrow = sh.set_row_cell(S_SELECTED, da_inviare && email.full());
|
||||
|
||||
sh.enable_cell(nrow, S_SELECTED, email.full());
|
||||
sh.set_row_cell(S_TIPOA, tipoa, nrow);
|
||||
sh.set_row_cell(S_CODANAGR, percip, nrow);
|
||||
sh.set_row_cell(S_EMAIL, email, nrow);
|
||||
|
||||
TString ragsoc = cache().get(LF_ANAG, key, ANA_RAGSOC);
|
||||
|
||||
@ -1144,14 +1189,14 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
const int anno = get_int(F_ANNO);
|
||||
const long daditta = get_long(F_DADITTA);
|
||||
const long aditta = get_long(F_ADITTA);
|
||||
TInvio_CU_mask m;
|
||||
TSheet_field & sh = m.sfield(F_SHEET);
|
||||
TInvio_CU_mask mail;
|
||||
TSheet_field & sh = mail.sfield(F_SHEET);
|
||||
TString email;
|
||||
TString4 tipoa;
|
||||
long percip;
|
||||
const long save_ditta = main_app().get_firm();
|
||||
|
||||
m.load();
|
||||
mail.load();
|
||||
for (long codditta = daditta; codditta <= aditta; codditta++)
|
||||
{
|
||||
TString query;
|
||||
@ -1175,15 +1220,25 @@ bool TCU_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
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);
|
||||
fill_row(mail, tipoa, percip);
|
||||
}
|
||||
}
|
||||
if (tipoa.full())
|
||||
fill_row(m, tipoa, percip);
|
||||
if (m.run() == K_ENTER)
|
||||
fill_row(mail, tipoa, percip);
|
||||
if (mail.run() == K_ENTER)
|
||||
{
|
||||
set_test_mail(m.get(F_TESTEMAIL));
|
||||
xvt_set_mail_params(nullptr, nullptr, m.get(F_FROMEMAIL), m.get(F_PASSWORD), nullptr);
|
||||
TToken_string cc(mail.get(F_CCEMAIL), ';');
|
||||
TToken_string ccn(mail.get(F_CCNEMAIL), ';');
|
||||
const TString test_mail = mail.get(F_TESTEMAIL);
|
||||
const TString from = mail.get(F_FROMEMAIL);
|
||||
const TString pwd = mail.get(F_PASSWORD);
|
||||
const bool rcpt = mail.get_bool(F_RECEIPT);
|
||||
const TString subj = mail.get(F_SUBJ);
|
||||
const TString msg = mail.get(F_MESSAGE);
|
||||
|
||||
set_test_mail(test_mail);
|
||||
if (from)
|
||||
xvt_set_mail_params(nullptr, nullptr, from, pwd, nullptr);
|
||||
FOR_EACH_SHEET_ITEM(sh, r)
|
||||
{
|
||||
if (sh.get_bool_row_cell(r, S_SELECTED))
|
||||
@ -1200,13 +1255,12 @@ 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), m.get(F_TESTEMAIL).full(), m.get(F_MESSAGE), log);
|
||||
send_cu(perc, quality, simple, anno, tipoa, percip, email, ragsoc, cc, ccn, rcpt, test_mail, subj, msg, log);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m.save();
|
||||
mail.save(EMPTY_STRING, false, false);
|
||||
main_app().set_firm(save_ditta);
|
||||
}
|
||||
else
|
||||
|
@ -86,8 +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 * ccnemail, const char * ragsoc, bool receipt, bool test,
|
||||
const char * emailmsg, TLog_report & log);
|
||||
const TString & email, const TString & ragsoc, const TString & ccemail, const TString & ccnemail, bool rcpt,
|
||||
const TString & test_email, const TString & subj, const TString & msg, TLog_report & log);
|
||||
void edit_cu(const TFilename& datafile, int quality, bool simple);
|
||||
|
||||
#endif
|
@ -1,10 +1,13 @@
|
||||
#define F_SHEET 201
|
||||
#define F_FROMEMAIL 202
|
||||
#define F_PASSWORD 203
|
||||
#define F_CCNEMAIL 204
|
||||
#define F_RECEIPT 205
|
||||
#define F_MESSAGE 206
|
||||
#define F_TESTEMAIL 207
|
||||
#define F_CCEMAIL 204
|
||||
#define F_CCNEMAIL 205
|
||||
#define F_RECEIPT 206
|
||||
#define F_MESSAGE 207
|
||||
#define F_SUBJ 208
|
||||
#define F_TESTEMAIL 209
|
||||
#define F_SORT 210
|
||||
|
||||
#define S_SELECTED 101
|
||||
#define S_EMAIL 102
|
||||
|
@ -20,9 +20,16 @@ ENDPAGE
|
||||
|
||||
PAGE "Invio Certificazione unica" 0 2 0 0
|
||||
|
||||
LISTBOX F_SORT 1 15
|
||||
BEGIN
|
||||
PROMPT 1 0 "Ordinamento "
|
||||
ITEM "1|Codice"
|
||||
ITEM "2|Ragione sociale"
|
||||
END
|
||||
|
||||
STRING F_FROMEMAIL 50
|
||||
BEGIN
|
||||
PROMPT 1 1 "Email di invio "
|
||||
PROMPT 1 1 "Utente inviante "
|
||||
END
|
||||
|
||||
STRING F_PASSWORD 50
|
||||
@ -31,7 +38,7 @@ BEGIN
|
||||
FLAGS "*"
|
||||
END
|
||||
|
||||
STRING F_CCNEMAIL 50
|
||||
STRING F_CCEMAIL 50
|
||||
BEGIN
|
||||
PROMPT 1 3 "Email conoscenza "
|
||||
END
|
||||
@ -41,20 +48,31 @@ BEGIN
|
||||
PROMPT 70 3 "Ricevuta"
|
||||
END
|
||||
|
||||
|
||||
STRING F_CCNEMAIL 50
|
||||
BEGIN
|
||||
PROMPT 1 4 "Conosc.nascosta "
|
||||
END
|
||||
|
||||
ZOOM F_SUBJ 50
|
||||
BEGIN
|
||||
PROMPT 1 5 "Oggetto "
|
||||
END
|
||||
|
||||
ZOOM F_MESSAGE 50
|
||||
BEGIN
|
||||
PROMPT 1 4 "Messaggio "
|
||||
PROMPT 1 6 "Messaggio "
|
||||
END
|
||||
|
||||
STRING F_TESTEMAIL 50
|
||||
BEGIN
|
||||
PROMPT 1 5 "Email prova "
|
||||
PROMPT 1 7 "Email prova "
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
SPREADSHEET F_SHEET -1 -1
|
||||
BEGIN
|
||||
PROMPT 0 7 ""
|
||||
PROMPT 0 9 ""
|
||||
ITEM "@1"
|
||||
ITEM "Email@50"
|
||||
ITEM "Tipo"
|
||||
@ -117,4 +135,4 @@ BEGIN
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
||||
ENDMASK
|
@ -933,8 +933,8 @@ void print_cu(const TFilename& datafile, int quality, bool syntetic)
|
||||
}
|
||||
|
||||
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,
|
||||
const char * emailmsg, TLog_report & log)
|
||||
const TString & email, const TString & ragsoc, const TString & ccemail, const TString & ccnemail, bool rcpt,
|
||||
const TString & test_email, const TString & subj, const TString & msg, TLog_report & log)
|
||||
{
|
||||
TCU_report cur(quality, syntetic, true);
|
||||
TFilename datafile;
|
||||
@ -943,6 +943,7 @@ void send_cu(TISAM_recordset& perc, int quality, bool syntetic, int anno, const
|
||||
const TRecnotype nperc = perc.items();
|
||||
const TRectype& rec = perc.cursor()->curr();
|
||||
const int modulo = 1; // In realtà non accetta modulo != 1 per cui separa causali diverse in due comunicazioni
|
||||
const bool test = test_email.full();
|
||||
|
||||
datafile.temp(CU_DEFAULT_NAME);
|
||||
pdf.temp("cu", "pdf");
|
||||
@ -963,22 +964,34 @@ void send_cu(TISAM_recordset& perc, int quality, bool syntetic, int anno, const
|
||||
|
||||
b.export_pdf(pdf, false);
|
||||
|
||||
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 << " (" << email << ")";
|
||||
if (emailmsg && *emailmsg)
|
||||
message << '\n' << emailmsg << '.';
|
||||
msg << email;
|
||||
if (!send_mail(to, cc, ccn, subj, message, attachment, false, receipt))
|
||||
msg << " non ";
|
||||
TToken_string to(email, ';'), cc("", ';'), ccn(ccnemail, ';'), attachment(pdf, ';');
|
||||
TString subject(subj);
|
||||
TString message;
|
||||
TString esito("Invio a ");
|
||||
|
||||
if (subject.blank())
|
||||
subject = "Certificazione unica anno ";
|
||||
subject << anno + 1;
|
||||
if (tipoa == "G")
|
||||
message << "Spett. ";
|
||||
else
|
||||
message << "Gent.mo/a ";
|
||||
message << ragsoc << '(' << email << ")\n";
|
||||
if (msg.full())
|
||||
message << msg << ' ';
|
||||
else
|
||||
message << "Certificazione anno ";
|
||||
message << anno + 1 << 'n';
|
||||
message << TR("Cordiali saluti\nAmministrazione ") << prefix().firm().ragione_sociale();
|
||||
|
||||
esito << email;
|
||||
if (!send_mail(to, cc, ccn, subj, message, attachment, false, rcpt))
|
||||
esito << " non ";
|
||||
else
|
||||
if (!test && to.full())
|
||||
ini_set_bool(CONFIG_DITTA, "CU", format("%1s%6ld", (const char *)tipoa, percip), true);
|
||||
msg << " riuscito";
|
||||
esito << " riuscito";
|
||||
log.log(0, msg);
|
||||
xvtil_statbar_set(NULL);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user