Patch level : 10.1016

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

Corretta rilevazione ore


git-svn-id: svn://10.65.10.50/branches/R_10_00@22267 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2011-06-15 14:27:33 +00:00
parent 65e0251976
commit e8a448f27d

View File

@ -41,7 +41,7 @@ protected:
void carica_default();
void update_column(short sid, bool full);
void riempi_sheet();
void nuova_riga();
void riempi_nuova_riga(int r);
void azzera_riga(TSheet_field& sheet);
void azzera_tutto(TSheet_field& sheet);
void registra();
@ -294,16 +294,6 @@ void TRilevamento_prev_msk::carica_default()
if (select.full()) select << "&&";
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
}
/* if (anno > 0)
{
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())
{
if (select.full()) select << "&&";
@ -327,26 +317,35 @@ void TRilevamento_prev_msk::carica_default()
if (select.full())
query << "SELECT " << select << "\n";
TString fromto = RILORE_TIPO "=\"D\" ";
TString from = RILORE_TIPO "=\"D\" ";
TString to = from;
TDate da(botime);
TDate a(eotime);
if (anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
da.set_day(1);
da.set_month(1);
da.set_year(anno);
a.set_year(anno);
if (damese > 0)
fromto << RILORE_MESE << "=\"" << damese << "\" ";
da.set_month(damese);
if (amese)
a.set_month(amese);
a.set_end_month();
}
from << " " << RILORE_DADATA << "=" << da.string() << " ";
to << " " << RILORE_DADATA << "=" << a.string() << " ";
query << "FROM " << fromto << "\n"
<< "TO " << fromto;
query << "FROM " << from << "\n"
<< "TO " << to;
TISAM_recordset def(query);
TSheet_field& sheet = sfield(F_SHEET);
sheet.destroy();
const TDate da(1, get_date(F_DADATA).month(), get_date(F_DADATA).year());
TDate a = da; a.set_end_month();
//riempio lo sheet con i dati che soddisfano il filtro preparato prima
for(bool ok = def.move_first(); ok; ok = def.move_next())
{
@ -395,13 +394,13 @@ void TRilevamento_prev_msk::riempi_sheet()
sheet.destroy();
//leggo dalla maschera i campi chiave di ricerca
const TDate da = get_date(F_DADATA);
const TDate a = get_date(F_ADATA);
const int daanno = da.year();
int aanno = a.year();
TDate da = get_date(F_DADATA);
TDate a = get_date(F_ADATA);
if (!da.ok())
da = botime;
if (aanno == 0)
aanno = 2100;
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
const TString4 tpora = get(F_TPORA);
TString80 codcosto;
@ -418,8 +417,8 @@ void TRilevamento_prev_msk::riempi_sheet()
get_anal_fields(codcosto, codcms, codfase);
sheet.set_columns_order();
update_column(S_DADATA, da.ok());
update_column(S_ADATA, a.ok());
// update_column(S_DADATA, da.ok());
// update_column(S_ADATA, a.ok());
update_column(S_RISOATT, risoatt.full());
update_column(S_CODRIS, codice.full());
update_column(S_DESRIS, codice.full());
@ -444,6 +443,8 @@ void TRilevamento_prev_msk::riempi_sheet()
update_column(id - 100, codfase.full());
sm.enable(id + 50, codfase.blank());
}
if (!a.ok())
a = eotime;
TString query;
query << "USE " << LF_RILORE << " KEY 2\n" ;
@ -484,10 +485,9 @@ void TRilevamento_prev_msk::riempi_sheet()
TString from = RILORE_TIPO "=\"P\" ";
TString to = from;
if (daanno > 0)
from << " " << RILORE_ANNO << "=" << daanno << " ";
to << " " << RILORE_ANNO << "=" << aanno << " ";
if (da.ok())
from << " " << RILORE_DADATA << "=" << da.string() << " ";
to << " " << RILORE_DADATA << "=" << a.string() << " ";
query << "FROM " << from << "\n"
<< "TO " << to;
@ -523,11 +523,10 @@ void TRilevamento_prev_msk::riempi_sheet()
//NUOVA_RIGA: metodo che aggiunge una riga allo sheet
//tenendo conto dei campi chiave compilati in testata
void TRilevamento_prev_msk::nuova_riga()
void TRilevamento_prev_msk::riempi_nuova_riga(int r)
{
TSheet_field& sheet = sfield(F_SHEET);
TToken_string & riga = sheet.row(-1);
const int r = sheet.items() - 1;
TToken_string & riga = sheet.row(r);
TMask& msk = sheet.sheet_mask();
//guardo il tipo risorsa / attrezzatura che sto ricercando
@ -558,7 +557,7 @@ void TRilevamento_prev_msk::nuova_riga()
sheet.select(r);
sheet.check_row(r);
riga.add(proponi_costo(riga), sheet.cid2index(S_COSTO));
sheet.force_update();
sheet.force_update(r);
}
//AZZERA_RIGA: metodo che azzera il valore unitario della riga selezionata
@ -625,14 +624,8 @@ void TRilevamento_prev_msk::registra()
}
else
{
const int anno = dadata.year();
const int mese = dadata.month();
const int giorno = dadata.day();
rilroa.put(RILORE_TIPO, "P");
rilroa.put(RILORE_ID, id);
rilroa.put(RILORE_ANNO, anno);
rilroa.put(RILORE_MESE, mese);
rilroa.put(RILORE_GIORNO, giorno);
rilroa.put(RILORE_TIPORA, tipora);
rilroa.put(RILORE_CODICE, codice);
rilroa.put(RILORE_TPORA, tpora);
@ -647,7 +640,8 @@ void TRilevamento_prev_msk::registra()
if (_numpr.full() && _tipopr.full())
{
TDoc_key oldkey(rilroa);
const long ndoc = date2ndoc(dadata) * 10000L + (adata.year() - dadata.year()) * 1000L+ date2ndoc(adata);
const long ndoc = (adata.year() - dadata.year()) * 10000L + date2ndoc(dadata) + date2ndoc(adata);
const int anno = dadata.year();
if (oldkey.provv() != 'D')
{
@ -762,12 +756,6 @@ bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, l
riempi_sheet();
return false;
}
case DLG_NEWREC:
if (e == fe_button)
{
nuova_riga();
return false;
}
case DLG_SAVEREC:
if (e == fe_button)
{
@ -799,11 +787,9 @@ bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, l
riempi_sheet();
break;
case F_SHEET:
if (e == se_query_add)
{
send_key(K_SPACE, DLG_NEWREC);
return false;
}
if (e == se_notify_add)
riempi_nuova_riga(jolly);
break;
case S_CODRIS:
case S_CODATT:
case S_CODLIST:
@ -811,6 +797,7 @@ bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, l
case S_TPORA:
if (e == fe_modify && f.mask().get(S_COSTO).blank())
f.mask().set(S_COSTO, proponi_costo(f.mask()));
break;
default: break;
}
return true;