Corretta gestione fine mese
git-svn-id: svn://10.65.10.50/trunk@2633 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0d181233fe
commit
894fe49825
@ -1316,14 +1316,13 @@ long TPrimanota_application::calcola_m770(int tipo_coll, real& spese, real& comp
|
|||||||
if (tipo_coll == 6)
|
if (tipo_coll == 6)
|
||||||
{
|
{
|
||||||
TString_array& rcg = cgs().rows_array();
|
TString_array& rcg = cgs().rows_array();
|
||||||
|
TToken_string& row = rcg.row(0);
|
||||||
TImporto imp;
|
TImporto imp;
|
||||||
|
imp = row;
|
||||||
for (int i = rcg.items()-1; i >= 0; i--)
|
if (imp.sezione() == 'D')
|
||||||
{
|
compenso = imp.valore();
|
||||||
TToken_string& row = rcg.row(i);
|
else
|
||||||
imp = row;
|
compenso = ZERO;
|
||||||
compenso += imp.valore();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return forn;
|
return forn;
|
||||||
|
@ -676,7 +676,11 @@ void TPrimanota_application::set_pagamento(const char* c, const char* d)
|
|||||||
_pag = NULL;
|
_pag = NULL;
|
||||||
}
|
}
|
||||||
if (c != NULL || d != NULL)
|
if (c != NULL || d != NULL)
|
||||||
|
{
|
||||||
|
if (!TDate::isdate(d))
|
||||||
|
d = "";
|
||||||
_pag = new TPagamento(c, d);
|
_pag = new TPagamento(c, d);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPrimanota_application::set_totale_pagamento(bool update)
|
void TPrimanota_application::set_totale_pagamento(bool update)
|
||||||
@ -950,8 +954,8 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
|||||||
{
|
{
|
||||||
sposta = (oldgame->conto().sottoconto() == newgame->conto().sottoconto());
|
sposta = (oldgame->conto().sottoconto() == newgame->conto().sottoconto());
|
||||||
if (sposta)
|
if (sposta)
|
||||||
sposta = yesno_box("Si desidera spostare la fattura ed i "
|
sposta = yesno_box("Si desidera spostare la fattura e gli eventuali\n"
|
||||||
"pagamenti relativi nella nuova partita?");
|
"pagamenti relativi nella partita %d %s?", anno, (const char*)numpart);
|
||||||
}
|
}
|
||||||
if (sposta)
|
if (sposta)
|
||||||
{
|
{
|
||||||
|
@ -1364,17 +1364,9 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
if (edit)
|
if (edit)
|
||||||
{
|
{
|
||||||
if (game.ok())
|
gm.set(P_ANNO, anno);
|
||||||
{
|
gm.set(P_NUMERO, numero);
|
||||||
gm.set(P_ANNO, anno);
|
gm._changed = TRUE;
|
||||||
gm.set(P_NUMERO, numero);
|
|
||||||
gm._changed = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!game.is_on_file())
|
|
||||||
app().partite().destroy(game);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Aggiorna sheet partite: aggiunge la nuova partita e lo riordina
|
// Aggiorna sheet partite: aggiunge la nuova partita e lo riordina
|
||||||
gm.fill_partite();
|
gm.fill_partite();
|
||||||
|
@ -63,9 +63,10 @@ void TPagamento::set_inizio(const TDate& d, bool rispetta_date)
|
|||||||
if (_inscad == 'F' && _mcomm && _inizio.day() == 31)
|
if (_inscad == 'F' && _mcomm && _inizio.day() == 31)
|
||||||
_inizio.set_day(30);
|
_inizio.set_day(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
TDate data(rispetta_date ? data_rata(0) : _inizio); // Aggiusta data iniziale con i gironi prima rata
|
TDate data(rispetta_date ? data_rata(0) : _inizio); // Aggiusta data iniziale con i gironi prima rata
|
||||||
next_scad(data, scad_rata(0), _mcomm, 0);
|
if (!rispetta_date)
|
||||||
|
next_scad(data, scad_rata(0), _mcomm, 0);
|
||||||
|
|
||||||
bool dummy;
|
bool dummy;
|
||||||
recalc_rate(0, FALSE, NULL, NULL, data.string(), NULL, NULL, _rdiff, _mcomm, dummy);
|
recalc_rate(0, FALSE, NULL, NULL, data.string(), NULL, NULL, _rdiff, _mcomm, dummy);
|
||||||
@ -430,33 +431,39 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
|
|||||||
|
|
||||||
void TPagamento::next_scad(TDate& d, int scad, bool mcomm, int rata)
|
void TPagamento::next_scad(TDate& d, int scad, bool mcomm, int rata)
|
||||||
{
|
{
|
||||||
if (mcomm && !(rata == 0 && (scad % 30) != 0))
|
if (mcomm && (rata > 0 || (scad % 30) == 0))
|
||||||
{
|
{
|
||||||
int nm = scad / 30;
|
int nm = scad / 30;
|
||||||
int ny = nm / 12;
|
int ny = nm / 12;
|
||||||
nm %= 12;
|
nm %= 12;
|
||||||
|
|
||||||
int newm = d.month() + nm;
|
int newm = d.month() + nm;
|
||||||
if (newm > 12) { newm -= 12; ny++; }
|
if (newm > 12) { newm -= 12; ny++; }
|
||||||
|
|
||||||
bool last = d.is_end_month() && inizio_scadenza() == 'M';
|
// bool last = d.is_end_month() && inizio_scadenza() == 'M';
|
||||||
|
const bool last = inizio_scadenza() == 'M' || _datadoc.is_end_month();
|
||||||
|
|
||||||
int dy = d.day();
|
int dy = d.day();
|
||||||
|
|
||||||
// la palla del febbraio & c.
|
// la palla del febbraio & c. ???
|
||||||
if (rata > 1)
|
if (rata > 1)
|
||||||
{
|
{
|
||||||
TDate oldd(data_rata(rata-2));
|
const TDate oldd(data_rata(rata-2));
|
||||||
if (oldd.day() > dy) dy = oldd.day();
|
if (oldd.day() > dy) dy = oldd.day();
|
||||||
}
|
}
|
||||||
|
|
||||||
d.set_day(1); // il giorno 1 ce l'hanno tutti
|
d.set_day(1); // il giorno 1 ce l'hanno tutti
|
||||||
d.set_month(newm);
|
d.set_month(newm);
|
||||||
d.set_year(d.year()+ny);
|
d.set_year(d.year()+ny);
|
||||||
|
/*
|
||||||
d.set_end_month();
|
d.set_end_month();
|
||||||
if (!last && dy < d.day())
|
if (!last && dy < d.day())
|
||||||
d.set_day(dy);
|
d.set_day(dy);
|
||||||
|
*/
|
||||||
|
if (last)
|
||||||
|
d.set_end_month();
|
||||||
|
else
|
||||||
|
d.set_day(dy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1472,10 +1479,7 @@ bool TPagamento::read(TTable* t, TTable* r)
|
|||||||
|
|
||||||
// aggiusta _inizio secondo INSCAD; vedi mese commerciale etc.
|
// aggiusta _inizio secondo INSCAD; vedi mese commerciale etc.
|
||||||
if (_inscad == 'M')
|
if (_inscad == 'M')
|
||||||
{
|
_inizio.set_end_month();
|
||||||
if (_mcomm) _inizio.set_day(_inizio.month() == 2 ? 28 : 30);
|
|
||||||
else _inizio.set_end_month();
|
|
||||||
}
|
|
||||||
else if (_inscad == 'F' && _mcomm && _inizio.day() == 31)
|
else if (_inscad == 'F' && _mcomm && _inizio.day() == 31)
|
||||||
_inizio.set_day(30);
|
_inizio.set_day(30);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user