Patch level : 12.0 302

Files correlati     :  cg4.exe
Commento            :

Ora i cespiti ammortizzabili non vengono più esclusi dalla liquidazione IVA.
Aggiunta di nuovo la funzione che estraeva un record di pagamento per l'F24 dalla liquidazione.

git-svn-id: svn://10.65.10.50/branches/R_10_00@23401 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
bonazzi 2016-11-11 14:30:56 +00:00
parent d536ae654a
commit 407aac8833
4 changed files with 535 additions and 448 deletions

View File

@ -654,12 +654,7 @@ public:
int previous_month (int m) const; int previous_month (int m) const;
/* Funzioni accessorie: estrazione deleghe void extract_f24(int m);
bool set_deleghe();
bool extract_deleghe();
bool extract_delega(int m, TArray& desc);
bool video_conferma(const real&, const real&, const real&, bool to_del = false);
*/
// stampa // stampa
void set_deltab(_DescrItem& d, bool iscred); void set_deltab(_DescrItem& d, bool iscred);

View File

@ -145,15 +145,16 @@ bool TLiquidazione_app::recalc_all()
break; break;
} }
} }
extract_f24(_month);
_month = save_month; _month = save_month;
} }
} }
const bool good = _prind->addstatus(1);
const bool good = _prind->addstatus(1);
TApplication::set_firm(__firm); TApplication::set_firm(__firm);
delete _prind; _prind = NULL;
delete _prind; _prind = NULL;
return good; return good;
} }
@ -1126,7 +1127,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
#ifdef DBG #ifdef DBG
const long nr = _mov->get_long(MOV_NUMREG); const long nr = _mov->get_long(MOV_NUMREG);
if (nr == 23121 || nr == 23112) if (nr == 24894)
int i = 1 ; int i = 1 ;
#endif #endif
@ -2567,11 +2568,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
// E quelli che non hanno la % prorata settata in tabella // E quelli che non hanno la % prorata settata in tabella
real aaa = acquisti_iva; real aaa = acquisti_iva;
// E'una questione molto dibattuta il fatti di escludere i beni ammortizzabili o no:
// Nella versione precedente (10.0) non venivano esclusi, poi dal 4-9-2014 sono stati esclusi ed infine nuovamente ignorati dal 17-2-2015
// Arriviamo al 17-09-2015 (data epica per altri motivi) e torniamo a tenerne conto per Pragma
aaa -= ammort_det_iva; // Scarta gli acquisti di beni ammortizzabili
if (percentuale1 != INVALID_PRORATA && percentuale1 != INVALID_PRORATA_ASSERT) if (percentuale1 != INVALID_PRORATA && percentuale1 != INVALID_PRORATA_ASSERT)
aaa -= rr1 ? *rr1 : ZERO; aaa -= rr1 ? *rr1 : ZERO;
if (percentuale2 != INVALID_PRORATA && percentuale2 != INVALID_PRORATA_ASSERT) if (percentuale2 != INVALID_PRORATA && percentuale2 != INVALID_PRORATA_ASSERT)

View File

@ -1356,6 +1356,7 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
//prospettino acconto //prospettino acconto
if ( (month == 12 && (_freqviva == "M" || (_isbenzinaro && _gest4))) if ( (month == 12 && (_freqviva == "M" || (_isbenzinaro && _gest4)))
|| (month == 13 && _freqviva == "T" && !(_isbenzinaro && _gest4)) ) || (month == 13 && _freqviva == "T" && !(_isbenzinaro && _gest4)) )
{
if (look_del(12,7)) //sia che sia a debito che a credito if (look_del(12,7)) //sia che sia a debito che a credito
{ {
d->_s4 = "ACC"; d->_s4 = "ACC";
@ -1372,7 +1373,7 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
} }
d->_s5 = t; d->_s5 = t;
} }
}
return d; return d;
} }

View File

