Corretti errori di gestione/stampa tabella indici libro
unico: dal MI4259 al MI4267. git-svn-id: svn://10.65.10.50/trunk@3441 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
70c2a931ba
commit
51db9c4e5a
@ -1,5 +1,6 @@
|
|||||||
#include <relapp.h>
|
#include <relapp.h>
|
||||||
|
#include <nditte.h>
|
||||||
|
#include <prefix.h>
|
||||||
#include "batbinl.h"
|
#include "batbinl.h"
|
||||||
|
|
||||||
class TIndici_app : public TRelation_application
|
class TIndici_app : public TRelation_application
|
||||||
@ -19,16 +20,99 @@ protected:
|
|||||||
|
|
||||||
virtual const char* get_next_key();
|
virtual const char* get_next_key();
|
||||||
virtual bool save_and_new() const { return TRUE; }
|
virtual bool save_and_new() const { return TRUE; }
|
||||||
|
virtual int read(TMask& m);
|
||||||
|
|
||||||
|
static bool ditta_handler(TMask_field& f, KEY key);
|
||||||
|
static bool annullapagine_handler(TMask_field& f, KEY key);
|
||||||
|
static TIndici_app& app() { return (TIndici_app&) main_app(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TIndici_app() {}
|
TIndici_app() {}
|
||||||
virtual ~TIndici_app() {}
|
virtual ~TIndici_app() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool TIndici_app::ditta_handler(TMask_field& f, KEY key)
|
||||||
|
{
|
||||||
|
TMask& m = f.mask();
|
||||||
|
if (key == K_TAB && m.is_running())
|
||||||
|
{
|
||||||
|
const long ditta = atol(f.get());
|
||||||
|
if (ditta == 0L && m.is_running())
|
||||||
|
{
|
||||||
|
m.reset(F_CODREG);m.reset(F_DESCREG);
|
||||||
|
m.disable(F_CODREG); m.disable(F_DESCREG);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((key == K_TAB && f.focusdirty()) || key == K_ENTER)
|
||||||
|
{
|
||||||
|
const long ditta = atol(f.get());
|
||||||
|
if (ditta == 0L) return TRUE;
|
||||||
|
if (prefix().exist(ditta))
|
||||||
|
{
|
||||||
|
app().set_firm(ditta);
|
||||||
|
m.enable(F_CODREG); m.enable(F_DESCREG);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f.error_box("Ditta %5ld non abilitata in contabilita'",ditta);
|
||||||
|
m.reset(F_CODREG);m.reset(F_DESCREG);
|
||||||
|
m.disable(F_CODREG); m.disable(F_DESCREG);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TIndici_app::annullapagine_handler(TMask_field& f, KEY key)
|
||||||
|
{
|
||||||
|
if (key == K_SPACE && f.focusdirty())
|
||||||
|
{
|
||||||
|
TMask& m = f.mask();
|
||||||
|
m.set(F_DESCREG,"");
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TIndici_app::read(TMask& m)
|
||||||
|
{
|
||||||
|
int r = TRelation_application::read(m);
|
||||||
|
long ditta = m.get_long(F_DITTA);
|
||||||
|
if (ditta > 0L)
|
||||||
|
if (prefix().exist(ditta))
|
||||||
|
set_firm(ditta);
|
||||||
|
else
|
||||||
|
warning_box("Ditta %5ld non abilitata in contabilita'",ditta);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
bool TIndici_app::user_create()
|
bool TIndici_app::user_create()
|
||||||
{
|
{
|
||||||
|
if (get_firm() == 0) // Se e' posizionato nel direttorio comune, setta la prima ditta abilitata in contabilita'
|
||||||
|
{
|
||||||
|
bool found = FALSE;
|
||||||
|
TLocalisamfile ditte(LF_NDITTE);
|
||||||
|
const long items = ditte.items();
|
||||||
|
long ditta = 0L;
|
||||||
|
for (ditte.first(); !found && ditte.ok(); ditte.next())
|
||||||
|
{
|
||||||
|
ditta = ditte.get_long(NDT_CODDITTA);
|
||||||
|
if (prefix().exist(ditta)) found = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
error_box("Abilitare almeno una ditta in contabilita'.");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
set_firm(ditta);
|
||||||
|
}
|
||||||
_indici = new TRelation(LF_INDLIB);
|
_indici = new TRelation(LF_INDLIB);
|
||||||
_maschera = new TMask("batbinl");
|
_maschera = new TMask("batbinl");
|
||||||
|
_maschera->set_handler(F_DITTA, ditta_handler);
|
||||||
|
_maschera->set_handler(F_PANN_LU, annullapagine_handler);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user