diff --git a/cg/cg0500a.uml b/cg/cg0500a.uml index 2ad8959de..8f7b38b92 100755 --- a/cg/cg0500a.uml +++ b/cg/cg0500a.uml @@ -21,11 +21,11 @@ BEGIN FLAGS "U" USE LF_CAUSALI INPUT CODCAUS F_COD_CAUS - DISPLAY "Cod. causale" CODCAUS + DISPLAY "Codice" CODCAUS DISPLAY "Descrizione @50" DESCR - DISPLAY "Tipo documento" TIPODOC - DISPLAY "Codice registro" REG - DISPLAY "Tipo movimento" TIPOMOV + DISPLAY "Documento" TIPODOC + DISPLAY "Registro" REG + DISPLAY "Movimento" TIPOMOV OUTPUT F_COD_CAUS CODCAUS OUTPUT F_DESCR DESCR HELP "Codice causale" @@ -36,14 +36,14 @@ STRING F_DESCR 40 BEGIN PROMPT 17 1 "Descrizione " FIELD LF_CAUSALI->DESCR - COPY USE F_COD_CAUS + USE LF_CAUSALI KEY 2 INPUT CODCAUS F_COD_CAUS INPUT DESCR F_DESCR - DISPLAY "Cod. causale" CODCAUS DISPLAY "Descrizione @50" DESCR - DISPLAY "Tipo documento" TIPODOC - DISPLAY "Codice registro" REG - DISPLAY "Tipo movimento" TIPOMOV + DISPLAY "Codice" CODCAUS + DISPLAY "Documento" TIPODOC + DISPLAY "Registro" REG + DISPLAY "Movimento" TIPOMOV OUTPUT F_COD_CAUS CODCAUS OUTPUT F_DESCR DESCR HELP "Descrizione della causale" diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index 1e15339ae..cef225feb 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -76,7 +76,7 @@ TMask* TPrimanota_application::load_mask(int n) ism.set_handler(102, codiva_handler); ism.set_handler(103, detrazione_handler); ism.set_handler(104, imposta_handler); - ism.set_handler(109, suspended_handler); + ism.set_handler(109, iva_sottoconto_handler); ism.set_handler(209, sheet_clifo_handler); ism.set_handler(309, sheet_clifo_handler); } @@ -304,6 +304,8 @@ void TPrimanota_application::init_mask(TMask& m) const bool corrval = intra && _causale.corrval(); m.show(F_CORRVALUTA, corrval); + + m.show(F_CODIVA, m.mode() == MODE_INS); } // Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_VISVAL (GROUP 3) @@ -443,8 +445,6 @@ void TPrimanota_application::init_insert_mode(TMask& m) void TPrimanota_application::init_modify_mode(TMask& m) { init_mask(m); - if (iva() != nessuna_iva) - m.hide(F_CODIVA); } @@ -754,14 +754,18 @@ int TPrimanota_application::write(const TMask& m) { _saldi.registra(); - if (iva() != nessuna_iva && !gestione_saldaconto()) + if (iva() != nessuna_iva) { - const TString16 causimm(_causale.causale_inc_imm()); - if (causimm.not_empty()) - genera_incasso(causimm); + causale().reg().reread(); // Aggiorna protocollo IVA + if (!gestione_saldaconto()) + { + const TString16 causimm(causale().causale_inc_imm()); + if (causimm.not_empty()) + genera_incasso(causimm); + } } - if (gestione_saldaconto() && _causale.saldaconto()) + if (gestione_saldaconto() && causale().saldaconto()) aggiorna_scadenzario(m); } return err; diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index 6ba938cef..838599dad 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -892,7 +892,7 @@ bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key) if (key == K_TAB || key == K_ENTER) { TMask& m = f.mask(); - if (m.get(115)[0] == 'T') + if (m.get(115)[0] == 'T') // Se riga totale documento { const char cf = m.get(f.dlg()-2)[0]; char tipo = app().clifo(); @@ -907,6 +907,26 @@ bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key) return TRUE; } +bool TPrimanota_application::iva_sottoconto_handler(TMask_field& f, KEY key) +{ + if (!suspended_handler(f, key)) + return FALSE; + + if (key == K_TAB && f.dirty() && !app().causale().corrispettivi()) + { + TMask& m = f.mask(); + const TFixed_string td(app().causale().tipo_doc()); + if (td == "FV" || td == "NC") // Nun lo vulevo fa' CASAP + { + const int cr = m.get_int(105); + if (cr == 2 || cr == 3) + m.set(105, 4); + } + } + return TRUE; +} + + bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k) { if (!suspended_handler(f, k)) @@ -996,7 +1016,7 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key) f.error_box("Causale incongruente con quella inserita precedentemente"); return FALSE; } - app().read_caus(cau, ann); + app().causale().read(cau, ann); } return TRUE; @@ -1062,7 +1082,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key) { if (reg.year() != dr.year()) { - const bool ok = reg.read(codreg, dr.year()); + const bool ok = reg.reread(); if (!ok) return FALSE; } diff --git a/cg/cg2102.h b/cg/cg2102.h index ad40dd34a..a40dae9a2 100755 --- a/cg/cg2102.h +++ b/cg/cg2102.h @@ -71,6 +71,7 @@ class TPrimanota_application : public TRelation_application static bool descr_handler(TMask_field& f, KEY k); static bool sheet_clifo_handler(TMask_field& f, KEY k); + static bool iva_sottoconto_handler(TMask_field& f, KEY k); static bool imponibile_handler(TMask_field& f, KEY key); static bool detrazione_handler(TMask_field& f, KEY key); static bool codiva_handler(TMask_field& f, KEY key); diff --git a/cg/cg2103.cpp b/cg/cg2103.cpp index acc0b9edd..d1766ac55 100755 --- a/cg/cg2103.cpp +++ b/cg/cg2103.cpp @@ -62,6 +62,16 @@ bool TRegistro::read(const char* cod, int year) return err == NOERR; } +bool TRegistro::reread() +{ + if (ok()) + { + const TString16 n(name()); + const int y = year(); + return read(n, y); + } + return FALSE; +} int TRegistro::year() const { diff --git a/cg/cg2103.h b/cg/cg2103.h index e2275753c..9b3fffd48 100755 --- a/cg/cg2103.h +++ b/cg/cg2103.h @@ -30,6 +30,7 @@ protected: public: bool read(const char* code, int year); + bool reread(); TRegistro& operator =(const TRegistro& r); virtual bool ok() const { return !_rec.empty(); } diff --git a/cg/cg5.url b/cg/cg5.url index dd8cfae40..9fbdb3c51 100755 --- a/cg/cg5.url +++ b/cg/cg5.url @@ -2,14 +2,12 @@ MENU TASK_MENUBAR SUBMENU MENU_FILE "~File" - ITEM BAR_ITEM(1) "~Parametri" MENUBAR MENU_BAR(1) MENU MENU_BAR(1) SUBMENU MENU_FILE "~File" - ITEM BAR_ITEM(1) "~Parametri" MENUBAR MENU_BAR(2) diff --git a/cg/cglib02.cpp b/cg/cglib02.cpp index eb1f4cd08..c106124a0 100755 --- a/cg/cglib02.cpp +++ b/cg/cglib02.cpp @@ -5,6 +5,8 @@ // ///////////////////////////////////////////////////////////////////////////// +#include + #include #include #include @@ -167,7 +169,7 @@ void TSaldo_agg::registra() for (int i=0; i < conti; i++) { THash_object * hobj = tconti(); - TConto & tcon = hobj->obj(); + TConto & tcon = (TConto &)hobj->obj(); if (!tcon.ok()) continue; saldi.zero();