Patch level : 12.0 310 316
Files correlati : Modificato il controllo sul calcolo liquidazione n modo che venga settato solo se viene effettivamente modificata la parte IVA di un movimento IVA o un pagamento relativo a IVA per cassa o differita. git-svn-id: svn://10.65.10.50/branches/R_10_00@23461 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
257265581a
commit
c336747533
@ -1,5 +1,6 @@
|
||||
#include "cg2101.h"
|
||||
#include "cg2103.h"
|
||||
#include "cgsaldac.h"
|
||||
|
||||
#include <diction.h>
|
||||
#include <tabutil.h>
|
||||
@ -9,7 +10,7 @@
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TMovimentoPN::TMovimentoPN()
|
||||
: TRelation(LF_MOV), _cg(LF_RMOV, RMV_NUMRIG), _iva(LF_RMOVIVA, RMI_NUMRIG)
|
||||
: TRelation(LF_MOV), _cg(LF_RMOV, RMV_NUMRIG), _iva(LF_RMOVIVA, RMI_NUMRIG), _old_iva(LF_RMOVIVA, RMI_NUMRIG)
|
||||
{
|
||||
add(LF_RMOV, "NUMREG=NUMREG");
|
||||
add(LF_RMOVIVA, "NUMREG=NUMREG");
|
||||
@ -63,6 +64,7 @@ int TMovimentoPN::read_mov_rows()
|
||||
ivafilter->put(RMI_NUMREG, numreg);
|
||||
_iva.read(ivafilter);
|
||||
|
||||
_old_iva = _iva;
|
||||
/*
|
||||
if (_cg.rows() > 0 && _iva.rows() > 0 && cg(0).get_char(RMV_ROWTYPE) != 'T')
|
||||
adjust_row_types();
|
||||
@ -156,7 +158,6 @@ bool TMovimentoPN::controlla_liquidazione(const TDate& data, TRegistro& registro
|
||||
{
|
||||
// Resetta i flag di calcolato sulla liquidazione IVA del mese di registrazione
|
||||
lim.zero("B0"); // calcolato
|
||||
lim.zero("B1"); // progressivi ricalcolati
|
||||
lim.rewrite();
|
||||
}
|
||||
}
|
||||
@ -278,10 +279,45 @@ int TMovimentoPN::registra(bool re, bool force)
|
||||
dataliq.set_month(mese_liq);
|
||||
}
|
||||
|
||||
controlla_liquidazione(dataliq, registro, true);
|
||||
if (re && dataliq.month() != _olddataliq.month())
|
||||
controlla_liquidazione(_olddataliq, registro, true);
|
||||
bool reset = !re ;
|
||||
if (reg.full())
|
||||
{
|
||||
reset = (dataliq.month() != _olddataliq.month() || _old_iva != _iva);
|
||||
if (dataliq.month() != _olddataliq.month())
|
||||
controlla_liquidazione(_olddataliq, registro, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
const TCausale causale(m.get(MOV_CODCAUS), annoiva);
|
||||
|
||||
if (causale.saldaconto(datareg) && causale.tipomov() != tm_fattura)
|
||||
{
|
||||
TPartite_array partarray;
|
||||
|
||||
partarray.add_numreg(numreg);
|
||||
|
||||
const int npart = partarray.items();
|
||||
|
||||
for (TPartita * part = partarray.first(); !reset && part != NULL; part = partarray.next())
|
||||
{
|
||||
const int nrpart = part->last();
|
||||
|
||||
for (int r = part->prima_fattura(); !reset && r >= 0 && r <= nrpart; r = part->succ(r))
|
||||
{
|
||||
TRiga_partite & rp = part->riga(r);
|
||||
|
||||
if (rp.is_fattura())
|
||||
{
|
||||
const TRectype & mov = cache().get(LF_MOV, rp.get(PART_NREG));
|
||||
|
||||
reset = mov.get_bool(MOV_LIQDIFF) || mov.get_bool(MOV_IVAXCASSA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reset)
|
||||
controlla_liquidazione(dataliq, registro, reset);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ class TMovimentoPN : public TRelation
|
||||
|
||||
// @DPRIV
|
||||
TRecord_array _cg, _iva;
|
||||
TRecord_array _old_iva;
|
||||
TDate _olddataliq;
|
||||
// @END
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user