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:
alex 2010-11-12 01:29:02 +00:00
parent 284f979191
commit e654ec5ec7
15 changed files with 460 additions and 341 deletions

View File

@ -228,7 +228,7 @@ void TRisoatt_msk::registra()
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);
chiave << anme;
chiave << anme << "01"; // giorno
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 real valuni(riga.get(sheet.cid2index(S_VALUNI)));

View File

@ -165,6 +165,8 @@ void TConfigurazioneIndustriale_app::file_to_sheet()
mask().sheet().check_row(item);
item++;
}
mask().set(F_DETTDISP, configfile.get("DETTDISP"));
mask().set(F_DETTCONS, configfile.get("DETTCONS"));
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);
totlen+=currdesc.len();
}
configfile.set("DETTDISP", mask().get(F_DETTDISP));
configfile.set("DETTCONS", mask().get(F_DETTCONS));
if (totlen>_maxlen)
message_box("E' probabile che la lunghezza delle descrizioni inserite ne impedisca la totale visualizzazione sullo schermo");

View File

@ -5,7 +5,6 @@
#define F_MOVEUP 152
#define F_MOVEDN 153
#define F_DETTDISP 154
#define F_DETTPREV 155
#define F_DETTCONS 156
#define FR_FILTRO 101

View File

@ -55,18 +55,9 @@ BEGIN
FIELD DETTDISP
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
BEGIN
PROMPT 2 6 "Dettaglio Consuntivi "
PROMPT 2 4 "Dettaglio Consuntivi "
ITEM "G|Giorno"
ITEM "M|Mese"
ITEM "A|Anno"

View File

@ -21,11 +21,14 @@ class TDisp_risoatt_msk : public TAutomask
{
int _preventivo;
int _consuntivo;
TString _dett;
protected:
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_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 nuova_riga();
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)
{
TSheet_field& sh = sfield(F_SHEET);
TMask & m = sh.sheet_mask();
if (len <= 0)
len = sh.sheet_mask().field(id).size();
len = m.field(id).size();
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);
return val;
}
@ -116,6 +148,7 @@ void TDisp_risoatt_msk::riempi_sheet()
TDisp_risoatt disp(dra.cursor()->curr());
TRisoatt_key drakey(disp.chiave());
TToken_string& riga = sheet.row(-1);
const TString4 tipo = drakey.tipo();
riga.add(drakey.tipo(), sheet.cid2index(S_RISOATT));
TString16 cod = drakey.cod();
cod.trim();
@ -125,11 +158,11 @@ void TDisp_risoatt_msk::riempi_sheet()
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
default : break;
}
riga.add(drakey.anno(), sheet.cid2index(S_ANNO));
riga.add(drakey.mese(), sheet.cid2index(S_MESE));
riga.add(drakey.data(), sheet.cid2index(S_DATA));
riga.add(drakey.tpora(), sheet.cid2index(S_TPORA));
riga.add(disp.ore_prev(), sheet.cid2index(S_OREPREV));
riga.add(disp.ore_cons(), sheet.cid2index(S_ORECONS));
riga.add(drakey.data(), sheet.cid2index(S_DATAOR));
sheet.check_row(sheet.items() - 1);
}
@ -159,8 +192,16 @@ void TDisp_risoatt_msk::nuova_riga()
else
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));
sheet.update_mask(r);
msk.enable(S_RISOATT, tutti);
@ -168,8 +209,6 @@ void TDisp_risoatt_msk::nuova_riga()
msk.enable(S_CODRIS);
if (tutti || tipo == "A")
msk.enable(S_CODATT);
msk.enable(S_ANNO, anno == 0);
msk.enable(S_MESE, mese == 0);
msk.enable(S_TPORA, tpora.empty());
//lancio la maschera di riga da compilare
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
void TDisp_risoatt_msk::registra()
{
TLocalisamfile tabmod(LF_TABMOD);
// TLocalisamfile tabmod(LF_TABMOD);
TModule_table tab("&DRA");
TSheet_field& sheet = sfield(F_SHEET);
TString80 chiave;
TString80 key;
TString80 newkey;
FOR_EACH_SHEET_ROW(sheet, r, row)
{
chiave.cut(0);
TToken_string& riga = *(TToken_string*)row;
const TString4 tipo = add_field_to_tab_key(riga, S_RISOATT, 1);
chiave << tipo;
chiave << add_field_to_tab_key(riga, tipo[0] == 'R' ? S_CODRIS : S_CODATT);
const bool risorsa = tipo == "R";
TString8 anme; anme << add_field_to_tab_key(riga, S_ANNO) << add_field_to_tab_key(riga, S_MESE, 2);
chiave << anme;
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));
key = tipo;
key << add_field_to_tab_key(riga, risorsa ? S_CODRIS : S_CODATT)
<< add_field_to_tab_key(riga, S_DATAOR) << add_field_to_tab_key(riga, S_TPORA);
newkey = tipo;
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 orecons = riga.get_int(sheet.cid2index(S_ORECONS));
tab.put("CODTAB", chiave);
int err = tab.read();
if(err == NOERR)
{
if(oreprev == 0 && orecons == 0)
tab.remove();
else
{
tab.put("I0", oreprev);
tab.put("I1", orecons);
tab.rewrite();
}
}
else
{
tab.put("CODTAB", chiave);
tab.put("S0", descr);
tab.put("I0", oreprev);
tab.put("I1", orecons);
tab.write();
}
tab.put("CODTAB", key);
int err = tab.read();
if (err == NOERR)
{
if (oreprev != 0 || orecons != 0)
{
tab.put("I0", oreprev);
tab.put("I1", orecons);
tab.rewrite();
const TString data = riga.get(sheet.cid2index(S_DATA));
if (data != riga.get(sheet.cid2index(S_DATAOR)))
{
tab.remove();
err = _iskeynotfound;
}
}
else
tab.remove();
}
if (err != NOERR)
{
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();
}
@ -338,7 +384,53 @@ bool TDisp_risoatt_msk::on_field_event(TOperable_field& f, TField_event e, long
send_key(K_SPACE, DLG_NEWREC);
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;
}
@ -352,6 +444,21 @@ TDisp_risoatt_msk::TDisp_risoatt_msk()
{
_preventivo = 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);
}
}
////////////////////////////////////////

