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)
|
||||
{
|
||||
TString_array& rcg = cgs().rows_array();
|
||||
TToken_string& row = rcg.row(0);
|
||||
TImporto imp;
|
||||
|
||||
for (int i = rcg.items()-1; i >= 0; i--)
|
||||
{
|
||||
TToken_string& row = rcg.row(i);
|
||||
imp = row;
|
||||
compenso += imp.valore();
|
||||
}
|
||||
imp = row;
|
||||
if (imp.sezione() == 'D')
|
||||
compenso = imp.valore();
|
||||
else
|
||||
compenso = ZERO;
|
||||
}
|
||||
|
||||
return forn;
|
||||
|
@ -676,7 +676,11 @@ void TPrimanota_application::set_pagamento(const char* c, const char* d)
|
||||
_pag = NULL;
|
||||
}
|
||||
if (c != NULL || d != NULL)
|
||||
{
|
||||
if (!TDate::isdate(d))
|
||||
d = "";
|
||||
_pag = new TPagamento(c, d);
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
if (sposta)
|
||||
sposta = yesno_box("Si desidera spostare la fattura ed i "
|
||||
"pagamenti relativi nella nuova partita?");
|
||||
sposta = yesno_box("Si desidera spostare la fattura e gli eventuali\n"
|
||||
"pagamenti relativi nella partita %d %s?", anno, (const char*)numpart);
|
||||
}
|
||||
if (sposta)
|
||||
{
|
||||
|
@ -1364,17 +1364,9 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
||||
|
||||
if (edit)
|
||||
{
|
||||
if (game.ok())
|
||||
{
|
||||
gm.set(P_ANNO, anno);
|
||||
gm.set(P_NUMERO, numero);
|
||||
gm._changed = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!game.is_on_file())
|
||||
app().partite().destroy(game);
|
||||
}
|
||||
gm.set(P_ANNO, anno);
|
||||
gm.set(P_NUMERO, numero);
|
||||
gm._changed = TRUE;
|
||||
|
||||
// Aggiorna sheet partite: aggiunge la nuova partita e lo riordina
|
||||
gm.fill_partite();
|
||||
|
@ -65,7 +65,8 @@ void TPagamento::set_inizio(const TDate& d, bool rispetta_date)
|
||||
}
|
||||
|
||||
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;
|
||||
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)
|
||||
{
|
||||
if (mcomm && !(rata == 0 && (scad % 30) != 0))
|
||||
if (mcomm && (rata > 0 || (scad % 30) == 0))
|
||||
{
|
||||
int nm = scad / 30;
|
||||
int ny = nm / 12;
|
||||
nm %= 12;
|
||||
int nm = scad / 30;
|
||||
int ny = nm / 12;
|
||||
nm %= 12;
|
||||
|
||||
int newm = d.month() + nm;
|
||||
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();
|
||||
|
||||
// la palla del febbraio & c.
|
||||
// la palla del febbraio & c. ???
|
||||
if (rata > 1)
|
||||
{
|
||||
TDate oldd(data_rata(rata-2));
|
||||
const TDate oldd(data_rata(rata-2));
|
||||
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_year(d.year()+ny);
|
||||
|
||||
/*
|
||||
d.set_end_month();
|
||||
if (!last && dy < d.day())
|
||||
d.set_day(dy);
|
||||
*/
|
||||
if (last)
|
||||
d.set_end_month();
|
||||
else
|
||||
d.set_day(dy);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1472,10 +1479,7 @@ bool TPagamento::read(TTable* t, TTable* r)
|
||||
|
||||
// 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();
|
||||
}
|
||||
_inizio.set_end_month();
|
||||
else if (_inscad == 'F' && _mcomm && _inizio.day() == 31)
|
||||
_inizio.set_day(30);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user