Modifiche al programma di calcolo/stampa liquidazione per nuovo
prospetto agricolo a partire dal 1998. git-svn-id: svn://10.65.10.50/trunk@5517 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
cead731ced
commit
2dc82934ed
@ -94,7 +94,7 @@ bool TLiquidazione_app::user_create()
|
||||
_att_r = &(_nditte->curr(LF_ATTIV));
|
||||
|
||||
_ditte = new TArray_sheet(-1, -1, -4, -4, "Selezione Ditte",
|
||||
"@1|Cod.@5R|Ragione Sociale@50|Vers.");
|
||||
"@1|Cod.@5R|Ragione Sociale@50|Vers.|Agr.Min");
|
||||
_n_ditte = 0l;
|
||||
|
||||
// Caro tab11, ricordati che un giorno sarai un file unico!
|
||||
@ -109,6 +109,7 @@ bool TLiquidazione_app::user_create()
|
||||
{
|
||||
TDate oggi(TODAY);
|
||||
_year.format("%d",oggi.year());
|
||||
_month = oggi.month();
|
||||
TConfig conf(CONFIG_STUDIO);
|
||||
_sind11 = conf.get_bool("Sind11");
|
||||
}
|
||||
@ -145,6 +146,8 @@ bool TLiquidazione_app::user_create()
|
||||
|
||||
_rel = new TRelation(LF_MOV);
|
||||
_rel->add(LF_RMOVIVA,"NUMREG=NUMREG");
|
||||
_rel->add(LF_PCON,"GRUPPO=GRUPPO|CONTO=CONTO",1,LF_RMOVIVA,AGR_PCON1);
|
||||
_rel->add(LF_PCON,"GRUPPO=GRUPPO|CONTO=CONTO|SOTTOCONTO=SOTTOCONTO",1,LF_RMOVIVA,AGR_PCON2);
|
||||
_rel->add(LF_CAUSALI,"CODCAUS=CODCAUS");
|
||||
|
||||
_cur = new TCursor(_rel, "", 2);
|
||||
@ -156,6 +159,7 @@ bool TLiquidazione_app::user_create()
|
||||
_pom = new TTable("POM");
|
||||
_ppa = new TTable("PPA");
|
||||
_plm = new TTable("PLM");
|
||||
_pia = new TTable("PIA");
|
||||
_lim = new TTable("LIM");
|
||||
_lam = new TTable("LAM");
|
||||
_pla = new TTable("%PLA");
|
||||
@ -166,9 +170,12 @@ bool TLiquidazione_app::user_create()
|
||||
|
||||
_mov = &_cur->file(LF_MOV);
|
||||
_rmoviva = &_cur->file(LF_RMOVIVA);
|
||||
_pcon_1 = &_cur->file(-AGR_PCON1);
|
||||
_pcon_2 = &_cur->file(-AGR_PCON2);
|
||||
|
||||
_pim_r = &(_pim->curr());
|
||||
_plm_r = &(_plm->curr());
|
||||
_pia_r = &(_pia->curr());
|
||||
_pum_r = &(_pum->curr());
|
||||
_pam_r = &(_pam->curr());
|
||||
_pom_r = &(_pom->curr());
|
||||
@ -179,9 +186,11 @@ bool TLiquidazione_app::user_create()
|
||||
_pla_r = &(_pla->curr());
|
||||
_ppa_r = &(_ppa->curr());
|
||||
_reg_r = &(_reg->curr());
|
||||
_rmoviva_r = &(_cur->curr(LF_RMOVIVA));
|
||||
_mov_r = &(_mov->curr());
|
||||
|
||||
_rmoviva_r = &(_cur->curr(LF_RMOVIVA));
|
||||
_pcon_1_r = &(_cur->curr(-AGR_PCON1));
|
||||
_pcon_2_r = &(_cur->curr(-AGR_PCON2));
|
||||
|
||||
// ACHTUNG: tutti i _codatt (codici attivita') sono
|
||||
// in realta' composti dal codice attivita' piu' il
|
||||
// tipo attivita' (1 o 2)
|
||||
@ -212,6 +221,12 @@ bool TLiquidazione_app::user_create()
|
||||
_plm_codatt = new TRecfield(*_plm_r,"CODTAB",4,9);
|
||||
_plm_mese = new TRecfield(*_plm_r,"CODTAB",10,11);
|
||||
|
||||
_pia_anno = new TRecfield(*_pia_r,"CODTAB",0,3);
|
||||
_pia_codatt = new TRecfield(*_pia_r,"CODTAB",4,9);
|
||||
_pia_mese = new TRecfield(*_pia_r,"CODTAB",10,11);
|
||||
_pia_codord = new TRecfield(*_pia_r,"CODTAB",12,15);
|
||||
_pia_codcom = new TRecfield(*_pia_r,"CODTAB",16,19);
|
||||
|
||||
_pla_ditta = new TRecfield(*_pla_r,"CODTAB",0,4);
|
||||
_pla_anno = new TRecfield(*_pla_r,"CODTAB",5,8);
|
||||
_pla_codatt = new TRecfield(*_pla_r,"CODTAB",9,14);
|
||||
@ -348,6 +363,11 @@ bool TLiquidazione_app::user_destroy()
|
||||
delete _plm_anno;
|
||||
delete _plm_codatt;
|
||||
delete _plm_mese;
|
||||
delete _pia_anno;
|
||||
delete _pia_codatt;
|
||||
delete _pia_mese;
|
||||
delete _pia_codord;
|
||||
delete _pia_codcom;
|
||||
delete _pum_anno;
|
||||
delete _pum_codatt;
|
||||
delete _pum_mese;
|
||||
@ -376,6 +396,7 @@ bool TLiquidazione_app::user_destroy()
|
||||
delete _pom;
|
||||
delete _ppa;
|
||||
delete _plm;
|
||||
delete _pia;
|
||||
delete _lim;
|
||||
delete _lam;
|
||||
delete _pla;
|
||||
@ -448,7 +469,7 @@ bool TLiquidazione_app::set_print(int)
|
||||
_month = 12;
|
||||
_selected.reset();
|
||||
_ditte->check(-1, FALSE);
|
||||
build_ditte_sheet(all);
|
||||
build_ditte_sheet(all);
|
||||
real inf; real ina; // cotale obbrobrio non fu da me cercato, ne' mai condiviso
|
||||
while (set_acconto(inf, ina))
|
||||
{
|
||||
@ -515,7 +536,7 @@ bool TLiquidazione_app::ch_year_handler(TMask_field& f, KEY key)
|
||||
app().build_nomiditte();
|
||||
app().build_ditte_sheet(f.mask().source_file() == "cg4300a.msk" ?
|
||||
(wht)atoi(f.mask().get(CG43_RDB_VERS)) :
|
||||
all);
|
||||
all);
|
||||
app().end_wait();
|
||||
}
|
||||
return TRUE;
|
||||
@ -535,7 +556,8 @@ void TLiquidazione_app::build_nomiditte(TProgind* pnd)
|
||||
if (good)
|
||||
{
|
||||
// check no parametri liquidazione
|
||||
if (!look_lia(dt.get_long("CODDITTA"))) good = FALSE;
|
||||
if (!look_lia(dt.get_long("CODDITTA")))
|
||||
good = FALSE;
|
||||
}
|
||||
else continue;
|
||||
|
||||
@ -544,9 +566,16 @@ void TLiquidazione_app::build_nomiditte(TProgind* pnd)
|
||||
// add record
|
||||
d->add(dt.get("CODDITTA"));
|
||||
d->add(dt.get("RAGSOC"));
|
||||
if (good) d->add(_lia->get("S7"));
|
||||
else d->add("??");
|
||||
|
||||
if (good)
|
||||
{
|
||||
d->add(_lia->get("S7"));
|
||||
d->add(_lia->get("B2"));
|
||||
}
|
||||
else
|
||||
{
|
||||
d->add("??");
|
||||
d->add("??");
|
||||
}
|
||||
_nomiditte.add(d);
|
||||
}
|
||||
if (pnd) pnd->addstatus(1);
|
||||
@ -615,21 +644,42 @@ bool TLiquidazione_app::what_freq_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_SPACE)
|
||||
{
|
||||
int month = f.mask().get_int(CG43_LST_MESE);
|
||||
if (f.get()[0] == '3') // trimestre intelligente
|
||||
{
|
||||
int month = f.mask().get_int(CG43_LST_MESE);
|
||||
if (month > 3)
|
||||
while (!is_trim(month)) month--;
|
||||
else month = 3;
|
||||
|
||||
f.mask().field(CG43_LST_TRIM).set(format("%d",month));
|
||||
}
|
||||
app().set_month(month);
|
||||
app().reset_choices(f.mask());
|
||||
app().build_ditte_sheet((wht)atoi(f.get()));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::lst_tm_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (f.to_check(key))
|
||||
{
|
||||
const int m = atoi(f.get());
|
||||
const bool change = (app()._month != 13 && m == 13) || (app()._month == 13 && m != 13);
|
||||
if (change)
|
||||
{
|
||||
app().begin_wait();
|
||||
//app().reset_choices(f.mask());
|
||||
app().set_month(m);
|
||||
app().build_ditte_sheet(f.mask().source_file() == "cg4300a.msk" ?
|
||||
(wht)atoi(f.mask().get(CG43_RDB_VERS)) :
|
||||
all);
|
||||
app().end_wait();
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::select_button(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_SPACE)
|
||||
@ -686,15 +736,17 @@ void TLiquidazione_app::set_choice_limits(TMask& m)
|
||||
void TLiquidazione_app::build_ditte_sheet(wht what)
|
||||
{
|
||||
// build sheet
|
||||
const int items = _nomiditte.items();
|
||||
_ditte->destroy();
|
||||
_what = what;
|
||||
for (int i = 0; i < _nomiditte.items(); i++)
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
TToken_string* d = new TToken_string(64);
|
||||
*d = (TToken_string&)_nomiditte[i];
|
||||
const char vers = d->get_char(2);
|
||||
const bool agr = d->get_char(3) == 'X';
|
||||
|
||||
bool unselectable = vers == '?';
|
||||
bool unselectable = vers == '?' || (_year > "1997" && _month < 13 && agr);
|
||||
if ((what == mnt && vers == 'T') || (what == trimestre && vers == 'M'))
|
||||
continue;
|
||||
|
||||
@ -723,6 +775,8 @@ bool TLiquidazione_app::set_liquidazione()
|
||||
m.set_handler(CG43_FLD_DFR, fr_ditt_handler);
|
||||
m.set_handler(CG43_RDB_VERS, what_freq_handler);
|
||||
m.set_handler(CG43_FLD_ANNO, ch_year_handler);
|
||||
m.set_handler(CG43_LST_MESE, lst_tm_handler);
|
||||
m.set_handler(CG43_LST_TRIM, lst_tm_handler);
|
||||
m.set_handler(CG43_BUT_SEL, select_button);
|
||||
m.set_handler(CG43_BUT_ANN, reset_button);
|
||||
|
||||
|
21
cg/cg4300.h
21
cg/cg4300.h
@ -23,6 +23,10 @@ class TProgind;
|
||||
// Parametri modificabili
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
// Fucked aliases to complain with new agricoltural rules
|
||||
#define AGR_PCON1 201
|
||||
#define AGR_PCON2 202
|
||||
|
||||
// arrotondamento default
|
||||
// da cambiare se la lira si appesantisce o in caso di inflazione polacca
|
||||
#define ROUND_LIRA (0)
|
||||
@ -98,6 +102,7 @@ enum tbc { precedente = 1, incorso = 2};
|
||||
#define DELEGA 17 // descrizione versamenti
|
||||
#define PIM_HEAD 18 // bytes sprecati per far vedere l'intestazione pim
|
||||
#define LIQACC 19 // prospetto liquidazione acconto
|
||||
#define PROGAGR 20 // progressivi per prospetto agricolo dal 1998
|
||||
|
||||
// ...............................................................
|
||||
// support structs
|
||||
@ -234,6 +239,7 @@ class TLiquidazione_app : public TPrint_application
|
||||
bool _isricacq; // ricalcolo imposte acq. riv (par. ditta)
|
||||
bool _isdifferita; // liquidazione differita e mese != 13
|
||||
bool _isdiffacc; // liq. differita (usato per stampa registri)
|
||||
bool _isagr98; // TRUE se l'anno e' > 1997 e si sta calcolando una attivita' agricola
|
||||
bool _recalc_only; // solo ricalcolo progressivi
|
||||
bool _calcall; // tutte le ditte nessuna esclusa
|
||||
bool _isbase; // stampa base di calcolo acconto
|
||||
@ -286,6 +292,8 @@ class TLiquidazione_app : public TPrint_application
|
||||
TRelation* _nditte;
|
||||
TLocalisamfile* _mov;
|
||||
TLocalisamfile* _rmoviva;
|
||||
TLocalisamfile* _pcon_1;
|
||||
TLocalisamfile* _pcon_2;
|
||||
|
||||
TInteressi_IVA_table* _ver;
|
||||
|
||||
@ -294,6 +302,7 @@ class TLiquidazione_app : public TPrint_application
|
||||
TTable* _pam;
|
||||
TTable* _pom;
|
||||
TTable* _plm;
|
||||
TTable* _pia;
|
||||
TTable* _lim;
|
||||
TTable* _lam;
|
||||
TTable* _pla;
|
||||
@ -306,6 +315,8 @@ class TLiquidazione_app : public TPrint_application
|
||||
// a reference rectype per file/table
|
||||
TRectype* _mov_r;
|
||||
TRectype* _rmoviva_r;
|
||||
TRectype* _pcon_1_r;
|
||||
TRectype* _pcon_2_r;
|
||||
TRectype* _iva_r;
|
||||
TRectype* _pim_r;
|
||||
TRectype* _pum_r;
|
||||
@ -315,6 +326,7 @@ class TLiquidazione_app : public TPrint_application
|
||||
TRectype* _nditte_r;
|
||||
TRectype* _pla_r;
|
||||
TRectype* _plm_r;
|
||||
TRectype* _pia_r;
|
||||
TRectype* _ppa_r;
|
||||
TRectype* _lim_r;
|
||||
TRectype* _lam_r;
|
||||
@ -345,6 +357,11 @@ class TLiquidazione_app : public TPrint_application
|
||||
TRecfield* _plm_anno;
|
||||
TRecfield* _plm_codatt;
|
||||
TRecfield* _plm_mese;
|
||||
TRecfield* _pia_anno;
|
||||
TRecfield* _pia_codatt;
|
||||
TRecfield* _pia_mese;
|
||||
TRecfield* _pia_codord;
|
||||
TRecfield* _pia_codcom;
|
||||
|
||||
TRecfield* _pla_ditta;
|
||||
TRecfield* _pla_anno;
|
||||
@ -390,7 +407,8 @@ public:
|
||||
void reset_choices(TMask&);
|
||||
void set_choice_limits(TMask&);
|
||||
void build_nomiditte(TProgind* pnd = NULL);
|
||||
void set_year(const char* y) { _year = y; }
|
||||
void set_year(const char* y) { _year = y; }
|
||||
void set_month(const int m) { _month = m; }
|
||||
|
||||
bool set_liquidazione();
|
||||
bool recalc_all();
|
||||
@ -515,6 +533,7 @@ public:
|
||||
bool look_pam(int m, const char* a, bool create = FALSE);
|
||||
bool look_pom(int m, const char* a, bool create = FALSE);
|
||||
bool look_plm(int m, const char* a, bool create = FALSE);
|
||||
bool look_pia(int m, const char* a, const char* cod1, const char* cod2, bool create = FALSE);
|
||||
bool look_lim(int m, bool create = FALSE);
|
||||
bool look_lam(int m, bool create = FALSE);
|
||||
bool look_pla(const char* a, bool create = FALSE);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <attiv.h>
|
||||
#include <tab1100.h>
|
||||
#include <mov.h>
|
||||
#include <pconti.h>
|
||||
#include "cg4300.h"
|
||||
|
||||
#ifdef DBG
|
||||
@ -245,6 +246,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
||||
|
||||
_isviaggio = _nditte->curr(LF_ATTIV).get_bool("REG74TER");
|
||||
_isagricolo = _nditte->curr(LF_ATTIV).get_bool("REGAGR");
|
||||
_isagr98 = _isagricolo && atoi(_year) > 1997;
|
||||
_isvent = FALSE;
|
||||
|
||||
if (tipoatt == 1 && waspla && month == 13)
|
||||
@ -456,6 +458,20 @@ void TLiquidazione_app::zero_att(int month, const char* codatt)
|
||||
_pom->rewrite();
|
||||
_pum->rewrite();
|
||||
}
|
||||
|
||||
// Azzera i progressivi per il prospetto agricolo dal 1998
|
||||
for (_pia->first(); !_pia->eof(); _pia->next())
|
||||
{
|
||||
int m = atoi(*_pia_mese);
|
||||
TString att = (const char*)*_pia_codatt;
|
||||
if (m == month && att == codatt && (_year == *_pia_anno))
|
||||
{
|
||||
_pia->put("R0",""); // Imponibile
|
||||
_pia->put("R1",""); // Imposta
|
||||
_pia->rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
if (_isplafond && month != 13)
|
||||
zero_plafond(month,codatt);
|
||||
}
|
||||
@ -496,6 +512,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
real corr_misCEE = 0.0;
|
||||
real acq_misCEE = 0.0;
|
||||
real acq_misnoCEE = 0.0;
|
||||
real agr_detIA = 0.0;
|
||||
real agr_1i = 0.0;
|
||||
real agr_2i = 0.0;
|
||||
real agr_1 = 0.0;
|
||||
@ -859,12 +876,33 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
agr_iva = imposta;
|
||||
const real p = _iva->get_real("R0") / CENTO;
|
||||
|
||||
if (corrisp) lordo2netto(agr_imp,agr_iva,p);
|
||||
if (corrisp)
|
||||
lordo2netto(agr_imp,agr_iva,p);
|
||||
|
||||
if (tipoagr == 1) // Ora si utilizza solo il segnalino 1
|
||||
{
|
||||
agr_1 += agr_iva;
|
||||
agr_1i += agr_imp;
|
||||
|
||||
// Nuovo regime agricolo dal 1998: si sommino per codice iva di compensazione (da reperire su PCON)
|
||||
if (_isagr98)
|
||||
{
|
||||
TString ivacomp("00"); // Se non esiste o non si trova il conto questo e' il default (fa un poco schifo ma e' cosi')
|
||||
|
||||
if (_cur->is_first_match(-AGR_PCON1)) // Esiste il conto ?
|
||||
// Bien, allora controlliamo il se e' un ricavo...
|
||||
if (_pcon_1_r->get_int(PCN_INDBIL) == 4)
|
||||
if (_cur->is_first_match(-AGR_PCON2)) // Esiste il sottoconto ?
|
||||
{
|
||||
if (look_iva(_pcon_2_r->get(PCN_IVACOMP)))
|
||||
ivacomp = _iva->get("CODTAB"); // Ecco il codice IVA di compensazione
|
||||
}
|
||||
look_pia(month, codatt, codiva, ivacomp, TRUE); // Crea il record in tabella se non esiste
|
||||
real pia_imp = _pia->get_real("R0") + agr_1i; // Aggiorna...
|
||||
_pia->put("R0", pia_imp);
|
||||
_pia->put("B0", TRUE); // Seguo l'esempio dei PIM per il ricalcolo acquisti alla fine del ciclo
|
||||
_pia->rewrite(); // Semplice, no?
|
||||
}
|
||||
}
|
||||
else if (tipoagr == 2)
|
||||
{
|
||||
@ -1231,6 +1269,29 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
}
|
||||
}
|
||||
|
||||
// Ricalcola le imposte per regime agricolo dal 1998 (PIA)
|
||||
if (_isagr98)
|
||||
{
|
||||
for (_pia->first(); !_pia->eof(); _pia->next())
|
||||
{
|
||||
// this is much furber than doing all of the checks (one more time)
|
||||
if (_pia->get_bool("B0"))
|
||||
{
|
||||
// calcola l'imposta a partire dal codice IVA di compensazione
|
||||
look_iva(*_pia_codcom);
|
||||
real perc = _iva->get_real("R0");
|
||||
|
||||
real iva = (_pia->get_real("R0") * perc)/CENTO;
|
||||
iva.ceil(ROUND_LIRA); // TBC check ceil
|
||||
agr_detIA += iva;
|
||||
_pia->put("R1",iva);
|
||||
// resetta in modo da non vederlo il mese dopo
|
||||
_pia->put("B0", "");
|
||||
_pia->rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* calcola il lercio prorata
|
||||
* solo se liq. periodica
|
||||
@ -1305,7 +1366,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
|
||||
// Il porco agricoltore spende poco e paga meno
|
||||
vendite_iva = agr_2;
|
||||
acquisti_iva = agr_3;
|
||||
acquisti_iva = agr_1 + agr_3;
|
||||
|
||||
// nuovo calcolo IVA detraibile
|
||||
if (!agr_7.is_zero())
|
||||
@ -1315,6 +1376,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
acquisti_iva += agr_7 * pdetr;
|
||||
acquisti_iva.round(ROUND_LIRA);
|
||||
}
|
||||
|
||||
if (_isagr98)
|
||||
{
|
||||
_plm->put("R13", agr_detIA);
|
||||
acquisti_iva += agr_detIA;
|
||||
}
|
||||
}
|
||||
|
||||
_plm->put("R0", vendite_iva);
|
||||
@ -2041,6 +2108,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
|
||||
// totali per regimi agricoli
|
||||
real acq_noCEE = 0.0;
|
||||
real iva_detIA = 0.0;
|
||||
real imp_agr1 = 0.0;
|
||||
real imp_agr2 = 0.0;
|
||||
|
||||
@ -2127,7 +2195,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
iva_vend += _plm->get_real("R6") + _plm->get_real("R5");
|
||||
// Tiene aggiornata l'iva acquisti, che andra' rettificata all'uscita del mese
|
||||
// secondo la formula:
|
||||
// iva_acq = iva_acq + iva detraibile calcolata
|
||||
// iva_acq = iva_acq + iva detraibile calcolata + iva compensazione
|
||||
// L'iva di compensazione e' tratta dall'iva vendite agricole con segnalino 1 (vedi tabella PIA)
|
||||
// il cui totale e' memorizzato in plm->R13
|
||||
// l'iva detraibile calcolata e' a sua volta fatta cosi'
|
||||
// sum(plm->R11) * { sum(pum->R11) / [sum(pum->R11) + sum(pum->R10)]}
|
||||
// dove plm->R11 = acquisti misti fuori CEE
|
||||
@ -2135,6 +2205,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
// pum->R11 = tot. imponibile reg agr. 2
|
||||
iva_acq += _plm->get_real("R7") + _plm->get_real("R5");
|
||||
acq_noCEE += _plm->get_real("R11");
|
||||
iva_detIA += _plm->get_real("R13");
|
||||
imp_agr1 += _pum->get_real("R10");
|
||||
imp_agr2 += _pum->get_real("R11");
|
||||
}
|
||||
@ -2259,7 +2330,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
perc.round(2);
|
||||
iva_ded = acq_noCEE * perc;
|
||||
iva_ded.round(ROUND_LIRA);
|
||||
iva_acq += iva_ded;
|
||||
iva_acq += iva_ded + iva_detIA;
|
||||
res_debt += iva_vend;
|
||||
res_cred += iva_acq;
|
||||
risultato += (iva_vend - iva_acq);
|
||||
|
@ -257,6 +257,29 @@ bool TLiquidazione_app::look_plm(int m, const char* a, bool create)
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::look_pia(int m, const char* a, const char* cod1, const char* cod2, bool create)
|
||||
{
|
||||
bool ok = FALSE;
|
||||
|
||||
(*_pia_codatt) = format("%6s", a);
|
||||
(*_pia_mese) = format("%02d",m);
|
||||
(*_pia_anno) = _year;
|
||||
(*_pia_codord) = cod1;
|
||||
(*_pia_codcom) = cod2;
|
||||
|
||||
TString s = _pia_r->get("CODTAB");
|
||||
_pia->read();
|
||||
ok = _pia->good();
|
||||
|
||||
if (!ok && create)
|
||||
{
|
||||
_pia_r->zero();
|
||||
_pia_r->put("CODTAB",s);
|
||||
_pia->write();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::look_pum(int m, const char* a, bool create)
|
||||
{
|
||||
bool ok = FALSE;
|
||||
|
118
cg/cg4304.cpp
118
cg/cg4304.cpp
@ -335,6 +335,24 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
|
||||
{
|
||||
_DescrItem* d = new _DescrItem(REGAGR);
|
||||
|
||||
if (_isagr98) // Setta l'array interno con tutti gli items relativi alla tabella PIA
|
||||
{
|
||||
TArray& agr_array = d->_arr;
|
||||
for (_pia->first(); !_pia->eof(); _pia->next()) // Scorre i progressivi agricoli
|
||||
{
|
||||
if (strcmp((const char*)*_pia_codatt, codatt) == 0 &&
|
||||
(atoi(*_pia_mese) == month) && _year == *_pia_anno) // E sono gia' in ordine di codice...
|
||||
{
|
||||
_DescrItem* p = new _DescrItem(PROGAGR);
|
||||
p->_r0 = _pia->get_real("R0"); // Imponibile
|
||||
p->_r1 = _pia->get_real("R1"); // Imposta
|
||||
p->_s0 = *_pia_codord; // Codice iva ordinario
|
||||
p->_s1 = *_pia_codcom; // Codice iva compensazione
|
||||
agr_array.add(p); // Aggiunge il fottuto item agricolo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
look_plm(month,codatt);
|
||||
|
||||
d->_r0 += _plm->get_real("R5");
|
||||
@ -346,6 +364,7 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
|
||||
d->_r6 += _plm->get_real("R11");
|
||||
d->_r7 += _pum->get_real("R10");
|
||||
d->_r8 += _pum->get_real("R11");
|
||||
d->_r11 += _plm->get_real("R13");
|
||||
// Aggiungo anche questi per comodita' futura.
|
||||
// in caso di ditta a regime agricolo
|
||||
// alias:
|
||||
@ -353,7 +372,7 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
|
||||
// _r10 mantiene l'iva detraibile calcolata!
|
||||
d->_r9 = (d->_r8 / (d->_r7 + d->_r8));
|
||||
d->_r9.round(2);
|
||||
d->_r10 = d->_r6 * d->_r9;
|
||||
d->_r10 = d->_r6 * d->_r9;
|
||||
d->_r9 *= CENTO;
|
||||
d->_r9.round(ROUND_LIRA);
|
||||
d->_r10.round(ROUND_LIRA);
|
||||
@ -1920,29 +1939,67 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
|
||||
real& agr_2i = d._r8;
|
||||
real& pdetr = d._r9;
|
||||
real& ivadt = d._r10;
|
||||
real& iva_detIA = d._r11;
|
||||
|
||||
real ara = agr_5 + agr_6;
|
||||
real arn = agr_3 + agr_4;
|
||||
real agr_ven = agr_1 + agr_2;
|
||||
real ivadt_amm = agr_1 + agr_3 + ivadt;
|
||||
real ivadt_amm = agr_1 + agr_3 + ivadt + iva_detIA;
|
||||
|
||||
set_bookmark("Prospetto regime agricolo", _att_bookmark);
|
||||
int r = 1;
|
||||
|
||||
set_row(r++,"@50gPROSPETTO REGIME AGRICOLO");
|
||||
set_row(r++,"");
|
||||
|
||||
// Last pain...
|
||||
TArray& agr_array = d._arr;
|
||||
const int pia_items = agr_array.items();
|
||||
|
||||
if (pia_items) // Se non siamo ancora nel 1998 questo vale 0, ossia non vi sono items.
|
||||
{
|
||||
real t1,t2; // Totale imponibile/imposta
|
||||
TString des; // Descrizione codice iva ordinario
|
||||
real al; // Aliquota IVA
|
||||
// Stampa l' intestazione...
|
||||
set_row(r++," Codice IVA@45gAliquota IVA@73gCodice IVA@88gAliquota IVA");
|
||||
set_row(r++," Ordinario@45gOrdinaria@61gImponibile@73gCompensazione@88gCompensazione@108gImposta");
|
||||
set_row(r++,"");
|
||||
for (int i=0; i<pia_items; i++)
|
||||
{
|
||||
_DescrItem& di = (_DescrItem&) agr_array[i];
|
||||
if (di._flags != PROGAGR)
|
||||
continue;
|
||||
look_iva(di._s0);
|
||||
des = _iva->get("S0");
|
||||
al = _iva->get_real("R0");
|
||||
set_row(r,"%4s %-25s@48g%s %%", (const char*) di._s0, (const char*) des, al.string("#@,@@"));
|
||||
set_row(r,"@56g%r@75g%4s",&di._r0, (const char*)di._s1);
|
||||
look_iva(di._s1);
|
||||
al = _iva->get_real("R0");
|
||||
set_row(r++,"@92g%s %%@100g%r", al.string("#@,@@"), &di._r1);
|
||||
t1 += di._r0;
|
||||
t2 += di._r1;
|
||||
}
|
||||
// ... ed il totale minchiativo
|
||||
r++;
|
||||
set_row(r++,"Totale@56g%r@100g%r",&t1,&t2);
|
||||
r+=2;
|
||||
}
|
||||
|
||||
// percentuale detraibilita'
|
||||
set_bookmark("Prospetto regime agricolo", _att_bookmark);
|
||||
|
||||
set_row(1,"@50gPROSPETTO REGIME AGRICOLO");
|
||||
set_row(2,"");
|
||||
set_row(3, "Iva vendite beni I parte Tabella A @56g%r",&agr_1);
|
||||
set_row(4, "");
|
||||
set_row(5, "Iva vendite beni diversi da I parte Tabella A @56g%r",&agr_2);
|
||||
set_row(6, "");
|
||||
set_row(7, "Totale iva sulle operazioni di vendita @56g%r", &agr_ven);
|
||||
set_row(8, "");
|
||||
set_row(9, "Iva acquisti in regime agricolo@56g%r",&ara);
|
||||
set_row(10, "");
|
||||
set_row(11, "Iva acquisti per operazioni diverse I parte Tabella A@56g%r",&arn);
|
||||
set_row(12, "... di cui beni ammortizzabili@56g%r",&agr_4);
|
||||
set_row(13, "");
|
||||
set_row(14, "Iva acquisti ad uso promiscuo@56g%r",&agr_7);
|
||||
set_row(r++, "Iva vendite beni I parte Tabella A @56g%r",&agr_1);
|
||||
set_row(r++, "");
|
||||
set_row(r++, "Iva vendite beni diversi da I parte Tabella A @56g%r",&agr_2);
|
||||
set_row(r++, "");
|
||||
set_row(r++, "Totale iva sulle operazioni di vendita @56g%r", &agr_ven);
|
||||
set_row(r++, "");
|
||||
set_row(r++, "Iva acquisti in regime agricolo@56g%r",&ara);
|
||||
set_row(r++, "");
|
||||
set_row(r++, "Iva acquisti per operazioni diverse I parte Tabella A@56g%r",&arn);
|
||||
set_row(r++, "... di cui beni ammortizzabili@56g%r",&agr_4);
|
||||
set_row(r++, "");
|
||||
set_row(r++, "Iva acquisti ad uso promiscuo@56g%r",&agr_7);
|
||||
|
||||
TString dn,riga;
|
||||
riga = agr_2i.string(".");
|
||||
@ -1958,13 +2015,13 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
|
||||
middle << "gx 100 = " << pdetr.string(".");
|
||||
middle << " %";
|
||||
|
||||
set_row(15, "");
|
||||
set_row(16, "@56g%r",&agr_2i);
|
||||
set_row(r++, "");
|
||||
set_row(r++, "@56g%r",&agr_2i);
|
||||
riga.format("Percentuale delle operazioni diverse@%dg%%s",xl - corr - ln/2);
|
||||
set_row(17, riga, (const char*)middle);
|
||||
set_row(r++, riga, (const char*)middle);
|
||||
corr = dn.len() % 2 == 0 ? 0 : 1;
|
||||
riga.format("@%dg%%s",xl - corr - dn.len()/2);
|
||||
set_row(18, riga, (const char*)dn);
|
||||
set_row(r++, riga, (const char*)dn);
|
||||
|
||||
riga = agr_7.string(".");
|
||||
dn = "100";
|
||||
@ -1977,15 +2034,20 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
|
||||
middle << "gx " << pdetr.string("###");
|
||||
middle << " = " << ivadt.string(".");
|
||||
|
||||
set_row(19, "");
|
||||
set_row(20, "@56g%r", &agr_7, &pdetr);
|
||||
set_row(r++, "");
|
||||
set_row(r++, "@56g%r", &agr_7, &pdetr);
|
||||
riga.format("Iva ammessa in detrazione sugli acquisti promiscui@%dg%%s",xl - corr - ln/2);
|
||||
set_row(21, riga, (const char*)middle);
|
||||
set_row(r++, riga, (const char*)middle);
|
||||
corr = dn.len() % 2 == 0 ? 0 : 1;
|
||||
riga.format("@%dg%%s",xl - corr - dn.len()/2);
|
||||
set_row(22, riga, (const char*)dn);
|
||||
set_row(23, "");
|
||||
set_row(24, "Totale iva ammessa in detrazione@56g%r",&ivadt_amm);
|
||||
set_row(r++, riga, (const char*)dn);
|
||||
set_row(r++, "");
|
||||
if (_isagr98)
|
||||
{
|
||||
set_row(r++, "Iva ammessa in detrazione I parte tabella A@56g%r",&iva_detIA);
|
||||
set_row(r++, "");
|
||||
}
|
||||
set_row(r++, "Totale iva ammessa in detrazione@56g%r",&ivadt_amm);
|
||||
|
||||
set_auto_ff(TRUE);
|
||||
set_print_zero(FALSE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user