2005-04-22 15:37:43 +00:00
|
|
|
|
#include <colors.h>
|
2008-12-01 16:51:03 +00:00
|
|
|
|
#include <diction.h>
|
2005-05-02 20:41:34 +00:00
|
|
|
|
#include <image.h>
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
|
|
|
|
#include "cilib.h"
|
2010-07-29 14:15:32 +00:00
|
|
|
|
#include "RILORE.h"
|
2005-04-21 16:37:52 +00:00
|
|
|
|
#include "cimsk.h"
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
2005-04-21 12:47:17 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
2008-12-01 16:51:03 +00:00
|
|
|
|
// TAlmanac_window
|
2005-04-18 15:31:21 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2008-12-01 16:51:03 +00:00
|
|
|
|
// @doc EXTERNAL
|
2005-04-21 12:47:17 +00:00
|
|
|
|
|
2008-12-01 16:51:03 +00:00
|
|
|
|
// @class TAlmanac_window | Finestra associata ad un TAlmanac_field
|
|
|
|
|
//
|
|
|
|
|
// @base public | TField_window
|
|
|
|
|
class TAlmanac_window : public TField_window
|
2005-05-02 20:41:34 +00:00
|
|
|
|
{
|
2008-12-01 16:51:03 +00:00
|
|
|
|
// @author:(INTERNAL) Brugno
|
|
|
|
|
|
|
|
|
|
// @access Protected Member
|
|
|
|
|
protected:
|
|
|
|
|
// override da TField_window
|
|
|
|
|
virtual void update();
|
|
|
|
|
// override da TField_window
|
2009-10-27 11:30:15 +00:00
|
|
|
|
virtual long handler(WINDOW win, EVENT* ep);
|
2008-12-01 16:51:03 +00:00
|
|
|
|
|
|
|
|
|
// @access Public Member
|
|
|
|
|
public:
|
|
|
|
|
// override da TField_window
|
|
|
|
|
virtual bool on_key(KEY k);
|
|
|
|
|
|
|
|
|
|
// @access Public Member
|
|
|
|
|
public:
|
|
|
|
|
// @cmember Costruttore
|
|
|
|
|
TAlmanac_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field *owner);
|
|
|
|
|
// @cmember Distruttore
|
|
|
|
|
virtual ~TAlmanac_window() {}
|
|
|
|
|
};
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
|
|
|
|
void TAlmanac_window::update()
|
|
|
|
|
{
|
|
|
|
|
COLOR col_f, col_b;
|
|
|
|
|
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
|
2005-04-22 11:18:23 +00:00
|
|
|
|
RCT rcttd;
|
2005-04-18 15:31:21 +00:00
|
|
|
|
TString str;
|
2008-12-01 16:51:03 +00:00
|
|
|
|
TAlmanac_field& o = (TAlmanac_field&)owner();
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
|
|
|
|
TField_window::update();
|
2005-05-02 20:41:34 +00:00
|
|
|
|
TDate cdate = o.selected_date();
|
2005-04-18 15:31:21 +00:00
|
|
|
|
cdate.set_day(1);
|
2005-05-02 20:41:34 +00:00
|
|
|
|
|
2008-12-01 16:51:03 +00:00
|
|
|
|
int cpage = o.mask().curr_page();
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
2008-12-01 16:51:03 +00:00
|
|
|
|
int rct_l, rct_t;
|
|
|
|
|
int rct_w = (rct.right - rct.left) / 9;
|
|
|
|
|
int rct_h = (rct.bottom - rct.top) / 9;
|
|
|
|
|
int pad = o.padding();
|
|
|
|
|
int row = 3;
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
2005-04-26 18:43:47 +00:00
|
|
|
|
set_font("", XVT_FS_BOLD);
|
2005-04-22 15:37:43 +00:00
|
|
|
|
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
|
2008-12-01 16:51:03 +00:00
|
|
|
|
int fh = CHARY;
|
2005-04-22 11:18:23 +00:00
|
|
|
|
|
2005-04-21 21:54:07 +00:00
|
|
|
|
if (o.show_month_name())
|
2005-04-21 15:13:51 +00:00
|
|
|
|
{
|
2005-04-22 11:18:23 +00:00
|
|
|
|
str.format("%s %d", itom(cdate.month()),cdate.year());
|
2005-04-21 15:13:51 +00:00
|
|
|
|
rct_l = rct.left + rct_w;
|
|
|
|
|
rct_t = rct.top + rct_h;
|
2005-04-22 11:18:23 +00:00
|
|
|
|
xvt_dwin_draw_text(win(), rct_l + pad + 2, fh + rct_t + pad + 2, str, -1);
|
2005-04-21 15:13:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-04-22 11:18:23 +00:00
|
|
|
|
for (int i=1;i<=7;i++)
|
2005-04-21 15:13:51 +00:00
|
|
|
|
{
|
2005-04-22 15:37:43 +00:00
|
|
|
|
str.format("%.3s", itow(i));
|
2005-04-21 15:13:51 +00:00
|
|
|
|
rct_l = rct.left + rct_w*i;
|
|
|
|
|
rct_t = rct.top + rct_h*2;
|
2005-04-22 11:18:23 +00:00
|
|
|
|
xvt_dwin_draw_text(win(), rct_l + pad + 2, fh + rct_t + pad + 2, str, -1);
|
2005-04-21 15:13:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-04-22 20:46:53 +00:00
|
|
|
|
--cdate;
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
2005-04-22 15:37:43 +00:00
|
|
|
|
do
|
2005-04-18 15:31:21 +00:00
|
|
|
|
{
|
2005-09-23 08:46:35 +00:00
|
|
|
|
if ((++cdate).wday()==1 && cdate.day() > 1) row++;
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
2005-04-26 18:43:47 +00:00
|
|
|
|
col_b = NORMAL_BACK_COLOR;
|
2005-04-22 15:37:43 +00:00
|
|
|
|
col_f=NORMAL_COLOR;
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
2005-04-26 18:43:47 +00:00
|
|
|
|
if (o.is_date_void(cpage, cdate))
|
|
|
|
|
{
|
|
|
|
|
if (!o.can_insert(cdate))
|
|
|
|
|
col_b = DISABLED_BACK_COLOR;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
col_b = FOCUS_BACK_COLOR;
|
|
|
|
|
|
2005-04-22 11:18:23 +00:00
|
|
|
|
set_pen(col_f);
|
|
|
|
|
set_brush(col_b);
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
|
|
|
|
rct_l = rct.left + rct_w*cdate.wday();
|
|
|
|
|
rct_t = rct.top + rct_h*row;
|
|
|
|
|
|
|
|
|
|
str.format("%2d", cdate.day());
|
|
|
|
|
|
2005-04-22 11:18:23 +00:00
|
|
|
|
rcttd.top = rct_t + pad;
|
|
|
|
|
rcttd.left = rct_l + pad;
|
|
|
|
|
rcttd.bottom = rct_t + rct_h - pad;
|
|
|
|
|
rcttd.right = rct_l + rct_w - pad;
|
|
|
|
|
|
|
|
|
|
xvt_dwin_draw_rect(win(), &rcttd);
|
2005-04-26 18:43:47 +00:00
|
|
|
|
if (cdate.is_holiday())
|
|
|
|
|
{
|
|
|
|
|
set_brush(o.can_insert(cdate) ? DISABLED_BACK_COLOR : NORMAL_COLOR, PAT_FDIAG);
|
|
|
|
|
xvt_dwin_draw_rect(win(), &rcttd);
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-22 15:37:43 +00:00
|
|
|
|
if (o.is_selected(cdate.day()))
|
|
|
|
|
{
|
|
|
|
|
set_pen(FOCUS_COLOR,1);
|
|
|
|
|
rcttd.top++; rcttd.left++; rcttd.bottom--; rcttd.right--;
|
|
|
|
|
xvt_dwin_draw_rect(win(), &rcttd);
|
|
|
|
|
}
|
2005-04-18 15:31:21 +00:00
|
|
|
|
|
2005-04-26 18:43:47 +00:00
|
|
|
|
xvt_dwin_draw_text(win(), rct_l + pad + 2, fh + rct_t + pad, str, -1);
|
2005-04-22 15:37:43 +00:00
|
|
|
|
}
|
|
|
|
|
while (!cdate.is_end_month());
|
2005-04-18 15:31:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAlmanac_window::on_key(KEY key)
|
|
|
|
|
{
|
2008-12-01 16:51:03 +00:00
|
|
|
|
TAlmanac_field& o = (TAlmanac_field&)owner();
|
|
|
|
|
TAlmanac_mask& m = (TAlmanac_mask&)o.mask();
|
2005-04-22 11:18:23 +00:00
|
|
|
|
|
2008-12-01 16:51:03 +00:00
|
|
|
|
const int smonth = o.selected_month();
|
|
|
|
|
const int syear = o.selected_year();
|
2005-04-21 21:54:07 +00:00
|
|
|
|
|
|
|
|
|
switch (key)
|
|
|
|
|
{
|
2008-12-01 16:51:03 +00:00
|
|
|
|
case K_RIGHT: o.move_selected_day(1); break;
|
|
|
|
|
case K_LEFT: o.move_selected_day(-1); break;
|
|
|
|
|
case K_UP: o.move_selected_day(-7); break;
|
|
|
|
|
case K_DOWN: o.move_selected_day(+7); break;
|
|
|
|
|
case K_SPACE:
|
|
|
|
|
case K_ENTER: m.open_day_mask(); break;
|
|
|
|
|
case K_PREV:
|
|
|
|
|
case K_NEXT:
|
|
|
|
|
case K_CTRL+K_F1:
|
|
|
|
|
case K_CTRL+K_F2:
|
|
|
|
|
case K_CTRL+K_F3:
|
|
|
|
|
case K_CTRL+K_F4:
|
|
|
|
|
case K_CTRL+K_F5:
|
|
|
|
|
case K_CTRL+K_F6:
|
|
|
|
|
case K_CTRL+K_F7:
|
|
|
|
|
case K_CTRL+K_F8:
|
|
|
|
|
case K_CTRL+K_F9:
|
|
|
|
|
case K_CTRL+K_F10:
|
|
|
|
|
case K_CTRL+K_F11:
|
|
|
|
|
case K_CTRL+K_F12:
|
|
|
|
|
m.on_key(key);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return TField_window::on_key(key);
|
2005-04-18 15:31:21 +00:00
|
|
|
|
}
|
2005-04-22 11:18:23 +00:00
|
|
|
|
|
2008-12-01 16:51:03 +00:00
|
|
|
|
if(syear != o.selected_year())
|
2005-04-22 15:37:43 +00:00
|
|
|
|
{
|
2008-12-01 16:51:03 +00:00
|
|
|
|
m.set_year(o.selected_year());
|
2005-04-22 15:37:43 +00:00
|
|
|
|
}
|
2005-04-22 11:18:23 +00:00
|
|
|
|
return true;
|
2005-04-18 15:31:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-10-27 11:30:15 +00:00
|
|
|
|
long TAlmanac_window::handler(WINDOW win, EVENT* ep)
|
2005-04-18 15:31:21 +00:00
|
|
|
|
{
|
|
|
|
|
switch(ep->type)
|
|
|
|
|
{
|
2008-12-01 16:51:03 +00:00
|
|
|
|
case E_MOUSE_DOWN:
|
|
|
|
|
case E_MOUSE_DBL:
|
2005-04-18 15:31:21 +00:00
|
|
|
|
{
|
2008-12-01 16:51:03 +00:00
|
|
|
|
TAlmanac_field & o = (TAlmanac_field&)owner();
|
|
|
|
|
TDate cdate = o.selected_date();
|
|
|
|
|
TDate fdate = cdate; fdate.set_day(1);
|
|
|
|
|
|
|
|
|
|
RCT rct; xvt_vobj_get_client_rect(win, &rct);
|
|
|
|
|
int rct_w = ((rct.right - rct.left) / 9);
|
|
|
|
|
int rct_h = ((rct.bottom - rct.top) / 9);
|
|
|
|
|
int pnt_c = (ep->v.mouse.where.h) / rct_w;
|
|
|
|
|
int pnt_r = (ep->v.mouse.where.v) / rct_h;
|
|
|
|
|
int delta = 7*pnt_r + pnt_c - (7*(3+cdate.week()-fdate.week()) + cdate.wday());
|
2005-04-22 11:18:23 +00:00
|
|
|
|
o.move_selected_day(delta);
|
2005-04-26 18:43:47 +00:00
|
|
|
|
if (ep->type==E_MOUSE_DBL)
|
2008-12-01 16:51:03 +00:00
|
|
|
|
((TAlmanac_mask&)o.mask()).open_day_mask();
|
2005-04-18 15:31:21 +00:00
|
|
|
|
}
|
2008-12-01 16:51:03 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2005-04-18 15:31:21 +00:00
|
|
|
|
}
|
2009-10-27 11:30:15 +00:00
|
|
|
|
return TField_window::handler(win, ep);
|
2005-04-18 15:31:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TAlmanac_window::TAlmanac_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field *owner)
|
2008-12-01 16:51:03 +00:00
|
|
|
|
: TField_window(x, y, dx, dy, parent, owner)
|
2005-04-18 15:31:21 +00:00
|
|
|
|
{
|
2008-12-01 16:51:03 +00:00
|
|
|
|
set_scroll_max(0, 0); // Get rid of that useless scrollbars
|
2005-04-18 15:31:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-02 20:41:34 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TImage_window
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2008-12-01 16:51:03 +00:00
|
|
|
|
// @doc EXTERNAL
|
|
|
|
|
|
|
|
|
|
// @class TAlmanac_window | Finestra associata ad un TAlmanac_field
|
|
|
|
|
//
|
|
|
|
|
// @base public | TField_window
|
|
|
|
|
class TImage_window : public TField_window
|
|
|
|
|
{
|
|
|
|
|
// @author:(INTERNAL) Brugno
|
|
|
|
|
int _curr_month;
|
|
|
|
|
|
|
|
|
|
// @access Protected Member
|
|
|
|
|
protected:
|
|
|
|
|
// override da TField_window
|
|
|
|
|
virtual void update();
|
|
|
|
|
|
|
|
|
|
// @access Public Member
|
|
|
|
|
public:
|
|
|
|
|
// @cmember Costruttore
|
|
|
|
|
TImage_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field *owner);
|
|
|
|
|
// @cmember Distruttore
|
|
|
|
|
virtual ~TImage_window() {}
|
|
|
|
|
};
|
|
|
|
|
|
2005-05-02 20:41:34 +00:00
|
|
|
|
void TImage_window::update()
|
|
|
|
|
{
|
|
|
|
|
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
|
|
|
|
|
TAlmanac_field & f = (TAlmanac_field&) owner();
|
|
|
|
|
const int month = f.selected_date().month();
|
|
|
|
|
|
|
|
|
|
_curr_month = month;
|
|
|
|
|
clear(MASK_BACK_COLOR);
|
|
|
|
|
|
2005-05-17 13:08:09 +00:00
|
|
|
|
TFilename month_img; month_img.format("%2smn%02d.jpg", (const char *) f.mask().source_file().left(2), _curr_month);
|
2005-05-02 20:41:34 +00:00
|
|
|
|
|
|
|
|
|
if (month_img.custom_path())
|
|
|
|
|
{
|
|
|
|
|
TImage bmp(month_img);
|
|
|
|
|
const double ratiox = (double) (rct.right) / (double) bmp.width();
|
|
|
|
|
const double ratioy = (double) (rct.bottom) / (double) bmp.height();
|
|
|
|
|
|
|
|
|
|
if (ratiox < ratioy)
|
|
|
|
|
{
|
|
|
|
|
int h = int(bmp.height() * ratiox);
|
|
|
|
|
|
|
|
|
|
rct.top = (rct.bottom - h) / 2;
|
|
|
|
|
rct.bottom = rct.top + h;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int w = int(bmp.width() * ratioy);
|
|
|
|
|
rct.left = (rct.right - w) / 2;
|
|
|
|
|
rct.right = rct.left + w;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bmp.draw(win(), rct);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TImage_window::TImage_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field *owner)
|
2008-12-01 16:51:03 +00:00
|
|
|
|
: TField_window(x, y, dx, dy, parent, owner), _curr_month(0)
|
|
|
|
|
{
|
|
|
|
|
set_scroll_max(0, 0); // Get rid of that useless scrollbars
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TAlmanac_field
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
TField_window* TAlmanac_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
|
|
|
|
|
{
|
|
|
|
|
TAlmanac_window* obj = new TAlmanac_window(x, y, dx, dy, parent, this);
|
|
|
|
|
RCT rct; xvt_vobj_get_outer_rect(obj->win(), &rct);
|
|
|
|
|
const int pad = 6;
|
|
|
|
|
|
|
|
|
|
if (rct.left > pad * 4)
|
|
|
|
|
{
|
|
|
|
|
_image = new TImage_window(-1, y, -1, dy, parent, this);
|
|
|
|
|
RCT img_rect; xvt_vobj_get_outer_rect(_image->win(), &img_rect);
|
|
|
|
|
img_rect.right = rct.left - pad;
|
|
|
|
|
img_rect.left = pad;
|
|
|
|
|
xvt_vobj_move(_image->win(), &img_rect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAlmanac_field::create(short id, const RCT& rect, WINDOW parent)
|
|
|
|
|
{
|
|
|
|
|
int x = rect.left/CHARX, y = rect.top/ROWY;
|
|
|
|
|
int h = (rect.bottom - rect.top)/ROWY, w = (rect.right - rect.left)/CHARX;
|
|
|
|
|
if (x+w > 80)
|
|
|
|
|
x = x + w - mask().columns() - 1;
|
|
|
|
|
TWindowed_field::create(id, x, y, w, h, parent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAlmanac_field::is_date_void(int currpage, const TDate& cdate)
|
|
|
|
|
{
|
|
|
|
|
return ((TAlmanac_mask &)mask()).is_date_void(currpage, cdate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAlmanac_field::force_update(bool update_image)
|
|
|
|
|
{
|
|
|
|
|
win().force_update();
|
|
|
|
|
if (update_image && _image != NULL)
|
|
|
|
|
_image->force_update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAlmanac_field::adjust_selected_day()
|
|
|
|
|
{
|
|
|
|
|
const int last = TDate::last_day(_selecteddate.month(), _selecteddate.year());
|
|
|
|
|
if (_selecteddate.day() > last)
|
|
|
|
|
_selecteddate.set_day(last);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAlmanac_field::set_selected_day(int nday)
|
|
|
|
|
{
|
|
|
|
|
if (nday>=1 && nday<=31 && nday != _selecteddate.day())
|
|
|
|
|
{
|
|
|
|
|
_selecteddate.set_day(nday);
|
|
|
|
|
adjust_selected_day();
|
|
|
|
|
force_update(false); // Dont'update the picture
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAlmanac_field::move_selected_day(int ddays)
|
|
|
|
|
{
|
|
|
|
|
const int old_month = _selecteddate.month();
|
|
|
|
|
_selecteddate += ddays;
|
|
|
|
|
force_update(old_month != _selecteddate.month()); // Dont'update the picture if needed
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAlmanac_field::set_selected_month(int nmonth)
|
|
|
|
|
{
|
|
|
|
|
if (nmonth >= 1 && nmonth <= 12 && nmonth != _selecteddate.month())
|
|
|
|
|
{
|
|
|
|
|
_selecteddate.set_month(nmonth);
|
|
|
|
|
adjust_selected_day();
|
|
|
|
|
force_update(true); // Update the picture too
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAlmanac_field::move_selected_month(int dmonths)
|
|
|
|
|
{
|
|
|
|
|
_selecteddate.addmonth(dmonths);
|
|
|
|
|
force_update(true); // Update the picture too
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAlmanac_field::set_selected_year(int nyear)
|
|
|
|
|
{
|
|
|
|
|
_selecteddate.set_year(nyear);
|
|
|
|
|
adjust_selected_day();
|
|
|
|
|
force_update(false); // Don't update the picture
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TAlmanac_mask
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
TMask_field* TAlmanac_mask::parse_field(TScanner& scanner)
|
|
|
|
|
{
|
|
|
|
|
const TString& k = scanner.key();
|
|
|
|
|
if (k.starts_with("AL", true))
|
|
|
|
|
{
|
|
|
|
|
TAlmanac_field* na = new TAlmanac_field(this);
|
|
|
|
|
_almanacs.add(na);
|
|
|
|
|
return na;
|
|
|
|
|
}
|
|
|
|
|
return TAutomask::parse_field(scanner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAlmanac_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
|
{
|
|
|
|
|
switch (o.dlg())
|
|
|
|
|
{
|
|
|
|
|
case F_PREVMONTH:
|
|
|
|
|
case F_NEXTMONTH:
|
|
|
|
|
if (e == fe_button)
|
|
|
|
|
{
|
|
|
|
|
TAlmanac_field& al = almanac();
|
|
|
|
|
const int old_year = al.selected_year();
|
|
|
|
|
al.move_selected_month(o.dlg() == F_PREVMONTH ? -1 : +1);
|
|
|
|
|
const int new_year = al.selected_year();
|
|
|
|
|
if (old_year != new_year) // Se cambio anno
|
|
|
|
|
set_year(new_year);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_PREVYEAR:
|
|
|
|
|
case F_NEXTYEAR:
|
|
|
|
|
if (e == fe_button)
|
|
|
|
|
{
|
|
|
|
|
TAlmanac_field& al = almanac();
|
|
|
|
|
const int year = al.selected_year();
|
|
|
|
|
set_year(year + (o.dlg() == F_PREVYEAR ? -1 : +1));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2005-05-02 20:41:34 +00:00
|
|
|
|
|
2008-12-01 16:51:03 +00:00
|
|
|
|
void TAlmanac_mask::set_focus()
|
2005-05-02 20:41:34 +00:00
|
|
|
|
{
|
2008-12-01 16:51:03 +00:00
|
|
|
|
TAutomask::set_focus();
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
for (i = _almanacs.last(); i >= 0; i = _almanacs.pred(i))
|
|
|
|
|
{
|
|
|
|
|
if (almanac(i).parent() == curr_win())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bool nav = i >= 0;
|
|
|
|
|
enable(F_PREVYEAR, nav);
|
|
|
|
|
enable(F_PREVMONTH, nav);
|
|
|
|
|
enable(F_NEXTMONTH, nav);
|
|
|
|
|
enable(F_NEXTYEAR, nav);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TAlmanac_mask::activate_almanac(const short id, const char* title)
|
|
|
|
|
{
|
|
|
|
|
int i = -1; // Calendario non trovato
|
|
|
|
|
|
|
|
|
|
const int pos = id2pos(id);
|
|
|
|
|
if (pos >= 0) // Calendario esistente
|
|
|
|
|
{
|
|
|
|
|
for (i = _almanacs.last(); i >= 0; i = _almanacs.pred(i))
|
|
|
|
|
if (almanac(i).dlg() == id)
|
|
|
|
|
break;
|
|
|
|
|
if (i < 0) // Calendario non ancora censito ...
|
|
|
|
|
i = _almanacs.add(fld(pos)); // ... non dovrebbe mai succedere
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (i < 0) // Devo creare al volo un calendario
|
|
|
|
|
{
|
|
|
|
|
WINDOW parent = create_page(TR("Calendario"), -1);
|
|
|
|
|
const TAlmanac_field& ca = almanac(0);
|
|
|
|
|
RCT rect; ca.get_rect(rect);
|
|
|
|
|
TAlmanac_field* na = new TAlmanac_field(this);
|
|
|
|
|
na->create(id, rect, parent);
|
|
|
|
|
add_field(na);
|
|
|
|
|
i = _almanacs.add(na);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TAlmanac_field& na = almanac(i);
|
|
|
|
|
if (title && *title)
|
|
|
|
|
{
|
|
|
|
|
const int page = find_parent_page(na);
|
|
|
|
|
xvt_notebk_set_tab_title(notebook(), page, title);
|
|
|
|
|
}
|
|
|
|
|
const TDate sdate(TODAY); // Inizilizzo con la data odierna
|
|
|
|
|
na.set_selected_date(sdate);
|
|
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TAlmanac_field & TAlmanac_mask::almanac(byte page) const
|
|
|
|
|
{
|
|
|
|
|
if (page >= _almanacs.items()) // Calcolo dell'indice del calendario corrente
|
|
|
|
|
{
|
|
|
|
|
for (page = _almanacs.last(); page > 0; page = _almanacs.pred(page))
|
|
|
|
|
{
|
|
|
|
|
if (almanac(page).parent() == curr_win())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return (TAlmanac_field&)_almanacs[page];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TAlmanac_mask::set_year(int newyear)
|
|
|
|
|
{
|
|
|
|
|
for (int i = _almanacs.last(); i >= 0; i = _almanacs.pred(i))
|
|
|
|
|
almanac(i).set_selected_year(newyear);
|
|
|
|
|
change_year(newyear);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TDate& TAlmanac_mask::selected_day() const
|
|
|
|
|
{ return almanac().selected_date(); }
|
|
|
|
|
|
|
|
|
|
void TAlmanac_mask::change_year(int newyear)
|
|
|
|
|
{
|
|
|
|
|
// Funzione virtuale da ridefinire!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAlmanac_mask::is_date_void(int currpage, const TDate& cdate)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TAlmanac_mask::TAlmanac_mask(const char* name)
|
|
|
|
|
{
|
|
|
|
|
read_mask(name, 0, -1); // Deve funzionare la virtual parse_field
|
|
|
|
|
set_handlers();
|
|
|
|
|
}
|
2010-06-17 16:04:30 +00:00
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
////////////////////////////
|
|
|
|
|
//// TRISOATT_KEY ////
|
|
|
|
|
////////////////////////////
|
2010-06-17 16:04:30 +00:00
|
|
|
|
|
|
|
|
|
//TIPO: metodo che restituisce il tipo (<R>isorsa o <A>ttrezzatura)
|
2010-06-30 14:36:03 +00:00
|
|
|
|
const char TRisoatt_key::tipo() const
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
2010-06-30 14:36:03 +00:00
|
|
|
|
return left(1)[0];
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//COD: metodo che restituisce il codice della risorsa op dell'attrezzatura
|
2010-06-30 14:36:03 +00:00
|
|
|
|
const TString& TRisoatt_key::cod() const
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
2010-06-30 14:36:03 +00:00
|
|
|
|
return mid(1, 16);
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ANNO: metodo che restituisce l'anno a cui fa riferimento la risorsa o l'attrezzatura
|
2010-06-30 14:36:03 +00:00
|
|
|
|
const int TRisoatt_key::anno() const
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
2010-06-30 14:36:03 +00:00
|
|
|
|
return atoi(mid(17, 4));
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//MESE: metodo che restituisce il mese a cui fa riferimento la risorsa o l'attrezzatura
|
2010-06-30 14:36:03 +00:00
|
|
|
|
const TString& TRisoatt_key::mese() const
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
2010-06-30 14:36:03 +00:00
|
|
|
|
return mid(21, 2);
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TPORA: metodo che restituisce il tipo dell'ora a cui fa riferimento la risorsa o l'attrezzatura
|
2010-06-30 14:36:03 +00:00
|
|
|
|
const TString& TRisoatt_key::tpora() const
|
|
|
|
|
{
|
|
|
|
|
return right(2);
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-24 07:20:54 +00:00
|
|
|
|
TRisoatt_key::TRisoatt_key(const char risoatt, const char* codice, const int anno, const char* mese, const char* tpora)
|
|
|
|
|
{
|
|
|
|
|
TString16 cod = codice; cod.left_just(16);
|
|
|
|
|
|
|
|
|
|
TString chiave; chiave << risoatt << cod << anno << mese << tpora;
|
|
|
|
|
set(chiave);
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
TRisoatt_key::TRisoatt_key(const char* roakey)
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
2010-06-30 14:36:03 +00:00
|
|
|
|
set(roakey);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////
|
|
|
|
|
//// TRISOATT ////
|
|
|
|
|
////////////////////////
|
|
|
|
|
|
2010-07-24 07:20:54 +00:00
|
|
|
|
bool TRisoatt::read(const TRisoatt_key& chiave)
|
|
|
|
|
{
|
|
|
|
|
int err = _iskeynotfound;
|
|
|
|
|
|
|
|
|
|
TModule_table tabmod("&ROA");
|
|
|
|
|
|
|
|
|
|
tabmod.put("CODTAB", chiave);
|
|
|
|
|
err = tabmod.read();
|
|
|
|
|
|
|
|
|
|
if (err != NOERR)
|
|
|
|
|
zero();
|
|
|
|
|
|
|
|
|
|
return err == NOERR;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
//CHIAVE: metodo che restituisce la chiave della tabella di modulo
|
|
|
|
|
const TString& TRisoatt::chiave() const
|
|
|
|
|
{
|
|
|
|
|
return get("CODTAB");
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//DESCR: metodo che restituisce la descrizione contenuta nella tabella di modulo
|
2010-06-30 14:36:03 +00:00
|
|
|
|
const TString& TRisoatt::descr() const
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
|
|
|
|
return get("S0");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//VALUNI: metodo che restituisce il valore unitario contenuto nella tabella di modulo
|
2010-06-30 14:36:03 +00:00
|
|
|
|
const real TRisoatt::valuni() const
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
|
|
|
|
return get_real("R1");
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
//costruttore
|
|
|
|
|
TRisoatt::TRisoatt(const TRectype& r)
|
|
|
|
|
: TRectype(r)
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
2010-06-30 14:36:03 +00:00
|
|
|
|
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-07-24 07:20:54 +00:00
|
|
|
|
TRisoatt::TRisoatt(const TRisoatt_key &chiave)
|
|
|
|
|
: TRectype(LF_TABMOD)
|
|
|
|
|
{
|
|
|
|
|
read(chiave);
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
/////////////////////////////
|
|
|
|
|
//// TDISP_RISOATT ////
|
|
|
|
|
/////////////////////////////
|
2010-06-17 16:04:30 +00:00
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
//CHIAVE: metodo che restituisce la chiave della tabella di modulo
|
|
|
|
|
const TString& TDisp_risoatt::chiave() const
|
|
|
|
|
{
|
|
|
|
|
return get("CODTAB");
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
//DESCR: metodo che restituisce la descrizione contenuta nella tabella di modulo
|
|
|
|
|
const TString& TDisp_risoatt::descr() const
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
2010-06-30 14:36:03 +00:00
|
|
|
|
return get("S0");
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
//VALUNI: metodo che restituisce il valore unitario contenuto nella tabella di modulo
|
|
|
|
|
const int TDisp_risoatt::ore_prev() const
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
2010-06-30 14:36:03 +00:00
|
|
|
|
return get_int("I0");
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
//VALUNI: metodo che restituisce il valore unitario contenuto nella tabella di modulo
|
|
|
|
|
const int TDisp_risoatt::ore_cons() const
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
2010-06-30 14:36:03 +00:00
|
|
|
|
return get_int("I1");
|
2010-06-17 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-06-30 14:36:03 +00:00
|
|
|
|
//costruttore
|
|
|
|
|
TDisp_risoatt::TDisp_risoatt(const TRectype& r)
|
2010-07-24 07:20:54 +00:00
|
|
|
|
: TRectype(r)
|
2010-06-17 16:04:30 +00:00
|
|
|
|
{
|
|
|
|
|
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////
|
|
|
|
|
//// TRILEVAMENTO_ORE ////
|
|
|
|
|
////////////////////////////////
|
|
|
|
|
|
|
|
|
|
//READ: cerca una riga rilevamento ore in base alla chiave primaria
|
2010-09-22 01:06:45 +00:00
|
|
|
|
int TRilevamento_ore::read(const char tipo, const int anno, const int mese, const int giorno, const char tipora, const char *codice, const char *tpora, const char* codcosto, const char* codcms, const char* codfase, TReclock lock)
|
2010-08-06 08:58:20 +00:00
|
|
|
|
{
|
|
|
|
|
TLocalisamfile rilore(LF_RILORE);
|
|
|
|
|
|
2010-09-21 14:36:08 +00:00
|
|
|
|
zero();
|
|
|
|
|
put(RILORE_TIPO, tipo);
|
2010-08-06 08:58:20 +00:00
|
|
|
|
put(RILORE_ANNO, anno);
|
|
|
|
|
put(RILORE_MESE, mese);
|
2010-09-21 14:36:08 +00:00
|
|
|
|
put(RILORE_GIORNO, giorno);
|
2010-09-22 01:06:45 +00:00
|
|
|
|
put(RILORE_TIPORA, tipora);
|
|
|
|
|
put(RILORE_CODICE, codice);
|
2010-08-06 08:58:20 +00:00
|
|
|
|
put(RILORE_TPORA, tpora);
|
|
|
|
|
put(RILORE_CODCOSTO, codcosto);
|
|
|
|
|
put(RILORE_CODCMS, codcms);
|
|
|
|
|
put(RILORE_CODFASE, codfase);
|
2010-09-21 14:36:08 +00:00
|
|
|
|
TRectype saverec(*this);
|
2010-08-06 08:58:20 +00:00
|
|
|
|
|
2010-09-21 14:36:08 +00:00
|
|
|
|
int err = NOERR;
|
|
|
|
|
while ((err = TRectype::read(rilore,_isequal, lock)) == _islocked)
|
|
|
|
|
if (!yesno_box("Dati in uso da parte di un altro utente"))
|
|
|
|
|
break;
|
2010-08-06 08:58:20 +00:00
|
|
|
|
|
2010-09-21 14:36:08 +00:00
|
|
|
|
if (err != NOERR)
|
|
|
|
|
*this = saverec;
|
|
|
|
|
return err;
|
2010-08-06 08:58:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-21 14:36:08 +00:00
|
|
|
|
int TRilevamento_ore::write_rewrite()
|
|
|
|
|
{
|
|
|
|
|
if (!empty())
|
|
|
|
|
{
|
|
|
|
|
TLocalisamfile rilore(LF_RILORE);
|
|
|
|
|
|
|
|
|
|
return TRectype::write_rewrite(rilore);
|
|
|
|
|
}
|
|
|
|
|
return _iskeynotfound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TRilevamento_ore::rewrite_write()
|
|
|
|
|
{
|
|
|
|
|
if (!empty())
|
|
|
|
|
{
|
|
|
|
|
TLocalisamfile rilore(LF_RILORE);
|
|
|
|
|
|
|
|
|
|
return TRectype::rewrite_write(rilore);
|
|
|
|
|
}
|
|
|
|
|
return _iskeynotfound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TRilevamento_ore::remove()
|
|
|
|
|
{
|
|
|
|
|
if (!empty())
|
|
|
|
|
{
|
|
|
|
|
TLocalisamfile rilore(LF_RILORE);
|
|
|
|
|
|
|
|
|
|
return TRectype::remove(rilore);
|
|
|
|
|
}
|
|
|
|
|
return _iskeynotfound;
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TIPO: indica se si tratta di una riga di <D>efault, <P>reventivo o <C>onsuntivo
|
|
|
|
|
const char TRilevamento_ore::tipo() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get(RILORE_TIPO)[0];
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TIPORA: indica se si tratta din una <R>isorsa o di una <A>ttrezzatura
|
|
|
|
|
const char TRilevamento_ore::tipora() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get(RILORE_TIPORA)[0];
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//CODICE: restiruisce il codice della risorsa o dell'attrezzatura
|
|
|
|
|
const TString& TRilevamento_ore::codice() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get(RILORE_CODICE);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ANNO: restituisce l'anno a cui fa riferimento la riga
|
|
|
|
|
const int TRilevamento_ore::anno() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get_int(RILORE_ANNO);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//MESE: restituisce il mese a cui fa riferimento la riga
|
2010-09-21 14:36:08 +00:00
|
|
|
|
const int TRilevamento_ore::mese() const
|
|
|
|
|
{
|
|
|
|
|
return get_int(RILORE_MESE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//GIORNO: restituisce il giorno a cui fa riferimento la riga
|
|
|
|
|
const int TRilevamento_ore::giorno() const
|
2010-07-24 07:20:54 +00:00
|
|
|
|
{
|
2010-09-21 14:36:08 +00:00
|
|
|
|
return get_int(RILORE_GIORNO);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TPORA: restituisce il tipo ora
|
|
|
|
|
const TString& TRilevamento_ore::tpora() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get(RILORE_TPORA);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//CODCOSTO: restituisce il codice del centro di costo
|
|
|
|
|
const TString& TRilevamento_ore::codcosto() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get(RILORE_CODCOSTO);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//CODCMS: restituisce il codice commessa
|
|
|
|
|
const TString& TRilevamento_ore::codcms() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get(RILORE_CODCMS);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//CODFASE: restituisce il codice della fase
|
|
|
|
|
const TString& TRilevamento_ore::codfase() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get(RILORE_CODFASE);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//DADATA: restituisce la data di inizio validit<69> della riga
|
|
|
|
|
const TDate TRilevamento_ore::dadata() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get_date(RILORE_DADATA);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ADATA: restituisce la fata di fine validit<69> della riga
|
|
|
|
|
const TDate TRilevamento_ore::adata()const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get_date(RILORE_ADATA);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//QTAORE: restituisce il numero di ore
|
|
|
|
|
const int TRilevamento_ore::qtaore() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get_int(RILORE_QTAORE);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//COSTO: restitusce il costo unitario
|
|
|
|
|
const real TRilevamento_ore::costo() const
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
return get_real(RILORE_COSTO);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_TIPO: setta <D>efault, <P>reventivo o <C>onsuntivo
|
|
|
|
|
void TRilevamento_ore::set_tipo(const char tipo)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_TIPO, tipo);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_TIPORA: setta <R>isorsa o <A>ttrezzatura
|
|
|
|
|
void TRilevamento_ore::set_tipora(const char tipora)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_TIPORA, tipora);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_CODICE: setta il codice
|
|
|
|
|
void TRilevamento_ore::set_codice(const char* codice)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_CODICE, codice);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_ANNO: setta l'anno di riferimento
|
|
|
|
|
void TRilevamento_ore::set_anno(const int anno)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_ANNO, anno);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_MESE: setta il mese di riferimento
|
2010-09-21 14:36:08 +00:00
|
|
|
|
void TRilevamento_ore::set_mese(const int mese)
|
2010-07-24 07:20:54 +00:00
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_MESE, mese);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-21 14:36:08 +00:00
|
|
|
|
//SET_GIORNO: setta il giorno di riferimento
|
|
|
|
|
void TRilevamento_ore::set_giorno(const int giorno)
|
|
|
|
|
{
|
|
|
|
|
put(RILORE_GIORNO, giorno);
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-24 07:20:54 +00:00
|
|
|
|
//SET_TPORA: setta il tipo ora
|
|
|
|
|
void TRilevamento_ore::set_tpora(const char* tpora)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_TPORA, tpora);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_CODCOSTO: setta il codice del centro di costo
|
|
|
|
|
void TRilevamento_ore::set_codcosto(const char* codcosto)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_CODCOSTO, codcosto);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_CODCMS: setta il codice commessa
|
|
|
|
|
void TRilevamento_ore::set_codcms(const char* codcms)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_CODCMS, codcms);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_CODFASE: setta il codice della fase
|
|
|
|
|
void TRilevamento_ore::set_codfase(const char* codfase)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_CODFASE, codfase);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_DADATA: setta la data di inizio validit<69> della riga
|
|
|
|
|
void TRilevamento_ore::set_dadata(const TDate& dadata)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_DADATA, dadata);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_ADATA: setta la data di fine validit<69> della riga
|
|
|
|
|
void TRilevamento_ore::set_adata(const TDate& adata)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_ADATA, adata);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_QTAORE: setta il numero di ore rilevato
|
|
|
|
|
void TRilevamento_ore::set_qtaore(const int qtaore)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_QTAORE, qtaore);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SET_COSTO: metodo che setta il costo unitario (da listino)
|
|
|
|
|
void TRilevamento_ore::set_costo(const real& costo)
|
|
|
|
|
{
|
2010-07-29 14:15:32 +00:00
|
|
|
|
put(RILORE_COSTO, costo);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Metodi costruttori
|
|
|
|
|
TRilevamento_ore::TRilevamento_ore(const TRectype& rec)
|
|
|
|
|
: TRectype(rec)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TRilevamento_ore::TRilevamento_ore(const TRilevamento_ore& rilore)
|
|
|
|
|
: TRectype(rilore)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-22 01:06:45 +00:00
|
|
|
|
TRilevamento_ore::TRilevamento_ore(const char tipo, const int anno, const int mese, const int giorno, const char tipora, const char* codice, const char* tpora, const char* codcosto, const char* codcms, const char* codfase)
|
2010-07-29 14:15:32 +00:00
|
|
|
|
: TRectype(LF_RILORE)
|
2010-07-24 07:20:54 +00:00
|
|
|
|
{
|
2010-09-22 01:06:45 +00:00
|
|
|
|
read(tipo, anno, mese, giorno, tipora, codice, tpora, codcosto, codcms, codfase);
|
2010-07-24 07:20:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TRilevamento_ore::TRilevamento_ore()
|
2010-07-29 14:15:32 +00:00
|
|
|
|
: TRectype(LF_RILORE)
|
2010-07-24 07:20:54 +00:00
|
|
|
|
{
|
|
|
|
|
zero();
|
2010-07-29 00:26:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|