Mixed gabriellings

git-svn-id: svn://10.65.10.50/trunk@2144 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1995-11-14 10:27:10 +00:00
parent f8ec43a066
commit 7e4865ef5a
6 changed files with 53 additions and 20 deletions

View File

@ -557,7 +557,7 @@ void TPrimanota_application::init_insert_mode(TMask& m)
void TPrimanota_application::init_modify_mode(TMask& m)
{
init_mask(m);
init_mask(m);
calcola_saldo(); // Verifica eventuali sbilanci contabili
}

View File

@ -1579,7 +1579,7 @@ bool TPrimanota_application::doc_handler(TMask_field& f, KEY key)
m.set(F_ANNORIF, dd.year()); // copia data documento
// TBI modifica scadenze pagamento
if (app().pagamento() != NULL)
if (app().pagamento() != NULL && !m.edit_mode())
app().recalc_scadenze(dd);
}

View File

@ -205,7 +205,7 @@ protected:
TPagamento* pagamento() { /* CHECK(_pag, "Pagamento nullo"); */ return _pag; }
void set_pagamento(const char* c, const char* d);
void reset_pagamento();
void reset_pagamento(TMask& m);
void set_scadenze(TMask& m);
bool read_scadenze(TMask& m);
void write_scadenze(const TMask& m);

View File

@ -166,7 +166,8 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
if (key == K_TAB && f.focusdirty() && m.is_running() && app().is_saldaconto())
if (key == K_TAB && f.focusdirty() && m.is_running() &&
app().is_saldaconto() && !f.mask().edit_mode())
{
const TString16 dt(m.get(F_DATADOC));
app().set_pagamento(f.get(), dt);
@ -199,7 +200,7 @@ bool TPrimanota_application::reset_handler(TMask_field& f, KEY key)
if (key == K_SPACE && m.is_running() && app().is_saldaconto())
{
app().reset_pagamento();
app().reset_pagamento(f.mask());
app().set_scadenze(m);
}
return TRUE;
@ -258,11 +259,34 @@ bool TPrimanota_application::codcab_handler(TMask_field& f, KEY key)
return TRUE;
}
void TPrimanota_application::reset_pagamento()
{
void TPrimanota_application::reset_pagamento(TMask& m)
{
// se in modifica, rilegge totali e date dalla maschera; altrimenti
// rilegge il pagamento da disco
if (_pag != NULL)
{
_pag->read();
/* if (!m.edit_mode())*/ _pag->read();
/*
else
{
const real spese(0.0);
real imponibile, imposta;
const real cambio(m.get(S_CAMBIO));
if (cambio.is_zero())
{
imponibile = real(m.get(F_IMPONIBILI));
imposta = real(m.get(F_IMPOSTE));
}
else
{
_pag->set_cambio(cambio);
imponibile = real(m.get(S_TOTDOCVAL));
imposta = ZERO;
}
_pag->set_inizio(m.get_date(F_DATADOC));
_pag->set_total(imponibile, imposta, spese);
}
*/
_pag->set_rate_auto();
}
}
@ -314,7 +338,7 @@ void TPrimanota_application::set_scadenze(TMask& m)
m.set(FS_NAMEPAG, pag.name());
m.set(FS_TIPOPR, pag.desc_tpr());
m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : "");
m.set(FS_RECALC, "X", TRUE);
m.set(FS_RECALC, m.edit_mode() ? "" : "X", TRUE);
m.set(FS_NRATE, pag.n_rate());
}
@ -441,7 +465,7 @@ bool TPrimanota_application::read_scadenze(TMask& m)
m.set(FS_NAMEPAG, pag.name());
m.set(FS_TIPOPR, pag.desc_tpr());
m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : "");
m.set(FS_RECALC, "X", TRUE);
m.set(FS_RECALC, m.edit_mode() ? "" : "X", TRUE);
m.set(FS_NRATE, pag.n_rate());
} //else
}

View File

