Patch level : 4.0 904
Files correlati : cg4.exe Ricompilazione Demo : [ ] Commento : Gestione IVA a liquidazione differita git-svn-id: svn://10.65.10.50/trunk@16288 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8dea595507
commit
09cc4ae152
@ -77,13 +77,13 @@ TLiquidazione_app::TLiquidazione_app(int m) :
|
||||
_ditte(NULL), _selected(10000),
|
||||
_year(4), _nomiditte(100), _menu(m), _firm_bookmark(-1)
|
||||
{
|
||||
_isprint = _is_interactive = _canprint = TRUE;
|
||||
_isplafond = _printonly = _is_visliq = FALSE;
|
||||
_isvent = _isagricolo = _isbenzinaro = _isviaggio = FALSE;
|
||||
_row = 1; _what = all; _comp_acconto = FALSE;
|
||||
_isriepilogo = FALSE; _calcall = FALSE;
|
||||
_recalc_only = _recalc_regis = _isfinal = _isregis = FALSE;
|
||||
_stampa_vers = _stampa_acc = FALSE;
|
||||
_isprint = _is_interactive = _canprint = true;
|
||||
_isplafond = _printonly = _is_visliq = false;
|
||||
_isvent = _isagricolo = _isbenzinaro = _isviaggio = _isdiff = false;
|
||||
_row = 1; _what = all; _comp_acconto = false;
|
||||
_isriepilogo = FALSE; _calcall = false;
|
||||
_recalc_only = _recalc_regis = _isfinal = _isregis = false;
|
||||
_stampa_vers = _stampa_acc = false;
|
||||
_recalc = needed;
|
||||
}
|
||||
|
||||
@ -172,7 +172,8 @@ bool TLiquidazione_app::user_create()
|
||||
_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);
|
||||
// _cur = new TCursor(_rel, "", 2);
|
||||
_cur = new TCursor(_rel, "", 4);
|
||||
|
||||
_ver = new TInteressi_IVA_table();
|
||||
_pim = new TTable("PIM");
|
||||
|
18
cg/cg4300.h
18
cg/cg4300.h
@ -106,6 +106,16 @@ enum tipo_sospensione { nessuna, normale, vol_affari, liquidazione };
|
||||
#define PROGAGR 20 // progressivi per prospetto agricolo dal 1998
|
||||
#define PIS_HEAD 21 // intestazione per i PIS (stampa cappelletto iniziale)
|
||||
#define PIS_ROW 22 // riga totali parziali per codiva (tabella progressivi di cui da periodo successivo)
|
||||
#define PIS_HEAD_D 23 // intestazione per i PIS (stampa cappelletto iniziale) differita
|
||||
#define PIS_HEAD_DI 24 // intestazione per i PIS (stampa cappelletto iniziale) differita incassati
|
||||
#define PIM_HEAD_D 25 // intestazione per i PIM (stampa cappelletto iniziale) differita
|
||||
#define PIM_HEAD_DI 26 // intestazione per i PIM (stampa cappelletto iniziale) differita incassati
|
||||
#define PIS_ROW_D 27 // riga totali parziali per codiva (tabella progressivi di cui da periodo successivo) differita
|
||||
#define PIS_ROW_DI 28 // riga totali parziali per codiva (tabella progressivi di cui da periodo successivo) differita incassati
|
||||
#define PIM_ROW_D 29 // riga totali parziali per codiva differita
|
||||
#define PIM_ROW_DI 30 // riga totali parziali per codiva differita incassati
|
||||
#define TOT_ROW_D 31 // totale dei pim (plm) differita
|
||||
#define TOT_ROW_DI 32 // totale dei pim (plm) differita incassate
|
||||
// ...............................................................
|
||||
// support structs
|
||||
// ...............................................................
|
||||
@ -159,9 +169,9 @@ public:
|
||||
word _flags;
|
||||
word _f0, _f1, _f2, _f3;
|
||||
TString _s0, _s1, _s2, _s3, _s4, _s5, _s6;
|
||||
real _r0, _r1, _r2, _r3, _r4, _r5,
|
||||
_r6, _r7, _r8, _r9, _r10, _r11, _r12,
|
||||
_r13, _r14, _r15, _r16, _r17, _r18, _r19, _r20;
|
||||
real _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7, _r8, _r9,
|
||||
_r10, _r11, _r12, _r13, _r14, _r15, _r16, _r17, _r18, _r19,
|
||||
_r20, _r21, _r22, _r23, _r24, _r25, _r26, _r27, _r28, _r29;
|
||||
TArray _arr;
|
||||
TDate _d0;
|
||||
|
||||
@ -246,6 +256,7 @@ class TLiquidazione_app : public TPrint_application
|
||||
bool _isvent; // ventilazione
|
||||
bool _isagricolo; // regime agricolo
|
||||
bool _isviaggio; // regime agenzie viaggio
|
||||
bool _isdiff; // liquidazione differita attiva
|
||||
bool _isbenzinaro; // regime benzinaro
|
||||
bool _gest4; // gestione 4° trim. per benzinaro
|
||||
bool _isannual; // dichiarazione annuale
|
||||
@ -574,6 +585,7 @@ public:
|
||||
void set_att(_DescrItem& d);
|
||||
void set_pim(_DescrItem& d);
|
||||
void set_pumpam(_DescrItem& d);
|
||||
void set_plm_diff(_DescrItem& d);
|
||||
void set_plm(_DescrItem& d);
|
||||
bool set_annual(_DescrItem& d);
|
||||
void set_grand(_DescrItem& d);
|
||||
|
444
cg/cg4301.cpp
444
cg/cg4301.cpp
@ -13,6 +13,7 @@
|
||||
|
||||
#include <nditte.h>
|
||||
#include <attiv.h>
|
||||
#include <causali.h>
|
||||
#include <tab1100.h>
|
||||
#include <mov.h>
|
||||
#include <rmoviva.h>
|
||||
@ -154,6 +155,11 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
||||
// se necessario (serve nelle chiamate ricorsive)
|
||||
// Ritorna FALSE soltanto se il ricalcolo era necessario e non e'
|
||||
// stato effettuato per scelta dello stronzo commercialista.
|
||||
|
||||
TConfig c(CONFIG_DITTA);
|
||||
|
||||
_isdiff = c.get_bool("GesLiqDiff");
|
||||
|
||||
if (month == 13 && recalc)
|
||||
{
|
||||
TTable pem("PEM");
|
||||
@ -474,8 +480,10 @@ bool TLiquidazione_app::update_att(int month, const char* codatt,
|
||||
void TLiquidazione_app::zero_att(int month, const char* codatt)
|
||||
{
|
||||
TTable *arr[4] = { _pim, _pis, _prm, _prp };
|
||||
const char* flds[] = { "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8",
|
||||
"R9", "R10", "R11", "R12", "R13", "R14", "S0", "S1", "S2" };
|
||||
const char* flds[] = { "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "R9",
|
||||
"R10", "R11", "R12", "R13", "R14", "R15", "R16", "R17", "R18", "R19",
|
||||
"R20", "R21", "R22", "R23", "R24", "R25", "R26", "R27", "R28", "R29",
|
||||
"S0", "S1", "S2" };
|
||||
|
||||
TString att, year, codtab;
|
||||
int m, start, stop;
|
||||
@ -503,7 +511,7 @@ void TLiquidazione_app::zero_att(int month, const char* codatt)
|
||||
year = codtab.mid(0,4);
|
||||
if (m == month && att == codatt && year == _year)
|
||||
{
|
||||
for (int j = 0; j < 18; j++) // Ciclo per i campi del record da azzerare
|
||||
for (int j = 0; j < 33; j++) // Ciclo per i campi del record da azzerare
|
||||
tab->zero(flds[j]);
|
||||
tab->rewrite();
|
||||
}
|
||||
@ -555,87 +563,91 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
// occhecasino. Se _comp_acconto e' TRUE, i movimenti considerati
|
||||
// saranno solo quelli di dicembre per data <= 20/12;
|
||||
{
|
||||
real totintra = 0.0;
|
||||
real nond19_imp = 0.0;
|
||||
real nond19_iva = 0.0;
|
||||
real ammort_det = 0.0;
|
||||
real ammort_det_iva = 0.0;
|
||||
real ammort_indet = 0.0;
|
||||
real ammort_indet_iva = 0.0;
|
||||
real ammort_6 = 0.0;
|
||||
real ammort_6_iva = 0.0;
|
||||
real acq_riv = 0.0;
|
||||
real acq_riv_iva = 0.0;
|
||||
real leasing = 0.0;
|
||||
real leasing_iva = 0.0;
|
||||
real cess_amm = 0.0;
|
||||
real cess_amm_iva = 0.0;
|
||||
real acquisti = 0.0;
|
||||
real acquisti_iva = 0.0;
|
||||
real vendite = 0.0;
|
||||
real vendite_iva = 0.0;
|
||||
real esenti_c1 = 0.0;
|
||||
real esenti_c2 = 0.0;
|
||||
real esenti_c3 = 0.0;
|
||||
real esenti_c1a = 0.0;
|
||||
real esenti_c3_bam = 0.0; // Beni ammorizzabili esenti c3
|
||||
real esenti_c1a_bam = 0.0; // Beni ammorizzabili esenti c1a
|
||||
real esenti_b14 = 0.0;
|
||||
real totintra = ZERO;
|
||||
real nond19_imp = ZERO;
|
||||
real nond19_iva = ZERO;
|
||||
real ammort_det = ZERO;
|
||||
real ammort_det_iva = ZERO;
|
||||
real ammort_indet = ZERO;
|
||||
real ammort_indet_iva = ZERO;
|
||||
real ammort_6 = ZERO;
|
||||
real ammort_6_iva = ZERO;
|
||||
real acq_riv = ZERO;
|
||||
real acq_riv_iva = ZERO;
|
||||
real leasing = ZERO;
|
||||
real leasing_iva = ZERO;
|
||||
real cess_amm = ZERO;
|
||||
real cess_amm_iva = ZERO;
|
||||
real acquisti = ZERO;
|
||||
real acquisti_iva = ZERO;
|
||||
real vendite = ZERO;
|
||||
real vendite_iva = ZERO;
|
||||
real esenti_c1 = ZERO;
|
||||
real esenti_c2 = ZERO;
|
||||
real esenti_c3 = ZERO;
|
||||
real esenti_c1a = ZERO;
|
||||
real esenti_c3_bam = ZERO; // Beni ammorizzabili esenti c3
|
||||
real esenti_c1a_bam = ZERO; // Beni ammorizzabili esenti c1a
|
||||
real esenti_b14 = ZERO;
|
||||
|
||||
// Comunicazione dati iva annuale (dal 2003)
|
||||
real cessioni_cd1_1 = 0.0; // Totale operazioni attive
|
||||
real cessioni_cd1_2 = 0.0; // non imponibili
|
||||
real cessioni_cd1_3 = 0.0; // esenti
|
||||
real cessioni_cd1_4 = 0.0; // intra
|
||||
real acquisti_cd2_1 = 0.0; // Totale operazioni passive
|
||||
real acquisti_cd2_2 = 0.0; // non imponibili
|
||||
real acquisti_cd2_3 = 0.0; // esenti
|
||||
real acquisti_cd2_4 = 0.0; // intra
|
||||
real oroargento_cd3_1 = 0.0; // imponibile acquisto oro e argento
|
||||
real oroargento_cd3_2 = 0.0; // imposta acquisto oro e argento
|
||||
real cessioni_cd1_1 = ZERO; // Totale operazioni attive
|
||||
real cessioni_cd1_2 = ZERO; // non imponibili
|
||||
real cessioni_cd1_3 = ZERO; // esenti
|
||||
real cessioni_cd1_4 = ZERO; // intra
|
||||
real acquisti_cd2_1 = ZERO; // Totale operazioni passive
|
||||
real acquisti_cd2_2 = ZERO; // non imponibili
|
||||
real acquisti_cd2_3 = ZERO; // esenti
|
||||
real acquisti_cd2_4 = ZERO; // intra
|
||||
real oroargento_cd3_1 = ZERO; // imponibile acquisto oro e argento
|
||||
real oroargento_cd3_2 = ZERO; // imposta acquisto oro e argento
|
||||
real rottami_cd3_3 = ZERO; // imponibile acquisto rottami
|
||||
real rottami_cd3_4 = ZERO; // imposta acquisto rottami
|
||||
|
||||
real vt_imponibile[23];
|
||||
real vt_imposta[23];
|
||||
|
||||
real esni_rimb = 0.0; // ci sommo tutti esenti e ni validi per rimborso
|
||||
real corr_CEE = 0.0;
|
||||
real corr_noCEE = 0.0;
|
||||
real acq_CEE = 0.0;
|
||||
real acq_noCEE = 0.0;
|
||||
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;
|
||||
real agr_2 = 0.0;
|
||||
real agr_3 = 0.0;
|
||||
real agr_4 = 0.0;
|
||||
real agr_5 = 0.0;
|
||||
real agr_6 = 0.0;
|
||||
real agr_7 = 0.0;
|
||||
real acq_ies = 0.0;
|
||||
real acq_ies_iva = 0.0;
|
||||
real ult_detr = 0.0;
|
||||
real acq_pint = 0.0;
|
||||
real acq_pint_iva = 0.0;
|
||||
real spgen = 0.0;
|
||||
real spgen_iva = 0.0;
|
||||
real assp_imp = 0.0;
|
||||
real assp_iva = 0.0;
|
||||
real vssp_imp = 0.0;
|
||||
real vssp_iva = 0.0;
|
||||
real assl_imp = 0.0;
|
||||
real assl_iva = 0.0;
|
||||
real vssl_imp = 0.0;
|
||||
real vssl_iva = 0.0;
|
||||
real bdog_imp = 0.0;
|
||||
real bdog_iva = 0.0;
|
||||
real agr_imp = 0.0;
|
||||
real agr_iva = 0.0;
|
||||
real esni_rimb = ZERO; // ci sommo tutti esenti e ni validi per rimborso
|
||||
real corr_CEE = ZERO;
|
||||
real corr_noCEE = ZERO;
|
||||
real acq_CEE = ZERO;
|
||||
real acq_noCEE = ZERO;
|
||||
real corr_misCEE = ZERO;
|
||||
real acq_misCEE = ZERO;
|
||||
real acq_misnoCEE = ZERO;
|
||||
real agr_detIA = ZERO;
|
||||
real agr_1i = ZERO;
|
||||
real agr_2i = ZERO;
|
||||
real agr_1 = ZERO;
|
||||
real agr_2 = ZERO;
|
||||
real agr_3 = ZERO;
|
||||
real agr_4 = ZERO;
|
||||
real agr_5 = ZERO;
|
||||
real agr_6 = ZERO;
|
||||
real agr_7 = ZERO;
|
||||
real acq_ies = ZERO;
|
||||
real acq_ies_iva = ZERO;
|
||||
real ult_detr = ZERO;
|
||||
real acq_pint = ZERO;
|
||||
real acq_pint_iva = ZERO;
|
||||
real spgen = ZERO;
|
||||
real spgen_iva = ZERO;
|
||||
real assp_imp = ZERO;
|
||||
real assp_iva = ZERO;
|
||||
real vssp_imp = ZERO;
|
||||
real vssp_iva = ZERO;
|
||||
real assl_imp = ZERO;
|
||||
real assl_iva = ZERO;
|
||||
real vssl_imp = ZERO;
|
||||
real vssl_iva = ZERO;
|
||||
real bdog_imp = ZERO;
|
||||
real bdog_iva = ZERO;
|
||||
real agr_imp = ZERO;
|
||||
real agr_iva = ZERO;
|
||||
real fdiff_imp = ZERO;
|
||||
real fdiff_iva = ZERO;
|
||||
real fdiffinc_imp = ZERO;
|
||||
real fdiffinc_iva = ZERO;
|
||||
|
||||
for (int j = 0; j < 23; j++)
|
||||
{
|
||||
@ -680,8 +692,29 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
|
||||
TRectype from(_cur->curr()); from.zero();
|
||||
TRectype to(from);
|
||||
TString8 fromreg("~"), toreg("0");
|
||||
|
||||
{
|
||||
TRelation * regrel = new TRelation("REG");
|
||||
TCursor reg(regrel);
|
||||
TString4 codreg;
|
||||
const int items = reg.items();
|
||||
|
||||
for (reg = 0L; reg.pos() < items; ++reg)
|
||||
{
|
||||
codreg = reg.curr().get("CODTAB").mid(4);
|
||||
|
||||
if (codreg < fromreg)
|
||||
fromreg = codreg;
|
||||
if (codreg > toreg)
|
||||
toreg = codreg;
|
||||
}
|
||||
|
||||
delete regrel;
|
||||
}
|
||||
|
||||
TDate f(1, month == 13 ? 1 : month, year_int);
|
||||
TDate fromdate(f);
|
||||
TDate t;
|
||||
|
||||
// Spiegazione dell'arcano segreto sulle agenzie viaggio:
|
||||
@ -691,6 +724,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
if (_isviaggio)
|
||||
f = TDate(1, 1, year_int-1);
|
||||
|
||||
if (_isdiff)
|
||||
f = TDate(1, 1, year_int-5);
|
||||
if (year_int < 1998 || _recalc_regis) // Vecchia selezione o calcolo progoressivi per stampa registri bollati
|
||||
{
|
||||
t.set_month(month == 13 ? 12 : month);
|
||||
@ -701,14 +736,31 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
t.set_year(month < 12 ? year_int : year_int+1);
|
||||
t.set_month(month < 12 ? 12 : _freqviva == "M" ? 1 : 3);
|
||||
}
|
||||
|
||||
t.set_end_month();
|
||||
|
||||
from.put(MOV_DATAREG, f);
|
||||
to.put(MOV_DATAREG, t);
|
||||
TDate todate(1, month == 13 ? 12 : month, year_int);
|
||||
|
||||
todate.set_end_month();
|
||||
|
||||
from.put(MOV_REG, fromreg);
|
||||
to.put(MOV_REG, toreg);
|
||||
|
||||
// from.put(MOV_DATAREG, f);
|
||||
// to.put(MOV_DATAREG, t);
|
||||
|
||||
_cur->freeze(FALSE);
|
||||
_cur->setregion(from, to);
|
||||
|
||||
TString filter;
|
||||
filter.format("((ANSI(DATAREG)>=%ld)&&(ANSI(DATAREG)<=%ld))", fromdate.date2ansi(), t.date2ansi());
|
||||
if (_isviaggio || _isdiff)
|
||||
{
|
||||
if (_isviaggio)
|
||||
filter << format("||((ANSI(DATA74TER)>=%ld)&&(ANSI(DATA74TER)<=%ld))", fromdate.date2ansi(), t.date2ansi());
|
||||
if (_isdiff)
|
||||
filter << format("||((ANSI(DATAINC)>=%ld)&&(ANSI(DATAINC)<=%ld))", fromdate.date2ansi(), t.date2ansi());
|
||||
}
|
||||
_cur->setfilter(filter);
|
||||
const long items = _cur->items();
|
||||
_cur->freeze();
|
||||
|
||||
@ -751,7 +803,25 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
if (date.year() != year_int) // Controlla anno di appartenenza, altrimenti is_date_ok potrebbe non funzionare
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
const TRectype& rcs = _cur->curr(LF_CAUSALI);
|
||||
const bool fattrit = rcs.get_bool("RITFATT");
|
||||
const bool cau_intra = rcs.get_bool("INTRACOM");
|
||||
const bool cau_valintra = rcs.get_bool("VALINTRA");
|
||||
const bool movdiff = _isdiff && tipomov == vendita && rcs.get_bool(CAU_LIQDIFF);
|
||||
if (movdiff)
|
||||
int i = 1;
|
||||
const TDate datainc = _mov->get_date(MOV_DATAINC);
|
||||
const bool datainc_ok = is_date_ok(datainc, month, liqmonth, year_int);
|
||||
const bool diffpayed = movdiff && datainc_ok;
|
||||
if (diffpayed)
|
||||
{
|
||||
date = _mov->get_date(MOV_DATAINC);
|
||||
if (date.year() != year_int) // Controlla anno di appartenenza, altrimenti is_date_ok potrebbe non funzionare
|
||||
continue;
|
||||
}
|
||||
const bool dok = is_date_ok(date, month, liqmonth, year_int);
|
||||
const bool difftopay = movdiff && dok && (!datainc.ok() || !datainc_ok);
|
||||
/*
|
||||
* check register present, rmoviva present and date OK
|
||||
*
|
||||
* In un futuro prossimo, molto remoto, quando implementeremo il Client/Server, questo
|
||||
@ -759,19 +829,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
* Ora viene implementato qui [is_date_ok()] per non appesantire ulteriormente
|
||||
* la lettura dei movimenti.
|
||||
*/
|
||||
const bool dok = !is_date_ok(date, month, liqmonth, year_int);
|
||||
|
||||
const bool sreg = !isreg;
|
||||
const bool rs8 = _reg->get("S8") != trueatt;
|
||||
const bool cmt = !_cur->is_first_match(LF_RMOVIVA);
|
||||
const bool dok1 = dok || diffpayed;
|
||||
|
||||
if (dok || sreg || rs8 || cmt)
|
||||
if (!dok1 || sreg || rs8 || cmt)
|
||||
|
||||
continue;
|
||||
|
||||
const tipo_sospensione sosp_imp = _reg->get_bool("B1") ? (tipo_sospensione) _reg->get_int("I9") : nessuna;
|
||||
const TRectype& rcs = _cur->curr(LF_CAUSALI);
|
||||
const bool fattrit = rcs.get_bool("RITFATT");
|
||||
const bool cau_intra = rcs.get_bool("INTRACOM");
|
||||
const bool cau_valintra = rcs.get_bool("VALINTRA");
|
||||
|
||||
/*
|
||||
* Tipo documento da eliminare (Scudler 1994)
|
||||
@ -810,17 +878,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
continue;
|
||||
|
||||
// totali parziali registrati nei pim per motivi ignoti
|
||||
real bolld_imp = 0.0; // imponibile bolle doganali
|
||||
real bolld_iva = 0.0; // imposta bolle doganali
|
||||
real asimp_imp = 0.0; // imponibile acquisti sosp. imposta
|
||||
real asimp_iva = 0.0; // imposta acquisti sosp. imposta
|
||||
real vsimp_imp = 0.0; // imponibile vendite sosp. imposta
|
||||
real vsimp_iva = 0.0; // imposta vendite sosp. imposta
|
||||
real rit_imp = 0.0; // imponibile fatture in ritardo
|
||||
real rit_iva = 0.0; // imposta fatture in ritardo
|
||||
real nin_imp = 0.0; // imponibile non incassati
|
||||
real nin_iva = 0.0; // imposta non incassati
|
||||
|
||||
real bolld_imp = ZERO; // imponibile bolle doganali
|
||||
real bolld_iva = ZERO; // imposta bolle doganali
|
||||
real asimp_imp = ZERO; // imponibile acquisti sosp. imposta
|
||||
real asimp_iva = ZERO; // imposta acquisti sosp. imposta
|
||||
real vsimp_imp = ZERO; // imponibile vendite sosp. imposta
|
||||
real vsimp_iva = ZERO; // imposta vendite sosp. imposta
|
||||
real rit_imp = ZERO; // imponibile fatture in ritardo
|
||||
real rit_iva = ZERO; // imposta fatture in ritardo
|
||||
real nin_imp = ZERO; // imponibile non incassati
|
||||
real nin_iva = ZERO; // imposta non incassati
|
||||
|
||||
look_iva(_rmoviva->get(RMI_CODIVA));
|
||||
TString4 codiva = _iva->get("CODTAB");
|
||||
TString4 tipoiva = _iva->get("S1");
|
||||
@ -854,34 +922,49 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
const real imposta_orig = _rmoviva->get_real(RMI_IMPOSTA);
|
||||
|
||||
const int decimals = TCurrency::get_firm_dec();
|
||||
real impon_ind, impon_det, impos_ind, impos_det;
|
||||
|
||||
if (percind <= ZERO)
|
||||
real diff_imp; // Liquidazione differita imponibile
|
||||
real diff_iva; // Liquidazione differita imposta
|
||||
real incdiff_imp; // Liquidazione differita incassate imponibile
|
||||
real incdiff_iva; // Liquidazione differita incassate imposta
|
||||
real impon_ind; // Imponibile indetraibile
|
||||
real impos_ind; // Imposta indetraibile
|
||||
real impon_det; // Imponibile detraibile
|
||||
real impos_det; // Imposta detraibile
|
||||
|
||||
if (difftopay)
|
||||
{
|
||||
impon_det = imponibile_orig;
|
||||
impos_det = imposta_orig;
|
||||
diff_imp = imponibile_orig;
|
||||
diff_iva = imposta_orig;
|
||||
}
|
||||
else
|
||||
if (percind >= CENTO)
|
||||
if (diffpayed)
|
||||
{
|
||||
impon_ind = imponibile_orig;
|
||||
impos_ind = imposta_orig;
|
||||
incdiff_imp = imponibile_orig;
|
||||
incdiff_iva = imposta_orig;
|
||||
}
|
||||
else
|
||||
{
|
||||
impon_ind = imponibile_orig * percind / CENTO; impon_ind.round(decimals);
|
||||
impon_det = imponibile_orig - impon_ind;
|
||||
impos_ind = impon_ind * perciva; impos_ind.round(decimals);
|
||||
impos_det = imposta_orig - impos_ind;
|
||||
}
|
||||
analizza_IVA(imponibile_orig, imposta_orig, percind, corrisp, false, codiva,
|
||||
impon_det, impos_det, impon_ind, impos_ind);
|
||||
|
||||
for (int is_detraibile = 0; is_detraibile < 2; is_detraibile++)
|
||||
// qui
|
||||
for (int is_detraibile = 0; is_detraibile < 2; is_detraibile++)
|
||||
{
|
||||
const int tipodet = is_detraibile ? 0 : tipoind;
|
||||
const real imponibile = is_detraibile ? impon_det : impon_ind;
|
||||
const real imposta = is_detraibile ? impos_det : impos_ind;
|
||||
if (imponibile.is_zero() && imposta.is_zero())
|
||||
continue;
|
||||
|
||||
//qui da verificare
|
||||
|
||||
if ((imponibile.is_zero() && imposta.is_zero()) &&
|
||||
(_isdiff &&
|
||||
(is_detraibile > 0 ||
|
||||
(diff_imp.is_zero() && diff_iva.is_zero() &&
|
||||
incdiff_imp.is_zero() && incdiff_iva.is_zero())
|
||||
)
|
||||
)
|
||||
)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Riga imponibile > 9 = ritenute; non si
|
||||
@ -1689,8 +1772,23 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
cs.add(r.string(), 0);
|
||||
cs.add(v.string(), 1);
|
||||
tab->put("S2",cs);
|
||||
|
||||
tab->rewrite(); // rewrite current table
|
||||
|
||||
if (is_detraibile == 0 &&
|
||||
(!diff_imp.is_zero() ||!diff_iva.is_zero() ||
|
||||
!incdiff_imp.is_zero() || !incdiff_imp.is_zero()))
|
||||
{
|
||||
// fatture a liquidazione differita
|
||||
tab->put("R26", tab->get_real("R26") + diff_imp);
|
||||
tab->put("R27", tab->get_real("R27") + diff_iva);
|
||||
tab->put("R28", tab->get_real("R28") + incdiff_imp);
|
||||
tab->put("R29", tab->get_real("R29") + incdiff_iva);
|
||||
fdiff_imp += diff_imp;
|
||||
fdiff_iva += diff_iva;
|
||||
fdiffinc_imp += incdiff_imp;
|
||||
fdiffinc_iva += incdiff_iva;
|
||||
}
|
||||
|
||||
tab->rewrite(); // rewrite current table
|
||||
} // for per tabelle
|
||||
} // for is_detraibile
|
||||
} while (_cur->next_match(LF_RMOVIVA));
|
||||
@ -1930,6 +2028,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
_pam->put("R13", assl_iva);
|
||||
_pam->put("R14", vssl_imp);
|
||||
_pam->put("R15", vssl_iva);
|
||||
|
||||
_plm->put("R26", fdiff_imp);
|
||||
_plm->put("R27", fdiff_iva);
|
||||
_plm->put("R28", fdiffinc_imp);
|
||||
_plm->put("R29", fdiffinc_iva);
|
||||
|
||||
_plm->rewrite();
|
||||
_pam->rewrite();
|
||||
@ -2647,48 +2750,52 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
look_lia();
|
||||
const bool new_age_2000 = (year_int >= 2000) && (_lia->get("S9") == "NV");
|
||||
|
||||
real risultato = 0.0;
|
||||
real detrazioni = 0.0;
|
||||
real versamenti = 0.0;
|
||||
real vers_int = 0.0;
|
||||
real rimborsi = 0.0;
|
||||
real rettifiche = 0.0;
|
||||
real res_debt = 0.0;
|
||||
real res_cred = 0.0;
|
||||
real cred_prec = 0.0;
|
||||
real cred_trasf = 0.0;
|
||||
real debt_precd = 0.0;
|
||||
real acc_dec = 0.0;
|
||||
real iva_vend = 0.0;
|
||||
real iva_acq = 0.0;
|
||||
real conguaglio = 0.0;
|
||||
real variazioni_imposta = 0.0;
|
||||
real imposta_non_versata = 0.0;
|
||||
real crediti_speciali = 0.0;
|
||||
real risultato = ZERO;
|
||||
real detrazioni = ZERO;
|
||||
real versamenti = ZERO;
|
||||
real vers_int = ZERO;
|
||||
real rimborsi = ZERO;
|
||||
real rettifiche = ZERO;
|
||||
real res_debt = ZERO;
|
||||
real res_cred = ZERO;
|
||||
real cred_prec = ZERO;
|
||||
real cred_trasf = ZERO;
|
||||
real debt_precd = ZERO;
|
||||
real acc_dec = ZERO;
|
||||
real iva_vend = ZERO;
|
||||
real iva_acq = ZERO;
|
||||
real conguaglio = ZERO;
|
||||
real variazioni_imposta = ZERO;
|
||||
real imposta_non_versata = ZERO;
|
||||
real crediti_speciali = ZERO;
|
||||
|
||||
// totali per regimi agricoli
|
||||
real acq_noCEE = 0.0;
|
||||
real imp_agr1 = 0.0;
|
||||
real imp_agr2 = 0.0;
|
||||
real acq_noCEE = ZERO;
|
||||
real imp_agr1 = ZERO;
|
||||
real imp_agr2 = ZERO;
|
||||
|
||||
// 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;
|
||||
real c_iCEE = ZERO;
|
||||
real c_eCEE = ZERO;
|
||||
real a_iCEE = ZERO;
|
||||
real a_eCEE = ZERO;
|
||||
real c_mCEE = ZERO;
|
||||
real a_mCEE = ZERO;
|
||||
real a_meCEE = ZERO;
|
||||
real cred_cost = ZERO;
|
||||
real deb_mens = ZERO;
|
||||
real perc_r = ZERO;
|
||||
real fdiff_imp = ZERO;
|
||||
real fdiff_iva = ZERO;
|
||||
real fdiffinc_imp = ZERO;
|
||||
real fdiffinc_iva = ZERO;
|
||||
|
||||
// totali per annuali
|
||||
real vol_aff_1 = 0.0;
|
||||
real vol_aff_2 = 0.0;
|
||||
real vol_aff_t = 0.0;
|
||||
real vol_aff_l = 0.0;
|
||||
real tot_cong = 0.0;
|
||||
real vol_aff_1 = ZERO;
|
||||
real vol_aff_2 = ZERO;
|
||||
real vol_aff_t = ZERO;
|
||||
real vol_aff_l = ZERO;
|
||||
real tot_cong = ZERO;
|
||||
|
||||
bool differita = FALSE;
|
||||
bool almeno_una_agricola = FALSE;
|
||||
@ -2755,11 +2862,22 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
|
||||
if (!attivita_agricola)
|
||||
{
|
||||
iva_vend += _plm->get_real("R0");
|
||||
iva_acq += _plm->get_real("R1");
|
||||
risultato += (_plm->get_real("R0") - _plm->get_real("R1"));
|
||||
res_debt += _plm->get_real("R0");
|
||||
res_cred += _plm->get_real("R1");
|
||||
const real vend = _plm->get_real("R0");
|
||||
const real acq = _plm->get_real("R1");
|
||||
const real diff_imp = _plm->get_real("R26");
|
||||
const real diff_iva = _plm->get_real("R27");
|
||||
const real diffinc_imp = _plm->get_real("R28");
|
||||
const real diffinc_iva = _plm->get_real("R29");
|
||||
|
||||
iva_vend += vend;
|
||||
iva_acq += acq;
|
||||
risultato += (vend - acq + diffinc_iva);
|
||||
res_debt += vend + diffinc_iva;
|
||||
res_cred += acq;
|
||||
fdiff_imp += diff_imp;
|
||||
fdiff_iva += diff_iva;
|
||||
fdiffinc_imp += diffinc_imp;
|
||||
fdiffinc_iva += diffinc_iva;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3161,6 +3279,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
_lim->put("S7", s7);
|
||||
_lim->put("B0", wasb0 ? "X" : "");
|
||||
_lim->put("B1", wasb1 ? "X" : "");
|
||||
|
||||
|
||||
/*
|
||||
* versamenti effettuati: si conteggiano in R0,
|
||||
@ -3244,6 +3363,11 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
_lim->put("R12", res_cred);
|
||||
_lim->put("R13", res_debt);
|
||||
|
||||
_lim->put("R26", fdiff_imp);
|
||||
_lim->put("R27", fdiff_iva);
|
||||
_lim->put("R28", fdiffinc_imp);
|
||||
_lim->put("R29", fdiffinc_iva);
|
||||
|
||||
_lam->put("R0", iva_vend);
|
||||
_lam->put("R1", iva_acq);
|
||||
_lam->put("R2", cred_prec);
|
||||
@ -3289,9 +3413,11 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
round_imposta(imposta_non_versata);
|
||||
round_imposta(credito_utilizzato_iva);
|
||||
round_imposta(crediti_speciali);
|
||||
round_imposta(fdiff_iva);
|
||||
round_imposta(fdiffinc_iva);
|
||||
|
||||
res_cred = iva_acq + versamenti + vers_int + cred_prec - cred_trasf + acc_dec + credito_utilizzato_iva + crediti_speciali;
|
||||
res_debt = iva_vend + rimborsi + debt_precd + imposta_non_versata;
|
||||
res_debt = iva_vend + rimborsi + debt_precd + imposta_non_versata + fdiffinc_iva;
|
||||
|
||||
if (atoi(_year) < 1998) // Non vale piu' dal 1998 in poi; iva_acq e' gia' ok e cosi' res_cred.
|
||||
{
|
||||
@ -3357,6 +3483,10 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
}
|
||||
}
|
||||
}
|
||||
_lim->put("R26", fdiff_imp);
|
||||
_lim->put("R27", fdiff_iva);
|
||||
_lim->put("R28", fdiffinc_imp);
|
||||
_lim->put("R29", fdiffinc_iva);
|
||||
// ciapa
|
||||
}
|
||||
|
||||
|
@ -548,8 +548,8 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
|
||||
|
||||
int tipomov = (tiporeg)_pim->get_long("I1");
|
||||
|
||||
real imp = _pim->get("R0");
|
||||
real iva = _pim->get("R1");
|
||||
const real imp = _pim->get("R0");
|
||||
const real iva = _pim->get("R1");
|
||||
|
||||
// totali imponibili
|
||||
if (tipomov == vendita)
|
||||
@ -559,6 +559,7 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
|
||||
// vedi sopra...
|
||||
vtot += imp;
|
||||
ivav += iva;
|
||||
ivav += _pim->get_real("R29");
|
||||
is_key = corr_ann.is_key(codiva);
|
||||
cx._totale = 0;
|
||||
_CorrItem& ca = is_key ? (_CorrItem&) corr_ann[codiva] : cx;
|
||||
|
446
cg/cg4304.cpp
446
cg/cg4304.cpp
@ -44,10 +44,18 @@ void TLiquidazione_app::set_page(int file, int cnt)
|
||||
break;
|
||||
case PIS_ROW:
|
||||
case PIM_ROW:
|
||||
case PIS_ROW_D:
|
||||
case PIM_ROW_D:
|
||||
case PIS_ROW_DI:
|
||||
case PIM_ROW_DI:
|
||||
set_pim(d);
|
||||
break;
|
||||
case PIS_HEAD:
|
||||
case PIM_HEAD:
|
||||
case PIS_HEAD_D:
|
||||
case PIM_HEAD_D:
|
||||
case PIS_HEAD_DI:
|
||||
case PIM_HEAD_DI:
|
||||
set_pim_head(d);
|
||||
break;
|
||||
case MISC_LIQ:
|
||||
@ -56,6 +64,10 @@ void TLiquidazione_app::set_page(int file, int cnt)
|
||||
case TOT_ROW:
|
||||
set_plm(d);
|
||||
break;
|
||||
case TOT_ROW_D:
|
||||
case TOT_ROW_DI:
|
||||
set_plm_diff(d);
|
||||
break;
|
||||
case PLAFOND:
|
||||
set_plafond(d);
|
||||
break;
|
||||
@ -89,6 +101,8 @@ void TLiquidazione_app::set_page(int file, int cnt)
|
||||
case DELCRED:
|
||||
set_deltab(d, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,6 +198,7 @@ void TLiquidazione_app::describe_liqacc()
|
||||
d->_r6 = _lia->get_real("R12");
|
||||
d->_r7 = _lia->get_real("R11");
|
||||
d->_r8 = _lia->get_real("R4");
|
||||
d->_r29 = _lia->get_real("R29");
|
||||
TToken_string ff(_lia->get("S1"),'!');
|
||||
real cre_pre (ff.get(0));
|
||||
real acq_intr (ff.get(1));
|
||||
@ -476,11 +491,11 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
TString ref(atts.items() == 1 ? codatt : "ALL");
|
||||
const char* tmpatt;
|
||||
int last = _descr_arr.last();
|
||||
bool isfirst = TRUE, issosp = FALSE;
|
||||
real t0, t1, t2, t3, t4, t5;
|
||||
bool issosp = false;
|
||||
real t0, t1, t2, t3, t4, t5, t26, t27, t28, t29;
|
||||
real rt0, rt1, rt2, rt3, rt4, rt5;
|
||||
real autodafe, autodafe_iva, art40, art40_iva;
|
||||
|
||||
real diffimp, diffiva, diffincimp, diffinciva;
|
||||
bool skip_acq = atts.items() == 1 && _mixed;
|
||||
|
||||
// descrittore riga autodafe'
|
||||
@ -496,10 +511,13 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
// anche se le colonne non ci sono; in tal modo si ottiene una peggior
|
||||
// chiarezza, una peggiore efficienza, una gran rottura di coglioni,
|
||||
// ma risulta identico al dio Sistema.
|
||||
_DescrItem* hea = new _DescrItem(describe_pis ? PIS_HEAD : PIM_HEAD);
|
||||
hea->_f0 = skip_acq; // cosi' non compare nemmeno la colonnina! contento?
|
||||
hea->_f1 = FALSE;
|
||||
_descr_arr.add(hea);
|
||||
_DescrItem * hea = NULL;
|
||||
_DescrItem * head = NULL;
|
||||
_DescrItem * headi = NULL;
|
||||
_DescrItem * tot = NULL;
|
||||
_DescrItem * totd = NULL;
|
||||
_DescrItem * totdi = NULL;
|
||||
int totpos = 0;
|
||||
|
||||
// Assoc array per memorizzare i corrispettivi da scorporare. Tali corrispettivi verranno
|
||||
// aggiunti alla fine del ciclo, scorrendo tutte le righe generate.
|
||||
@ -527,7 +545,6 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
codiva = codtab.mid(16,4);
|
||||
bool ok = look_reg(codreg);
|
||||
ok |= look_iva(codiva);
|
||||
bool isnew = FALSE;
|
||||
|
||||
if (!ok) continue;
|
||||
|
||||
@ -539,6 +556,15 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
TToken_string s1(tab->get("S1"),'!'); // Imponibile/iva fatture in ritardo
|
||||
real rit_imp(s1.get(0));
|
||||
real rit_iva(s1.get(1));
|
||||
|
||||
if (tipomov == vendita)
|
||||
{
|
||||
diffimp = _pim->get_real("R26");
|
||||
diffiva = _pim->get_real("R27");
|
||||
diffincimp = _pim->get_real("R28");
|
||||
diffinciva = _pim->get_real("R29");
|
||||
}
|
||||
|
||||
const bool is_rit= tipodet != 0 && month == 13 && rit_imp != 0.0; //Se fattura in ritardo con tipo detr. != 0 e si sta calcolando l'annuale
|
||||
const tipo_sospensione sosp_imp = _reg->get_bool("B1") ? (tipo_sospensione) _reg->get_int("I9") : nessuna;
|
||||
issosp |= (sosp_imp != nessuna); // Setta il flag di presenza registri in sospensione (qualsiasi tipo: normale, vol_affari, liquidazione)
|
||||
@ -579,39 +605,41 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
|
||||
for(i = last+1; i < _descr_arr.items(); i++)
|
||||
{
|
||||
d = (_DescrItem*)&_descr_arr[i];
|
||||
if (d->_flags == PIM_PIS &&
|
||||
d->_s0 == ref &&
|
||||
d->_s1 == codiva)
|
||||
_DescrItem * wd = (_DescrItem*)&_descr_arr[i];
|
||||
if (wd->_flags == PIM_PIS &&
|
||||
wd->_s0 == ref &&
|
||||
wd->_s1 == codiva)
|
||||
{
|
||||
d = wd;
|
||||
break;
|
||||
if (d->_s1 > codiva)
|
||||
{
|
||||
isnew = TRUE;
|
||||
_DescrItem* dd = new _DescrItem(PIM_PIS);
|
||||
// CicciaPrassi li vuole in ordine crescente
|
||||
_descr_arr.insert(dd,i);
|
||||
// che due maron stereofonic: se quello dopo
|
||||
// era il primo, quello prima va dopo
|
||||
if (d->_f0)
|
||||
{
|
||||
dd->_f0 = TRUE;
|
||||
d->_f0 = FALSE;
|
||||
}
|
||||
else if (isfirst)
|
||||
{
|
||||
d->_f0 = TRUE;
|
||||
isfirst = FALSE;
|
||||
}
|
||||
d = dd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wd->_flags == TOT_ROW)
|
||||
break;
|
||||
if (wd->_flags == PIM_PIS &&
|
||||
wd->_s0 == ref &&
|
||||
wd->_s1 > codiva)
|
||||
break;
|
||||
}
|
||||
if (!isnew && i == _descr_arr.items())
|
||||
if (d == NULL)
|
||||
{
|
||||
isnew = TRUE;
|
||||
bool isfirst = (hea == NULL);
|
||||
|
||||
if (isfirst)
|
||||
{
|
||||
hea = new _DescrItem(describe_pis ? PIS_HEAD : PIM_HEAD);
|
||||
hea->_f0 = skip_acq; // cosi' non compare nemmeno la colonnina! contento?
|
||||
hea->_f1 = true;
|
||||
_descr_arr.insert(hea, i++);
|
||||
tot = new _DescrItem(TOT_ROW);
|
||||
totpos = _descr_arr.insert(tot, i);
|
||||
}
|
||||
else
|
||||
totpos++;
|
||||
d = new _DescrItem(PIM_PIS);
|
||||
if (isfirst) { d->_f0 = TRUE; isfirst = FALSE; }
|
||||
_descr_arr.add(d);
|
||||
d->_f0 = isfirst;
|
||||
d->_s0 = ref;
|
||||
d->_s1 = codiva;
|
||||
_descr_arr.insert(d, i);
|
||||
}
|
||||
|
||||
if (tipomov == acquisto)
|
||||
@ -740,12 +768,98 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
art40_iva += va7v;
|
||||
}
|
||||
}
|
||||
if (isnew)
|
||||
{
|
||||
d->_s0 = ref;
|
||||
d->_s1 = codiva;
|
||||
// flag per stampare l'intestazione colonne
|
||||
}
|
||||
if (tipomov == vendita)
|
||||
{
|
||||
if (!diffimp.is_zero() && !diffiva.is_zero())
|
||||
{
|
||||
const word id = describe_pis ? PIS_ROW_D : PIM_ROW_D;
|
||||
int j;
|
||||
|
||||
d = NULL;
|
||||
for (j = totpos + 1; j < _descr_arr.items(); j++)
|
||||
{
|
||||
_DescrItem * wd = (_DescrItem*)&_descr_arr[j];
|
||||
const bool found = wd->_flags == id && wd->_s0 == ref;
|
||||
|
||||
if (found && wd->_s1 == codiva)
|
||||
{
|
||||
d = wd;
|
||||
break;
|
||||
}
|
||||
if (wd->_flags == TOT_ROW_D)
|
||||
break;
|
||||
if (found && wd->_s1 > codiva)
|
||||
break;
|
||||
}
|
||||
if (d == NULL)
|
||||
{
|
||||
const bool isfirst = head == NULL;
|
||||
|
||||
if (isfirst)
|
||||
{
|
||||
head = new _DescrItem(describe_pis ? PIS_HEAD_D : PIM_HEAD_D);
|
||||
_descr_arr.insert(head, j++);
|
||||
head->_f0 = false;
|
||||
head->_f1 = true;
|
||||
totd = new _DescrItem(TOT_ROW_D);
|
||||
_descr_arr.insert(totd, j);
|
||||
}
|
||||
d = new _DescrItem(id);
|
||||
_descr_arr.insert(d, j);
|
||||
d->_f0 = isfirst;
|
||||
d->_s0 = ref;
|
||||
d->_s1 = codiva;
|
||||
}
|
||||
d->_r26 += diffimp;
|
||||
d->_r27 += diffiva;
|
||||
t26 += diffimp;
|
||||
t27 += diffiva;
|
||||
}
|
||||
if (!diffincimp.is_zero() && !diffinciva.is_zero())
|
||||
{
|
||||
const word id = describe_pis ? PIS_ROW_DI : PIM_ROW_DI;
|
||||
int j;
|
||||
|
||||
d = NULL;
|
||||
for (j = totpos + 1; j < _descr_arr.items(); j++)
|
||||
{
|
||||
_DescrItem * wd = (_DescrItem*)&_descr_arr[j];
|
||||
const bool found = wd->_flags == id && wd->_s0 == ref;
|
||||
|
||||
if (found && wd->_s1 == codiva)
|
||||
{
|
||||
d = wd;
|
||||
break;
|
||||
}
|
||||
if (wd->_flags == TOT_ROW_DI)
|
||||
break;
|
||||
if (found && wd->_s1 > codiva)
|
||||
break;
|
||||
}
|
||||
if (d == NULL)
|
||||
{
|
||||
const bool isfirst = headi == NULL;
|
||||
if (isfirst)
|
||||
{
|
||||
headi = new _DescrItem(describe_pis ? PIS_HEAD_DI : PIM_HEAD_DI);
|
||||
_descr_arr.insert(headi, j++);
|
||||
headi->_f0 = false;
|
||||
headi->_f1 = true;
|
||||
totdi = new _DescrItem(TOT_ROW_DI);
|
||||
_descr_arr.insert(totdi, j);
|
||||
}
|
||||
d = new _DescrItem(id);
|
||||
_descr_arr.insert(d, j);
|
||||
d->_f0 = isfirst;
|
||||
d->_s0 = ref;
|
||||
d->_s1 = codiva;
|
||||
}
|
||||
d->_r28 += diffincimp;
|
||||
d->_r29 += diffinciva;
|
||||
t28 += diffincimp;
|
||||
t29 += diffinciva;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // End of _pim cycle
|
||||
|
||||
@ -780,11 +894,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
iads->_r1 += iva74t;
|
||||
t1 += iva74t;
|
||||
rt1 += iva74t;
|
||||
if (isfirst)
|
||||
{
|
||||
isfirst = FALSE;
|
||||
iads->_f0 = TRUE;
|
||||
}
|
||||
iads->_f0 = false;
|
||||
}
|
||||
} // fine while (codatt)
|
||||
|
||||
@ -795,12 +905,8 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
ads->_s1 = "VA7";
|
||||
ads->_r0 = art40;
|
||||
ads->_r1 = art40_iva;
|
||||
if (isfirst)
|
||||
{
|
||||
isfirst = FALSE;
|
||||
ads->_f0 = TRUE;
|
||||
}
|
||||
_descr_arr.add(ads);
|
||||
ads->_f0 = false;
|
||||
_descr_arr.insert(ads, totpos++);
|
||||
}
|
||||
|
||||
if (!describe_pis && (autodafe.sign() > 0 || autodafe_iva.sign() > 0))
|
||||
@ -810,35 +916,38 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
ads->_s1 = "AF"; // cosi' vollero, inoltre non e' piu' A35 ma AF, come sul dio sistema
|
||||
ads->_r0 = autodafe;
|
||||
ads->_r1 = autodafe_iva;
|
||||
if (isfirst)
|
||||
{
|
||||
isfirst = FALSE;
|
||||
ads->_f0 = TRUE;
|
||||
}
|
||||
_descr_arr.add(ads);
|
||||
ads->_f0 = false;
|
||||
_descr_arr.insert(ads, totpos++);
|
||||
}
|
||||
|
||||
// ag. viaggio: iva dovuta 74 ter la vogliono in mezzo ai progressivi
|
||||
if (iads != NULL) _descr_arr.add(iads);
|
||||
if (iads != NULL)
|
||||
_descr_arr.insert(iads, totpos++);
|
||||
|
||||
if (describe_pis)
|
||||
{
|
||||
_DescrItem& d = (_DescrItem&)_descr_arr[_descr_arr.last()];
|
||||
if (d._flags == PIS_HEAD) // Nessun PIS_ROW presente
|
||||
d._f1 = TRUE; // Evita la stampa dell'intestazione
|
||||
}
|
||||
|
||||
// prepara una bella riga di totali
|
||||
_DescrItem* d = new _DescrItem(TOT_ROW);
|
||||
d->_r0 = t0; d->_r1 = t1;
|
||||
d->_r2 = t2; d->_r3 = t3;
|
||||
d->_r4 = t4; d->_r5 = t5;
|
||||
if (tot != NULL)
|
||||
{
|
||||
tot->_r0 = t0; tot->_r1 = t1;
|
||||
tot->_r2 = t2; tot->_r3 = t3;
|
||||
tot->_r4 = t4; tot->_r5 = t5;
|
||||
}
|
||||
if (totd != NULL)
|
||||
{
|
||||
totd->_r26 = t26;
|
||||
totd->_r27 = t27;
|
||||
}
|
||||
if (totdi != NULL)
|
||||
{
|
||||
totdi->_r28 = t28;
|
||||
totdi->_r29 = t29;
|
||||
}
|
||||
// Totali progressivi da registri, comprensivi dei valori per calcolo vol affari.
|
||||
if (issosp) // Setta i valori (e la conseguente stampa della riga) solo se presenti registri in sospensione
|
||||
if (tot != NULL && issosp) // Setta i valori (e la conseguente stampa della riga) solo se presenti registri in sospensione
|
||||
{
|
||||
d->_r11 = rt0; d->_r12 = rt1;
|
||||
d->_r13 = rt2; d->_r14 = rt3;
|
||||
d->_s2 = rt4.string(); d->_s3 = rt5.string();
|
||||
tot->_r11 = rt0; tot->_r12 = rt1;
|
||||
tot->_r13 = rt2; tot->_r14 = rt3;
|
||||
tot->_s2 = rt4.string(); tot->_s3 = rt5.string();
|
||||
}
|
||||
|
||||
// aggiunge dati ptm
|
||||
@ -863,9 +972,12 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
look_plm(m, att);
|
||||
real ad1, ad2;
|
||||
|
||||
d->_r6 += _pom->get_real("R0"); // acq. intracomunitari
|
||||
d->_r7 += _pom->get_real("R1"); // inded. art 19
|
||||
d->_r8 += _pom->get_real("R2"); // IVA su inded. art. 19
|
||||
if (tot != NULL)
|
||||
{
|
||||
tot->_r6 += _pom->get_real("R0"); // acq. intracomunitari
|
||||
tot->_r7 += _pom->get_real("R1"); // inded. art 19
|
||||
tot->_r8 += _pom->get_real("R2"); // IVA su inded. art. 19
|
||||
}
|
||||
t->_r0 += _pom->get_real("R3"); // acq. ammortizz. detr
|
||||
t->_r1 += _pom->get_real("R4"); // IVA acq. ammort. detr
|
||||
t->_r2 += _pum->get_real("R2"); // ammort. detr. 6%
|
||||
@ -896,16 +1008,19 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
t->_s0 = ttm;
|
||||
|
||||
t->_f0 = _prorata.percentuale(_year)!=INVALID_PRORATA && (month != 13); // flag per segnalare l'esistenza
|
||||
d->_r9 += _pom->get_real("R9"); // acq. inded. su ricavi esenti
|
||||
d->_r10 += _pom->get_real("R10"); // IVA acq. inded. su ricavi esenti
|
||||
if (tot != NULL)
|
||||
{
|
||||
tot->_r9 += _pom->get_real("R9"); // acq. inded. su ricavi esenti
|
||||
tot->_r10 += _pom->get_real("R10"); // IVA acq. inded. su ricavi esenti
|
||||
|
||||
// passaggi interni
|
||||
real aipip(d->_s0); // progressivo ...
|
||||
real aipivp(d->_s1); // ... (che mazzata sulle palle...)
|
||||
aipip += _pum->get_real("R8"); // acq. inded. per pass. int
|
||||
aipivp += _pum->get_real("R9"); // IVA acq. inded. per pass. int
|
||||
d->_s0 = aipip.string(); // risbatto ...
|
||||
d->_s1 = aipivp.string(); // ..
|
||||
real aipip(tot->_s0); // progressivo ...
|
||||
real aipivp(tot->_s1); // ... (che mazzata sulle palle...)
|
||||
aipip += _pum->get_real("R8"); // acq. inded. per pass. int
|
||||
aipivp += _pum->get_real("R9"); // IVA acq. inded. per pass. int
|
||||
tot->_s0 = aipip.string(); // risbatto ...
|
||||
tot->_s1 = aipivp.string(); // ..
|
||||
}
|
||||
|
||||
// spese generali.
|
||||
real spgnp(t->_s2); // progressivo ...
|
||||
@ -952,12 +1067,12 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
} // for (mese ok)
|
||||
|
||||
// Cazzata orrenda ma necessaria CM500308
|
||||
if (issosp)
|
||||
if (tot != NULL && issosp)
|
||||
{
|
||||
rt4 += d->_r7; rt5 += d->_r8; // Det 1
|
||||
rt4 += d->_r9; rt5 += d->_r10; // Det 3
|
||||
rt4 += real(d->_s0); rt5 += real(d->_s1); // Det 9
|
||||
d->_s2 = rt4.string(); d->_s3 = rt5.string();
|
||||
rt4 += tot->_r7; rt5 += tot->_r8; // Det 1
|
||||
rt4 += tot->_r9; rt5 += tot->_r10; // Det 3
|
||||
rt4 += real(tot->_s0); rt5 += real(tot->_s1); // Det 9
|
||||
tot->_s2 = rt4.string(); tot->_s3 = rt5.string();
|
||||
}
|
||||
|
||||
// annual follows in _arr
|
||||
@ -1039,7 +1154,6 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
}
|
||||
}
|
||||
}
|
||||
_descr_arr.add(d);
|
||||
_descr_arr.add(t);
|
||||
}
|
||||
|
||||
@ -1063,6 +1177,7 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts, _DescrItem*
|
||||
d->_r6 = _lim->get_real("R6");
|
||||
d->_r7 = _lim->get_real("R14");
|
||||
d->_r9 = _lim->get_real("R9");
|
||||
d->_r29 = _lim->get_real("R29");
|
||||
if (atoi(_year) <= 1997) // Dal 1998 in poi il conguaglio prorata non va stampato, ma conglobato nell'iva acquisti
|
||||
d->_r10 = _lim->get_real("R7"); // totale conguaglio prorata
|
||||
|
||||
@ -1467,17 +1582,24 @@ void TLiquidazione_app::set_liqacc_2000(_DescrItem& d)
|
||||
|
||||
if (d._r3 > ZERO)
|
||||
d._r0 += d._r3; // Aggiungi rettifiche a debito
|
||||
int i = 9;
|
||||
if (!_isdiffacc)
|
||||
set_row(9,FR("@11gIva esigibile fino al 20/12@81g%r"), &d._r0);
|
||||
{
|
||||
set_row(i++,FR("@11gIva esigibile fino al 20/12@81g%r"), &d._r0);
|
||||
if (d._r29 > ZERO)
|
||||
set_row(i++,FR("@11gIVA a liquidazione differita incassata fino al 20/12@75g%r"), &d._r29);
|
||||
}
|
||||
else
|
||||
set_row(9,FR("@11gIva sulle operazioni di vendita@81g%r"), &d._r0);
|
||||
int i = 10;
|
||||
{
|
||||
set_row(i++,FR("@11gIva sulle operazioni di vendita@81g%r"), &d._r0);
|
||||
if (d._r29 > ZERO)
|
||||
set_row(i++,FR("@11gIVA a liquidazione differita incassata@75g%r"), &d._r29);
|
||||
}
|
||||
if (!_isdiffacc)
|
||||
{
|
||||
set_row(i++,FR("@11gIva esigibile fino al 20/12 di cui non fatturata@81g%r"), &d._r1);
|
||||
set_row(i++,FR("@11gIva esigibile fino al 20/12 di cui non annotata@81g%r"), &d._r2);
|
||||
}
|
||||
|
||||
if (d._r3 < ZERO)
|
||||
d._r5 -= d._r3; // Aggiungi rettifiche a credito
|
||||
if (!_isdiffacc)
|
||||
@ -1528,30 +1650,76 @@ void TLiquidazione_app::set_liqacc_2000(_DescrItem& d)
|
||||
|
||||
void TLiquidazione_app::set_pim_head(_DescrItem& d)
|
||||
{
|
||||
int r = 1;
|
||||
if (d._flags == PIM_HEAD)
|
||||
int r = 1;
|
||||
|
||||
if (d._flags == PIM_HEAD)
|
||||
set_bookmark(TR("Riepilogo progressivi"), _att_bookmark);
|
||||
else // PIS_HEAD
|
||||
{
|
||||
if (d._f1)
|
||||
return; // No header please
|
||||
|
||||
set_bookmark(TR("Riepilogo progressivi successivi"), _att_bookmark);
|
||||
set_row(r++,TR(" Di cui da periodo successivo"));
|
||||
set_row(r++,"");
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row(r++,"");
|
||||
if (d._flags == PIM_HEAD_D)
|
||||
{
|
||||
set_row(r++, TR("Fatture a liquidazione differita"));
|
||||
set_bookmark(TR("Riepilogo progressivi a liquidazione differita"), _att_bookmark);
|
||||
}
|
||||
else
|
||||
if (d._flags == PIM_HEAD_DI)
|
||||
{
|
||||
set_row(r++, TR("Fatture a liquidazione differita incassate"));
|
||||
set_bookmark(TR("Riepilogo progressivi a liquidazione differita incassati"), _att_bookmark);
|
||||
}
|
||||
else // PIS_HEAD
|
||||
{
|
||||
if (d._flags == PIS_HEAD)
|
||||
{
|
||||
set_row(r++,TR(" Di cui da periodo successivo"));
|
||||
set_row(r++,"");
|
||||
set_bookmark(TR("Riepilogo progressivi successivi"), _att_bookmark);
|
||||
}
|
||||
else
|
||||
if (d._flags == PIS_HEAD_D)
|
||||
{
|
||||
set_row(r++, TR("Fatture a liquidazione differita"));
|
||||
set_bookmark(TR("Riepilogo progressivi successivi a liquidazione differita"), _att_bookmark);
|
||||
}
|
||||
else
|
||||
if (d._flags == PIS_HEAD_DI)
|
||||
{
|
||||
set_row(r++, TR("Fatture a liquidazione differita incassate"));
|
||||
set_bookmark(TR("Riepilogo progressivi successivi a liquidazione differita incassati"), _att_bookmark);
|
||||
}
|
||||
}
|
||||
set_row(r++,"");
|
||||
}
|
||||
if (d._f0)
|
||||
{
|
||||
set_row(r++,FR(" Cod.@41gVENDITE@71gCORRISPETTIVI"));
|
||||
set_row(r++,FR(" IVA Descrizione@30gImponibile@49gImposta@63gImponibile@82gImposta"));
|
||||
if (d._flags == PIM_HEAD || d._flags == PIS_HEAD)
|
||||
{
|
||||
set_row(r++,FR(" Cod.@41gVENDITE@71gCORRISPETTIVI"));
|
||||
set_row(r++,FR(" IVA Descrizione@30gImponibile@49gImposta@63gImponibile@82gImposta"));
|
||||
set_row(r,"");
|
||||
}
|
||||
/* else
|
||||
{
|
||||
set_row(r++,FR(" Cod.@41gVENDITE"));
|
||||
set_row(r++,FR(" IVA Descrizione@30gImponibile@49gImposta"));
|
||||
} */
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row(r++,FR(" Cod.@41gVENDITE@71gCORRISPETTIVI@106gACQUISTI"));
|
||||
set_row(r++,FR(" IVA Descrizione@30gImponibile@49gImposta@63gImponibile"
|
||||
"@82gImposta@96gImponibile@115gImposta"));
|
||||
if (d._flags == PIM_HEAD || d._flags == PIS_HEAD)
|
||||
{
|
||||
set_row(r++,FR(" Cod.@41gVENDITE@71gCORRISPETTIVI@106gACQUISTI"));
|
||||
set_row(r++,FR(" IVA Descrizione@30gImponibile@49gImposta@63gImponibile"
|
||||
"@82gImposta@96gImponibile@115gImposta"));
|
||||
set_row(r,"");
|
||||
}
|
||||
/* else
|
||||
{
|
||||
set_row(r++,FR(" Cod.@41gVENDITE"));
|
||||
set_row(r++,FR(" IVA Descrizione@30gImponibile@49gImposta"));
|
||||
} */
|
||||
}
|
||||
set_row(r,"");
|
||||
}
|
||||
|
||||
void TLiquidazione_app::set_pim(_DescrItem& d)
|
||||
@ -1560,8 +1728,10 @@ void TLiquidazione_app::set_pim(_DescrItem& d)
|
||||
const bool a = (d._r0 + d._r1) == ZERO;
|
||||
const bool b = (d._r2 + d._r3) == ZERO;
|
||||
const bool c = (d._r4 + d._r5) == ZERO;
|
||||
const bool e = (d._r26 + d._r27) == ZERO;
|
||||
const bool f = (d._r28 + d._r29) == ZERO;
|
||||
|
||||
if (a && b && c)
|
||||
if (a && b && c && e && f)
|
||||
return;
|
||||
|
||||
int rw = 1;
|
||||
@ -1578,19 +1748,38 @@ void TLiquidazione_app::set_pim(_DescrItem& d)
|
||||
if (d._s2.len() > 19) d._s2.cut(19);
|
||||
}
|
||||
|
||||
if (d._f0) // e' il primo: non fa piu' nulla perche' l'intestazione
|
||||
// viene fatta comunque da set_pim_head
|
||||
{}
|
||||
if (d._flags == PIM_ROW || d._flags == PIS_ROW)
|
||||
{
|
||||
set_row(rw++,"%4s %s@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r",
|
||||
(const char*)d._s1, (const char*)d._s2,
|
||||
&(d._r0), &(d._r1), &(d._r2), &(d._r3), &(d._r4), &(d._r5));
|
||||
}
|
||||
else
|
||||
if (d._flags == PIM_ROW_D || d._flags == PIS_ROW_D)
|
||||
{
|
||||
set_row(rw++,"%4s %s@25g%r@41g%r",
|
||||
(const char*)d._s1, (const char*)d._s2,
|
||||
&(d._r26), &(d._r27));
|
||||
}
|
||||
else
|
||||
if (d._flags == PIM_ROW_DI || d._flags == PIS_ROW_DI)
|
||||
{
|
||||
set_row(rw++,"%4s %s@25g%r@41g%r",
|
||||
(const char*)d._s1, (const char*)d._s2,
|
||||
&(d._r28), &(d._r29));
|
||||
}
|
||||
}
|
||||
|
||||
set_row(rw++,"%4s %s@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r",
|
||||
(const char*)d._s1,
|
||||
(const char*)d._s2,
|
||||
&(d._r0),
|
||||
&(d._r1),
|
||||
&(d._r2),
|
||||
&(d._r3),
|
||||
&(d._r4),
|
||||
&(d._r5));
|
||||
void TLiquidazione_app::set_plm_diff(_DescrItem& d)
|
||||
{
|
||||
int rw = 1;
|
||||
|
||||
set_row(rw++,""); set_row(rw++,"");
|
||||
if (d._flags == TOT_ROW_D)
|
||||
set_row(rw++,FR("Totale@25g%r@41g%r"), &(d._r26), &(d._r27));
|
||||
else
|
||||
set_row(rw++,FR("Totale@25g%r@41g%r"), &(d._r28), &(d._r29));
|
||||
set_row(rw++,"");
|
||||
}
|
||||
|
||||
void TLiquidazione_app::set_plm(_DescrItem& d)
|
||||
@ -2031,6 +2220,7 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
|
||||
const real& interessi = d._r7;
|
||||
const real& versamenti = d._r8;
|
||||
const real& vers_int = d._r9;
|
||||
const real& diffinc_iva = d._r29;
|
||||
TToken_string tt(d._s0);
|
||||
real iva_vend(tt.get(0));
|
||||
real iva_acq(tt.get(1));
|
||||
@ -2060,6 +2250,8 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
|
||||
if (!_is_visliq)
|
||||
iva_vend += rett_debt;
|
||||
set_row(rw++,FR("@11gIVA esigibile per il periodo@75g%r"), &iva_vend);
|
||||
if (diffinc_iva != ZERO)
|
||||
set_row(rw++,FR("@11gIVA a liquidazione differita incassata@75g%r"), &diffinc_iva);
|
||||
if (_is_visliq)
|
||||
set_row(rw++,FR("@11g$[r]Rettifiche IVA a debito$[n]@75g%r"), &rett_debt); // Rettifiche modificabili
|
||||
|
||||
@ -2070,7 +2262,7 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
|
||||
if (_is_visliq)
|
||||
set_row(rw++,FR("@11g$[r]Rettifiche IVA a credito$[n]@58g%r"), &rett_cred);
|
||||
|
||||
real iva_deb_cred = iva_vend - iva_acq;
|
||||
real iva_deb_cred = iva_vend - iva_acq + diffinc_iva;
|
||||
if (_is_visliq)
|
||||
iva_deb_cred += rett_debt - rett_cred;
|
||||
|
||||
|
@ -4068,4 +4068,4 @@ int cg4400(int argc, char* argv[])
|
||||
TStampa_registri_app a;
|
||||
a.run(argc, argv, TR("Stampa registri IVA"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user