Patch level : 10.0 902

Files correlati     : ci0.exe ci2.exe
Ricompilazione Demo : [ ]
Commento            :

Agiunta tabella listini
Camibiato il metodo di cancellazione delle righe
Gestione disponibilità


git-svn-id: svn://10.65.10.50/branches/R_10_00@21542 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2011-01-31 02:47:08 +00:00
parent 97a0bf973a
commit e8950fdeb3
23 changed files with 683 additions and 330 deletions

@ -48,7 +48,7 @@ const TString& TRisoatt_msk::add_field_to_tab_filter(const short id, int len, co
val = get(id);
if (val == empty_value)
val.fill('?', len);
val.fill(id == F_LIS ? '0' :'?', len);
else
val.left_just(len);
@ -60,12 +60,25 @@ const TString& TRisoatt_msk::add_field_to_tab_key(TToken_string& row, const shor
TSheet_field& sh = sfield(F_SHEET);
if (len <= 0)
len = sh.sheet_mask().field(id).size();
{
if (id == F_LIS)
len = field(id).size();
else
len = sh.sheet_mask().field(id).size();
}
TString& val = get_tmp_string();
val = row.get(sh.cid2index(id));
val.left_just(len);
if (id == F_LIS)
{
val = get(id);
val.lpad(4, '0');
}
else
{
val = row.get(sh.cid2index(id));
val.left_just(len);
}
return val;
}
@ -73,10 +86,16 @@ const TString& TRisoatt_msk::add_field_to_tab_key(TToken_string& row, const shor
//compilati sulla maschera
void TRisoatt_msk::riempi_sheet()
{
TString filtro;
TSheet_field& sheet = sfield(F_SHEET);
if (sheet.items() > 0 && sheet.dirty() && yesno_box("Vuoi salvare le modifiche"))
registra();
TString filtro;
char risoatt = get(F_RISOATT)[0];
//guardo il tipo risorsa / attrezzatura che sto ricercando (se setto a '?')
filtro << add_field_to_tab_filter(F_LIS);
filtro << add_field_to_tab_filter(F_RISOATT, 1, "T");
//leggo il codice corretto a seconda del tipo selezionato (se vuoto setto a 16 caratteri '?')
switch(risoatt)
@ -87,7 +106,7 @@ void TRisoatt_msk::riempi_sheet()
default: break;
}
filtro << add_field_to_tab_filter(F_ANNO);
filtro << add_field_to_tab_filter(F_MESE, 2);
filtro << add_field_to_tab_filter(F_MESE, 2) << "01";
filtro << add_field_to_tab_filter(F_TPORA);
TString query("USE &ROA\n");
@ -102,8 +121,7 @@ void TRisoatt_msk::riempi_sheet()
TISAM_recordset roa(query);
TSheet_field& sheet = sfield(F_SHEET);
sheet.destroy();
sheet.destroy();
//riempio lo sheet con i dati che soddisfano il filtro preparato prima
for(bool ok = roa.move_first(); ok; ok = roa.move_next())
@ -133,6 +151,7 @@ void TRisoatt_msk::riempi_sheet()
riga.add(roakey.mese(), sheet.cid2index(S_MESE));
riga.add(roakey.tpora(), sheet.cid2index(S_TPORA));
riga.add(roa.valuni().string(), sheet.cid2index(S_VALUNI));
riga.add(roa.valunipr().string(), sheet.cid2index(S_VALUNIPR));
riga.add(roakey.anno(), sheet.cid2index(S_ANNO));
sheet.check_row(sheet.items() - 1);
}
@ -178,7 +197,7 @@ void TRisoatt_msk::nuova_riga()
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_real(S_VALUNI) > ZERO)
if(msk.run() == K_ENTER)
sheet.update_row(r);
else
sheet.destroy(r);
@ -187,29 +206,25 @@ void TRisoatt_msk::nuova_riga()
}
//AZZERA_RIGA: metodo che azzera il valore unitario della riga selezionata
//(N.B.: le righe con valore unitario nullo verranno eliminate in fase di registrazione)
void TRisoatt_msk::azzera_riga(TSheet_field& sheet)
{
TMask& msk = sheet.sheet_mask();
_valore = msk.get_real(S_VALUNI);
msk.set(S_VALUNI, ZERO);
msk.set(S_DEL, "X");
}
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
//(N.B.: le righe con valore unitario nullo verranno eliminate in fase di registrazione)
void TRisoatt_msk::azzera_tutto(TSheet_field& sheet)
{
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& row = sheet.row(r);
row.add(0, sheet.cid2index(S_VALUNI));
row.add("X", sheet.cid2index(S_DEL));
}
sheet.force_update();
}
//REGISTRA: metodo che salva nella tabella di modulo le
//righe dello sheet che hanno valore > 0, ed elimina quelle che hanno
//vaoler pari a zero, e poi ricarica lo sheet
void TRisoatt_msk::registra()
{
//TLocalisamfile tabmod(LF_TABMOD);
@ -223,27 +238,30 @@ void TRisoatt_msk::registra()
chiave.cut(0);
TToken_string& riga = *(TToken_string*)row;
const TString4 del = riga.get(sheet.cid2index(S_DEL));
const TString4 lis = add_field_to_tab_key(riga, F_LIS);
chiave << lis;
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);
TString8 anme; anme << add_field_to_tab_key(riga, S_ANNO) << add_field_to_tab_key(riga, S_MESE, 2);
chiave << anme << "01"; // giorno
chiave << add_field_to_tab_key(riga, S_ANNO) << add_field_to_tab_key(riga, S_MESE, 2) << "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)));
const real valunipr(riga.get(sheet.cid2index(S_VALUNIPR)));
tab.put("CODTAB", chiave);
int err = tab.read();
if(err == NOERR)
{
if(valuni == ZERO)
if (del =="X")
tab.remove();
else
{
tab.put("R1", valuni);
tab.put("I0", anme);
tab.put("R2", valunipr);
tab.rewrite();
}
}
@ -252,11 +270,10 @@ void TRisoatt_msk::registra()
tab.put("CODTAB", chiave);
tab.put("S0", descr);
tab.put("R1", valuni);
tab.put("I0", anme);
tab.put("R2", valunipr);
tab.write();
}
}
riempi_sheet();
}
void TRisoatt_msk::copia_tutto()
@ -340,13 +357,14 @@ void TRisoatt_msk::copia_tutto()
}
TString80 chiave;
const TString4 lis = add_field_to_tab_key(row, F_LIS);
const TString4 tipo = add_field_to_tab_key(row, S_RISOATT, 1);
const TString16 codice = add_field_to_tab_key(row, tipo[0] == 'R' ? S_CODRIS : S_CODATT);
const TString4 stranno = add_field_to_tab_key(row, S_ANNO);
const TString4 mese = add_field_to_tab_key(row, S_MESE, 2);
const TString4 tpora = add_field_to_tab_key(row, S_TPORA);
chiave << tipo[0] << codice << stranno << mese << tpora;
chiave << lis << tipo[0] << codice << stranno << mese << tpora;
const real valuni(row.get(sheet.cid2index(S_VALUNI)));
TString80 chiavedest;
@ -474,6 +492,7 @@ bool TRisoatt_msk::on_field_event(TOperable_field& f, TField_event e, long jolly
break;
case F_ANNO:
case F_MESE:
case F_LIS:
case F_RISOATT:
case F_CODICE:
case F_CODRIS:

@ -1,25 +1,28 @@
//Campi maschera ci0200a
#define F_ANNO 301
#define F_MESE 302
#define F_TPORA 303
#define F_RISOATT 304
#define F_CODICE 305
#define F_CODRIS 306
#define F_DESRIS 307
#define F_CODATT 308
#define F_DESATT 309
#define F_SHEET 310
#define F_LIS 303
#define F_TPORA 304
#define F_RISOATT 305
#define F_CODICE 306
#define F_CODRIS 307
#define F_DESRIS 308
#define F_CODATT 309
#define F_DESATT 310
#define F_SHEET 311
#define DLG_RESET 400
#define DLG_COPY 401
#define DLG_CERCA 402
#define S_RISOATT 101
#define S_CODRIS 102
#define S_DESRIS 107
#define S_CODATT 202
#define S_DESATT 207
#define S_ANNO 103
#define S_MESE 104
#define S_TPORA 105
#define S_VALUNI 106
#define S_DEL 101
#define S_RISOATT 102
#define S_CODRIS 103
#define S_CODATT 203
#define S_ANNO 104
#define S_MESE 105
#define S_TPORA 106
#define S_VALUNI 107
#define S_VALUNIPR 108
#define S_DESRIS 109
#define S_DESATT 209

@ -57,9 +57,21 @@ BEGIN
FLAGS "M"
END
STRING F_LIS 4
BEGIN
PROMPT 44 1 "Listino "
USE &LIS
FLAGS "UZ"
INPUT CODTAB F_LIS
DISPLAY "Codice@16" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_LIS CODTAB
CHECKTYPE NORMAL
END
STRING F_TPORA 2
BEGIN
PROMPT 44 1 "Tipo ora "
PROMPT 59 1 "Tipo ora "
USE &ORE
INPUT CODTAB F_TPORA
DISPLAY "Codice@16" CODTAB
@ -138,21 +150,23 @@ END
SPREADSHEET F_SHEET -19 0
BEGIN
PROMPT 1 4 ""
ITEM "Canc"
ITEM "Tipo"
ITEM "Codice@16"
ITEM "Anno"
ITEM "Mese"
ITEM "Tipo\nOra@5"
ITEM "Valore\nUnitario@10"
ITEM "Costo@10"
ITEM "Costo Preventivo@10"
ITEM "Descrizione@50"
END
ENDPAGE
ENDMASK
PAGE "Riga listino costi" -1 -1 78 13
PAGE "Riga listino costi" -1 -1 78 12
GROUPBOX DLG_NULL 76 9
GROUPBOX DLG_NULL 76 11
BEGIN
PROMPT 1 1 "@bRisorsa - Attrezzatura"
END
@ -239,9 +253,21 @@ BEGIN
FLAGS "D"
END
NUMBER S_VALUNI 10 2
CURRENCY S_VALUNI 10
BEGIN
PROMPT 2 8 "Valore Unitario "
PROMPT 2 8 "Costo "
FLAGS "U"
END
CURRNECY S_VALUNIPR 10
BEGIN
PROMPT 2 9 "Costo preventivo "
FLAGS "U"
END
BOOLEAN S_DEL
BEGIN
PROMPT 2 10 "Elimina"
END
ENDPAGE

@ -67,14 +67,16 @@ const TString& TDisp_risoatt_msk::add_field_to_tab_key(TToken_string& row, const
TString& val = get_tmp_string();
if( id == S_DATA || id == S_DATAOR)
if( id == S_DATA)
{
TDate data(row.get(sh.cid2index(id)));
val = data.string(ANSI);
}
else
{
val = row.get(sh.cid2index(id));
val.left_just(len);
val.left_just(len);
}
return val;
}
@ -89,14 +91,16 @@ const TString& TDisp_risoatt_msk::add_field_to_tab_key(const short id, int len)
TString& val = get_tmp_string();
if( id == S_DATA || id == S_DATAOR)
if( id == S_DATA)
{
TDate data(m.get(id));
val = data.string(ANSI);
}
else
{
val = m.get(id);
val.left_just(len);
val.left_just(len);
}
return val;
}
@ -104,6 +108,12 @@ const TString& TDisp_risoatt_msk::add_field_to_tab_key(const short id, int len)
//compilati sulla maschera
void TDisp_risoatt_msk::riempi_sheet()
{
TSheet_field& sheet = sfield(F_SHEET);
if (sheet.items() > 0 && sheet.dirty() && yesno_box("Vuoi salvare le modifiche"))
registra();
sheet.destroy();
TString filtro;
char risoatt = get(F_RISOATT)[0];
@ -120,7 +130,7 @@ void TDisp_risoatt_msk::riempi_sheet()
filtro << add_field_to_tab_filter(F_ANNO);
//leggo il mese (se vuoto setto a '??')
filtro << add_field_to_tab_filter(F_MESE, 2);
filtro << add_field_to_tab_filter(F_MESE, 2) << "??";
//leggo il tipo ora (se vuoto setto a '??')
filtro << add_field_to_tab_filter(F_TPORA);
@ -139,30 +149,27 @@ void TDisp_risoatt_msk::riempi_sheet()
TISAM_recordset dra(query);
TSheet_field& sheet = sfield(F_SHEET);
sheet.destroy();
//riempio lo sheet con i dati che soddisfano il filtro preparato prima
for(bool ok = dra.move_first(); ok; ok = dra.move_next())
{
TDisp_risoatt disp(dra.cursor()->curr());
TRisoatt_key drakey(disp.chiave());
TString 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();
const TString4 tipo = drakey.left(1);
riga.add(tipo, sheet.cid2index(S_RISOATT));
TString16 cod = drakey.mid(1, 16);
cod.trim();
switch(drakey.tipo())
switch(tipo[0])
{
case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
default : break;
}
riga.add(drakey.data(), sheet.cid2index(S_DATA));
riga.add(drakey.tpora(), sheet.cid2index(S_TPORA));
TDate d(drakey.mid(17, 8));
riga.add(d.string(), sheet.cid2index(S_DATA));
riga.add(drakey.right(2), 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);
}
@ -210,8 +217,9 @@ void TDisp_risoatt_msk::nuova_riga()
if (tutti || tipo == "A")
msk.enable(S_CODATT);
msk.enable(S_TPORA, tpora.empty());
msk.enable(S_DATA);
//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)
sheet.update_row(r);
else
sheet.destroy(r);
@ -220,57 +228,42 @@ void TDisp_risoatt_msk::nuova_riga()
}
//AZZERA_RIGA: metodo che azzera il valore unitario della riga selezionata
//(N.B.: le righe con valore unitario nullo verranno eliminate in fase di registrazione)
void TDisp_risoatt_msk::azzera_riga(TSheet_field& sheet)
{
const int nriga = sheet.selected();
TToken_string& row = sheet.row(nriga);
row.add(0, sheet.cid2index(S_OREPREV));
row.add(0, sheet.cid2index(S_ORECONS));
TMask& msk = sheet.sheet_mask();
_preventivo = msk.get_int(S_OREPREV);
_consuntivo = msk.get_int(S_ORECONS);
msk.set(S_OREPREV, 0L);
msk.set(S_ORECONS, 0L);
msk.set(S_DEL, "X");
}
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
//(N.B.: le righe con valore unitario nullo verranno eliminate in fase di registrazione)
void TDisp_risoatt_msk::azzera_tutto(TSheet_field& sheet)
{
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& row = sheet.row(r);
row.add(0, sheet.cid2index(S_OREPREV));
row.add(0, sheet.cid2index(S_ORECONS));
row.add("X", sheet.cid2index(S_DEL));
}
}
//REGISTRA: metodo che salva nella tabella di modulo le
//righe dello sheet che hanno valore > 0, ed elimina quelle che hanno
//vaoler pari a zero, e poi ricarica lo sheet
//REGISTRA: metodo che salva nella tabella di modulo le righe dello sheet
void TDisp_risoatt_msk::registra()
{
// TLocalisamfile tabmod(LF_TABMOD);
TModule_table tab("&DRA");
TSheet_field& sheet = sfield(F_SHEET);
TString80 key;
TString80 newkey;
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& riga = *(TToken_string*)row;
const TString4 del = riga.get(sheet.cid2index(S_DEL));
const TString4 tipo = add_field_to_tab_key(riga, S_RISOATT, 1);
const bool risorsa = tipo == "R";
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);
key << add_field_to_tab_key(riga, risorsa ? S_CODRIS : S_CODATT);
key << add_field_to_tab_key(riga, S_DATA);
key << 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));
@ -279,32 +272,27 @@ void TDisp_risoatt_msk::registra()
int err = tab.read();
if (err == NOERR)
{
if (oreprev != 0 || orecons != 0)
if (del == "X")
tab.remove();
else
{
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("CODTAB", key);
tab.put("D0", riga.get(sheet.cid2index(S_DATA)));
tab.put("I0", oreprev);
tab.put("I1", orecons);
tab.write();
}
}
riempi_sheet();
sheet.destroy();
riempi_sheet();
}
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera

