Patch level :10.0 256

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
modernizzata a bomba la stampa documenti avanzata; inserita preview e firma; fatta funzionare la mail e i pdf


git-svn-id: svn://10.65.10.50/trunk@18494 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2009-03-11 12:10:27 +00:00
parent b093150553
commit 2af36abb42
2 changed files with 109 additions and 18 deletions

View File

@ -10,14 +10,57 @@ END
BUTTON DLG_SETPRINT 10 2
BEGIN
PROMPT 3 1 "~Imposta"
PROMPT 2 1 "~Imposta"
END
BUTTON DLG_PREVIEW 10 2
BEGIN
PROMPT 3 1 "~Anteprima"
PICTURE TOOL_PREVIEW
MESSAGE EXIT,65
END
BUTTON DLG_NULL 10 2
BEGIN
PROMPT 4 1 ""
PICTURE 0
END
BUTTON DLG_EMAIL 10 2
BEGIN
PROMPT 2 1 "~Mail"
PICTURE BMP_EMAIL
MESSAGE EXIT,K_ESC
PROMPT 5 1 "Mail"
PICTURE TOOL_EMAIL
MESSAGE EXIT,69
FLAGS "D"
END
BUTTON DLG_SIGNMAIL 10 2
BEGIN
PROMPT 6 1 "Firmata"
PICTURE TOOL_SIGNMAIL
MESSAGE EXIT,101
FLAGS "D"
END
BUTTON DLG_NULL 10 2
BEGIN
PROMPT 7 1 ""
PICTURE 0
END
BUTTON DLG_PDF 10 2
BEGIN
PROMPT 8 1 "Pdf"
PICTURE TOOL_PDF
MESSAGE EXIT,80
FLAGS "D"
END
BUTTON DLG_SIGNPDF 10 2
BEGIN
PROMPT 9 1 "Firmato"
PICTURE TOOL_SIGNPDF
MESSAGE EXIT,112
FLAGS "D"
END

View File

