Patch level : 12.0 358
Files correlati : f171.trr f171.dir cg4.exe Corretto il calcolo liquidazione per l'IVA indetraibile e i movimenti cper cassa con IVA normale ed esente. git-svn-id: svn://10.65.10.50/branches/R_10_00@23664 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e795d24099
commit
fa48200320
@ -1457,7 +1457,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
#ifdef DBG
|
||||
const long nr = _mov->get_long(MOV_NUMREG);
|
||||
|
||||
if (nr == 115414 || nr == 155995)
|
||||
if (nr == 29167 || nr == 29171 )
|
||||
int i = 1 ;
|
||||
#endif
|
||||
|
||||
@ -1466,7 +1466,19 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
sosp_imp != vol_affari)
|
||||
tot_reg += imponibile_orig;
|
||||
|
||||
if (bIsMovDiff && tm == tm_fattura)
|
||||
bool bRowIsMovDiff = bIsMovDiff && imposta_orig != ZERO;
|
||||
|
||||
analizza_IVA(imponibile_orig, imposta_orig, percind, corrisp, false, codiva,
|
||||
impon_det, impos_det, impon_ind, impos_ind);
|
||||
for (int is_detr_diff = 1; is_detr_diff >= 0; is_detr_diff--)
|
||||
{
|
||||
real diff_impr = (is_detr_diff == 0) ? impon_det : impon_ind;
|
||||
real diff_ivar = (is_detr_diff == 0) ? impos_det : impos_ind;
|
||||
real diff_totr = diff_impr + diff_ivar;
|
||||
|
||||
if (diff_totr == ZERO)
|
||||
continue;
|
||||
if (bRowIsMovDiff && tm == tm_fattura)
|
||||
{
|
||||
const TDate datareg = _mov->get(MOV_DATAREG);
|
||||
|
||||
@ -1489,14 +1501,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
|
||||
id.put("MESELIQ", mesereg);
|
||||
id.put("TIPOIVA", tipomov == 2 ? 2 : 1);
|
||||
id.put(ID_INDETR, is_detr_diff > 0);
|
||||
id.put("TIPODIFF", iva_cass ? 2 : 1);
|
||||
id.put(MOV_DATAREG, _mov->get(MOV_DATADOC));
|
||||
id.put(RMI_CODIVA, codiva);
|
||||
id.put("SEZIONE", sezfat);
|
||||
|
||||
id.put("IMPORTO", imponibile_orig+imposta_orig);
|
||||
id.put(RMI_IMPONIBILE, imponibile_orig);
|
||||
id.put(RMI_IMPOSTA, imposta_orig);
|
||||
id.put("IMPORTO", diff_totr);
|
||||
id.put(RMI_IMPONIBILE, diff_impr);
|
||||
id.put(RMI_IMPOSTA, diff_ivar);
|
||||
|
||||
const int ew = id.write_rewrite();
|
||||
if (ew != NOERR)
|
||||
@ -1533,6 +1546,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
CHECKD(rmi_tipoatt > 0, "Invalid tipo att ", rmi_tipoatt);
|
||||
id.put("TIPOATT", rmi_tipoatt);
|
||||
id.put("TIPOIVA", tipomov == 2 ? 2 : 1);
|
||||
id.put(ID_INDETR, is_detr_diff > 0);
|
||||
id.put("TIPODIFF", iva_cass ? 2 : 1);
|
||||
id.put(RMI_CODIVA, codiva);
|
||||
|
||||
@ -1540,8 +1554,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
bool ultimo = false;
|
||||
long nregpag;
|
||||
int nrigpag;
|
||||
|
||||
tipo_movimento tipomov_pag = tm_pagamento;
|
||||
|
||||
if (nrigp > 0 && nrigp < 9999)
|
||||
{
|
||||
const TPartita& p = arrpart.partita(pagsca);
|
||||
@ -1591,10 +1605,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
|
||||
const long numregp = id.get_long(ID_NUMREGP);
|
||||
const int numrigp = nrigp;
|
||||
real val_imp = pagtmp.valore() * lordo_orig / tot;
|
||||
real val_imp = pagtmp.valore() * diff_totr / tot;
|
||||
real val_iva;
|
||||
|
||||
if (ultimo)
|
||||
if (ultimo && (is_detr_diff == 0))
|
||||
{
|
||||
TRectype svidrec(id.curr());
|
||||
TLocalisamfile rid(LF_IVADIFF);
|
||||
@ -1604,7 +1618,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
|
||||
rid.put(MOV_NUMREG, numreg);
|
||||
rid.put(RMI_NUMRIG, numrig);
|
||||
val_iva = imposta_orig;
|
||||
val_iva = diff_ivar;
|
||||
|
||||
bool pag_found = false;
|
||||
|
||||
@ -1637,7 +1651,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
id.put(RMI_IMPONIBILE, val_imp);
|
||||
id.put(RMI_IMPOSTA, val_iva);
|
||||
|
||||
if (tipomov_pag >= tm_pagamento)
|
||||
if (tipomov_pag >= tm_pagamento && is_detr_diff == 0)
|
||||
{
|
||||
incdiff_imp += val_imp;
|
||||
incdiff_iva += val_iva;
|
||||
@ -1667,28 +1681,22 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_date_ok(date, month, liqmonth, year_int)) // 5-3-2014
|
||||
if (is_date_ok(date, month, liqmonth, year_int) && is_detr_diff == 0) // 5-3-2014
|
||||
{
|
||||
diff_imp = imponibile_orig;
|
||||
diff_iva = imposta_orig;
|
||||
diff_imp = diff_impr;
|
||||
diff_iva = diff_ivar;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bIsMovDiff)
|
||||
if (is_date_ok(date, month, liqmonth, year_int) && is_detr_diff == 0) // 5-3-2014
|
||||
{
|
||||
if (is_date_ok(date, month, liqmonth, year_int)) // 5-3-2014
|
||||
{
|
||||
diff_imp = imponibile_orig;
|
||||
diff_iva = imposta_orig;
|
||||
diff_imp = diff_impr;
|
||||
diff_iva = diff_ivar;
|
||||
}
|
||||
}
|
||||
else
|
||||
analizza_IVA(imponibile_orig, imposta_orig, percind, corrisp, false, codiva,
|
||||
impon_det, impos_det, impon_ind, impos_ind);
|
||||
}
|
||||
|
||||
|
||||
// Filling dell'array per IVA11
|
||||
if (_is_interactive && month == 13)
|
||||
iva11_set_arr_phase_1(trueatt);
|
||||
@ -1730,7 +1738,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
codreg = comune.get_int(COM_CODREG) + 1;
|
||||
}
|
||||
|
||||
if (bIsMovDiff)
|
||||
if (bRowIsMovDiff)
|
||||
{
|
||||
vt_imponibile[codreg] += incdiff_imp;
|
||||
vt_imposta[codreg] += incdiff_iva;
|
||||
@ -1820,21 +1828,19 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
*/
|
||||
}
|
||||
|
||||
bool bMovDiffToAdd = true;
|
||||
|
||||
for (int is_detraibile = 0; is_detraibile < 2; is_detraibile++)
|
||||
{
|
||||
const int tipodet = is_detraibile ? 0 : tipoind;
|
||||
const real imponibile = is_detraibile ? impon_det : impon_ind;
|
||||
const real imposta = is_detraibile ? impos_det : impos_ind;
|
||||
const int tipodet = is_detraibile == 0 ? 0 : tipoind;
|
||||
real imponibile = is_detraibile == 0 ? impon_det : impon_ind;
|
||||
real imposta = is_detraibile == 0? impos_det : impos_ind;
|
||||
|
||||
if ((imponibile.is_zero() && imposta.is_zero()) &&
|
||||
(bIsMovDiff &&
|
||||
(is_detraibile > 0 ||
|
||||
(diff_imp.is_zero() && diff_iva.is_zero() &&
|
||||
incdiff_imp.is_zero() && incdiff_iva.is_zero())
|
||||
)
|
||||
)
|
||||
)
|
||||
continue;
|
||||
if (bRowIsMovDiff && is_detraibile == 0)
|
||||
{
|
||||
imponibile = ZERO;
|
||||
imposta = ZERO;
|
||||
}
|
||||
|
||||
/* Riga imponibile > 9 = ritenute; non si considerano (Scudler 1994) */
|
||||
|
||||
@ -2533,10 +2539,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
cs.add(v.string(), 1);
|
||||
tab->put("S2",cs);
|
||||
|
||||
if (is_detraibile == 0 && // eseguire solo una volta (is_detraibile è in un ciclo da 0 a 1)
|
||||
(!diff_imp.is_zero() || !diff_iva.is_zero() ||
|
||||
!incdiff_imp.is_zero() || !incdiff_iva.is_zero()))
|
||||
if (bRowIsMovDiff && bMovDiffToAdd)
|
||||
{
|
||||
bMovDiffToAdd = false;
|
||||
if (tipomov == vendita)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
@ -2568,8 +2573,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
else
|
||||
{
|
||||
// fatture acquisto a liquidazione differita
|
||||
tab->curr().add("R30", diff_imp);
|
||||
tab->curr().add("R31", diff_iva);
|
||||
tab->curr().add("R30", incdiff_imp);
|
||||
tab->curr().add("R31", incdiff_iva);
|
||||
tab->curr().add("R32", incdiff_imp);
|
||||
tab->curr().add("R33", incdiff_iva);
|
||||
fdiff_imp_acq += diff_imp;
|
||||
|
@ -1648,7 +1648,7 @@ int TLiquidazione_app::calc_inc_diff(int tipoiva, real& imponibile_diff, real& i
|
||||
TString limit; limit << "ANNOLIQ=" << _year;
|
||||
if (_month < 13) limit << " MESELIQ=" << _month;
|
||||
TString query; // righe pagamento (TIPOMOV>=3) ed escluse NC!
|
||||
query << "USE IVADIFF KEY 2 SELECT (TIPOMOV>2)&&(TIPOIVA=" << tipoiva << ')'
|
||||
query << "USE IVADIFF KEY 2 SELECT (TIPOMOV>2)&&(TIPOIVA=" << tipoiva << ")&&NUM(INDETR!='X')"
|
||||
<< "\nFROM " << limit << "\nTO " << limit;
|
||||
|
||||
TISAM_recordset id(query);
|
||||
|
@ -1,3 +1,3 @@
|
||||
171
|
||||
0
|
||||
$ivadiff|0|0|110|0|IVA ad esigibilità differita o per cassa|||
|
||||
$ivadiff|0|0|111|0|IVA ad esigibilità differita o per cassa|||
|
||||
|
@ -1,5 +1,5 @@
|
||||
171
|
||||
19
|
||||
20
|
||||
NUMREG|3|7|0|Numero operazione Fattura
|
||||
NUMRIG|2|3|0|Numero riga IVA
|
||||
NUMPRO|2|3|0|Numero progressivo PAG o NC
|
||||
@ -12,6 +12,7 @@ ANNOLIQ|2|4|0|Anno liquidazione
|
||||
MESELIQ|2|2|0|Mese liquidazione
|
||||
TIPOATT|2|1|0|Tipo attività (1=Normale; 2=Mista)
|
||||
TIPOIVA|2|1|0|Tipo IVA (1=Vendite; 2=Acquisti)
|
||||
INDETR|8|1|0|Riga di IVA indetraibile
|
||||
TIPODIFF|2|1|0|IVA differita (1) o per Cassa (2)
|
||||
CODIVA|1|4|0|Codice IVA
|
||||
SEZIONE|1|1|0|Sezione <D>are <A>vere
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define ID_MESELIQ "MESELIQ"
|
||||
#define ID_TIPOATT "TIPOATT"
|
||||
#define ID_TIPOIVA "TIPOIVA"
|
||||
#define ID_INDETR "INDETR"
|
||||
#define ID_TIPODIFF "TIPODIFF"
|
||||
#define ID_CODIVA "CODIVA"
|
||||
#define ID_SEZIONE "SEZIONE"
|
||||
|
Loading…
x
Reference in New Issue
Block a user