@ -1,431 +1,526 @@
// cg4305: liquidazione IVA // cg4305: liquidazione IVA
// funzionalita' accessorie (calcolo acconto, estrazione deleghe) // funzionalita' accessorie (calcolo acconto, estrazione deleghe)
#include <currency.h> #include <currency.h>
#include <defmask.h> #include <defmask.h>
#include <recarray.h> #include <recarray.h>
#include <progind.h> #include <progind.h>
#include <prefix.h> #include <prefix.h>
#include <sheet.h> #include <sheet.h>
#include <utility.h> #include <utility.h>
#include <config.h> #include <config.h>
#include <righef24.h> #include <righef24.h>
#include <modaut.h> #include <modaut.h>
#include "cg4300.h" #include "cg4300.h"
#include "cg4300b.h" #include "cg4300b.h"
#include "cg4300c.h" #include "cg4300c.h"
#include "cg4800b.h" #include "cg4800b.h"
// -------------------------------------------- calcolo acconto dicembre void TLiquidazione_app::extract_f24(int month)
bool TLiquidazione_app::set_acconto(real& inf, real& ina) {
{ if (main_app().has_module(GVAUT))
TMask m("cg4300c"); {
bool versare = false;
m.set(CHK_CGC_PRINT,"X"); const TRectype & lim = get_lim(month);
m.field(FLD_CGC_YEAR).set_handler(ch_year_handler);
m.field(FLD_CGC_YEAR).set(_year); if (lim.full())
{
int k = 0; long j; real topay = result_liq(month); // TBC non si puo' fa' accussi'!!!!! pena il casino!
_calcall = FALSE; if (month == 12)
versare = topay > _ver->get(I_ANNUALE);
for (;;) else
{ versare = topay > _ver->get(I_PERIODICO);
if (k == K_ESC || k == K_ENTER || k == K_QUIT)
break; real intr = lim.get_real("R14");
k = m.run(); topay += intr; // lo vogliono registrato con interessi
real nrnd = topay;
_year = m.get(FLD_CGC_YEAR); round_imposta(topay); // importo totale del versamento arrotondato
_isprint = m.get_bool(CHK_CGC_PRINT);
_isbase = m.get_bool(CHK_CGC_BASE); TLocalisamfile f24(LF_RIGHEF24);
_basecalc = (tbc)m.get_long(RDB_CGC_BASE); TTable trib("%TRB");
long progr = 0L;
inf = ina = ZERO; const bool mensile = _freqviva == "M";
const int codtrib = mensile ? 6000 + month : 6031 + (month / 3);
switch (k) TString descr("IVA ANNUALE");
{
case DLG_SELECT: TDate scad(16, (mensile ? month : ((month + 2) / 3) * 3), atoi(_year));
const long codditta = _nditte->lfile().get_long("CODDITTA");
// scegli ditte
_ditte->run(); if (month < 13)
scad.addmonth(mensile ? 1 : 2);
for (j = 0l; j < _ditte->items(); j++) while (scad.wday() > 5)
if (_ditte->checked(j)) _selected.set(j); ++scad;
break; if (month < 13)
case BUT_CGC_ALL: {
_ditte->check(-1); if (mensile)
for (j = 0l; j < _ditte->items(); j++) descr.format("IVA mese di %s %s", itom(month), (const char *)_year);
if (_ditte->checked(j) && !_ditte->row_disabled(j)) else
_selected.set(j); descr.format("IVA %s Trimestre %s", itor(month / 3 + 1), (const char *)_year);
_calcall = TRUE; }
k = K_ENTER; trib.put("CODTAB", codtrib);
break; if (trib.read() == NOERR)
} {
} f24.setkey(4);
return k == K_ENTER; f24.put(F24_TIPOINTEST, "D");
} f24.put(F24_INTEST, codditta);
f24.put(F24_ANNO, _year);
bool TLiquidazione_app::recalc_acconti(real& inf, real& ina) f24.put(F24_TRIBUTO, codtrib);
{ if (f24.read() == NOERR)
TString buf(256); {
if (f24.get(F24_DATAVERS).blank())
bool onemade = FALSE; {
f24.put(F24_IMPORTODEB, topay);
const long firm = TApplication::get_firm(); f24.put(F24_INTIVATRIM, intr);
_prind = new TProgind(_n_ditte, f24.put(F24_DATASCAD, scad);
TR(" Calcolo acconto "
"\n Preparazione archivi " const int err = f24.rewrite();
"\n "),
TRUE,TRUE); if (err != NOERR)
error_box(FR("Ditta %ld\n%s\nerrore %d"), codditta, (const char *) descr, err);
if (_ver->read(atoi(_year),(_month > 12) ? 12 : _month) != NOERR) }
warning_box(FR("Errore %d in lettura tabella versamenti ed interessi."),_ver->status()); }
for (int l = 0; l < _ditte->items(); l++) else
{ {
if (_prind->iscancelled()) f24.setkey(1);
break; if (f24.last() == NOERR)
if ((_calcall || _selected[l]) && !_ditte->row_disabled(l)) progr = f24.get_long(F24_PROGR);
{ progr++;
if (onemade == FALSE && _isprint) f24.zero();
{ f24.put(F24_PROGR, progr);
_DescrItem* d = new _DescrItem(ACCHEAD);
d->_f0 = _basecalc == incorso;
d->_f1 = _isbase; f24.put(F24_TRIBUTO, codtrib);
_descr_arr.add(d); f24.put(F24_TIPOINTEST, "D");
} f24.put(F24_INTEST, codditta);
f24.put(F24_DESCR, descr);
_nditte->curr().zero(); f24.put(F24_DATASCAD, scad);
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1)); f24.put(F24_ANNO, _year);
_nditte->read(); f24.put(F24_IMPORTODEB, topay);
f24.put(F24_INTIVATRIM, intr);
const long ditta = _nditte->curr().get_long("CODDITTA");
TApplication::set_firm(ditta); const int err = f24.write();
TIva_round ir; if (err != NOERR)
ir.set_default_iva_mode(atoi(_year), _month > 12, ditta); error_box(FR("Ditta %ld\n%s\nerrore %d"), codditta, (const char *) descr, err);
}
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74_4"); }
}
const TRectype & lia = get_lia(); }
}
_freqviva = lia.get("S7");
inf = lia.get_real("R13"); // -------------------------------------------- calcolo acconto dicembre
ina = lia.get_real("R14"); bool TLiquidazione_app::set_acconto(real& inf, real& ina)
{
buf.format(FR("Calcolo acconto:\nditta %s"), TMask m("cg4300c");
(const char*)_nditte_r->get("RAGSOC"));
_prind->set_text(buf); m.set(CHK_CGC_PRINT,"X");
recalc_acconto(inf, ina); m.field(FLD_CGC_YEAR).set_handler(ch_year_handler);
onemade = TRUE; m.field(FLD_CGC_YEAR).set(_year);
}
_prind->addstatus(1); int k = 0; long j;
}
_calcall = FALSE;
TApplication::set_firm(firm);
delete _prind; for (;;)
return TRUE; {
} if (k == K_ESC || k == K_ENTER || k == K_QUIT)
break;
bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) k = m.run();
{
real bc = 0.0; _year = m.get(FLD_CGC_YEAR);
real acc = 0.0; _isprint = m.get_bool(CHK_CGC_PRINT);
real cre = 0.0; _isbase = m.get_bool(CHK_CGC_BASE);
real deb = 0.0; _basecalc = (tbc)m.get_long(RDB_CGC_BASE);
real iva_ven = 0.0;
real iva_acq = 0.0; inf = ina = ZERO;
real iva_ret = 0.0;
real iva_rim = 0.0; switch (k)
real ult_det = 0.0; {
real iva_pro = 0.0; case DLG_SELECT:
real cre_pre = 0.0;
real acq_intr = 0.0; // scegli ditte
const bool isdifferita = is_acconto_differito(); // MI3262... _ditte->run();
int error = FALSE;
for (j = 0l; j < _ditte->items(); j++)
TString16 tipo_acc; if (_ditte->checked(j)) _selected.set(j);
// TBI rewrite from scratch break;
// this is absolutely fundamental case BUT_CGC_ALL:
if (_basecalc == precedente) _ditte->check(-1);
{ for (j = 0l; j < _ditte->items(); j++)
// determina casistica if (_ditte->checked(j) && !_ditte->row_disabled(j))
enum { mm, tt, mt, tm, boh } history = boh; _selected.set(j);
real divide_by_three = 1.0; _calcall = TRUE;
const char thh = *_freqviva; k = K_ENTER;
break;
const TString4 thyear = _year; }
_year.format("%d", atoi(_year)-1); }
return k == K_ENTER;
const TRectype & lia = get_lia(); }
if (lia.empty()) bool TLiquidazione_app::recalc_acconti(real& inf, real& ina)
error = 3; {
else TString buf(256);
{
char ohh = lia.get_char("S7"); bool onemade = FALSE;
if (ohh == 'M') history = thh == 'M' ? mm : mt; const long firm = TApplication::get_firm();
if (ohh == 'T') history = thh == 'M' ? tm : tt; _prind = new TProgind(_n_ditte,
if (history == boh) TR(" Calcolo acconto "
{ "\n Preparazione archivi "
_year = thyear; "\n "),
return FALSE; TRUE,TRUE);
}
if (_ver->read(atoi(_year),(_month > 12) ? 12 : _month) != NOERR)
// casino benzinari warning_box(FR("Errore %d in lettura tabella versamenti ed interessi."),_ver->status());
TString attprev = _nditte->curr().get("CODATTPREV"); for (int l = 0; l < _ditte->items(); l++)
long codd = _nditte->curr().get_long("CODDITTA"); {
TString16 key; if (_prind->iscancelled())
break;
key.format("%ld|%s", codd, (const char *) attprev); if ((_calcall || _selected[l]) && !_ditte->row_disabled(l))
{
const TRectype & atts = cache().get(LF_ATTIV, key); if (onemade == FALSE && _isprint)
{
if (atts.get_bool("ART74_4")) // e' proprio un gran benzinaro _DescrItem* d = new _DescrItem(ACCHEAD);
history = lia.get_bool("B4") ? mm : tt; // Was CNF_DITTA->GesT74 d->_f0 = _basecalc == incorso;
d->_f1 = _isbase;
switch (history) _descr_arr.add(d);
{ }
case mm:
{ _nditte->curr().zero();
// base calcolo: 12a anno preced, Rideterminare a seconda dell'acconto _nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
// versato; ris = 88% del debito (0 se credito _nditte->read();
const TRectype & lim = get_lim(12);
const long ditta = _nditte->curr().get_long("CODDITTA");
if (lim.empty()) TApplication::set_firm(ditta);
error = 2;
else TIva_round ir;
{ ir.set_default_iva_mode(atoi(_year), _month > 12, ditta);
bc += lim.get_real("R0");
const real av = lim.get_real("R11"); _isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74_4");
bc += av;
} const TRectype & lia = get_lia();
}
break; _freqviva = lia.get("S7");
case tt: inf = lia.get_real("R13");
case tm: ina = lia.get_real("R14");
{
// base calcolo: 13a anno precedente. Rideterm. per eventuale acconto buf.format(FR("Calcolo acconto:\nditta %s"),
const TRectype & lim = get_lim(13); // TBC sara' 13a davvero? Secondo me e' 12 (const char*)_nditte_r->get("RAGSOC"));
_prind->set_text(buf);
if (lim.empty()) recalc_acconto(inf, ina);
error = 2; onemade = TRUE;
else }
{ extract_f24(_month);
bc += lim.get_real("R0"); _prind->addstatus(1);
const real av = lim.get_real("R11"); }
bc += av;
} TApplication::set_firm(firm);
if (history == tm) delete _prind;
// tm come tt ma si divide per 3 la base di calcolo prima di calcolare l'88% return TRUE;
divide_by_three = 3.0; }
}
break; bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
case mt: {
{ real bc = 0.0;
// basecalcolo: 10, 11, 12 anno prec., 10 e 11 se a debito, 12 vedi acconto; real acc = 0.0;
// sommare e prendi 88% se a debito real cre = 0.0;
const TRectype & lim10 = get_lim(10); real deb = 0.0;
const TRectype & lim11 = get_lim(11); real iva_ven = 0.0;
const TRectype & lim12 = get_lim(12); real iva_acq = 0.0;
real iva_ret = 0.0;
if (lim10.empty()) real iva_rim = 0.0;
error = 2; real ult_det = 0.0;
else real iva_pro = 0.0;
{ real cre_pre = 0.0;
const real app = lim10.get_real("R0"); real acq_intr = 0.0;
const bool isdifferita = is_acconto_differito(); // MI3262...
if (app > ZERO) //a debito int error = FALSE;
bc += app;
} TString16 tipo_acc;
if (lim11.empty())
error = 2; // TBI rewrite from scratch
else // this is absolutely fundamental
{ if (_basecalc == precedente)
const real app = lim11.get_real("R0"); {
if (app > ZERO) //a debito // determina casistica
bc += app; enum { mm, tt, mt, tm, boh } history = boh;
} real divide_by_three = 1.0;
if (lim12.empty()) const char thh = *_freqviva;
error = 2;
else const TString4 thyear = _year;
{ _year.format("%d", atoi(_year)-1);
bc += lim12.get_real("R0");
const real av = lim12.get_real("R11"); const TRectype & lia = get_lia();
bc += av;
} if (lia.empty())
} error = 3;
break; else
} {
char ohh = lia.get_char("S7");
round_imposta(bc);
if (bc > ZERO) //debito if (ohh == 'M') history = thh == 'M' ? mm : mt;
{ if (ohh == 'T') history = thh == 'M' ? tm : tt;
acc = ((bc / divide_by_three) * _ver->get(isdifferita ? B_LIQ_DIFF : B_LIQ_NORM)) / CENTO; if (history == boh)
acc.round(TCurrency::get_firm_dec()); {
} _year = thyear;
tipo_acc = "S"; return FALSE;
} }
_year = thyear;
} // casino benzinari
else TString attprev = _nditte->curr().get("CODATTPREV");
if (_basecalc == incorso) long codd = _nditte->curr().get_long("CODDITTA");
{ TString16 key;
// that's pazzesc but as it turns out there's no better way
_comp_acconto = TRUE; key.format("%ld|%s", codd, (const char *) attprev);
// force recalc of current month
_recalc = one; const TRectype & atts = cache().get(LF_ATTIV, key);
int need_refresh = FALSE;
for (int mese = 1; mese < _month; mese++) if (atts.get_bool("ART74_4")) // e' proprio un gran benzinaro
if (is_month_ok_strict(mese)) history = lia.get_bool("B4") ? mm : tt; // Was CNF_DITTA->GesT74
{
const TRectype & lim = get_lim(mese); switch (history)
{
if (lim.empty() || !lim.get_bool("B0")) case mm:
{ {
need_refresh = true; // base calcolo: 12a anno preced, Rideterminare a seconda dell'acconto
break; // versato; ris = 88% del debito (0 se credito
} const TRectype & lim = get_lim(12);
}
if (need_refresh && yesno_box(FR("Alcuni mesi precedenti non risultano ricalcolati:\n" if (lim.empty())
"è consigliabile il ricalcolo. Si desidera eseguirlo?"))) error = 2;
_recalc = ever; else
{
for (int m = 1; m <= _month; m++) bc += lim.get_real("R0");
if (is_month_plain(m) || _recalc == ever) const real av = lim.get_real("R11");
{ bc += av;
if (_prind->iscancelled()) }
break; }
update_firm(m); break;
} case tt:
case tm:
// calcola l'acconto {
TRectype lim = get_lim(12); // base calcolo: 13a anno precedente. Rideterm. per eventuale acconto
const TRectype & lim = get_lim(13); // TBC sara' 13a davvero? Secondo me e' 12
if (lim.not_empty())
{ if (lim.empty())
cre = lim.get_real("R12"); error = 2;
cre -= lim.get_real("R19"); else
{
deb = lim.get_real("R13") + inf + ina; bc += lim.get_real("R0");
deb -= lim.get_real("R18"); // CM600446 const real av = lim.get_real("R11");
deb -= lim.get_real("R1"); // CM600446 bc += av;
}
if (lim.get_real("R17") > ZERO) if (history == tm)
deb -= lim.get_real("R17"); // tm come tt ma si divide per 3 la base di calcolo prima di calcolare l'88%
else divide_by_three = 3.0;
cre += lim.get_real("R17"); }
break;
bc = deb - cre; case mt:
if (bc > ZERO) {
acc = bc; // basecalcolo: 10, 11, 12 anno prec., 10 e 11 se a debito, 12 vedi acconto;
// sommare e prendi 88% se a debito
look_lam(12); //posiziona anche la tabella lam const TRectype & lim10 = get_lim(10);
const TRectype & lim11 = get_lim(11);
iva_ven = _lam->get_real("R0"); //iva sulle vendite annotate fino al 20/12 const TRectype & lim12 = get_lim(12);
iva_acq = _lam->get_real("R1"); //iva sugli acquisti annotati fino al 20/12
cre_pre = _lam->get_real("R2"); //credito precedente if (lim10.empty())
iva_ret = lim.get_real("R5"); //rettifica error = 2;
iva_rim = lim.get_real("R1"); //iva chiesta a rimborso else
ult_det = lim.get_real("R6"); //ulteriori detrazioni {
//iva_pro: //iva relativa alla percentuale di prorata const real app = lim10.get_real("R0");
TTable plm ("PLM");
plm.zero(); if (app > ZERO) //a debito
plm.put("CODTAB",_year); bc += app;
TRectype rec (plm.curr()); }
plm.read(_isgteq); if (lim11.empty())
for (; !plm.eof(); plm.next()) error = 2;
{ else
if (plm.curr() != rec) break; {
iva_pro += plm.get_real("R2"); const real app = lim11.get_real("R0");
} if (app > ZERO) //a debito
//acq_intr bc += app;
TTable pom ("POM"); }
pom.zero(); if (lim12.empty())
pom.put("CODTAB",_year); error = 2;
rec = pom.curr(); else
pom.read(_isgteq); {
for (; !pom.eof(); pom.next()) bc += lim12.get_real("R0");
{ const real av = lim12.get_real("R11");
if (pom.curr() != rec) break; bc += av;
acq_intr += pom.get_real("R0"); }
} }
tipo_acc = "A"; //flag per dire che si e' utilizzato il metodo analitico break;
//stop }
}
else error = 1; round_imposta(bc);
if (bc > ZERO) //debito
// pulisci il water {
_comp_acconto = FALSE; acc = ((bc / divide_by_three) * _ver->get(isdifferita ? B_LIQ_DIFF : B_LIQ_NORM)) / CENTO;
_isprint = FALSE; acc.round(TCurrency::get_firm_dec());
for (int i = 1; i <= _month; i++) }
if (is_month_plain(i)) tipo_acc = "S";
update_firm(i); }
lim.put("B0",""); _year = thyear;
put_lim(lim); }
else
lim = get_lim(13); if (_basecalc == incorso)
if (lim.not_empty()) {
{ // that's pazzesc but as it turns out there's no better way
lim.put("B0",""); _comp_acconto = TRUE;
put_lim(lim); // force recalc of current month
} _recalc = one;
//fine int need_refresh = FALSE;
_isprint = true; for (int mese = 1; mese < _month; mese++)
} if (is_month_ok_strict(mese))
{
// sbatti l'acconto (e non solo!) in LIA const TRectype & lim = get_lim(mese);
TRectype lia = get_lia();
if (lim.empty() || !lim.get_bool("B0"))
if (lia.not_empty()) {
{ need_refresh = true;
if (isdifferita && _basecalc == incorso) break;
{ }
acc *= real(2.0); }
acc /= real(3.0); if (need_refresh && yesno_box(FR("Alcuni mesi precedenti non risultano ricalcolati:\n"
} "è consigliabile il ricalcolo. Si desidera eseguirlo?")))
lia.put("R4",acc); _recalc = ever;
lia.put("R7",iva_ven);
lia.put("R8",iva_acq); for (int m = 1; m <= _month; m++)
lia.put("R9",iva_ret); if (is_month_plain(m) || _recalc == ever)
lia.put("R10",iva_rim); {
lia.put("R11",ult_det); if (_prind->iscancelled())
lia.put("R12",iva_pro); break;
TToken_string rr("",'!'); update_firm(m);
rr.add(cre_pre.string(),0); }
rr.add(acq_intr.string(),1);
lia.put("S1",rr); // calcola l'acconto
lia.put("S8",tipo_acc); TRectype lim = get_lim(12);
put_lia(lia);
} if (lim.not_empty())
{
cre = lim.get_real("R12");
// per questa volta lasciamo perdere la describe_acconto cre -= lim.get_real("R19");
if (_isprint)
{ deb = lim.get_real("R13") + inf + ina;
// segnalazioni di errore da gesticolare: deb -= lim.get_real("R18"); // CM600446
// error = 0: no error deb -= lim.get_real("R1"); // CM600446
// error = 1: manca tabella risultati liquidazione per l'anno indicato
// error = 2: manca tabella risultati liquidazione per l'anno precedente if (lim.get_real("R17") > ZERO)
// error = 3: manca tabella dichiarazione annuale per l'anno precedente deb -= lim.get_real("R17");
_DescrItem* d = new _DescrItem(ACCONTO); else
d->_r0 = bc; cre += lim.get_real("R17");
d->_r1 = acc;
d->_r2 = cre; bc = deb - cre;
d->_r3 = deb; if (bc > ZERO)
d->_f0 = _basecalc == incorso; acc = bc;
d->_f1 = _isbase;
d->_f2 = error; look_lam(12); //posiziona anche la tabella lam
d->_f3 = isdifferita;
d->_s0 = _nditte->curr().get("CODDITTA"); iva_ven = _lam->get_real("R0"); //iva sulle vendite annotate fino al 20/12
d->_s1 = _nditte->curr().get("RAGSOC"); iva_acq = _lam->get_real("R1"); //iva sugli acquisti annotati fino al 20/12
cre_pre = _lam->get_real("R2"); //credito precedente
_descr_arr.add(d); iva_ret = lim.get_real("R5"); //rettifica
} iva_rim = lim.get_real("R1"); //iva chiesta a rimborso
return TRUE; ult_det = lim.get_real("R6"); //ulteriori detrazioni
} //iva_pro: //iva relativa alla percentuale di prorata
TTable plm ("PLM");
plm.zero();
plm.put("CODTAB",_year);
TRectype rec (plm.curr());
plm.read(_isgteq);
for (; !plm.eof(); plm.next())
{
if (plm.curr() != rec) break;
iva_pro += plm.get_real("R2");
}
//acq_intr
TTable pom ("POM");
pom.zero();
pom.put("CODTAB",_year);
rec = pom.curr();
pom.read(_isgteq);
for (; !pom.eof(); pom.next())
{
if (pom.curr() != rec) break;
acq_intr += pom.get_real("R0");
}
tipo_acc = "A"; //flag per dire che si e' utilizzato il metodo analitico
//stop
}
else error = 1;
// pulisci il water
_comp_acconto = FALSE;
_isprint = FALSE;
for (int i = 1; i <= _month; i++)
if (is_month_plain(i))
update_firm(i);
lim.put("B0","");
put_lim(lim);
lim = get_lim(13);
if (lim.not_empty())
{
lim.put("B0","");
put_lim(lim);
}
//fine
_isprint = true;
}
// sbatti l'acconto (e non solo!) in LIA
TRectype lia = get_lia();
if (lia.not_empty())
{
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);
lia.put("R9",iva_ret);
lia.put("R10",iva_rim);
lia.put("R11",ult_det);
lia.put("R12",iva_pro);
TToken_string rr("",'!');
rr.add(cre_pre.string(),0);
rr.add(acq_intr.string(),1);
lia.put("S1",rr);
lia.put("S8",tipo_acc);
put_lia(lia);
}
// per questa volta lasciamo perdere la describe_acconto
if (_isprint)
{
// segnalazioni di errore da gesticolare:
// error = 0: no error
// error = 1: manca tabella risultati liquidazione per l'anno indicato
// error = 2: manca tabella risultati liquidazione per l'anno precedente
// error = 3: manca tabella dichiarazione annuale per l'anno precedente
_DescrItem* d = new _DescrItem(ACCONTO);
d->_r0 = bc;
d->_r1 = acc;
d->_r2 = cre;
d->_r3 = deb;
d->_f0 = _basecalc == incorso;
d->_f1 = _isbase;
d->_f2 = error;
d->_f3 = isdifferita;
d->_s0 = _nditte->curr().get("CODDITTA");
d->_s1 = _nditte->curr().get("RAGSOC");
_descr_arr.add(d);
}
return TRUE;
}