diff --git a/cg/cg0500a.uml b/cg/cg0500a.uml index 76d889937..90e495d2b 100755 --- a/cg/cg0500a.uml +++ b/cg/cg0500a.uml @@ -47,6 +47,7 @@ BEGIN DISPLAY "Movimento" TIPOMOV OUTPUT F_COD_CAUS CODCAUS OUTPUT F_DESCR DESCR + KEY 2 HELP "Descrizione della causale" MESSAGE COPY, F_DESCR2 END @@ -176,7 +177,7 @@ PAGE "" -1 -1 77 20 GROUPBOX DLG_NULL 78 3 BEGIN - PROMPT 1 0 "@BCampi obbligatori in immissione documenti" + PROMPT 1 0 "" END STRING F_COD_CAUS2 3 @@ -193,7 +194,7 @@ END GROUPBOX DLG_NULL 78 3 BEGIN - PROMPT 1 3 "@BCampi obbligatori in caricamento documenti" + PROMPT 1 3 "@BCampi obbligatori in immissione documenti" END BOOLEAN F_DATA_DOC diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index a706d4554..86bc0640c 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -45,9 +45,14 @@ TMask* TPrimanota_application::load_mask(int n) m->set_handler(F_CODCAUS, caus_query_handler); m->set_handler(F_DATAREG, datareg_handler); m->set_handler(F_DATACOMP, datacomp_handler); + TConfig c(CONFIG_STUDIO, "cg"); const bool dr = c.get_bool("PoCuDr"); // Scelta primo campo col focus m->first_focus(dr ? F_DATAREG : F_CODCAUS); + + _savenew = TRUE; + if (c.exist("Cg21SN")) + _savenew = c.get_bool("Cg21SN"); // Salva e registra } break; case 1: @@ -139,8 +144,9 @@ bool TPrimanota_application::user_create() return TRUE; } + bool TPrimanota_application::save_and_new() const -{ return TRUE; } +{ return _savenew; } bool TPrimanota_application::user_destroy() @@ -279,6 +285,7 @@ void TPrimanota_application::read_firm_params() _rif_par = c.get_bool("RifPar"); } + void TPrimanota_application::init_mask(TMask& m) { disable_menu_item(M_FILE_PRINT); diff --git a/cg/cg2101.cpp b/cg/cg2101.cpp index cdb63c412..d912dfa0a 100755 --- a/cg/cg2101.cpp +++ b/cg/cg2101.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include "cg2101.h" @@ -134,6 +135,60 @@ int TMovimentoPN::cancella(TLocalisamfile& f, int da, int a) return f.status(); } +char TMovimentoPN::frequenza_versamenti(int year) const +{ + static int last_year = 0; + static char last_freq = ' '; + + if (year != last_year) + { + TString16 key; + key << year; + TTable lia("LIA"); + lia.put("CODTAB", key); + if (lia.read() != NOERR) + { + TLocalisamfile nditte(LF_NDITTE); + nditte.put("CODDITTA", main_app().get_firm()); + nditte.read(); + last_freq = nditte.get_char("FREQVIVA"); + } + else + last_freq = lia.get_char("S7"); + CHECK(last_freq == 'M' || last_freq == 'T', "Frequenza versamento IVA assurda"); + } + + return last_freq; +} + +bool TMovimentoPN::controlla_liquidazione(const TDate& data, bool reset) const +{ + bool calcolata = FALSE; + + const int anno = data.year(); + int mese = data.month(); + if (frequenza_versamenti(anno) == 'T') + mese += 2 - ((mese-1) % 3); + + // Chiave di LIM: Anno (1-4), Mese (5-6) + + TTable lim("LIM"); + TString16 key; + key << anno << mese; + lim.put("CODTAB", key); + if (lim.read() == NOERR) + calcolata = lim.get_bool("B0"); + + if (calcolata && reset) + { + // Resetta il flag di calcolato sulla liquidazione IVA del mese di registrazione + lim.put("B0", FALSE); + lim.write(); + } + + return calcolata; +} + int TMovimentoPN::registra(bool re, bool force) { @@ -202,31 +257,16 @@ int TMovimentoPN::registra(bool re, bool force) const TDate datareg = m.get_date("DATAREG"); registro.update(max(protiva, uprotiva), datareg); } - - // Resetta il flag di calcolato sulla liquidazione IVA del mese di registrazione - // Chiave di LIM: Anno (1-4), Mese (5-6) - + const TDate d(m.get("DATAREG")); - TString16 chiave; chiave << d.year() << d.month(); - TTable lim("LIM"); - lim.put("CODTAB", chiave); - if (lim.read() == NOERR) - { - const bool calcolato = lim.get_bool("B0"); - if (calcolato) - { - lim.put("B0", FALSE); - lim.rewrite(); - } - } - + controlla_liquidazione(d, TRUE); + const int att = att_mista ? 2 : 1; - // Chiave di PLM: Anno (1-4), Cod. Att. (5-9), Tipo att. (10-10), Mese (11-12) TTable plm("PLM"); for (int a = 1; a <= att; a++) { - chiave.cut(0); + TString16 chiave; chiave << d.year() << registro.attivita() << a << d.month(); plm.put("CODTAB", chiave); if (plm.read() == NOERR) diff --git a/cg/cg2101.h b/cg/cg2101.h index fdfa41d43..1302cf8d7 100755 --- a/cg/cg2101.h +++ b/cg/cg2101.h @@ -43,6 +43,9 @@ public: int cg_items() const { return _cg.items(); } int iva_items() const { return _iva.items(); } void destroy_rows(); + + char frequenza_versamenti(int year) const; // Ritorna 'M'ensile o 'T'rimestrale + bool controlla_liquidazione(const TDate& data, bool reset = FALSE) const; TMovimentoPN(); virtual ~TMovimentoPN() {} diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index f20f85756..d3451e1c9 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -59,6 +59,7 @@ const real& TPrimanota_application::cod2IVA(const TMask& m) return _percent; } + real TPrimanota_application::scorpora(real& imponibile, const real& percent) { real imposta = abs(imponibile) * percent / (percent + 100.0); imposta.ceil(); @@ -1082,7 +1083,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key) f.warning_box("La data dell'operazione e' antecedente al %s,\n" "ultima registrazione sul libro giornale dell'esercizio %d", gio.last_reg().string(), ae); - + if (m.query_mode()) { const long numreg = m.get_long(F_NUMREG); @@ -1092,7 +1093,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key) mov.put(MOV_NUMREG, numreg); if (mov.read() == NOERR) m.set(F_CODCAUS, mov.get(MOV_CODCAUS)); - } + } } TRegistro& reg = app().causale().reg(); @@ -1101,7 +1102,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key) { if (reg.year() != dr.year()) { - const bool ok = reg.reread(); + const bool ok = reg.read(codreg, dr.year()); if (!ok) return FALSE; if (app().iva() != nessuna_iva) m.field(F_CODREG).on_hit(); @@ -1118,6 +1119,12 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key) f.warning_box("La data dell'operazione e' antecedente al %s,\n" "ultima registrazione sul registro '%s' dell'anno %d", reg.last_reg().string(), (const char*)codreg, dr.year()); + + if (reg.iva() != nessuna_iva && app()._rel->controlla_liquidazione(dr) == TRUE) + { + const char* m = itom(dr.month()); + f.warning_box("La liquidazione IVA relativa al mese di %s e' gia' stata calcolata", m); + } } } } diff --git a/cg/cg2102.h b/cg/cg2102.h index 327d7801b..f456ba608 100755 --- a/cg/cg2102.h +++ b/cg/cg2102.h @@ -41,6 +41,7 @@ class TPrimanota_application : public TRelation_application TipoIVA _iva; // Tipo di IVA corrente bool _ges_val, _ges_sal; // Gestione valuta e saldaconto bool _rif_par; // Riferimento parita (NUM_DOC | PROTIVA) + bool _savenew; // Registra e nuovo TSaldo_agg _saldi; // Saldi da aggiornare @@ -48,7 +49,7 @@ class TPrimanota_application : public TRelation_application long _lastreg; // Numero ultima registrazione int _mode; // Modo maschera corrente - void* _app_data; + void* _app_data; static bool suspended_handler(TMask_field& f, KEY k); static bool num_handler(TMask_field& f, KEY key); diff --git a/cg/cg5000a.h b/cg/cg5000a.h index 36e94428d..78a7bfe32 100755 --- a/cg/cg5000a.h +++ b/cg/cg5000a.h @@ -14,3 +14,4 @@ #define CHK_NOVIIP 114 #define CHK_NOVIPC 115 #define CHK_GSACMI 116 +#define CHK_SAVENEW 117 \ No newline at end of file diff --git a/cg/cg5000a.uml b/cg/cg5000a.uml index 1fd95f36a..f6663cba9 100755 --- a/cg/cg5000a.uml +++ b/cg/cg5000a.uml @@ -4,7 +4,7 @@ PAGE "Parametri contabilita' studio" -1 -1 76 16 GROUPBOX DLG_NULL 74 4 BEGIN - PROMPT 1 1 "Dati Banca di appoggio" + PROMPT 1 1 "Dati Banca di appoggio per deleghe IVA" END NUMBER FLD_CODABI 5 @@ -20,7 +20,7 @@ BEGIN OUTPUT FLD_RAGSOCB S0 FIELD CodABI CHECKTYPE NORMAL - FLAGS "RZ" + FLAGS "Z" END NUMBER FLD_CODCAB 5 @@ -30,7 +30,7 @@ BEGIN INPUT CODTAB[6,10] FLD_CODCAB CHECKTYPE NORMAL FIELD CodCAB - FLAGS "RZ" + FLAGS "Z" END STRING FLD_RAGSOCB 50 @@ -41,32 +41,30 @@ END BOOLEAN CHK_SIND11 BEGIN - PROMPT 2 5 "Somma imposte non detr. ad acq/import. in modello IVA 11" + PROMPT 2 5 "Somma imposte non detraibili ad acq/import. in modello IVA 11" FIELD Sind11 END +GROUPBOX DLG_NULL 74 4 +BEGIN + PROMPT 1 6 "Stampa registri" +END + BOOLEAN CHK_STIREG BEGIN - PROMPT 2 6 "Stampa intestazione registri bollati" + PROMPT 2 7 "Stampa intestazione registri bollati" FIELD StiReg END BOOLEAN CHK_NODTRG BEGIN - PROMPT 2 7 "Non stampa data di registrazione sui registri IVA" + PROMPT 2 8 "Non stampa data di registrazione sui registri IVA" FIELD NoDtRg END -BOOLEAN CHK_POCUDR -BEGIN - PROMPT 2 8 "Posiz. cursore su data registr. in immissione documenti" - HELP "Determina il posizionamento automatico del cursore sulla data di registrazione o sulla causale in prima nota" - FIELD PoCuDr -END - NUMBER FLD_CODAGV 5 BEGIN - PROMPT 2 9 "Codice IVA per ricavi misti agenzie di viaggio " + PROMPT 2 10 "Codice IVA per ricavi misti agenzie di viaggio " USE %IVA INPUT CODTAB FLD_CODAGV DISPLAY "Codice" CODTAB @@ -121,6 +119,33 @@ END ENDPAGE +PAGE "Parametri contabilita' studio" + +BOOLEAN CHK_POCUDR +BEGIN + PROMPT 2 2 "Posiziona cursore sulla data di registrazione in immissione documenti" + HELP "Determina il posizionamento automatico del cursore sulla data di registrazione in fase di immisione documenti" + FIELD PoCuDr +END + +BOOLEAN CHK_SAVENEW +BEGIN + PROMPT 3 3 "Prima Nota" + FIELD Cg21SN +END + +BUTTON DLG_OK 10 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_QUIT 10 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE + ENDMASK