View File

@ -15,11 +15,11 @@
#define S_RISOATT 101
#define S_CODRIS 102
#define S_DESRIS 108
#define S_DESRIS 107
#define S_CODATT 202
#define S_DESATT 208
#define S_ANNO 103
#define S_MESE 104
#define S_TPORA 105
#define S_OREPREV 106
#define S_ORECONS 107
#define S_DESATT 207
#define S_DATA 103
#define S_TPORA 104
#define S_OREPREV 105
#define S_ORECONS 106
#define S_DATAOR 108

View File

@ -134,12 +134,12 @@ BEGIN
PROMPT 1 4 ""
ITEM "Tipo"
ITEM "Codice@16"
ITEM "Anno"
ITEM "Mese"
ITEM "Data@10"
ITEM "Tipo\nOra@5"
ITEM "Ore\npreventivo@12"
ITEM "Ore\nconsuntivo@12"
ITEM "Descrizione@50"
ITEM "Data@10"
END
ENDPAGE
@ -147,7 +147,7 @@ ENDMASK
PAGE "Riga disponibilità" -1 -1 78 13
GROUPBOX DLG_NULL 76 9
GROUPBOX DLG_NULL 76 10
BEGIN
PROMPT 1 1 "@bRisorsa - Attrezzatura"
END
@ -209,23 +209,14 @@ BEGIN
GROUP 2
END
NUMBER S_ANNO 4
DATE S_DATA
BEGIN
PROMPT 2 7 "Anno "
FLAGS "AD"
END
LISTBOX S_MESE 10
BEGIN
PROMPT 22 7 "Mese"
ITEM "|"
FILED CODTAB[21,2]
FLAGS "MD"
PROMPT 2 7 "Data "
END
STRING S_TPORA 2
BEGIN
PROMPT 59 7 "Tipo ora "
PROMPT 2 8 "Tipo ora "
USE &ORE
INPUT CODTAB S_TPORA
DISPLAY "Codice@16" CODTAB
@ -237,12 +228,18 @@ END
NUMBER S_OREPREV 6
BEGIN
PROMPT 2 8 "Ore a Preventivo "
PROMPT 30 8 "Ore a Preventivo "
END
NUMBER S_ORECONS 6
BEGIN
PROMPT 30 8 "Ore a Consuntivo "
PROMPT 55 8 "a Consuntivo "
END
DATA S_DATAOR
BEGIN
PROMPT 2 9 "Data "
FLAGS "D"
END
ENDPAGE