@ -601,7 +601,7 @@ bool Visliq_app::vis_one(int m)
msk.field(F_RIMBORSO).set(rimborso.string());
if (rettifica.sign() < 0)
{
msk.field(F_RETTIFICA).set(abs(rettifica).string());
msk.field(F_RETTIFICA).set(real(abs(rettifica)).string());
msk.field(F_DEBCRE).set("C");
}
else if (rettifica.sign() > 0)
@ -918,7 +918,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver
}
else if (rett.sign() < 0)
{
vsw->replace(lrettc, abs(rett).string("###.###.###.###"), 58);
vsw->replace(lrettc, real(abs(rett)).string("###.###.###.###"), 58);
vsw->replace(lrettd, " ", 75);
}
else
@ -930,7 +930,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver
if (risul.sign() < 0)
{
ln.overwrite("CREDITO ATTUALE", 23);
ln.overwrite(abs(risul).string("###.###.###.###"), 58);
ln.overwrite(real(abs(risul)).string("###.###.###.###"), 58);
}
else if (risul.sign() > 0)
{
@ -1029,10 +1029,10 @@ void Visliq_app::recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field
int sr0 = (_lim->get_real("R0")).sign();
int sr5 = (_lim->get_real("R5")).sign();
t.add(abs(_lim->get_real("R0")).string(),1);
t.add(real(abs(_lim->get_real("R0"))).string(),1);
t.add(sr0 == 0 ? "" : (sr0 > 0 ? "D" : "C"), 2);
t.add((_lim->get_real("R1")).string(),3);
t.add(abs(_lim->get_real("R5")).string(),4);
t.add(real(abs(_lim->get_real("R5"))).string(),4);
t.add(sr5 == 0 ? "" : (sr5 > 0 ? "D" : "C"),5);
sl->force_update(row);
@ -1131,14 +1131,14 @@ void Visliq_app::read_general(TMask& m)
else tt = &(sh.row(i-1));
tt->add(itoname(i),0);
tt->add(abs(_lim->get_real("R0")).string(),1);
tt->add(real(abs(_lim->get_real("R0"))).string(),1);
int sr0 = (_lim->get_real("R0")).sign();
int sr5 = (_lim->get_real("R5")).sign();
tt->add(sr0 == 0 ? "" : (sr0 > 0 ? "D" : "C"),2);
tt->add(_lim->get_real("R1").string(),3);
tt->add(abs(_lim->get_real("R5")).string(),4);
tt->add(real(abs(_lim->get_real("R5"))).string(),4);
tt->add(sr5 == 0 ? "" : (sr5 > 0 ? "D" : "C"),5);
sh.row(i-1) = (*tt);
@ -1504,10 +1504,10 @@ if (was_lim)
int sr0 = (_lim->get_real("R0")).sign();
int sr5 = (_lim->get_real("R5")).sign();
tt_ln.add(abs(_lim->get_real("R0")).string(),1);
tt_ln.add(real(abs(_lim->get_real("R0"))).string(),1);
tt_ln.add(sr0 == 0 ? "" : (sr0 > 0 ? "D" : "C"), 2);
tt_ln.add((_lim->get_real("R1")).string(),3);
tt_ln.add(abs(_lim->get_real("R5")).string(),4);
tt_ln.add(real(abs(_lim->get_real("R5"))).string(),4);
tt_ln.add(sr5 == 0 ? "" : (sr5 > 0 ? "D" : "C"),5);
// sh.force_update(row);

View File

@ -48,7 +48,16 @@ const char* TPagamento::_rata_sfield(int n, int f) const
void TPagamento::set_inizio(const TDate& d)
{
bool dio;
_inizio = d;
_inizio = d;
// aggiusta _inizio secondo INSCAD; vedi mese commerciale etc.
if (_inscad == 'M')
{
if (_mcomm) _inizio.set_day(_inizio.month() == 2 ? 28 : 30);
else _inizio.set_end_month();
}
else if (_inscad == 'F' && _mcomm && _inizio.day() == 31)
_inizio.set_day(30);
recalc_rate(0, FALSE, NULL, d.string(), NULL, NULL, _rdiff, _mcomm, dio);
}