campo-sirio/include/modtbapp.cpp
guy be3aaff31b Patch level : 10.0
Files correlati     : lv0
Ricompilazione Demo : [ ]
Commento            :
Aggiunta gestione tabelle di modulo (preliminare)


git-svn-id: svn://10.65.10.50/trunk@16940 c028cbd2-c16b-5b4b-a496-9718f37d4682
2008-07-25 07:59:03 +00:00

79 lines
1.6 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");
}
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;
TString4 tabname = argv(2);
tabname.upper();
if (tabname.len() == 3)
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_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;
}