Patch level : 12.0 726

Files correlati     : cg0.exe cg4.exe cgmenu.men cg0800a.msk cg4b00a.msk cg0800a.rep cg4b00a.rep cg3.exe cg3200a.msk cg3600a.msk232.bat

Commento            :

Sistemata esposizione pro rata
Modificate le stampe progressivi IVA
This commit is contained in:
AlexBonazzi 2019-03-11 17:40:52 +01:00
parent 2b086c58ca
commit b2b336b7ea
10 changed files with 278 additions and 483 deletions

View File

@ -71,27 +71,39 @@ void TRiepilogoIVA_app::main_loop()
rep.load(repname);
if (recset != NULL)
{
const int anno = m.get_int(F_ANNO);
int anno = m.get_int(F_ANNO);
int damese = m.get_int(F_DAMESE);
int amese = m.get_int(F_AMESE);
recset->freeze();
recset->set_da_mese_var(damese);
recset->set_a_mese_var(amese);
if (damese == 13)
{
damese = 1;
amese = 12;
recset->set_annuale(true);
recset->set_annual(true);
}
recset->set_anno(anno);
recset->set_da_mese(damese);
recset->set_a_mese(amese);
if (damese == 13)
{
damese = 1;
amese = 12;
recset->set_annual(true);
}
recset->set_da_mese(damese);
recset->set_a_mese(amese);
const TDate da(1, damese, anno);
TDate a(1, amese, anno);
if (m.get_long(F_DAMESE) == 13)
a.addyear();
a.set_end_month();
recset->freeze();
recset->set_from(da);
recset->set_to(a);
recset->set_var("#ANNO", m.get_long(F_ANNO), true);
recset->set_var("#DAMESE", m.get_long(F_DAMESE), true);
recset->set_var("#AMESE", m.get_long(F_AMESE), true);
recset->unfreeze();
rep.set_recordset(recset);

View File

@ -18,74 +18,70 @@
<field x="131.5" type="Numero" align="right" width="5" pattern="1">
<source>#PAGE</source>
</field>
<field x="28" y="1" type="Testo" width="32" height="2" pattern="1" text="Progressivi IVA">
<font face="Courier New" bold="1" size="14" />
<field x="38" y="1" type="Testo" width="25" pattern="1" text="Progressivi IVA">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="62.5" y="1" type="Numero" align="right" width="10" height="2" pattern="1">
<font face="Courier New" bold="1" size="14" />
<field x="64" y="1" type="Numero" align="right" width="6" pattern="1">
<font face="Courier New" bold="1" size="10" />
<source>#ANNO</source>
</field>
<field x="73.5" y="1" type="Testo" width="4" height="2" pattern="1" text="da">
<font face="Courier New" bold="1" size="14" />
</field>
<field x="78" y="1" type="Array" width="20" height="2" pattern="1">
<font face="Courier New" bold="1" size="14" />
<field x="74" y="1" type="Array" width="16" pattern="1">
<font face="Courier New" bold="1" size="10" />
<source>#DAMESE</source>
<list>
<li Value="Gennaio" Code="1" />
<li Value="Febbraio" Code="2" />
<li Value="Marzo" Code="3" />
<li Value="Aprile" Code="4" />
<li Value="Maggio" Code="5" />
<li Value="Giugno" Code="6" />
<li Value="Luglio" Code="7" />
<li Value="Agosto" Code="8" />
<li Value="Settembre" Code="9" />
<li Value="Ottobre" Code="10" />
<li Value="Novembre" Code="11" />
<li Value="Dicembre" Code="12" />
<li Value="da gennaio" Code="1" />
<li Value="da febbraio" Code="2" />
<li Value="da marzo" Code="3" />
<li Value="da aprile" Code="4" />
<li Value="da maggio" Code="5" />
<li Value="da giugno" Code="6" />
<li Value="da luglio" Code="7" />
<li Value="da agosto" Code="8" />
<li Value="da settembre" Code="9" />
<li Value="da ottobre" Code="10" />
<li Value="da novembre" Code="11" />
<li Value="da dicembre" Code="12" />
<li Value="annuale" Code="13" />
</list>
</field>
<field x="99" y="1" type="Testo" width="4" height="2" pattern="1" text="a">
<font face="Courier New" bold="1" size="14" />
</field>
<field x="102.5" y="1" type="Array" width="20" height="2" pattern="1">
<font face="Courier New" bold="1" size="14" />
<field x="91" y="1" type="Array" width="16" pattern="1">
<font face="Courier New" bold="1" size="10" />
<source>#AMESE</source>
<list>
<li Value="Gennaio" Code="1" />
<li Value="Febbraio" Code="2" />
<li Value="Marzo" Code="3" />
<li Value="Aprile" Code="4" />
<li Value="Maggio" Code="5" />
<li Value="Giugno" Code="6" />
<li Value="Luglio" Code="7" />
<li Value="Agosto" Code="8" />
<li Value="Settembre" Code="9" />
<li Value="Ottobre" Code="10" />
<li Value="Novembre" Code="11" />
<li Value="Dicembre" Code="12" />
<li Value="a gennaio" Code="1" />
<li Value="a febbraio" Code="2" />
<li Value="a marzo" Code="3" />
<li Value="ad aprile" Code="4" />
<li Value="a maggio" Code="5" />
<li Value="a giugno" Code="6" />
<li Value="a luglio" Code="7" />
<li Value="ad agosto" Code="8" />
<li Value="a settembre" Code="9" />
<li Value="a ottobre" Code="10" />
<li Value="a novembre" Code="11" />
<li Value="a dicembre" Code="12" />
<li Code="13" />
</list>
</field>
<field x="60" y="3" type="Testo" width="10" pattern="1" text="Vendite">
<field x="60" y="2.25" type="Testo" width="10" pattern="1" text="Vendite">
<font face="Courier New" size="10" />
</field>
<field x="85.5" y="3" type="Testo" width="18" pattern="1" text="Corrispettivi">
<field x="85.5" y="2.25" type="Testo" width="18" pattern="1" text="Corrispettivi">
<font face="Courier New" size="10" />
</field>
<field x="114" y="3" type="Testo" width="12" pattern="1" text="Acquisti">
<field x="114" y="2.25" type="Testo" width="12" pattern="1" text="Acquisti">
<font face="Courier New" size="10" />
</field>
<field x="53" y="4" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<field x="53" y="3.25" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<font face="Courier New" size="10" />
</field>
<field x="81" y="4" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<field x="81" y="3.25" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<font face="Courier New" size="10" />
</field>
<field x="108" y="4" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<field x="108" y="3.25" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<font face="Courier New" size="10" />
</field>
<field border="2" x="4" y="5.5" type="Linea" width="134" height="0" pattern="1" />
<field border="2" x="4" y="4.75" type="Linea" width="134" height="0" pattern="1" />
</section>
<section type="Head" level="1" pattern="1" />
<section type="Body" pattern="1" />

View File

@ -63,7 +63,7 @@ END
LIST F_AMESE 20
BEGIN
PROMPT 2 7 " A mese "
PROMPT 35 5 " A mese "
ITEM "13|13a liquid."
FLAGS "MP"
WARINIG "Il mese di inizio non può essere successico al mese di fine"

View File

@ -1159,9 +1159,10 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
// calcola nuovo prorata per ogni attivita' (miste: 1+2)
real pr;
const real rsa = ris - (e3-e5) - (e4-e6) - vrc;
if (!rsa.is_zero())
const real rsn = rsa - e1;
if (!rsa.is_zero())
{
const real rsn = rsa - e1;
pr = CENTO - (rsn * CENTO / rsa); // Percentuale di indetraibilita: reciproco della percentuale di detraibilita'
pr.round(0);
}
@ -1210,7 +1211,9 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
dd->_r8 = e5;
dd->_r9 = e6;
dd->_r10 = vrc;
t->_arr.add(dd);
dd->_ra0 = rsa;
dd->_ra1 = rsn;
t->_arr.add(dd);
}
}
}
@ -2825,10 +2828,8 @@ bool TLiquidazione_app::set_annual(_DescrItem& d)
set_row(row++, FR("%% PRO-RATA (%s%%) ed IVA non detraibile (%s%%)@69g%r"), (const char*)s1, (const char*)s2, &(d._r6));
else
set_row(row++, FR("%% PRO-RATA (%s%%)"), (const char*)s1);
const real denom = vol_aff - rev_charge;
const real num = denom - d._r1 - d._r4 - d._r5 + d._r8 - d._r7 + d._r9;
set_row(row++, FR("Numeratore pro-rata @69g%r"), &num);
set_row(row++, FR("Denominatore @69g%r"), &denom);
set_row(row++, FR("Numeratore pro-rata @69g%r"), &(d._ra1));
set_row(row++, FR("Denominatore @69g%r"), &(d._ra0));
// set_row(row++,FR("C1 - Operazioni esenti escluse da nr. 1 a 9 e 11 art. 10 @69g%r"), &(d._r1));
// set_row(row++,FR("C2 - Operazioni esenti di cui nr. 11 art. 10 @69g%r"), &(d._r4));
// set_row(row++,FR("C3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r"), &(d._r5));

