Patch level : 10.0 patch 808

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Rilevazione ore


git-svn-id: svn://10.65.10.50/branches/R_10_00@20888 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2010-09-22 01:06:45 +00:00
parent 056f30451a
commit 253c8447ff
11 changed files with 744 additions and 571 deletions

View File

@ -175,7 +175,7 @@ void TDef_risoatt_msk::riempi_sheet()
TString select;
if (risoatt.full())
select << "(" << RILORE_TIPORA << "==" << risoatt << ")";
select << "(" << RILORE_TIPORA << "==\"" << risoatt << "\")";
if (codice.full())
{
if (select.full()) select << "&&";
@ -215,23 +215,12 @@ void TDef_risoatt_msk::riempi_sheet()
query << "SELECT " << select << "\n";
TString fromto = RILORE_TIPO "=\"D\"";
if(risoatt != 'T')
if (anno > 0)
{
fromto << " " << RILORE_TIPORA << "=\"" << risoatt << "\" ";
if(codice.full())
{
fromto << " " << RILORE_CODICE << "=\"" << codice << "\" ";
if(anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if(mese > 0)
{
fromto << " " << RILORE_MESE << "=\"" << mese << "\" ";
if(tpora.full())
fromto << " " << RILORE_TPORA << "=\"" << tpora << "\" ";
}
}
}
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if (mese > 0)
fromto << " " << RILORE_MESE << "=\"" << mese << "\" ";
}
query << "FROM " << fromto << "\n"
@ -377,7 +366,7 @@ void TDef_risoatt_msk::registra()
get_row_anal_fields(riga, codcosto, codcms, codfase);
rilroa.read('D', tipora, codice, anno, mese, 0, tpora, codcosto, codcms, codfase);
rilroa.read('D', anno, mese, 0, tipora, codice, tpora, codcosto, codcms, codfase);
if (qtaore == 0)
rilroa.remove();
else
@ -394,7 +383,12 @@ void TDef_risoatt_msk::registra()
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
bool TDef_risoatt_msk::on_field_event(TOperable_field& f, TField_event e, long jolly)
{
switch (f.dlg())
if (f.dlg() >= F_ANAL && f.dlg() <= F_ANAL+12)
{
if (e == fe_modify)
riempi_sheet();
}
switch (f.dlg())
{
case DLG_CERCA:
if (e == fe_button)

View File

@ -3,7 +3,6 @@
#define F_MESE 302
#define F_TPORA 303
#define F_RISOATT 304
#define F_CODICE 305
#define F_CODRIS 306
#define F_DESRIS 307
#define F_CODATT 308

View File

@ -64,11 +64,11 @@ LISTBOX F_RISOATT 1 12
BEGIN
PROMPT 2 2 "@bTipo "
ITEM "T|Tutti"
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@
MESSAGE HIDE,1@|HIDE,2@
ITEM "R|Risorsa"
MESSAGE HIDE,1@|SHOW,2@|HIDE,3@
MESSAGE SHOW,1@|HIDE,2@
ITEM "A|Attrezzatura"
MESSAGE HIDE,1@|HIDE,2@|SHOW,3@
MESSAGE HIDE,1@|SHOW,2@
FLAGS "Z"
END
@ -81,7 +81,7 @@ BEGIN
DISPLAY "Descrizione@50" S0
OUTPUT F_CODRIS CODTAB
OUTPUT F_DESRIS S0
GROUP 2
GROUP 1
CHECKTYPE NORMAL
END
@ -89,20 +89,19 @@ STRING F_DESRIS 50 27
BEGIN
PROMPT 50 2 ""
FLAGS "D"
GROUP 2
GROUP 1
END
STRING F_CODATT 16
BEGIN
PROMPT 23 2 "Codice "
FIELD CODTAB[1,16]
USE ATR
INPUT CODTAB F_CODATT
DISPLAY "Codice@16" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODATT CODTAB
OUTPUT F_DESATT S0
GROUP 3
GROUP 2
CHECKTYPE NORMAL
END
@ -110,7 +109,7 @@ STRING F_DESATT 50 27
BEGIN
PROMPT 50 2 ""
FLAGS "D"
GROUP 3
GROUP 2
END
@ -231,73 +230,73 @@ END
STRING S_CDC1 20
BEGIN
PROMPT 2 8 "Cdc 1"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC2 20
BEGIN
PROMPT 2 8 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC3 20
BEGIN
PROMPT 2 8 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC4 20
BEGIN
PROMPT 2 8 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC5 20
BEGIN
PROMPT 2 9 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC6 20
BEGIN
PROMPT 2 9 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC7 20
BEGIN
PROMPT 2 9 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC8 20
BEGIN
PROMPT 2 9 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC9 20
BEGIN
PROMPT 2 10 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC10 20
BEGIN
PROMPT 2 10 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC11 20
BEGIN
PROMPT 2 10 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
STRING S_CDC12 20
BEGIN
PROMPT 2 10 "Cdc 2"
FLAGS "H"
FLAGS "HB"
END
NUMBER S_QTAORE 6

View File

@ -134,7 +134,6 @@ const real TRilevamento_prev_msk::proponi_costo(TToken_string& riga)
return costo;
}
void TRilevamento_prev_msk::get_anal_fields(TString & cdc, TString & cms, TString & fase)
{
TString val;
@ -261,7 +260,7 @@ void TRilevamento_prev_msk::carica_default()
TString select;
if (risoatt.full())
query << "SELECT (" << RILORE_TIPORA << "==" << risoatt << ")";
query << "(" << RILORE_TIPORA << "==" << risoatt << ")";
if (codice.full())
{
if (select.full()) select << "&&";
@ -301,23 +300,12 @@ void TRilevamento_prev_msk::carica_default()
query << "SELECT " << select << "\n";
TString fromto = RILORE_TIPO "=\"D\" ";
if(risoatt != 'T')
if (anno > 0)
{
fromto << " " << RILORE_TIPORA << "=\"" << risoatt << "\" ";
if(codice.full())
{
fromto << " " << RILORE_CODICE << "=\"" << codice << "\" ";
if(anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if(damese > 0)
{
fromto << RILORE_MESE << "=\"" << damese << "\" ";
if(tpora.full())
fromto << " " << RILORE_TPORA << "=\"" << tpora << "\" ";
}
}
}
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if (damese > 0)
fromto << RILORE_MESE << "=\"" << damese << "\" ";
}
query << "FROM " << fromto << "\n"
@ -362,7 +350,11 @@ void TRilevamento_prev_msk::carica_default()
void TRilevamento_prev_msk::riempi_sheet()
{
//leggo dalla maschera i campi chiave di ricerca
const int anno = get_date(F_DADATA).year();
const int daanno = get_date(F_DADATA).year();
int aanno = get_date(F_ADATA).year();
if (aanno == 0)
aanno = 2100;
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
int damese = get_date(F_DADATA).month();
int amese = get_date(F_ADATA).month();
@ -385,67 +377,54 @@ void TRilevamento_prev_msk::riempi_sheet()
TString select;
if (risoatt.full())
select << "(" << RILORE_TIPORA << "==" << risoatt << ")";
select << "(" << RILORE_TIPORA << "==\"" << risoatt << "\")";
if (codice.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
}
if (anno > 0)
if (daanno > 0)
{
if (select.full()) select << "&&";
select << "STR(" << RILORE_ANNO << "==" << anno << ")";
select << "STR(BETWEEN(" << RILORE_ANNO << "," << daanno << "," << aanno << "))";
}
if ( damese > 0 || amese > 0)
{
if (select.full()) select << "&&";
select << "(BETWEEN(MESE,\"" << damese << "\",\"" << amese << "\"))";
select << "(BETWEEN(" << RILORE_MESE << "," << damese << "," << amese << "))";
}
if (tpora.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_TPORA << ",\"" << tpora << "\",\"" << tpora << "\"))";
select << "(" << RILORE_TPORA << "==\"" << tpora << "\")";
}
if (codcosto.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODCOSTO << ",\"" << codcosto << "\",\"" << codcosto << "\"))";
select << "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")";
}
if (codcms.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODCMS << ",\"" << codcms << "\",\"" << codcms << "\"))";
select << "(" << RILORE_CODCMS << "==\"" << codcms << "\")";
}
if (codfase.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODFASE << ",\"" << codfase << "\",\"" << codfase << "\"))";
select << "(" << RILORE_CODFASE << "==\"" << codfase << "\")";
}
if (select.full())
query << "SELECT " << select << "\n";
TString fromto = RILORE_TIPO "=\"P\" ";
if(risoatt != 'T')
{
fromto << " " << RILORE_TIPORA << "=\"" << risoatt << "\" ";
if(codice.full())
{
fromto << " " << RILORE_CODICE << "=\"" << codice << "\" ";
if(anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if(damese > 0)
{
fromto << RILORE_MESE << "=\"" << damese << "\" ";
if(tpora.full())
fromto << " " << RILORE_TPORA << "=\"" << tpora << "\" ";
}
}
}
}
TString from = RILORE_TIPO "=\"P\" ";
TString to = from;
query << "FROM " << fromto << "\n"
<< "TO " << fromto;
if (daanno > 0)
from << " " << RILORE_ANNO << "=\"" << daanno << "\" ";
to << " " << RILORE_ANNO << "=\"" << aanno << "\" ";
query << "FROM " << from << "\n"
<< "TO " << to;
TISAM_recordset def(query);
@ -593,19 +572,16 @@ void TRilevamento_prev_msk::registra()
const int qtaore = riga.get_int(sheet.cid2index(S_QTAORE));
const TString& tmp = riga.get(sheet.cid2index(S_COSTO));
const real costo(tmp);
const int mese = adata.month();
get_row_anal_fields(riga, codcosto, codcms, codfase);
rilroa.read('P', tipora, codice, adata.year(), mese, 0, tpora);
rilroa.read('P', dadata.year(), dadata.month(), dadata.day(), tipora, codice, tpora, codcosto, codcms, codfase);
if(qtaore == 0)
rilroa.remove();
else
{
rilroa.set_codcosto(codcosto);
rilroa.set_codcms(codcms);
rilroa.set_codfase(codfase);
rilroa.set_dadata(dadata);
rilroa.set_adata(adata);
rilroa.set_qtaore(qtaore);
rilroa.set_costo(costo);
@ -619,6 +595,11 @@ void TRilevamento_prev_msk::registra()
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, long jolly)
{
if (f.dlg() >= F_ANAL && f.dlg() <= F_ANAL+12)
{
if (e == fe_modify)
riempi_sheet();
}
switch (f.dlg())
{
case DLG_DEFAULT:
@ -680,6 +661,13 @@ bool TRilevamento_prev_msk::on_field_event(TOperable_field& f, TField_event e, l
}
}
break;
case F_RISOATT:
case F_CODRIS:
case F_CODATT:
case F_TPORA:
if (e == fe_modify)
riempi_sheet();
break;
case F_SHEET:
if (e == se_query_add)
{

View File

@ -98,7 +98,6 @@ END
STRING F_CODATT 16
BEGIN
PROMPT 23 2 "Codice "
FIELD CODTAB[1,16]
USE ATR
INPUT CODTAB F_CODATT
DISPLAY "Codice@16" CODTAB

View File

@ -12,6 +12,7 @@
#include "cilib.h"
#include "ci2200a.h"
#include "rilore.h"
#include "../ca/calib01.h"
#include "../ve/velib.h"
////////////////////////////////////////////
@ -22,17 +23,25 @@
class TRilevamento_cons_msk : public TAutomask
{
int _qtaore;
char _mode;
short _cdc_sid, _cdc_lid;
short _cms_sid, _cms_lid;
short _fase_sid, _fase_lid;
short _scdc_sid, _scdc_lid;
short _scms_sid, _scms_lid;
short _sfase_sid, _sfase_lid;
char _edit_mode;
TDate _datasel;
int _rigasel;
int _giorno;
protected:
const real 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);
void carica_default();
void riempi_sheet();
void riempi_calendario(TISAM_recordset& def);
void riempi_risoatt(TDate& data, const char* codcosto, const char* codcms, const char* codfase);
void riempi_calendario(const TString & query, const int anno, const int mese);
void riempi_risoatt(int giorno);
void azzera_tutto();
void registra();
@ -40,7 +49,6 @@ protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
void esegui() const;
TRilevamento_cons_msk();
};
@ -83,7 +91,104 @@ const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
}
return costo;
}
void TRilevamento_cons_msk::get_anal_fields(TString & cdc, TString & cms, TString & fase)
{
TString val;
cdc.cut(0);
if (_cdc_sid >= 0)
for ( short id = _cdc_sid; id <= _cdc_lid; id++)
{
val = get(id);
val.rpad(field(id).size());
cdc << val;
}
cdc.trim();
cms.cut(0);
if (_cms_sid >= 0)
for ( short id = _cms_sid; id <= _cms_lid; id++)
{
val = get(id);
val.rpad(field(id).size());
cms << val;
}
cms.trim();
fase.cut(0);
if (_fase_sid >= 0)
for ( short id = _fase_sid; id <= _fase_lid; id++)
{
val = get(id);
val.rpad(field(id).size());
fase << val;
}
fase.trim();
}
void TRilevamento_cons_msk::get_row_anal_fields(TToken_string & row, TString & cdc, TString & cms, TString & fase)
{
TSheet_field & s = sfield(F_SHEET);
TMask & m = s.sheet_mask();
TString val;
cdc.cut(0);
if (_scdc_sid >= 0)
for ( short id = _scdc_sid; id <= _scdc_lid; id++)
{
val = row.get(s.cid2index(id));
val.rpad(m.field(id).size());
cdc << val;
}
cdc.trim();
cms.cut(0);
if (_scms_sid >= 0)
for ( short id = _scms_sid; id <= _scms_lid; id++)
{
val = row.get(s.cid2index(id));
val.rpad(m.field(id).size());
cms << val;
}
cms.trim();
fase.cut(0);
if (_sfase_sid >= 0)
for ( short id = _sfase_sid; id <= _sfase_lid; id++)
{
val = row.get(s.cid2index(id));
val.rpad(m.field(id).size());
fase << val;
}
fase.trim();
}
void TRilevamento_cons_msk::put_row_anal_fields(TToken_string & row, const TString & cdc, const TString & cms, const TString & fase)
{
TSheet_field & s = sfield(F_SHEET);
TMask & m = s.sheet_mask();
int pos = 0;
if (_scdc_sid >= 0)
for (short id = _scdc_sid; id <= _scdc_lid; id++)
{
const int len = m.field(id).size();
row.add(cdc.mid(pos, len), s.cid2index(id));
pos += len;
}
pos = 0;
if (_scms_sid >= 0)
for (short id = _scms_sid; id <= _scms_lid; id++)
{
const int len = m.field(id).size();
row.add(cms.mid(pos, len), s.cid2index(id));
pos += len;
}
pos = 0;
if (_sfase_sid >= 0)
for (short id = _sfase_sid; id <= _sfase_lid; id++)
{
const int len = m.field(id).size();
row.add(fase.mid(pos, len), s.cid2index(id));
pos += len;
}
}
void TRilevamento_cons_msk::carica_default()
{
@ -92,241 +197,24 @@ void TRilevamento_cons_msk::carica_default()
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
const int mese = get_int(F_MESE);
const TString4 tpora = get(F_TPORA);
const TString80 codcosto = get(F_CODCOSTO);
const TString80 codcms = get(F_CODCMS);
const TString16 codfase = get(F_CODFASE);
TString80 codcosto;
TString80 codcms;
TString16 codfase;
TString16 codice;
TString query;
TString select;
switch(get(F_RISOATT)[0])
{
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
}
get_anal_fields(codcosto, codcms, codfase);
TString query;
query << "USE " << LF_RILORE << "\n"
<< "SELECT (" << RILORE_TIPORA << "==\"" << risoatt << "\")&&"
<< "(" << RILORE_CODICE << "==\"" << codice << "\")&&"
<< "STR(" << RILORE_ANNO << "==" << anno << ")&&"
<< "STR(" << RILORE_MESE << "==" << mese << ")&&"
<< "(" << RILORE_TPORA << "==\"" << tpora << "\")&&"
<< "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")&&"
<< "(" << RILORE_CODCMS << "==\"" << codcms << "\")&&"
<< "(" << RILORE_CODFASE << "==\"" << codfase << "\")\n";
TString fromto = RILORE_TIPO "=\"D\" ";
if(risoatt != 'T')
{
fromto << " " << RILORE_TIPORA << "=\"" << risoatt << "\" ";
if(codice.full())
{
fromto << " " << RILORE_CODICE << "=\"" << codice << "\" ";
if(anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if(mese > 0)
{
fromto << RILORE_MESE << "=\"" << mese << "\" ";
if(tpora.full())
fromto << " " << RILORE_TPORA << "=\"" << tpora << "\" ";
}
}
}
}
TISAM_recordset def(query);
riempi_calendario(def);
}
//RIEMPI_CALENDARIO: coloro le celle dello sheet calendario secondo le festività e i giorni occupati
void TRilevamento_cons_msk::riempi_calendario(TISAM_recordset& def)
{
const int anno = get_int(F_ANNO);
const int mese = atoi(get(F_MESE));
TSheet_field& calendario = sfield(F_CALENDARIO);
calendario.destroy();
TSheet_field& sheet = sfield(F_SHEET);
sheet.destroy();
//se non ho selezionato un mese valido, svuoto lo sheet e non faccio nient'altro
if(mese == 0)
return;
//abilito per default tutte le colonne del calendario
for(int i = 1; i <= 31; i++)
{
short cid = C_CODFASE;
cid += i;
calendario.enable_column(calendario.cid2index(cid));
}
//disabilita tutte le colonne dal giorno successivo alla fine del mese in poi
TDate date(1, mese, anno);
date.set_end_month();
int giorno = date.day(); giorno++;
for(giorno; giorno <= 31; giorno++)
{
short cid = C_CODFASE;
cid += giorno;
calendario.enable_column(calendario.cid2index(cid), false);
}
TAssoc_array commesse;
int idriga = 0;
//scorro il recordset, aggiungo una riga allo sheet per ogni chiave analitica che trovo e coloro di blu
//tutte le celle che corrispondono a una data interessata da qualcosa
for(bool ok = def.move_first(); ok; ok = def.move_next())
{
TRilevamento_ore rilore(def.cursor()->curr());
TToken_string com;
com.add(rilore.codcosto());
com.add(rilore.codcms());
com.add(rilore.codfase());
if(!commesse.is_key(com))
{
TString4 tmp; tmp << idriga++;
commesse.add(com, tmp);
calendario.row(-1);
}
TDate data = rilore.dadata();
int cid = C_CODFASE;
cid += data.day();
TToken_string& row = calendario.row(commesse.get_int(com));
row.add(rilore.codcosto(), calendario.cid2index(C_CODCOSTO));
row.add(rilore.codcms(), calendario.cid2index(C_CODCMS));
row.add(rilore.codfase(), calendario.cid2index(C_CODFASE));
if(_mode == 'F')
{
calendario.set_back_and_fore_color(COLOR_DKBLUE, COLOR_DKBLUE, commesse.get_int(com), calendario.cid2index(cid));
row.add('P', calendario.cid2index(cid));
}
}
//su ogni riga dello sheet coloro di rosso le festività
FOR_EACH_SHEET_ROW(calendario, r, riga)
{
TToken_string& row = calendario.row(r);
TDate mesesel(1, mese, anno); --mesesel;
for(mesesel; ++mesesel; mesesel.is_end_month())
{
if(mesesel.month() > mese)
{
calendario.force_update();
break;
}
short cid = C_CODFASE;
cid += mesesel.day();
const TString4 cella = row.get(calendario.cid2index(cid));
if(cella.empty())
{
if(mesesel.is_holiday())
calendario.set_back_and_fore_color(COLOR_DKRED, COLOR_DKRED, r, calendario.cid2index(cid));
}
else
row.add("", calendario.cid2index(cid));
}
}
}
void TRilevamento_cons_msk::riempi_risoatt(TDate& data, const char* codcosto, const char* codcms, const char* codfase)
{
TSheet_field& sheet = sfield(F_SHEET);
sheet.destroy();
//leggo dalla maschera i campi chiave di ricerca
const int anno = get_int(F_ANNO);
const TString4 risoatt = "";
const TString4 mese = get(F_MESE);
const TString4 tpora = get(F_TPORA);
//preparo la query
TString query;
if(_mode == 'F')
query << "USE RILORE\n"
<< "SELECT (" << RILORE_TIPORA << "==\"" << risoatt << "\")&&"
<< "STR(" << RILORE_ANNO << "==" << anno << ")&&"
<< "STR(" << RILORE_MESE << "==" << mese << ")&&"
<< "(" << RILORE_TPORA << "==\"" << tpora << "\")&&"
<< "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")&&"
<< "(" << RILORE_CODCMS << "==\"" << codcms << "\")&&"
<< "(" << RILORE_CODFASE << "==\"" << codfase << "\")&&"
<< "(BETWEEN(" << RILORE_DADATA << ",#DATA,#DATA))\n"
<< "FROM " << RILORE_TIPO << "=\"C\"\n"
<< "TO " << RILORE_TIPO << "=\"C\"";
else
query << "USE " << LF_RILORE << "\n"
<< "SELECT (" << RILORE_TIPORA << "==\"" << risoatt << "\")&&"
<< "STR(" << RILORE_ANNO << "==" << anno << ")&&"
<< "STR(" << RILORE_MESE << "==" << mese << ")&&"
<< "(" << RILORE_TPORA << "==\"" << tpora << "\")&&"
<< "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")&&"
<< "(" << RILORE_CODCMS << "==\"" << codcms << "\")&&"
<< "(" << RILORE_CODFASE << "==\"" << codfase << "\")\n"
<< "FROM " << RILORE_TIPO << "=\"D\"\n"
<< "TO " << RILORE_TIPO << "=\"D\"";
TISAM_recordset def(query);
def.set_var("#DATA", data);
//riempio lo sheet con i dati che soddisfano il filtro preparato prima
for(bool ok = def.move_first(); ok; ok = def.move_next())
{
TRilevamento_ore rilore(def.cursor()->curr());
TToken_string& riga = sheet.row(-1);
riga.add(rilore.tipora(), sheet.cid2index(S_RISOATT));
switch(rilore.tipora())
{
case 'R': riga.add(rilore.codice(), sheet.cid2index(S_CODRIS)); break;
case 'A': riga.add(rilore.codice(), sheet.cid2index(S_CODATT)); break;
default : break;
}
riga.add(rilore.tpora(), sheet.cid2index(S_TPORA));
riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
riga.add(rilore.costo().string(), sheet.cid2index(S_COSTO));
sheet.check_row(sheet.items() - 1);
}
sheet.force_update();
}
//RIEMPI_SHEET: metodo che riempie lo sheet in base ai campi chiave
//compilati sulla maschera
void TRilevamento_cons_msk::riempi_sheet()
{
//leggo dalla maschera i campi chiave di ricerca
const int anno = get_int(F_ANNO);
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
const int mese = get_int(F_MESE);
const TString4 tpora = get(F_TPORA);
const TString80 codcosto = get(F_CODCOSTO);
const TString80 codcms = get(F_CODCMS);
const TString16 codfase = get(F_CODFASE);
TString16 codice;
switch(get(F_RISOATT)[0])
{
case 'T': codice = get(F_CODICE); break;
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
}
//preparo la query
TString query;
query << "USE " << LF_RILORE << "\n" ;
TString select;
query << "USE " << LF_RILORE << "\n" ;
if (risoatt.full())
select << "(" << RILORE_TIPORA << "==" << risoatt << ")";
select << "(" << RILORE_TIPORA << "==\"" << risoatt << "\")";
if (codice.full())
{
if (select.full()) select << "&&";
@ -345,52 +233,275 @@ void TRilevamento_cons_msk::riempi_sheet()
if (tpora.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_TPORA << ",\"" << tpora << "\",\"" << tpora << "\"))";
select << "(" << RILORE_TPORA << "==\"" << tpora << "\")";
}
if (codcosto.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODCOSTO << ",\"" << codcosto << "\",\"" << codcosto << "\"))";
select << "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")";
}
if (codcms.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODCMS << ",\"" << codcms << "\",\"" << codcms << "\"))";
select << "(" << RILORE_CODCMS << "==\"" << codcms << "\")";
}
if (codfase.full())
{
if (select.full()) select << "&&";
select << "(BETWEEN(" << RILORE_CODFASE << ",\"" << codfase << "\",\"" << codfase << "\"))";
select << "(" << RILORE_CODFASE << "==\"" << codfase << "\")";
}
if (select.full())
query << "SELECT " << select << "\n";
TString fromto = "TIPO=\"C\"";
if(risoatt != 'T')
TString fromto = RILORE_TIPO "=\"D\" ";
if (anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if (mese > 0)
fromto << RILORE_MESE << "=\"" << mese << "\" ";
}
riempi_calendario(query, anno, mese);
}
//RIEMPI_CALENDARIO: coloro le celle dello sheet calendario secondo le festività e i giorni occupati
void TRilevamento_cons_msk::riempi_calendario(const TString & query, const int anno, const int mese)
{
TSheet_field& calendario = sfield(F_CALENDARIO);
calendario.destroy();
sfield(F_SHEET).destroy();
TToken_string & row = calendario.row(-1);
TDate d(1, mese, anno); d.set_end_month();
const int end_month = d.day();
const short last_id = DAY2ID(end_month);
TBit_array fulldays;
TISAM_recordset recset(query);
//abilito per default tutte le colonne del calendario
for(short id = C_1; id <= C_31; id++)
calendario.enable_column(calendario.cid2index(id), id <= last_id ? true : false);
//scorro il recordset, aggiungo una riga allo sheet per ogni chiave analitica che trovo e coloro di blu
//tutte le celle che corrispondono a una data interessata da qualcosa
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
{
const int day = recset.get(RILORE_GIORNO).as_int();
fulldays.set(day);
}
for(short id = C_1; id <= last_id; id++)
{
const int column = calendario.cid2index(id);
if (fulldays[ID2DAY(id)])
{
if (_edit_mode)
calendario.set_back_and_fore_color(COLOR_DKBLUE, COLOR_DKBLUE, 0, column); // coloro di blu le date con registrazioni
}
else
if (TDate(ID2DAY(id), mese, anno).is_holiday())
calendario.set_back_and_fore_color(COLOR_DKRED, COLOR_DKRED, 0, column); // coloro di rosso le festività
row.add(' ', column);
}
calendario.force_update();
}
void TRilevamento_cons_msk::riempi_risoatt(int giorno)
{
TSheet_field& sheet = sfield(F_SHEET);
sheet.destroy();
//leggo dalla maschera i campi chiave di ricerca
const int anno = get_int(F_ANNO);
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
const int mese = get_int(F_MESE);
const TString4 tpora = get(F_TPORA);
TString80 codcosto;
TString80 codcms;
TString16 codfase;
TString16 codice;
TString query;
TString select;
switch(get(F_RISOATT)[0])
{
fromto << " TIPORA=\"" << risoatt << "\"";
if(codice.full())
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
}
get_anal_fields(codcosto, codcms, codfase);
//preparo la query
query << "USE " << LF_RILORE << "\n" ;
if (risoatt.full())
select << "(" << RILORE_TIPORA << "==\"" << risoatt << "\")";
if (codice.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
}
if (anno > 0)
{
if (select.full()) select << "&&";
select << "STR(" << RILORE_ANNO << "==" << anno << ")";
}
if (mese > 0)
{
if (select.full()) select << "&&";
select << "STR(" RILORE_MESE << "==" << mese << ")";
}
if (_edit_mode && giorno > 0)
{
if (select.full()) select << "&&";
select << "STR(" RILORE_GIORNO << "==" << giorno << ")";
}
if (tpora.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_TPORA << "==\"" << tpora << "\")";
}
if (codcosto.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")";
}
if (codcms.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODCMS << "==\"" << codcms << "\")";
}
if (codfase.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODFASE << "==\"" << codfase << "\")";
}
if (select.full())
query << "SELECT " << select << "\n";
TString fromto = RILORE_TIPO;
if (_edit_mode)
fromto << "=\"C\"";
else
fromto << "=\"D\"";
if (anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if (mese > 0)
{
fromto << " CODICE=\"" << codice << "\"";
if(anno > 0)
{
fromto << " ANNO=\"" << anno << "\"";
if(mese > 0)
{
fromto << " MESE=\"" << mese << "\"";
if(tpora.full())
fromto << " TPORA=\"" << tpora << "\"";
}
}
fromto << RILORE_MESE << "=\"" << mese << "\" ";
if (_edit_mode && giorno > 0)
fromto << RILORE_GIORNO << "=\"" << giorno << "\" ";
}
}
query << "FROM " << fromto << "\n"
<< "TO " << fromto;
TISAM_recordset def(query);
riempi_calendario(def);
//riempio lo sheet con i dati che soddisfano il filtro preparato prima
for(bool ok = def.move_first(); ok; ok = def.move_next())
{
TRilevamento_ore rilore(def.cursor()->curr());
TToken_string& riga = sheet.row(-1);
riga.add(rilore.tipora(), sheet.cid2index(S_RISOATT));
switch(rilore.tipora())
{
case 'R': riga.add(rilore.codice(), sheet.cid2index(S_CODRIS)); break;
case 'A': riga.add(rilore.codice(), sheet.cid2index(S_CODATT)); break;
default : break;
}
put_row_anal_fields(riga, rilore.codcosto(), rilore.codcms(), rilore.codfase());
riga.add(rilore.tpora(), sheet.cid2index(S_TPORA));
riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
riga.add(rilore.costo().string(), sheet.cid2index(S_COSTO));
sheet.check_row(sheet.items() - 1);
}
sheet.force_update();
}
//RIEMPI_SHEET: metodo che riempie lo sheet in base ai campi chiave
//compilati sulla maschera
void TRilevamento_cons_msk::riempi_sheet()
{
//leggo dalla maschera i campi chiave di ricerca
const int anno = get_int(F_ANNO);
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
const int mese = get_int(F_MESE);
const TString4 tpora = get(F_TPORA);
TString80 codcosto;
TString80 codcms;
TString16 codfase;
TString16 codice;
TString query;
TString select;
switch(get(F_RISOATT)[0])
{
case 'R': codice = get(F_CODRIS); break;
case 'A': codice = get(F_CODATT); break;
default: break;
}
get_anal_fields(codcosto, codcms, codfase);
//preparo la query
query << "USE " << LF_RILORE << "\n" ;
if (risoatt.full())
select << "(" << RILORE_TIPORA << "==\"" << risoatt << "\")";
if (codice.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
}
if (anno > 0)
{
if (select.full()) select << "&&";
select << "STR(" << RILORE_ANNO << "==" << anno << ")";
}
if (mese > 0)
{
if (select.full()) select << "&&";
select << "STR(" RILORE_MESE << "==" << mese << ")";
}
if (tpora.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_TPORA << "==\"" << tpora << "\")";
}
if (codcosto.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")";
}
if (codcms.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODCMS << "==\"" << codcms << "\")";
}
if (codfase.full())
{
if (select.full()) select << "&&";
select << "(" << RILORE_CODFASE << "==\"" << codfase << "\")";
}
if (select.full())
query << "SELECT " << select << "\n";
TString fromto = RILORE_TIPO "=\"C\"";
if (anno > 0)
{
fromto << " " << RILORE_ANNO << "=\"" << anno << "\" ";
if (mese > 0)
fromto << RILORE_MESE << "=\"" << mese << "\" ";
}
query << "FROM " << fromto << "\n"
<< "TO " << fromto;
riempi_calendario(query, anno, mese);
}
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
@ -410,36 +521,30 @@ void TRilevamento_cons_msk::azzera_tutto()
//vaoler pari a zero, e poi ricarica lo sheet
void TRilevamento_cons_msk::registra()
{
const TDate data = _datasel;
const int riga = _rigasel;
TSheet_field& calendario = sfield(F_CALENDARIO);
TToken_string& rigacal = calendario.row(riga);
TSheet_field& sheet = sfield(F_SHEET);
TRilevamento_ore rilroa;
const int mese = get_int(F_MESE);
const int anno = get_int(F_ANNO);
const int giorno = data.day();
TString80 codcosto;
TString80 codcms;
TString16 codfase;
FOR_EACH_SHEET_ROW(sheet, r, row)
FOR_EACH_SHEET_ROW(sheet, r, row)
{
TToken_string& riga = *(TToken_string*)row;
const char tipora = riga.get_char(sheet.cid2index(S_RISOATT));
const TString16 codice = tipora == 'R' ? riga.get(sheet.cid2index(S_CODRIS)) : riga.get(sheet.cid2index(S_CODATT));
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
const TString80 codcosto = rigacal.get(calendario.cid2index(C_CODCOSTO));
const TString80 codcms = rigacal.get(calendario.cid2index(C_CODCMS));
const TString80 codfase = rigacal.get(calendario.cid2index(C_CODFASE));
const int qtaore = riga.get_int(sheet.cid2index(S_QTAORE));
const real costo(riga.get(sheet.cid2index(S_COSTO)));
rilroa.read('C', tipora, codice, anno, mese, giorno, tpora);
get_row_anal_fields(riga, codcosto, codcms, codfase);
rilroa.read('C', anno, mese, _giorno, tipora, codice, tpora, codcosto, codcms, codfase);
if(qtaore == 0)
rilroa.remove();
else
{
rilroa.set_dadata(data);
rilroa.set_adata(data);
rilroa.set_qtaore(qtaore);
rilroa.set_costo(costo);
@ -447,6 +552,7 @@ void TRilevamento_cons_msk::registra()
}
}
riempi_sheet();
riempi_risoatt(_giorno);
}
void TRilevamento_cons_msk::notify_focus_field(short id)
@ -454,52 +560,61 @@ void TRilevamento_cons_msk::notify_focus_field(short id)
TMask::notify_focus_field(id);
if(id == F_CALENDARIO)
{
TSheet_field& calendario = sfield(id);
TToken_string& riga = calendario.row(calendario.selected());
const int giorno = calendario.current_column() - calendario.cid2index(C_1);
TDate data(giorno, get_int(F_MESE), get_int(F_ANNO));
_datasel = data;
_rigasel = calendario.selected();
riempi_risoatt(data, riga.get(0), riga.get(1), riga.get(2));
_giorno = sfield(id).current_column();
riempi_risoatt(_giorno);
}
}
//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() >= F_ANAL && f.dlg() <= F_ANAL+12)
{
if (e == fe_modify)
riempi_sheet();
}
switch (f.dlg())
{
case DLG_DEFAULT:
if(e == fe_button)
{
_mode = 'D';
_edit_mode = false;
carica_default();
}
break;
case DLG_CERCA:
if(e == fe_button)
{
_mode = 'F';
_edit_mode = true;
riempi_sheet();
}
break;
case DLG_SAVEREC:
if(e == fe_button)
{
_mode = 'S';
_edit_mode = true;
registra();
}
case F_ANNO:
case F_MESE:
case F_RISOATT:
case F_CODRIS:
case F_CODATT:
case F_TPORA:
if (e == fe_modify)
riempi_sheet();
break;
case S_RISOATT:
case S_CODRIS:
case S_CODATT:
case S_TPORA:
if(e == fe_modify)
{
if(get(S_RISOATT).full() && (get(F_CODRIS).full() || get(F_CODRIS).full()) && get(S_TPORA).full())
{
TSheet_field& sheet = sfield(F_SHEET);
TSheet_field& sheet = sfield(F_SHEET);
TMask & sm = sheet.sheet_mask();
if(sm.get(S_RISOATT).full() && (sm.get(S_CODRIS).full() || sm.get(S_CODATT).full()) && sm.get(S_TPORA).full())
proponi_costo(sheet.row(sheet.selected()));
}
}
break;
default: break;
@ -507,13 +622,119 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
return true;
}
void TRilevamento_cons_msk::esegui() const
{
}
TRilevamento_cons_msk::TRilevamento_cons_msk()
: TAutomask("ci2200a")
{
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
TConfig& ini = ca_config();
TSheet_field & s = sfield(F_SHEET);
TMask & sm = s.sheet_mask();
int y = 3;
int sy = 8;
short dlg = F_ANAL; // id del primo campo da generare
short sdlg = S_CDC1 + 100; // id del primo campo da generare
_cdc_sid = _cdc_lid = _cms_sid = _cms_lid = _fase_sid = _fase_lid = -1;
_scdc_sid = _scdc_lid = _scms_sid = _scms_lid = _sfase_sid = _sfase_lid = -1;
for (int i = 0; i < 2; i++)
{
const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2
if (level == "CDC") // Crea centro di costo
{
if (fasinfo.parent() == LF_CDC)
{
int h = ca_multilevel_code_info(LF_CDC).levels();
const int h1 = ca_create_fields_compact(*this, 0, LF_FASI, 2, y, dlg, dlg + 100);
y += 2;
_cdc_sid = dlg;
_cdc_lid = dlg + h - 1;
_fase_sid = _cdc_lid + 1;
_fase_lid = dlg + h1 - 1;
dlg += h1;
const int sh = ca_create_fields_compact(sm, 0, LF_FASI, 2, sy, sdlg, sdlg + 50);
sy += 2;
_scdc_sid = sdlg;
_scdc_lid = sdlg + h - 1;
_sfase_sid = _scdc_lid + 1;
_sfase_lid = sdlg + sh - 1;
sdlg += sh;
}
else
{
const int h = ca_create_fields_compact(*this, 0, LF_CDC, 2, y++, dlg, dlg + 100);
_cdc_sid = dlg;
_cdc_lid = dlg + h - 1;
dlg += h;
const int sh = ca_create_fields_compact(sm, 0, LF_CDC, 2, sy++, sdlg, sdlg + 50);
_scdc_sid = sdlg;
_scdc_lid = sdlg + sh - 1;
sdlg += h;
}
}
else
if (level == "CMS") // Crea commessa
{
if (fasinfo.parent() == LF_COMMESSE)
{
int h = ca_multilevel_code_info(LF_COMMESSE).levels();
const int h1 = ca_create_fields_compact(*this, 0, LF_FASI, 2, y, dlg, dlg + 100);
y += 2;
_cms_sid = dlg;
_cms_lid = dlg + h - 1;
_fase_sid = _cms_lid + 1;
_fase_lid = dlg + h1 - 1;
dlg += h1;
const int sh = ca_create_fields_compact(sm, 0, LF_FASI, 2, sy, sdlg, sdlg + 50);
sy += 2;
_scms_sid = sdlg;
_scms_lid = sdlg + h - 1;
_sfase_sid = _scms_lid + 1;
_sfase_lid = sdlg + sh - 1;
sdlg += sh;
}
else
{
const int h = ca_create_fields_compact(*this, 0, LF_COMMESSE, 2, y++, dlg, dlg + 100);
_cms_sid = dlg;
_cms_lid = dlg + h - 1;
dlg += h;
const int sh = ca_create_fields_compact(sm, 0, LF_COMMESSE, 2, sy++, sdlg, sdlg + 50);
_scms_sid = sdlg;
_scms_lid = sdlg + sh - 1;
sdlg += sh;
}
}
}
if (fasinfo.levels() > 0 && fasinfo.parent() <= 0)
{
const int h = ca_create_fields_compact(*this, 0, LF_FASI, 2, y++, dlg, dlg + 100);
_fase_sid = dlg;
_fase_lid = dlg + h - 1;
dlg += h;
const int sh = ca_create_fields_compact(sm, 0, LF_FASI, 2, sy++, sdlg, sdlg + 50);
_sfase_sid = sdlg;
_sfase_lid = sdlg + sh - 1;
sdlg += h;
}
for (short id = S_CDC12 + 100; id >= S_CDC1 + 100; id--)
{
const int pos = sm.id2pos(id);
if (pos >= 0)
{
TMask_field& f = sm.fld(pos);
const int size = f.size();
const TString prompt = ((TEditable_field &)f).get_warning();
s.set_column_header(id, prompt);
s.set_column_justify(id, f.is_kind_of(CLASS_REAL_FIELD));
s.set_column_width(id, (max(3+size, prompt.len()+1)) * CHARX);
s.enable_column(id);
}
else
s.delete_column(id);
}
_qtaore = 0;
}
@ -531,8 +752,7 @@ public:
void TRilevamento_cons_app::main_loop()
{
TRilevamento_cons_msk msk;
while (msk.run() != K_QUIT)
msk.esegui();
while (msk.run() != K_QUIT) ;
}
int ci2200(int argc, char *argv[])

