Patch level : 12.0 922

Files correlati     : tp0.exe.exe tp0900ac.rep tp0900al.rep tp0900ca.rep tp0900le.rep tp0900pl.rep tp0900ve.rep vetbscc.msk
Commento            :

- Corretto controllo nel caso di esenzione e esposizione esenti.
- Modificato il report del modulo 6.1 per le descrizioni
- Aggiunto campo descrizione per dichiarazione nella tabella sotoocategorie CONAI
This commit is contained in:
Alessandro Bonazzi 2020-01-16 23:10:06 +01:00
parent f12ec74c61
commit 3ba5622b85
7 changed files with 105 additions and 72 deletions

View File

@ -93,17 +93,15 @@ TDichiarazione_CONAI_csv_recordset::TDichiarazione_CONAI_csv_recordset()
class TDichiarazione_CONAI : public TSkeleton_application
{
TLog_report * _log;
protected:
real clifo_conai(const TCli_for& clifo, const TCONAI_class conai_specie, TString& paiv, const TDocumento & doc, const int n_riga_generata = 0) const;
void elabora(const TMask& mask) const;
bool scrivi_csv(const TRectype& prima_riga, TDichiarazione_CONAI_csv_recordset& csv,
const TCONAI_class conai_specie, const TString & sottoclass,
const TString& conai_codart) const;
const TString& conai_codart, TLog_report &log) const;
void scrivi_csv_doc_con_riga_generata(const TDocumento& doc, const int n_riga_generata,
TDichiarazione_CONAI_csv_recordset& csv, const TCONAI_class conai_specie,
const TString & sottoclass) const;
const TString & sottoclass, TLog_report &log) const;
void scrivi_csv_doc_speciale(const TDocumento& doc, TDichiarazione_CONAI_csv_recordset& csv,
const TCONAI_class conai_specie, const TString & sottoclass,
const TString& conai_codart) const;
@ -151,14 +149,15 @@ real TDichiarazione_CONAI::clifo_conai(const TCli_for& clifo, const TCONAI_class
//riempie recordset con le righe CONAI del documento che contiene una riga generata CONAI
void TDichiarazione_CONAI::scrivi_csv_doc_con_riga_generata(const TDocumento& doc, const int n_riga_generata,
TDichiarazione_CONAI_csv_recordset& csv,
const TCONAI_class conai_specie, const TString & sottoclass) const
const TCONAI_class conai_specie, const TString & sottoclass,
TLog_report &log) const
{
//prende dalla riga i dati che gli servono per fare vari calcoli
const TRiga_documento& riga_generata = doc[n_riga_generata];
const TCodice_articolo conai_codart = riga_generata.get(RDOC_CODART); //questo ci serve per trovare le righe conai
const real totale_qta_assogg = riga_generata.get_real(RDOC_QTA); //questo ci serve per le quantita' assoggetate o no
TGeneric_distrib agip(totale_qta_assogg, 5); //distrib per ridistribuire le % dei quantitativi assoggetati
const bool esponi_esenti = ini_get_bool(CONFIG_DITTA, "ve", "ESPONIESENTI");
real totale_qta_assogg = riga_generata.get_real(RDOC_QTA); //questo ci serve per le quantita' assoggetate o no
TArray qta_AB_conai; //array con le quantita' conai totali (A+B)
//scopre se il doc e' una NAC
@ -173,7 +172,14 @@ void TDichiarazione_CONAI::scrivi_csv_doc_con_riga_generata(const TDocumento& do
//cerca la percentuale di esenzione conai sul cliente (controllo)
const real cfven_perc_conai = clifo_conai(clifo, conai_specie, clifo_paiv, doc, n_riga_generata);
//ciclo di creazione del distrib con le quote conai
if (esponi_esenti && cfven_perc_conai >= CENTO)
totale_qta_assogg = ZERO;
TGeneric_distrib agip(totale_qta_assogg, 5); //distrib per ridistribuire le % dei quantitativi assoggetati
if (doc.get_long(DOC_NDOC) == 28L)
int i = 1;
//ciclo di creazione del distrib con le quote conai
FOR_EACH_PHYSICAL_RDOC(doc, j, rdoc)
{
//quantita' totale conai (A + B) sul report
@ -198,11 +204,12 @@ void TDichiarazione_CONAI::scrivi_csv_doc_con_riga_generata(const TDocumento& do
}
}
}
if (doc.numero() == 441)
int i = 1;
const real qta_assoggettata_calcolata = agip.tot() * (CENTO - cfven_perc_conai) / CENTO;
real qta_assoggettata_calcolata = agip.tot();
qta_assoggettata_calcolata.round(5);
if (esponi_esenti && cfven_perc_conai >= CENTO)
qta_assoggettata_calcolata = ZERO;
if (qta_assoggettata_calcolata != totale_qta_assogg)
{
TString msg(TR("Documento"));
@ -210,7 +217,7 @@ void TDichiarazione_CONAI::scrivi_csv_doc_con_riga_generata(const TDocumento& do
msg << ' ' << doc.anno() << ' ' << doc.numerazione() << ' ' << doc.numero() << ' '
<< " - quantità assoggettata " << totale_qta_assogg.stringa()
<< " - quantità calcolata " << qta_assoggettata_calcolata.stringa();
_log->log(2, msg);
log.log(2, msg);
}
//ciclo di riempimento delle righe csv;scandisce solo l'array con i valori compilati
FOR_EACH_ARRAY_ROW(qta_AB_conai, i, obj)
@ -290,7 +297,12 @@ void TDichiarazione_CONAI::scrivi_csv_doc_con_riga_generata(const TDocumento& do
//percentuale di esenzione conai in cfven
csv.set(17, TVariant(cfven_perc_conai));
csv.set(18, cache().get("&VESCC", sottocat, "S0"));
TString descr = cache().get("&VESCC", sottocat, "S2");
if (descr.blank())
descr = cache().get("&VESCC", sottocat, "S0");
csv.set(18, descr);
}
}
}
@ -393,7 +405,11 @@ void TDichiarazione_CONAI::scrivi_csv_doc_speciale(const TDocumento& doc, TDichi
//percentuale di esenzione conai in cfven
csv.set(17, TVariant(cfven_perc_conai));
csv.set(18, cache().get("&VESCC", sottocat, "S0"));
TString descr = cache().get("&VESCC", sottocat, "S2");
if (descr.blank())
descr = cache().get("&VESCC", sottocat, "S0");
csv.set(18, descr);
}
}
}
@ -404,7 +420,7 @@ void TDichiarazione_CONAI::scrivi_csv_doc_speciale(const TDocumento& doc, TDichi
//..il metodo adatto
bool TDichiarazione_CONAI::scrivi_csv(const TRectype& prima_riga, TDichiarazione_CONAI_csv_recordset& csv,
const TCONAI_class conai_specie, const TString & sottoclass,
const TString& conai_codart) const
const TString& conai_codart, TLog_report &log) const
{
//crea la testata delle righedoc per poter fare vari calcoli (e intanto il tempo se ne va...)
const int anno = prima_riga.get_int(RDOC_ANNO);
@ -444,7 +460,7 @@ bool TDichiarazione_CONAI::scrivi_csv(const TRectype& prima_riga, TDichiarazione
}
if (n_riga_generata > 0)
scrivi_csv_doc_con_riga_generata(doc, n_riga_generata, csv, conai_specie, sottoclass);
scrivi_csv_doc_con_riga_generata(doc, n_riga_generata, csv, conai_specie, sottoclass, log);
else
scrivi_csv_doc_speciale(doc, csv, conai_specie, sottoclass, conai_codart);
@ -543,7 +559,8 @@ static int compare_csv_rows_datadoc(const TObject** o1, const TObject** o2)
//metodo di base per la ricerca delle righe documento che soddisfano i parametri dell'utonto
void TDichiarazione_CONAI::elabora(const TMask& mask) const
{
//Tanto per cominciare stabilisce il range di date...
TLog_report log("Errori Dichiarazione CONAI");
//Tanto per cominciare stabilisce il range di date...
const int anno = mask.get_int(F_ANNO);
TDate dataini(1, 1, anno);
@ -698,15 +715,15 @@ void TDichiarazione_CONAI::elabora(const TMask& mask) const
const long ndoc = rdoc.get(RDOC_NDOC).as_int();
if (ndoc != last_ndoc)
{
scrivi_csv(rdoc.cursor()->curr(), *csv, conai_specie, sottoclass, codart);
scrivi_csv(rdoc.cursor()->curr(), *csv, conai_specie, sottoclass, codart, log);
last_ndoc = ndoc;
}
} //for(bool ok = rdoc.move_first(..
} //for(bool ok = scc.move_first(..
} //FOR_EACH...
if (_log->errors() != 0)
if (log.errors() != 0)
{
_log->print_or_preview();
log.print_or_preview();
if (!yesno_box("Ci sono errori. Vuoi continuare ugualmente ?"))
return;
}
@ -777,8 +794,6 @@ bool TDichiarazione_CONAI::create()
if (!has_module(DCAUT))
return cantaccess_box(title());
_log = new TLog_report("Errori Dichiarazione CONAI");
return TSkeleton_application::create();
}

View File

@ -145,8 +145,7 @@
<section type="Head" level="1" pattern="1" />
<section type="Head" level="2" pattern="1">
<groupby>J</groupby>
<prescript description="H2 PRESCRIPT">0
#F2.101 !
<prescript description="H2 PRESCRIPT">0 #F2.101 !
0
#F2.102 !
0
@ -156,7 +155,7 @@
</section>
<section type="Body" pattern="1">
<field x="2" y="0.5" type="Immagine" width="90" height="55" pattern="1">
<source>"tp0900ac.png"</source>
<source>"tp0900pl.png"</source>
</field>
</section>
<section type="Body" level="1" pattern="1">
@ -176,7 +175,7 @@
<source>CODCLI</source>
</field>
<field type="Stringa" hidden="1" align="right" width="4" id="100" pattern="1">
<source>NUM(SOTTOCL)</source>
<source>NUM(SOTTOCL[3,4])</source>
<postscript description="B1.100 POSTSCRIPT">#THIS @
#F2.100 !</postscript>
</field>
@ -210,6 +209,12 @@ DUP
#F2.104
+!</postscript>
</field>
<field x="51" y="1" type="Stringa" hidden="1" bg_color="#F2F2F2" width="50" id="200" pattern="1">
<font face="Courier New" size="8" />
<source>DESCR</source>
<postscript description="B1.200 POSTSCRIPT">#THIS @
#F2.200 !</postscript>
</field>
</section>
<section y="41" type="Foot" pattern="1">
<font face="Courier New" size="8" />
@ -250,7 +255,7 @@ DUP
</section>
<section type="Foot" level="1" pattern="1" />
<section type="Foot" level="2" pattern="1">
<field type="Stringa" hidden="1" bg_color="#F2F2F2" width="4" id="100" pattern="1" text="SOTTOCL">
<field x="5" type="Stringa" bg_color="#F2F2F2" width="2" id="100" pattern="1">
<font face="Arial Narrow" size="8" />
</field>
<field x="29.25" type="Numero" align="right" width="10" id="101" pattern="1" hide_zero="1" text="#####@,@@@">
@ -303,10 +308,8 @@ DUP
*
#THIS !</prescript>
</field>
<field type="Stringa" bg_color="#F2F2F2" width="28" id="200" pattern="1">
<field x="12" type="Stringa" bg_color="#F2F2F2" dynamic_height="1" width="18" height="3" id="200" pattern="1">
<font face="Courier New" size="8" />
<prescript description="F2.200 PRESCRIPT">MESSAGE ISAMREAD,163,MOD='VE'!COD='SCC'!CODTAB=#100,S0
</prescript>
</field>
</section>
</report>

