e00d63cf0b
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@17036 c028cbd2-c16b-5b4b-a496-9718f37d4682
170 lines
3.6 KiB
C++
Executable File
170 lines
3.6 KiB
C++
Executable File
#include <automask.h>
|
|
#include <defmask.h>
|
|
#include <relapp.h>
|
|
#include <tabutil.h>
|
|
#include <modaut.h>
|
|
#include <nditte.h>
|
|
#include <recarray.h>
|
|
#include <reprint.h>
|
|
#include <reputils.h>
|
|
|
|
#include "lv0.h"
|
|
#include "lv0500a.h"
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
// MASCHERA
|
|
//-------------------------------------------------------------------
|
|
class TPass_plan_contr_mask : public TAutomask
|
|
{
|
|
private:
|
|
bool is_check(TField_event e);
|
|
|
|
protected:
|
|
virtual bool on_field_event(TOperable_field& campo, TField_event e, long jolly);
|
|
|
|
public:
|
|
TPass_plan_contr_mask();
|
|
};
|
|
|
|
bool TPass_plan_contr_mask::on_field_event(TOperable_field& campo, TField_event e, long jolly)
|
|
{
|
|
int _giorno = get_int(F_GGCONS);
|
|
|
|
switch(campo.dlg())
|
|
{
|
|
case F_GGCONS:
|
|
/*
|
|
* Controllo dell'esattezza del giorno.
|
|
* Se inserisco un numero maggiore di 7 oppure
|
|
* uguale a 0 allora pop-up di errore
|
|
*/
|
|
if(is_check(e))
|
|
{
|
|
if( _giorno>7 || _giorno==0)
|
|
{
|
|
return error_box(TR("Errore:Giorno Inesistente!"));
|
|
}
|
|
}
|
|
case F_ORAARR:
|
|
/*
|
|
* Controllo formattazione del campo ORA. Il
|
|
* Nel caso inserisco un numero inferiore delle 6 cifre
|
|
* interpreto le cifre mancanti come degli 0 posti dinnanzi
|
|
* alla cifra.
|
|
* Successivamente controllo la formattazione delle ore,
|
|
* minuti, secondi.
|
|
*/
|
|
if(is_check(e))
|
|
{
|
|
TString8 _ora_str = get(F_ORAARR);
|
|
if( _ora_str.not_empty())
|
|
{
|
|
for(int a=_ora_str.len(); a<6 ;a++)
|
|
{
|
|
_ora_str.insert("0",0);
|
|
}
|
|
|
|
if(_ora_str.sub(0,2)>"23")
|
|
{
|
|
return error_box(TR("Ora errata"));
|
|
}
|
|
else if(_ora_str.sub(2,4)>"59")
|
|
{
|
|
return error_box(TR("Minuti errati"));
|
|
}
|
|
else if(_ora_str.sub(4,6)>"59")
|
|
{
|
|
return error_box(TR("Secondi errati"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Settaggio a false di tutti i flags
|
|
*/
|
|
long l = 0;
|
|
for(short i = F_LUN; i< F_LUN+7; i++)
|
|
{
|
|
set(i,l,0);
|
|
}
|
|
|
|
/*
|
|
* Settaggio a true del flag corrispondente
|
|
* al giorno imputato a video
|
|
*/
|
|
switch(_giorno)
|
|
{
|
|
case 1:
|
|
set(F_LUN,true);
|
|
break;
|
|
case 2:
|
|
set(F_MAR,true);
|
|
break;
|
|
case 3:
|
|
set(F_MER,true);
|
|
break;
|
|
case 4:
|
|
set(F_GIO,true);
|
|
break;
|
|
case 5:
|
|
set(F_VEN,true);
|
|
break;
|
|
case 6:
|
|
set(F_SAB,true);
|
|
break;
|
|
case 7:
|
|
set(F_DOM,true);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool TPass_plan_contr_mask::is_check(TField_event e)
|
|
{
|
|
return (e==fe_modify || e==fe_close);
|
|
}
|
|
|
|
TPass_plan_contr_mask::TPass_plan_contr_mask() : TAutomask("lv0500a") {}
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
// APPLICAZIONE
|
|
//--------------------------------------------------------------
|
|
class TPass_plan_contr : public TRelation_application
|
|
{
|
|
TPass_plan_contr_mask* _mask;
|
|
TRelation* _rel;
|
|
|
|
protected:
|
|
virtual bool user_create();
|
|
virtual bool user_destroy();
|
|
virtual TMask* get_mask(int mode) { return _mask; }
|
|
virtual bool changing_mask(int mode) { return false; }
|
|
|
|
public:
|
|
virtual TRelation* get_relation() const {return (TRelation*)_rel;}
|
|
};
|
|
|
|
|
|
bool TPass_plan_contr::user_create()
|
|
{
|
|
_rel = new TRelation(LF_LVPASPLAN);
|
|
_mask = new TPass_plan_contr_mask;
|
|
return true;
|
|
}
|
|
|
|
bool TPass_plan_contr::user_destroy()
|
|
{
|
|
delete _mask;
|
|
return true;
|
|
}
|
|
|
|
int lv0500(int argc, char* argv[])
|
|
{
|
|
TPass_plan_contr a;
|
|
a.run(argc, argv, TR("Archivi Lavanderie"));
|
|
return 0;
|
|
}
|