Patch level : 10.0 320
Files correlati : ve0.exe ve1.exe Ricompilazione Demo : [ ] Commento : Corretta valorizzazione righe di tipo Risorse ed Attrezzature. Aggiunta possibilita' di stampare copie extra dei documenti in base alla variabile #PRINT_EXTRA_COPIES git-svn-id: svn://10.65.10.50/trunk@18961 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
999644b0a8
commit
9b94b01c61
@ -212,11 +212,14 @@ TDoc_recordset::~TDoc_recordset()
|
|||||||
class TReport_doc : public TReport
|
class TReport_doc : public TReport
|
||||||
{
|
{
|
||||||
size_t _first_msg;
|
size_t _first_msg;
|
||||||
|
int _extra_copies;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void include_libraries(bool reload);
|
virtual void include_libraries(bool reload);
|
||||||
virtual size_t get_usr_words(TString_array& words) const;
|
virtual size_t get_usr_words(TString_array& words) const;
|
||||||
virtual bool execute_usr_word(unsigned int opcode, TVariant_stack& stack);
|
virtual bool execute_usr_word(unsigned int opcode, TVariant_stack& stack);
|
||||||
|
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
||||||
|
virtual bool set_usr_val(const TString& name, const TVariant& var);
|
||||||
|
|
||||||
TDocumentoEsteso& doc();
|
TDocumentoEsteso& doc();
|
||||||
TRiga_documento& riga_doc(int n = 0);
|
TRiga_documento& riga_doc(int n = 0);
|
||||||
@ -235,6 +238,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
bool print(const TRecordset& doc, TReport_book& book, bool def, word copies,
|
bool print(const TRecordset& doc, TReport_book& book, bool def, word copies,
|
||||||
bool alleg, bool arc, bool signature);
|
bool alleg, bool arc, bool signature);
|
||||||
|
int extra_copies() const { return _extra_copies; }
|
||||||
|
|
||||||
TReport_doc(const char* name);
|
TReport_doc(const char* name);
|
||||||
virtual ~TReport_doc();
|
virtual ~TReport_doc();
|
||||||
@ -746,11 +750,30 @@ void TReport_doc::include_libraries(bool reload)
|
|||||||
include("ve1300.alx");
|
include("ve1300.alx");
|
||||||
}
|
}
|
||||||
|
|
||||||
TReport_doc::TReport_doc(const char* name)
|
bool TReport_doc::get_usr_val(const TString& name, TVariant& var) const
|
||||||
|
{
|
||||||
|
if (name == "#PRINT_EXTRA_COPIES")
|
||||||
|
{
|
||||||
|
var = long(_extra_copies);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return TReport::get_usr_val(name, var);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TReport_doc::set_usr_val(const TString& name, const TVariant& var)
|
||||||
|
{
|
||||||
|
if (name == "#PRINT_EXTRA_COPIES")
|
||||||
|
{
|
||||||
|
_extra_copies = var.as_int();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return TReport::set_usr_val(name, var);
|
||||||
|
}
|
||||||
|
|
||||||
|
TReport_doc::TReport_doc(const char* name) : _extra_copies(0)
|
||||||
{
|
{
|
||||||
// istanziamento e impostazione della relazione di gestione della ditta corrente
|
// istanziamento e impostazione della relazione di gestione della ditta corrente
|
||||||
load(name); // Faccio la load altrimenti non include la libreria 1300.alx
|
load(name); // Faccio la load altrimenti non include la libreria 1300.alx
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TReport_doc::~TReport_doc()
|
TReport_doc::~TReport_doc()
|
||||||
@ -867,6 +890,7 @@ protected:
|
|||||||
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,
|
virtual bool get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn,
|
||||||
TString& subj, TString& text, TToken_string& attach, bool& ui) const ;
|
TString& subj, TString& text, TToken_string& attach, bool& ui) const ;
|
||||||
|
void print_extra_copies(TReport_doc& report, const TRecordset& doc, TReport_book& book) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
@ -969,6 +993,14 @@ bool TReport_doc_app::destroy()
|
|||||||
return TSkeleton_application::destroy();
|
return TSkeleton_application::destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TReport_doc_app::print_extra_copies(TReport_doc& report, const TRecordset& doc,
|
||||||
|
TReport_book& book) const
|
||||||
|
{
|
||||||
|
const int extra_copies = report.extra_copies();
|
||||||
|
if (extra_copies > 0)
|
||||||
|
report.print(doc, book, false, extra_copies, false, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
||||||
{
|
{
|
||||||
TISAM_recordset doc(query);
|
TISAM_recordset doc(query);
|
||||||
@ -1023,10 +1055,13 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
|||||||
const TString& tipodoc = doc.get(DOC_TIPODOC).as_string();
|
const TString& tipodoc = doc.get(DOC_TIPODOC).as_string();
|
||||||
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
|
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
|
||||||
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;
|
||||||
|
|
||||||
TFilename profilo; // Tenta di costruirsi il nome del report
|
TFilename profilo; // Tenta di costruirsi il nome del report
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (send_mail)
|
|
||||||
|
// Se non stampo su carta cerco di usare un profilo con sfondo
|
||||||
|
if (paperless)
|
||||||
ok = tipo.mail_print_profile(profilo);
|
ok = tipo.mail_print_profile(profilo);
|
||||||
else
|
else
|
||||||
ok = tipo.main_print_profile(profilo, 2);
|
ok = tipo.main_print_profile(profilo, 2);
|
||||||
@ -1036,7 +1071,7 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
|||||||
int copies = _msk->get_int(F_NCOPIE);
|
int copies = _msk->get_int(F_NCOPIE);
|
||||||
if (copies <= 0 && is_definitive)
|
if (copies <= 0 && is_definitive)
|
||||||
copies = tipo.ncopie();
|
copies = tipo.ncopie();
|
||||||
if (copies <= 0 || send_mail)
|
if (copies <= 0 || paperless)
|
||||||
copies = 1;
|
copies = 1;
|
||||||
|
|
||||||
TReport_doc& report = reports.get(profilo);
|
TReport_doc& report = reports.get(profilo);
|
||||||
@ -1055,6 +1090,8 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
|||||||
{
|
{
|
||||||
if (!report.print(doc, book, is_definitive, copies, true, arc, signature))
|
if (!report.print(doc, book, is_definitive, copies, true, arc, signature))
|
||||||
break;
|
break;
|
||||||
|
if (!paperless)
|
||||||
|
print_extra_copies(report, doc, book);
|
||||||
}
|
}
|
||||||
} //if(profilo.custom_path()...
|
} //if(profilo.custom_path()...
|
||||||
else
|
else
|
||||||
@ -1082,7 +1119,11 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
|||||||
if (send_mail)
|
if (send_mail)
|
||||||
allegato.print(doc, *mail_book, false, 1, false, false, false); // Non archivio gli allegati alla mail
|
allegato.print(doc, *mail_book, false, 1, false, false, false); // Non archivio gli allegati alla mail
|
||||||
else
|
else
|
||||||
|
{
|
||||||
allegato.print(doc, book, false, copies, false, arc, signature);
|
allegato.print(doc, book, false, copies, false, arc, signature);
|
||||||
|
if (!paperless)
|
||||||
|
print_extra_copies(allegato, doc, book);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mail_book != NULL)
|
if (mail_book != NULL)
|
||||||
|
@ -223,7 +223,7 @@ const TSpesa_prest & TRiga_documento::spesa() const
|
|||||||
|
|
||||||
test_firm();
|
test_firm();
|
||||||
|
|
||||||
const TString80 codice(get("CODART"));
|
const TString80 codice(get(RDOC_CODART));
|
||||||
TString80 index; index << tipor << codice;
|
TString80 index; index << tipor << codice;
|
||||||
|
|
||||||
TSpesa_prest * s = (TSpesa_prest *) _spese.objptr(index);
|
TSpesa_prest * s = (TSpesa_prest *) _spese.objptr(index);
|
||||||
@ -293,7 +293,6 @@ void TRiga_documento::set_variables(TExpression * e) const
|
|||||||
for (int i = 0; i < items; i++)
|
for (int i = 0; i < items; i++)
|
||||||
{
|
{
|
||||||
const TFieldref field(e->varname(i), LF_RIGHEDOC);
|
const TFieldref field(e->varname(i), LF_RIGHEDOC);
|
||||||
|
|
||||||
switch (field.file())
|
switch (field.file())
|
||||||
{
|
{
|
||||||
case LF_ANAMAG :
|
case LF_ANAMAG :
|
||||||
@ -471,6 +470,8 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
|||||||
switch (tipor)
|
switch (tipor)
|
||||||
{
|
{
|
||||||
case RIGA_MERCE:
|
case RIGA_MERCE:
|
||||||
|
case RIGA_RISORSE:
|
||||||
|
case RIGA_ATTREZZATURE:
|
||||||
c = _qtaprezzo;
|
c = _qtaprezzo;
|
||||||
break;
|
break;
|
||||||
case RIGA_PRESTAZIONI:
|
case RIGA_PRESTAZIONI:
|
||||||
|
@ -1918,7 +1918,6 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool doc_al_lordo = tipo().calcolo_lordo();
|
const bool doc_al_lordo = tipo().calcolo_lordo();
|
||||||
TRiepilogo_iva * aliquota;
|
|
||||||
const int ndec = decimals();
|
const int ndec = decimals();
|
||||||
|
|
||||||
const TRecord_array& righe = body(LF_RIGHEDOC);
|
const TRecord_array& righe = body(LF_RIGHEDOC);
|
||||||
@ -1933,14 +1932,13 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
|||||||
if (iva.ok())
|
if (iva.ok())
|
||||||
{
|
{
|
||||||
const TString & cod = iva.codice();
|
const TString & cod = iva.codice();
|
||||||
aliquota = (TRiepilogo_iva *) table.objptr(cod);
|
TRiepilogo_iva* aliquota = (TRiepilogo_iva*)table.objptr(cod);
|
||||||
if (aliquota == NULL)
|
if (aliquota == NULL)
|
||||||
{
|
{
|
||||||
aliquota = new TRiepilogo_iva(iva);
|
aliquota = new TRiepilogo_iva(iva);
|
||||||
table.add(cod, aliquota);
|
table.add(cod, aliquota);
|
||||||
}
|
}
|
||||||
const real imponibile = doc_al_lordo ? r.importo(true, true, ndec) : r.imponibile();
|
const real imponibile = doc_al_lordo ? r.importo(true, true, ndec) : r.imponibile();
|
||||||
|
|
||||||
aliquota->imp_orig() += imponibile;
|
aliquota->imp_orig() += imponibile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1981,7 +1979,7 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
|||||||
{
|
{
|
||||||
const TString & cod = iva.codice();
|
const TString & cod = iva.codice();
|
||||||
|
|
||||||
aliquota = (TRiepilogo_iva *) table.objptr(cod);
|
TRiepilogo_iva* aliquota = (TRiepilogo_iva *) table.objptr(cod);
|
||||||
if (aliquota == NULL)
|
if (aliquota == NULL)
|
||||||
{
|
{
|
||||||
aliquota = new TRiepilogo_iva(iva);
|
aliquota = new TRiepilogo_iva(iva);
|
||||||
@ -2276,8 +2274,8 @@ real TDocumento::provvigione(bool first, int ndec) const
|
|||||||
{
|
{
|
||||||
if (ndec == AUTO_DECIMALS)
|
if (ndec == AUTO_DECIMALS)
|
||||||
ndec = decimals();
|
ndec = decimals();
|
||||||
for (int i = rows(); i > 0; i--)
|
for (int i = physical_rows(); i > 0; i--)
|
||||||
val += ((TRiga_documento &) ((TDocumento *)this)->row(i)).provvigione(first, ndec);
|
val += physical_row(i).provvigione(first, ndec);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -2285,10 +2283,11 @@ real TDocumento::provvigione(bool first, int ndec) const
|
|||||||
real TDocumento::valore(bool totale, bool lordo, int ndec) const
|
real TDocumento::valore(bool totale, bool lordo, int ndec) const
|
||||||
{
|
{
|
||||||
real val;
|
real val;
|
||||||
for (int i=rows(); i>0; i--)
|
for (int i = physical_rows(); i>0; i--)
|
||||||
{
|
{
|
||||||
TRiga_documento &r = ((TRiga_documento &) ((TDocumento *)this)->row(i));
|
const TRiga_documento &r = physical_row(i);
|
||||||
if (r.is_merce() || r.is_spese() || r.is_prestazione())
|
//if (r.is_merce() || r.is_spese() || r.is_prestazione())
|
||||||
|
if (strchr("MSPRA", r.tipo().tipo()) != NULL) // Merce, Spese, Prestazioni, Risorse, Attrezzature
|
||||||
val += r.valore(totale, lordo, ndec);
|
val += r.valore(totale, lordo, ndec);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
@ -2311,7 +2310,7 @@ void TDocumento::put_str(const char* fieldname, const char* val)
|
|||||||
else
|
else
|
||||||
if (strcmp(fieldname, DOC_CODCF) == 0)
|
if (strcmp(fieldname, DOC_CODCF) == 0)
|
||||||
{
|
{
|
||||||
const TString16 v(val);
|
const TString8 v(val);
|
||||||
put(DOC_SPESEUPD, TRectype::get(DOC_CODCF) == v);
|
put(DOC_SPESEUPD, TRectype::get(DOC_CODCF) == v);
|
||||||
TAuto_variable_rectype::put_str(fieldname, v);
|
TAuto_variable_rectype::put_str(fieldname, v);
|
||||||
dirty_fields();
|
dirty_fields();
|
||||||
|
@ -448,7 +448,7 @@ TFormula_documento* TTipo_documento::succ_formula(bool restart)
|
|||||||
bool TTipo_documento::scarica_residuo() const
|
bool TTipo_documento::scarica_residuo() const
|
||||||
{
|
{
|
||||||
if (is_ordine() && !riporta_ordinato())
|
if (is_ordine() && !riporta_ordinato())
|
||||||
return TRUE;
|
return true;
|
||||||
return get_bool("B4");
|
return get_bool("B4");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user