From 1091feb25ae78a334631216f61980d028253e4e6 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Fri, 11 Jun 2021 19:03:51 +0200 Subject: [PATCH] Patch level : 12.0 1062 Files correlati : ve0.exe ve6.exe Commento : Modificato calcolo plafond Contabilizzazione con causale per tipo documenti SDI --- src/ve/velib.h | 2 +- src/ve/velib03.cpp | 4 +++- src/ve/velib04b.cpp | 30 +++++++++++++++++++++++------- src/ve/velib06a.cpp | 2 +- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/ve/velib.h b/src/ve/velib.h index ffe71675f..926af1d35 100755 --- a/src/ve/velib.h +++ b/src/ve/velib.h @@ -883,7 +883,7 @@ public: const TRiepilogo_iva * riepilogo_iva(int index) const { return (index >= 0 && index < _cod_iva.items()) ? riepilogo_iva(_cod_iva.row(index)) : NULL; } TCli_for& clifor(bool force_reload = false) const; TLi_manager & plafond(bool force_reload = false); - const real importo_plafond() const; + const real importo_plafond(bool diff = false) const; const real importo_plafond_salvato() const; TOccasionale& occas() const; const TAgente& agente(bool first = true) const; diff --git a/src/ve/velib03.cpp b/src/ve/velib03.cpp index af5b00be3..1e3370ca9 100755 --- a/src/ve/velib03.cpp +++ b/src/ve/velib03.cpp @@ -2801,7 +2801,7 @@ TCli_for& TDocumento::clifor(bool force_reload) const return cf; } -const real TDocumento::importo_plafond() const +const real TDocumento::importo_plafond(bool diff) const { real importo_plafond; @@ -2816,6 +2816,8 @@ const real TDocumento::importo_plafond() const } if (is_nota_credito()) importo_plafond = -importo_plafond; + if (diff) + importo_plafond -= importo_plafond_salvato(); return importo_plafond; } diff --git a/src/ve/velib04b.cpp b/src/ve/velib04b.cpp index 686b228e6..6ba7fb547 100755 --- a/src/ve/velib04b.cpp +++ b/src/ve/velib04b.cpp @@ -17,6 +17,7 @@ #include "../m770/scperc.h" #include "../m770/rver.h" #include "../m770/perc.h" +#include "../f9/f9lib.h" void TMovimentoPN_VE::destroy_iva_row(int i) @@ -1037,8 +1038,26 @@ TCausale* TContabilizzazione::get_caus(const TDocumento& doc, const int year) co { TString4 codcaus; TToken_string key; + static TCategorie_doc __cats; - if (_fld_cms_cont.full()) + if (main_app().has_module(F9AUT, CHK_DONGLE)) + { + const TString & tipodoc = doc.get(DOC_TIPODOCSDI); + + if (tipodoc.full()) + { +#ifdef NEW_FP + TClasse_doc * classe = __cats.tipo2class(tipodoc); + + if (classe != nullptr) + + codcaus = classe->caus_cont(); +#else + codcaus =__cats.tipo2caus_cont(tipodoc); +#endif + } + } + if (codcaus.blank() && _fld_cms_cont.full()) { const TString& cms = doc.commessa_principale(); if (cms.full()) @@ -1065,13 +1084,10 @@ TCausale* TContabilizzazione::get_caus(const TDocumento& doc, const int year) co codcaus = doc.tipo().causale(); // Istanzia la causale del documento corrente... } - if (_caus != NULL && _caus->codice() == codcaus && _caus->reg().year() == year) + if (_caus != nullptr && _caus->codice() == codcaus && _caus->reg().year() == year) return _caus; - if (_caus != NULL) - { - delete _caus; - _caus = NULL; - } + if (_caus != nullptr) + safe_delete(_caus); if (codcaus.full()) _caus = new TCausale(codcaus, year); diff --git a/src/ve/velib06a.cpp b/src/ve/velib06a.cpp index f591f8033..a29449334 100755 --- a/src/ve/velib06a.cpp +++ b/src/ve/velib06a.cpp @@ -3065,7 +3065,7 @@ bool codcms_handler(TMask_field& f, KEY key) } //if (main_app().has_module(CTAUT) && (... //aggiornamento automatico del campo codice contabilita' separata nel caso di commessa che ce lo abbia - if (main_app().has_module(NPAUT, CHK_DONGLE) && f.running_check(key)) + if (mask.id2pos(F_CONTSEP) >= 0 && main_app().has_module(NPAUT, CHK_DONGLE) && mask.get(F_CONTSEP).full() && f.running_check(key)) { const TString& contsep = cache().get(LF_COMMESSE, codcms, COMMESSE_CONTSEP);