campo-sirio/include/modtbapp.cpp
guy 2c144f4dac Aggiunta funzione dexist per testare esistenza cartelle
Corretta gestione tabelle di modulo contenenti il codice cliente


git-svn-id: svn://10.65.10.50/branches/R_10_00@22848 c028cbd2-c16b-5b4b-a496-9718f37d4682
2013-05-06 08:50:32 +00:00

92 lines
1.8 KiB
C++
Executable File

#include <execp.h>
#include <modtbapp.h>
#include <tabmod.h>
// @cmember Richiede la maschera da usare
TMask* TTable_module_application::get_mask(int)
{
CHECK(_msk, "Null mask");
return _msk;
}
// @cmember Ritorna la relazione da modificare
TRelation* TTable_module_application::get_relation() const
{
CHECK(_rel, "Null relation");
return _rel;
}
void TTable_module_application::print()
{
const TModule_table& tab = (const TModule_table&)file();
TString16 cmd;
cmd << tab.module() << "1 -0 " << tab.name();
TExternal_app stampa(cmd);
stampa.run();
}
bool TTable_module_application::protected_record(TRectype& rec)
{
return rec.get_bool("FPC");
}
void TTable_module_application::set_mask(TMask * mask)
{
if (mask != NULL)
{
if (_msk != NULL)
delete _msk;
_msk = mask;
}
}
TMask* TTable_module_application::user_create_mask()
{
TModule_table& tab = (TModule_table&)file();
TString16 name = tab.module();
if (tab.customer() > 0)
{
TString8 c;
c.format("%06ld", tab.customer());
name << c;
}
name << "tb" << tab.name();
return new TMask(name);
}
bool TTable_module_application::user_create()
{
if (argc() < 3)
return false;
TString16 tabname = argv(2);
tabname.upper();
if (tabname[0] != '&')
tabname.insert("&"); // Forza la tabella di modulo
_rel = new TRelation(tabname);
_msk = user_create_mask();
TFilename rep = _msk->source_file().name();
const int tb = rep.find("tb");
if (tb > 0)
rep.overwrite("st", tb);
if (rep.custom_path())
{
enable_menu_item(M_FILE_PREVIEW);
enable_menu_item(M_FILE_PRINT);
}
TString title;
_msk->get_caption(title);
set_title(title);
return true;
}
bool TTable_module_application::user_destroy()
{
if (_msk) delete _msk;
if (_rel) delete _rel;
return true;
}