View File

@ -25,6 +25,29 @@ bool TRiepilogoIVA_mask::on_field_event(TOperable_field& o, TField_event e, long
switch (o.dlg())
{
case F_DAMESE:
if (e == fe_modify || e == fe_close)
{
if (atoi(o.get()) > m.get_int(F_AMESE))
m.set(F_AMESE, o.get());
if (e == fe_modify && (atoi(o.get()) == 13))
{
TDate d(1, 1, m.get_int(F_ANNO));
m.set(F_DADATA, d);
d.set_month(12);
d.set_end_month();
m.set(F_ADATA, d);
}
}
break;
case F_AMESE:
if (e == fe_modify || e == fe_close)
{
if (atoi(o.get()) < m.get_int(F_DAMESE))
o.set(m.get(F_DAMESE));
}
break;
case F_DADATA:
if (e == fe_modify || e == fe_close)
{
@ -38,34 +61,6 @@ bool TRiepilogoIVA_mask::on_field_event(TOperable_field& o, TField_event e, long
if (TDate(o.get()) < m.get_date(F_DADATA))
o.set(m.get(F_DADATA));
}
case F_DASOTTOC:
if (e == fe_modify || e == fe_close)
{
TString da; da.format("%03d%03d%06ld", m.get_int(F_DAGRUPPO), m.get_int(F_DACONTO), m.get_long(F_DASOTTOC));
TString a; a.format("%03d%03d%06ld", m.get_int(F_AGRUPPO), m.get_int(F_ACONTO), m.get_long(F_ASOTTOC));
if (da > a)
{
m.set(F_AGRUPPO, da.left(3));
m.set(F_ACONTO, da.mid(3, 3));
m.set(F_ASOTTOC, da.right(6), 0x3);
}
}
break;
case F_ASOTTOC:
if (e == fe_modify || e == fe_close)
{
TString da; da.format("%03d%03d%06ld", m.get_int(F_DAGRUPPO), m.get_int(F_DACONTO), m.get_long(F_DASOTTOC));
TString a; a.format("%03d%03d%06ld", m.get_int(F_AGRUPPO), m.get_int(F_ACONTO), m.get_long(F_ASOTTOC));
if (da > a)
{
m.set(F_AGRUPPO, da.left(3));
m.set(F_ACONTO, da.mid(3, 3));
m.set(F_ASOTTOC, da.right(6), 0x3);
}
}
default:
break;
}
@ -78,20 +73,10 @@ bool TRiepilogoIVA_mask::on_field_event(TOperable_field& o, TField_event e, long
class TRiepilogoIVAcompetenza_recordset : public TRiepilogoIVA_recordset
{
bool _competenzaperiodo;
bool _competenzadiversa;
bool _registrazioneritardo;
public:
virtual bool set_competenzaperiodoIVA(bool on) { _competenzaperiodo = on; return on; }
virtual bool set_competenzadiversaIVA(bool on) { _competenzadiversa = on; return on; }
virtual bool set_registrazioneIVAritardo(bool on) { return _registrazioneritardo = on; return on; }
virtual bool competenzaperiodoIVA() const { return _competenzaperiodo; }
virtual bool competenzadiversaIVA() const { return _competenzadiversa; }
virtual bool registrazioneIVAritardo() const { return _registrazioneritardo; }
virtual bool is_competenza() const { return true; }
TRiepilogoIVAcompetenza_recordset() {}
virtual ~TRiepilogoIVAcompetenza_recordset() { }
};
@ -121,34 +106,27 @@ void TRiepilogoIVA_app::main_loop()
rep.load(repname);
if (recset != NULL)
{
recset->freeze();
recset->set_competenzaperiodoIVA(m.get_bool(F_COMPUG));
recset->set_competenzadiversaIVA(m.get_bool(F_COMPDIV));
recset->set_registrazioneIVAritardo(m.get_bool(F_REGRIT));
recset->set_from(m.get_date(F_DADATA));
recset->set_to(m.get_date(F_ADATA));
recset->set_annuale((m.get_date(F_DADATA).month() == 1) && (m.get_date(F_ADATA).month() == 12)
);
int anno = m.get_int(F_ANNO);
int damese = m.get_int(F_DAMESE);
int amese = m.get_int(F_AMESE);
recset->set_from_conto(m.get_long(F_DAGRUPPO), m.get_long(F_DACONTO), m.get_long(F_DASOTTOC));
if (m.get_long(F_DAGRUPPO) != 0)
recset->set_to_conto(m.get_long(F_AGRUPPO), m.get_long(F_ACONTO), m.get_long(F_ASOTTOC));
recset->set_var("#COMPUG", m.get_bool(F_COMPUG), true);
recset->set_var("#COMPDIV", m.get_bool(F_COMPDIV), true);
recset->set_var("#REGRIT", m.get_bool(F_REGRIT), true);
recset->set_var("#TODATE", m.get_date(F_ADATA), true);
recset->set_var("#FROMDATE", m.get_date(F_DADATA), true);
recset->set_var("#TODATE", m.get_date(F_ADATA), true);
recset->set_var("#DAGRUPPO", m.get_long(F_DAGRUPPO), true);
recset->set_var("#DACONTO", m.get_long(F_DACONTO), true);
recset->set_var("#DASOTTOCONTO", m.get_long(F_DASOTTOC), true);
recset->set_var("#AGRUPPO", m.get_long(F_AGRUPPO), true);
recset->set_var("#ACONTO", m.get_long(F_ACONTO), true);
recset->set_var("#ASOTTOCONTO", m.get_long(F_ASOTTOC), true);
recset->unfreeze();
rep.set_recordset(recset);
rep.print_or_preview();
recset->freeze();
recset->set_da_mese_var(damese);
recset->set_a_mese_var(amese);
if (damese == 13)
{
damese = 1;
amese = 12;
recset->set_annual(true);
}
recset->set_anno(anno);
recset->set_da_mese(damese);
recset->set_a_mese(amese);
recset->set_from(m.get_date(F_DADATA));
recset->set_to(m.get_date(F_ADATA));
recset->unfreeze();
rep.set_recordset(recset);
rep.print_or_preview();
}
}
}

View File

@ -1,18 +1,10 @@
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_DADATA 103
#define F_ADATA 104
#define F_DAGRUPPO 105
#define F_DACONTO 106
#define F_DASOTTOC 107
#define F_AGRUPPO 108
#define F_ACONTO 109
#define F_ASOTTOC 110
#define F_DADESCR 111
#define F_ADESCR 112
#define F_COMPUG 113
#define F_COMPDIV 114
#define F_REGRIT 115
#define F_ANNO 103
#define F_DAMESE 104
#define F_AMESE 105
#define F_DADATA 106
#define F_ADATA 107
#define F_REPORT 200
#define F_PROFILO 201

View File

@ -18,108 +18,84 @@
<field x="131.5" type="Numero" align="right" width="5" pattern="1">
<source>#PAGE</source>
</field>
<field x="7" y="1" type="Testo" width="32" height="2" pattern="1" text="Progressivi IVA dal">
<font face="Courier New" bold="1" size="14" />
<field x="21.5" y="1" type="Testo" width="45" pattern="1" text="Progressivi IVA per competenza">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="38.5" y="1" type="Data" width="25" height="2" pattern="1">
<font face="Courier New" bold="1" size="14" />
<field x="67.5" y="1" type="Numero" align="right" width="6" pattern="1">
<font face="Courier New" bold="1" size="10" />
<source>#ANNO</source>
</field>
<field x="77.5" y="1" type="Array" width="16" pattern="1">
<font face="Courier New" bold="1" size="10" />
<source>#DAMESE</source>
<list>
<li Value="da gennaio" Code="1" />
<li Value="da febbraio" Code="2" />
<li Value="da marzo" Code="3" />
<li Value="da aprile" Code="4" />
<li Value="da maggio" Code="5" />
<li Value="da giugno" Code="6" />
<li Value="da luglio" Code="7" />
<li Value="da agosto" Code="8" />
<li Value="da settembre" Code="9" />
<li Value="da ottobre" Code="10" />
<li Value="da novembre" Code="11" />
<li Value="da dicembre" Code="12" />
<li Value="annuale" Code="13" />
</list>
</field>
<field x="94.5" y="1" type="Array" width="16" pattern="1">
<font face="Courier New" bold="1" size="10" />
<source>#AMESE</source>
<list>
<li Value="a gennaio" Code="1" />
<li Value="a febbraio" Code="2" />
<li Value="a marzo" Code="3" />
<li Value="ad aprile" Code="4" />
<li Value="a maggio" Code="5" />
<li Value="a giugno" Code="6" />
<li Value="a luglio" Code="7" />
<li Value="ad agosto" Code="8" />
<li Value="a settembre" Code="9" />
<li Value="a ottobre" Code="10" />
<li Value="a novembre" Code="11" />
<li Value="a dicembre" Code="12" />
<li Code="13" />
</list>
</field>
<field x="28.5" y="2" type="Testo" width="35" pattern="1" text="Da data di registrazione">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="63.5" y="2" type="Data" width="14" pattern="1">
<font face="Courier New" bold="1" size="10" />
<source>#FROMDATE</source>
</field>
<field x="65.5" y="1" type="Testo" width="4" height="2" pattern="1" text="al">
<font face="Courier New" bold="1" size="14" />
<field x="78" y="2" type="Testo" width="2" pattern="1" text="a">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="72.5" y="1" type="Data" width="25" height="2" pattern="1">
<font face="Courier New" bold="1" size="14" />
<field x="81" y="2" type="Data" width="14" pattern="1">
<font face="Courier New" bold="1" size="10" />
<source>#TODATE</source>
</field>
<field x="7" y="3" type="Testo" width="30" height="2" pattern="1" text="Competenza IVA">
<font face="Courier New" bold="1" size="14" />
</field>
<field x="40" y="3" type="Testo" width="20" height="2" pattern="1" text="corrente">
<font face="Courier New" bold="1" size="14" />
<prescript description="H0.0 PRESCRIPT">#THIS
#COMPUG @
0
=
IF
HIDE
ELSE
SHOW
THEN</prescript>
</field>
<field x="63" y="3" type="Testo" width="30" height="2" pattern="1" text="da successivo">
<font face="Courier New" bold="1" size="14" />
<prescript description="H0.0 PRESCRIPT">#THIS
#COMPDIV @
0
=
IF
HIDE
ELSE
SHOW
THEN</prescript>
</field>
<field x="94.5" y="3" type="Testo" width="40" height="2" pattern="1" text="fatture in ritardo">
<font face="Courier New" bold="1" size="14" />
<prescript description="H0.0 PRESCRIPT">#THIS
#REGRIT @
0
=
IF
HIDE
ELSE
SHOW
THEN</prescript>
</field>
<field x="7" y="5.25" type="Testo" width="20" height="2" pattern="1" text="Da conto">
<font face="Courier New" bold="1" size="14" />
</field>
<field x="29" y="5.25" type="Numero" align="right" width="6" height="2" pattern="1" hide_zero="1">
<font face="Courier New" bold="1" size="14" />
<source>#DAGRUPPO</source>
</field>
<field x="36" y="5.25" type="Numero" align="right" width="6" height="2" pattern="1" hide_zero="1">
<font face="Courier New" bold="1" size="14" />
<source>#DACONTO</source>
</field>
<field x="43" y="5.25" type="Numero" align="right" width="12" height="2" pattern="1" hide_zero="1">
<font face="Courier New" bold="1" size="14" />
<source>#DASOTTOCONTO</source>
</field>
<field x="59.5" y="5.25" type="Testo" width="15" height="2" pattern="1" text="A conto">
<font face="Courier New" bold="1" size="14" />
</field>
<field x="76.5" y="5.25" type="Numero" align="right" width="6" height="2" pattern="1" hide_zero="1">
<font face="Courier New" bold="1" size="14" />
<source>#AGRUPPO</source>
</field>
<field x="83.5" y="5.25" type="Numero" align="right" width="6" height="2" pattern="1" hide_zero="1">
<font face="Courier New" bold="1" size="14" />
<source>#ACONTO</source>
</field>
<field x="90.5" y="5.25" type="Numero" align="right" width="12" height="2" pattern="1" hide_zero="1">
<font face="Courier New" bold="1" size="14" />
<source>#ASOTTOCONTO</source>
</field>
<field x="63" y="7.25" type="Testo" width="10" pattern="1" text="Vendite">
<field x="63" y="3" type="Testo" width="10" pattern="1" text="Vendite">
<font face="Courier New" size="10" />
</field>
<field x="88" y="7.25" type="Testo" width="18" pattern="1" text="Corrispettivi">
<field x="88" y="3" type="Testo" width="18" pattern="1" text="Corrispettivi">
<font face="Courier New" size="10" />
</field>
<field x="117.5" y="7.25" type="Testo" width="12" pattern="1" text="Acquisti">
<field x="117.5" y="3" type="Testo" width="12" pattern="1" text="Acquisti">
<font face="Courier New" size="10" />
</field>
<field x="53" y="8.25" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<field x="53" y="4" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<font face="Courier New" size="10" />
</field>
<field x="81" y="8.25" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<field x="81" y="4" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<font face="Courier New" size="10" />
</field>
<field x="108" y="8.25" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<field x="108" y="4" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
<font face="Courier New" size="10" />
</field>
<field border="2" x="4" y="9.75" type="Linea" width="134" height="0" pattern="1" />
<field border="2" x="4" y="5.5" type="Linea" width="134" height="0" pattern="1" />
</section>
<section type="Head" level="1" pattern="1" />
<section type="Body" pattern="1" />

View File

@ -46,151 +46,43 @@ BEGIN
FLAGS "D"
END
NUMBER F_ANNO 4
BEGIN
PROMPT 2 3 "Anno "
FLAGS "AP"
CHECKTYPE REQUIRED
END
LIST F_DAMESE 20
BEGIN
PROMPT 2 5 "Da mese "
ITEM "13|13a liquid."
FLAGS "MP"
MESSAGE COPY,F_AMESE
END
LIST F_AMESE 20
BEGIN
PROMPT 35 5 " A mese "
ITEM "13|13a liquid."
FLAGS "MP"
WARINIG "Il mese di inizio non può essere successico al mese di fine"
VALIDATE F_DAMESE<=F_AMESE
END
DATE F_DADATA
BEGIN
PROMPT 2 3 "Da: data "
PROMPT 2 7 "Da: data registrazione "
END
DATE F_ADATA
BEGIN
PROMPT 2 5 " A: data "
PROMPT 2 9 " A: data registrazione "
WARINIG "La data di inizio non può essere successico alla data di fine"
VALIDATE DATE_CMP_FUNC >= F_>ADATA
END
NUMBER F_DAGRUPPO 3
BEGIN
PROMPT 2 7 "Da: Gruppo "
USE LF_PCON KEY 1 SELECT (CONTO="")
INPUT GRUPPO F_DAGRUPPO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_DAGRUPPO GRUPPO
CHECKTYPE NORMAL
END
NUMBER F_DACONTO 3
BEGIN
PROMPT 23 7 "Conto "
USE LF_PCON KEY 1 SELECT (SOTTOCONTO="")
INPUT GRUPPO F_DAGRUPPO
INPUT CONTO F_DACONTO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_DACONTO CONTO
OUTPUT F_DAGRUPPO GRUPPO
CHECKTYPE NORMAL
END
NUMBER F_DASOTTOC 6
BEGIN
PROMPT 36 7 "Sottoconto "
USE LF_PCON
INPUT GRUPPO F_DAGRUPPO
INPUT CONTO F_DACONTO
INPUT SOTTOCONTO F_DASOTTOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_DASOTTOC SOTTOCONTO
OUTPUT F_DAGRUPPO GRUPPO
OUTPUT F_DACONTO CONTO
OUTPUT F_DADESCR DESCR
CHECKTYPE NORMAL
END
STRING F_DADESCR 50
BEGIN
PROMPT 14 9 ""
USE LF_PCON KEY 2
INPUT DESCR F_DADESCR
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
OUTPUT F_DASOTTOC SOTTOCONTO
OUTPUT F_DACONTO CONTO
OUTPUT F_DAGRUPPO GRUPPO
OUTPUT F_DADESCR DESCR
CHECKTYPE NORMAL
END
NUMBER F_AGRUPPO 3
BEGIN
PROMPT 2 11 " A: Gruppo "
USE LF_PCON KEY 1 SELECT (CONTO="")
INPUT GRUPPO F_AGRUPPO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_AGRUPPO GRUPPO
CHECKTYPE NORMAL
END
NUMBER F_ACONTO 3
BEGIN
PROMPT 23 11 "Conto "
USE LF_PCON KEY 1 SELECT (SOTTOCONTO="")
INPUT GRUPPO F_AGRUPPO
INPUT CONTO F_ACONTO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_ACONTO CONTO
OUTPUT F_AGRUPPO GRUPPO
CHECKTYPE NORMAL
END
NUMBER F_ASOTTOC 6
BEGIN
PROMPT 36 11 "Sottoconto "
USE LF_PCON
INPUT GRUPPO F_AGRUPPO
INPUT CONTO F_ACONTO
INPUT SOTTOCONTO F_ASOTTOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_ASOTTOC SOTTOCONTO
OUTPUT F_AGRUPPO GRUPPO
OUTPUT F_ACONTO CONTO
OUTPUT F_ADESCR DESCR
CHECKTYPE NORMAL
END
STRING F_ADESCR 50
BEGIN
PROMPT 14 13 ""
USE LF_PCON KEY 2
INPUT DESCR F_ADESCR
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
OUTPUT F_ASOTTOC SOTTOCONTO
OUTPUT F_ACONTO CONTO
OUTPUT F_AGRUPPO GRUPPO
OUTPUT F_ADESCR DESCR
CHECKTYPE NORMAL
END
BOOLEAN F_COMPUG
BEGIN
PROMPT 2 15 "Movimenti con competenza uguale alla registrazione"
END
BOOLEAN F_COMPDIV
BEGIN
PROMPT 2 17 "Movimenti con competenza diversa dalla registrazione"
END
BOOLEAN F_REGRIT
BEGIN
PROMPT 2 19 "Movimenti registrati in ritardo"
END
STRING F_REPORT 256 50
BEGIN
PROMPT 2 -3 "Tipo di stampa "

View File

@ -69,27 +69,12 @@ void TRiepilogoIVA_recordset::requery()
int p = wrk.find("FROMDATE");
if (p > 0)
query << wrk.left(p) << _from_date.string();
query << wrk.sleft(p) << _from_date.string();
wrk.ltrim(p + 8);
p = wrk.find("TODATE");
if (p > 0)
{
query << wrk.left(p);
if (competenzaperiodoIVA() && !competenzadiversaIVA() && !registrazioneIVAritardo())
query << _to_date.string();
else
{
TDate to(_to_date);
to.set_day(31);
to.set_month(12);
if (_to_date.month() == 12)
to.addyear(1);
query << to.string();
}
query << wrk.mid(p + 6);
}
query << wrk.sleft(p) << _to_date.string()<< wrk.smid(p + 6);
TISAM_recordset recset(query);
@ -101,94 +86,62 @@ void TRiepilogoIVA_recordset::requery()
long conto = recset.get(RMI_CONTO).as_int();
long sottoconto = recset.get(RMI_SOTTOCONTO).as_int();
if (((gruppo >= _from_gruppo) && (gruppo <= _to_gruppo)) &&
((conto >= _from_conto) && (conto <= _to_conto)) &&
((sottoconto >= _from_sottoconto) && (conto <= _to_sottoconto)))
TRegistro reg(recset.get(reg_fieldname).as_string());
TipoIVA t = reg.iva();
TDate data = recset.get(datareg_fieldname).as_date();
const int meseliq = recset.get(meseliq_fieldname).as_int();
const TDate datadoc = recset.get(datadoc_fieldname).as_date();
const TipoIVA tipo = reg.iva(); // 1=Vendite; 2=Acquisti
const bool fatt_rit_2018 = recset.get(TOSTRING(LF_MOV) "." MOV_DATAREG).as_bool() && (data.year() >= 2018);
const int year_diff = data.year() - datadoc.year();
const bool fattritind = ((tipo == iva_acquisti) && fatt_rit_2018) && ((year_diff > 2) || ((year_diff >= 1) && data.month() >= 5));
const bool fattrit = ((tipo == iva_acquisti) && !fattritind && fatt_rit_2018) && (year_diff >= 1);
if (is_competenza())
{
TRegistro reg(recset.get(reg_fieldname).as_string());
TipoIVA t = reg.iva();
TDate data = recset.get(datareg_fieldname).as_date();
const int meseliq = recset.get(meseliq_fieldname).as_int();
const TDate datadoc = recset.get(datadoc_fieldname).as_date();
const TipoIVA tipo = reg.iva(); // 1=Vendite; 2=Acquisti
const bool fatt_rit_2018 = recset.get(TOSTRING(LF_MOV) "." MOV_DATAREG).as_bool() && (data.year() >= 2018);
const int year_diff = data.year() - datadoc.year();
const bool fattritind = ((tipo == iva_acquisti) && fatt_rit_2018) && ((year_diff > 2) || ((year_diff >= 1) && data.month() >= 5));
const bool fattrit = ((tipo == iva_acquisti) && !fattritind && fatt_rit_2018) && (year_diff >= 1);
if (is_competenza())
if (meseliq != 0)
{
if (meseliq != 0)
{
data.set_month(meseliq);
data.set_end_month();
if (competenzadiversaIVA())
{
if (data < _from_date || data > _to_date)
continue;
}
else
continue;
}
else
if (competenzadiversaIVA() && !competenzaperiodoIVA())
continue;
if (fattrit)
{
if (registrazioneIVAritardo())
{
if (!annuale() || _to_date.year() != datadoc.year())
continue;
}
else
continue;
}
else
if (competenzaperiodoIVA() && (data < _from_date || data > _to_date))
continue;
if (meseliq > data.month())
data.addyear(-1);
data.set_month(meseliq);
data.set_end_month();
}
else
{
if (fattrit)
{
if (!annuale() || _to_date.year() != datadoc.year())
continue;
}
else
if (data < _from_date || data > _to_date)
continue;
}
if (rec == NULL)
work_array.add(cod, rec = new TRiepilogoIVA_record(cod));
if (t == iva_acquisti)
{
real & r = rec->impacq();
r += recset.get(RMI_IMPONIBILE).as_real();
real & r1 = rec->ivaacq();
r1 += recset.get(RMI_IMPOSTA).as_real();
}
else
if (t == iva_vendite)
{
if (reg.corrispettivi())
{
real & r = rec->impcorr();
r += recset.get(RMI_IMPONIBILE).as_real();
real & r1 = rec->ivacorr();
r1 += recset.get(RMI_IMPOSTA).as_real();
}
else
{
real & r = rec->impven();
r += recset.get(RMI_IMPONIBILE).as_real();
real & r1 = rec->ivaven();
r1 += recset.get(RMI_IMPOSTA).as_real();
}
}
}
if (fattrit)
{
data.addyear(-1);
data.set_month(12);
data.set_end_month();
}
if (data.year() != _anno || (data.year() == _anno && (data.month() < _da_mese || data.month() > _a_mese)))
continue;
if (rec == NULL)
work_array.add(cod, rec = new TRiepilogoIVA_record(cod));
if (t == iva_acquisti)
{
real & r = rec->impacq();
r += recset.get(RMI_IMPONIBILE).as_real();
real & r1 = rec->ivaacq();
r1 += recset.get(RMI_IMPOSTA).as_real();
}
else
if (t == iva_vendite)
{
if (reg.corrispettivi())
{
real & r = rec->impcorr();
r += recset.get(RMI_IMPONIBILE).as_real();
real & r1 = rec->ivacorr();
r1 += recset.get(RMI_IMPOSTA).as_real();
}
else
{
real & r = rec->impven();
r += recset.get(RMI_IMPONIBILE).as_real();
real & r1 = rec->ivaven();
r1 += recset.get(RMI_IMPOSTA).as_real();
}
}
}
TString_array keys;
@ -317,8 +270,7 @@ const TVariant& TRiepilogoIVA_recordset::get(unsigned int column) const
}
TRiepilogoIVA_recordset::TRiepilogoIVA_recordset() : TRecordset(), _pos(0), _from_date(botime), _to_date(eotime),
_from_gruppo(0), _from_conto(0), _from_sottoconto(0L),
_to_gruppo(999), _to_conto(999), _to_sottoconto(999999L), _freezed(false), _annuale(false)
_freezed(false), _annuale(false), _anno(0), _da_mese(1), _a_mese(12)
{
add_field(_alfafld, 101, 4, COD);

View File

@ -21,18 +21,15 @@
class TRiepilogoIVA_recordset : public TRecordset
{
TArray _rows;
long _pos;
TDate _from_date;
TDate _to_date;
long _from_gruppo;
long _from_conto;
long _from_sottoconto;
long _to_gruppo;
long _to_conto;
long _to_sottoconto;
TArray _info;
bool _freezed;
bool _annuale;
long _pos;
TDate _from_date;
TDate _to_date;
int _anno;
int _da_mese;
int _a_mese;
bool _freezed;
bool _annuale;
protected:
virtual const TVariant& get_field(int num, const char* field) const;
@ -51,21 +48,20 @@ public:
// const TString& col2name(unsigned int column) const;
virtual const TVariant& get(unsigned int column) const;
TDate set_from(const TDate& from) { set_var("#FROMDATE", from, true); return _from_date = from; }
TDate set_to(const TDate& to) { set_var("#TODATE", to, true); return _to_date = to; }
int set_anno(const int anno) {set_var("#ANNO", (long) anno, true); return _anno = anno; };
void set_da_mese_var(const int mese) { set_var("#DAMESE", (long)mese, true); }
void set_a_mese_var(const int mese) { set_var("#AMESE", (long)mese, true); }
int set_da_mese(const int mese) { return _da_mese = mese; }
int set_a_mese(const int mese) { return _a_mese = mese; }
TDate set_from(const TDate& from) { return _from_date = from; }
TDate set_to(const TDate& to) { return _to_date = to; }
void set_from_conto(int gruppo, int conto, long sottoconto) { _from_gruppo = gruppo; _from_conto = conto; _from_sottoconto = sottoconto; }
void set_to_conto(int gruppo, int conto, long sottoconto) { _to_gruppo = gruppo; _to_conto = conto; _to_sottoconto = sottoconto; }
virtual bool set_competenzaperiodoIVA(bool on) { return true; }
virtual bool set_competenzadiversaIVA(bool on) { return false; }
virtual bool set_registrazioneIVAritardo(bool on) { return false; }
virtual bool set_annuale(bool on) { _annuale = on; return _annuale; }
virtual bool competenzaperiodoIVA() const { return true; }
virtual bool competenzadiversaIVA() const { return false; }
virtual bool registrazioneIVAritardo() const { return true; }
virtual bool annuale() const { return _annuale; }
bool set_annual(bool on) { return _annuale = on; }
bool annuale() const { return _annuale; }
virtual bool is_competenza() const { return false; }
int anno() const { return _anno; }
int da_mese() { return _da_mese; }
int a_mese() { return _a_mese; }
TRiepilogoIVA_recordset();
virtual ~TRiepilogoIVA_recordset() { }