Corretto errore MI0159 (migliorato autopremimento)

git-svn-id: svn://10.65.10.50/trunk@1186 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1995-03-29 14:15:48 +00:00
parent 7924f321c4
commit 5ceac3fb47
2 changed files with 55 additions and 16 deletions

@ -1,4 +1,5 @@
#include <relapp.h>
#include <defmask.h>
#include <pconti.h>
#include "cg0.h"
@ -248,11 +249,13 @@ void CG0100_application::init_insert_mode(TMask& m)
HIDDEN bool gruppo_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
const int gruppo = m.get_int(FLD_CM1_GRUPPO);
const int conto = m.get_int(FLD_CM1_CONTO);
const long sottoc = m.get_long(FLD_CM1_SOTTOCONTO);
if (key == K_ENTER)
{
const TMask& m = f.mask();
const int gruppo = atoi(m.get(FLD_CM1_GRUPPO));
const int conto = atoi(m.get(FLD_CM1_CONTO));
TLocalisamfile& pconti = app().get_relation()->lfile();
if (gruppo != 0 && conto != 0)
{
@ -264,17 +267,33 @@ HIDDEN bool gruppo_handler(TMask_field& f, KEY key)
return f.warning_box ("Il gruppo non esiste");
}
}
else
if (key == K_TAB)
{
const int next = m.next_fld();
bool key_ok = TRUE;
if (sottoc > 0)
key_ok = gruppo > 0 && conto > 0;
else
if (conto > 0)
key_ok = gruppo > 0;
if (key_ok && next != DLG_NULL && next != f.dlg() &&
!m.field(next).in_key(1))
return m.stop_run(K_AUTO_ENTER);
}
return TRUE;
}
HIDDEN bool conto_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
const int gruppo = m.get_int(FLD_CM1_GRUPPO);
const int conto = m.get_int(FLD_CM1_CONTO);
const long sottoc = m.get_long(FLD_CM1_SOTTOCONTO);
if (key == K_ENTER)
{
const TMask& m = f.mask();
const int gruppo = m.get_int(FLD_CM1_GRUPPO);
const int conto = m.get_int(FLD_CM1_CONTO);
const long sottoc = m.get_int(FLD_CM1_SOTTOCONTO);
TLocalisamfile& pconti = app().get_relation()->lfile();
if (gruppo != 0 && conto != 0 && sottoc != 0)
@ -292,7 +311,22 @@ HIDDEN bool conto_handler(TMask_field& f, KEY key)
return m.field(FLD_CM1_SOTTOCONTO).warning_box ("Non e' possibile inserire un sottoconto di un conto relativo ad un cliente/fornitore");
}
}
}
}
else
if (key == K_TAB)
{
const int next = m.next_fld();
bool key_ok = TRUE;
if (sottoc > 0)
key_ok = gruppo > 0 && conto > 0;
else
if (conto > 0)
key_ok = gruppo > 0;
if (key_ok && next != DLG_NULL && next != f.dlg() &&
!m.field(next).in_key(1))
return m.stop_run(K_AUTO_ENTER);
}
return TRUE;
}
@ -300,14 +334,17 @@ HIDDEN bool sottoc_handler(TMask_field& f, KEY key)
{
if (key == K_TAB)
{
TMask& m = f.mask();
const int gruppo = m.get_int(FLD_CM1_GRUPPO);
TMask& m = f.mask();
const int gruppo = m.get_int(FLD_CM1_GRUPPO);
const int conto = m.get_int(FLD_CM1_CONTO);
const long sottoc = m.get_long(FLD_CM1_SOTTOCONTO);
const int next = m.next_fld();
if (gruppo == 0) return TRUE;
const int conto = m.get_int(FLD_CM1_CONTO);
const long sottoconto = m.get_long(FLD_CM1_SOTTOCONTO);
if (sottoconto != 0 && conto == 0)
if (sottoc != 0 && conto == 0)
return m.field(FLD_CM1_CONTO).error_box("Manca il conto");
return m.stop_run(K_AUTO_ENTER);
if (next != DLG_NULL && next != f.dlg() && !m.field(next).in_key(1))
return m.stop_run(K_AUTO_ENTER);
}
return TRUE;
}

@ -41,8 +41,10 @@ $(O)/cg0400.o: cg0400.cpp $(I6) $(I10) $(I24) $(I27) $(I33) $(I43) cg0400.h cg
$(O)/cg0500.o: cg0500.cpp $(I6) $(I10) $(I24) $(I27) $(I33) $(I43) cg0500.h
$(EP)cg0: $(O)/cg0.o $(O)/cg0100.o $(O)/cg0200.o $(O)/cg0201.o $(O)/cg0300.o $(O)/cg0400.o $(O)/cg0500.o $(O)/cg2103.o $(O)/conto.o $(LIBD1) $(EP)cg0.frl
$(LINK) $(LFLAGSD1) $@ $(O)/cg0.o $(O)/cg0100.o $(O)/cg0200.o $(O)/cg0201.o $(O)/cg0300.o $(O)/cg0400.o $(O)/cg0500.o $(O)/cg2103.o $(O)/conto.o
$(EP)classpim.o: classpim.cpp classpim.h
$(EP)cg0: $(O)/cg0.o $(O)/cg0100.o $(O)/cg0200.o $(O)/cg0201.o $(O)/cg0300.o $(O)/cg0400.o $(O)/cg0500.o $(O)/cg2103.o $(O)/conto.o $(O)/classpim.o $(LIBD1) $(EP)cg0.frl
$(LINK) $(LFLAGSD1) $@ $(O)/cg0.o $(O)/cg0100.o $(O)/cg0200.o $(O)/cg0201.o $(O)/cg0300.o $(O)/cg0400.o $(O)/cg0500.o $(O)/cg2103.o $(O)/conto.o $(O)/classpim.o
$(EP)cg0.frl: cg0.url $(U1)
$(RCOMP) cg0 -l $(EP)cg0