Errori corretti acconti, ecc.

git-svn-id: svn://10.65.10.50/trunk@1978 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1995-10-18 14:44:50 +00:00
parent f210ec8e9d
commit 4d483384b0
4 changed files with 77 additions and 40 deletions

View File

@ -83,7 +83,7 @@ bool TLiquidazione_app::user_create()
ditta = subj.get_long(2);
char rcl = *(subj.get(3));
_recalc_only = rcl == 'C';
_is_visliq = rcl == 'V';
_is_visliq = rcl == 'V';
// S/s = stampa senza ricalcolo (minuscolo = definitivo)
// L/l = stampa con ricalcolo se necessario (minuscolo = definitivo)
// C = solo ricalcolo
@ -218,7 +218,7 @@ bool TLiquidazione_app::user_create()
if (!look_lia())
{ end_wait(); return FALSE; }
_nditte->zero();
_nditte_r->put("CODDITTA", ditta);
_nditte->read();

View File

@ -153,12 +153,11 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
_isdiffacc = cnf.get_bool("GeLiDi"); //usato per stampa acconto in coda ai registri
_isdifferita = _isdiffacc && _month != 13;
_isintr = !cnf.get_bool("InTrTr") && _freqviva != "M";
bool gest4 = FALSE; //usato alla riga 342 per stampa acconto
if (_isbenzinaro)
gest4 = cnf.get_bool("GesT74");
_gest4 = cnf.get_bool("GesT74");
// controlla che il periodo corrente non sia l'inizio dell'attivita'
// nel caso, differita va a FALSE
_monthinatt = 1;
_monthinatt = 1;
TDate inatt(_nditte->lfile().get("DINIZIOATT"));
if (is_in_liq_period(inatt)) _isdifferita = FALSE;
if (inatt.year() == atoi(_year)) _monthinatt = inatt.month();
@ -342,9 +341,9 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
//dell'acconto in coda al resto
if (_isregis && stliq)
if ((month == 12 && _freqviva == "M") ||
(month == 12 && _isbenzinaro && gest4) ||
(month == 12 && _isbenzinaro && _gest4) ||
(_isannual && _freqviva == "T" && !_isbenzinaro) ||
(_isannual && _isbenzinaro && !gest4))
(_isannual && _isbenzinaro && !_gest4))
describe_liqacc();
}
return ok || calc;
@ -1633,8 +1632,12 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
/*
* acconto dicembre se previsto
*/
if ((month == 12 && _isbenzinaro) ||
(month >= 12 && _freqviva == "M"))
//if ((month == 12 && _isbenzinaro) ||
// (month >= 12 && _freqviva == "M"))
if ((month >= 12 && _freqviva == "M") ||
(month == 12 && _isbenzinaro && _gest4) ||
(_isannual && _freqviva == "T" && !_isbenzinaro) ||
(_isannual && _isbenzinaro && !_gest4))
{
risultato -= versamenti_IVA(12,"7");
acc_dec = versamenti_IVA(12,"7");
@ -1670,7 +1673,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
* Ora gestito esplicitamente nei parametri ditta, forzato
* FALSE per ditte mensili e liq. annuale
*/
if (_isintr && month < 13)
//if (_isintr && month < 13)
if ((_isintr && ((month != 12 || (_isbenzinaro && !_gest4)))))
{
real interesse = interesse_trimestrale(_month);
real ivi = risultato * (interesse / CENTO);
@ -1679,7 +1683,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
}
// questo serve anche per la visualizzazione e per l'estrazione deleghe
if (_isintr && month < 13)
//if (_isintr && month < 13)
if ((_isintr && ((month != 12 || (_isbenzinaro && !_gest4)))))
_lim->put("R10",interesse_trimestrale(_month));
// totale conguaglio su tutte le attivita'
@ -1696,8 +1701,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
if (!_recalc_only)
_lim->put("B0","X");
if (_isfinal) _lim->put("B1", "X");
_lim->put("B0","X");
if (_isfinal) _lim->put("B1", "X");
if (wasdifferita) _isdifferita = TRUE;

View File

@ -835,7 +835,18 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
}
return d;
*/
if (!look_del(month,1) && !look_del(month,7)) return NULL;
bool stampa_vers = FALSE;
if (_lim->get_real("R0") > ZERO)
{
real iva = _lim->get_real("R0") + _lim->get_real("R14");
if (_isannual) iva.round(ROUND_MILLELIRE);
if (iva >= IVA_DA_RIPORTARE)
stampa_vers = TRUE;
}
if (_freqviva == "T" && _isannual) month = 12;
if (!look_del(month,1) && !look_del(month,7) && !stampa_vers) return NULL;
_DescrItem* d = new _DescrItem(DELEGA);
@ -851,22 +862,24 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
d->_d0 = _del->get_date("D0");
} // altrimenti lascia tutto in bianco e ci scriveranno i dati a mano
}
if (look_del(month,7))
{
d->_s4 = "ACC";
TToken_string t;
if (_del->get_bool("B0"))
if (_freqviva == "M" ||
(_freqviva == "T" && _isannual))
if (look_del(month,7))
{
t.add(_del->get("S2"));
t.add(_del->get("S1"));
t.add(_del->get("S7"));
t.add(_del->get("S8"));
t.add(_del->get_real("R0").string());
t.add(_del->get("D0"));
}
d->_s5 = t;
}
d->_s4 = "ACC";
TToken_string t;
if (_del->get_bool("B0"))
{
t.add(_del->get("S2"));
t.add(_del->get("S1"));
t.add(_del->get("S7"));
t.add(_del->get("S8"));
t.add(_del->get_real("R0").string());
t.add(_del->get("D0"));
}
d->_s5 = t;
}
return d;
}
@ -1406,6 +1419,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
set_row(5,"@11g@bCALCOLO LIQUIDAZIONE D'IMPOSTA@r");
set_row(6,""); int rw = 7;
set_row(rw++," @66gCredito@84gDebito"); set_row(rw++,"");
if (_isannual) iva_vend.round(ROUND_MILLELIRE);
set_row(rw++,"@11gIva sulle operazioni di vendita@75g%r", &iva_vend);
set_row(rw++,"%s@11gRettifiche IVA a debito%s@75g%r",
_is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &rett_debt);
@ -1414,28 +1428,33 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
// conguaglio prorata
if (conguaglio.sign() > 0)
{
set_row(rw++,"@11gConguaglio pro-rata@75g%r", &conguaglio);
}
// debito liq. precedente < 50000
if (debt_prec > ZERO)
set_row(rw++,"@11gDebito da liquidazione precedente@75g%r", &debt_prec);
if (_isannual) res_debt.round(ROUND_MILLELIRE);
set_row(rw++,"@11gRISULTATO@75g%r", &res_debt);
if (_isannual) iva_acq.round(ROUND_MILLELIRE);
set_row(rw++,"@11gIva sulle operazioni di acquisto@58g%r", &iva_acq);
if (_isannual) cred_prec.round(ROUND_MILLELIRE);
if (_isannual || d._f1)
set_row(rw++,"@11gCredito inizio anno@58g%r", &cred_prec);
else
set_row(rw++,"@11gCredito precedente@58g%r", &cred_prec);
if (!acc_dec.is_zero())
{
if (_isannual) acc_dec.round(ROUND_MILLELIRE);
set_row(rw++,"%s@11gVersamento acconto dicembre%s@58g%r",
_is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &acc_dec);
}
if (!detrazioni.is_zero())
{
if (_isannual) detrazioni.round(ROUND_MILLELIRE);
set_row(rw++,"@11gUlteriori detrazioni@58g%r", &detrazioni);
}
set_row(rw++,"%s@11gRettifiche IVA a credito%s@58g%r",
_is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &rett_cred);
@ -1458,6 +1477,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
cg = -cg;
set_row(rw++,"@11gConguaglio pro-rata@58g%r", &cg);
}
if (_isannual) res_cred.round(ROUND_MILLELIRE);
set_row(rw++,"@11gRISULTATO@58g%r", &res_cred);
// se non c'e' nulla da versare stampa solo una riga vuota

