diff --git a/src/ba/ba3400.cpp b/src/ba/ba3400.cpp index 14a4dd375..62cccd6b1 100755 --- a/src/ba/ba3400.cpp +++ b/src/ba/ba3400.cpp @@ -52,26 +52,24 @@ bool TTestrel_application::user_destroy() // Testmask /////////////////////////////////////////////////////////// -class TTest_application : public TApplication +class TTest_application : public TSkeleton_application { const char* _maskname; protected: - bool create() { return menu(0); } - bool destroy() { return TRUE; } - bool menu(MENU_TAG); + void main_loop(); public: TTest_application(const char* name) : _maskname(name) {} }; -bool TTest_application::menu(MENU_TAG) +void TTest_application::main_loop() { if (*_maskname) { TMask m(_maskname); - KEY k = m.run(); - if (k == K_QUIT) stop_run(); + + while (m.run() == K_ENTER); } else { @@ -83,8 +81,6 @@ bool TTest_application::menu(MENU_TAG) m.run(); } } - - return FALSE; } /////////////////////////////////////////////////////////// diff --git a/src/ba/ba3400a.uml b/src/ba/ba3400a.uml index b056d73fb..7ef31e31b 100755 --- a/src/ba/ba3400a.uml +++ b/src/ba/ba3400a.uml @@ -4,7 +4,7 @@ PAGE "Richiesta" -1 -1 76 12 STRING F_NOME 50 BEGIN - PROMPT 3 3 "Nome maschera" + PROMPT 3 3 "Maschera " END BUTTON DLG_OK 10 2 diff --git a/src/ba/ba8300.cpp b/src/ba/ba8300.cpp index 39f52ec14..2f8ffe6bd 100755 --- a/src/ba/ba8300.cpp +++ b/src/ba/ba8300.cpp @@ -567,6 +567,13 @@ bool TReport_mask::save_report() if (ok) _is_dirty = false; } + if (is_power_station()) + { + DIRECTORY dir; + + xvt_fsys_get_default_dir(&dir); + xvt_fsys_set_dir(&dir); + } return ok; } diff --git a/src/ba/ba8300a.uml b/src/ba/ba8300a.uml index e9725ed2f..1973ee7b2 100755 --- a/src/ba/ba8300a.uml +++ b/src/ba/ba8300a.uml @@ -7,7 +7,7 @@ BEGIN PROMPT 1 0 "" RSELECT "" WARNING "E' necessario specificare il codice" - CHECKTYPE REQUIRED +// CHECKTYPE REQUIRED END STRING F_DESCR 50 46 diff --git a/src/ba/batbiva.uml b/src/ba/batbiva.uml index ddaacf0b2..8feac107b 100755 --- a/src/ba/batbiva.uml +++ b/src/ba/batbiva.uml @@ -46,7 +46,7 @@ BEGIN WARNING "Manca la descrizione" END -LIST LST_TABIVA_S1 2 20 +LIST LST_TABIVA_S1 2 28 BEGIN PROMPT 2 2 "Tipo " FIELD S1 @@ -70,11 +70,15 @@ BEGIN MESSAGE CLEAR,FLD_TABIVA_R0|CLEAR,FLD_TABIVA_I0 MESSAGE ENABLE,FLD_TABIVA_I3|ENABLE,FLD_TABIVA_I4|SHOW,CHK_TABIVA_B5 MESSAGE ENABLE,FLD_TABIVA_S6 -END + ITEM "RC|Reverse Charge (vendite)" + MESSAGE CLEAR,FLD_TABIVA_R0|CLEAR,FLD_TABIVA_I0 + MESSAGE ENABLE,FLD_TABIVA_I3|ENABLE,FLD_TABIVA_I4|SHOW,CHK_TABIVA_B5 + MESSAGE ENABLE,FLD_TABIVA_S6 + END STRING FLD_TABIVA_S6 4 BEGIN - PROMPT 39 2 "C.IVA a cui ventilare " + PROMPT 44 2 "C.IVA a cui ventilare " FLAGS "U" FIELD S6 COPY USE FLD_TABIVA_CODTAB @@ -146,7 +150,7 @@ END BOOLEAN CHK_TABIVA_B5 BEGIN - PROMPT 30 5 "Escluso dal calcolo dei bolli sufatture esenti" + PROMPT 30 5 "Escluso dal calcolo dei bolli su fatture esenti" FIELD B5 END @@ -188,6 +192,8 @@ BEGIN INPUT FLD_TABIVA_I3 OUTPUT FLD_TABIVA_I3 ITEM " |Nessuno" + ITEM "14|Passaggi interni" + ITEM "16|Cessioni beni ammortizzabili" ITEM "20|Operazioni non imponibili (comma 1, artt.8, 8bis e 9)" ITEM "21|Operazioni non imponibili a seguito di dich. d'intento" ITEM "22|Altre operazioni non imponibili" @@ -201,6 +207,7 @@ BEGIN ITEM "36|Cessione di microprocessori" ITEM "37|Prestazioni comparto edile e settori connessi" ITEM "38|Operazioni settore energetico" + ITEM "39|Reverse charge altri casi" ITEM "B1|Ammontare op. es. escluse da nr. 1 a 9 e 11 art. 10" ITEM "B2|Ammontare op. es. di cui al nr. 11 art. 10" ITEM "B3|Ammontare op. es. di cui ai nr. 1 a 9 art. 10" diff --git a/src/cg/IVA 2021 modello.pdf b/src/cg/IVA 2021 modello.pdf index 751ef298a..3ad932477 100644 Binary files a/src/cg/IVA 2021 modello.pdf and b/src/cg/IVA 2021 modello.pdf differ diff --git a/src/cg/cg0700a.h b/src/cg/cg0700a.h index b8b26c64b..77287152d 100755 --- a/src/cg/cg0700a.h +++ b/src/cg/cg0700a.h @@ -16,4 +16,14 @@ #define O_COMUNENAS 113 #define O_DENCOMNAS 114 #define O_STATOPAIV 115 - +#define O_REFERENTE 116 +#define O_BYMAIL 117 +#define O_MAIL 118 +#define O_DOCMAIL 119 +#define O_PEC 120 +#define O_PTEL 121 +#define O_TEL 122 +#define O_PTEL2 123 +#define O_TEL2 124 +#define O_PTEL3 125 +#define O_TEL3 126 \ No newline at end of file diff --git a/src/cg/cg0700a.uml b/src/cg/cg0700a.uml index be9c697ef..4da533627 100755 --- a/src/cg/cg0700a.uml +++ b/src/cg/cg0700a.uml @@ -200,6 +200,99 @@ BEGIN //CHECKTYPE NORMAL END +STRING O_REFERENTE 50 +BEGIN +PROMPT 2 14 "Referente " +FIELD REFERENTE +END + +TEXT DLG_NULL +BEGIN + PROMPT 2 15 "E-Mail" +END + +STRING O_MAIL 50 25 +BEGIN + PROMPT 2 16 "Normale " + FIELD MAIL +END + +BOOLEAN O_BYMAIL +BEGIN + PROMPT 40 16 "Consenso spedizione doc tramite email" + FIELD BYMAIL + MESSAGE FALSE CLEAR,O_DOCMAIL + MESSAGE TRUE ENABLE,O_DOCMAIL +END + +STRING O_DOCMAIL 50 25 +BEGIN + PROMPT 2 17 "Documenti " + FIELD DOCMAIL + CHECKTYPE REQUIRED +END + +STRING O_PEC 80 45 +BEGIN + PROMPT 2 18 "Pec " + FIELD PEC +END + +STRING O_PTEL 5 +BEGIN + PROMPT 2 19 "Telefono " + FIELD PTEL + HELP "Prefisso telefonico primo recapito" +END + +STRING O_TEL 20 15 +BEGIN + PROMPT 18 19 "/" + FIELD TEL + HELP "Numero telefonico primo recapito" +END + +STRING O_PTEL2 5 +BEGIN + PROMPT 11 20 " " + FIELD PTEL2 + HELP "Prefisso telefonico secondo recapito" +END + +STRING O_TEL2 20 15 +BEGIN +PROMPT 18 20 "/" +FIELD TEL2 +HELP "Numero telefonico secondo recapito" +END + +STRING O_PTEL3 5 +BEGIN + PROMPT 11 21 " " + FIELD PTEL3 + HELP "Prefisso telefonico terzo recapito" +END + +STRING O_TEL3 20 15 +BEGIN + PROMPT 18 21 "/" + FIELD TEL3 + HELP "Numero telefonico terzo recapito" +END + +STRING DLG_NULL 50 32 +BEGIN + PROMPT 1 -1 "Ultimo aggiornamento " + FLAGS "D" + FIELD UTENTE +END + +DATE DLG_NULL +BEGIN + PROMPT 60 -1 "" + FLAGS "D" + FIELD DATAAGG +END ENDPAGE ENDMASK diff --git a/src/cg/cg2100.cpp b/src/cg/cg2100.cpp index b80cb07b2..2ccf04096 100755 --- a/src/cg/cg2100.cpp +++ b/src/cg/cg2100.cpp @@ -988,7 +988,7 @@ void TPrimanota_application::init_insert_mode(TMask& m) const TString4 codreg = reg.name(); const int regyear = reg.year(); - reg.force_read(codreg, regyear); + //reg.force_read(codreg, regyear); const long protiva = reg.protocol() + 1; m.set(F_PROTIVA, protiva, true); // Aggiorna protocollo IVA @@ -1911,7 +1911,7 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm) _automatico->_numdoc.cut(0); TRegistro & cr = (TRegistro &) cached_registro(causreg.codice_registro()); - cr.reread(); + // cr.reread(); _automatico->_numdoc << cr.protocol() + 1; } else diff --git a/src/cg/cg3100.cpp b/src/cg/cg3100.cpp index 93cbb523d..a464d73d0 100755 --- a/src/cg/cg3100.cpp +++ b/src/cg/cg3100.cpp @@ -68,7 +68,8 @@ class TListaMov_application : public TPrintapp int _ricser; bool _settata_prima_riga, _causale_gia_stampata,_mov_di_sola_iva; int _cur1,_cur2,_cur2b,_cur3,_cur4,_decidi,/*_tipod,*/_controllo_mov_errati; - int _numero_riga, _alleg, _tiporegistro, _scelta_stampa, _nr, _n; + int _numero_riga, _alleg, _scelta_stampa, _nr, _n; + tiporeg _tiporegistro; int _provvis; liste _tipo_lista; word _flags; @@ -481,11 +482,11 @@ bool TListaMov_application::filter_func_fatture (const TRelation* rel) const int ann_reg = mov.get_int(MOV_ANNOIVA); const TString4 cod_reg = mov.get(MOV_REG); - const int tipo_reg = tipo_registro(cod_reg, ann_reg); + const tiporeg tipo_reg = cached_registro(cod_reg, ann_reg).tipo_registro(); // Considera solo iva acquisti o vendite - if (tipo_reg != 1 && tipo_reg != 2) - return FALSE; + if (tipo_reg != vendita && tipo_reg != acquisto) + return false; if (app()._annoes > 0) //anno esercizio specificato nella maschera { @@ -536,8 +537,10 @@ bool TListaMov_application::filter_func (const TRelation * rel) { const TString& cod_reg = mov.get(MOV_REG); const int ann_reg = mov.get_int(MOV_ANNOIVA); - const int tipo_reg = tipo_registro(cod_reg, ann_reg); - if (tipo_reg == 1 || tipo_reg == 2) + const tiporeg tipo_reg = cached_registro(cod_reg, ann_reg).tipo_registro(); + + // Considera solo iva acquisti o vendite + if (tipo_reg != vendita && tipo_reg != acquisto) return false; } @@ -626,9 +629,10 @@ void TListaMov_application::stampa_errori_rmov() else set_row(_nr++, FR("@11gCodice C/F non presente in Anagrafica")); if (_registro.not_empty()) //se su mov e' indicato il codice registro { - TRegistro rg (_registro, _ae); - const int tiporeg = rg.tipo(); - if ((tiporeg == 1 && t != 'C') || (tiporeg == 2 && t != 'F')) + const TRegistro & reg = cached_registro(_registro, _ae); + const tiporeg tipo = reg.tipo_registro(); + + if ((tipo == vendita && t != 'C') || (tipo == acquisto && t != 'F')) set_row(_nr++, FR("@11gTipo C/F non compatibile con tipo registro")); } } @@ -715,14 +719,14 @@ void TListaMov_application::stampa_errori_iva(int* nr, const TRigaiva& riva) const int tipocr = riva._tipocr; if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9) - if (_tiporegistro != 2) + if (_tiporegistro != acquisto) set_row(++(*nr), FR("@11gCodice di indetraibilita' errato")); - if (_tiporegistro == 1) + if (_tiporegistro == vendita) if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9) set_row(++(*nr), FR("@11gTipo costo/ricavo non valido")); - if (_tiporegistro == 2) + if (_tiporegistro == acquisto) if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9) set_row(++(*nr), FR("@11gTipo costo/ricavo non valido")); } @@ -782,11 +786,11 @@ void TListaMov_application::set_page(int file, int count) TString16 reg = current_cursor()->curr(LF_MOV).get(MOV_REG); int anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA); char prov = current_cursor()->curr(LF_MOV).get_char(MOV_PROVVIS); - int tipo = tipo_registro(reg, anno); - + const tiporeg tipo = cached_registro(reg, anno).tipo_registro(); TEsercizi_contabili esc; + esc.date2esc(data); // qui verificare - if ( (tipo == 1) || (tipo == 2) ) + if ( (tipo == vendita) || (tipo == acquisto) ) { set_row (_n, FR("@103greg @3s"),FLD(LF_MOV,MOV_REG)); set_row (_n, FR("@111gpr @5n"),FLD(LF_MOV,MOV_PROTIVA)); @@ -860,7 +864,8 @@ bool TListaMov_application::preprocess_page(int file,int counter) _codcf = curmov.get_long(MOV_CODCF); _numero = curmov.get_long(MOV_NUMREG); _codval = curmov.get(MOV_CODVALI); - _tiporegistro = tipo_registro(_registro, _anno); + _tiporegistro = cached_registro(_registro, _anno).tipo_registro(); + _causale_gia_stampata = FALSE; TEsercizi_contabili esc; @@ -987,11 +992,9 @@ bool TListaMov_application::preprocess_page(int file,int counter) _descr_causale = caus.get(CAU_DESCR); _alleg_causale = caus.get_bool(CAU_ALLEG); _tipodocumento = caus.get(CAU_TIPODOC); - - _tiporegistro = tipo_registro (_registro, _anno); - - if ((_tiporegistro != 1)&&(_tiporegistro != 2))//se si tratta di un movimento di sola prima nota - return TRUE; + _tiporegistro = cached_registro(_registro, _anno).tipo_registro(); + if ((_tiporegistro != vendita) && (_tiporegistro != acquisto))//se si tratta di un movimento di sola prima nota + return true; } } else if (file == LF_RMOV) @@ -1038,10 +1041,10 @@ bool TListaMov_application::preprocess_page(int file,int counter) _numr = curmov.get_long(MOV_NUMREG); _tipo_elenco = curmov.get(MOV_TIPO); _codcf = curmov.get_long(MOV_CODCF); - const int tiporeg = tipo_registro (codreg, anno); - const TString8 attreg = AttivitaRegistro (codreg, anno); + const tiporeg tiporeg = cached_registro(codreg, anno).tipo_registro(); + const TString8 attreg = cached_registro(codreg, anno).attivita(); - if (tiporeg == 1 || tiporeg == 2)//se si tratta di un movimento iva + if (tiporeg == vendita || tiporeg == acquisto)//se si tratta di un movimento iva { _tipoatt = TipoAttivita(attreg, get_firm()); _tipo_elenco = curmov.get(MOV_TIPO); @@ -1870,18 +1873,18 @@ bool TListaMov_application::segnala_errori_iva() return true; } if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9) - if (_tiporegistro != 2) + if (_tiporegistro != acquisto) { rmoviva.readat(nrec); return true; } - if (_tiporegistro == 1) + if (_tiporegistro == vendita) if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9) { rmoviva.readat(nrec); return true; } - if (_tiporegistro == 2) + if (_tiporegistro == acquisto) if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9) { rmoviva.readat(nrec); diff --git a/src/cg/cg3300.cpp b/src/cg/cg3300.cpp index 36182580b..d57bc2739 100755 --- a/src/cg/cg3300.cpp +++ b/src/cg/cg3300.cpp @@ -25,6 +25,7 @@ #include "cg3.h" #include "cg3300.h" +#include "cglib.h" #include "cg3300a.h" #include "cg3300b.h" @@ -469,18 +470,19 @@ void TStampa_allegati::ricalcola(int anno_dic) { pi.addstatus(1); - const int tiporeg = reg.get_int("I0"); - if ((tiporeg != 2) && (tiporeg != 1)) + const tiporeg tipo = cached_registro(reg).tipo_registro(); + + if ((tipo != acquisto) && (tipo != vendita)) continue; - if (tiporeg == 1) + if (tiporeg == vendita) { - bool sosp = reg.get_bool ("B0"); - if (sosp) continue; - vendite = TRUE; + if (cached_registro(reg).sospeso()) + continue; + vendite = true; } else - vendite = FALSE; + vendite = false; tipodoc = cau.get (CAU_TIPODOC); if (corrispettivo (tipodoc)) diff --git a/src/cg/cg3700.cpp b/src/cg/cg3700.cpp index 7978e2593..721fed667 100755 --- a/src/cg/cg3700.cpp +++ b/src/cg/cg3700.cpp @@ -84,7 +84,6 @@ class TLista_fatture : public TPrintapp protected: long select_firm_range(long from, long to); - int tiporeg(const TString& ); static bool mix_handler(TMask_field&, KEY); static bool date_handler(TMask_field&, KEY); static bool to_ditt_handler(TMask_field&, KEY); @@ -117,12 +116,6 @@ public: inline TLista_fatture& app() { return (TLista_fatture&) main_app(); } -int TLista_fatture::tiporeg(const TString& reg) -{ - TString8 s; s.format("%4d%-3s",_date_from.year(),(const char*)reg); - return atoi(cache().get("REG", s, "I0")); -} - bool TLista_fatture::filter_func1(const TRelation *r) { TLista_fatture& a = app(); @@ -144,8 +137,8 @@ bool TLista_fatture::filter_func1(const TRelation *r) if (riv.get(RMI_TIPODET).blank() || percind.is_zero()) return false; - const int tiporeg = a.tiporeg(rg); - if (tiporeg != 2) + const tiporeg tipo = cached_registro(rg).tipo_registro(); + if (tipo != acquisto) return false; } else // Tipo costo/ricavo @@ -443,8 +436,9 @@ bool TLista_fatture::preprocess_page(int file, int counter) if (_tipo == intra) { TString4 codiva = rec.get(RMI_CODIVA); - const int tipomov = tiporeg(mov.get(MOV_REG)); - if (tipomov == 2 && tipodet == 9) + const tiporeg tipomov = cached_registro(mov.get(MOV_REG)).tipo_registro(); + + if (tipomov == acquisto && tipodet == 9) codiva = "~A19"; // Speciale per acquisti indeducibili art. 19 const bool is_key = _intra_items.is_key(codiva); // Esiste l'elemento ? // Se si' allora prendi quello, altrimenti prendine uno nuovo @@ -469,8 +463,10 @@ bool TLista_fatture::preprocess_page(int file, int counter) _tot_iva += iva; _tp_imp += imp; _tp_iva += iva; - const int tipomov = tiporeg(mov.get(MOV_REG)); - if (_tipo == indetraibile && tipomov == 2 && tipodet > 0) + + const tiporeg tipomov = cached_registro(mov.get(MOV_REG)).tipo_registro(); + + if (_tipo == indetraibile && tipomov == acquisto && tipodet > 0) { TString4 codiva = rec.get(RMI_CODIVA); _Iva_item * iva_row = (_Iva_item *) _indetr.objptr(codiva); diff --git a/src/cg/cg4100.cpp b/src/cg/cg4100.cpp index 7719a25b1..f39d92366 100755 --- a/src/cg/cg4100.cpp +++ b/src/cg/cg4100.cpp @@ -24,7 +24,7 @@ #include #include -#include "cglib02.h" +#include "cglib.h" struct therec { @@ -89,7 +89,7 @@ bool CG4100_App::sort_sal() sal.set_anno_es(year); sal.clear_saldi(year); long numreg = 0L; - tiposal tsal = normale; + tiposal tsal = saldo_normale; char provvis; TDate datareg; @@ -127,20 +127,11 @@ bool CG4100_App::sort_sal() mov.put(MOV_NUMREG, numreg); mov.read(); CHECK(mov.good(),"Archivi movimenti e righe inconsistenti"); + const TString& codcaus = mov.get(MOV_CODCAUS); - // Tipo saldo normale per default - tsal = normale; - const TString& codcaus = mov.get(MOV_CODCAUS); - const TRectype& causale = cache().get(LF_CAUSALI, codcaus); - if (!causale.empty()) - { - const char ac = causale.get_char(CAU_MOVAP); - if (ac == 'A') - tsal = apertura; else - if (ac == 'C') - tsal = chiusura; - } - + tsal = saldo_normale; // Tipo saldo normale per default + if(codcaus.full()) + tsal = cached_causale(codcaus, year).tipo_saldo(); scaricato = mov.get_bool(MOV_SCARCON); provvis = mov.get_char(MOV_PROVVIS); datareg = mov.get_date(MOV_DATAREG); diff --git a/src/cg/cg4300.cpp b/src/cg/cg4300.cpp index 79b104bf5..f3980cc42 100755 --- a/src/cg/cg4300.cpp +++ b/src/cg/cg4300.cpp @@ -208,7 +208,6 @@ bool TLiquidazione_app::user_create() _lam = new TTable("LAM"); _pla = new TTable("%PLA"); _reg = new TTable("REG"); - _iva = new TTable("%IVA"); _del = new TTable("%DEL"); _mov = &_cur->file(LF_MOV); @@ -225,7 +224,6 @@ bool TLiquidazione_app::user_create() _pum_r = &(_pum->curr()); _pam_r = &(_pam->curr()); _pom_r = &(_pom->curr()); - _iva_r = &(_iva->curr()); _del_r = &(_del->curr()); _lam_r = &(_lam->curr()); _pla_r = &(_pla->curr()); diff --git a/src/cg/cg4300.h b/src/cg/cg4300.h index a9b1f7207..642eee98b 100755 --- a/src/cg/cg4300.h +++ b/src/cg/cg4300.h @@ -338,7 +338,6 @@ class TLiquidazione_app : public TPrint_application TTable* _pla; TTable* _ppa; TTable* _reg; - TTable* _iva; TTable* _del; // a reference rectype per file/table @@ -346,7 +345,6 @@ class TLiquidazione_app : public TPrint_application TRectype* _rmoviva_r; TRectype* _pcon_1_r; TRectype* _pcon_2_r; - TRectype* _iva_r; TRectype* _pim_r; TRectype* _pis_r; TRectype* _prm_r; @@ -622,7 +620,7 @@ public: bool look_pla(const char* a, bool create = false); bool look_ppa(int m, const char* a, int t, bool create = false); bool look_del(int month, int type, bool create = false); - bool look_iva(const char* cod); +// bool look_iva(const char* cod); bool look_reg(const char* reg); const TRectype & get_lia(long ditta = 0l, bool create = false, int anno = 0); const int put_lia(const TRectype & lia, bool re = true); diff --git a/src/cg/cg4302.cpp b/src/cg/cg4302.cpp index 1d947d1d3..1e45fa0c8 100755 --- a/src/cg/cg4302.cpp +++ b/src/cg/cg4302.cpp @@ -554,8 +554,7 @@ bool TLiquidazione_app::look_pla(const char* a, bool create) (*_pla_codatt) = buf; const TString16 s = _pla_r->get("CODTAB"); - const int err = _pla->read(); - bool ok = err == NOERR; + bool ok = _pla->read() == NOERR; if (!ok && create) { _pla->zero(); @@ -584,6 +583,7 @@ bool TLiquidazione_app::look_reg(const char* reg) return rt; } +/* bool TLiquidazione_app::look_iva(const char* cod) { bool rt = true; @@ -604,6 +604,7 @@ bool TLiquidazione_app::look_iva(const char* cod) return rt; } +*/ bool TLiquidazione_app::look_ppa(int month, const char* codatt, int type, bool create) { @@ -982,8 +983,10 @@ real TLiquidazione_app::aliquota_agvia() { real r; const TString& codagv = ini_get_string(CONFIG_STUDIO, "cg", "CodAgv"); - if (codagv.full() && look_iva(codagv)) // Controlla se è vuoto! CM600475 - r = _iva->get_real("R0"); + const TCodiceIVA & civa = cached_codIVA(codagv); + + if (civa.ok()) // Controlla se è vuoto! CM600475 + r = civa.percentuale(); return r; } diff --git a/src/cg/cg4303.cpp b/src/cg/cg4303.cpp index d521bc851..0fb74019b 100755 --- a/src/cg/cg4303.cpp +++ b/src/cg/cg4303.cpp @@ -95,10 +95,13 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt) vaf += imponibile; _pam->put("R1", vaf); _pam->rewrite(); + // Aggiorna il totale IVA periodica CD1_1 - if (month == 13 && look_iva(ci->_codiva)) + const TCodiceIVA & civa = cached_codIVA(ci->_codiva); + + if (month == 13 && civa.ok()) { - if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi... + if (civa.tipo_comunicazione_attive().full()) // Solo CD1_1 ha senso coi corrispettivi... { _pum->curr().add("R14", imponibile); // CD1_1 _pum->rewrite(); @@ -142,12 +145,11 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) int tipocr = atoi(*_pim_tipocr); int mese = atoi(*_pim_mese); int tipodet = atoi(*_pim_tipodet); - look_iva(*_pim_codiva); + const TCodiceIVA & civa = cached_codIVA(*_pim_codiva); // base di riparto solo se non esente, non soggetto, non imponibile - TString16 tipoiva(_iva->get("S1")); + TString16 tipoiva(civa.tipo()); TString16 reg = *_pim_codreg; - /* * caso particolare SENSU Vladimiro (1995) #MI3001 * questi vengono pero' conteggiati nel totale @@ -161,18 +163,15 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) if (tipocr == 1 && (mese == m) && att == (const char*)(*_pim_codatt)) { - if (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES") + if (civa.iva_da_ventilare()) { real lurd = _pim->get_real("R0"); lurd += _pim->get_real("R1"); - real perc = _iva->get_real("R0"); - TString other = _iva->get("S6"); - if (!other.empty()) - { - // ventila a un altro codice - look_iva(other); - perc = _iva->get_real("R0"); - } + real perc = civa.percentuale(); + TString other = civa.iva_a_cui_ventilare(); + + if (other.full()) + perc = cached_codIVA(other).percentuale(); // ventila a un altro codice add_ventilation(perc / CENTO, lurd, *_pim_codiva, other); } } @@ -341,9 +340,11 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) _pam->rewrite(); // Aggiorna il totale IVA periodica CD1_1 - if (month == 13 && look_iva(vv->_codiva)) + const TCodiceIVA & civa = cached_codIVA(vv->_codiva); + + if (month == 13 && civa.ok()) { - if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi + if (civa.get("S10").full()) // Solo CD1_1 ha senso coi corrispettivi { _pum->curr().add("R14", imponibile); // CD1_1 _pum->rewrite(); @@ -364,9 +365,10 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) // viene amorosamente messo a quanto il codice IVA prevede if (!was) { - look_iva(vv->_codiva); + const TCodiceIVA & civa = cached_codIVA((vv->_codiva)); + _pim->put("I1", (long)vendita); - if (!_iva->get_bool("B4")) + if (!civa.escluso_dal_rimborso()) _pim->put("B3", "X"); } _pim->rewrite(); @@ -533,8 +535,8 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, if (!_pim->get_bool("B3")) continue; // Se il tipo di codice e' NS non va considerato nella sommatoria del tot. acquisti - look_iva(codiva); - const bool non_sogg = _iva->get("S1") == "NS"; + const TCodiceIVA & civa = cached_codIVA(codiva); + const bool non_sogg = civa.iva_non_soggetta(); if (!is_mens) // Trimestrali { @@ -565,7 +567,7 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, ca._totale += _pim->get_real("R3"); if (!is_key) // se non c'e' lo aggiunge { - ca._aliquota = _iva->get_real("R0")/CENTO; // Se e' nuovo setta l'aliquota + ca._aliquota = civa.moltiplicatore_percentuale(); // Se e' nuovo setta l'aliquota corr_ann.add(codiva,ca); } } diff --git a/src/cg/cg4304.cpp b/src/cg/cg4304.cpp index 802b36f0a..fe6386e0d 100755 --- a/src/cg/cg4304.cpp +++ b/src/cg/cg4304.cpp @@ -286,7 +286,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt) continue; look_reg(*_pim_codreg); - look_iva(*_pim_codiva); + const TCodiceIVA & civa = cached_codIVA(*_pim_codiva); int tipocr = atoi(*_pim_tipocr); int tipodet = atoi(*_pim_tipodet); @@ -295,7 +295,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt) real imponibile = _pim->get_real("R0"); real imposta = _pim->get_real("R1"); tiporeg tipomov = (tiporeg)_reg->get_long("I0"); - TString4 tipoiva = _iva->get("S1"); + TString4 tipoiva = civa.tipo(); if (_year != *_pim_anno || (month == 13 && mese < 13)) continue; @@ -564,28 +564,19 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool continue; TString4 codiva = codtab.mid(16,4); codiva.trim(); - if (!look_iva(codiva)) + const TCodiceIVA & civa = cached_codIVA(codiva); + + if (!civa.ok()) continue; tiporeg tipomov = (tiporeg)_reg->get_int("I0"); bool corrisp = _reg->get_bool("B0"); - const TString4 tipoiva = _iva->get("S1"); + const TString4 tipoiva = civa.tipo(); const TString4 other = tab->get("S4"); TToken_string s1(tab->get("S1"), '!'); // Imponibile/iva fatture in ritardo real rit_imp(s1.get(0)); real rit_iva(s1.get(1)); - /* Perchè _pim invece di tab ? 17-10-2012 - diffimp = _pim->get_real("R26"); - diffiva = _pim->get_real("R27"); - diffincimp = _pim->get_real("R28"); - diffinciva = _pim->get_real("R29"); - - diffimp_acq = _pim->get_real("R30"); - diffiva_acq = _pim->get_real("R31"); - diffincimp_acq = _pim->get_real("R32"); - diffinciva_acq = _pim->get_real("R33"); */ - diffimp = tab->get_real("R26"); diffiva = tab->get_real("R27"); diffincimp = tab->get_real("R28"); @@ -603,10 +594,10 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool issosp |= (sosp_imp != nessuna_sospensione); // Setta il flag di presenza registri in sospensione (qualsiasi tipo: sospensione_normale, vol_affari, liquidazione) // ACHTUNG! Corrispettivi da ventileer possono ventilare ad un altro codiva; in tal caso si scrive quello if (corrisp && other.full()) - { - look_iva(other); codiva = other; - } + + const TCodiceIVA & civa1 = cached_codIVA(codiva); // codice IVA aggiornato per eventuale ventilazione + // se e' corrispettivo da ventilare non scrivo un cannolo ripieno visto che e' stato ventilato if (tipomov == vendita && tipoiva == "VE" && !describe_pis) continue; @@ -713,7 +704,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool ca._totale_vf += tab->get_real(tipoiva == "VE" ? "R2" : "R3"); if (!is_key) // se non c'e' lo aggiunge { - ca._aliquota = _iva->get_real("R0")/CENTO; // Se e' nuovo setta l'aliquota + ca._aliquota = civa.moltiplicatore_percentuale(); // Se e' nuovo setta l'aliquota corr_ann.add(codiva,ca); } // vedi corrispettivi veri e falsi @@ -1804,8 +1795,9 @@ void TLiquidazione_app::set_pim(_DescrItem& d) rw++; else { - look_iva(d._s1); - d._s2 = _iva->get("S0"); + const TCodiceIVA & civa = cached_codIVA(d._s1); + + d._s2 = civa.get("S0"); if (d._s2.len() > 19) d._s2.cut(19); } @@ -2934,8 +2926,9 @@ void TLiquidazione_app::set_ventila(_DescrItem& d) for(i = 0; i < d._arr.items(); i++) { _vDesc& vd = (_vDesc&)d._arr[i]; - look_iva(vd._codiva); - s0 = _iva->get("S0"); s0.cut(23); + const TCodiceIVA & civa = cached_codIVA(vd._codiva); + + s0 = civa.descrizione(); s0.cut(23); set_row(row+i,"@8g%5s@17g%-23s@41g%r@68g%r@89g%r", (const char*)vd._codiva, @@ -3065,13 +3058,15 @@ void TLiquidazione_app::set_regagr(_DescrItem& d) _DescrItem& di = (_DescrItem&) agr_array[i]; if (di._flags != PROGAGR) continue; - look_iva(di._s0); - des = _iva->get("S0"); des.cut(25); - al = _iva->get_real("R0"); + + const TCodiceIVA & civa = cached_codIVA(di._s0); + + des = civa.descrizione(); des.cut(25); + al = civa.percentuale(); set_row(r,"%4s %-25s@48g%s %%", (const char*) di._s0, (const char*) des, al.string("#@,@@")); set_row(r,"@56g%r@75g%4s",&di._r0, (const char*)di._s1); - look_iva(di._s1); - al = _iva->get_real("R0"); + const TCodiceIVA & civa1 = cached_codIVA(di._s1); + al = civa1.percentuale(); set_row(r++,"@92g%s %%@100g%r", al.string("#@,@@"), &di._r1); t1 += di._r0; t2 += di._r1; diff --git a/src/cg/cg7600.cpp b/src/cg/cg7600.cpp index 766c17417..d0de36141 100644 --- a/src/cg/cg7600.cpp +++ b/src/cg/cg7600.cpp @@ -120,7 +120,7 @@ void TQuadro_VE_recordset::load() const int int_tipo_iva11_ven = atoi(tipo_iva11_ven); const bool non_imponibile = (tipo_aliquota == "NI"); const bool esente = (tipo_aliquota == "ES"); - const bool reverse = int_tipo_iva11_ven >= 31 && int_tipo_iva11_ven <= 38; + const bool reverse = (int_tipo_iva11_ven >= 31 && int_tipo_iva11_ven <= 39) || (tipo_iva11_ven == "G7A"); const bool terremotati = int_tipo_iva11_ven == 25; TToken_string codatt; codatt.add(prefix().get_codditta()); @@ -172,7 +172,7 @@ void TQuadro_VE_recordset::load() if (tipocr == 4) { - if (int_tipo_iva11_ven == acq_ind_pass_int || int_tipo_iva11_ven == cess_amm) + if (reverse || int_tipo_iva11_ven == acq_ind_pass_int || int_tipo_iva11_ven == cess_amm) add_value("VE40.1", imp); } } diff --git a/src/cg/cg7700.cpp b/src/cg/cg7700.cpp index 23519d24a..3b9f994a8 100644 --- a/src/cg/cg7700.cpp +++ b/src/cg/cg7700.cpp @@ -286,9 +286,9 @@ void TQuadro_VF_recordset::load() } if (non_soggetto) { - if (tipo_iva11_acq == "15A" || int_tipo_iva11_acq == 15) + if (int_tipo_iva11_acq == 15) { - if (tipo_iva11_acq == "15A") + if (tipo_iva11_acq == "15B") add_value("VF17.2", imp); add_value("VF17.1", imp); } @@ -350,7 +350,7 @@ void TQuadro_VF_recordset::load() key = codiva; tipo_aliquota = cache().get("%IVA", key, "S1"); - if (tipo_aliquota.blank() && datapag <= a_datareg && tipoiva == 2) // Acquists + if (tipo_aliquota.blank() && datapag <= a_datareg && tipoiva == 2) // Acquisti { imp211 += imp; if (tipodiff == 2) diff --git a/src/cg/cg7700a.rep b/src/cg/cg7700a.rep index 98e9cf554..aae4a9805 100644 --- a/src/cg/cg7700a.rep +++ b/src/cg/cg7700a.rep @@ -5,7 +5,7 @@