Patch level : 12.0 426
Files correlati : ci0200a.msk ci0300a.msk ci1.exe ci1300a.rep ci2.exe MODIFICHE CRPA Aggiunto tipo assenza alla tabella ore Anno obbligatorio nel listino costi Stampato il tipo di assenza, le ore di assenza e il totale ora lavorate nella stampa ore mensili per risorsa/attrezzatura Proposta automatica delle disponibilità di ore se non si inserisce nulla nell’immissione consuntivo con parametri in configurazione git-svn-id: svn://10.65.10.50/branches/R_10_00@23994 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6af69b6f17
commit
6679ae167f
@ -46,6 +46,7 @@ END
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 2 1 "Anno "
|
||||
CHECTYPE REQUIRED
|
||||
FLAGS "A"
|
||||
END
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#define F_DESCAUSCN 172
|
||||
#define F_CODARTPR 173
|
||||
#define F_DESARTPR 174
|
||||
#define F_AUTODEF 175
|
||||
#define F_DEFDISP 176
|
||||
|
||||
#define F_CODNUMNI 165
|
||||
#define F_DESNUMNI 166
|
||||
|
@ -166,7 +166,7 @@ BEGIN
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
GROUPBOX DLG_NULL 78 6
|
||||
BEGIN
|
||||
PROMPT 1 10 "@bConsuntivi"
|
||||
END
|
||||
@ -254,14 +254,28 @@ BEGIN
|
||||
ADD RUN cg0 -4
|
||||
END
|
||||
|
||||
BOOLEAN F_AUTODEF
|
||||
BEGIN
|
||||
PROMPT 2 14 "Default automatico"
|
||||
FIELS DefaultAuto
|
||||
MESSAGE TRUE ENABLE,F_DEFDISP
|
||||
MESSAGE FALSE CLEAR,F_DEFDISP
|
||||
END
|
||||
|
||||
BOOLEAN F_DEFDISP
|
||||
BEGIN
|
||||
PROMPT 40 14 "Default da Disponibilità"
|
||||
FIELS DefaultDisp
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
BEGIN
|
||||
PROMPT 1 15 "@bMovimenti NON IVA"
|
||||
PROMPT 1 17 "@bMovimenti NON IVA"
|
||||
END
|
||||
|
||||
STRING F_CODNUMNI 4
|
||||
BEGIN
|
||||
PROMPT 2 16 "Numerazione "
|
||||
PROMPT 2 18 "Numerazione "
|
||||
FIELD CODNUMNI
|
||||
HELP "Codice numerazione"
|
||||
COPY USE F_CODNUMPR
|
||||
@ -276,7 +290,7 @@ END
|
||||
|
||||
STRING F_DESNUMNI 50
|
||||
BEGIN
|
||||
PROMPT 25 16 ""
|
||||
PROMPT 25 18 ""
|
||||
HELP "Descrizione numerazione"
|
||||
COPY USE F_DESNUMPR
|
||||
INPUT S0 F_DESNUMNI
|
||||
@ -286,7 +300,7 @@ END
|
||||
|
||||
STRING F_TIPODOCNI 4
|
||||
BEGIN
|
||||
PROMPT 2 17 "Tipo documento "
|
||||
PROMPT 2 19 "Tipo documento "
|
||||
FIELD TIPODOCNI
|
||||
HELP "Codice tipo documento"
|
||||
COPY USE F_TIPODOCPR
|
||||
@ -300,7 +314,7 @@ END
|
||||
|
||||
STRING F_DESTIPODOCNI 50
|
||||
BEGIN
|
||||
PROMPT 25 17 ""
|
||||
PROMPT 25 19 ""
|
||||
HELP "Descrizione tipo documento"
|
||||
COPY USE F_DESTIPODOCPR
|
||||
INPUT S0 F_DESTIPODOCNI
|
||||
@ -310,7 +324,7 @@ END
|
||||
|
||||
STRING F_CODIVANI 4
|
||||
BEGIN
|
||||
PROMPT 2 18 "Codice IVA "
|
||||
PROMPT 2 20 "Codice IVA "
|
||||
FIELD CODIVANI
|
||||
HELP "Codice IVA"
|
||||
USE %IVA
|
||||
@ -325,7 +339,7 @@ END
|
||||
|
||||
STRING F_DESIVANI 50
|
||||
BEGIN
|
||||
PROMPT 25 18 ""
|
||||
PROMPT 25 20 ""
|
||||
HELP "Descrizione IVA"
|
||||
USE %IVA KEY 2
|
||||
INPUT S0 F_DESIVANI
|
||||
|
@ -71,6 +71,7 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int c
|
||||
const char tipo_stampa = get(F_TIPOSTAMPA)[0];
|
||||
const int anno = get_int(F_ANNO);
|
||||
const int mese = tipo_stampa == 'M' ? curr_mese : 0;
|
||||
const bool calc_ore_lav = rep.field("F1.98") != NULL;
|
||||
|
||||
//date del periodo
|
||||
TDate inizio_periodo, fine_periodo;
|
||||
@ -82,6 +83,19 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int c
|
||||
//se tipo_stampa = 'A'nnuale: il contenuto dell'assoc_array sarà: tot_Prev - 12 valori mensili Consuntivi - tot_Consuntivo
|
||||
|
||||
TAssoc_array righe;
|
||||
TString_array tpass;
|
||||
|
||||
for (TDate data = inizio_periodo; data <= fine_periodo; ++data)
|
||||
{
|
||||
int i = data - inizio_periodo + 1;
|
||||
|
||||
if (data.wday() > 5)
|
||||
tpass.add("WE", i);
|
||||
else
|
||||
if (data.is_holiday())
|
||||
tpass.add("PH", i);
|
||||
}
|
||||
|
||||
|
||||
const TVariant tiporisorsa = get(F_RISOATT);
|
||||
|
||||
@ -137,6 +151,8 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int c
|
||||
const real tot_ore = rilore_recset.get(RILORE_QTAORE).as_real();
|
||||
|
||||
const real tot_ore_uso_risorsa_nel_periodo = tot_ore * giorni_lavorativi / giorni_lavorativi_rilore;
|
||||
const TString8 tpora = rilore_recset.get(RILORE_TPORA).as_string();
|
||||
const TString8 tpassenza = cache().get("&ORE", tpora, "S2");
|
||||
|
||||
//crea la chiave per l'assoc_array
|
||||
TToken_string key;
|
||||
@ -185,6 +201,22 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int c
|
||||
real tot = record->get(32);
|
||||
tot += ore_al_giorno;
|
||||
record->add(tot.string(), 32);
|
||||
|
||||
int i = data - inizio_periodo + 1;
|
||||
if (tpassenza.full())
|
||||
{
|
||||
TString8 tp = tpass.objptr(i) == NULL ? EMPTY_STRING : tpass.row(i);
|
||||
|
||||
if (tp.blank())
|
||||
tpass.add(tpassenza, i);
|
||||
}
|
||||
else
|
||||
if (calc_ore_lav)
|
||||
{
|
||||
real totorelav = record->get(33);
|
||||
totorelav += ore_al_giorno;
|
||||
record->add(totorelav.string(), 33);
|
||||
}
|
||||
}
|
||||
} //for (TDate data = inizio_int..
|
||||
} //if (tipo_ora == 'P')..
|
||||
@ -193,6 +225,23 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int c
|
||||
|
||||
} //for (int i = 0; i < 2; i++)...
|
||||
|
||||
if (calc_ore_lav)
|
||||
{
|
||||
for (int d = 1; d <= 31; ++d)
|
||||
{
|
||||
TString8 fld = "H0."; fld << 200 + d;
|
||||
|
||||
if (tpass.objptr(d) != NULL)
|
||||
{
|
||||
const TString8 tp = tpass.row(d);
|
||||
|
||||
rep.field(fld)->set(tp);
|
||||
}
|
||||
else
|
||||
rep.field(fld)->set("");
|
||||
}
|
||||
}
|
||||
|
||||
//prende il recordset in opera dal report per fargli le set_var
|
||||
TRil_ore_recordset* recset = (TRil_ore_recordset*)rep.recordset();
|
||||
//tenta la mask2report per far apparire sul report i campi di selezione della maschera
|
||||
|
@ -52,6 +52,9 @@
|
||||
<li Value="Fase" Code="8" />
|
||||
</list>
|
||||
</field>
|
||||
<field border="1" x="14" y="3" type="Testo" width="29" pattern="1" text="Tipo assenza">
|
||||
<font face="Arial Narrow" bold="1" size="7" />
|
||||
</field>
|
||||
<field border="1" x="57" y="1" type="Stringa" align="center" width="3.5" height="2" id="101" pattern="2" />
|
||||
<field border="1" x="60.5" y="1" type="Stringa" align="center" width="3.5" height="2" id="102" pattern="2" />
|
||||
<field border="1" x="64" y="1" type="Stringa" align="center" width="3.5" height="2" id="103" pattern="2" />
|
||||
@ -83,6 +86,37 @@
|
||||
<field border="1" x="155" y="1" type="Stringa" align="center" width="3.5" height="2" id="129" pattern="2" />
|
||||
<field border="1" x="158.5" y="1" type="Stringa" align="center" width="3.5" height="2" id="130" pattern="2" />
|
||||
<field border="1" x="162" y="1" type="Stringa" align="center" width="3.5" height="2" id="131" pattern="2" />
|
||||
<field border="1" x="57" y="3" type="Stringa" width="3.5" id="201" pattern="1" />
|
||||
<field border="1" x="60.5" y="3" type="Stringa" width="3.5" id="202" pattern="1" />
|
||||
<field border="1" x="64" y="3" type="Stringa" width="3.5" id="203" pattern="1" />
|
||||
<field border="1" x="67.5" y="3" type="Stringa" width="3.5" id="204" pattern="1" />
|
||||
<field border="1" x="71" y="3" type="Stringa" width="3.5" id="205" pattern="1" />
|
||||
<field border="1" x="74.5" y="3" type="Stringa" width="3.5" id="206" pattern="1" />
|
||||
<field border="1" x="78" y="3" type="Stringa" width="3.5" id="207" pattern="1" />
|
||||
<field border="1" x="81.5" y="3" type="Stringa" width="3.5" id="208" pattern="1" />
|
||||
<field border="1" x="85" y="3" type="Stringa" width="3.5" id="209" pattern="1" />
|
||||
<field border="1" x="88.5" y="3" type="Stringa" width="3.5" id="210" pattern="1" />
|
||||
<field border="1" x="92" y="3" type="Stringa" width="3.5" id="211" pattern="1" />
|
||||
<field border="1" x="95.5" y="3" type="Stringa" width="3.5" id="212" pattern="1" />
|
||||
<field border="1" x="99" y="3" type="Stringa" width="3.5" id="213" pattern="1" />
|
||||
<field border="1" x="102.5" y="3" type="Stringa" width="3.5" id="214" pattern="1" />
|
||||
<field border="1" x="106" y="3" type="Stringa" width="3.5" id="215" pattern="1" />
|
||||
<field border="1" x="109.5" y="3" type="Stringa" width="3.5" id="216" pattern="1" />
|
||||
<field border="1" x="113" y="3" type="Stringa" width="3.5" id="217" pattern="1" />
|
||||
<field border="1" x="116.5" y="3" type="Stringa" width="3.5" id="218" pattern="1" />
|
||||
<field border="1" x="120" y="3" type="Stringa" width="3.5" id="219" pattern="1" />
|
||||
<field border="1" x="123.5" y="3" type="Stringa" width="3.5" id="220" pattern="1" />
|
||||
<field border="1" x="127" y="3" type="Stringa" width="3.5" id="221" pattern="1" />
|
||||
<field border="1" x="130.5" y="3" type="Stringa" width="3.5" id="222" pattern="1" />
|
||||
<field border="1" x="134" y="3" type="Stringa" width="3.5" id="223" pattern="1" />
|
||||
<field border="1" x="137.5" y="3" type="Stringa" width="3.5" id="224" pattern="1" />
|
||||
<field border="1" x="141" y="3" type="Stringa" width="3.5" id="225" pattern="1" />
|
||||
<field border="1" x="144.5" y="3" type="Stringa" width="3.5" id="226" pattern="1" />
|
||||
<field border="1" x="148" y="3" type="Stringa" width="3.5" id="227" pattern="1" />
|
||||
<field border="1" x="151.5" y="3" type="Stringa" width="3.5" id="228" pattern="1" />
|
||||
<field border="1" x="155" y="3" type="Stringa" width="3.5" id="229" pattern="1" />
|
||||
<field border="1" x="158.5" y="3" type="Stringa" width="3.5" id="230" pattern="1" />
|
||||
<field border="1" x="162" y="3" type="Stringa" width="3.5" id="231" pattern="1" />
|
||||
</section>
|
||||
<section type="Head" level="1" pattern="1">
|
||||
<font face="Arial" size="10" />
|
||||
@ -146,7 +180,7 @@
|
||||
<font face="Arial" bold="1" size="10" />
|
||||
<prescript description="H1.91 PRESCRIPT">MESSAGE TABLEREAD,RSS,#90,S0</prescript>
|
||||
</field>
|
||||
<field x="71" y="4.5" type="Stringa" bg_color="#400040" txt_color="#FFFFFF" width="50" id="92" pattern="2">
|
||||
<field x="71" y="4.5" type="Stringa" bg_color="#400040" txt_color="#FFFFFF" width="96" id="92" pattern="2">
|
||||
<font face="Arial" bold="1" size="10" />
|
||||
<prescript description="H1.92 PRESCRIPT">MESSAGE TABLEREAD,ATR,#90,S0</prescript>
|
||||
</field>
|
||||
@ -311,6 +345,10 @@
|
||||
<source>G31</source>
|
||||
<prescript description="B1.0 PRESCRIPT">MESSAGE ADD,F1.131</prescript>
|
||||
</field>
|
||||
<field border="1" x="168" type="Numero" hidden="1" align="right" width="3.5" pattern="1" text=".2">
|
||||
<source>TotOreLav</source>
|
||||
<prescript description="B1.0 PRESCRIPT">MESSAGE ADD,F1.98</prescript>
|
||||
</field>
|
||||
<field border="1" x="1" type="Stringa" width="13" id="90" pattern="1">
|
||||
<font face="Arial Narrow" bold="1" size="8" />
|
||||
<source>IF ((#ORDINAMENTO==4)||(#ORDINAMENTO==8);Key3;IF ((#ORDINAMENTO==1)||(#ORDINAMENTO==5);Key1;Key2))
|
||||
@ -322,16 +360,27 @@
|
||||
</field>
|
||||
</section>
|
||||
<section type="Foot" pattern="1" />
|
||||
<section type="Foot" level="1" height="6" pattern="1">
|
||||
<section type="Foot" level="1" height="15" pattern="1">
|
||||
<font face="Arial Narrow" bold="1" size="7" />
|
||||
<field border="1" x="14" y="0.5" type="Testo" align="right" bg_color="#C0C0C0" width="29" pattern="2" text="Totali">
|
||||
<font face="Arial" bold="1" size="8" />
|
||||
</field>
|
||||
<field x="128" y="3" type="Testo" width="4" pattern="1" text="Data" />
|
||||
<field x="133" y="3" type="Data" width="10" pattern="1">
|
||||
<source>#SYSTEM.DATE</source>
|
||||
</field>
|
||||
<field x="150" y="3" type="Testo" width="7" pattern="1" text="Firma" />
|
||||
<field border="2" x="14" y="3" type="Rettangolo" width="42" height="6" pattern="1" />
|
||||
<field border="1" x="14" y="3" type="Testo" align="center" width="42" pattern="1" text="Assenze" />
|
||||
<field border="1" x="14" y="4" type="Testo" width="36" pattern="1" text="Weekend" />
|
||||
<field border="1" x="50" y="4" type="Testo" align="center" width="6" pattern="1" text="WE" />
|
||||
<field x="138" y="4" type="Testo" width="12" pattern="1" text="Totale ore lavorate" />
|
||||
<field border="1" x="14" y="5" type="Testo" width="36" pattern="1" text="Malattia" />
|
||||
<field border="1" x="50" y="5" type="Testo" align="center" width="6" pattern="1" text="SL" />
|
||||
<field border="1" x="14" y="6" type="Testo" width="36" pattern="1" text="Festivit&#E0; pubblica" />
|
||||
<field border="1" x="50" y="6" type="Testo" align="center" width="6" pattern="1" text="PH" />
|
||||
<field border="1" x="14" y="7" type="Testo" width="36" pattern="1" text="Ferie annuali" />
|
||||
<field border="1" x="50" y="7" type="Testo" align="center" width="6" pattern="1" text="AH" />
|
||||
<field border="1" x="14" y="8" type="Testo" width="36" pattern="1" text="Altre assenze" />
|
||||
<field border="1" x="50" y="8" type="Testo" align="center" width="6" pattern="1" text="OA" />
|
||||
<field border="1" x="14" y="10" type="Testo" width="75" height="4" pattern="1" text=" Data e firma Staff Member" />
|
||||
<field border="1" x="90" y="10" type="Testo" width="75" height="4" pattern="1" text=" Data e firma Project ManagerF; CoordinatoreF;Responsabile" />
|
||||
<field border="1" x="150" y="4" type="Numero" align="right" width="6" id="98" pattern="1" text=".2" />
|
||||
<field border="1" x="43.5" y="0.5" type="Numero" align="right" bg_color="#C0C0C0" width="6" id="99" pattern="2" text=".2" />
|
||||
<field border="1" x="50" y="0.5" type="Numero" align="right" bg_color="#C0C0C0" width="6" id="100" pattern="2" text=".2" />
|
||||
<field border="1" x="57" y="0.5" type="Numero" align="right" bg_color="#C0C0C0" width="3.5" id="101" pattern="2" hide_zero="1" text=".2" />
|
||||
@ -368,4 +417,4 @@
|
||||
</section>
|
||||
<section type="Foot" level="2" pattern="1" />
|
||||
<section type="Foot" level="3" pattern="1" />
|
||||
</report>
|
||||
</report>
|
||||
|
@ -25,6 +25,7 @@ TRil_ore_recordset::TRil_ore_recordset() : TAS400_recordset("AS400(512)")
|
||||
|
||||
create_field("TotPrev", -1, 7, _realfld, false);
|
||||
create_field("TotCons", -1, 7, _realfld, false);
|
||||
create_field("TotOreLav", -1, 7, _realfld, false);
|
||||
|
||||
TString4 name;
|
||||
for (int i = 1; i <= 31; i++)
|
||||
@ -48,6 +49,8 @@ bool TRil_ore_cms_recordset::cms_cdc_filter(const TRelation* rel)
|
||||
{
|
||||
const TRectype& curr_rec = rel->curr();
|
||||
const TString& curr_codcms = curr_rec.get(RILORE_CODCMS);
|
||||
if (curr_codcms.blank())
|
||||
return !_ignore;
|
||||
FOR_EACH_ARRAY_ROW(_list, r, riga)
|
||||
{
|
||||
const char* lista_codcms = riga->get(0);
|
||||
@ -134,6 +137,8 @@ const TVariant describe_cms(const TString& chiave1)
|
||||
{
|
||||
if (chiave1 == OTHER_ACTIVITIES)
|
||||
return TR("Altre attivita'");
|
||||
if (chiave1.blank())
|
||||
return TR("Ore di assenza");
|
||||
return cache().get(LF_COMMESSE, chiave1, COMMESSE_DESCRIZ);
|
||||
}
|
||||
|
||||
@ -175,6 +180,10 @@ void ci_fill_recset_from_ass(TAssoc_array& ass, TReport& rep)
|
||||
real totale_c = record_ass.get(32);
|
||||
totale_c.round(2);
|
||||
recset->set("TotCons", totale_c);
|
||||
// Totale ore lavorat (lo prende dall'assoc_array e lo butta nel recset appena arrotondato)
|
||||
real totale_o = record_ass.get(33);
|
||||
totale_o.round(2);
|
||||
recset->set("TotOreLav", totale_o);
|
||||
|
||||
//per avere una distribuzione di ore giornaliera che faccia ritornare il totale consuntivo..
|
||||
//..indipendentemente da arrotondamenti e troncamenti, si ricorre al mitico TGeneric_distrib...
|
||||
|
@ -307,6 +307,9 @@ protected:
|
||||
void azzera_riga(TSheet_field& sheet);
|
||||
void azzera_tutto(TSheet_field& sheet);
|
||||
void registra();
|
||||
const TString& add_int_to_tab_filter(const short intval, int len, const char* empty_value= "");
|
||||
const TString& add_field_to_tab_filter(const short id, int len, const char* empty_value = "");
|
||||
void riempi_sheet_disp();
|
||||
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
@ -504,6 +507,111 @@ void TRilevamento_cons_msk::update_column(short sid, bool full)
|
||||
sf.set_column_width(sid, 0);
|
||||
}
|
||||
|
||||
const TString& TRilevamento_cons_msk::add_int_to_tab_filter(const short intval, int len, const char* empty_value)
|
||||
{
|
||||
TString& val = get_tmp_string();
|
||||
|
||||
val << intval;
|
||||
if (val == empty_value)
|
||||
val.fill('?', len);
|
||||
else
|
||||
val.right_just(len, '0');
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
const TString& TRilevamento_cons_msk::add_field_to_tab_filter(const short id, int len, const char* empty_value)
|
||||
{
|
||||
if (len <= 0)
|
||||
len = field(id).size();
|
||||
|
||||
TString& val = get_tmp_string();
|
||||
|
||||
val = get(id);
|
||||
if (val == empty_value)
|
||||
val.fill('?', len);
|
||||
else
|
||||
val.left_just(len);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void TRilevamento_cons_msk::riempi_sheet_disp()
|
||||
{
|
||||
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
TMask & sm = sheet.sheet_mask();
|
||||
|
||||
TString filtro;
|
||||
char risoatt = get(F_RISOATT)[0];
|
||||
|
||||
_curr_giorno = _giorno;
|
||||
_curr_mese = _mese;
|
||||
_curr_anno = _anno;;
|
||||
|
||||
//guardo il tipo risorsa / attrezzatura che sto ricercando (se Tutti setto a '?')
|
||||
filtro << add_field_to_tab_filter(F_RISOATT, 1, "T");
|
||||
//leggo il codice corretto a seconda del tipo selezionato (se vuoto setto a 16 caratteri '?')
|
||||
switch(risoatt)
|
||||
{
|
||||
case 'T': filtro << "????????????????"; break;
|
||||
case 'R': filtro << add_field_to_tab_filter(F_CODRIS,16); break;
|
||||
case 'A': filtro << add_field_to_tab_filter(F_CODATT, 16); break;
|
||||
default : break;
|
||||
}
|
||||
|
||||
filtro << add_int_to_tab_filter(_anno, 4);
|
||||
filtro << add_int_to_tab_filter(_mese, 2);
|
||||
filtro << add_int_to_tab_filter(_giorno, 2);
|
||||
|
||||
//leggo il tipo ora (se vuoto setto a '??')
|
||||
filtro << add_field_to_tab_filter(F_TPORA, 2);
|
||||
|
||||
TString query;
|
||||
|
||||
query << "USE &DRA\n";
|
||||
if (filtro.full())
|
||||
query << "SELECT CODTAB?=\"" << filtro << "\"";
|
||||
if(risoatt != 'T')
|
||||
{
|
||||
query << "\n"
|
||||
<< "FROM CODTAB=" << risoatt << "\n"
|
||||
<< "TO CODTAB=" << risoatt << "\n";
|
||||
}
|
||||
|
||||
TISAM_recordset dra(query);
|
||||
|
||||
//riempio lo sheet con i dati che soddisfano il filtro preparato prima
|
||||
for(bool ok = dra.move_first(); ok; ok = dra.move_next())
|
||||
{
|
||||
TDisp_risoatt disp(dra.cursor()->curr());
|
||||
TString drakey(disp.chiave());
|
||||
TToken_string& riga = sheet.row(-1);
|
||||
const TString4 tipo = drakey.left(1);
|
||||
riga.add(tipo, sheet.cid2index(S_RISOATT));
|
||||
TString16 cod = drakey.mid(1, 16);
|
||||
cod.trim();
|
||||
switch(tipo[0])
|
||||
{
|
||||
case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
|
||||
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
|
||||
default : break;
|
||||
}
|
||||
riga.add(drakey.right(2), sheet.cid2index(S_TPORA));
|
||||
riga.add(disp.ore_cons().string(), sheet.cid2index(S_QTAORE));
|
||||
|
||||
const int r = sheet.items() - 1;
|
||||
|
||||
sheet.check_row(r);
|
||||
}
|
||||
if (sheet.items() > 0)
|
||||
{
|
||||
sheet.select(0);
|
||||
update_disp();
|
||||
update_prev();
|
||||
}
|
||||
sheet.force_update();
|
||||
}
|
||||
void TRilevamento_cons_msk::riempi_sheet(char tipo)
|
||||
{
|
||||
|
||||
@ -558,6 +666,12 @@ void TRilevamento_cons_msk::riempi_sheet(char tipo)
|
||||
sm.enable(id + 50, codfase.blank());
|
||||
}
|
||||
//preparo la query
|
||||
if (tipo == 'L')
|
||||
{
|
||||
riempi_sheet_disp();
|
||||
sheet.force_update();
|
||||
return ;
|
||||
}
|
||||
|
||||
query << "USE " << LF_RILORE << " KEY 2\n" ;
|
||||
if (risoatt.full())
|
||||
@ -593,38 +707,57 @@ void TRilevamento_cons_msk::riempi_sheet(char tipo)
|
||||
query << "SELECT " << select << "\n";
|
||||
|
||||
const TString & dett = get(F_INTERVALLO);
|
||||
TString from;
|
||||
from << RILORE_TIPO << "=\"" << tipo << "\"";
|
||||
TString to(from);
|
||||
TDate da(botime);
|
||||
TDate a(eotime);
|
||||
|
||||
if (_anno > 0)
|
||||
{
|
||||
da.set_day(1);
|
||||
da.set_month(1);
|
||||
da.set_year(_anno);
|
||||
a.set_year(_anno);
|
||||
if (dett != "A")
|
||||
{
|
||||
da.set_month(_mese);
|
||||
a.set_month(_mese);
|
||||
if (dett != "M" && tipo == 'C')
|
||||
{
|
||||
da.set_day(_giorno);
|
||||
a.set_day(_giorno);
|
||||
}
|
||||
else
|
||||
a.set_end_month();
|
||||
}
|
||||
}
|
||||
from << " " << RILORE_DADATA << "=" << da.string() << " ";
|
||||
to << " " << RILORE_DADATA << "=" << a.string() << " ";
|
||||
|
||||
query << "FROM " << from << "\n"
|
||||
<< "TO " << to;
|
||||
|
||||
TRecnotype items = 0L;
|
||||
int anno = _anno;
|
||||
int mese = _mese;
|
||||
TISAM_recordset def(query);
|
||||
int loops = tipo == 'D' ? 12 : 1;
|
||||
|
||||
while(items == 0L && loops > 0)
|
||||
{
|
||||
TString from;
|
||||
TString q = query;
|
||||
from << RILORE_TIPO << "=\"" << tipo << "\"";
|
||||
TString to(from);
|
||||
TDate da(botime);
|
||||
TDate a(eotime);
|
||||
|
||||
if (_anno > 0)
|
||||
{
|
||||
da.set_day(1);
|
||||
da.set_month(1);
|
||||
da.set_year(anno);
|
||||
a.set_year(anno);
|
||||
if (dett != "A")
|
||||
{
|
||||
da.set_month(mese);
|
||||
a.set_month(mese);
|
||||
if (dett != "M" && tipo == 'C')
|
||||
{
|
||||
da.set_day(_giorno);
|
||||
a.set_day(_giorno);
|
||||
}
|
||||
else
|
||||
a.set_end_month();
|
||||
}
|
||||
}
|
||||
from << " " << RILORE_DADATA << "=" << da.string() << " ";
|
||||
to << " " << RILORE_DADATA << "=" << a.string() << " ";
|
||||
|
||||
q << "FROM " << from << "\n"
|
||||
<< "TO " << to;
|
||||
|
||||
def.set(q);
|
||||
def.requery();
|
||||
items = def.items();
|
||||
mese--;
|
||||
if (mese < 1)
|
||||
{
|
||||
mese = 12;
|
||||
anno--;
|
||||
}
|
||||
loops--;
|
||||
}
|
||||
|
||||
_curr_giorno = _giorno;
|
||||
_curr_mese = _mese;
|
||||
@ -668,6 +801,9 @@ void TRilevamento_cons_msk::riempi_sheet(char tipo)
|
||||
update_disp();
|
||||
update_prev();
|
||||
}
|
||||
else
|
||||
if (tipo == 'C' && ini_get_bool(CONFIG_DITTA, "ci", "DefaultAuto"))
|
||||
return riempi_sheet(ini_get_bool(CONFIG_DITTA, "ci", "DefaultDisp") ? 'L' : 'D');
|
||||
sheet.force_update();
|
||||
}
|
||||
|
||||
@ -700,7 +836,7 @@ void TRilevamento_cons_msk::update_tree()
|
||||
|
||||
tree->update_content(content_query(), get(F_INTERVALLO), _mese, _anno);
|
||||
cal.force_update();
|
||||
cal.tree()->goto_root();
|
||||
// cal.tree()->goto_root();
|
||||
}
|
||||
|
||||
void TRilevamento_cons_msk::update_disp()
|
||||
@ -1256,7 +1392,7 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
|
||||
{
|
||||
case DLG_DEFAULT:
|
||||
if(e == fe_button)
|
||||
riempi_sheet('D');
|
||||
riempi_sheet(ini_get_bool(CONFIG_DITTA, "ci", "DefaultDisp") ? 'L' : 'D');
|
||||
break;
|
||||
case DLG_CERCA:
|
||||
if(e == fe_button)
|
||||
|
@ -391,6 +391,9 @@ class TConsuntivazione_msk : public TAutomask
|
||||
bool _sheet_dirty, _recontabilize, _locked;
|
||||
|
||||
protected:
|
||||
const TString& add_int_to_tab_filter(const short intval, int len, const char* empty_value = "");
|
||||
const TString& add_field_to_tab_filter(const short id, int len, const char* empty_value = "");
|
||||
void TConsuntivazione_msk::riempi_sheet_disp(const TDate & da_data, const TDate & a_data);
|
||||
virtual TMask_field* parse_field(TScanner& scanner);
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
@ -419,6 +422,109 @@ public:
|
||||
TConsuntivazione_msk();
|
||||
};
|
||||
|
||||
const TString& TConsuntivazione_msk::add_int_to_tab_filter(const short intval, int len, const char* empty_value)
|
||||
{
|
||||
TString& val = get_tmp_string();
|
||||
|
||||
val << intval;
|
||||
if (val == empty_value)
|
||||
val.fill('?', len);
|
||||
else
|
||||
val.right_just(len, '0');
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
const TString& TConsuntivazione_msk::add_field_to_tab_filter(const short id, int len, const char* empty_value)
|
||||
{
|
||||
if (len <= 0)
|
||||
len = field(id).size();
|
||||
|
||||
TString& val = get_tmp_string();
|
||||
|
||||
val = get(id);
|
||||
if (val == empty_value)
|
||||
val.fill('?', len);
|
||||
else
|
||||
val.left_just(len);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void TConsuntivazione_msk::riempi_sheet_disp(const TDate & da_data, const TDate & a_data)
|
||||
{
|
||||
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
TMask & sm = sheet.sheet_mask();
|
||||
|
||||
TString filtro;
|
||||
char risoatt = get(F_RISOATT)[0];
|
||||
const int items = a_data - da_data + 1;
|
||||
TProgind p(items, TR("Caricamento disponibilità"));
|
||||
|
||||
for (TDate d = da_data; d <= a_data; ++d)
|
||||
{
|
||||
if (!p.addstatus(1L))
|
||||
break;
|
||||
//guardo il tipo risorsa / attrezzatura che sto ricercando (se Tutti setto a '?')
|
||||
filtro = add_field_to_tab_filter(F_RISOATT, 1, "T");
|
||||
//leggo il codice corretto a seconda del tipo selezionato (se vuoto setto a 16 caratteri '?')
|
||||
switch(risoatt)
|
||||
{
|
||||
case 'T': filtro << "????????????????"; break;
|
||||
case 'R': filtro << add_field_to_tab_filter(F_CODRIS,16); break;
|
||||
case 'A': filtro << add_field_to_tab_filter(F_CODATT, 16); break;
|
||||
default : break;
|
||||
}
|
||||
|
||||
filtro << add_int_to_tab_filter(d.year(), 4);
|
||||
filtro << add_int_to_tab_filter(d.month(), 2);
|
||||
filtro << add_int_to_tab_filter(d.day(), 2);
|
||||
|
||||
//leggo il tipo ora (se vuoto setto a '??')
|
||||
filtro << add_field_to_tab_filter(F_TPORA, 2);
|
||||
|
||||
TString query;
|
||||
|
||||
query << "USE &DRA\n";
|
||||
if (filtro.full())
|
||||
query << "SELECT CODTAB?=\"" << filtro << "\"";
|
||||
if(risoatt != 'T')
|
||||
{
|
||||
query << "\n"
|
||||
<< "FROM CODTAB=" << risoatt << "\n"
|
||||
<< "TO CODTAB=" << risoatt << "\n";
|
||||
}
|
||||
|
||||
TISAM_recordset dra(query);
|
||||
|
||||
//riempio lo sheet con i dati che soddisfano il filtro preparato prima
|
||||
for(bool ok = dra.move_first(); ok; ok = dra.move_next())
|
||||
{
|
||||
TDisp_risoatt disp(dra.cursor()->curr());
|
||||
TString drakey(disp.chiave());
|
||||
TToken_string& riga = sheet.row(-1);
|
||||
const TString4 tipo = drakey.left(1);
|
||||
riga.add(tipo, sheet.cid2index(S_RISOATT));
|
||||
TString16 cod = drakey.mid(1, 16);
|
||||
cod.trim();
|
||||
switch(tipo[0])
|
||||
{
|
||||
case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
|
||||
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
|
||||
default : break;
|
||||
}
|
||||
riga.add(drakey.right(2), sheet.cid2index(S_TPORA));
|
||||
riga.add(disp.ore_cons().string(), sheet.cid2index(S_QTAORE));
|
||||
|
||||
const int r = sheet.items() - 1;
|
||||
|
||||
sheet.check_row(r);
|
||||
}
|
||||
}
|
||||
sheet.force_update();
|
||||
}
|
||||
|
||||
TMask_field* TConsuntivazione_msk::parse_field(TScanner& scanner)
|
||||
{
|
||||
if (scanner.key() == "CA")
|
||||
@ -665,6 +771,12 @@ bool TConsuntivazione_msk::load_sheet()
|
||||
|
||||
enable(DLG_SAVEREC, _sheet_dirty = false);
|
||||
_locked = false;
|
||||
if (sheet.empty())
|
||||
{
|
||||
if (ini_get_bool(CONFIG_DITTA, "ci", "DefaultAuto") &&
|
||||
ini_get_bool(CONFIG_DITTA, "ci", "DefaultDisp"))
|
||||
riempi_sheet_disp(da_data, a_data);
|
||||
}
|
||||
return !sheet.empty();
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <recarray.h>
|
||||
#include <relation.h>
|
||||
#include <reputils.h>
|
||||
#include <sheet.h>
|
||||
#include <textset.h>
|
||||
#include <sheet.h>
|
||||
#include <toolfld.h>
|
||||
|
@ -562,16 +562,16 @@ const TString& TRisoatt_key::tpora() const
|
||||
|
||||
TRisoatt_key::TRisoatt_key(const char* codlist, const char risoatt, const char* codice, const int anno, const char* mese, const char* giorno, const char* tpora)
|
||||
{
|
||||
TString4 lis = codlist; lis.left_just(4);
|
||||
TString16 lis = codlist; lis.left_just(4);
|
||||
TString16 cod = codice; cod.left_just(16);
|
||||
cut(0) << lis << risoatt << cod << anno << mese << giorno << tpora;
|
||||
zap() << lis << risoatt << cod << anno << mese << giorno << tpora;
|
||||
}
|
||||
|
||||
TRisoatt_key::TRisoatt_key(const char* codlist, const char risoatt, const char* codice, const TDate & date, const char* tpora)
|
||||
{
|
||||
TString4 lis = codlist; lis.lpad(4, '0');
|
||||
TString16 lis = codlist; lis.lpad(4, '0');
|
||||
TString16 cod = codice; cod.left_just(16);
|
||||
cut(0) << lis << risoatt << cod << date.string(ANSI) << tpora;
|
||||
zap() << lis << risoatt << cod << date.string(ANSI) << tpora;
|
||||
}
|
||||
|
||||
TRisoatt_key::TRisoatt_key(const char* roakey)
|
||||
|
@ -2,4 +2,5 @@
|
||||
#define F_COD_ORA 101
|
||||
#define F_DES_ORA 102
|
||||
#define F_COD_EST 103
|
||||
#define F_TIP_ORA 104
|
||||
#define F_COD_ASS 104
|
||||
#define F_TIP_ORA 105
|
||||
|
@ -53,10 +53,21 @@ END
|
||||
STRING F_COD_EST 10
|
||||
BEGIN
|
||||
PROMPT 2 5 "Codice esterno "
|
||||
FLAGS ""
|
||||
FLAGS "U"
|
||||
FIELD S1
|
||||
END
|
||||
|
||||
LIST F_COD_ASS 2 13
|
||||
BEGIN
|
||||
PROMPT 2 7 "Codice assenza "
|
||||
FLAGS "U"
|
||||
ITEM " | "
|
||||
ITEM "SL|Malattia"
|
||||
ITEM "AH|Ferie"
|
||||
ITEM "OA|Altre assenze"
|
||||
FIELD S2
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
ENDMASK
|
||||
|
@ -23,5 +23,6 @@
|
||||
#define RILORE_CIG "CIG"
|
||||
#define RILORE_RIMBORSO "RIMBORSO"
|
||||
#define RILORE_NOTE "NOTE"
|
||||
#define RILORE_INVPAG "INVPAG"
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user