This commit was generated by cvs2svn to compensate for changes in r7146,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://10.65.10.50/trunk@7147 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a4b664ff1b
commit
d7bf7a33cb
15
mr/mr0.cpp
Executable file
15
mr/mr0.cpp
Executable file
@ -0,0 +1,15 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include "mr0.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int a = argc > 1 ? (argv[1][1] - '0') : 0;
|
||||
switch (a)
|
||||
{
|
||||
default:
|
||||
mr0100(argc, argv);
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
1
mr/mr0.url
Executable file
1
mr/mr0.url
Executable file
@ -0,0 +1 @@
|
||||
#include <default.url>
|
141
mr/mr0100.cpp
Executable file
141
mr/mr0100.cpp
Executable file
@ -0,0 +1,141 @@
|
||||
#include <automask.h>
|
||||
#include <tabapp.h>
|
||||
|
||||
#include "mr0.h"
|
||||
#include "mrplib.h"
|
||||
|
||||
#include "mrtblnp.h"
|
||||
|
||||
TTable_application& app() { return (TTable_application&)main_app(); }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TMRP_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TMRP_mask : public TAutomask
|
||||
{
|
||||
TMRP_calendar* _calendar;
|
||||
|
||||
protected:
|
||||
virtual TMask_field* parse_field(TScanner& scanner);
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TMRP_mask(const char* name, int num = 0);
|
||||
virtual ~TMRP_mask();
|
||||
};
|
||||
|
||||
TMask_field* TMRP_mask::parse_field(TScanner& scanner)
|
||||
{
|
||||
const TString& k = scanner.key();
|
||||
if (k == "CA")
|
||||
return new TCalendar_field(this);
|
||||
return TAutomask::parse_field(scanner);
|
||||
}
|
||||
|
||||
bool TMRP_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const TString16 tn = app().get_tabname();
|
||||
if (tn == "IMP" || tn == "LNP")
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_CODICE:
|
||||
case F_IMPIANTO:
|
||||
case F_TYPE:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TString16 lin, imp;
|
||||
if (tn == "LNP")
|
||||
{
|
||||
switch (get(F_TYPE)[0])
|
||||
{
|
||||
case 'L': lin = get(F_CODICE); imp = get(F_IMPIANTO); break;
|
||||
case 'I': imp = get(F_IMPIANTO); break;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (get(F_TYPE) == "I")
|
||||
imp = get(F_CODICE);
|
||||
}
|
||||
if (_calendar == NULL)
|
||||
_calendar = new TMRP_calendar(lin, imp);
|
||||
else
|
||||
_calendar->set(lin, imp);
|
||||
|
||||
TCalendar_field& cf = (TCalendar_field&)field(F_CALENDAR);
|
||||
cf.set_calendar(_calendar, get_int(F_YEAR));
|
||||
cf.win().force_update();
|
||||
}
|
||||
break;
|
||||
case F_YEAR:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
{
|
||||
TCalendar_field& cf = (TCalendar_field&)field(F_CALENDAR);
|
||||
cf.set_calendar(_calendar, get_int(F_YEAR));
|
||||
if (is_running())
|
||||
cf.win().force_update();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TMRP_mask::TMRP_mask(const char* name, int num)
|
||||
: _calendar(NULL)
|
||||
{
|
||||
read_mask(name, num, 0);
|
||||
set_handlers();
|
||||
}
|
||||
|
||||
TMRP_mask::~TMRP_mask()
|
||||
{
|
||||
if (_calendar)
|
||||
delete _calendar;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TMRPtables
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TMRPtables : public TTable_application
|
||||
{
|
||||
protected:
|
||||
virtual TString& get_mask_name(TString& name) const;
|
||||
virtual TMask* set_mask(TMask* m);
|
||||
};
|
||||
|
||||
TString& TMRPtables::get_mask_name(TString& name) const
|
||||
{
|
||||
name = get_tabname();
|
||||
name.insert("mrtb", 0);
|
||||
return name;
|
||||
}
|
||||
|
||||
TMask* TMRPtables::set_mask(TMask* m)
|
||||
{
|
||||
if (m == NULL)
|
||||
{
|
||||
TString name; get_mask_name(name);
|
||||
m = new TMRP_mask(name);
|
||||
}
|
||||
return TTable_application::set_mask(m);
|
||||
}
|
||||
|
||||
int mr0100(int argc, char* argv[])
|
||||
{
|
||||
if (argc > 2)
|
||||
{
|
||||
TString name;
|
||||
name << "Tabella " << argv[2];
|
||||
TMRPtables a;
|
||||
a.run(argc, argv, name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
478
mr/mrplib.cpp
Executable file
478
mr/mrplib.cpp
Executable file
@ -0,0 +1,478 @@
|
||||
#include <config.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include "mrplib.h"
|
||||
|
||||
TString16 TMRP_calendar::_days;
|
||||
TToken_string TMRP_calendar::_holidays;
|
||||
|
||||
void TMRP_calendar::init_default()
|
||||
{
|
||||
TConfig cfg(CONFIG_DITTA, "mr");
|
||||
// Inizializza i turni dei 5 giorni feriali a 1
|
||||
// Inizializza i turni di sabato e domenica a 0
|
||||
// Inizializza i turni dei giorni festivi a 0
|
||||
_days = cfg.get("Turni", NULL, -1, "1111100011111000");
|
||||
// Inizializza la lista delle feste comandate tranne la Pasqua
|
||||
_holidays = cfg.get("Feste", NULL, -1,
|
||||
"01-01|06-01|25-04|01-05|15-08|01-11|08-12|25-12|26-12");
|
||||
}
|
||||
|
||||
bool TMRP_calendar::is_holiday(int g, int m) const
|
||||
{
|
||||
if (_days.empty())
|
||||
((TMRP_calendar*)this)->init_default();
|
||||
TString16 str; str.format("%02d-%02d", g, m);
|
||||
return _holidays.find(str) >= 0;
|
||||
}
|
||||
|
||||
bool TMRP_calendar::is_holiday(const TDate& date) const
|
||||
{
|
||||
return is_holiday(date.day(), date.month());
|
||||
}
|
||||
|
||||
bool TMRP_calendar::is_red(const TDate& date) const
|
||||
{
|
||||
if (date.wday() == 7)
|
||||
return TRUE;
|
||||
return is_holiday(date);
|
||||
}
|
||||
|
||||
void TMRP_calendar::add_holiday(int g, int m)
|
||||
{
|
||||
if (!is_holiday(g, m))
|
||||
{
|
||||
TString16 str; str.format("%02d-%02d", g, m);
|
||||
_holidays.add(str);
|
||||
}
|
||||
}
|
||||
|
||||
void TMRP_calendar::suppress_holiday(int g, int m)
|
||||
{
|
||||
if (is_holiday(g, m))
|
||||
{
|
||||
TString16 str; str.format("%02d-%02d", g, m);
|
||||
const int pos = _holidays.find(str);
|
||||
const TString tail = _holidays.mid(pos+6, -1);
|
||||
_holidays.cut(pos);
|
||||
_holidays << tail;
|
||||
}
|
||||
}
|
||||
|
||||
void TMRP_calendar::read_cal(const TString& key, char tipo)
|
||||
{
|
||||
TTable cal(tipo == 'L' ? "CAL" : "CAI");
|
||||
cal.put("CODTAB", key);
|
||||
TString80 s1;
|
||||
if (cal.read() == NOERR)
|
||||
s1 = cal.get("S1");
|
||||
s1.left_just(62);
|
||||
if (tipo == 'L')
|
||||
_exc_lin.add(key, s1);
|
||||
else
|
||||
_exc_imp.add(key, s1);
|
||||
}
|
||||
|
||||
int TMRP_calendar::turni(const TDate& data, int& mini, int& maxi)
|
||||
{
|
||||
const int year = data.year();
|
||||
const int month = data.month();
|
||||
const int day = data.day();
|
||||
TString16 str;
|
||||
|
||||
mini = maxi = -1;
|
||||
if (_codlin.not_empty())
|
||||
{
|
||||
str.format("%5s%4d%02d", _codlin, year, month);
|
||||
if (_exc_lin.objptr(str) == NULL)
|
||||
read_cal(str, 'L');
|
||||
|
||||
const TString& turn = (const TString&)_exc_lin[str];
|
||||
mini = turn[day] - '0';
|
||||
maxi = turn[day+31] - '0';
|
||||
}
|
||||
if (mini >= 0 && maxi >= 0)
|
||||
return 3;
|
||||
|
||||
if (_codimp.not_empty())
|
||||
{
|
||||
str.format("%5s%4d%02d", _codimp, year, month);
|
||||
if (_exc_imp.objptr(str) == NULL)
|
||||
read_cal(str, 'I');
|
||||
|
||||
const TString& turn = (const TString&)_exc_imp[str];
|
||||
mini = turn[day] - '0';
|
||||
maxi = turn[day+31] - '0';
|
||||
}
|
||||
if (mini >= 0 && maxi >= 0)
|
||||
return 2;
|
||||
|
||||
if (_days.empty())
|
||||
init_default();
|
||||
|
||||
// Controlla se e' festa
|
||||
for (str = _holidays.get(0); str.not_empty(); str = _holidays.get())
|
||||
{
|
||||
int g,m,a;
|
||||
str << '-' << year;
|
||||
if (sscanf(str, "%d-%d-%d", &g, &m, &a) == 3)
|
||||
{
|
||||
const TDate festa(g, m, a);
|
||||
if (data == festa)
|
||||
{
|
||||
if (mini < 0) mini = _days[7] - '0';
|
||||
if (maxi < 0) maxi = _days[7] - '0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mini >= 0 && maxi >= 0)
|
||||
return 1;
|
||||
|
||||
// Usa giorni default
|
||||
const int giorno = data.wday() - 1;
|
||||
if (mini < 0) mini = _days[giorno] - '0';
|
||||
if (maxi < 0) maxi = _days[giorno+8] - '0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TMRP_calendar::set_turni(const TDate& data, int mini, int maxi)
|
||||
{
|
||||
const int year = data.year();
|
||||
const int month = data.month();
|
||||
const int day = data.day();
|
||||
TString16 str;
|
||||
|
||||
if (_codlin.not_empty())
|
||||
{
|
||||
str.format("%5s%4d%02d", _codlin, year, month);
|
||||
if (_exc_lin.objptr(str) == NULL)
|
||||
read_cal(str, 'L');
|
||||
TString& turn = (TString&)_exc_lin[str];
|
||||
|
||||
if (mini >= 0 && mini <= 9)
|
||||
turn[day] = '0' + mini;
|
||||
else
|
||||
turn[day] = ' ';
|
||||
if (maxi >= 0 && maxi <= 9)
|
||||
turn[day+31] = '0' + maxi;
|
||||
else
|
||||
turn[day+31] = ' ';
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (_codimp.not_empty())
|
||||
{
|
||||
str.format("%5s%4d%02d", _codimp, year, month);
|
||||
if (_exc_imp.objptr(str) == NULL)
|
||||
read_cal(str, 'I');
|
||||
TString& turn = (TString&)_exc_imp[str];
|
||||
if (mini >= 0 && mini <= 9)
|
||||
turn[day] = '0' + mini;
|
||||
else
|
||||
turn[day] = ' ';
|
||||
if (maxi >= 0 && maxi <= 9)
|
||||
turn[day+31] = '0' + maxi;
|
||||
else
|
||||
turn[day+31] = ' ';
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Controlla se e' festa
|
||||
for (str = _holidays.get(0); str.not_empty(); str = _holidays.get())
|
||||
{
|
||||
int g,m,a;
|
||||
str << '-' << year;
|
||||
if (sscanf(str, "%d-%d-%d", &g, &m, &a) == 3)
|
||||
{
|
||||
const TDate festa(g, m, a);
|
||||
if (data == festa)
|
||||
{
|
||||
if (mini >= 0 && mini <= 9)
|
||||
_days[7] = '0' + mini;
|
||||
else
|
||||
_days[7] = ' ';
|
||||
if (maxi >= 0 && maxi <= 9)
|
||||
_days[15] = '0' + maxi;
|
||||
else
|
||||
_days[15] = ' ';
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int giorno = data.wday() - 1;
|
||||
if (mini >= 0 && mini <= 9)
|
||||
_days[giorno] = '0' + mini;
|
||||
else
|
||||
_days[giorno] = '0';
|
||||
if (maxi >= 0 && maxi <= 9)
|
||||
_days[giorno+8] = '0' + maxi;
|
||||
else
|
||||
_days[giorno+8] = '0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TMRP_calendar::write()
|
||||
{
|
||||
int err = NOERR;
|
||||
|
||||
if (_codlin.not_empty())
|
||||
{
|
||||
TTable cal("CAL");
|
||||
FOR_EACH_ASSOC_STRING(_exc_lin, hash, key, str)
|
||||
{
|
||||
cal.put("CODTAB", key);
|
||||
cal.put("S1", str);
|
||||
err = cal.rewrite();
|
||||
if (err != NOERR)
|
||||
err = cal.write();
|
||||
if (err != NOERR)
|
||||
{
|
||||
error_box("Errore %d nell'aggiornamento del calendario.", err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
if (_codimp.not_empty())
|
||||
{
|
||||
TTable cal("CAI");
|
||||
FOR_EACH_ASSOC_STRING(_exc_imp, hash, key, str)
|
||||
{
|
||||
cal.put("CODTAB", key);
|
||||
cal.put("S1", (const TString&)_exc_imp[key]);
|
||||
err = cal.rewrite();
|
||||
if (err != NOERR)
|
||||
err = cal.write();
|
||||
if (err != NOERR)
|
||||
{
|
||||
error_box("Errore %d nell'aggiornamento del calendario.", err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
TConfig cfg(CONFIG_DITTA, "mr");
|
||||
cfg.set("Turni", _days);
|
||||
cfg.set("Feste", _holidays);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void TMRP_calendar::set(const char* linea, const char* impianto)
|
||||
{
|
||||
_exc_lin.destroy();
|
||||
_exc_imp.destroy();
|
||||
|
||||
_codlin = linea;
|
||||
_codimp = impianto;
|
||||
|
||||
if (_codlin.not_empty())
|
||||
{
|
||||
TTable lnp("LNP");
|
||||
lnp.put("CODTAB", _codlin);
|
||||
if (lnp.read() == NOERR)
|
||||
{
|
||||
if (_codimp.empty())
|
||||
_codimp = lnp.get("S6");
|
||||
}
|
||||
else
|
||||
_codlin = "";
|
||||
}
|
||||
if (_codimp.not_empty())
|
||||
{
|
||||
TTable imp("IMP");
|
||||
imp.put("CODTAB", _codimp);
|
||||
if (imp.read() != NOERR)
|
||||
_codimp = "";
|
||||
}
|
||||
}
|
||||
|
||||
TMRP_calendar::TMRP_calendar(const char* linea, const char* impianto)
|
||||
{
|
||||
set(linea, impianto);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TCalendar_win
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TCalendar_win : public TField_window
|
||||
{
|
||||
int _anno;
|
||||
TMRP_calendar* _calendario;
|
||||
|
||||
protected:
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
virtual void update();
|
||||
|
||||
public:
|
||||
void set_calendar(TMRP_calendar* cal, int year = 0);
|
||||
|
||||
TCalendar_win(int x, int y, int dx, int dy,
|
||||
WINDOW parent, TWindowed_field* owner);
|
||||
virtual ~TCalendar_win() { }
|
||||
};
|
||||
|
||||
void TCalendar_win::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_MOUSE_DOWN:
|
||||
if (_calendario)
|
||||
{
|
||||
const PNT& where = ep->v.mouse.where;
|
||||
RCT rct; xvt_vobj_get_client_rect(win, &rct);
|
||||
const int month = where.v * 13 / rct.bottom;
|
||||
if (month >= 1 && month <= 12)
|
||||
{
|
||||
const int day = where.h * 33 / rct.right - 1;
|
||||
const int last = TDate::last_day(month, _anno);
|
||||
if (day >= 1 && day <= last)
|
||||
{
|
||||
TMask m("Turni del giorno", 1, 40, 7);
|
||||
m.add_date(101, 0, "Data ", 1, 1, "D");
|
||||
m.add_string(102, 0, "", 19, 1, 9, "D");
|
||||
m.add_boolean(103, 0, "Festa", 31, 1);
|
||||
m.add_list(104, 0, "Turni minimi ", 1, 3, 8, "", " |0|1|2|3|4|5|6", "Standard|Nessuno|1 turno|2 turni|3 turni|4 turni|5 turni|6 turni");
|
||||
m.add_list(105, 0, "Turni massimi ", 1, 4, 8, "", " |0|1|2|3|4|5|6", "Standard|Nessuno|1 turno|2 turni|3 turni|4 turni|5 turni|6 turni");
|
||||
|
||||
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
||||
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
||||
const TDate d(day, month, _anno);
|
||||
const bool festa = _calendario->is_holiday(d);
|
||||
m.set(101, d.string());
|
||||
m.set(102, itow(d.wday()));
|
||||
m.set(103, festa ? "X" : "");
|
||||
int mini, maxi; _calendario->turni(d, mini, maxi);
|
||||
m.set(104, mini);
|
||||
m.set(105, maxi);
|
||||
if (m.run() == K_ENTER && m.dirty())
|
||||
{
|
||||
const char mi = m.get(104)[0];
|
||||
mini = (mi == ' ') ? -1 : mi-'0';
|
||||
const char ma = m.get(105)[0];
|
||||
maxi = (ma == ' ') ? -1 : ma-'0';
|
||||
_calendario->set_turni(d, mini, maxi);
|
||||
|
||||
const bool fe = m.get_bool(103);
|
||||
if (fe != festa)
|
||||
{
|
||||
if (fe)
|
||||
_calendario->add_holiday(d.day(), d.month());
|
||||
else
|
||||
_calendario->suppress_holiday(d.day(), d.month());
|
||||
}
|
||||
|
||||
force_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
TField_window::handler(win, ep);
|
||||
}
|
||||
|
||||
void TCalendar_win::update()
|
||||
{
|
||||
TField_window::update();
|
||||
|
||||
_pixmap = TRUE;
|
||||
|
||||
TString16 str;
|
||||
str << _anno;
|
||||
set_color(COLOR_BLACK, COLOR_WHITE);
|
||||
printat(1, 1, str);
|
||||
|
||||
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
|
||||
|
||||
int i, j;
|
||||
for (i = 1; i <= 31; i++)
|
||||
{
|
||||
const int x = rct.right * (i+1) / 33;
|
||||
line(x, 0, x, rct.bottom);
|
||||
str.format("%2d", i);
|
||||
printat(x+2, 0, str);
|
||||
}
|
||||
for (j = 1; j <= 12; j++)
|
||||
{
|
||||
const int y = rct.bottom * j / 13;
|
||||
line(0, y, rct.right, y);
|
||||
str = itom(j); str.cut(3);
|
||||
printat(1, y, str);
|
||||
}
|
||||
|
||||
TMRP_calendar* defcal = NULL;
|
||||
TMRP_calendar* cal = _calendario;
|
||||
if (cal == NULL)
|
||||
{
|
||||
defcal = new TMRP_calendar();
|
||||
cal = defcal;
|
||||
}
|
||||
|
||||
for (j = 1; j <= 12; j++)
|
||||
{
|
||||
const int y = rct.bottom * j / 13;
|
||||
const last = TDate::last_day(j, _anno);
|
||||
for (i = 1; i <= last; i++)
|
||||
{
|
||||
const int x = rct.right * (i+1) / 33;
|
||||
const TDate data(i, j, _anno);
|
||||
set_color(cal->is_red(data) ? COLOR_RED : COLOR_BLACK, COLOR_WHITE);
|
||||
int tmin, tmax;
|
||||
cal->turni(data, tmin, tmax);
|
||||
str.format("%d", tmin);
|
||||
printat(x+2, y, str);
|
||||
str.format("%2d", tmax);
|
||||
printat(x+2, y+CHARY-3, str);
|
||||
}
|
||||
}
|
||||
|
||||
if (defcal != NULL)
|
||||
delete defcal;
|
||||
|
||||
_pixmap = FALSE;
|
||||
}
|
||||
|
||||
void TCalendar_win::set_calendar(TMRP_calendar* cal, int year)
|
||||
{
|
||||
_calendario = cal;
|
||||
if (year > 0)
|
||||
_anno = year;
|
||||
else
|
||||
_anno = TDate(TODAY).year();
|
||||
}
|
||||
|
||||
TCalendar_win::TCalendar_win(int x, int y, int dx, int dy,
|
||||
WINDOW parent, TWindowed_field* owner)
|
||||
: TField_window(x, y, dx, dy, parent, owner)
|
||||
{
|
||||
xvt_sbar_set_range(win(), HSCROLL, 0, 0);
|
||||
xvt_sbar_set_range(win(), VSCROLL, 0, 0);
|
||||
set_calendar(NULL);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TCalendar_field
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TField_window* TCalendar_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
|
||||
{
|
||||
return new TCalendar_win(x, y, dx, dy, parent, this);
|
||||
}
|
||||
|
||||
|
||||
void TCalendar_field::set_calendar(TMRP_calendar* cal, int year)
|
||||
{
|
||||
TCalendar_win& cw = (TCalendar_win&)win();
|
||||
cw.set_calendar(cal, year);
|
||||
}
|
58
mr/mrplib.h
Executable file
58
mr/mrplib.h
Executable file
@ -0,0 +1,58 @@
|
||||
#ifndef __MRPLIB_H
|
||||
#define __MRPLIB_H
|
||||
|
||||
#ifndef __MASK_H
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
class TMRP_calendar : public TObject
|
||||
{
|
||||
static TString16 _days;
|
||||
static TToken_string _holidays;
|
||||
TAssoc_array _exc_imp, _exc_lin;
|
||||
TString16 _codimp, _codlin;
|
||||
|
||||
protected:
|
||||
void init_default();
|
||||
void read_cal(const TString& key, char tipo);
|
||||
|
||||
public:
|
||||
int turni(const TDate& date, int& mini, int& maxi);
|
||||
|
||||
int turni_min(const TDate& date)
|
||||
{ int mini, maxi; turni(date, mini, maxi); return mini; }
|
||||
|
||||
int turni_max(const TDate& date)
|
||||
{ int mini, maxi; turni(date, mini, maxi); return maxi; }
|
||||
|
||||
int set_turni(const TDate& date, int mini, int maxi);
|
||||
|
||||
int write();
|
||||
int rewrite() { return write(); }
|
||||
|
||||
void add_holiday(int g, int m);
|
||||
void suppress_holiday(int g, int m);
|
||||
bool is_holiday(int g, int m) const;
|
||||
bool is_holiday(const TDate& date) const;
|
||||
bool is_red(const TDate& date) const;
|
||||
|
||||
void set(const char* linea, const char* impianto);
|
||||
|
||||
TMRP_calendar(const char* linea = NULL, const char* impianto = NULL);
|
||||
virtual ~TMRP_calendar() { }
|
||||
};
|
||||
|
||||
class TCalendar_field : public TWindowed_field
|
||||
{
|
||||
protected: // TWindowed_field
|
||||
virtual TField_window* create_window(int x, int y, int dx, int dy,
|
||||
WINDOW parent);
|
||||
public:
|
||||
void set_calendar(TMRP_calendar* cal, int year = 0);
|
||||
|
||||
TCalendar_field(TMask* m) : TWindowed_field(m) { }
|
||||
virtual ~TCalendar_field() { }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
7
mr/mrtbimp.h
Executable file
7
mr/mrtbimp.h
Executable file
@ -0,0 +1,7 @@
|
||||
#ifndef __MRTBIMP_H
|
||||
#define __MRTBIMP_H
|
||||
|
||||
#define F_CODICE 101
|
||||
#define F_DESC 102
|
||||
|
||||
#endif
|
44
mr/mrtbimp.uml
Executable file
44
mr/mrtbimp.uml
Executable file
@ -0,0 +1,44 @@
|
||||
#include "mrtbimp.h"
|
||||
|
||||
TOOLBAR "" 0 19 80 3
|
||||
#include <toolbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Tabella IMP" -1 -1 65 15
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
END
|
||||
|
||||
STRING F_CODICE 5
|
||||
BEGIN
|
||||
PROMPT 2 2 "Codice "
|
||||
FIELD CODTAB
|
||||
KEY 1
|
||||
USE IMP
|
||||
INPUT CODTAB F_CODICE
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
DISPLAY "Descrizione@60" S0
|
||||
OUTPUT F_CODICE CODTAB
|
||||
OUTPUT F_DESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "UZ"
|
||||
END
|
||||
|
||||
STRING F_DESC 50
|
||||
BEGIN
|
||||
PROMPT 2 4 "Descrizione "
|
||||
FIELD S0
|
||||
KEY 2
|
||||
USE IMP KEY 2
|
||||
INPUT S0 F_DESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
OUTPUT F_DESC S0
|
||||
OUTPUT F_CODICE CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
17
mr/mrtblnp.h
Executable file
17
mr/mrtblnp.h
Executable file
@ -0,0 +1,17 @@
|
||||
#ifndef __BATBLNP_H
|
||||
#define __BATBLNP_H
|
||||
|
||||
#define F_CODICE 101
|
||||
#define F_DESC 102
|
||||
|
||||
#define F_IMPIANTO 103
|
||||
#define F_DESCIMPIANTO 104
|
||||
|
||||
#define F_PERSONE 105
|
||||
#define F_TURNI 106
|
||||
|
||||
#define F_YEAR 201
|
||||
#define F_TYPE 202
|
||||
#define F_CALENDAR 203
|
||||
|
||||
#endif
|
114
mr/mrtblnp.uml
Executable file
114
mr/mrtblnp.uml
Executable file
@ -0,0 +1,114 @@
|
||||
#include "mrtblnp.h"
|
||||
|
||||
TOOLBAR "" 0 19 80 3
|
||||
#include <toolbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Linee di produzione" -1 -1 65 15
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
END
|
||||
|
||||
STRING F_CODICE 5
|
||||
BEGIN
|
||||
PROMPT 2 2 "Linea "
|
||||
FLAGS "UZ"
|
||||
FIELD CODTAB
|
||||
KEY 1
|
||||
USE LNP
|
||||
INPUT CODTAB F_CODICE
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@60" S0
|
||||
OUTPUT F_CODICE CODTAB
|
||||
OUTPUT F_DESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_DESC 50
|
||||
BEGIN
|
||||
PROMPT 25 2 ""
|
||||
FIELD S0
|
||||
KEY 2
|
||||
USE LNP KEY 2
|
||||
INPUT S0 F_DESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
OUTPUT F_DESC S0
|
||||
OUTPUT F_CODICE CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_IMPIANTO 5
|
||||
BEGIN
|
||||
PROMPT 2 4 "Impianto "
|
||||
FLAGS "UZ"
|
||||
USE IMP
|
||||
INPUT CODTAB F_IMPIANTO
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_IMPIANTO CODTAB
|
||||
OUTPUT F_DESCIMPIANTO S0
|
||||
CHECKTYPE NORMAL
|
||||
FIELD S6
|
||||
END
|
||||
|
||||
STRING F_DESCIMPIANTO 50
|
||||
BEGIN
|
||||
PROMPT 25 4 ""
|
||||
USE IMP KEY 2
|
||||
INPUT S0 F_DESCIMPIANTO
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
COPY OUTPUT F_IMPIANTO
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 4
|
||||
BEGIN
|
||||
PROMPT 1 6 ""
|
||||
END
|
||||
|
||||
NUMBER F_PERSONE 3
|
||||
BEGIN
|
||||
PROMPT 2 7 "Persone "
|
||||
FLAGS "U"
|
||||
FIELD I0
|
||||
END
|
||||
|
||||
NUMBER F_TURNI 1
|
||||
BEGIN
|
||||
PROMPT 2 8 "Turni standard "
|
||||
FLAGS "U"
|
||||
FIELD I1
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Calendario" -1 -1 65 15
|
||||
|
||||
NUMBER F_YEAR 4
|
||||
BEGIN
|
||||
PROMPT 1 1 "Anno "
|
||||
FLAGS "A"
|
||||
END
|
||||
|
||||
LIST F_TYPE 1 10
|
||||
BEGIN
|
||||
PROMPT 21 1 "Tipo "
|
||||
ITEM "L|Linea"
|
||||
ITEM "I|Impianto"
|
||||
ITEM "S|Standard"
|
||||
END
|
||||
|
||||
CALENDAR F_CALENDAR -3 -1
|
||||
BEGIN
|
||||
PROMPT 0 2 ""
|
||||
END
|
||||
|
||||
|
||||
ENDPAGE
|
||||
|
||||
|
||||
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user