Patch level :10.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
stampa fatture per imponibile limite


git-svn-id: svn://10.65.10.50/branches/R_10_00@21820 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2011-03-23 16:19:49 +00:00
parent 8bc2cbe968
commit 3ac4b35834
2 changed files with 106 additions and 17 deletions

View File

@ -1,12 +1,52 @@
#include <applicat.h>
#include <automask.h>
#include <recarray.h>
#include <relation.h>
#include <report.h>
#include <strings.h>
#include <mov.h>
#include <rmoviva.h>
#include "../ba/ba8500.h"
#include "../cg/cg7200a.h"
///////////////////////////////////////////////////////////
// Recordset
///////////////////////////////////////////////////////////
class TPrint_x_imponibile_recordset : public TISAM_recordset
{
static real _limite;
protected:
static bool filtro(const TRelation* rel);
virtual void set_custom_filter(TCursor& cursor) const;
public:
TPrint_x_imponibile_recordset(const TString& sql) : TISAM_recordset(sql) {}
};
real TPrint_x_imponibile_recordset::_limite;
bool TPrint_x_imponibile_recordset::filtro(const TRelation* rel)
{
const TRectype& rec = rel->curr();
const TString& keytok = rec.get(MOV_NUMREG);
TRecord_array righe_iva(keytok, LF_RMOVIVA);
real tot_imponibile;
for (int r = righe_iva.last_row(); r > 0; r = righe_iva.pred_row(r))
tot_imponibile += righe_iva.row(r).get_real(RMI_IMPONIBILE);
return tot_imponibile > _limite;
}
void TPrint_x_imponibile_recordset::set_custom_filter(TCursor& cursor) const
{
_limite = get("#LIMITE").as_real();
cursor.set_filterfunction(filtro);
}
///////////////////////////////////////////////////////////
// Report
///////////////////////////////////////////////////////////
@ -17,9 +57,16 @@ protected:
virtual bool use_mask() { return false; }
public:
virtual bool set_recordset(const TString& sql);
TPrint_x_imponibile_report();
};
bool TPrint_x_imponibile_report::set_recordset(const TString& sql)
{
TPrint_x_imponibile_recordset* recset = new TPrint_x_imponibile_recordset(sql);
return TReport::set_recordset(recset);
}
TPrint_x_imponibile_report::TPrint_x_imponibile_report()
{
load("cg7200a");
@ -49,25 +96,43 @@ void TPrint_x_imponibile_mask::elabora()
const int anno = get_int(F_ANNO);
const TDate dataini = get_date(F_DATAINI);
const TDate datafin = get_date(F_DATAFIN);
const real limite = get_real(F_LIMITE);
const real limite_farlocco = limite * 0.60;
TString query;
query << "USE MOV KEY 3";
query << "\nSELECT (TOTDOC>=" << limite_farlocco.integer() << ")";
if (tipodate == 'R') //per data di 'R'egistrazione
{
query << "USE MOV KEY 3";
query << "\nSELECT (ANNOIVA=" << anno << ")";
if (codcf <= 0L)
query << "&&(BETWEEN(DATAREG," << dataini.date2ansi() << "," << datafin.date2ansi() << "))";
query << "\nFROM TIPO=" << tipoelenco;
query << " CODCF=" << codcf;
query << " DATAREG=" << dataini.date2ansi();
if (codcf > 0L)
{
query << " CODCF=" << codcf;
query << " DATAREG=" << dataini.date2ansi();
}
query << "\nTO TIPO=" << tipoelenco;
query << " CODCF=" << (codcf > 0L ? codcf : 999999);
query << " DATAREG=" << datafin.date2ansi();
if (codcf > 0L)
{
query << " CODCF=" << codcf;
query << " DATAREG=" << datafin.date2ansi();
}
}
else //per data 'D'ocumento
{
query << "&&(BETWEEN(DATADOC," << dataini.date2ansi() << "," << datafin.date2ansi() << "))";
query << "\nBY CODCF DATADOC";
query << "\nFROM TIPO=" << tipoelenco;
if (codcf > 0L)
query << " CODCF=" << codcf;
query << "\nTO TIPO=" << tipoelenco;
if (codcf > 0L)
query << " CODCF=" << codcf;
}
TPrint_x_imponibile_report rep;

View File

@ -95,7 +95,7 @@ THEN</prescript>
<font face="Arial" bold="1" size="8" />
<prescript description="H2 PRESCRIPT">MESSAGE RESET,F2</prescript>
<field x="8" y="0.75" type="Stringa" width="50" pattern="1">
<prescript description="H2.0 PRESCRIPT">MESSAGE ISAMREAD,20,TIPOCF=#H1.101!CODCF=#151,RAGSOC</prescript>
<prescript>MESSAGE ISAMREAD,20,TIPOCF=#H1.101!CODCF=#151,RAGSOC</prescript>
</field>
<field x="1" y="0.75" type="Numero" align="right" width="6" id="151" pattern="1">
<source>CODCF</source>
@ -110,22 +110,29 @@ THEN</prescript>
<sql>USE RMOVIVA
FROM NUMREG=#PARENT.NUMREG
TO NUMREG=#PARENT.NUMREG</sql>
<field x="3" type="Numero" align="right" width="3" pattern="1">
<field x="1" type="Numero" align="right" width="3" pattern="1">
<source>NUMRIG</source>
</field>
<field x="7" type="Valuta" align="right" width="10" pattern="1" text="#########,@@">
<field x="5" type="Valuta" align="right" width="10" id="241" pattern="1" text="#########,@@">
<source>IMPONIBILE</source>
</field>
<field x="18" type="Valuta" align="right" width="10" pattern="1" text="#########,@@">
<field x="16" type="Valuta" align="right" width="10" id="242" pattern="1" text="#########,@@">
<source>IMPOSTA</source>
</field>
<field x="29" type="Stringa" width="4" pattern="1">
<field x="30" type="Array" width="15" id="244" pattern="1">
<source>PARENT.TIPODOC</source>
<list>
<li Value="Normale" Code=" ">251 ENABLE</li>
<li Value="Scontrino" Code="SC">251 DISABLE "IMPONIBILE" @ "F11.235" +! "IMPOSTA" @ "F11.236" +!</li>
</list>
</field>
<field x="50" type="Stringa" width="4" id="250" pattern="1">
<source>CODIVA</source>
</field>
<field x="34" type="Array" width="15" pattern="1">
<prescript description="B11.0 PRESCRIPT">MESSAGE TABLEREAD,%IVA,CODIVA,S1</prescript>
<field x="55" type="Array" width="15" id="251" pattern="1">
<prescript description="B11.251 PRESCRIPT">MESSAGE TABLEREAD,%IVA,CODIVA,S1</prescript>
<list>
<li Value="Normale">"IMPONIBILE" @ "F11.201" +! "IMPOSTA" @ "F11.202" +!</li>
<li Value="Normale" Code=" ">"IMPONIBILE" @ "F11.201" +! "IMPOSTA" @ "F11.202" +!</li>
<li Value="Non soggetto" Code="NS">"IMPONIBILE" @ "F11.211" +! "IMPOSTA" @ "F11.212" +!</li>
<li Value="Esente" Code="ES">"IMPONIBILE" @ "F11.221" +! "IMPOSTA" @ "F11.222" +!</li>
<li Value="Non imponibile" Code="NI">"IMPONIBILE" @ "F11.231" +! "IMPOSTA" @ "F11.232" +!</li>
@ -215,6 +222,20 @@ THEN</prescript>
"H1.102" @ &#3E;= IF
#THIS @
"F1.232" +!
THEN</prescript>
</field>
<field x="84" y="1" type="Valuta" hidden="1" align="right" width="10" id="235" pattern="1" text="#########,@@">
<prescript description="F11.235 PRESCRIPT">#241 @
"H1.102" @ &#3E;= IF
#THIS @
"F1.235" +!
THEN</prescript>
</field>
<field x="94" y="1" type="Valuta" hidden="1" align="right" width="10" id="236" pattern="1" text="#########,@@">
<prescript description="F11.236 PRESCRIPT">#241 @
"H1.102" @ &#3E;= IF
#THIS @
"F1.236" +!
THEN</prescript>
</field>
<field x="51.5" type="Stringa" width="3.5" id="239" pattern="1">
@ -249,7 +270,7 @@ THEN</prescript>
<field border="1" x="1" y="0.25" type="Linea" width="117" height="0" pattern="1" />
<field x="103" y="0.75" type="Testo" width="5" pattern="1" text="Pag." />
<field x="108" y="0.75" type="Numero" align="right" width="4" pattern="1">
<source>REPORT.PAGE</source>
<source>#REPORT.PAGE</source>
</field>
</section>
<section type="Foot" level="1" pattern="1">
@ -265,6 +286,7 @@ THEN</prescript>
<field x="73" y="4.75" type="Testo" width="14" pattern="1" text="Non soggetto" />
<field x="73" y="5.75" type="Testo" width="14" pattern="1" text="Esente" />
<field x="73" y="6.75" type="Testo" width="14" pattern="1" text="Non imponibile" />
<field x="73" y="7.75" type="Testo" width="14" pattern="1" text="Scontrini" />
<field x="89" y="3.75" type="Valuta" align="right" width="13" id="201" pattern="1" text="#########,@@" />
<field x="102" y="3.75" type="Valuta" align="right" width="13" id="202" pattern="1" text="#########,@@" />
<field x="89" y="4.75" type="Valuta" align="right" width="13" id="211" pattern="1" text="#########,@@" />
@ -273,6 +295,8 @@ THEN</prescript>
<field x="102" y="5.75" type="Valuta" align="right" width="13" id="222" pattern="1" text="#########,@@" />
<field x="89" y="6.75" type="Valuta" align="right" width="13" id="231" pattern="1" text="#########,@@" />
<field x="102" y="6.75" type="Valuta" align="right" width="13" id="232" pattern="1" text="#########,@@" />
<field x="89" y="7.75" type="Valuta" align="right" width="13" id="235" pattern="1" text="#########,@@" />
<field x="102" y="7.75" type="Valuta" align="right" width="13" id="236" pattern="1" text="#########,@@" />
<field x="75" y="2.25" type="Valuta" align="right" width="14" id="240" pattern="1" text="#########,@@" />
<field x="89" y="2.25" type="Valuta" align="right" width="13" id="241" pattern="1" text="#########,@@" />
<field x="102" y="2.25" type="Valuta" align="right" width="13" id="242" pattern="1" text="#########,@@" />