Patch level : 12.0 938
Files correlati : cg5.exe cg5500b.msk cg5500c.msk Commento : Attivati acconto e interessi con ricalcolo nei trimestrali. Aggiunta 13 nei trimestrali e sistemata la visualizzazione dei trimestrali. Corrette diciture pro rata a da C1 C2 C3 C1a in B1 B2 B3 B4 Calcolato il pro rata mensile sempre Detratti gli i beni ammortizzabili esenti venduti nel calcolo pro rata con numeratore e denominatore (da verificare)
This commit is contained in:
parent
49a173742e
commit
57531a6132
@ -923,7 +923,7 @@ bool Visliq_app::vis_one(int m)
|
||||
if (k == K_SAVE)
|
||||
{
|
||||
{ write_liq(); recalc_next_liq(m, _liq_sheet, _vers_sheet); }
|
||||
if (d_mod) { write_del(); }
|
||||
if (d_mod) { write_del(m); }
|
||||
l_mod = d_mod = false;
|
||||
recorded = true;
|
||||
}
|
||||
@ -935,7 +935,7 @@ bool Visliq_app::vis_one(int m)
|
||||
if (kk == K_YES)
|
||||
{
|
||||
if (l_mod) { write_liq(); recalc_next_liq(m, _liq_sheet, _vers_sheet); }
|
||||
if (d_mod) { write_del(); }
|
||||
if (d_mod) { write_del(m); }
|
||||
l_mod = d_mod = false;
|
||||
recorded = true;
|
||||
}
|
||||
@ -1560,60 +1560,57 @@ void Visliq_app::recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field
|
||||
look_lim(start_month);
|
||||
}
|
||||
|
||||
void Visliq_app::write_liq()
|
||||
void Visliq_app::write_del(const int month, const char * codabi, const char * codcab, const char * codcon,
|
||||
const TDate & d, const real& v, const real& i, bool stampato)
|
||||
{
|
||||
// piccola, ma simpatica
|
||||
// naturalmente era much bigger
|
||||
_lim->rewrite();
|
||||
}
|
||||
int tipodel = 1;
|
||||
|
||||
void Visliq_app::write_del(const real& v, const real& i, bool stampato)
|
||||
{
|
||||
bool wasdel = false;
|
||||
|
||||
int month = atoi(*_lim_mese);
|
||||
TString8 abi(_lim->get("S4"));
|
||||
TString8 cab(_lim->get("S5"));
|
||||
TString4 con(_lim->get("S6"));
|
||||
TDate date(_lim->get("D0"));
|
||||
real vers = v;
|
||||
if (month == 12)
|
||||
tipodel = 7;
|
||||
else
|
||||
if (month == 13)
|
||||
tipodel = 2;
|
||||
const bool wasdel = look_del(month, tipodel);
|
||||
TString8 abi(codabi == nullptr ? _lim->get("S4") : codabi);
|
||||
TString8 cab(codcab == nullptr ? _lim->get("S5") : codcab);
|
||||
TString4 con(codcon == nullptr ? _lim->get("S6") : codcon);
|
||||
TDate date(d == TDate(NULLDATE) ? _lim->get_date("D0") : d);
|
||||
const real vers(v >= ZERO ? v : _lim->get_real("R8"));
|
||||
|
||||
if (vers == ZERO)
|
||||
vers = _lim->get_real("R8");
|
||||
if (vers == ZERO && (wasdel = look_del(month,1)))
|
||||
{
|
||||
_del->remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wasdel)
|
||||
look_del(month,1,true); // Crea delega
|
||||
if (!wasdel)
|
||||
{
|
||||
|
||||
real inter = i;
|
||||
look_del(month, tipodel, true); // Crea delega
|
||||
}
|
||||
|
||||
if (i == ZERO)
|
||||
{
|
||||
real percint = _lim->get_real("R10");
|
||||
if (vers == ZERO)
|
||||
_del->remove();
|
||||
else
|
||||
{
|
||||
real inter = i;
|
||||
|
||||
// riapplica il tasso di interesse
|
||||
// se trimestrale e' stato scorporato rispetto all'eventuale input utente
|
||||
inter = vers - (vers * CENTO / (percint + CENTO));
|
||||
if (i == ZERO)
|
||||
{
|
||||
real percint = _lim->get_real("R10");
|
||||
|
||||
round_imposta(inter);
|
||||
}
|
||||
|
||||
_del->put("R0",vers);
|
||||
_del->put("R1",inter);
|
||||
_del->put("D0",date);
|
||||
_del->put("S7",abi);
|
||||
_del->put("S8",cab);
|
||||
_del->put("S9",con);
|
||||
_del->put("B0", stampato); // Preimposta flag di stampato, altrimenti viene ignorato dalla liquidazione 04-12-2014
|
||||
// riapplica il tasso di interesse
|
||||
// se trimestrale e' stato scorporato rispetto all'eventuale input utente
|
||||
inter = v - (v * CENTO / (percint + CENTO));
|
||||
round_imposta(inter);
|
||||
}
|
||||
_del->put("R0", vers);
|
||||
_del->put("R1", inter);
|
||||
_del->put("D0", date);
|
||||
_del->put("S7", abi);
|
||||
_del->put("S8", cab);
|
||||
_del->put("S9", con);
|
||||
_del->put("B0", stampato); // Preimposta flag di stampato, altrimenti viene ignorato dalla liquidazione 04-12-2014
|
||||
|
||||
const int ctri = _freqviva == "M" ? 6000 + month : 6030 + (month/3);
|
||||
_del->put("S6", ctri);
|
||||
|
||||
_del->rewrite();
|
||||
const int ctri = _freqviva == "M" ? 6000 + month : 6030 + (month / 3);
|
||||
_del->put("S6", ctri);
|
||||
|
||||
_del->rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1722,15 +1719,17 @@ void Visliq_app::read_general(TMask& m)
|
||||
real interessi[13];
|
||||
TDate date[13];
|
||||
TToken_string banche[13];
|
||||
bool stampato[13];
|
||||
bool stampato[13] = { false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
|
||||
for (_del->first(); !_del->eof(); _del->next())
|
||||
{
|
||||
if (atol(*_del_ditta) == get_firm() && atoi(*_del_anno) == _year)
|
||||
{
|
||||
// uso solo deleghe normali (tipo == 1) e acconti (tipo == 7)
|
||||
|
||||
// uso solo deleghe normali (tipo == 1), annuali (tipo == 2) e acconti (tipo == 7)
|
||||
int tipod = atoi(*_del_tipo);
|
||||
if (tipod == 1 || tipod == 7)
|
||||
|
||||
if (tipod < 3 || tipod == 7)
|
||||
{
|
||||
|
||||
// somma versamenti nel mese adeguato
|
||||
@ -1757,28 +1756,32 @@ void Visliq_app::read_general(TMask& m)
|
||||
// Sheet versamenti
|
||||
TString nomemese;
|
||||
sv.destroy();
|
||||
for (int i = 1; i <= 13; i++)
|
||||
// for (int i = 1; i <= 13; i++)
|
||||
for (int i = step; i < last_month; i += step)
|
||||
{
|
||||
if (!is_month_ok(i) && i != 13)
|
||||
continue;
|
||||
nomemese = itoname(i == 13 ? 12 : i);
|
||||
if (nomemese == "4 Trimestre")
|
||||
nomemese = TR("4 Tr.");
|
||||
if (i == 12) nomemese << TR(" acconto");
|
||||
if (i == 13) nomemese << TR(" saldo");
|
||||
int m = (i > 12) ? 13 : i;
|
||||
|
||||
const int row = sv.set_row_cell(S_MESE, nomemese); // mese
|
||||
|
||||
sv.set_row_cell(S_DATA, date[i - 1], row); // data vers.
|
||||
sv.set_row_cell(S_ABI, banche[i - 1].get(0), row); // azienda
|
||||
sv.set_row_cell(S_CAB, banche[i - 1].get(1), row); // dipendenza
|
||||
sv.set_row_cell(S_CONC, banche[i - 1].get(2), row); // concessionaria
|
||||
sv.set_row_cell(S_VERSAMENTO, versamenti[i - 1], row);// versamenti
|
||||
sv.set_row_cell(S_INTERESSI, interessi[i - 1], row);// interessi
|
||||
sv.set_row_cell(S_STAMPATO, stampato[i - 1], row);// stampato
|
||||
if (is_month_ok(m) || m == 13)
|
||||
{
|
||||
nomemese = itoname(m == 13 ? 12 : i);
|
||||
if (nomemese == "4 Trimestre")
|
||||
nomemese = TR("4 Tr.");
|
||||
if (m == 12) nomemese << TR(" acconto");
|
||||
if (m == 13) nomemese << TR(" saldo");
|
||||
|
||||
// if (i == 12)
|
||||
// sv.disable_cell(11, cid2index(S_INTERESSI));
|
||||
const int row = sv.set_row_cell(S_MESE, nomemese); // mese
|
||||
|
||||
sv.set_row_cell(S_DATA, date[m - 1], row); // data vers.
|
||||
sv.set_row_cell(S_ABI, banche[m - 1].get(0), row); // azienda
|
||||
sv.set_row_cell(S_CAB, banche[m - 1].get(1), row); // dipendenza
|
||||
sv.set_row_cell(S_CONC, banche[m - 1].get(2), row); // concessionaria
|
||||
sv.set_row_cell(S_VERSAMENTO, versamenti[m - 1], row);// versamenti
|
||||
sv.set_row_cell(S_INTERESSI, interessi[m - 1], row);// interessi
|
||||
sv.set_row_cell(S_STAMPATO, stampato[m - 1], row);// stampato
|
||||
|
||||
// if (i == 12)
|
||||
// sv.disable_cell(11, cid2index(S_INTERESSI));
|
||||
}
|
||||
}
|
||||
sv.force_update();
|
||||
|
||||
@ -1826,6 +1829,7 @@ void Visliq_app::write_general(TMask& m)
|
||||
|
||||
for (int i = step; i < last_month; i += step)
|
||||
{
|
||||
int m = (i > 12) ? 13 : i;
|
||||
// this is a true bordel
|
||||
const int row = (i/step) - 1;
|
||||
|
||||
@ -1833,22 +1837,21 @@ void Visliq_app::write_general(TMask& m)
|
||||
bool vfrommask = sv.selected() == (i == 12 ? row + 1 : row) && svm.is_running();
|
||||
|
||||
TToken_string& tt_lo = (TToken_string&)_liq_rows[row];
|
||||
// TToken_string& tt_ln = sh.row(row);
|
||||
|
||||
|
||||
// risolve menata del dettaglio si'/no
|
||||
if (lfrommask)
|
||||
for (int i = 1; i <= 13; i++)
|
||||
sh.set_row_cell(101 + i, shm.get(101+i), row);
|
||||
for (int j = 1; j <= 13; j++)
|
||||
sh.set_row_cell(101 + j, shm.get(101 + j), row);
|
||||
|
||||
// saltare una riga se dicembre (riga 11 == acconto)
|
||||
// int sv_row = i == 12 ? row + 1 : row;
|
||||
TToken_string& tt_vo = (TToken_string&)_vers_rows[row];
|
||||
TToken_string& tt_vn = sv.row(row);
|
||||
|
||||
if (vfrommask)
|
||||
{
|
||||
for (int i = 1; i <= 5; i++)
|
||||
sh.set_row_cell(101 + i, svm.get(101+i), row);
|
||||
for (int j = 1; j <= 5; j++)
|
||||
sh.set_row_cell(101 + j, svm.get(101+j), row);
|
||||
}
|
||||
|
||||
// traduci contenuto righe in real pila
|
||||
@ -1884,7 +1887,7 @@ void Visliq_app::write_general(TMask& m)
|
||||
|
||||
// acconto (si considererà solo a dicembre)
|
||||
|
||||
was_lim = look_lim(i);
|
||||
was_lim = look_lim(m);
|
||||
if (!was_lim)
|
||||
carry = false; // blocca riporto crediti e debiti
|
||||
|
||||
@ -1899,65 +1902,30 @@ void Visliq_app::write_general(TMask& m)
|
||||
|
||||
if (row == row_acc)
|
||||
{
|
||||
// ricalcola acconto se occorre
|
||||
// e crea/aggiorna la delega
|
||||
TToken_string& vo = (TToken_string&)_vers_rows[_freqviva == "M" ? 11 : 3];
|
||||
real oacct(vo.get(cid2index(S_VERSAMENTO)));
|
||||
real nacct(sv.get_real_row_cell(row_acc, S_VERSAMENTO));
|
||||
TDate aodate(vo.get(cid2index(S_DATA)));
|
||||
TDate andate(sv.get_date_row_cell(row_acc, S_DATA));
|
||||
TString8 aoabi(vo.get(cid2index(S_ABI)));
|
||||
TString8 anabi(sv.get_str_row_cell(row_acc, S_ABI));
|
||||
TString8 aocab(vo.get(cid2index(S_CAB)));
|
||||
TString8 ancab(sv.get_str_row_cell(row_acc, S_CAB));
|
||||
TString aocon(vo.get(cid2index(S_CONC)));
|
||||
TString ancon(sv.get_str_row_cell(row_acc, S_CONC));
|
||||
bool aosta(vo.get_bool(cid2index(S_STAMPATO)));
|
||||
bool ansta(sv.get_bool_row_cell(row_acc, S_STAMPATO));
|
||||
|
||||
if (oacct != nacct)
|
||||
if (overs != nvers)
|
||||
{
|
||||
risc -= oacct;
|
||||
risc += nacct;
|
||||
risl += oacct;
|
||||
risl -= nacct;
|
||||
_lim->put("R11", nacct);
|
||||
}
|
||||
if (oacct != nacct || nint != oint || ndate != odate || anabi != aoabi || ancab != aocab || ancon != aocon || aosta != ansta)
|
||||
{
|
||||
look_del(12, 7, true);
|
||||
_del->put("D0", andate);
|
||||
_del->put("B0", ansta);
|
||||
_del->put("R0", nacct);
|
||||
_del->zero("R1");
|
||||
_del->put("S7", anabi);
|
||||
_del->put("S8", ancab);
|
||||
_del->put("S9", ancon);
|
||||
_del->put("S6", "6013");
|
||||
_del->put("R1", nint);
|
||||
_del->put("B0", nsta);
|
||||
_del->rewrite();
|
||||
risc -= overs;
|
||||
risc += nvers;
|
||||
risl += overs;
|
||||
risl -= nvers;
|
||||
_lim->put("R11", nvers);
|
||||
}
|
||||
}
|
||||
else
|
||||
// ricalcola versamenti se occorre
|
||||
// e crea/aggiorna le deleghe
|
||||
|
||||
if (nvers != overs || nint != oint|| ndate != odate || nabi != oabi || ncab != ocab || ncon != ocon || osta != nsta)
|
||||
{
|
||||
// ricalcola versamenti se occorre
|
||||
// e crea/aggiorna le deleghe
|
||||
|
||||
if (nvers != overs || nint != oint|| ndate != odate || nabi != oabi || ncab != ocab || ncon != ocon || osta != nsta)
|
||||
{
|
||||
_lim->put("R8", nvers);
|
||||
real percint = (nint / (nvers - nint)) * CENTO;
|
||||
|
||||
percint.round(2);
|
||||
_lim->put("R10", percint);
|
||||
_lim->put("D0", ndate);
|
||||
_lim->put("S4", nabi);
|
||||
_lim->put("S5", ncab);
|
||||
_lim->put("S6", ncon);
|
||||
write_del(nvers, nint, nsta);
|
||||
}
|
||||
_lim->put("R8", nvers);
|
||||
real percint = (nint / (nvers - nint)) * CENTO;
|
||||
|
||||
percint.round(2);
|
||||
_lim->put("R10", percint);
|
||||
_lim->put("D0", ndate);
|
||||
_lim->put("S4", nabi);
|
||||
_lim->put("S5", ncab);
|
||||
_lim->put("S6", ncon);
|
||||
write_del(m, nabi, ncab, ncon, ndate, nvers, nint, nsta);
|
||||
}
|
||||
|
||||
// se modificate rettifiche
|
||||
|
@ -86,8 +86,9 @@ public:
|
||||
|
||||
void read_general(TMask& m);
|
||||
void write_general(TMask& m);
|
||||
void write_liq();
|
||||
void write_del(const real &v = ZERO, const real &i = ZERO, bool stampato = false);
|
||||
void write_liq() { _lim->rewrite(); }
|
||||
void write_del(const int month, const char * codabi = nullptr, const char * codcab = nullptr, const char * codcon = nullptr,
|
||||
const TDate & d = TDate(NULLDATE), const real &v = MENOUNO, const real &i = ZERO, bool stampato = false);
|
||||
|
||||
void set_freqviva();
|
||||
void set_freqviva(const char* f) { _freqviva = f; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user