Patch level : 10.0 patch 814

Files correlati     : ca0.exe
Ricompilazione Demo : [ ]
Commento

Aggiunto un totale da ripartire sula tabelle di ripartizione che, se compilato, serve per aggiungere una eventuale differenza all'ultima riga della ripartizione (rif. Habilita)


git-svn-id: svn://10.65.10.50/branches/R_10_00@20966 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2010-10-07 12:52:15 +00:00
parent b63a0c479a
commit 5321e12da8
3 changed files with 58 additions and 15 deletions

View File

@ -73,6 +73,10 @@ bool TRiparti_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
sm.show(101);
sm.enable(101);
sf.enable_column(0);
set(F_TOTRIP, CENTO);
disable(F_TOTRIP);
show(F_SOMMA);
show(F_DIFFERENZA);
}
break;
case 1: //peso economico della commessa (non viene specificato nulla, la ripartizione avviene in base ai saldi)
@ -81,6 +85,10 @@ bool TRiparti_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
sm.disable(101); //necessario per non avere 2 campi abilitati e nascosti nella stessa posizione (dà errore)
sm.hide(201);
sf.enable_column(0, false);
disable(F_TOTRIP);
hide(F_TOTRIP);
hide(F_SOMMA);
hide(F_DIFFERENZA);
}
break;
case 2: //parti
@ -89,6 +97,9 @@ bool TRiparti_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
sm.show(201);
sm.enable(201);
sf.enable_column(0);
enable(F_TOTRIP);
show(F_SOMMA);
show(F_DIFFERENZA);
}
break;
}
@ -97,15 +108,33 @@ bool TRiparti_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
}
if (e == fe_close && atoi(o.get()) == 0)
{
TSheet_field& sf = sfield(F_SHEET);
/* TSheet_field& sf = sfield(F_SHEET);
real tot;
FOR_EACH_SHEET_ROW(sf, i, row)
tot += real(row->get(0));
tot.round(2);
if (tot != CENTO)
return error_box(TR("Il totale delle percentuali di ripartizione deve essere 100"));
if (tot != CENTO) */
// if (get_real(F_SOMMA) != CENTO)
// return error_box(TR("Il totale delle percentuali di ripartizione deve essere 100"));
}
break;
case F_SHEET:
if (e == fe_init || (e == se_leave && o.dirty()))
{
TSheet_field& sf = sfield(F_SHEET);
real tot;
FOR_EACH_SHEET_ROW(sf, i, row)
tot += real(row->get(0));
const int t = atoi(get(F_TIPORIP));
tot.round(t == 0 ? 2 : 5);
set(F_SOMMA, tot);
real diff = get_real(F_TOTRIP);
if (diff != ZERO)
diff -= tot;
set(F_DIFFERENZA, diff);
}
break;
case F_GENFASI:
if (e == fe_init)
{
@ -375,7 +404,7 @@ void TRiparti_app::spezza_campo(const TString& str, TToken_string& row, int firs
void TRiparti_app::write_rows()
{
real diff = _msk->get_real(F_TOTRIP);
const bool has_tot = _msk->get_int(F_TIPORIP) == 2 &&diff != ZERO;
const bool has_tot = _msk->get_int(F_TIPORIP) != 1 && diff != ZERO;
TRectype* key = new TRectype(LF_RRIP);
const char tipo = _msk->get(F_TIPO)[0];
key->put("TIPO", tipo);
@ -404,12 +433,12 @@ void TRiparti_app::write_rows()
diff -= rec.get_real(RRIP_RIPARTO);
}
if (has_tot != ZERO)
if (yesno_box(FR("Il totale da ripartire differisce di %s\ndal totale delle righe devo aggiungere la differenza"), abs(diff).stringa()))
if (yesno_box(FR("Il totale da ripartire differisce di %s\ndal totale delle righe devo aggiungere la differenza all'ultima riga"), abs(diff).stringa()))
a[a.last_row()].add(RRIP_RIPARTO, diff);
else
{
const real newtot = _msk->get_real(F_TOTRIP) - diff;
_msk->set (F_TOTRIP, newtot);
TRectype & rec = a.row(-1, true);
rec.put(RRIP_RIPARTO, diff);
}
a.rewrite();

View File

@ -41,3 +41,5 @@
#define F_SHEET 151
#define F_GENFASI 152
#define F_TOTRIP 153
#define F_SOMMA 154
#define F_DIFFERENZA 155

View File

@ -191,12 +191,6 @@ BEGIN
GROUP 2
END
NUMBER F_TOTRIP 15 5
BEGIN
PROMPT 2 10 "Totale riparto "
FIELD TOTRIP
END
ENDPAGE
PAGE "Righe" -1 -1 78 22
@ -211,9 +205,27 @@ BEGIN
FIELD TIPORIP
END
NUMBER F_TOTRIP 15 5
BEGIN
PROMPT 2 3 "Totale "
FIELD TOTRIP
END
NUMBER F_SOMMA 15 5
BEGIN
PROMPT 26 3 "Somma "
FLAGS "D"
END
NUMBER F_DIFFERENZA 15 5
BEGIN
PROMPT 48 3 "Differenza "
FLAGS "D"
END
SPREADSHEET F_SHEET 80 -3
BEGIN
PROMPT 0 3 ""
PROMPT 0 4 ""
ITEM "Ripartiz.@15F"
ITEM "Cdc1"
ITEM "Cdc2"
@ -252,7 +264,7 @@ BEGIN
MESSAGE COPY,201
END
NUMBER 201 6
NUMBER 201 15 5
BEGIN
PROMPT 1 0 "Numero parti "
FLAGS "U"