View File

@ -29,6 +29,7 @@ class TDef_risoatt_msk : public TAutomask
short _scdc_sid, _scdc_lid;
short _scms_sid, _scms_lid;
short _sfase_sid, _sfase_lid;
TString _dett;
protected:
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());
TToken_string& riga = sheet.row(-1);
riga.add(rilore.tipora(), sheet.cid2index(S_RISOATT));
switch(rilore.tipora())
const char tipo = rilore.get(RILORE_TIPORA)[0];
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 'A': riga.add(rilore.codice(), sheet.cid2index(S_CODATT)); break;
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
default : break;
}
riga.add(rilore.anno(), sheet.cid2index(S_ANNO));
riga.add(rilore.mese(), sheet.cid2index(S_MESE));
riga.add(rilore.tpora(), sheet.cid2index(S_TPORA));
put_row_anal_fields(riga, rilore.codcosto(), rilore.codcms(), rilore.codfase());
riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
riga.add(rilore.costo().string(), sheet.cid2index(S_COSTO));
TDate d(rilore.get_int(RILORE_GIORNO), rilore.get_int(RILORE_MESE), rilore.get_int(RILORE_ANNO));
riga.add(d.string(), sheet.cid2index(S_DATA));
riga.add(rilore.get(RILORE_TPORA), sheet.cid2index(S_TPORA));
put_row_anal_fields(riga, rilore.get(RILORE_CODCOSTO), rilore.get(RILORE_CODCMS), rilore.get(RILORE_CODFASE));
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.force_update();
@ -282,8 +288,18 @@ void TDef_risoatt_msk::nuova_riga()
else
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));
get_anal_fields(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);
if (tutti || tipo == "A")
msk.enable(S_CODATT);
msk.enable(S_ANNO, anno == 0);
msk.enable(S_MESE, mese == 0);
msk.enable(S_TPORA, tpora.empty());
if (_scdc_sid >= 0)
for ( short id = _scdc_sid; id <= _scdc_lid; id++)
@ -353,9 +367,12 @@ void TDef_risoatt_msk::registra()
TToken_string& riga = *(TToken_string*)row;
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 int anno = riga.get_int(sheet.cid2index(S_ANNO));
const int mese = riga.get_int(sheet.cid2index(S_MESE));
TDate d(riga.get(sheet.cid2index(S_DATA)));
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 long id = riga.get_long(sheet.cid2index(S_ID));
TString80 codcosto;
TString80 codcms;
TString80 codfase;
@ -365,17 +382,28 @@ void TDef_risoatt_msk::registra()
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)
rilroa.remove();
else
{
rilroa.set_qtaore(qtaore);
rilroa.set_costo(costo);
int err = rilroa.rewrite_write();
rilroa.put(RILORE_ANNO, anno);
rilroa.put(RILORE_MESE, mese);
rilroa.put(RILORE_GIORNO, giorno);
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
@ -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);
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;
}
@ -588,6 +670,22 @@ TDef_risoatt_msk::TDef_risoatt_msk()
s.delete_column(id);
}
_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);
}
}
////////////////////////////////////////

View File

@ -16,23 +16,23 @@
#define S_RISOATT 101
#define S_CODRIS 102
#define S_DESRIS 120
#define S_DESRIS 119
#define S_CODATT 202
#define S_DESATT 220
#define S_ANNO 103
#define S_MESE 104
#define S_TPORA 105
#define S_CDC1 106
#define S_CDC2 107
#define S_CDC3 108
#define S_CDC4 109
#define S_CDC5 110
#define S_CDC6 111
#define S_CDC7 112
#define S_CDC8 113
#define S_CDC9 114
#define S_CDC10 115
#define S_CDC11 116
#define S_CDC12 117
#define S_QTAORE 118
#define S_COSTO 119
#define S_DESATT 219
#define S_DATA 103
#define S_TPORA 104
#define S_CDC1 105
#define S_CDC2 106
#define S_CDC3 107
#define S_CDC4 108
#define S_CDC5 109
#define S_CDC6 110
#define S_CDC7 111
#define S_CDC8 112
#define S_CDC9 113
#define S_CDC10 114
#define S_CDC11 115
#define S_CDC12 116
#define S_QTAORE 117
#define S_COSTO 118
#define S_ID 120

