Controllo sul massimo numero di registrazione

git-svn-id: svn://10.65.10.50/trunk@592 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-11-10 14:42:57 +00:00
parent 6fa1850d67
commit 376c915b9a
2 changed files with 20 additions and 8 deletions

View File

@ -1049,15 +1049,26 @@ bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
///////////////////////////////////////////////////////////
// Handler of the F_NUMREG field on the query mask
// Certified 90%
// Certified 99%
bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
{
if (!f.mask().is_running()) return TRUE;
if (key == K_TAB && f.get().not_empty())
{
if (app().find(1))
dispatch_e_char(f.parent(), K_AUTO_ENTER);
{
TMask& m = f.mask();
if (!m.is_running()) return TRUE;
const long num = atol(f.get());
if (key == K_TAB && num > 0)
{
const long max = app()._lastreg+1;
if (num < max)
{
if (app().find(1))
m.stop_run(K_AUTO_ENTER);
}
else if (num > max)
{
f.set(format("%ld", max));
return f.error_box("Non e' possibile inserire movimenti superiori al %ld", max);
}
}
return TRUE;
}

View File

@ -66,6 +66,7 @@ BEGIN
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
DISPLAY "Tipo" TMCF
OUTPUT 103 TMCF
OUTPUT 104 GRUPPO
OUTPUT 105 CONTO