Gestione ore straordinarie in due scaglioni

git-svn-id: svn://10.65.10.50/branches/R_10_00@23021 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2014-12-10 16:09:21 +00:00
parent ec024943ae
commit 53c83b8c87
4 changed files with 78 additions and 1 deletions

View File

@ -9,7 +9,7 @@ int main(int argc, char** argv)
case 0 : ci0100(argc,argv); break; // gestione tabelle cont. ind.
case 1 : ci0200(argc,argv); break; // gestione risorse / attrezzature
case 2 : ci0300(argc,argv); break; // parametri configurazione Contabilità Industriale
case 3 : ci0400(argc,argv); break; // immssione documenti
case 3 : ci0400(argc,argv); break; // immissione documenti
case 4 : ci0500(argc,argv); break; // gestione disponibilità risorse / attrezzature
case 5 : ci0600(argc,argv); break; // gestione default risorse / attrezzature
case 6 : ci0700(argc,argv); break; // creazione do

View File

@ -9,6 +9,8 @@ int main(int argc, char** argv)
case 1: ci1200(argc,argv); break; // stampa
case 2: ci1300(argc,argv); break; // rilevazione ore mensili per risorsa - attrezzatura
case 3: ci1400(argc,argv); break; // rilevazione ore mensili per cms - cdc
case 4: ci1500(argc,argv); break; // movimenti interni
case 5: ci1600(argc,argv); break; // interrogazione movimenti interni
default: break;
}
return 0;

View File

@ -4,6 +4,8 @@
int ci1200(int argc, char* argv[]); // stampe
int ci1300(int argc, char* argv[]); // rilevazione ore mensili per risorsa - attrezzatura
int ci1400(int argc, char* argv[]); // rilevazione ore mensili per cms - cdc
int ci1500(int argc, char* argv[]); // elaborazione movimenti interni
int ci1600(int argc, char* argv[]); // interrogazione movimenti interni
#endif // __CI1_H

View File

@ -396,6 +396,7 @@ protected:
protected:
bool cerca_disponibilita(int riga) const;
int cerca_straordinario(int riga, const TString& tipo_ora) const;
real proponi_costo(TMask& msk) const;
void riempi_nuova_riga(int r);
bool add_ril_to_doc(TRectype& rilore, TDocumento& doc, TLog_report& log) const;
@ -1225,6 +1226,37 @@ bool TConsuntivazione_msk::cerca_disponibilita(int riga) const
return false;
}
int TConsuntivazione_msk::cerca_straordinario(int riga, const TString& tipo_ora) const
{
TSheet_field& s = sfield(F_SHEET);
const int col_att = s.cid2index(S_CODATT);
const int col_ora = s.cid2index(S_TPORA);
const int col_cms = s.cid2index(S_CDC1);
const TToken_string& r = s.row(riga);
TString80 cod_rss; r.get(col_att, cod_rss); cod_rss.trim();
TString80 cod_cms; r.get(col_cms, cod_cms); cod_cms.trim();
for (int i = riga-2; i <= riga+2; i++) if (i != riga)
{
if (i >= 0 && i < s.items())
{
const TToken_string& ri = s.row(i);
TString80 ca; ri.get(col_att, ca); ca.trim();
TString4 to; ri.get(col_ora, to); to.trim();
TString80 cc; ri.get(col_cms, cc); cc.trim();
if (ca == cod_rss && cc == cod_cms && to == tipo_ora)
return i;
}
}
const int nr = s.insert(riga+1);
TToken_string& rowd = s.row(nr);
rowd = r;
rowd.add(tipo_ora, col_ora);
return nr;
}
bool TConsuntivazione_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
@ -1367,6 +1399,47 @@ bool TConsuntivazione_msk::on_field_event(TOperable_field& o, TField_event e, lo
sheet.force_update(nr);
}
}
} else
if (tipo == 'R' && cod.full() && ora.full())
{
const int col = sheet.cid2index(S_QTAORE);
const TRectype& rss = cache().get("RSS", cod);
int ore = row.get_int(col);
const int dopo_ora1 = rss.get_int("R5");
const TString4 ora1 = rss.get("S9");
const real prezzo1 = rss.get("R6");
const int dopo_ora2 = rss.get_int("R7");
const TString4 ora2 = rss.get("S10");
const real prezzo2 = rss.get("R8");
int ore1 = 0, ore2 = 0;
if (ore > dopo_ora2 && ora2.full()) // ultraordinario
{
ore2 = ore - dopo_ora2;
ore -= ore2;
}
if (ore > dopo_ora1 && ora1.full()) // straordinario
{
ore1 = ore - dopo_ora1;
ore = dopo_ora1;
}
if (ore1 > 0) // c'è straordinario?
{
const int prz = sheet.cid2index(S_COSTO);
row.add(ore, col); // Reimposta ore ordinarie
const int r1 = cerca_straordinario(jolly, ora1);
sheet.row(r1).add(ore1, col); // Ore straordinarie
sheet.row(r1).add(prezzo1.string(0, 2), prz);
if (ore2 > 0) // Ore ultraordianrie
{
const int r2 = cerca_straordinario(r1, ora2);
sheet.row(r2).add(ore2, col);
sheet.row(r2).add(prezzo2.string(0, 2), prz);
}
sheet.force_update();
}
}
}
break;