Patch level : 10.0 patch 808

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Rilevazione ore


git-svn-id: svn://10.65.10.50/branches/R_10_00@20887 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2010-09-21 14:36:08 +00:00
parent a16fcd0b21
commit 056f30451a
16 changed files with 355 additions and 453 deletions

View File

@ -134,6 +134,7 @@ void TRisoatt_msk::riempi_sheet()
riga.add(roakey.tpora(), sheet.cid2index(S_TPORA));
riga.add(roa.valuni().string(), sheet.cid2index(S_VALUNI));
riga.add(roakey.anno(), sheet.cid2index(S_ANNO));
sheet.check_row(sheet.items() - 1);
}
sheet.set_column_justify(sheet.cid2index(S_VALUNI), true);
@ -177,43 +178,11 @@ 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)
{
const real& valuni = msk.get_real(S_VALUNI);
if(valuni > ZERO)
{
riga.add(msk.get(S_RISOATT)[0], sheet.cid2index(S_RISOATT));
const char tipo = msk.get(S_RISOATT)[0];
switch(tipo)
{
case 'R':
{
riga.add(msk.get(S_CODRIS), sheet.cid2index(S_CODRIS));
riga.add(msk.get(S_DESRIS), sheet.cid2index(S_DESRIS));
}
break;
case 'A':
{
riga.add(msk.get(S_CODATT), sheet.cid2index(S_CODATT));
riga.add(msk.get(S_DESATT), sheet.cid2index(S_DESATT));
}
break;
default : break;
}
riga.add(msk.get(S_ANNO), sheet.cid2index(S_ANNO));
riga.add(msk.get(S_MESE), sheet.cid2index(S_MESE));
riga.add(msk.get(S_TPORA), sheet.cid2index(S_TPORA));
riga.add(msk.get(S_VALUNI), sheet.cid2index(S_VALUNI));
}
else
{
sheet.destroy(r);
sheet.force_update();
}
}
msk.enable_default();
if(msk.run() == K_ENTER && msk.get_real(S_VALUNI) > ZERO)
sheet.update_row(r);
else
sheet.destroy(r);
msk.enable_default();
sheet.force_update();
}
@ -275,8 +244,8 @@ void TRisoatt_msk::registra()
{
tab.put("R1", valuni);
tab.put("I0", anme);
tab.rewrite();
}
err = tab.rewrite();
}
else
{

View File

@ -202,7 +202,6 @@ BEGIN
OUTPUT S_CODATT CODTAB
OUTPUT S_DESATT S0
CHECKTYPE REQUIRED
MESSAGE COPY,S_CODRIS
FLAGS "GD"
GROUP 2
END
@ -257,7 +256,7 @@ END
BUTTON DLG_RESET 2 2
BEGIN
PROMPT 2 1 "Azzera"
MESSAGE EXIT,K_DEL
MESSAGE RESET,S_VALUNI
PICTURE TOOL_RESET
END

View File

@ -130,7 +130,6 @@ void TDisp_risoatt_msk::riempi_sheet()
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));
sheet.check_row(sheet.items() - 1);
}
@ -173,44 +172,10 @@ void TDisp_risoatt_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)
{
const int oreprev = msk.get_int(S_OREPREV);
const int orecons = msk.get_int(S_ORECONS);
if(oreprev > 0 || orecons > 0)
{
riga.add(msk.get(S_RISOATT)[0], sheet.cid2index(S_RISOATT));
const char tipo = msk.get(S_RISOATT)[0];
switch(tipo)
{
case 'R':
{
riga.add(msk.get(S_CODRIS), sheet.cid2index(S_CODRIS));
riga.add(msk.get(S_DESRIS), sheet.cid2index(S_DESRIS));
}
break;
case 'A':
{
riga.add(msk.get(S_CODATT), sheet.cid2index(S_CODATT));
riga.add(msk.get(S_DESATT), sheet.cid2index(S_DESATT));
}
break;
default : break;
}
riga.add(msk.get(S_ANNO), sheet.cid2index(S_ANNO));
riga.add(msk.get(S_MESE), sheet.cid2index(S_MESE));
riga.add(msk.get(S_TPORA), sheet.cid2index(S_TPORA));
riga.add(msk.get(S_OREPREV), sheet.cid2index(S_OREPREV));
riga.add(msk.get(S_ORECONS), sheet.cid2index(S_ORECONS));
}
else
{
sheet.destroy(r);
sheet.force_update();
}
}
if (msk.run() == K_ENTER && (msk.get_int(S_OREPREV) > 0 || msk.get_int(S_ORECONS) > 0))
sheet.update_row(r);
else
sheet.destroy(r);
msk.enable_default();
sheet.force_update();
}

View File

@ -198,7 +198,6 @@ BEGIN
OUTPUT S_DESATT S0
CHECKTYPE REQUIRED
FLAGS "GD"
MESSAGE COPY,S_CODRIS
GROUP 2
END
@ -258,7 +257,7 @@ END
BUTTON DLG_RESET 2 2
BEGIN
PROMPT 2 1 "Azzera"
MESSAGE EXIT,K_DEL
MESSAGE RESET,S_OREPREV|RESET,S_ORECONS
PICTURE TOOL_RESET
END

View File

