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:
parent
1d9c4847ae
commit
eb26575f90
@ -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 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"));
|
||||
if (mese != 0 && mese != d.month())
|
||||
if (d.ok() && mese != 0 && mese != d.month())
|
||||
return error_box(TR("Mese errato"));
|
||||
if (_dett == "A")
|
||||
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);
|
||||
TToken_string & curr_row = sheet.row(jolly);
|
||||
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 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)
|
||||
{
|
||||
if (r != jolly && tipo == add_field_to_tab_key(*row, S_RISOATT, 1))
|
||||
{
|
||||
const TString cod = add_field_to_tab_key(idcod);
|
||||
if ( cod == add_field_to_tab_key(*row, idcod))
|
||||
{
|
||||
TString tpora = add_field_to_tab_key(S_TPORA);
|
||||
|
||||
if ( tpora == add_field_to_tab_key(*row, S_TPORA))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r != jolly)
|
||||
if (tipo == row->get(sheet.cid2index(S_RISOATT)))
|
||||
if (cod == row->get(sheet.cid2index(idcod)))
|
||||
if (tpora == row->get(sheet.cid2index(S_TPORA)))
|
||||
{
|
||||
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;
|
||||
|
101
ci/ci2200.cpp
101
ci/ci2200.cpp
@ -54,7 +54,6 @@ protected:
|
||||
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);
|
||||
void riempi_risoatt(char tipo = 'C');
|
||||
@ -66,7 +65,9 @@ protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TRilevamento_cons_msk();
|
||||
void riempi_sheet();
|
||||
|
||||
TRilevamento_cons_msk();
|
||||
};
|
||||
|
||||
const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
|
||||
@ -557,7 +558,7 @@ void TRilevamento_cons_msk::update_disp()
|
||||
TString chiave(risoatt);
|
||||
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);
|
||||
|
||||
if (val != NULL)
|
||||
@ -566,10 +567,10 @@ void TRilevamento_cons_msk::update_disp()
|
||||
{
|
||||
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" ;
|
||||
TString tochiave = chiave.left(21);
|
||||
|
||||
|
||||
TString tochiave(risoatt);
|
||||
const TString4 intervallo = get(F_INTERVALLO);
|
||||
|
||||
if (intervallo == "M")
|
||||
@ -584,8 +585,7 @@ void TRilevamento_cons_msk::update_disp()
|
||||
--day;
|
||||
}
|
||||
|
||||
tochiave << day.string(ANSI) << tpora;
|
||||
|
||||
tochiave << codice << day.string(ANSI) << tpora;
|
||||
query << "TO CODTAB=\"" << tochiave << "\"\n";
|
||||
|
||||
TISAM_recordset def(query);
|
||||
@ -597,6 +597,19 @@ void TRilevamento_cons_msk::update_disp()
|
||||
_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()
|
||||
@ -613,6 +626,9 @@ void TRilevamento_cons_msk::update_prev()
|
||||
//leggo dalla maschera i campi chiave di ricerca
|
||||
TString4 risoatt = row.get(sf.cid2index(S_RISOATT));
|
||||
TString16 codice;
|
||||
TString codcosto;
|
||||
TString codcms;
|
||||
TString codfase;
|
||||
|
||||
if (risoatt == "T")
|
||||
risoatt = "";
|
||||
@ -622,16 +638,12 @@ void TRilevamento_cons_msk::update_prev()
|
||||
else
|
||||
if (risoatt == "A")
|
||||
codice = row.get(sf.cid2index(S_CODATT));
|
||||
|
||||
if (codice.full())
|
||||
get_row_anal_fields(row, codcosto, codcms, codfase);
|
||||
if (codice.full() && (codcosto.full() || codcms.full() || codfase.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);
|
||||
@ -648,44 +660,28 @@ void TRilevamento_cons_msk::update_prev()
|
||||
else
|
||||
{
|
||||
TString query;
|
||||
query << "USE " << LF_RILORE << " KEY 2\n"
|
||||
<< "FROM " << RILORE_TIPO "=\"P\""
|
||||
query << "USE " << LF_RILORE << " KEY 5\n"
|
||||
<< "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_MESE << "=" << _mese << " "
|
||||
<< RILORE_GIORNO << "=" << _giorno << " "
|
||||
<< RILORE_TIPORA << "=" << risoatt << " "
|
||||
<< RILORE_CODICE << "=" << codice << " "
|
||||
<< RILORE_TPORA << "=" << tpora << " "
|
||||
<< RILORE_CODCOSTO << "=" << codcosto << " "
|
||||
<< RILORE_CODCMS << "=" << codcms << " "
|
||||
<< RILORE_CODFASE << "=" << codfase << "\n";
|
||||
<< RILORE_MESE << "=" << 1 << " "
|
||||
<< RILORE_GIORNO << "=" << 1 << "\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 << " "
|
||||
query << "TO " << RILORE_TIPO "=\"P\" "
|
||||
<< RILORE_TIPORA << "=" << risoatt << " "
|
||||
<< RILORE_CODICE << "=" << codice << " "
|
||||
<< RILORE_TPORA << "=" << tpora << " "
|
||||
<< RILORE_CODCOSTO << "=" << codcosto << " "
|
||||
<< RILORE_CODCMS << "=" << codcms << " "
|
||||
<< RILORE_CODFASE << "=" << codfase << "\n";
|
||||
<< RILORE_CODFASE << "=" << codfase
|
||||
<< RILORE_ANNO << "=" << _anno << " "
|
||||
<< RILORE_MESE << "=" << 12 << " "
|
||||
<< RILORE_GIORNO << "=" << 31 << "\n";
|
||||
|
||||
TISAM_recordset def(query);
|
||||
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
|
||||
bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||||
{
|
||||
if ((f.dlg() == _cdc_lid ||
|
||||
f.dlg() == _cms_lid ||
|
||||
f.dlg() == _fase_lid) && e == fe_modify)
|
||||
riempi_sheet();
|
||||
const short dlg = f.dlg();
|
||||
if (e == fe_modify)
|
||||
{
|
||||
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 (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)
|
||||
nuova_riga();
|
||||
else
|
||||
if (e == se_enter)
|
||||
if (e == se_enter || e == se_leave)
|
||||
{
|
||||
update_prev();
|
||||
update_disp();
|
||||
@ -1290,6 +1290,7 @@ void TRilevamento_cons_app::main_loop()
|
||||
{
|
||||
open_files(LF_DOC, LF_RIGHEDOC, LF_RILORE, 0);
|
||||
TRilevamento_cons_msk msk;
|
||||
msk.riempi_sheet();
|
||||
while (msk.run() != K_QUIT) ;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#define F_SHEET 330
|
||||
#define F_INTERVALLO 331
|
||||
#define F_OREDIS 332
|
||||
#define F_ORECONS 333
|
||||
|
||||
#define DLG_RESET 900
|
||||
#define DLG_CERCA 901
|
||||
@ -47,7 +48,7 @@
|
||||
#define S_CUP 121
|
||||
#define S_CIG 122
|
||||
#define S_DESRIS 123
|
||||
#define S_DESATT 223
|
||||
#define S_DESATT 224
|
||||
#define S_ID 124
|
||||
|
||||
#define S_CMSH 350
|
||||
|
@ -120,12 +120,18 @@ BEGIN
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
NUMBER F_OREDIS 6
|
||||
NUMBER F_OREDIS 6 2
|
||||
BEGIN
|
||||
PROMPT 60 2 "Dispon."
|
||||
FLAG "D"
|
||||
END
|
||||
|
||||
NUMBER F_ORECONS 6 2
|
||||
BEGIN
|
||||
PROMPT 60 3 "Cons. "
|
||||
FLAG "D"
|
||||
END
|
||||
|
||||
SPREADSHEET F_CALENDARIO 10 0
|
||||
BEGIN
|
||||
PROMPT 1 8 ""
|
||||
@ -348,7 +354,7 @@ BEGIN
|
||||
PROMPT 45 11 "Prezzo "
|
||||
END
|
||||
|
||||
NUMBER S_OREPREV 6
|
||||
NUMBER S_OREPREV 6 2
|
||||
BEGIN
|
||||
PROMPT 60 11 "Ore Prev. "
|
||||
FLAGS "D"
|
||||
|
Loading…
x
Reference in New Issue
Block a user