diff --git a/ve/velib.h b/ve/velib.h index e7f5c7c0e..9171536e6 100755 --- a/ve/velib.h +++ b/ve/velib.h @@ -216,6 +216,7 @@ class TTipo_documento : public TRectype // velib03 TString _str_desc_doc, _str_desc_rdoc; char _tipocf; + char _tipocr; char _check_qta; bool _cnt_prezzi, _show_evaded_lines; @@ -288,6 +289,8 @@ public: bool printable() const { return get("S5").not_empty(); } bool main_print_profile(TFilename& report) const; bool additional_print_profile(TFilename& report) const; + bool is_costo() const ; + bool is_ricavo() const ; TFormula_documento* first_formula() { return succ_formula(true); } TFormula_documento* succ_formula(bool restart = FALSE); diff --git a/ve/velib03a.cpp b/ve/velib03a.cpp index d0bde2d33..4cce00ff1 100755 --- a/ve/velib03a.cpp +++ b/ve/velib03a.cpp @@ -92,6 +92,16 @@ bool TTipo_documento::additional_print_profile(TFilename& report) const return ok; } +bool TTipo_documento::is_costo() const +{ + return _tipocr == 'C' || tipocf() == 'F'; +} + +bool TTipo_documento::is_ricavo() const +{ + return _tipocr == 'R' || tipocf() == 'C'; +} + const char TTipo_documento::tipocf() const { if (_tipocf < ' ') @@ -259,6 +269,7 @@ void TTipo_documento::read_formule() TConfig prof(profile, "MAIN"); prof.write_protect(); // Altrimenti non si distrugge!!! + _tipocr = prof.get_char("TIPOCR", NULL, -1, ' '); _formule = prof.get("CAMPICALC"); const TString& calcoli = prof.get("CALCOLI"); if (calcoli == "*") diff --git a/ve/vereplib.cpp b/ve/vereplib.cpp index b77677e12..8e8f1ac49 100755 --- a/ve/vereplib.cpp +++ b/ve/vereplib.cpp @@ -72,11 +72,13 @@ const TVariant& TDocument_recordset::get(int num, const char* field) const } else if (xvt_str_compare_ignoring_case(field, "IS_COSTO") == 0) { - var = doc.get_char(DOC_TIPOCF)=='F' ? UNO : ZERO; + bool costo = (doc.tipo().is_costo()) || (!doc.tipo().is_ricavo() && doc.get_char(DOC_TIPOCF)=='F'); + var = costo ? UNO : ZERO; } else if (xvt_str_compare_ignoring_case(field, "IS_RICAVO") == 0) { - var = doc.get_char(DOC_TIPOCF)=='C' ? UNO : ZERO; + bool ricavo = (doc.tipo().is_ricavo()) || (!doc.tipo().is_costo() && doc.get_char(DOC_TIPOCF)=='C'); + var = ricavo ? UNO : ZERO; } else {