COrrezioni liquidazione e visualizzazione

git-svn-id: svn://10.65.10.50/trunk@1545 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1995-07-03 10:39:38 +00:00
parent 0f26593d44
commit bca2780adb
8 changed files with 230 additions and 186 deletions

View File

@ -1460,6 +1460,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
risultato -= cred_prec;
res_cred += cred_prec;
}
} else if (_isdifferita)
{
// TBI gestione struonza
}
if (month == 13)
@ -1550,7 +1553,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
* versamenti effettuati: si conteggiano in R0,
* sono > 0 solo se andavano calcolati (vedi sopra)
*/
risultato -= (versamenti + vers_int);
risultato -= versamenti + vers_int;
/*
* acconto dicembre se previsto
*/

View File

@ -478,31 +478,60 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
}
if (create)
{
// codici ABI e CAB da anagrafica ditte
TString abi = _nditte->lfile().get("ABIBAN");
TString cab = _nditte->lfile().get("CABBAN");
_del->put("S7", abi);
_del->put("S8", cab);
// descrizione banca
TTable ban("%BAN");
ban.zero();
TString codban = format("%05ld", atol(abi));
if (!cab.empty()) codban << format("%05ld", atol(cab));
ban.put("CODTAB", codban);
if (ban.read() != NOERR)
{
TString desban(ban.get("S0"));
_del->put("S1", desban);
// vedi se titolare conto fiscale
bool titcf = FALSE;
bool isdel = FALSE;
TLocalisamfile anag(LF_ANAG);
anag.zero();
anag.put("TIPOA", _nditte->lfile().get("TIPOA"));
anag.put("CODANAGR", _nditte->lfile().get("CODANAGR"));
if (anag.read() == NOERR)
{
titcf = anag.get_bool("TITCF");
isdel = anag.get_long("TIPOSTDEL") == 0l;
}
// infila ufficio concessione in S9
// e descrizione comune in S2
TString16 con; TString uva;
if (look_conc(con, uva))
if (!titcf || isdel)
{
_del->put("S9", con);
_del->put("S2", uva);
// non titolare conto fiscale oppure paga con delega:
// cerca banca
// codici ABI e CAB da anagrafica ditte
TString abi = _nditte->lfile().get("ABIBAN");
TString cab = _nditte->lfile().get("CABBAN");
if (abi.empty())
{
abi = anag.get("CODABI");
abi = anag.get("CODCAB");
}
_del->put("S7", abi);
_del->put("S8", cab);
// descrizione banca
TTable ban("%BAN");
ban.zero();
TString codban = format("%05ld", atol(abi));
if (!cab.empty()) codban << format("%05ld", atol(cab));
ban.put("CODTAB", codban);
if (ban.read() != NOERR)
{
TString desban(ban.get("S0"));
_del->put("S1", desban);
}
}
else
{
// non usa delega bensi' bollettino o distinta:
// cerca concessione comune
// infila ufficio concessione in S9
// e descrizione comune in S2
TString16 con; TString uva;
if (look_conc(con, uva))
{
_del->put("S9", con);
_del->put("S2", uva);
}
}
// scrive codice tributo

View File

@ -857,9 +857,12 @@ void TLiquidazione_app::set_firm(_DescrItem& d)
reset_header();
set_header(1,"Ditta %s %s@109gData @<@125gPag. @#",
(const char*)(d._s0), (const char*)(d._s1));
set_header(2,"");
if (!_isregis)
{
set_header(1,"Ditta %s %s@109gData @<@125gPag. @#",
(const char*)(d._s0), (const char*)(d._s1));
set_header(2,"");
}
set_header(3,sep);
set_header(4,"%s@102gFrequenza %s",
(const char*)tim_title,
@ -934,9 +937,12 @@ void TLiquidazione_app::set_att(_DescrItem& d)
(const char*)tipatt);
reset_header();
set_header(1,"Ditta %s %s@109gData @<@125gPag. @#",
(const char*)(d._s0), (const char*)(d._s1));
set_header(2,"");
if (!_isregis)
{
set_header(1,"Ditta %s %s@109gData @<@125gPag. @#",
(const char*)(d._s0), (const char*)(d._s1));
set_header(2,"");
}
set_header(3,sep);
set_header(4,"%s@55g%s", (const char*)tim_title, (const char*)att_title);
set_header(5,sep);
@ -955,7 +961,9 @@ void TLiquidazione_app::set_att(_DescrItem& d)
void TLiquidazione_app::set_plafond(_DescrItem& d)
{
{
if (_isregis) return;
set_bookmark("Quadro plafond", _att_bookmark);
real r1 = d._r2 - d._r1 - d._r0;
@ -1012,13 +1020,14 @@ void TLiquidazione_app::set_pim(_DescrItem& d)
{
look_iva(d._s1);
d._s2 = _iva->get("S0");
if (d._s2.len() > 19) d._s2.cut(19);
}
if (d._f0) // e' il primo: non fa piu' nulla perche' l'intestazione
// viene fatta comunque da set_pim_head
{}
set_row(rw++,"%4s %-20s@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r",
set_row(rw++,"%4s %s@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r",
(const char*)d._s1,
(const char*)d._s2,
&(d._r0),

View File

@ -102,7 +102,7 @@ bool TLiquidazione_app::extract_deleghe()
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4");
bool mens = _freqviva == "M";
_isannual = (_month == 12 && !mens && !_isbenzinaro) ||
(_month == 13 && (mens || _isbenzinaro));
(_month == 13 && (mens || _isbenzinaro));
_isriepilogo = _month == 13;
_isendliq = _isannual || _isriepilogo;
@ -118,31 +118,31 @@ bool TLiquidazione_app::extract_deleghe()
{
_DescrItem* ddeb = NULL;
_DescrItem* dcrd = NULL;
// scorri desc e prepara descritems
for (int i = 0; i < desc.items(); i++)
{
TToken_string& tt = (TToken_string&)desc[i];
real tp(tt.get(3));
if (tp.sign() > 0)
{
if (ddeb == NULL)
{
ddeb = new _DescrItem(DELDEB);
ddeb->_f0 = _month;
}
real tp(tt.get(3));
if (tp.sign() > 0)
{
if (ddeb == NULL)
{
ddeb = new _DescrItem(DELDEB);
ddeb->_f0 = _month;
}
ddeb->_arr.add(tt);
}
else
{
if (dcrd == NULL)
{
dcrd = new _DescrItem(DELCRED);
dcrd->_f0 = _month;
}
}
else
{
if (dcrd == NULL)
{
dcrd = new _DescrItem(DELCRED);
dcrd->_f0 = _month;
}
dcrd->_arr.add(tt);
}
}
}
if (dcrd != NULL) _descr_arr.add(dcrd);
if (ddeb != NULL) _descr_arr.add(ddeb);
@ -157,38 +157,41 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc)
if (look_lim(month))
{
real topay = result_liq(month);
topay += _lim->get_real("R14");
real topay = result_liq(month); // TBC non si puo' fa' accussi'!!!!! pena il casino!
real intr = _lim->get_real("R14");
topay += intr; // lo vogliono registrato con interessi
real nrnd = topay;
topay.round(-3);
if (!topay.is_zero())
{
tt = new TToken_string(80);
tt->add(_nditte->curr().get("CODDITTA"));
tt->add(_nditte->curr().get("RAGSOC"));
tt->add(_freqviva);
tt->add(_nditte->curr().get("CODDITTA"));
tt->add(_nditte->curr().get("RAGSOC"));
tt->add(_freqviva);
tt->add(topay.string());
tt->add("");
// tt->add(intr.string());
// tt->add(intr.string());
}
if (topay.sign() > 0)
{
look_del(month, _isannual ? 2 : 1, TRUE);
_del->put("R0",topay);
// _del->put("R1",intr);
_del->put("R1",intr);
_del->put("R2",nrnd); // non arrotondato, per calcolo risultato a debito/cr
_del->rewrite();
tt->add(_del->get("S7"));
tt->add(_del->get("S8"));
tt->add(_del->get("S9"));
tt->add(_nditte->curr().get("PTEL"));
tt->add(_nditte->curr().get("TEL"));
tt->add(_del->get("S7"));
tt->add(_del->get("S8"));
tt->add(_del->get("S9"));
tt->add(_nditte->curr().get("PTEL"));
tt->add(_nditte->curr().get("TEL"));
}
}
if (tt != NULL)
desc.add(tt);
desc.add(tt);
return TRUE;
}
@ -199,7 +202,6 @@ bool TLiquidazione_app::set_acconto(real& inf, real& ina)
TMask m("cg4300c.msk");
m.set(CHK_CGC_PRINT,"X");
m.field(FLD_CGC_YEAR).set_handler(ch_year_handler);
int k = 0; long j;
_calcall = FALSE;
@ -217,7 +219,7 @@ bool TLiquidazione_app::set_acconto(real& inf, real& ina)
inf = real(m.get(FLD_CGC_INF));
ina = real(m.get(FLD_CGC_INA));
switch (k)
{
case DLG_SELECT:
@ -311,11 +313,11 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
else
{
char ohh = _lia->get_char("S7");
if (ohh == 'M') history = thh == 'M' ? mm : mt;
if (ohh == 'T') history = thh == 'M' ? tm : tt;
if (history == boh) return FALSE;
// casino benzinari
TString attprev = _nditte->curr().get("CODATTPREV");
long codd = _nditte->curr().get_long("CODDITTA");
@ -326,10 +328,10 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
if (atts.read() != NOERR) atts.zero();
if (atts.get_bool("ART74/4")) // e' proprio un gran benzinaro
{
TConfig cnf(CONFIG_DITTA, "cg");
history = cnf.get_bool("GesT74") ? mm : tt;
TConfig cnf(CONFIG_DITTA, "cg");
history = cnf.get_bool("GesT74") ? mm : tt;
}
switch (history)
{
case mm:
@ -349,12 +351,12 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
if (!look_lim(12)) error = 2; // TBC sara' 13a davvero? Secondo me e' 12
else
{
bc += _lim->get_real("R0");
real av = _lim->get_real("R11");
bc += av;
bc += _lim->get_real("R0");
real av = _lim->get_real("R11");
bc += av;
}
if (_basecalc == tm)
// tm come tt ma si divide per 3 la base di calcolo prima di calcolare l'88%
// tm come tt ma si divide per 3 la base di calcolo prima di calcolare l'88%
bc /= real(3.0);
break;
case mt:
@ -367,9 +369,9 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
if (!look_lim(12)) error = 2;
else
{
bc += _lim->get_real("R0");
real av = _lim->get_real("R11");
bc += av;
bc += _lim->get_real("R0");
real av = _lim->get_real("R11");
bc += av;
}
break;
}
@ -382,71 +384,70 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
}
_year = thyear;
}
else if (_basecalc == incorso)
{
// that's pazzesc but as it turns out there's no better way
_comp_acconto = TRUE;
// force recalc of current month
_recalc = one;
// insozza il water
update_firm(12);
// calcola l'acconto
if (look_lim(12))
{
// TBC trimestrali, differite
bc = result_liq(12);
// somma i non fatturati/non annotati
bc += inf + ina;
if (bc.sign() > 0)
acc = bc * ACCONTO_DICEMBRE;
}
else error = 1;
// pulisci il water
_comp_acconto = FALSE;
update_firm(12);
}
// sbatti l'acconto in LIA
if (look_lia())
{
_lia->put("R4",acc);
isdifferita = _lia->get_bool("B1");
_lia->rewrite();
}
bool wasdel = look_del(12,7);
else if (_basecalc == incorso)
{
// that's pazzesc but as it turns out there's no better way
_comp_acconto = TRUE;
// force recalc of current month
_recalc = one;
// insozza il water
update_firm(12);
if (acc.sign() > 0 && acc > ACCONTO_MINIMO_DA_VERSARE)
{
// crea o aggiorna delega
// TBC everything
look_del(12,7,TRUE);
_del->put("R0", acc);
_del->rewrite();
// calcola l'acconto
if (look_lim(12))
{
// TBC trimestrali, differite
bc = result_liq(12);
// somma i non fatturati/non annotati
bc += inf + ina;
if (bc.sign() > 0) acc = bc;
}
else if (wasdel)
_del->remove();
else error = 1;
// pulisci il water
_comp_acconto = FALSE;
update_firm(12);
}
// sbatti l'acconto in LIA
if (look_lia())
{
_lia->put("R4",acc);
isdifferita = _lia->get_bool("B1");
_lia->rewrite();
}
bool wasdel = look_del(12,7);
if (acc.sign() > 0 && acc > ACCONTO_MINIMO_DA_VERSARE)
{
// crea o aggiorna delega
// TBC everything
look_del(12,7,TRUE);
_del->put("R0", acc);
_del->rewrite();
}
else if (wasdel)
_del->remove();
// 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->_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;
}
{
// 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->_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;
}

View File

@ -452,7 +452,7 @@ bool Visliq_app::vis_all()
{
if (!look_lia())
return FALSE;
// mask diverse per trimestrale e annuale
TMask m(_freqviva == "M" ? "cg5500b" : "cg5500c");
_mask = &m;
@ -602,7 +602,7 @@ bool Visliq_app::vis_one(int m)
if (is_delega = look_del(m,1))
{
vers = _del->get_real("R0") /* + _del->get_real("R1") */;
vers = _del->get_real("R0");
date = _del->get_date("D0");
abi = _del->get("S7");
cab = _del->get("S8");
@ -738,24 +738,24 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver
{
// ricalcola tutto, scrive nei lim, NON salva e riaggiusta
// la paginata della liquidazione
// Descrizione Da ricalcolare
// Descrizione Da ricalcolare
// -------------------------------------------------------------------------------
real iva_ven = _lam->get_real("R0"); // IVA acquisti no
real iva_acq = _lam->get_real("R1"); // IVA vendite no
real cre_pre = _lam->get_real("R2"); // credito precedente no (solo dopo)
real deb_pre = _lam->get_real("R3"); // debito precedente no (solo dopo)
real ris = _lim->get_real("R0"); // risultato si
real rmb = _lim->get_real("R1"); // rimborso si
real rtt = _lim->get_real("R5"); // rettifica si
real udt = _lim->get_real("R6"); // ult. detrazioni no
real cgp = _lim->get_real("R7"); // conguaglio prorata no
real vrs = _lim->get_real("R8"); // versamenti si
real vri = _lim->get_real("R9"); // versamenti integrativi no
real itt = _lim->get_real("R10"); // tasso interesse no
real act = _lim->get_real("R11"); // acconto si
real crd = _lim->get_real("R12"); // totale a credito si
real dbt = _lim->get_real("R13"); // totale a debito si
real itr = _lim->get_real("R14"); // interesse totale si
real iva_ven = _lam->get_real("R0"); // IVA acquisti no
real iva_acq = _lam->get_real("R1"); // IVA vendite no
real cre_pre = _lam->get_real("R2"); // credito precedente no (solo dopo)
real deb_pre = _lam->get_real("R3"); // debito precedente no (solo dopo)
real ris = _lim->get_real("R0"); // risultato si
real rmb = _lim->get_real("R1"); // rimborso si
real rtt = _lim->get_real("R5"); // rettifica si
real udt = _lim->get_real("R6"); // ult. detrazioni no
real cgp = _lim->get_real("R7"); // conguaglio prorata no
real vrs = _lim->get_real("R8"); // versamenti si
real vri = _lim->get_real("R9"); // versamenti integrativi no
real itt = _lim->get_real("R10"); // tasso interesse no
real act = _lim->get_real("R11"); // acconto si
real crd = _lim->get_real("R12"); // totale a credito si
real dbt = _lim->get_real("R13"); // totale a debito si
real itr = _lim->get_real("R14"); // interesse totale si
// -------------------------------------------------------------------------------
// calcola vecchio risultato: se e' diverso da R0 ci sono cazzi strani
@ -941,6 +941,7 @@ void Visliq_app::recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field
_lim->put("R0", risl);
_lim->put("R12", risc);
_lim->put("R13", risd);
// interessi
if (intt.sign() > 0)
{
@ -972,13 +973,14 @@ void Visliq_app::recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field
}
// se non si fa questa non scrive una delega,
// bensi' una bovazza
// bensi' una bovazza (escremento bovino)
look_lim(start_month);
}
void Visliq_app::write_liq()
{
// piccola, ma simpatica
// naturalmente era much bigger
_lim->rewrite();
}
@ -1080,7 +1082,7 @@ void Visliq_app::read_general(TMask& m)
if (m >= 12)
m = tipod == 7 ? 12 : 13;
versamenti[m-1] += _del->get_real("R0") + _del->get_real("R1");
versamenti[m-1] += _del->get_real("R0");
date[m-1] = _del->get_date("D0");
banche[m-1].add(_del->get("S7"),0);
banche[m-1].add(_del->get("S8"),1);

View File

@ -104,7 +104,7 @@ public:
bool vis_all();
bool vis_one(int);
Visliq_app() : TApplication() {}
Visliq_app() : TApplication(), _vers_sheet(NULL), _liq_sheet(NULL) {}
virtual ~Visliq_app() {}
};

View File

@ -173,18 +173,18 @@ PAGE "Prospetto versamenti" -1 -1 50 12
STRING 101 20
BEGIN
PROMPT 1 2 "Mese "
PROMPT 1 1 "Mese "
FLAGS "D"
END
DATE 102
BEGIN
PROMPT 1 5 "Data "
PROMPT 1 2 "Data "
END
NUMBER 103 5
BEGIN
PROMPT 4 8 "Codice ABI "
PROMPT 1 3 "Codice ABI "
HELP "Codice ABI banca di appoggio"
FIELD S7
FLAGS "RZ"
@ -202,7 +202,7 @@ END
NUMBER 104 5
BEGIN
PROMPT 40 8 "Codice CAB "
PROMPT 1 4 "Codice CAB "
HELP "Codice CAB banca di appoggio"
FIELD S8
FLAGS "RZ"
@ -214,7 +214,7 @@ END
NUMBER 105 3
BEGIN
PROMPT 4 9 "Concessione "
PROMPT 1 5 "Concessione "
HELP "Codice Concessione del Comune di residenza fiscale"
// FIELD S9
FLAGS "RZ"
@ -223,15 +223,15 @@ END
NUMBER 106 15 0
BEGIN
PROMPT 1 4 "Versamenti "
PROMPT 1 6 "Versamenti "
FLAGS "R"
PICTURE "."
END
/*
LIST 107 1 8
LIST 107 1 10
BEGIN
PROMPT 1 9 "Importo a "
PROMPT 1 7 "Importo a "
ITEM " | "
ITEM "D|Debito"
ITEM "C|Credito"

View File

@ -81,21 +81,21 @@ PAGE "Prospetto mensile" -1 -1 50 10
STRING 101 20
BEGIN
PROMPT 1 2 "Mese "
PROMPT 1 1 "Mese "
FLAGS "D"
END
NUMBER 102 15 0
BEGIN
PROMPT 1 3 "Risultato "
PROMPT 1 2 "Risultato "
FLAGS "DR"
PICTURE "."
END
LIST 103 1 8
LIST 103 1 10
BEGIN
PROMPT 1 4 "Importo a "
PROMPT 1 3 "Importo a "
ITEM " | "
ITEM "D|Debito"
ITEM "C|Credito"
@ -106,21 +106,21 @@ END
NUMBER 104 15
BEGIN
PROMPT 22 5 "IVA a rimborso "
PROMPT 1 4 "IVA a rimborso "
FLAGS "R"
PICTURE "."
END
NUMBER 105 15
BEGIN
PROMPT 22 6 "Debito/Credito "
PROMPT 1 5 "Debito/Credito "
FLAGS "R"
PICTURE "."
END
LIST 106 1 8
BEGIN
PROMPT 1 7 "Importo a "
PROMPT 1 6 "Importo a "
ITEM " | "
ITEM "D|Debito"
ITEM "C|Credito"
@ -151,18 +151,18 @@ PAGE "Prospetto versamenti" -1 -1 50 12
STRING 101 20
BEGIN
PROMPT 1 2 "Mese "
PROMPT 1 1 "Mese "
FLAGS "D"
END
DATE 102
BEGIN
PROMPT 1 5 "Data "
PROMPT 1 2 "Data "
END
NUMBER 103 5
BEGIN
PROMPT 4 8 "Codice ABI "
PROMPT 1 3 "Codice ABI "
HELP "Codice ABI banca di appoggio"
FIELD S7
FLAGS "RZ"
@ -180,7 +180,7 @@ END
NUMBER 104 5
BEGIN
PROMPT 40 8 "Codice CAB "
PROMPT 1 4 "Codice CAB "
HELP "Codice CAB banca di appoggio"
FIELD S8
FLAGS "RZ"
@ -192,7 +192,7 @@ END
NUMBER 105 3
BEGIN
PROMPT 4 9 "Concessione "
PROMPT 1 5 "Concessione "
HELP "Codice Concessione del Comune di residenza fiscale"
// FIELD S9
FLAGS "RZ"
@ -201,7 +201,7 @@ END
NUMBER 106 15 0
BEGIN
PROMPT 1 4 "Versamenti "
PROMPT 1 6 "Versamenti "
FLAGS "R"
PICTURE "."
END
@ -209,7 +209,7 @@ END
/*
LIST 107 1 8
BEGIN
PROMPT 1 9 "Importo a "
PROMPT 1 7 "Importo a "
ITEM "D|Debito"
ITEM "C|Credito"
INPUT 104