diff --git a/src/cg/cg0500.h b/src/cg/cg0500.h index 3532341c8..8dd44b4e9 100755 --- a/src/cg/cg0500.h +++ b/src/cg/cg0500.h @@ -38,7 +38,6 @@ #define F_MOVCGIND 235 #define F_RIL_FT_EM_RI 236 #define F_DATAREG_PREC 237 -#define F_FAT_RITARDO_IND 238 #define SS_TIPO 101 #define SS_SEZIONE 102 diff --git a/src/cg/cg0500a.uml b/src/cg/cg0500a.uml index 0004b47fb..0f5d83892 100755 --- a/src/cg/cg0500a.uml +++ b/src/cg/cg0500a.uml @@ -251,13 +251,6 @@ BEGIN GROUP 2 END -BOOLEAN F_FAT_RITARDO_IND -BEGIN - PROMPT 34 8 "Fattura in ritardo indeducibile" - FIELD RITFATTIND - GROUP 2 -END - STRING F_COD_CAUS_IM 3 BEGIN PROMPT 34 9 "Codice causale collegata " diff --git a/src/cg/cg2100.cpp b/src/cg/cg2100.cpp index e2b245676..52609dc63 100755 --- a/src/cg/cg2100.cpp +++ b/src/cg/cg2100.cpp @@ -853,6 +853,7 @@ void TPrimanota_application::init_insert_mode(TMask& m) m.field(F_RITFIS).set_prompt(PR("IVA intracomun. ")); else m.field(F_RITFIS).set_prompt(PR("Ritenute fiscali ")); + m.set(F_RITFATT, app().causale().fattura_in_ritardo() ? "X" : " "); } else { diff --git a/src/cg/cg2100.h b/src/cg/cg2100.h index d22091eeb..bd77f9f14 100755 --- a/src/cg/cg2100.h +++ b/src/cg/cg2100.h @@ -19,6 +19,7 @@ #define F_DATACOMP 116 #define F_ANNOIVA 117 #define F_NUMDOCEXT 130 +#define F_RITFATT 231 #define F_CLIFO 128 #define F_CLIENTE 151 diff --git a/src/cg/cg2100c.uml b/src/cg/cg2100c.uml index 609366e9a..f7e5e65e9 100755 --- a/src/cg/cg2100c.uml +++ b/src/cg/cg2100c.uml @@ -573,6 +573,12 @@ BEGIN FIELD REVCHARGE END +BOOLEAN F_RITFATT +BEGIN + PROMPT 25 17 "Fattura in ritardo " + FIELD RITFATT +END + DATE F_DATA74TER BEGIN PROMPT 52 15 "Data 74/ter " diff --git a/src/cg/cg2102.cpp b/src/cg/cg2102.cpp index efec158e5..e3cf326ed 100755 --- a/src/cg/cg2102.cpp +++ b/src/cg/cg2102.cpp @@ -1294,7 +1294,7 @@ bool TPrimanota_application::codiva_handler(TMask_field& f, KEY key) { TBill b; app().IVA2bill(iva, b); - char cr[2] = { b.tipo_cr() + '0', '\0' }; + char cr[2] = { ((char) b.tipo_cr()) + '0', '\0' }; m.set(105, *cr > '0' ? cr : ""); const char tipo[2] = { b.tipo(), '\0' }; @@ -2318,6 +2318,7 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key) const long protocol = app().causale().reg().protocol() + 1; m.set(F_PROTIVA, protocol); + m.set(F_RITFATT, app().causale().fattura_in_ritardo() ? "X" : " "); } } diff --git a/src/cg/cg2103.cpp b/src/cg/cg2103.cpp index 3d21858a2..2f99c1c74 100755 --- a/src/cg/cg2103.cpp +++ b/src/cg/cg2103.cpp @@ -268,13 +268,18 @@ char TCausale::sezione_ritfis() const char TCausale::sezione_revcharge() const { - if (_sezione_revcharge <= ' ') - { - (char&)_sezione_revcharge = sezione(RIGA_REVERSE_CHARGE); - if (_sezione_revcharge < 'A') - (char&)_sezione_revcharge = sezione_clifo(); - } - return _sezione_revcharge; + if (_sezione_revcharge <= ' ') + { + (char&)_sezione_revcharge = sezione(RIGA_REVERSE_CHARGE); + if (_sezione_revcharge < 'A') + (char&)_sezione_revcharge = sezione_clifo(); + } + return _sezione_revcharge; +} + +bool TCausale::fattura_in_ritardo() const +{ + return _rec.get_bool(CAU_RITFATT); } diff --git a/src/cg/cg2103.h b/src/cg/cg2103.h index 76d8894eb..f64af3ed4 100755 --- a/src/cg/cg2103.h +++ b/src/cg/cg2103.h @@ -73,6 +73,7 @@ public: char sezione_ritsoc() const; char sezione_ritfis() const; char sezione_revcharge() const ; + bool fattura_in_ritardo() const; virtual bool reread(); virtual bool read(const char* cod, int year); diff --git a/src/cg/cg4301.cpp b/src/cg/cg4301.cpp index c66e86cce..bf6a253af 100755 --- a/src/cg/cg4301.cpp +++ b/src/cg/cg4301.cpp @@ -1146,15 +1146,16 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array & if (date.year() != year_int) // Controlla anno di appartenenza, altrimenti is_date_ok potrebbe non funzionare continue; } - const TRectype& rcs = _cur->curr(LF_CAUSALI); - const TDate datareg = _mov->get_date(MOV_DATAREG); - const TDate datadoc = _mov->get_date(MOV_DATADOC); - const bool dataritind = ((tipomov == acquisto) && (_year >= 2018)) && ((datareg.year() - datadoc.year()) > 1 ) || - (((datareg.year() - datadoc.year()) == 1) && datareg.month() >= 5); - const bool datarit = ((tipomov == acquisto) && !dataritind) && ((datareg.year() - datadoc.year()) == 1); - const bool fattritind = (_year >= 2018) && (rcs.get_bool(CAU_RITFATTIND) || dataritind); - const bool fattrit = rcs.get_bool(CAU_RITFATT) || datarit; - const bool cau_intra = rcs.get_bool(CAU_INTRACOM); + const TRectype& rcs = _cur->curr(LF_CAUSALI); + const TDate datareg = _mov->get_date(MOV_DATAREG); + const TDate datadoc = _mov->get_date(MOV_DATADOC); + const bool fatt_rit_2018 = atoi(_year) >= 2018 && _mov->get_bool(MOV_RITFATT); + const int year_diff = datareg.year() - datadoc.year(); + const bool dataritind = ((tipomov == acquisto) && fatt_rit_2018) && + ((year_diff > 2) || ((year_diff >= 1) && datareg.month() >= 5)); + const bool fattrit = ((tipomov == acquisto) && !dataritind) && (year_diff >= 1); + const bool fattritind = (rcs.get_bool(CAU_RITFATT) && atoi(_year) < 2018) || dataritind; + const bool cau_intra = rcs.get_bool(CAU_INTRACOM); const bool cau_valintra = rcs.get_bool(CAU_VALINTRA); /* diff --git a/src/cg/f23.dir b/src/cg/f23.dir index b8aa4ea39..d76838de3 100755 --- a/src/cg/f23.dir +++ b/src/cg/f23.dir @@ -1,3 +1,3 @@ 23 0 -$mov|89161|89161|477|0|Movimenti di prima nota|NMOV|| +$mov|0|0|478|0|Movimenti di prima nota|NMOV|| diff --git a/src/cg/f23.trr b/src/cg/f23.trr index 299c55f11..e60dbf0db 100755 --- a/src/cg/f23.trr +++ b/src/cg/f23.trr @@ -1,10 +1,11 @@ 23 -57 +58 ANNOES|9|4|0|Codice esercizio NUMREG|3|7|0|Numero di operazione DATAREG|5|8|0|Data operazione DATACOMP|5|8|0|Data competenza DATADOC|5|8|0|Data documento +RITFATT|8|1|0|Fattura in ritardo DATA74TER|5|8|0|Data per art. 74 ter MESELIQ|2|2|0|Mese per liquidazione differita NUMDOC|1|7|0|Numero documento diff --git a/src/cg/f26.dir b/src/cg/f26.dir index 4ff6f8270..0ba20e75b 100755 --- a/src/cg/f26.dir +++ b/src/cg/f26.dir @@ -1,3 +1,3 @@ 26 0 -$caus|0|0|89|0|Causali contabili|60|| +$caus|0|0|88|0|Causali contabili|60|| diff --git a/src/cg/f26.trr b/src/cg/f26.trr index 80017dd38..ba31a4cd6 100755 --- a/src/cg/f26.trr +++ b/src/cg/f26.trr @@ -1,5 +1,5 @@ 26 -29 +28 CODCAUS|1|3|0|Codice causale DESCR|1|50|0|Descrizione causale TIPODOC|1|2|0|Tipo documento @@ -14,7 +14,6 @@ AUTOFATT|8|1|0|Autofattura art. ?? MOVSEZ|8|1|0|Movimento sezionale ?? TIPOMOV|2|1|0|Tipo movimento saldaconto RITFATT|8|1|0|Fattura in ritardo -RITFATTIND|8|1|0|Fattura in ritardo indeducibile COLLCESP|1|1|0|Collegamnto ai cespiti M770|1|1|0|Collegamento al 770 CODCAUSIM|1|3|0|Codice causale incasso immediato