@ -82,14 +82,15 @@ void TDef_risoatt_msk::get_anal_fields(TString& cdc, TString& cms, TString& fase
void TDef_risoatt_msk::get_row_anal_fields(TToken_string & row, TString & cdc, TString & cms, TString & fase)
{
TMask & m = sfield(F_SHEET).sheet_mask();
TSheet_field & s = sfield(F_SHEET);
TMask & m = s.sheet_mask();
TString val;
cdc.cut(0);
if (_scdc_sid >= 0)
for ( short id = _scdc_sid; id <= _scdc_lid; id++)
{
val = m.get(id);
val = row.get(s.cid2index(id));
val.rpad(m.field(id).size());
cdc << val;
}
@ -98,7 +99,7 @@ void TDef_risoatt_msk::get_row_anal_fields(TToken_string & row, TString & cdc, T
if (_scms_sid >= 0)
for ( short id = _scms_sid; id <= _scms_lid; id++)
{
val = m.get(id);
val = row.get(s.cid2index(id));
val.rpad(m.field(id).size());
cms << val;
}
@ -107,7 +108,7 @@ void TDef_risoatt_msk::get_row_anal_fields(TToken_string & row, TString & cdc, T
if (_sfase_sid >= 0)
for ( short id = _sfase_sid; id <= _sfase_lid; id++)
{
val = m.get(id);
val = row.get(s.cid2index(id));
val.rpad(m.field(id).size());
fase << val;
}
@ -150,17 +151,17 @@ void TDef_risoatt_msk::put_row_anal_fields(TToken_string & row, const TString &
void TDef_risoatt_msk::riempi_sheet()
{
//leggo dalla maschera i campi chiave di ricerca
const TString4 anno = get(F_ANNO);
const int anno = get_int(F_ANNO);
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
const TString4 mese = get(F_MESE);
const int mese = get_int(F_MESE);
const TString4 tpora = get(F_TPORA);
TString80 codcosto;
TString80 codcms;
TString16 codfase;
TString16 codice;
switch(get(F_RISOATT)[0])
{
case 'T': codice = get(F_CODICE); break;
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
@ -169,45 +170,46 @@ void TDef_risoatt_msk::riempi_sheet()
get_anal_fields(codcosto, codcms, codfase);
TString query;
query << "USE " << LF_RILORE << "\n" ;
TString select;
if (risoatt.full())
select << "(BETWEEN(" << RILORE_TIPORA << ",\"" << risoatt << "\",\"" << risoatt << "\"))";
select << "(" << RILORE_TIPORA << "==" << risoatt << ")";
if (codice.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODICE << ",\"" << codice << "\",\"" << codice << "\"))";
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
}
if (anno > 0)
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_ANNO << ",\"" << anno << "\",\"" << anno << "\"))";
select << "STR(" << RILORE_ANNO << "==" << anno << ")";
}
if (mese.full())
if (mese > 0)
{
if (select.full()) select << "&&";
select << "(BETWEEN(MESE,\"" << mese << "\",\"" << mese << "\"))";
select << "STR(" RILORE_MESE << "==" << mese << ")";
}
if (tpora.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_TPORA << ",\"" << tpora << "\",\"" << tpora << "\"))";
select << "(" << RILORE_TPORA << "==\"" << tpora << "\")";
}
if (codcosto.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODCOSTO << ",\"" << codcosto << "\",\"" << codcosto << "\"))";
select << "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")";
}
if (codcms.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODCMS << ",\"" << codcms << "\",\"" << codcms << "\"))";
select << "(" << RILORE_CODCMS << "==\"" << codcms << "\")";
}
if (codfase.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODFASE << ",\"" << codfase << "\",\"" << codfase << "\"))";
select << "(" << RILORE_CODFASE << "==\"" << codfase << "\")";
}
if (select.full())
query << "SELECT " << select << "\n";
@ -219,10 +221,10 @@ void TDef_risoatt_msk::riempi_sheet()
if(codice.full())
{
fromto << " " << RILORE_CODICE << "=\"" << codice << "\" ";
if(anno.full())
if(anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if(mese.full())
if(mese > 0)
{
fromto << " " << RILORE_MESE << "=\"" << mese << "\" ";
if(tpora.full())
@ -258,7 +260,7 @@ void TDef_risoatt_msk::riempi_sheet()
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));
sheet.check_row(sheet.items() - 1);
}
sheet.force_update();
}
@ -290,7 +292,7 @@ void TDef_risoatt_msk::nuova_riga()
if (tipo == "R")
riga.add(get(F_CODRIS), sheet.cid2index(S_CODRIS));
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));
@ -317,22 +319,11 @@ void TDef_risoatt_msk::nuova_riga()
msk.enable(id, codfase.blank());
//lancio la maschera di riga da compilare
if(msk.run() == K_ENTER)
{
const int qtaore = msk.get_int(S_QTAORE);
const real prezzo = msk.get_real(S_COSTO);
if(qtaore > 0)
sheet.update_row(r);
else
{
sheet.destroy(sheet.items() - 1);
sheet.force_update();
}
}
if (msk.run() == K_ENTER && msk.get_int(S_QTAORE) > 0)
sheet.update_row(r);
else
sheet.destroy(r);
msk.enable_default();
sheet.check_row(sheet.items() - 1);
sheet.force_update();
}
@ -366,7 +357,7 @@ void TDef_risoatt_msk::azzera_tutto(TSheet_field& sheet)
//vaoler pari a zero, e poi ricarica lo sheet
void TDef_risoatt_msk::registra()
{
TLocalisamfile file(LF_RILORE);
TRilevamento_ore rilroa;
TSheet_field& sheet = sfield(F_SHEET);
FOR_EACH_SHEET_ROW(sheet, r, row)
@ -375,7 +366,7 @@ void TDef_risoatt_msk::registra()
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 TString4 mese = riga.get(sheet.cid2index(S_MESE));
const int mese = riga.get_int(sheet.cid2index(S_MESE));
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
TString80 codcosto;
TString80 codcms;
@ -386,25 +377,15 @@ void TDef_risoatt_msk::registra()
get_row_anal_fields(riga, codcosto, codcms, codfase);
TRilevamento_ore rilroa('D', tipora, codice, anno, mese, tpora, codcosto, codcms, codfase);
if(!rilroa.empty() && qtaore == 0)
rilroa.remove(file);
rilroa.read('D', tipora, codice, anno, mese, 0, tpora, codcosto, codcms, codfase);
if (qtaore == 0)
rilroa.remove();
else
{
TRilevamento_ore rilroa;
rilroa.set_tipo('D');
rilroa.set_tipora(tipora);
rilroa.set_codice(codice);
rilroa.set_anno(anno);
rilroa.set_mese(mese);
rilroa.set_tpora(tpora);
rilroa.set_codcosto(codcosto);
rilroa.set_codcms(codcms);
rilroa.set_codfase(codfase);
rilroa.set_qtaore(qtaore);
rilroa.set_costo(costo);
int err = rilroa.rewrite_write(file);
int err = rilroa.rewrite_write();
}
}
riempi_sheet();
@ -471,7 +452,6 @@ bool TDef_risoatt_msk::on_field_event(TOperable_field& f, TField_event e, long j
case F_ANNO:
case F_MESE:
case F_RISOATT:
case F_CODICE:
case F_CODRIS:
case F_CODATT:
case F_TPORA:

View File

@ -72,22 +72,6 @@ BEGIN
FLAGS "Z"
END
STRING F_CODICE 16
BEGIN
PROMPT 23 2 "Codice "
USE LF_RILORE
SELECT TIPO='D'
DISPLAY "Tipo@5" TIPORA
DISPALY "Codice@16" CODICE
DISPLAY "Anno@5" ANNO
DISPLAY "Mese@5" MESE
DISPLAY "Tipo\nora@5" TPORA
OUTPUT F_RISOATT TIPORA
OUTPUT F_CODICE CODICE
GROUP 1
CHECKTYPE NORMAL
END
STRING F_CODRIS 16
BEGIN
PROMPT 23 2 "Codice "
@ -122,7 +106,7 @@ BEGIN
CHECKTYPE NORMAL
END
STRING F_DESATT 50
STRING F_DESATT 50 27
BEGIN
PROMPT 50 2 ""
FLAGS "D"
@ -168,7 +152,6 @@ END
RADIOBUTTON S_RISOATT 1 74
BEGIN
PROMPT 2 2 "@bTipo "
FIELD CODTAB[0,1]
ITEM "R|Risorsa"
MESSAGE SHOW,1@|HIDE,2@|RESET,2@
ITEM "A|Attrezzatura"
@ -179,7 +162,6 @@ END
STRING S_CODRIS 16
BEGIN
PROMPT 2 5 "Codice Risorsa "
FIELD CODTAB[1,16]
USE RSS
INPUT CODTAB S_CODRIS
DISPLAY "Codice@16" CODTAB
@ -202,7 +184,6 @@ END
STRING S_CODATT 16
BEGIN
PROMPT 2 5 "Codice Attrezzatura "
FIELD CODTAB[1,16]
USE ATR
INPUT CODTAB S_CODATT
DISPLAY "Codice@16" CODTAB
@ -212,7 +193,6 @@ BEGIN
CHECKTYPE REQUIRED
FLAGS "GD"
GROUP 2
MESSAGE COPY,S_CODRIS
END
STRING S_DESATT 50
@ -233,7 +213,6 @@ END
LISTBOX S_MESE 10
BEGIN
PROMPT 22 7 "Mese"
FILED CODTAB[21,2]
FLAGS "MD"
END
@ -252,96 +231,72 @@ END
STRING S_CDC1 20
BEGIN
PROMPT 2 8 "Cdc 1"
USE LF_CDC
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC2 20
BEGIN
PROMPT 2 8 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC3 20
BEGIN
PROMPT 2 8 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC4 20
BEGIN
PROMPT 2 8 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC5 20
BEGIN
PROMPT 2 9 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC6 20
BEGIN
PROMPT 2 9 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC7 20
BEGIN
PROMPT 2 9 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC8 20
BEGIN
PROMPT 2 9 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC9 20
BEGIN
PROMPT 2 10 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC10 20
BEGIN
PROMPT 2 10 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC11 20
BEGIN
PROMPT 2 10 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
STRING S_CDC12 20
BEGIN
PROMPT 2 10 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
END
@ -367,7 +322,7 @@ END
BUTTON DLG_RESET 2 2
BEGIN
PROMPT 2 1 "Azzera"
MESSAGE EXIT,K_DEL
MESSAGE RESET,S_QTAORE
PICTURE TOOL_RESET
END

View File

@ -170,14 +170,15 @@ void TRilevamento_prev_msk::get_anal_fields(TString & cdc, TString & cms, TStrin
void TRilevamento_prev_msk::get_row_anal_fields(TToken_string & row, TString & cdc, TString & cms, TString & fase)
{
TMask & m = sfield(F_SHEET).sheet_mask();
TSheet_field & s = sfield(F_SHEET);
TMask & m = s.sheet_mask();
TString val;
cdc.cut(0);
if (_scdc_sid >= 0)
for ( short id = _scdc_sid; id <= _scdc_lid; id++)
{
val = m.get(id);
val = row.get(s.cid2index(id));
val.rpad(m.field(id).size());
cdc << val;
}
@ -186,7 +187,7 @@ void TRilevamento_prev_msk::get_row_anal_fields(TToken_string & row, TString & c
if (_scms_sid >= 0)
for ( short id = _scms_sid; id <= _scms_lid; id++)
{
val = m.get(id);
val = row.get(s.cid2index(id));
val.rpad(m.field(id).size());
cms << val;
}
@ -195,7 +196,7 @@ void TRilevamento_prev_msk::get_row_anal_fields(TToken_string & row, TString & c
if (_sfase_sid >= 0)
for ( short id = _sfase_sid; id <= _sfase_lid; id++)
{
val = m.get(id);
val = row.get(s.cid2index(id));
val.rpad(m.field(id).size());
fase << val;
}
@ -238,8 +239,8 @@ void TRilevamento_prev_msk::carica_default()
//leggo dalla maschera i campi chiave di ricerca
const int anno = get_date(F_DADATA).year();
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
TString4 damese; damese.format("%02d", get_date(F_DADATA).month());
TString4 amese; amese.format("%02d", get_date(F_ADATA).month());
const int damese = get_date(F_DADATA).month();
const int amese = get_date(F_ADATA).month();
const TString4 tpora = get(F_TPORA);
TString80 codcosto;
TString80 codcms;
@ -248,7 +249,6 @@ void TRilevamento_prev_msk::carica_default()
switch(get(F_RISOATT)[0])
{
case 'T': codice = get(F_CODICE); break;
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
@ -258,22 +258,47 @@ void TRilevamento_prev_msk::carica_default()
TString query;
query << "USE " << LF_RILORE << "\n";
TString select;
if (risoatt.full())
query << "SELECT (BETWEEN(" << RILORE_TIPORA << ",\"" << risoatt << "\",\"" << risoatt << "\"))";
query << "SELECT (" << RILORE_TIPORA << "==" << risoatt << ")";
if (codice.full())
query << "&&(BETWEEN(" << RILORE_CODICE << ",\"" << codice << "\",\"" << codice << "\"))";
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
}
if (anno > 0)
query << "&&(BETWEEN(" << RILORE_ANNO << ",\"" << anno << "\",\"" << anno << "\"))";
query << "(BETWEEN(MESE,\"" << damese << "\",\"" << amese << "\"))&&";
{
if (select.full()) select << "&&";
select << "STR(" << RILORE_ANNO << "==" << anno << ")";
}
if (damese > 0 || amese > 0)
{
if (select.full()) select << "&&";
select << "(BETWEEN(MESE,\"" << damese << "\",\"" << amese << "\"))";
}
if (tpora.full())
query << "&&(BETWEEN(" << RILORE_TPORA << ",\"" << tpora << "\",\"" << tpora << "\"))";
{
if (select.full()) select << "&&";
select << "(" << RILORE_TPORA << "==\"" << tpora << "\")";
}
if (codcosto.full())
query << "&&(BETWEEN(" << RILORE_CODCOSTO << ",\"" << codcosto << "\",\"" << codcosto << "\"))";
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")";
}
if (codcms.full())
query << "&&(BETWEEN(" << RILORE_CODCMS << ",\"" << codcms << "\",\"" << codcms << "\"))";
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODCMS << "==\"" << codcms << "\")";
}
if (codfase.full())
query << "&&(BETWEEN(" << RILORE_CODFASE << ",\"" << codfase << "\",\"" << codfase << "\"))";
query << "\n";
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODFASE << "==\"" << codfase << "\")";
}
if (select.full())
query << "SELECT " << select << "\n";
TString fromto = RILORE_TIPO "=\"D\" ";
if(risoatt != 'T')
@ -285,7 +310,7 @@ void TRilevamento_prev_msk::carica_default()
if(anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if(damese.full())
if(damese > 0)
{
fromto << RILORE_MESE << "=\"" << damese << "\" ";
if(tpora.full())
@ -326,6 +351,7 @@ void TRilevamento_prev_msk::carica_default()
put_row_anal_fields(riga, rilore.codcosto(), rilore.codcms(), rilore.codfase());
riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
riga.add(proponi_costo(riga).string(), sheet.cid2index(S_COSTO));
sheet.check_row(sheet.items() - 1);
}
sheet.force_update();
@ -338,8 +364,8 @@ void TRilevamento_prev_msk::riempi_sheet()
//leggo dalla maschera i campi chiave di ricerca
const int anno = get_date(F_DADATA).year();
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
TString4 damese; damese.format("%02d", get_date(F_DADATA).month()); if (damese == "00") damese = "01";
TString4 amese; amese.format("%02d", get_date(F_ADATA).month()); if (amese == "00") amese = "12";
int damese = get_date(F_DADATA).month();
int amese = get_date(F_ADATA).month();
const TString4 tpora = get(F_TPORA);
TString80 codcosto;
TString80 codcms;
@ -347,7 +373,6 @@ void TRilevamento_prev_msk::riempi_sheet()
TString16 codice;
switch(get(F_RISOATT)[0])
{
case 'T': codice = get(F_CODICE); break;
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
@ -360,19 +385,22 @@ void TRilevamento_prev_msk::riempi_sheet()
TString select;
if (risoatt.full())
select << "(BETWEEN(" << RILORE_TIPORA << ",\"" << risoatt << "\",\"" << risoatt << "\"))";
select << "(" << RILORE_TIPORA << "==" << risoatt << ")";
if (codice.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODICE << ",\"" << codice << "\",\"" << codice << "\"))";
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
}
if (anno > 0)
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_ANNO << ",\"" << anno << "\",\"" << anno << "\"))";
select << "STR(" << RILORE_ANNO << "==" << anno << ")";
}
if ( damese > 0 || amese > 0)
{
if (select.full()) select << "&&";
select << "(BETWEEN(MESE,\"" << damese << "\",\"" << amese << "\"))";
}
if (tpora.full())
{
if (select.full()) select << "&&";
@ -406,7 +434,7 @@ void TRilevamento_prev_msk::riempi_sheet()
if(anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if(damese.full())
if(damese > 0)
{
fromto << RILORE_MESE << "=\"" << damese << "\" ";
if(tpora.full())
@ -444,6 +472,7 @@ void TRilevamento_prev_msk::riempi_sheet()
riga.add(rilore.adata(), sheet.cid2index(S_ADATA));
riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
riga.add(rilore.costo().string(), sheet.cid2index(S_COSTO));
sheet.check_row(sheet.items() - 1);
}
sheet.force_update();
}
@ -504,18 +533,12 @@ void TRilevamento_prev_msk::nuova_riga()
msk.enable(id, codfase.blank());
//lancio la maschera di riga da compilare
if(msk.run() == K_ENTER)
if(msk.run() == K_ENTER && msk.get_int(S_QTAORE) > 0)
sheet.update_row(r);
else
{
const int qtaore = msk.get_int(S_QTAORE);
const real prezzo = msk.get_real(S_COSTO);
if(qtaore > 0)
sheet.update_row(r);
else
{
sheet.destroy(sheet.items() - 1);
sheet.force_update();
}
sheet.destroy(r);
sheet.force_update();
}
msk.enable_default();
@ -553,7 +576,7 @@ void TRilevamento_prev_msk::azzera_tutto(TSheet_field& sheet)
//vaoler pari a zero, e poi ricarica lo sheet
void TRilevamento_prev_msk::registra()
{
TLocalisamfile file(LF_RILORE);
TRilevamento_ore rilroa;
TSheet_field& sheet = sfield(F_SHEET);
FOR_EACH_SHEET_ROW(sheet, r, row)
@ -570,31 +593,24 @@ void TRilevamento_prev_msk::registra()
const int qtaore = riga.get_int(sheet.cid2index(S_QTAORE));
const TString& tmp = riga.get(sheet.cid2index(S_COSTO));
const real costo(tmp);
TString4 mese; mese.format("%02d", adata.month());
TRilevamento_ore rilroa('P', tipora, codice, adata.year(), mese, tpora);
const int mese = adata.month();
get_row_anal_fields(riga, codcosto, codcms, codfase);
if(!rilroa.empty() && qtaore == 0)
rilroa.remove(file);
rilroa.read('P', tipora, codice, adata.year(), mese, 0, tpora);
if(qtaore == 0)
rilroa.remove();
else
{
TRilevamento_ore rilroa;
rilroa.set_tipo('P');
rilroa.set_tipora(tipora);
rilroa.set_codice(codice);
rilroa.set_anno(adata.year());
rilroa.set_mese(mese);
rilroa.set_tpora(tpora);
rilroa.set_codcosto(codcosto);
rilroa.set_codcms(codcms);
rilroa.set_codfase(codfase);
rilroa.set_dadata(dadata);
rilroa.set_codcosto(codcosto);
rilroa.set_codcms(codcms);
rilroa.set_codfase(codfase);
rilroa.set_adata(adata);
rilroa.set_qtaore(qtaore);
rilroa.set_costo(costo);
int err = rilroa.rewrite_write(file);
int err = rilroa.rewrite_write();
}
}
riempi_sheet();
@ -694,7 +710,7 @@ TRilevamento_prev_msk::TRilevamento_prev_msk()
TMask & sm = s.sheet_mask();
int y = 3;
int sy = 8;
short dlg = F_ANAL; // id del primo campo da generare
short dlg = F_ANAL; // id del primo campo da generare
short sdlg = S_CDC1 + 100; // id del primo campo da generare
_cdc_sid = _cdc_lid = _cms_sid = _cms_lid = _fase_sid = _fase_lid = -1;
@ -824,4 +840,4 @@ int ci2100(int argc, char *argv[])
TRilevamento_prev_app a;
a.run (argc, argv, TR("Rilevamento Ore Preventivo"));
return TRUE;
}
}

View File

@ -1,4 +1,4 @@
//Campi maschera ci0600a
//Campi maschera ci2100a
#define F_DADATA 301
#define F_ADATA 302
#define F_TPORA 303

View File

@ -45,12 +45,12 @@ END
DATE F_DADATA
BEGIN
PROMPT 3 1 "Dal"
PROMPT 3 1 "Dal "
END
DATE F_ADATA
BEGIN
PROMPT 23 1 "Al"
PROMPT 25 1 "Al"
END
STRING F_TPORA 2
@ -75,22 +75,6 @@ BEGIN
FLAGS "Z"
END
STRING F_CODICE 16
BEGIN
PROMPT 23 2 "Codice "
USE LF_RILORE
SELECT TIPO='D'
DISPLAY "Tipo@5" TIPORA
DISPALY "Codice@16" CODICE
DISPLAY "Anno@5" ANNO
DISPLAY "Mese@5" MESE
DISPLAY "Tipo\nora@5" TPORA
OUTPUT F_RISOATT TIPORA
OUTPUT F_CODICE CODICE
GROUP 1
CHECKTYPE NORMAL
END
STRING F_CODRIS 16
BEGIN
PROMPT 23 2 "Codice "
@ -170,7 +154,6 @@ END
RADIOBUTTON S_RISOATT 1 70
BEGIN
PROMPT 2 2 "@bTipo "
FIELD CODTAB[0,1]
ITEM "R|Risorsa"
MESSAGE SHOW,1@|HIDE,2@|RESET,2@
ITEM "A|Attrezzatura"
@ -181,7 +164,6 @@ END
STRING S_CODRIS 16
BEGIN
PROMPT 2 5 "Codice Risorsa "
FIELD CODTAB[1,16]
USE RSS
INPUT CODTAB S_CODRIS
DISPLAY "Codice@16" CODTAB
@ -204,7 +186,6 @@ END
STRING S_CODATT 16
BEGIN
PROMPT 2 5 "Codice Attrezzatura "
FIELD CODTAB[1,16]
USE ATR
INPUT CODTAB S_CODATT
DISPLAY "Codice@16" CODTAB
@ -214,7 +195,6 @@ BEGIN
CHECKTYPE REQUIRED
FLAGS "GD"
GROUP 2
MESSAGE COPY,S_CODRIS
END
STRING S_DESATT 50
@ -243,103 +223,80 @@ BEGIN
DISPLAY "Codice@16" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT S_TPORA CODTAB
CHECKTYPE REQUIRED
FLAGS "D"
END
STRING S_CDC1 20
BEGIN
PROMPT 2 8 "Cdc 1"
USE LF_CDC
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC2 20
BEGIN
PROMPT 2 8 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC3 20
BEGIN
PROMPT 2 8 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC4 20
BEGIN
PROMPT 2 8 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC5 20
BEGIN
PROMPT 2 9 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC6 20
BEGIN
PROMPT 2 9 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC7 20
BEGIN
PROMPT 2 9 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC8 20
BEGIN
PROMPT 2 9 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC9 20
BEGIN
PROMPT 2 10 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC10 20
BEGIN
PROMPT 2 10 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC11 20
BEGIN
PROMPT 2 10 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC12 20
BEGIN
PROMPT 2 10 "Cdc 2"
COPY USE S_CDC1
CHECKTYPE NORMAL
FLAGS "H"
FLAGS "HB"
END
NUMBER S_QTAORE 6
@ -364,7 +321,8 @@ END
BUTTON DLG_RESET 2 2
BEGIN
PROMPT 2 1 "Azzera"
MESSAGE EXIT,K_DEL
MESSAGE RESET,S_QTAORE
PICTURE TOOL_RESET
END

View File

@ -11,6 +11,7 @@
#include "ci2.h"
#include "cilib.h"
#include "ci2200a.h"
#include "rilore.h"
#include "../ve/velib.h"
////////////////////////////////////////////
@ -61,11 +62,9 @@ const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
const TRisoatt_key chiave(tipo, codice, anno, mese, tpora);
TModule_table roa("&ROA");
roa.put("CODTAB", chiave);
int err = roa.read();
const TRectype & roa = cache().get("&ROA", chiave);
if(err == NOERR)
if(!roa.empty())
costo = roa.get_real("R1");
else
{
@ -91,51 +90,52 @@ void TRilevamento_cons_msk::carica_default()
//leggo dalla maschera i campi chiave di ricerca
const int anno = get_int(F_ANNO);
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
const TString4 mese = get(F_MESE);
const int mese = get_int(F_MESE);
const TString4 tpora = get(F_TPORA);
const TString80 codcosto = get(F_CODCOSTO);
const TString80 codcms = get(F_CODCMS);
const TString16 codfase = get(F_CODFASE);
TString16 codice;
switch(get(F_RISOATT)[0])
switch(get(F_RISOATT)[0])
{
case 'T': codice = get(F_CODICE); break;
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
}
TString query;
query << "USE RILORE\n"
<< "SELECT (BETWEEN(TIPORA,\"" << risoatt << "\",\"" << risoatt << "\"))&&"
<< "(BETWEEN(CODICE,\"" << codice << "\",\"" << codice << "\"))&&"
<< "(BETWEEN(ANNO," << anno << "," << anno << "))&&"
<< "(BETWEEN(MESE,\"" << mese << "\",\"" << mese << "\"))&&"
<< "(BETWEEN(TPORA,\"" << tpora << "\",\"" << tpora << "\"))&&"
<< "(BETWEEN(CODCOSTO,\"" << codcosto << "\",\"" << codcosto << "\"))&&"
<< "(BETWEEN(CODCMS,\"" << codcms << "\",\"" << codcms << "\"))&&"
<< "(BETWEEN(CODFASE,\"" << codfase << "\",\"" << codfase << "\"))\n";
query << "USE " << LF_RILORE << "\n"
<< "SELECT (" << RILORE_TIPORA << "==\"" << risoatt << "\")&&"
<< "(" << RILORE_CODICE << "==\"" << codice << "\")&&"
<< "STR(" << RILORE_ANNO << "==" << anno << ")&&"
<< "STR(" << RILORE_MESE << "==" << mese << ")&&"
<< "(" << RILORE_TPORA << "==\"" << tpora << "\")&&"
<< "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")&&"
<< "(" << RILORE_CODCMS << "==\"" << codcms << "\")&&"
<< "(" << RILORE_CODFASE << "==\"" << codfase << "\")\n";
TString fromto = "TIPO=\"D\"";
if(risoatt != 'T')
{
fromto << " TIPORA=\"" << risoatt << "\"";
if(codice.full())
{
fromto << " CODICE=\"" << codice << "\"";
if(anno > 0)
{
fromto << " ANNO=\"" << anno << "\"";
if(mese.full())
{
fromto << " MESE=\"" << mese << "\"";
if(tpora.full())
fromto << " TPORA=\"" << tpora << "\"";
}
}
}
}
TISAM_recordset def(query);
TString fromto = RILORE_TIPO "=\"D\" ";
if(risoatt != 'T')
{
fromto << " " << RILORE_TIPORA << "=\"" << risoatt << "\" ";
if(codice.full())
{
fromto << " " << RILORE_CODICE << "=\"" << codice << "\" ";
if(anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if(mese > 0)
{
fromto << RILORE_MESE << "=\"" << mese << "\" ";
if(tpora.full())
fromto << " " << RILORE_TPORA << "=\"" << tpora << "\" ";
}
}
}
}
TISAM_recordset def(query);
riempi_calendario(def);
}
@ -250,29 +250,30 @@ void TRilevamento_cons_msk::riempi_risoatt(TDate& data, const char* codcosto, co
//preparo la query
TString query;
if(_mode == 'F')
query << "USE RILORE\n"
<< "SELECT (BETWEEN(TIPORA,\"" << risoatt << "\",\"" << risoatt << "\"))&&"
<< "(BETWEEN(ANNO," << anno << "," << anno << "))&&"
<< "(BETWEEN(MESE,\"" << mese << "\",\"" << mese << "\"))&&"
<< "(BETWEEN(TPORA,\"" << tpora << "\",\"" << tpora << "\"))&&"
<< "(BETWEEN(CODCOSTO,\"" << codcosto << "\",\"" << codcosto << "\"))&&"
<< "(BETWEEN(CODCMS,\"" << codcms << "\",\"" << codcms << "\"))&&"
<< "(BETWEEN(CODFASE,\"" << codfase << "\",\"" << codfase << "\"))&&"
<< "(BETWEEN(DADATA,#DATA,#DATA))\n"
<< "FROM TIPO=\"C\"\n"
<< "TO TIPO=\"C\"";
<< "SELECT (" << RILORE_TIPORA << "==\"" << risoatt << "\")&&"
<< "STR(" << RILORE_ANNO << "==" << anno << ")&&"
<< "STR(" << RILORE_MESE << "==" << mese << ")&&"
<< "(" << RILORE_TPORA << "==\"" << tpora << "\")&&"
<< "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")&&"
<< "(" << RILORE_CODCMS << "==\"" << codcms << "\")&&"
<< "(" << RILORE_CODFASE << "==\"" << codfase << "\")&&"
<< "(BETWEEN(" << RILORE_DADATA << ",#DATA,#DATA))\n"
<< "FROM " << RILORE_TIPO << "=\"C\"\n"
<< "TO " << RILORE_TIPO << "=\"C\"";
else
query << "USE RILORE\n"
<< "SELECT (BETWEEN(TIPORA,\"" << risoatt << "\",\"" << risoatt << "\"))&&"
<< "(BETWEEN(ANNO," << anno << "," << anno << "))&&"
<< "(BETWEEN(MESE,\"" << mese << "\",\"" << mese << "\"))&&"
<< "(BETWEEN(TPORA,\"" << tpora << "\",\"" << tpora << "\"))&&"
<< "(BETWEEN(CODCOSTO,\"" << codcosto << "\",\"" << codcosto << "\"))&&"
<< "(BETWEEN(CODCMS,\"" << codcms << "\",\"" << codcms << "\"))&&"
<< "(BETWEEN(CODFASE,\"" << codfase << "\",\"" << codfase << "\"))\n"
<< "FROM TIPO=\"D\"\n"
<< "TO TIPO=\"D\"";
query << "USE " << LF_RILORE << "\n"
<< "SELECT (" << RILORE_TIPORA << "==\"" << risoatt << "\")&&"
<< "STR(" << RILORE_ANNO << "==" << anno << ")&&"
<< "STR(" << RILORE_MESE << "==" << mese << ")&&"
<< "(" << RILORE_TPORA << "==\"" << tpora << "\")&&"
<< "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")&&"
<< "(" << RILORE_CODCMS << "==\"" << codcms << "\")&&"
<< "(" << RILORE_CODFASE << "==\"" << codfase << "\")\n"
<< "FROM " << RILORE_TIPO << "=\"D\"\n"
<< "TO " << RILORE_TIPO << "=\"D\"";
TISAM_recordset def(query);
def.set_var("#DATA", data);
@ -293,6 +294,7 @@ void TRilevamento_cons_msk::riempi_risoatt(TDate& data, const char* codcosto, co
riga.add(rilore.tpora(), sheet.cid2index(S_TPORA));
riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
riga.add(rilore.costo().string(), sheet.cid2index(S_COSTO));
sheet.check_row(sheet.items() - 1);
}
sheet.force_update();
}
@ -304,7 +306,7 @@ void TRilevamento_cons_msk::riempi_sheet()
//leggo dalla maschera i campi chiave di ricerca
const int anno = get_int(F_ANNO);
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
const TString4 mese = get(F_MESE);
const int mese = get_int(F_MESE);
const TString4 tpora = get(F_TPORA);
const TString80 codcosto = get(F_CODCOSTO);
const TString80 codcms = get(F_CODCMS);
@ -319,16 +321,49 @@ void TRilevamento_cons_msk::riempi_sheet()
}
//preparo la query
TString query;
query << "USE RILORE\n"
<< "SELECT (BETWEEN(TIPORA,\"" << risoatt << "\",\"" << risoatt << "\"))&&"
<< "(BETWEEN(CODICE,\"" << codice << "\",\"" << codice << "\"))&&"
<< "(BETWEEN(ANNO," << anno << "," << anno << "))&&"
<< "(BETWEEN(MESE,\"" << mese << "\",\"" << mese << "\"))&&"
<< "(BETWEEN(TPORA,\"" << tpora << "\",\"" << tpora << "\"))&&"
<< "(BETWEEN(CODCOSTO,\"" << codcosto << "\",\"" << codcosto << "\"))&&"
<< "(BETWEEN(CODCMS,\"" << codcms << "\",\"" << codcms << "\"))&&"
<< "(BETWEEN(CODFASE,\"" << codfase << "\",\"" << codfase << "\"))\n";
TString query;
query << "USE " << LF_RILORE << "\n" ;
TString select;
if (risoatt.full())
select << "(" << RILORE_TIPORA << "==" << risoatt << ")";
if (codice.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
}
if (anno > 0)
{
if (select.full()) select << "&&";
select << "STR(" << RILORE_ANNO << "==" << anno << ")";
}
if (mese > 0)
{
if (select.full()) select << "&&";
select << "STR(" RILORE_MESE << "==" << mese << ")";
}
if (tpora.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_TPORA << ",\"" << tpora << "\",\"" << tpora << "\"))";
}
if (codcosto.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODCOSTO << ",\"" << codcosto << "\",\"" << codcosto << "\"))";
}
if (codcms.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODCMS << ",\"" << codcms << "\",\"" << codcms << "\"))";
}
if (codfase.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODFASE << ",\"" << codfase << "\",\"" << codfase << "\"))";
}
if (select.full())
query << "SELECT " << select << "\n";
TString fromto = "TIPO=\"C\"";
if(risoatt != 'T')
@ -340,7 +375,7 @@ void TRilevamento_cons_msk::riempi_sheet()
if(anno > 0)
{
fromto << " ANNO=\"" << anno << "\"";
if(mese.full())
if(mese > 0)
{
fromto << " MESE=\"" << mese << "\"";
if(tpora.full())
@ -356,7 +391,6 @@ void TRilevamento_cons_msk::riempi_sheet()
TISAM_recordset def(query);
riempi_calendario(def);
}
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
@ -381,12 +415,13 @@ void TRilevamento_cons_msk::registra()
TSheet_field& calendario = sfield(F_CALENDARIO);
TToken_string& rigacal = calendario.row(riga);
TSheet_field& sheet = sfield(F_SHEET);
TRilevamento_ore rilroa;
const int mese = get_int(F_MESE);
const int anno = get_int(F_ANNO);
const int giorno = data.day();
TLocalisamfile file(LF_RILORE);
FOR_EACH_SHEET_ROW(sheet, r, row)
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& riga = *(TToken_string*)row;
const char tipora = riga.get_char(sheet.cid2index(S_RISOATT));
@ -396,33 +431,19 @@ void TRilevamento_cons_msk::registra()
const TString80 codcms = rigacal.get(calendario.cid2index(C_CODCMS));
const TString80 codfase = rigacal.get(calendario.cid2index(C_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)));
const TString4 mese = get(F_MESE);
const int anno = get_int(F_ANNO);
TRilevamento_ore rilroa('C', tipora, codice, get_int(F_ANNO), get(F_MESE), tpora);
if(!rilroa.empty() && qtaore == 0)
rilroa.remove(file);
rilroa.read('C', tipora, codice, anno, mese, giorno, tpora);
if(qtaore == 0)
rilroa.remove();
else
{
TRilevamento_ore rilroa;
rilroa.set_tipo('C');
rilroa.set_tipora(tipora);
rilroa.set_codice(codice);
rilroa.set_anno(anno);
rilroa.set_mese(mese);
rilroa.set_tpora(tpora);
rilroa.set_codcosto(codcosto);
rilroa.set_codcms(codcms);
rilroa.set_codfase(codfase);
rilroa.set_dadata(data);
rilroa.set_adata(data);
rilroa.set_qtaore(qtaore);
rilroa.set_costo(costo);
int err = rilroa.rewrite_write(file);
int err = rilroa.rewrite_write();
}
}
riempi_sheet();