View File

@ -12,53 +12,66 @@
#define F_CODCMS 311
#define F_CODFASE 312
#define F_CALENDARIO 313
#define F_SHEET 314
#define F_ANAL 314
#define F_SHEET 330
#define DLG_RESET 900
#define DLG_CERCA 901
#define DLG_DEFAULT 902
#define C_CODCOSTO 101
#define C_CODCMS 102
#define C_CODFASE 103
#define C_1 104
#define C_2 105
#define C_3 106
#define C_4 107
#define C_5 108
#define C_6 109
#define C_7 110
#define C_8 111
#define C_9 112
#define C_10 113
#define C_11 114
#define C_12 115
#define C_13 116
#define C_14 117
#define C_15 118
#define C_16 119
#define C_17 120
#define C_18 121
#define C_19 122
#define C_20 123
#define C_21 124
#define C_22 125
#define C_23 126
#define C_24 127
#define C_25 128
#define C_26 129
#define C_27 130
#define C_28 131
#define C_29 132
#define C_30 133
#define C_31 134
#define C_0 100
#define C_1 101
#define C_2 102
#define C_3 103
#define C_4 104
#define C_5 105
#define C_6 106
#define C_7 107
#define C_8 108
#define C_9 109
#define C_10 110
#define C_11 111
#define C_12 112
#define C_13 113
#define C_14 114
#define C_15 115
#define C_16 116
#define C_17 117
#define C_18 118
#define C_19 119
#define C_20 120
#define C_21 121
#define C_22 122
#define C_23 123
#define C_24 124
#define C_25 125
#define C_26 126
#define C_27 127
#define C_28 128
#define C_29 129
#define C_30 130
#define C_31 131
#define ID2DAY(ID) (ID - C_0)
#define DAY2ID(DAY) (C_0 + DAY)
#define S_RISOATT 101
#define S_CODRIS 102
#define S_DESRIS 899
#define S_DESRIS 119
#define S_CODATT 202
#define S_DESATT 999
#define S_DESATT 219
#define S_TPORA 103
#define S_QTAORE 104
#define S_COSTO 105
#define S_OREDIS 106
#define S_CDC1 104
#define S_CDC2 105
#define S_CDC3 106
#define S_CDC4 107
#define S_CDC5 108
#define S_CDC6 109
#define S_CDC7 110
#define S_CDC8 111
#define S_CDC9 112
#define S_CDC10 113
#define S_CDC11 114
#define S_CDC12 115
#define S_QTAORE 116
#define S_COSTO 117
#define S_OREDIS 118

