Patch level : 10.0 152

Files correlati     :  lv0.exe
Ricompilazione Demo : [ ]
Commento            :

Aggiunto il calendario giorni lavorativi e festività nella configurazione lavanderie

Aggiunto menu per i documenti


git-svn-id: svn://10.65.10.50/trunk@17527 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2008-11-01 18:09:05 +00:00
parent 0ef98c201f
commit 562cc9dfe9
18 changed files with 287 additions and 38 deletions

View File

@ -2,20 +2,103 @@
#include <msksheet.h>
#include <relation.h>
#include "../ci/cilib.h"
#include "lvlib.h"
#include "lv0300a.h"
class TConf_lavanderie_mask : public TAlmanac_mask
{
TLavanderie_calendar _cal; // array di TBit_array. Ognuno di essi č lungo 366 e rappresenta i flag di presenza documenti per ogni giorno dell'anno. Ogni page della maschera ha bisogno di un bitarray diverso
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
// ereditato da TAlmanac_mask
virtual bool is_date_void(int currpage, TDate& cdate);
virtual void change_year(int newyear);
// metodi di accesso
void update_current_calendar(int year);
// apertura del foglio interno di gestione dei documenti
virtual void open_day_mask(const TDate & date);
// Costruttore
TConf_lavanderie_mask(const TFilename & f) : TAlmanac_mask(f), _cal(TDate(TODAY).year()) { }
// Distruttore
~TConf_lavanderie_mask() { }
};
bool TConf_lavanderie_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case DLG_OK:
if (e == fe_button)
_cal.write();
break;
default:
TAlmanac_mask::on_field_event(o, e, jolly);
break;
}
return true;
}
bool TConf_lavanderie_mask::is_date_void(int currpage, TDate& cdate)
{
return _cal.is_holiday(cdate);
}
void TConf_lavanderie_mask::change_year(int newyear)
{
_cal.write();
_cal.read(newyear);
}
void TConf_lavanderie_mask::open_day_mask(const TDate & date)
{
TDate d(date);
if (!d.ok())
d = curr_almanac().selected_date();
const bool holiday = _cal.is_holiday(d) ? false : true;
_cal.set_holiday(d, holiday);
almanac().force_update();
}
void TConf_lavanderie_mask::update_current_calendar(int year)
{
change_year(year);
}
class TConf_Lavanderie : public TConfig_application
{
TConf_lavanderie_mask * _mask;
protected:
virtual void load_mask();
virtual void save_mask(bool tosave) ;
virtual TMask* get_mask() {return _mask;}
virtual TMask* create_mask(const TFilename & f);
virtual void save_mask(bool tosave) ;
virtual bool user_create( );
public:
TConf_Lavanderie() : TConfig_application( CONFIG_DITTA ){ }
TConf_Lavanderie() : TConfig_application( CONFIG_DITTA ), _mask(NULL) {}
virtual ~TConf_Lavanderie( ){ }
};
TMask* TConf_Lavanderie::create_mask(const TFilename & f)
{
if (_mask == NULL)
{
_mask = new TConf_lavanderie_mask(f);
_mask->activate_almanac(F_ALMANAC, 0, TDate(TODAY));
}
return _mask;
}
bool TConf_Lavanderie::user_create( )
{
TConfig conf(CONFIG_DITTA );
@ -25,38 +108,38 @@ bool TConf_Lavanderie::user_create( )
void TConf_Lavanderie::load_mask()
{
TMask* m=get_mask();
if (m==NULL)
return;
TMask* m = get_mask();
if (m != NULL)
{
TConfig_application::load_mask();
FOR_EACH_MASK_SHEET((*m), i, s)
{
s->destroy();
TMask& sm=s->sheet_mask();
TConfig_application::load_mask();
FOR_EACH_MASK_SHEET((*m), i, s)
{
s->destroy();
TMask& sm=s->sheet_mask();
bool found=true;
for (int r=0; found ;r++)
{
FOR_EACH_MASK_FIELD(sm,j,f)
{
const TFieldref* fr=f->field();
if(fr!=NULL)
{
const TString& value=get_config()->get(fr->name(),NULL,r);
if (value.empty() && f->dlg()==101 )
{
found=false;
break;
}
s->row(r).add(value,s->cid2index(f->dlg()));
}
}
if (found)
s->check_row(r, 1);
}
s->force_update();
}
bool found=true;
for (int r=0; found ;r++)
{
FOR_EACH_MASK_FIELD(sm,j,f)
{
const TFieldref* fr=f->field();
if(fr!=NULL)
{
const TString& value=get_config()->get(fr->name(),NULL,r);
if (value.empty() && f->dlg()==101 )
{
found=false;
break;
}
s->row(r).add(value,s->cid2index(f->dlg()));
}
}
if (found)
s->check_row(r, 1);
}
s->force_update();
}
}
}
void TConf_Lavanderie::save_mask(bool tosave)

View File

@ -1,3 +1,5 @@
#include "../ci/cimsk.h"
#define GEN 1
#define FAT 2
#define ORF 3
@ -33,6 +35,7 @@
#define F_DOCDOT 221
#define F_UNICONT 222
#define F_ALMANAC 223
#define S_CODNUM_RIT 101
#define S_TIPODOC_RIT 102

View File

@ -334,6 +334,39 @@ END
ENDPAGE
PAGE "Calendario" 0 2 0 0
ALMANAC F_ALMANAC 60 16
BEGIN
PROMPT -3 1 ""
END
BUTTON F_PREVMONTH 10 2
BEGIN
PROMPT -26 -1 "~Precedente"
PICTURE BMP_PREVREC
END
LIST F_CHANGEMONTH 10
BEGIN
PROMPT -36 -1 ""
FLAGS "M"
END
NUMBER F_CHANGEYEAR 10
BEGIN
PROMPT -46 -1 ""
FLAGS "A"
END
BUTTON F_NEXTMONTH 10 2
BEGIN
PROMPT -56 -1 "S~uccessivo"
PICTURE BMP_NEXTREC
END
ENDPAGE
ENDMASK
PAGE "Buoni di ritiro" -1 -1 80 5

View File

@ -1,6 +1,8 @@
#include "lvlib.h"
#include "..\mg\clifogiac.h"
#include <config.h>
#include <date.h>
#include <recset.h>
#include <utility.h>
#include "../cg/cglib01.h"
@ -352,3 +354,105 @@ TArticolo_lavanderie & cached_article_laundry(const char * codart, const char ti
return art;
}
///////////////////////////////////////////////////////////
// TLavanderie_calendar
///////////////////////////////////////////////////////////
// Serve per aggiungere le feste dei Patroni
void TLavanderie_calendar::set_holiday(const TDate & date, bool holiday)
{
if (_year == date.year())
{
const TDate inizio(1, 1, _year);
long ndays = date - inizio;
_days.set(ndays, holiday);
_dirty = true;
}
}
bool TLavanderie_calendar::is_holiday(const TDate& date) const
{
if (_year == date.year())
{
const TDate inizio(1, 1, _year);
long ndays = date - inizio;
return _days[ndays];
}
return false;
}
int TLavanderie_calendar::read(int year)
{
if (year != 0)
_year = year;
TConfig cfg(CONFIG_DITTA, "lv");
TString8 varname("CAL");
varname << _year;
_days.reset();
const TString val = cfg.get(varname);
if (val.full())
{
const int len = val.len();
for (int i = 0; i < len; i++)
_days.set(i, val[i] != ' ');
}
else
{
const TDate inizio(1, 1, _year);
const TDate fine(31, 12, _year);
TDate data(inizio);
for (int i = 0; data <= fine; ++data, i++)
_days.set(i, data.is_holiday() || data.wday() == 6);
}
return NOERR;
}
int TLavanderie_calendar::write() const
{
if (_dirty)
{
TConfig cfg(CONFIG_DITTA, "lv");
TString8 varname("CAL");
varname << _year;
TString val(255);
const TDate inizio(1, 1, _year);
const TDate fine(31, 12, _year);
TDate data(inizio);
for (int i = 0; data <= fine; ++data, i++)
val << (_days[i] ? 'X' : ' ');
cfg.set(varname, val);
}
((TLavanderie_calendar *)this)->_dirty = false;
return NOERR;
}
int TLavanderie_calendar::remove() const
{
TConfig cfg(CONFIG_DITTA, "lv");
TString8 varname("CAL");
varname << _year;
TString val(255);
const TDate inizio(1, 1, _year);
const TDate fine(31, 12, _year);
TDate data(inizio);
for (int i = 0; data <= fine; ++data, i++)
val << data.is_holiday() ? "X" : " ";
cfg.set(varname, val);
return NOERR;
}
TLavanderie_calendar::TLavanderie_calendar(const int year) : _year(year), _dirty(false)
{
read();
}

View File

@ -90,4 +90,25 @@ public:
TArticolo_lavanderie & cached_article_laundry(const char * codart, const char tipocf, const long codcf, const int indsped);
class TLavanderie_calendar : public TObject
{
int _year;
TBit_array _days;
bool _dirty;
public:
int read(int year = 0);
int write() const;
int rewrite() const { return write(); }
int remove() const;
void set_holiday(const TDate& date, bool holiday = true);
void reset_holiday(const TDate& date) { set_holiday(date, false);}
bool is_holiday(const TDate& date) const;
TLavanderie_calendar(int year);
virtual ~TLavanderie_calendar() { }
};
#endif

View File

@ -7,10 +7,6 @@ Item_01 = "Archivi e Tabelle di Base", [LVMENU_001]
Item_02 = "Gestione Giri", [LVMENU_040]
Item_03 = "Configurazione", [LVMENU_090]
Item_04 = "Contratti", "lv0 -3", "F"
Item_05 = "Documenti di Trasporto", "ve0 -1 -filtI1=1 -defNUM_GEN,TIPODOC_GEN,lv", "F"
Item_05 = "Fatture", "ve0 -1 -filtI1=2 -defNUM_FAT,TIPODOC_FAT,lv", "F"
Item_05 = "Ordini Fornitori", "ve0 -1 -filtI1=3 -defNUM_ORF,TIPODOC_ORF,lv", "F"
Item_05 = "Ordini Clienti", "ve0 -1 -filtI1=3 -defNUM_ORC,TIPODOC_ORC,lv", "F"
[LVMENU_001]
Caption = "Archivi e Tabelle di Base"
@ -87,10 +83,19 @@ Module = 41
Flags = ""
Item_01 = "Stampa Giri", "lv0 -1 lv2300a", "F"
[LVMENU_055]
Caption = "Documenti"
Picture = <ba00>
Module = 41
Flags = ""
Item_01 = "Documenti di Trasporto", "ve0 -1 -filtI1=1 -defNUM_GEN,TIPODOC_GEN,lv", "F"
Item_02 = "Fatture", "ve0 -1 -filtI1=2 -defNUM_FAT,TIPODOC_FAT,lv", "F"
Item_03 = "Ordini Fornitori", "ve0 -1 -filtI1=3 -defNUM_ORF,TIPODOC_ORF,lv", "F"
Item_04 = "Ordini Clienti", "ve0 -1 -filtI1=3 -defNUM_ORC,TIPODOC_ORC,lv", "F"
[LVMENU_090]
Caption = "Configurazione"
Picture = <ba00>
Module = 41
Flags = ""
Item_01 = "Parametri gestione lavanderie", "lv0 -2", "F"

BIN
lv/lvmn01.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
lv/lvmn02.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
lv/lvmn03.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
lv/lvmn04.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
lv/lvmn05.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
lv/lvmn06.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
lv/lvmn07.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
lv/lvmn08.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
lv/lvmn09.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
lv/lvmn10.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
lv/lvmn11.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
lv/lvmn12.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB