Patch level : 12.0 716
Files correlati : cg0.exe cg4.exe cgmenu.men cg0800a.msk cg4b00a.msk Commento : Stampa progressivi IVA Stampa progressivi IVA per competenza
This commit is contained in:
parent
f86fab64d0
commit
7e0a7ceed3
@ -79,6 +79,7 @@ void TRiepilogoIVA_app::main_loop()
|
||||
{
|
||||
damese = 1;
|
||||
amese = 12;
|
||||
recset->set_annuale(true);
|
||||
}
|
||||
|
||||
const TDate da(1, damese, anno);
|
||||
|
@ -78,17 +78,19 @@ bool TRiepilogoIVA_mask::on_field_event(TOperable_field& o, TField_event e, long
|
||||
|
||||
class TRiepilogoIVAcompetenza_recordset : public TRiepilogoIVA_recordset
|
||||
{
|
||||
bool _senzacompetenza;
|
||||
bool _competenzaperiodo;
|
||||
bool _competenzadiversa;
|
||||
bool _registrazioneritardo;
|
||||
|
||||
public:
|
||||
virtual bool set_senzacompetenzaIVA(bool on) { _senzacompetenza = on; return on; }
|
||||
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 senzacompetenzaIVA() { return _senzacompetenza; }
|
||||
virtual bool competenzadiversaIVA() { return _competenzadiversa; }
|
||||
virtual bool registrazioneIVAritardo() { return _registrazioneritardo; }
|
||||
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() { }
|
||||
@ -120,16 +122,18 @@ void TRiepilogoIVA_app::main_loop()
|
||||
if (recset != NULL)
|
||||
{
|
||||
recset->freeze();
|
||||
recset->set_senzacompetenzaIVA(m.get_bool(F_NOCOMP));
|
||||
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)
|
||||
);
|
||||
|
||||
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("#NOCOMP", m.get_bool(F_NOCOMP), true);
|
||||
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);
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define F_ASOTTOC 110
|
||||
#define F_DADESCR 111
|
||||
#define F_ADESCR 112
|
||||
#define F_NOCOMP 113
|
||||
#define F_COMPUG 113
|
||||
#define F_COMPDIV 114
|
||||
#define F_REGRIT 115
|
||||
|
||||
|
@ -21,78 +21,105 @@
|
||||
<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>
|
||||
<field x="38.5" y="1" type="Data" width="20" height="2" pattern="1">
|
||||
<field x="38.5" y="1" type="Data" width="25" height="2" pattern="1">
|
||||
<font face="Courier New" bold="1" size="14" />
|
||||
<source>#FROMDATE</source>
|
||||
</field>
|
||||
<field x="59.5" y="1" type="Testo" width="4" height="2" pattern="1" text="al">
|
||||
<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>
|
||||
<field x="63.5" y="1" type="Data" width="20" height="2" pattern="1">
|
||||
<field x="72.5" y="1" type="Data" width="25" height="2" pattern="1">
|
||||
<font face="Courier New" bold="1" size="14" />
|
||||
<source>#TODATE</source>
|
||||
</field>
|
||||
<field x="86" y="1" type="Testo" width="8" height="2" pattern="1" text="IVA">
|
||||
<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="96" y="1" type="Array" width="30" height="2" pattern="1">
|
||||
<field x="40" y="3" type="Testo" width="20" height="2" pattern="1" text="corrente">
|
||||
<font face="Courier New" bold="1" size="14" />
|
||||
<source>#COMPIVA</source>
|
||||
<list>
|
||||
<li Value="competenza attuale" Code="1" />
|
||||
<li Value="competenza precedente" Code="2" />
|
||||
<li Value="senza competenza" Code="3" />
|
||||
</list>
|
||||
<prescript description="H0.0 PRESCRIPT">#THIS
|
||||
#COMPUG @
|
||||
0
|
||||
=
|
||||
IF
|
||||
HIDE
|
||||
ELSE
|
||||
SHOW
|
||||
THEN</prescript>
|
||||
</field>
|
||||
<field x="7" y="3" type="Testo" width="15" height="2" pattern="1" text="Da conto">
|
||||
<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="24" y="3" type="Numero" align="right" width="6" height="2" pattern="1">
|
||||
<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="31" y="3" type="Numero" align="right" width="6" height="2" pattern="1">
|
||||
<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="38" y="3" type="Numero" align="right" width="12" height="2" pattern="1">
|
||||
<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="3" type="Testo" width="15" height="2" pattern="1" text="A conto">
|
||||
<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="3" type="Numero" align="right" width="6" height="2" pattern="1">
|
||||
<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="3" type="Numero" align="right" width="6" height="2" pattern="1">
|
||||
<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="3" type="Numero" align="right" width="12" height="2" pattern="1">
|
||||
<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="5" type="Testo" width="10" pattern="1" text="Vendite">
|
||||
<field x="63" y="7.25" type="Testo" width="10" pattern="1" text="Vendite">
|
||||
<font face="Courier New" size="10" />
|
||||
</field>
|
||||
<field x="88" y="5" type="Testo" width="18" pattern="1" text="Corrispettivi">
|
||||
<field x="88" y="7.25" type="Testo" width="18" pattern="1" text="Corrispettivi">
|
||||
<font face="Courier New" size="10" />
|
||||
</field>
|
||||
<field x="117.5" y="5" type="Testo" width="12" pattern="1" text="Acquisti">
|
||||
<field x="117.5" y="7.25" type="Testo" width="12" pattern="1" text="Acquisti">
|
||||
<font face="Courier New" size="10" />
|
||||
</field>
|
||||
<field x="53" y="6" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
|
||||
<field x="53" y="8.25" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
|
||||
<font face="Courier New" size="10" />
|
||||
</field>
|
||||
<field x="81" y="6" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
|
||||
<field x="81" y="8.25" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
|
||||
<font face="Courier New" size="10" />
|
||||
</field>
|
||||
<field x="108" y="6" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
|
||||
<field x="108" y="8.25" type="Testo" width="30" pattern="1" text=" Imponibile Imposta">
|
||||
<font face="Courier New" size="10" />
|
||||
</field>
|
||||
<field border="2" x="4" y="7.5" type="Linea" width="134" height="0" pattern="1" />
|
||||
<field border="2" x="4" y="9.75" type="Linea" width="134" height="0" pattern="1" />
|
||||
</section>
|
||||
<section type="Head" level="1" pattern="1" />
|
||||
<section type="Body" pattern="1" />
|
||||
|
@ -176,14 +176,14 @@ BEGIN
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
BOOLEAN F_NOCOMP
|
||||
BOOLEAN F_COMPUG
|
||||
BEGIN
|
||||
PROMPT 2 15 "Movimenti senza competenza diversa"
|
||||
PROMPT 2 15 "Movimenti con competenza uguale alla registrazione"
|
||||
END
|
||||
|
||||
BOOLEAN F_COMPDIV
|
||||
BEGIN
|
||||
PROMPT 2 17 "Movimenti con competenza nel periodo"
|
||||
PROMPT 2 17 "Movimenti con competenza diversa dalla registrazione"
|
||||
END
|
||||
|
||||
BOOLEAN F_REGRIT
|
||||
|
@ -1,4 +1,16 @@
|
||||
#include "cglib05.h"
|
||||
#include <utility.h>
|
||||
|
||||
enum tiporeg {
|
||||
vendita = 1,
|
||||
acquisto = 2,
|
||||
riepilogativo = 3,
|
||||
incassi = 4,
|
||||
giornale = 5,
|
||||
sociale = 6,
|
||||
cespiti = 7
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRiepilogoIVA_recordset
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -51,7 +63,7 @@ void TRiepilogoIVA_recordset::requery()
|
||||
TAssoc_array work_array;
|
||||
TString16 reg_fieldname; reg_fieldname << LF_MOV << "." << MOV_REG;
|
||||
TString16 datareg_fieldname; datareg_fieldname << LF_MOV << "." << MOV_DATAREG;
|
||||
TString16 datacomp_fieldname; datacomp_fieldname << LF_MOV << "." << MOV_MESELIQ;
|
||||
TString16 datadoc_fieldname; datadoc_fieldname << LF_MOV << "." << MOV_DATADOC;
|
||||
TString16 meseliq_fieldname; meseliq_fieldname << LF_MOV << "." << MOV_MESELIQ;
|
||||
|
||||
int p = wrk.find("FROMDATE");
|
||||
@ -64,7 +76,7 @@ void TRiepilogoIVA_recordset::requery()
|
||||
if (p > 0)
|
||||
{
|
||||
query << wrk.left(p);
|
||||
if (senzacompetenzaIVA() && !competenzadiversaIVA() && !registrazioneIVAritardo())
|
||||
if (competenzaperiodoIVA() && !competenzadiversaIVA() && !registrazioneIVAritardo())
|
||||
query << _to_date.string();
|
||||
else
|
||||
{
|
||||
@ -93,31 +105,57 @@ void TRiepilogoIVA_recordset::requery()
|
||||
((conto >= _from_conto) && (conto <= _to_conto)) &&
|
||||
((sottoconto >= _from_sottoconto) && (conto <= _to_sottoconto)))
|
||||
{
|
||||
TRegistro codreg(recset.get(reg_fieldname).as_string());
|
||||
|
||||
TipoIVA t = codreg.iva();
|
||||
|
||||
// filtro 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 (competenzadiversaIVA())
|
||||
if (is_competenza())
|
||||
{
|
||||
const int meseliq = recset.get(meseliq_fieldname).as_int();
|
||||
|
||||
if (meseliq != 0)
|
||||
{
|
||||
data.set_month(meseliq);
|
||||
data.set_end_month();
|
||||
if (data < _from_date || data > _to_date)
|
||||
data.set_end_month();
|
||||
if (competenzadiversaIVA())
|
||||
{
|
||||
if (data < _from_date || data > _to_date)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
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 (registrazioneIVAritardo())
|
||||
else
|
||||
{
|
||||
TDate datacomp = recset.get(datacomp_fieldname).as_date();
|
||||
if (fattrit)
|
||||
{
|
||||
if (!annuale() || _to_date.year() != datadoc.year())
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (data < _from_date || data > _to_date)
|
||||
continue;
|
||||
}
|
||||
if (senzacompetenzaIVA() && (data < _from_date || data > _to_date))
|
||||
continue;
|
||||
|
||||
if (rec == NULL)
|
||||
work_array.add(cod, rec = new TRiepilogoIVA_record(cod));
|
||||
@ -131,7 +169,7 @@ void TRiepilogoIVA_recordset::requery()
|
||||
else
|
||||
if (t == iva_vendite)
|
||||
{
|
||||
if (codreg.corrispettivi())
|
||||
if (reg.corrispettivi())
|
||||
{
|
||||
real & r = rec->impcorr();
|
||||
r += recset.get(RMI_IMPONIBILE).as_real();
|
||||
@ -275,9 +313,9 @@ 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)
|
||||
_from_gruppo(0), _from_conto(0), _from_sottoconto(0L),
|
||||
_to_gruppo(999), _to_conto(999), _to_sottoconto(999999L), _freezed(false), _annuale(false)
|
||||
|
||||
{
|
||||
add_field(_alfafld, 101, 4, COD);
|
||||
add_field(_alfafld, 102, 50, DESC);
|
||||
|
@ -32,6 +32,7 @@ class TRiepilogoIVA_recordset : public TRecordset
|
||||
long _to_sottoconto;
|
||||
TArray _info;
|
||||
bool _freezed;
|
||||
bool _annuale;
|
||||
|
||||
protected:
|
||||
virtual const TVariant& get_field(int num, const char* field) const;
|
||||
@ -56,12 +57,15 @@ public:
|
||||
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_senzacompetenzaIVA(bool on) { return true; }
|
||||
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 senzacompetenzaIVA() { return true; }
|
||||
virtual bool competenzadiversaIVA() { return false; }
|
||||
virtual bool registrazioneIVAritardo() { 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; }
|
||||
virtual bool is_competenza() const { return false; }
|
||||
|
||||
TRiepilogoIVA_recordset();
|
||||
virtual ~TRiepilogoIVA_recordset() { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user