View File

@ -47,7 +47,6 @@ END
LISTBOX F_MESE 10
BEGIN
PROMPT 24 1 "Mese "
ITEM "|"
FLAGS "M"
END
@ -75,66 +74,47 @@ END
STRING F_CODRIS 16
BEGIN
PROMPT 23 3 "Codice "
PROMPT 23 2 "Codice "
USE RSS
INPUT CODTAB F_CODRIS
DISPLAY "Codice@16" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODRIS CODTAB
OUTPUT F_DESRIS S0
GROUP 2
CHECKTYPE NORMAL
END
STRING F_DESRIS 50 27
BEGIN
PROMPT 50 2 ""
FLAGS "D"
GROUP 2
END
STRING F_CODATT 16
BEGIN
PROMPT 23 2 "Codice "
FIELD CODTAB[1,16]
USE ATR
INPUT CODTAB F_CODATT
DISPLAY "Codice@16" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODATT CODTAB
OUTPUT F_DESATT S0
GROUP 3
CHECKTYPE NORMAL
END
STRING F_CODCOSTO 20 15
STRING F_DESATT 50 27
BEGIN
PROMPT 2 3 "C.d.C. "
USE CDC
INPUT CODCOSTO F_CODCOSTO
DISPLAY "Codice@16" CODCOSTO
DISPLAY "Descrizione@50" DESCRIZ
OUTPUT F_CODCOSTO CODCOSTO
PROMPT 50 27 ""
FLAGS "D"
GROUP 3
END
STRING F_CODCMS 20 15
BEGIN
PROMPT 2 4 "Cms. "
USE COMMESSE
INPUT CODCMS F_CODCMS
DISPLAY "Codice@16" CODCMS
DISPLAY "Descrizione@50" DESCRIZ
OUTPUT F_CODCMS CODCMS
END
STRING F_CODFASE 10 8
BEGIN
PROMPT 2 5 "Fase "
USE FASI
INPUT CODCMSFAS F_CODCMS SELECT
INPUT CODFASE F_CODFASE
DISPLAY "Codice@16" CODFASE
DISPLAY "Descrizione@50" DESCRIZ
OUTPUT F_CODFASE CODFASE
END
SPREADSHEET F_CALENDARIO -16 4
SPREADSHEET F_CALENDARIO -16 2
BEGIN
PROMPT 1 7 ""
ITEM "Centro di\nCosto@8F"
ITEM "Codice\nCommessa@8F"
ITEM "Codice\nFase@5F"
ITEM "1@2"
ITEM "2@2"
ITEM "3@2"
@ -170,13 +150,26 @@ END
SPREADSHEET F_SHEET -15 0
BEGIN
PROMPT 1 12 ""
PROMPT 1 10 ""
ITEM "Tipo"
ITEM "Codice@16"
ITEM "Tipo\nOra@5"
ITEM "CDC1"
ITEM "CDC2"
ITEM "CDC3"
ITEM "CDC4"
ITEM "CDC5"
ITEM "CDC6"
ITEM "CDC7"
ITEM "CDC8"
ITEM "CDC9"
ITEM "CDC10"
ITEM "CDC11"
ITEM "CDC12"
ITEM "Qta\nOre@5"
ITEM "Costo@6"
ITEM "Ore\ndisponibilità"
ITEM "Descrizione@50"
END
ENDPAGE
@ -184,45 +177,6 @@ ENDMASK
PAGE "Calendario" -1 -1 78 13
GROUPBOX DLG_NULL 76 3
BEGIN
PROMPT 1 1 "@bDati Analitici"
END
STRING C_CODCOSTO 20 15
BEGIN
PROMPT 2 2 "C.d.C. "
USE COMMESSE
INPUT CODCMS C_CODCOSTO
DISPLAY "Codice@16" CODCMS
DISPLAY "Descrizione@50" DESCRIZ
OUTPUT C_CODCOSTO CODCMS
CHECKTYPE REQUIRED
END
STRING C_CODCMS 20 15
BEGIN
PROMPT 30 2 "Cms. "
USE COMMESSE
INPUT CODCMS C_CODCMS
DISPLAY "Codice@16" CODCMS
DISPLAY "Descrizione@50" DESCRIZ
OUTPUT C_CODCMS CODCMS
CHECKTYPE REQUIRED
END
STRING C_CODFASE 10 8
BEGIN
PROMPT 59 2 "Fase "
USE FASI
INPUT CODCMSFAS F_CODCMS SELECT
INPUT CODFASE F_CODFASE
DISPLAY "Codice@16" CODFASE
DISPLAY "Descrizione@50" DESCRIZ
OUTPUT F_CODFASE CODFASE
CHECKTYPE REQUIRED
END
STRING C_1 1
BEGIN
PROMPT 2 4 " 1"
@ -462,6 +416,78 @@ BEGIN
CHECKTYPE REQUIRED
END
STRING S_CDC1 20
BEGIN
PROMPT 2 8 "Cdc 1"
FLAGS "HB"
END
STRING S_CDC2 20
BEGIN
PROMPT 2 8 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC3 20
BEGIN
PROMPT 2 8 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC4 20
BEGIN
PROMPT 2 8 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC5 20
BEGIN
PROMPT 2 9 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC6 20
BEGIN
PROMPT 2 9 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC7 20
BEGIN
PROMPT 2 9 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC8 20
BEGIN
PROMPT 2 9 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC9 20
BEGIN
PROMPT 2 10 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC10 20
BEGIN
PROMPT 2 10 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC11 20
BEGIN
PROMPT 2 10 "Cdc 2"
FLAGS "HB"
END
STRING S_CDC12 20
BEGIN
PROMPT 2 10 "Cdc 2"
FLAGS "HB"
END
NUMBER S_QTAORE 6
BEGIN
PROMPT 2 11 "Quantità ore "