@ -13,13 +13,13 @@
#define DLG_RESET 400
#define DLG_CERCA 401
#define S_RISOATT 101
#define S_CODRIS 102
#define S_DESRIS 107
#define S_CODATT 202
#define S_DESATT 207
#define S_DATA 103
#define S_TPORA 104
#define S_OREPREV 105
#define S_ORECONS 106
#define S_DATAOR 108
#define S_DEL 101
#define S_RISOATT 102
#define S_CODRIS 103
#define S_CODATT 203
#define S_DATA 104
#define S_TPORA 105
#define S_OREPREV 106
#define S_ORECONS 107
#define S_DESRIS 108
#define S_DESATT 208

@ -132,6 +132,7 @@ END
SPREADSHEET F_SHEET -19 0
BEGIN
PROMPT 1 4 ""
ITEM "Canc"
ITEM "Tipo"
ITEM "Codice@16"
ITEM "Data@10"
@ -139,7 +140,6 @@ BEGIN
ITEM "Ore\npreventivo@12"
ITEM "Ore\nconsuntivo@12"
ITEM "Descrizione@50"
ITEM "Data@10"
END
ENDPAGE
@ -212,6 +212,7 @@ END
DATE S_DATA
BEGIN
PROMPT 2 7 "Data "
FLAGS "D"
END
STRING S_TPORA 2
@ -236,10 +237,9 @@ BEGIN
PROMPT 55 8 "a Consuntivo "
END
DATA S_DATAOR
BOOLEAN S_DEL
BEGIN
PROMPT 2 9 "Data "
FLAGS "D"
PROMPT 2 9 "Elimina"
END
ENDPAGE

