Spostato RicAcq da parametri ditta a parametri studio

git-svn-id: svn://10.65.10.50/trunk@875 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-01-18 14:39:53 +00:00
parent 365f52efa8
commit 8dd13258ab
11 changed files with 108 additions and 68 deletions

View File

@ -144,7 +144,7 @@ BEGIN
KEY 5 KEY 5
USE LF_CLIFO KEY 5 USE LF_CLIFO KEY 5
INPUT TIPOCF F_TIPOCF SELECT INPUT TIPOCF F_TIPOCF SELECT
INPUT STATOPAIV F_STATOPAIV SELECT INPUT STATOPAIV F_STATOPAIV
INPUT PAIV F_PAIV INPUT PAIV F_PAIV
DISPLAY "Partita IVA@11" PAIV DISPLAY "Partita IVA@11" PAIV
DISPLAY "Sospeso" SOSPESO DISPLAY "Sospeso" SOSPESO

View File

@ -256,7 +256,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
if (err) 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(), tc.gruppo(), tc.conto(), tc.sottoconto(),
err == 1 ? "sconosciuto" : "sospeso"); err == 1 ? "sconosciuto" : "sospeso");
continue; continue;

View File

@ -142,9 +142,12 @@ int TMovimentoPN::cancella(TLocalisamfile& f, int da, int a)
char TMovimentoPN::frequenza_versamenti(int year) const char TMovimentoPN::frequenza_versamenti(int year) const
{ {
static int last_year = 0; static int last_year = 0;
static long last_firm = 0;
static char last_freq = ' '; static char last_freq = ' ';
if (year != last_year) const long firm = main_app().get_firm();
if (firm != last_firm || year != last_year)
{ {
TString16 key; TString16 key;
key << year; key << year;
@ -153,14 +156,15 @@ char TMovimentoPN::frequenza_versamenti(int year) const
lia.put("CODTAB", key); lia.put("CODTAB", key);
if (lia.read() != NOERR) if (lia.read() != NOERR)
{ {
TLocalisamfile nditte(LF_NDITTE); TLocalisamfile nditte(LF_NDITTE, firm);
nditte.setkey(1); nditte.setkey(1);
nditte.put("CODDITTA", main_app().get_firm()); nditte.put("CODDITTA", );
nditte.read(); nditte.read();
last_freq = nditte.get_char("FREQVIVA"); last_freq = nditte.get_char("FREQVIVA");
} }
else else
last_freq = lia.get_char("S7"); last_freq = lia.get_char("S7");
last_firm = firm;
CHECK(last_freq == 'M' || last_freq == 'T', "Frequenza versamenti IVA assurda"); CHECK(last_freq == 'M' || last_freq == 'T', "Frequenza versamenti IVA assurda");
} }

View File

@ -1081,15 +1081,38 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
if (key == K_TAB && num > 0) if (key == K_TAB && num > 0)
{ {
const long max = app()._lastreg+1; const long max = app()._lastreg+1;
_skip_giornale_check = FALSE;
_skip_bollato_check = FALSE;
if (num < max) if (num < max)
{ {
if (app().find(1)) if (app().find(1))
{ {
const TLocalisamfile& mov = app()._rel->lfile(); const TLocalisamfile& mov = app()._rel->lfile();
m.set(F_DATAREG, mov.get("DATAREG")); bool ok = TRUE;
m.set(F_DATACOMP, mov.get("DATACOMP"));
m.set(F_CODCAUS, mov.get("CODCAUS")); if (mov.get_bool("STAMPATO"))
m.stop_run(K_AUTO_ENTER); {
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) 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 long numreg = m.get_long(F_NUMREG);
const bool error = numreg == 0 || numreg > app()._lastreg; const bool error = numreg == 0 || numreg > app()._lastreg;
const TLibro_giornale& gio = app().giornale(); if (!_skip_giornale_check)
if (dr < gio.last_print()) {
{ const TLibro_giornale& gio = app().giornale();
f.error_box("La data dell'operazione e' antecedente al %s,\n" if (dr < gio.last_print())
"ultima stampa del libro giornale dell'esercizio %d", {
gio.last_print().string(), ae); f.error_box("La data dell'operazione e' antecedente al %s,\n"
if (error) return FALSE; "ultima stampa del libro giornale dell'esercizio %d",
} gio.last_print().string(), ae);
if (dr < gio.last_reg()) if (error) return FALSE;
f.warning_box("La data dell'operazione e' antecedente al %s,\n" }
"ultima registrazione sul libro giornale dell'esercizio %d", if (dr < gio.last_reg())
gio.last_reg().string(), ae); 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()) if (m.query_mode())
app().causale().read(m.get(F_CODCAUS), dr.year()); 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(); m.field(F_CODREG).on_hit();
} }
if (dr < reg.last_print()) if (!_skip_bollato_check)
{ {
f.error_box("La data dell'operazione e' antecedente al %s,\n" if (dr < reg.last_print())
"ultima stampa del registro '%s' dell'anno %d", {
reg.last_print().string(), (const char*)codreg, dr.year()); f.error_box("La data dell'operazione e' antecedente al %s,\n"
if (error) return FALSE; "ultima stampa del registro '%s' dell'anno %d",
} reg.last_print().string(), (const char*)codreg, dr.year());
if (dr < reg.last_reg()) if (error) return FALSE;
f.warning_box("La data dell'operazione e' antecedente al %s,\n" }
"ultima registrazione sul registro '%s' dell'anno %d", if (dr < reg.last_reg())
reg.last_reg().string(), (const char*)codreg, dr.year()); 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) if (reg.iva() != nessuna_iva && app()._rel->controlla_liquidazione(dr) == TRUE)
{ {
const char* m = itom(dr.month()); const char* m = itom(dr.month());

View File

@ -41,8 +41,12 @@ class TPrimanota_application : public TRelation_application
TipoIVA _iva; // Tipo di IVA corrente TipoIVA _iva; // Tipo di IVA corrente
bool _ges_val, _ges_sal; // Gestione valuta e saldaconto bool _ges_val, _ges_sal; // Gestione valuta e saldaconto
bool _num_cli, _num_for; // Riferimento partita allineato a destra 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 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? bool _iva_showed; // Lo sheet IVA e' gia' stato visualizzato una volta?

View File

@ -114,7 +114,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
_lim->put("R6",""); _lim->put("R6","");
_lim->rewrite(); _lim->rewrite();
TConfig cnf(CONFIG_DITTA, "cg"); TConfig cnf(CONFIG_STUDIO, "cg");
_isricacq = cnf.get_bool("RicAcq"); _isricacq = cnf.get_bool("RicAcq");
// ricalcolo normale // ricalcolo normale

View File

@ -17,3 +17,4 @@
#define CHK_21SAVENEW 117 #define CHK_21SAVENEW 117
#define CHK_02SAVENEW 118 #define CHK_02SAVENEW 118
#define FLD_DESAGV 119 #define FLD_DESAGV 119
#define CHK_RICACQ 120

View File

@ -17,7 +17,7 @@ ENDPAGE
PAGE "Parametri contabilita' studio" -1 -1 76 17 PAGE "Parametri contabilita' studio" -1 -1 76 17
GROUPBOX DLG_NULL 74 5 GROUPBOX DLG_NULL 74 12
BEGIN BEGIN
PROMPT 1 1 "Parametri IVA" PROMPT 1 1 "Parametri IVA"
END END
@ -60,14 +60,16 @@ END
BOOLEAN CHK_SIND11 BOOLEAN CHK_SIND11
BEGIN 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" HELP "Indicare se includere l'IVA non detraibile nell'importo dell'operazioni IVA art.19 IVA 11"
FIELD Sind11 FIELD Sind11
END END
GROUPBOX DLG_NULL 74 6 BOOLEAN CHK_RICACQ
BEGIN 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 END
TEXT DLG_NULL TEXT DLG_NULL
@ -109,7 +111,7 @@ END
STRING FLD_CODAGV 4 STRING FLD_CODAGV 4
BEGIN 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" HELP "Codice IVA per scorporo operazioni con l'esetero per agenzie di viaggio"
WARNIG "Codice IVA errato" WARNIG "Codice IVA errato"
USE %IVA USE %IVA
@ -130,7 +132,7 @@ END
STRING FLD_DESAGV 50 STRING FLD_DESAGV 50
BEGIN BEGIN
PROMPT 3 10 "Descrizione " PROMPT 3 11 "Descrizione "
USE %IVA KEY 2 USE %IVA KEY 2
INPUT S0 FLD_DESAGV INPUT S0 FLD_DESAGV
DISPLAY "Descrizione@50" S0 DISPLAY "Descrizione@50" S0

View File

@ -53,4 +53,3 @@
#define FLD_DCSUECE 152 #define FLD_DCSUECE 152
#define FLD_DCSPECE 153 #define FLD_DCSPECE 153
#define FLD_DESLIN 154 #define FLD_DESLIN 154
#define CHK_RICACQ 155

View File

@ -49,16 +49,9 @@ BEGIN
END END
GROUPBOX DLG_NULL 76 12 GROUPBOX DLG_NULL 76 11
BEGIN BEGIN
PROMPT 2 6 "" PROMPT 2 7 "Parametri contabilita'"
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
END END
BOOLEAN CHK_GSLBCN BOOLEAN CHK_GSLBCN

View File

@ -36,15 +36,22 @@ bool TRipristina_stampa::firm_handler(TMask_field& f, KEY key)
const long firm = atol(f.get()); const long firm = atol(f.get());
if (firm < 0) if (firm < 0)
return f.error_box("Codice ditta impossibile"); return f.error_box("Codice ditta errato");
else else
if (firm == 0) if (firm == 0)
return f.error_box("La ditta e' obbligatoria"); return f.error_box("La ditta e' obbligatoria");
else else
if (!prefhndl->exist(firm)) 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 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; return TRUE;
} }
@ -55,17 +62,15 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
{ {
bool ok = TRUE; bool ok = TRUE;
CHECK(firm > 0, "Non posso ripristinare sui dati comuni"); CHECK(firm > 0, "Non posso ripristinare sui dati comuni");
CHECK(regist != NULL && strlen(regist) < 4, "Registro impossibile"); CHECKS(regist && *regist && strlen(regist) <= 3, "Registro errato ", regist);
CHECK(month > 0 && month < 13, "Mese impossibile"); CHECKD(month > 0 && month < 13, "Mese errato ", month);
set_firm(firm); set_firm(firm);
const char * const fieldname = giornale ? MOV_STAMPATO : MOV_REGST; const char * const fieldname = giornale ? MOV_STAMPATO : MOV_REGST;
TRelation rel(LF_MOV); TRelation rel(LF_MOV);
TLocalisamfile & mov = rel.lfile(); TLocalisamfile & mov = rel.lfile();
TTable reg("REG"); TTable reg("REG");
TString16 s; TString16 s; s.format("%04d%s", year, regist);
s.format("%04d%s", year, regist);
reg.zero(); reg.zero();
reg.put("CODTAB", s); reg.put("CODTAB", s);
@ -77,7 +82,7 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
{ {
TTable esc("ESC"); TTable esc("ESC");
esc.zero(); esc.zero();
esc.put("CODTAB", year); esc.put("CODTAB", format("%04d", year));
if (esc.read() != NOERR) if (esc.read() != NOERR)
{ {
set_firm(_default_firm); set_firm(_default_firm);
@ -90,6 +95,8 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
if (wd.month() > month) if (wd.month() > month)
year++; year++;
} }
const int ld = TDate::last_day(month, year);
if (day > ld) day = ld;
TDate d(day, month, year); TDate d(day, month, year);
TRectype from(mov.curr()); from.zero(); TRectype from(mov.curr()); from.zero();
@ -122,7 +129,7 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
mov.zero(fieldname); mov.zero(fieldname);
ok = (mov.rewrite() == NOERR); ok = (mov.rewrite() == NOERR);
if (!ok) 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()); mov.get_long(MOV_NUMREG), mov.status());
} }
--d; --d;
@ -131,12 +138,12 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
reg.put("I6", last_num); reg.put("I6", last_num);
ok = (reg.rewrite() == NOERR); ok = (reg.rewrite() == NOERR);
if (!ok) 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()); (const char * ) regist, mov.status());
} }
else 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); set_firm(_default_firm);
return ok; return ok;
@ -167,13 +174,14 @@ bool TRipristina_stampa::menu(MENU_TAG)
const bool giornale = _msk->get_int(F_TIPO) == 5; const bool giornale = _msk->get_int(F_TIPO) == 5;
const int year = _msk->get_int(giornale ? F_ESER : F_YEAR); const int year = _msk->get_int(giornale ? F_ESER : F_YEAR);
const int month = _msk->get_int(F_MESE); 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)) if (prefhndl->exist(firm))
{ {
TString256 mess("Attenzione sara' ripristinata la stampa\n del registro "); TString256 mess("Attenzione sara' ripristinata la stampa del registro ");
mess << reg << " dell'" << (giornale ? "esercizio " : "anno ") << year mess << reg << "\ndell'" << (giornale ? "esercizio " : "anno ") << year
<< " della ditta " << firm << "dal " << day << '-' << month << '-' << year; << " della ditta " << firm << " dal " << day << '-' << month << '-' << year;
if (yesno_box((const char *) mess)) if (yesno_box((const char *) mess))
{ {