1994-09-16 10:13:08 +00:00
|
|
|
#include <confapp.h>
|
|
|
|
#include <lffiles.h>
|
|
|
|
#include <files.h>
|
1994-10-12 17:59:25 +00:00
|
|
|
#include <isam.h>
|
1994-09-16 10:13:08 +00:00
|
|
|
#include "cg5100a.h"
|
|
|
|
|
|
|
|
class CG51_App : public TConfig_application
|
|
|
|
{
|
1994-10-12 17:59:25 +00:00
|
|
|
bool _change_pcon;
|
|
|
|
TString16 _val;
|
1994-09-16 10:13:08 +00:00
|
|
|
public:
|
|
|
|
virtual bool preprocess_config (TMask& mask, TConfig& config);
|
|
|
|
virtual bool postprocess_config (TMask& mask, TConfig& config);
|
|
|
|
virtual bool postprocess_config_changed(const char* par, const char* var,
|
|
|
|
const char* oldv, const char* newv);
|
|
|
|
|
1994-10-12 17:59:25 +00:00
|
|
|
virtual bool user_create() { _change_pcon = FALSE;}
|
|
|
|
virtual bool user_destroy();
|
1994-09-16 10:13:08 +00:00
|
|
|
CG51_App() : TConfig_application(CONFIG_DITTA) {}
|
|
|
|
virtual ~CG51_App() {}
|
|
|
|
};
|
1994-10-12 17:59:25 +00:00
|
|
|
bool CG51_App::user_destroy()
|
|
|
|
{
|
|
|
|
TDir dir;
|
|
|
|
TString file(16);
|
|
|
|
|
|
|
|
if (_change_pcon)
|
|
|
|
{
|
|
|
|
dir.get(LF_PCON, _lock, _nordir, _sysdirop);
|
|
|
|
file = dir.name();
|
|
|
|
file[0] = _val[0] == 'X' ? '%' : '$';
|
|
|
|
dir.set(file, dir.eod(), dir.flags(), dir.des(), dir.expr());
|
|
|
|
dir.put(LF_PCON, _nordir, _sysdirop);
|
|
|
|
if (dir.eox() == 0L)
|
|
|
|
{
|
|
|
|
TSystemisamfile s(LF_PCON);
|
|
|
|
s.build(10L);
|
|
|
|
}
|
|
|
|
|
|
|
|
dir.get(LF_CAUSALI, _lock, _nordir, _sysdirop);
|
|
|
|
file = dir.name();
|
|
|
|
file[0] = _val[0] == 'X' ? '%' : '$';
|
|
|
|
dir.set(file, dir.eod(), dir.flags(), dir.des(), dir.expr());
|
|
|
|
dir.put(LF_CAUSALI, _nordir, _sysdirop);
|
|
|
|
if (dir.eox() == 0L)
|
|
|
|
{
|
|
|
|
TSystemisamfile s(LF_CAUSALI);
|
|
|
|
s.build(10L);
|
|
|
|
}
|
|
|
|
|
|
|
|
dir.get(LF_RCAUSALI, _lock, _nordir, _sysdirop);
|
|
|
|
file = dir.name();
|
|
|
|
file[0] = _val[0] == 'X' ? '%' : '$';
|
|
|
|
dir.set(file, dir.eod(), dir.flags(), dir.des(), dir.expr());
|
|
|
|
dir.put(LF_RCAUSALI, _nordir, _sysdirop);
|
|
|
|
if (dir.eox() == 0L)
|
|
|
|
{
|
|
|
|
TSystemisamfile s(LF_RCAUSALI);
|
|
|
|
s.build(10L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
1994-09-16 10:13:08 +00:00
|
|
|
|
|
|
|
bool CG51_App::preprocess_config (TMask& mask, TConfig& config)
|
|
|
|
{
|
|
|
|
// these are disabled in normal applications
|
1994-10-12 17:59:25 +00:00
|
|
|
TLocalisamfile mov(LF_MOV);
|
|
|
|
const bool movempty = mov.empty();
|
|
|
|
mask.enable(CHK_ANCFCM, movempty);
|
|
|
|
mask.enable(CHK_PCTCCM, movempty);
|
1994-09-16 10:13:08 +00:00
|
|
|
disable_menu_item(M_FILE_NEW);
|
|
|
|
disable_menu_item(M_FILE_REVERT);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CG51_App::postprocess_config(TMask& mask, TConfig& config)
|
|
|
|
{
|
|
|
|
enable_menu_item(M_FILE_NEW);
|
|
|
|
enable_menu_item(M_FILE_REVERT);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CG51_App::postprocess_config_changed(const char* par, const char* var,
|
|
|
|
const char* oldv, const char* newv)
|
|
|
|
{
|
|
|
|
TString v(var);
|
|
|
|
TDir dir;
|
|
|
|
TString file(16);
|
|
|
|
|
|
|
|
if (v == "AnCfCm")
|
|
|
|
{
|
1994-10-12 17:59:25 +00:00
|
|
|
if (yesno_box("Confermi il cambiamento dell'anagrafica clienti/fornitori"))
|
|
|
|
{
|
|
|
|
dir.get(LF_CLIFO, _lock, _nordir, _sysdirop);
|
|
|
|
file = dir.name();
|
|
|
|
file[0] = *newv == 'X' ? '%' : '$';
|
|
|
|
dir.set(file, dir.eod(), dir.flags(), dir.des(), dir.expr());
|
|
|
|
dir.put(LF_CLIFO, _nordir, _sysdirop);
|
|
|
|
if (dir.eox() == 0L)
|
|
|
|
{
|
|
|
|
TSystemisamfile s(LF_CLIFO);
|
|
|
|
s.build(10L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
1994-09-16 10:13:08 +00:00
|
|
|
}
|
|
|
|
else if (v == "PcTcCm")
|
|
|
|
{
|
1994-10-12 17:59:25 +00:00
|
|
|
if (yesno_box("Confermi il cambiamento del piano conti/causali"))
|
|
|
|
{
|
|
|
|
_change_pcon = TRUE;
|
|
|
|
_val = newv;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
1994-09-16 10:13:08 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int cg5100 (int argc, char* argv[])
|
|
|
|
{
|
|
|
|
CG51_App appc;
|
|
|
|
appc.run(argc, argv, "Parametri Ditta");
|
|
|
|
return 0;
|
|
|
|
}
|