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
230
cg/cg4301.cpp
230
cg/cg4301.cpp
@ -7,6 +7,7 @@
|
|||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include <utility.h>
|
||||||
#include "cg4300.h"
|
#include "cg4300.h"
|
||||||
|
|
||||||
// -------------------- QUI comincia l'avventura --------------------------
|
// -------------------- QUI comincia l'avventura --------------------------
|
||||||
@ -321,10 +322,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
real corr_misCEE = 0.0;
|
real corr_misCEE = 0.0;
|
||||||
real acq_misCEE = 0.0;
|
real acq_misCEE = 0.0;
|
||||||
real acq_misnoCEE = 0.0;
|
real acq_misnoCEE = 0.0;
|
||||||
real agr_ven = 0.0;
|
real agr_1 = 0.0;
|
||||||
real agr_acq = 0.0;
|
real agr_2 = 0.0;
|
||||||
real agr_conf = 0.0;
|
real agr_3 = 0.0;
|
||||||
real agr_acc = 0.0;
|
real agr_4 = 0.0;
|
||||||
|
real agr_5 = 0.0;
|
||||||
|
real agr_6 = 0.0;
|
||||||
real for_rimb = 0.0;
|
real for_rimb = 0.0;
|
||||||
real acq_ies = 0.0;
|
real acq_ies = 0.0;
|
||||||
real acq_ies_iva = 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 sreg = !isreg;
|
||||||
const bool rs8 = _reg_r->get("S8") != trueatt;
|
const bool rs8 = _reg_r->get("S8") != trueatt;
|
||||||
const bool cmt = !_cur->is_first_match(LF_RMOVIVA);
|
const bool cmt = !_cur->is_first_match(LF_RMOVIVA);
|
||||||
|
const TRectype& rcs = _cur->curr(LF_CAUSALI);
|
||||||
|
|
||||||
if (dok || sreg || rs8 || cmt) continue;
|
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
|
* Fatture in ritardo vengono considerate solo in dichiarazione
|
||||||
* annuale
|
* annuale
|
||||||
*/
|
*/
|
||||||
if (!_isannual && _cur->curr(LF_CAUSALI).get_bool("RITFATT"))
|
if (month != 13 && rcs.get_bool("RITFATT"))
|
||||||
continue;
|
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 (_comp_acconto && date.month() != 12 && date.day() > 20)
|
||||||
if(date.month() != 12 && date.day() > 20)
|
continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
bool corrisp = _reg_r->get_bool("B0");
|
bool corrisp = _reg_r->get_bool("B0");
|
||||||
tiporeg tipomov = (tiporeg)_reg_r->get_long("I0");
|
tiporeg tipomov = (tiporeg)_reg_r->get_long("I0");
|
||||||
@ -424,6 +427,18 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
*/
|
*/
|
||||||
if(rigaimp > 9) continue;
|
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
|
// casi particolari
|
||||||
// *****************************************
|
// *****************************************
|
||||||
@ -523,7 +538,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// plafond
|
// plafond
|
||||||
if (_isplafond && tipomov == acquisto && !_isannual &&
|
if (_isplafond && tipomov == acquisto && month != 13 &&
|
||||||
tipoiva == "NI" && tipopla != 0)
|
tipoiva == "NI" && tipopla != 0)
|
||||||
{
|
{
|
||||||
add_plafond(month, codatt, tipopla, imponibile, tipodoc == "BD");
|
add_plafond(month, codatt, tipopla, imponibile, tipodoc == "BD");
|
||||||
@ -547,16 +562,37 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_isagricolo)
|
if (_isagricolo)
|
||||||
switch(tipoagr)
|
{
|
||||||
|
/*
|
||||||
|
* 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 (tipoagr == 1 && tipoagr == 3)
|
||||||
if (tipomov == acquisto) agr_acq += imposta;
|
agr_1 += imposta;
|
||||||
else agr_ven += imposta;
|
else if (tipoagr == 2)
|
||||||
break;
|
agr_2 += imposta;
|
||||||
case 2: if (tipomov == vendita) agr_conf += imposta; break;
|
|
||||||
case 3: if (tipomov == vendita) agr_acc += imposta; break;
|
|
||||||
}
|
}
|
||||||
|
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
|
if (tipodet == 1) // acquisti indeducibili su ricavi esenti art. 10
|
||||||
{
|
{
|
||||||
acq_ies += imponibile;
|
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
|
// 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;
|
real prorata;
|
||||||
if (!_prorata.is_zero())
|
if (!_prorata.is_zero() && month != 13)
|
||||||
{
|
{
|
||||||
prorata = acquisti_iva * (_prorata / CENTO);
|
prorata = acquisti_iva * (_prorata / CENTO);
|
||||||
prorata.round(ROUND_LIRA);
|
prorata.round(ROUND_LIRA);
|
||||||
|
acquisti_iva -= prorata;
|
||||||
}
|
}
|
||||||
look_plm(month, codatt, TRUE);
|
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("R9", corr_misCEE);
|
||||||
_plm->put("R10",acq_misCEE);
|
_plm->put("R10",acq_misCEE);
|
||||||
_plm->put("R11",acq_misnoCEE);
|
_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)
|
else if (_isagricolo)
|
||||||
{
|
{
|
||||||
_plm->put("R5", agr_ven);
|
_plm->put("R5", agr_1);
|
||||||
_plm->put("R6", agr_conf);
|
_plm->put("R6", agr_2);
|
||||||
_plm->put("R7", agr_acc);
|
_plm->put("R7", agr_3);
|
||||||
_plm->put("R8", agr_acq);
|
_plm->put("R8", agr_4);
|
||||||
|
_plm->put("R9", agr_5);
|
||||||
|
_plm->put("R10", agr_6);
|
||||||
|
|
||||||
// Il porco agricoltore spende poco e paga meno
|
// Il porco agricoltore spende poco e paga meno
|
||||||
acquisti_iva -= (agr_acq + leasing_iva + ammort_iva + ammort_6_iva);
|
vendite_iva = agr_2;
|
||||||
vendite_iva -= (agr_ven + agr_conf + agr_acc);
|
acquisti_iva = agr_3 - agr_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// COSA MI TOCCA FARE (per campare, of course)
|
// COSA MI TOCCA FARE (per campare, of course)
|
||||||
@ -855,73 +900,106 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
real deb_mens(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)
|
while ((tmpatt = atts.get()) != NULL)
|
||||||
{
|
{
|
||||||
TString att(tmpatt);
|
TString att(tmpatt);
|
||||||
|
|
||||||
for (int m = 1; m <= 12; m++)
|
if (_isdifferita && is_first_month(month))
|
||||||
{
|
{
|
||||||
// ciclo su tutti i mesi del caso (1 o 3)
|
// usa i totali del mese di dicembre dell'anno
|
||||||
// non porta via tempo anche cosi'
|
// precedente
|
||||||
if (!_isannual && !is_month_ok(m, month))
|
differita = TRUE;
|
||||||
continue;
|
TString yr(_year);
|
||||||
|
_year = format("%d", atoi(_year)-1);
|
||||||
|
if (!look_lim(12))
|
||||||
|
{
|
||||||
|
_year = yr;
|
||||||
|
differita = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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);
|
look_plm(month, att); look_ptm(month,att);
|
||||||
// a debito: IVA vendite, debito precedente, Prorata
|
// gia' conteggiato: prorata
|
||||||
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
// da conteggiare: IVA vendite ag. viaggio
|
||||||
risultato += (_plm->get_real("R0") - _plm->get_real("R1") +
|
// a debito: IVA vendite, debito precedente
|
||||||
_plm->get_real("R2") - _plm->get_real("R3") -
|
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
||||||
_plm->get_real("R4"));
|
risultato += (_plm->get_real("R0") - _plm->get_real("R1") -
|
||||||
detrazioni+= (_plm->get_real("R3") + _plm->get_real("R4"));
|
_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)
|
if (_isviaggio)
|
||||||
{
|
{
|
||||||
// somma totali per calcolo successivo
|
// calcolo credito costo, debito mensile, perc. ripart.
|
||||||
c_iCEE += _plm->get_real("R5");
|
perc_r = (a_mCEE * CENTO)/(a_mCEE + a_meCEE);
|
||||||
c_eCEE += _plm->get_real("R6");
|
real c = (c_mCEE * perc_r)/CENTO; c.round(ROUND_LIRA);
|
||||||
a_iCEE += _plm->get_real("R7");
|
real tc = (c_iCEE + c);
|
||||||
a_eCEE += _plm->get_real("R8");
|
real ta = (a_iCEE + a_mCEE);
|
||||||
c_mCEE += _plm->get_real("R9");
|
real bi = tc - ta - credito_costo_prec(month);
|
||||||
a_mCEE += _plm->get_real("R10");
|
|
||||||
a_meCEE += _plm->get_real("R11");
|
|
||||||
}
|
|
||||||
} // fine ciclo sul mese
|
|
||||||
|
|
||||||
// toglie credito precedente considerando rimborsi
|
if (bi.sign() < 0)
|
||||||
// e acconto versato e rettifiche, come da manuale
|
// credito di costo
|
||||||
risultato -= credito_prec(month);
|
{
|
||||||
// vedi se c'era un debito precedente per debiti < 50.000
|
cred_cost = abs(bi);
|
||||||
risultato += debt_prec(month);
|
cred_cost.round(ROUND_LIRA);
|
||||||
|
}
|
||||||
if (_isviaggio)
|
else
|
||||||
{
|
{
|
||||||
// calcolo credito costo, debito mensile, perc. ripart.
|
deb_mens = (bi /((CENTO + aliquota_agvia())/CENTO)) *
|
||||||
perc_r = (a_mCEE * CENTO)/(a_mCEE + a_meCEE);
|
(aliquota_agvia()/CENTO);
|
||||||
real c = (c_mCEE * perc_r)/CENTO; c.round(ROUND_LIRA);
|
deb_mens.round(ROUND_LIRA);
|
||||||
real tc = (c_iCEE + c);
|
risultato += deb_mens;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
look_lim(month,TRUE);
|
look_lim(month,TRUE);
|
||||||
|
|
||||||
_lim->put("R0",risultato);
|
_lim->put("R0",risultato);
|
||||||
_lim->put("R2",cred_cost);
|
_lim->put("R2",cred_cost);
|
||||||
_lim->put("R3",perc_r);
|
_lim->put("R3",deb_mens);
|
||||||
_lim->put("R4",deb_mens);
|
_lim->put("R4",perc_r);
|
||||||
_lim->put("R6",detrazioni);
|
_lim->put("R6",detrazioni);
|
||||||
|
|
||||||
if (_freqviva == "T" && risultato.sign() > 0)
|
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)
|
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
|
// 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 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->_r0 += _plm->get_real("R5"); // vend. reg. agr.
|
||||||
d->_r1 += _plm->get_real("R6"); // vend. per conferimento
|
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->_r3 += _plm->get_real("R8"); // acquisti reg. agr.
|
||||||
d->_r4 += _plm->get_real("R0"); // IVA acquisti rimasta
|
d->_r4 += _plm->get_real("R0"); // IVA acquisti rimasta
|
||||||
d->_r5 += _plm->get_real("R1"); // IVA vendite 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)
|
void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
|
||||||
{
|
{
|
||||||
if (month != 13 && !look_lim(month))
|
if (!look_lim(month)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
_DescrItem* d = new _DescrItem(REGVIA);
|
_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))
|
if (!is_month_ok(mese,month) || !look_plm(mese, codatt))
|
||||||
continue;
|
continue;
|
||||||
@ -290,11 +289,10 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
|
|||||||
d->_r6 += _plm->get_real("R11"); // acquisti misti parte 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)
|
// credito di costo precedente (CHECK annuale)
|
||||||
d->_r8 = credito_costo_prec(_isriepilogo || _isannual ? 12 : mese);
|
d->_r8 = credito_costo_prec(mese);
|
||||||
// calcolera' imposte e crediti solo se e' annuale vera
|
|
||||||
d->_f1 = _isriepilogo && !_isannual;
|
|
||||||
|
|
||||||
_descr_arr.add(d);
|
_descr_arr.add(d);
|
||||||
}
|
}
|
||||||
@ -1372,7 +1370,7 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
|||||||
&up, &den, &tmr);
|
&up, &den, &tmr);
|
||||||
|
|
||||||
// se e' l'annuale non ha senso altro
|
// se e' l'annuale non ha senso altro
|
||||||
// if (d._f1) return;
|
if (d._f1) return;
|
||||||
|
|
||||||
real tma = d._r3 + d._r4;
|
real tma = d._r3 + d._r4;
|
||||||
tmp = d._r3.string(REAL_PICTURE); tmp.ltrim();
|
tmp = d._r3.string(REAL_PICTURE); tmp.ltrim();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user