From 9e5769e3a5555508b2093a10e5b6db20f53d1a52 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Tue, 29 Aug 2023 18:12:13 +0200 Subject: [PATCH] Patch level : 12.00 1278 Files correlati : tp0.exe Le esenzioni nella dichiarazione di febbraio della sicart non venivano calcolate bene --- src/ve/velib.h | 5 ++++- src/ve/velib03.cpp | 19 +++++++++++-------- src/ve/velib06.cpp | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/ve/velib.h b/src/ve/velib.h index 854921fe0..5369a3942 100755 --- a/src/ve/velib.h +++ b/src/ve/velib.h @@ -823,6 +823,7 @@ class TDocumento : public TMultiple_rectype // velib03 TRiga_documento * _sconto; // Riga per lo sconto di testata TRiga_documento * _esenzione; // Riga per l' esenzione iva TRiga_documento * _valfisc; // Riga di valenza fiscale per fatture 2019+ + bool _force_recalc; bool _dirty_deny; @@ -883,6 +884,8 @@ public: TCodgiac_livelli& livelli() const ; void dirty_fields(); + void force_recalc(bool on) { _force_recalc = on; } + bool force_recalc() { return _force_recalc; } TAssoc_array& tabella_iva(bool solo_imponibili = false) { update_tabella_iva(solo_imponibili); return _tabella_iva; } int riepilogo_iva_items() const { return _cod_iva.items();} @@ -1011,7 +1014,7 @@ public: void update_spese_aut(TString_array & spese, bool preserve_old = false, TSheet_field * sh = NULL, bool force = false); void update_conai_qta(); void update_conai(); - void old_update_conai(); +// void old_update_conai(); bool is_generic() const { return tipo_valido() && tipo().is_generic(); } bool is_fattura() const { return tipo_valido() && tipo().is_fattura(); } diff --git a/src/ve/velib03.cpp b/src/ve/velib03.cpp index 809f98dca..d6b035d32 100755 --- a/src/ve/velib03.cpp +++ b/src/ve/velib03.cpp @@ -261,20 +261,21 @@ void TDocumento::init() check_modules(); } -TDocumento::TDocumento() : TMultiple_rectype(LF_DOC) +TDocumento::TDocumento() + : TMultiple_rectype(LF_DOC), _force_recalc(false) { init(); } -TDocumento::TDocumento(const TDocumento & d) - : TMultiple_rectype(LF_DOC) +TDocumento::TDocumento(const TDocumento & d) + : TMultiple_rectype(LF_DOC), _force_recalc(false) { init(); copy(d); } TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc) - : TMultiple_rectype(LF_DOC) + : TMultiple_rectype(LF_DOC), _force_recalc(false) { init(); if (numdoc > 0) @@ -284,7 +285,7 @@ TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc) } TDocumento::TDocumento(const TDoc_key& key) - : TMultiple_rectype(LF_DOC) + : TMultiple_rectype(LF_DOC), _force_recalc(false) { init(); const long ndoc = key.ndoc(); @@ -296,7 +297,7 @@ TDocumento::TDocumento(const TDoc_key& key) TDocumento::TDocumento(const TRectype& rec) - : TMultiple_rectype(LF_DOC) + : TMultiple_rectype(LF_DOC), _force_recalc(false) { init(); read(rec); @@ -1619,7 +1620,6 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const } } } - { TLocalisamfile anamag(LF_ANAMAG); TLocalisamfile codalt(LF_CODCORR); @@ -1761,6 +1761,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const } #endif } + myself.force_recalc(false); return err; } @@ -1815,6 +1816,7 @@ int TDocumento::remove(TBaseisamfile& f) const myself.plafond(true).remove(myself); myself.auto_evasione(); } + myself.force_recalc(false); return TMultiple_rectype::remove(f); } @@ -3035,6 +3037,7 @@ TDocumento& TDocumento::copy(const TDocumento & d) _auto_cod_modify_pend = d._auto_cod_modify_pend; _row_auto_cod_changed = d._row_auto_cod_changed; _qta_evasa_auto_changed = d._qta_evasa_auto_changed; + _force_recalc = d._force_recalc; return *this; } @@ -3336,7 +3339,7 @@ bool has_new_conai(const TDocumento& doc) */ void TDocumento::update_conai() { - if (main_app().has_module(DCAUT, CHK_DONGLE) && tipo().add_conai() && tipo().stato_bloccato() != stato()) // tipo().stati_iniziali_modifica().find(stato()) >= 0) + if (main_app().has_module(DCAUT, CHK_DONGLE) && tipo().add_conai() && (force_recalc() || tipo().stati_iniziali_modifica().find(stato()) >= 0)) { TAssoc_array conai_aggiornati; const TRectype& cfven = clifor().vendite(); diff --git a/src/ve/velib06.cpp b/src/ve/velib06.cpp index 0f3a6275b..4acc2edcf 100755 --- a/src/ve/velib06.cpp +++ b/src/ve/velib06.cpp @@ -959,6 +959,7 @@ bool TDocumento_mask::on_key(KEY key) enable(DLG_SAVEREC); enable(DLG_DELREC); xvtil_statbar_set(TR("Modifica")); + doc().force_recalc(true); } else warning_box("L'utente %s non puo' modificare questo documento",