Skudler-konformance
git-svn-id: svn://10.65.10.50/trunk@890 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
822f8633bc
commit
bd49ded02c
246
cg/cg4301.cpp
246
cg/cg4301.cpp
@ -7,6 +7,7 @@
|
||||
#include <progind.h>
|
||||
#include <sheet.h>
|
||||
#include <config.h>
|
||||
#include <utility.h>
|
||||
#include "cg4300.h"
|
||||
|
||||
// -------------------- QUI comincia l'avventura --------------------------
|
||||
@ -321,10 +322,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
real corr_misCEE = 0.0;
|
||||
real acq_misCEE = 0.0;
|
||||
real acq_misnoCEE = 0.0;
|
||||
real agr_ven = 0.0;
|
||||
real agr_acq = 0.0;
|
||||
real agr_conf = 0.0;
|
||||
real agr_acc = 0.0;
|
||||
real agr_1 = 0.0;
|
||||
real agr_2 = 0.0;
|
||||
real agr_3 = 0.0;
|
||||
real agr_4 = 0.0;
|
||||
real agr_5 = 0.0;
|
||||
real agr_6 = 0.0;
|
||||
real for_rimb = 0.0;
|
||||
real acq_ies = 0.0;
|
||||
real acq_ies_iva = 0.0;
|
||||
@ -353,6 +356,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
const bool sreg = !isreg;
|
||||
const bool rs8 = _reg_r->get("S8") != trueatt;
|
||||
const bool cmt = !_cur->is_first_match(LF_RMOVIVA);
|
||||
const TRectype& rcs = _cur->curr(LF_CAUSALI);
|
||||
|
||||
if (dok || sreg || rs8 || cmt) continue;
|
||||
|
||||
@ -373,15 +377,14 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
* Fatture in ritardo vengono considerate solo in dichiarazione
|
||||
* annuale
|
||||
*/
|
||||
if (!_isannual && _cur->curr(LF_CAUSALI).get_bool("RITFATT"))
|
||||
if (month != 13 && rcs.get_bool("RITFATT"))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* check date se si calcola l'acconto
|
||||
* check date: se si calcola l'acconto, solo da 1/12 a 20/12
|
||||
*/
|
||||
if (_comp_acconto)
|
||||
if(date.month() != 12 && date.day() > 20)
|
||||
continue;
|
||||
if (_comp_acconto && date.month() != 12 && date.day() > 20)
|
||||
continue;
|
||||
|
||||
bool corrisp = _reg_r->get_bool("B0");
|
||||
tiporeg tipomov = (tiporeg)_reg_r->get_long("I0");
|
||||
@ -423,6 +426,18 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
* considerano (Scudler 1994)
|
||||
*/
|
||||
if(rigaimp > 9) continue;
|
||||
|
||||
/*
|
||||
* In liq. annuale si totalizzano nelle vendite
|
||||
* solo le stranezze che seguono
|
||||
*/
|
||||
if (month == 13 && tipomov == vendita &&
|
||||
(!rcs.get_bool("AUTOFATT") && tipoiva != "NS"))
|
||||
{
|
||||
if (tipodoc == "AF" ||
|
||||
(!rcs.get_bool("INTRACOM") && !rcs.get_bool("VALINTRA")))
|
||||
continue;
|
||||
}
|
||||
|
||||
// *****************************************
|
||||
// casi particolari
|
||||
@ -523,7 +538,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
}
|
||||
|
||||
// plafond
|
||||
if (_isplafond && tipomov == acquisto && !_isannual &&
|
||||
if (_isplafond && tipomov == acquisto && month != 13 &&
|
||||
tipoiva == "NI" && tipopla != 0)
|
||||
{
|
||||
add_plafond(month, codatt, tipopla, imponibile, tipodoc == "BD");
|
||||
@ -546,17 +561,38 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
case 5: acq_misnoCEE += imponibile; break;
|
||||
}
|
||||
|
||||
if (_isagricolo)
|
||||
switch(tipoagr)
|
||||
if (_isagricolo)
|
||||
{
|
||||
/*
|
||||
* rifatto sensu Scudler 1995 con invidiabile sicurezza
|
||||
* senza porsi domande e mettendo NUMERI uguali
|
||||
* al TIPO RECORD del frigorifero
|
||||
*/
|
||||
if (tipomov == vendita)
|
||||
{
|
||||
case 1:
|
||||
if (tipomov == acquisto) agr_acq += imposta;
|
||||
else agr_ven += imposta;
|
||||
break;
|
||||
case 2: if (tipomov == vendita) agr_conf += imposta; break;
|
||||
case 3: if (tipomov == vendita) agr_acc += imposta; break;
|
||||
if (tipoagr == 1 && tipoagr == 3)
|
||||
agr_1 += imposta;
|
||||
else if (tipoagr == 2)
|
||||
agr_2 += imposta;
|
||||
}
|
||||
|
||||
else if (tipodet == 0)
|
||||
{
|
||||
if (tipoagr == 2)
|
||||
{
|
||||
if (tipocr != 2 && tipocr != 3 && tipocr != 8)
|
||||
agr_3 += imposta;
|
||||
else
|
||||
agr_4 += imposta;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tipocr != 2 && tipocr != 3 && tipocr != 8)
|
||||
agr_5 += imposta;
|
||||
else
|
||||
agr_6 += imposta;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tipodet == 1) // acquisti indeducibili su ricavi esenti art. 10
|
||||
{
|
||||
acq_ies += imponibile;
|
||||
@ -734,16 +770,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
}
|
||||
|
||||
// calcolati tutti i movimenti e aggiornati i pim
|
||||
// salviamo i totali antes que seja tarde
|
||||
|
||||
/*
|
||||
* calcola il lercio prorata
|
||||
* calcola il lercio prorata
|
||||
* solo se liq. periodica
|
||||
*/
|
||||
real prorata;
|
||||
if (!_prorata.is_zero())
|
||||
if (!_prorata.is_zero() && month != 13)
|
||||
{
|
||||
prorata = acquisti_iva * (_prorata / CENTO);
|
||||
prorata.round(ROUND_LIRA);
|
||||
prorata.round(ROUND_LIRA);
|
||||
acquisti_iva -= prorata;
|
||||
}
|
||||
look_plm(month, codatt, TRUE);
|
||||
|
||||
@ -768,17 +805,25 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
_plm->put("R9", corr_misCEE);
|
||||
_plm->put("R10",acq_misCEE);
|
||||
_plm->put("R11",acq_misnoCEE);
|
||||
|
||||
// ---- NOTA BENE ------------------------
|
||||
// l'iva vendite nei plm non comprende
|
||||
// l'iva agenzie di viaggio, calcolata
|
||||
// in liquidazione (mensile o trimestrale)
|
||||
// ---------------------------------------
|
||||
}
|
||||
else if (_isagricolo)
|
||||
{
|
||||
_plm->put("R5", agr_ven);
|
||||
_plm->put("R6", agr_conf);
|
||||
_plm->put("R7", agr_acc);
|
||||
_plm->put("R8", agr_acq);
|
||||
_plm->put("R5", agr_1);
|
||||
_plm->put("R6", agr_2);
|
||||
_plm->put("R7", agr_3);
|
||||
_plm->put("R8", agr_4);
|
||||
_plm->put("R9", agr_5);
|
||||
_plm->put("R10", agr_6);
|
||||
|
||||
// Il porco agricoltore spende poco e paga meno
|
||||
acquisti_iva -= (agr_acq + leasing_iva + ammort_iva + ammort_6_iva);
|
||||
vendite_iva -= (agr_ven + agr_conf + agr_acc);
|
||||
vendite_iva = agr_2;
|
||||
acquisti_iva = agr_3 - agr_4;
|
||||
}
|
||||
|
||||
// COSA MI TOCCA FARE (per campare, of course)
|
||||
@ -853,75 +898,108 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
real a_meCEE(0.0);
|
||||
real cred_cost(0.0);
|
||||
real deb_mens(0.0);
|
||||
real perc_r(0.0);
|
||||
real perc_r(0.0);
|
||||
|
||||
bool differita = FALSE;
|
||||
|
||||
while ((tmpatt = atts.get()) != NULL)
|
||||
{
|
||||
TString att(tmpatt);
|
||||
|
||||
for (int m = 1; m <= 12; m++)
|
||||
{
|
||||
// ciclo su tutti i mesi del caso (1 o 3)
|
||||
// non porta via tempo anche cosi'
|
||||
if (!_isannual && !is_month_ok(m, month))
|
||||
continue;
|
||||
|
||||
look_plm(month, att); look_ptm(month,att);
|
||||
// a debito: IVA vendite, debito precedente, Prorata
|
||||
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
||||
risultato += (_plm->get_real("R0") - _plm->get_real("R1") +
|
||||
_plm->get_real("R2") - _plm->get_real("R3") -
|
||||
_plm->get_real("R4"));
|
||||
detrazioni+= (_plm->get_real("R3") + _plm->get_real("R4"));
|
||||
|
||||
if (_isviaggio)
|
||||
{
|
||||
// somma totali per calcolo successivo
|
||||
c_iCEE += _plm->get_real("R5");
|
||||
c_eCEE += _plm->get_real("R6");
|
||||
a_iCEE += _plm->get_real("R7");
|
||||
a_eCEE += _plm->get_real("R8");
|
||||
c_mCEE += _plm->get_real("R9");
|
||||
a_mCEE += _plm->get_real("R10");
|
||||
a_meCEE += _plm->get_real("R11");
|
||||
}
|
||||
} // fine ciclo sul mese
|
||||
|
||||
// toglie credito precedente considerando rimborsi
|
||||
// e acconto versato e rettifiche, come da manuale
|
||||
risultato -= credito_prec(month);
|
||||
// vedi se c'era un debito precedente per debiti < 50.000
|
||||
risultato += debt_prec(month);
|
||||
|
||||
if (_isviaggio)
|
||||
if (_isdifferita && is_first_month(month))
|
||||
{
|
||||
// calcolo credito costo, debito mensile, perc. ripart.
|
||||
perc_r = (a_mCEE * CENTO)/(a_mCEE + a_meCEE);
|
||||
real c = (c_mCEE * perc_r)/CENTO; c.round(ROUND_LIRA);
|
||||
real tc = (c_iCEE + c);
|
||||
real ta = (a_iCEE + a_mCEE);
|
||||
real bi = tc - ta - credito_costo_prec(month);
|
||||
|
||||
if (bi.sign() < 0)
|
||||
// credito di costo
|
||||
{
|
||||
cred_cost = abs(bi);
|
||||
cred_cost.round(ROUND_LIRA);
|
||||
// usa i totali del mese di dicembre dell'anno
|
||||
// precedente
|
||||
differita = TRUE;
|
||||
TString yr(_year);
|
||||
_year = format("%d", atoi(_year)-1);
|
||||
if (!look_lim(12))
|
||||
{
|
||||
_year = yr;
|
||||
differita = FALSE;
|
||||
}
|
||||
else
|
||||
}
|
||||
if (differita)
|
||||
{
|
||||
risultato = result_liq(12);
|
||||
deb_mens = _lim->get_real("R3");
|
||||
detrazioni= _lim->get_real("R6");
|
||||
perc_r = _lim->get_real("R4");
|
||||
cred_cost = _lim->get_real("R2");
|
||||
_year = format("%d", atoi(_year)+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int m = 1; m <= 12; m++)
|
||||
{
|
||||
// ciclo su tutti i mesi del caso (1 o 3)
|
||||
// non porta via tempo anche cosi'
|
||||
if (!_isannual && !is_month_ok(m, month))
|
||||
continue;
|
||||
|
||||
look_plm(month, att); look_ptm(month,att);
|
||||
// gia' conteggiato: prorata
|
||||
// da conteggiare: IVA vendite ag. viaggio
|
||||
// a debito: IVA vendite, debito precedente
|
||||
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
||||
risultato += (_plm->get_real("R0") - _plm->get_real("R1") -
|
||||
_plm->get_real("R3") - _plm->get_real("R4"));
|
||||
detrazioni+= (_plm->get_real("R3") + _plm->get_real("R4"));
|
||||
|
||||
if (_isviaggio)
|
||||
{
|
||||
// somma totali per calcolo successivo
|
||||
c_iCEE += _plm->get_real("R5");
|
||||
c_eCEE += _plm->get_real("R6");
|
||||
a_iCEE += _plm->get_real("R7");
|
||||
a_eCEE += _plm->get_real("R8");
|
||||
c_mCEE += _plm->get_real("R9");
|
||||
a_mCEE += _plm->get_real("R10");
|
||||
a_meCEE += _plm->get_real("R11");
|
||||
}
|
||||
} // fine ciclo sul mese
|
||||
}
|
||||
|
||||
if (!(_isdifferita && is_first_month(month)))
|
||||
{
|
||||
// toglie credito precedente considerando rimborsi
|
||||
// e acconto versato e rettifiche, come da manuale
|
||||
risultato -= credito_prec(month);
|
||||
// vedi se c'era un debito precedente per debiti < 50.000
|
||||
risultato += debt_prec(month);
|
||||
|
||||
if (_isviaggio)
|
||||
{
|
||||
deb_mens = (bi /((CENTO + aliquota_agvia())/CENTO)) *
|
||||
(aliquota_agvia()/CENTO);
|
||||
deb_mens.round(ROUND_LIRA);
|
||||
// calcolo credito costo, debito mensile, perc. ripart.
|
||||
perc_r = (a_mCEE * CENTO)/(a_mCEE + a_meCEE);
|
||||
real c = (c_mCEE * perc_r)/CENTO; c.round(ROUND_LIRA);
|
||||
real tc = (c_iCEE + c);
|
||||
real ta = (a_iCEE + a_mCEE);
|
||||
real bi = tc - ta - credito_costo_prec(month);
|
||||
|
||||
if (bi.sign() < 0)
|
||||
// credito di costo
|
||||
{
|
||||
cred_cost = abs(bi);
|
||||
cred_cost.round(ROUND_LIRA);
|
||||
}
|
||||
else
|
||||
{
|
||||
deb_mens = (bi /((CENTO + aliquota_agvia())/CENTO)) *
|
||||
(aliquota_agvia()/CENTO);
|
||||
deb_mens.round(ROUND_LIRA);
|
||||
risultato += deb_mens;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
look_lim(month,TRUE);
|
||||
|
||||
_lim->put("R0",risultato);
|
||||
_lim->put("R2",cred_cost);
|
||||
_lim->put("R3",perc_r);
|
||||
_lim->put("R4",deb_mens);
|
||||
_lim->put("R3",deb_mens);
|
||||
_lim->put("R4",perc_r);
|
||||
_lim->put("R6",detrazioni);
|
||||
|
||||
if (_freqviva == "T" && risultato.sign() > 0)
|
||||
|
@ -62,13 +62,16 @@ bool TLiquidazione_app::check_month(int m, int m2)
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::is_date_ok(TDate& d, int month)
|
||||
// TRUE se la data passata va considerata nel
|
||||
// TRUE se la data (di mov o pim) passata va considerata nel
|
||||
// ricalcolo dei progressivi mensili per il mese e anno
|
||||
// selezionati
|
||||
// selezionati; se month == 13 vanno bene tutte purche'
|
||||
// sia giusto l'anno
|
||||
{
|
||||
if (d.month() > month || d.year() != atoi(_year))
|
||||
if (month == 13)
|
||||
return month < 13 && d.year() == atoi(_year);
|
||||
else if (d.month() > month || d.year() != atoi(_year))
|
||||
return FALSE;
|
||||
return d.month() == month;
|
||||
else return d.month() == month;
|
||||
}
|
||||
|
||||
|
||||
|
@ -259,7 +259,7 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
|
||||
|
||||
d->_r0 += _plm->get_real("R5"); // vend. reg. agr.
|
||||
d->_r1 += _plm->get_real("R6"); // vend. per conferimento
|
||||
d->_r2 += _plm->get_real("R7"); // vend. accessorie
|
||||
// d->_r2 += _plm->get_real("R7"); // vend. accessorie
|
||||
d->_r3 += _plm->get_real("R8"); // acquisti reg. agr.
|
||||
d->_r4 += _plm->get_real("R0"); // IVA acquisti rimasta
|
||||
d->_r5 += _plm->get_real("R1"); // IVA vendite rimasta
|
||||
@ -271,12 +271,11 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
|
||||
|
||||
void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
|
||||
{
|
||||
if (month != 13 && !look_lim(month))
|
||||
return;
|
||||
if (!look_lim(month)) return;
|
||||
|
||||
_DescrItem* d = new _DescrItem(REGVIA);
|
||||
|
||||
for (int mese = 1; mese <= month && mese < 13; mese++)
|
||||
for (int mese = 1; mese <= month; mese++)
|
||||
{
|
||||
if (!is_month_ok(mese,month) || !look_plm(mese, codatt))
|
||||
continue;
|
||||
@ -288,13 +287,12 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
|
||||
d->_r4 += _plm->get_real("R10"); // acquisti misti parte CEE
|
||||
d->_r5 += _plm->get_real("R8"); // acquisti fuori CEE
|
||||
d->_r6 += _plm->get_real("R11"); // acquisti misti parte fuori CEE
|
||||
}
|
||||
|
||||
d->_r7 = _lim->get_real("R4"); // perc. ripartizione
|
||||
}
|
||||
|
||||
// percentuale ripartizione
|
||||
d->_r7 = _lim->get_real("R4");
|
||||
// credito di costo precedente (CHECK annuale)
|
||||
d->_r8 = credito_costo_prec(_isriepilogo || _isannual ? 12 : mese);
|
||||
// calcolera' imposte e crediti solo se e' annuale vera
|
||||
d->_f1 = _isriepilogo && !_isannual;
|
||||
d->_r8 = credito_costo_prec(mese);
|
||||
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
@ -1372,7 +1370,7 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
||||
&up, &den, &tmr);
|
||||
|
||||
// se e' l'annuale non ha senso altro
|
||||
// if (d._f1) return;
|
||||
if (d._f1) return;
|
||||
|
||||
real tma = d._r3 + d._r4;
|
||||
tmp = d._r3.string(REAL_PICTURE); tmp.ltrim();
|
||||
|
Loading…
x
Reference in New Issue
Block a user