@ -320,7 +320,7 @@ void TDef_risoatt_msk::nuova_riga()
msk.enable(id, codfase.blank());
//lancio la maschera di riga da compilare
if (msk.run() == K_ENTER && msk.get_int(S_QTAORE) > 0)
if (msk.run() == K_ENTER)
sheet.update_row(r);
else
sheet.destroy(r);
@ -339,7 +339,7 @@ void TDef_risoatt_msk::azzera_riga(TSheet_field& sheet)
TMask& msk = sheet.sheet_mask();
_qtaore = msk.get_int(S_QTAORE);
msk.set(S_QTAORE, 0L);
msk.set(S_DEL, "X");
}
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
@ -349,7 +349,7 @@ void TDef_risoatt_msk::azzera_tutto(TSheet_field& sheet)
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& row = sheet.row(r);
row.add(0, sheet.cid2index(S_QTAORE));
row.add("X", sheet.cid2index(S_DEL));
}
}
@ -365,6 +365,7 @@ void TDef_risoatt_msk::registra()
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& riga = *(TToken_string*)row;
const TString4 del = riga.get(sheet.cid2index(S_DEL));
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));
TDate d(riga.get(sheet.cid2index(S_DATA)));
@ -377,13 +378,12 @@ void TDef_risoatt_msk::registra()
TString80 codcms;
TString80 codfase;
const int qtaore = riga.get_int(sheet.cid2index(S_QTAORE));
const TString& tmp = riga.get(sheet.cid2index(S_COSTO));
const real costo(tmp);
const real costo(riga.get(sheet.cid2index(S_COSTO)));
get_row_anal_fields(riga, codcosto, codcms, codfase);
rilroa.read('D', id);
if (qtaore == 0)
if (del == "X")
err = rilroa.remove();
else
{

@ -14,25 +14,26 @@
#define DLG_RESET 400
#define DLG_CERCA 401
#define S_RISOATT 101
#define S_CODRIS 102
#define S_DESRIS 119
#define S_CODATT 202
#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
#define S_DEL 101
#define S_RISOATT 102
#define S_CODRIS 103
#define S_DESRIS 120
#define S_CODATT 203
#define S_DESATT 220
#define S_DATA 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_ID 121

@ -116,6 +116,7 @@ END
SPREADSHEET F_SHEET -18 0
BEGIN
PROMPT 1 7 ""
ITEM "Canc"
ITEM "Tipo"
ITEM "Codice@16"
ITEM "Data@10"
@ -141,9 +142,9 @@ END
ENDPAGE
ENDMASK
PAGE "Dati Predefiniti" -1 -1 78 13
PAGE "Dati Predefiniti" -1 -1 78 15
GROUPBOX DLG_NULL 76 20
GROUPBOX DLG_NULL 76 14
BEGIN
PROMPT 1 1 "@bRisorsa - Attrezzatura"
END
@ -307,6 +308,11 @@ BEGIN
FLAGS "D"
END
BOOLEAN S_DEL
BEGIN
PROMPT 31 13 "Elimina"
END
ENDPAGE
TOOLBAR "" 0 0 0 2

@ -11,6 +11,7 @@
#include "cilib.h"
#include "ci2100a.h"
#include "rilore.h"
#include "../ca/commesse.h"
#include "../ca/calib01.h"
#include "../ve/velib.h"
@ -55,6 +56,7 @@ public:
const real TRilevamento_prev_msk::proponi_costo(const TMask& msk)
{
real costo = ZERO;
const TString8 codlist = msk.get(S_CODLIST);
const char tipo = msk.get(S_RISOATT)[0];
TString80 codice;
switch(tipo)
@ -63,32 +65,31 @@ const real TRilevamento_prev_msk::proponi_costo(const TMask& msk)
case 'A': codice = msk.get(S_CODATT); break;
default : break;
}
const TDate dal = msk.get_date(S_DADATA);
TDate dal = msk.get_date(S_DADATA);
const TString4 tpora = msk.get(S_TPORA);
const TRisoatt_key chiave(tipo, codice, dal, tpora);
if (!dal.ok())
dal = eotime;
else
dal.set_day(1);
const TRisoatt_key chiave(codlist, tipo, codice, dal, tpora);
TModule_table roa("&ROA");
roa.put("CODTAB", chiave);
int err = roa.read();
if(err == NOERR)
costo = roa.get_real("R1");
costo = roa.get_real("R2");
else
{
const int anno = dal.year();
TString4 mese; mese.format("%02d", dal.month());
TString8 tmp; tmp << anno << mese;
const long anme = atol(tmp);
TString query;
query << "USE &ROA\n"
<< "SELECT I0<" << anme << "\n"
<< "FROM CODTAB=" << tipo << codice.left_just(16) << "\n"
<< "TO CODTAB=" << tipo << codice.left_just(16) << "\n"
<< "BY I0\n";
TISAM_recordset rec(query);
query << "USE &ROA SELECT MID(CODTAB,30,2)==\"" << tpora << "\"\n"
<< "FROM CODTAB=" << chiave.left(21) << "\n"
<< "TO CODTAB=" << chiave << "\n";
TISAM_recordset rec(query);
if(rec.move_last())
costo = rec.cursor()->curr().get_real("R1");
if(rec.move_last())
costo = rec.cursor()->curr().get_real("R2");
}
return costo;
}
@ -97,6 +98,7 @@ const real TRilevamento_prev_msk::proponi_costo(TToken_string& riga)
{
real costo = ZERO;
TSheet_field& sheet = sfield(F_SHEET);
const TString8 codlist = riga.get(sheet.cid2index(S_CODLIST));
const char tipo = riga.get_char(sheet.cid2index(S_RISOATT));
TString80 codice;
switch(tipo)
@ -106,33 +108,30 @@ const real TRilevamento_prev_msk::proponi_costo(TToken_string& riga)
default : break;
}
TString cazzone = riga.get(sheet.cid2index(S_DADATA));
const TDate dadata(riga.get(sheet.cid2index(S_DADATA)));
TDate dal(riga.get(sheet.cid2index(S_DADATA)));
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
const TRisoatt_key chiave(tipo, codice, dadata, tpora);
if (!dal.ok())
dal = eotime;
else
dal.set_day(1);
const TRisoatt_key chiave(codlist, tipo, codice, dal, tpora);
TModule_table roa("&ROA");
roa.put("CODTAB", chiave);
int err = roa.read();
if(err == NOERR)
costo = roa.get_real("R1");
costo = roa.get_real("R2");
else
{
const int anno = dadata.year();
TString4 mese; mese.format("%02d", dadata.month());
TString8 tmp; tmp << anno << mese;
const long anme = atol(tmp);
TString query;
query << "USE &ROA\n"
<< "SELECT I0<" << anme << "\n"
<< "FROM CODTAB=" << tipo << codice.left_just(16) << "\n"
<< "TO CODTAB=" << tipo << codice.left_just(16) << "\n"
<< "BY I0\n";
query << "USE &ROA SELECT MID(CODTAB,30,2)==\"" << tpora << "\"\n"
<< "FROM CODTAB=\"" << chiave.left(21) << "\"\n"
<< "TO CODTAB=\"" << chiave << "\"\n";
TISAM_recordset rec(query);
if(rec.move_last())
costo = rec.cursor()->curr().get_real("R1");
costo = rec.cursor()->curr().get_real("R2");
}
return costo;
}
@ -269,7 +268,7 @@ void TRilevamento_prev_msk::carica_default()
if (select.full()) select << "&&";
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
}
if (anno > 0)
/* if (anno > 0)
{
if (select.full()) select << "&&";
select << "STR(" << RILORE_ANNO << "==" << anno << ")";
@ -278,7 +277,7 @@ void TRilevamento_prev_msk::carica_default()
{
if (select.full()) select << "&&";
select << "(BETWEEN(MESE,\"" << damese << "\",\"" << amese << "\"))";
}
} */
if (tpora.full())
{
if (select.full()) select << "&&";
@ -330,7 +329,7 @@ void TRilevamento_prev_msk::carica_default()
const char tipo = rilore.get(RILORE_TIPORA)[0];
TString16 cod = rilore.get(RILORE_CODICE);
riga.add(tipo), sheet.cid2index(S_RISOATT);
riga.add(tipo, sheet.cid2index(S_RISOATT));
switch (tipo)
{
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
@ -449,6 +448,7 @@ void TRilevamento_prev_msk::riempi_sheet()
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_CODLIST), sheet.cid2index(S_CODLIST));
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);
@ -526,27 +526,20 @@ void TRilevamento_prev_msk::nuova_riga()
}
//AZZERA_RIGA: metodo che azzera il valore unitario della riga selezionata
//(N.B.: le righe con valore unitario nullo verranno eliminate in fase di registrazione)
void TRilevamento_prev_msk::azzera_riga(TSheet_field& sheet)
{
const int nriga = sheet.selected();
TToken_string& row = sheet.row(nriga);
row.add(0, sheet.cid2index(S_QTAORE));
TMask& msk = sheet.sheet_mask();
_qtaore = msk.get_int(S_QTAORE);
msk.set(S_QTAORE, 0L);
msk.set(S_DEL, "X");
}
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
//(N.B.: le righe con valore unitario nullo verranno eliminate in fase di registrazione)
void TRilevamento_prev_msk::azzera_tutto(TSheet_field& sheet)
{
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& row = sheet.row(r);
row.add(0, sheet.cid2index(S_QTAORE));
row.add("X", sheet.cid2index(S_DEL));
}
}
@ -563,6 +556,7 @@ void TRilevamento_prev_msk::registra()
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& riga = *(TToken_string*)row;
const TString4 del = riga.get(sheet.cid2index(S_DEL));
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 TDate& dadata = riga.get(sheet.cid2index(S_DADATA));
@ -573,12 +567,12 @@ void TRilevamento_prev_msk::registra()
TString80 codcms;
TString80 codfase;
const int qtaore = riga.get_int(sheet.cid2index(S_QTAORE));
const TString& tmp = riga.get(sheet.cid2index(S_COSTO));
const real costo(tmp);
const TString8 codlist = riga.get(sheet.cid2index(S_CODLIST));
const real costo(riga.get(sheet.cid2index(S_COSTO)));
get_row_anal_fields(riga, codcosto, codcms, codfase);
const bool found = rilroa.read('P', id) == NOERR;
if (qtaore == 0)
if (del == "X")
{
if (found)
{
@ -612,6 +606,7 @@ void TRilevamento_prev_msk::registra()
rilroa.put(RILORE_DADATA, dadata);
rilroa.put(RILORE_ADATA, adata);
rilroa.put(RILORE_QTAORE, qtaore);
rilroa.put(RILORE_CODLIST, codlist);
rilroa.put(RILORE_COSTO, costo);
if (_numpr.full() && _tipopr.full())
{
@ -701,6 +696,22 @@ bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, l
{
if (e == fe_modify && f.dlg() >= F_ANAL && f.dlg() < F_ANAL+12)
riempi_sheet();
if (f.dlg() == _scms_lid)
{
if (e == fe_init || e == fe_modify)
{
const TRectype & curr = f.mask().efield(_scms_lid).browse()->cursor()->curr();
const TString codcms = curr.get(COMMESSE_CODCMS);
f.mask().set(S_CMSH, codcms);
if (e == fe_modify)
{
const TRectype & commesse = cache().get(LF_COMMESSE, codcms);
f.mask().set(S_CODLIST, commesse.get(COMMESSE_LISRILPR), 3);
}
}
}
switch (f.dlg())
{
case DLG_DEFAULT:
@ -741,26 +752,6 @@ bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, l
sheet.force_update();
return false;
}
break;
case DLG_CANCEL:
if(e == fe_button && jolly == 1)
{
TSheet_field& sheet = sfield(F_SHEET);
TMask& msk = sheet.sheet_mask();
const int qtaore = msk.get_int(S_QTAORE);
if(sheet.selected() == sheet.items() - 1)
{
sheet.destroy(sheet.items() - 1);
sheet.force_update();
}
else if(_qtaore > 0)
{
TToken_string& row = sheet.row(sheet.selected());
row.add(_qtaore, sheet.cid2index(S_QTAORE));
_qtaore = 0;
}
}
break;
case F_DADATA:
case F_ADATA:
@ -779,6 +770,7 @@ bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, l
}
case S_CODRIS:
case S_CODATT:
case S_CODLIST:
case S_DADATA:
case S_TPORA:
if (e == fe_modify)

@ -16,26 +16,31 @@
#define DLG_DEFAULT 402
#define F_DESANAL 410
#define S_RISOATT 101
#define S_CODRIS 102
#define S_DESRIS 120
#define S_CODATT 202
#define S_DESATT 220
#define S_DADATA 103
#define S_ADATA 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_ID 121
#define S_DEL 101
#define S_RISOATT 102
#define S_CODRIS 103
#define S_CODATT 203
#define S_DADATA 104
#define S_ADATA 105
#define S_TPORA 106
#define S_CDC1 107
#define S_CDC2 108
#define S_CDC3 109
#define S_CDC4 110
#define S_CDC5 111
#define S_CDC6 112
#define S_CDC7 113
#define S_CDC8 114
#define S_CDC9 115
#define S_CDC10 116
#define S_CDC11 117
#define S_CDC12 118
#define S_QTAORE 119
#define S_CODLIST 120
#define S_COSTO 121
#define S_DESRIS 122
#define S_DESATT 222
#define S_ID 123
#define S_CMSH 350

@ -118,6 +118,7 @@ END
SPREADSHEET F_SHEET -18 0
BEGIN
PROMPT 1 7 ""
ITEM "Canc"
ITEM "Tipo"
ITEM "Codice@16"
ITEM "Dal@10"
@ -135,7 +136,8 @@ BEGIN
ITEM "CDC10"
ITEM "CDC11"
ITEM "CDC12"
ITEM "Qta\nOre@5"
ITEM "Ore@5"
ITEM "Listino"
ITEM "Costo@10"
ITEM "Descrizione@50"
ITEM "ID@8"
@ -305,12 +307,23 @@ END
NUMBER S_QTAORE 6
BEGIN
PROMPT 2 11 "Quantità ore "
PROMPT 2 11 "Ore "
END
STRING S_CODLIST 4
BEGIN
PROMPT 30 11 "Listino "
USE &LIS
INPUT CODTAB S_CODLIST
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT S_CODLIST CODTAB
FLAGS "UZ"
END
NUMBER S_COSTO 10 2
BEGIN
PROMPT 30 11 "Prezzo "
PROMPT 45 11 "Prezzo "
END
NUMBER S_ID 8
@ -319,6 +332,17 @@ BEGIN
FLAGS "D"
END
BOOLEAN S_DEL
BEGIN
PROMPT 31 12 "Elimina"
END
STRING S_CMSH 20
BEGIN
PROMPT 50 16 ""
FLAGS "H"
END
ENDPAGE
TOOLBAR "" 0 0 0 2

@ -42,6 +42,7 @@ class TRilevamento_cons_msk : public TAutomask
TEsercizi_contabili _es;
TString _numcn;
TString _tipocn;
TToken_string _last_key;
protected:
const real proponi_costo(TToken_string& riga);
@ -50,10 +51,14 @@ protected:
void put_row_anal_fields(TToken_string & row, const TString & cdc, const TString & cms, const TString & fase);
void carica_default();
void update_day();
void update_disp();
void riempi_sheet();
void riempi_calendario(const TString & query);
void update_column(short sid, const bool full, int len = -1);
void riempi_risoatt(char tipo = 'C');
void azzera_tutto();
void nuova_riga();
void azzera_riga(TSheet_field& sheet);
void azzera_tutto(TSheet_field& sheet);
void registra();
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
@ -66,6 +71,7 @@ const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
{
real costo = ZERO;
TSheet_field& sheet = sfield(F_SHEET);
const TString8 codlist = riga.get(sheet.cid2index(S_CODLIST));
const char tipo = riga.get_char(sheet.cid2index(S_RISOATT));
TString80 codice;
switch(tipo)
@ -74,25 +80,22 @@ const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
case 'A': codice = riga.get(sheet.cid2index(S_CODATT)); break;
default : break;
}
const TDate dal(1, _mese, _anno);
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
const TRisoatt_key chiave(codlist, tipo, codice, dal, tpora);
TModule_table roa("&ROA");
roa.put("CODTAB", chiave);
int err = roa.read();
const TRisoatt_key chiave(tipo, codice, dal, tpora);
const TRectype & roa = cache().get("&ROA", chiave);
if(!roa.empty())
if(err == NOERR)
costo = roa.get_real("R1");
else
{
TString8 tmp; tmp << _anno << _mese;
const long anme = atol(tmp);
TString query;
query << "USE &ROA\n"
<< "SELECT I0<" << anme << "\n"
<< "FROM CODTAB=" << tipo << codice.left_just(16) << "\n"
<< "TO CODTAB=" << tipo << codice.left_just(16) << "\n"
<< "BY I0\n";
query << "USE &ROA SELECT MID(CODTAB,30,2)==\"" << tpora << "\"\n"
<< "FROM CODTAB=\"" << chiave.left(21) << "\"\n"
<< "TO CODTAB=\"" << chiave << "\"\n";
TISAM_recordset rec(query);
if(rec.move_last())
@ -100,6 +103,7 @@ const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
}
return costo;
}
void TRilevamento_cons_msk::get_anal_fields(TString & cdc, TString & cms, TString & fase)
{
TString val;
@ -259,8 +263,6 @@ void TRilevamento_cons_msk::carica_default()
if (_mese > 0)
fromto << RILORE_MESE << "=" << _mese << " ";
}
riempi_calendario(query);
riempi_risoatt('D');
}
@ -366,6 +368,23 @@ void TRilevamento_cons_msk::riempi_calendario(const TString & query)
}
calendario.force_update();
}
void TRilevamento_cons_msk::update_column(short sid, bool full, int len)
{
TSheet_field& sf = sfield(F_SHEET);
TMask_field& f = sf.sheet_mask().field(sid);
if (len < 0)
{
const TString prompt = f.prompt();
len = prompt.len();
}
const int column = sf.cid2index(sid);
sf.enable_column(column, !full);
sf.set_column_width(column, !full ? (max(3 + f.size(), len + 1) * CHARX) : 0);
}
void TRilevamento_cons_msk::riempi_risoatt(char tipo)
{
@ -386,18 +405,27 @@ void TRilevamento_cons_msk::riempi_risoatt(char tipo)
TString query;
TString select;
switch(get(F_RISOATT)[0])
switch(risoatt[0])
{
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
}
update_disp();
get_anal_fields(codcosto, codcms, codfase);
update_column(S_RISOATT, risoatt.full());
update_column(S_CODRIS, codice.full());
update_column(S_DESRIS, codice.full());
update_column(S_CODATT, codice.full());
update_column(S_DESATT, codice.full());
update_column(S_TPORA, tpora.full(), 4);
//preparo la query
query << "USE " << LF_RILORE << " KEY 2\n" ;
if (risoatt.full())
{
select << "(" << RILORE_TIPORA << "==\"" << risoatt << "\")";
}
if (codice.full())
{
if (select.full()) select << "&&";
@ -450,11 +478,11 @@ void TRilevamento_cons_msk::riempi_risoatt(char tipo)
TRilevamento_ore rilore(def.cursor()->curr());
TToken_string& riga = sheet.row(-1);
const char tipo = rilore.get(RILORE_TIPORA)[0];
const char tipor = rilore.get(RILORE_TIPORA)[0];
TString16 cod = rilore.get(RILORE_CODICE);
riga.add(tipo, sheet.cid2index(S_RISOATT));
switch(tipo)
riga.add(tipor, sheet.cid2index(S_RISOATT));
switch(tipor)
{
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
@ -463,16 +491,103 @@ void TRilevamento_cons_msk::riempi_risoatt(char tipo)
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_CODLIST), sheet.cid2index(S_CODLIST));
riga.add(rilore.get(RILORE_COSTO), sheet.cid2index(S_COSTO));
riga.add(rilore.get(RILORE_CUP), sheet.cid2index(S_CUP));
riga.add(rilore.get(RILORE_CIG), sheet.cid2index(S_CIG));
riga.add(rilore.get(RILORE_ID), sheet.cid2index(S_ID));
riga.add(tipo == 'D' ? 0 : rilore.get(RILORE_ID), sheet.cid2index(S_ID));
sheet.check_row(sheet.items() - 1);
}
sheet.force_update();
}
//RIEMPI_SHEET: metodo che riempie lo sheet in base ai campi chiave
//compilati sulla maschera
void TRilevamento_cons_msk::update_disp()
{
//leggo dalla maschera i campi chiave di ricerca
TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
TString4 tpora = get(F_TPORA);
TString16 codice;
if (risoatt == "R")
codice = get(F_CODRIS);
else
if (risoatt == "A")
codice = get(F_CODATT);
const bool head_resource = codice.full();
TSheet_field & sf = sfield(F_SHEET);
if (!head_resource && sf.items() > 0)
{
const int r = sf.selected();
if (r >= 0)
{
TToken_string & row = sf.row(r);
risoatt = row.get(sf.cid2index(S_RISOATT));
tpora = row.get(sf.cid2index(S_TPORA));
if (risoatt == "R")
codice = row.get(sf.cid2index(S_CODRIS));
else
if (risoatt == "A")
codice = row.get(sf.cid2index(S_CODATT));
}
}
TToken_string key(risoatt);
key.add(codice);
key.add(tpora);
key.add(_giorno);
key.add(_mese);
key.add(_anno);
if (key == _last_key)
return;
_last_key = key;
int oredisp = 0;
if (codice.full())
{
TString query;
query << "USE " << LF_RILORE << " KEY 2\n"
<< "SELECT (" << RILORE_TIPORA << "==\"" << risoatt
<< "\")&&(" << RILORE_CODICE << "==\"" << codice
<< "\")&&(" << RILORE_TPORA << "==\"" << tpora << "\")\n"
<< "FROM " << RILORE_TIPO "=\"D\""
<< " " << RILORE_ANNO << "=" << _anno << " "
<< RILORE_MESE << "=" << _mese << " "
<< RILORE_GIORNO << "=" << _giorno << "\n";
TDate to_day(_giorno, _mese, _anno);
const TString4 intervallo = get(F_INTERVALLO);
if (intervallo == "M")
{
to_day.addmonth();
--to_day;
}
else
if (intervallo == "A")
{
to_day.addyear();
--to_day;
}
query << "TO " << RILORE_TIPO "=\"D\""
<< " " << RILORE_ANNO << "=" << to_day.year() << " "
<< RILORE_MESE << "=" << to_day.month() << " "
<< RILORE_GIORNO << "=" << to_day.day();
TISAM_recordset def(query);
for(bool ok = def.move_first(); ok; ok = def.move_next())
oredisp += def.cursor()->curr().get_int(RILORE_QTAORE);
}
set(F_OREDIS, oredisp);
}
//RIEMPI_SHEET: metodo che riempie lo sheet in base ai campi chiave
//compilati sulla maschera
void TRilevamento_cons_msk::riempi_sheet()
@ -543,15 +658,73 @@ void TRilevamento_cons_msk::riempi_sheet()
riempi_risoatt();
}
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
//(N.B.: le righe con valore unitario nullo verranno eliminate in fase di registrazione)
void TRilevamento_cons_msk::azzera_tutto()
//NUOVA_RIGA: metodo che aggiunge una riga allo sheet
//tenendo conto dei campi chiave compilati in testata
void TRilevamento_cons_msk::nuova_riga()
{
TSheet_field& sheet = sfield(F_SHEET);
const int r = sheet.items() - 1;
TToken_string & riga = sheet.row(r);
TMask& msk = sheet.sheet_mask();
sheet.select(r);
//guardo il tipo risorsa / attrezzatura che sto ricercando
const bool tutti = get(F_RISOATT)[0] == 'T';
const TString4 tipo = tutti ? "R" : get(F_RISOATT);
TString codice;
TString tpora = get(F_TPORA);
TString codcosto;
TString codcms;
TString codfase;
/* msk.enable(S_RISOATT, tutti);
if (tutti || tipo == "R")
msk.enable(S_CODRIS);
if (tutti || tipo == "A")
msk.enable(S_CODATT);
msk.enable(S_TPORA, tpora.empty()); */
if (_scdc_sid >= 0)
for ( short id = _scdc_sid; id <= _scdc_lid; id++)
msk.enable(id, codcosto.blank());
if (_scms_sid >= 0)
for ( short id = _scms_sid; id <= _scms_lid; id++)
msk.enable(id, codcms.blank());
if (_sfase_sid >= 0)
for ( short id = _sfase_sid; id <= _sfase_lid; id++)
msk.enable(id, codfase.blank());
riga.add(tipo, sheet.cid2index(S_RISOATT));
if (!tutti)
{
if (tipo == "R")
riga.add(get(F_CODRIS), sheet.cid2index(S_CODRIS));
else
riga.add(get(F_CODATT), sheet.cid2index(S_CODATT));
}
riga.add(tpora, sheet.cid2index(S_TPORA));
get_anal_fields(codcosto, codcms, codfase);
put_row_anal_fields(riga, codcosto, codcms, codfase);
riga.add(proponi_costo(riga).string(), sheet.cid2index(S_COSTO));
sheet.check_row(r);
sheet.force_update(r);
}
//AZZERA_RIGA: metodo che azzera il valore unitario della riga selezionata
void TRilevamento_cons_msk::azzera_riga(TSheet_field& sheet)
{
TMask& msk = sheet.sheet_mask();
msk.set(S_DEL, "X");
}
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
void TRilevamento_cons_msk::azzera_tutto(TSheet_field& sheet)
{
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& row = sheet.row(r);
row.add(0, sheet.cid2index(S_QTAORE));
row.add("X", sheet.cid2index(S_DEL));
}
}
@ -575,18 +748,20 @@ void TRilevamento_cons_msk::registra()
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& riga = *(TToken_string*)row;
const TString4 del = riga.get(sheet.cid2index(S_DEL));
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 TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
const int qtaore = riga.get_int(sheet.cid2index(S_QTAORE));
const long id = riga.get_long(sheet.cid2index(S_ID));
const TString8 codlist = riga.get(sheet.cid2index(S_CODLIST));
const real costo(riga.get(sheet.cid2index(S_COSTO)));
const TString16 cup(riga.get(sheet.cid2index(S_CUP)));
const TString16 cig(riga.get(sheet.cid2index(S_CIG)));
get_row_anal_fields(riga, codcosto, codcms, codfase);
const bool found = rilroa.read('C', id) == NOERR;
if(qtaore == 0)
if (del == "X")
{
if (found)
{
@ -615,6 +790,7 @@ void TRilevamento_cons_msk::registra()
rilroa.put(RILORE_CODCMS, codcms);
rilroa.put(RILORE_CODFASE, codfase);
rilroa.put(RILORE_QTAORE, qtaore);
rilroa.put(RILORE_CODLIST, codlist);
rilroa.put(RILORE_COSTO, costo);
rilroa.put(RILORE_CUP, cup);
rilroa.put(RILORE_CIG, cig);
@ -734,7 +910,7 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
{
if (e == fe_modify && f.dlg() >= F_ANAL && f.dlg() < F_ANAL+12)
riempi_sheet();
if (main_app().has_module(CUAUT) && f.dlg() == _scms_lid)
if (f.dlg() == _scms_lid)
{
if (e == fe_init || e == fe_modify)
{
@ -744,15 +920,21 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
f.mask().set(S_CMSH, codcms);
if (e == fe_modify)
{
TToken_string key;
const TRectype & commesse = cache().get(LF_COMMESSE, codcms);
key.add(codcms);
key.add("C");
key.add(1);
const TRectype & cfcms = cache().get(LF_CFCMS, key);
f.mask().set(S_CODLIST, commesse.get(COMMESSE_LISRILCN), 3);
if (main_app().has_module(CUAUT))
{
TToken_string key;
f.mask().set(S_CUP, cfcms.get(CFCMS_CUP), 3);
f.mask().set(S_CIG, cfcms.get(CFCMS_CIG), 3);
key.add(codcms);
key.add("C");
key.add(1);
const TRectype & cfcms = cache().get(LF_CFCMS, key);
f.mask().set(S_CUP, cfcms.get(CFCMS_CUP), 3);
f.mask().set(S_CIG, cfcms.get(CFCMS_CIG), 3);
}
}
}
}
@ -782,39 +964,59 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
if (e == se_enter)
riempi_risoatt();
break;
case F_INTERVALLO:
if (e == fe_modify)
case F_SHEET:
if (e == se_notify_add)
nuova_riga();
else
if (e == se_enter)
update_disp();
break;
case F_INTERVALLO:
if (e == fe_modify)
{
const TString4 dett = ini_get_string(CONFIG_DITTA, "ci", "DETTCONS");
if (dett == "A")
{
const TString4 dett = ini_get_string(CONFIG_DITTA, "ci", "DETTCONS");
if (dett == "A")
reset(F_ANNO);
disable(F_ANNO);
reset(F_MESE);
disable(F_MESE);
}
else
{
if (dett == "M")
{
reset(F_ANNO);
disable(F_ANNO);
reset(F_MESE);
disable(F_MESE);
}
else
{
if (dett == "M")
{
reset(F_MESE);
disable(F_MESE);
}
}
riempi_sheet();
}
break;
riempi_sheet();
}
break;
case DLG_RESET:
if(e == fe_button)
{
TSheet_field& sheet = sfield(F_SHEET);
switch(jolly)
{
case 0: azzera_tutto(sheet); break;
case 2: azzera_riga(sheet); break;
default: break;
}
sheet.force_update();
return false;
}
break;
case S_RISOATT:
case S_CODRIS:
case S_CODATT:
case S_CODLIST:
case S_TPORA:
if(e == fe_modify)
{
TSheet_field& sheet = sfield(F_SHEET);
TMask & sm = sheet.sheet_mask();
if(sm.get(S_RISOATT).full() && (sm.get(S_CODRIS).full() || sm.get(S_CODATT).full()) && sm.get(S_TPORA).full())
proponi_costo(sheet.row(sheet.selected()));
f.mask().set(S_COSTO, proponi_costo(sheet.row(sheet.selected())).string());
}
break;
default: break;

@ -15,6 +15,7 @@
#define F_ANAL 314
#define F_SHEET 330
#define F_INTERVALLO 331
#define F_OREDIS 332
#define DLG_RESET 900
#define DLG_CERCA 901
@ -22,30 +23,31 @@
#define F_CONT 101
#define S_RISOATT 101
#define S_CODRIS 102
#define S_CODATT 202
#define S_TPORA 103
#define S_CDC1 104
#define S_CDC2 105
#define S_CDC3 106
#define S_CDC4 107
#define S_CDC5 108
#define S_CDC6 109
#define S_CDC7 110
#define S_CDC8 111
#define S_CDC9 112
#define S_CDC10 113
#define S_CDC11 114
#define S_CDC12 115
#define S_QTAORE 116
#define S_COSTO 117
#define S_OREDIS 118
#define S_CUP 119
#define S_CIG 120
#define S_DESRIS 121
#define S_DESATT 221
#define S_ID 122
#define S_DEL 101
#define S_RISOATT 102
#define S_CODRIS 103
#define S_CODATT 203
#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_CODLIST 118
#define S_COSTO 119
#define S_CUP 120
#define S_CIG 121
#define S_DESRIS 122
#define S_DESATT 222
#define S_ID 123
#define S_CMSH 350
#define S_DCUP 351

@ -120,15 +120,22 @@ BEGIN
GROUP 3
END
NUMBER F_OREDIS 6
BEGIN
PROMPT 60 2 "Dispon."
FLAG "D"
END
SPREADSHEET F_CALENDARIO 10 0
BEGIN
PROMPT 1 8 ""
ITEM "@4"
END
SPREADSHEET F_SHEET 65 0
SPREADSHEET F_SHEET 85 0
BEGIN
PROMPT 15 8 ""
ITEM "Canc"
ITEM "Tipo"
ITEM "Codice@16"
ITEM "Tipo\nOra@5"
@ -144,9 +151,9 @@ BEGIN
ITEM "CDC10"
ITEM "CDC11"
ITEM "CDC12"
ITEM "Qta\nOre@5"
ITEM "Ore@5"
ITEM "Listino"
ITEM "Costo@6"
ITEM "Ore\ndisponibilità"
ITEM "CUP@15"
ITEM "CIG@10"
ITEM "Descrizione@50"
@ -324,14 +331,20 @@ BEGIN
PROMPT 2 11 "Quantità ore "
END
NUMBER S_COSTO 6 2
STRING S_CODLIST 4
BEGIN
PROMPT 30 11 "Prezzo "
PROMPT 30 11 "Listino "
USE &LIS
INPUT CODTAB S_CODLIST
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT S_CODLIST CODTAB
FLAGS "UZ"
END
NUMBER S_OREDIS 6
NUMBER S_COSTO 6 2
BEGIN
PROMPT 50 11 "Quantità ore "
PROMPT 45 11 "Prezzo "
END
STRING S_CMSH 20
@ -392,6 +405,11 @@ BEGIN
FLAGS "D"
END
BOOLEAN S_DEL
BEGIN
PROMPT 31 14 "Elimina"
END
ENDPAGE
TOOLBAR "" 0 0 0 2

@ -509,38 +509,45 @@ TAlmanac_mask::TAlmanac_mask(const char* name)
//// TRISOATT_KEY ////
////////////////////////////
//codlist: metodo che restituisce il codice listino
const TString & TRisoatt_key::codlist() const
{
return left(4);
}
//TIPO: metodo che restituisce il tipo (<R>isorsa o <A>ttrezzatura)
const char TRisoatt_key::tipo() const
{
return left(1)[0];
return mid(4, 1)[0];
}
//COD: metodo che restituisce il codice della risorsa op dell'attrezzatura
const TString& TRisoatt_key::cod() const
{
return mid(1, 16);
return mid(5, 16);
}
//ANNO: metodo che restituisce l'anno a cui fa riferimento la risorsa o l'attrezzatura
const int TRisoatt_key::anno() const
{
return atoi(mid(17, 4));
return atoi(mid(21, 4));
}
//MESE: metodo che restituisce il mese a cui fa riferimento la risorsa o l'attrezzatura
const TString& TRisoatt_key::mese() const
{
return mid(21, 2);
return mid(25, 2);
}
const TString& TRisoatt_key::giorno() const
{
return mid(23, 2);
return mid(27, 2);
}
const TString& TRisoatt_key::data() const
{
TDate d(mid(17, 8));
TDate d(mid(21, 8));
TString & str = get_tmp_string(12);
str = d.string(ANSI);
@ -553,19 +560,21 @@ 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* giorno, const char* tpora)
TRisoatt_key::TRisoatt_key(const char* codlist, const char risoatt, const char* codice, const int anno, const char* mese, const char* giorno, const char* tpora)
{
TString16 lis = codlist; lis.left_just(4);
TString16 cod = codice; cod.left_just(16);
TString chiave; chiave << risoatt << cod << anno << mese << giorno << tpora;
TString chiave; chiave << lis << risoatt << cod << anno << mese << giorno << tpora;
set(chiave);
}
TRisoatt_key::TRisoatt_key(const char risoatt, const char* codice, const TDate & date, const char* tpora)
TRisoatt_key::TRisoatt_key(const char* codlist, const char risoatt, const char* codice, const TDate & date, const char* tpora)
{
TString16 lis = codlist; lis.lpad(4, '0');
TString16 cod = codice; cod.left_just(16);
TString chiave; chiave << risoatt << cod << date.string(ANSI) << tpora;
TString chiave; chiave << lis << risoatt << cod << date.string(ANSI) << tpora;
set(chiave);
}
@ -611,6 +620,12 @@ const real TRisoatt::valuni() const
return get_real("R1");
}
//VALUNIPR: metodo che restituisce il valore unitario contenuto nella tabella di modulo
const real TRisoatt::valunipr() const
{
return get_real("R2");
}
//costruttore
TRisoatt::TRisoatt(const TRectype& r)
: TRectype(r)

@ -160,6 +160,7 @@ class TRisoatt_key : public TString80
public:
TRisoatt_key & operator =(const TRisoatt_key& roakey) { return *this; }
const TString& codlist() const;
const char tipo() const;
const TString& cod() const;
const int anno() const;
@ -169,8 +170,8 @@ public:
const TString& data() const;
//costruttore
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* codlist, const char risoatt, const char* codice, const int anno, const char* mese, const char * giorno, const char* tpora);
TRisoatt_key(const char* codlist, const char risoatt, const char* codice, const TDate & data, const char* tpora);
TRisoatt_key(const char* roakey);
};
@ -190,6 +191,7 @@ public:
const TString& chiave() const;
const TString& descr() const;
const real valuni() const;
const real valunipr() const;
//costruttore
TRisoatt(const TRectype& r);

