Correzione errori
git-svn-id: svn://10.65.10.50/trunk@1626 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
43b3d42d58
commit
69029737cc
@ -658,7 +658,8 @@ void CG1100_application::set_senza_IV()
|
||||
|
||||
if (conto != 0 && sottoc == 0l)
|
||||
{
|
||||
set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "##") );
|
||||
//set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "##") );
|
||||
set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "#") );
|
||||
set_row (i, "@82g@1s", FLD(LF_PCON, PCN_TMCF) );
|
||||
set_row (i, "@89g@f", FLD(LF_PCON, PCN_STSOTTBIL) );
|
||||
set_row (i, "@98g@f", FLD(LF_PCON, PCN_COMPENS) );
|
||||
@ -725,7 +726,8 @@ void CG1100_application::set_senza_ana()
|
||||
set_row (1, "@73g#-8t", &_clivd);
|
||||
set_row (1, "@82g@pn", FLD(LF_PCON, PCN_NUMIVD, "@@") );
|
||||
|
||||
set_row (1, "@87g@pn", FLD(LF_PCON, PCN_INDBIL, "##") );
|
||||
//set_row (1, "@87g@pn", FLD(LF_PCON, PCN_INDBIL, "##") );
|
||||
set_row (1, "@87g@pn", FLD(LF_PCON, PCN_INDBIL, "#") );
|
||||
set_row (1, "@92g@1s", FLD(LF_PCON, PCN_TMCF) );
|
||||
set_row (1, "@99g@f", FLD(LF_PCON, PCN_STSOTTBIL) );
|
||||
set_row (1, "@107g@f", FLD(LF_PCON, PCN_COMPENS) );
|
||||
@ -779,7 +781,8 @@ void CG1100_application::set_completa()
|
||||
|
||||
if (conto != 0 && sottoc == 0l)
|
||||
{
|
||||
set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "##") );
|
||||
//set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "##") );
|
||||
set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "#") );
|
||||
set_row (i, "@82g@1s", FLD(LF_PCON, PCN_TMCF) );
|
||||
set_row (i, "@89g@f", FLD(LF_PCON, PCN_STSOTTBIL) );
|
||||
set_row (i, "@98g@f", FLD(LF_PCON, PCN_COMPENS) );
|
||||
@ -1161,8 +1164,8 @@ bool CG1100_application::user_create()
|
||||
_cur_c2 = add_cursor (NULL);
|
||||
|
||||
add_file(LF_PCON);
|
||||
// _descr = new TParagraph_string ("",40);
|
||||
|
||||
set_print_zero();
|
||||
|
||||
_tipo_stampa = completa;
|
||||
_salto_pag = FALSE;
|
||||
|
@ -127,31 +127,31 @@ int cg1300(int argc, char* argv[])
|
||||
}
|
||||
break;
|
||||
case 'I':
|
||||
{
|
||||
{
|
||||
TAgg_opintra a;
|
||||
a.run(argc, argv, "Aggiornamento flag op. intracomunitarie");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'T':
|
||||
{
|
||||
{
|
||||
TAgg_tconto a;
|
||||
a.run(argc, argv, "Aggiornamento tipo conto");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
{
|
||||
{
|
||||
TAgg_nprot a;
|
||||
a.run(argc, argv,"Rinumerazione numero di protocollo");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
{
|
||||
{
|
||||
TAgg_codatt a;
|
||||
a.run(argc, argv,"Aggiornamento codice attivita'");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -126,10 +126,11 @@ void TAgg_codatt::cancella_rec()
|
||||
TTable pla("PLA");
|
||||
for (pla.first(); !pla.eof(); pla.next())
|
||||
pla.remove();
|
||||
|
||||
/***
|
||||
TTable rmb("RMB");
|
||||
for (rmb.first(); !rmb.eof(); rmb.next())
|
||||
rmb.remove();
|
||||
***/
|
||||
}
|
||||
|
||||
void TAgg_codatt::aggiorna_att(const char* nome)
|
||||
|
@ -1400,8 +1400,8 @@ bool CG1500_application::bil_verifica()
|
||||
}
|
||||
//se saldo_finale < 0 verra' stampato con una A, se no con una D
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
movimentato = sld.ultima_immissione_verifica(_annoes,g,c,s,indbil_conto,_stampa_mov_prov);
|
||||
|
||||
//modifica del 31/03/95
|
||||
@ -1430,11 +1430,11 @@ bool CG1500_application::bil_verifica()
|
||||
|
||||
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (movimentato || _stampav != 1)
|
||||
if (movimentato || _stampav != 1)
|
||||
if (!(saldo_finale == ZERO && _stampav == 2))
|
||||
{
|
||||
{
|
||||
esiste_sc = TRUE;
|
||||
esiste_conto = TRUE;
|
||||
|
||||
@ -1493,12 +1493,12 @@ bool CG1500_application::bil_verifica()
|
||||
}
|
||||
_gp = g;
|
||||
_cp = c;
|
||||
}
|
||||
}
|
||||
|
||||
TRecnotype recnum = _pcn->recno();
|
||||
_pcn->next();
|
||||
if (_pcn->eof())
|
||||
{
|
||||
TRecnotype recnum = _pcn->recno();
|
||||
_pcn->next();
|
||||
if (_pcn->eof())
|
||||
{
|
||||
if ( (_verifica == 2) && esiste_conto )
|
||||
{
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
@ -1520,10 +1520,10 @@ bool CG1500_application::bil_verifica()
|
||||
(!((_stampav == 2)&&(saldo_conto == 0))) ) )
|
||||
scrivi_record_conto(prg_conto_dare,prg_conto_avere,mov_conto_dare,
|
||||
mov_conto_avere,saldo_conto);
|
||||
}
|
||||
_pcn->readat(recnum);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
_pcn->readat(recnum);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//bilancio di verifica per data limite
|
||||
|
1750
cg/cg4301.cpp
1750
cg/cg4301.cpp
File diff suppressed because it is too large
Load Diff
522
cg/cg4303.cpp
522
cg/cg4303.cpp
@ -1,3 +1,524 @@
|
||||
<<<<<<< cg4303.cpp
|
||||
// -----------------------------------------------------------------
|
||||
// Calcolo liquidazione
|
||||
// part 4: casi particolari
|
||||
// fv 2-2-94
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
#include "cg4300.h"
|
||||
|
||||
void TLiquidazione_app::add_plafond(int month, const char* codatt, int type,
|
||||
real& howmuch, bool intra)
|
||||
{
|
||||
look_ppa(month,codatt,type);
|
||||
|
||||
TString att(codatt);
|
||||
|
||||
real r0 = _ppa_r->get_real("R0");
|
||||
real r1 = _ppa_r->get_real("R1");
|
||||
real r2 = _ppa_r->get_real("R2");
|
||||
|
||||
if (intra) r1 += howmuch;
|
||||
else r0 += howmuch;
|
||||
|
||||
if (r2 < (r0+r1))
|
||||
describe_error("Acquisti in eccesso rispetto al plafond disponibile",
|
||||
att.cut(5));
|
||||
_ppa_r->put("R0",r0);
|
||||
_ppa_r->put("R1",r1);
|
||||
_ppa->rewrite();
|
||||
}
|
||||
|
||||
void TLiquidazione_app::zero_plafond (int month, const char* codatt)
|
||||
{
|
||||
for (int jj = 1; jj <= 3; jj++) // three types of plafond
|
||||
{
|
||||
real r;
|
||||
look_ppa(month,codatt,jj,TRUE);
|
||||
if (is_first_month(month))
|
||||
{
|
||||
r = (jj == 1 ? _p8 : (jj == 2 ? _p8b : _p9));
|
||||
}
|
||||
else
|
||||
{
|
||||
long rn = _ppa->recno();
|
||||
|
||||
// se non c'e' quello del mese prima c'e' poco da fare,
|
||||
// si ricalcola tutto
|
||||
if (!look_ppa(previous_month(month),codatt,jj))
|
||||
// mazza che bella chiamata ricorsiva
|
||||
{
|
||||
if (_recalc != needed)
|
||||
{
|
||||
describe_error("Progressivi plafond non ricalcolati per "
|
||||
"i mesi precedenti: possibili errori",
|
||||
codatt);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!update_att(previous_month(month),codatt, FALSE))
|
||||
describe_error("Progressivi plafond non ricalcolati per "
|
||||
"i mesi precedenti: possibili errori",
|
||||
codatt);
|
||||
look_ppa(previous_month(month),codatt,jj);
|
||||
}
|
||||
}
|
||||
r = _ppa_r->get_real("R2") -
|
||||
_ppa_r->get_real("R0") -
|
||||
_ppa_r->get_real("R1");
|
||||
|
||||
_ppa->readat(rn);
|
||||
}
|
||||
_ppa_r->put("R2",r);
|
||||
_ppa_r->put("R0","");
|
||||
_ppa_r->put("R1","");
|
||||
_ppa->rewrite();
|
||||
} // for tipo esenzione plafond
|
||||
}
|
||||
|
||||
// ricalcolo dei corrispettivi
|
||||
void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt)
|
||||
{
|
||||
if (_corr_arr.items() == 0) return;
|
||||
// ricalcola (solo per il mese in corso!) operando sull'array
|
||||
for (int i = 0; i < _corr_arr.items(); i++)
|
||||
{
|
||||
_CorrItem* ci = (_CorrItem*)&_corr_arr[i];
|
||||
if (ci->_month != month || ci->_codatt != codatt)
|
||||
continue;
|
||||
|
||||
real imposta = (abs(ci->_totale) * ci->_aliquota)/(ci->_aliquota + 1.00);
|
||||
imposta.ceil();
|
||||
if (ci->_totale.sign() < 0) imposta = -imposta;
|
||||
real imponibile = ci->_totale - imposta;
|
||||
|
||||
// aggiusto l'IVA vendite nei plm
|
||||
look_plm(month, codatt);
|
||||
real ive = _plm->get_real("R0");
|
||||
ive += imposta;
|
||||
_plm->put("R0",ive);
|
||||
_plm->rewrite();
|
||||
// .. e il volume di affari nei pam
|
||||
real vaf = _pam->get_real("R1");
|
||||
vaf += imponibile;
|
||||
_pam->put("R1", vaf);
|
||||
_pam->rewrite();
|
||||
|
||||
// Aggiorno i luridi pim
|
||||
look_pim(month, codatt, ci->_codreg, "", ci->_codiva, ci->_tipodet, TRUE);
|
||||
|
||||
imponibile += _pim->get_real("R0");
|
||||
imposta += _pim->get_real("R1");
|
||||
_pim->put("R0", imponibile);
|
||||
_pim->put("R1", imposta);
|
||||
_pim->rewrite();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ricalcolo della malefica ventilazione
|
||||
void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
||||
{
|
||||
if (!_isvent || _isagricolo || _isviaggio || _vend_arr.items() == 0) return;
|
||||
|
||||
TString att(codatt);
|
||||
|
||||
// 1) ricalcola i pim dei mesi dal primo al corrente se necessario
|
||||
recalc rcl = _recalc;
|
||||
_recalc = needed;
|
||||
for (int m = 1; m < month; m++)
|
||||
update_att(m,codatt, FALSE);
|
||||
_recalc = rcl;
|
||||
|
||||
_vent_arr.destroy();
|
||||
|
||||
for (m = 1; m <= month; m++)
|
||||
{
|
||||
// aggiunge gli acquisti del mese m operando sui pim
|
||||
for (_pim->first(); !_pim->eof(); _pim->next())
|
||||
{
|
||||
if (_year != *_pim_anno) continue;
|
||||
|
||||
// se e' acquisto beni per rivendita
|
||||
int tipocr = atoi(*_pim_tipocr);
|
||||
int mese = atoi(*_pim_mese);
|
||||
int tipodet = atoi(*_pim_tipodet);
|
||||
look_iva(*_pim_codiva);
|
||||
// base di riparto solo se non esente, non soggetto, non imponibile
|
||||
TString16 tipoiva(_iva->get("S1"));
|
||||
TString16 reg = *_pim_codreg;
|
||||
|
||||
|
||||
/*
|
||||
* caso particolare SENSU Vladimiro (1995) #MI3001
|
||||
* questi vengono pero' conteggiati nel totale
|
||||
* acquisti per rivendita
|
||||
*/
|
||||
if (tipocr == 5 && tipodet == 3)
|
||||
continue;
|
||||
|
||||
TString att(codatt);
|
||||
|
||||
if (tipocr == 1 && (mese == m) &&
|
||||
att == (const char*)(*_pim_codatt))
|
||||
{
|
||||
if (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES")
|
||||
{
|
||||
real lurd = _pim->get_real("R0");
|
||||
lurd += _pim->get_real("R1");
|
||||
real perc = _iva->get_real("R0");
|
||||
TString other = _iva->get("S6");
|
||||
if (!other.empty())
|
||||
{
|
||||
// ventila a un altro codice
|
||||
look_iva(other);
|
||||
perc = _iva->get_real("R0");
|
||||
}
|
||||
add_ventilation(perc / CENTO, lurd, *_pim_codiva, other);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2) calcola totale acquisti su tutte le aliquote
|
||||
real totacq = 0.0;
|
||||
real totven = 0.0;
|
||||
|
||||
for (int j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem& vv = (_VentItem&)_vent_arr[j];
|
||||
totacq += vv._totale;
|
||||
}
|
||||
|
||||
// 3) ricalcola (solo per il mese in corso!) operando sull'array
|
||||
for (int i = 0; i < _vend_arr.items(); i++)
|
||||
{
|
||||
_VendItem* vi = (_VendItem*)&_vend_arr[i];
|
||||
if (vi->_month != month)
|
||||
continue;
|
||||
|
||||
// questo serve solo per il prospettino di m.
|
||||
totven += vi->_totale;
|
||||
|
||||
// 3.2) calcola percentuali di ripartizione e prepara l'affettatrice
|
||||
TDistrib dst(vi->_totale,ROUND_LIRA);
|
||||
for (j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
dst.add(vv->_totale/totacq);
|
||||
}
|
||||
|
||||
// 3.3) affetta l'importo
|
||||
for (j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
real imponibile = dst.get();
|
||||
real div(1.0); div += vv->_aliquota;
|
||||
real imposta = imponibile - (imponibile/div);
|
||||
imposta.ceil(ROUND_LIRA);
|
||||
imponibile -= imposta;
|
||||
|
||||
// aggiusto l'IVA vendite nei plm
|
||||
look_plm(month, codatt);
|
||||
real ive = _plm->get_real("R0");
|
||||
ive += imposta;
|
||||
_plm->put("R0",ive);
|
||||
_plm->rewrite();
|
||||
// .. e il volume di affari nei pam
|
||||
real vaf = _pam->get_real("R1");
|
||||
vaf += imponibile;
|
||||
_pam->put("R1", vaf);
|
||||
_pam->rewrite();
|
||||
|
||||
// Aggiorno i luridi pim
|
||||
look_pim(month, codatt, vi->_codreg, "0", vv->_codiva, vi->_tipodet, TRUE);
|
||||
|
||||
imponibile += _pim->get_real("R0");
|
||||
imposta += _pim->get_real("R1");
|
||||
_pim->put("R0", imponibile);
|
||||
_pim->put("R1", imposta);
|
||||
_pim->put("S4", vv->_other);
|
||||
// segnale per comodita'
|
||||
_pim->put("B1","X");
|
||||
_pim->rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
// memorizza totali per il prospettino di m.
|
||||
look_plm(month, codatt);
|
||||
|
||||
// PAM e PUM
|
||||
_pam->put("R2",totacq);
|
||||
_pam->put("R3",totven);
|
||||
_pam->rewrite();
|
||||
}
|
||||
|
||||
|
||||
// questa serve per il rimborso secondo le
|
||||
// nuove cazzonorme
|
||||
class rObj : public TObject
|
||||
{
|
||||
public:
|
||||
real _imp;
|
||||
real _iva;
|
||||
real _perc;
|
||||
|
||||
rObj() {}
|
||||
virtual ~rObj() {}
|
||||
};
|
||||
|
||||
|
||||
// defines per stabilire quale cazzo di metodo piace oggi alla prassi
|
||||
// ------------------------------------------------------------------
|
||||
// Considera tutti i mesi del trimestre fino a quello indicato
|
||||
// se lasciato indefinito usa solo il mese passato
|
||||
#define OGGI_GLI_TIRA_DI_USARE_TRE_MESI
|
||||
|
||||
_DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
|
||||
bool stliq)
|
||||
{
|
||||
// calcola condizioni per il diritto al rimborso infracazzuale
|
||||
// chiamata soltanto per i trimestri anche se annuale
|
||||
// aggiornata a normative per anno liq. > 1994
|
||||
|
||||
bool rimborsami = FALSE;
|
||||
_DescrItem* d = NULL;
|
||||
TToken_string atts(codatts);
|
||||
const char* tmpatt;
|
||||
TString att;
|
||||
|
||||
real es_ni = 0.0;
|
||||
real vol_aff = 0.0;;
|
||||
|
||||
while ((tmpatt = atts.get()) != NULL)
|
||||
{
|
||||
att = tmpatt;
|
||||
#ifdef OGGI_GLI_TIRA_DI_USARE_TRE_MESI
|
||||
for (int m = (month == 13 ? 1 : (next_trim(month)-2)); m <= month; m++)
|
||||
{
|
||||
#else
|
||||
int m = month;
|
||||
#endif
|
||||
if (!look_plm(m,att)) continue;
|
||||
|
||||
vol_aff += _pam->get_real("R1");
|
||||
es_ni += _pum->get_real("R12");
|
||||
#ifdef OGGI_GLI_TIRA_DI_USARE_TRE_MESI
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// condizione 1
|
||||
real prc = es_ni/vol_aff; prc.round(2);
|
||||
|
||||
if (stliq && !vol_aff.is_zero() && prc > MIN_PARTE_ESENTE)
|
||||
{
|
||||
rimborsami = TRUE;
|
||||
d = new _DescrItem(RIMBORSO);
|
||||
d->_f0 = TRUE;
|
||||
d->_r0 = es_ni;
|
||||
d->_r1 = vol_aff;
|
||||
}
|
||||
|
||||
// ---------------------- condizione 2
|
||||
// u' casinu pazzescu d'u nuiu guvernu
|
||||
|
||||
real vtot = 0.0;
|
||||
real atot = 0.0;
|
||||
real ivav = 0.0;
|
||||
real ivaa = 0.0;
|
||||
|
||||
real alv = 0.0; // aliquota media vendite
|
||||
real ala = 0.0; // aliquota media acquisti
|
||||
|
||||
/***********************************************************************
|
||||
Sembra che sia stato annullato subito dopo che ho finito di scrivere
|
||||
queste 150 righe di casino
|
||||
***********************************************************************
|
||||
// due array dove ficcare i totali per
|
||||
// codiva in ordine di imponibile
|
||||
TArray varr, aarr;
|
||||
|
||||
// scorri i bellissimi progressivi mensili rimborso
|
||||
for (_rmb->first(); !_rmb->eof(); _rmb->next())
|
||||
{
|
||||
int year = atoi((const char*)_year);
|
||||
int ryear = atoi((const char*)(*_rmb_anno));
|
||||
int rmese = atoi((const char*)(*_rmb_mese));
|
||||
|
||||
if (year != ryear || (rmese < (month - 2) || rmese > month))
|
||||
continue;
|
||||
|
||||
real imp = _rmb->get("R0");
|
||||
real iva = _rmb->get("R1");
|
||||
real per = _rmb->get("R2");
|
||||
|
||||
rObj* rb = new rObj;
|
||||
rb->_imp = imp;
|
||||
rb->_iva = iva;
|
||||
rb->_perc = per;
|
||||
|
||||
TArray& arr = (tiporeg)atoi((const char*)(*_rmb_tiporeg)) == vendita ? varr : aarr;
|
||||
|
||||
for (int i = 0; i < arr.items(); i++)
|
||||
{
|
||||
rObj& robj = (rObj&)arr[i];
|
||||
if (robj._imp < imp)
|
||||
break;
|
||||
}
|
||||
arr.insert(rb, i);
|
||||
|
||||
// totali imponibili
|
||||
if ((tiporeg)atoi((const char*)(*_rmb_tiporeg)) == vendita)
|
||||
vtot += imp;
|
||||
else
|
||||
atot += imp;
|
||||
}
|
||||
|
||||
// se ci sono due o piu' imponibili uguali devo
|
||||
// sostituire l'imposta con la media delle aliquote
|
||||
// ciclo uguale sui due array
|
||||
for (int w = 0; w < 2; w++)
|
||||
{
|
||||
TArray& arr = w == 0 ? varr : aarr;
|
||||
for (int i = 0; i < arr.items(); i++)
|
||||
{
|
||||
rObj& robj = (rObj&)arr[i];
|
||||
real impref = robj._imp;
|
||||
real perc = robj._perc;
|
||||
|
||||
for (int j = i+1; j < arr.items(); j++)
|
||||
{
|
||||
rObj& rbj = (rObj&)arr[j];
|
||||
if (rbj._imp != impref)
|
||||
break;
|
||||
perc += rbj._perc;
|
||||
}
|
||||
// riaggiustesbimo
|
||||
if (j > i+1)
|
||||
{
|
||||
// funzionerebbe comunque ma risparmiamo una
|
||||
// divisione per 1
|
||||
real ndiv(j-i);
|
||||
perc /= ndiv;
|
||||
for (; i < j; i++)
|
||||
{
|
||||
rObj& rbj = (rObj&)arr[i];
|
||||
rbj._iva = rbj._imp * (perc/CENTO);
|
||||
rbj._iva.round(ROUND_LIRA);
|
||||
}
|
||||
i --;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 51 per cento
|
||||
vtot *= PERC_IMP_RIMBORSABILE;
|
||||
atot *= PERC_IMP_RIMBORSABILE;
|
||||
|
||||
for (w = 0; w < 2; w++)
|
||||
{
|
||||
TArray& arr = w == 0 ? varr : aarr;
|
||||
real timp = w == 0 ? vtot : atot;
|
||||
real tiva = 0.0;
|
||||
|
||||
for (int i = 0; i < arr.items(); i++)
|
||||
{
|
||||
rObj& robj = (rObj&)arr[i];
|
||||
if (timp >= robj._imp)
|
||||
{
|
||||
tiva += robj._iva;
|
||||
timp -= robj._imp;
|
||||
}
|
||||
else
|
||||
{
|
||||
real perc = timp/robj._imp;
|
||||
if (!perc.is_zero())
|
||||
{
|
||||
real ttiv = robj._iva * perc;
|
||||
ttiv.round(ROUND_LIRA);
|
||||
tiva += ttiv;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (w == 0) ivav = tiva;
|
||||
else ivaa = tiva;
|
||||
}
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
// scorri i bellissimi progressivi mensili
|
||||
for (_pim->first(); !_pim->eof(); _pim->next())
|
||||
{
|
||||
int year = atoi((const char*)_year);
|
||||
int ryear = atoi(*_pim_anno);
|
||||
int rmese = atoi(*_pim_mese);
|
||||
|
||||
// B3 significa che e' acq. o vendita valido per rimb. per aliquota
|
||||
if (!_pim->get_bool("B3")) continue;
|
||||
|
||||
#ifdef OGGI_GLI_TIRA_DI_USARE_TRE_MESI
|
||||
if (year != ryear ||
|
||||
(month != 13 && (rmese < (next_trim(month)-2) || rmese > month)))
|
||||
continue;
|
||||
#else
|
||||
if (year != ryear || (month != rmese))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
int tipomov = (tiporeg)_pim->get_long("I1");
|
||||
|
||||
real imp = _pim->get("R0");
|
||||
real iva = _pim->get("R1");
|
||||
|
||||
// totali imponibili
|
||||
if (tipomov == vendita)
|
||||
{
|
||||
vtot += imp;
|
||||
ivav += iva;
|
||||
}
|
||||
else
|
||||
{
|
||||
atot += imp;
|
||||
ivaa += iva;
|
||||
}
|
||||
}
|
||||
|
||||
// finalmente
|
||||
alv = ivav/vtot; alv.round(4);
|
||||
ala = ivaa/atot; ala.round(4);
|
||||
|
||||
// vedi condizioni
|
||||
rimborsami = ala > alv;
|
||||
if (rimborsami)
|
||||
{
|
||||
// vedi di quanto ala eccede alv; deve essere > 10%
|
||||
real ecc = ((ala/alv) - real(1.0));
|
||||
rimborsami = (ecc >= SOGLIA_MAGGIORE_ALIQUOTA_DEL_CAZZO_PER_AVER_DIRITTO_AL_RIMBORSO);
|
||||
}
|
||||
|
||||
if (stliq && rimborsami)
|
||||
{
|
||||
if (d == NULL) d = new _DescrItem(RIMBORSO);
|
||||
d->_f1 = TRUE;
|
||||
d->_r2 = vtot;
|
||||
d->_r3 = atot;
|
||||
d->_r4 = ivav;
|
||||
d->_r5 = ivaa;
|
||||
d->_r6 = alv * CENTO;
|
||||
d->_r7 = ala * CENTO;
|
||||
}
|
||||
|
||||
if (rimborsami && is_month_ok_strict(month))
|
||||
{
|
||||
look_lim(month);
|
||||
_lim->put("B2", "X");
|
||||
_lim->rewrite();
|
||||
}
|
||||
return d;
|
||||
}
|
||||
=======
|
||||
// -----------------------------------------------------------------
|
||||
// Calcolo liquidazione
|
||||
// part 4: casi particolari
|
||||
@ -536,3 +1057,4 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
|
||||
}
|
||||
return d;
|
||||
}
|
||||
>>>>>>> 1.41
|
||||
|
@ -1,5 +1,6 @@
|
||||
// cg4400.cpp
|
||||
// *******************
|
||||
// Stampa registri IVA
|
||||
// *******************
|
||||
#include "cg4.h"
|
||||
#include "cg4400.h"
|
||||
#include "cg4400a.h"
|
||||
@ -135,8 +136,6 @@ bool CG4400_application::mask_mese (TMask_field& f, KEY k)
|
||||
f.mask().hide (TIPO_RIEPILOGATIVO);
|
||||
f.mask().hide (RIF_VID);
|
||||
}
|
||||
//TMask_field& cc = f.mask().field(CODICE_LIB_UN);
|
||||
//cc.set_dirty();
|
||||
}
|
||||
if (id == FINO_A_MESE)
|
||||
{
|
||||
@ -202,7 +201,7 @@ bool CG4400_application::look_reg(int i, int anno, TString& codlib, int m, const
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese, long ditta, bool* st)
|
||||
bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese, long ditta, TProgind* prog)
|
||||
{
|
||||
int a, tipo;
|
||||
TString16 codtab;
|
||||
@ -239,8 +238,9 @@ bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese,
|
||||
if (month < m - 1)
|
||||
{
|
||||
app().set_firm(__firm);
|
||||
*st = FALSE;
|
||||
return error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta);
|
||||
delete prog;
|
||||
error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta);
|
||||
app().stop_run();
|
||||
}
|
||||
ok = TRUE;
|
||||
}
|
||||
@ -250,25 +250,25 @@ bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese,
|
||||
|
||||
bool CG4400_application::mask_libun (TMask_field& f, KEY k)
|
||||
{
|
||||
static bool can_print = TRUE;
|
||||
|
||||
if (k == K_ENTER) return can_print;
|
||||
|
||||
if (k==K_TAB && f.mask().is_running())
|
||||
{
|
||||
TString16 cod(f.mask().get(CODICE_LIBRO_IVA));
|
||||
TString16 codlib(f.mask().get(CODICE_LIB_UN));
|
||||
//modifica del 26/04/1995
|
||||
if (codlib.empty())
|
||||
{
|
||||
app()._test = TRUE;
|
||||
return f.error_box("Inserire il codice del libro unico");
|
||||
return FALSE;
|
||||
}
|
||||
//fine modifica
|
||||
|
||||
if (app()._selected.ones() == 0l) return FALSE;
|
||||
|
||||
TProgind* p = new TProgind(app()._ditte->items()/2,"Verifica parametri in corso...",FALSE,TRUE,30);
|
||||
|
||||
TString16 cod(f.mask().get(CODICE_LIBRO_IVA));
|
||||
int fino_a_mese = f.mask().get_int(MESE);
|
||||
int anno = f.mask().get_int(ANNO);
|
||||
bool ok = FALSE;
|
||||
can_print = TRUE;
|
||||
int last_mese = 13;
|
||||
int mese = 0;
|
||||
|
||||
@ -276,9 +276,11 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k)
|
||||
|
||||
for (int i = 0; i < app()._ditte->items(); i++)
|
||||
{
|
||||
//p->addstatus(1);
|
||||
long ditta = app()._ditte->row(i).get_long(1);
|
||||
if (prefix().exist(ditta))
|
||||
{
|
||||
p->addstatus(1);
|
||||
app().set_firm(ditta);
|
||||
if (cod.not_empty())
|
||||
{
|
||||
@ -286,28 +288,26 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k)
|
||||
if (!ok)
|
||||
{
|
||||
//modifica del 21/04/1995 suggerita da Cinzia!!!
|
||||
/*****Rimodifica del 19/07/95 MI0817
|
||||
if (app()._selected.ones() == 1L) //solo se ho selezionato 1 ditta devo dare il messaggio
|
||||
if (app()._selected[i])
|
||||
f.message_box("Ditta %ld: il registro %s non soddisfa i parametri indicati", ditta, (const char*)cod);
|
||||
*****/
|
||||
continue;
|
||||
}
|
||||
//if (mese != 0 && mese < fino_a_mese - 1) //indipendentemente se si tratta di una ditta selezionata oppure no
|
||||
if (mese < fino_a_mese - 1) //indipendentemente se si tratta di una ditta selezionata oppure no
|
||||
{
|
||||
app().set_firm(app().__firm);
|
||||
can_print = FALSE;
|
||||
return error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta);
|
||||
delete p;
|
||||
f.error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta);
|
||||
app().stop_run();
|
||||
}
|
||||
//modifica del 30/06/1995
|
||||
}
|
||||
else
|
||||
{
|
||||
ok = app().look_regs(anno,codlib,fino_a_mese,&mese,ditta,&can_print);
|
||||
//if ( app()._selected[i] && !ok )
|
||||
ok = app().look_regs(anno,codlib,fino_a_mese,&mese,ditta,p);
|
||||
if (!ok)
|
||||
{
|
||||
if (!can_print)
|
||||
return FALSE;
|
||||
if (app()._selected.ones() == 1L) //solo se ho selezionato 1 ditta devo dare il messaggio
|
||||
if (app()._selected[i])
|
||||
f.message_box("Ditta %ld: nessun registro soddisfa i parametri indicati", ditta);
|
||||
@ -325,13 +325,13 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k)
|
||||
const char* me = "";
|
||||
me = format("%02d", last_mese);
|
||||
f.mask().set(ULTIMO_MESE, me);
|
||||
delete p;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::mask_cod (TMask_field& f, KEY k)
|
||||
{
|
||||
//if (k == K_TAB || f.focusdirty())
|
||||
if (k == K_TAB)
|
||||
{
|
||||
TTable TabLbu ("%LBU");
|
||||
@ -1512,7 +1512,8 @@ void CG4400_application::stampa_plafonds(int r)
|
||||
{
|
||||
real r8 = ZERO;
|
||||
r8 = stampa_valori_plafonds(r1, num, ppa, "1");
|
||||
if (r8 > ZERO)
|
||||
//if (r8 > ZERO)
|
||||
if (!r8.is_zero())
|
||||
{
|
||||
real pri = ZERO;
|
||||
real pre = ZERO;
|
||||
@ -1543,7 +1544,8 @@ void CG4400_application::stampa_plafonds(int r)
|
||||
{
|
||||
real r8b = ZERO;
|
||||
r8b = stampa_valori_plafonds(r2, num, ppa, "2");
|
||||
if (r8b > ZERO)
|
||||
//if (r8b > ZERO)
|
||||
if (!r8b.is_zero())
|
||||
{
|
||||
real pri = ZERO;
|
||||
real pre = ZERO;
|
||||
@ -1575,7 +1577,8 @@ void CG4400_application::stampa_plafonds(int r)
|
||||
{
|
||||
real r9 = ZERO;
|
||||
r9 = stampa_valori_plafonds(r3, num, ppa, "3");
|
||||
if (r9 > ZERO)
|
||||
//if (r9 > ZERO)
|
||||
if (!r9.is_zero())
|
||||
{
|
||||
real pri = ZERO;
|
||||
real pre = ZERO;
|
||||
@ -1597,7 +1600,7 @@ void CG4400_application::stampa_plafonds(int r)
|
||||
}
|
||||
real x = r9 - pri - pre;
|
||||
r++;
|
||||
set_row(r++, "ART. 8 bis 1° comma Disponibile %r", &r9);
|
||||
set_row(r++, "ART. 9 1° comma Disponibile %r", &r9);
|
||||
set_row(r++, "Utilizzato all'interno@44g%r", &pri);
|
||||
set_row(r++, "Utilizzato per l'importazione@44g%r riporto %r", &pre, &x);
|
||||
}
|
||||
@ -2481,8 +2484,6 @@ print_action CG4400_application::postprocess_page (int file, int counter)
|
||||
|
||||
bool CG4400_application::set_print(int n)
|
||||
{
|
||||
printer().read_configuration(); // Ripristina stampante standard
|
||||
|
||||
TMask m ("cg4400a");
|
||||
int giorni_del_mese;
|
||||
bool ok;
|
||||
@ -2502,7 +2503,7 @@ bool CG4400_application::set_print(int n)
|
||||
m.set_handler (BUT_DFR, fr_butt_handler);
|
||||
m.set_handler (ANNO, year_handler);
|
||||
|
||||
m.set(F_SELECT, _selected.ones());
|
||||
m.field(F_SELECT).set(format("%ld",_selected.ones()));
|
||||
set_choice_limits(m);
|
||||
|
||||
//printer().footerlen(5);
|
||||
@ -2673,10 +2674,10 @@ void CG4400_application::no_movimenti()
|
||||
else a = _fino_a_mese;
|
||||
for (int m = da; m <= a; m++)
|
||||
{
|
||||
if (! printer().isopen())
|
||||
printer().open();
|
||||
if (stampo_liquidazione(m))
|
||||
{
|
||||
if (! printer().isopen())
|
||||
printer().open();
|
||||
TFilename f;
|
||||
f.temp("rgp");
|
||||
// _datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header
|
||||
@ -2836,7 +2837,7 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
continue;
|
||||
if (_u_data.ok())
|
||||
if (_fino_a_mese < _u_data.month()) //significa che e' gia'
|
||||
continue;
|
||||
continue; //stato stampato
|
||||
}
|
||||
msg = FALSE;
|
||||
|
||||
@ -2898,10 +2899,10 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
}
|
||||
} //for
|
||||
if (msg)
|
||||
//if ( (_tipo_stampa != 3) || (_tipo_stampa == 3 && _fino_a_mese == 1) )
|
||||
if ( (_tipo_stampa != 3) || (_tipo_stampa == 3 && _fino_a_mese == 1 && _selected.ones() == 1L) ) //il messaggio seguente, nel caso di stampa su libro unico,
|
||||
message_box("Ditta %ld: nessun registro soddisfa i parametri indicati", _ditta); //viene gia' dato nell'handler (che scatta pero' se il mese di
|
||||
} //stampa e' diverso da gennaio
|
||||
//if ( (_tipo_stampa != 3) || (_tipo_stampa == 3 && _fino_a_mese == 1 && _selected.ones() == 1L) ) //il messaggio seguente, nel caso di stampa su libro unico,
|
||||
if(_tipo_stampa == 3 && _fino_a_mese == 1 && _selected.ones() == 1L)
|
||||
message_box("Ditta %ld: nessun registro soddisfa i parametri indicati", _ditta); //viene gia' dato nell'handler
|
||||
} //da Gennaio)
|
||||
}
|
||||
}
|
||||
TApplication::set_firm(__firm);
|
||||
@ -2915,10 +2916,10 @@ void CG4400_application::stampa_liq_mesi_succ()
|
||||
int a = _data_a.month();
|
||||
for (int m = da; m <= a; m++)
|
||||
{
|
||||
if (!printer().isopen())
|
||||
printer().open();
|
||||
if (stampo_liquidazione(m))
|
||||
{
|
||||
if (!printer().isopen())
|
||||
printer().open();
|
||||
// _datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header (intestazione per la stampa liquidazione)
|
||||
_datareg = TDate(1, m, _annoes); // Meglio cosi'
|
||||
TFilename t;
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
bool ventilazione(const char*);
|
||||
bool cerca_libro_gio(TString&, bool*);
|
||||
bool look_reg (int, int, TString&, int, const char*, int*, long);
|
||||
bool look_regs(int, TString&, int, int*, long, bool*);
|
||||
bool look_regs(int, TString&, int, int*, long, TProgind*);
|
||||
bool stampa_totali_finali();
|
||||
bool stampa_datareg();
|
||||
bool stampa_registri_IVA(const TMask&);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "cg4400b.h"
|
||||
|
||||
PAGE "Stampa registri IVA" -1 -1 78 14
|
||||
PAGE "Stampa registri IVA" -1 -1 78 12
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
|
@ -576,7 +576,7 @@ TRectype& TSaldo::ricerca_progr_prec (int annoesprec, int g, int c, long s)
|
||||
(*_saldo_ep) = saldi.curr();
|
||||
saldi.setkey(oldkey);
|
||||
|
||||
// riposiziona...
|
||||
// riposiziona...
|
||||
saldi.zero();
|
||||
saldi.put(SLD_GRUPPO,g);
|
||||
saldi.put(SLD_CONTO,c);
|
||||
|
Loading…
x
Reference in New Issue
Block a user