View File

@ -145,8 +145,7 @@
<section type="Head" level="1" pattern="1" />
<section type="Head" level="2" pattern="1">
<groupby>J</groupby>
<prescript description="H2 PRESCRIPT">0
#F2.101 !
<prescript description="H2 PRESCRIPT">0 #F2.101 !
0
#F2.102 !
0
@ -156,7 +155,7 @@
</section>
<section type="Body" pattern="1">
<field x="2" y="0.5" type="Immagine" width="90" height="55" pattern="1">
<source>"tp0900al.png"</source>
<source>"tp0900pl.png"</source>
</field>
</section>
<section type="Body" level="1" pattern="1">
@ -176,7 +175,7 @@
<source>CODCLI</source>
</field>
<field type="Stringa" hidden="1" align="right" width="4" id="100" pattern="1">
<source>NUM(SOTTOCL)</source>
<source>NUM(SOTTOCL[3,4])</source>
<postscript description="B1.100 POSTSCRIPT">#THIS @
#F2.100 !</postscript>
</field>
@ -210,6 +209,12 @@ DUP
#F2.104
+!</postscript>
</field>
<field x="51" y="1" type="Stringa" hidden="1" bg_color="#F2F2F2" width="50" id="200" pattern="1">
<font face="Courier New" size="8" />
<source>DESCR</source>
<postscript description="B1.200 POSTSCRIPT">#THIS @
#F2.200 !</postscript>
</field>
</section>
<section y="41" type="Foot" pattern="1">
<font face="Courier New" size="8" />
@ -250,7 +255,7 @@ DUP
</section>
<section type="Foot" level="1" pattern="1" />
<section type="Foot" level="2" pattern="1">
<field type="Stringa" hidden="1" bg_color="#F2F2F2" width="4" id="100" pattern="1" text="SOTTOCL">
<field x="5" type="Stringa" bg_color="#F2F2F2" width="2" id="100" pattern="1">
<font face="Arial Narrow" size="8" />
</field>
<field x="29.25" type="Numero" align="right" width="10" id="101" pattern="1" hide_zero="1" text="#####@,@@@">
@ -303,10 +308,8 @@ DUP
*
#THIS !</prescript>
</field>
<field type="Stringa" bg_color="#F2F2F2" width="28" id="200" pattern="1">
<field x="12" type="Stringa" bg_color="#F2F2F2" dynamic_height="1" width="18" height="3" id="200" pattern="1">
<font face="Courier New" size="8" />
<prescript description="F2.200 PRESCRIPT">MESSAGE ISAMREAD,163,MOD='VE'!COD='SCC'!CODTAB=#100,S0
</prescript>
</field>
</section>
</report>

