From 8dd13258aba8310000b1099315fc2caa6e89eca8 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 18 Jan 1995 14:39:53 +0000 Subject: [PATCH] Spostato RicAcq da parametri ditta a parametri studio git-svn-id: svn://10.65.10.50/trunk@875 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg0200a.uml | 2 +- cg/cg2100.cpp | 2 +- cg/cg2101.cpp | 10 ++++-- cg/cg2102.cpp | 87 +++++++++++++++++++++++++++++++++----------------- cg/cg2102.h | 6 +++- cg/cg4301.cpp | 2 +- cg/cg5000a.h | 1 + cg/cg5000a.uml | 14 ++++---- cg/cg5100a.h | 1 - cg/cg5100a.uml | 11 ++----- cg/cg5400.cpp | 40 +++++++++++++---------- 11 files changed, 108 insertions(+), 68 deletions(-) diff --git a/cg/cg0200a.uml b/cg/cg0200a.uml index c94ad053e..d6261351d 100755 --- a/cg/cg0200a.uml +++ b/cg/cg0200a.uml @@ -144,7 +144,7 @@ BEGIN KEY 5 USE LF_CLIFO KEY 5 INPUT TIPOCF F_TIPOCF SELECT - INPUT STATOPAIV F_STATOPAIV SELECT + INPUT STATOPAIV F_STATOPAIV INPUT PAIV F_PAIV DISPLAY "Partita IVA@11" PAIV DISPLAY "Sospeso" SOSPESO diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index 8f134a9dd..6a9240545 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -256,7 +256,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year) if (err) { - error_box("Il conto %03d %03d %06ld della causale e' ", + error_box("Il conto %d %d %ld della causale e' %s", tc.gruppo(), tc.conto(), tc.sottoconto(), err == 1 ? "sconosciuto" : "sospeso"); continue; diff --git a/cg/cg2101.cpp b/cg/cg2101.cpp index a4042d714..a8fad3b7a 100755 --- a/cg/cg2101.cpp +++ b/cg/cg2101.cpp @@ -142,9 +142,12 @@ int TMovimentoPN::cancella(TLocalisamfile& f, int da, int a) char TMovimentoPN::frequenza_versamenti(int year) const { static int last_year = 0; + static long last_firm = 0; static char last_freq = ' '; - if (year != last_year) + const long firm = main_app().get_firm(); + + if (firm != last_firm || year != last_year) { TString16 key; key << year; @@ -153,14 +156,15 @@ char TMovimentoPN::frequenza_versamenti(int year) const lia.put("CODTAB", key); if (lia.read() != NOERR) { - TLocalisamfile nditte(LF_NDITTE); + TLocalisamfile nditte(LF_NDITTE, firm); nditte.setkey(1); - nditte.put("CODDITTA", main_app().get_firm()); + nditte.put("CODDITTA", ); nditte.read(); last_freq = nditte.get_char("FREQVIVA"); } else last_freq = lia.get_char("S7"); + last_firm = firm; CHECK(last_freq == 'M' || last_freq == 'T', "Frequenza versamenti IVA assurda"); } diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index 349150a89..8e10ec384 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -1081,15 +1081,38 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key) if (key == K_TAB && num > 0) { const long max = app()._lastreg+1; + + _skip_giornale_check = FALSE; + _skip_bollato_check = FALSE; + if (num < max) { if (app().find(1)) { - const TLocalisamfile& mov = app()._rel->lfile(); - m.set(F_DATAREG, mov.get("DATAREG")); - m.set(F_DATACOMP, mov.get("DATACOMP")); - m.set(F_CODCAUS, mov.get("CODCAUS")); - m.stop_run(K_AUTO_ENTER); + const TLocalisamfile& mov = app()._rel->lfile(); + bool ok = TRUE; + + if (mov.get_bool("STAMPATO")) + { + ok = yesnobox("Il movimento e' gia' stato stampato sul libro giornale:\n" + "si desidera continuare ugualmente"); + _skip_giornale_check = ok; + } + + if (ok && mov.get_bool("REGST")) + { + ok = yesnobox("Il movimento e' gia' stato stampato sul bollato:\n" + "si desidera continuare ugualmente"); + _skip_bollato_check = ok; + } + + if (ok) + { + m.set(F_DATAREG, mov.get("DATAREG")); + m.set(F_DATACOMP, mov.get("DATACOMP")); + m.set(F_CODCAUS, mov.get("CODCAUS")); + m.stop_run(K_AUTO_ENTER); + } } } else if (num > max) @@ -1184,18 +1207,21 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key) const long numreg = m.get_long(F_NUMREG); const bool error = numreg == 0 || numreg > app()._lastreg; - const TLibro_giornale& gio = app().giornale(); - if (dr < gio.last_print()) - { - f.error_box("La data dell'operazione e' antecedente al %s,\n" - "ultima stampa del libro giornale dell'esercizio %d", - gio.last_print().string(), ae); - if (error) return FALSE; - } - if (dr < gio.last_reg()) - 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 (!_skip_giornale_check) + { + const TLibro_giornale& gio = app().giornale(); + if (dr < gio.last_print()) + { + f.error_box("La data dell'operazione e' antecedente al %s,\n" + "ultima stampa del libro giornale dell'esercizio %d", + gio.last_print().string(), ae); + if (error) return FALSE; + } + if (dr < gio.last_reg()) + 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()) app().causale().read(m.get(F_CODCAUS), dr.year()); @@ -1213,18 +1239,21 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key) m.field(F_CODREG).on_hit(); } - if (dr < reg.last_print()) - { - f.error_box("La data dell'operazione e' antecedente al %s,\n" - "ultima stampa del registro '%s' dell'anno %d", - reg.last_print().string(), (const char*)codreg, dr.year()); - if (error) return FALSE; - } - if (dr < reg.last_reg()) - 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 (!_skip_bollato_check) + { + if (dr < reg.last_print()) + { + f.error_box("La data dell'operazione e' antecedente al %s,\n" + "ultima stampa del registro '%s' dell'anno %d", + reg.last_print().string(), (const char*)codreg, dr.year()); + if (error) return FALSE; + } + if (dr < reg.last_reg()) + 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()); diff --git a/cg/cg2102.h b/cg/cg2102.h index feac3d214..c6c74da49 100755 --- a/cg/cg2102.h +++ b/cg/cg2102.h @@ -41,8 +41,12 @@ class TPrimanota_application : public TRelation_application TipoIVA _iva; // Tipo di IVA corrente bool _ges_val, _ges_sal; // Gestione valuta e saldaconto bool _num_cli, _num_for; // Riferimento partita allineato a destra + + bool _skip_giornale_check; // Ignora controllo data stampa libro giornale + bool _skip_bollato_check; // Ignora controllo data stampa bollato + bool _savenew; // Registra e nuovo - short _firstfocus; // First field to gain focus + short _firstfocus; // Primo campo della maschera a prendere il focus bool _iva_showed; // Lo sheet IVA e' gia' stato visualizzato una volta? diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 2cae35aed..9080d5a52 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -114,7 +114,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) _lim->put("R6",""); _lim->rewrite(); - TConfig cnf(CONFIG_DITTA, "cg"); + TConfig cnf(CONFIG_STUDIO, "cg"); _isricacq = cnf.get_bool("RicAcq"); // ricalcolo normale diff --git a/cg/cg5000a.h b/cg/cg5000a.h index 12a5019fe..1c638d912 100755 --- a/cg/cg5000a.h +++ b/cg/cg5000a.h @@ -17,3 +17,4 @@ #define CHK_21SAVENEW 117 #define CHK_02SAVENEW 118 #define FLD_DESAGV 119 +#define CHK_RICACQ 120 \ No newline at end of file diff --git a/cg/cg5000a.uml b/cg/cg5000a.uml index bae9bb906..45a72bd3a 100755 --- a/cg/cg5000a.uml +++ b/cg/cg5000a.uml @@ -17,7 +17,7 @@ ENDPAGE PAGE "Parametri contabilita' studio" -1 -1 76 17 -GROUPBOX DLG_NULL 74 5 +GROUPBOX DLG_NULL 74 12 BEGIN PROMPT 1 1 "Parametri IVA" END @@ -60,14 +60,16 @@ END BOOLEAN CHK_SIND11 BEGIN - PROMPT 3 4 "Somma imposte non detraibili ad acq/import. in modello IVA 11" + PROMPT 3 5 "Somma imposte non detraibili ad acq/import. in modello IVA 11" HELP "Indicare se includere l'IVA non detraibile nell'importo dell'operazioni IVA art.19 IVA 11" FIELD Sind11 END -GROUPBOX DLG_NULL 74 6 +BOOLEAN CHK_RICACQ BEGIN - PROMPT 1 6 "Liquidazione IVA" + PROMPT 3 6 "Ricalcolo imposte acquisti per rivendita " + HELP "Indicare se attivare il calcolo IVA acquisti per rivendita nel calcolo ventilazione" + FIELD RicAcq END TEXT DLG_NULL @@ -109,7 +111,7 @@ END STRING FLD_CODAGV 4 BEGIN - PROMPT 3 9 "Codice IVA per ricavi misti agenzie di viaggio " + PROMPT 3 10 "Codice IVA per ricavi misti agenzie di viaggio " HELP "Codice IVA per scorporo operazioni con l'esetero per agenzie di viaggio" WARNIG "Codice IVA errato" USE %IVA @@ -130,7 +132,7 @@ END STRING FLD_DESAGV 50 BEGIN - PROMPT 3 10 "Descrizione " + PROMPT 3 11 "Descrizione " USE %IVA KEY 2 INPUT S0 FLD_DESAGV DISPLAY "Descrizione@50" S0 diff --git a/cg/cg5100a.h b/cg/cg5100a.h index 08e1fcbc3..46c6d48e5 100755 --- a/cg/cg5100a.h +++ b/cg/cg5100a.h @@ -53,4 +53,3 @@ #define FLD_DCSUECE 152 #define FLD_DCSPECE 153 #define FLD_DESLIN 154 -#define CHK_RICACQ 155 \ No newline at end of file diff --git a/cg/cg5100a.uml b/cg/cg5100a.uml index a9af939c7..42b137cdd 100755 --- a/cg/cg5100a.uml +++ b/cg/cg5100a.uml @@ -49,16 +49,9 @@ BEGIN END -GROUPBOX DLG_NULL 76 12 +GROUPBOX DLG_NULL 76 11 BEGIN - PROMPT 2 6 "" -END - -BOOLEAN CHK_RICACQ -BEGIN - PROMPT 4 7 "Ricalcolo imposte acquisti per rivendita " - HELP "Indicare se attivare il calcolo IVA acquisti per rivendita nel calcolo ventilazione" - FIELD RicAcq + PROMPT 2 7 "Parametri contabilita'" END BOOLEAN CHK_GSLBCN diff --git a/cg/cg5400.cpp b/cg/cg5400.cpp index 07662469c..aa5070b8c 100755 --- a/cg/cg5400.cpp +++ b/cg/cg5400.cpp @@ -36,15 +36,22 @@ bool TRipristina_stampa::firm_handler(TMask_field& f, KEY key) const long firm = atol(f.get()); if (firm < 0) - return f.error_box("Codice ditta impossibile"); + return f.error_box("Codice ditta errato"); else if (firm == 0) return f.error_box("La ditta e' obbligatoria"); else if (!prefhndl->exist(firm)) - return f.error_box("Gli archivi della ditta %d non sono stati ancora generati",firm); + return f.error_box("Gli archivi della ditta %ld non sono stati ancora generati", firm); else - main_app().set_firm(firm); + { + if (main_app().get_firm() != firm) + main_app().set_firm(firm); + + TMask_field& r = f.mask().field(F_REG); + r.set_dirty(); + r.on_key(K_TAB); + } } return TRUE; } @@ -55,17 +62,15 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist, { bool ok = TRUE; CHECK(firm > 0, "Non posso ripristinare sui dati comuni"); - CHECK(regist != NULL && strlen(regist) < 4, "Registro impossibile"); - CHECK(month > 0 && month < 13, "Mese impossibile"); + CHECKS(regist && *regist && strlen(regist) <= 3, "Registro errato ", regist); + CHECKD(month > 0 && month < 13, "Mese errato ", month); set_firm(firm); const char * const fieldname = giornale ? MOV_STAMPATO : MOV_REGST; TRelation rel(LF_MOV); TLocalisamfile & mov = rel.lfile(); TTable reg("REG"); - TString16 s; - - s.format("%04d%s", year, regist); + TString16 s; s.format("%04d%s", year, regist); reg.zero(); reg.put("CODTAB", s); @@ -77,7 +82,7 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist, { TTable esc("ESC"); esc.zero(); - esc.put("CODTAB", year); + esc.put("CODTAB", format("%04d", year)); if (esc.read() != NOERR) { set_firm(_default_firm); @@ -90,6 +95,8 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist, if (wd.month() > month) year++; } + const int ld = TDate::last_day(month, year); + if (day > ld) day = ld; TDate d(day, month, year); TRectype from(mov.curr()); from.zero(); @@ -122,7 +129,7 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist, mov.zero(fieldname); ok = (mov.rewrite() == NOERR); if (!ok) - error_box("Errore nell' aggiornamento del movimento %ld.\n Errore n. %d", + error_box("Errore nell'aggiornamento del movimento %ld.\n Errore n. %d", mov.get_long(MOV_NUMREG), mov.status()); } --d; @@ -131,12 +138,12 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist, reg.put("I6", last_num); ok = (reg.rewrite() == NOERR); if (!ok) - error_box("Errore nell' aggiornamento del registro %s.\n Errore n. %d", + error_box("Errore nell'aggiornamento del registro %s.\n Errore n. %d", (const char * ) regist, mov.status()); } else - ok = error_box("Non riesco a leggere il registro %s anno %s", (const char *) regist, (const char *) year); + ok = error_box("Impossibile leggere il registro %s anno %s", (const char *) regist, (const char *) year); set_firm(_default_firm); return ok; @@ -167,13 +174,14 @@ bool TRipristina_stampa::menu(MENU_TAG) const bool giornale = _msk->get_int(F_TIPO) == 5; const int year = _msk->get_int(giornale ? F_ESER : F_YEAR); const int month = _msk->get_int(F_MESE); - const int day = giornale ? _msk->get_int(F_DAY) : 1; + int day = giornale ? _msk->get_int(F_DAY) : 1; + if (day < 1) day = 1; if (prefhndl->exist(firm)) { - TString256 mess("Attenzione sara' ripristinata la stampa\n del registro "); - mess << reg << " dell'" << (giornale ? "esercizio " : "anno ") << year - << " della ditta " << firm << "dal " << day << '-' << month << '-' << year; + TString256 mess("Attenzione sara' ripristinata la stampa del registro "); + mess << reg << "\ndell'" << (giornale ? "esercizio " : "anno ") << year + << " della ditta " << firm << " dal " << day << '-' << month << '-' << year; if (yesno_box((const char *) mess)) {