Patch level : 12.0 1086

Files correlati     : ci1300ab.rep ci1300bb.rep ci1300a.rep ci1300a.msk ci1300b.rep ci1.exe

Commento        :

Aggiunti report per beneficiario alla stampa ore per risorsa/attrezzatura

aggiunto logo del beneficiario

sintassi da mettere nel prescript del campo immagine :
LOGO_BENEF
#THIS !

L'Id dell'immagine deve essere LOGO+<codice tipo lavoro>
This commit is contained in:
Alessandro Bonazzi 2021-10-10 22:07:22 +02:00
parent f09652c549
commit 8e4d68a734
6 changed files with 112 additions and 45 deletions

View File

@ -11,6 +11,7 @@
#include "../ca/cfcms.h"
#include "rilore.h"
#include "cilib.h"
#include "ci1350.h"
#include "ci1300a.h"
@ -34,7 +35,7 @@ protected:
public:
void set_codcf(long codcf) { _codcf = codcf; }
void set_codtpl(const char *cod) { _codtpl = cod; }
TRil_ore_ris_report(const TString & tipostampa);
TRil_ore_ris_report(bool mensile, bool beneficiario);
};
size_t TRil_ore_ris_report::get_usr_words(TString_array& words) const
@ -87,15 +88,15 @@ bool TRil_ore_ris_report::execute_usr_word(unsigned int opcode, TVariant_stack&
return ok;
}
TRil_ore_ris_report::TRil_ore_ris_report(const TString & tipostampa) : _codcf(0L)
TRil_ore_ris_report::TRil_ore_ris_report(bool mensile, bool beneficiario) : _codcf(0L)
{
TFilename report_name;
if (tipostampa[1] == 'M')
if (mensile)
report_name = "ci1300a";
else
report_name = "ci1300b";
if (tipostampa[0] == 'B')
if (beneficiario)
report_name << "b";
load(report_name);
set_recordset(new TRil_ore_recordset);
@ -105,14 +106,17 @@ TRil_ore_ris_report::TRil_ore_ris_report(const TString & tipostampa) : _codcf(0L
// Maschera
///////////////////////////////////////////////////////////
class TRil_ore_ris_mask : public TAutomask
class TRil_ore_ris_mask : public TSimpleAutomask
{
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
// virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
void elabora_risorsa(const TString& curr_risorsa, const int curr_mese, const bool ignore, TReport& rep) const;
const bool mensile() const { return get(F_TIPOSTAMPA)[1] == 'M';}
const bool per_beneficiario() const { return get(F_TIPOSTAMPA)[0] == 'B'; }
const TString & tipostampa() const { return get(F_TIPOSTAMPA); }
const bool mensile() const { return tipostampa() == "M";}
const bool per_beneficiario() const { return get_bool(F_BENEFICIARIO); }
const real proponi_costo(const char *codlist, const char * tipo, const char * codice, const char * tpora, int mese, int anno) const ;
public:
void elabora() const;
@ -121,19 +125,48 @@ public:
virtual ~TRil_ore_ris_mask() {}
};
TRil_ore_ris_mask::TRil_ore_ris_mask() : TAutomask("ci1300a")
TRil_ore_ris_mask::TRil_ore_ris_mask() : TSimpleAutomask("ci1300a")
{
}
bool TRil_ore_ris_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
/*bool TRil_ore_ris_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
return true;
}
*/
const real TRil_ore_ris_mask::proponi_costo(const char *codlist, const char * tipo, const char * codice, const char * tpora, int mese, int anno) const
{
real r;
const TDate dal(1, mese, anno);
TRisoatt_key chiave(codlist, tipo[0], codice, dal, tpora);
const TRectype & rec = cache().get("&ROA", chiave);
if (rec.empty())
{
if (chiave.cod().full() && chiave.tpora().full())
{
TModule_table tab("ROA");
tab.put("CODTAB", chiave);
const int err = tab.read();
if (err != _isemptyfile)
{
chiave.overwrite("????????", 21, 8);
if (err != _iseof)
tab.prev();
if (tab.get("CODTAB").match(chiave))
r = tab.get_real("R1");
}
}
}
else
r = rec.get_real("R1");
return r;
}
void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int curr_mese, const bool ignore, TReport& rep) const
{
const int tipo_ordinamento = get_int(F_ORDINAMENTO);
const TString4 tipo_stampa = get(F_TIPOSTAMPA);
const int anno = get_int(F_ANNO);
const int mese = mensile() ? curr_mese : 0;
const bool calc_ore_lav = rep.field("F1.98") != NULL;
@ -207,13 +240,13 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int c
for (bool ok = rilore_recset.move_first(); ok; ok = rilore_recset.move_next())
{
const TString80 codcosto = rilore_recset.get(RILORE_CODCOSTO).as_string();
TString80 codcms = rilore_recset.get(RILORE_CODCMS).as_string();
const TString16 codfase = rilore_recset.get(RILORE_CODFASE).as_string();
const TString80 codcosto = rilore_recset.get_string(RILORE_CODCOSTO);
TString80 codcms = rilore_recset.get_string(RILORE_CODCMS);
const TString16 codfase = rilore_recset.get_string(RILORE_CODFASE);
//date limite qta ore sul record del file LF_RILORE
TDate ini_rilore = rilore_recset.get(RILORE_DADATA).as_date();
TDate fine_rilore = rilore_recset.get(RILORE_ADATA).as_date();
TDate ini_rilore = rilore_recset.get_date(RILORE_DADATA);
TDate fine_rilore = rilore_recset.get_date(RILORE_ADATA);
//adatta le date alla commessa se quest'ultima è contenuta nell'intervallo (può essere più breve..
//..dell'intervallo selezionato, oppure sovrapporsi solo parzialmente)
@ -229,10 +262,10 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int c
if (giorni_lavorativi_rilore > 0)
{
const real tot_ore = rilore_recset.get(RILORE_QTAORE).as_real();
const real tot_ore = rilore_recset.get_real(RILORE_QTAORE);
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 tpora = rilore_recset.get_string(RILORE_TPORA);
const TString8 tpassenza = cache().get("&ORE", tpora, "S2");
//crea la chiave per l'assoc_array
@ -297,7 +330,7 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int c
{
if (giorni_lavorativi_rilore == 1 || ci_is_ferial_day(data))
{
const int index = tipo_stampa == 'M' ? data.day() : data.month();
const int index = mensile() ? data.day() : data.month();
real prev = record->get(index);
prev += ore_al_giorno;
record->add(prev.string(), index);
@ -305,6 +338,17 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, const int c
tot += ore_al_giorno;
record->add(tot.string(), 32);
real totcosto = record->get(34);
real costo = rilore_recset.get_real(RILORE_COSTO);
if (costo == ZERO)
costo = proponi_costo(rilore_recset.get_string(RILORE_CODLIST),
rilore_recset.get_string(RILORE_TIPORA),
rilore_recset.get_string(RILORE_CODICE),
tpora, data.month(), data.year());
totcosto += ore_al_giorno * costo;
record->add(totcosto.string(), 34);
int i = data - inizio_periodo + 1;
if (tpassenza.full())
{
@ -372,14 +416,13 @@ void TRil_ore_ris_mask::elabora() const
//book di stampa
TReport_book book;
//stampa mensile o annuale?
const TString4 tipostampa = get(F_TIPOSTAMPA);
TRil_ore_ris_report rep(tipostampa);
TRil_ore_ris_report rep(mensile(), per_beneficiario());
rep.set_codcf(get_long(F_CODFIN));
rep.set_codtpl(get(F_CODTPL));
int da_mese = 1;
int a_mese = 1;
if (tipostampa[1] == 'M')
if (mensile())
{
da_mese = get_int(F_DA_MESE);
a_mese = get_int(F_A_MESE);
@ -395,7 +438,7 @@ void TRil_ore_ris_mask::elabora() const
//giro su tutti i mesi; se stampa annuale o mese unico -> un giro solo
for (int m = da_mese; m <= a_mese; m++)
{
if (tipostampa[1] == 'M')
if (mensile())
format_report_month(get_int(F_ANNO), m, rep);
//query sulla tabella interessata (risorse o attrezzature)

View File

@ -20,6 +20,7 @@
#define F_CODFIN 219
#define F_RAGFIN 220
#define F_RIGHE 221
#define F_BENEFICIARIO 222
//campi riga sheet
#define S_CODCMS 101

View File

@ -131,21 +131,25 @@ BEGIN
PROMPT 1 6 "@bFiltri su anno / mese"
END
LISTBOX F_TIPOSTAMPA 25
LISTBOX F_TIPOSTAMPA 1 8
BEGIN
PROMPT 2 7 "Tipo di stampa "
ITEM "AM|Mensile"
MESSAGE SHOW,F_DA_MESE|SHOW,F_A_MESE|CLEAR,4@
ITEM "AA|Annuale"
MESSAGE HIDE,F_DA_MESE|HIDE,F_A_MESE|CLEAR,4@
ITEM "BM|Per Beneficiario Mensile"
MESSAGE SHOW,F_DA_MESE|SHOW,F_A_MESE|ENABLE,4@
ITEM "BA|Per Beneficiario Annuale"
MESSAGE HIDE,F_DA_MESE|HIDE,F_A_MESE|ENABLE,4@
ITEM "M|Mensile"
MESSAGE SHOW,F_DA_MESE|SHOW,F_A_MESE
ITEM "A|Annuale"
MESSAGE HIDE,F_DA_MESE|HIDE,F_A_MESE
FLAGS "Z"
FIELD #TIPOSTAMPA
END
BOOLEAN F_BENEFICIARIO
BEGIN
PROMPT 32 7 "Per Beneficiario"
MESSAGE FALSE CLEAR,4@
MESSAGE TRUE ENABLE,4@
FIELD #BENEFICIARIO
END
NUMBER F_ANNO 4
BEGIN
PROMPT 2 8 "Anno "

View File

@ -121,9 +121,23 @@
<field border="1" x="2" y="14" deactivated="" type="Testo" valign="center" hidden="" link="" dynamic_height="" shade_offset="" width="12" codval="" id="" pattern="2" hide_zero="" text=" MESE">
<font face="Arial" bold="1" size="8" />
</field>
<field border="1" x="14" y="14" deactivated="" type="Numero" valign="center" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="8" codval="" id="" pattern="2" hide_zero="" text="">
<field border="1" x="14" y="14" deactivated="" type="Array" valign="center" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="8" codval="" id="" pattern="2" hide_zero="" text="">
<font face="Arial" bold="1" size="8" />
<source>#MESE</source>
<list>
<li Value="Gennaio" Code="01" />
<li Value="Febbraio" Code="02" />
<li Value="Marzo" Code="03" />
<li Value="Aprile" Code="04" />
<li Value="Maggio" Code="05" />
<li Value="Giugno" Code="06" />
<li Value="Luglio" Code="07" />
<li Value="Agosto" Code="08" />
<li Value="Settembre" Code="09" />
<li Value="Ottobre" Code="10" />
<li Value="Novembre" Code="11" />
<li Value="Dicembre" Code="12" />
</list>
</field>
<field border="2" x="1" y="16" deactivated="" type="Linea" hidden="" link="" dynamic_height="" shade_offset="" width="166" codval="" height="0" id="" pattern="1" hide_zero="" text="" />
<field x="76" y="8.25" deactivated="" type="Stringa" hidden="1" link="" dynamic_height="" shade_offset="" width="7" codval="" id="90" pattern="2" hide_zero="" text="">
@ -150,8 +164,7 @@
#THIS !</prescript>
</field>
<field x="111" y="1" deactivated="" type="Immagine" hidden="" link="" dynamic_height="" shade_offset="" width="40" codval="" height="4" id="111" pattern="1" hide_zero="" text="">
<prescript description="H1.111 PRESCRIPT">LOGO
#THIS !</prescript>
<prescript description="H1.111 PRESCRIPT">LOGO #THIS !</prescript>
</field>
</section>
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Head" level="2" hidden="" page_break="" can_break="" pattern="1">
@ -182,8 +195,8 @@
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Body" level="" hidden="" page_break="" can_break="" pattern="1" />
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Body" level="1" hidden="" page_break="" can_break="" pattern="1">
<font face="Arial Narrow" size="7" />
<field border="1" x="43.5" deactivated="" type="Numero" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="6" codval="" id="" pattern="1" hide_zero="" text=".2">
<source>Costo</source>
<field border="1" x="43.5" deactivated="" type="Numero" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="6" codval="" id="" pattern="1" hide_zero="1" text=".2">
<source>TotCostoCons</source>
<prescript description="B1.0 PRESCRIPT">MESSAGE ADD,F1.99</prescript>
</field>
<field border="1" x="50" deactivated="" type="Numero" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="6" codval="" id="" pattern="1" hide_zero="" text=".2">

View File

@ -116,12 +116,10 @@
<font face="Arial" bold="1" size="8" />
</field>
<field x="3" y="1" deactivated="" type="Immagine" hidden="" link="" dynamic_height="" shade_offset="" width="80" codval="" height="4" id="110" pattern="1" hide_zero="" text="">
<prescript description="H1.110 PRESCRIPT">LOGO_BENEF
#THIS !</prescript>
<prescript description="H1.110 PRESCRIPT">LOGO_BENEF #THIS !</prescript>
</field>
<field x="82" y="1" deactivated="" type="Immagine" hidden="" link="" dynamic_height="" shade_offset="" width="40" codval="" height="4" id="111" pattern="1" hide_zero="" text="">
<prescript description="H1.111 PRESCRIPT">LOGO
#THIS !</prescript>
<prescript description="H1.111 PRESCRIPT">LOGO #THIS !</prescript>
</field>
</section>
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Head" level="2" hidden="" page_break="" can_break="" pattern="1">
@ -152,8 +150,8 @@
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Body" level="" hidden="" page_break="" can_break="" pattern="1" />
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Body" level="1" hidden="" page_break="" can_break="" pattern="1">
<font face="Arial Narrow" size="7" />
<field border="1" x="44" deactivated="" type="Numero" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="6" codval="" id="" pattern="1" hide_zero="" text=".2">
<source>Costo</source>
<field border="1" x="44" deactivated="" type="Numero" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="6" codval="" id="" pattern="1" hide_zero="1" text=".2">
<source>TotCostoCons</source>
<prescript description="B1.0 PRESCRIPT">MESSAGE ADD,F1.99</prescript>
</field>
<field border="1" x="50.5" deactivated="" type="Numero" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="6" codval="" id="" pattern="1" hide_zero="" text=".2">

View File

@ -25,7 +25,8 @@ 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);
create_field("TotOreLav", -1, 7, _realfld, false);
create_field("TotCostoCons", -1, 7, _realfld, false);
TString4 name;
for (int i = 1; i <= 31; i++)
@ -176,15 +177,22 @@ void ci_fill_recset_from_ass(TAssoc_array& ass, TReport& rep)
real totale_p = record_ass.get(0);
totale_p.round(2);
recset->set("TotPrev", totale_p);
// Totale consuntivo (lo prende dall'assoc_array e lo butta nel recset appena arrotondato)
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)
// 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);
// Totale costo consuntivo (lo prende dall'assoc_array e lo butta nel recset appena arrotondato)
real tot_costo = record_ass.get(34);
tot_costo.round(2);
recset->set("TotCostoCons", tot_costo);
//per avere una distribuzione di ore giornaliera che faccia ritornare il totale consuntivo..
//..indipendentemente da arrotondamenti e troncamenti, si ricorre al mitico TGeneric_distrib...
TGeneric_distrib esso(totale_c, 2);