Patch level : 10.976
Files correlati : ci0.exe ci2.exe Ricompilazione Demo : [ ] Commento : Modificata la proposta dei costi nella rilevazione ore git-svn-id: svn://10.65.10.50/branches/R_10_00@21963 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
89442c7b67
commit
1a9b29646a
@ -157,6 +157,7 @@ void TRisoatt_msk::riempi_sheet()
|
||||
}
|
||||
|
||||
sheet.set_column_justify(sheet.cid2index(S_VALUNI), true);
|
||||
sheet.set_column_justify(sheet.cid2index(S_VALUNIPR), true);
|
||||
sheet.force_update();
|
||||
}
|
||||
|
||||
|
164
ci/ci2100.cpp
164
ci/ci2100.cpp
@ -32,8 +32,8 @@ class TRilevamento_prev_msk : public TAutomask
|
||||
TString _tipopr;
|
||||
|
||||
protected:
|
||||
const real proponi_costo(const TMask& msk);
|
||||
const real proponi_costo(TToken_string& riga);
|
||||
const TString & proponi_costo(const TMask& msk);
|
||||
const TString & proponi_costo(TToken_string& riga);
|
||||
|
||||
void get_anal_fields(TString & cdc, TString & cms, TString & fase);
|
||||
void get_row_anal_fields(TToken_string & row, TString & cdc, TString & cms, TString & fase);
|
||||
@ -53,9 +53,8 @@ public:
|
||||
TRilevamento_prev_msk();
|
||||
};
|
||||
|
||||
const real TRilevamento_prev_msk::proponi_costo(const TMask& msk)
|
||||
const TString & 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;
|
||||
@ -73,28 +72,41 @@ const real TRilevamento_prev_msk::proponi_costo(const TMask& msk)
|
||||
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();
|
||||
TRisoatt_key chiave(codlist, tipo, codice, dal, tpora);
|
||||
const TRectype & rec = cache().get("&ROA", chiave);
|
||||
|
||||
if (rec.empty())
|
||||
{
|
||||
if (chiave.cod().full() && chiave.tpora().full())
|
||||
{
|
||||
TModule_table tab("ROA");
|
||||
|
||||
if(err == NOERR)
|
||||
costo = roa.get_real("R2");
|
||||
else
|
||||
{
|
||||
TString 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);
|
||||
dal = msk.get_date(S_ADATA);
|
||||
if (!dal.ok())
|
||||
dal = eotime;
|
||||
else
|
||||
dal.set_day(1);
|
||||
|
||||
if(rec.move_last())
|
||||
costo = rec.cursor()->curr().get_real("R2");
|
||||
}
|
||||
return costo;
|
||||
TRisoatt_key chiave_sec(codlist, tipo, codice, dal, tpora);
|
||||
|
||||
tab.put("CODTAB", chiave_sec);
|
||||
const int err = tab.read();
|
||||
if (err != _isemptyfile)
|
||||
{
|
||||
chiave.overwrite("????????", 21, 8);
|
||||
if (err != _iseof)
|
||||
tab.prev();
|
||||
if (tab.get("CODTAB").match(chiave))
|
||||
return tab.get("R2");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return rec.get("R2");
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
const real TRilevamento_prev_msk::proponi_costo(TToken_string& riga)
|
||||
const TString & TRilevamento_prev_msk::proponi_costo(TToken_string& riga)
|
||||
{
|
||||
real costo = ZERO;
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
@ -115,25 +127,39 @@ const real TRilevamento_prev_msk::proponi_costo(TToken_string& riga)
|
||||
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("R2");
|
||||
else
|
||||
{
|
||||
TString 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);
|
||||
TRisoatt_key chiave(codlist, tipo, codice, dal, tpora);
|
||||
const TRectype & rec = cache().get("&ROA", chiave);
|
||||
|
||||
if (rec.empty())
|
||||
{
|
||||
if (chiave.cod().full() && chiave.tpora().full())
|
||||
{
|
||||
TModule_table tab("ROA");
|
||||
|
||||
if(rec.move_last())
|
||||
costo = rec.cursor()->curr().get_real("R2");
|
||||
}
|
||||
return costo;
|
||||
dal = riga.get(sheet.cid2index(S_ADATA));
|
||||
if (!dal.ok())
|
||||
dal = eotime;
|
||||
else
|
||||
dal.set_day(1);
|
||||
|
||||
TRisoatt_key chiave_sec(codlist, tipo, codice, dal, tpora);
|
||||
|
||||
tab.put("CODTAB", chiave_sec);
|
||||
const int err = tab.read();
|
||||
if (err != _isemptyfile)
|
||||
{
|
||||
chiave.overwrite("????????", 21, 8);
|
||||
if (err != _iseof)
|
||||
tab.prev();
|
||||
if (tab.get("CODTAB").match(chiave))
|
||||
return tab.get("R2");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return rec.get("R2");
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
void TRilevamento_prev_msk::get_anal_fields(TString & cdc, TString & cms, TString & fase)
|
||||
@ -341,7 +367,7 @@ void TRilevamento_prev_msk::carica_default()
|
||||
riga.add(a.string(), sheet.cid2index(S_ADATA));
|
||||
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(proponi_costo(riga).string(), sheet.cid2index(S_COSTO));
|
||||
riga.add(proponi_costo(riga), sheet.cid2index(S_COSTO));
|
||||
sheet.check_row(sheet.items() - 1);
|
||||
}
|
||||
sheet.force_update();
|
||||
@ -500,12 +526,12 @@ void TRilevamento_prev_msk::riempi_sheet()
|
||||
void TRilevamento_prev_msk::nuova_riga()
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
TToken_string & riga = sheet.row(-1);
|
||||
const int r = sheet.items() - 1;
|
||||
sheet.select(r);
|
||||
TToken_string & riga = sheet.row(-1);
|
||||
TMask& msk = sheet.sheet_mask();
|
||||
|
||||
//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;
|
||||
@ -529,39 +555,11 @@ void TRilevamento_prev_msk::nuova_riga()
|
||||
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(msk).string(), sheet.cid2index(S_COSTO));
|
||||
sheet.update_mask(r);
|
||||
msk.enable(S_RISOATT, tutti);
|
||||
if (tutti || tipo == "R")
|
||||
msk.enable(S_CODRIS);
|
||||
if (tutti || tipo == "A")
|
||||
msk.enable(S_CODATT);
|
||||
// msk.enable(S_DADATA, dadata.empty());
|
||||
// msk.enable(S_ADATA, adata.empty());
|
||||
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());
|
||||
|
||||
//lancio la maschera di riga da compilare
|
||||
if(msk.run() == K_ENTER && msk.get_int(S_QTAORE) > 0)
|
||||
sheet.update_row(r);
|
||||
else
|
||||
{
|
||||
sheet.destroy(r);
|
||||
sheet.force_update();
|
||||
}
|
||||
msk.enable_default();
|
||||
|
||||
sheet.check_row(sheet.items() - 1);
|
||||
sheet.force_update();
|
||||
sheet.check_row(r);
|
||||
sheet.update_row(r);
|
||||
sheet.select(r);
|
||||
riga.add(proponi_costo(riga), sheet.cid2index(S_COSTO));
|
||||
sheet.force_update();
|
||||
}
|
||||
|
||||
//AZZERA_RIGA: metodo che azzera il valore unitario della riga selezionata
|
||||
@ -741,14 +739,14 @@ bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, l
|
||||
{
|
||||
const TRectype & curr = f.mask().efield(_scms_lid).browse()->cursor()->curr();
|
||||
const TString codcms = curr.get(COMMESSE_CODCMS);
|
||||
TMask & m = f.mask();
|
||||
|
||||
f.mask().set(S_CMSH, codcms);
|
||||
if (e == fe_modify)
|
||||
{
|
||||
const TRectype & commesse = cache().get(LF_COMMESSE, codcms);
|
||||
m.set(S_CMSH, codcms);
|
||||
|
||||
const TRectype & commesse = cache().get(LF_COMMESSE, codcms);
|
||||
|
||||
f.mask().set(S_CODLIST, commesse.get(COMMESSE_LISRILPR), 3);
|
||||
}
|
||||
if (m.get(S_CODLIST).blank())
|
||||
m.set(S_CODLIST, commesse.get(COMMESSE_LISRILPR), 3);
|
||||
}
|
||||
}
|
||||
switch (f.dlg())
|
||||
@ -812,8 +810,8 @@ bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, l
|
||||
case S_CODLIST:
|
||||
case S_DADATA:
|
||||
case S_TPORA:
|
||||
if (e == fe_modify)
|
||||
f.mask().set(S_COSTO, proponi_costo(f.mask()).string());
|
||||
if (e == fe_modify && f.mask().get(S_COSTO).blank())
|
||||
f.mask().set(S_COSTO, proponi_costo(f.mask()));
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
|
118
ci/ci2200.cpp
118
ci/ci2200.cpp
@ -46,7 +46,8 @@ class TRilevamento_cons_msk : public TAutomask
|
||||
TAssoc_array _oreprev;
|
||||
|
||||
protected:
|
||||
const real proponi_costo(TToken_string& riga);
|
||||
const TString & proponi_costo(const TMask & mask);
|
||||
const TString & proponi_costo(TToken_string& riga);
|
||||
void get_anal_fields(TString & cdc, TString & cms, TString & fase);
|
||||
void get_row_anal_fields(TToken_string & row, TString & cdc, TString & cms, TString & fase);
|
||||
void put_row_anal_fields(TToken_string & row, const TString & cdc, const TString & cms, const TString & fase);
|
||||
@ -70,9 +71,47 @@ public:
|
||||
TRilevamento_cons_msk();
|
||||
};
|
||||
|
||||
const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
|
||||
const TString & TRilevamento_cons_msk::proponi_costo(const TMask& msk)
|
||||
{
|
||||
const TString8 codlist = msk.get(S_CODLIST);
|
||||
const char tipo = msk.get(S_RISOATT)[0];
|
||||
TString80 codice;
|
||||
switch(tipo)
|
||||
{
|
||||
case 'R': codice = msk.get(S_CODRIS); break;
|
||||
case 'A': codice = msk.get(S_CODATT); break;
|
||||
default : break;
|
||||
}
|
||||
const TDate dal(1, _mese, _anno);
|
||||
const TString4 tpora = msk.get(S_TPORA);
|
||||
TRisoatt_key chiave(codlist, tipo, codice, dal, tpora);
|
||||
const TRectype & rec = cache().get("&ROA", chiave);
|
||||
|
||||
if (rec.empty())
|
||||
{
|
||||
if (chiave.cod().full() && chiave.tpora().full())
|
||||
{
|
||||
TModule_table tab("ROA");
|
||||
|
||||
tab.put("CODTAB", chiave);
|
||||
const int err = tab.read();
|
||||
if (err != _isemptyfile)
|
||||
{
|
||||
chiave.overwrite("????????", 21, 8);
|
||||
if (err != _iseof)
|
||||
tab.prev();
|
||||
if (tab.get("CODTAB").match(chiave))
|
||||
return tab.get("R1");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return rec.get("R1");
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
const TString & 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));
|
||||
@ -86,27 +125,33 @@ const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
|
||||
|
||||
const TDate dal(1, _mese, _anno);
|
||||
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();
|
||||
TRisoatt_key chiave(codlist, tipo, codice, dal, tpora);
|
||||
const TRectype & rec = cache().get("&ROA", chiave);
|
||||
|
||||
if (rec.empty())
|
||||
{
|
||||
if (chiave.cod().full() && chiave.tpora().full())
|
||||
{
|
||||
TModule_table tab("ROA");
|
||||
|
||||
if(err == NOERR)
|
||||
costo = roa.get_real("R1");
|
||||
else
|
||||
{
|
||||
TString 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");
|
||||
}
|
||||
return costo;
|
||||
tab.put("CODTAB", chiave);
|
||||
const int err = tab.read();
|
||||
if (err != _isemptyfile)
|
||||
{
|
||||
chiave.overwrite("????????", 21, 8);
|
||||
if (err != _iseof)
|
||||
tab.prev();
|
||||
if (tab.get("CODTAB").match(chiave))
|
||||
return tab.get("R1");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return rec.get("R1");
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
|
||||
void TRilevamento_cons_msk::get_anal_fields(TString & cdc, TString & cms, TString & fase)
|
||||
{
|
||||
TString val;
|
||||
@ -776,7 +821,6 @@ void TRilevamento_cons_msk::nuova_riga()
|
||||
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);
|
||||
@ -797,10 +841,11 @@ void TRilevamento_cons_msk::nuova_riga()
|
||||
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);
|
||||
sheet.update_row(r);
|
||||
sheet.select(r);
|
||||
riga.add(proponi_costo(riga), sheet.cid2index(S_COSTO));
|
||||
sheet.force_update();
|
||||
}
|
||||
//AZZERA_RIGA: metodo che azzera il valore unitario della riga selezionata
|
||||
void TRilevamento_cons_msk::azzera_riga(TSheet_field& sheet)
|
||||
@ -1014,13 +1059,16 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
|
||||
{
|
||||
const TRectype & curr = f.mask().efield(_scms_lid).browse()->cursor()->curr();
|
||||
const TString codcms = curr.get(COMMESSE_CODCMS);
|
||||
TMask & m = f.mask();
|
||||
|
||||
f.mask().set(S_CMSH, codcms);
|
||||
m.set(S_CMSH, codcms);
|
||||
|
||||
const TRectype & commesse = cache().get(LF_COMMESSE, codcms);
|
||||
|
||||
if (m.get(S_CODLIST).blank())
|
||||
m.set(S_CODLIST, commesse.get(COMMESSE_LISRILCN), 3);
|
||||
if (e == fe_modify)
|
||||
{
|
||||
const TRectype & commesse = cache().get(LF_COMMESSE, codcms);
|
||||
|
||||
f.mask().set(S_CODLIST, commesse.get(COMMESSE_LISRILCN), 3);
|
||||
if (main_app().has_module(CUAUT))
|
||||
{
|
||||
TToken_string key;
|
||||
@ -1030,8 +1078,8 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
|
||||
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);
|
||||
m.set(S_CUP, cfcms.get(CFCMS_CUP), 3);
|
||||
m.set(S_CIG, cfcms.get(CFCMS_CIG), 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1113,12 +1161,8 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
|
||||
case S_CODATT:
|
||||
case S_CODLIST:
|
||||
case S_TPORA:
|
||||
if(e == fe_modify)
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
|
||||
f.mask().set(S_COSTO, proponi_costo(sheet.row(sheet.selected())).string());
|
||||
}
|
||||
if (e == fe_modify && f.mask().get(S_COSTO).blank())
|
||||
f.mask().set(S_COSTO, proponi_costo(f.mask()));
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
@ -122,13 +122,13 @@ END
|
||||
|
||||
NUMBER F_OREDIS 6 2
|
||||
BEGIN
|
||||
PROMPT 60 2 "Dispon."
|
||||
PROMPT 60 1 "Dispon."
|
||||
FLAG "D"
|
||||
END
|
||||
|
||||
NUMBER F_ORECONS 6 2
|
||||
BEGIN
|
||||
PROMPT 60 3 "Cons. "
|
||||
PROMPT 60 2 "Cons. "
|
||||
FLAG "D"
|
||||
END
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user