Corretta ricerca dei registri in seguito al zerofilling dell'anno

git-svn-id: svn://10.65.10.50/trunk@228 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-09-13 16:42:24 +00:00
parent 1d414b2abc
commit 5c70586f90
6 changed files with 176 additions and 163 deletions

View File

@ -72,7 +72,7 @@ END
NUMBER F_ANNOES 4 NUMBER F_ANNOES 4
BEGIN BEGIN
PROMPT 51 7 "Anno di esercizio " PROMPT 51 7 "Anno di esercizio "
FLAGS "D" FLAGS "DRZ"
END END
STRING F_CODCAUS 3 STRING F_CODCAUS 3

View File

@ -55,7 +55,7 @@ NUMBER F_ANNOES 4
BEGIN BEGIN
PROMPT 57 4 "Esercizio " PROMPT 57 4 "Esercizio "
FIELD ANNOES FIELD ANNOES
FLAGS "D" FLAGS "DRZ"
END END
DATE F_DATADOC DATE F_DATADOC

View File

@ -95,7 +95,7 @@ NUMBER F_ANNOES 4
BEGIN BEGIN
PROMPT 32 4 "Anno esercizio " PROMPT 32 4 "Anno esercizio "
FIELD LF_MOV->ANNOES FIELD LF_MOV->ANNOES
FLAGS "DG" FLAGS "DGRZ"
MESSAGE COPY,H_ANNOES MESSAGE COPY,H_ANNOES
END END
@ -202,7 +202,7 @@ BEGIN
PROMPT 51 9 "Riepilogo fino al n. " PROMPT 51 9 "Riepilogo fino al n. "
FIELD LF_MOV->UPROTIVA FIELD LF_MOV->UPROTIVA
NUM_EXPR (#F_RIEPILOGO==0)||(#F_RIEPILOGO>=#F_PROTIVA) NUM_EXPR (#F_RIEPILOGO==0)||(#F_RIEPILOGO>=#F_PROTIVA)
WARNING "Il riepilogo non puo' essere inferiore al protocollo IVA" WARNING "Inserire un riepilogo non inferiore al protocollo IVA"
END END
STRING F_CLIFO 1 STRING F_CLIFO 1
@ -504,7 +504,7 @@ END
NUMBER H_ANNOES 4 NUMBER H_ANNOES 4
BEGIN BEGIN
PROMPT 61 1 "Esercizio " PROMPT 61 1 "Esercizio "
FLAGS "D" FLAGS "DRZ"
END END
STRING H_CODCAUS 3 STRING H_CODCAUS 3

View File

@ -20,7 +20,8 @@ int date2esc(const TDate& d, int* prevesc)
{ {
const TDate ia(esc.get("D0")); // Data inizio esercizio const TDate ia(esc.get("D0")); // Data inizio esercizio
const TDate fa(esc.get("D1")); // Data fine esercizio const TDate fa(esc.get("D1")); // Data fine esercizio
const anno = esc.get_int("CODTAB"); TString16 sanno(esc.get_int("CODTAB")); sanno.cut(4);
const int anno = atoi(sanno);
if (d >= ia && d <= fa) if (d >= ia && d <= fa)
return anno; return anno;
if (prevesc) *prevesc = anno; if (prevesc) *prevesc = anno;

View File

@ -427,10 +427,13 @@ real TPrimanota_application::calcola_saldo() const
// Certified 90% // Certified 90%
bool TPrimanota_application::cg_handler(TMask_field& f, KEY k) bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
{ {
if (k == K_ENTER) if ((k == K_TAB && !f.mask().is_running()) || k == K_ENTER)
{ {
TSheet_field& cg = app().cgs(); TSheet_field& cg = app().cgs();
real saldo = app().calcola_saldo(); const real saldo = app().calcola_saldo();
if (k == K_ENTER)
{
if (saldo != ZERO) if (saldo != ZERO)
{ {
const char* ss = saldo.string("."); const char* ss = saldo.string(".");
@ -440,6 +443,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
if (app().get_cgs_imp(0).valore() == ZERO) if (app().get_cgs_imp(0).valore() == ZERO)
return f.error_box("Il movimento non ha una prima riga contabile valida!"); return f.error_box("Il movimento non ha una prima riga contabile valida!");
} }
}
return TRUE; return TRUE;
} }
@ -713,11 +717,12 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
// Certified 90% // Certified 90%
bool TPrimanota_application::iva_handler(TMask_field& f, KEY k) bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
{ {
if (k != K_ENTER) return TRUE; if ((k == K_TAB && !f.mask().is_running()) || k == K_ENTER)
{
const real imp = app().calcola_imp(); const real imp = app().calcola_imp();
const real tot = app().totale_documento(); const real tot = app().totale_documento();
if (k == K_ENTER)
{
if (imp != tot) if (imp != tot)
{ {
TString16 t(tot.string(".")); TString16 t(tot.string("."));
@ -725,7 +730,8 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
return error_box("La somma del totale documento e delle ritenute (%s) e' diverso dalla " return error_box("La somma del totale documento e delle ritenute (%s) e' diverso dalla "
"somma degli imponibili e delle imposte (%s)", (const char*)t, (const char*)i); "somma degli imponibili e delle imposte (%s)", (const char*)t, (const char*)i);
} }
}
}
return TRUE; return TRUE;
} }
@ -1197,6 +1203,7 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
pi.setstatus(i+1); pi.setstatus(i+1);
} }
app().fill_sheet(m); app().fill_sheet(m);
app().cgs().force_update();
} }
} }
return TRUE; return TRUE;

