Patch level : 10.0
Files correlati : ve1.exe Ricompilazione Demo : [ ] Commento : Corretta stampa fatture contestualmente ad invio via mail ed archiviazione automatica git-svn-id: svn://10.65.10.50/trunk@19420 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
bed1159296
commit
746acd8423
@ -54,8 +54,8 @@ TRiga_documento& TDoc_recordset::riga_doc(int n) const
|
||||
n = _mypos+1;
|
||||
if (n > _doc->rows()) // Non dovrebbe succedere mai
|
||||
{
|
||||
n = _doc->new_row().get_int(RDOC_NRIGA);
|
||||
(*_doc)[n].put(RDOC_TIPORIGA, "05"); // Crea ua riga descrizione fittizia
|
||||
n = _doc->new_row("05").get_int(RDOC_NRIGA);
|
||||
//(*_doc)[n].put(RDOC_TIPORIGA, "05"); // Crea ua riga descrizione fittizia
|
||||
}
|
||||
if (n <= 0)
|
||||
n = 1;
|
||||
@ -851,19 +851,12 @@ TReport_doc_mask::TReport_doc_mask() : TAutomask("ve1100a")
|
||||
class TReports_cache : TCache
|
||||
{
|
||||
protected:
|
||||
virtual TObject* key2obj(const char* key);
|
||||
|
||||
virtual TObject* key2obj(const char* key) { return new TReport_doc(key); }
|
||||
public:
|
||||
TReport_doc& get(const TString& key) { return *(TReport_doc*)objptr(key); }
|
||||
TReports_cache() : TCache(7) { }
|
||||
TReports_cache() : TCache(13) { }
|
||||
};
|
||||
|
||||
TObject* TReports_cache::key2obj(const char* key)
|
||||
{
|
||||
TReport_doc* rep = new TReport_doc(key);
|
||||
return rep;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TReport_doc_app
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -889,7 +882,7 @@ protected:
|
||||
|
||||
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;
|
||||
const TString & get_mail_address() const;
|
||||
const TString& get_mail_address() const;
|
||||
virtual bool get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn,
|
||||
TString& subj, TString& text, TToken_string& attach, bool& ui) const ;
|
||||
void print_extra_copies(TReport_doc& report, const TRecordset& doc, TReport_book& book) const;
|
||||
@ -1031,7 +1024,7 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
||||
|
||||
TReports_cache reports; // Cache degli ultimi reports usati
|
||||
TDoc_book book; // Destinazione dell'intera stampa
|
||||
TDoc_book* mail_book = NULL; // Destinazione dell'intera stampa
|
||||
TDoc_book* mail_book = NULL; // Destinazione della singola mail
|
||||
TLog_report log(TR("Invio documenti per email"));
|
||||
TProgind pi(docs, TR("Elaborazione documenti..."), true, true);
|
||||
|
||||
@ -1089,8 +1082,11 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
||||
if (send_mail)
|
||||
{
|
||||
mail_book = new TDoc_book;
|
||||
if (!report.print(doc, *mail_book, is_definitive, 1, true, arc, signature))
|
||||
if (!report.print(doc, *mail_book, is_definitive, 1, true, false, false)) // Non archiviare per ora...
|
||||
break;
|
||||
if (arc) // ... eventualemte archivia direttamente il book senza passare per uno temporaneo
|
||||
mail_book->archive(NULL, signature);
|
||||
|
||||
TString mesg;
|
||||
mesg << tipo.descrizione() << TR(" n. ") << doc.get(DOC_NDOC)
|
||||
<< TR(" a ") << get_mail_address();
|
||||
@ -1106,9 +1102,16 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
||||
} //if(profilo.custom_path()...
|
||||
else
|
||||
{
|
||||
TString msg; msg << TR("Report inesistente") << " : " << profilo;
|
||||
statbar_set_title(TASK_WIN, msg);
|
||||
beep(2);
|
||||
TString msg; msg << TR("Report inesistente: ") << profilo;
|
||||
#ifdef xvt_dm_post_error
|
||||
if (is_power_version())
|
||||
xvt_dm_post_error(msg);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
statbar_set_title(TASK_WIN, msg);
|
||||
beep(2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1141,15 +1144,23 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
||||
if (mail_book->pages() > 0)
|
||||
{
|
||||
TFilename attachment;
|
||||
attachment.tempdir();
|
||||
attachment << SLASH << _anno <<'_' << _codnum << '_' << _ndoc;
|
||||
attachment.ext("pdf");
|
||||
bool is_tmp = false;
|
||||
|
||||
bool ok = mail_book->export_pdf(attachment, mode == out_signed_mail);
|
||||
if (attach_mail) // Ho chiesto la spedizione vera e propria
|
||||
// Se ho archiviato (arc==true) allora il file di attachment e' gia' pronto!
|
||||
bool ok = arc && get_next_pdf(_anno, -1, _codnum, _ndoc, _codcf, attachment);
|
||||
if (!ok || !attachment.exist()) // Altrimenti ne creo uno temporaneo
|
||||
{
|
||||
attachment.tempdir();
|
||||
attachment << SLASH << _anno <<'_' << _codnum << '_' << _ndoc;
|
||||
attachment.ext("pdf");
|
||||
ok = mail_book->export_pdf(attachment, mode == out_signed_mail);
|
||||
is_tmp = ok;
|
||||
}
|
||||
if (ok && attach_mail) // Ho chiesto la spedizione vera e propria
|
||||
{
|
||||
ok = spotlite_send_mail(attachment);
|
||||
remove(attachment);
|
||||
if (is_tmp)
|
||||
remove(attachment);
|
||||
}
|
||||
}
|
||||
delete mail_book;
|
||||
|
Loading…
x
Reference in New Issue
Block a user