Patch level : 10.0 944

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

Aggiunta disponibilità alla rilevazione pre consuntiva


git-svn-id: svn://10.65.10.50/branches/R_10_00@21714 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2011-02-25 07:00:18 +00:00
parent 1d9c4847ae
commit eb26575f90
4 changed files with 75 additions and 71 deletions

View File

@ -379,9 +379,9 @@ bool TDisp_risoatt_msk::on_field_event(TOperable_field& f, TField_event e, long
const int anno = get_int(F_ANNO); const int anno = get_int(F_ANNO);
const int mese = get_int(F_MESE); const int mese = get_int(F_MESE);
if (anno != 0 && anno != d.year()) if (d.ok() && anno != 0 && anno != d.year())
return error_box(TR("Anno errato")); return error_box(TR("Anno errato"));
if (mese != 0 && mese != d.month()) if (d.ok() && mese != 0 && mese != d.month())
return error_box(TR("Mese errato")); return error_box(TR("Mese errato"));
if (_dett == "A") if (_dett == "A")
d.set_month(1); d.set_month(1);
@ -395,27 +395,23 @@ bool TDisp_risoatt_msk::on_field_event(TOperable_field& f, TField_event e, long
TSheet_field& sheet = sfield(F_SHEET); TSheet_field& sheet = sfield(F_SHEET);
TToken_string & curr_row = sheet.row(jolly); TToken_string & curr_row = sheet.row(jolly);
TDate d(curr_row.get(sheet.cid2index(S_DATA))); TDate d(curr_row.get(sheet.cid2index(S_DATA)));
const TString4 tipo = add_field_to_tab_key(S_RISOATT, 1); const TString4 tipo = curr_row.get(sheet.cid2index(S_RISOATT));
const bool risorsa = tipo == "R"; const bool risorsa = tipo == "R";
const short idcod = risorsa ? S_CODRIS : S_CODATT; const short idcod = risorsa ? S_CODRIS : S_CODATT;
const TString cod = curr_row.get(sheet.cid2index(idcod));
TString tpora = curr_row.get(sheet.cid2index(S_TPORA));
FOR_EACH_SHEET_ROW(sheet, r, row) FOR_EACH_SHEET_ROW(sheet, r, row)
{ {
if (r != jolly && tipo == add_field_to_tab_key(*row, S_RISOATT, 1)) if (r != jolly)
{ if (tipo == row->get(sheet.cid2index(S_RISOATT)))
const TString cod = add_field_to_tab_key(idcod); if (cod == row->get(sheet.cid2index(idcod)))
if ( cod == add_field_to_tab_key(*row, idcod)) if (tpora == row->get(sheet.cid2index(S_TPORA)))
{ {
TString tpora = add_field_to_tab_key(S_TPORA); TDate dr(row->get(sheet.cid2index(S_DATA)));
if (dr == d)
if ( tpora == add_field_to_tab_key(*row, S_TPORA)) return error_box(FR("La risorsa %s alla data %s esiste già alla riga %d"), (const char *) cod,(const char *) d.string(), r + 1);
{ }
TDate dr(row->get(sheet.cid2index(S_DATA)));
if (dr == d)
return error_box(FR("La risorsa %s alla data %s esiste già alla riga %d"), (const char *) cod,(const char *) d.string(), r + 1);
}
}
}
} }
} }
default: break; default: break;

View File

