Patch level : 12.0 1138
Files correlati : cg4 Commento: Corretta imputazione quadro VT ora viene usato il comune dell'unità locale
This commit is contained in:
parent
0d8e271dfc
commit
28e577caff
@ -16,6 +16,7 @@
|
||||
|
||||
#include <nditte.h>
|
||||
#include <attiv.h>
|
||||
#include <unloc.h>
|
||||
#include <causali.h>
|
||||
#include <tab1100.h>
|
||||
#include <mov.h>
|
||||
@ -338,7 +339,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
||||
TString8 cattiv(codatt);
|
||||
cattiv << tipoatt;
|
||||
|
||||
const bool waspla = look_pla(cattiv); // perchè sta cosa ) , has_single_activity);
|
||||
const bool waspla = look_pla(cattiv, has_single_activity);
|
||||
if (!waspla)
|
||||
break; // Non calcolare attività inesistenti 29-11-2012
|
||||
|
||||
@ -1450,7 +1451,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
real nin_iva = ZERO; // imposta non incassati
|
||||
|
||||
const TString4 codiva = _rmoviva->get(RMI_CODIVA);
|
||||
TCodiceIVA civa(codiva);
|
||||
const TCodiceIVA& civa = cached_codIVA(codiva);
|
||||
|
||||
#ifdef DBG
|
||||
BREAK_DBG;
|
||||
@ -1466,17 +1467,16 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
continue;
|
||||
}
|
||||
|
||||
look_iva(codiva); // da eliminare esso per evitare un problema di non lettura _iva ve eliminato
|
||||
const TString4 tipoiva = _iva->get("S1");
|
||||
const TString4 tipoes_v = _iva->get("S2");
|
||||
const TString4 tipoes_a = _iva->get("S9");
|
||||
const int tipoagr = _iva->get_int("I4"); // 2/9/2015 was S4
|
||||
const int tipoag = _iva->get_int("S5");
|
||||
const int tipopla = _iva->get_int("S3");
|
||||
int isrimbinfr = _iva->get_bool("B3"); // vale per calcolo rimborso se ES o NI
|
||||
const real perciva = _iva->get_real("R0") / CENTO;
|
||||
int ivarimb = !_iva->get_bool("B4"); // non escluso calcolo rimb. per al. media
|
||||
const bool den_prorata = _iva->get_bool("B7"); // denominatore prorata nel caso di calcolo pro rata con numeratore e denominatore
|
||||
const TString4 tipoiva = civa.tipo();
|
||||
const TString4 tipoes_v = civa.IVA11_vendite();
|
||||
const TString4 tipoes_a = civa.IVA11_acquisti();
|
||||
const int tipoagr = civa.tipo_IVA_agricola(); // 2/9/2015 was S4
|
||||
const int tipoag = civa.tipo_agenzie_viaggio();
|
||||
const int tipopla = civa.tipo_plafond();
|
||||
int isrimbinfr = civa.codice_rimborso_infrannuale(); // vale per calcolo rimborso se ES o NI
|
||||
const real perciva = civa.moltiplicatore_percentuale();
|
||||
int ivarimb = !civa.escluso_dal_rimborso(); // non escluso calcolo rimb. per al. media
|
||||
const bool den_prorata = civa.tipo_IVA_agricola(); // denominatore prorata nel caso di calcolo pro rata con numeratore e denominatore
|
||||
|
||||
const TString4 tipocr_s = _rmoviva->get(RMI_TIPOCR);
|
||||
const int tipocr = atoi(tipocr_s);
|
||||
@ -1559,7 +1559,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
|
||||
sezfat = tipomov == vendita ? 'D' : 'A';
|
||||
|
||||
if (is_detr_diff == 1 || civa.tipo() == "NS")
|
||||
if (is_detr_diff == 1 || civa.iva_non_soggetta())
|
||||
continue;
|
||||
if (bIsMovDiff && tm == tm_fattura)
|
||||
{
|
||||
@ -1876,28 +1876,28 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
|
||||
if (tipoiva.empty() && codcf != 0)
|
||||
{
|
||||
TString8 key; key.format("%c|%ld", _mov->get_char(MOV_TIPO), codcf);
|
||||
TToken_string key; key.format("%c|%ld", _mov->get_char(MOV_TIPO), codcf);
|
||||
const TRectype& clifo = cache().get(LF_CLIFO, key);
|
||||
int codreg = 0; // codice regione x privati 22 == partite iva 0 == senza codice
|
||||
const int tipoalleg = clifo.get_int(CLI_ALLEG);
|
||||
|
||||
if (tipoalleg == 6) // privato
|
||||
{
|
||||
if (clifo.get_bool(CLI_OCCAS))
|
||||
{
|
||||
const TString& key_occ = _mov->get(MOV_OCFPI);
|
||||
const TRectype& occas = cache().get(LF_OCCAS, key_occ);
|
||||
|
||||
key = occas.get(OCC_STATO);
|
||||
key << "|" << occas.get(OCC_COM);
|
||||
}
|
||||
else
|
||||
{
|
||||
key = clifo.get(CLI_STATOCF);
|
||||
key << "|" << clifo.get(CLI_COMCF);
|
||||
}
|
||||
|
||||
key.cut(0);
|
||||
key.add(get_firm());
|
||||
|
||||
int unloc = _reg->get_int("I7");
|
||||
|
||||
if (unloc == 0)
|
||||
unloc = 1;
|
||||
key.add(unloc);
|
||||
|
||||
const TRectype & runloc = cache().get(LF_UNLOC, key);
|
||||
|
||||
key.format("|%s", (const char *)runloc.get(ULC_COMULC));
|
||||
|
||||
const TRectype& comune = cache().get(LF_COMUNI, key);
|
||||
|
||||
codreg = comune.get_int(COM_CODREG) + 1;
|
||||
}
|
||||
|
||||
@ -2221,8 +2221,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
if (_pcon_1_r->get_int(PCN_INDBIL) == 4)
|
||||
if (_cur->is_first_match(-AGR_PCON2)) // Esiste il sottoconto ?
|
||||
{
|
||||
if (look_iva(_pcon_2_r->get(PCN_IVACOMP)))
|
||||
ivacomp = _iva->get("CODTAB"); // Ecco il codice IVA di compensazione
|
||||
const TCodiceIVA & civa = cached_codIVA(_pcon_2_r->get(PCN_IVACOMP));
|
||||
|
||||
if (civa.ok())
|
||||
ivacomp = civa.codice(); // Ecco il codice IVA di compensazione
|
||||
}
|
||||
look_pia(month, codatt, codiva, ivacomp, true); // Crea il record in tabella se non esiste
|
||||
real pia_imp = _pia->get_real("R0") + agr_imp; // Aggiorna...
|
||||
@ -2727,11 +2729,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
if (_pim->get_bool("B4"))
|
||||
{
|
||||
// ricalcola l'imposta a partire dal codice IVA
|
||||
look_iva(*_pim_codiva);
|
||||
real old_iva = _pim->get_real("R1");
|
||||
real perc = _iva->get_real("R0");
|
||||
const TCodiceIVA & civa = cached_codIVA(*_pim_codiva);
|
||||
const real old_iva = _pim->get_real("R1");
|
||||
real new_iva = _pim->get_real("R0") * civa.moltiplicatore_percentuale();
|
||||
|
||||
real new_iva = _pim->get_real("R0") * perc / CENTO;
|
||||
round_al_centesimo(new_iva);
|
||||
|
||||
if (new_iva != old_iva)
|
||||
@ -2759,10 +2760,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
if (_pia->get_bool("B0"))
|
||||
{
|
||||
// calcola l'imposta a partire dal codice IVA di compensazione
|
||||
look_iva(*_pia_codcom);
|
||||
real perc = _iva->get_real("R0");
|
||||
|
||||
real iva = _pia->get_real("R0") * perc / CENTO;
|
||||
const TCodiceIVA & civa = cached_codIVA(*_pia_codcom);
|
||||
real iva = _pia->get_real("R0") * civa.moltiplicatore_percentuale();
|
||||
|
||||
round_al_centesimo(iva);
|
||||
agr_detIA += iva;
|
||||
_pia->put("R1",iva);
|
||||
@ -2994,12 +2994,14 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt)
|
||||
|
||||
if (is_split_payment(_mov->curr()))
|
||||
imposta = ZERO;
|
||||
const TString4 codiva = _iva->get("CODTAB");
|
||||
const TString4 tipoiva = _iva->get("S1");
|
||||
const real ali = _iva->get_real("R0");
|
||||
const TString4 tipoes_v = _iva->get("S2");
|
||||
const TString4 tipoes_a = _iva->get("S9");
|
||||
const int tipoagr = _iva->get_int("I4"); // 2/9/2015 was S4
|
||||
|
||||
const TCodiceIVA & civa = cached_codIVA(_rmoviva->get(RMI_CODIVA));
|
||||
const TString4 codiva = civa.codice();
|
||||
const TString4 tipoiva = civa.tipo();
|
||||
const real ali = civa.percentuale();
|
||||
const TString4 tipoes_v = civa.IVA11_vendite();
|
||||
const TString4 tipoes_a = civa.IVA11_acquisti();
|
||||
const int tipoagr = civa.tipo_IVA_agricola(); // 2/9/2015 was S4
|
||||
const TRectype& rcs = _cur->curr(LF_CAUSALI);
|
||||
const bool autofattura = rcs.get_bool("AUTOFATT");
|
||||
const bool valintra = rcs.get_bool("VALINTRA");
|
||||
@ -3379,14 +3381,17 @@ void TLiquidazione_app::iva11_set_arr_phase_2(const TString& codatt)
|
||||
// Must consider current activity too...
|
||||
codiva = *_pim_codiva;
|
||||
reg = *_pim_codreg;
|
||||
look_iva(codiva); look_reg(reg); // posiziona la tabella registri e quella IVA
|
||||
tiva = _iva->get("S1"); // tipo IVA
|
||||
tpla = _iva->get("S3"); // tipo gestione plafond
|
||||
tagr = _iva->get_int("I4"); // tipo gestione regime agricolo 2/9/2015 was S4
|
||||
tvia = _iva->get("S5"); // tipo gestione ag. viaggio
|
||||
v11 = _iva->get("S2"); // n.ro riga vendite per mod. IVA11
|
||||
a11 = _iva->get("S9"); // n.ro riga acquisti per mod. IVA11
|
||||
aliq = _iva->get_real("R0"); // aliquota
|
||||
|
||||
const TCodiceIVA & civa = cached_codIVA(codiva);
|
||||
|
||||
look_reg(reg); // posiziona la tabella registri e quella IVA
|
||||
tiva = civa.tipo(); // tipo IVA
|
||||
tpla = civa.tipo_plafond(); // tipo gestione plafond
|
||||
tagr = civa.tipo_IVA_agricola(); // tipo gestione regime agricolo 2/9/2015 was S4
|
||||
tvia = civa.tipo_agenzie_viaggio(); // tipo gestione ag. viaggio
|
||||
v11 = civa.IVA11_vendite(); // n.ro riga vendite per mod. IVA11
|
||||
a11 = civa.IVA11_acquisti(); // n.ro riga acquisti per mod. IVA11
|
||||
aliq = civa.percentuale(); // aliquota
|
||||
treg = (tiporeg)_reg->get_long("I0");
|
||||
const bool is_vendita = treg == vendita;
|
||||
const bool is_acquisto = treg == acquisto;
|
||||
@ -3484,7 +3489,7 @@ void TLiquidazione_app::iva11_set_arr_phase_2(const TString& codatt)
|
||||
_CorrItem& ca = (_CorrItem&) corr_ann[codiva];
|
||||
ca._totale += lor;
|
||||
if (!is_present)
|
||||
ca._aliquota = _iva->get_real("R0"); // Se e' nuovo setta l'aliquota
|
||||
ca._aliquota = civa.percentuale(); // Se e' nuovo setta l'aliquota
|
||||
}
|
||||
|
||||
tt = _pim->get("S0");
|
||||
@ -4541,8 +4546,10 @@ void TLiquidazione_app::recalc_annual(const char* att, bool & first)
|
||||
const int tipocr = atoi(*_pim_tipocr);
|
||||
codiva = *_pim_codiva;
|
||||
reg = *_pim_codreg;
|
||||
look_iva(codiva); look_reg(reg);
|
||||
tiva = _iva->get("S1");
|
||||
const TCodiceIVA & civa = cached_codIVA(codiva);
|
||||
|
||||
look_reg(reg);
|
||||
tiva = civa.tipo();
|
||||
|
||||
const TRegistro & reg = cached_registro(_reg->curr());
|
||||
const tipo_sospensione simp = reg.sospensione();
|
||||
@ -4573,7 +4580,7 @@ void TLiquidazione_app::recalc_annual(const char* att, bool & first)
|
||||
_CorrItem& ca = (_CorrItem&)corr_ann[codiva];
|
||||
ca._totale += _pim->get_real("R3");
|
||||
if (!is_key) // se non c'e' lo aggiunge
|
||||
ca._aliquota = _iva->get_real("R0") / CENTO; // Se è nuovo setta l'aliquota
|
||||
ca._aliquota = civa.moltiplicatore_percentuale(); // Se è nuovo setta l'aliquota
|
||||
}
|
||||
if (tipoatt == 1)
|
||||
volaff1 += imp_ifs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user