View File

@ -145,8 +145,7 @@
<section type="Head" level="1" pattern="1" />
<section type="Head" level="2" pattern="1">
<groupby>J</groupby>
<prescript description="H2 PRESCRIPT">0
#F2.101 !
<prescript description="H2 PRESCRIPT">0 #F2.101 !
0
#F2.102 !
0
@ -156,7 +155,7 @@
</section>
<section type="Body" pattern="1">
<field x="2" y="0.5" type="Immagine" width="90" height="55" pattern="1">
<source>"tp0900ca.png"</source>
<source>"tp0900pl.png"</source>
</field>
</section>
<section type="Body" level="1" pattern="1">
@ -176,7 +175,7 @@
<source>CODCLI</source>
</field>
<field type="Stringa" hidden="1" align="right" width="4" id="100" pattern="1">
<source>NUM(SOTTOCL)</source>
<source>NUM(SOTTOCL[3,4])</source>
<postscript description="B1.100 POSTSCRIPT">#THIS @
#F2.100 !</postscript>
</field>
@ -210,6 +209,12 @@ DUP
#F2.104
+!</postscript>
</field>
<field x="51" y="1" type="Stringa" hidden="1" bg_color="#F2F2F2" width="50" id="200" pattern="1">
<font face="Courier New" size="8" />
<source>DESCR</source>
<postscript description="B1.200 POSTSCRIPT">#THIS @
#F2.200 !</postscript>
</field>
</section>
<section y="41" type="Foot" pattern="1">
<font face="Courier New" size="8" />
@ -250,7 +255,7 @@ DUP
</section>
<section type="Foot" level="1" pattern="1" />
<section type="Foot" level="2" pattern="1">
<field type="Stringa" hidden="1" bg_color="#F2F2F2" width="4" id="100" pattern="1" text="SOTTOCL">
<field x="5" type="Stringa" bg_color="#F2F2F2" width="2" id="100" pattern="1">
<font face="Arial Narrow" size="8" />
</field>
<field x="29.25" type="Numero" align="right" width="10" id="101" pattern="1" hide_zero="1" text="#####@,@@@">
@ -303,10 +308,8 @@ DUP
*
#THIS !</prescript>
</field>
<field type="Stringa" bg_color="#F2F2F2" width="28" id="200" pattern="1">
<field x="12" type="Stringa" bg_color="#F2F2F2" dynamic_height="1" width="18" height="3" id="200" pattern="1">
<font face="Courier New" size="8" />
<prescript description="F2.200 PRESCRIPT">MESSAGE ISAMREAD,163,MOD='VE'!COD='SCC'!CODTAB=#100,S0
</prescript>
</field>
</section>
</report>

