Patch level : 10.0 patch ???
Files correlati : ci0 ci2 Ricompilazione Demo : [ ] Commento : prima consegna del programma di rilevamento ore consuntivo - da sistemare il caricamento del default git-svn-id: svn://10.65.10.50/branches/R_10_00@20814 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
72cc8ea919
commit
1857dd25ac
@ -22,20 +22,20 @@
|
||||
//Classe TDef_risoatt_msk
|
||||
class TDef_risoatt_msk : public TAutomask
|
||||
{
|
||||
int _qtaore;
|
||||
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;
|
||||
int _qtaore;
|
||||
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;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
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 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 riempi_sheet();
|
||||
void nuova_riga();
|
||||
void azzera_riga(TSheet_field& sheet);
|
||||
@ -47,7 +47,7 @@ public:
|
||||
TDef_risoatt_msk();
|
||||
};
|
||||
|
||||
void TDef_risoatt_msk::get_anal_fields(TString & cdc, TString & cms, TString & fase)
|
||||
void TDef_risoatt_msk::get_anal_fields(TString& cdc, TString& cms, TString& fase)
|
||||
{
|
||||
TString val;
|
||||
|
||||
|
@ -212,6 +212,7 @@ BEGIN
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "GD"
|
||||
GROUP 2
|
||||
MESSAGE COPY,S_CODRIS
|
||||
END
|
||||
|
||||
STRING S_DESATT 50
|
||||
|
@ -214,6 +214,7 @@ BEGIN
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "GD"
|
||||
GROUP 2
|
||||
MESSAGE COPY,S_CODRIS
|
||||
END
|
||||
|
||||
STRING S_DESATT 50
|
||||
|
225
ci/ci2200.cpp
225
ci/ci2200.cpp
@ -1,5 +1,6 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <colors.h>
|
||||
#include <defmask.h>
|
||||
#include <recset.h>
|
||||
#include <sheet.h>
|
||||
@ -25,12 +26,16 @@ protected:
|
||||
const real proponi_costo(TToken_string& riga);
|
||||
|
||||
void carica_default();
|
||||
|
||||
void riempi_sheet();
|
||||
void riempi_calendario(TISAM_recordset& def, const char fonte);
|
||||
void riempi_risoatt(TDate& data, const char* codcosto, const char* codcms, const char* codfase);
|
||||
void nuova_riga();
|
||||
void azzera_riga(TSheet_field& sheet);
|
||||
void azzera_tutto(TSheet_field& sheet);
|
||||
void registra();
|
||||
|
||||
virtual void notify_focus_field(short id);
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
@ -125,11 +130,10 @@ const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
|
||||
|
||||
void TRilevamento_cons_msk::carica_default()
|
||||
{
|
||||
/*//leggo dalla maschera i campi chiave di ricerca
|
||||
const int anno = get_date(F_DADATA).year();
|
||||
//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);
|
||||
TString4 damese; damese.format("%02d", get_date(F_DADATA).month());
|
||||
TString4 amese; amese.format("%02d", get_date(F_ADATA).month());
|
||||
const TString4 mese = get(F_MESE);
|
||||
const TString4 tpora = get(F_TPORA);
|
||||
const TString80 codcosto = get(F_CODCOSTO);
|
||||
const TString80 codcms = get(F_CODCMS);
|
||||
@ -148,7 +152,7 @@ void TRilevamento_cons_msk::carica_default()
|
||||
<< "SELECT (BETWEEN(TIPORA,\"" << risoatt << "\",\"" << risoatt << "\"))&&"
|
||||
<< "(BETWEEN(CODICE,\"" << codice << "\",\"" << codice << "\"))&&"
|
||||
<< "(BETWEEN(ANNO," << anno << "," << anno << "))&&"
|
||||
<< "(BETWEEN(MESE,\"" << damese << "\",\"" << amese << "\"))&&"
|
||||
<< "(BETWEEN(MESE,\"" << mese << "\",\"" << mese << "\"))&&"
|
||||
<< "(BETWEEN(TPORA,\"" << tpora << "\",\"" << tpora << "\"))&&"
|
||||
<< "(BETWEEN(CODCOSTO,\"" << codcosto << "\",\"" << codcosto << "\"))&&"
|
||||
<< "(BETWEEN(CODCMS,\"" << codcms << "\",\"" << codcms << "\"))&&"
|
||||
@ -164,31 +168,143 @@ void TRilevamento_cons_msk::carica_default()
|
||||
if(anno > 0)
|
||||
{
|
||||
fromto << " ANNO=\"" << anno << "\"";
|
||||
if(damese.full())
|
||||
if(mese.full())
|
||||
{
|
||||
fromto << " MESE=\"" << damese << "\"";
|
||||
fromto << " MESE=\"" << mese << "\"";
|
||||
if(tpora.full())
|
||||
fromto << " TPORA=\"" << tpora << "\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query << "FROM " << fromto << "\n"
|
||||
<< "TO " << fromto;
|
||||
//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 char fonte)
|
||||
{
|
||||
const int anno = get_int(F_ANNO);
|
||||
const int mese = atoi(get(F_MESE));
|
||||
TSheet_field& calendario = sfield(F_CALENDARIO);
|
||||
calendario.destroy();
|
||||
|
||||
TISAM_recordset def(query);
|
||||
//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();
|
||||
if(!data.ok())
|
||||
data = NULLDATE;
|
||||
|
||||
int cid = C_CODFASE;
|
||||
cid += data.day();
|
||||
calendario.set_back_and_fore_color(COLOR_DKBLUE, COLOR_DKBLUE, commesse.get_int(com), calendario.cid2index(cid));
|
||||
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));
|
||||
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();
|
||||
|
||||
const TDate da(1, get_date(F_DADATA).month(), get_date(F_DADATA).year());
|
||||
TDate a = da; a.set_day(a.last_day(da.month(), a.year()));
|
||||
//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;
|
||||
query << "USE RILORE\n"
|
||||
<< "SELECT (BETWEEN(TIPORA,\"" << risoatt << "\",\"" << risoatt << "\"))&&"
|
||||
<< "(BETWEEN(ANNO," << anno << "," << anno << "))&&"
|
||||
<< "(BETWEEN(MESE,\"" << mese << "\",\"" << mese << "\"))&&"
|
||||
<< "(BETWEEN(TPORA,\"" << tpora << "\",\"" << tpora << "\"))&&"
|
||||
<< "(BETWEEN(CODCOSTO,\"" << codcosto << "\",\"" << codcosto << "\"))&&"
|
||||
<< "(BETWEEN(CODCMS,\"" << codcms << "\",\"" << codcms << "\"))&&"
|
||||
<< "(BETWEEN(CODFASE,\"" << codfase << "\",\"" << codfase << "\"))&&"
|
||||
<< "(BETWEEN(DADATA,#DATA,#DATA))\n"
|
||||
<< "FROM TIPO=\"C\"\n"
|
||||
<< "TO TIPO=\"C\"";
|
||||
|
||||
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())
|
||||
@ -197,30 +313,21 @@ void TRilevamento_cons_msk::carica_default()
|
||||
case 'A': riga.add(rilore.codice(), sheet.cid2index(S_CODATT)); break;
|
||||
default : break;
|
||||
}
|
||||
riga.add(rilore.dadata(), sheet.cid2index(S_DADATA));
|
||||
riga.add(rilore.adata(), sheet.cid2index(S_ADATA));
|
||||
riga.add(rilore.tpora(), sheet.cid2index(S_TPORA));
|
||||
riga.add(rilore.codcosto(), sheet.cid2index(S_CODCOSTO));
|
||||
riga.add(rilore.codcms(), sheet.cid2index(S_CODCMS));
|
||||
riga.add(rilore.codfase(), sheet.cid2index(S_CODFASE));
|
||||
riga.add(da, sheet.cid2index(S_DADATA));
|
||||
riga.add(a, sheet.cid2index(S_ADATA));
|
||||
riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
|
||||
riga.add(proponi_costo(riga).string(), sheet.cid2index(S_COSTO));
|
||||
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.force_update();*/
|
||||
|
||||
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_date(F_DADATA).year();
|
||||
//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);
|
||||
TString4 damese; damese.format("%02d", get_date(F_DADATA).month());
|
||||
TString4 amese; amese.format("%02d", get_date(F_ADATA).month());
|
||||
const TString4 mese = get(F_MESE);
|
||||
const TString4 tpora = get(F_TPORA);
|
||||
const TString80 codcosto = get(F_CODCOSTO);
|
||||
const TString80 codcms = get(F_CODCMS);
|
||||
@ -234,18 +341,19 @@ void TRilevamento_cons_msk::riempi_sheet()
|
||||
default: break;
|
||||
}
|
||||
|
||||
//preparo la query
|
||||
TString query;
|
||||
query << "USE RILORE\n"
|
||||
<< "SELECT (BETWEEN(TIPORA,\"" << risoatt << "\",\"" << risoatt << "\"))&&"
|
||||
<< "(BETWEEN(CODICE,\"" << codice << "\",\"" << codice << "\"))&&"
|
||||
<< "(BETWEEN(ANNO," << anno << "," << anno << "))&&"
|
||||
<< "(BETWEEN(MESE,\"" << damese << "\",\"" << amese << "\"))&&"
|
||||
<< "(BETWEEN(MESE,\"" << mese << "\",\"" << mese << "\"))&&"
|
||||
<< "(BETWEEN(TPORA,\"" << tpora << "\",\"" << tpora << "\"))&&"
|
||||
<< "(BETWEEN(CODCOSTO,\"" << codcosto << "\",\"" << codcosto << "\"))&&"
|
||||
<< "(BETWEEN(CODCMS,\"" << codcms << "\",\"" << codcms << "\"))&&"
|
||||
<< "(BETWEEN(CODFASE,\"" << codfase << "\",\"" << codfase << "\"))\n";
|
||||
|
||||
TString fromto = "TIPO=\"P\"";
|
||||
TString fromto = "TIPO=\"C\"";
|
||||
if(risoatt != 'T')
|
||||
{
|
||||
fromto << " TIPORA=\"" << risoatt << "\"";
|
||||
@ -255,9 +363,9 @@ void TRilevamento_cons_msk::riempi_sheet()
|
||||
if(anno > 0)
|
||||
{
|
||||
fromto << " ANNO=\"" << anno << "\"";
|
||||
if(damese.full())
|
||||
if(mese.full())
|
||||
{
|
||||
fromto << " MESE=\"" << damese << "\"";
|
||||
fromto << " MESE=\"" << mese << "\"";
|
||||
if(tpora.full())
|
||||
fromto << " TPORA=\"" << tpora << "\"";
|
||||
}
|
||||
@ -270,33 +378,8 @@ void TRilevamento_cons_msk::riempi_sheet()
|
||||
|
||||
TISAM_recordset def(query);
|
||||
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
sheet.destroy();
|
||||
|
||||
//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.dadata(), sheet.cid2index(S_DADATA));
|
||||
riga.add(rilore.adata(), sheet.cid2index(S_ADATA));
|
||||
riga.add(rilore.tpora(), sheet.cid2index(S_TPORA));
|
||||
riga.add(rilore.codcosto(), sheet.cid2index(S_CODCOSTO));
|
||||
riga.add(rilore.codcms(), sheet.cid2index(S_CODCMS));
|
||||
riga.add(rilore.codfase(), sheet.cid2index(S_CODFASE));
|
||||
riga.add(rilore.dadata(), sheet.cid2index(S_DADATA));
|
||||
riga.add(rilore.adata(), sheet.cid2index(S_ADATA));
|
||||
riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
|
||||
riga.add(rilore.costo().string(), sheet.cid2index(S_COSTO));
|
||||
}
|
||||
sheet.force_update();*/
|
||||
riempi_calendario(def, 'C');
|
||||
|
||||
}
|
||||
|
||||
//NUOVA_RIGA: metodo che aggiunge una riga allo sheet
|
||||
@ -472,13 +555,33 @@ void TRilevamento_cons_msk::registra()
|
||||
riempi_sheet();*/
|
||||
}
|
||||
|
||||
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));
|
||||
riempi_risoatt(data, riga.get(0), riga.get(1), riga.get(2));
|
||||
}
|
||||
}
|
||||
|
||||
//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)
|
||||
{
|
||||
/* switch (f.dlg())
|
||||
switch (f.dlg())
|
||||
{
|
||||
case DLG_DEFAULT:
|
||||
if(e == fe_button)
|
||||
carica_default();
|
||||
case F_ANNO:
|
||||
case F_MESE:
|
||||
if(e == fe_modify)
|
||||
riempi_sheet();
|
||||
default: break;
|
||||
} */
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
16
ci/ci2200a.h
16
ci/ci2200a.h
@ -1,4 +1,4 @@
|
||||
//Campi maschera ci0600a
|
||||
//Campi maschera ci2200a
|
||||
#define F_ANNO 301
|
||||
#define F_MESE 302
|
||||
#define F_TPORA 303
|
||||
@ -53,12 +53,12 @@
|
||||
#define C_30 133
|
||||
#define C_31 134
|
||||
|
||||
#define S_RISOATT 205
|
||||
#define S_CODRIS 206
|
||||
#define S_RISOATT 101
|
||||
#define S_CODRIS 102
|
||||
#define S_DESRIS 899
|
||||
#define S_CODATT 306
|
||||
#define S_CODATT 202
|
||||
#define S_DESATT 999
|
||||
#define S_TPORA 207
|
||||
#define S_QTAORE 208
|
||||
#define S_COSTO 209
|
||||
#define S_OREDIS 210
|
||||
#define S_TPORA 103
|
||||
#define S_QTAORE 104
|
||||
#define S_COSTO 105
|
||||
#define S_OREDIS 106
|
@ -399,6 +399,7 @@ BEGIN
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "GD"
|
||||
GROUP 1
|
||||
MESSAGE COPY,S_CODATT
|
||||
END
|
||||
|
||||
STRING S_DESRIS 50
|
||||
@ -422,6 +423,7 @@ BEGIN
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "GD"
|
||||
GROUP 2
|
||||
MESSAGE COPY,S_CODRIS
|
||||
END
|
||||
|
||||
STRING S_DESATT 50
|
||||
|
Loading…
x
Reference in New Issue
Block a user