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:
		
							parent
							
								
									8bc2cbe968
								
							
						
					
					
						commit
						3ac4b35834
					
				@ -1,12 +1,52 @@
 | 
				
			|||||||
#include <applicat.h>
 | 
					#include <applicat.h>
 | 
				
			||||||
#include <automask.h>
 | 
					#include <automask.h>
 | 
				
			||||||
 | 
					#include <recarray.h>
 | 
				
			||||||
 | 
					#include <relation.h>
 | 
				
			||||||
#include <report.h>
 | 
					#include <report.h>
 | 
				
			||||||
#include <strings.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <mov.h>
 | 
				
			||||||
 | 
					#include <rmoviva.h>
 | 
				
			||||||
#include "../ba/ba8500.h"
 | 
					#include "../ba/ba8500.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "../cg/cg7200a.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
 | 
					// Report
 | 
				
			||||||
///////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////
 | 
				
			||||||
@ -17,9 +57,16 @@ protected:
 | 
				
			|||||||
  virtual bool use_mask() { return false; }
 | 
					  virtual bool use_mask() { return false; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					  virtual bool set_recordset(const TString& sql);
 | 
				
			||||||
  TPrint_x_imponibile_report();
 | 
					  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()
 | 
					TPrint_x_imponibile_report::TPrint_x_imponibile_report()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  load("cg7200a");
 | 
					  load("cg7200a");
 | 
				
			||||||
@ -49,25 +96,43 @@ void TPrint_x_imponibile_mask::elabora()
 | 
				
			|||||||
  const int anno = get_int(F_ANNO);
 | 
					  const int anno = get_int(F_ANNO);
 | 
				
			||||||
  const TDate dataini = get_date(F_DATAINI);
 | 
					  const TDate dataini = get_date(F_DATAINI);
 | 
				
			||||||
  const TDate datafin = get_date(F_DATAFIN);
 | 
					  const TDate datafin = get_date(F_DATAFIN);
 | 
				
			||||||
 | 
					  const real limite = get_real(F_LIMITE);
 | 
				
			||||||
 | 
					  const real limite_farlocco = limite * 0.60;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TString query;
 | 
					  TString query;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  query << "USE MOV KEY 3";
 | 
				
			||||||
 | 
					  query << "\nSELECT (TOTDOC>=" << limite_farlocco.integer() << ")";
 | 
				
			||||||
  if (tipodate == 'R')  //per data di 'R'egistrazione
 | 
					  if (tipodate == 'R')  //per data di 'R'egistrazione
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    query << "USE MOV KEY 3";
 | 
					    if (codcf <= 0L)
 | 
				
			||||||
 | 
					      query << "&&(BETWEEN(DATAREG," << dataini.date2ansi() << "," << datafin.date2ansi() << "))";
 | 
				
			||||||
    query << "\nSELECT (ANNOIVA=" << anno << ")";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    query << "\nFROM TIPO=" << tipoelenco;
 | 
					    query << "\nFROM TIPO=" << tipoelenco;
 | 
				
			||||||
    query << " CODCF=" << codcf;
 | 
					    if (codcf > 0L)
 | 
				
			||||||
    query << " DATAREG=" << dataini.date2ansi();
 | 
					    {
 | 
				
			||||||
 | 
					      query << " CODCF=" << codcf;
 | 
				
			||||||
 | 
					      query << " DATAREG=" << dataini.date2ansi();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    query << "\nTO TIPO=" << tipoelenco;
 | 
					    query << "\nTO TIPO=" << tipoelenco;
 | 
				
			||||||
    query << " CODCF=" << (codcf > 0L ? codcf : 999999);
 | 
					    if (codcf > 0L)
 | 
				
			||||||
    query << " DATAREG=" << datafin.date2ansi();
 | 
					    {
 | 
				
			||||||
 | 
					      query << " CODCF=" << codcf;
 | 
				
			||||||
 | 
					      query << " DATAREG=" << datafin.date2ansi();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else      //per data 'D'ocumento
 | 
					  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;
 | 
					  TPrint_x_imponibile_report rep;
 | 
				
			||||||
 | 
				
			|||||||
@ -95,7 +95,7 @@ THEN</prescript>
 | 
				
			|||||||
  <font face="Arial" bold="1" size="8" />
 | 
					  <font face="Arial" bold="1" size="8" />
 | 
				
			||||||
  <prescript description="H2 PRESCRIPT">MESSAGE RESET,F2</prescript>
 | 
					  <prescript description="H2 PRESCRIPT">MESSAGE RESET,F2</prescript>
 | 
				
			||||||
  <field x="8" y="0.75" type="Stringa" width="50" pattern="1">
 | 
					  <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>
 | 
				
			||||||
  <field x="1" y="0.75" type="Numero" align="right" width="6" id="151" pattern="1">
 | 
					  <field x="1" y="0.75" type="Numero" align="right" width="6" id="151" pattern="1">
 | 
				
			||||||
   <source>CODCF</source>
 | 
					   <source>CODCF</source>
 | 
				
			||||||
@ -110,22 +110,29 @@ THEN</prescript>
 | 
				
			|||||||
  <sql>USE RMOVIVA
 | 
					  <sql>USE RMOVIVA
 | 
				
			||||||
FROM NUMREG=#PARENT.NUMREG
 | 
					FROM NUMREG=#PARENT.NUMREG
 | 
				
			||||||
TO NUMREG=#PARENT.NUMREG</sql>
 | 
					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>
 | 
					   <source>NUMRIG</source>
 | 
				
			||||||
  </field>
 | 
					  </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>
 | 
					   <source>IMPONIBILE</source>
 | 
				
			||||||
  </field>
 | 
					  </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>
 | 
					   <source>IMPOSTA</source>
 | 
				
			||||||
  </field>
 | 
					  </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>
 | 
					   <source>CODIVA</source>
 | 
				
			||||||
  </field>
 | 
					  </field>
 | 
				
			||||||
  <field x="34" type="Array" width="15" pattern="1">
 | 
					  <field x="55" type="Array" width="15" id="251" pattern="1">
 | 
				
			||||||
   <prescript description="B11.0 PRESCRIPT">MESSAGE TABLEREAD,%IVA,CODIVA,S1</prescript>
 | 
					   <prescript description="B11.251 PRESCRIPT">MESSAGE TABLEREAD,%IVA,CODIVA,S1</prescript>
 | 
				
			||||||
   <list>
 | 
					   <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="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="Esente" Code="ES">"IMPONIBILE" @ "F11.221" +! "IMPOSTA" @ "F11.222" +!</li>
 | 
				
			||||||
    <li Value="Non imponibile" Code="NI">"IMPONIBILE" @ "F11.231" +! "IMPOSTA" @ "F11.232" +!</li>
 | 
					    <li Value="Non imponibile" Code="NI">"IMPONIBILE" @ "F11.231" +! "IMPOSTA" @ "F11.232" +!</li>
 | 
				
			||||||
@ -215,6 +222,20 @@ THEN</prescript>
 | 
				
			|||||||
"H1.102" @ E;= IF
 | 
					"H1.102" @ E;= IF
 | 
				
			||||||
  #THIS @
 | 
					  #THIS @
 | 
				
			||||||
  "F1.232" +!
 | 
					  "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" @ E;= 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" @ E;= IF
 | 
				
			||||||
 | 
					  #THIS @
 | 
				
			||||||
 | 
					  "F1.236" +!
 | 
				
			||||||
THEN</prescript>
 | 
					THEN</prescript>
 | 
				
			||||||
  </field>
 | 
					  </field>
 | 
				
			||||||
  <field x="51.5" type="Stringa" width="3.5" id="239" pattern="1">
 | 
					  <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 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="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">
 | 
					  <field x="108" y="0.75" type="Numero" align="right" width="4" pattern="1">
 | 
				
			||||||
   <source>REPORT.PAGE</source>
 | 
					   <source>#REPORT.PAGE</source>
 | 
				
			||||||
  </field>
 | 
					  </field>
 | 
				
			||||||
 </section>
 | 
					 </section>
 | 
				
			||||||
 <section type="Foot" level="1" pattern="1">
 | 
					 <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="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="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="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="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="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="#########,@@" />
 | 
					  <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="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="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="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="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="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="#########,@@" />
 | 
					  <field x="102" y="2.25" type="Valuta" align="right" width="13" id="242" pattern="1" text="#########,@@" />
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user