View File

@ -145,8 +145,7 @@
<section type="Head" level="1" pattern="1" />
<section type="Head" level="2" pattern="1">
<groupby>J</groupby>
<prescript description="H2 PRESCRIPT">0
#F2.101 !
<prescript description="H2 PRESCRIPT">0 #F2.101 !
0
#F2.102 !
0
@ -156,7 +155,7 @@
</section>
<section type="Body" pattern="1">
<field x="2" y="0.5" type="Immagine" width="90" height="55" pattern="1">
<source>"tp0900le.png"</source>
<source>"tp0900pl.png"</source>
</field>
</section>
<section type="Body" level="1" pattern="1">
@ -176,7 +175,7 @@
<source>CODCLI</source>
</field>
<field type="Stringa" hidden="1" align="right" width="4" id="100" pattern="1">
<source>NUM(SOTTOCL)</source>
<source>NUM(SOTTOCL[3,4])</source>
<postscript description="B1.100 POSTSCRIPT">#THIS @
#F2.100 !</postscript>
</field>
@ -210,6 +209,12 @@ DUP
#F2.104
+!</postscript>
</field>
<field x="51" y="1" type="Stringa" hidden="1" bg_color="#F2F2F2" width="50" id="200" pattern="1">
<font face="Courier New" size="8" />
<source>DESCR</source>
<postscript description="B1.200 POSTSCRIPT">#THIS @
#F2.200 !</postscript>
</field>
</section>
<section y="41" type="Foot" pattern="1">
<font face="Courier New" size="8" />
@ -250,7 +255,7 @@ DUP
</section>
<section type="Foot" level="1" pattern="1" />
<section type="Foot" level="2" pattern="1">
<field type="Stringa" hidden="1" bg_color="#F2F2F2" width="4" id="100" pattern="1" text="SOTTOCL">
<field x="5" type="Stringa" bg_color="#F2F2F2" width="2" id="100" pattern="1">
<font face="Arial Narrow" size="8" />
</field>
<field x="29.25" type="Numero" align="right" width="10" id="101" pattern="1" hide_zero="1" text="#####@,@@@">
@ -303,10 +308,8 @@ DUP
*
#THIS !</prescript>
</field>
<field type="Stringa" bg_color="#F2F2F2" width="28" id="200" pattern="1">
<field x="12" type="Stringa" bg_color="#F2F2F2" dynamic_height="1" width="18" height="3" id="200" pattern="1">
<font face="Courier New" size="8" />
<prescript description="F2.200 PRESCRIPT">MESSAGE ISAMREAD,163,MOD='VE'!COD='SCC'!CODTAB=#100,S0
</prescript>
</field>
</section>
</report>

View File