View File

@ -73,22 +73,6 @@ BEGIN
FLAGS "Z"
END
STRING F_CODICE 16
BEGIN
PROMPT 23 2 "Codice "
USE LF_RILORE
SELECT TIPO='D'
DISPLAY "Tipo@5" TIPORA
DISPALY "Codice@16" CODICE
DISPLAY "Anno@5" ANNO
DISPLAY "Mese@5" MESE
DISPLAY "Tipo\nora@5" TPORA
OUTPUT F_RISOATT TIPORA
OUTPUT F_CODICE CODICE
GROUP 1
CHECKTYPE NORMAL
END
STRING F_CODRIS 16
BEGIN
PROMPT 23 3 "Codice "
@ -417,7 +401,6 @@ END
RADIOBUTTON S_RISOATT 1 74
BEGIN
PROMPT 2 2 "@bTipo: "
FIELD CODTAB[0,1]
ITEM "R|Risorsa"
MESSAGE SHOW,1@|HIDE,2@|RESET,2@
ITEM "A|Attrezzatura"
@ -428,7 +411,6 @@ END
STRING S_CODRIS 16
BEGIN
PROMPT 2 5 "Codice Risorsa "
FIELD CODTAB[1,16]
USE RSS
INPUT CODTAB S_CODRIS
DISPLAY "Codice@16" CODTAB
@ -451,7 +433,6 @@ END
STRING S_CODATT 16
BEGIN
PROMPT 2 5 "Codice Attrezzatura "
FIELD CODTAB[1,16]
USE ATR
INPUT CODTAB S_CODATT
DISPLAY "Codice@16" CODTAB
@ -461,7 +442,6 @@ BEGIN
CHECKTYPE REQUIRED
FLAGS "G"
GROUP 2
MESSAGE COPY,S_CODRIS
END
STRING S_DESATT 50
@ -509,7 +489,7 @@ END
BUTTON DLG_RESET 2 2
BEGIN
PROMPT 2 1 "Azzera"
MESSAGE EXIT,K_DEL
MESSAGE RESET,S_QTAORE
PICTURE TOOL_RESET
END

