Patch level : 10.0 no patch
Files correlati : ci0.exe Ricompilazione Demo : [ ] Commento : Modulo rilevazione ore step 2 git-svn-id: svn://10.65.10.50/branches/R_10_00@21132 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
284f979191
commit
e654ec5ec7
@ -228,7 +228,7 @@ void TRisoatt_msk::registra()
|
|||||||
chiave << add_field_to_tab_key(riga, tipo[0] == 'R' ? S_CODRIS : S_CODATT);
|
chiave << add_field_to_tab_key(riga, tipo[0] == 'R' ? S_CODRIS : S_CODATT);
|
||||||
|
|
||||||
TString8 anme; anme << add_field_to_tab_key(riga, S_ANNO) << add_field_to_tab_key(riga, S_MESE, 2);
|
TString8 anme; anme << add_field_to_tab_key(riga, S_ANNO) << add_field_to_tab_key(riga, S_MESE, 2);
|
||||||
chiave << anme;
|
chiave << anme << "01"; // giorno
|
||||||
chiave << add_field_to_tab_key(riga, S_TPORA);
|
chiave << add_field_to_tab_key(riga, S_TPORA);
|
||||||
const TString80 descr = tipo[0] == 'R' ? riga.get(sheet.cid2index(S_DESRIS)) : riga.get(sheet.cid2index(S_DESATT));
|
const TString80 descr = tipo[0] == 'R' ? riga.get(sheet.cid2index(S_DESRIS)) : riga.get(sheet.cid2index(S_DESATT));
|
||||||
const real valuni(riga.get(sheet.cid2index(S_VALUNI)));
|
const real valuni(riga.get(sheet.cid2index(S_VALUNI)));
|
||||||
|
@ -165,6 +165,8 @@ void TConfigurazioneIndustriale_app::file_to_sheet()
|
|||||||
mask().sheet().check_row(item);
|
mask().sheet().check_row(item);
|
||||||
item++;
|
item++;
|
||||||
}
|
}
|
||||||
|
mask().set(F_DETTDISP, configfile.get("DETTDISP"));
|
||||||
|
mask().set(F_DETTCONS, configfile.get("DETTCONS"));
|
||||||
mask().sheet().force_update();
|
mask().sheet().force_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,6 +201,8 @@ void TConfigurazioneIndustriale_app::sheet_to_file()
|
|||||||
configfile.set("DeleteClosed", mask().row(i).get(10), NULL, true, i);
|
configfile.set("DeleteClosed", mask().row(i).get(10), NULL, true, i);
|
||||||
totlen+=currdesc.len();
|
totlen+=currdesc.len();
|
||||||
}
|
}
|
||||||
|
configfile.set("DETTDISP", mask().get(F_DETTDISP));
|
||||||
|
configfile.set("DETTCONS", mask().get(F_DETTCONS));
|
||||||
|
|
||||||
if (totlen>_maxlen)
|
if (totlen>_maxlen)
|
||||||
message_box("E' probabile che la lunghezza delle descrizioni inserite ne impedisca la totale visualizzazione sullo schermo");
|
message_box("E' probabile che la lunghezza delle descrizioni inserite ne impedisca la totale visualizzazione sullo schermo");
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#define F_MOVEUP 152
|
#define F_MOVEUP 152
|
||||||
#define F_MOVEDN 153
|
#define F_MOVEDN 153
|
||||||
#define F_DETTDISP 154
|
#define F_DETTDISP 154
|
||||||
#define F_DETTPREV 155
|
|
||||||
#define F_DETTCONS 156
|
#define F_DETTCONS 156
|
||||||
|
|
||||||
#define FR_FILTRO 101
|
#define FR_FILTRO 101
|
||||||
|
@ -55,18 +55,9 @@ BEGIN
|
|||||||
FIELD DETTDISP
|
FIELD DETTDISP
|
||||||
END
|
END
|
||||||
|
|
||||||
LISTBOX F_DETTPREV 6
|
|
||||||
BEGIN
|
|
||||||
PROMPT 2 4 "Dettaglio Preventivi "
|
|
||||||
ITEM "G|Giorno"
|
|
||||||
ITEM "M|Mese"
|
|
||||||
ITEM "A|Anno"
|
|
||||||
FIELD DETTPREV
|
|
||||||
END
|
|
||||||
|
|
||||||
LISTBOX F_DETTCONS 6
|
LISTBOX F_DETTCONS 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 6 "Dettaglio Consuntivi "
|
PROMPT 2 4 "Dettaglio Consuntivi "
|
||||||
ITEM "G|Giorno"
|
ITEM "G|Giorno"
|
||||||
ITEM "M|Mese"
|
ITEM "M|Mese"
|
||||||
ITEM "A|Anno"
|
ITEM "A|Anno"
|
||||||
|
193
ci/ci0500.cpp
193
ci/ci0500.cpp
@ -21,11 +21,14 @@ class TDisp_risoatt_msk : public TAutomask
|
|||||||
{
|
{
|
||||||
int _preventivo;
|
int _preventivo;
|
||||||
int _consuntivo;
|
int _consuntivo;
|
||||||
|
TString _dett;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||||
|
|
||||||
const TString& add_field_to_tab_filter(const short id, int len = 0, const char* empty_value = "");
|
const TString& add_field_to_tab_filter(const short id, int len = 0, const char* empty_value = "");
|
||||||
const TString& add_field_to_tab_key(TToken_string& row, const short id, int len = 0);
|
const TString& add_field_to_tab_key(TToken_string& row, const short id, int len = 0);
|
||||||
|
const TString& add_field_to_tab_key(const short id, int len = 0);
|
||||||
void riempi_sheet();
|
void riempi_sheet();
|
||||||
void nuova_riga();
|
void nuova_riga();
|
||||||
void azzera_riga(TSheet_field& sheet);
|
void azzera_riga(TSheet_field& sheet);
|
||||||
@ -57,13 +60,42 @@ const TString& TDisp_risoatt_msk::add_field_to_tab_filter(const short id, int le
|
|||||||
const TString& TDisp_risoatt_msk::add_field_to_tab_key(TToken_string& row, const short id, int len)
|
const TString& TDisp_risoatt_msk::add_field_to_tab_key(TToken_string& row, const short id, int len)
|
||||||
{
|
{
|
||||||
TSheet_field& sh = sfield(F_SHEET);
|
TSheet_field& sh = sfield(F_SHEET);
|
||||||
|
TMask & m = sh.sheet_mask();
|
||||||
|
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
len = sh.sheet_mask().field(id).size();
|
len = m.field(id).size();
|
||||||
|
|
||||||
TString& val = get_tmp_string();
|
TString& val = get_tmp_string();
|
||||||
|
|
||||||
val = row.get(sh.cid2index(id));
|
if( id == S_DATA || id == S_DATAOR)
|
||||||
|
{
|
||||||
|
TDate data(row.get(sh.cid2index(id)));
|
||||||
|
val = data.string(ANSI);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
val = row.get(sh.cid2index(id));
|
||||||
|
val.left_just(len);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& TDisp_risoatt_msk::add_field_to_tab_key(const short id, int len)
|
||||||
|
{
|
||||||
|
TSheet_field& sh = sfield(F_SHEET);
|
||||||
|
TMask & m = sh.sheet_mask();
|
||||||
|
|
||||||
|
|
||||||
|
if (len <= 0)
|
||||||
|
len = m.field(id).size();
|
||||||
|
|
||||||
|
TString& val = get_tmp_string();
|
||||||
|
|
||||||
|
if( id == S_DATA || id == S_DATAOR)
|
||||||
|
{
|
||||||
|
TDate data(m.get(id));
|
||||||
|
val = data.string(ANSI);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
val = m.get(id);
|
||||||
val.left_just(len);
|
val.left_just(len);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -116,6 +148,7 @@ void TDisp_risoatt_msk::riempi_sheet()
|
|||||||
TDisp_risoatt disp(dra.cursor()->curr());
|
TDisp_risoatt disp(dra.cursor()->curr());
|
||||||
TRisoatt_key drakey(disp.chiave());
|
TRisoatt_key drakey(disp.chiave());
|
||||||
TToken_string& riga = sheet.row(-1);
|
TToken_string& riga = sheet.row(-1);
|
||||||
|
const TString4 tipo = drakey.tipo();
|
||||||
riga.add(drakey.tipo(), sheet.cid2index(S_RISOATT));
|
riga.add(drakey.tipo(), sheet.cid2index(S_RISOATT));
|
||||||
TString16 cod = drakey.cod();
|
TString16 cod = drakey.cod();
|
||||||
cod.trim();
|
cod.trim();
|
||||||
@ -125,11 +158,11 @@ void TDisp_risoatt_msk::riempi_sheet()
|
|||||||
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
|
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
|
||||||
default : break;
|
default : break;
|
||||||
}
|
}
|
||||||
riga.add(drakey.anno(), sheet.cid2index(S_ANNO));
|
riga.add(drakey.data(), sheet.cid2index(S_DATA));
|
||||||
riga.add(drakey.mese(), sheet.cid2index(S_MESE));
|
|
||||||
riga.add(drakey.tpora(), sheet.cid2index(S_TPORA));
|
riga.add(drakey.tpora(), sheet.cid2index(S_TPORA));
|
||||||
riga.add(disp.ore_prev(), sheet.cid2index(S_OREPREV));
|
riga.add(disp.ore_prev(), sheet.cid2index(S_OREPREV));
|
||||||
riga.add(disp.ore_cons(), sheet.cid2index(S_ORECONS));
|
riga.add(disp.ore_cons(), sheet.cid2index(S_ORECONS));
|
||||||
|
riga.add(drakey.data(), sheet.cid2index(S_DATAOR));
|
||||||
sheet.check_row(sheet.items() - 1);
|
sheet.check_row(sheet.items() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +192,16 @@ void TDisp_risoatt_msk::nuova_riga()
|
|||||||
else
|
else
|
||||||
riga.add(get(F_CODATT), sheet.cid2index(S_CODATT));
|
riga.add(get(F_CODATT), sheet.cid2index(S_CODATT));
|
||||||
}
|
}
|
||||||
riga.add(anno, sheet.cid2index(S_ANNO));
|
TDate data;
|
||||||
riga.add(mese, sheet.cid2index(S_MESE));
|
if (anno == 0)
|
||||||
|
data = TDate(TODAY);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.set_day(1);
|
||||||
|
data.set_month(mese == 0 ? 1 : mese);
|
||||||
|
data.set_year(anno);
|
||||||
|
}
|
||||||
|
riga.add(data.string(), sheet.cid2index(S_DATA));
|
||||||
riga.add(tpora, sheet.cid2index(S_TPORA));
|
riga.add(tpora, sheet.cid2index(S_TPORA));
|
||||||
sheet.update_mask(r);
|
sheet.update_mask(r);
|
||||||
msk.enable(S_RISOATT, tutti);
|
msk.enable(S_RISOATT, tutti);
|
||||||
@ -168,8 +209,6 @@ void TDisp_risoatt_msk::nuova_riga()
|
|||||||
msk.enable(S_CODRIS);
|
msk.enable(S_CODRIS);
|
||||||
if (tutti || tipo == "A")
|
if (tutti || tipo == "A")
|
||||||
msk.enable(S_CODATT);
|
msk.enable(S_CODATT);
|
||||||
msk.enable(S_ANNO, anno == 0);
|
|
||||||
msk.enable(S_MESE, mese == 0);
|
|
||||||
msk.enable(S_TPORA, tpora.empty());
|
msk.enable(S_TPORA, tpora.empty());
|
||||||
//lancio la maschera di riga da compilare
|
//lancio la maschera di riga da compilare
|
||||||
if (msk.run() == K_ENTER && (msk.get_int(S_OREPREV) > 0 || msk.get_int(S_ORECONS) > 0))
|
if (msk.run() == K_ENTER && (msk.get_int(S_OREPREV) > 0 || msk.get_int(S_ORECONS) > 0))
|
||||||
@ -214,49 +253,56 @@ void TDisp_risoatt_msk::azzera_tutto(TSheet_field& sheet)
|
|||||||
//vaoler pari a zero, e poi ricarica lo sheet
|
//vaoler pari a zero, e poi ricarica lo sheet
|
||||||
void TDisp_risoatt_msk::registra()
|
void TDisp_risoatt_msk::registra()
|
||||||
{
|
{
|
||||||
TLocalisamfile tabmod(LF_TABMOD);
|
// TLocalisamfile tabmod(LF_TABMOD);
|
||||||
TModule_table tab("&DRA");
|
TModule_table tab("&DRA");
|
||||||
TSheet_field& sheet = sfield(F_SHEET);
|
TSheet_field& sheet = sfield(F_SHEET);
|
||||||
TString80 chiave;
|
TString80 key;
|
||||||
|
TString80 newkey;
|
||||||
|
|
||||||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||||
{
|
{
|
||||||
chiave.cut(0);
|
|
||||||
TToken_string& riga = *(TToken_string*)row;
|
TToken_string& riga = *(TToken_string*)row;
|
||||||
|
|
||||||
const TString4 tipo = add_field_to_tab_key(riga, S_RISOATT, 1);
|
const TString4 tipo = add_field_to_tab_key(riga, S_RISOATT, 1);
|
||||||
chiave << tipo;
|
const bool risorsa = tipo == "R";
|
||||||
chiave << add_field_to_tab_key(riga, tipo[0] == 'R' ? S_CODRIS : S_CODATT);
|
|
||||||
|
key = tipo;
|
||||||
TString8 anme; anme << add_field_to_tab_key(riga, S_ANNO) << add_field_to_tab_key(riga, S_MESE, 2);
|
key << add_field_to_tab_key(riga, risorsa ? S_CODRIS : S_CODATT)
|
||||||
chiave << anme;
|
<< add_field_to_tab_key(riga, S_DATAOR) << add_field_to_tab_key(riga, S_TPORA);
|
||||||
chiave << add_field_to_tab_key(riga, S_TPORA);
|
newkey = tipo;
|
||||||
const TString80 descr = tipo[0] == 'R' ? riga.get(sheet.cid2index(S_DESRIS)) : riga.get(sheet.cid2index(S_DESATT));
|
newkey << add_field_to_tab_key(riga, risorsa ? S_CODRIS : S_CODATT)
|
||||||
|
<< add_field_to_tab_key(riga, S_DATA) << add_field_to_tab_key(riga, S_TPORA);
|
||||||
|
const TString80 descr = risorsa ? riga.get(sheet.cid2index(S_DESRIS)) : riga.get(sheet.cid2index(S_DESATT));
|
||||||
const int oreprev = riga.get_int(sheet.cid2index(S_OREPREV));
|
const int oreprev = riga.get_int(sheet.cid2index(S_OREPREV));
|
||||||
const int orecons = riga.get_int(sheet.cid2index(S_ORECONS));
|
const int orecons = riga.get_int(sheet.cid2index(S_ORECONS));
|
||||||
|
|
||||||
tab.put("CODTAB", chiave);
|
tab.put("CODTAB", key);
|
||||||
int err = tab.read();
|
int err = tab.read();
|
||||||
|
if (err == NOERR)
|
||||||
if(err == NOERR)
|
{
|
||||||
{
|
if (oreprev != 0 || orecons != 0)
|
||||||
if(oreprev == 0 && orecons == 0)
|
{
|
||||||
tab.remove();
|
tab.put("I0", oreprev);
|
||||||
else
|
tab.put("I1", orecons);
|
||||||
{
|
tab.rewrite();
|
||||||
tab.put("I0", oreprev);
|
const TString data = riga.get(sheet.cid2index(S_DATA));
|
||||||
tab.put("I1", orecons);
|
if (data != riga.get(sheet.cid2index(S_DATAOR)))
|
||||||
tab.rewrite();
|
{
|
||||||
}
|
tab.remove();
|
||||||
}
|
err = _iskeynotfound;
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
tab.put("CODTAB", chiave);
|
else
|
||||||
tab.put("S0", descr);
|
tab.remove();
|
||||||
tab.put("I0", oreprev);
|
}
|
||||||
tab.put("I1", orecons);
|
if (err != NOERR)
|
||||||
tab.write();
|
{
|
||||||
}
|
tab.zero();
|
||||||
|
tab.put("CODTAB", newkey);
|
||||||
|
tab.put("D0", riga.get(sheet.cid2index(S_DATA)));
|
||||||
|
tab.put("I0", oreprev);
|
||||||
|
tab.put("I1", orecons);
|
||||||
|
tab.write();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
riempi_sheet();
|
riempi_sheet();
|
||||||
}
|
}
|
||||||
@ -338,7 +384,53 @@ bool TDisp_risoatt_msk::on_field_event(TOperable_field& f, TField_event e, long
|
|||||||
send_key(K_SPACE, DLG_NEWREC);
|
send_key(K_SPACE, DLG_NEWREC);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
default: break;
|
case S_DATA:
|
||||||
|
if (e == fe_modify)
|
||||||
|
{
|
||||||
|
TDate d(f.get());
|
||||||
|
const int anno = get_int(F_ANNO);
|
||||||
|
const int mese = get_int(F_MESE);
|
||||||
|
|
||||||
|
if (anno != 0 && anno != d.year())
|
||||||
|
return error_box(TR("Anno errato"));
|
||||||
|
if (mese != 0 && mese != d.month())
|
||||||
|
return error_box(TR("Mese errato"));
|
||||||
|
if (_dett == "A")
|
||||||
|
d.set_month(1);
|
||||||
|
if (_dett != "G")
|
||||||
|
d.set_day(1);
|
||||||
|
f.set(d.string());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (e == se_leave)
|
||||||
|
{
|
||||||
|
TSheet_field& sheet = sfield(F_SHEET);
|
||||||
|
TToken_string & curr_row = sheet.row(jolly);
|
||||||
|
TDate d(curr_row.get(sheet.cid2index(S_DATA)));
|
||||||
|
const TString4 tipo = add_field_to_tab_key(S_RISOATT, 1);
|
||||||
|
const bool risorsa = tipo == "R";
|
||||||
|
const short idcod = risorsa ? S_CODRIS : S_CODATT;
|
||||||
|
|
||||||
|
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||||
|
{
|
||||||
|
if (r != jolly && tipo == add_field_to_tab_key(*row, S_RISOATT, 1))
|
||||||
|
{
|
||||||
|
const TString cod = add_field_to_tab_key(idcod);
|
||||||
|
if ( cod == add_field_to_tab_key(*row, idcod))
|
||||||
|
{
|
||||||
|
TString tpora = add_field_to_tab_key(S_TPORA);
|
||||||
|
|
||||||
|
if ( tpora == add_field_to_tab_key(*row, S_TPORA))
|
||||||
|
{
|
||||||
|
TDate dr(row->get(sheet.cid2index(S_DATA)));
|
||||||
|
if (dr == d)
|
||||||
|
return error_box(FR("La risorsa %s alla data %s esiste già alla riga %d"), (const char *) cod,(const char *) d.string(), r + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -352,6 +444,21 @@ TDisp_risoatt_msk::TDisp_risoatt_msk()
|
|||||||
{
|
{
|
||||||
_preventivo = 0;
|
_preventivo = 0;
|
||||||
_consuntivo = 0;
|
_consuntivo = 0;
|
||||||
|
_dett = ini_get_string(CONFIG_DITTA, "ci", "DETTDISP", "G");
|
||||||
|
if (_dett == "A")
|
||||||
|
{
|
||||||
|
field(F_ANNO).update_flags("A", true);
|
||||||
|
reset(F_ANNO);
|
||||||
|
disable(F_ANNO);
|
||||||
|
reset(F_MESE);
|
||||||
|
disable(F_MESE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (_dett == "M")
|
||||||
|
{
|
||||||
|
reset(F_MESE);
|
||||||
|
disable(F_MESE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
14
ci/ci0500a.h
14
ci/ci0500a.h
@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
#define S_RISOATT 101
|
#define S_RISOATT 101
|
||||||
#define S_CODRIS 102
|
#define S_CODRIS 102
|
||||||
#define S_DESRIS 108
|
#define S_DESRIS 107
|
||||||
#define S_CODATT 202
|
#define S_CODATT 202
|
||||||
#define S_DESATT 208
|
#define S_DESATT 207
|
||||||
#define S_ANNO 103
|
#define S_DATA 103
|
||||||
#define S_MESE 104
|
#define S_TPORA 104
|
||||||
#define S_TPORA 105
|
#define S_OREPREV 105
|
||||||
#define S_OREPREV 106
|
#define S_ORECONS 106
|
||||||
#define S_ORECONS 107
|
#define S_DATAOR 108
|
@ -134,12 +134,12 @@ BEGIN
|
|||||||
PROMPT 1 4 ""
|
PROMPT 1 4 ""
|
||||||
ITEM "Tipo"
|
ITEM "Tipo"
|
||||||
ITEM "Codice@16"
|
ITEM "Codice@16"
|
||||||
ITEM "Anno"
|
ITEM "Data@10"
|
||||||
ITEM "Mese"
|
|
||||||
ITEM "Tipo\nOra@5"
|
ITEM "Tipo\nOra@5"
|
||||||
ITEM "Ore\npreventivo@12"
|
ITEM "Ore\npreventivo@12"
|
||||||
ITEM "Ore\nconsuntivo@12"
|
ITEM "Ore\nconsuntivo@12"
|
||||||
ITEM "Descrizione@50"
|
ITEM "Descrizione@50"
|
||||||
|
ITEM "Data@10"
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
@ -147,7 +147,7 @@ ENDMASK
|
|||||||
|
|
||||||
PAGE "Riga disponibilità" -1 -1 78 13
|
PAGE "Riga disponibilità" -1 -1 78 13
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 76 9
|
GROUPBOX DLG_NULL 76 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "@bRisorsa - Attrezzatura"
|
PROMPT 1 1 "@bRisorsa - Attrezzatura"
|
||||||
END
|
END
|
||||||
@ -209,23 +209,14 @@ BEGIN
|
|||||||
GROUP 2
|
GROUP 2
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER S_ANNO 4
|
DATE S_DATA
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 7 "Anno "
|
PROMPT 2 7 "Data "
|
||||||
FLAGS "AD"
|
|
||||||
END
|
|
||||||
|
|
||||||
LISTBOX S_MESE 10
|
|
||||||
BEGIN
|
|
||||||
PROMPT 22 7 "Mese"
|
|
||||||
ITEM "|"
|
|
||||||
FILED CODTAB[21,2]
|
|
||||||
FLAGS "MD"
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING S_TPORA 2
|
STRING S_TPORA 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 59 7 "Tipo ora "
|
PROMPT 2 8 "Tipo ora "
|
||||||
USE &ORE
|
USE &ORE
|
||||||
INPUT CODTAB S_TPORA
|
INPUT CODTAB S_TPORA
|
||||||
DISPLAY "Codice@16" CODTAB
|
DISPLAY "Codice@16" CODTAB
|
||||||
@ -237,12 +228,18 @@ END
|
|||||||
|
|
||||||
NUMBER S_OREPREV 6
|
NUMBER S_OREPREV 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 8 "Ore a Preventivo "
|
PROMPT 30 8 "Ore a Preventivo "
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER S_ORECONS 6
|
NUMBER S_ORECONS 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 30 8 "Ore a Consuntivo "
|
PROMPT 55 8 "a Consuntivo "
|
||||||
|
END
|
||||||
|
|
||||||
|
DATA S_DATAOR
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 9 "Data "
|
||||||
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
142
ci/ci0600.cpp
142
ci/ci0600.cpp
@ -29,6 +29,7 @@ class TDef_risoatt_msk : public TAutomask
|
|||||||
short _scdc_sid, _scdc_lid;
|
short _scdc_sid, _scdc_lid;
|
||||||
short _scms_sid, _scms_lid;
|
short _scms_sid, _scms_lid;
|
||||||
short _sfase_sid, _sfase_lid;
|
short _sfase_sid, _sfase_lid;
|
||||||
|
TString _dett;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||||
@ -235,19 +236,24 @@ void TDef_risoatt_msk::riempi_sheet()
|
|||||||
{
|
{
|
||||||
TRilevamento_ore rilore(def.cursor()->curr());
|
TRilevamento_ore rilore(def.cursor()->curr());
|
||||||
TToken_string& riga = sheet.row(-1);
|
TToken_string& riga = sheet.row(-1);
|
||||||
riga.add(rilore.tipora(), sheet.cid2index(S_RISOATT));
|
const char tipo = rilore.get(RILORE_TIPORA)[0];
|
||||||
switch(rilore.tipora())
|
TString16 cod = rilore.get(RILORE_CODICE);
|
||||||
|
|
||||||
|
riga.add(tipo, sheet.cid2index(S_RISOATT));
|
||||||
|
switch(tipo)
|
||||||
{
|
{
|
||||||
case 'R': riga.add(rilore.codice(), sheet.cid2index(S_CODRIS)); break;
|
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
|
||||||
case 'A': riga.add(rilore.codice(), sheet.cid2index(S_CODATT)); break;
|
case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
|
||||||
default : break;
|
default : break;
|
||||||
}
|
}
|
||||||
riga.add(rilore.anno(), sheet.cid2index(S_ANNO));
|
TDate d(rilore.get_int(RILORE_GIORNO), rilore.get_int(RILORE_MESE), rilore.get_int(RILORE_ANNO));
|
||||||
riga.add(rilore.mese(), sheet.cid2index(S_MESE));
|
|
||||||
riga.add(rilore.tpora(), sheet.cid2index(S_TPORA));
|
riga.add(d.string(), sheet.cid2index(S_DATA));
|
||||||
put_row_anal_fields(riga, rilore.codcosto(), rilore.codcms(), rilore.codfase());
|
riga.add(rilore.get(RILORE_TPORA), sheet.cid2index(S_TPORA));
|
||||||
riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
|
put_row_anal_fields(riga, rilore.get(RILORE_CODCOSTO), rilore.get(RILORE_CODCMS), rilore.get(RILORE_CODFASE));
|
||||||
riga.add(rilore.costo().string(), sheet.cid2index(S_COSTO));
|
riga.add(rilore.get(RILORE_QTAORE), sheet.cid2index(S_QTAORE));
|
||||||
|
riga.add(rilore.get(RILORE_COSTO), sheet.cid2index(S_COSTO));
|
||||||
|
riga.add(rilore.get(RILORE_ID), sheet.cid2index(S_ID));
|
||||||
sheet.check_row(sheet.items() - 1);
|
sheet.check_row(sheet.items() - 1);
|
||||||
}
|
}
|
||||||
sheet.force_update();
|
sheet.force_update();
|
||||||
@ -282,8 +288,18 @@ void TDef_risoatt_msk::nuova_riga()
|
|||||||
else
|
else
|
||||||
riga.add(get(F_CODATT), sheet.cid2index(S_CODATT));
|
riga.add(get(F_CODATT), sheet.cid2index(S_CODATT));
|
||||||
}
|
}
|
||||||
riga.add(anno, sheet.cid2index(S_ANNO));
|
|
||||||
riga.add(mese, sheet.cid2index(S_MESE));
|
TDate data;
|
||||||
|
|
||||||
|
if (anno == 0)
|
||||||
|
data = TDate(TODAY);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.set_day(1);
|
||||||
|
data.set_month(mese == 0 ? 1 : mese);
|
||||||
|
data.set_year(anno);
|
||||||
|
}
|
||||||
|
riga.add(data.string(), sheet.cid2index(S_DATA));
|
||||||
riga.add(tpora, sheet.cid2index(S_TPORA));
|
riga.add(tpora, sheet.cid2index(S_TPORA));
|
||||||
get_anal_fields(codcosto, codcms, codfase);
|
get_anal_fields(codcosto, codcms, codfase);
|
||||||
put_row_anal_fields(riga, codcosto, codcms, codfase);
|
put_row_anal_fields(riga, codcosto, codcms, codfase);
|
||||||
@ -293,8 +309,6 @@ void TDef_risoatt_msk::nuova_riga()
|
|||||||
msk.enable(S_CODRIS);
|
msk.enable(S_CODRIS);
|
||||||
if (tutti || tipo == "A")
|
if (tutti || tipo == "A")
|
||||||
msk.enable(S_CODATT);
|
msk.enable(S_CODATT);
|
||||||
msk.enable(S_ANNO, anno == 0);
|
|
||||||
msk.enable(S_MESE, mese == 0);
|
|
||||||
msk.enable(S_TPORA, tpora.empty());
|
msk.enable(S_TPORA, tpora.empty());
|
||||||
if (_scdc_sid >= 0)
|
if (_scdc_sid >= 0)
|
||||||
for ( short id = _scdc_sid; id <= _scdc_lid; id++)
|
for ( short id = _scdc_sid; id <= _scdc_lid; id++)
|
||||||
@ -353,9 +367,12 @@ void TDef_risoatt_msk::registra()
|
|||||||
TToken_string& riga = *(TToken_string*)row;
|
TToken_string& riga = *(TToken_string*)row;
|
||||||
const char tipora = riga.get_char(sheet.cid2index(S_RISOATT));
|
const char tipora = riga.get_char(sheet.cid2index(S_RISOATT));
|
||||||
const TString16 codice = tipora == 'R' ? riga.get(sheet.cid2index(S_CODRIS)) : riga.get(sheet.cid2index(S_CODATT));
|
const TString16 codice = tipora == 'R' ? riga.get(sheet.cid2index(S_CODRIS)) : riga.get(sheet.cid2index(S_CODATT));
|
||||||
const int anno = riga.get_int(sheet.cid2index(S_ANNO));
|
TDate d(riga.get(sheet.cid2index(S_DATA)));
|
||||||
const int mese = riga.get_int(sheet.cid2index(S_MESE));
|
const int anno = d.year();
|
||||||
|
const int mese = d.month();
|
||||||
|
const int giorno = d.day();
|
||||||
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
|
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
|
||||||
|
const long id = riga.get_long(sheet.cid2index(S_ID));
|
||||||
TString80 codcosto;
|
TString80 codcosto;
|
||||||
TString80 codcms;
|
TString80 codcms;
|
||||||
TString80 codfase;
|
TString80 codfase;
|
||||||
@ -365,17 +382,28 @@ void TDef_risoatt_msk::registra()
|
|||||||
|
|
||||||
get_row_anal_fields(riga, codcosto, codcms, codfase);
|
get_row_anal_fields(riga, codcosto, codcms, codfase);
|
||||||
|
|
||||||
rilroa.read('D', anno, mese, 0, tipora, codice, tpora, codcosto, codcms, codfase);
|
rilroa.read('D', id);
|
||||||
if (qtaore == 0)
|
if (qtaore == 0)
|
||||||
rilroa.remove();
|
rilroa.remove();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rilroa.set_qtaore(qtaore);
|
rilroa.put(RILORE_ANNO, anno);
|
||||||
rilroa.set_costo(costo);
|
rilroa.put(RILORE_MESE, mese);
|
||||||
|
rilroa.put(RILORE_GIORNO, giorno);
|
||||||
int err = rilroa.rewrite_write();
|
rilroa.put(RILORE_TIPORA, tipora);
|
||||||
|
rilroa.put(RILORE_CODICE, codice);
|
||||||
|
rilroa.put(RILORE_TPORA, tpora);
|
||||||
|
rilroa.put(RILORE_CODCOSTO, codcosto);
|
||||||
|
rilroa.put(RILORE_CODCMS, codcms);
|
||||||
|
rilroa.put(RILORE_CODFASE, codfase);
|
||||||
|
rilroa.put(RILORE_QTAORE, qtaore);
|
||||||
|
rilroa.put(RILORE_COSTO, costo);
|
||||||
|
rilroa.put(RILORE_ID, id);
|
||||||
|
rilroa.rewrite_write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sheet.destroy();
|
||||||
|
riempi_sheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
|
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
|
||||||
@ -452,7 +480,61 @@ bool TDef_risoatt_msk::on_field_event(TOperable_field& f, TField_event e, long j
|
|||||||
{
|
{
|
||||||
send_key(K_SPACE, DLG_NEWREC);
|
send_key(K_SPACE, DLG_NEWREC);
|
||||||
return false;
|
return false;
|
||||||
} default: break;
|
}
|
||||||
|
case S_DATA:
|
||||||
|
if (e == fe_modify)
|
||||||
|
{
|
||||||
|
TDate d(f.get());
|
||||||
|
TSheet_field& sheet = sfield(F_SHEET);
|
||||||
|
|
||||||
|
if (_dett == "A")
|
||||||
|
d.set_month(1);
|
||||||
|
d.set_day(1);
|
||||||
|
f.set(d.string());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (e == se_leave)
|
||||||
|
{
|
||||||
|
TSheet_field& sheet = sfield(F_SHEET);
|
||||||
|
TToken_string & curr_row = sheet.row(jolly);
|
||||||
|
TDate d(curr_row.get(sheet.cid2index(S_DATA)));
|
||||||
|
TString80 codcosto;
|
||||||
|
TString80 codcms;
|
||||||
|
TString80 codfase;
|
||||||
|
const TString4 tipo = curr_row.get(sheet.cid2index(S_RISOATT));
|
||||||
|
const bool risorsa = tipo == "R";
|
||||||
|
const short idcod = risorsa ? S_CODRIS : S_CODATT;
|
||||||
|
|
||||||
|
get_row_anal_fields(curr_row, codcosto, codcms, codfase);
|
||||||
|
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||||
|
{
|
||||||
|
if (r != jolly && tipo == row->get(sheet.cid2index(S_RISOATT)))
|
||||||
|
{
|
||||||
|
const TString cod = curr_row.get(sheet.cid2index(idcod));
|
||||||
|
if ( cod == row->get(sheet.cid2index(idcod)))
|
||||||
|
{
|
||||||
|
TString tpora = curr_row.get(sheet.cid2index(S_TPORA));
|
||||||
|
|
||||||
|
if ( tpora == row->get(sheet.cid2index(S_TPORA)))
|
||||||
|
{
|
||||||
|
TString80 codcostor;
|
||||||
|
TString80 codcmsr;
|
||||||
|
TString80 codfaser;
|
||||||
|
|
||||||
|
get_row_anal_fields(*row, codcostor, codcmsr, codfaser);
|
||||||
|
if (codcostor == codcosto && codcmsr == codcms && codfaser == codfase)
|
||||||
|
{
|
||||||
|
TDate dr(row->get(sheet.cid2index(S_DATA)));
|
||||||
|
if (dr == d)
|
||||||
|
return error_box(FR("La risorsa %s alla data %s esiste già alla riga %d"), (const char *)cod,(const char *) d.string(), r + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -588,6 +670,22 @@ TDef_risoatt_msk::TDef_risoatt_msk()
|
|||||||
s.delete_column(id);
|
s.delete_column(id);
|
||||||
}
|
}
|
||||||
_qtaore = 0;
|
_qtaore = 0;
|
||||||
|
_dett = ini_get_string(CONFIG_DITTA, "ci", "DETTCONS", "G");
|
||||||
|
|
||||||
|
if (_dett == "A")
|
||||||
|
{
|
||||||
|
field(F_ANNO).update_flags("A", true);
|
||||||
|
reset(F_ANNO);
|
||||||
|
disable(F_ANNO);
|
||||||
|
reset(F_MESE);
|
||||||
|
disable(F_MESE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (_dett == "M")
|
||||||
|
{
|
||||||
|
reset(F_MESE);
|
||||||
|
disable(F_MESE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
38
ci/ci0600a.h
38
ci/ci0600a.h
@ -16,23 +16,23 @@
|
|||||||
|
|
||||||
#define S_RISOATT 101
|
#define S_RISOATT 101
|
||||||
#define S_CODRIS 102
|
#define S_CODRIS 102
|
||||||
#define S_DESRIS 120
|
#define S_DESRIS 119
|
||||||
#define S_CODATT 202
|
#define S_CODATT 202
|
||||||
#define S_DESATT 220
|
#define S_DESATT 219
|
||||||
#define S_ANNO 103
|
#define S_DATA 103
|
||||||
#define S_MESE 104
|
#define S_TPORA 104
|
||||||
#define S_TPORA 105
|
#define S_CDC1 105
|
||||||
#define S_CDC1 106
|
#define S_CDC2 106
|
||||||
#define S_CDC2 107
|
#define S_CDC3 107
|
||||||
#define S_CDC3 108
|
#define S_CDC4 108
|
||||||
#define S_CDC4 109
|
#define S_CDC5 109
|
||||||
#define S_CDC5 110
|
#define S_CDC6 110
|
||||||
#define S_CDC6 111
|
#define S_CDC7 111
|
||||||
#define S_CDC7 112
|
#define S_CDC8 112
|
||||||
#define S_CDC8 113
|
#define S_CDC9 113
|
||||||
#define S_CDC9 114
|
#define S_CDC10 114
|
||||||
#define S_CDC10 115
|
#define S_CDC11 115
|
||||||
#define S_CDC11 116
|
#define S_CDC12 116
|
||||||
#define S_CDC12 117
|
#define S_QTAORE 117
|
||||||
#define S_QTAORE 118
|
#define S_COSTO 118
|
||||||
#define S_COSTO 119
|
#define S_ID 120
|
@ -119,8 +119,7 @@ BEGIN
|
|||||||
PROMPT 1 7 ""
|
PROMPT 1 7 ""
|
||||||
ITEM "Tipo"
|
ITEM "Tipo"
|
||||||
ITEM "Codice@16"
|
ITEM "Codice@16"
|
||||||
ITEM "Anno"
|
ITEM "Data@10"
|
||||||
ITEM "Mese"
|
|
||||||
ITEM "Tipo\nOra@5"
|
ITEM "Tipo\nOra@5"
|
||||||
ITEM "CDC1"
|
ITEM "CDC1"
|
||||||
ITEM "CDC2"
|
ITEM "CDC2"
|
||||||
@ -137,6 +136,7 @@ BEGIN
|
|||||||
ITEM "Qta\nOre@5"
|
ITEM "Qta\nOre@5"
|
||||||
ITEM "Costo@10"
|
ITEM "Costo@10"
|
||||||
ITEM "Descrizione@50"
|
ITEM "Descrizione@50"
|
||||||
|
ITEM "ID@8"
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
@ -203,17 +203,9 @@ BEGIN
|
|||||||
GROUP 2
|
GROUP 2
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER S_ANNO 4
|
DATE S_DATA
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 7 "Anno "
|
PROMPT 2 7 "Data "
|
||||||
CHECKTYPE REQUIRED
|
|
||||||
FLAGS "AD"
|
|
||||||
END
|
|
||||||
|
|
||||||
LISTBOX S_MESE 10
|
|
||||||
BEGIN
|
|
||||||
PROMPT 22 7 "Mese"
|
|
||||||
FLAGS "MD"
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING S_TPORA 2
|
STRING S_TPORA 2
|
||||||
@ -310,6 +302,12 @@ BEGIN
|
|||||||
PROMPT 30 11 "Prezzo "
|
PROMPT 30 11 "Prezzo "
|
||||||
END
|
END
|
||||||
|
|
||||||
|
NUMBER S_ID 8
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 12 "ID "
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
TOOLBAR "" 0 0 0 2
|
TOOLBAR "" 0 0 0 2
|
||||||
|
291
ci/cilib.cpp
291
ci/cilib.cpp
@ -533,17 +533,39 @@ const TString& TRisoatt_key::mese() const
|
|||||||
return mid(21, 2);
|
return mid(21, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TString& TRisoatt_key::giorno() const
|
||||||
|
{
|
||||||
|
return mid(23, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& TRisoatt_key::data() const
|
||||||
|
{
|
||||||
|
TDate d(mid(17, 8));
|
||||||
|
TString & str = get_tmp_string(12);
|
||||||
|
|
||||||
|
str = d.string(ANSI);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
//TPORA: metodo che restituisce il tipo dell'ora a cui fa riferimento la risorsa o l'attrezzatura
|
//TPORA: metodo che restituisce il tipo dell'ora a cui fa riferimento la risorsa o l'attrezzatura
|
||||||
const TString& TRisoatt_key::tpora() const
|
const TString& TRisoatt_key::tpora() const
|
||||||
{
|
{
|
||||||
return right(2);
|
return right(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRisoatt_key::TRisoatt_key(const char risoatt, const char* codice, const int anno, const char* mese, const char* tpora)
|
TRisoatt_key::TRisoatt_key(const char risoatt, const char* codice, const int anno, const char* mese, const char* giorno, const char* tpora)
|
||||||
{
|
{
|
||||||
TString16 cod = codice; cod.left_just(16);
|
TString16 cod = codice; cod.left_just(16);
|
||||||
|
|
||||||
TString chiave; chiave << risoatt << cod << anno << mese << tpora;
|
TString chiave; chiave << risoatt << cod << anno << mese << giorno << tpora;
|
||||||
|
set(chiave);
|
||||||
|
}
|
||||||
|
|
||||||
|
TRisoatt_key::TRisoatt_key(const char risoatt, const char* codice, const TDate & date, const char* tpora)
|
||||||
|
{
|
||||||
|
TString16 cod = codice; cod.left_just(16);
|
||||||
|
|
||||||
|
TString chiave; chiave << risoatt << cod << date.string(ANSI) << tpora;
|
||||||
set(chiave);
|
set(chiave);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,9 +635,18 @@ const TString& TDisp_risoatt::chiave() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//DESCR: metodo che restituisce la descrizione contenuta nella tabella di modulo
|
//DESCR: metodo che restituisce la descrizione contenuta nella tabella di modulo
|
||||||
const TString& TDisp_risoatt::descr() const
|
const long TDisp_risoatt::id() const
|
||||||
{
|
{
|
||||||
return get("S0");
|
return get_long("S0");
|
||||||
|
}
|
||||||
|
//DESCR: metodo che restituisce la descrizione contenuta nella tabella di modulo
|
||||||
|
void TDisp_risoatt::set_id(long id)
|
||||||
|
{
|
||||||
|
TString & idstr = get_tmp_string(12);
|
||||||
|
|
||||||
|
idstr << id;
|
||||||
|
idstr.lpad('0');
|
||||||
|
put("S0", idstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//VALUNI: metodo che restituisce il valore unitario contenuto nella tabella di modulo
|
//VALUNI: metodo che restituisce il valore unitario contenuto nella tabella di modulo
|
||||||
@ -642,10 +673,48 @@ TDisp_risoatt::TDisp_risoatt(const TRectype& r)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
//READ: cerca una riga rilevamento ore in base alla chiave primaria
|
//READ: cerca una riga rilevamento ore in base alla chiave primaria
|
||||||
|
int TRilevamento_ore::read(const char tipo, const long id, TReclock lock)
|
||||||
|
{
|
||||||
|
TLocalisamfile rilore(LF_RILORE);
|
||||||
|
int err = _iskeynotfound;
|
||||||
|
|
||||||
|
zero();
|
||||||
|
if (id > 0L)
|
||||||
|
{
|
||||||
|
put(RILORE_TIPO, tipo);
|
||||||
|
put(RILORE_ID, id);
|
||||||
|
while ((err = TRectype::read(rilore,_isequal, lock)) == _islocked)
|
||||||
|
if (!yesno_box("Dati in uso da parte di un altro utente"))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (err != NOERR)
|
||||||
|
{
|
||||||
|
long id = 0L;
|
||||||
|
zero();
|
||||||
|
put(RILORE_TIPO, tipo);
|
||||||
|
put(RILORE_ID, 99999999L);
|
||||||
|
int err1 = TRectype::read(rilore,_isequal);
|
||||||
|
|
||||||
|
if (err1 != _isemptyfile)
|
||||||
|
{
|
||||||
|
if (err1 != _iseof && err1 != _isbof)
|
||||||
|
rilore.prev();
|
||||||
|
if (tipo == rilore.get_char(RILORE_TIPO))
|
||||||
|
id = rilore.get_long(RILORE_ID);
|
||||||
|
}
|
||||||
|
id++;
|
||||||
|
put(RILORE_TIPO, tipo);
|
||||||
|
put(RILORE_ID, id);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
TLocalisamfile rilore(LF_RILORE);
|
TLocalisamfile rilore(LF_RILORE);
|
||||||
|
int err = NOERR;
|
||||||
|
|
||||||
|
rilore.setkey(2);
|
||||||
zero();
|
zero();
|
||||||
put(RILORE_TIPO, tipo);
|
put(RILORE_TIPO, tipo);
|
||||||
put(RILORE_ANNO, anno);
|
put(RILORE_ANNO, anno);
|
||||||
@ -657,24 +726,61 @@ int TRilevamento_ore::read(const char tipo, const int anno, const int mese, cons
|
|||||||
put(RILORE_CODCOSTO, codcosto);
|
put(RILORE_CODCOSTO, codcosto);
|
||||||
put(RILORE_CODCMS, codcms);
|
put(RILORE_CODCMS, codcms);
|
||||||
put(RILORE_CODFASE, codfase);
|
put(RILORE_CODFASE, codfase);
|
||||||
|
|
||||||
TRectype saverec(*this);
|
TRectype saverec(*this);
|
||||||
|
|
||||||
int err = NOERR;
|
|
||||||
while ((err = TRectype::read(rilore,_isequal, lock)) == _islocked)
|
while ((err = TRectype::read(rilore,_isequal, lock)) == _islocked)
|
||||||
if (!yesno_box("Dati in uso da parte di un altro utente"))
|
if (!yesno_box("Dati in uso da parte di un altro utente"))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
|
{
|
||||||
|
long id = 0L;
|
||||||
|
zero();
|
||||||
|
put(RILORE_TIPO, tipo);
|
||||||
|
put(RILORE_ID, 99999999L);
|
||||||
|
int err1 = TRectype::read(rilore,_isequal);
|
||||||
|
|
||||||
|
if (err1 != _isemptyfile)
|
||||||
|
{
|
||||||
|
if (err1 != _iseof && err1 != _isbof)
|
||||||
|
rilore.prev();
|
||||||
|
if (tipo == rilore.get_char(RILORE_TIPO))
|
||||||
|
id = rilore.get_long(RILORE_ID);
|
||||||
|
}
|
||||||
|
id++;
|
||||||
*this = saverec;
|
*this = saverec;
|
||||||
|
put(RILORE_ID, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
rilore.setkey(1);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TRilevamento_ore::update_id()
|
||||||
|
{
|
||||||
|
if (get_long(RILORE_ID) == 0L)
|
||||||
|
{
|
||||||
|
long id = 0;
|
||||||
|
TLocalisamfile rilore(LF_RILORE);
|
||||||
|
const TString4 tipo = get(RILORE_TIPO);
|
||||||
|
|
||||||
|
rilore.put(RILORE_TIPO, tipo);
|
||||||
|
rilore.put(RILORE_ID, 999999999L);
|
||||||
|
|
||||||
|
if (rilore.read() != _isemptyfile && rilore.get(RILORE_TIPO) == tipo)
|
||||||
|
id = rilore.get_long(RILORE_ID);
|
||||||
|
put(RILORE_ID, ++id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int TRilevamento_ore::write_rewrite()
|
int TRilevamento_ore::write_rewrite()
|
||||||
{
|
{
|
||||||
if (!empty())
|
if (!empty())
|
||||||
{
|
{
|
||||||
TLocalisamfile rilore(LF_RILORE);
|
TLocalisamfile rilore(LF_RILORE);
|
||||||
|
|
||||||
|
update_id();
|
||||||
return TRectype::write_rewrite(rilore);
|
return TRectype::write_rewrite(rilore);
|
||||||
}
|
}
|
||||||
return _iskeynotfound;
|
return _iskeynotfound;
|
||||||
@ -686,6 +792,7 @@ int TRilevamento_ore::rewrite_write()
|
|||||||
{
|
{
|
||||||
TLocalisamfile rilore(LF_RILORE);
|
TLocalisamfile rilore(LF_RILORE);
|
||||||
|
|
||||||
|
update_id();
|
||||||
return TRectype::rewrite_write(rilore);
|
return TRectype::rewrite_write(rilore);
|
||||||
}
|
}
|
||||||
return _iskeynotfound;
|
return _iskeynotfound;
|
||||||
@ -702,174 +809,6 @@ int TRilevamento_ore::remove()
|
|||||||
return _iskeynotfound;
|
return _iskeynotfound;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TIPO: indica se si tratta di una riga di <D>efault, <P>reventivo o <C>onsuntivo
|
|
||||||
const char TRilevamento_ore::tipo() const
|
|
||||||
{
|
|
||||||
return get(RILORE_TIPO)[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
//TIPORA: indica se si tratta din una <R>isorsa o di una <A>ttrezzatura
|
|
||||||
const char TRilevamento_ore::tipora() const
|
|
||||||
{
|
|
||||||
return get(RILORE_TIPORA)[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
//CODICE: restiruisce il codice della risorsa o dell'attrezzatura
|
|
||||||
const TString& TRilevamento_ore::codice() const
|
|
||||||
{
|
|
||||||
return get(RILORE_CODICE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//ANNO: restituisce l'anno a cui fa riferimento la riga
|
|
||||||
const int TRilevamento_ore::anno() const
|
|
||||||
{
|
|
||||||
return get_int(RILORE_ANNO);
|
|
||||||
}
|
|
||||||
|
|
||||||
//MESE: restituisce il mese a cui fa riferimento la riga
|
|
||||||
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
|
|
||||||
{
|
|
||||||
return get_int(RILORE_GIORNO);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TPORA: restituisce il tipo ora
|
|
||||||
const TString& TRilevamento_ore::tpora() const
|
|
||||||
{
|
|
||||||
return get(RILORE_TPORA);
|
|
||||||
}
|
|
||||||
|
|
||||||
//CODCOSTO: restituisce il codice del centro di costo
|
|
||||||
const TString& TRilevamento_ore::codcosto() const
|
|
||||||
{
|
|
||||||
return get(RILORE_CODCOSTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
//CODCMS: restituisce il codice commessa
|
|
||||||
const TString& TRilevamento_ore::codcms() const
|
|
||||||
{
|
|
||||||
return get(RILORE_CODCMS);
|
|
||||||
}
|
|
||||||
|
|
||||||
//CODFASE: restituisce il codice della fase
|
|
||||||
const TString& TRilevamento_ore::codfase() const
|
|
||||||
{
|
|
||||||
return get(RILORE_CODFASE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//DADATA: restituisce la data di inizio validità della riga
|
|
||||||
const TDate TRilevamento_ore::dadata() const
|
|
||||||
{
|
|
||||||
return get_date(RILORE_DADATA);
|
|
||||||
}
|
|
||||||
|
|
||||||
//ADATA: restituisce la fata di fine validità della riga
|
|
||||||
const TDate TRilevamento_ore::adata()const
|
|
||||||
{
|
|
||||||
return get_date(RILORE_ADATA);
|
|
||||||
}
|
|
||||||
|
|
||||||
//QTAORE: restituisce il numero di ore
|
|
||||||
const int TRilevamento_ore::qtaore() const
|
|
||||||
{
|
|
||||||
return get_int(RILORE_QTAORE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//COSTO: restitusce il costo unitario
|
|
||||||
const real TRilevamento_ore::costo() const
|
|
||||||
{
|
|
||||||
return get_real(RILORE_COSTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_TIPO: setta <D>efault, <P>reventivo o <C>onsuntivo
|
|
||||||
void TRilevamento_ore::set_tipo(const char tipo)
|
|
||||||
{
|
|
||||||
put(RILORE_TIPO, tipo);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_TIPORA: setta <R>isorsa o <A>ttrezzatura
|
|
||||||
void TRilevamento_ore::set_tipora(const char tipora)
|
|
||||||
{
|
|
||||||
put(RILORE_TIPORA, tipora);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_CODICE: setta il codice
|
|
||||||
void TRilevamento_ore::set_codice(const char* codice)
|
|
||||||
{
|
|
||||||
put(RILORE_CODICE, codice);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_ANNO: setta l'anno di riferimento
|
|
||||||
void TRilevamento_ore::set_anno(const int anno)
|
|
||||||
{
|
|
||||||
put(RILORE_ANNO, anno);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_MESE: setta il mese di riferimento
|
|
||||||
void TRilevamento_ore::set_mese(const int mese)
|
|
||||||
{
|
|
||||||
put(RILORE_MESE, mese);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_GIORNO: setta il giorno di riferimento
|
|
||||||
void TRilevamento_ore::set_giorno(const int giorno)
|
|
||||||
{
|
|
||||||
put(RILORE_GIORNO, giorno);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_TPORA: setta il tipo ora
|
|
||||||
void TRilevamento_ore::set_tpora(const char* tpora)
|
|
||||||
{
|
|
||||||
put(RILORE_TPORA, tpora);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_CODCOSTO: setta il codice del centro di costo
|
|
||||||
void TRilevamento_ore::set_codcosto(const char* codcosto)
|
|
||||||
{
|
|
||||||
put(RILORE_CODCOSTO, codcosto);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_CODCMS: setta il codice commessa
|
|
||||||
void TRilevamento_ore::set_codcms(const char* codcms)
|
|
||||||
{
|
|
||||||
put(RILORE_CODCMS, codcms);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_CODFASE: setta il codice della fase
|
|
||||||
void TRilevamento_ore::set_codfase(const char* codfase)
|
|
||||||
{
|
|
||||||
put(RILORE_CODFASE, codfase);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_DADATA: setta la data di inizio validità della riga
|
|
||||||
void TRilevamento_ore::set_dadata(const TDate& dadata)
|
|
||||||
{
|
|
||||||
put(RILORE_DADATA, dadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_ADATA: setta la data di fine validità della riga
|
|
||||||
void TRilevamento_ore::set_adata(const TDate& adata)
|
|
||||||
{
|
|
||||||
put(RILORE_ADATA, adata);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_QTAORE: setta il numero di ore rilevato
|
|
||||||
void TRilevamento_ore::set_qtaore(const int qtaore)
|
|
||||||
{
|
|
||||||
put(RILORE_QTAORE, qtaore);
|
|
||||||
}
|
|
||||||
|
|
||||||
//SET_COSTO: metodo che setta il costo unitario (da listino)
|
|
||||||
void TRilevamento_ore::set_costo(const real& costo)
|
|
||||||
{
|
|
||||||
put(RILORE_COSTO, costo);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Metodi costruttori
|
//Metodi costruttori
|
||||||
TRilevamento_ore::TRilevamento_ore(const TRectype& rec)
|
TRilevamento_ore::TRilevamento_ore(const TRectype& rec)
|
||||||
: TRectype(rec)
|
: TRectype(rec)
|
||||||
@ -881,6 +820,12 @@ TRilevamento_ore::TRilevamento_ore(const TRilevamento_ore& rilore)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRilevamento_ore::TRilevamento_ore(const char tipo, const long id)
|
||||||
|
: TRectype(LF_RILORE)
|
||||||
|
{
|
||||||
|
read(tipo, id);
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
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)
|
||||||
: TRectype(LF_RILORE)
|
: TRectype(LF_RILORE)
|
||||||
{
|
{
|
||||||
|
41
ci/cilib.h
41
ci/cilib.h
@ -160,10 +160,13 @@ public:
|
|||||||
const TString& cod() const;
|
const TString& cod() const;
|
||||||
const int anno() const;
|
const int anno() const;
|
||||||
const TString& mese() const;
|
const TString& mese() const;
|
||||||
|
const TString& giorno() const;
|
||||||
const TString& tpora() const;
|
const TString& tpora() const;
|
||||||
|
const TString& data() const;
|
||||||
|
|
||||||
//costruttore
|
//costruttore
|
||||||
TRisoatt_key(const char risoatt, const char* codice, const int anno, const char* mese, const char* tpora);
|
TRisoatt_key(const char risoatt, const char* codice, const int anno, const char* mese, const char * giorno, const char* tpora);
|
||||||
|
TRisoatt_key(const char risoatt, const char* codice, const TDate & data, const char* tpora);
|
||||||
TRisoatt_key(const char* roakey);
|
TRisoatt_key(const char* roakey);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -202,10 +205,11 @@ public:
|
|||||||
TDisp_risoatt & operator =(const TDisp_risoatt& ris) { return *this; }
|
TDisp_risoatt & operator =(const TDisp_risoatt& ris) { return *this; }
|
||||||
|
|
||||||
const TString& chiave() const;
|
const TString& chiave() const;
|
||||||
const TString& descr() const;
|
const long id() const;
|
||||||
const int ore_prev() const;
|
const int ore_prev() const;
|
||||||
const int ore_cons() const;
|
const int ore_cons() const;
|
||||||
|
|
||||||
|
void set_id(long id);
|
||||||
//costruttore
|
//costruttore
|
||||||
TDisp_risoatt(const TRectype& r);
|
TDisp_risoatt(const TRectype& r);
|
||||||
|
|
||||||
@ -222,45 +226,18 @@ class TRilevamento_ore : public TRectype
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
int read(const char tipo, const long id, TReclock lock = _nolock);
|
||||||
int 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 = _nolock);
|
int 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 = _nolock);
|
||||||
int remove();
|
int remove();
|
||||||
|
void update_id();
|
||||||
int write_rewrite();
|
int write_rewrite();
|
||||||
int rewrite_write();
|
int rewrite_write();
|
||||||
|
|
||||||
const TRilevamento_ore & operator =(const TRilevamento_ore & rilore) { TRectype::operator =(rilore); return *this; }
|
const TRilevamento_ore & operator =(const TRilevamento_ore & rilore) { TRectype::operator =(rilore); return *this; }
|
||||||
|
|
||||||
const char tipo() const;
|
|
||||||
const char tipora() const;
|
|
||||||
const TString& codice() const;
|
|
||||||
const int anno() const;
|
|
||||||
const int mese() const;
|
|
||||||
const int giorno() const;
|
|
||||||
const TString& tpora() const;
|
|
||||||
const TString& codcosto() const;
|
|
||||||
const TString& codcms() const;
|
|
||||||
const TString& codfase() const;
|
|
||||||
const TDate dadata() const;
|
|
||||||
const TDate adata() const;
|
|
||||||
const int qtaore() const;
|
|
||||||
const real costo() const;
|
|
||||||
|
|
||||||
void set_tipo(const char tipo);
|
|
||||||
void set_tipora(const char tipora);
|
|
||||||
void set_codice(const char* codice);
|
|
||||||
void set_anno(const int anno);
|
|
||||||
void set_mese(int mese);
|
|
||||||
void set_giorno(int giorno);
|
|
||||||
void set_tpora(const char* tpora);
|
|
||||||
void set_codcosto(const char* codcosto);
|
|
||||||
void set_codcms(const char* codcms);
|
|
||||||
void set_codfase(const char* codfase);
|
|
||||||
void set_dadata(const TDate& dadata);
|
|
||||||
void set_adata(const TDate& adata);
|
|
||||||
void set_qtaore(const int qtaore);
|
|
||||||
void set_costo(const real& costo);
|
|
||||||
|
|
||||||
TRilevamento_ore(const TRectype& rec);
|
TRilevamento_ore(const TRectype& rec);
|
||||||
TRilevamento_ore(const TRilevamento_ore& rilore);
|
TRilevamento_ore(const TRilevamento_ore& rilore);
|
||||||
|
TRilevamento_ore(const char tipo, const long id);
|
||||||
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);
|
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);
|
||||||
TRilevamento_ore();
|
TRilevamento_ore();
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
125
|
125
|
||||||
0
|
0
|
||||||
$rilore|0|0|125|0|Rilevamento Ore|||
|
$rilore|17|17|133|0|Rilevamento Ore|||
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
125
|
125
|
||||||
18
|
19
|
||||||
TIPO|1|1|0|<D>efault <P>reventivo <C>onsuntivo
|
TIPO|1|1|0|<D>efault <P>reventivo <C>onsuntivo
|
||||||
|
ID|3|8|0|Id del record
|
||||||
TIPORA|1|1|0|<R>isorsa <A>ttrezzatura
|
TIPORA|1|1|0|<R>isorsa <A>ttrezzatura
|
||||||
CODICE|1|16|0|Codice Risorsa o Attrezzatura
|
CODICE|1|16|0|Codice Risorsa o Attrezzatura
|
||||||
ANNO|9|4|0|Anno
|
ANNO|9|4|0|Anno
|
||||||
@ -18,7 +19,8 @@ DPROVV|1|1|0|Chiave doc - <P>rovvisorio o <D>efionitivo
|
|||||||
DANNO|2|4|0|Chiave doc - Anno
|
DANNO|2|4|0|Chiave doc - Anno
|
||||||
DCODNUM|2|4|0|Chiave doc - Codnum
|
DCODNUM|2|4|0|Chiave doc - Codnum
|
||||||
DNDOC|2|7|0|Chiave doc - ndoc
|
DNDOC|2|7|0|Chiave doc - ndoc
|
||||||
3
|
4
|
||||||
TIPO+ANNO+MESE+GIORNO+TIPORA+CODICE+TPORA+CODCOSTO+CODCMS+CODFASE|
|
TIPO+ID|
|
||||||
|
TIPO+ANNO+MESE+GIORNO+TIPORA+CODICE+TPORA+CODCOSTO+CODCMS+CODFASE|X
|
||||||
TIPO+TIPORA+CODICE+ANNO+MESE+GIORNO+TPORA+CODCOSTO+CODCMS+CODFASE|X
|
TIPO+TIPORA+CODICE+ANNO+MESE+GIORNO+TPORA+CODCOSTO+CODCMS+CODFASE|X
|
||||||
TIPO+CODCOSTO+CODCMS+CODFASE|X
|
TIPO+CODCOSTO+CODCMS+CODFASE|X
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define __RILORE_H
|
#define __RILORE_H
|
||||||
|
|
||||||
#define RILORE_TIPO "TIPO"
|
#define RILORE_TIPO "TIPO"
|
||||||
|
#define RILORE_ID "ID"
|
||||||
#define RILORE_TIPORA "TIPORA"
|
#define RILORE_TIPORA "TIPORA"
|
||||||
#define RILORE_CODICE "CODICE"
|
#define RILORE_CODICE "CODICE"
|
||||||
#define RILORE_ANNO "ANNO"
|
#define RILORE_ANNO "ANNO"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user