7702fd3969
Files correlati : lv0.exe Ricompilazione Demo : [ ] Commento : Implemetata generazione prossimo codice per tutte le tabelle con codice numerico Semplificarta lettura scrittura tabella passaggi planning git-svn-id: svn://10.65.10.50/trunk@17228 c028cbd2-c16b-5b4b-a496-9718f37d4682
73 lines
2.2 KiB
C++
Executable File
73 lines
2.2 KiB
C++
Executable File
// gestione tabelle lavanderie
|
|
|
|
#include <automask.h>
|
|
#include <modtbapp.h>
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Maschera generica di gestione tabelle lavanderie
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TLV_table_mask : public TAutomask
|
|
{
|
|
protected:
|
|
virtual bool on_field_event(TOperable_field &o, TField_event e, long jolly);
|
|
|
|
public:
|
|
TLV_table_mask(const char* name) : TAutomask(name) {}
|
|
};
|
|
|
|
bool TLV_table_mask::on_field_event(TOperable_field &o, TField_event e, long jolly)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Applicazione generica di gestione tabelle lavanderie
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// applicazione per la gestione delle tabelle di lavanderia
|
|
class TLV_table_app : public TTable_module_application
|
|
{
|
|
protected: // TRelation_application
|
|
virtual TMask* user_create_mask();
|
|
virtual bool get_next_key(TToken_string& key);
|
|
|
|
public:
|
|
};
|
|
|
|
// Ridefinire questo metodo per le eventuali maschere speciali
|
|
// che abbiano controlli speciali da effettuare nella on_field_evebt
|
|
TMask* TLV_table_app::user_create_mask()
|
|
{
|
|
const TString4 name = get_relation()->file(0).name();
|
|
if (name == "???")
|
|
return new TLV_table_mask("???");
|
|
// Le maschere normali sono gia' gestite dalla TTable_module_application
|
|
return TTable_module_application::user_create_mask();
|
|
}
|
|
|
|
// Cerca di generare automaticamente la prossima chiave numerica di una tabella
|
|
bool TLV_table_app::get_next_key(TToken_string& key)
|
|
{
|
|
// Controlla se il campo COTDAB e' numerico
|
|
TMask& msk = curr_mask();
|
|
TMask_field* keyfield = msk.find_by_fieldname("CODTAB");
|
|
if (keyfield != NULL && keyfield->is_kind_of(CLASS_REAL_FIELD))
|
|
{
|
|
long num = 1;
|
|
TLocalisamfile& tab = get_relation()->lfile();
|
|
if (tab.last() == NOERR) // Cerca l'eventuale ultimo record della tabella
|
|
num += tab.get_long("CODTAB");
|
|
// Costrusci la chiave formattata alla giusta lunghezza del campo, es: "101|0003"
|
|
key.format("%d|%0*ld", keyfield->dlg(), keyfield->size(), num);
|
|
}
|
|
return key.full(); // Ritorna true se la procedura e' riuscita
|
|
}
|
|
|
|
int lv0100(int argc, char* argv[])
|
|
{
|
|
TLV_table_app a;
|
|
a.run(argc, argv, TR("Tabella Lavanderie"));
|
|
return 0;
|
|
}
|