Correzioni da verificare da parte di ferdinando

git-svn-id: svn://10.65.10.50/trunk@2457 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-01-15 18:56:45 +00:00
parent 485e33f8c6
commit 0d6378dacc

View File

@ -37,10 +37,10 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
TString16 banca; TString16 banca;
bool doit = TRUE, m_imp = FALSE, m_perc = FALSE, m_pag = FALSE; bool doit = TRUE, m_imp = FALSE, m_perc = FALSE, m_pag = FALSE;
bool m_scad = FALSE, m_tipo = FALSE, m_ulc = FALSE, mod = FALSE; bool m_scad = FALSE, m_tipo = FALSE, m_ulc = FALSE, mod = FALSE, m_implit = FALSE;
word ahiahi = P_OK; word ahiahi = P_OK;
TString news(10), newi(15), newp(15), newt(1), newu(1); TString news(10), newi(15), newp(15), newil(15), newt(1), newu(1);
bool recalc = msk->get_bool(FS_RECALC); bool recalc = msk->get_bool(FS_RECALC);
bool mcomm = msk->get_bool(FS_MCOMM); bool mcomm = msk->get_bool(FS_MCOMM);
@ -62,13 +62,18 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
newp = ns.get(3); // Percentuale newp = ns.get(3); // Percentuale
newt = ns.get(4); // Tipo pagamento newt = ns.get(4); // Tipo pagamento
newu = ns.get(5); // Ulteriore classificazione newu = ns.get(5); // Ulteriore classificazione
if (in_valuta)
{
newil = ns.get(1);
m_implit = real(newil) != real(ts.get(1));
}
// qui viene il bello, si fa per dire // qui viene il bello, si fa per dire
if (news != ts.get(0)) // modificata data scadenza if (news != ts.get(0)) // modificata data scadenza
mod = m_scad = TRUE; mod = m_scad = TRUE;
if (newp != ts.get(3)) // modificata percentuale if (real(newp) != real(ts.get(3))) // modificata percentuale
mod = m_perc = TRUE; mod = m_perc = TRUE;
if (newi != ts.get(impos)) // modificato importo if (real(newi) != real(ts.get(impos))) // modificato importo
{ {
// se si modifica la percentuale l'importo non viene cagato // se si modifica la percentuale l'importo non viene cagato
if ((recalc && !m_perc) || (!recalc)) if ((recalc && !m_perc) || (!recalc))
@ -82,8 +87,8 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
else if (m_tipo) { else if (m_tipo) {
// forza reset di ulc se si e' modificato il tipo rata // forza reset di ulc se si e' modificato il tipo rata
m_ulc = TRUE; m_ulc = TRUE;
newu = ""; newu = "";
} }
break; break;
case K_DEL: case K_DEL:
@ -137,7 +142,7 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
// see if rdiff changed // see if rdiff changed
msk->set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2"); msk->set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
msk->set(FS_NRATE, pag.n_rate()); msk->set(FS_NRATE, pag.n_rate());
} }
if (!recalc) if (!recalc)
{ {
ahiahi = P_OK; ahiahi = P_OK;
@ -166,7 +171,14 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
} }
if (mod) if (mod)
rws.row(r) = ps.row(r); rws.row(r) = ps.row(r);
}
if (in_valuta && m_implit)
{
TToken_string& trw = pag.rata(r);
trw.add(newil, 7);
} }
if (ahiahi) // any error? Rimetti le righe com'erano prima if (ahiahi) // any error? Rimetti le righe com'erano prima
{ {
if (recalc) if (recalc)
@ -209,11 +221,12 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
ok = error_box(s); ok = error_box(s);
} }
const bool in_valuta = m.get(SK_VALUTA).not_empty();
real imp;
if (key == K_ENTER && m.edit_mode()) if (key == K_ENTER && m.edit_mode())
{ {
const bool in_valuta = m.get(SK_VALUTA).not_empty();
const real tot = m.get(in_valuta ? SK_TOTDOCVAL : F_TOTALE); const real tot = m.get(in_valuta ? SK_TOTDOCVAL : F_TOTALE);
real imp;
for (int r = pag.n_rate()-1; r >= 0; r--) for (int r = pag.n_rate()-1; r >= 0; r--)
imp += pag.tpay_rata(r); imp += pag.tpay_rata(r);
if (imp != tot) if (imp != tot)
@ -232,20 +245,20 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
ok = FALSE; // Permette di guardare il risultato prima di registrare ok = FALSE; // Permette di guardare il risultato prima di registrare
} }
} }
}
if (in_valuta) if (key == K_ENTER && in_valuta)
{ {
const real totlit = m.get(F_TOTALE); const real totlit = m.get(F_TOTALE);
imp = ZERO; imp = ZERO;
for (int r = pag.n_rate()-1; r >= 0; r--) for (int r = pag.n_rate()-1; r >= 0; r--)
imp += pag.tlit_rata(r); imp += pag.tlit_rata(r);
if (imp != totlit) if (imp != totlit)
{ {
const TString is(imp.string(".")); const TString is(imp.string("."));
const TString ts(totlit.string(".")); const TString ts(totlit.string("."));
warning_box("Il totale in lire delle rate e' %s mentre\n" ok = error_box("Il totale in lire delle rate e' %s mentre\n"
"il totale del documento e' %s."); "il totale del documento e' %s.", (const char *)ts, (const char *)is);
}
} }
} }
} }
@ -517,7 +530,7 @@ bool TPrimanota_application::ratalit_handler(TMask_field& f, KEY key)
TPagamento& pag = app().pagamento(); TPagamento& pag = app().pagamento();
if (pag.in_valuta()) if (pag.in_valuta())
{ {
TValuta v("", TDate(), pag.cambio()); TValuta v("VAL", TDate(), pag.cambio());
const real other(f.mask().get(103)); const real other(f.mask().get(103));
TString16 s(v.val2lit(other).string()); TString16 s(v.val2lit(other).string());
f.set(s); f.set(s);
@ -532,8 +545,8 @@ bool TPrimanota_application::rataval_handler(TMask_field& f, KEY key)
{ {
TPagamento& pag = app().pagamento(); TPagamento& pag = app().pagamento();
if (pag.in_valuta()) if (pag.in_valuta())
{ {
TValuta v("", TDate(), pag.cambio()); TValuta v("VAL", TDate(), pag.cambio());
const real other(f.mask().get(102)); const real other(f.mask().get(102));
TString16 s(v.lit2val(other).string()); TString16 s(v.lit2val(other).string());
f.set(s); f.set(s);