diff --git a/cg/cg0500.cpp b/cg/cg0500.cpp index 87d2151e7..4e5f0fc25 100755 --- a/cg/cg0500.cpp +++ b/cg/cg0500.cpp @@ -33,7 +33,7 @@ class TCaus_app : public TRelation_application TRecord_array * _rcaus_rec; // Parametri ditta - bool _valuta, _saldaconto; + bool _valuta, _saldaconto, _liqdiff; int _anno_iva; tipo_descr _last_descr; @@ -383,9 +383,9 @@ bool TCaus_app::tipomov_hndl (TMask_field& f, KEY k) bool TCaus_app::mostra_campi() { TMask& m = curr_mask(); - const TString& codreg = m.get(F_COD_REG); - if (codreg.empty()) + + if (codreg.blank()) { m.hide(F_AUTO_FAT); m.hide(F_ALLEGAT); @@ -420,7 +420,18 @@ bool TCaus_app::mostra_campi() } else { // codreg non vuoto - m.hide(F_OP_FINE_ANNO); + if (_liqdiff) + { + const TRegistro r(codreg, anno_iva()); + const bool reg_vendite = r.iva() == iva_vendite && !r.corrispettivi(); + + if (!reg_vendite) + m.reset(F_LIQDIFF); + m.show(F_LIQDIFF, reg_vendite); + } + else + m.reset(F_LIQDIFF); + m.hide(F_OP_FINE_ANNO); m.enable(F_MOV_VALU, valuta()); m.show(F_COD_CAUS_IM); @@ -856,7 +867,8 @@ void TCaus_app::on_config_change() TConfig conf(CONFIG_DITTA, "cg"); _saldaconto = conf.get_bool("GesSal"); - _valuta = conf.get_bool("GesVal"); + _valuta = conf.get_bool("GesVal"); + _liqdiff = conf.get_bool("GesLiqDiff"); _anno_iva = 0; TTable reg("REG"); diff --git a/cg/cg0500.h b/cg/cg0500.h index 5234cfaae..052a94e9e 100755 --- a/cg/cg0500.h +++ b/cg/cg0500.h @@ -35,6 +35,7 @@ #define F_PROVV 132 #define F_CODCAUREG 133 #define F_REGSPIVA 134 +#define F_LIQDIFF 135 #define SS_SEZIONE 102 #define SS_TIPOCF 103 diff --git a/cg/cg0500a.uml b/cg/cg0500a.uml index 8465d0ffa..2296863d3 100755 --- a/cg/cg0500a.uml +++ b/cg/cg0500a.uml @@ -276,24 +276,31 @@ END BOOLEAN F_MOV_VALU BEGIN - PROMPT 2 12 "Movimento in valuta" + PROMPT 2 11 "Movimento in valuta" FIELD MOVVAL GROUP 2 END BOOLEAN F_SOLAIVA BEGIN - PROMPT 34 12 "Movimento di sola IVA" + PROMPT 34 11 "Movimento di sola IVA" FIELD SOLOIVA END BOOLEAN F_MOV_SEZ BEGIN - PROMPT 34 12 "Movimento solo sezionale" + PROMPT 34 11 "Movimento solo sezionale" FIELD MOVSEZ FLAGS "H" END +BOOLEAN F_LIQDIFF +BEGIN + PROMPT 2 12 "Fattura di vendita a liquidazione differita" + FIELD LIQDIFF + FLAGS "H" +END + LIST F_PROVV 1 26 BEGIN PROMPT 2 13 "Movimento provvisorio " diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index 636f83824..87601e150 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -287,10 +287,18 @@ bool TPrimanota_application::read_caus(const char* cod, int year) numrif.set_justify(iva == iva_acquisti ? _num_for : _num_cli); numrif.set_trim(!numrif.right_justified()); activate_numrif(*m, false); + const TCausale & c = causale(); - const bool av = causale().reg().agenzia_viaggi(); + const bool av = c.reg().agenzia_viaggi(); m->show(F_DATA74TER, av); if (!av) m->reset(F_DATA74TER); + + const TRegistro & r = c.reg(); + + const bool reg_vendite = r.iva() == iva_vendite && !r.corrispettivi(); + const bool liqdiff = _liqdiff && c.liqdiff()&& reg_vendite; + m->show(F_DATAINC, liqdiff); + if (!liqdiff) m->reset(F_DATAINC); if (ins) { @@ -493,6 +501,7 @@ void TPrimanota_application::on_config_change() _ges_val = cnf.get_bool("GesVal"); _ges_sal = cnf.get_bool("GesSal"); _npart_is_prot = cnf.get_bool("RifPro"); + _liqdiff = cnf.get_bool("GesLiqDiff"); _num_cli = cnf.get_bool("NrCliDx"); _num_for = cnf.get_bool("NrForDx"); diff --git a/cg/cg2100.h b/cg/cg2100.h index 7af97eb2f..f781b3009 100755 --- a/cg/cg2100.h +++ b/cg/cg2100.h @@ -62,6 +62,7 @@ #define F_ADJUST_PRORATA 146 #define F_DATAINTRA 147 #define F_ADJUST_IVA 148 +#define F_DATAINC 149 #define F_GRUPPO 180 #define F_CONTO 181 diff --git a/cg/cg2100c.uml b/cg/cg2100c.uml index b5fcf1bac..ab7216419 100755 --- a/cg/cg2100c.uml +++ b/cg/cg2100c.uml @@ -534,6 +534,14 @@ BEGIN FIELD DATA74TER END +DATE F_DATAINC +BEGIN + PROMPT 52 15 "Data incasso " + WARNING "Data di incasso per liquidazione differita" + FIELD DATAINC + FLAGS "H" +END + NUMBER F_ANNORIF 4 BEGIN PROMPT 48 16 "Rif.partita " diff --git a/cg/cg2102.h b/cg/cg2102.h index 0169ed48c..b61a8d04e 100755 --- a/cg/cg2102.h +++ b/cg/cg2102.h @@ -35,6 +35,7 @@ class TPrimanota_application : public TRelation_application bool _ges_val, _ges_sal; // Gestione valuta e saldaconto bool _num_cli, _num_for; // Riferimento partita allineato a destra + bool _liqdiff; // Liquidazione differita bool _npart_is_prot; // Riferimento partita = n. prot. IVA anziche' doc bool _skip_giornale_check; // Ignora controllo data stampa libro giornale diff --git a/cg/cg2103.cpp b/cg/cg2103.cpp index bdd4ba172..f386fecd7 100755 --- a/cg/cg2103.cpp +++ b/cg/cg2103.cpp @@ -132,6 +132,9 @@ bool TCausale::valintra() const bool TCausale::soloiva() const { return _rec.get_bool(CAU_SOLOIVA); } +bool TCausale::liqdiff() const +{ return _rec.get_bool(CAU_LIQDIFF); } + int TCausale::regime_speciale() const { return _rec.get_int(CAU_REGSPIVA); } diff --git a/cg/cg2103.h b/cg/cg2103.h index 8ed8f6bda..31c54e776 100755 --- a/cg/cg2103.h +++ b/cg/cg2103.h @@ -38,6 +38,7 @@ public: bool intra() const; bool valintra() const; bool soloiva() const; + bool liqdiff() const; char provvisorio() const { return _provvisorio; } const TString& causale_inc_imm() const; const TString& causale_reg_iva() const; diff --git a/cg/cg2107.h b/cg/cg2107.h index fe9b62dbf..3c52c54f0 100755 --- a/cg/cg2107.h +++ b/cg/cg2107.h @@ -5,6 +5,10 @@ #include #endif +#ifndef __TREE_H +#include +#endif + #ifndef __CGLIB01_H__ #include "cglib01.h" #endif diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index e63fe5893..bd55103fd 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -1810,7 +1810,8 @@ bool TListaMov_application::segnala_errori_ogniriga() bool TListaMov_application::segnala_errori_iva() { TLocalisamfile& rmoviva = current_cursor()->file(LF_RMOVIVA); - + const TRectype& mv = current_cursor()->curr(LF_RMOV); + if (current_cursor()->is_first_match(LF_RMOVIVA)) { const TRecnotype nrec = rmoviva.recno(); @@ -1831,7 +1832,7 @@ bool TListaMov_application::segnala_errori_iva() } const TString4 cod = rec.get(RMI_CODIVA); real percind; - const int tipodet = codind2tipodet(rec.get_char(RMI_TIPODET), percind); + const int tipodet = get_tipodet_from_rmi(rec, mv, percind); const int tipocr = rec.get_int(RMI_TIPOCR); const TRectype& tab_iva = cache().get("%IVA", cod); if (!tab_iva.empty()) diff --git a/cg/cg3700.cpp b/cg/cg3700.cpp index 840534532..47ae5c2ee 100755 --- a/cg/cg3700.cpp +++ b/cg/cg3700.cpp @@ -139,7 +139,7 @@ bool TLista_fatture::filter_func1(const TRelation *r) if (a._tipo == indetraibile) { real percind; - const int tipodet = get_tipodet_from_rmi(riv, percind); + const int tipodet = get_tipodet_from_rmi(riv, mov, percind); if (tipodet == 0 || percind.is_zero()) return false; @@ -391,10 +391,11 @@ bool TLista_fatture::preprocess_page(int file, int counter) { TCursor* curs = current_cursor(); const TRectype& rec = curs->curr(); + const TRectype& mov = curs->curr(LF_MOV); _ragsoc = curs->curr(LF_CLIFO).get(CLI_RAGSOC); _ragsoc.strip_double_spaces(); real percind; - const int tipodet = get_tipodet_from_rmi(rec, percind); + const int tipodet = get_tipodet_from_rmi(rec, mov, percind); if (_tipo == indetraibile && percind < CENTO) { const int dec = TCurrency::get_firm_dec(); @@ -435,7 +436,6 @@ bool TLista_fatture::preprocess_page(int file, int counter) _tp_doc = 0.0; _tp_imp = 0.0; _tp_iva = 0.0; } - const TRectype& mov = curs->curr(LF_MOV); real doc = mov.get_real(MOV_TOTDOC); real imp = rec.get_real(RMI_IMPONIBILE); real iva = rec.get_real(RMI_IMPOSTA); @@ -707,7 +707,7 @@ void TLista_fatture::set_page(int file, int counter) else { real percind; - const int tipodet = get_tipodet_from_rmi(current_cursor()->curr(), percind); + const int tipodet = get_tipodet_from_rmi(current_cursor()->curr(), current_cursor()->curr(LF_MOV), percind); set_row(nriga,"@110g%d", tipodet); } set_row(nriga,"@112g@15n",FLD(LF_RMOVIVA,RMI_IMPOSTA)); diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index 7792d88e1..43000c17a 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -336,6 +336,8 @@ bool TLiquidazione_app::user_create() TRectype to(from); TDate f(1, 1, atoi(_year)); TDate t(1, _month == 13 ? 12 : _month, atoi(_year)); + +// qui se liquidazione diff. su ditta si parte da year-4 e filtro su anno o data liquid diff sul movim nel periodo t.set_end_month(); from.put(MOV_DATAREG, f); to.put(MOV_DATAREG, t); diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index a7b3e14a6..2e06152d6 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -848,7 +848,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) // da evitare di dover controllare mese e anno sul PIM const bool was_riv = (tipoiva != "NS") && (tipocr == 1 || tipocr ==5); real percind; - const int tipoind = get_tipodet_from_rmi(_rmoviva->curr(), percind); + const int tipoind = get_tipodet_from_rmi(_rmoviva->curr(), _mov->curr(), percind); const real imponibile_orig = _rmoviva->get_real(RMI_IMPONIBILE); const real imposta_orig = _rmoviva->get_real(RMI_IMPOSTA); @@ -1963,7 +1963,7 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt) // A partire dalla versione 3.1 la gestione dell'IVA 11 non viene piu' supportata ... // ... ergo non stiamo a gestire la indetraibilita' parziale real percind; - const int tipodet = get_tipodet_from_rmi(_rmoviva->curr(), percind); + const int tipodet = get_tipodet_from_rmi(_rmoviva->curr(), _mov->curr(), percind); real imponibile = _rmoviva->get_real(RMI_IMPONIBILE); real imposta = _rmoviva->get_real(RMI_IMPOSTA); const TString4 codiva = _iva->get("CODTAB"); diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index 39e54d75e..8e436a020 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -1294,7 +1294,9 @@ int TStampa_registri_app::stampa_prospetto(int rr, bool print_prec) rr++; set_row(rr, TR("Legenda Tipo Operazione: 1=operazione intracomunitaria 2=AF art.34 comma 3")); if (_auto_intraf) - set_row(rr, FR("@78g3=operazione intracomunitaria e AF art.34 comma 3")); + set_row(rr, FR("@78g3=operazione intracomunitaria e AF art.34 comma 3 4=Fattura a liquidazione differita")); + else + set_row(rr, FR("@78g4=Fattura a liquidazione differita")); rr++; _stampa = _st_tot_fin; @@ -2003,6 +2005,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) TString16 codval = mov.get(MOV_CODVALI); real corrval = mov.get_real(MOV_CORRVALUTA); bool autof = caus.get_bool(CAU_AUTOFATT); + bool liqdiff = caus.get_bool(CAU_LIQDIFF); TString80 descrcau = caus.get(CAU_DESCR); real totdoc = mov.get_real(MOV_TOTDOC); @@ -2229,6 +2232,8 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) tipo_op = "1"; else if (autof) tipo_op = "2"; + else if (liqdiff) + tipo_op = "4"; set_row(_r, "@66g%s", (const char*) tipo_op); diff --git a/cg/cg5100a.h b/cg/cg5100a.h index b95f28407..74f4069c9 100755 --- a/cg/cg5100a.h +++ b/cg/cg5100a.h @@ -62,6 +62,7 @@ #define CHK_INTRTR 357 #define CHK_DTCFPG 358 #define CHK_RIFPRO 359 +#define CHK_LIQDIF 360 // gruppi #define GROUP_SALDACONTO 1 diff --git a/cg/cg5100a.uml b/cg/cg5100a.uml index f25fe6e4a..4bd63d982 100755 --- a/cg/cg5100a.uml +++ b/cg/cg5100a.uml @@ -88,6 +88,14 @@ BEGIN GROUP GROUP_CONTABILITA END +BOOLEAN CHK_LIQDIF +BEGIN + PROMPT 40 7 "Gestione liquidazione differita" + HELP "Indicare se e' attivata anche la gestione della liquidazione differita delle fatture" + FIELD GesLiqDiff + GROUP GROUP_CONTABILITA +END + GROUPBOX DLG_NULL 76 7 BEGIN PROMPT 2 12 "@bParametri saldaconto" diff --git a/cg/cg6700.cpp b/cg/cg6700.cpp index 0306aac09..f2071d75c 100755 --- a/cg/cg6700.cpp +++ b/cg/cg6700.cpp @@ -906,7 +906,7 @@ bool TRic_ListaMov::controlla_riva() //_n_rec = rec.get_int(RMI_ANNOES); codiva = rec.get(RMI_CODIVA); real percind; - const int tipodet = get_tipodet_from_rmi(rec, percind); + const int tipodet = get_tipodet_from_rmi(rec, current_cursor()->file(LF_MOV).curr(), percind); tipocr = rec.get_int(RMI_TIPOCR); gruppocr = rec.get_int(RMI_GRUPPO); contocr = rec.get_int(RMI_CONTO); @@ -2296,7 +2296,7 @@ bool TRic_ListaMov::preprocess_page(int file,int counter) int numrig = rmoviva.get_int(RMI_NUMRIG); _tipocr = rmoviva.get_int(RMI_TIPOCR); real percind; - _tipod = get_tipodet_from_rmi(rmoviva, percind); + _tipod = get_tipodet_from_rmi(rmoviva, current_cursor()->file(LF_MOV).curr(), percind); _codiva = rmoviva.get(RMI_CODIVA); //_n_rec = cur->curr(LF_RMOVIVA).get_int(RMI_ANNOES); _gruppocr = rmoviva.get_int(RMI_GRUPPO); diff --git a/cg/cg6800.cpp b/cg/cg6800.cpp index 83ec1a21d..b8ed3e9a6 100755 --- a/cg/cg6800.cpp +++ b/cg/cg6800.cpp @@ -731,7 +731,7 @@ bool TVar_mov::setta_campi_maschera_iva(TMask& m) TString codiva (_tiva->get (RMI_CODIVA)); real imposta (_tiva->get_real(RMI_IMPOSTA)); real percind; - int tipodet = get_tipodet_from_rmi(_tiva->curr(), percind); + int tipodet = get_tipodet_from_rmi(_tiva->curr(), *_rec_mov, percind); int tipocr = _tiva->get_int (RMI_TIPOCR); int gruppo = _tiva->get_int (RMI_GRUPPO); int conto = _tiva->get_int (RMI_CONTO); diff --git a/cg/cg6902.cpp b/cg/cg6902.cpp index db57ddbbb..1d2b36d52 100755 --- a/cg/cg6902.cpp +++ b/cg/cg6902.cpp @@ -1324,7 +1324,9 @@ bool TInv_cont::invio_mov_IVA() record.overwrite(str,43); //Tipo costo/ricavo real percind; - const int tipodet = get_tipodet_from_rmi(_triva->curr(), percind); + const TRectype & mov = cache().get(LF_MOV, nreg); + const int tipodet = get_tipodet_from_rmi(_triva->curr(), mov, percind); + str.format("%01d", tipodet); record.overwrite(str,44); //Tipo detraibilita' diff --git a/cg/cgpagame.cpp b/cg/cgpagame.cpp index 45a1658f4..9c3b47d0c 100755 --- a/cg/cgpagame.cpp +++ b/cg/cgpagame.cpp @@ -44,14 +44,11 @@ TDate TPagamento::_rata_dfield(int n, int f) const /* Funzione sgradita al nuovo C ed anche a Guy: static bleah! const char* TPagamento::_rata_sfield(int n, int f) const { - static char kak[16]; TToken_string& t = (TToken_string&)_rate[n]; - const char* k = t.get(f); - if (k != NULL) - strncpy(kak, k, 16); - else - kak[0] = '\0'; - return kak; + TString & s = get_tmp_string(30); + + s = t.get(f); + return s; } */ diff --git a/cg/f23.dir b/cg/f23.dir index b2fa09388..08da14f49 100755 --- a/cg/f23.dir +++ b/cg/f23.dir @@ -1,3 +1,3 @@ 23 0 -$mov|0|0|365|0|Movimenti di prima nota||| +$mov|0|0|373|0|Movimenti di prima nota||| diff --git a/cg/f23.trr b/cg/f23.trr index e87750f8f..ba886ecf2 100755 --- a/cg/f23.trr +++ b/cg/f23.trr @@ -1,5 +1,5 @@ 23 -45 +46 ANNOES|9|4|0|Codice esercizio NUMREG|3|7|0|Numero di operazione DATAREG|5|8|0|Data operazione @@ -45,6 +45,7 @@ DPROVV|1|1|0|Documento originale PROVV DANNO|2|4|0|Documento originale ANNO DCODNUM|1|4|0|Documento originale CODNUM DNDOC|3|7|0|Documento originale NDOC +DATAINC|5|8|0|Data di incasso per liquidazione differita 3 NUMREG| DATAREG+NUMREG| diff --git a/cg/f26.dir b/cg/f26.dir index 04e2c6f4d..f4991528e 100755 --- a/cg/f26.dir +++ b/cg/f26.dir @@ -1,4 +1,3 @@ 26 0 -$caus|0|0|84|0|Causali contabili||| - +$caus|0|0|85|0|Causali contabili||| diff --git a/cg/f26.trr b/cg/f26.trr index 620c6869f..b855aaf40 100755 --- a/cg/f26.trr +++ b/cg/f26.trr @@ -1,5 +1,5 @@ 26 -24 +25 CODCAUS|1|3|0|Codice causale DESCR|1|50|0|Descrizione causale TIPODOC|1|2|0|Tipo documento @@ -24,6 +24,7 @@ SOLOIVA|8|1|0|Movimento di sola IVA PROVV|1|1|0|Tipo movimento (" " Normale, "P" Provvisorio cancellabile, "C" Provvisorio da cepiti) REGSPIVA|2|2|0|Regimi speciali IVA CODCAUREG|1|3|0|Causale regolarizzazione IVA +LIQDIFF|8|1|0|Fattue a liquidazione differita 2 CODCAUS| UPPER(DESCR)|X