@ -21,6 +21,7 @@ Picture = <ci01>
Module = 8
Flags = "F"
Item_01 = "Tabella tipo ore", "ci0 -0 ORE", "F"
Item_01 = "Tabella Listini", "ci0 -0 LIS", "F"
Item_02 = "Gestione Listini Costi", "ci0 -1", "F"
Item_03 = "Gestione Disponibilità", "ci0 -4", "F"
Item_04 = "Gestione Predefiniti", "ci0 -5", "F"

3
ci/citblis.h Executable file

@ -0,0 +1,3 @@
//campi maschera citbore (Tabella Listini rilevazione)
#define F_COD_LIS 101
#define F_DES_LIS 102

44
ci/citblis.uml Executable file

@ -0,0 +1,44 @@
#include "citblis.h"
TOOLBAR "" 0 0 0 2
#include "relapbar.h"
ENDPAGE
PAGE "Tabella Listini Rilevazione" 0 2 0 0
GROUPBOX DLG_NULL 76 4
BEGIN
PROMPT 1 1 "@bDati Listino"
END
STRING F_COD_LIS 4
BEGIN
PROMPT 2 2 "Codice "
FLAGS "UZ"
USE &LIS
INPUT CODTAB F_COD_LIS
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_COD_LIS CODTAB
OUTPUT F_DES_LIS S0
CHECKTYPE REQUIRED
FIELD CODTAB
KEY 1
END
STRING F_DES_LIS 50
BEGIN
PROMPT 2 3 "Descrizione "
USE &LIS KEY 2
INPUT CODTAB F_COD_LIS
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT F_COD_LIS
FIELD S0
KEY 2
CHECKTYPE REQUIRED
END
ENDPAGE
ENDMASK