View File

@ -642,43 +642,17 @@ TDisp_risoatt::TDisp_risoatt(const TRectype& r)
////////////////////////////////
//READ: cerca una riga rilevamento ore in base alla chiave primaria
int TRilevamento_ore::read(const char tipo, const char tipora, const char *codice, const int anno, const int mese, const int giorno, const char *tpora, TReclock lock)
{
TLocalisamfile rilore(LF_RILORE);
rilore.setkey(2);
put(RILORE_TIPO, tipo);
put(RILORE_TIPORA, tipora);
put(RILORE_CODICE, codice);
put(RILORE_ANNO, anno);
put(RILORE_MESE, mese);
put(RILORE_GIORNO, giorno);
put(RILORE_TPORA, tpora);
TRectype saverec(*this);
int err = NOERR;
while ((err = TRectype::read(rilore,_isequal, lock)) == _islocked)
if (!yesno_box("Dati in uso da parte di un altro utente"))
break;
if (err != NOERR)
*this = saverec;
rilore.setkey(1);
return err;
}
//READ: cerca una riga rilevamento ore in base alla chiave secodaria
int TRilevamento_ore::read(const char tipo, const char tipora, const char *codice, const int anno, const int mese, const int giorno, const char *tpora, const char* codcosto, const char* codcms, const char* codfase, TReclock lock)
int TRilevamento_ore::read(const char tipo, const int anno, const int mese, const int giorno, const char tipora, const char *codice, const char *tpora, const char* codcosto, const char* codcms, const char* codfase, TReclock lock)
{
TLocalisamfile rilore(LF_RILORE);
zero();
put(RILORE_TIPO, tipo);
put(RILORE_TIPORA, tipora);
put(RILORE_CODICE, codice);
put(RILORE_ANNO, anno);
put(RILORE_MESE, mese);
put(RILORE_GIORNO, giorno);
put(RILORE_TIPORA, tipora);
put(RILORE_CODICE, codice);
put(RILORE_TPORA, tpora);
put(RILORE_CODCOSTO, codcosto);
put(RILORE_CODCMS, codcms);
@ -695,29 +669,6 @@ int TRilevamento_ore::read(const char tipo, const char tipora, const char *codic
return err;
}
//READ: cerca una riga rilevamento ore in base alla chiave secondaria
int TRilevamento_ore::read(const char tipo, const char* codcosto, const char* codcms, const char* codfase, TReclock lock)
{
TLocalisamfile rilore(LF_RILORE);
rilore.setkey(3);
put(RILORE_TIPO, tipo);
put(RILORE_CODCOSTO, codcosto);
put(RILORE_CODCMS, codcms);
put(RILORE_CODFASE, codfase);
TRectype saverec(*this);
int err = NOERR;
while ((err = TRectype::read(rilore,_isequal, lock)) == _islocked)
if (!yesno_box("Dati in uso da parte di un altro utente"))
break;
if (err != NOERR)
*this = saverec;
rilore.setkey(1);
return err;
}
int TRilevamento_ore::write_rewrite()
{
if (!empty())
@ -930,22 +881,10 @@ TRilevamento_ore::TRilevamento_ore(const TRilevamento_ore& rilore)
{
}
TRilevamento_ore::TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora, const char* codcosto, const char* codcms, const char* codfase)
TRilevamento_ore::TRilevamento_ore(const char tipo, const int anno, const int mese, const int giorno, const char tipora, const char* codice, const char* tpora, const char* codcosto, const char* codcms, const char* codfase)
: TRectype(LF_RILORE)
{
read(tipo, tipora, codice, anno, mese, giorno, tpora, codcosto, codcms, codfase);
}
TRilevamento_ore::TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora)
: TRectype(LF_RILORE)
{
read(tipo, tipora, codice, anno, mese, giorno, tpora);
}
TRilevamento_ore::TRilevamento_ore(const char tipo, const char* codcosto, const char* codcms, const char* codfase)
: TRectype(LF_RILORE)
{
read(tipo, codcosto, codcms, codfase);
read(tipo, anno, mese, giorno, tipora, codice, tpora, codcosto, codcms, codfase);
}
TRilevamento_ore::TRilevamento_ore()

