Handlers per ricalcolo importi in valuta/lire con F8 o vuotando il campo
git-svn-id: svn://10.65.10.50/trunk@2361 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
322eff2a09
commit
8c1abd1a43
@ -125,6 +125,8 @@ TMask* TPrimanota_application::load_mask(int n)
|
|||||||
m->set_handler(FS_VSCAB, codcab_handler);
|
m->set_handler(FS_VSCAB, codcab_handler);
|
||||||
|
|
||||||
TMask& sm = ps.sheet_mask();
|
TMask& sm = ps.sheet_mask();
|
||||||
|
sm.set_handler(102, ratalit_handler);
|
||||||
|
sm.set_handler(103, rataval_handler);
|
||||||
sm.set_handler(105, tipopag_handler);
|
sm.set_handler(105, tipopag_handler);
|
||||||
sm.set_handler(106, tipopag_handler);
|
sm.set_handler(106, tipopag_handler);
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,10 @@ class TPrimanota_application : public TRelation_application
|
|||||||
static bool codcab_handler(TMask_field& f, KEY key);
|
static bool codcab_handler(TMask_field& f, KEY key);
|
||||||
static bool tipopag_handler(TMask_field& f, KEY key);
|
static bool tipopag_handler(TMask_field& f, KEY key);
|
||||||
|
|
||||||
|
static bool ratalit_handler(TMask_field& f, KEY key);
|
||||||
|
static bool rataval_handler(TMask_field& f, KEY key);
|
||||||
|
|
||||||
|
|
||||||
static bool iva_notify(TSheet_field& s, int r, KEY key);
|
static bool iva_notify(TSheet_field& s, int r, KEY key);
|
||||||
static bool iva_handler(TMask_field& f, KEY key);
|
static bool iva_handler(TMask_field& f, KEY key);
|
||||||
static bool cg_notify(TSheet_field& s, int r, KEY key);
|
static bool cg_notify(TSheet_field& s, int r, KEY key);
|
||||||
|
@ -432,6 +432,38 @@ bool TPrimanota_application::codcab_handler(TMask_field& f, KEY key)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TPrimanota_application::ratalit_handler(TMask_field& f, KEY key)
|
||||||
|
{
|
||||||
|
if (key == K_F8 || (key == K_TAB && f.focusdirty() && f.get().empty()))
|
||||||
|
{
|
||||||
|
TPagamento& pag = app().pagamento();
|
||||||
|
if (pag.in_valuta())
|
||||||
|
{
|
||||||
|
TValuta v("", TDate(), pag.cambio());
|
||||||
|
const real other(f.mask().get(103));
|
||||||
|
TString16 s(v.val2lit(other).string());
|
||||||
|
f.set(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TPrimanota_application::rataval_handler(TMask_field& f, KEY key)
|
||||||
|
{
|
||||||
|
if (key == K_F8 || (key == K_TAB && f.focusdirty() && f.get().empty()))
|
||||||
|
{
|
||||||
|
TPagamento& pag = app().pagamento();
|
||||||
|
if (pag.in_valuta())
|
||||||
|
{
|
||||||
|
TValuta v("", TDate(), pag.cambio());
|
||||||
|
const real other(f.mask().get(102));
|
||||||
|
TString16 s(v.lit2val(other).string());
|
||||||
|
f.set(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void TPrimanota_application::reset_pagamento(TMask&)
|
void TPrimanota_application::reset_pagamento(TMask&)
|
||||||
{
|
{
|
||||||
TPagamento& pag = pagamento();
|
TPagamento& pag = pagamento();
|
||||||
|
@ -683,7 +683,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
|||||||
{
|
{
|
||||||
// calcola defaults per tipo pagamento e scadenza
|
// calcola defaults per tipo pagamento e scadenza
|
||||||
// nel caso di rate nuove
|
// nel caso di rate nuove
|
||||||
oldscad = scad_rata(1);
|
oldscad = scad_rata(srate.items() - 1);
|
||||||
if (_mcomm)
|
if (_mcomm)
|
||||||
{
|
{
|
||||||
int mesi = oldscad / 30;
|
int mesi = oldscad / 30;
|
||||||
@ -986,6 +986,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
|||||||
else if (_inited)
|
else if (_inited)
|
||||||
{
|
{
|
||||||
if (dd <= botime) dd = lastdate;
|
if (dd <= botime) dd = lastdate;
|
||||||
|
if (j > 0 && nscd == 0) nscd = oldscad;
|
||||||
next_scad(dd,nscd,mcomm,j);
|
next_scad(dd,nscd,mcomm,j);
|
||||||
}
|
}
|
||||||
else nscd = _int_rate;
|
else nscd = _int_rate;
|
||||||
|
@ -112,6 +112,7 @@ public:
|
|||||||
void set_round(int n) { _round = n; }
|
void set_round(int n) { _round = n; }
|
||||||
void set_cambio(const real& ex);
|
void set_cambio(const real& ex);
|
||||||
bool in_valuta() const { return _cambio != 1.0; }
|
bool in_valuta() const { return _cambio != 1.0; }
|
||||||
|
const real& cambio() const { return _cambio; }
|
||||||
|
|
||||||
// check consistency: returns word with errors flagged, 0 if ok
|
// check consistency: returns word with errors flagged, 0 if ok
|
||||||
word validate() const;
|
word validate() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user