View File

@ -119,8 +119,7 @@ BEGIN
PROMPT 1 7 ""
ITEM "Tipo"
ITEM "Codice@16"
ITEM "Anno"
ITEM "Mese"
ITEM "Data@10"
ITEM "Tipo\nOra@5"
ITEM "CDC1"
ITEM "CDC2"
@ -137,6 +136,7 @@ BEGIN
ITEM "Qta\nOre@5"
ITEM "Costo@10"
ITEM "Descrizione@50"
ITEM "ID@8"
END
ENDPAGE
@ -203,17 +203,9 @@ BEGIN
GROUP 2
END
NUMBER S_ANNO 4
DATE S_DATA
BEGIN
PROMPT 2 7 "Anno "
CHECKTYPE REQUIRED
FLAGS "AD"
END
LISTBOX S_MESE 10
BEGIN
PROMPT 22 7 "Mese"
FLAGS "MD"
PROMPT 2 7 "Data "
END
STRING S_TPORA 2
@ -310,6 +302,12 @@ BEGIN
PROMPT 30 11 "Prezzo "
END
NUMBER S_ID 8
BEGIN
PROMPT 2 12 "ID "
FLAGS "D"
END
ENDPAGE
TOOLBAR "" 0 0 0 2

View File

@ -533,17 +533,39 @@ const TString& TRisoatt_key::mese() const
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
const TString& TRisoatt_key::tpora() const
{
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);
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);
}
@ -613,9 +635,18 @@ const TString& TDisp_risoatt::chiave() const
}
//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
@ -642,10 +673,48 @@ TDisp_risoatt::TDisp_risoatt(const TRectype& r)
////////////////////////////////
//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)
{
TLocalisamfile rilore(LF_RILORE);
int err = NOERR;
rilore.setkey(2);
zero();
put(RILORE_TIPO, tipo);
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_CODCMS, codcms);
put(RILORE_CODFASE, codfase);
TRectype saverec(*this);
int err = NOERR;
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++;
*this = saverec;
put(RILORE_ID, id);
}
rilore.setkey(1);
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()
{
if (!empty())
{
TLocalisamfile rilore(LF_RILORE);
update_id();
return TRectype::write_rewrite(rilore);
}
return _iskeynotfound;
@ -686,6 +792,7 @@ int TRilevamento_ore::rewrite_write()
{
TLocalisamfile rilore(LF_RILORE);
update_id();
return TRectype::rewrite_write(rilore);
}
return _iskeynotfound;
@ -702,174 +809,6 @@ int TRilevamento_ore::remove()
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
TRilevamento_ore::TRilevamento_ore(const 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)
: TRectype(LF_RILORE)
{

View File

@ -160,10 +160,13 @@ public:
const TString& cod() const;
const int anno() const;
const TString& mese() const;
const TString& giorno() const;
const TString& tpora() const;
const TString& data() const;
//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);
};
@ -202,10 +205,11 @@ public:
TDisp_risoatt & operator =(const TDisp_risoatt& ris) { return *this; }
const TString& chiave() const;
const TString& descr() const;
const long id() const;
const int ore_prev() const;
const int ore_cons() const;
void set_id(long id);
//costruttore
TDisp_risoatt(const TRectype& r);
@ -222,45 +226,18 @@ class TRilevamento_ore : public TRectype
private:
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 remove();
void update_id();
int write_rewrite();
int rewrite_write();
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 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();
};

View File

@ -1,3 +1,3 @@
125
0
$rilore|0|0|125|0|Rilevamento Ore|||
$rilore|17|17|133|0|Rilevamento Ore|||

View File

@ -1,6 +1,7 @@
125
18
19
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
CODICE|1|16|0|Codice Risorsa o Attrezzatura
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
DCODNUM|2|4|0|Chiave doc - Codnum
DNDOC|2|7|0|Chiave doc - ndoc
3
TIPO+ANNO+MESE+GIORNO+TIPORA+CODICE+TPORA+CODCOSTO+CODCMS+CODFASE|
4
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+CODCOSTO+CODCMS+CODFASE|X

View File

@ -2,6 +2,7 @@
#define __RILORE_H
#define RILORE_TIPO "TIPO"
#define RILORE_ID "ID"
#define RILORE_TIPORA "TIPORA"
#define RILORE_CODICE "CODICE"
#define RILORE_ANNO "ANNO"