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 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);
|
||||
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 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);
|
||||
|
||||
const bool ic = _mov->get_bool(MOV_IVAXCASSA);
|
||||
TPartite_array arrpart; // Partite interessate
|
||||
TPointer_array pagscatt; // Righe di pagsca interessate
|
||||
|
||||
@ -1206,7 +1212,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
real tot_incassato, tot_da_incassare;
|
||||
int flag_pg_nc = 0; // Ci sono pagamenti (0x1) e/o note di credito(0x2) ?
|
||||
bool game_found = false;
|
||||
if (has_sc)
|
||||
|
||||
if (has_sc)
|
||||
{
|
||||
arrpart.add_numreg(numreg);
|
||||
const TPartita* p = arrpart.first();
|
||||
@ -1218,8 +1225,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
|
||||
TDate orizzonte = fine; // caso tradizionale
|
||||
|
||||
// esperimento del 15-02-2016
|
||||
if (1)
|
||||
if (iva_cass)
|
||||
{
|
||||
TDate data_rif = data_maturazione_IVA_diff(_mov->curr());
|
||||
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;
|
||||
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
|
||||
if (!nc_tot.is_zero() && pagscaold.items() > pagscatt.items())
|
||||
{
|
||||
@ -1288,11 +1294,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
}
|
||||
}
|
||||
|
||||
TImporto saldo = rp.importo(false);
|
||||
saldo += pg_tot; saldo += nc_tot;
|
||||
TImporto incasso = pg_tot;
|
||||
TImporto saldo = rp.importo(false);
|
||||
|
||||
incasso += nc_tot;
|
||||
saldo += incasso;
|
||||
saldo.normalize(sezfat);
|
||||
incasso.normalize(sezpag);
|
||||
if (saldo.valore() > ZERO)
|
||||
tot_da_incassare = saldo.valore();
|
||||
if (incasso.valore() > ZERO)
|
||||
tot_incassato = incasso.valore();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1309,12 +1321,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
}
|
||||
}
|
||||
// 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;
|
||||
|
||||
datainc = data_maturazione_IVA_diff(_mov->curr());
|
||||
_mov->put(MOV_DATAINC, datainc);
|
||||
_mov->put(MOV_DATAINC, datainc);
|
||||
}
|
||||
if (tot_incassato > ZERO && is_date_ok(datainc, month, liqmonth, year_int))
|
||||
{
|
||||
@ -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);
|
||||
}
|
||||
#ifndef DEBUG
|
||||
if (codiva == "E7")
|
||||
int cazzone = 1;
|
||||
#endif
|
||||
const TString4 tipoiva = _iva->get("S1");
|
||||
const TString4 tipoes_v = _iva->get("S2");
|
||||
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 real totfat = _mov->get(MOV_TOTDOC);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (_mov->get_long(MOV_NUMREG) == 23353)
|
||||
int cazzone = 1;
|
||||
#endif
|
||||
|
||||
TLocalisamfile id(LF_IVADIFF);
|
||||
TRectype& idcurr = id.curr();
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -4069,43 +4072,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
TRectype lim = get_lim(month+deltam, true);
|
||||
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,
|
||||
* 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)
|
||||
lim.put("B1", "X");
|
||||
|
||||
/* Cazzata galattica: vedi sopra
|
||||
if (wasdifferita) _isdifferita = true;
|
||||
*/
|
||||
|
||||
// AWFUL! se siamo in annuale, occorre arrotondare alle 1000 lire
|
||||
// schiaffo tutto il codice nell'IF che segue, e se lo si vuole togliere
|
||||
// non si fara' che scancellare tutto il blocco
|
||||
@ -4252,23 +4214,13 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
else
|
||||
res_cred += cred_prec;
|
||||
res_debt = iva_vend + rimborsi + debt_precd + imposta_non_versata + fdiffinc_iva + credito_autorizzato_F24;
|
||||
|
||||
/* Obsolescenza pura nel 2014
|
||||
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)
|
||||
|
||||
if (rettifiche >= ZERO)
|
||||
res_debt += rettifiche;
|
||||
else
|
||||
res_cred -= rettifiche;
|
||||
|
||||
if (variazioni_imposta.sign() >= 0)
|
||||
if (variazioni_imposta >= ZERO)
|
||||
res_debt += variazioni_imposta;
|
||||
else
|
||||
res_cred -= variazioni_imposta;
|
||||
|
Loading…
x
Reference in New Issue
Block a user