View File

@ -222,9 +222,7 @@ class TRilevamento_ore : public TRectype
private:
public:
int read(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora, const char* codcosto, const char* codcms, const char* codfase, TReclock lock = _nolock);
int read(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora, TReclock lock = _nolock);
int read(const char tipo, const char* codcosto, const char* codcms, const char* codfase, TReclock lock = _nolock);
int read(const char tipo, const int anno, const int mese, const int giorno, const char tipora, const char* codice, const char* tpora, const char* codcosto, const char* codcms, const char* codfase, TReclock lock = _nolock);
int remove();
int write_rewrite();
int rewrite_write();
@ -263,9 +261,7 @@ public:
TRilevamento_ore(const TRectype& rec);
TRilevamento_ore(const TRilevamento_ore& rilore);
TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora, const char* codcosto, const char* codcms, const char* codfase);
TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const int mese, const int giorno, const char* tpora);
TRilevamento_ore(const char tipo, const char* codcosto, const char* codcms, const char* codfase);
TRilevamento_ore(const char tipo, const int anno, const int mese, const int giorno, const char tipora, const char* codice, const char* tpora, const char* codcosto, const char* codcms, const char* codfase);
TRilevamento_ore();
};

View File

@ -19,6 +19,6 @@ DANNO|2|4|0|Chiave doc - Anno
DCODNUM|2|4|0|Chiave doc - Codnum
DNDOC|2|7|0|Chiave doc - ndoc
3
TIPO+TIPORA+CODICE+ANNO+MESE+GIORNO+TPORA+CODCOSTO+CODCMS+CODFASE|
TIPO+TIPORA+CODICE+ANNO+MESE+GIORNO+TPORA|X
TIPO+ANNO+MESE+GIORNO+TIPORA+CODICE+TPORA+CODCOSTO+CODCMS+CODFASE|
TIPO+TIPORA+CODICE+ANNO+MESE+GIORNO+TPORA+CODCOSTO+CODCMS+CODFASE|X
TIPO+CODCOSTO+CODCMS+CODFASE|X