Correzione chiusura partite e gestione spostamento righe
git-svn-id: svn://10.65.10.50/trunk@1921 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fea80fd094
commit
c120c129d0
@ -546,7 +546,7 @@ void TPrimanota_application::init_modify_mode(TMask& m)
|
|||||||
init_mask(m);
|
init_mask(m);
|
||||||
|
|
||||||
partite().destroy();
|
partite().destroy();
|
||||||
if (is_pagamento())
|
if (is_saldaconto())
|
||||||
{
|
{
|
||||||
const long numreg = m.get_long(F_NUMREG);
|
const long numreg = m.get_long(F_NUMREG);
|
||||||
partite().add_numreg(numreg);
|
partite().add_numreg(numreg);
|
||||||
@ -914,7 +914,7 @@ int TPrimanota_application::rewrite(const TMask& m)
|
|||||||
|
|
||||||
if (salvaconto)
|
if (salvaconto)
|
||||||
{
|
{
|
||||||
partite().update_reg(_rel->lfile().curr());
|
partite().update_reg(_rel->curr());
|
||||||
partite().rewrite();
|
partite().rewrite();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -467,16 +467,21 @@ real TPrimanota_application::calcola_saldo() const
|
|||||||
for (int i = 0; i < max; i++)
|
for (int i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
TToken_string& r = rows.row(i);
|
TToken_string& r = rows.row(i);
|
||||||
tdare += real(r.get(0));
|
const real dare(r.get(0));
|
||||||
tavere += real(r.get());
|
const real avere(r.get());
|
||||||
|
|
||||||
|
tdare += dare;
|
||||||
|
tavere += avere;
|
||||||
|
|
||||||
if (pag)
|
if (pag)
|
||||||
{
|
{
|
||||||
const char sez = tdare.is_zero() ? 'A' : 'D';
|
|
||||||
const TImporto importo(sez, sez == 'A' ? tavere : tdare);
|
|
||||||
const char tipo = row_type(r);
|
const char tipo = row_type(r);
|
||||||
if (strchr("ACGKP", tipo) != NULL)
|
if (strchr("ACGKP", tipo) != NULL)
|
||||||
|
{
|
||||||
|
const char sez = dare.is_zero() ? 'A' : 'D';
|
||||||
|
const TImporto importo(sez, sez == 'A' ? avere : dare);
|
||||||
saldaconto += importo;
|
saldaconto += importo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,8 +400,8 @@ bool TPrimanota_application::read_scadenze(TMask& m)
|
|||||||
m.disable(-2); // Disabilita fornitore
|
m.disable(-2); // Disabilita fornitore
|
||||||
m.disable(-3); // Disabilita cambio
|
m.disable(-3); // Disabilita cambio
|
||||||
m.disable(F_CODPAG); // Disabilita codice pagamento
|
m.disable(F_CODPAG); // Disabilita codice pagamento
|
||||||
m.disable(F_ANNORIF); // Disabilita anno partita
|
// m.disable(F_ANNORIF); // Disabilita anno partita
|
||||||
m.disable(F_NUMRIF); // Disabilita numero partita
|
// m.disable(F_NUMRIF); // Disabilita numero partita
|
||||||
m.disable(FS_RESET); // Disabilita tasto di reset
|
m.disable(FS_RESET); // Disabilita tasto di reset
|
||||||
m.set(FS_RECALC, "", TRUE); // Disabilita ricalcolo automatico
|
m.set(FS_RECALC, "", TRUE); // Disabilita ricalcolo automatico
|
||||||
m.disable(FS_RECALC);
|
m.disable(FS_RECALC);
|
||||||
@ -515,7 +515,7 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
|||||||
bool sposta = newgame != NULL;
|
bool sposta = newgame != NULL;
|
||||||
if (sposta)
|
if (sposta)
|
||||||
{
|
{
|
||||||
sposta = (oldgame->conto() == newgame->conto());
|
sposta = (oldgame->conto().sottoconto() == newgame->conto().sottoconto());
|
||||||
if (sposta)
|
if (sposta)
|
||||||
sposta = yesno_box("Spostare le righe nella nuova partita?");
|
sposta = yesno_box("Spostare le righe nella nuova partita?");
|
||||||
}
|
}
|
||||||
|
@ -448,7 +448,9 @@ bool TRiga_scadenze::modifica_pagamento(const TRectype& new_pag, const TValuta&
|
|||||||
sum.update(old_pag, new_pag, PART_IMPORTOVAL);
|
sum.update(old_pag, new_pag, PART_IMPORTOVAL);
|
||||||
sum.update(old_pag, new_pag, PART_RITENUTE);
|
sum.update(old_pag, new_pag, PART_RITENUTE);
|
||||||
|
|
||||||
partita().chiusa(TRUE); // Aggiorna flag di chiusura
|
// Aggiorna flags di chiusura
|
||||||
|
chiusa(TRUE);
|
||||||
|
partita().chiusa(TRUE);
|
||||||
|
|
||||||
const bool empty = new_pag.get_char(PAGSCA_ACCSAL) != 'S' &&
|
const bool empty = new_pag.get_char(PAGSCA_ACCSAL) != 'S' &&
|
||||||
new_pag.get_real(PAGSCA_IMPORTO).is_zero();
|
new_pag.get_real(PAGSCA_IMPORTO).is_zero();
|
||||||
@ -582,13 +584,23 @@ TPartita::TPartita(const TBill& clifo, int anno, const char* num)
|
|||||||
read(clifo, anno, num);
|
read(clifo, anno, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* TPartita::build_key(TString& key) const
|
||||||
|
{
|
||||||
|
if (_conto.tipo() > ' ')
|
||||||
|
key.format("%c%3d%3d%6ld%4d%s", _conto.tipo(), 0, 0, _conto.sottoconto(),
|
||||||
|
_anno, (const char*)_num);
|
||||||
|
else
|
||||||
|
key.format("%c%3d%3d%6ld%4d%s",
|
||||||
|
_conto.tipo(), _conto.gruppo(), _conto.conto(), _conto.sottoconto(),
|
||||||
|
_anno, (const char*)_num);
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
int TPartita::compare(const TSortable& s) const
|
int TPartita::compare(const TSortable& s) const
|
||||||
{
|
{
|
||||||
TString80 key; key.format("%c%6ld%4d%s", conto().tipo(), conto().sottoconto(),
|
TString80 key; build_key(key);
|
||||||
anno(), (const char*)numero());
|
|
||||||
const TPartita& p = (const TPartita&)s;
|
const TPartita& p = (const TPartita&)s;
|
||||||
TString80 par; par.format("%c%6ld%4d%s", p.conto().tipo(), p.conto().sottoconto(),
|
TString80 par; p.build_key(par);
|
||||||
p.anno(), (const char*)p.numero());
|
|
||||||
return strcmp(key, par);
|
return strcmp(key, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -934,7 +946,7 @@ bool TPartita::chiusa(bool update)
|
|||||||
for (int r = part.last(); r > 0; r--)
|
for (int r = part.last(); r > 0; r--)
|
||||||
{
|
{
|
||||||
const TRiga_scadenze& scad = part.rata(r);
|
const TRiga_scadenze& scad = part.rata(r);
|
||||||
if (!scad.chiusa(update))
|
if (!scad.chiusa())
|
||||||
{
|
{
|
||||||
forse_chiusa = FALSE;
|
forse_chiusa = FALSE;
|
||||||
break;
|
break;
|
||||||
@ -1120,6 +1132,11 @@ TPartita* TPartite_array::find(const TBill& clifo, int anno, const char* num, bo
|
|||||||
TPartita* TPartite_array::find(const TRectype& r, bool create)
|
TPartita* TPartite_array::find(const TRectype& r, bool create)
|
||||||
{
|
{
|
||||||
TBill zio; zio.get(r);
|
TBill zio; zio.get(r);
|
||||||
|
if (zio.gruppo() == 0)
|
||||||
|
{
|
||||||
|
zio.set(r.get_int(PART_GRUPPOCL), r.get_int(PART_CONTOCL),
|
||||||
|
zio.sottoconto(), zio.tipo());
|
||||||
|
}
|
||||||
const int anno = r.get_int(PART_ANNO);
|
const int anno = r.get_int(PART_ANNO);
|
||||||
const char* num = r.get_str(PART_NUMPART);
|
const char* num = r.get_str(PART_NUMPART);
|
||||||
return find(zio, anno, num, create);
|
return find(zio, anno, num, create);
|
||||||
|
@ -185,6 +185,9 @@ class TPartita : public TSortable
|
|||||||
TRecord_array _part;
|
TRecord_array _part;
|
||||||
TRecord_array _unassigned;
|
TRecord_array _unassigned;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const char* build_key(TString& key) const;
|
||||||
|
|
||||||
public: // TObject
|
public: // TObject
|
||||||
virtual bool ok() const { return _part.rows() > 0; }
|
virtual bool ok() const { return _part.rows() > 0; }
|
||||||
virtual int compare(const TSortable& s) const;
|
virtual int compare(const TSortable& s) const;
|
||||||
@ -272,7 +275,7 @@ public:
|
|||||||
bool write(bool re = FALSE);
|
bool write(bool re = FALSE);
|
||||||
bool rewrite() { return write(TRUE); }
|
bool rewrite() { return write(TRUE); }
|
||||||
|
|
||||||
int add_numreg(long numreg); // Carica tutte le partite relative alla registrazione numreg
|
int add_numreg(long numreg); // Carica tutte le partite relative alla registrazione numreg
|
||||||
TImporto importo_speso(long numreg, int numrig);
|
TImporto importo_speso(long numreg, int numrig);
|
||||||
void update_reg(const TRectype& mov, long old_reg = 0);
|
void update_reg(const TRectype& mov, long old_reg = 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user