@ -1,3 +1,3 @@
125
0
$rilore|0|0|164|0|Rilevamento Ore|||
$rilore|11|16|168|0|Rilevamento Ore|||

@ -1,5 +1,5 @@
125
22
23
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
@ -14,10 +14,11 @@ CODFASE|1|10|0|Codice Fase
DADATA|5|8|0|Data Inizio
ADATA|5|8|0|Data Fine
QTAORE|2|4|0|Quantita' ora
CODLIST|1|4|0|Codice Listino
COSTO|4|10|2|Costo Unitario
PROVV|1|1|0|Chiave doc - PROVV
ANNO|2|4|0|Chiave doc - ANNO
CODNUM|2|4|0|Chiave doc - CODNUM
CODNUM|1|4|0|Chiave doc - CODNUM
NDOC|3|7|0|Chiave doc - NDOC
IDRIGA|3|6|0|Chiave doc -IDRIGA
CUP|1|15|0|Codice Unico di Progetto

@ -15,6 +15,7 @@
#define RILORE_DADATA "DADATA"
#define RILORE_ADATA "ADATA"
#define RILORE_QTAORE "QTAORE"
#define RILORE_CODLIST "CODLIST"
#define RILORE_COSTO "COSTO"
#define RILORE_PROVV "PROVV"
#define RILORE_ANNO "ANNO"