1994-11-10 10:59:24 +00:00
|
|
|
|
#include <applicat.h>
|
1997-12-15 15:11:40 +00:00
|
|
|
|
#include <form.h>
|
1994-11-10 10:59:24 +00:00
|
|
|
|
#include <modaut.h>
|
1996-05-28 09:39:05 +00:00
|
|
|
|
#include <msksheet.h>
|
1997-12-15 15:11:40 +00:00
|
|
|
|
#include <printer.h>
|
1994-11-10 10:59:24 +00:00
|
|
|
|
#include <utility.h>
|
|
|
|
|
#include <urldefid.h>
|
1998-04-30 14:38:35 +00:00
|
|
|
|
#include <dongle.h>
|
1995-02-21 15:10:12 +00:00
|
|
|
|
|
1994-11-10 10:59:24 +00:00
|
|
|
|
#include "ba1.h"
|
1996-05-28 09:39:05 +00:00
|
|
|
|
#include "ba1500.h"
|
1994-11-10 10:59:24 +00:00
|
|
|
|
#include "ba1500a.h"
|
1998-04-30 14:38:35 +00:00
|
|
|
|
#include "ba1500b.h"
|
1997-12-15 15:11:40 +00:00
|
|
|
|
#include "ba1600.h"
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
|
TInformazione_moduli::TInformazione_moduli()
|
1998-11-04 18:04:26 +00:00
|
|
|
|
: _unassigned_modules(0)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
const TDongle& d = dongle();
|
|
|
|
|
for (word mod = M77AUT; mod < ENDAUT; mod++)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
TToken_string t = d.module_code2desc(mod);
|
|
|
|
|
if (t.len() > 2 && !t.starts_with("Modulo vario", true)) // Scarta moduli ignoti
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
if (d.shown(mod)) //controlla che sia veramente un modulo da mostrare!
|
|
|
|
|
{
|
|
|
|
|
t.add(d.module_code2name(mod));
|
|
|
|
|
t.add(mod);
|
|
|
|
|
_infos.add(t);
|
|
|
|
|
}
|
1996-05-28 09:39:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_infos.sort();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
for (int i = 0; i < _infos.items(); i++)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
|
|
|
|
TToken_string& riga = _infos.row(i);
|
1996-06-12 08:32:36 +00:00
|
|
|
|
const int mod = riga.get_int(2);
|
|
|
|
|
_index[mod] = i;
|
1996-05-28 09:39:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const char* TInformazione_moduli::get_description_by_order(int index)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (index >= 0 && index < _infos.items())
|
1996-05-28 09:39:05 +00:00
|
|
|
|
return _infos.row(index).get(0);
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const char* TInformazione_moduli::get_description_by_name(const char* code) const
|
|
|
|
|
{
|
|
|
|
|
FOR_EACH_ARRAY_ROW_BACK(_infos, i, info)
|
|
|
|
|
{
|
2008-04-04 16:03:36 +00:00
|
|
|
|
if (xvt_str_compare_ignoring_case(info->get(1), code) == 0)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
return info->get(0);
|
|
|
|
|
}
|
2008-04-04 16:03:36 +00:00
|
|
|
|
return TR("{MODULO SCONOSCIUTO}");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const char* TInformazione_moduli::get_name_by_order(int index)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (index >= 0 && index < _infos.items())
|
1996-05-28 09:39:05 +00:00
|
|
|
|
return _infos.row(index).get(1);
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TInformazione_moduli::get_module_by_order(int index)
|
|
|
|
|
{
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (index >= 0 && index < _infos.items())
|
|
|
|
|
return _infos.row(index).get_int(2);
|
1996-05-28 09:39:05 +00:00
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const char* TInformazione_moduli::get_description(int module)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{ return get_description_by_order(_index[module]); }
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const char* TInformazione_moduli::get_name(int module)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{ return get_name_by_order(_index[module]); }
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int TInformazione_moduli::get_index(int module) const
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{ return _index[module]; }
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int TInformazione_moduli::get_index_by_name(const char* code) const
|
|
|
|
|
{
|
|
|
|
|
FOR_EACH_ARRAY_ROW_BACK(_infos, i, info)
|
|
|
|
|
{
|
2008-04-04 16:03:36 +00:00
|
|
|
|
if (xvt_str_compare_ignoring_case(info->get(1), code) == 0)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return i >= 0 ? get_index(i) : i;
|
|
|
|
|
}
|
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
1997-12-15 15:11:40 +00:00
|
|
|
|
// TForm richiesta attivazione
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TRequest_form : public TForm
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
void update_serno(const TString& serno);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
void update_dongle();
|
2001-04-30 14:22:43 +00:00
|
|
|
|
void update_os();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
void print_footer();
|
|
|
|
|
|
|
|
|
|
TRequest_form(const char* name);
|
|
|
|
|
virtual ~TRequest_form() { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TRequest_form::TRequest_form(const char* name)
|
|
|
|
|
: TForm(name)
|
|
|
|
|
{
|
|
|
|
|
const TPrint_section& header = section('H', odd_page);
|
|
|
|
|
const TPrint_section& footer = section('F', odd_page);
|
|
|
|
|
|
|
|
|
|
int riga[66];
|
|
|
|
|
int y1 = header.height()-2;
|
|
|
|
|
int y2 = printer().formlen() - footer.height();
|
|
|
|
|
if ((y2-y1) & 0x1) y2--; // Forza un numero pari di righe
|
|
|
|
|
|
|
|
|
|
for (int i = 0; ; i++)
|
|
|
|
|
{
|
|
|
|
|
riga[i] = y1 + 2*(i+1);
|
|
|
|
|
if (riga[i] >= y2-1)
|
|
|
|
|
{
|
|
|
|
|
riga[i] = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
genera_intestazioni(odd_page, y1+1);
|
|
|
|
|
genera_fincatura(odd_page, y1, y2, riga);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRequest_form::update_serno(const TString& num)
|
|
|
|
|
{
|
|
|
|
|
const TDate today(TODAY);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
TForm_item& data = find_field('H', odd_page, FF_DATARICH);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
data.set(today.string());
|
1998-04-30 14:38:35 +00:00
|
|
|
|
switch (::dongle().hardware() )
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
case _dongle_hardlock:
|
|
|
|
|
find_field('H',odd_page,FF_DONGLE_HW).set("HARDLOCK"); break;
|
|
|
|
|
default:
|
|
|
|
|
find_field('H',odd_page,FF_DONGLE_HW).set("EUTRON"); break;
|
1998-04-30 14:38:35 +00:00
|
|
|
|
}
|
|
|
|
|
TForm_item& serno = find_field('H', odd_page, FF_DONGLE_SN);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
serno.set(num);
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
void TRequest_form::update_dongle()
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
const TDongle& d = dongle();
|
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
TForm_item& year = find_field('H', odd_page, FF_YEAR);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
TString16 str;
|
|
|
|
|
str << "31-12-" << (int)d.year_assist();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
year.set(str);
|
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
TForm_item& user = find_field('H', odd_page, FF_NUTENTI);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
str.format("%d", d.max_users());
|
1997-12-15 15:11:40 +00:00
|
|
|
|
user.set(str);
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-30 14:22:43 +00:00
|
|
|
|
void TRequest_form::update_os()
|
|
|
|
|
{
|
2003-03-31 14:36:25 +00:00
|
|
|
|
const char* stros = NULL;
|
|
|
|
|
switch (xvt_sys_get_os_version())
|
2001-04-30 14:22:43 +00:00
|
|
|
|
{
|
2004-04-30 09:17:07 +00:00
|
|
|
|
case XVT_WS_LINUX : stros = "Linux"; break;
|
2003-03-31 14:36:25 +00:00
|
|
|
|
case XVT_WS_WIN_95: stros = "Windows 95"; break;
|
|
|
|
|
case XVT_WS_WIN_98: stros = "Windows 98"; break;
|
2007-03-30 13:51:17 +00:00
|
|
|
|
default : stros = "Windows NT/2000/XP"; break;
|
2001-04-30 14:22:43 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
|
|
TForm_item& os = find_field('H', odd_page, FF_OS);
|
2001-04-30 14:22:43 +00:00
|
|
|
|
os.set(stros);
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
void TRequest_form::print_footer()
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
set_footer(odd_page, true);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
printer().formfeed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TAttivazione_moduli
|
1997-09-30 09:34:49 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
1996-05-16 10:44:00 +00:00
|
|
|
|
|
2001-05-07 13:28:51 +00:00
|
|
|
|
class TAttivazione_moduli : public TSkeleton_application
|
1994-11-10 10:59:24 +00:00
|
|
|
|
{
|
|
|
|
|
TMask* _msk;
|
1996-05-28 09:39:05 +00:00
|
|
|
|
TInformazione_moduli* _im;
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
|
|
|
|
word _serno;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
word _wanted_users, _wanted_assist;
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
private:
|
|
|
|
|
void garble_dongle(word k[4]) const;
|
|
|
|
|
const TString& garble_md5(const char* strin) const;
|
|
|
|
|
const TString& garble_md5(long numin) const;
|
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
protected:
|
1994-11-10 10:59:24 +00:00
|
|
|
|
virtual bool create() ;
|
|
|
|
|
virtual bool destroy() ;
|
2001-05-07 13:28:51 +00:00
|
|
|
|
virtual void main_loop();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
virtual bool use_files() const { return false; }
|
2001-06-25 10:41:20 +00:00
|
|
|
|
virtual bool test_assistance_year() const;
|
1994-12-07 11:07:54 +00:00
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
void garble_module(word n, TString& str1, TString& str2) const;
|
|
|
|
|
void garble_users(word u, TString& str1, TString& str2) const;
|
|
|
|
|
void garble_year(word year, TString& str1, TString& str2) const;
|
1997-11-20 08:18:05 +00:00
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
word& serno() { return _serno; }
|
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
void init_mask();
|
|
|
|
|
void update_listino();
|
|
|
|
|
void load_masklistino(TMask & m);
|
|
|
|
|
void save_masklistino(TMask & m);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
int build_sheet(bool on = true);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
void build_key_column();
|
|
|
|
|
|
|
|
|
|
bool burn_dongle();
|
|
|
|
|
|
1994-11-10 10:59:24 +00:00
|
|
|
|
static void keyext(const TString & s, word * v);
|
1996-05-28 09:39:05 +00:00
|
|
|
|
static void encode_second_key();
|
1997-09-30 09:34:49 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
static bool date_hnd(TMask_field& f, KEY k);
|
|
|
|
|
static bool serno_hnd(TMask_field& f, KEY k);
|
1997-11-20 08:18:05 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
static bool k_notify(TSheet_field& f, int r, KEY k);
|
1997-11-20 08:18:05 +00:00
|
|
|
|
static bool change_users_handler(TMask_field&, KEY key);
|
|
|
|
|
static bool maxuser_handler(TMask_field& fld, KEY key);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
static bool change_assist_handler(TMask_field&, KEY key);
|
|
|
|
|
static bool assist_handler(TMask_field& fld, KEY key);
|
|
|
|
|
static bool print_handler(TMask_field& fld, KEY key);
|
1998-08-25 17:46:29 +00:00
|
|
|
|
static bool printlist_handler(TMask_field& fld, KEY key);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
static bool aggiorna_listino_handler(TMask_field& fld, KEY key);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
static bool modifica_listino_handler(TMask_field& fld, KEY key);
|
1998-01-28 08:53:28 +00:00
|
|
|
|
static bool aga_handler(TMask_field& fld, KEY key);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
static bool sh_nposti_handler(TMask_field& fld, KEY key);
|
|
|
|
|
static bool sh_acquisto_handler(TMask_field& fld, KEY key);
|
|
|
|
|
static bool sh_aggiornamento_handler(TMask_field& fld, KEY key);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
2001-04-30 14:22:43 +00:00
|
|
|
|
bool new_module_requested();
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
void print_request();
|
|
|
|
|
void print_answer();
|
2001-04-30 14:22:43 +00:00
|
|
|
|
void print_status();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
//void print_listino();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual void print();
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
TAttivazione_moduli() : _msk(NULL), _wanted_users(0), _wanted_assist(0) { }
|
|
|
|
|
virtual ~TAttivazione_moduli() { }
|
1994-11-10 10:59:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
1994-12-07 11:07:54 +00:00
|
|
|
|
HIDDEN TAttivazione_moduli& app() { return (TAttivazione_moduli &)main_app(); }
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
int round_price(int val)
|
|
|
|
|
{
|
|
|
|
|
if (val>50000)
|
|
|
|
|
val=int((val+9)/10000)*10000;
|
|
|
|
|
else
|
|
|
|
|
val=int((val+9)/10)*10;
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAttivazione_moduli::sh_nposti_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_TAB && fld.focusdirty())
|
|
|
|
|
{
|
|
|
|
|
// default
|
|
|
|
|
int posti = atoi(fld.get());
|
|
|
|
|
if (posti<=1)
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1998-04-30 14:38:35 +00:00
|
|
|
|
int val = fld.mask().get_int(F_ACQ1);
|
|
|
|
|
switch (posti)
|
|
|
|
|
{
|
|
|
|
|
case 2:
|
|
|
|
|
val = int(val * .30); break;
|
|
|
|
|
case 3:
|
|
|
|
|
val = int(val * .20); break;
|
|
|
|
|
case 5:
|
|
|
|
|
val = int(val * .15); break;
|
|
|
|
|
case 9:
|
|
|
|
|
val = int(val * .10); break;
|
|
|
|
|
case 30:
|
|
|
|
|
val = int(val * .05); break;
|
|
|
|
|
default:
|
|
|
|
|
val=0;
|
|
|
|
|
}
|
|
|
|
|
val = round_price(val);
|
|
|
|
|
if (fld.mask().field(fld.dlg()+1).empty())
|
|
|
|
|
fld.mask().field(fld.dlg()+1).set(val) ; // costo di acquisto
|
|
|
|
|
val=fld.mask().get_int(fld.dlg()+1);
|
|
|
|
|
val = int (val * .35);
|
|
|
|
|
val = round_price(val);
|
|
|
|
|
fld.mask().field(fld.dlg()+2).set(val) ; // costo di aggiornamento
|
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1998-04-30 14:38:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAttivazione_moduli::sh_acquisto_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1998-04-30 14:38:35 +00:00
|
|
|
|
}
|
|
|
|
|
bool TAttivazione_moduli::sh_aggiornamento_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_TAB && fld.empty())
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1998-04-30 14:38:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TAttivazione_moduli::update_listino()
|
|
|
|
|
{
|
|
|
|
|
TMask msklistino("ba1500b") ;
|
|
|
|
|
TMask &smask = msklistino.sfield(F_MODULILIST).sheet_mask();
|
|
|
|
|
for (int c=0; c<6; c++)
|
|
|
|
|
{
|
|
|
|
|
smask.set_handler(F_POSTI1+3*c, sh_nposti_handler );
|
|
|
|
|
smask.set_handler(F_ACQ1+3*c, sh_acquisto_handler );
|
|
|
|
|
smask.set_handler(F_AGG1+3*c, sh_aggiornamento_handler);
|
|
|
|
|
}
|
|
|
|
|
load_masklistino(msklistino);
|
|
|
|
|
if (msklistino.run()==K_ENTER)
|
|
|
|
|
{
|
|
|
|
|
save_masklistino(msklistino);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAttivazione_moduli::load_masklistino(TMask &msklistino)
|
|
|
|
|
{
|
|
|
|
|
TWait_cursor hourglass;
|
|
|
|
|
TInstall_ini ini;
|
|
|
|
|
TDate dt(ini.get("Listino","Main"));
|
|
|
|
|
if (!dt.empty())
|
|
|
|
|
msklistino.set(F_DATALIST,dt);
|
|
|
|
|
|
|
|
|
|
TSheet_field& sf = msklistino.sfield(F_MODULILIST);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
for (int i = 0; i < sf.items(); i++)
|
1998-04-30 14:38:35 +00:00
|
|
|
|
{
|
|
|
|
|
const TString16 modname(_im->get_name_by_order(i));
|
|
|
|
|
if (modname.empty())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
TToken_string& riga = sf.row(i);
|
|
|
|
|
riga=modname;
|
|
|
|
|
|
|
|
|
|
const TFixed_string d(_im->get_description_by_order(i));
|
|
|
|
|
riga.add(d);
|
|
|
|
|
riga.trim();
|
|
|
|
|
riga.add("1"); // prima colonna = monoutenza
|
|
|
|
|
|
|
|
|
|
TString_array prices;
|
|
|
|
|
ini.set_paragraph(modname);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
ini.list_variables(prices, true,modname,true); // get array sorted by var name
|
1998-04-30 14:38:35 +00:00
|
|
|
|
FOR_EACH_ARRAY_ROW(prices, v, key)
|
|
|
|
|
{
|
|
|
|
|
const TFixed_string price(key->get(0));
|
2006-12-13 16:22:33 +00:00
|
|
|
|
if (price.compare("Prezzo", 6, true) == 0)
|
1998-04-30 14:38:35 +00:00
|
|
|
|
{
|
|
|
|
|
TString16 colonna(price.sub(7,price.len()-1));
|
|
|
|
|
if (atoi(colonna) != 1)
|
|
|
|
|
riga.add(colonna);
|
|
|
|
|
TToken_string valori(key->get(1),',');
|
|
|
|
|
riga.add(valori.get(0));
|
|
|
|
|
riga.add(valori.get(1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sf.check_row(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAttivazione_moduli::save_masklistino(TMask &msklistino)
|
|
|
|
|
{
|
|
|
|
|
TWait_cursor hourglass;
|
|
|
|
|
TInstall_ini ini;
|
|
|
|
|
ini.set_paragraph("Main");
|
|
|
|
|
ini.set("Listino",msklistino.get(F_DATALIST));
|
|
|
|
|
TSheet_field& sf = (TSheet_field&)msklistino.field(F_MODULILIST);
|
|
|
|
|
const int items=sf.items();
|
|
|
|
|
for (int i = 0; i < items; i++)
|
|
|
|
|
{
|
|
|
|
|
TToken_string& riga = sf.row(i);
|
|
|
|
|
TString tmpstr(riga.get(0));
|
|
|
|
|
ini.set_paragraph(tmpstr);
|
|
|
|
|
|
|
|
|
|
int nposti;
|
|
|
|
|
for (int col=0; col < 6; col++)
|
|
|
|
|
{
|
|
|
|
|
const char * p=riga.get(3*col+2);
|
|
|
|
|
if (p==NULL || (nposti=atoi(p))==0 )
|
|
|
|
|
break;
|
|
|
|
|
tmpstr = riga.get(3*col+3);
|
|
|
|
|
if (tmpstr.blank())
|
|
|
|
|
continue;
|
|
|
|
|
tmpstr << ',' << riga.get(3*col+4);
|
|
|
|
|
TString16 varname("Prezzo");
|
|
|
|
|
varname << '(' << nposti << ')';
|
|
|
|
|
ini.set(varname,tmpstr);
|
|
|
|
|
if (ini.new_paragraph())
|
|
|
|
|
ini.set("Descrizione",riga.get(1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
|
int TAttivazione_moduli::build_sheet(bool on)
|
|
|
|
|
{
|
|
|
|
|
int nmod = 0;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
TSheet_field& sf = _msk->sfield(F_MODULI);
|
|
|
|
|
for (int i = 0; i < _im->items(); i++)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
|
|
|
|
TToken_string& riga = sf.row(i);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
riga = _im->get_description_by_order(i);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
riga.trim();
|
1996-05-28 09:39:05 +00:00
|
|
|
|
const int module = _im->get_module_by_order(i);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
|
1998-02-17 11:15:36 +00:00
|
|
|
|
const bool ics = module == 0 || (on && ::dongle().active(module));
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (ics)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
|
|
|
|
riga.add("X");
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (module != 0)
|
1998-11-04 18:04:26 +00:00
|
|
|
|
nmod++;
|
|
|
|
|
else
|
|
|
|
|
sf.disable_cell(i, -1); // Disabilita la riga della base
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
riga.add(" ");
|
1996-05-28 09:39:05 +00:00
|
|
|
|
riga.add(module);
|
|
|
|
|
}
|
|
|
|
|
return nmod;
|
|
|
|
|
}
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
void TAttivazione_moduli::garble_dongle(word k[4]) const
|
1997-09-30 09:34:49 +00:00
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
::dongle().garble(k);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
void TAttivazione_moduli::garble_module(word n, TString& str1, TString& str2) const
|
1997-09-30 09:34:49 +00:00
|
|
|
|
{
|
1997-11-20 08:18:05 +00:00
|
|
|
|
const TDate today(_msk->get(F_DT));
|
1997-09-30 09:34:49 +00:00
|
|
|
|
const long val = today.date2julian();
|
|
|
|
|
|
|
|
|
|
word data[4];
|
|
|
|
|
data[0] = word(_msk->get_int(F_SN));
|
2005-12-22 15:46:04 +00:00
|
|
|
|
data[1] = word(val >> 16);
|
|
|
|
|
data[2] = n;
|
1997-09-30 09:34:49 +00:00
|
|
|
|
data[3] = word(val & 0xFFFF);
|
2008-03-19 15:31:53 +00:00
|
|
|
|
garble_dongle(data);
|
|
|
|
|
str1.format("%04X%04X", data[0], data[1]);
|
|
|
|
|
|
|
|
|
|
str2 = ::dongle().module_code2name(n);
|
|
|
|
|
str2.upper();
|
|
|
|
|
str2 = garble_md5(str2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TString& TAttivazione_moduli::garble_md5(const char* strin) const
|
|
|
|
|
{
|
|
|
|
|
const TDate today(_msk->get(F_DT));
|
|
|
|
|
TString80 chiaro, cifrato;
|
|
|
|
|
chiaro.format("%8ld%d%s", today.date2ansi(), _msk->get_int(F_SN), strin);
|
|
|
|
|
xvt_str_md5(chiaro, cifrato.get_buffer(32));
|
|
|
|
|
cifrato.upper();
|
|
|
|
|
return cifrato.right(8);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
const TString& TAttivazione_moduli::garble_md5(long numin) const
|
|
|
|
|
{
|
|
|
|
|
TString16 strin; strin.format("%ld", numin);
|
|
|
|
|
return garble_md5(strin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAttivazione_moduli::garble_users(word u, TString& str1, TString& str2) const
|
1997-11-20 08:18:05 +00:00
|
|
|
|
{
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const TDate today(_msk->get(F_DT));
|
|
|
|
|
const long val = today.date2julian();
|
|
|
|
|
|
1997-11-20 08:18:05 +00:00
|
|
|
|
word data[4];
|
2005-12-22 15:46:04 +00:00
|
|
|
|
data[0] = u;
|
|
|
|
|
data[1] = word(val >> 16);
|
|
|
|
|
data[2] = word(_msk->get_int(F_SN));
|
1997-12-15 15:11:40 +00:00
|
|
|
|
data[3] = word(val & 0xFFFF);
|
2008-03-19 15:31:53 +00:00
|
|
|
|
garble_dongle(data);
|
|
|
|
|
str1.format("%04X%04X", data[0], data[1]);
|
|
|
|
|
|
|
|
|
|
str2 = garble_md5(u);
|
1997-11-20 08:18:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
void TAttivazione_moduli::garble_year(word y, TString& str1, TString& str2) const
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
|
|
|
|
const TDate today(_msk->get(F_DT));
|
|
|
|
|
const long val = today.date2julian();
|
|
|
|
|
|
|
|
|
|
word data[4];
|
2005-12-22 15:46:04 +00:00
|
|
|
|
data[0] = word(_msk->get_int(F_SN));
|
|
|
|
|
data[1] = word(val >> 16);
|
|
|
|
|
data[2] = y;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
data[3] = word(val & 0xFFFF);
|
2008-03-19 15:31:53 +00:00
|
|
|
|
garble_dongle(data);
|
|
|
|
|
str1.format("%04X%04X", data[0], data[1]);
|
|
|
|
|
|
|
|
|
|
str2 = garble_md5(y);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
1997-11-20 08:18:05 +00:00
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
void TAttivazione_moduli::build_key_column()
|
|
|
|
|
{
|
1997-12-15 15:11:40 +00:00
|
|
|
|
TSheet_field& sf = _msk->sfield(F_MODULI);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
sf.enable_column(F_KEY, false);
|
1997-10-09 15:27:15 +00:00
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
TString8 tmp1, tmp2;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
FOR_EACH_SHEET_ROW_BACK(sf, i, riga)
|
1997-10-09 15:27:15 +00:00
|
|
|
|
{
|
|
|
|
|
if (!sf.cell_disabled(i, 1))
|
|
|
|
|
{
|
1997-12-15 15:11:40 +00:00
|
|
|
|
int module = riga->get_int(2);
|
2008-03-19 15:31:53 +00:00
|
|
|
|
garble_module(module, tmp1, tmp2);
|
|
|
|
|
riga->add(tmp1, 3);
|
1997-10-09 15:27:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sf.force_update();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
1998-02-17 11:15:36 +00:00
|
|
|
|
_msk->set(F_USERS, ::dongle().max_users());
|
|
|
|
|
_msk->set(F_ASSIST, ::dongle().year_assist());
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAttivazione_moduli::burn_dongle()
|
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
TDongle& din = ::dongle();
|
|
|
|
|
bool ok = din.type() == _user_dongle;
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (ok)
|
|
|
|
|
{
|
2008-03-19 15:31:53 +00:00
|
|
|
|
TString16 key;
|
1997-09-30 09:34:49 +00:00
|
|
|
|
|
1997-11-20 08:18:05 +00:00
|
|
|
|
TSheet_field& sf = _msk->sfield(F_MODULI);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
FOR_EACH_SHEET_ROW(sf, i, riga)
|
1997-09-30 09:34:49 +00:00
|
|
|
|
{
|
1997-12-15 15:11:40 +00:00
|
|
|
|
key = riga->get(3); key.trim();
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (key.not_empty())
|
|
|
|
|
{
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const int module = riga->get_int(2);
|
2008-03-19 15:31:53 +00:00
|
|
|
|
TString8 str1, str2;
|
|
|
|
|
garble_module(module, str1, str2);
|
|
|
|
|
const bool good = (key == str1) || (key == str2);
|
2003-11-21 09:35:14 +00:00
|
|
|
|
if (good)
|
1997-09-30 09:34:49 +00:00
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
if (!din.active(module) &&
|
2002-10-24 10:47:49 +00:00
|
|
|
|
yesno_box(FR("Confermare l'attivazione del modulo %d:\n%s"),
|
1997-12-15 15:11:40 +00:00
|
|
|
|
module, riga->get(0)))
|
1998-02-17 11:15:36 +00:00
|
|
|
|
din.activate(module);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
if (din.active(module) &&
|
2002-10-24 10:47:49 +00:00
|
|
|
|
yesno_box(FR("Confermare la disattivazione del modulo %d:\n%s"),
|
1997-12-15 15:11:40 +00:00
|
|
|
|
module, riga->get(0)))
|
1998-02-17 11:15:36 +00:00
|
|
|
|
din.deactivate(module);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-02-17 11:15:36 +00:00
|
|
|
|
if (din.dirty())
|
1997-09-30 09:34:49 +00:00
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
ok = din.burn();
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (!ok)
|
2002-10-24 10:47:49 +00:00
|
|
|
|
error_box(TR("Impossibile riprogrammare la chiave"));
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
1997-11-20 08:18:05 +00:00
|
|
|
|
bool TAttivazione_moduli::maxuser_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
bool ok = true;
|
1997-11-20 08:18:05 +00:00
|
|
|
|
if (key == K_TAB && fld.focusdirty())
|
|
|
|
|
{
|
|
|
|
|
const int utenti = atoi(fld.get());
|
1997-12-15 15:11:40 +00:00
|
|
|
|
if (utenti > 0 && utenti < 10000)
|
1997-11-20 08:18:05 +00:00
|
|
|
|
{
|
2008-03-19 15:31:53 +00:00
|
|
|
|
TString8 str1, str2;
|
|
|
|
|
app().garble_users(utenti, str1, str2);
|
|
|
|
|
fld.mask().set(102, str1);
|
1997-11-20 08:18:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2002-10-24 10:47:49 +00:00
|
|
|
|
ok = fld.error_box(TR("Numero di utenti errato"));
|
1997-11-20 08:18:05 +00:00
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAttivazione_moduli::change_users_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
{
|
2002-10-24 10:47:49 +00:00
|
|
|
|
TMask m(TR("Utenti"), 1, 40, 5);
|
|
|
|
|
m.add_number(101, 0, PR("Utenti "), 1, 1, 4, "U");
|
|
|
|
|
m.add_string(102, 0, PR("Codice "), 1, 2, 8, "U");
|
1997-11-20 08:18:05 +00:00
|
|
|
|
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
|
|
|
|
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
|
|
|
|
|
1998-02-17 11:15:36 +00:00
|
|
|
|
TDongle& dongle = ::dongle();
|
|
|
|
|
if (dongle.type() == _user_dongle)
|
1997-12-15 15:11:40 +00:00
|
|
|
|
m.set(101, dongle.max_users());
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m.set_handler(101, maxuser_handler);
|
|
|
|
|
m.disable(102);
|
|
|
|
|
}
|
1997-11-20 08:18:05 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
if (m.run() == K_ENTER)
|
|
|
|
|
{
|
|
|
|
|
const int utenti = m.get_int(101);
|
1998-02-17 11:15:36 +00:00
|
|
|
|
if (dongle.type() == _user_dongle)
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
2008-03-19 15:31:53 +00:00
|
|
|
|
if (utenti > 0 && utenti < 1000)
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
|
|
|
|
if (m.field(102).empty())
|
|
|
|
|
{
|
|
|
|
|
app()._wanted_users = utenti;
|
|
|
|
|
if (utenti > 0)
|
2008-10-22 08:18:26 +00:00
|
|
|
|
fld.message_box(TR("Premere 'Stampa'\nper richiedere l'attivazione di %d utenti."),
|
|
|
|
|
utenti);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-03-19 15:31:53 +00:00
|
|
|
|
TString8 str1, str2;
|
|
|
|
|
app().garble_users(utenti, str1, str2);
|
|
|
|
|
if ((m.get(102) == str1) || (m.get(102) == str2))
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
|
|
|
|
dongle.set_max_users(utenti);
|
|
|
|
|
fld.mask().set(F_USERS, utenti);
|
|
|
|
|
}
|
|
|
|
|
else
|
2002-10-24 10:47:49 +00:00
|
|
|
|
fld.error_box(TR("Codice errato"));
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2002-10-24 10:47:49 +00:00
|
|
|
|
fld.error_box(TR("Numero di utenti errato"));
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
app()._wanted_users = utenti;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
#define YEAR_MIN 2007
|
|
|
|
|
#define YEAR_MAX 2777
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
bool TAttivazione_moduli::assist_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
bool ok = true;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
if (key == K_TAB && fld.focusdirty())
|
|
|
|
|
{
|
|
|
|
|
const int year = atoi(fld.get());
|
2008-03-19 15:31:53 +00:00
|
|
|
|
if (year >= YEAR_MIN && year <= YEAR_MAX)
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
2008-03-19 15:31:53 +00:00
|
|
|
|
TString16 str1, str2;
|
|
|
|
|
app().garble_year(year, str1, str2);
|
|
|
|
|
fld.mask().set(102, str1);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2002-10-24 10:47:49 +00:00
|
|
|
|
ok = fld.error_box(TR("Anno errato"));
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAttivazione_moduli::change_assist_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
{
|
2002-10-24 10:47:49 +00:00
|
|
|
|
TMask m(TR("Assistenza"), 1, 40, 5);
|
|
|
|
|
m.add_number(101, 0, PR("Anno "), 1, 1, 4, "U");
|
|
|
|
|
m.add_string(102, 0, PR("Codice "), 1, 2, 8, "U");
|
1997-12-15 15:11:40 +00:00
|
|
|
|
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
|
|
|
|
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
1997-11-20 08:18:05 +00:00
|
|
|
|
|
1998-02-17 11:15:36 +00:00
|
|
|
|
TDongle& dongle = ::dongle();
|
|
|
|
|
if (dongle.type() == _user_dongle)
|
1997-12-15 15:11:40 +00:00
|
|
|
|
m.set(101, dongle.year_assist());
|
|
|
|
|
else
|
1997-11-20 08:18:05 +00:00
|
|
|
|
{
|
1997-12-15 15:11:40 +00:00
|
|
|
|
m.set_handler(101, assist_handler);
|
1997-11-20 08:18:05 +00:00
|
|
|
|
m.disable(102);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m.run() == K_ENTER)
|
|
|
|
|
{
|
2001-06-25 10:41:20 +00:00
|
|
|
|
word year = m.get_int(101);
|
1998-02-17 11:15:36 +00:00
|
|
|
|
if (dongle.type() == _user_dongle)
|
1997-11-20 08:18:05 +00:00
|
|
|
|
{
|
2008-03-19 15:31:53 +00:00
|
|
|
|
if (year >= YEAR_MIN && year <= YEAR_MAX)
|
2001-06-25 10:41:20 +00:00
|
|
|
|
{
|
1997-12-15 15:11:40 +00:00
|
|
|
|
if (m.field(102).empty())
|
|
|
|
|
{
|
|
|
|
|
app()._wanted_assist = year;
|
2008-10-22 08:18:26 +00:00
|
|
|
|
fld.message_box(FR("Premere 'Stampa'\nper richiedere il contratto di assistenza per l'anno %u."),
|
|
|
|
|
year);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
1997-11-20 08:18:05 +00:00
|
|
|
|
else
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
2008-03-19 15:31:53 +00:00
|
|
|
|
TString16 str1, str2;
|
|
|
|
|
app().garble_year(year, str1, str2);
|
|
|
|
|
bool ok = (m.get(102) == str1) || (m.get(102) == str2);
|
2001-06-25 10:41:20 +00:00
|
|
|
|
if (ok)
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
|
|
|
|
dongle.set_year_assist(year);
|
|
|
|
|
fld.mask().set(F_ASSIST, year);
|
|
|
|
|
}
|
|
|
|
|
else
|
2002-10-24 10:47:49 +00:00
|
|
|
|
fld.error_box(TR("Codice errato"));
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
1997-11-20 08:18:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2002-10-24 10:47:49 +00:00
|
|
|
|
fld.error_box(TR("Anno errato"));
|
1997-11-20 08:18:05 +00:00
|
|
|
|
}
|
1997-12-15 15:11:40 +00:00
|
|
|
|
else
|
|
|
|
|
app()._wanted_assist = year;
|
1997-11-20 08:18:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1997-11-20 08:18:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
bool TAttivazione_moduli::print_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
app().print();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
/*
|
1998-08-25 17:46:29 +00:00
|
|
|
|
bool TAttivazione_moduli::printlist_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
app().print_listino();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1998-08-25 17:46:29 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
*/
|
1998-08-25 17:46:29 +00:00
|
|
|
|
|
1998-01-28 08:53:28 +00:00
|
|
|
|
bool TAttivazione_moduli::aga_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
{
|
2008-09-09 14:04:51 +00:00
|
|
|
|
TMask mask(TR("Produttore"), 1, 70, 6);
|
|
|
|
|
mask.add_string(101, 0, PR("Ditta "), 1, 1, 60);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
mask.add_string(102, 0, PR("Amministratore di sistema "), 1, 2, 16, "U");
|
|
|
|
|
mask.add_string(103, 0, PR("Password di amministratore "), 1, 3, 16, "*");
|
1999-05-24 13:34:11 +00:00
|
|
|
|
|
1998-01-28 08:53:28 +00:00
|
|
|
|
mask.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
|
|
|
|
mask.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
|
|
|
|
|
2009-01-12 16:52:14 +00:00
|
|
|
|
//nuovo modo di gettare il producer da oem.ini
|
|
|
|
|
TConfig oemini(CONFIG_OEM, "MAIN");
|
|
|
|
|
const int oem = oemini.get_int("OEM", NULL, -1, -1);
|
|
|
|
|
if (oem >= 0)
|
|
|
|
|
{
|
|
|
|
|
TString8 para; para << "OEM_" << oem;
|
|
|
|
|
oemini.set_paragraph(para);
|
|
|
|
|
mask.set(101, ::decode(oemini.get("Name")));
|
|
|
|
|
mask.set(102, ::decode(oemini.get("Administrator")));
|
|
|
|
|
mask.set(103, ::decode(oemini.get("Password")));
|
|
|
|
|
}
|
|
|
|
|
else //vecchio modo; gi<67> che c'<27> elimina i vecchi valori dall'install.ini
|
|
|
|
|
{
|
|
|
|
|
TConfig ini("install.ini", "Main");
|
|
|
|
|
mask.set(101, ::decode(ini.get("Producer")));
|
|
|
|
|
mask.set(102, ::decode(ini.get("Administrator")));
|
|
|
|
|
mask.set(103, ::decode(ini.get("Password")));
|
|
|
|
|
ini.remove("Producer");
|
|
|
|
|
ini.remove("Administrator");
|
|
|
|
|
ini.remove("Password");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//setta comunque nel nuovo modo con producer = 0 se eventualmente ignoto
|
1998-01-28 08:53:28 +00:00
|
|
|
|
if (mask.run() == K_ENTER)
|
1999-05-24 13:34:11 +00:00
|
|
|
|
{
|
2009-01-12 16:52:14 +00:00
|
|
|
|
oemini.set("Name", ::encode(mask.get(101)));
|
|
|
|
|
oemini.set("Administrator", ::encode(mask.get(102)));
|
|
|
|
|
oemini.set("Password", ::encode(mask.get(103)));
|
|
|
|
|
if (oem < 0)
|
|
|
|
|
oemini.set("OEM", "0", "MIAN", true);
|
1999-05-24 13:34:11 +00:00
|
|
|
|
}
|
1998-01-28 08:53:28 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1998-01-28 08:53:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
void TAttivazione_moduli::init_mask()
|
1994-11-10 10:59:24 +00:00
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
const TDate oggi(TODAY);
|
|
|
|
|
const int nmod = build_sheet();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
const TDongle& d = ::dongle();
|
|
|
|
|
if (d.hardware() == _dongle_hardlock)
|
2002-10-24 10:47:49 +00:00
|
|
|
|
_msk->set_caption(TR("Attivazione HARDLOCK"));
|
1998-02-17 11:15:36 +00:00
|
|
|
|
else
|
2002-10-24 10:47:49 +00:00
|
|
|
|
_msk->set_caption(TR("Attivazione EUTRON"));
|
1997-11-20 08:18:05 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
_msk->set(F_SN, d.number());
|
1998-02-17 11:15:36 +00:00
|
|
|
|
_msk->set(F_DT, oggi);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
_msk->set(F_USERS, d.max_users());
|
|
|
|
|
_msk->set(F_ASSIST, d.year_assist());
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
bool TAttivazione_moduli::serno_hnd(TMask_field& f, KEY k)
|
|
|
|
|
{
|
|
|
|
|
if (k == K_TAB && f.focusdirty())
|
|
|
|
|
app().build_key_column();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-11-20 08:18:05 +00:00
|
|
|
|
bool TAttivazione_moduli::date_hnd(TMask_field& f, KEY k)
|
|
|
|
|
{
|
|
|
|
|
if (k == K_TAB && f.focusdirty())
|
|
|
|
|
{
|
|
|
|
|
const TDate data(f.get());
|
|
|
|
|
const TDate oggi(TODAY);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
if (data > oggi)
|
2002-10-24 10:47:49 +00:00
|
|
|
|
return f.error_box(FR("La data deve essere antecedente a quella di sistema"));
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
1998-02-17 11:15:36 +00:00
|
|
|
|
const TDate& last_update = ::dongle().last_update();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
if (data < last_update)
|
2002-10-24 10:47:49 +00:00
|
|
|
|
return f.error_box(FR("La data deve essere successiva al %s"), last_update.string());
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
1998-02-17 11:15:36 +00:00
|
|
|
|
const int year_assist = ::dongle().year_assist()+1;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
if (data.year() > year_assist)
|
2002-10-24 10:47:49 +00:00
|
|
|
|
return f.error_box(FR("La data deve essere antecedente al 31-12-%d"), year_assist);
|
1997-11-20 08:18:05 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1997-11-20 08:18:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
|
bool TAttivazione_moduli::k_notify(TSheet_field& f, int r, KEY k)
|
|
|
|
|
{
|
1997-11-20 08:18:05 +00:00
|
|
|
|
if (k == K_INS || k == K_DEL)
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return false;
|
|
|
|
|
return true;
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
|
|
|
|
|
bool TAttivazione_moduli::modifica_listino_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
app().update_listino();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1998-04-30 14:38:35 +00:00
|
|
|
|
}
|
1997-12-15 15:11:40 +00:00
|
|
|
|
bool TAttivazione_moduli::aggiorna_listino_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
bool ok = true;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
{
|
|
|
|
|
TInstall_ini ini;
|
|
|
|
|
TFilename name = ini.get("DiskPath");
|
|
|
|
|
name.add(ini.default_name());
|
1998-02-24 10:30:04 +00:00
|
|
|
|
while (!name.exist())
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
2002-10-24 10:47:49 +00:00
|
|
|
|
TMask msk(TR("Aggiornamento listino"), 1, -1, -1, 60, 4);
|
|
|
|
|
msk.add_string(DLG_USER, 0, PR("Percorso "), 1, 1, 50);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
msk.add_button(DLG_CANCEL, 0, "", -12, -1, 10, 2);
|
|
|
|
|
msk.add_button(DLG_OK, 0, "", -22, -1, 10, 2);
|
|
|
|
|
msk.set(DLG_USER, name);
|
|
|
|
|
if (msk.run() == K_ENTER)
|
|
|
|
|
name = msk.get(DLG_USER);
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
ok = false;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
break;
|
1998-04-30 14:38:35 +00:00
|
|
|
|
}
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
if (ok)
|
1998-08-25 17:46:29 +00:00
|
|
|
|
{
|
|
|
|
|
if (ok = ini.update_prices(name))
|
2002-10-24 10:47:49 +00:00
|
|
|
|
message_box(TR("Listino aggiornato"));
|
1998-08-25 17:46:29 +00:00
|
|
|
|
else
|
2002-10-24 10:47:49 +00:00
|
|
|
|
message_box(TR("Listino gi<67> aggiornato"));
|
1998-08-25 17:46:29 +00:00
|
|
|
|
}
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAttivazione_moduli::print_request()
|
|
|
|
|
{
|
|
|
|
|
TRequest_form form("ba1500a");
|
|
|
|
|
TForm_item& num = form.find_field('B', odd_page, 101);
|
|
|
|
|
TForm_item& descr = form.find_field('B', odd_page, 102);
|
|
|
|
|
TForm_item& codice = form.find_field('B', odd_page, 103);
|
|
|
|
|
TForm_item& price = form.find_field('B', odd_page, 104);
|
|
|
|
|
TForm_item& manut = form.find_field('B', odd_page, 105);
|
|
|
|
|
|
|
|
|
|
TInstall_ini ini;
|
1998-04-30 14:38:35 +00:00
|
|
|
|
ini.write_protect();
|
|
|
|
|
|
1998-02-17 11:15:36 +00:00
|
|
|
|
const bool special = _wanted_assist > ::dongle().year_assist() || _wanted_users != 0;
|
|
|
|
|
const word users = max(_wanted_users, ::dongle().max_users());
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
TWait_cursor hourglass;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
TSheet_field& sheet = _msk->sfield(F_MODULI);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
int found = 0;
|
|
|
|
|
TString str;
|
|
|
|
|
|
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, r, row)
|
|
|
|
|
{
|
|
|
|
|
const int module = row->get_int(2) ;
|
|
|
|
|
const bool active = ::dongle().active(module);
|
|
|
|
|
const bool wanted = *row->get(1) > ' ';
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
if (!special && active)
|
|
|
|
|
continue;
|
|
|
|
|
if (!wanted && !active)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (found == 0)
|
|
|
|
|
{
|
|
|
|
|
printer().open();
|
|
|
|
|
form.find_field('H',odd_page,1).set(dongle().reseller());
|
|
|
|
|
form.update_serno(_msk->get(F_SN));
|
|
|
|
|
form.update_dongle();
|
|
|
|
|
form.update_os();
|
|
|
|
|
}
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
str.format("%3d", ++found);
|
|
|
|
|
num.set(str);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
str = row->get(0);
|
|
|
|
|
descr.set(str);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
str = active ? TR("*ATTIVO*") : "";
|
|
|
|
|
codice.set(str);
|
|
|
|
|
|
|
|
|
|
str = _im->get_name(module);
|
|
|
|
|
real full, assist;
|
|
|
|
|
ini.prices(str, users, full, assist);
|
|
|
|
|
if (active)
|
|
|
|
|
{
|
|
|
|
|
real old_full, old_assist;
|
|
|
|
|
ini.prices(str, ::dongle().max_users(), old_full, old_assist);
|
|
|
|
|
full -= old_full;
|
|
|
|
|
assist -= old_assist;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
assist = 0.0;
|
|
|
|
|
|
|
|
|
|
price.set(full.string());
|
|
|
|
|
manut.set(assist.string());
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
form.print(-1);
|
|
|
|
|
}
|
1998-04-30 14:38:35 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
if (special && found > 0)
|
|
|
|
|
{
|
|
|
|
|
codice.set("");
|
|
|
|
|
price.set("");
|
|
|
|
|
manut.set("");
|
|
|
|
|
if (_wanted_users != 0)
|
|
|
|
|
{
|
|
|
|
|
str.format("%3d", ++found);
|
|
|
|
|
num.set(str);
|
|
|
|
|
|
|
|
|
|
str.format(FR("Variazione del numero utenti da %u a %u"),
|
|
|
|
|
::dongle().max_users(), _wanted_users);
|
|
|
|
|
descr.set(str);
|
|
|
|
|
form.print(-1);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
if (_wanted_assist > ::dongle().year_assist())
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
str.format("%3d", ++found);
|
|
|
|
|
num.set(str);
|
|
|
|
|
str.format(FR("Contratto di assistenza per l'anno %u"), _wanted_assist);
|
|
|
|
|
descr.set(str);
|
|
|
|
|
form.print(-1);
|
|
|
|
|
}
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
|
|
if (found)
|
|
|
|
|
{
|
|
|
|
|
form.print_footer();
|
|
|
|
|
printer().close();
|
|
|
|
|
}
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-04-30 14:22:43 +00:00
|
|
|
|
void TAttivazione_moduli::print_status()
|
|
|
|
|
{
|
|
|
|
|
TRequest_form form("ba1500a");
|
|
|
|
|
TForm_item& descr = form.find_field('B', odd_page, 102);
|
|
|
|
|
TForm_item& codice = form.find_field('B', odd_page, 103);
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
form.find_field('H',odd_page,1).set(dongle().reseller());
|
2001-04-30 14:22:43 +00:00
|
|
|
|
form.update_serno(_msk->get(F_SN));
|
2006-12-13 16:22:33 +00:00
|
|
|
|
form.update_dongle();
|
2001-04-30 14:22:43 +00:00
|
|
|
|
form.update_os();
|
|
|
|
|
|
|
|
|
|
TWait_cursor hourglass;
|
|
|
|
|
printer().open();
|
|
|
|
|
|
|
|
|
|
TSheet_field& sheet = _msk->sfield(F_MODULI);
|
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, r, row)
|
|
|
|
|
{
|
|
|
|
|
const int module = row->get_int(2) ;
|
|
|
|
|
const bool active = ::dongle().active(module);
|
|
|
|
|
|
|
|
|
|
if (!active)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
descr.set(row->get(0));
|
2002-10-24 10:47:49 +00:00
|
|
|
|
codice.set(TR("*ATTIVO*"));
|
2001-04-30 14:22:43 +00:00
|
|
|
|
form.print(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printer().close();
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
void TAttivazione_moduli::print_answer()
|
|
|
|
|
{
|
|
|
|
|
TString str;
|
|
|
|
|
int found = 0;
|
|
|
|
|
|
|
|
|
|
TRequest_form form("ba1500a");
|
|
|
|
|
TForm_item& num = form.find_field('B', odd_page, 101);
|
|
|
|
|
TForm_item& descr = form.find_field('B', odd_page, 102);
|
|
|
|
|
TForm_item& codice = form.find_field('B', odd_page, 103);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
TSheet_field& sheet = _msk->sfield(F_MODULI);
|
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, r, row) if (*row->get(1) > ' ')
|
|
|
|
|
{
|
|
|
|
|
const int module = _im->get_module_by_order(r);
|
|
|
|
|
if (module != BAAUT)
|
|
|
|
|
{
|
|
|
|
|
if (found == 0)
|
|
|
|
|
{
|
|
|
|
|
printer().open();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
form.update_serno(_msk->get(F_SN));
|
2006-12-13 16:22:33 +00:00
|
|
|
|
form.update_dongle();
|
2001-06-25 10:41:20 +00:00
|
|
|
|
form.update_os();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
str.format("%3d", ++found);
|
|
|
|
|
num.set(str);
|
|
|
|
|
|
|
|
|
|
str = row->get(0);
|
|
|
|
|
descr.set(str);
|
|
|
|
|
|
|
|
|
|
str = row->get(3);
|
|
|
|
|
codice.set(str);
|
|
|
|
|
|
|
|
|
|
form.print(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_wanted_users != 0 || _wanted_assist != 0)
|
|
|
|
|
{
|
|
|
|
|
if (found == 0)
|
|
|
|
|
{
|
|
|
|
|
printer().open();
|
|
|
|
|
form.update_serno(_msk->get(F_SN));
|
2006-12-13 16:22:33 +00:00
|
|
|
|
form.update_dongle();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
if (_wanted_users != 0)
|
|
|
|
|
{
|
|
|
|
|
str.format("%3d", ++found);
|
|
|
|
|
num.set(str);
|
2002-10-24 10:47:49 +00:00
|
|
|
|
str.format(FR("Variazione del numero utenti da %u a %u"),
|
1998-02-17 11:15:36 +00:00
|
|
|
|
::dongle().max_users(), _wanted_users);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
descr.set(str);
|
2008-03-19 15:31:53 +00:00
|
|
|
|
TString8 str1, str2;
|
|
|
|
|
garble_users(_wanted_users, str1, str2);
|
|
|
|
|
codice.set(str1);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
form.print(-1);
|
|
|
|
|
}
|
|
|
|
|
if (_wanted_assist != 0)
|
|
|
|
|
{
|
|
|
|
|
str.format("%3d", ++found);
|
|
|
|
|
num.set(str);
|
2002-10-24 10:47:49 +00:00
|
|
|
|
str.format(FR("Contratto di assistenza per l'anno %u"), _wanted_assist);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
descr.set(str);
|
2008-03-19 15:31:53 +00:00
|
|
|
|
TString8 str1, str2;
|
|
|
|
|
garble_year(_wanted_assist, str1, str2);
|
|
|
|
|
codice.set(str1);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
form.print(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (found)
|
|
|
|
|
{
|
|
|
|
|
form.print_footer();
|
|
|
|
|
printer().close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
/*
|
1998-08-25 17:46:29 +00:00
|
|
|
|
void TAttivazione_moduli::print_listino()
|
|
|
|
|
{
|
|
|
|
|
TRequest_form form("ba1500a");
|
|
|
|
|
TForm_item& num = form.find_field('B', odd_page, 101);
|
|
|
|
|
TForm_item& descr = form.find_field('B', odd_page, 102);
|
|
|
|
|
TForm_item& codice = form.find_field('B', odd_page, 103);
|
|
|
|
|
TForm_item& price = form.find_field('B', odd_page, 104);
|
|
|
|
|
TForm_item& manut = form.find_field('B', odd_page, 105);
|
|
|
|
|
|
|
|
|
|
TInstall_ini ini;
|
|
|
|
|
ini.write_protect();
|
|
|
|
|
|
|
|
|
|
const bool special = _wanted_assist > ::dongle().year_assist() || _wanted_users != 0;
|
|
|
|
|
const word users = max(_wanted_users, ::dongle().max_users());
|
|
|
|
|
|
|
|
|
|
TWait_cursor hourglass;
|
|
|
|
|
TSheet_field& sheet = _msk->sfield(F_MODULI);
|
|
|
|
|
{
|
|
|
|
|
int found = 0;
|
|
|
|
|
TString str;
|
|
|
|
|
real full, assist;
|
|
|
|
|
|
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, r, row)
|
|
|
|
|
{
|
|
|
|
|
const int module = row->get_int(2) ;
|
|
|
|
|
const bool active = ::dongle().active(module);
|
|
|
|
|
|
|
|
|
|
str = _im->get_name(module);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
ini.prices(str, users, full, assist, false);
|
1998-08-25 17:46:29 +00:00
|
|
|
|
if (!full.is_zero() || ! assist.is_zero())
|
|
|
|
|
{
|
|
|
|
|
if (found++ == 0)
|
|
|
|
|
{
|
|
|
|
|
printer().open();
|
2002-10-24 10:47:49 +00:00
|
|
|
|
form.find_field('H',odd_page,1).set(TR("LISTINO"));
|
1998-08-25 17:46:29 +00:00
|
|
|
|
|
|
|
|
|
num.set("");
|
2002-10-24 10:47:49 +00:00
|
|
|
|
str.format(TR("Numero utenti: %u"), users );
|
1998-08-25 17:46:29 +00:00
|
|
|
|
descr.set(str);
|
|
|
|
|
form.print(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
price.set(full.string());
|
|
|
|
|
manut.set(assist.string());
|
|
|
|
|
|
|
|
|
|
str.format("%3d", found);
|
|
|
|
|
num.set(str);
|
|
|
|
|
|
|
|
|
|
str = row->get(0);
|
|
|
|
|
descr.set(str);
|
|
|
|
|
|
|
|
|
|
str = "";
|
|
|
|
|
codice.set(str);
|
|
|
|
|
|
|
|
|
|
form.print(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (found)
|
|
|
|
|
{
|
|
|
|
|
form.print_footer();
|
|
|
|
|
printer().close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
*/
|
1998-08-25 17:46:29 +00:00
|
|
|
|
|
2001-04-30 14:22:43 +00:00
|
|
|
|
bool TAttivazione_moduli::new_module_requested()
|
|
|
|
|
{
|
|
|
|
|
TSheet_field& sheet = _msk->sfield(F_MODULI);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
bool found = false;
|
2001-04-30 14:22:43 +00:00
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, r, row)
|
|
|
|
|
{
|
|
|
|
|
if (*row->get(1) > ' ') // Wanted!
|
|
|
|
|
{
|
|
|
|
|
const int module = row->get_int(2);
|
|
|
|
|
if (!::dongle().active(module)) // Not active yet?
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
found = true;
|
2001-04-30 14:22:43 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return found;
|
|
|
|
|
}
|
1998-08-25 17:46:29 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
void TAttivazione_moduli::print()
|
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
if (::dongle().type() == _user_dongle)
|
2001-04-30 14:22:43 +00:00
|
|
|
|
{
|
|
|
|
|
if (new_module_requested())
|
|
|
|
|
print_request();
|
|
|
|
|
else
|
|
|
|
|
print_status();
|
|
|
|
|
}
|
1997-12-15 15:11:40 +00:00
|
|
|
|
else
|
|
|
|
|
print_answer();
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-25 10:41:20 +00:00
|
|
|
|
// Questo programma non deve bloccarsi per l'anno di assistenza!
|
|
|
|
|
bool TAttivazione_moduli::test_assistance_year() const
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
2001-06-25 10:41:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
1994-11-10 10:59:24 +00:00
|
|
|
|
bool TAttivazione_moduli::create()
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
bool ok = ::dongle().login(true);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (!ok)
|
2006-04-13 17:56:02 +00:00
|
|
|
|
return false;
|
2001-06-25 10:41:20 +00:00
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
if (::dongle().hardware() == _dongle_network)
|
|
|
|
|
return error_box(TR("Questo programma non puo' funzionare mentre e' in funzione il server di autorizzazioni"));
|
|
|
|
|
|
2001-06-25 10:41:20 +00:00
|
|
|
|
ok = TApplication::test_assistance_year();
|
2006-04-13 17:56:02 +00:00
|
|
|
|
#ifdef DBG
|
2007-09-17 15:33:04 +00:00
|
|
|
|
// Backdoor nascosta per la cifratura del dninst.zip
|
|
|
|
|
// Mettere nella cartella dei programi il file dninst.txt ...
|
|
|
|
|
// ... e nascera' in automagico il file dninst.zip per Luca
|
2006-04-13 17:56:02 +00:00
|
|
|
|
if (ok && argc() > 2 && strcmp(argv(2), "-dninst") == 0)
|
|
|
|
|
ok = false;
|
|
|
|
|
#endif
|
2001-06-25 10:41:20 +00:00
|
|
|
|
if (!ok)
|
|
|
|
|
{
|
|
|
|
|
ok = update_assistance_year();
|
2008-10-22 08:18:26 +00:00
|
|
|
|
if (ok && TApplication::test_assistance_year())
|
|
|
|
|
return false; // Aggiornamento automatico riuscito!
|
2001-06-25 10:41:20 +00:00
|
|
|
|
}
|
1997-09-30 09:34:49 +00:00
|
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
|
_im = new TInformazione_moduli;
|
|
|
|
|
|
1994-12-07 11:07:54 +00:00
|
|
|
|
disable_menu_item(M_FILE_NEW);
|
|
|
|
|
disable_menu_item(M_FILE_PG_SETUP);
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
|
|
|
|
_msk = new TMask("ba1500a") ;
|
1997-11-20 08:18:05 +00:00
|
|
|
|
|
|
|
|
|
_msk->set_handler(F_CHANGEUSERS, change_users_handler);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
_msk->set_handler(F_CHANGEASSIST, change_assist_handler);
|
|
|
|
|
_msk->set_handler(F_PRINT, print_handler);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
/*
|
1998-08-25 17:46:29 +00:00
|
|
|
|
_msk->set_handler(F_PRINTLIST, printlist_handler);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
_msk->set_handler(F_AGGLISTINO, aggiorna_listino_handler);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
*/
|
1998-11-04 18:04:26 +00:00
|
|
|
|
const TDongleType mydongle = ::dongle().type();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
if (mydongle == _aga_dongle)
|
1998-01-28 08:53:28 +00:00
|
|
|
|
{
|
|
|
|
|
_msk->show(F_AGA);
|
|
|
|
|
_msk->set_handler(F_AGA, aga_handler);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
/*
|
1998-04-30 14:38:35 +00:00
|
|
|
|
_msk->show(F_MODLISTINO);
|
|
|
|
|
_msk->set_handler(F_MODLISTINO, modifica_listino_handler);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
*/
|
1998-01-28 08:53:28 +00:00
|
|
|
|
}
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
1997-11-20 08:18:05 +00:00
|
|
|
|
TSheet_field& sf = _msk->sfield(F_MODULI);
|
|
|
|
|
sf.set_notify(k_notify);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
switch (mydongle)
|
1994-11-10 10:59:24 +00:00
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
case _user_dongle:
|
1998-11-04 18:04:26 +00:00
|
|
|
|
_msk->enable(F_DT);
|
|
|
|
|
_msk->set_handler(F_DT, date_hnd);
|
|
|
|
|
case _developer_dongle:
|
1998-04-30 14:38:35 +00:00
|
|
|
|
init_mask();
|
1998-11-04 18:04:26 +00:00
|
|
|
|
_serno=_msk->get_int(F_SN);
|
|
|
|
|
sf.enable_column(F_ENABLE, serno() != 0);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
sf.enable_column(F_KEY, serno() != 0);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
break;
|
1998-02-17 11:15:36 +00:00
|
|
|
|
case _aga_dongle:
|
1997-10-09 15:27:15 +00:00
|
|
|
|
_msk->set_handler(F_SN, serno_hnd);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
_msk->enable(F_SN);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
init_mask();
|
1998-11-04 18:04:26 +00:00
|
|
|
|
_serno=_msk->get_int(F_SN);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
build_sheet(false);
|
|
|
|
|
sf.enable_column(1);
|
1997-10-09 15:27:15 +00:00
|
|
|
|
build_key_column();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
break;
|
1997-09-30 09:34:49 +00:00
|
|
|
|
default:
|
2006-12-13 16:22:33 +00:00
|
|
|
|
break;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enable_menu_item(M_FILE_PG_SETUP);
|
|
|
|
|
enable_menu_item(M_FILE_PRINT);
|
2001-05-07 13:28:51 +00:00
|
|
|
|
return TSkeleton_application::create();
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAttivazione_moduli::destroy()
|
|
|
|
|
{
|
1995-03-22 09:07:04 +00:00
|
|
|
|
if (_msk != NULL) delete _msk;
|
1996-05-28 09:39:05 +00:00
|
|
|
|
if (_im != NULL) delete _im;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-07 13:28:51 +00:00
|
|
|
|
void TAttivazione_moduli::main_loop()
|
1994-11-10 10:59:24 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
if (_msk->run() == K_ENTER)
|
1997-09-30 09:34:49 +00:00
|
|
|
|
burn_dongle();
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ba1500(int argc, char** argv)
|
|
|
|
|
{
|
1996-05-16 10:44:00 +00:00
|
|
|
|
// dipende dalla check_parameters fatta in main()
|
1999-05-24 13:34:11 +00:00
|
|
|
|
if (user() == ::dongle().administrator())
|
1996-05-16 10:44:00 +00:00
|
|
|
|
{
|
|
|
|
|
TAttivazione_moduli a ;
|
2008-03-19 15:31:53 +00:00
|
|
|
|
a.run(argc, argv, TR("Attivazione moduli"));
|
1996-05-16 10:44:00 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2002-10-24 10:47:49 +00:00
|
|
|
|
error_box(FR("L'utente %s non e' abilitato all'esecuzione di questo programma"), (const char*)user());
|
1994-11-10 10:59:24 +00:00
|
|
|
|
return 0;
|
2008-03-19 15:31:53 +00:00
|
|
|
|
}
|