Patch level : 10.0 290
Files correlati : Commento : Corretta liquidazione per quanto riguarda l'IVAdifferita, vedi Diana2000 settembre. git-svn-id: svn://10.65.10.50/branches/R_10_00@23373 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
dffbb31e60
commit
7cf822d272
@ -1133,6 +1133,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
const bool corrisp = _reg->get_bool("B0");
|
const bool corrisp = _reg->get_bool("B0");
|
||||||
const tiporeg tipomov = (tiporeg)_reg->get_int("I0"); // 1=Vendite; 2=Acquisti
|
const tiporeg tipomov = (tiporeg)_reg->get_int("I0"); // 1=Vendite; 2=Acquisti
|
||||||
|
|
||||||
|
|
||||||
|
const long nr = _mov->get_long(MOV_NUMREG);
|
||||||
|
|
||||||
|
if (nr == 23121)
|
||||||
|
int i = 1;
|
||||||
|
|
||||||
tipo_movimento tm = (tipo_movimento)_mov->get_int(MOV_TIPOMOV);
|
tipo_movimento tm = (tipo_movimento)_mov->get_int(MOV_TIPOMOV);
|
||||||
if (tm == tm_nessuno)
|
if (tm == tm_nessuno)
|
||||||
{
|
{
|
||||||
@ -1187,7 +1193,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
const bool iva_cass = !iva_diff && !_isviaggio && tm > tm_nessuno && is_IVAxCassa(_mov->curr());
|
const bool iva_cass = !iva_diff && !_isviaggio && tm > tm_nessuno && is_IVAxCassa(_mov->curr());
|
||||||
const bool bIsMovDiff = (iva_diff || iva_cass) && !_recalc_regis; // Aggiunto test su ricalcolo da registri 13-12-2012
|
const bool bIsMovDiff = (iva_diff || iva_cass) && !_recalc_regis; // Aggiunto test su ricalcolo da registri 13-12-2012
|
||||||
bool dok = is_date_ok(date, month, liqmonth, year_int);
|
bool dok = is_date_ok(date, month, liqmonth, year_int);
|
||||||
|
const bool ic = _mov->get_bool(MOV_IVAXCASSA);
|
||||||
TPartite_array arrpart; // Partite interessate
|
TPartite_array arrpart; // Partite interessate
|
||||||
TPointer_array pagscatt; // Righe di pagsca interessate
|
TPointer_array pagscatt; // Righe di pagsca interessate
|
||||||
|
|
||||||
@ -1206,6 +1212,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
real tot_incassato, tot_da_incassare;
|
real tot_incassato, tot_da_incassare;
|
||||||
int flag_pg_nc = 0; // Ci sono pagamenti (0x1) e/o note di credito(0x2) ?
|
int flag_pg_nc = 0; // Ci sono pagamenti (0x1) e/o note di credito(0x2) ?
|
||||||
bool game_found = false;
|
bool game_found = false;
|
||||||
|
|
||||||
if (has_sc)
|
if (has_sc)
|
||||||
{
|
{
|
||||||
arrpart.add_numreg(numreg);
|
arrpart.add_numreg(numreg);
|
||||||
@ -1218,8 +1225,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
|
|
||||||
TDate orizzonte = fine; // caso tradizionale
|
TDate orizzonte = fine; // caso tradizionale
|
||||||
|
|
||||||
// esperimento del 15-02-2016
|
if (iva_cass)
|
||||||
if (1)
|
|
||||||
{
|
{
|
||||||
TDate data_rif = data_maturazione_IVA_diff(_mov->curr());
|
TDate data_rif = data_maturazione_IVA_diff(_mov->curr());
|
||||||
if (data_rif < fine)
|
if (data_rif < fine)
|
||||||
@ -1243,12 +1249,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sarebbe_maturata(_mov->curr(), inizio+1L, fine))
|
if (iva_diff || sarebbe_maturata(_mov->curr(), inizio+1L, fine))
|
||||||
{
|
{
|
||||||
TPointer_array pagscaold;
|
TPointer_array pagscaold;
|
||||||
TImporto pg_tot, nc_tot;
|
TImporto pg_tot, nc_tot;
|
||||||
rp.calcola_pagato_periodo(TDate(0L), orizzonte, pg_tot, nc_tot, &pagscaold);
|
|
||||||
|
|
||||||
|
rp.calcola_pagato_periodo(inizio+1L, orizzonte, pg_tot, nc_tot, &pagscaold);
|
||||||
// Controllo se ci siam persi delle note di credito negli anni scorsi
|
// Controllo se ci siam persi delle note di credito negli anni scorsi
|
||||||
if (!nc_tot.is_zero() && pagscaold.items() > pagscatt.items())
|
if (!nc_tot.is_zero() && pagscaold.items() > pagscatt.items())
|
||||||
{
|
{
|
||||||
@ -1288,11 +1294,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TImporto incasso = pg_tot;
|
||||||
TImporto saldo = rp.importo(false);
|
TImporto saldo = rp.importo(false);
|
||||||
saldo += pg_tot; saldo += nc_tot;
|
|
||||||
|
incasso += nc_tot;
|
||||||
|
saldo += incasso;
|
||||||
saldo.normalize(sezfat);
|
saldo.normalize(sezfat);
|
||||||
|
incasso.normalize(sezpag);
|
||||||
if (saldo.valore() > ZERO)
|
if (saldo.valore() > ZERO)
|
||||||
tot_da_incassare = saldo.valore();
|
tot_da_incassare = saldo.valore();
|
||||||
|
if (incasso.valore() > ZERO)
|
||||||
|
tot_incassato = incasso.valore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1309,7 +1321,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Simulo incasso se necessario
|
// Simulo incasso se necessario
|
||||||
if (!tot_da_incassare.is_zero()) // già controllato se sarebbe_maturata(_mov->curr(), fine)
|
if (iva_cass && tot_da_incassare > ZERO) // già controllato se sarebbe_maturata(_mov->curr(), fine)
|
||||||
{
|
{
|
||||||
tot_incassato = tot_da_incassare;
|
tot_incassato = tot_da_incassare;
|
||||||
|
|
||||||
@ -1402,10 +1414,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
{
|
{
|
||||||
CHECKS(codiva == _iva->get("CODTAB"), "Codice IVA simile ", (const char*)codiva);
|
CHECKS(codiva == _iva->get("CODTAB"), "Codice IVA simile ", (const char*)codiva);
|
||||||
}
|
}
|
||||||
#ifndef DEBUG
|
|
||||||
if (codiva == "E7")
|
|
||||||
int cazzone = 1;
|
|
||||||
#endif
|
|
||||||
const TString4 tipoiva = _iva->get("S1");
|
const TString4 tipoiva = _iva->get("S1");
|
||||||
const TString4 tipoes_v = _iva->get("S2");
|
const TString4 tipoes_v = _iva->get("S2");
|
||||||
const TString4 tipoes_a = _iva->get("S9");
|
const TString4 tipoes_a = _iva->get("S9");
|
||||||
@ -1499,11 +1507,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
const char sezpag = tipomov == vendita ? 'A' : 'D';
|
const char sezpag = tipomov == vendita ? 'A' : 'D';
|
||||||
const real totfat = _mov->get(MOV_TOTDOC);
|
const real totfat = _mov->get(MOV_TOTDOC);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
if (_mov->get_long(MOV_NUMREG) == 23353)
|
|
||||||
int cazzone = 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TLocalisamfile id(LF_IVADIFF);
|
TLocalisamfile id(LF_IVADIFF);
|
||||||
TRectype& idcurr = id.curr();
|
TRectype& idcurr = id.curr();
|
||||||
FOR_EACH_ARRAY_ITEM(pagscatt, r, obj)
|
FOR_EACH_ARRAY_ITEM(pagscatt, r, obj)
|
||||||
@ -1585,7 +1588,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
idcurr.put(RMI_IMPOSTA, imposta);
|
idcurr.put(RMI_IMPOSTA, imposta);
|
||||||
if (tipomov_pag >= tm_pagamento) // 5-3-2014 incremento incdiff_imp solo coi pagamenti! Coerentemente con !ultimo
|
if (tipomov_pag >= tm_pagamento) // 5-3-2014 incremento incdiff_imp solo coi pagamenti! Coerentemente con !ultimo
|
||||||
{
|
{
|
||||||
incdiff_imp += imponibile;
|
incdiff_imp += imponibile; // ??????????? qui
|
||||||
incdiff_iva += imposta;
|
incdiff_iva += imposta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4069,43 +4072,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
TRectype lim = get_lim(month+deltam, true);
|
TRectype lim = get_lim(month+deltam, true);
|
||||||
const TString16 codtab = lim.get("CODTAB");
|
const TString16 codtab = lim.get("CODTAB");
|
||||||
|
|
||||||
/*
|
|
||||||
// azzeriamo tutto (tranne r1, r5, s1, s0, s7)
|
|
||||||
const real rimborso = _lim->get("R1");
|
|
||||||
const real r5 = _lim->get("R5"); // Rettifiche
|
|
||||||
const real credito_utilizzato_f24 = _lim->get("R16");
|
|
||||||
const real r17 = _lim->get("R17");
|
|
||||||
const real r18 = _lim->get("R18");
|
|
||||||
const real r19 = _lim->get("R19");
|
|
||||||
const real credito_autorizzato_f24 = _lim->get_real("R20");
|
|
||||||
const TDate data_autorizzazione = _lim->get_date("D1");
|
|
||||||
const TString s7 = _lim->get("S7");
|
|
||||||
const TString s0 = _lim->get("S0"); // Descrizioni rettifiche
|
|
||||||
const TString s1 = _lim->get("S1");
|
|
||||||
const TString s2 = _lim->get("S2");
|
|
||||||
const TString s3 = _lim->get("S3");
|
|
||||||
const bool wasb0 = _lim->get_bool("B0");
|
|
||||||
const bool wasb1 = _lim->get_bool("B1");
|
|
||||||
|
|
||||||
_lim->zero();
|
|
||||||
_lim->put("CODTAB", codtab);
|
|
||||||
_lim->put("R1", rimborso);
|
|
||||||
_lim->put("R5", r5); // Rettifiche
|
|
||||||
_lim->put("R16", credito_utilizzato_f24);
|
|
||||||
_lim->put("R17", r17);
|
|
||||||
_lim->put("R18", r18);
|
|
||||||
_lim->put("R19", r19);
|
|
||||||
_lim->put("R20", credito_autorizzato_f24);
|
|
||||||
_lim->put("D1", data_autorizzazione);
|
|
||||||
_lim->put("S0", s0);
|
|
||||||
_lim->put("S1", s1);
|
|
||||||
_lim->put("S2", s2);
|
|
||||||
_lim->put("S3", s3);
|
|
||||||
_lim->put("S7", s7);
|
|
||||||
_lim->put("B0", wasb0 ? "X" : "");
|
|
||||||
_lim->put("B1", wasb1 ? "X" : ""); */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* versamenti effettuati: si conteggiano in R0,
|
* versamenti effettuati: si conteggiano in R0,
|
||||||
* sono > 0 solo se andavano calcolati (vedi sopra)
|
* sono > 0 solo se andavano calcolati (vedi sopra)
|
||||||
@ -4211,10 +4177,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
if (_recalc_only)
|
if (_recalc_only)
|
||||||
lim.put("B1", "X");
|
lim.put("B1", "X");
|
||||||
|
|
||||||
/* Cazzata galattica: vedi sopra
|
|
||||||
if (wasdifferita) _isdifferita = true;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// AWFUL! se siamo in annuale, occorre arrotondare alle 1000 lire
|
// AWFUL! se siamo in annuale, occorre arrotondare alle 1000 lire
|
||||||
// schiaffo tutto il codice nell'IF che segue, e se lo si vuole togliere
|
// schiaffo tutto il codice nell'IF che segue, e se lo si vuole togliere
|
||||||
// non si fara' che scancellare tutto il blocco
|
// non si fara' che scancellare tutto il blocco
|
||||||
@ -4253,22 +4215,12 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
res_cred += cred_prec;
|
res_cred += cred_prec;
|
||||||
res_debt = iva_vend + rimborsi + debt_precd + imposta_non_versata + fdiffinc_iva + credito_autorizzato_F24;
|
res_debt = iva_vend + rimborsi + debt_precd + imposta_non_versata + fdiffinc_iva + credito_autorizzato_F24;
|
||||||
|
|
||||||
/* Obsolescenza pura nel 2014
|
if (rettifiche >= ZERO)
|
||||||
if (atoi(_year) < 1998) // Non vale piu' dal 1998 in poi; iva_acq e' gia' ok e cosi' res_cred.
|
|
||||||
{
|
|
||||||
if (tot_cong.sign() > 0)
|
|
||||||
res_debt += tot_cong;
|
|
||||||
else
|
|
||||||
res_cred -= tot_cong;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (rettifiche.sign() >= 0)
|
|
||||||
res_debt += rettifiche;
|
res_debt += rettifiche;
|
||||||
else
|
else
|
||||||
res_cred -= rettifiche;
|
res_cred -= rettifiche;
|
||||||
|
|
||||||
if (variazioni_imposta.sign() >= 0)
|
if (variazioni_imposta >= ZERO)
|
||||||
res_debt += variazioni_imposta;
|
res_debt += variazioni_imposta;
|
||||||
else
|
else
|
||||||
res_cred -= variazioni_imposta;
|
res_cred -= variazioni_imposta;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user