Patch level : 780
Files correlati : ve1 Ricompilazione Demo : [ ] Commento : 0001671: Implementare una gestione profili documento personalzzata per cliente Richiesta cliente Autotrasporti Galeotti aggiungere la possibilità di stampare i documenti con un profilo diverso a seconda del codice cliente. git-svn-id: svn://10.65.10.50/trunk@20663 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a1405c1783
commit
0a28e94038
@ -952,6 +952,7 @@ protected:
|
|||||||
virtual bool get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn,
|
virtual bool get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn,
|
||||||
TString& subj, TString& text, TToken_string& attach, short& ui) const ;
|
TString& subj, TString& text, TToken_string& attach, short& ui) const ;
|
||||||
void print_extra_copies(TReport_doc& report, const TRecordset& doc, TReport_book& book) const;
|
void print_extra_copies(TReport_doc& report, const TRecordset& doc, TReport_book& book) const;
|
||||||
|
bool nome_report(const TRecordset& doc, int quale, TFilename& profilo) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
@ -1092,6 +1093,32 @@ void TReport_doc_app::print_extra_copies(TReport_doc& report, const TRecordset&
|
|||||||
report.print(doc, book, false, extra_copies, false, false, false);
|
report.print(doc, book, false, extra_copies, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Quale 0=standard,1=aggiuntivo,2=mail
|
||||||
|
bool TReport_doc_app::nome_report(const TRecordset& doc, int quale, TFilename& profilo) const
|
||||||
|
{
|
||||||
|
const TString4 tipodoc = doc.get(DOC_TIPODOC).as_string();
|
||||||
|
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
|
||||||
|
bool ok = false;
|
||||||
|
switch (quale)
|
||||||
|
{
|
||||||
|
case 1: ok = tipo.additional_print_profile(profilo, 2); break;
|
||||||
|
case 2: ok = tipo.mail_print_profile(profilo); break;
|
||||||
|
default: ok = tipo.main_print_profile(profilo, 2); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok) // Cerca eventuale personalizzazione per il singolo cliente
|
||||||
|
{
|
||||||
|
TString8 codcf = doc.get(DOC_CODCF).as_string(); codcf.right_just(6, '0');
|
||||||
|
TFilename path = profilo.name_only();
|
||||||
|
path << '_' << doc.get(DOC_TIPOCF) << codcf << ".rep";
|
||||||
|
if (path.custom_path())
|
||||||
|
profilo = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_definitive)
|
bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_definitive)
|
||||||
{
|
{
|
||||||
const int docs = doc.items();
|
const int docs = doc.items();
|
||||||
@ -1145,15 +1172,10 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_def
|
|||||||
const bool send_mail = ( mode == out_mail || mode == out_signed_mail) && get_mail_address().full();
|
const bool send_mail = ( mode == out_mail || mode == out_signed_mail) && get_mail_address().full();
|
||||||
const bool paperless = send_mail || mode == out_pdf || mode == out_signed_pdf;
|
const bool paperless = send_mail || mode == out_pdf || mode == out_signed_pdf;
|
||||||
|
|
||||||
TFilename profilo; // Tenta di costruirsi il nome del report
|
// Tenta di costruirsi il nome del report: se non stampo su carta cerco di usare un profilo con sfondo
|
||||||
bool ok = false;
|
TFilename profilo;
|
||||||
|
const bool ok = nome_report(doc, paperless ? 2 : 0, profilo);
|
||||||
// Se non stampo su carta cerco di usare un profilo con sfondo
|
|
||||||
if (paperless)
|
|
||||||
ok = tipo.mail_print_profile(profilo);
|
|
||||||
else
|
|
||||||
ok = tipo.main_print_profile(profilo, 2);
|
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
int copies = 1;
|
int copies = 1;
|
||||||
@ -1196,7 +1218,7 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_def
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stampa eventuali allegati
|
// Stampa eventuali allegati
|
||||||
if (tipo.additional_print_profile(profilo, 2))
|
if (nome_report(doc, 1, profilo))
|
||||||
{
|
{
|
||||||
int copies = tipo.additional_ncopie();
|
int copies = tipo.additional_ncopie();
|
||||||
if (copies <= 0) copies = 1;
|
if (copies <= 0) copies = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user