diff --git a/src/ba/ba3100.cpp b/src/ba/ba3100.cpp index 3596cfa3d..c6b0560b4 100755 --- a/src/ba/ba3100.cpp +++ b/src/ba/ba3100.cpp @@ -9,6 +9,7 @@ #include "../cg/cgtbdel.h" #include "../cg/cgtbreg.h" #include "../cg/cgtbver.h" +#include "batbiva.h" #include "batbnoc.h" #include "batbval.h" @@ -24,6 +25,7 @@ #define TAB_DELEGHE "%DEL" #define TAB_DET "%DET" #define TAB_IVDIRETTIVA "%IVD" +#define TAB_IVA "%IVA" #define TAB_REGISTRI "REG" #define TAB_VALUTE "%VAL" #define TAB_VERSAMENTI "%VER" @@ -132,30 +134,30 @@ void TGeneric_table_app::copy_rec_in_insert_fields(TMask& m) } // ------------------------------------------------------------- -void TGeneric_table_app::init_insert_mode(TMask& m) +void TGeneric_table_app::init_insert_mode(TMask& m) { - const TString& n = get_tabname(); - if (n == TAB_REGISTRI) - { - const int anno = m.get_int(F_ANNO); + const TString& n = get_tabname(); + if (n == TAB_REGISTRI) + { + const int anno = m.get_int(F_ANNO); - m.set(F_STAMPA_INTESTAZIONE, _stampa_intest ? "X" : ""); - TTable reg(TAB_REGISTRI); - reg.put("CODTAB", m.get(F_ANNO)); + m.set(F_STAMPA_INTESTAZIONE, _stampa_intest ? "X" : ""); + TTable reg(TAB_REGISTRI); + reg.put("CODTAB", m.get(F_ANNO)); - const TRectype to(reg.curr()); + const TRectype to(reg.curr()); - _exist_journal = false; - _exist_dich_int = false; + _exist_journal = false; + _exist_dich_int = false; - // PIG programming mode - for (reg.read(_isgteq); !_exist_journal && reg.good() && reg.curr() <= to; reg.next()) - _exist_journal = (reg.get_long("I0") == REG_JOURNAL); + // PIG programming mode + for (reg.read(_isgteq); !_exist_journal && reg.good() && reg.curr() <= to; reg.next()) + _exist_journal = (reg.get_long("I0") == REG_JOURNAL); reg.zero(); - reg.put("CODTAB", m.get(F_ANNO)); - for (reg.read(_isgteq); !_exist_dich_int && reg.good() && reg.curr() <= to; reg.next()) - _exist_dich_int = (reg.get_long("I0") == REG_DICHINT); - } + reg.put("CODTAB", m.get(F_ANNO)); + for (reg.read(_isgteq); !_exist_dich_int && reg.good() && reg.curr() <= to; reg.next()) + _exist_dich_int = (reg.get_long("I0") == REG_DICHINT); + } else if (n == TAB_VERSAMENTI) { @@ -165,40 +167,65 @@ void TGeneric_table_app::init_insert_mode(TMask& m) copy_rec_in_insert_fields(m); } else - if (n == TAB_VALUTE) + if (n == TAB_VALUTE) m.enable(-3); + else + if (n == TAB_IVA) + { + const bool pro_rata_nd = ini_get_bool(CONFIG_STUDIO, "cg", "ProRataNumDen", false); + + if (!pro_rata_nd) + { + m.reset(FLD_NUM_B6); + m.reset(FLD_DEN_B7); + } + } } -void TGeneric_table_app::init_modify_mode(TMask& m) -{ - Tab_application::init_modify_mode(m); - const TString& n = get_tabname(); - if (n == TAB_REGISTRI) - { - TString16 config; - config.format("REG%05ld", m.get_long(F_CODDITTA)); - config << m.get(F_CODICE); - TConfig ini(CONFIG_STAMPE, config); - const int what = ini.get_int("Type", NULL, -1, -1); - m.set(F_CONFIG, what >= 0 ? "X" : ""); - m.enable(F_CONFIG, what >= 0); - } else - if (n == TAB_VALUTE) - { - m.disable(-3); // Disabilita scelta decimali e contro-euro - } else - if (n == TAB_VERSAMENTI) - { - load_rec_in_disabled_fields(m); - } - if (n == TAB_DET) +void TGeneric_table_app::init_modify_mode(TMask& m) +{ + Tab_application::init_modify_mode(m); + const TString& n = get_tabname(); + if (n == TAB_REGISTRI) { - const bool prot = get_relation()->curr().get_bool(FPC); - - m.enable(DLG_SAVEREC, !prot); - m.enable(DLG_DELREC, !prot); + TString16 config; + config.format("REG%05ld", m.get_long(F_CODDITTA)); + config << m.get(F_CODICE); + TConfig ini(CONFIG_STAMPE, config); + const int what = ini.get_int("Type", NULL, -1, -1); + m.set(F_CONFIG, what >= 0 ? "X" : ""); + m.enable(F_CONFIG, what >= 0); } -} + else + if (n == TAB_VALUTE) + { + m.disable(-3); // Disabilita scelta decimali e contro-euro + } + else + if (n == TAB_VERSAMENTI) + { + load_rec_in_disabled_fields(m); + } + else + if (n == TAB_DET) + { + const bool prot = get_relation()->curr().get_bool(FPC); + + m.enable(DLG_SAVEREC, !prot); + m.enable(DLG_DELREC, !prot); + } + else + if (n == TAB_IVA) + { + const bool pro_rata_nd = ini_get_bool(CONFIG_STUDIO, "cg", "ProRataNumDen", false); + + if (!pro_rata_nd) + { + m.reset(FLD_NUM_B6); + m.reset(FLD_DEN_B7); + } + } +} void TGeneric_table_app::init_query_mode(TMask& m) { @@ -642,6 +669,14 @@ bool TGeneric_table_app::user_create() if (name == TAB_NOMENCOMB) mask.set_handler(NOC_CODICE2, codnoc_handler); + if (name == TAB_IVA) + { + const bool pro_rata_nd = ini_get_bool(CONFIG_STUDIO, "cg", "ProRataNumDen", false); + + mask.show(FLD_NUM_B6, pro_rata_nd); + mask.show(FLD_DEN_B7, pro_rata_nd); + } + if (name == TAB_IVDIRETTIVA) mask.set_handler(F_NUM, numivd_handler); } diff --git a/src/ba/ba3700.cpp b/src/ba/ba3700.cpp index 96f04f49f..67006208f 100755 --- a/src/ba/ba3700.cpp +++ b/src/ba/ba3700.cpp @@ -382,40 +382,36 @@ bool TCond_pag_app::ult_class(TMask_field& f, KEY k) bool TCond_pag_app::cond_pagamento(TMask_field& f, KEY k) { - if (!f.to_check(k) || f.mask().query_mode() || !f.mask().get(F_NUM_RATE).full()) - return true; - // Controllo se il tipo è coerente con quello segnato prima - int nrate = f.mask().get_int(F_NUM_RATE); - bool err = false; - switch (atoi(f.get().right(1))) - { - // Pagamento a rate - case 1: - if (nrate <= 1) - { - err = true; - f.set("TP02"); - } - break; - // Pagamento completo - case 2: - if (nrate > 1) - { - err = true; - f.set("TP01"); - } - break; - // Pagamento anticipo - case 3: - // Non so che fare! - break; - } - if(err) + if (f.to_check(k) || (!f.mask().query_mode() && k == K_ENTER)) + { + // Controllo se il tipo è coerente con quello segnato prima + int nrate = f.mask().sfield(F_SHEET_RPG).items(); + + switch (atoi(f.get().right(1))) { + case 1: // Pagamento a rate + if (nrate <= 1) + { + warning_box("Impossibile impostare questo tipo di pagamento con %d rat%c!", nrate, nrate == 0 ? 'e' : 'a'); + f.set("TP02"); + } + break; + // Pagamento completo + case 2: + if (nrate > 1) + { warning_box("Impossibile impostare questo tipo di pagamento con %d rate!", nrate); + f.set("TP01"); + } + break; + // Pagamento anticipo + case 3: + // Non so che fare! + break; } - return true; + } + return true; } // qui viene il belloccio diff --git a/src/ba/batbiva.h b/src/ba/batbiva.h index a6c7da1d3..4dd8920c2 100755 --- a/src/ba/batbiva.h +++ b/src/ba/batbiva.h @@ -25,3 +25,5 @@ #define FLD_INDET_S4 126 #define FLD_NATURA 127 #define CHK_TABIVA_B5 128 +#define FLD_NUM_B6 129 +#define FLD_DEN_B7 130 diff --git a/src/ba/batbiva.uml b/src/ba/batbiva.uml index 96c51adc9..3da9e088c 100755 --- a/src/ba/batbiva.uml +++ b/src/ba/batbiva.uml @@ -326,9 +326,23 @@ ITEM "N6|N6 - IVA in reverse charge" ITEM "N7|N7 - IVA assolta in altro stato U3" END +BOOLEAN FLD_NUM_B6 +BEGIN + PROMPT 3 21 "Fa parte del numeratore pro-rata" + MESSAGE TRUE DISABLE,FLD_DEN_B7|"X",FLD_DEN_B7 + MESSAGE FALSE ENABLE,FLD_DEN_B7 + FIELD B6 +END + +BOOLEAN FLD_DEN_B7 +BEGIN + PROMPT 40 21 "Fa parte del denominatore pro-rata" + FIELD B7 +END + BOOLEAN FLD_SOSPESO_B2 BEGIN - PROMPT 3 21 "Codice IVA sospeso" + PROMPT 3 22 "Codice IVA sospeso" FIELD B2 END