@ -807,7 +807,15 @@ bool TReport_doc_mask::on_field_event(TOperable_field& o, TField_event e, long j
TReport_doc_mask::TReport_doc_mask() : TAutomask("ve1100a")
{
hide(F_PROVV);
enable(DLG_EMAIL);
//abilita i bottoni della toolbar in base ai moduli presenti sulla chiave
TApplication& a = main_app();
const bool can_pdf = a.has_module(RSAUT);
const bool can_sign = can_pdf && a.has_module(FDAUT);
enable(DLG_EMAIL, can_pdf);
enable(DLG_SIGNMAIL, can_sign);
enable(DLG_PDF, can_pdf);
enable(DLG_SIGNPDF, can_sign);
}
///////////////////////////////////////////////////////////
@ -838,6 +846,8 @@ class TReport_doc_app : public TSkeleton_application
{
TReport_doc_mask* _msk;
enum TOutput_mode {out_preview, out_print, out_mail, out_signed_mail, out_pdf, out_signed_pdf};
int _anno;
TString16 _codnum; // codice numerazione / profilo
long _ndoc, _codcf;
@ -847,8 +857,9 @@ protected:
void add_data_filter(TString& query, bool from) const;
void add_ndoc_filter(TString& query, bool from) const;
void add_filter(TString& str, bool from) const;
bool print_loop(const TString& query, bool send_by_mail);
void print_selection(bool send_by_mail = false);
bool print_loop(const TString& query, TOutput_mode mode);
void print_selection(TOutput_mode mode);
TOutput_mode key2mode(KEY k) const;
void set_next_pdf(int an, const char* cn, long nd, char tcf, long cf);
virtual bool get_next_pdf(int anno, long ditta, const char* codnum, long numdoc, long codcf, TFilename& pdf) const;
@ -956,7 +967,7 @@ bool TReport_doc_app::destroy()
return TSkeleton_application::destroy();
}
bool TReport_doc_app::print_loop(const TString& query, bool send_by_mail)
bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
{
TISAM_recordset doc(query);
const int docs = doc.items();
@ -1000,7 +1011,7 @@ bool TReport_doc_app::print_loop(const TString& query, bool send_by_mail)
const TString& tipodoc = doc.get(DOC_TIPODOC).as_string();
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
const bool send_mail = send_by_mail && get_mail_address().full();
const bool send_mail = ( mode == out_mail || mode == out_signed_mail) && get_mail_address().full();
TFilename profilo; // Tenta di costruirsi il nome del report
bool ok = false;
@ -1014,7 +1025,7 @@ bool TReport_doc_app::print_loop(const TString& query, bool send_by_mail)
int copies = _msk->get_int(F_NCOPIE);
if (copies <= 0 && is_definitive)
copies = tipo.ncopie();
if (copies <= 0)
if (copies <= 0 || send_mail)
copies = 1;
TReport_doc& report = reports.get(profilo);
@ -1072,7 +1083,7 @@ bool TReport_doc_app::print_loop(const TString& query, bool send_by_mail)
attachment.tempdir();
attachment << SLASH << _anno <<'_' << _codnum << '_' << _ndoc;
attachment.ext("pdf");
mail_book->send_mail(attachment);
mail_book->send_mail(attachment, mode == out_signed_mail);
remove(attachment);
}
delete mail_book;
@ -1083,39 +1094,77 @@ bool TReport_doc_app::print_loop(const TString& query, bool send_by_mail)
if (book.pages() > 0)
{
if (docs > 1)
set_next_pdf(0, "", 0L, ' ', 0L); // Disabilita archiviazione PDF
set_next_pdf(0, "", 0L, ' ', 0L); //spegne l'archiviazione nell'esportazione;non si possono archiviare più docs in uno!!!
book.add(log);
book.print_or_preview();
switch (mode)
{
case out_preview: book.preview(); break;
case out_pdf:
case out_signed_pdf:
{
TFilename pdf;
pdf.tempdir();
pdf << SLASH << _anno <<'_' << _codnum << '_' << _ndoc;
pdf.ext("pdf");
if (book.export_pdf(pdf, mode == out_signed_pdf))
xvt_sys_goto_url(pdf, "open");
}
break;
default: book.print(); break;
}
}
return true;
}
void TReport_doc_app::print_selection(bool send_by_mail)
void TReport_doc_app::print_selection(TOutput_mode mode)
{
TString query;
query << "USE " << LF_DOC;
add_filter(query, true);
add_filter(query, false);
print_loop(query, send_by_mail);
print_loop(query, mode);
}
//Allah!!
TReport_doc_app::TOutput_mode TReport_doc_app::key2mode(KEY k) const
{
TOutput_mode mode = out_print;
switch (k)
{
case 'A': mode = out_preview; break;
case 'E': mode = out_mail; break;
case 'e': mode = out_signed_mail; break;
case 'P': mode = out_pdf; break;
case 'p': mode = out_signed_pdf; break;
default : mode = out_print; break;
}
return mode;
}
void TReport_doc_app::main_loop()
{
const int a = argc();
if (a > 2)
_msk->set(F_CODNUM, argv(2)); // Stampa da menu con numerazione imposta
if (a > 6) // Stampa da riga di comando
{
TOutput_mode mode = out_print;
_msk->set(F_DATA_O_NUM, "N"); // Stampa per numero documento
_msk->set(F_ANNO, argv(3));
_msk->set(F_PROVV, argv(4));
_msk->set(F_DA_NDOC, argv(5));
_msk->set(F_A_NDOC, argv(6));
if (a > 7)
mode = key2mode(argv(7)[0]); // modo di stampa
if (a > 8)
_msk->set(F_NCOPIE, argv(8)); // Numero copie
print_selection();
print_selection(mode);
return;
}
@ -1124,8 +1173,7 @@ void TReport_doc_app::main_loop()
const KEY k = _msk->run();
if (k == K_QUIT)
break;
const bool mail = k != K_ENTER;
print_selection(mail);
print_selection(key2mode(k));
}
}