@ -54,7 +54,6 @@ protected:
void update_day(); void update_day();
void update_disp(); void update_disp();
void update_prev(); void update_prev();
void riempi_sheet();
void riempi_calendario(const TString & query); void riempi_calendario(const TString & query);
void update_column(short sid, const bool full); void update_column(short sid, const bool full);
void riempi_risoatt(char tipo = 'C'); void riempi_risoatt(char tipo = 'C');
@ -66,7 +65,9 @@ protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public: public:
TRilevamento_cons_msk(); void riempi_sheet();
TRilevamento_cons_msk();
}; };
const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga) const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
@ -557,7 +558,7 @@ void TRilevamento_cons_msk::update_disp()
TString chiave(risoatt); TString chiave(risoatt);
TDate day(_giorno, _mese, _anno); TDate day(_giorno, _mese, _anno);
chiave << codice.lpad(field(F_CODRIS).size()) << day.string(ANSI) << tpora; chiave << codice.rpad(field(F_CODRIS).size()) << day.string(ANSI) << tpora;
real * val = (real *)_oredisp.objptr(chiave); real * val = (real *)_oredisp.objptr(chiave);
if (val != NULL) if (val != NULL)
@ -566,10 +567,10 @@ void TRilevamento_cons_msk::update_disp()
{ {
TString query; TString query;
query << "USE &DRA SELECT MID(CODTAB,30,2)==\"" << tpora << "\"\n" query << "USE &DRA SELECT RIGHT(CODTAB,2)==\"" << tpora << "\"\n"
<< "FROM CODTAB=\"" << chiave << "\"\n" ; << "FROM CODTAB=\"" << chiave << "\"\n" ;
TString tochiave = chiave.left(21);
TString tochiave(risoatt);
const TString4 intervallo = get(F_INTERVALLO); const TString4 intervallo = get(F_INTERVALLO);
if (intervallo == "M") if (intervallo == "M")
@ -584,8 +585,7 @@ void TRilevamento_cons_msk::update_disp()
--day; --day;
} }
tochiave << day.string(ANSI) << tpora; tochiave << codice << day.string(ANSI) << tpora;
query << "TO CODTAB=\"" << tochiave << "\"\n"; query << "TO CODTAB=\"" << tochiave << "\"\n";
TISAM_recordset def(query); TISAM_recordset def(query);
@ -597,6 +597,19 @@ void TRilevamento_cons_msk::update_disp()
_oredisp.add(chiave, oredisp); _oredisp.add(chiave, oredisp);
} }
} }
real orecons;
codice.trim();
for (int r = 0; r < sf.items(); r++)
{
TToken_string & row = sf.row(r);
if (risoatt == row.get(sf.cid2index(S_RISOATT)))
if (codice == row.get(sf.cid2index(S_CODRIS)))
orecons += real(row.get(sf.cid2index(S_QTAORE)));
}
set(F_ORECONS, orecons);
} }
void TRilevamento_cons_msk::update_prev() void TRilevamento_cons_msk::update_prev()
@ -613,6 +626,9 @@ void TRilevamento_cons_msk::update_prev()
//leggo dalla maschera i campi chiave di ricerca //leggo dalla maschera i campi chiave di ricerca
TString4 risoatt = row.get(sf.cid2index(S_RISOATT)); TString4 risoatt = row.get(sf.cid2index(S_RISOATT));
TString16 codice; TString16 codice;
TString codcosto;
TString codcms;
TString codfase;
if (risoatt == "T") if (risoatt == "T")
risoatt = ""; risoatt = "";
@ -622,16 +638,12 @@ void TRilevamento_cons_msk::update_prev()
else else
if (risoatt == "A") if (risoatt == "A")
codice = row.get(sf.cid2index(S_CODATT)); codice = row.get(sf.cid2index(S_CODATT));
get_row_anal_fields(row, codcosto, codcms, codfase);
if (codice.full()) if (codice.full() && (codcosto.full() || codcms.full() || codfase.full()))
{ {
TString4 tpora = row.get(sf.cid2index(S_TPORA)); TString4 tpora = row.get(sf.cid2index(S_TPORA));
TString codcosto;
TString codcms;
TString codfase;
TToken_string chiave; TToken_string chiave;
get_anal_fields(codcosto, codcms, codfase);
chiave.add(_anno); chiave.add(_anno);
chiave.add(_mese); chiave.add(_mese);
chiave.add(_giorno); chiave.add(_giorno);
@ -648,44 +660,28 @@ void TRilevamento_cons_msk::update_prev()
else else
{ {
TString query; TString query;
query << "USE " << LF_RILORE << " KEY 2\n" query << "USE " << LF_RILORE << " KEY 5\n"
<< "FROM " << RILORE_TIPO "=\"P\"" << "FROM " << RILORE_TIPO "=\"P\" "
<< RILORE_TIPORA << "=" << risoatt << " "
<< RILORE_CODICE << "=" << codice << " "
<< RILORE_TPORA << "=" << tpora << " "
<< RILORE_CODCOSTO << "=" << codcosto << " "
<< RILORE_CODCMS << "=" << codcms << " "
<< RILORE_CODFASE << "=" << codfase
<< " " << RILORE_ANNO << "=" << _anno << " " << " " << RILORE_ANNO << "=" << _anno << " "
<< RILORE_MESE << "=" << _mese << " " << RILORE_MESE << "=" << 1 << " "
<< RILORE_GIORNO << "=" << _giorno << " " << RILORE_GIORNO << "=" << 1 << "\n";
<< RILORE_TIPORA << "=" << risoatt << " "
<< RILORE_CODICE << "=" << codice << " "
<< RILORE_TPORA << "=" << tpora << " "
<< RILORE_CODCOSTO << "=" << codcosto << " "
<< RILORE_CODCMS << "=" << codcms << " "
<< RILORE_CODFASE << "=" << codfase << "\n";
TDate day(_giorno, _mese, _anno); query << "TO " << RILORE_TIPO "=\"P\" "
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_TIPORA << "=" << risoatt << " "
<< RILORE_CODICE << "=" << codice << " " << RILORE_CODICE << "=" << codice << " "
<< RILORE_TPORA << "=" << tpora << " " << RILORE_TPORA << "=" << tpora << " "
<< RILORE_CODCOSTO << "=" << codcosto << " " << RILORE_CODCOSTO << "=" << codcosto << " "
<< RILORE_CODCMS << "=" << codcms << " " << RILORE_CODCMS << "=" << codcms << " "
<< RILORE_CODFASE << "=" << codfase << "\n"; << RILORE_CODFASE << "=" << codfase
<< RILORE_ANNO << "=" << _anno << " "
<< RILORE_MESE << "=" << 12 << " "
<< RILORE_GIORNO << "=" << 31 << "\n";
TISAM_recordset def(query); TISAM_recordset def(query);
real oreprev; real oreprev;
@ -1004,10 +1000,14 @@ void TRilevamento_cons_msk::update_day()
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera //ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, long jolly) bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, long jolly)
{ {
if ((f.dlg() == _cdc_lid || const short dlg = f.dlg();
f.dlg() == _cms_lid || if (e == fe_modify)
f.dlg() == _fase_lid) && e == fe_modify) {
riempi_sheet(); if (dlg == _cdc_lid || dlg == _cms_lid || dlg == _fase_lid)
riempi_sheet();
if (dlg == _scdc_lid || dlg == _scms_lid || dlg == _sfase_lid)
update_prev();
}
if (f.dlg() == _scms_lid) if (f.dlg() == _scms_lid)
{ {
if (e == fe_init || e == fe_modify) if (e == fe_init || e == fe_modify)
@ -1066,7 +1066,7 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
if (e == se_notify_add) if (e == se_notify_add)
nuova_riga(); nuova_riga();
else else
if (e == se_enter) if (e == se_enter || e == se_leave)
{ {
update_prev(); update_prev();
update_disp(); update_disp();
@ -1290,6 +1290,7 @@ void TRilevamento_cons_app::main_loop()
{ {
open_files(LF_DOC, LF_RIGHEDOC, LF_RILORE, 0); open_files(LF_DOC, LF_RIGHEDOC, LF_RILORE, 0);
TRilevamento_cons_msk msk; TRilevamento_cons_msk msk;
msk.riempi_sheet();
while (msk.run() != K_QUIT) ; while (msk.run() != K_QUIT) ;
} }

View File

@ -16,6 +16,7 @@
#define F_SHEET 330 #define F_SHEET 330
#define F_INTERVALLO 331 #define F_INTERVALLO 331
#define F_OREDIS 332 #define F_OREDIS 332
#define F_ORECONS 333
#define DLG_RESET 900 #define DLG_RESET 900
#define DLG_CERCA 901 #define DLG_CERCA 901
@ -47,7 +48,7 @@
#define S_CUP 121 #define S_CUP 121
#define S_CIG 122 #define S_CIG 122
#define S_DESRIS 123 #define S_DESRIS 123
#define S_DESATT 223 #define S_DESATT 224
#define S_ID 124 #define S_ID 124
#define S_CMSH 350 #define S_CMSH 350

View File

@ -120,12 +120,18 @@ BEGIN
GROUP 3 GROUP 3
END END
NUMBER F_OREDIS 6 NUMBER F_OREDIS 6 2
BEGIN BEGIN
PROMPT 60 2 "Dispon." PROMPT 60 2 "Dispon."
FLAG "D" FLAG "D"
END END
NUMBER F_ORECONS 6 2
BEGIN
PROMPT 60 3 "Cons. "
FLAG "D"
END
SPREADSHEET F_CALENDARIO 10 0 SPREADSHEET F_CALENDARIO 10 0
BEGIN BEGIN
PROMPT 1 8 "" PROMPT 1 8 ""
@ -348,7 +354,7 @@ BEGIN
PROMPT 45 11 "Prezzo " PROMPT 45 11 "Prezzo "
END END
NUMBER S_OREPREV 6 NUMBER S_OREPREV 6 2
BEGIN BEGIN
PROMPT 60 11 "Ore Prev. " PROMPT 60 11 "Ore Prev. "
FLAGS "D" FLAGS "D"