View File

@ -642,72 +642,113 @@ TDisp_risoatt::TDisp_risoatt(const TRectype& r)
////////////////////////////////
//READ: cerca una riga rilevamento ore in base alla chiave primaria
bool TRilevamento_ore::read(const char tipo, const char tipora, const char *codice, const int anno, const char *mese, const char *tpora)
int TRilevamento_ore::read(const char tipo, const char tipora, const char *codice, const int anno, const int mese, const int giorno, const char *tpora, TReclock lock)
{
int err = _iskeynotfound;
TLocalisamfile rilore(LF_RILORE);
rilore.setkey(2);
rilore.setkey(2);
put(RILORE_TIPO, tipo);
put(RILORE_TIPORA, tipora);
put(RILORE_CODICE, codice);
put(RILORE_ANNO, anno);
put(RILORE_MESE, mese);
put(RILORE_GIORNO, giorno);
put(RILORE_TPORA, tpora);
TRectype saverec(*this);
err = TRectype::read(rilore);
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)
zero();
return err == NOERR;
*this = saverec;
rilore.setkey(1);
return err;
}
//READ: cerca una riga rilevamento ore in base alla chiave secodaria
bool TRilevamento_ore::read(const char tipo, const char tipora, const char *codice, const int anno, const char *mese, const char *tpora, const char* codcosto, const char* codcms, const char* codfase)
int TRilevamento_ore::read(const char tipo, const char tipora, const char *codice, const int anno, const int mese, const int giorno, const char *tpora, const char* codcosto, const char* codcms, const char* codfase, TReclock lock)
{
int err = _iskeynotfound;
TLocalisamfile rilore(LF_RILORE);
put(RILORE_TIPO, tipo);
zero();
put(RILORE_TIPO, tipo);
put(RILORE_TIPORA, tipora);
put(RILORE_CODICE, codice);
put(RILORE_ANNO, anno);
put(RILORE_MESE, mese);
put(RILORE_GIORNO, giorno);
put(RILORE_TPORA, tpora);
put(RILORE_CODCOSTO, codcosto);
put(RILORE_CODCMS, codcms);
put(RILORE_CODFASE, codfase);
TRectype saverec(*this);
err = TRectype::read(rilore);
if (err != NOERR)
zero();
int err = NOERR;
while ((err = TRectype::read(rilore,_isequal, lock)) == _islocked)
if (!yesno_box("Dati in uso da parte di un altro utente"))
break;
return err == NOERR;
if (err != NOERR)
*this = saverec;
return err;
}
//READ: cerca una riga rilevamento ore in base alla chiave secondaria
bool TRilevamento_ore::read(const char tipo, const char* codcosto, const char* codcms, const char* codfase)
int TRilevamento_ore::read(const char tipo, const char* codcosto, const char* codcms, const char* codfase, TReclock lock)
{
int err = _iskeynotfound;
TLocalisamfile rilore(LF_RILORE);
rilore.setkey(3);
rilore.setkey(3);
put(RILORE_TIPO, tipo);
put(RILORE_CODCOSTO, codcosto);
put(RILORE_CODCMS, codcms);
put(RILORE_CODFASE, codfase);
TRectype saverec(*this);
err = TRectype::read(rilore);
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)
zero();
*this = saverec;
rilore.setkey(1);
return err;
}
return err == NOERR;
int TRilevamento_ore::write_rewrite()
{
if (!empty())
{
TLocalisamfile rilore(LF_RILORE);
return TRectype::write_rewrite(rilore);
}
return _iskeynotfound;
}
int TRilevamento_ore::rewrite_write()
{
if (!empty())
{
TLocalisamfile rilore(LF_RILORE);
return TRectype::rewrite_write(rilore);
}
return _iskeynotfound;
}
int TRilevamento_ore::remove()
{
if (!empty())
{
TLocalisamfile rilore(LF_RILORE);
return TRectype::remove(rilore);
}
return _iskeynotfound;
}
//TIPO: indica se si tratta di una riga di <D>efault, <P>reventivo o <C>onsuntivo
@ -735,9 +776,15 @@ const int TRilevamento_ore::anno() const
}
//MESE: restituisce il mese a cui fa riferimento la riga
const TString& TRilevamento_ore::mese() const
const int TRilevamento_ore::mese() const
{
return get(RILORE_MESE);
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
@ -813,11 +860,17 @@ void TRilevamento_ore::set_anno(const int anno)
}
//SET_MESE: setta il mese di riferimento
void TRilevamento_ore::set_mese(const char* mese)
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)
{
@ -877,16 +930,16 @@ TRilevamento_ore::TRilevamento_ore(const TRilevamento_ore& rilore)
{
}
TRilevamento_ore::TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const char* mese, const char* tpora, const char* codcosto, const char* codcms, const char* codfase)
TRilevamento_ore::TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora, const char* codcosto, const char* codcms, const char* codfase)
: TRectype(LF_RILORE)
{
read(tipo, tipora, codice, anno, mese, tpora, codcosto, codcms, codfase);
read(tipo, tipora, codice, anno, mese, giorno, tpora, codcosto, codcms, codfase);
}
TRilevamento_ore::TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const char* mese, const char* tpora)
TRilevamento_ore::TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora)
: TRectype(LF_RILORE)
{
read(tipo, tipora, codice, anno, mese, tpora);
read(tipo, tipora, codice, anno, mese, giorno, tpora);
}
TRilevamento_ore::TRilevamento_ore(const char tipo, const char* codcosto, const char* codcms, const char* codfase)

