Patch level : 10.982
Files correlati : ci1exe Ricompilazione Demo : [ ] Commento : Imlementate le stampa della rilevazione senza ripartizione git-svn-id: svn://10.65.10.50/branches/R_10_00@22017 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
869692a6fd
commit
362458365c
@ -69,6 +69,7 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, TReport& re
|
||||
{
|
||||
const int tipo_ordinamento = get_int(F_ORDINAMENTO);
|
||||
const char tipo_stampa = get(F_TIPOSTAMPA)[0];
|
||||
const bool split = get_bool(F_RIPARTISCI);
|
||||
|
||||
//creare un assoc_array con chiave TToken_string cms-sede-fase(1) o sede-cms-fase(2) in base ai parametri..
|
||||
//..indicati sulla maschera
|
||||
@ -120,7 +121,7 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, TReport& re
|
||||
if (ini_cms > dataini)
|
||||
dataini = ini_cms;
|
||||
//se la commessa fosse tutta nel futuro o nel passato -> lascia perdere
|
||||
const long giorni_lavorativi = ci_calcola_giorni_lavorativi(dataini, datafine);
|
||||
const long giorni_lavorativi = split ? ci_calcola_giorni_lavorativi(dataini, datafine) : 1L;
|
||||
if (giorni_lavorativi <= 0)
|
||||
continue;
|
||||
|
||||
@ -129,10 +130,12 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, TReport& re
|
||||
TDate ini_lav, fine_lav;
|
||||
const int anno = get_int(F_ANNO);
|
||||
const int mese = tipo_stampa == 'M' ? get_int(F_MESE) : 0;
|
||||
const long giorni_lavorativi_cms = ci_calcola_giorni_lavorativi_cms(anno, mese, ini_cms, fine_cms, dataini, datafine, ini_lav, fine_lav);
|
||||
long giorni_lavorativi_cms = ci_calcola_giorni_lavorativi_cms(anno, mese, ini_cms, fine_cms, dataini, datafine, ini_lav, fine_lav);
|
||||
|
||||
//adesso deve riproporzionare il monte ore sul record sul mese selezionato (fa tutto il lavoro se ci sono giorni..
|
||||
//..lavorativi sulla commessa in questione)
|
||||
if (giorni_lavorativi_cms == 0 && !split && i == 1)
|
||||
giorni_lavorativi_cms = giorni_lavorativi;
|
||||
if (giorni_lavorativi_cms > 0)
|
||||
{
|
||||
const real tot_ore = rilore_recset.get(RILORE_QTAORE).as_real();
|
||||
@ -169,20 +172,33 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, TReport& re
|
||||
}
|
||||
else //'C'onsuntivo (aggiorna tutte le caselle dei giorni lavorativi)
|
||||
{
|
||||
const real ore_al_giorno = tot_ore / giorni_lavorativi;
|
||||
for (TDate data = ini_lav; data <= fine_lav; ++data)
|
||||
{
|
||||
if (giorni_lavorativi == 1 || ci_is_ferial_day(data))
|
||||
{
|
||||
const int index = tipo_stampa == 'M' ? data.day() : data.month();
|
||||
real prev = record->get(index);
|
||||
prev += ore_al_giorno;
|
||||
record->add(prev.string(), index);
|
||||
real tot = record->get(32);
|
||||
tot += ore_al_giorno;
|
||||
record->add(tot.string(), 32);
|
||||
}
|
||||
}
|
||||
if (split)
|
||||
{
|
||||
const real ore_al_giorno = tot_ore / giorni_lavorativi;
|
||||
for (TDate data = ini_lav; data <= fine_lav; ++data)
|
||||
{
|
||||
if (giorni_lavorativi == 1 || ci_is_ferial_day(data))
|
||||
{
|
||||
const int index = tipo_stampa == 'M' ? data.day() : data.month();
|
||||
real prev = record->get(index);
|
||||
prev += ore_al_giorno;
|
||||
record->add(prev.string(), index);
|
||||
real tot = record->get(32);
|
||||
tot += ore_al_giorno;
|
||||
record->add(tot.string(), 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int index = tipo_stampa == 'M' ? rilore_recset.get(RILORE_GIORNO).as_int() : rilore_recset.get(RILORE_MESE).as_int();
|
||||
real prev = record->get(index);
|
||||
prev += tot_ore;
|
||||
record->add(prev.string(), index);
|
||||
real tot = record->get(32);
|
||||
tot += tot_ore;
|
||||
record->add(tot.string(), 32);
|
||||
}
|
||||
}
|
||||
} //if (giorni_lavorativi_cms > 0)..
|
||||
} //for (bool ok = rilore_recset.move_first();..
|
||||
@ -194,7 +210,7 @@ void TRil_ore_ris_mask::elabora_risorsa(const TString& curr_risorsa, TReport& re
|
||||
//finita l'elaborazione che ha riempito l'assoc_array, asegna il medesimo ad un..
|
||||
//..csv_recordset e poi sbatte quest'ultimo (ordinato) nel report
|
||||
//Il tutto nel magico metodo che segue!
|
||||
ci_fill_recset_from_ass(righe, rep);
|
||||
ci_fill_recset_from_ass(righe, rep, split);
|
||||
//campo a mano per fare scattare la mask2report()
|
||||
rep.recordset()->set_var("#CODRIS", curr_risorsa, true);
|
||||
|
||||
|
@ -12,4 +12,5 @@
|
||||
#define F_ANNO 211
|
||||
#define F_MESE 212
|
||||
#define F_ORDINAMENTO 213
|
||||
#define F_SHOW_FASI 214
|
||||
#define F_SHOW_FASI 214
|
||||
#define F_RIPARTISCI 215
|
@ -32,6 +32,7 @@ BEGIN
|
||||
OUTPUT F_DA_CODRIS CODTAB
|
||||
OUTPUT F_DA_DESRIS S0
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "U"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
@ -108,6 +109,7 @@ BEGIN
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_A_CODATT CODTAB
|
||||
OUTPUT F_A_DESATT S0
|
||||
FLAGS "U"
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 2
|
||||
END
|
||||
@ -169,6 +171,11 @@ BEGIN
|
||||
FIELD #ORDINAMENTO
|
||||
END
|
||||
|
||||
BOOLEAN F_RIPARTISCI
|
||||
BEGIN
|
||||
PROMPT 1 19 "Ripartisci il consuntivo sul periodo"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
@ -99,7 +99,7 @@ long ci_calcola_giorni_lavorativi_cms(const int anno, const int mese, const TDat
|
||||
|
||||
|
||||
|
||||
void ci_fill_recset_from_ass(TAssoc_array& ass, TReport& rep)
|
||||
void ci_fill_recset_from_ass(TAssoc_array& ass, TReport& rep, bool split)
|
||||
{
|
||||
//deve informarsi sul tipo di report che è in uso
|
||||
const TString& rep_class = rep.get_class();
|
||||
@ -141,20 +141,35 @@ void ci_fill_recset_from_ass(TAssoc_array& ass, TReport& rep)
|
||||
|
||||
//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, 1);
|
||||
for (int j = 1; j <= 31; j++)
|
||||
{
|
||||
real ore = record_ass.get(j);
|
||||
esso.add(ore);
|
||||
}
|
||||
// ridistribuzione delle ore per giorno nel recordset
|
||||
TString4 name;
|
||||
for (int k = 1; k <= 31; k++)
|
||||
{
|
||||
const real ore_giorno = esso.get();
|
||||
name.format("G%02d", k);
|
||||
recset->set(name, ore_giorno);
|
||||
}
|
||||
if (split)
|
||||
{
|
||||
TGeneric_distrib esso(totale_c, 1);
|
||||
for (int j = 1; j <= 31; j++)
|
||||
{
|
||||
real ore = record_ass.get(j);
|
||||
esso.add(ore);
|
||||
}
|
||||
// ridistribuzione delle ore per giorno nel recordset
|
||||
TString4 name;
|
||||
|
||||
for (int k = 1; k <= 31; k++)
|
||||
{
|
||||
const real ore_giorno = esso.get();
|
||||
name.format("G%02d", k);
|
||||
recset->set(name, ore_giorno);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TString4 name;
|
||||
|
||||
for (int k = 1; k <= 31; k++)
|
||||
{
|
||||
real ore = record_ass.get(k);
|
||||
name.format("G%02d", k);
|
||||
recset->set(name, ore);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//2) chiavi delle righe
|
||||
|
@ -25,7 +25,7 @@ long ci_calcola_giorni_lavorativi(const TDate& dataini, const TDate& datafine);
|
||||
long ci_calcola_giorni_lavorativi_cms(const int anno, const int mese, const TDate& ini_cms, const TDate& fine_cms,
|
||||
const TDate& dataini, const TDate& datafine, TDate& inizio_lav, TDate& fine_lav);
|
||||
|
||||
void ci_fill_recset_from_ass(TAssoc_array& ass, TReport& rep);
|
||||
void ci_fill_recset_from_ass(TAssoc_array& ass, TReport& rep, bool split);
|
||||
|
||||
void format_report_month(const int anno, const int mese, TReport& rep);
|
||||
|
||||
|
@ -69,6 +69,7 @@ bool TRil_ore_cms_mask::elabora_commessa(const TString& curr_commessa, TReport&
|
||||
const TVariant tipo_cms_cdc = get(F_CMSOCDC);
|
||||
const bool per_commessa = tipo_cms_cdc.as_string() == "C";
|
||||
const char tipo_stampa = get(F_TIPOSTAMPA)[0];
|
||||
const bool split = get_bool(F_RIPARTISCI);
|
||||
|
||||
//date del periodo
|
||||
const int anno = get_int(F_ANNO);
|
||||
@ -105,8 +106,8 @@ bool TRil_ore_cms_mask::elabora_commessa(const TString& curr_commessa, TReport&
|
||||
const int durata_cms = ca_durata_commessa(rec_cms, ini_cms, fine_cms);
|
||||
|
||||
//se la commessa non "interseca" il periodo selezionato -> finisce qui
|
||||
if (fine_cms < inizio || ini_cms > fine)
|
||||
return false;
|
||||
// if (split && (fine_cms < inizio || ini_cms > fine))
|
||||
// return false;
|
||||
|
||||
query << "USE RILORE KEY 5";
|
||||
query << "\nFROM TIPO=#TIPO CODCMS=#CODICE";
|
||||
@ -141,26 +142,25 @@ bool TRil_ore_cms_mask::elabora_commessa(const TString& curr_commessa, TReport&
|
||||
|
||||
//se esiste la commessa nel record e sta stampando per cdc, la commessa va tenuta in considerazione per..
|
||||
//..quanto riguarda l'intervallo di date
|
||||
if (!per_commessa)
|
||||
{
|
||||
const TString& commessa = rilore_recset.get(RILORE_CODCMS).as_string();
|
||||
const TRectype& rec_cms = cache().get(LF_COMMESSE, commessa);
|
||||
const int durata_cms = ca_durata_commessa(rec_cms, ini_cms, fine_cms);
|
||||
if (!per_commessa)
|
||||
{
|
||||
const TString& commessa = rilore_recset.get(RILORE_CODCMS).as_string();
|
||||
const TRectype& rec_cms = cache().get(LF_COMMESSE, commessa);
|
||||
const int durata_cms = ca_durata_commessa(rec_cms, ini_cms, fine_cms);
|
||||
//se la commessa non "interseca" il mese selezionato -> finisce qui
|
||||
// if (fine_cms < inizio || ini_cms > fine)
|
||||
// continue;
|
||||
}
|
||||
|
||||
//se la commessa non "interseca" il mese selezionato -> finisce qui
|
||||
if (fine_cms < inizio || ini_cms > fine)
|
||||
continue;
|
||||
}
|
||||
|
||||
//adatta le date alla commessa se quest'ultima è contenuta nell'intervallo (può essere più breve..
|
||||
//..dell'intervallo selezionato, oppure sovrapporsi solo parzialmente)
|
||||
//se sta stampando per cdc -> fine_cms e ini_cms sono vuoti se non c'è la cms e non fa la trimmatura
|
||||
if (fine_cms.ok() && fine_cms < datafine)
|
||||
datafine = fine_cms;
|
||||
if (ini_cms.ok() && ini_cms > dataini)
|
||||
dataini = ini_cms;
|
||||
//adatta le date alla commessa se quest'ultima è contenuta nell'intervallo (può essere più breve..
|
||||
//..dell'intervallo selezionato, oppure sovrapporsi solo parzialmente)
|
||||
//se sta stampando per cdc -> fine_cms e ini_cms sono vuoti se non c'è la cms e non fa la trimmatura
|
||||
if (fine_cms.ok() && fine_cms < datafine)
|
||||
datafine = fine_cms;
|
||||
if (ini_cms.ok() && ini_cms > dataini)
|
||||
dataini = ini_cms;
|
||||
//se la commessa fosse tutta nel futuro o nel passato -> lascia perdere
|
||||
const long giorni_lavorativi = ci_calcola_giorni_lavorativi(dataini, datafine);
|
||||
const long giorni_lavorativi = split ? ci_calcola_giorni_lavorativi(dataini, datafine) : 1L;
|
||||
if (giorni_lavorativi <= 0)
|
||||
continue;
|
||||
|
||||
@ -176,6 +176,8 @@ bool TRil_ore_cms_mask::elabora_commessa(const TString& curr_commessa, TReport&
|
||||
fine_lav = fine;
|
||||
}
|
||||
|
||||
if (giorni_lavorativi_cms == 0 && !split && i == 1)
|
||||
giorni_lavorativi_cms = giorni_lavorativi;
|
||||
if (giorni_lavorativi_cms > 0)
|
||||
{
|
||||
const real tot_ore = rilore_recset.get(RILORE_QTAORE).as_real();
|
||||
@ -199,20 +201,33 @@ bool TRil_ore_cms_mask::elabora_commessa(const TString& curr_commessa, TReport&
|
||||
}
|
||||
else //'C'onsuntivo (aggiorna tutte le caselle dei giorni lavorativi)
|
||||
{
|
||||
const real ore_al_giorno = tot_ore / giorni_lavorativi;
|
||||
for (TDate data = ini_lav; data <= fine_lav; ++data)
|
||||
{
|
||||
if (giorni_lavorativi == 1 || ci_is_ferial_day(data))
|
||||
{
|
||||
const int index = tipo_stampa == 'M' ? data.day() : data.month();
|
||||
real prev = record->get(index);
|
||||
prev += ore_al_giorno;
|
||||
record->add(prev.string(), index);
|
||||
real tot = record->get(32);
|
||||
tot += ore_al_giorno;
|
||||
record->add(tot.string(), 32);
|
||||
}
|
||||
}
|
||||
if (split)
|
||||
{
|
||||
const real ore_al_giorno = tot_ore / giorni_lavorativi;
|
||||
for (TDate data = ini_lav; data <= fine_lav; ++data)
|
||||
{
|
||||
if (giorni_lavorativi == 1 || ci_is_ferial_day(data))
|
||||
{
|
||||
const int index = tipo_stampa == 'M' ? data.day() : data.month();
|
||||
real prev = record->get(index);
|
||||
prev += ore_al_giorno;
|
||||
record->add(prev.string(), index);
|
||||
real tot = record->get(32);
|
||||
tot += ore_al_giorno;
|
||||
record->add(tot.string(), 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int index = tipo_stampa == 'M' ? rilore_recset.get(RILORE_GIORNO).as_int() : rilore_recset.get(RILORE_MESE).as_int();
|
||||
real prev = record->get(index);
|
||||
prev += tot_ore;
|
||||
record->add(prev.string(), index);
|
||||
real tot = record->get(32);
|
||||
tot += tot_ore;
|
||||
record->add(tot.string(), 32);
|
||||
}
|
||||
} //if(i==0)..
|
||||
|
||||
} //if (giorni_lavorativi_cms > 0)..
|
||||
@ -223,7 +238,7 @@ bool TRil_ore_cms_mask::elabora_commessa(const TString& curr_commessa, TReport&
|
||||
rep.mask2report(*this);
|
||||
//finita l'elaborazione che ha riempito l'assoc_array, asegna il medesimo ad un..
|
||||
//..csv_recordset e poi sbatte quest'ultimo (ordinato) nel report
|
||||
ci_fill_recset_from_ass(righe, rep);
|
||||
ci_fill_recset_from_ass(righe, rep, split);
|
||||
//campo a mano per fare scattare la mask2report()
|
||||
rep.recordset()->set_var("#CODCMS", curr_commessa, true);
|
||||
|
||||
|
@ -11,3 +11,4 @@
|
||||
#define F_TIPOSTAMPA 210
|
||||
#define F_ANNO 211
|
||||
#define F_MESE 212
|
||||
#define F_RIPARTISCI 213
|
@ -153,6 +153,13 @@ BEGIN
|
||||
FIELD #MESE
|
||||
END
|
||||
|
||||
BOOLEAN F_RIPARTISCI
|
||||
BEGIN
|
||||
PROMPT 1 8 "Ripartisci il consuntivo sul periodo"
|
||||
END
|
||||
|
||||
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user