Patch level : 10.0 902

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

Aggiunta matricola e Qualifica alla tabella risorse


git-svn-id: svn://10.65.10.50/branches/R_10_00@21550 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2011-01-31 22:19:56 +00:00
parent 33aeede24e
commit 74d842b112
5 changed files with 170 additions and 71 deletions

View File

@ -43,6 +43,8 @@ class TRilevamento_cons_msk : public TAutomask
TString _numcn;
TString _tipocn;
TToken_string _last_key;
TAssoc_array _oredisp;
TAssoc_array _oreprev;
protected:
const real proponi_costo(TToken_string& riga);
@ -52,6 +54,7 @@ protected:
void carica_default();
void update_day();
void update_disp();
void update_prev();
void riempi_sheet();
void riempi_calendario(const TString & query);
void update_column(short sid, const bool full, int len = -1);
@ -368,6 +371,7 @@ 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);
@ -516,17 +520,19 @@ void TRilevamento_cons_msk::riempi_risoatt(char tipo)
riga.add(tipo == 'D' ? 0 : rilore.get(RILORE_ID), sheet.cid2index(S_ID));
sheet.check_row(sheet.items() - 1);
sheet.select(sheet.items() - 1);
update_prev();
}
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);
TSheet_field & sf = sfield(F_SHEET);
//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")
@ -536,7 +542,6 @@ void TRilevamento_cons_msk::update_disp()
codice = get(F_CODATT);
const bool head_resource = codice.full();
TSheet_field & sf = sfield(F_SHEET);
if (!head_resource && sf.items() > 0)
{
@ -545,6 +550,7 @@ void TRilevamento_cons_msk::update_disp()
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")
@ -555,55 +561,152 @@ void TRilevamento_cons_msk::update_disp()
}
}
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;
}
TString chiave(risoatt);
TDate day(_giorno, _mese, _anno);
chiave << codice.lpad(field(F_CODRIS).size()) << day.string(ANSI) << tpora;
real * val = (real *)_oredisp.objptr(chiave);
if (val != NULL)
set(F_OREDIS, *val);
else
if (intervallo == "A")
{
to_day.addyear();
--to_day;
}
{
TString query;
query << "USE &DRA SELECT MID(CODTAB,30,2)==\"" << tpora << "\"\n"
<< "FROM CODTAB=\"" << chiave << "\"\n" ;
TString tochiave = chiave.left(21);
query << "TO " << RILORE_TIPO "=\"D\""
<< " " << RILORE_ANNO << "=" << to_day.year() << " "
<< RILORE_MESE << "=" << to_day.month() << " "
<< RILORE_GIORNO << "=" << to_day.day();
const TString4 intervallo = get(F_INTERVALLO);
TISAM_recordset def(query);
if (intervallo == "M")
{
day.addmonth();
--day;
}
else
if (intervallo == "A")
{
day.addyear();
--day;
}
for(bool ok = def.move_first(); ok; ok = def.move_next())
oredisp += def.cursor()->curr().get_int(RILORE_QTAORE);
tochiave << day.string(ANSI) << tpora;
query << "TO CODTAB=\"" << tochiave << "\"\n";
TISAM_recordset def(query);
real oredisp;
for(bool ok = def.move_first(); ok; ok = def.move_next())
oredisp += def.cursor()->curr().get_real(RILORE_QTAORE);
set(F_OREDIS, oredisp);
_oredisp.add(chiave, oredisp);
}
}
}
void TRilevamento_cons_msk::update_prev()
{
TSheet_field & sf = sfield(F_SHEET);
if ( sf.items() > 0)
{
const int r = sf.selected();
if (r < 0)
return;
TToken_string & row = sf.row(r);
//leggo dalla maschera i campi chiave di ricerca
TString4 risoatt = row.get(sf.cid2index(S_RISOATT));
TString16 codice;
if (risoatt == "T")
risoatt = "";
else
if (risoatt == "R")
codice = row.get(sf.cid2index(S_CODRIS));
else
if (risoatt == "A")
codice = row.get(sf.cid2index(S_CODATT));
if (codice.full())
{
TString4 tpora = row.get(sf.cid2index(S_TPORA));
TString codcosto;
TString codcms;
TString codfase;
TToken_string chiave;
get_anal_fields(codcosto, codcms, codfase);
chiave.add(_anno);
chiave.add(_mese);
chiave.add(_giorno);
chiave.add(risoatt);
chiave.add(codice);
chiave.add(tpora);
chiave.add(codcosto);
chiave.add(codcms);
chiave.add(codfase);
real * val = (real *)_oreprev.objptr(chiave);
if (val != NULL)
row.add(val->string(), sf.cid2index(S_OREPREV));
else
{
TString query;
query << "USE " << LF_RILORE << " KEY 5\n"
<< "FROM " << RILORE_TIPO "=\"P\""
<< " " << RILORE_ANNO << "=" << _anno << " "
<< RILORE_MESE << "=" << _mese << " "
<< RILORE_GIORNO << "=" << _giorno << " "
<< RILORE_TIPORA << "=" << risoatt << " "
<< RILORE_CODICE << "=" << codice << " "
<< RILORE_TPORA << "=" << tpora << " "
<< RILORE_CODCOSTO << "=" << codcosto << " "
<< RILORE_CODCMS << "=" << codcms << " "
<< RILORE_CODFASE << "=" << codfase << "\n";
TDate day(_giorno, _mese, _anno);
const TString4 intervallo = get(F_INTERVALLO);
if (intervallo == "M")
{
day.addmonth();
--day;
}
else
if (intervallo == "A")
{
day.addyear();
--day;
}
query << "TO " << RILORE_TIPO "=\"P\""
<< " " << RILORE_ANNO << "=" << day.year() << " "
<< RILORE_MESE << "=" << day.month() << " "
<< RILORE_GIORNO << "=" << day.day() << " "
<< RILORE_GIORNO << "=" << _giorno << " "
<< RILORE_TIPORA << "=" << risoatt << " "
<< RILORE_CODICE << "=" << codice << " "
<< RILORE_TPORA << "=" << tpora << " "
<< RILORE_CODCOSTO << "=" << codcosto << " "
<< RILORE_CODCMS << "=" << codcms << " "
<< RILORE_CODFASE << "=" << codfase << "\n";
TISAM_recordset def(query);
real oreprev;
for(bool ok = def.move_first(); ok; ok = def.move_next())
oreprev += def.cursor()->curr().get_int(RILORE_QTAORE);
row.add(oreprev.string(), sf.cid2index(S_OREPREV));
sf.force_update(r);
_oreprev.add(chiave, oreprev);
}
}
}
set(F_OREDIS, oredisp);
}
//RIEMPI_SHEET: metodo che riempie lo sheet in base ai campi chiave
@ -696,22 +799,6 @@ void TRilevamento_cons_msk::nuova_riga()
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)
{
@ -989,7 +1076,10 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
nuova_riga();
else
if (e == se_enter)
{
update_prev();
update_disp();
}
break;
case F_INTERVALLO:
if (e == fe_modify)

View File

@ -43,11 +43,12 @@
#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_OREPREV 120
#define S_CUP 121
#define S_CIG 122
#define S_DESRIS 123
#define S_DESATT 223
#define S_ID 124
#define S_CMSH 350
#define S_DCUP 351

View File

@ -154,6 +154,7 @@ BEGIN
ITEM "Ore@5"
ITEM "Listino"
ITEM "Costo@6"
ITEM "Ore Prev."
ITEM "CUP@15"
ITEM "CIG@10"
ITEM "Descrizione@50"
@ -347,6 +348,12 @@ BEGIN
PROMPT 45 11 "Prezzo "
END
NUMBER S_OREPREV 6
BEGIN
PROMPT 60 11 "Ore Prev. "
FLAGS "D"
END
STRING S_CMSH 20
BEGIN
PROMPT 50 16 ""

View File

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

View File

@ -23,8 +23,9 @@ NDOC|3|7|0|Chiave doc - NDOC
IDRIGA|3|6|0|Chiave doc -IDRIGA
CUP|1|15|0|Codice Unico di Progetto
CIG|1|10|0|Codice Identificativo di Gara
4
5
TIPO+ID|
TIPO+ANNO+MESE+GIORNO+TIPORA+CODICE+TPORA+CODCOSTO+CODCMS+CODFASE|X
TIPO+TIPORA+CODICE+ANNO+MESE+GIORNO+TPORA+CODCOSTO+CODCMS+CODFASE|X
TIPO+CODCOSTO+CODCMS+CODFASE|X
TIPO+TIPORA+CODICE+TPORA+CODCOSTO+CODCMS+CODFASE+ANNO+MESE+GIORNO|X