Gigamodifica per registrare progressivi mensili anche per le ditte
trimestrali, piu' innumerevoli aggiornamenti git-svn-id: svn://10.65.10.50/trunk@871 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8b2cb80657
commit
cd7ddb4520
@ -194,8 +194,10 @@ bool TLiquidazione_app::user_create()
|
|||||||
to.put(MOV_DATAREG, t);
|
to.put(MOV_DATAREG, t);
|
||||||
_cur->setregion(from, to);
|
_cur->setregion(from, to);
|
||||||
|
|
||||||
if (is_month_ok(_month)) update_firm(_month);
|
if (is_month_ok_strict(_month))
|
||||||
if (_isprint) print();
|
update_firm(_month);
|
||||||
|
if (_isprint && _descr_arr.items() > 0)
|
||||||
|
print();
|
||||||
TApplication::set_firm(__firm);
|
TApplication::set_firm(__firm);
|
||||||
end_wait();
|
end_wait();
|
||||||
}
|
}
|
||||||
|
60
cg/cg4300.h
60
cg/cg4300.h
@ -131,7 +131,7 @@ public:
|
|||||||
_r6, _r7, _r8,
|
_r6, _r7, _r8,
|
||||||
_r9, _r10,_r11;
|
_r9, _r10,_r11;
|
||||||
TArray _arr;
|
TArray _arr;
|
||||||
|
|
||||||
_DescrItem(word f) : _f0(0), _f1(0), _f2(0), _arr(4)
|
_DescrItem(word f) : _f0(0), _f1(0), _f2(0), _arr(4)
|
||||||
{ _flags = f; }
|
{ _flags = f; }
|
||||||
virtual ~_DescrItem()
|
virtual ~_DescrItem()
|
||||||
@ -162,6 +162,7 @@ class TLiquidazione_app : public TPrint_application
|
|||||||
int _month; // mese da calcolare
|
int _month; // mese da calcolare
|
||||||
TDate _date; // data di stampa
|
TDate _date; // data di stampa
|
||||||
bool _isprint; // vuoi stampare o no?
|
bool _isprint; // vuoi stampare o no?
|
||||||
|
bool _canprint; // PUOI stampare o no?
|
||||||
bool _printonly; // calcolo definitivo
|
bool _printonly; // calcolo definitivo
|
||||||
recalc _recalc; // tipo ricalcolo scelto
|
recalc _recalc; // tipo ricalcolo scelto
|
||||||
bool _isplafond; // plafond importatori abituali
|
bool _isplafond; // plafond importatori abituali
|
||||||
@ -182,7 +183,7 @@ class TLiquidazione_app : public TPrint_application
|
|||||||
long _n_ditte; // numero ditte
|
long _n_ditte; // numero ditte
|
||||||
bool _comp_acconto; // stiamo calcolando l'acconto
|
bool _comp_acconto; // stiamo calcolando l'acconto
|
||||||
TArray _nomiditte; // array descr. ditte per sheet
|
TArray _nomiditte; // array descr. ditte per sheet
|
||||||
|
|
||||||
TProgind* _prind;
|
TProgind* _prind;
|
||||||
int _row;
|
int _row;
|
||||||
TArray _vend_arr; // tabella vendite per ventilazione
|
TArray _vend_arr; // tabella vendite per ventilazione
|
||||||
@ -197,7 +198,7 @@ class TLiquidazione_app : public TPrint_application
|
|||||||
long __firm; // ditta selezionata all'inizio
|
long __firm; // ditta selezionata all'inizio
|
||||||
bool _is_interactive; // lanciata da menu o da altro prog
|
bool _is_interactive; // lanciata da menu o da altro prog
|
||||||
bool _is_visliq; // lanciata da visualizzazione liquidazione
|
bool _is_visliq; // lanciata da visualizzazione liquidazione
|
||||||
|
|
||||||
static real CENTO;
|
static real CENTO;
|
||||||
|
|
||||||
// main cursor
|
// main cursor
|
||||||
@ -264,16 +265,16 @@ class TLiquidazione_app : public TPrint_application
|
|||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
long select_firm_range(long from, long to, wht freq);
|
long select_firm_range(long from, long to, wht freq);
|
||||||
|
|
||||||
static bool ch_year_handler(TMask_field& f, KEY key);
|
static bool ch_year_handler(TMask_field& f, KEY key);
|
||||||
static bool to_ditt_handler(TMask_field& f, KEY key);
|
static bool to_ditt_handler(TMask_field& f, KEY key);
|
||||||
static bool fr_ditt_handler(TMask_field& f, KEY key);
|
static bool fr_ditt_handler(TMask_field& f, KEY key);
|
||||||
static bool to_butt_handler(TMask_field& f, KEY key);
|
static bool to_butt_handler(TMask_field& f, KEY key);
|
||||||
static bool fr_butt_handler(TMask_field& f, KEY key);
|
static bool fr_butt_handler(TMask_field& f, KEY key);
|
||||||
static bool what_freq_handler(TMask_field& f, KEY key);
|
static bool what_freq_handler(TMask_field& f, KEY key);
|
||||||
|
|
||||||
static TLiquidazione_app& app() { return (TLiquidazione_app&)main_app(); }
|
static TLiquidazione_app& app() { return (TLiquidazione_app&)main_app(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -301,21 +302,26 @@ public:
|
|||||||
void recalc_att (int month, const char* codatt);
|
void recalc_att (int month, const char* codatt);
|
||||||
void recalc_annual (const char* codatt);
|
void recalc_annual (const char* codatt);
|
||||||
_DescrItem* recalc_rimborso(int month, const char* codatts);
|
_DescrItem* recalc_rimborso(int month, const char* codatts);
|
||||||
|
|
||||||
// ricalcolo liquidazioni dai progressivi
|
// ricalcolo liquidazioni dai progressivi mensili
|
||||||
void write_liq (int month, const char* atts);
|
void write_liq (int month, const char* atts);
|
||||||
|
|
||||||
|
// ritorna l'eventuale ma sempre appropriato debito (< 50.000)
|
||||||
|
real debt_prec(int month);
|
||||||
|
// ritorna il risultato della liquidazione del mese
|
||||||
|
// non considera il conguaglio prorata (annuale)
|
||||||
|
real result_liq(int month);
|
||||||
// ritorna l'appropriato credito precedente al mese in corso
|
// ritorna l'appropriato credito precedente al mese in corso
|
||||||
real credito_prec(int month);
|
real credito_prec(int month);
|
||||||
// ritorna l'appropriato credito di costo precedente al mese in corso
|
// ritorna l'appropriato credito di costo precedente al mese in corso
|
||||||
// (travel agency only)
|
// (travel agency only)
|
||||||
real credito_costo_prec(int month, const char* codatt);
|
real credito_costo_prec(int month);
|
||||||
// ritorna i versamenti effettuati nel mese passato
|
// ritorna i versamenti effettuati nel mese
|
||||||
real versamenti_IVA(int month, bool acconto = FALSE);
|
real versamenti_IVA(int month, bool acconto = FALSE);
|
||||||
|
|
||||||
// supporto stampa
|
// supporto stampa
|
||||||
void describe_firm(int month);
|
void describe_firm(int month);
|
||||||
void describe_att(int month, const char* codatt);
|
void describe_att(int month, const char* codatt, bool isresult);
|
||||||
void describe_name(int month, TToken_string& atts);
|
void describe_name(int month, TToken_string& atts);
|
||||||
void describe_plafond(int month, const char* codatt);
|
void describe_plafond(int month, const char* codatt);
|
||||||
void describe_ventilation(int month, const char* codatt);
|
void describe_ventilation(int month, const char* codatt);
|
||||||
@ -326,10 +332,10 @@ public:
|
|||||||
void describe_error(const char* errstr, const char* codatt);
|
void describe_error(const char* errstr, const char* codatt);
|
||||||
void describe_annual(const char* codatt);
|
void describe_annual(const char* codatt);
|
||||||
void describe_consistence(const char* codatt);
|
void describe_consistence(const char* codatt);
|
||||||
|
|
||||||
// corrispettivi
|
// corrispettivi
|
||||||
void recalc_corrispettivi (int month, const char* codatt);
|
void recalc_corrispettivi (int month, const char* codatt);
|
||||||
|
|
||||||
// ventilasiun
|
// ventilasiun
|
||||||
void recalc_ventilation (int month, const char* codatt);
|
void recalc_ventilation (int month, const char* codatt);
|
||||||
|
|
||||||
@ -337,14 +343,14 @@ public:
|
|||||||
void zero_plafond (int month, const char* codatt);
|
void zero_plafond (int month, const char* codatt);
|
||||||
void add_plafond (int month, const char* codatt, int type,
|
void add_plafond (int month, const char* codatt, int type,
|
||||||
real& howmuch, bool intra);
|
real& howmuch, bool intra);
|
||||||
|
|
||||||
// ritorna l'aliquota ordinaria dal
|
// ritorna l'aliquota ordinaria dal
|
||||||
// codice IVA apposito immesso nei parametri studio
|
// codice IVA apposito immesso nei parametri studio
|
||||||
real aliquota_agvia();
|
real aliquota_agvia();
|
||||||
|
|
||||||
// ritorna l'interesse per il mese in questione (dai parametri studio)
|
// ritorna l'interesse per il mese in questione (dai parametri studio)
|
||||||
real interesse_trimestrale(int month);
|
real interesse_trimestrale(int month);
|
||||||
|
|
||||||
// minchia di puro suino
|
// minchia di puro suino
|
||||||
void add_vendite (int month, const char* codreg, int tipodet, real& r);
|
void add_vendite (int month, const char* codreg, int tipodet, real& r);
|
||||||
void add_ventilation (real iva, real sum, const char* codiva);
|
void add_ventilation (real iva, real sum, const char* codiva);
|
||||||
@ -355,7 +361,7 @@ public:
|
|||||||
virtual void set_page(int file, int counter);
|
virtual void set_page(int file, int counter);
|
||||||
virtual bool preprocess_page(int file, int counter);
|
virtual bool preprocess_page(int file, int counter);
|
||||||
virtual print_action postprocess_page(int file, int counter);
|
virtual print_action postprocess_page(int file, int counter);
|
||||||
|
|
||||||
// settaggio righe per ogni elemento di _descr_arr
|
// settaggio righe per ogni elemento di _descr_arr
|
||||||
void set_plafond(_DescrItem& d);
|
void set_plafond(_DescrItem& d);
|
||||||
void set_ventila(_DescrItem& d);
|
void set_ventila(_DescrItem& d);
|
||||||
@ -381,19 +387,25 @@ public:
|
|||||||
bool look_iva(const char* cod);
|
bool look_iva(const char* cod);
|
||||||
bool look_reg(const char* reg);
|
bool look_reg(const char* reg);
|
||||||
bool look_lia(bool create = FALSE, int anno = 0);
|
bool look_lia(bool create = FALSE, int anno = 0);
|
||||||
|
|
||||||
_VendItem* look_vendita(int m, const char* codreg);
|
_VendItem* look_vendita(int m, const char* codreg);
|
||||||
_VentItem* look_ventilation(int m, const char* codreg);
|
_VentItem* look_ventilation(int m, const char* codreg);
|
||||||
|
|
||||||
// tutti i controlli del mondo sui mesi da calcolare
|
// tutti i controlli del mondo sui mesi da calcolare
|
||||||
static bool is_trim (int x);
|
static bool is_trim (int x);
|
||||||
static bool is_in_trim (int x, int t);
|
// is_month_ok controlla che il mese passato sia
|
||||||
bool is_month_ok (int x, int month = -1);
|
// da prendere in considerazione per la liquidazione
|
||||||
|
// controllando il regime trimestrale o mensile
|
||||||
|
bool is_month_ok(int x, int mtocalc);
|
||||||
|
// is_month_ok_strict controlla che il mese sia OK per la
|
||||||
|
// liquidazione, ma ritorna TRUE per le trimestrali solo
|
||||||
|
// se il mese cade ESATTAMENTE su un trimestre
|
||||||
|
bool is_month_ok_strict(int x, int month = -1);
|
||||||
bool is_date_ok (TDate& d, int month);
|
bool is_date_ok (TDate& d, int month);
|
||||||
bool is_first_month (int m);
|
bool is_first_month (int m);
|
||||||
int previous_month (int m);
|
int previous_month (int m);
|
||||||
bool check_month (int m, int mref);
|
bool check_month(int m, int mref);
|
||||||
|
|
||||||
// Funzioni accessorie: estrazione deleghe
|
// Funzioni accessorie: estrazione deleghe
|
||||||
bool set_deleghe();
|
bool set_deleghe();
|
||||||
bool extract_deleghe();
|
bool extract_deleghe();
|
||||||
|
448
cg/cg4301.cpp
448
cg/cg4301.cpp
@ -10,9 +10,13 @@
|
|||||||
#include "cg4300.h"
|
#include "cg4300.h"
|
||||||
|
|
||||||
// -------------------- QUI comincia l'avventura --------------------------
|
// -------------------- QUI comincia l'avventura --------------------------
|
||||||
|
// ----------------------------------------------------- ******************
|
||||||
// che nel gennaio 1995 non solo non e' finita, ma si fa
|
// che nel gennaio 1995 non solo non e' finita, ma si fa ******************
|
||||||
// ogni giorno piu' odiosa e nevrastenica
|
// ogni giorno piu' odiosa e nevrastenica ******************
|
||||||
|
// ----------------------------------------------------- ******************
|
||||||
|
// Datemi un punto di appoggio ******************
|
||||||
|
// e mi ci appoggero' ******************
|
||||||
|
// ----------------------------------------------------- ******************
|
||||||
|
|
||||||
bool TLiquidazione_app::recalc_all()
|
bool TLiquidazione_app::recalc_all()
|
||||||
{
|
{
|
||||||
@ -41,50 +45,48 @@ bool TLiquidazione_app::recalc_all()
|
|||||||
TApplication::set_firm(nomeditta.get_long(1));
|
TApplication::set_firm(nomeditta.get_long(1));
|
||||||
_prind->addstatus(1);
|
_prind->addstatus(1);
|
||||||
|
|
||||||
// trimestrali impropriamente selezionate per mesi intermedi
|
_freqviva = nomeditta.get(3);
|
||||||
_freqviva = nomeditta.get(3);
|
/*
|
||||||
if (!is_month_ok(_month)) continue;
|
* trimestrali impropriamente selezionate per mesi intermedi
|
||||||
|
* provocano il ricalcolo dei progressivi mensili ma non la stampa
|
||||||
|
*/
|
||||||
|
_canprint = is_month_ok_strict(_month);
|
||||||
|
|
||||||
int need_refresh = FALSE;
|
int need_refresh = FALSE;
|
||||||
if (_recalc != ever)
|
if (_recalc != ever)
|
||||||
{
|
{
|
||||||
for (int m = 1; m < _month; m++)
|
for (int m = 1; m < _month; m++)
|
||||||
{
|
if (!look_lim(m) || !_lim->get_bool("B0"))
|
||||||
if (!is_month_ok(m)) continue;
|
|
||||||
if (!look_lim(m)) need_refresh = TRUE;
|
|
||||||
else if (!(_lim->get_bool("B0"))) need_refresh = TRUE;
|
|
||||||
}
|
|
||||||
if (need_refresh)
|
|
||||||
{
|
|
||||||
if (_is_interactive)
|
|
||||||
{
|
{
|
||||||
if (yesno_box("Alcuni mesi precedenti non risultano ricalcolati. E' "
|
need_refresh = TRUE;
|
||||||
"consigliabile il ricalcolo. Si desidera eseguirlo?"))
|
break;
|
||||||
_recalc = ever;
|
|
||||||
}
|
}
|
||||||
else _recalc = needed;
|
|
||||||
}
|
if (need_refresh && yesno_box("Alcuni mesi precedenti non "
|
||||||
}
|
"risultano ricalcolati. E' consigliabile il ricalcolo. "
|
||||||
|
"Si desidera eseguirlo?"))
|
||||||
|
_recalc = ever;
|
||||||
|
}
|
||||||
|
|
||||||
if (_recalc == ever)
|
for (int m = 1; m <= _month; m++)
|
||||||
{
|
if (is_month_ok(m, _month) || _recalc == ever)
|
||||||
for (int m = 1; m < _month; m++)
|
{
|
||||||
if (is_month_ok(m))
|
if (_prind->iscancelled())
|
||||||
update_firm(m);
|
break;
|
||||||
}
|
update_firm(m);
|
||||||
update_firm(_month);
|
}
|
||||||
|
|
||||||
// se ci sono altri mesi dopo quello calcolato, invalida il
|
// se ci sono altri mesi dopo l'ultimo calcolato, invalida il
|
||||||
// flag 'calcolato' del primo, per causare il ricalcolo dei
|
// flag 'calcolato' del primo, per causare il ricalcolo dei
|
||||||
// successivi (evitando problemi per credito precedente)
|
// successivi (evitando problemi per credito precedente)
|
||||||
for (int m = _month+1; m <= 13; m++)
|
for (m = _month+1; m <= 13; m++)
|
||||||
if (is_month_ok(m) && look_lim(m))
|
if (is_month_ok_strict(m) && look_lim(m))
|
||||||
{
|
{
|
||||||
_lim->put("B0","");
|
_lim->put("B0","");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool canc = _prind->iscancelled();
|
bool canc = _prind->iscancelled();
|
||||||
if (!canc) _prind->addstatus(1);
|
if (!canc) _prind->addstatus(1);
|
||||||
|
|
||||||
@ -184,7 +186,6 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
|||||||
_isvent = _reg->get_bool("B3");
|
_isvent = _reg->get_bool("B3");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((month != 13 || _isannual) && (calc || !recalc))
|
if ((month != 13 || _isannual) && (calc || !recalc))
|
||||||
if (!update_att(month, cattiv))
|
if (!update_att(month, cattiv))
|
||||||
describe_error("Attivita' non ricalcolate: possibili errori",
|
describe_error("Attivita' non ricalcolate: possibili errori",
|
||||||
@ -196,11 +197,11 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
|||||||
{
|
{
|
||||||
look_plm(month,cattiv);
|
look_plm(month,cattiv);
|
||||||
gheravergot = !_plm->get_real("R0").is_zero() ||
|
gheravergot = !_plm->get_real("R0").is_zero() ||
|
||||||
!_plm->get_real("R1").is_zero();
|
!_plm->get_real("R1").is_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (month == _month && gheravergot)
|
if (month == _month)
|
||||||
describe_att(month,cattiv);
|
describe_att(month,cattiv,gheravergot);
|
||||||
|
|
||||||
atts.add(cattiv);
|
atts.add(cattiv);
|
||||||
cattivs.add(cattiv);
|
cattivs.add(cattiv);
|
||||||
@ -208,20 +209,20 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
|||||||
|
|
||||||
// se attivita' mista stampa riepilogo
|
// se attivita' mista stampa riepilogo
|
||||||
if (_mixed && month == _month)
|
if (_mixed && month == _month)
|
||||||
describe_att(month,cattivs);
|
describe_att(month,cattivs, TRUE);
|
||||||
}
|
}
|
||||||
while (_nditte->next_match(LF_ATTIV));
|
while (_nditte->next_match(LF_ATTIV));
|
||||||
|
|
||||||
// se quater stampa riepilogo
|
// se quater stampa riepilogo
|
||||||
if (quater && month == _month)
|
if (quater && month == _month)
|
||||||
describe_att(month,atts);
|
describe_att(month,atts, TRUE);
|
||||||
|
|
||||||
// occorre poterla chiamare altre volte con mesi diversi
|
// occorre poterla chiamare altre volte con mesi diversi
|
||||||
_nditte->restore_status();
|
_nditte->restore_status();
|
||||||
|
|
||||||
// aggiorna le liquidazioni mensili
|
// aggiorna le liquidazioni mensili
|
||||||
if ((_month != 13 || _isannual) && (calc || !recalc))
|
if ((_month != 13 || _isannual) && (calc || !recalc))
|
||||||
write_liq (month, atts);
|
write_liq(month, atts);
|
||||||
|
|
||||||
// rimborso infraannuale
|
// rimborso infraannuale
|
||||||
_DescrItem* rimb_d = NULL;
|
_DescrItem* rimb_d = NULL;
|
||||||
@ -242,31 +243,36 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
|||||||
return ok || calc;
|
return ok || calc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TLiquidazione_app::update_att(int month, const char* codatt, bool recalc)
|
bool TLiquidazione_app::update_att(int month, const char* codatt,
|
||||||
|
bool recalc)
|
||||||
// viene passato un codice attivita' con codatt+tipoatt
|
// viene passato un codice attivita' con codatt+tipoatt
|
||||||
// vedi update_firm per il burdel dei calc e recalc
|
// vedi update_firm per il burdel dei calc e recalc
|
||||||
|
|
||||||
// occhecasino. Se _comp_acconto e' TRUE, i movimenti considerati
|
// occhecasino. Se _comp_acconto e' TRUE, i movimenti considerati
|
||||||
// saranno solo quelli di dicembre per data <= 20/12;
|
// saranno solo quelli di dicembre per data <= 20/12;
|
||||||
// il ricalcolo e' FORZATO da _recalc messo a one
|
// il ricalcolo e' FORZATO da _recalc messo a one
|
||||||
{
|
{
|
||||||
look_plm(month, codatt, TRUE);
|
if (month == 13)
|
||||||
bool ok = _plm->get_bool("B0");
|
recalc_annual(codatt);
|
||||||
if (ok && !recalc) return TRUE;
|
else
|
||||||
bool calc = _recalc == ever || (_recalc == one && month == _month) ;
|
|
||||||
|
|
||||||
if (!calc && _recalc != never) calc = !ok;
|
|
||||||
if (_isannual && month == 13) month = 12;
|
|
||||||
|
|
||||||
if (calc || !recalc)
|
|
||||||
{
|
{
|
||||||
zero_att(month,codatt);
|
look_plm(month, codatt, TRUE);
|
||||||
recalc_att(month,codatt);
|
bool ok = _plm->get_bool("B0");
|
||||||
recalc_ventilation(month, codatt);
|
if (ok && !recalc) return TRUE;
|
||||||
recalc_corrispettivi(month, codatt);
|
bool calc = _recalc == ever || (_recalc == one && month == _month);
|
||||||
if (month == 12) recalc_annual(codatt);
|
if (!calc && _recalc != never) calc = !ok;
|
||||||
|
|
||||||
|
if (calc || !recalc)
|
||||||
|
{
|
||||||
|
zero_att(month,codatt);
|
||||||
|
recalc_att(month,codatt);
|
||||||
|
recalc_ventilation(month, codatt);
|
||||||
|
recalc_corrispettivi(month, codatt);
|
||||||
|
// per trimestrali
|
||||||
|
if (_isannual) recalc_annual(codatt);
|
||||||
|
}
|
||||||
|
return ok || calc;
|
||||||
}
|
}
|
||||||
return ok || calc;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TLiquidazione_app::zero_att(int month, const char* codatt)
|
void TLiquidazione_app::zero_att(int month, const char* codatt)
|
||||||
@ -289,6 +295,8 @@ void TLiquidazione_app::zero_att(int month, const char* codatt)
|
|||||||
|
|
||||||
void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||||
// il codatt passato e' codice att + tipo att ( IN {1|2} )
|
// il codatt passato e' codice att + tipo att ( IN {1|2} )
|
||||||
|
// occhecasino. Se _comp_acconto e' TRUE, i movimenti considerati
|
||||||
|
// saranno solo quelli di dicembre per data <= 20/12;
|
||||||
{
|
{
|
||||||
real totintra = 0.0;
|
real totintra = 0.0;
|
||||||
real nond19_imp = 0.0;
|
real nond19_imp = 0.0;
|
||||||
@ -322,7 +330,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
real agr_acq = 0.0;
|
real agr_acq = 0.0;
|
||||||
real agr_conf = 0.0;
|
real agr_conf = 0.0;
|
||||||
real agr_acc = 0.0;
|
real agr_acc = 0.0;
|
||||||
real cred_cost = 0.0;
|
|
||||||
real for_rimb = 0.0;
|
real for_rimb = 0.0;
|
||||||
real acq_ies = 0.0;
|
real acq_ies = 0.0;
|
||||||
real acq_ies_iva = 0.0;
|
real acq_ies_iva = 0.0;
|
||||||
@ -409,7 +416,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
bool autodafe = (tipodoc == "AF" && tipocr == 4);
|
bool autodafe = (tipodoc == "AF" && tipocr == 4);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* puo' capitare per flags prassiani
|
* puo' capitare per motivi brutalmente prassici
|
||||||
* SENSU Sergio 1995, Guido
|
* SENSU Sergio 1995, Guido
|
||||||
*/
|
*/
|
||||||
if (tipoatt == 0) tipoatt = 1;
|
if (tipoatt == 0) tipoatt = 1;
|
||||||
@ -433,10 +440,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
// Altre cose di cui tener conto
|
// Altre cose di cui tener conto
|
||||||
if (tipomov == acquisto && (tipocr == 1 || tipocr == 5))
|
if (tipomov == acquisto && (tipocr == 1 || tipocr == 5))
|
||||||
/*
|
/*
|
||||||
* Acquisto beni per rivendita sono comunque sommati, ma
|
* Acquisto beni per rivendita: sono comunque sommati, ma
|
||||||
* vengono considerati in ventilazione solo se l'apposito
|
* vengono considerati in ventilazione solo se l'apposito
|
||||||
* parametro ditta e' settato, piu' altre condizioni (vedi
|
* parametro ditta e' settato, piu' altre condizioni (vedi
|
||||||
* recalc_ventilation())
|
* recalc_ventilation() for spulcing)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
acq_riv += imponibile;
|
acq_riv += imponibile;
|
||||||
@ -457,15 +464,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
ult_detr += imponibile * real(DETRAZIONE_6PERCENTO);
|
ult_detr += imponibile * real(DETRAZIONE_6PERCENTO);
|
||||||
}
|
}
|
||||||
else if (tipomov == vendita && tipocr == 4)
|
else if (tipomov == vendita && tipocr == 4)
|
||||||
// Vendite strum. art 17 (cess. amm.)
|
/*
|
||||||
// anche autofatture e anche nell'annuale
|
* Vendite strum. art 17 (cess. amm.)
|
||||||
// (Sergio 1995)
|
* Comprende anche autofatture, anche nell'annuale
|
||||||
|
* (Sergio 1995)
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
cess_amm += imponibile;
|
cess_amm += imponibile;
|
||||||
cess_amm_iva += imposta;
|
cess_amm_iva += imposta;
|
||||||
}
|
}
|
||||||
else if (tipomov == acquisto && tipocr == 8)
|
else if (tipomov == acquisto && tipocr == 8)
|
||||||
// Acquisto beni strum. in leasing
|
// Acquisto beni strum. acquisiti in leasing
|
||||||
{
|
{
|
||||||
leasing += imponibile;
|
leasing += imponibile;
|
||||||
leasing_iva += imposta;
|
leasing_iva += imposta;
|
||||||
@ -559,7 +568,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
acq_ies_iva += imposta;
|
acq_ies_iva += imposta;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tipodet == 3) // passaggi interni (solo ventilaz)
|
if (tipodet == 3) // passaggi interni (solo per ventilaz)
|
||||||
{
|
{
|
||||||
acq_pint += imponibile;
|
acq_pint += imponibile;
|
||||||
acq_pint_iva += imposta;
|
acq_pint_iva += imposta;
|
||||||
@ -598,14 +607,16 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
* le maledette fatture con scontrino sono sul registro dei
|
* le maledette fatture con scontrino sono sul registro dei
|
||||||
* corrispettivi, ma vanno riportate nelle vendite in stampa;
|
* corrispettivi, ma vanno riportate nelle vendite in stampa;
|
||||||
* dunque, le sommiamo in R5 e R6 di PIM anche se continuiamo
|
* dunque, le sommiamo in R5 e R6 di PIM anche se continuiamo
|
||||||
* a riportare il totale in R0 e R1. La stampa (describe_pim)
|
* a sommarle anche in R0 e R1. La stampa (describe_pim)
|
||||||
* dovra' scorporare
|
* dovra' scorporarle
|
||||||
*/
|
*/
|
||||||
real ifs = _pim_r->get_real("R5"); // imponibile fatture con scontrino
|
real ifs = _pim_r->get_real("R5"); // imponibile fatture con scontrino
|
||||||
real vfs = _pim_r->get_real("R6"); // IVA fatt. con scontrino
|
real vfs = _pim_r->get_real("R6"); // IVA fatt. con scontrino
|
||||||
/*
|
/*
|
||||||
* le maledette autofatture non residenti art. 17
|
* le maledette autofatture non residenti art. 17
|
||||||
* vedi al calcolo if (autodafe)
|
* vedi al calcolo if (autodafe) si tengono da parte
|
||||||
|
* La stampa le scorpora solo IN SEDE di dichiarazione annuale
|
||||||
|
* NELL'OTTICA di una PIU' CORRETTA e CONSONA ......................
|
||||||
*/
|
*/
|
||||||
real adf = _pim_r->get_real("R7");
|
real adf = _pim_r->get_real("R7");
|
||||||
real adi = _pim_r->get_real("R8");
|
real adi = _pim_r->get_real("R8");
|
||||||
@ -628,14 +639,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
// corrispettivi
|
// corrispettivi
|
||||||
if (corrisp)
|
if (corrisp)
|
||||||
{
|
{
|
||||||
// ennesimo casino: non tutti i corrispettivi sono
|
/*
|
||||||
// corrispettivi; in effetti, alcuni corrispettivi
|
* ennesimo casino: non tutti i corrispettivi sono
|
||||||
// non sono corrispettivi. Ci si potrebbe domandare
|
* corrispettivi; in effetti, alcuni corrispettivi
|
||||||
// se gli altri corrispettivi sono corrispettivi o
|
* non sono corrispettivi. Ci si potrebbe domandare
|
||||||
// no; ebbene, gli altri corrispettivi risultano
|
* se gli altri corrispettivi sono corrispettivi o
|
||||||
// fortunatamente essere corrispettivi.
|
* no; ebbene, gli altri corrispettivi risultano
|
||||||
if (tipodoc == "CR" || tipodoc == "RF" || tipodoc == "SC" ||
|
* fortunatamente essere corrispettivi.
|
||||||
tipodoc == "SN" || tipodoc == "CN")
|
*/
|
||||||
|
if (tipodoc == "CR" || tipodoc == "RF" || tipodoc == "SC")
|
||||||
{
|
{
|
||||||
// questi sono corrispettivi davvero; comportamento normale
|
// questi sono corrispettivi davvero; comportamento normale
|
||||||
if (tipoiva == "VE") // da ventilare
|
if (tipoiva == "VE") // da ventilare
|
||||||
@ -729,7 +741,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
// calcolati tutti i movimenti e aggiornati i pim
|
// calcolati tutti i movimenti e aggiornati i pim
|
||||||
// salviamo i totali antes que seja tarde
|
// salviamo i totali antes que seja tarde
|
||||||
|
|
||||||
// calcola il lercio prorata
|
/*
|
||||||
|
* calcola il lercio prorata
|
||||||
|
*/
|
||||||
real prorata;
|
real prorata;
|
||||||
if (!_prorata.is_zero())
|
if (!_prorata.is_zero())
|
||||||
{
|
{
|
||||||
@ -740,10 +754,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* ACHTUNG: l'iva sulle vendite e' calcolata sommando anche i
|
* ACHTUNG: l'iva sulle vendite e' calcolata sommando anche i
|
||||||
* corrispettivi; non tiene conto quindi delle imposte calcolate
|
* corrispettivi che sono corrispettivi, a differenza dei corrispettivi
|
||||||
|
* che non sono corrispettivi, ma tanto quelli (come si sa) non sono
|
||||||
|
* corrispettivi. Dunque, non si tiene conto delle imposte calcolate
|
||||||
* con la ventilazione (che vanno sottratte) ne' di quelle
|
* con la ventilazione (che vanno sottratte) ne' di quelle
|
||||||
* calcolate per le agenzie di viaggio (che sembra non vadano
|
* calcolate per le agenzie di viaggio (che sembra non vadano
|
||||||
* sottratte per il calcolo del volume di affari)
|
* comunque sottratte nel calcolo del volume di affari)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_plm->put("R2", prorata);
|
_plm->put("R2", prorata);
|
||||||
@ -756,41 +772,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
_plm->put("R8", acq_noCEE);
|
_plm->put("R8", acq_noCEE);
|
||||||
_plm->put("R9", corr_misCEE);
|
_plm->put("R9", corr_misCEE);
|
||||||
_plm->put("R10",acq_misCEE);
|
_plm->put("R10",acq_misCEE);
|
||||||
_plm->put("R11",acq_misnoCEE);
|
_plm->put("R11",acq_misnoCEE);
|
||||||
|
|
||||||
/*
|
|
||||||
* calcola base da base e credito di costo
|
|
||||||
* indi abilmente trova il codiva e calcola l'iva del caso
|
|
||||||
*/
|
|
||||||
real rip = acq_misCEE / (acq_misCEE + acq_misnoCEE);
|
|
||||||
real corr_imp = corr_misCEE * rip; corr_imp.round(ROUND_LIRA);
|
|
||||||
corr_imp += corr_CEE;
|
|
||||||
real cost_detr = acq_misCEE * acq_CEE;
|
|
||||||
real base_imp = corr_imp - (cost_detr
|
|
||||||
+ credito_costo_prec(month, codatt));
|
|
||||||
real debito = 0.0;
|
|
||||||
|
|
||||||
if (base_imp.sign() < 0)
|
|
||||||
{
|
|
||||||
// credito di costo
|
|
||||||
cred_cost = abs(base_imp);
|
|
||||||
// vendite_iva e' corretto cosi' visto che i corrispettivi
|
|
||||||
// sono registrati al lordo e l'imposta e' 0
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
debito = base_imp * aliquota_agvia();
|
|
||||||
vendite_iva += debito;
|
|
||||||
vendite_iva.round(ROUND_LIRA);
|
|
||||||
}
|
|
||||||
|
|
||||||
// tutte ste minchie le mettiamo in lim anche se sarebbe
|
|
||||||
// assai piu' migliore metterle in plm
|
|
||||||
look_lim(month,TRUE);
|
|
||||||
_lim->put("R2", cred_cost);
|
|
||||||
_lim->put("R3", debito);
|
|
||||||
_lim->put("R4", rip);
|
|
||||||
_lim->rewrite();
|
|
||||||
}
|
}
|
||||||
else if (_isagricolo)
|
else if (_isagricolo)
|
||||||
{
|
{
|
||||||
@ -804,12 +786,14 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// COSA MI TOCCA FARE (per campare, of course)
|
// COSA MI TOCCA FARE (per campare, of course)
|
||||||
// due numeri nello stesso campo
|
// due numeri nello stesso campo ma e' sempre meglio
|
||||||
|
// del TIPO RECORD
|
||||||
TToken_string s(40);
|
TToken_string s(40);
|
||||||
|
|
||||||
_plm->put("R0", vendite_iva);
|
_plm->put("R0", vendite_iva);
|
||||||
_plm->put("R1", acquisti_iva);
|
_plm->put("R1", acquisti_iva);
|
||||||
_plm->put("R3", ult_detr);
|
_plm->put("R3", ult_detr);
|
||||||
|
// probabilmente R4 serviva per il decalage e non si usera'
|
||||||
_plm->put("R12", _prorata); // per comodita' in stampa
|
_plm->put("R12", _prorata); // per comodita' in stampa
|
||||||
_plm->put("B0", "X"); // calcolato (invalidato dalla primanota)
|
_plm->put("B0", "X"); // calcolato (invalidato dalla primanota)
|
||||||
_plm->put("S1", for_rimb.string());
|
_plm->put("S1", for_rimb.string());
|
||||||
@ -817,18 +801,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
// si riempiano le stringhe di coppie di real
|
// si riempiano le stringhe di coppie di real
|
||||||
s.add(acq_ies.string());
|
s.add(acq_ies.string());
|
||||||
s.add(acq_ies_iva.string());
|
s.add(acq_ies_iva.string());
|
||||||
_plm->put("S2", (const char*)s);
|
_plm->put("S2", (const char*)s);
|
||||||
|
|
||||||
s = "";
|
s = "";
|
||||||
s.add(acq_pint.string());
|
s.add(acq_pint.string());
|
||||||
s.add(acq_pint_iva.string());
|
s.add(acq_pint_iva.string());
|
||||||
_plm->put("S3", (const char*)s);
|
_plm->put("S3", (const char*)s);
|
||||||
|
|
||||||
s = "";
|
s = "";
|
||||||
s.add(spgen.string());
|
s.add(spgen.string());
|
||||||
s.add(spgen_iva.string());
|
s.add(spgen_iva.string());
|
||||||
_plm->put("S4", (const char*)s);
|
_plm->put("S4", (const char*)s);
|
||||||
|
|
||||||
_plm->rewrite();
|
_plm->rewrite();
|
||||||
|
|
||||||
// salva gli altri totali para no ponernos locos despues
|
// salva gli altri totali para no ponernos locos despues
|
||||||
@ -853,13 +834,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
_ptm->put("S2", acquisti.string());
|
_ptm->put("S2", acquisti.string());
|
||||||
_ptm->put("S3", vendite.string());
|
_ptm->put("S3", vendite.string());
|
||||||
_ptm->rewrite();
|
_ptm->rewrite();
|
||||||
|
|
||||||
// somma le ulteriori detrazioni
|
|
||||||
look_lim(month, TRUE);
|
|
||||||
real dt = _lim->get_real("R6");
|
|
||||||
dt += ult_detr;
|
|
||||||
_lim->put("R6", dt);
|
|
||||||
_lim->rewrite();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TLiquidazione_app::write_liq(int month, const char* codatts)
|
void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||||
@ -871,65 +845,89 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
real risultato = 0.0;
|
real risultato = 0.0;
|
||||||
real vol_aff = 0.0;
|
real vol_aff = 0.0;
|
||||||
real debito_prec = 0.0;
|
real debito_prec = 0.0;
|
||||||
real ris_deb = 0.0;
|
real detrazioni = 0.0;
|
||||||
real ris_cred = 0.0;
|
|
||||||
|
// totali per agenzie viaggio
|
||||||
|
real c_iCEE(0.0);
|
||||||
|
real c_eCEE(0.0);
|
||||||
|
real a_iCEE(0.0);
|
||||||
|
real a_eCEE(0.0);
|
||||||
|
real c_mCEE(0.0);
|
||||||
|
real a_mCEE(0.0);
|
||||||
|
real a_meCEE(0.0);
|
||||||
|
real cred_cost(0.0);
|
||||||
|
real deb_mens(0.0);
|
||||||
|
real perc_r(0.0);
|
||||||
|
|
||||||
while ((tmpatt = atts.get()) != NULL)
|
while ((tmpatt = atts.get()) != NULL)
|
||||||
{
|
{
|
||||||
TString att(tmpatt);
|
TString att(tmpatt);
|
||||||
{
|
|
||||||
look_plm(month, att); look_ptm(month,att);
|
|
||||||
// a debito: IVA vendite, debito precedente, Prorata
|
|
||||||
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
|
||||||
risultato += (_plm->get_real("R0") - _plm->get_real("R1") +
|
|
||||||
_plm->get_real("R2") - _plm->get_real("R3") -
|
|
||||||
_plm->get_real("R4"));
|
|
||||||
|
|
||||||
ris_deb += (_plm->get_real("R0") + _plm->get_real("R2"));
|
|
||||||
ris_cred += (_plm->get_real("R1") + _plm->get_real("R3") +
|
|
||||||
_plm->get_real("R4"));
|
|
||||||
|
|
||||||
if (month == 12)
|
|
||||||
{
|
|
||||||
look_pla(att);
|
|
||||||
vol_aff += _pla->get_real("R0");
|
|
||||||
// a credito anche il conguaglio prorata
|
|
||||||
risultato -= _pla->get_real("R10");
|
|
||||||
ris_cred += _pla->get_real("R10");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// toglie credito precedente decrementato di ev. rimborsi chiesti
|
|
||||||
// e acconto versato e rettificato come da manuale
|
|
||||||
risultato -= credito_prec(month);
|
|
||||||
ris_cred += credito_prec(month);
|
|
||||||
|
|
||||||
// vedi se c'era un debito precedente
|
for (int m = 1; m <= 12; m++)
|
||||||
if (!is_first_month(month))
|
{
|
||||||
{
|
// ciclo su tutti i mesi del caso (1 o 3)
|
||||||
if (look_lim(previous_month(month)))
|
// non porta via tempo anche cosi'
|
||||||
|
if (!_isannual && !is_month_ok(m, month))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
look_plm(month, att); look_ptm(month,att);
|
||||||
|
// a debito: IVA vendite, debito precedente, Prorata
|
||||||
|
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
||||||
|
risultato += (_plm->get_real("R0") - _plm->get_real("R1") +
|
||||||
|
_plm->get_real("R2") - _plm->get_real("R3") -
|
||||||
|
_plm->get_real("R4"));
|
||||||
|
detrazioni+= (_plm->get_real("R3") + _plm->get_real("R4"));
|
||||||
|
|
||||||
|
if (_isviaggio)
|
||||||
|
{
|
||||||
|
// somma totali per calcolo successivo
|
||||||
|
c_iCEE += _plm->get_real("R5");
|
||||||
|
c_eCEE += _plm->get_real("R6");
|
||||||
|
a_iCEE += _plm->get_real("R7");
|
||||||
|
a_eCEE += _plm->get_real("R8");
|
||||||
|
c_mCEE += _plm->get_real("R9");
|
||||||
|
a_mCEE += _plm->get_real("R10");
|
||||||
|
a_meCEE += _plm->get_real("R11");
|
||||||
|
}
|
||||||
|
} // fine ciclo sul mese
|
||||||
|
|
||||||
|
// toglie credito precedente considerando rimborsi
|
||||||
|
// e acconto versato e rettifiche, come da manuale
|
||||||
|
risultato -= credito_prec(month);
|
||||||
|
// vedi se c'era un debito precedente per debiti < 50.000
|
||||||
|
risultato += debt_prec(month);
|
||||||
|
|
||||||
|
if (_isviaggio)
|
||||||
{
|
{
|
||||||
real r = _lim->get_real("R0");
|
// calcolo credito costo, debito mensile, perc. ripart.
|
||||||
if (_lim->get_real("R5").sign() > 0)
|
perc_r = (a_mCEE * CENTO)/(a_mCEE + a_meCEE);
|
||||||
r += _plm->get_real("R5");
|
real c = (c_mCEE * perc_r)/CENTO; c.round(ROUND_LIRA);
|
||||||
// non considera il rimborso in quanto se e' a debito
|
real tc = (c_iCEE + c);
|
||||||
// non c'e' rimborso, e se e' rettificato pure
|
real ta = (a_iCEE + a_mCEE);
|
||||||
if (r.sign() > 0 && r < IVA_DA_RIPORTARE)
|
real bi = tc - ta - credito_costo_prec(month);
|
||||||
debito_prec += r;
|
|
||||||
}
|
if (bi.sign() < 0)
|
||||||
}
|
// credito di costo
|
||||||
risultato += debito_prec;
|
{
|
||||||
ris_deb += debito_prec;
|
cred_cost = abs(bi);
|
||||||
|
cred_cost.round(ROUND_LIRA);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deb_mens = (bi /((CENTO + aliquota_agvia())/CENTO)) *
|
||||||
|
(aliquota_agvia()/CENTO);
|
||||||
|
deb_mens.round(ROUND_LIRA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
look_lim(month,TRUE);
|
look_lim(month,TRUE);
|
||||||
|
|
||||||
// scorpora ulteriori detrazioni
|
|
||||||
real dt = _lim->get_real("R6");
|
|
||||||
risultato -= dt;
|
|
||||||
ris_cred += dt;
|
|
||||||
|
|
||||||
_lim->put("R0",risultato);
|
_lim->put("R0",risultato);
|
||||||
|
_lim->put("R2",cred_cost);
|
||||||
|
_lim->put("R3",perc_r);
|
||||||
|
_lim->put("R4",deb_mens);
|
||||||
|
_lim->put("R6",detrazioni);
|
||||||
|
|
||||||
if (_freqviva == "T" && risultato.sign() > 0)
|
if (_freqviva == "T" && risultato.sign() > 0)
|
||||||
{
|
{
|
||||||
real interesse = interesse_trimestrale(_month);
|
real interesse = interesse_trimestrale(_month);
|
||||||
@ -939,14 +937,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
|
|
||||||
_lim->put("B0","X");
|
_lim->put("B0","X");
|
||||||
_lim->rewrite();
|
_lim->rewrite();
|
||||||
|
|
||||||
if (month == 12)
|
|
||||||
{
|
|
||||||
if (!look_lia(TRUE))
|
|
||||||
_lia->put("S7", (const char *) _freqviva);
|
|
||||||
_lia->put("R1", vol_aff);
|
|
||||||
_lia->rewrite();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -966,55 +956,58 @@ void TLiquidazione_app::recalc_annual(const char* att)
|
|||||||
real ven_lrd = 0.0;
|
real ven_lrd = 0.0;
|
||||||
|
|
||||||
int tipoatt = att[strlen(att) -1] - '0';
|
int tipoatt = att[strlen(att) -1] - '0';
|
||||||
|
|
||||||
TString aaa(att);
|
TString aaa(att);
|
||||||
|
|
||||||
if (tipoatt == 2)
|
if (tipoatt == 2)
|
||||||
{
|
{
|
||||||
// istanzia ai valori precedenti, calcolati per l'attivita' 1
|
// istanzia ai valori precedenti, calcolati per l'attivita' 1
|
||||||
look_pla(aaa);
|
// llok_pla forza a 1 il tipo attivita'
|
||||||
vendite = _pla->get_real("R0");
|
if (look_pla(aaa))
|
||||||
es_b1 = _pla->get_real("R1");
|
{
|
||||||
es_b2 = _pla->get_real("R2");
|
vendite = _pla->get_real("R0");
|
||||||
es_b3 = _pla->get_real("R3");
|
es_b1 = _pla->get_real("R1");
|
||||||
cess_amm = _pla->get_real("R4");
|
es_b2 = _pla->get_real("R2");
|
||||||
ivven = _pla->get_real("R11");
|
es_b3 = _pla->get_real("R3");
|
||||||
ivlac = _pla->get_real("R12");
|
cess_amm = _pla->get_real("R4");
|
||||||
ven_lrd = _pla->get_real("R13");
|
ivven = _pla->get_real("R11");
|
||||||
acq = _pla->get_real("R14");
|
ivlac = _pla->get_real("R12");
|
||||||
|
ven_lrd = _pla->get_real("R13");
|
||||||
|
acq = _pla->get_real("R14");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i <= 12; i++)
|
for (int i = 1; i <= 12; i++)
|
||||||
{
|
{
|
||||||
if (is_month_ok(i))
|
// ricalcola se necessario
|
||||||
{
|
if (i != 12 && !update_att(i,aaa,FALSE))
|
||||||
// ricalcola se necessario
|
describe_error("Attivita' non ricalcolata: "
|
||||||
if (i != 12 && !update_att(i,aaa,FALSE))
|
"possibili errori",att);
|
||||||
describe_error("Attivita' non ricalcolata: "
|
look_ptm(i,aaa); look_plm(i,aaa);
|
||||||
"possibili errori",att);
|
real vend(_ptm->get("S3"));
|
||||||
look_ptm(i,aaa); look_plm(i,aaa);
|
ven_lrd += vend; // lordo vendite
|
||||||
real vend(_ptm->get("S3"));
|
|
||||||
ven_lrd += vend; // lordo vendite
|
// non entra l'IVA per calcolo volume affari
|
||||||
// non entra l'IVA per calcolo volume affari
|
vendite += (vend - _plm->get_real("R0"));
|
||||||
vendite += (vend - _plm->get_real("R0"));
|
real eb3(_ptm->get("S0"));
|
||||||
real eb3(_ptm->get("S0"));
|
es_b1 += _ptm->get_real("R13");
|
||||||
es_b1 += _ptm->get_real("R13");
|
es_b2 += _ptm->get_real("R14");
|
||||||
es_b2 += _ptm->get_real("R14");
|
es_b3 += eb3;
|
||||||
es_b3 += eb3;
|
acq_iva += _plm->get_real("R1");
|
||||||
acq_iva += _plm->get_real("R1");
|
cess_amm += _ptm->get_real("R10");
|
||||||
cess_amm += _ptm->get_real("R10");
|
pro_pag += _plm->get_real("R2");
|
||||||
pro_pag += _plm->get_real("R2");
|
real aax(_ptm->get("S2"));
|
||||||
real aax(_ptm->get("S2"));
|
acq += aax - // rilevanti per aliquota media
|
||||||
acq += aax - // rilevanti per aliquota media
|
_ptm->get_real("R3") - // toglie ammortizz. etc
|
||||||
_ptm->get_real("R3") - // toglie ammortizz. etc
|
_ptm->get_real("R5") - // non detraibili non ci sono
|
||||||
_ptm->get_real("R5") - // non detraibili non ci sono
|
_ptm->get_real("R8");
|
||||||
_ptm->get_real("R8");
|
ivlac += _plm->get_real("R1") - // idem per IVE
|
||||||
ivlac += _plm->get_real("R1") - // idem per IVE
|
_ptm->get_real("R4") -
|
||||||
_ptm->get_real("R4") -
|
_ptm->get_real("R9") -
|
||||||
_ptm->get_real("R9") -
|
_ptm->get_real("R12");
|
||||||
_ptm->get_real("R12");
|
ivven += _plm->get_real("R0");
|
||||||
ivven += _plm->get_real("R0");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// calcolo prorata
|
// calcolo prorata
|
||||||
real prorata = (es_b1/(vendite - cess_amm - es_b3)) * CENTO;
|
real prorata = (es_b1/(vendite - cess_amm - es_b3)) * CENTO;
|
||||||
real conguaglio = 0.0;
|
real conguaglio = 0.0;
|
||||||
@ -1026,9 +1019,6 @@ void TLiquidazione_app::recalc_annual(const char* att)
|
|||||||
conguaglio = topay - pro_pag;
|
conguaglio = topay - pro_pag;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vediamo se la porca aliquota media acquisti e' superiore alla
|
|
||||||
// porca aliquota media vendite
|
|
||||||
|
|
||||||
look_pla(aaa);
|
look_pla(aaa);
|
||||||
_pla->put("R0", vendite);
|
_pla->put("R0", vendite);
|
||||||
_pla->put("R1", es_b1);
|
_pla->put("R1", es_b1);
|
||||||
@ -1128,4 +1118,4 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
199
cg/cg4302.cpp
199
cg/cg4302.cpp
@ -13,29 +13,7 @@ bool TLiquidazione_app::is_trim(int x)
|
|||||||
// TRUE se il mese passato e' un trimestre
|
// TRUE se il mese passato e' un trimestre
|
||||||
{ return x == 3 || x == 6 || x == 9 || x == 12; }
|
{ return x == 3 || x == 6 || x == 9 || x == 12; }
|
||||||
|
|
||||||
bool TLiquidazione_app::is_in_trim(int x, int t)
|
bool TLiquidazione_app::is_month_ok_strict(int x, int month)
|
||||||
// TRUE se il mese passato e' nel trimestre t
|
|
||||||
{
|
|
||||||
bool ret = FALSE;
|
|
||||||
switch(t)
|
|
||||||
{
|
|
||||||
case 3:
|
|
||||||
ret = x >= 1 && x <= 3;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
ret = x >= 4 && x <= 6;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
ret = x >= 7 && x <= 9;
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
ret = x >= 10 && x <= 12;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TLiquidazione_app::is_month_ok(int x, int month)
|
|
||||||
// TRUE se il mese passato e' compatibile con il regime
|
// TRUE se il mese passato e' compatibile con il regime
|
||||||
// di liquidazione e (opz) non e' maggiore di quello scelto
|
// di liquidazione e (opz) non e' maggiore di quello scelto
|
||||||
{
|
{
|
||||||
@ -45,6 +23,21 @@ bool TLiquidazione_app::is_month_ok(int x, int month)
|
|||||||
( x <= month && is_trim(x));
|
( x <= month && is_trim(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TLiquidazione_app::is_month_ok(int x, int mtocalc)
|
||||||
|
// TRUE se il mese passato e' compatibile con il mese da calcolare
|
||||||
|
// rispetto al regime di liquidazione scelto
|
||||||
|
{
|
||||||
|
bool ret = x == mtocalc;
|
||||||
|
if (!ret && _freqviva == "T")
|
||||||
|
{
|
||||||
|
// aggiusta al trimestre il mese da calcolare
|
||||||
|
mtocalc += 2 - ((mtocalc-1) % 3);
|
||||||
|
ret = x >= (mtocalc - 3) && x <= mtocalc;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TLiquidazione_app::is_first_month(int m)
|
bool TLiquidazione_app::is_first_month(int m)
|
||||||
{
|
{
|
||||||
return _freqviva == "M" ?
|
return _freqviva == "M" ?
|
||||||
@ -69,16 +62,13 @@ bool TLiquidazione_app::check_month(int m, int m2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TLiquidazione_app::is_date_ok(TDate& d, int month)
|
bool TLiquidazione_app::is_date_ok(TDate& d, int month)
|
||||||
// TRUE se la data passata va considerata nel
|
// TRUE se la data passata va considerata nel
|
||||||
// ricalcolo dei progressivi per il mese e anno
|
// ricalcolo dei progressivi mensili per il mese e anno
|
||||||
// selezionati
|
// selezionati
|
||||||
{
|
{
|
||||||
if (d.month() > month || d.year() != atoi(_year))
|
if (d.month() > month || d.year() != atoi(_year))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return _freqviva == "M" ?
|
return d.month() == month;
|
||||||
(d.month() == month):
|
|
||||||
((month - d.month()) >= 0 &&
|
|
||||||
(month - d.month()) < 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -326,12 +316,13 @@ bool TLiquidazione_app::look_ppa(int month, const char* codatt, int type, bool c
|
|||||||
|
|
||||||
bool TLiquidazione_app::look_del(int month, int type, bool create)
|
bool TLiquidazione_app::look_del(int month, int type, bool create)
|
||||||
{
|
{
|
||||||
TString16 ditta = _nditte->curr().get("CODDITTA");
|
long ditta = _nditte->curr().get_long("CODDITTA");
|
||||||
_del->zero();
|
_del->zero();
|
||||||
(*_del_ditta) = ditta;
|
(*_del_ditta) = format("%05ld", ditta);
|
||||||
(*_del_anno) = _year;
|
(*_del_anno) = _year;
|
||||||
(*_del_mese) = month;
|
(*_del_mese) = format("%02d", month);
|
||||||
(*_del_tipo) = type;
|
(*_del_tipo) = format("%1d", type);
|
||||||
|
|
||||||
TString16 ctab = _del->get("CODTAB");
|
TString16 ctab = _del->get("CODTAB");
|
||||||
_del->read();
|
_del->read();
|
||||||
|
|
||||||
@ -365,106 +356,80 @@ bool TLiquidazione_app::look_lia(bool create, int year)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
real TLiquidazione_app::result_liq(int month)
|
||||||
|
// risultato esatto della liquidazione del mese month, <0 a credito
|
||||||
|
// >0 a debito; non comprende il conguaglio prorata (annuale)
|
||||||
|
{
|
||||||
|
real r(0.0);
|
||||||
|
if (look_lim(month))
|
||||||
|
{
|
||||||
|
r = _lim->get_real("R0") +
|
||||||
|
_lim->get_real("R1") + // rimborso
|
||||||
|
_lim->get_real("R5"); // rettifiche
|
||||||
|
// le ulteriori detrazioni sono gia' comprese in R0
|
||||||
|
// eventuale acconto versato a dicembre
|
||||||
|
if (month == 12 && look_del(12,7) && _del->get_bool("B1"))
|
||||||
|
r -= _del->get_real("R0");
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
real TLiquidazione_app::debt_prec(int month)
|
||||||
|
{
|
||||||
|
real r(0.0);
|
||||||
|
if (!is_first_month(month))
|
||||||
|
{
|
||||||
|
if (look_lim(previous_month(month)))
|
||||||
|
{
|
||||||
|
r = result_liq(previous_month(month));
|
||||||
|
if (!(r.sign() > 0 && r < IVA_DA_RIPORTARE))
|
||||||
|
r = ZERO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
real TLiquidazione_app::credito_prec(int month)
|
real TLiquidazione_app::credito_prec(int month)
|
||||||
// ritorna l'appropriato credito precedente al mese in corso
|
// ritorna l'appropriato credito precedente al mese in corso
|
||||||
// lascia PLM posizionata sul mese passato
|
|
||||||
{
|
{
|
||||||
real c(0.0);
|
real c(0.0);
|
||||||
|
|
||||||
if (is_first_month(month))
|
if (is_first_month(month))
|
||||||
{
|
{
|
||||||
look_lia();
|
if (look_lia())
|
||||||
if (_lia->status() == NOERR)
|
c = _lia->get_real("R0");
|
||||||
c = _lia->get_real("R0");
|
// e' positivo
|
||||||
// int yr = atoi(_year) - 1;
|
|
||||||
// _lim->zero();
|
|
||||||
// *_lim_anno = yr;
|
|
||||||
// *_lim_mese = 12;
|
|
||||||
// if (_lim->read() == NOERR)
|
|
||||||
// considera anche il rimborso
|
|
||||||
// c = _lim->get_real("R0") + _lim->get_real("R1");
|
|
||||||
// e le eventuali rettifiche
|
|
||||||
// real rett = _lim->get_real("R5");
|
|
||||||
// c += rett;
|
|
||||||
// e le ulteriori detrazioni
|
|
||||||
// real detr = _lim->get_real("R6");
|
|
||||||
// c -= detr;
|
|
||||||
// e l'acconto versato a dicembre
|
|
||||||
// _del->zero();
|
|
||||||
|
|
||||||
// TString ditta = _nditte->curr().get("CODDITTA");
|
|
||||||
// *_del_ditta = ditta;
|
|
||||||
// *_del_anno = yr;
|
|
||||||
// *_del_mese = 12;
|
|
||||||
// *_del_tipo = 7;
|
|
||||||
// if (_del->read() == NOERR)
|
|
||||||
// c -= _del->get_real("R0");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool ok = look_lim(previous_month(month));
|
c = result_liq(previous_month(month));
|
||||||
if (!ok || !_lim->get_bool("B0"))
|
if (c.sign() < 0) c = abs(c);
|
||||||
{
|
else c = real(0.0);
|
||||||
if (_recalc != needed)
|
|
||||||
{
|
|
||||||
describe_error("Ricalcolo non eseguito: possibili errori "
|
|
||||||
"credito precedente","ALL");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
update_firm(previous_month(month), FALSE);
|
|
||||||
look_lim(previous_month(month));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// toglie il rimborso chiesto
|
|
||||||
c = _lim->get_real("R0") + _lim->get_real("R1");
|
|
||||||
// e le eventuali rettifiche
|
|
||||||
real rett = _lim->get_real("R5");
|
|
||||||
c += rett;
|
|
||||||
// e le ulteriori detrazioni
|
|
||||||
real detr = _lim->get_real("R6");
|
|
||||||
c -= detr;
|
|
||||||
}
|
}
|
||||||
look_lim(month);
|
|
||||||
|
|
||||||
if (c.sign() < 0) c = abs(c);
|
|
||||||
else c = real(0.0);
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
real TLiquidazione_app::credito_costo_prec(int month, const char* codatt)
|
real TLiquidazione_app::credito_costo_prec(int month)
|
||||||
// ritorna l'appropriato credito di costo precedente al mese in corso
|
// ritorna l'appropriato credito di costo precedente al mese in corso
|
||||||
// (travel agency only)
|
// (travel agency only)
|
||||||
{
|
{
|
||||||
real c = 0.0;
|
real c(0.0);
|
||||||
if (is_first_month(month))
|
if (is_first_month(month))
|
||||||
{
|
{
|
||||||
int yr = atoi(_year) - 1;
|
int yr = atoi(_year)-1;
|
||||||
_lim->zero();
|
_lim->zero();
|
||||||
*_lim_anno = yr;
|
*_lim_anno = yr;
|
||||||
*_lim_mese = 12;
|
*_lim_mese = 12;
|
||||||
if (_lim->read() == NOERR) c = _lim->get_real("R2");
|
if (_lim->read() == NOERR)
|
||||||
|
c = _lim->get_real("R2");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool ok = look_lim(previous_month(month));
|
if (look_lim(previous_month(month)))
|
||||||
if (!ok || !_lim->get_bool("B0"))
|
|
||||||
{
|
|
||||||
if (_recalc != needed)
|
|
||||||
{
|
|
||||||
describe_error("Ricalcolo non eseguito: possibili errori "
|
|
||||||
"credito di costo","ALL");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Super Prassi a questo punto vorrebbe una update_firm
|
|
||||||
update_att(previous_month(month), codatt, FALSE);
|
|
||||||
look_lim(previous_month(month));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// qui il rimborso non c'e'
|
// qui il rimborso non c'e'
|
||||||
c = _lim->get_real("R2");
|
c = _lim->get_real("R2");
|
||||||
}
|
}
|
||||||
look_lim(month);
|
look_lim(month);
|
||||||
return c;
|
return c;
|
||||||
@ -472,13 +437,19 @@ real TLiquidazione_app::credito_costo_prec(int month, const char* codatt)
|
|||||||
|
|
||||||
|
|
||||||
real TLiquidazione_app::versamenti_IVA(int month, bool acconto)
|
real TLiquidazione_app::versamenti_IVA(int month, bool acconto)
|
||||||
{
|
{
|
||||||
|
// se month e' 12 e acconto == TRUE somma anche
|
||||||
|
// l'eventuale acconto versato a dicembre
|
||||||
real ret(0.0);
|
real ret(0.0);
|
||||||
int typ = acconto ? 7 : 1;
|
|
||||||
|
if (look_del(month,1))
|
||||||
if (look_del(month,typ))
|
|
||||||
if (_del->get_bool("B0")) // solo se stampata
|
if (_del->get_bool("B0")) // solo se stampata
|
||||||
ret = _del->get_real("R0") + _del->get_real("R1");
|
ret = _del->get_real("R0") + _del->get_real("R1");
|
||||||
|
|
||||||
|
if (month == 12 && acconto)
|
||||||
|
if (look_del(month,7))
|
||||||
|
if (_del->get_bool("B0")) // solo se stampata
|
||||||
|
ret += _del->get_real("R0") + _del->get_real("R1");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -496,6 +467,6 @@ real TLiquidazione_app::interesse_trimestrale(int month)
|
|||||||
{
|
{
|
||||||
month /= 3; month--;
|
month /= 3; month--;
|
||||||
TConfig cnf(CONFIG_STUDIO);
|
TConfig cnf(CONFIG_STUDIO);
|
||||||
real r = cnf.get("InTr", NULL, month);
|
real r(cnf.get("InTr", NULL, month));
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
104
cg/cg4303.cpp
104
cg/cg4303.cpp
@ -17,23 +17,14 @@ void TLiquidazione_app::add_plafond(int month, const char* codatt, int type,
|
|||||||
real r1 = _ppa_r->get_real("R1");
|
real r1 = _ppa_r->get_real("R1");
|
||||||
real r2 = _ppa_r->get_real("R2");
|
real r2 = _ppa_r->get_real("R2");
|
||||||
|
|
||||||
if (intra)
|
if (intra) r1 += howmuch;
|
||||||
r1 += howmuch;
|
else r0 += howmuch;
|
||||||
else
|
|
||||||
r0 += howmuch;
|
|
||||||
|
|
||||||
if (r2 < (r0+r1))
|
if (r2 < (r0+r1))
|
||||||
{
|
|
||||||
describe_error("Acquisti in eccesso rispetto al plafond disponibile",
|
describe_error("Acquisti in eccesso rispetto al plafond disponibile",
|
||||||
att.cut(5));
|
att.cut(5));
|
||||||
}
|
|
||||||
// r2 -= (r0+r1);
|
|
||||||
// if (r2.sign() < 0) r2 = 0.0;
|
|
||||||
|
|
||||||
_ppa_r->put("R0",r0);
|
_ppa_r->put("R0",r0);
|
||||||
_ppa_r->put("R1",r1);
|
_ppa_r->put("R1",r1);
|
||||||
// _ppa_r->put("R2",r2);
|
|
||||||
|
|
||||||
_ppa->rewrite();
|
_ppa->rewrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,62 +119,61 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
|||||||
TString att(codatt);
|
TString att(codatt);
|
||||||
|
|
||||||
// 1) ricalcola i pim dei mesi dal primo al corrente se necessario
|
// 1) ricalcola i pim dei mesi dal primo al corrente se necessario
|
||||||
|
recalc rcl = _recalc;
|
||||||
|
_recalc = needed;
|
||||||
for (int m = 1; m < month; m++)
|
for (int m = 1; m < month; m++)
|
||||||
if (is_month_ok(m)) update_att(m,codatt, FALSE);
|
update_att(m,codatt, FALSE);
|
||||||
|
_recalc = rcl;
|
||||||
|
|
||||||
_vent_arr.destroy();
|
_vent_arr.destroy();
|
||||||
|
|
||||||
for (m = 1; m <= month; m++)
|
for (m = 1; m <= month; m++)
|
||||||
{
|
{
|
||||||
if (is_month_ok(m))
|
// aggiunge gli acquisti del mese m operando sui pim
|
||||||
|
for (_pim->first(); !_pim->eof(); _pim->next())
|
||||||
{
|
{
|
||||||
// aggiunge gli acquisti del mese m operando sui pim
|
// se e' acquisto beni per rivendita
|
||||||
for (_pim->first(); !_pim->eof(); _pim->next())
|
int tipocr = atoi(*_pim_tipocr);
|
||||||
|
int mese = atoi(*_pim_mese);
|
||||||
|
int tipodet = atoi(*_pim_tipodet);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* se non si e' settato il ricalcolo nei parametri ditta
|
||||||
|
* considera soltanto quelli con detraibilita' == 3
|
||||||
|
* (passaggi interni)
|
||||||
|
* sensu Scudler 1994
|
||||||
|
*/
|
||||||
|
if (!_isricacq && tipodet != 3)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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))
|
||||||
{
|
{
|
||||||
// se e' acquisto beni per rivendita
|
look_iva(*_pim_codiva);
|
||||||
int tipocr = atoi(*_pim_tipocr);
|
|
||||||
int mese = atoi(*_pim_mese);
|
|
||||||
int tipodet = atoi(*_pim_tipodet);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* se non si e' settato il ricalcolo nei parametri ditta
|
|
||||||
* considera soltanto quelli con detraibilita' == 3
|
|
||||||
* (passaggi interni)
|
|
||||||
* sensu Scudler 1994
|
|
||||||
*/
|
|
||||||
if (!_isricacq && tipodet != 3)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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))
|
|
||||||
|
|
||||||
{
|
|
||||||
look_iva(*_pim_codiva);
|
|
||||||
|
|
||||||
// soltanto normali ed esenti IVA sono base di riparto
|
// soltanto normali ed esenti IVA sono base di riparto
|
||||||
if (_iva->get("S1").empty() || _iva->get("S1") == "ES")
|
if (_iva->get("S1").empty() || _iva->get("S1") == "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())
|
||||||
{
|
{
|
||||||
real lurd = _pim->get_real("R0");
|
// ventila a un altro codice
|
||||||
lurd += _pim->get_real("R1");
|
look_iva(other);
|
||||||
real perc = _iva->get_real("R0");
|
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);
|
|
||||||
}
|
}
|
||||||
|
add_ventilation(perc / CENTO, lurd, *_pim_codiva);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
165
cg/cg4304.cpp
165
cg/cg4304.cpp
@ -67,11 +67,11 @@ bool TLiquidazione_app::preprocess_page(int file, int cnt)
|
|||||||
// Print description
|
// Print description
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
void TLiquidazione_app::describe_att(int month, const char* codatt)
|
void TLiquidazione_app::describe_att(int month, const char* codatt, bool isresult)
|
||||||
{
|
{
|
||||||
TToken_string atts(codatt);
|
TToken_string atts(codatt);
|
||||||
|
|
||||||
if (_isprint)
|
if (_isprint && _canprint)
|
||||||
{
|
{
|
||||||
describe_name(month, atts);
|
describe_name(month, atts);
|
||||||
if (atts.items() == 1 && _isplafond)
|
if (atts.items() == 1 && _isplafond)
|
||||||
@ -82,7 +82,8 @@ void TLiquidazione_app::describe_att(int month, const char* codatt)
|
|||||||
describe_agricolo(month, codatt);
|
describe_agricolo(month, codatt);
|
||||||
if (atts.items() == 1 && _isviaggio)
|
if (atts.items() == 1 && _isviaggio)
|
||||||
describe_viaggio(month, codatt);
|
describe_viaggio(month, codatt);
|
||||||
describe_pims(month,codatt);
|
if (isresult)
|
||||||
|
describe_pims(month,codatt);
|
||||||
if (atts.items() == 1)
|
if (atts.items() == 1)
|
||||||
describe_consistence(codatt);
|
describe_consistence(codatt);
|
||||||
}
|
}
|
||||||
@ -109,7 +110,7 @@ void TLiquidazione_app::describe_name(int month, TToken_string& codatts)
|
|||||||
|
|
||||||
void TLiquidazione_app::describe_firm(int month)
|
void TLiquidazione_app::describe_firm(int month)
|
||||||
{
|
{
|
||||||
if (!_isprint) return;
|
if (!_isprint || !_canprint) return;
|
||||||
|
|
||||||
_DescrItem* d = new _DescrItem(SET_FIRM);
|
_DescrItem* d = new _DescrItem(SET_FIRM);
|
||||||
|
|
||||||
@ -123,7 +124,6 @@ void TLiquidazione_app::describe_firm(int month)
|
|||||||
|
|
||||||
void TLiquidazione_app::describe_plafond(int month, const char* codatt)
|
void TLiquidazione_app::describe_plafond(int month, const char* codatt)
|
||||||
{
|
{
|
||||||
if (month == 13) month = 12;
|
|
||||||
// prepara la descrizione del riepilogo da stampare e lo accoda
|
// prepara la descrizione del riepilogo da stampare e lo accoda
|
||||||
real t1, t2, t3;
|
real t1, t2, t3;
|
||||||
_DescrItem* d = new _DescrItem(PLAFOND);
|
_DescrItem* d = new _DescrItem(PLAFOND);
|
||||||
@ -131,23 +131,27 @@ void TLiquidazione_app::describe_plafond(int month, const char* codatt)
|
|||||||
for (int jj = 1; jj <= 3; jj++) // three types of plafond
|
for (int jj = 1; jj <= 3; jj++) // three types of plafond
|
||||||
{
|
{
|
||||||
t1 = 0.0; t2 = 0.0; t3 = 0.0;
|
t1 = 0.0; t2 = 0.0; t3 = 0.0;
|
||||||
for (int m = 1; m <= month; m++)
|
for (int m = 1; m <= month && m < 13; m++)
|
||||||
{
|
{
|
||||||
if (!is_month_ok(m)) continue;
|
if (is_month_ok(m,month) && look_ppa(m,codatt,jj))
|
||||||
|
|
||||||
if (look_ppa(m,codatt,jj))
|
|
||||||
{
|
{
|
||||||
t1 = _ppa->get_real("R0");
|
t1 += _ppa->get_real("R0");
|
||||||
t2 = _ppa->get_real("R1");
|
t2 += _ppa->get_real("R1");
|
||||||
t3 = _ppa->get_real("R2");
|
t3 = _ppa->get_real("R2");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (jj)
|
switch (jj)
|
||||||
{
|
{
|
||||||
case 1: d->_r0 = t1; d->_r1 = t2; d->_r2 = t3; break;
|
case 1:
|
||||||
case 2: d->_r3 = t1; d->_r4 = t2; d->_r5 = t3; break;
|
d->_r0 = t1; d->_r1 = t2; d->_r2 = t3;
|
||||||
case 3: d->_r6 = t1; d->_r7 = t2; d->_r8 = t3; break;
|
break;
|
||||||
}
|
case 2:
|
||||||
|
d->_r3 = t1; d->_r4 = t2; d->_r5 = t3;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
d->_r6 = t1; d->_r7 = t2; d->_r8 = t3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} // for tipo esenzione plafond
|
} // for tipo esenzione plafond
|
||||||
|
|
||||||
_descr_arr.add(d);
|
_descr_arr.add(d);
|
||||||
@ -212,7 +216,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
|
|||||||
d->_arr.add(vd);
|
d->_arr.add(vd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (check_month(mese,month) && corrisp
|
else if (is_month_ok(mese,month) && corrisp
|
||||||
&& _pim->get_bool("B1") &&
|
&& _pim->get_bool("B1") &&
|
||||||
tipocr == 0 && tipomov == vendita)
|
tipocr == 0 && tipomov == vendita)
|
||||||
// non sono sicurissimo della above condition
|
// non sono sicurissimo della above condition
|
||||||
@ -243,18 +247,13 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
|
|||||||
|
|
||||||
void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
|
void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
|
||||||
{
|
{
|
||||||
if (month != 13)
|
|
||||||
if (!(look_plm(month, codatt) && look_ptm(month,codatt)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_DescrItem* d = new _DescrItem(REGAGR);
|
_DescrItem* d = new _DescrItem(REGAGR);
|
||||||
|
|
||||||
for (int mese = 1; mese <= month; mese++)
|
for (int mese = 1; mese <= month && mese < 13; mese++)
|
||||||
{
|
{
|
||||||
if (mese == 13)
|
if (!(_isannual || _isriepilogo) && !is_month_ok(mese,month))
|
||||||
break;
|
|
||||||
if (month != 13 && mese != month)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(look_plm(mese, codatt) && look_ptm(mese,codatt)))
|
if (!(look_plm(mese, codatt) && look_ptm(mese,codatt)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -266,27 +265,21 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
|
|||||||
d->_r5 += _plm->get_real("R1"); // IVA vendite rimasta
|
d->_r5 += _plm->get_real("R1"); // IVA vendite rimasta
|
||||||
d->_r6 += _ptm->get_real("R4") + _ptm->get_real("R12") +
|
d->_r6 += _ptm->get_real("R4") + _ptm->get_real("R12") +
|
||||||
_ptm->get_real("R9"); // IVA acq. ammortizzabili
|
_ptm->get_real("R9"); // IVA acq. ammortizzabili
|
||||||
}
|
}
|
||||||
|
|
||||||
_descr_arr.add(d);
|
_descr_arr.add(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
|
void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
|
||||||
{
|
{
|
||||||
if (month != 13)
|
if (month != 13 && !look_lim(month))
|
||||||
if (!(look_plm(month, codatt) && look_lim(month)))
|
return;
|
||||||
return;
|
|
||||||
|
|
||||||
_DescrItem* d = new _DescrItem(REGVIA);
|
_DescrItem* d = new _DescrItem(REGVIA);
|
||||||
|
|
||||||
for (int mese = 1; mese <= month; mese++)
|
for (int mese = 1; mese <= month && mese < 13; mese++)
|
||||||
{
|
{
|
||||||
if (mese == 13)
|
if (!is_month_ok(mese,month) || !look_plm(mese, codatt))
|
||||||
break;
|
continue;
|
||||||
if (!check_month(mese,month))
|
|
||||||
continue;
|
|
||||||
if (!(look_plm(mese, codatt) && look_lim(mese)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
d->_r0 += _plm->get_real("R5"); // corrispettivi CEE
|
d->_r0 += _plm->get_real("R5"); // corrispettivi CEE
|
||||||
d->_r1 += _plm->get_real("R9"); // corrispettivi misti CEE
|
d->_r1 += _plm->get_real("R9"); // corrispettivi misti CEE
|
||||||
@ -295,11 +288,11 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
|
|||||||
d->_r4 += _plm->get_real("R10"); // acquisti misti parte CEE
|
d->_r4 += _plm->get_real("R10"); // acquisti misti parte CEE
|
||||||
d->_r5 += _plm->get_real("R8"); // acquisti fuori CEE
|
d->_r5 += _plm->get_real("R8"); // acquisti fuori CEE
|
||||||
d->_r6 += _plm->get_real("R11"); // acquisti misti parte fuori CEE
|
d->_r6 += _plm->get_real("R11"); // acquisti misti parte fuori CEE
|
||||||
// questa e' sempre quella dell'ultimo mese
|
|
||||||
d->_r7 = _lim->get_real("R4"); // percentuale di ripartizione
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d->_r7 = _lim->get_real("R4"); // perc. ripartizione
|
||||||
// credito di costo precedente (CHECK annuale)
|
// credito di costo precedente (CHECK annuale)
|
||||||
d->_r8 = credito_costo_prec(_isriepilogo || _isannual ? 12 : mese, codatt);
|
d->_r8 = credito_costo_prec(_isriepilogo || _isannual ? 12 : mese);
|
||||||
// calcolera' imposte e crediti solo se e' annuale vera
|
// calcolera' imposte e crediti solo se e' annuale vera
|
||||||
d->_f1 = _isriepilogo && !_isannual;
|
d->_f1 = _isriepilogo && !_isannual;
|
||||||
|
|
||||||
@ -360,7 +353,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp((const char*)*_pim_codatt, att) == 0 &&
|
if (strcmp((const char*)*_pim_codatt, att) == 0 &&
|
||||||
check_month(atoi(*_pim_mese),month) &&
|
is_month_ok(atoi(*_pim_mese),month) &&
|
||||||
_year == (const char*)*_pim_anno)
|
_year == (const char*)*_pim_anno)
|
||||||
{
|
{
|
||||||
// vedi se c'e' gia' un item corrispondente
|
// vedi se c'e' gia' un item corrispondente
|
||||||
@ -371,13 +364,36 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
|
|||||||
d->_s0 == ref &&
|
d->_s0 == ref &&
|
||||||
d->_s1 == (const char*)*_pim_codiva)
|
d->_s1 == (const char*)*_pim_codiva)
|
||||||
break;
|
break;
|
||||||
|
if (d->_s1 > (const char*)*_pim_codiva)
|
||||||
|
{
|
||||||
|
isnew = TRUE;
|
||||||
|
_DescrItem* dd = new _DescrItem(PIM_ROW);
|
||||||
|
// CiccioPrassi li vuole in ordine crescente
|
||||||
|
_descr_arr.insert(dd,i);
|
||||||
|
// che cazzo di due marroni: se quello dopo
|
||||||
|
// era il primo, quello prima e' dopo
|
||||||
|
if (d->_f0)
|
||||||
|
{
|
||||||
|
dd->_f0 = TRUE;
|
||||||
|
d->_f0 = FALSE;
|
||||||
|
}
|
||||||
|
else if (isfirst)
|
||||||
|
{
|
||||||
|
d->_f0 = TRUE;
|
||||||
|
isfirst = FALSE;
|
||||||
|
}
|
||||||
|
d = dd;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (i == _descr_arr.items())
|
if (!isnew && i == _descr_arr.items())
|
||||||
{
|
{
|
||||||
isnew = TRUE;
|
isnew = TRUE;
|
||||||
d = new _DescrItem(PIM_ROW);
|
d = new _DescrItem(PIM_ROW);
|
||||||
|
if (isfirst) { d->_f0 = TRUE; isfirst = FALSE; }
|
||||||
|
_descr_arr.add(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tipomov == acquisto)
|
if (tipomov == acquisto)
|
||||||
{
|
{
|
||||||
d->_r4 += _pim->get_real("R0");
|
d->_r4 += _pim->get_real("R0");
|
||||||
@ -426,13 +442,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
|
|||||||
{
|
{
|
||||||
d->_s0 = ref;
|
d->_s0 = ref;
|
||||||
d->_s1 = *_pim_codiva;
|
d->_s1 = *_pim_codiva;
|
||||||
_descr_arr.add(d);
|
|
||||||
// flag per stampare l'intestazione colonne
|
// flag per stampare l'intestazione colonne
|
||||||
if (isfirst)
|
|
||||||
{
|
|
||||||
d->_f0 = TRUE;
|
|
||||||
isfirst = FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -465,7 +475,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
|
|||||||
|
|
||||||
for (int m = 1; m <= month && m < 13; m++)
|
for (int m = 1; m <= month && m < 13; m++)
|
||||||
{
|
{
|
||||||
if (!is_month_ok(m) || !check_month(m,month)) continue;
|
if (!is_month_ok(m,month) && !(_isannual || _isriepilogo)) continue;
|
||||||
|
|
||||||
atts.restart();
|
atts.restart();
|
||||||
while ((tmpatt = atts.get()) != NULL)
|
while ((tmpatt = atts.get()) != NULL)
|
||||||
@ -563,7 +573,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
|
|||||||
void TLiquidazione_app::describe_liq(int month, const char* codatts,
|
void TLiquidazione_app::describe_liq(int month, const char* codatts,
|
||||||
_DescrItem* di)
|
_DescrItem* di)
|
||||||
{
|
{
|
||||||
if (!_isprint) return;
|
if (!_isprint || !_canprint) return;
|
||||||
if (_isannual || _isriepilogo) month = 12;
|
if (_isannual || _isriepilogo) month = 12;
|
||||||
|
|
||||||
_DescrItem* d = new _DescrItem(THE_END);
|
_DescrItem* d = new _DescrItem(THE_END);
|
||||||
@ -578,12 +588,16 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts,
|
|||||||
while ((tmpatt = atts.get()) != NULL)
|
while ((tmpatt = atts.get()) != NULL)
|
||||||
{
|
{
|
||||||
TString att(tmpatt);
|
TString att(tmpatt);
|
||||||
look_plm(month, att);
|
for (int mm = 1; mm <= 12; mm++)
|
||||||
d->_r0 += _plm->get_real("R0"); // IVA vendite
|
{
|
||||||
d->_r1 += _plm->get_real("R1"); // IVA acquisti
|
if (!is_month_ok(mm, month)) continue;
|
||||||
d->_r2 += _plm->get_real("R3"); // Detrazioni 1
|
look_plm(mm, att);
|
||||||
d->_r2 += _plm->get_real("R4"); // Detrazioni 2
|
d->_r0 += _plm->get_real("R0"); // IVA vendite
|
||||||
d->_r1 -= _plm->get_real("R2"); // pro-rata
|
d->_r1 += _plm->get_real("R1"); // IVA acquisti
|
||||||
|
d->_r2 += _plm->get_real("R3"); // Detrazioni 1
|
||||||
|
d->_r2 += _plm->get_real("R4"); // Detrazioni 2
|
||||||
|
d->_r1 -= _plm->get_real("R2"); // pro-rata
|
||||||
|
}
|
||||||
// ev. conguaglio prorata
|
// ev. conguaglio prorata
|
||||||
if (_isannual || _isriepilogo)
|
if (_isannual || _isriepilogo)
|
||||||
{
|
{
|
||||||
@ -592,8 +606,10 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
look_lim(month);
|
look_lim(month);
|
||||||
|
|
||||||
d->_r3 += _lim->get_real("R0"); // risultato
|
d->_r3 += _lim->get_real("R0"); // risultato
|
||||||
d->_r4 += _lim->get_real("R1"); // rimborso
|
d->_r4 += _lim->get_real("R1"); // rimborso
|
||||||
|
|
||||||
if (_lim->get("S7") == "D")
|
if (_lim->get("S7") == "D")
|
||||||
d->_r5 += abs(_lim->get_real("R5")); // rettifiche a debito
|
d->_r5 += abs(_lim->get_real("R5")); // rettifiche a debito
|
||||||
else
|
else
|
||||||
@ -676,7 +692,8 @@ void TLiquidazione_app::describe_consistence(const char* codatt)
|
|||||||
|
|
||||||
|
|
||||||
void TLiquidazione_app::describe_error(const char* err, const char* codatt)
|
void TLiquidazione_app::describe_error(const char* err, const char* codatt)
|
||||||
{
|
{
|
||||||
|
if (!_isprint || !_canprint) return;
|
||||||
_errors.add(new _ErrItem(err,codatt,_nditte->curr().get("CODDITTA")));
|
_errors.add(new _ErrItem(err,codatt,_nditte->curr().get("CODDITTA")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,9 +734,9 @@ void TLiquidazione_app::set_firm(_DescrItem& d)
|
|||||||
{
|
{
|
||||||
_ErrItem& s = (_ErrItem&)_errors[i];
|
_ErrItem& s = (_ErrItem&)_errors[i];
|
||||||
if (s._att == "ALL" && s._firm == d._s0)
|
if (s._att == "ALL" && s._firm == d._s0)
|
||||||
{ j++; set_row(i+10, "@5g@b*** %s ***@r", (const char*)s._err); }
|
{ j++; set_row(i+3, "@5g@b*** %s ***@r", (const char*)s._err); }
|
||||||
}
|
}
|
||||||
if (j) set_auto_ff(TRUE);
|
if (j) set_row(i+3,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -750,7 +767,7 @@ void TLiquidazione_app::set_att(_DescrItem& d)
|
|||||||
TString tipatt;
|
TString tipatt;
|
||||||
|
|
||||||
if (d._f0 > 0)
|
if (d._f0 > 0)
|
||||||
tipatt.format("(att. %d)", d._f0);
|
tipatt.format(d._f0 == 1 ? "SERVIZI" : "ALTRE ATTIVITA'");
|
||||||
|
|
||||||
if (d._s3.empty())
|
if (d._s3.empty())
|
||||||
{
|
{
|
||||||
@ -905,6 +922,7 @@ void TLiquidazione_app::set_plm(_DescrItem& d)
|
|||||||
&tot2);
|
&tot2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TLiquidazione_app::set_ptm(_DescrItem& d)
|
void TLiquidazione_app::set_ptm(_DescrItem& d)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -938,6 +956,7 @@ void TLiquidazione_app::set_ptm(_DescrItem& d)
|
|||||||
}
|
}
|
||||||
if (!(spgn.is_zero() && spgn_iva.is_zero()))
|
if (!(spgn.is_zero() && spgn_iva.is_zero()))
|
||||||
{
|
{
|
||||||
|
printed = TRUE;
|
||||||
set_row(row++, "Spese generali@50g%r@69g%r",
|
set_row(row++, "Spese generali@50g%r@69g%r",
|
||||||
&spgn,
|
&spgn,
|
||||||
&spgn_iva);
|
&spgn_iva);
|
||||||
@ -959,7 +978,7 @@ void TLiquidazione_app::set_ptm(_DescrItem& d)
|
|||||||
&(d._r3),
|
&(d._r3),
|
||||||
&rn);
|
&rn);
|
||||||
}
|
}
|
||||||
if (d._f0 && !(d._r11.is_zero()))
|
if (d._f0)
|
||||||
{
|
{
|
||||||
printed = TRUE;
|
printed = TRUE;
|
||||||
set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r",
|
set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r",
|
||||||
@ -1048,8 +1067,6 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
|
|||||||
|
|
||||||
set_row(rw++,"@11gRISULTATO@58g%r", &rc);
|
set_row(rw++,"@11gRISULTATO@58g%r", &rc);
|
||||||
|
|
||||||
// TBI versamenti integrativi e non, e chissa' cos'altro
|
|
||||||
|
|
||||||
real iva = rd - rc;
|
real iva = rd - rc;
|
||||||
char how = iva.sign() < 0 ? 'c' : 'd';
|
char how = iva.sign() < 0 ? 'c' : 'd';
|
||||||
iva = abs(iva);
|
iva = abs(iva);
|
||||||
@ -1302,7 +1319,6 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
|||||||
"RELATIVI A VIAGGI MISTI");
|
"RELATIVI A VIAGGI MISTI");
|
||||||
set_row(18,"");
|
set_row(18,"");
|
||||||
|
|
||||||
|
|
||||||
// la bella frazioncina della percentuale di ripartizione
|
// la bella frazioncina della percentuale di ripartizione
|
||||||
TString tmp(d._r4.string(REAL_PICTURE)); tmp.ltrim();
|
TString tmp(d._r4.string(REAL_PICTURE)); tmp.ltrim();
|
||||||
TString up = tmp;
|
TString up = tmp;
|
||||||
@ -1313,7 +1329,7 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
|||||||
int ln = max(up.len(), dn.len()) + 2;
|
int ln = max(up.len(), dn.len()) + 2;
|
||||||
TString den(ln); den.fill('-');
|
TString den(ln); den.fill('-');
|
||||||
up.center_just(ln); dn.center_just(ln);
|
up.center_just(ln); dn.center_just(ln);
|
||||||
real rip = d._r7 * CENTO; rip.round(2);
|
real rip = d._r7; rip.round(2);
|
||||||
|
|
||||||
// la bella frazioncina degli imponibili viaggi misti
|
// la bella frazioncina degli imponibili viaggi misti
|
||||||
TString tmp2 = d._r1.string(REAL_PICTURE); tmp2.ltrim();
|
TString tmp2 = d._r1.string(REAL_PICTURE); tmp2.ltrim();
|
||||||
@ -1331,7 +1347,7 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
|||||||
int rem2 = pos1+ den.len() + 11;
|
int rem2 = pos1+ den.len() + 11;
|
||||||
int pos2 = rem2 + 20;
|
int pos2 = rem2 + 20;
|
||||||
|
|
||||||
real cim = d._r1 * d._r7; cim.round(ROUND_LIRA);
|
real cim = (d._r1 * d._r7)/CENTO; cim.round(ROUND_LIRA);
|
||||||
|
|
||||||
set_row(19,format("@%dg%%t@%dg%%t", pos1, pos2),
|
set_row(19,format("@%dg%%t@%dg%%t", pos1, pos2),
|
||||||
&up, &up2);
|
&up, &up2);
|
||||||
@ -1355,20 +1371,20 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
|||||||
&up, &den, &tmr);
|
&up, &den, &tmr);
|
||||||
|
|
||||||
// se e' l'annuale non ha senso altro
|
// se e' l'annuale non ha senso altro
|
||||||
if (d._f1) return;
|
// if (d._f1) return;
|
||||||
|
|
||||||
tmr = d._r3 + d._r4;
|
real tma = d._r3 + d._r4;
|
||||||
tmp = d._r3.string(REAL_PICTURE); tmp.ltrim();
|
tmp = d._r3.string(REAL_PICTURE); tmp.ltrim();
|
||||||
up = "("; up << tmp << " + ";
|
up = "("; up << tmp << " + ";
|
||||||
tmp = d._r4.string(REAL_PICTURE); tmp.ltrim();
|
tmp = d._r4.string(REAL_PICTURE); tmp.ltrim();
|
||||||
up << tmp << ")";
|
up << tmp << ")";
|
||||||
den.fill('.',59-up.len());
|
den.fill('.',59-up.len());
|
||||||
set_row(24,"Ammontare dei costi deducibili@40g%t %t@100g%r",
|
set_row(24,"Ammontare dei costi deducibili@40g%t %t@100g%r",
|
||||||
&up, &den, &tmr);
|
&up, &den, &tma);
|
||||||
den.fill('.',60);
|
den.fill('.',60);
|
||||||
set_row(25,"Credito di costo precedente @40g%t@100g%r", &den, &(d._r8));
|
set_row(25,"Credito di costo precedente @40g%t@100g%r", &den, &(d._r8));
|
||||||
|
|
||||||
real bil = d._r0 - tmr - d._r8;
|
real bil = tmr - tma - d._r8;
|
||||||
|
|
||||||
bool iscred = bil.sign() < 0;
|
bool iscred = bil.sign() < 0;
|
||||||
bil = abs(bil);
|
bil = abs(bil);
|
||||||
@ -1389,12 +1405,11 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
|||||||
iscred ? "CREDITO DI COSTO " : "Base imponibile lorda",
|
iscred ? "CREDITO DI COSTO " : "Base imponibile lorda",
|
||||||
&up, &den, &bil);
|
&up, &den, &bil);
|
||||||
}
|
}
|
||||||
else
|
else if (bil.sign() > 0)
|
||||||
{
|
{
|
||||||
real aliva = aliquota_agvia();
|
real aliva = aliquota_agvia();
|
||||||
real dovuta = bil - (bil / (aliva+real(1.0)));
|
real dovuta = (bil/((aliva+CENTO)/CENTO)) * (aliva/CENTO);
|
||||||
dovuta.ceil(ROUND_LIRA);
|
dovuta.round(ROUND_LIRA);
|
||||||
aliva *= 100.0;
|
|
||||||
|
|
||||||
tmp = bil.string(REAL_PICTURE); tmp.ltrim();
|
tmp = bil.string(REAL_PICTURE); tmp.ltrim();
|
||||||
up = tmp;
|
up = tmp;
|
||||||
|
@ -15,6 +15,7 @@ bool TLiquidazione_app::set_deleghe()
|
|||||||
{
|
{
|
||||||
TMask m("cg4300b.msk");
|
TMask m("cg4300b.msk");
|
||||||
|
|
||||||
|
m.field(FLD_CGB_YEAR).set(_year);
|
||||||
m.field(FLD_CGB_YEAR).set_handler(ch_year_handler);
|
m.field(FLD_CGB_YEAR).set_handler(ch_year_handler);
|
||||||
|
|
||||||
int k = 0;
|
int k = 0;
|
||||||
@ -61,8 +62,6 @@ bool TLiquidazione_app::set_deleghe()
|
|||||||
bool TLiquidazione_app::extract_deleghe()
|
bool TLiquidazione_app::extract_deleghe()
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
long firm = TApplication::get_firm();
|
|
||||||
_prind = new TProgind(_calcall ? _n_ditte : _selected.ones(),
|
_prind = new TProgind(_calcall ? _n_ditte : _selected.ones(),
|
||||||
" Estrazione deleghe \n"
|
" Estrazione deleghe \n"
|
||||||
" preparazione archivi \n "
|
" preparazione archivi \n "
|
||||||
@ -83,16 +82,19 @@ bool TLiquidazione_app::extract_deleghe()
|
|||||||
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
||||||
_nditte->read();
|
_nditte->read();
|
||||||
|
|
||||||
|
// must succeed
|
||||||
|
look_lia();
|
||||||
|
_freqviva = _lia->get("S7");
|
||||||
|
|
||||||
sprintf (buf,"Estrazione deleghe (%d):\nditta %s\n ",
|
sprintf (buf,"Estrazione deleghe (%d):\nditta %s\n ",
|
||||||
_month,
|
_month,
|
||||||
(const char*)_nditte_r->get("RAGSOC"));
|
(const char*)_nditte_r->get("RAGSOC"));
|
||||||
_prind->set_text(buf);
|
_prind->set_text(buf);
|
||||||
|
|
||||||
|
|
||||||
if (is_month_ok(_month))
|
if (is_month_ok_strict(_month))
|
||||||
{
|
{
|
||||||
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4");
|
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4");
|
||||||
_freqviva = look_lia() ? _lia->get("S7") : _nditte->curr().get("FREQVIVA");
|
|
||||||
bool mens = _freqviva == "M";
|
bool mens = _freqviva == "M";
|
||||||
_isannual = (_month == 12 && !mens && !_isbenzinaro) ||
|
_isannual = (_month == 12 && !mens && !_isbenzinaro) ||
|
||||||
(_month == 13 && (mens || _isbenzinaro));
|
(_month == 13 && (mens || _isbenzinaro));
|
||||||
@ -103,7 +105,7 @@ bool TLiquidazione_app::extract_deleghe()
|
|||||||
_prind->addstatus(1);
|
_prind->addstatus(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TApplication::set_firm(firm);
|
TApplication::set_firm(__firm);
|
||||||
delete _prind;
|
delete _prind;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user