View File

@ -5,7 +5,6 @@
#include <causali.h> #include <causali.h>
const char* iva2name(TipoIVA iva) const char* iva2name(TipoIVA iva)
{ {
const char* i; const char* i;
@ -48,8 +47,7 @@ bool TRegistro::read(const char* cod, int year)
TTable reg("REG"); TTable reg("REG");
if (cod && *cod > ' ') if (cod && *cod > ' ')
{ {
TString16 chiave; TString16 chiave; chiave.format("%04d%s", year, cod);
chiave << year << cod;
reg.put("CODTAB", chiave); reg.put("CODTAB", chiave);
err = reg.read(); err = reg.read();
} }
@ -64,7 +62,15 @@ bool TRegistro::read(const char* cod, int year)
int TRegistro::year() const int TRegistro::year() const
{ return ok() ? atoi(_rec.get("CODTAB")) : 0; } {
int anno = 0;
if (ok())
{
TString16 sanno(_rec.get("CODTAB")); sanno.cut(4);
anno = atoi(sanno);
}
return anno;
}
@ -120,12 +126,9 @@ bool TRegistro::read_att()
bool TRegistro::agenzia_viaggi() bool TRegistro::agenzia_viaggi()
{ {
if (iva() != iva_vendite)
return FALSE;
bool av = FALSE; bool av = FALSE;
if (read_att()) av = _att.get_bool("REG74TER"); if (iva() == iva_vendite && read_att())
av = _att.get_bool("REG74TER");
return av; return av;
} }
@ -176,7 +179,7 @@ bool TLibro_giornale::read(int y)
TTable reg("REG"); TTable reg("REG");
bool found = FALSE; bool found = FALSE;
TString16 anno; anno.format("%4d", y); TString16 anno; anno.format("%04d", y);
reg.setkey(1); reg.setkey(1);
reg.put("CODTAB", anno); // Cerca il primo registro dell'anno y reg.put("CODTAB", anno); // Cerca il primo registro dell'anno y
@ -197,8 +200,9 @@ bool TLibro_giornale::read(int y)
return found; return found;
} }
TDate TLibro_giornale::global_last_print() const /*
{ TDate TLibro_giornale::global_last_print() const
{
TTable reg("REG"); TTable reg("REG");
reg.setkey(1); reg.setkey(1);
@ -212,7 +216,8 @@ TDate TLibro_giornale::global_last_print() const
} }
} }
return last; return last;
} }
*/
TLibro_giornale::TLibro_giornale(int y) TLibro_giornale::TLibro_giornale(int y)
{ {