View File

@ -444,7 +444,7 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
case tt:
case tm:
// base calcolo: 13a anno precedente. Rideterm. per eventuale acconto
if (!look_lim(12)) error = 2; // TBC sara' 13a davvero? Secondo me e' 12
if (!look_lim(13)) error = 2; // TBC sara' 13a davvero? Secondo me e' 12
else
{
bc += _lim->get_real("R0");
@ -520,18 +520,15 @@ else if (_basecalc == incorso)
// calcola l'acconto
if (look_lim(12)) //posiziona anche la tabella lam
{
// TBC trimestrali, differite
//bc = result_liq(12);
// bc = result_liq(12);
// somma i non fatturati/non annotati
//bc += inf + ina;
// bc += inf + ina;
cre = _lim->get_real("R12");
//quando calcolo la 12° ci vado a sommare il
//versa. dovuto all'acconto
//allora devo ricalcolarmi l'effettivo credito
cre -= _lim->get_real("R11");
//bc -= _lim->get_real("R11");
deb = _lim->get_real("R13") + inf + ina;
bc = deb - cre;
@ -581,6 +578,16 @@ else error = 1;
for (int i = 1; i <= _month; i++)
if (is_month_plain(i))
update_firm(i);
//18/10/1995
_lim->put("B0","");
_lim->rewrite();
if (look_lim(13))
{
_lim->put("B0","");
_lim->rewrite();
}
//fine
_isprint = TRUE;
}
@ -589,7 +596,11 @@ if (look_lia())
{
TConfig cnf(CONFIG_DITTA, "cg");
isdifferita = cnf.get_bool("GeLiDi");
if (isdifferita && _basecalc == incorso) acc *= real(double(2/3));
if (isdifferita && _basecalc == incorso)
{
acc *= real(2.0);
acc /= real(3.0);
}
_lia->put("R4",acc);
_lia->put("R7",iva_ven);
_lia->put("R8",iva_acq);