Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento :continua la contabilizzazione cespiti; aggiunto il ricalcolo saldi git-svn-id: svn://10.65.10.50/trunk@15971 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9eeb94b570
commit
393b44b407
@ -5,6 +5,7 @@
|
|||||||
#include <reputils.h>
|
#include <reputils.h>
|
||||||
|
|
||||||
#include "../cg/cg2101.h"
|
#include "../cg/cg2101.h"
|
||||||
|
#include "../cg/cglib02.h"
|
||||||
|
|
||||||
#include "celib.h"
|
#include "celib.h"
|
||||||
#include "ce2101.h"
|
#include "ce2101.h"
|
||||||
@ -230,7 +231,10 @@ int TSaldo_per_codice::compila_rmov(const int tipo, const int riga_nor, TArray&
|
|||||||
const long sottoc = atol(_idcespite);
|
const long sottoc = atol(_idcespite);
|
||||||
ok = sottoc > 0 && sottoc < 1000000;
|
ok = sottoc > 0 && sottoc < 1000000;
|
||||||
if (ok)
|
if (ok)
|
||||||
|
{
|
||||||
zio.set(zio.gruppo(), zio.conto(), sottoc);
|
zio.set(zio.gruppo(), zio.conto(), sottoc);
|
||||||
|
ok = zio.find();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
@ -275,25 +279,106 @@ const TRectype& TSaldo_per_codice::categoria() const
|
|||||||
|
|
||||||
class TMovimentoPN_CE : public TMovimentoPN
|
class TMovimentoPN_CE : public TMovimentoPN
|
||||||
{
|
{
|
||||||
|
TSaldo_agg _sagg;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void salda_rmov(const bool add);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual int read(TIsamop op = _isequal, TReclock lockop = _nolock);
|
||||||
|
virtual int write(bool force = true);
|
||||||
|
virtual int rewrite(bool force = true);
|
||||||
|
virtual int remove();
|
||||||
|
|
||||||
TRectype& nuova_riga();
|
TRectype& nuova_riga();
|
||||||
TRectype& nuova_riga(const TRectype& row);
|
TRectype& nuova_riga(const TRectype& row);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void TMovimentoPN_CE::salda_rmov(const bool add)
|
||||||
|
{
|
||||||
|
_sagg.set_anno_es(curr().get_int(MOV_ANNOES));
|
||||||
|
_sagg.set_movprovv(curr().get_char(MOV_PROVVIS) > ' ');
|
||||||
|
_sagg.set_movimentato(true);
|
||||||
|
|
||||||
|
TBill zio;
|
||||||
|
TImporto imp;
|
||||||
|
for (int i = 0; i < cg_items(); i++)
|
||||||
|
{
|
||||||
|
const TRectype& rmov = cg(i); //riga i-esima corrente
|
||||||
|
zio.get(rmov);
|
||||||
|
imp.set(rmov.get_char(RMV_SEZIONE), rmov.get_real(RMV_IMPORTO));
|
||||||
|
_sagg.aggiorna(zio, imp, add);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int TMovimentoPN_CE::read(TIsamop op, TReclock lockop)
|
||||||
|
{
|
||||||
|
int err = TMovimentoPN::read(op, lockop);
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
_sagg.reset();
|
||||||
|
salda_rmov(false);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TMovimentoPN_CE::remove()
|
||||||
|
{
|
||||||
|
int err = TMovimentoPN::remove();
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
_sagg.registra();
|
||||||
|
_sagg.reset();
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TMovimentoPN_CE::write(bool force)
|
||||||
|
{
|
||||||
|
int err = TMovimentoPN::write(force);
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
salda_rmov(true);
|
||||||
|
_sagg.set_num_ulmov(curr().get_long(MOV_NUMREG));
|
||||||
|
_sagg.set_data_ulmov(curr().get_date(MOV_DATAREG));
|
||||||
|
_sagg.registra();
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TMovimentoPN_CE::rewrite(bool force)
|
||||||
|
{
|
||||||
|
int err = TMovimentoPN::rewrite(force);
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
salda_rmov(true);
|
||||||
|
_sagg.registra();
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
//nuova riga fondo
|
||||||
TRectype& TMovimentoPN_CE::nuova_riga()
|
TRectype& TMovimentoPN_CE::nuova_riga()
|
||||||
{
|
{
|
||||||
TRectype& riga = cg(-1);
|
TRectype& riga = cg(-1);
|
||||||
riga.put(RMV_NUMRIG, cg_items());
|
riga.put(RMV_NUMRIG, cg_items());
|
||||||
riga.put(RMV_ANNOES, curr().get(MOV_ANNOES));
|
riga.put(RMV_ANNOES, curr().get(MOV_ANNOES));
|
||||||
|
|
||||||
return riga;
|
return riga;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nuova riga normale
|
||||||
TRectype& TMovimentoPN_CE::nuova_riga(const TRectype& row)
|
TRectype& TMovimentoPN_CE::nuova_riga(const TRectype& row)
|
||||||
{
|
{
|
||||||
TRectype& riga = cg(-1);
|
TRectype& riga = cg(-1);
|
||||||
riga = row;
|
riga = row;
|
||||||
riga.put(RMV_NUMRIG, cg_items());
|
riga.put(RMV_NUMRIG, cg_items());
|
||||||
riga.put(RMV_ANNOES, curr().get(MOV_ANNOES));
|
riga.put(RMV_ANNOES, curr().get(MOV_ANNOES));
|
||||||
|
|
||||||
|
//resettatore del saldo ad ogni nuovo movimento (righe tot presenti 1 = nuovo movimento)
|
||||||
|
if (cg_items() == 1)
|
||||||
|
_sagg.reset();
|
||||||
|
|
||||||
return riga;
|
return riga;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +409,7 @@ public:
|
|||||||
|
|
||||||
void TTrasf_mov_ce_cg::delete_old_movs(const TDate& ini_es)
|
void TTrasf_mov_ce_cg::delete_old_movs(const TDate& ini_es)
|
||||||
{
|
{
|
||||||
TMovimentoPN pn;
|
TMovimentoPN_CE pn;
|
||||||
|
|
||||||
TRectype darec(LF_MOV);
|
TRectype darec(LF_MOV);
|
||||||
darec.put(MOV_DATAREG, ini_es);
|
darec.put(MOV_DATAREG, ini_es);
|
||||||
@ -436,6 +521,12 @@ void TTrasf_mov_ce_cg::genera_mov(TArray& righe_mov, const TDate& datareg, const
|
|||||||
msg << TR("Impossibile registrare il movimento ") << numreg << "\n";
|
msg << TR("Impossibile registrare il movimento ") << numreg << "\n";
|
||||||
log.log(2, msg);
|
log.log(2, msg);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg << TR("Registrato movimento ") << numreg << TR(" categoria ") << descat << "\n";
|
||||||
|
log.log(0, msg);
|
||||||
|
}
|
||||||
pn.destroy_rows(numreg); //ne elimina le righe per poter ricominciare
|
pn.destroy_rows(numreg); //ne elimina le righe per poter ricominciare
|
||||||
head.put(MOV_NUMREG, ++numreg); //nuova testata per nuovo movimento
|
head.put(MOV_NUMREG, ++numreg); //nuova testata per nuovo movimento
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user