Corrette ricerche sui saldi

git-svn-id: svn://10.65.10.50/trunk@2935 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-05-30 13:48:03 +00:00
parent ab8f4c7139
commit 5a47a0786d
3 changed files with 28 additions and 19 deletions

View File

@ -18,7 +18,7 @@ ENDPAGE
/* page1 */ /* page1 */
PAGE "Impostazione parametri ditta" -1 -1 77 8 PAGE "Parametri ditta" -1 -1 77 8
GROUPBOX DLG_NULL 76 4 GROUPBOX DLG_NULL 76 4
BEGIN BEGIN

View File

@ -59,7 +59,7 @@ const int EsePre(const int EseCorr)
// aep e' l'esercizio precedente // aep e' l'esercizio precedente
TSaldi_list::TSaldi_list(int gr, int co, int aec, int aep_par) TSaldi_list::TSaldi_list(int gr, int co, int aec, int aep_par)
{ {
TLocalisamfile cf(LF_SALDI, FALSE); TLocalisamfile cf(LF_SALDI);
bool force; bool force;
TString16 key; TString16 key;
int aep = aep_par; int aep = aep_par;
@ -140,6 +140,7 @@ real TSaldo::calcola_saldo_iniziale(int g,int c,long s,int indbil)
_saldi.put(SLD_CONTO,c); _saldi.put(SLD_CONTO,c);
_saldi.put(SLD_SOTTOCONTO,s); _saldi.put(SLD_SOTTOCONTO,s);
_saldi.put(SLD_ANNOES,_annoes); _saldi.put(SLD_ANNOES,_annoes);
_saldi.put(SLD_FLSCA,"");
if (_rec_presente_ec = (_saldi.read() == NOERR)) if (_rec_presente_ec = (_saldi.read() == NOERR))
saldoini = _saldi.get_real(SLD_SALDO); saldoini = _saldi.get_real(SLD_SALDO);
@ -313,6 +314,7 @@ bool TSaldo::ultima_immissione_verifica(int annoes,int g,int c,long s,int indbil
_saldi.put(SLD_GRUPPO,g); _saldi.put(SLD_GRUPPO,g);
_saldi.put(SLD_CONTO,c); _saldi.put(SLD_CONTO,c);
_saldi.put(SLD_SOTTOCONTO,s); _saldi.put(SLD_SOTTOCONTO,s);
_saldi.put(SLD_FLSCA, "");
if (_saldi.read() == NOERR) if (_saldi.read() == NOERR)
{ {
@ -331,7 +333,7 @@ bool TSaldo::ultima_immissione_verifica(int annoes,int g,int c,long s,int indbil
if (_saldo_iniziale == ZERO && _prg_dare == ZERO && _prg_avere == ZERO) if (_saldo_iniziale == ZERO && _prg_dare == ZERO && _prg_avere == ZERO)
return esito; return esito;
if (stp_prov == ZERO && paverepro == ZERO) if (stp_prov == 0 && paverepro == ZERO)
return esito; return esito;
if (sezione == 'A') _saldo_iniziale = -_saldo_iniziale; if (sezione == 'A') _saldo_iniziale = -_saldo_iniziale;
@ -387,6 +389,7 @@ bool TSaldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil
_saldi.put(SLD_GRUPPO,g); _saldi.put(SLD_GRUPPO,g);
_saldi.put(SLD_CONTO,c); _saldi.put(SLD_CONTO,c);
_saldi.put(SLD_SOTTOCONTO,s); _saldi.put(SLD_SOTTOCONTO,s);
_saldi.put(SLD_FLSCA, "");
if (_saldi.read() == NOERR) if (_saldi.read() == NOERR)
{ {
@ -443,11 +446,13 @@ bool TSaldo::ricerca_progr_prec (int annoesprec, int g, int c, long s)
else else
{ {
const int oldkey = _saldi.getkey(); const int oldkey = _saldi.getkey();
_saldi.setkey(1);
_saldi.zero(); _saldi.zero();
_saldi.put(SLD_ANNOES,annoesprec); _saldi.put(SLD_ANNOES,annoesprec);
_saldi.put(SLD_GRUPPO,g); _saldi.put(SLD_GRUPPO,g);
_saldi.put(SLD_CONTO,c); _saldi.put(SLD_CONTO,c);
_saldi.put(SLD_SOTTOCONTO,s); _saldi.put(SLD_SOTTOCONTO,s);
_saldi.put(SLD_FLSCA, "");
_rec_presente_ep = _saldi.read() == NOERR; _rec_presente_ep = _saldi.read() == NOERR;
_saldi.setkey(oldkey); _saldi.setkey(oldkey);
} }
@ -462,6 +467,7 @@ bool TSaldo::prg_saldo(int annoes, TConto& conto, real& prgdare, real& prgavere,
_saldi.put(SLD_CONTO,conto.conto()); _saldi.put(SLD_CONTO,conto.conto());
_saldi.put(SLD_SOTTOCONTO,conto.sottoconto()); _saldi.put(SLD_SOTTOCONTO,conto.sottoconto());
_saldi.put(SLD_ANNOES,annoes); _saldi.put(SLD_ANNOES,annoes);
_saldi.put(SLD_FLSCA, "");
bool ok = _saldi.read() == NOERR; bool ok = _saldi.read() == NOERR;

View File

@ -17,7 +17,7 @@ class TContoExt : public TConto
public: public:
bool scaricato() { return _scaricato; } bool scaricato() const { return _scaricato; }
TContoExt(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL, bool sc = FALSE) TContoExt(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL, bool sc = FALSE)
: TConto(g, c, s, t, d), _scaricato(sc) {} : TConto(g, c, s, t, d), _scaricato(sc) {}
@ -148,6 +148,8 @@ void TSaldo_agg::clear_saldi(int year)
for (saldi.read(_isgteq, _lock); for (saldi.read(_isgteq, _lock);
!saldi.eof() && saldi.curr() <= last; !saldi.eof() && saldi.curr() <= last;
saldi.next(_lock)) saldi.next(_lock))
{
if (!saldi.get_bool(SLD_FLSCA))
{ {
saldi.put(SLD_FLAGSALINI, "D"); saldi.put(SLD_FLAGSALINI, "D");
saldi.zero(SLD_SALDO); saldi.zero(SLD_SALDO);
@ -159,6 +161,9 @@ void TSaldo_agg::clear_saldi(int year)
saldi.zero(SLD_DATAULMOV); saldi.zero(SLD_DATAULMOV);
saldi.rewrite(); saldi.rewrite();
} }
else
saldi.reread(_unlock);
}
saldi.reread(_unlock); saldi.reread(_unlock);
} }
@ -185,15 +190,14 @@ void TSaldo_agg::registra()
{ {
THash_object* hobj = _tab_conti.get_hashobj(); THash_object* hobj = _tab_conti.get_hashobj();
TContoExt& tcon = (TContoExt&)hobj->obj(); TContoExt& tcon = (TContoExt&)hobj->obj();
CHECK(tcon.ok(), "Tentavi di saldare un conto incompleto, eh? Mapporcodio! Stronzone!"); CHECK(tcon.ok(), "Tentativo di saldare un conto incompleto");
saldi.zero(); saldi.zero();
saldi.put(SLD_ANNOES, atoi(hobj->key().left(4)) ); saldi.put(SLD_ANNOES, atoi(hobj->key().left(4)) );
saldi.put(SLD_GRUPPO, tcon.gruppo()); saldi.put(SLD_GRUPPO, tcon.gruppo());
saldi.put(SLD_CONTO, tcon.conto()); saldi.put(SLD_CONTO, tcon.conto());
saldi.put(SLD_SOTTOCONTO, tcon.sottoconto()); saldi.put(SLD_SOTTOCONTO, tcon.sottoconto());
if (tcon.scaricato()) saldi.put(SLD_FLSCA, tcon.scaricato());
saldi.put(SLD_FLSCA, "X");
bool update = TRUE; bool update = TRUE;
@ -204,8 +208,7 @@ void TSaldo_agg::registra()
saldi.put(SLD_GRUPPO, tcon.gruppo()); saldi.put(SLD_GRUPPO, tcon.gruppo());
saldi.put(SLD_CONTO, tcon.conto()); saldi.put(SLD_CONTO, tcon.conto());
saldi.put(SLD_SOTTOCONTO, tcon.sottoconto()); saldi.put(SLD_SOTTOCONTO, tcon.sottoconto());
if (tcon.scaricato()) saldi.put(SLD_FLSCA, tcon.scaricato());
saldi.put(SLD_FLSCA, "X");
si = tcon.saldo(); si = tcon.saldo();
if (si < ZERO) if (si < ZERO)