View File

@ -220,18 +220,23 @@ public:
class TRilevamento_ore : public TRectype
{
private:
bool read(const char tipo, const char tipora, const char* codice, const int anno, const char* mese, const char* tpora, const char* codcosto, const char* codcms, const char* codfase);
bool read(const char tipo, const char tipora, const char* codice, const int anno, const char* mese, const char* tpora);
bool read(const char tipo, const char* codcosto, const char* codcms, const char* codfase);
public:
TRilevamento_ore & operator =(const TRilevamento_ore & rilore) { return *this; }
int read(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora, const char* codcosto, const char* codcms, const char* codfase, TReclock lock = _nolock);
int read(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora, TReclock lock = _nolock);
int read(const char tipo, const char* codcosto, const char* codcms, const char* codfase, TReclock lock = _nolock);
int remove();
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 TString& mese() const;
const int mese() const;
const int giorno() const;
const TString& tpora() const;
const TString& codcosto() const;
const TString& codcms() const;
@ -245,7 +250,8 @@ public:
void set_tipora(const char tipora);
void set_codice(const char* codice);
void set_anno(const int anno);
void set_mese(const char* mese);
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);
@ -257,8 +263,8 @@ public:
TRilevamento_ore(const TRectype& rec);
TRilevamento_ore(const TRilevamento_ore& rilore);
TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const char* mese, const char* tpora, const char* codcosto, const char* codcms, const char* codfase);
TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const char* mese, const char* tpora);
TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora, const char* codcosto, const char* codcms, const char* codfase);
TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora);
TRilevamento_ore(const char tipo, const char* codcosto, const char* codcms, const char* codfase);
TRilevamento_ore();
};

