diff --git a/src/ce/ce0400.cpp b/src/ce/ce0400.cpp index ba29c88c8..d0bb62b71 100755 --- a/src/ce/ce0400.cpp +++ b/src/ce/ce0400.cpp @@ -1,10 +1,12 @@ #include #include #include +#include #include #include #include "ce0400a.h" +#include "../cg/cglib.h" //------------------------------------------------------ // Maschera di configurazione @@ -23,6 +25,17 @@ bool TConfig_mask::on_field_event(TOperable_field& f, TField_event e, long jolly { switch (f.dlg()) { +/* case F_ESERCORR: + if (e == fe_init) + { + const TEsercizio & esc = esercizi().esercizio(f.get_int()); + bool covid_19 = esc.inizio().year() > 2019; + + show(F_SOSPAMM, covid_19); + if (!covid_19) + reset(F_SOSPAMM); + } + break; */ case F_NAME_USER: if (e == fe_button) { diff --git a/src/ce/ce0400a.h b/src/ce/ce0400a.h index 5aab2b0d8..b45bb3723 100755 --- a/src/ce/ce0400a.h +++ b/src/ce/ce0400a.h @@ -13,6 +13,7 @@ #define F_DATACONS 110 #define F_ANNOTUIR 111 #define F_AMMPROP 112 +#define F_SOSPAMM 113 //Pagina 2 //sheet elenco files personalizzati e relative righe diff --git a/src/ce/ce0400a.uml b/src/ce/ce0400a.uml index 14fe205dd..a815957bf 100755 --- a/src/ce/ce0400a.uml +++ b/src/ce/ce0400a.uml @@ -134,6 +134,12 @@ BEGIN FIELD AMMPROP END +BOOLEAN F_SOSPAMM +BEGIN + PROMPT 1 10 "Sospensione ammortamento per COVID-19" + FIELD SOSPAMM +END + ENDPAGE //-----------------------------------------------------------------------------------------------// diff --git a/src/ce/ce1400.cpp b/src/ce/ce1400.cpp index b5aea8660..6e34c3390 100755 --- a/src/ce/ce1400.cpp +++ b/src/ce/ce1400.cpp @@ -86,14 +86,18 @@ bool TSac_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) if (e == fe_modify || e == fe_close) { TDitta_cespiti& dc = ditta_cespiti(); + const int ese = get_int(F_ESERCIZIO); const int gr = get_int(F_GRUPPO); - const char* sp = get(F_SPECIE); + const TString16 sp = get(F_SPECIE); const int ca = get_int(F_CATEGORIA2); const TRectype& cac = dc.categoria(gr, sp, ca); bool ok = !cac.empty(); - if (ok && (o.dlg() == F_CATEGORIA || o.dlg() == F_CATEGORIA2)) + const short dlg = o.dlg(); + + if (ok && (dlg == F_CATEGORIA || dlg == F_CATEGORIA2)) { - set(o.dlg() == F_CATEGORIA ? F_DESC_CAT : F_DESC_CAT2, cac.get("S0")); + set(dlg == F_CATEGORIA ? F_DESC_CAT : F_DESC_CAT2, cac.get("S0")); + const bool sospamm = ini_get_bool(CONFIG_DITTA, "ce", "SOSPAMM", false) && ese == 2020; if (cac.get_bool("B0")) return error_box(TR("Categoria non ammortizzabile")); @@ -105,7 +109,8 @@ bool TSac_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) case 1: // Beni immateriali { const bool amm_per_anni = cac.get_int("I1") <= 1; - if (amm_per_anni) + + if (!sospamm && amm_per_anni) return error_box(TR("La categoria prevede un ammortamento per anni:\n" "Effettuare le scelte sul cespite")); } @@ -113,7 +118,8 @@ bool TSac_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) case 2: // Costi pluriennali { const int vincolo = cac.get_int("I2"); - if (vincolo == 3) // Quote + + if (!sospamm && vincolo == 3) // Quote return error_box(TR("La categoria prevede un ammortamento per quote costanti:\n" "Effettuare le scelte sul cespite")); } @@ -122,10 +128,17 @@ bool TSac_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) break; } } - if (!ok && !o.empty() && o.dlg() == F_CATEGORIA2) - return error_box(TR("E' neccessario specificare una categoria valida")); - if (ok && e == fe_button && o.dlg() == F_CATEGORIA) - send_key(K_ENTER, 0); + if (ok) + { + if (dlg == F_CATEGORIA) + send_key(K_ENTER, 0); + } + else + { + if (ca > 0 && dlg == F_CATEGORIA2) + return error_box(TR("E' neccessario specificare una categoria valida")); + } + } break; default: @@ -278,7 +291,7 @@ protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); public: - TImm_mask() : TAutomask("ce1400c") { } + TImm_mask() : TAutomask("ce1400c") {} }; bool TImm_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) @@ -307,7 +320,7 @@ protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); public: - TPlu_mask() : TAutomask("ce1400d") { } + TPlu_mask() : TAutomask("ce1400d") {} }; bool TPlu_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) @@ -419,23 +432,36 @@ void TScelta_amm_cat::init_mask(TMask& m) const int gru = _msk[0]->get_int(F_GRUPPO); const char* spe = _msk[0]->get(F_SPECIE); const int cat = _msk[0]->get_int(F_CATEGORIA2); + dc.set_attivita(ese, gru, spe); dc.init_mask(m); m.set(F_CATEGORIA, cat); - + const TRectype& cac = dc.categoria(gru, spe, cat); + switch (_tipo) { case 1: // Immateriali - m.set(F_TIPOAMM, cac.get("I1")); - m.set(F_MAX_AMM, cac.get("R13")); - m.set(F_ANNI, cac.get("I3")); + { + m.set(F_TIPOAMM, cac.get("I1")); + m.set(F_MAX_AMM, cac.get("R13")); + m.set(F_ANNI, cac.get("I3")); + + const bool amm_per_anni = cac.get_int("I1") <= 1; + + m.enable(F_NORFIS, !amm_per_anni); + } break; case 2: // Pluriennali - m.set(F_TIPOVINC, cac.get("I2")); - m.set(F_MIN_AMM, cac.get("R14")); - m.set(F_MAX_AMM, cac.get("R15")); - m.set(F_ANNI, cac.get("I3")); + { + const int vincolo = cac.get_int("I2"); + + m.set(F_TIPOVINC, vincolo); + m.set(F_MIN_AMM, cac.get("R14")); + m.set(F_MAX_AMM, cac.get("R15")); + m.set(F_ANNI, cac.get("I3")); + m.enable(F_NORFIS, vincolo != 3); + } break; default: // Materiali { diff --git a/src/ce/ce2101.cpp b/src/ce/ce2101.cpp index e3b35a98d..31ea6dec7 100755 --- a/src/ce/ce2101.cpp +++ b/src/ce/ce2101.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -925,36 +926,44 @@ real TCespite::calc_quota(const real& valamm, const real& perric, // Calcolo delle quote perse // Certified 50% -real TCespite::calc_quote_perse(const real& valamm, const real& peric, const real& residuo, +// non piu' previste dalla legge tolto nel 2021 +/* real TCespite::calc_quote_perse(const real& valamm, const real& peric, const real& residuo, const real& quotamm, bool mov_vend, const TDate& dtmov) { const TDitta_cespiti& cce = ditta_cespiti(); const real coeff_durata = cce.coefficiente_durata_esercizio(); real quota = valamm * coeff_durata * peric / CENTO; - if (mov_vend) - { - TDate inies, fines; - cce.esercizio_corrente(inies, fines); - const TDate dtcomp = get_date(CESPI_DTCOMP); - const real giorni_possesso = dtmov - fnc_max(inies, dtcomp) + 1; - const real giorni_esercizio = fines - inies + 1; - quota = quota * giorni_possesso / giorni_esercizio; - } - cce.arrotonda(quota); - - if (quota < residuo) + const bool skip = _tipo_sit != 1 && _sosp_covid && cce.esercizio_corrente() == 2020; + + if (skip) + quota = ZERO; + else { - const bool amm_rit = ammini_get_bool(AMMCE_AMMRIT); - if (quota > quotamm && !amm_rit) - quota -= quotamm; - else + if (mov_vend) + { + TDate inies, fines; + cce.esercizio_corrente(inies, fines); + const TDate dtcomp = get_date(CESPI_DTCOMP); + const real giorni_possesso = dtmov - fnc_max(inies, dtcomp) + 1; + const real giorni_esercizio = fines - inies + 1; + quota = quota * giorni_possesso / giorni_esercizio; + } + cce.arrotonda(quota); + + if (quota < residuo) + { + const bool amm_rit = ammini_get_bool(AMMCE_AMMRIT); + if (quota > quotamm && !amm_rit) + quota -= quotamm; + else + quota = ZERO; + } + else quota = ZERO; } - else - quota = ZERO; - return quota; } +*/ void TCespite::agg_quota(const real& movvalamm, TRectype& rec, const char* field, bool calcq) { @@ -992,18 +1001,20 @@ void TCespite::agg_quota(const real& movvalamm, TRectype& rec, const char* field } } +const char * rewrite_fname(const char* name, int sit) +{ + TString16 fname = get_tmp_string(20); + + fname = name; + if (fname.starts_with("PF") && sit != 1) + fname.overwrite("PC", 0); + return fname; +} + HIDDEN const TString& catdi_get(const TRectype* pcatdi, const char* name, int sit) { - if (pcatdi != NULL) - { - if (sit != 1) - { - TString16 fname(name); - fname.overwrite("PC", 0); - return pcatdi->get(fname); - } - return pcatdi->get(name); - } + if (pcatdi != nullptr) + return pcatdi->get(rewrite_fname(name, sit)); else CHECK(false, "NULL CATDI record"); @@ -1024,6 +1035,7 @@ const TString& TCespite::ammini_get(const char* pstar) const const TDitta_cespiti& dc = ditta_cespiti(); const TRectype* pcatdi = NULL; const TRectype* pcac = NULL; + const bool sospamm = _sosp_covid && dc.esercizio_corrente() == 2020; // L'utente fa le sue scelte: ma saranno sensate e coerenti? int scelte = _ammini.get_int(AMMCE_SCELTE); @@ -1035,6 +1047,10 @@ const TString& TCespite::ammini_get(const char* pstar) const const int categ = get_int(CESPI_CODCAT); TString80 key; key.format("%d|%d|%s|%d", anno, gruppo, (const char*)specie, categ); const TRectype& catdi = cache().get(LF_CATDI, key); + + if (get_int(CESPI_IDCESPITE) == 452 && _tipo_sit != 3) + int i = 1; + if (!catdi.empty()) { pcatdi = &catdi; @@ -1085,14 +1101,16 @@ const TString& TCespite::ammini_get(const char* pstar) const } break; case tc_immateriale: + // if (scelte == 2 || (_tipo_sit != 1 && sospamm)) if (scelte == 2) val = catdi_get(pcatdi, CATDI_PFNORVN, _tipo_sit); else val = pcac->get("R13"); break; case tc_pluriennale: +// if (scelte == 2 || (_tipo_sit != 1 && sospamm)) if (scelte == 2) - val = catdi_get(pcatdi, CATDI_PFNORVN, _tipo_sit); + val = catdi_get(pcatdi, CATDI_PFNORVN, _tipo_sit); else val = pcac->get("R15"); break; @@ -1312,7 +1330,8 @@ void TCespite::calc_perc(TRelation& rel, const TRectype& tmv, const TRectype& tm // Calcolare quote perse const TDate dtmov = tmv.get_date(MOVCE_DTMOV); - const real quote_perse = calc_quote_perse(valamm, per_eff, resamm, qnor, true, dtmov); + // non piu' previste dalla legge tolto nel 2021 + // const real quote_perse = calc_quote_perse(valamm, per_eff, resamm, qnor, true, dtmov); if (_tipo_sit == 1 && get_int(CESPI_USOPROM) > 1) agg_quota(valamm, ammmv, "QNOR", true); @@ -1864,8 +1883,9 @@ void TCespite::calc_amm_residui(bool is_valid) _ammpro.put(AMMCE_QNOR, qnor); ammpro_put_perc(AMMCE_PNOR, per_eff); - const real quote_perse = calc_quote_perse(valamm, pmat, resamm, qnor, false, TDate()); - _ammpro.put(AMMCE_QPERSE, quote_perse); + // non piu' previste dalla legge tolto nel 2021 +// const real quote_perse = calc_quote_perse(valamm, pmat, resamm, qnor, false, TDate()); + _ammpro.zero(AMMCE_QPERSE); const int uso_promiscuo = get_int(CESPI_USOPROM); if (_tipo_sit == 1 && uso_promiscuo > 1) @@ -1875,7 +1895,7 @@ void TCespite::calc_amm_residui(bool is_valid) resamm -= qnor + _ammpro.get_real(AMMCE_FPRIVATO); const real pacc = _ammpro.get_real(AMMCE_PACC); - if (resamm > ZERO && pacc > ZERO && quote_perse.is_zero()) + if (resamm > ZERO && pacc > ZERO) // non piu' previste dalla legge tolto nel 2021 && quote_perse.is_zero()) { const real qacc = calc_quota(val_amm(), pacc, resamm, per_eff); _ammpro.put(AMMCE_QACC, qacc); @@ -2059,7 +2079,8 @@ bool TCespite::calc_amm(int tipo_sit, const TDate& data_limite, const TString16 idcespite = get(CESPI_IDCESPITE); // Keep it handy for debug purposes log(FR("* Inizio calcolo situazione %d cespite %s"), tipo_sit, (const char*)idcespite); - + + #ifdef DBG if (tipo_sit == 1 && atol(idcespite) == 1362) tipo_sit = 1; // Put your breakpoint here @@ -2175,15 +2196,18 @@ void TCespite::load_saldi(const int tiposit, const int esercizio) TCespite::TCespite() : TRectype(LF_CESPI), _salini(LF_SALCE), _salpro(LF_SALCE), _ammini(LF_AMMCE), _ammpro(LF_AMMCE) { + _sosp_covid = ini_get_bool(CONFIG_DITTA, "ce", "SOSPAMM", false); } TCespite::TCespite(const char* id) : TRectype(LF_CESPI), _salini(LF_SALCE), _salpro(LF_SALCE), _ammini(LF_AMMCE), _ammpro(LF_AMMCE) { + _sosp_covid = ini_get_bool(CONFIG_DITTA, "ce", "SOSPAMM", false); read(id); } TCespite::TCespite(const TRectype& rec) : TRectype(rec), _salini(LF_SALCE), _salpro(LF_SALCE), _ammini(LF_AMMCE), _ammpro(LF_AMMCE) { + _sosp_covid = ini_get_bool(CONFIG_DITTA, "ce", "SOSPAMM", false); } diff --git a/src/ce/ce2101.h b/src/ce/ce2101.h index e2b032206..0b3b9e27b 100755 --- a/src/ce/ce2101.h +++ b/src/ce/ce2101.h @@ -12,6 +12,7 @@ enum TTipoVeicolo { tv_nessuno, tv_automobile, tv_motociclo, tv_ciclomotore, class TCespite : public TRectype { int _tipo_sit; + bool _sosp_covid; TRectype _salini, _salpro; TRectype _ammini, _ammpro; diff --git a/src/ce/ce3900.cpp b/src/ce/ce3900.cpp index 0c1d300e8..eff401b44 100755 --- a/src/ce/ce3900.cpp +++ b/src/ce/ce3900.cpp @@ -32,11 +32,13 @@ class TStampa_sintetica_mask : public TAutomask { bool _preview; + bool _excel; protected: bool on_field_event(TOperable_field& o, TField_event e, long jolly); public: bool preview() const { return _preview; } + bool excel() const { return _excel; } TStampa_sintetica_mask(); }; @@ -82,12 +84,23 @@ bool TStampa_sintetica_mask::on_field_event(TOperable_field& o, TField_event e, break; case DLG_PRINT: if (e == fe_button) + { _preview = false; + _excel = false; + } break; case DLG_PREVIEW: if (e == fe_button) { _preview = true; + _excel = false; + stop_run(K_ENTER); + } + break; + case DLG_EXPORT_EXCEL: + if (e == fe_button) + { + _excel = true; stop_run(K_ENTER); } break; @@ -96,7 +109,7 @@ bool TStampa_sintetica_mask::on_field_event(TOperable_field& o, TField_event e, return ok; } -TStampa_sintetica_mask::TStampa_sintetica_mask() : TAutomask("ce3900"), _preview(false) +TStampa_sintetica_mask::TStampa_sintetica_mask() : TAutomask("ce3900"), _preview(false), _excel(false) { } @@ -236,6 +249,8 @@ bool TStampa_sintetica_rep::get_usr_val(const TString& name, TVariant& var) cons { const TRecordset& recset = *recordset(); const TString& idcespite = recset.get(CESPI_IDCESPITE).as_string(); + + if (idcespite != _cespite.get(CESPI_IDCESPITE)) { TCespite& c = (TCespite&)_cespite; @@ -411,13 +426,30 @@ void TStampa_sintetica::main_loop() rep.load("ce3900b"); rep.set_filter(mask); + if (mask.excel()) + { + rep.section('H', 2).hide(); + rep.section('H', 3).hide(); + rep.section('H', 4).hide(); + rep.section('F', 2).hide(); + rep.section('F', 3).hide(); + rep.section('F', 4).hide(); + } book.add(rep); //stampa il book dei report - if (mask.preview()) - book.preview(); + if (mask.excel()) + { + TFilename out; + + out.tempdir(); out.add("cespsint.xls"); + book.export_excel(out, false, true, true); + } else - book.print(); + if (mask.preview()) + book.preview(); + else + book.print(); } } diff --git a/src/ce/ce3900.uml b/src/ce/ce3900.uml index e9f0a76cf..25011a2c9 100755 --- a/src/ce/ce3900.uml +++ b/src/ce/ce3900.uml @@ -1,6 +1,9 @@ #include "ce3900.h" TOOLBAR "topbar" 0 0 0 2 + +#define EXPORT_EXCEL + #include ENDPAGE diff --git a/src/ce/ce3900a.rep b/src/ce/ce3900a.rep index 4077f258c..45d037511 100755 --- a/src/ce/ce3900a.rep +++ b/src/ce/ce3900a.rep @@ -1,13 +1,13 @@ Registro cespiti sintetico - + USE CESPI KEY 2 \ No newline at end of file diff --git a/src/ce/ce3900b.rep b/src/ce/ce3900b.rep index ce6e4b0f7..96255ab24 100644 --- a/src/ce/ce3900b.rep +++ b/src/ce/ce3900b.rep @@ -1,13 +1,13 @@ Registro cespiti sintetico per codice cespite - + USE CESPI KEY 2 \ No newline at end of file diff --git a/src/f1/f1lib.cpp b/src/f1/f1lib.cpp index b154c3226..55a2ae491 100644 --- a/src/f1/f1lib.cpp +++ b/src/f1/f1lib.cpp @@ -1,6 +1,6 @@ #include "f1lib.h" #include "config.h" -#include "cglib.h" +#include "../cg/cglib.h" #include "execp.h" #include "cfven.h" #include "reputils.h" @@ -202,10 +202,10 @@ bool TFppro::associa_mov(const int numreg) const const char* TFppro::get_tipoprot() const { TString query; - static TString tipo; + query << "SELECT PZ_TIPOPROT AS TIPOPROT FROM FPPRO00F\r\n" << where_str(); _db->sq_set_exec(query); - return tipo.cut(0) = _db->sq_get("TIPOPROT"); + return _db->sq_get("TIPOPROT"); } const char* TFppro::get_numprot() const diff --git a/src/f9/f9lib.h b/src/f9/f9lib.h index 2223b405c..4649e4b1d 100644 --- a/src/f9/f9lib.h +++ b/src/f9/f9lib.h @@ -8,7 +8,7 @@ #include "strings.h" #include "date.h" #include "real.h" -#include "cglib.h" +#include "../cg/cglib.h" #include "sheet.h" #include "sqlset.h" #include "reprint.h" @@ -156,8 +156,9 @@ private: std::shared_ptr> _name_catdocs; int _mode_sheet; - std::shared_ptr find_causcont(const TString& caus); // OK - std::shared_ptr find_tipodoc(const TString& tipodoc); // OK + std::shared_ptr find_causcont(const TString& caus) const ; // OK + std::shared_ptr find_tipodoc(const TString& tipodoc) const ; // OK + std::shared_ptr find_tipodocsdi(const TString& tipodocsdi) const ; // OK std::vector>>::iterator find_sheet_annessi(const TString& catdoc); // OK @@ -193,6 +194,7 @@ public: std::shared_ptr get_sheet_catdocs(); std::shared_ptr get_sheet_ann(const TString& catdoc); std::shared_ptr mov2cat(int numreg); + const char * tipo2caus_cont(const TString & tipodoc) { std::shared_ptr c = find_tipodocsdi(tipodoc); if (c != nullptr) return c->causcont; else return ""; } void reload(); static void remove_all(); static void remove_all_ann(); diff --git a/src/f9/f9lib01.cpp b/src/f9/f9lib01.cpp index 25c4b58c4..02aa6e415 100644 --- a/src/f9/f9lib01.cpp +++ b/src/f9/f9lib01.cpp @@ -2,11 +2,11 @@ #include "f9lib.h" -#include "f1lib.h" +#include "../f1/f1lib.h" #include "f901tab.h" #include "progind.h" #include "clifo.h" -#include "cglib.h" +#include "../cg/cglib.h" #include "mov.h" #include "../fp/fplib.h" #include "annessif9.h" @@ -1269,7 +1269,7 @@ TF9_dberr::TF9_dberr() // TCategorie_doc /////////////////////////////////////////////////////////////////////////////////////////// -std::shared_ptr TCategorie_doc::find_causcont(const TString& caus) +std::shared_ptr TCategorie_doc::find_causcont(const TString& caus) const { for (auto it = _rows.begin(); it != _rows.end(); ++it) { @@ -1279,7 +1279,7 @@ std::shared_ptr TCategorie_doc::find_causcont(const return nullptr; } -std::shared_ptr TCategorie_doc::find_tipodoc(const TString& tipodoc) +std::shared_ptr TCategorie_doc::find_tipodoc(const TString& tipodoc) const { for (auto it = _rows.begin(); it != _rows.end(); ++it) { @@ -1290,6 +1290,16 @@ std::shared_ptr TCategorie_doc::find_tipodoc(const T return nullptr; } +std::shared_ptr TCategorie_doc::find_tipodocsdi(const TString& tipodocsdi) const +{ + for (auto it = _rows.begin(); it != _rows.end(); ++it) + { + if ((*it)->caus_sost == tipodocsdi) + return *it; + } + return nullptr; +} + std::vector>>::iterator TCategorie_doc::find_sheet_annessi(const TString& catdoc) { for(auto it = _sheets_annessi.begin(); it != _sheets_annessi.end(); ++it) diff --git a/src/li/lilib01.cpp b/src/li/lilib01.cpp index 9597a2bb7..5369f6f40 100644 --- a/src/li/lilib01.cpp +++ b/src/li/lilib01.cpp @@ -560,15 +560,19 @@ bool TLi_manager::plafond_rewrite(TDocumento& d) TToken_string plafs(d.get(DOC_PLAFOND), ','); const TString8 tipodoc = d.tipo().codice(); const TString4 stato = d.get(DOC_STATO); - real diff = (doc_ok(d) && has_valid_plafond() ? d.importo_plafond() : ZERO) - d.importo_plafond_salvato(); -// Calcolo le differenze tra il plafond attuale da verificare e quello precedente - if (diff != ZERO) - { - ok = utilizza_plafond(d, plafs, diff); - d.put(DOC_PLAFOND, plafs); - flush(); - } + if (doc_ok(d) && has_valid_plafond()) + { + const real diff = d.importo_plafond(true); + + // Calcolo le differenze tra il plafond attuale da verificare e quello precedente + if (diff != ZERO) + { + ok = utilizza_plafond(d, plafs, diff); + d.put(DOC_PLAFOND, plafs); + flush(); + } + } return ok; } diff --git a/src/res/print.png b/src/res/print.png index d328a9418..49d7240ce 100755 Binary files a/src/res/print.png and b/src/res/print.png differ diff --git a/src/res/resource.ini b/src/res/resource.ini index 6fa95d8fc..12d0bf4a5 100755 --- a/src/res/resource.ini +++ b/src/res/resource.ini @@ -48,6 +48,7 @@ 10236=intervento.ico 10237=attrezzature.ico 10238=camporep.ico +10239=senddoc.ico [Images] 101=ok.bmp diff --git a/src/res/setprint.png b/src/res/setprint.png index 3543b6458..29a0189b6 100755 Binary files a/src/res/setprint.png and b/src/res/setprint.png differ 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);