@ -145,8 +145,7 @@
<section type="Head" level="1" pattern="1" />
<section type="Head" level="2" pattern="1">
<groupby>J</groupby>
<prescript description="H2 PRESCRIPT">0
#F2.101 !
<prescript description="H2 PRESCRIPT">0 #F2.101 !
0
#F2.102 !
0
@ -176,7 +175,7 @@
<source>CODCLI</source>
</field>
<field type="Stringa" hidden="1" align="right" width="4" id="100" pattern="1">
<source>NUM(SOTTOCL)</source>
<source>NUM(SOTTOCL[3,4])</source>
<postscript description="B1.100 POSTSCRIPT">#THIS @
#F2.100 !</postscript>
</field>
@ -210,6 +209,12 @@ DUP
#F2.104
+!</postscript>
</field>
<field x="51" y="1" type="Stringa" hidden="1" bg_color="#F2F2F2" width="50" id="200" pattern="1">
<font face="Courier New" size="8" />
<source>DESCR</source>
<postscript description="B1.200 POSTSCRIPT">#THIS @
#F2.200 !</postscript>
</field>
</section>
<section y="41" type="Foot" pattern="1">
<font face="Courier New" size="8" />
@ -250,7 +255,7 @@ DUP
</section>
<section type="Foot" level="1" pattern="1" />
<section type="Foot" level="2" pattern="1">
<field type="Stringa" hidden="1" bg_color="#F2F2F2" width="4" id="100" pattern="1" text="SOTTOCL">
<field x="5" type="Stringa" bg_color="#F2F2F2" width="2" id="100" pattern="1">
<font face="Arial Narrow" size="8" />
</field>
<field x="29.25" type="Numero" align="right" width="10" id="101" pattern="1" hide_zero="1" text="#####@,@@@">
@ -303,10 +308,8 @@ DUP
*
#THIS !</prescript>
</field>
<field type="Stringa" bg_color="#F2F2F2" width="28" id="200" pattern="1">
<field x="12" type="Stringa" bg_color="#F2F2F2" dynamic_height="1" width="18" height="3" id="200" pattern="1">
<font face="Courier New" size="8" />
<prescript description="F2.200 PRESCRIPT">MESSAGE ISAMREAD,163,MOD='VE'!COD='SCC'!CODTAB=#100,S0
</prescript>
</field>
</section>
</report>

View File

@ -145,8 +145,7 @@
<section type="Head" level="1" pattern="1" />
<section type="Head" level="2" pattern="1">
<groupby>J</groupby>
<prescript description="H2 PRESCRIPT">0
#F2.101 !
<prescript description="H2 PRESCRIPT">0 #F2.101 !
0
#F2.102 !
0
@ -156,7 +155,7 @@
</section>
<section type="Body" pattern="1">
<field x="2" y="0.5" type="Immagine" width="90" height="55" pattern="1">
<source>"tp0900ve.png"</source>
<source>"tp0900pl.png"</source>
</field>
</section>
<section type="Body" level="1" pattern="1">
@ -176,7 +175,7 @@
<source>CODCLI</source>
</field>
<field type="Stringa" hidden="1" align="right" width="4" id="100" pattern="1">
<source>NUM(SOTTOCL)</source>
<source>NUM(SOTTOCL[3,4])</source>
<postscript description="B1.100 POSTSCRIPT">#THIS @
#F2.100 !</postscript>
</field>
@ -210,6 +209,12 @@ DUP
#F2.104
+!</postscript>
</field>
<field x="51" y="1" type="Stringa" hidden="1" bg_color="#F2F2F2" width="50" id="200" pattern="1">
<font face="Courier New" size="8" />
<source>DESCR</source>
<postscript description="B1.200 POSTSCRIPT">#THIS @
#F2.200 !</postscript>
</field>
</section>
<section y="41" type="Foot" pattern="1">
<font face="Courier New" size="8" />
@ -250,7 +255,7 @@ DUP
</section>
<section type="Foot" level="1" pattern="1" />
<section type="Foot" level="2" pattern="1">
<field type="Stringa" hidden="1" bg_color="#F2F2F2" width="4" id="100" pattern="1" text="SOTTOCL">
<field x="5" type="Stringa" bg_color="#F2F2F2" width="2" id="100" pattern="1">
<font face="Arial Narrow" size="8" />
</field>
<field x="29.25" type="Numero" align="right" width="10" id="101" pattern="1" hide_zero="1" text="#####@,@@@">
@ -303,10 +308,8 @@ DUP
*
#THIS !</prescript>
</field>
<field type="Stringa" bg_color="#F2F2F2" width="28" id="200" pattern="1">
<field x="12" type="Stringa" bg_color="#F2F2F2" dynamic_height="1" width="18" height="3" id="200" pattern="1">
<font face="Courier New" size="8" />
<prescript description="F2.200 PRESCRIPT">MESSAGE ISAMREAD,163,MOD='VE'!COD='SCC'!CODTAB=#100,S0
</prescript>
</field>
</section>
</report>