View File

@ -1,4 +1,3 @@
125
0
$rilore|0|0|121|0|Rilevamento Ore|||
$rilore|0|0|125|0|Rilevamento Ore|||

View File

@ -1,10 +1,11 @@
125
13
18
TIPO|1|1|0|<D>efault <P>reventivo <C>onsuntivo
TIPORA|1|1|0|<R>isorsa <A>ttrezzatura
CODICE|1|16|0|Codice Risorsa o Attrezzatura
ANNO|2|4|0|Anno
MESE|1|2|0|Mese
ANNO|9|4|0|Anno
MESE|9|2|0|Mese
GIORNO|9|2|0|Giorno
TPORA|1|2|0|Tipo Ora
CODCOSTO|1|20|0|Codice centro di costo
CODCMS|1|20|0|Codice Commessa
@ -18,6 +19,6 @@ DANNO|2|4|0|Chiave doc - Anno
DCODNUM|2|4|0|Chiave doc - Codnum
DNDOC|2|7|0|Chiave doc - ndoc
3
TIPO+TIPORA+CODICE+ANNO+MESE+TPORA+CODCOSTO+CODCMS+CODFASE|
TIPO+TIPORA+CODICE+ANNO+MESE+TPORA|X
TIPO+TIPORA+CODICE+ANNO+MESE+GIORNO+TPORA+CODCOSTO+CODCMS+CODFASE|
TIPO+TIPORA+CODICE+ANNO+MESE+GIORNO+TPORA|X
TIPO+CODCOSTO+CODCMS+CODFASE|X

View File

@ -6,6 +6,7 @@
#define RILORE_CODICE "CODICE"
#define RILORE_ANNO "ANNO"
#define RILORE_MESE "MESE"
#define RILORE_GIORNO "GIORNO"
#define RILORE_TPORA "TPORA"
#define RILORE_CODCOSTO "CODCOSTO"
#define RILORE_CODCMS "CODCMS"