Aggiunto programma cancellazione movimenti provvisori git-svn-id: svn://10.65.10.50/trunk@276 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			2005 lines
		
	
	
		
			55 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			2005 lines
		
	
	
		
			55 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
//Lista movimenti
 | 
						|
 | 
						|
#include <mask.h>
 | 
						|
#include <printapp.h>
 | 
						|
#include <scanner.h>
 | 
						|
#include <relation.h>
 | 
						|
#include <tabutil.h>
 | 
						|
#include <utility.h>
 | 
						|
#include <urldefid.h>
 | 
						|
 | 
						|
#include <mov.h>
 | 
						|
#include <rmov.h>
 | 
						|
#include <rmoviva.h>
 | 
						|
#include <pconti.h>
 | 
						|
#include <comuni.h>
 | 
						|
#include <clifo.h>
 | 
						|
#include <attiv.h>
 | 
						|
#include <causali.h>
 | 
						|
#include <nditte.h>
 | 
						|
#include <msg.h>
 | 
						|
 | 
						|
#include "cg3.h"
 | 
						|
#include "cg3100.h"
 | 
						|
#include "cglib03.h"
 | 
						|
 | 
						|
//const MAXSTR = 128;
 | 
						|
//static char __tmp [MAXSTR];
 | 
						|
//static TFixed_string tmp (__tmp, MAXSTR);
 | 
						|
 | 
						|
static TString256 TMP;
 | 
						|
 | 
						|
enum liste {
 | 
						|
  movimenti=1,
 | 
						|
  fatture=2,
 | 
						|
  movimenti_sezionale=3
 | 
						|
  };
 | 
						|
 | 
						|
bool filter_func (const TRelation *);
 | 
						|
bool filter_func_fatture (const TRelation *);
 | 
						|
bool annoes      (TMask_field&, KEY);  
 | 
						|
bool data_inizio (TMask_field&, KEY);
 | 
						|
bool data_fine   (TMask_field&, KEY);   
 | 
						|
 | 
						|
class CG3100_application : public TPrintapp
 | 
						|
{
 | 
						|
  friend bool filter_func (const TRelation *);
 | 
						|
  friend bool filter_func_fatture (const TRelation *);
 | 
						|
  friend bool annoes      (TMask_field&, KEY);
 | 
						|
  friend bool data_inizio (TMask_field&, KEY);
 | 
						|
  friend bool data_fine   (TMask_field&, KEY);
 | 
						|
 | 
						|
  TRigaiva_array _c;
 | 
						|
  TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes;
 | 
						|
  TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv, *_nditte;
 | 
						|
  TRelation      * _relmov,* _relmov1,* _relmov2,* _relmov3;
 | 
						|
  TCursor * _curr1, * _curr2, * _curr3; 
 | 
						|
  TDate  _data_ini, _data_fin, _datareg, _data_prec;
 | 
						|
  TString _descr, _descr_doc, _descr_causale, _totali_a, _totali_d;
 | 
						|
  TString _totalegen_dare, _totalegen_avere, _tipo_ini, _masc, _causale;
 | 
						|
  TString _causale_ini, _causale_fin, _registro,_registro_ini, _registro_fin;
 | 
						|
  TString _tipoatt, _tipo_elenco,_tipo_clifo_prec,_cod,_tipoelsucc;
 | 
						|
  TString _tipo_clifo_precedente;
 | 
						|
  TString _appoggio, _tipodoc, _tipodocumento, _err1, _msg, _err, _err2;
 | 
						|
  TString _ragsoc, _indcf, _civcf, _paiv, _codcaus, _dencom, _provcom, _cofi;
 | 
						|
  TString _capcf, _codval, _simbolo, _statocf, _comcf, _tipo_fin;
 | 
						|
  long _documenti, _codice_ini, _codice_fin, _numero_reg,_codcf;
 | 
						|
  long _numreg, _numreg_fin, _numreg_ini, _codalleg, _numeroregp,_codclifosucc;
 | 
						|
  long _codcf_prec, _numr;
 | 
						|
  int  _anno, _annoes;
 | 
						|
  real _totdocumenti, _totdoc, _totimponibile, _totimposta, _importo;
 | 
						|
  real _op_esenti, _op_non_imp, _impo, _impos;
 | 
						|
  real _tot_dare, _tot_avere, _tot_avere_giornaliero;
 | 
						|
  real _tot_dare_giornaliero, _tot_dare_generale, _tot_avere_generale;
 | 
						|
  bool _intracom, _no_preprocess_page, _salto_pagina, _stampa_anno_comp;
 | 
						|
  bool _stampa_parte_iva,_alleg_causale,_stampa_mess_alleg_iva,_allegb,_ricser;
 | 
						|
  bool _settata_prima_riga, _causale_gia_stampata;
 | 
						|
  int  _cur1,_cur2,_cur2b,_cur3,_cur4,_decidi,_tipod,_controllo_mov_errati;
 | 
						|
  int  _numero_riga, _alleg, _tiporegistro, _tipocr, _scelta_stampa, _nr, _n;
 | 
						|
  liste _tipo_lista;
 | 
						|
  word _flags;
 | 
						|
 | 
						|
protected:
 | 
						|
  virtual void preprocess_header();
 | 
						|
  virtual bool preprocess_page(int,int);
 | 
						|
  virtual print_action postprocess_page(int,int);
 | 
						|
  virtual print_action postprocess_print(int,int);
 | 
						|
  virtual void set_page(int,int);
 | 
						|
  virtual bool set_print(int m);
 | 
						|
  void init_print(const TMask& m);
 | 
						|
 | 
						|
public:
 | 
						|
 | 
						|
  void user_create() ;
 | 
						|
  void user_destroy();
 | 
						|
  bool segnala_errori_primariga();
 | 
						|
  bool segnala_errori_ogniriga();
 | 
						|
  void stampa_errori_rmov();
 | 
						|
  void stampa_errori_mov();
 | 
						|
  void stampa_intestazione();
 | 
						|
  void incrementa_totali();
 | 
						|
  void compila_clifo();
 | 
						|
  void compila_comuni();
 | 
						|
  int  my_next (TLocalisamfile&); 
 | 
						|
  
 | 
						|
  CG3100_application() {}
 | 
						|
};
 | 
						|
 | 
						|
TDate InizioEsercizio(int anno)
 | 
						|
{
 | 
						|
  TTable TabEs ("ESC");
 | 
						|
  TString16 codtab;
 | 
						|
  TDate inizio_es;
 | 
						|
 | 
						|
  TabEs.zero();
 | 
						|
  codtab.format ("%04d", anno);
 | 
						|
  TabEs.put ("CODTAB", codtab);
 | 
						|
  TabEs.read();
 | 
						|
  if (TabEs.good())
 | 
						|
      inizio_es= TabEs.get_date ("D0");
 | 
						|
 | 
						|
  return inizio_es;
 | 
						|
}
 | 
						|
 | 
						|
TDate FineEsercizio(int anno)
 | 
						|
{
 | 
						|
  TTable TabEs ("ESC");
 | 
						|
  TString16 codtab;
 | 
						|
  TDate fine_es;
 | 
						|
 | 
						|
  TabEs.zero();
 | 
						|
  codtab.format ("%04d", anno);
 | 
						|
  TabEs.put ("CODTAB", codtab);
 | 
						|
  TabEs.read();
 | 
						|
  if (TabEs.good())
 | 
						|
      fine_es = TabEs.get_date ("D1");
 | 
						|
  else fine_es = botime;
 | 
						|
  
 | 
						|
  return fine_es;
 | 
						|
}
 | 
						|
 | 
						|
bool annoes(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
//  if ( (k == K_SPACE) || (k == K_TAB) )
 | 
						|
  if (k == K_TAB)
 | 
						|
  {
 | 
						|
    int anno = f.mask().get_int (F_ANNO);
 | 
						|
    if ( anno != 0 )
 | 
						|
    {
 | 
						|
      f.mask().field(F_DATAINI).set(InizioEsercizio(anno));
 | 
						|
      TDate fine = FineEsercizio(anno + 1);
 | 
						|
      if (fine == botime)
 | 
						|
         fine = FineEsercizio(anno); 
 | 
						|
  	  f.mask().field(F_DATAFIN).set(fine);
 | 
						|
    }
 | 
						|
  }
 | 
						|
  return TRUE; 
 | 
						|
} 
 | 
						|
 | 
						|
bool data_inizio(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
  CG3100_application &app = (CG3100_application&)main_app();
 | 
						|
  
 | 
						|
  if (k == K_ENTER)
 | 
						|
  {
 | 
						|
    int decidi;
 | 
						|
    int anno   = f.mask().get_int (F_ANNO);
 | 
						|
    TDate data = f.mask().get(F_DATAINI);
 | 
						|
    if (app._masc == "cg3100a")
 | 
						|
       decidi = f.mask().get_int (F_DECIDI);
 | 
						|
    if ( anno != 0 && ( (app._masc == "cg3100b") || 
 | 
						|
         ((app._masc == "cg3100a" ) && (decidi == 2)) ) )
 | 
						|
    {
 | 
						|
      if (!data.ok()) //se la data e' vuota
 | 
						|
	     f.mask().field(F_DATAINI).set(InizioEsercizio(anno));
 | 
						|
      else
 | 
						|
        if (data < InizioEsercizio(anno))
 | 
						|
        {
 | 
						|
          f.error_box("La data indicata non deve essere inferiore alla data di inizio esercizio");   
 | 
						|
          return FALSE;
 | 
						|
        }
 | 
						|
    }
 | 
						|
  }      
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool data_fine(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
  CG3100_application & app = (CG3100_application&)main_app();
 | 
						|
  
 | 
						|
  if (k == K_ENTER)
 | 
						|
  {
 | 
						|
    int decidi;
 | 
						|
    int anno      = f.mask().get_int (F_ANNO);
 | 
						|
    TDate dataini = f.mask().get(F_DATAINI);
 | 
						|
    TDate datafin = f.mask().get(F_DATAFIN); 
 | 
						|
    if (app._masc == "cg3100a")
 | 
						|
       decidi = f.mask().get_int (F_DECIDI);
 | 
						|
    if ( (app._masc == "cg3100b") || 
 | 
						|
         ((app._masc == "cg3100a" ) && (decidi == 2)) ) 
 | 
						|
       if ( dataini.ok() && datafin.ok() ) 
 | 
						|
          if (dataini > datafin) 
 | 
						|
          {
 | 
						|
           f.error_box("La data iniziale non deve essere superiore alla data finale");
 | 
						|
           return FALSE;
 | 
						|
          }  
 | 
						|
    if ( anno != 0 && ( (app._masc == "cg3100b") || 
 | 
						|
         ((app._masc == "cg3100a" ) && (decidi == 2)) ) )
 | 
						|
    {
 | 
						|
      TDate fine = FineEsercizio(anno + 1);
 | 
						|
      if (fine == botime)
 | 
						|
         fine = FineEsercizio(anno); 
 | 
						|
      if (!datafin.ok()) //se la data e' vuota 
 | 
						|
  	     f.mask().field(F_DATAFIN).set(fine);
 | 
						|
      else
 | 
						|
        if (datafin > fine)
 | 
						|
        {
 | 
						|
          f.error_box("La data indicata non deve essere superiore alla data di fine esercizio successivo, oppure, in caso questo non esista, dell'esercizio indicato");   
 | 
						|
          return FALSE;
 | 
						|
        }
 | 
						|
    }
 | 
						|
  }      
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
void CG3100_application::compila_clifo()
 | 
						|
{
 | 
						|
  _clifo->setkey(1);
 | 
						|
  _clifo->zero();
 | 
						|
  _clifo->put(CLI_TIPOCF,_tipo_elenco);
 | 
						|
  _clifo->put(CLI_CODCF,_codcf);
 | 
						|
  _clifo->read();
 | 
						|
  if (_clifo->bad())
 | 
						|
    _clifo->zero();
 | 
						|
  _alleg    = _clifo->get_int(CLI_ALLEG);
 | 
						|
  _statocf  = _clifo->get(CLI_STATOCF);
 | 
						|
  _comcf    = _clifo->get(CLI_COMCF);
 | 
						|
  _ragsoc   = _clifo->get(CLI_RAGSOC);
 | 
						|
  _indcf    = _clifo->get(CLI_INDCF);
 | 
						|
  _civcf    = _clifo->get(CLI_CIVCF);
 | 
						|
  _paiv     = _clifo->get(CLI_PAIV);
 | 
						|
  _capcf    = _clifo->get(CLI_CAPCF);
 | 
						|
  _cofi     = _clifo->get(CLI_COFI); 
 | 
						|
  _codalleg = _clifo->get_long(CLI_CODALLEG);
 | 
						|
}
 | 
						|
 | 
						|
void CG3100_application::compila_comuni()
 | 
						|
{
 | 
						|
  _comuni->setkey(1);
 | 
						|
  _comuni->zero();
 | 
						|
  _comuni->put(COM_STATO,_statocf);
 | 
						|
  _comuni->put(COM_COM,_comcf);
 | 
						|
  _comuni->read();
 | 
						|
  if (_comuni->bad())
 | 
						|
    _comuni->curr().zero();
 | 
						|
  _dencom  = _comuni->get(COM_DENCOM);
 | 
						|
  _provcom = _comuni->get(COM_PROVCOM);
 | 
						|
}
 | 
						|
 | 
						|
const int AllegClifo (int gruppo, int conto, long sottoconto)
 | 
						|
{  
 | 
						|
  TLocalisamfile clifo(LF_CLIFO);
 | 
						|
  int alleg;
 | 
						|
 | 
						|
  clifo.setkey(3);
 | 
						|
  clifo.zero();
 | 
						|
  clifo.put(CLI_GRUPPO, gruppo);
 | 
						|
  clifo.put(CLI_CONTO,  conto);
 | 
						|
  clifo.put(CLI_CODCF,  sottoconto);
 | 
						|
  clifo.read();
 | 
						|
  if (clifo.good())
 | 
						|
    alleg = clifo.curr().get_int(CLI_ALLEG);  
 | 
						|
  else
 | 
						|
    alleg = 0;
 | 
						|
 | 
						|
  return alleg;
 | 
						|
}
 | 
						|
 | 
						|
const char * DescrConto (long gruppo, long conto, long sottoconto, 
 | 
						|
                         const char* tipocf)
 | 
						|
{  
 | 
						|
  TLocalisamfile pcon(LF_PCON);
 | 
						|
  TLocalisamfile clifo(LF_CLIFO);
 | 
						|
  
 | 
						|
  pcon.setkey(1);
 | 
						|
  pcon.zero();
 | 
						|
  pcon.put(PCN_GRUPPO, gruppo);
 | 
						|
  if (conto != 0)
 | 
						|
    pcon.put(PCN_CONTO, conto);
 | 
						|
  if (sottoconto != 0)
 | 
						|
    pcon.put(PCN_SOTTOCONTO,sottoconto);
 | 
						|
  pcon.read();
 | 
						|
  if (pcon.good())
 | 
						|
    TMP = pcon.curr().get(PCN_DESCR);
 | 
						|
  else
 | 
						|
  {
 | 
						|
    clifo.setkey(1); 
 | 
						|
    clifo.zero();
 | 
						|
    clifo.put(CLI_CODCF, sottoconto);
 | 
						|
    clifo.put(CLI_TIPOCF,tipocf);
 | 
						|
    clifo.read();
 | 
						|
    if (clifo.good())
 | 
						|
      TMP = clifo.get(CLI_RAGSOC);
 | 
						|
  }
 | 
						|
  return TMP;  
 | 
						|
}
 | 
						|
 | 
						|
bool CausAlleg (const char * cod)
 | 
						|
{
 | 
						|
  TLocalisamfile caus(LF_CAUSALI);
 | 
						|
  bool allegb;
 | 
						|
  
 | 
						|
  caus.setkey(1);
 | 
						|
  caus.zero();
 | 
						|
  caus.put(CAU_CODCAUS,cod);
 | 
						|
  caus.read();
 | 
						|
  if (caus.bad())
 | 
						|
    caus.zero();
 | 
						|
  allegb = caus.get_bool(CAU_ALLEG);
 | 
						|
  
 | 
						|
  return allegb;
 | 
						|
}
 | 
						|
 | 
						|
const char * TipoAttivita (const char * attreg, long codice_ditta)
 | 
						|
{
 | 
						|
  TLocalisamfile attiv(LF_ATTIV);
 | 
						|
 | 
						|
  attiv.setkey(1);
 | 
						|
  attiv.zero();
 | 
						|
  attiv.put(ATT_CODDITTA, codice_ditta);
 | 
						|
  attiv.put(ATT_CODATT,   attreg);
 | 
						|
 | 
						|
  attiv.read();
 | 
						|
  if (attiv.good())
 | 
						|
    TMP = attiv.curr().get(ATT_TIPOATT);  
 | 
						|
  else
 | 
						|
    TMP = "";
 | 
						|
 | 
						|
  return TMP;
 | 
						|
}
 | 
						|
 | 
						|
const char * SimboloValuta (const char * cod)
 | 
						|
{
 | 
						|
  TTable tab_val(TAB_VAL);
 | 
						|
  TString codtab = format ("%-3s", cod); 
 | 
						|
  
 | 
						|
  tab_val.zero();
 | 
						|
  
 | 
						|
  tab_val.put("CODTAB", codtab);
 | 
						|
  tab_val.read();
 | 
						|
  if (tab_val.good())
 | 
						|
    TMP = tab_val.get("S7");
 | 
						|
  else 
 | 
						|
    TMP = "";
 | 
						|
 | 
						|
  return TMP;
 | 
						|
}
 | 
						|
 | 
						|
const char * DescrDoc (const char * tipo)
 | 
						|
{
 | 
						|
  TTable  tab_tpd(TAB_TPD);
 | 
						|
  TString codtab = format ("%-2s", tipo);
 | 
						|
  
 | 
						|
  tab_tpd.zero();
 | 
						|
  
 | 
						|
  tab_tpd.put("CODTAB", codtab);
 | 
						|
  tab_tpd.read();
 | 
						|
  if (tab_tpd.good())
 | 
						|
    TMP = tab_tpd.get("S0");
 | 
						|
  else
 | 
						|
    TMP = "";
 | 
						|
 | 
						|
  return TMP;
 | 
						|
} 
 | 
						|
 | 
						|
const char * AttivitaRegistro (const char * cod, int anno)
 | 
						|
{
 | 
						|
  TTable tab_reg("REG");
 | 
						|
  TString codtab ( format ("%04d%-3s", anno, cod) );
 | 
						|
  
 | 
						|
  tab_reg.zero();
 | 
						|
 | 
						|
  tab_reg.put("CODTAB", codtab);
 | 
						|
  tab_reg.read();
 | 
						|
 | 
						|
  if (tab_reg.good())
 | 
						|
    TMP = tab_reg.get("S8");
 | 
						|
  else
 | 
						|
    TMP = "";
 | 
						|
  
 | 
						|
  return TMP; 
 | 
						|
}
 | 
						|
 | 
						|
const int CodiceRegistro (const char* cod, int anno)
 | 
						|
{
 | 
						|
  TTable tab_reg("REG");
 | 
						|
  TString codtab;
 | 
						|
  codtab.format("%4d%-3s", anno, cod);
 | 
						|
  //sprintf (__tmp, "%04d%-3s", anno, cod);
 | 
						|
  //TString codtab (__tmp);
 | 
						|
  int     tipo_reg;
 | 
						|
 | 
						|
  tab_reg.zero();
 | 
						|
 | 
						|
  tab_reg.put("CODTAB", codtab);
 | 
						|
  tab_reg.read();
 | 
						|
 | 
						|
  if (tab_reg.good())
 | 
						|
    tipo_reg = tab_reg.get_int("I0");
 | 
						|
  else
 | 
						|
    tipo_reg = 0;
 | 
						|
  
 | 
						|
  return tipo_reg; 
 | 
						|
}
 | 
						|
 | 
						|
bool filter_func_fatture (const TRelation * rel)
 | 
						|
{
 | 
						|
  CG3100_application & app = (CG3100_application&)main_app();
 | 
						|
  int                  tipo_reg;
 | 
						|
  int                  ann_reg;
 | 
						|
  TString              cod_reg;
 | 
						|
  TLocalisamfile     & mov = rel->lfile(LF_MOV); 
 | 
						|
  TRectype from (mov.curr());
 | 
						|
  TRectype to (mov.curr());
 | 
						|
  ann_reg  = mov.get_int (MOV_ANNOIVA); 
 | 
						|
  cod_reg  = mov.get     (MOV_REG); 
 | 
						|
  tipo_reg = CodiceRegistro (cod_reg, ann_reg);
 | 
						|
  from.zero();
 | 
						|
  to.zero();
 | 
						|
  if (app._annoes != 0) //anno esercizio specificato nella maschera
 | 
						|
  {
 | 
						|
    from.put(MOV_ANNOES, app._annoes);
 | 
						|
    to.put(MOV_ANNOES, app._annoes);
 | 
						|
  }
 | 
						|
  //if (app._data_ini.ok())
 | 
						|
  //   from.put(MOV_DATAREG, app._data_ini);
 | 
						|
  from.put(MOV_TIPO, app._tipo_ini);
 | 
						|
  if (app._codice_ini != 0)
 | 
						|
    from.put(MOV_CODCF, app._codice_ini);
 | 
						|
  //if (app._data_fin.ok())
 | 
						|
  //   to.put(MOV_DATAREG, app._data_fin);
 | 
						|
  to.put(MOV_TIPO, app._tipo_fin);
 | 
						|
  if (app._codice_fin != 0)
 | 
						|
    to.put(MOV_CODCF, app._codice_fin); 
 | 
						|
  
 | 
						|
  if (((mov.curr() >= from) && (mov.curr() <= to)) &&
 | 
						|
      ((tipo_reg == 1) || (tipo_reg == 2)))
 | 
						|
    return TRUE;
 | 
						|
  
 | 
						|
  return FALSE;
 | 
						|
}
 | 
						|
 | 
						|
bool filter_func (const TRelation * rel)
 | 
						|
{
 | 
						|
  CG3100_application & app = (CG3100_application&)main_app();
 | 
						|
  int                  tipo_reg, ann_reg;
 | 
						|
  TString              cod_reg, causale;
 | 
						|
  TLocalisamfile     & mov = rel->lfile(LF_MOV); 
 | 
						|
  TRectype from (mov.curr());
 | 
						|
  TRectype to   (mov.curr());
 | 
						|
  switch (app._scelta_stampa)
 | 
						|
  {
 | 
						|
   case 0:
 | 
						|
     ann_reg  = mov.get_int(MOV_ANNOIVA); 
 | 
						|
     causale  = mov.get    (MOV_CODCAUS);
 | 
						|
     from.zero();
 | 
						|
     to.zero();
 | 
						|
     if ( (app._decidi == 2) && (app._annoes != 0) )
 | 
						|
     { 
 | 
						|
      from.put(MOV_ANNOES, app._annoes);
 | 
						|
      to.put(MOV_ANNOES, app._annoes);
 | 
						|
     }
 | 
						|
     from.put(MOV_CODCAUS, app._causale_ini);
 | 
						|
     to.put(MOV_CODCAUS, app._causale_fin);
 | 
						|
     from.put(MOV_REG, app._registro_ini);
 | 
						|
     to.put(MOV_REG, app._registro_fin);        
 | 
						|
     if ((mov.curr() >= from) && (mov.curr() <= to)) 
 | 
						|
       return TRUE;
 | 
						|
     break;
 | 
						|
   case 1:
 | 
						|
     cod_reg  = mov.get      (MOV_REG); 
 | 
						|
     ann_reg  = mov.get_int  (MOV_ANNOIVA); 
 | 
						|
     tipo_reg = CodiceRegistro(cod_reg, ann_reg);
 | 
						|
     causale  = mov.get      (MOV_CODCAUS);
 | 
						|
     from.zero();
 | 
						|
     to.zero();
 | 
						|
     if ( (app._decidi == 2) && (app._annoes != 0) )
 | 
						|
     {  
 | 
						|
      from.put(MOV_ANNOES, app._annoes);
 | 
						|
      to.put(MOV_ANNOES, app._annoes);
 | 
						|
     }
 | 
						|
     from.put(MOV_CODCAUS, app._causale_ini);
 | 
						|
     to.put(MOV_CODCAUS, app._causale_fin);
 | 
						|
    
 | 
						|
     if (((mov.curr() >= from) && (mov.curr() <= to)) &&
 | 
						|
        ((tipo_reg != 1) && (tipo_reg != 2)))
 | 
						|
        return TRUE;
 | 
						|
    
 | 
						|
     break;
 | 
						|
 | 
						|
   default:
 | 
						|
     break;
 | 
						|
   }
 | 
						|
   return FALSE;
 | 
						|
}
 | 
						|
 | 
						|
void CG3100_application::stampa_errori_rmov()
 | 
						|
{
 | 
						|
  if (_scelta_stampa == 0)  //lista movimenti
 | 
						|
  {    
 | 
						|
    if (_controllo_mov_errati != 3)
 | 
						|
    { 
 | 
						|
      _nr = 2;
 | 
						|
      if (_descr == "")
 | 
						|
      { 
 | 
						|
        reset_row(_nr); 
 | 
						|
        set_row(_nr++, "@11g%s", ERR_66);
 | 
						|
      }   
 | 
						|
      if (_stampa_mess_alleg_iva)
 | 
						|
      {
 | 
						|
        if (!_alleg_causale)
 | 
						|
        {  
 | 
						|
          reset_row(_nr);
 | 
						|
          set_row(_nr++, "@11g%61s", MSG_20);
 | 
						|
        }
 | 
						|
        if ((_alleg == 1)||(_alleg == 2))
 | 
						|
        {
 | 
						|
          reset_row(_nr);
 | 
						|
          set_row(_nr++, "@11g%s", MSG_31);
 | 
						|
        }
 | 
						|
      }    
 | 
						|
      if (_err2 == ERR_1)
 | 
						|
      {   
 | 
						|
        reset_row(_nr);
 | 
						|
        set_row(_nr++, "@11g%s",ERR_1);
 | 
						|
      }            
 | 
						|
      if (_err == ERR_2)
 | 
						|
      {
 | 
						|
        reset_row(_nr);
 | 
						|
        set_row(_nr++, "@11g%s",ERR_2);
 | 
						|
      }       
 | 
						|
      if (_msg == MSG_54)
 | 
						|
      {
 | 
						|
        reset_row(_nr);
 | 
						|
        set_row(_nr++, "@11g%s",MSG_54);
 | 
						|
      }       
 | 
						|
      if (_err1 == ERR_09)
 | 
						|
      {
 | 
						|
        reset_row(_nr);
 | 
						|
        set_row(_nr, "@11g%s",ERR_09); 
 | 
						|
      }       
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
void CG3100_application::stampa_errori_mov()
 | 
						|
{
 | 
						|
  if (_scelta_stampa == 0)
 | 
						|
  {
 | 
						|
    if (_controllo_mov_errati != 3)
 | 
						|
    {
 | 
						|
      //aggiungere il controllo anno di competenza
 | 
						|
        
 | 
						|
      if ( (_tiporegistro == 1)||(_tiporegistro == 2) ) //controlli su mov. iva
 | 
						|
      {
 | 
						|
       if (_caus->bad())
 | 
						|
        set_row(++_n, "@11g%s", ERR_16);
 | 
						|
       
 | 
						|
       if (_tipodocumento != _tipodoc)
 | 
						|
          set_row(++_n, "@11g%s", MSG_19);
 | 
						|
      
 | 
						|
       if ((_stampa_mess_alleg_iva)&&(!_alleg_causale))
 | 
						|
          set_row(++_n, "@11g%s", MSG_20);
 | 
						|
                            
 | 
						|
       if (_registro == "")
 | 
						|
          set_row(++_n, "@11g%s", ERR_21);
 | 
						|
      }    
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
void CG3100_application::set_page(int file, int count)
 | 
						|
{
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
    if (file == LF_RMOVIVA)
 | 
						|
      break;
 | 
						|
    if (file == LF_RMOV)
 | 
						|
    {
 | 
						|
      _nr = 1;
 | 
						|
      set_row(_nr,"@3n",FLD(LF_RMOV,RMV_NUMRIG));
 | 
						|
      //          set_row(_nr,"@5g@3s",FLD(LF_MOV,MOV_CODCAUS));
 | 
						|
      //          set_row(_nr,"@9g#.20t", &_descr_causale);
 | 
						|
      set_row(_nr,"@30g@24s",FLD(LF_RMOV,RMV_DESCR));
 | 
						|
      set_row(_nr,"@56g@4n",FLD(LF_RMOV,RMV_GRUPPO));
 | 
						|
      set_row(_nr,"@61g@3n",FLD(LF_RMOV,RMV_CONTO));
 | 
						|
      set_row(_nr,"@65g@6n",FLD(LF_RMOV,RMV_SOTTOCONTO));
 | 
						|
      set_row(_nr,"@72g#.20t",&_descr);
 | 
						|
      _appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
 | 
						|
      if ((_appoggio=="D")||(_appoggio=="d"))
 | 
						|
        set_row(_nr,"@93g@pN",FLD(LF_RMOV,RMV_IMPORTO,"###.###.###.###")); 
 | 
						|
      else
 | 
						|
        set_row(_nr,"@111g@pN",FLD(LF_RMOV,RMV_IMPORTO,"###.###.###.###"));
 | 
						|
      set_row(_nr,"@130g@f",FLD(LF_MOV,MOV_STAMPATO));
 | 
						|
    }                     
 | 
						|
    else if (file == LF_MOV)
 | 
						|
    {
 | 
						|
      _n = 1;
 | 
						|
      set_row (_n, "Operazione n. @18g@7n", FLD(LF_MOV,MOV_NUMREG));
 | 
						|
      //set_row (_n, "@23g@3s",FLD(LF_MOV,MOV_CODCAUS));
 | 
						|
      set_row (_n, "@26gdel@30g@d",FLD(LF_MOV,MOV_DATAREG));
 | 
						|
      set_row (_n, "@41g@40s",FLD(LF_MOV,MOV_DESCR));
 | 
						|
      set_row (_n, "@82gdoc. @87g@7s",FLD(LF_MOV,MOV_NUMDOC));
 | 
						|
      set_row (_n, "@95gdel@99g@d", FLD(LF_MOV,MOV_DATADOC));
 | 
						|
      TString16 reg = current_cursor()->curr(LF_MOV).get(MOV_REG);
 | 
						|
      int      anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA);
 | 
						|
      int tipo = CodiceRegistro(reg, anno);
 | 
						|
      if ( (tipo == 1) || (tipo == 2) )
 | 
						|
      {
 | 
						|
        set_row (_n, "@110greg @3s",FLD(LF_MOV,MOV_REG));
 | 
						|
        set_row (_n, "@118gpr @5n",FLD(LF_MOV,MOV_PROTIVA));
 | 
						|
      }
 | 
						|
      if (_scelta_stampa == 0)
 | 
						|
         if (_stampa_anno_comp)
 | 
						|
            set_row (_n, "@127g@4n", FLD(LF_MOV,MOV_ANNOES)); 
 | 
						|
      //set_row (_n, "@130g@f", FLD(LF_MOV,MOV_STAMPATO));
 | 
						|
    }
 | 
						|
    break;
 | 
						|
    
 | 
						|
  case fatture:
 | 
						|
    break;
 | 
						|
    
 | 
						|
  case movimenti_sezionale:
 | 
						|
    break; 
 | 
						|
    
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
void CG3100_application::stampa_intestazione()
 | 
						|
{
 | 
						|
  TString sep;     
 | 
						|
  sep = "";
 | 
						|
  set_row (1,(const char*)sep);
 | 
						|
  if (_tipo_elenco == "C")
 | 
						|
    set_row (2, "Cliente@9g@6n", FLD(LF_MOV,MOV_CODCF));
 | 
						|
  else 
 | 
						|
    set_row (2, "Fornitore@12g@6n", FLD(LF_MOV,MOV_CODCF));
 | 
						|
  set_row (2, "@18g#35t", &_ragsoc);
 | 
						|
  set_row (2, "@54gInd #29t", &_indcf);
 | 
						|
  set_row (2, "@87g#10t", &_civcf);
 | 
						|
  set_row (2, "@98gP.I. #11t", &_paiv);
 | 
						|
  if (_alleg == 0)
 | 
						|
    set_row (2, "@121gAllegato NO");
 | 
						|
  else 
 | 
						|
    set_row (2, "@121gAllegato SI");
 | 
						|
  set_row (3, "@54gCap #5t",  &_capcf);
 | 
						|
  set_row (3,"@64gLoc #20t",  &_dencom);
 | 
						|
  set_row (3,"@89gPr #5t",   &_provcom);
 | 
						|
  set_row (3, "@98gC.F. #16t", &_cofi);
 | 
						|
  if (_alleg == 0)
 | 
						|
    set_row (3, "@120gRifer@126g#6d", &_codalleg);
 | 
						|
}
 | 
						|
 | 
						|
bool CG3100_application::preprocess_page(int file,int counter)
 | 
						|
{
 | 
						|
 | 
						|
  TCursor * cur = current_cursor();
 | 
						|
 | 
						|
  if (counter) return TRUE;
 | 
						|
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
    if (_scelta_stampa == 0)
 | 
						|
    {
 | 
						|
      if (file == LF_MOV)
 | 
						|
      {
 | 
						|
        _tot_avere = 0;
 | 
						|
        _tot_dare  = 0;
 | 
						|
        _c.destroy();
 | 
						|
        _no_preprocess_page = FALSE;
 | 
						|
        _causale = current_cursor()->curr(LF_MOV).get(MOV_CODCAUS);
 | 
						|
        _registro = current_cursor()->curr(LF_MOV).get(MOV_REG);
 | 
						|
        _anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA);
 | 
						|
        _tipodoc = current_cursor()->curr(LF_MOV).get(MOV_TIPODOC);
 | 
						|
        _datareg = current_cursor()->file(LF_MOV).get_date(MOV_DATAREG);
 | 
						|
        _causale_gia_stampata = FALSE;
 | 
						|
 | 
						|
        //TDate data_corrente (current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG));
 | 
						|
        _tiporegistro = CodiceRegistro(_registro, _anno);
 | 
						|
 | 
						|
        TLocalisamfile& fl = current_cursor()->file(LF_MOV);
 | 
						|
        TRectype da (fl.curr());
 | 
						|
        TRectype a  (fl.curr());
 | 
						|
        da.zero();
 | 
						|
        a.zero();
 | 
						|
        if (_annoes != 0)
 | 
						|
        {  
 | 
						|
          da.put(MOV_ANNOES, _annoes);
 | 
						|
          a.put(MOV_ANNOES, _annoes);
 | 
						|
        }  
 | 
						|
        da.put(MOV_CODCAUS, _causale_ini);
 | 
						|
        da.put(MOV_REG, _registro_ini);
 | 
						|
        a.put(MOV_CODCAUS, _causale_fin);
 | 
						|
        a.put(MOV_REG, _registro_fin);
 | 
						|
        
 | 
						|
        if ((fl.curr() >= da) && (fl.curr() <= a))
 | 
						|
          //&&((_tiporegistro == 1)||(_tiporegistro == 2))) 
 | 
						|
        {   
 | 
						|
          _caus->setkey(1);
 | 
						|
          _caus->curr().put(CAU_CODCAUS,_causale);
 | 
						|
          _caus->read();
 | 
						|
          if (_caus->bad())
 | 
						|
            _caus->curr().zero();
 | 
						|
          _descr_causale = _caus->curr().get(CAU_DESCR); 
 | 
						|
          _alleg_causale = _caus->curr().get_bool(CAU_ALLEG);
 | 
						|
          _tipodocumento = _caus->curr().get(CAU_TIPODOC);
 | 
						|
          
 | 
						|
          if (   ((_controllo_mov_errati == 1)&&(segnala_errori_primariga()))
 | 
						|
              || (_controllo_mov_errati == 2))
 | 
						|
          {
 | 
						|
            stampa_errori_mov();
 | 
						|
            return TRUE;
 | 
						|
          }
 | 
						|
          else if ((_controllo_mov_errati == 1)&&(!segnala_errori_primariga()))
 | 
						|
            return FALSE;
 | 
						|
          else if (_controllo_mov_errati == 3)
 | 
						|
            return TRUE;
 | 
						|
        }
 | 
						|
      }
 | 
						|
    else if (file == LF_RMOV)
 | 
						|
    {
 | 
						|
      if (!_causale_gia_stampata)
 | 
						|
      {
 | 
						|
        set_row(_nr,"@4g%3s",   (const char*) _causale);
 | 
						|
        set_row(_nr,"@8g%.20s", (const char*) _descr_causale);
 | 
						|
        _causale_gia_stampata = TRUE;
 | 
						|
      }
 | 
						|
 | 
						|
      if (((_controllo_mov_errati == 1)&&(segnala_errori_ogniriga()))||(_controllo_mov_errati == 2)||(_controllo_mov_errati == 3))
 | 
						|
      {
 | 
						|
        int gruppo = current_cursor()->curr(LF_RMOV).get_int(RMV_GRUPPO);
 | 
						|
        int conto  = current_cursor()->curr(LF_RMOV).get_int(RMV_CONTO);
 | 
						|
        long sottoconto = current_cursor()->curr(LF_RMOV).get_long(RMV_SOTTOCONTO);
 | 
						|
        TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC);
 | 
						|
        _descr = DescrConto(gruppo, conto, sottoconto, tipoc);
 | 
						|
        _alleg = AllegClifo(gruppo, conto, sottoconto);
 | 
						|
        _importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
 | 
						|
        _appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
 | 
						|
        if (!_no_preprocess_page)
 | 
						|
        {
 | 
						|
          if ((_appoggio=="D")||(_appoggio=="d"))
 | 
						|
          {
 | 
						|
            _tot_dare_generale += _importo;
 | 
						|
            _tot_dare          += _importo;
 | 
						|
          }
 | 
						|
          else if ((_appoggio=="A")||(_appoggio=="a"))
 | 
						|
          {
 | 
						|
            _tot_avere += _importo;
 | 
						|
            _tot_avere_generale += _importo;
 | 
						|
          }
 | 
						|
          stampa_errori_rmov();  
 | 
						|
        }
 | 
						|
        return TRUE;                  
 | 
						|
      }
 | 
						|
    }
 | 
						|
    else if ((_stampa_parte_iva)&&(file == LF_RMOVIVA))
 | 
						|
    {
 | 
						|
      const TRectype iva(current_cursor()->file(LF_RMOVIVA).curr());
 | 
						|
      _impo   = iva.get_real(RMI_IMPONIBILE);
 | 
						|
      _impos  = iva.get_real(RMI_IMPOSTA);
 | 
						|
      _tipocr = iva.get_int(RMI_TIPOCR);
 | 
						|
      _tipod  = iva.get_int(RMI_TIPODET);
 | 
						|
      _cod    = iva.get(RMI_CODIVA);        
 | 
						|
      if (_stampa_parte_iva)
 | 
						|
        _c.add_riga(_impo,_impos,_cod,_tipod,0.00,0.00);
 | 
						|
 | 
						|
      return TRUE;
 | 
						|
    }
 | 
						|
  }
 | 
						|
  else //_scelta_stampa == 1
 | 
						|
  {
 | 
						|
    if (file == LF_MOV)
 | 
						|
    {
 | 
						|
      _tot_avere = 0;
 | 
						|
      _tot_dare  = 0; 
 | 
						|
      _no_preprocess_page = FALSE; 
 | 
						|
      _causale = current_cursor()->curr(LF_MOV).get(MOV_CODCAUS);
 | 
						|
      _registro = current_cursor()->curr(LF_MOV).get(MOV_REG);
 | 
						|
      _anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOES);
 | 
						|
      _tipodoc = current_cursor()->curr(LF_MOV).get(MOV_TIPODOC);
 | 
						|
 | 
						|
      TLocalisamfile& fl = current_cursor()->file(LF_MOV);
 | 
						|
      TRectype da (fl.curr());
 | 
						|
      TRectype a (fl.curr());
 | 
						|
      da.zero();
 | 
						|
      a.zero();
 | 
						|
      if (_annoes != 0)
 | 
						|
      {  
 | 
						|
        da.put(MOV_ANNOES, _annoes);
 | 
						|
        a.put(MOV_ANNOES, _annoes);
 | 
						|
      }
 | 
						|
      da.put(MOV_CODCAUS, _causale_ini);
 | 
						|
      a.put(MOV_CODCAUS, _causale_fin);
 | 
						|
      
 | 
						|
      if ((fl.curr() >= da) && (fl.curr() <= a))
 | 
						|
        /*
 | 
						|
           if ((_annoes == _anno) || (_annoes == 0)) 
 | 
						|
           if ((_causale >= _causale_ini) && (_causale <= _causale_fin))
 | 
						|
           */
 | 
						|
      {
 | 
						|
        _caus->setkey(1);
 | 
						|
        _caus->curr().put(CAU_CODCAUS,_causale);
 | 
						|
        _caus->read();
 | 
						|
        _descr_causale = _caus->curr().get(CAU_DESCR); 
 | 
						|
        _alleg_causale = _caus->curr().get_bool(CAU_ALLEG);
 | 
						|
        _tipodocumento = _caus->curr().get(CAU_TIPODOC);
 | 
						|
 | 
						|
        _tiporegistro = CodiceRegistro (_registro, _anno);
 | 
						|
 | 
						|
        if ((_tiporegistro != 1)&&(_tiporegistro != 2))//se si tratta di un movimento di sola prima nota
 | 
						|
          return TRUE;
 | 
						|
      } 
 | 
						|
    }
 | 
						|
    else if (file == LF_RMOV)
 | 
						|
    {
 | 
						|
      long gruppo = atol(current_cursor()->curr(LF_RMOV).get(RMV_GRUPPO));
 | 
						|
      long conto = atol(current_cursor()->curr(LF_RMOV).get(RMV_CONTO));
 | 
						|
      long sottoconto = atol(current_cursor()->curr(LF_RMOV).get(RMV_SOTTOCONTO));
 | 
						|
      TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC); 
 | 
						|
      _descr = DescrConto(gruppo, conto, sottoconto, tipoc);
 | 
						|
      _importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
 | 
						|
      _appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
 | 
						|
      if (!_no_preprocess_page)
 | 
						|
      {
 | 
						|
        if ((_appoggio=="D")||(_appoggio=="d"))
 | 
						|
        {
 | 
						|
          _tot_dare_generale += _importo;
 | 
						|
          _tot_dare += _importo;
 | 
						|
        }
 | 
						|
        else if ((_appoggio=="A")||(_appoggio=="a"))
 | 
						|
        {
 | 
						|
          _tot_avere += _importo;
 | 
						|
          _tot_avere_generale += _importo;
 | 
						|
        }
 | 
						|
      }
 | 
						|
      return TRUE;
 | 
						|
    }
 | 
						|
  } 
 | 
						|
  break;
 | 
						|
    
 | 
						|
  case fatture:
 | 
						|
  {
 | 
						|
    if (file == LF_MOV)
 | 
						|
    {
 | 
						|
      int anno       = cur->curr(LF_MOV).get_int(MOV_ANNOIVA);
 | 
						|
      TString codreg = cur->curr(LF_MOV).get(MOV_REG);
 | 
						|
      _numr        = current_cursor()->curr(LF_MOV).get_long(MOV_NUMREG); 
 | 
						|
      _tipo_elenco = current_cursor()->curr(LF_MOV).get(MOV_TIPO); 
 | 
						|
      _codcf       = current_cursor()->curr(LF_MOV).get_long(MOV_CODCF);
 | 
						|
      int     tiporeg = CodiceRegistro   (codreg, anno);
 | 
						|
      TString attreg  = AttivitaRegistro (codreg, anno); 
 | 
						|
      
 | 
						|
      if (tiporeg == 1 || tiporeg == 2)//se si tratta di un movimento iva
 | 
						|
      {  
 | 
						|
        _tipoatt     = TipoAttivita(attreg, get_firm());  
 | 
						|
        _tipo_elenco = cur->curr(LF_MOV).get(MOV_TIPO);
 | 
						|
        _codcf       = cur->curr(LF_MOV).get_long(MOV_CODCF);
 | 
						|
        _codcaus     = cur->curr(LF_MOV).get(MOV_CODCAUS);
 | 
						|
        _tipodoc     = cur->curr(LF_MOV).get(MOV_TIPODOC);      
 | 
						|
        _codval      = cur->curr(LF_MOV).get(MOV_CODVAL); 
 | 
						|
        _totdoc      = cur->curr(LF_MOV).get_real(MOV_TOTDOC);
 | 
						|
        /*
 | 
						|
        if ((_tipo_elenco != _tipo_clifo_precedente) && 
 | 
						|
            (_tipo_clifo_precedente != "") && _salto_pagina)
 | 
						|
           printer().formfeed();
 | 
						|
        */
 | 
						|
        if ((_tipo_elenco != _tipo_clifo_prec) && 
 | 
						|
            (_tipo_clifo_prec != "") && _salto_pagina)
 | 
						|
           printer().formfeed();
 | 
						|
        
 | 
						|
        TLocalisamfile& file = cur->file(LF_MOV);
 | 
						|
        TRectype da (file.curr());
 | 
						|
        TRectype a (file.curr());
 | 
						|
        da.zero();
 | 
						|
        a.zero();  
 | 
						|
        
 | 
						|
        if (_annoes != 0) //anno specificato nella maschera
 | 
						|
        {
 | 
						|
          da.put(MOV_ANNOES, _annoes);
 | 
						|
          a.put(MOV_ANNOES, _annoes);
 | 
						|
        }
 | 
						|
        if (_data_ini.ok())
 | 
						|
           da.put(MOV_DATAREG, _data_ini);
 | 
						|
        da.put(MOV_TIPO, _tipo_ini);
 | 
						|
        if (_codice_ini != 0)
 | 
						|
          da.put(MOV_CODCF, _codice_ini);
 | 
						|
        if (_data_fin.ok())
 | 
						|
           a.put(MOV_DATAREG, _data_fin);
 | 
						|
        a.put(MOV_TIPO, _tipo_fin);
 | 
						|
        if (_codice_fin != 0)
 | 
						|
          a.put(MOV_CODCF, _codice_fin); 
 | 
						|
        
 | 
						|
        if ((file.curr() >= da) && (file.curr() <= a))
 | 
						|
        {  
 | 
						|
          compila_clifo();
 | 
						|
          compila_comuni();
 | 
						|
          
 | 
						|
          if ((_tipo_clifo_prec == "")&&(_codcf_prec == 0l)) 
 | 
						|
          {
 | 
						|
            _tipo_clifo_prec = _tipo_elenco;
 | 
						|
            _codcf_prec      = _codcf; 
 | 
						|
            stampa_intestazione();
 | 
						|
          }
 | 
						|
          else
 | 
						|
            if (_tipo_clifo_prec == _tipo_elenco && _codcf_prec == _codcf)
 | 
						|
               _settata_prima_riga = FALSE;
 | 
						|
            else
 | 
						|
            {
 | 
						|
             stampa_intestazione();
 | 
						|
             _tipo_clifo_prec = _tipo_elenco;
 | 
						|
             _codcf_prec      = _codcf;
 | 
						|
             _settata_prima_riga = FALSE;
 | 
						|
            }    
 | 
						|
          return TRUE;
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
    else if (file == LF_RMOVIVA)
 | 
						|
    { 
 | 
						|
      int  gruppo = current_cursor()->curr(LF_RMOV).get_int(RMV_GRUPPO);
 | 
						|
      int  conto  = current_cursor()->curr(LF_RMOV).get_int(RMV_CONTO);          
 | 
						|
      
 | 
						|
      _pcon->zero();
 | 
						|
      _pcon->put("GRUPPO",gruppo);  
 | 
						|
      _pcon->put("CONTO", conto); 
 | 
						|
      _pcon->put("SOTTOCONTO", 0L);
 | 
						|
      
 | 
						|
      if (_pcon->read() == NOERR)
 | 
						|
        _ricser = _pcon->get_int("RICSER");
 | 
						|
      
 | 
						|
      _simbolo   = SimboloValuta(_codval);
 | 
						|
      _allegb    = CausAlleg(_codcaus);
 | 
						|
      _descr_doc = DescrDoc(_tipodoc);
 | 
						|
      //_totdocumenti += _totdoc;
 | 
						|
      //_ricser   = current_cursor()->curr(LF_RMOVIVA).get_int(RMI_RICSER);
 | 
						|
      _intracom = current_cursor()->curr(LF_RMOVIVA).get_bool(RMI_INTRA);          
 | 
						|
      
 | 
						|
      if ((_codval != "LIT") && _intracom)
 | 
						|
      {
 | 
						|
        reset_row(1);
 | 
						|
        set_row(1,"Corr.in lire@14g@pN",FLD(LF_MOV,MOV_CORRLIRE,"###.###.###.###"));
 | 
						|
        set_row(1,"@34gCorr.in valuta@49g@pN",FLD(LF_MOV,MOV_CORRVALUTA,"###.###.###.###"));
 | 
						|
        if (_simbolo.not_empty())
 | 
						|
          set_row(1,"@65g%.5s", (const char *)_simbolo);
 | 
						|
        else
 | 
						|
          set_row(1,"@65g%.3s", (const char *)_codval);
 | 
						|
      }
 | 
						|
      else if (!_settata_prima_riga)
 | 
						|
      {
 | 
						|
        reset_row(1);    
 | 
						|
        set_row(1,"@7n",FLD(LF_MOV,MOV_NUMREG));
 | 
						|
        set_row(1,"@8g@d",FLD(LF_MOV,MOV_DATAREG)); 
 | 
						|
        set_row(1,"@17g@3,rs",FLD(LF_MOV,MOV_REG));
 | 
						|
        set_row(1,"@21g@5n",FLD(LF_MOV,MOV_PROTIVA));
 | 
						|
        
 | 
						|
        TString protiva  = cur->curr(LF_MOV).get(MOV_PROTIVA);
 | 
						|
        TString uprotiva = cur->curr(LF_MOV).get(MOV_UPROTIVA);
 | 
						|
        
 | 
						|
        if (uprotiva.not_empty())
 | 
						|
        {                            
 | 
						|
          for (int i = 0; protiva[i] && (protiva[i] == uprotiva[i]); i++); 
 | 
						|
          uprotiva = uprotiva.mid(i);
 | 
						|
          set_row(1, "@24g/@25g%s", (const char*) uprotiva);
 | 
						|
        }
 | 
						|
        set_row(1, "@33g@d", FLD(LF_MOV,MOV_DATADOC)); 
 | 
						|
        set_row(1,"@42g@6,rs",FLD(LF_MOV,MOV_NUMDOC));
 | 
						|
        set_row(1,"@49g@3s",FLD(LF_MOV,MOV_CODCAUS));
 | 
						|
        set_row(1,"@53g@2s",FLD(LF_MOV,MOV_TIPODOC));
 | 
						|
        set_row(1,"@56g%.11s", (const char *)_descr_doc);
 | 
						|
        set_row(1,"@68g@pN",FLD(LF_MOV,MOV_TOTDOC,"###.###.###.###"));
 | 
						|
        set_row(1,"@84g@pN",FLD(LF_RMOVIVA,RMI_IMPONIBILE,"###.###.###.###"));      
 | 
						|
        set_row(1,"@101g@4s",FLD(LF_RMOVIVA,RMI_CODIVA));
 | 
						|
        set_row(1,"@105g@1n",FLD(LF_RMOVIVA,RMI_TIPODET));
 | 
						|
        if (_tipoatt == "E")
 | 
						|
          if (_ricser == 1)        
 | 
						|
            set_row(1,"@109g1");
 | 
						|
          else if (_ricser == 2)
 | 
						|
            set_row(1,"@109g2");
 | 
						|
        set_row(1,"@111g@f",FLD(LF_RMOVIVA,RMI_INTRA));
 | 
						|
        set_row(1,"@113g@pN",FLD(LF_RMOVIVA,RMI_IMPOSTA,"###.###.###.###"));
 | 
						|
        if (!_allegb)
 | 
						|
          set_row(1,"@131g*");
 | 
						|
 | 
						|
        incrementa_totali();        
 | 
						|
        _settata_prima_riga = TRUE;        
 | 
						|
        ++_documenti;
 | 
						|
      }       
 | 
						|
      else if (_settata_prima_riga)
 | 
						|
      {
 | 
						|
        reset_row(1);
 | 
						|
        set_row(1,"@84g@pN", FLD(LF_RMOVIVA,RMI_IMPONIBILE,"###.###.###.###"));
 | 
						|
        set_row(1,"@101g@4s",   FLD(LF_RMOVIVA,RMI_CODIVA));
 | 
						|
        set_row(1,"@113g@pN",  FLD(LF_RMOVIVA,RMI_IMPOSTA,"###.###.###.###"));
 | 
						|
        incrementa_totali();                           
 | 
						|
      }     
 | 
						|
      return TRUE;                  
 | 
						|
    }
 | 
						|
  }      
 | 
						|
    break;   
 | 
						|
 | 
						|
  case movimenti_sezionale:
 | 
						|
    break;
 | 
						|
    
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
  return FALSE;
 | 
						|
}
 | 
						|
 | 
						|
print_action CG3100_application::postprocess_page(int file,int count)
 | 
						|
{
 | 
						|
  if (count)
 | 
						|
  {
 | 
						|
    reset_print();
 | 
						|
    return NEXT_PAGE;
 | 
						|
  }
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
    if (file == LF_RMOV)
 | 
						|
    {
 | 
						|
      force_setpage();
 | 
						|
      break;
 | 
						|
    }
 | 
						|
    if (_scelta_stampa == 0)
 | 
						|
    {
 | 
						|
      if (file == LF_MOV)
 | 
						|
      {       
 | 
						|
        if (_stampa_parte_iva)
 | 
						|
        { 
 | 
						|
          int r = 0;
 | 
						|
          for (int j = 0; j < _c.items(); j++)
 | 
						|
          {
 | 
						|
            TRigaiva& riga = (TRigaiva&)_c[j];
 | 
						|
            r = j+1;
 | 
						|
            set_row(r, "Imponibile@12g%15.0r", &riga._imponibile);
 | 
						|
            set_row(r, "@31gImposta@39g%15.0r",   &riga._imposta);
 | 
						|
            set_row(r, "@58gCodice Iva@68g%3s", (const char*)riga._codiva);
 | 
						|
            switch (riga._tipodet)
 | 
						|
            {
 | 
						|
            case 0 : set_row(r, "@73gDetraibile");
 | 
						|
                     break;
 | 
						|
                   case 1 : set_row(r, "@73gIndetraibile su op.es.");
 | 
						|
                     break;
 | 
						|
                   case 3 : set_row(r, "@73gPassaggi interni");
 | 
						|
                     break;
 | 
						|
                   case 9 : set_row(r, "@73gIndetraibile art.19");
 | 
						|
                     break;
 | 
						|
                   default: break;   
 | 
						|
                   } 
 | 
						|
          } 
 | 
						|
          _c.destroy();
 | 
						|
          if (r > 0)
 | 
						|
            return REPEAT_PAGE;  
 | 
						|
          else 
 | 
						|
            return NEXT_PAGE;
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
    break;
 | 
						|
    
 | 
						|
  case fatture:
 | 
						|
    if (file == LF_MOV)
 | 
						|
    {
 | 
						|
      _totdocumenti += _totdoc;
 | 
						|
      TRecnotype pos, items;
 | 
						|
      bool FINITO = FALSE;
 | 
						|
      TLocalisamfile& mov = current_cursor()->file(LF_MOV);       
 | 
						|
      TCursor * cur = current_cursor();
 | 
						|
 | 
						|
      pos   = current_cursor()->pos();
 | 
						|
      items = current_cursor()->items();
 | 
						|
      
 | 
						|
      FINITO = (pos == items-1);
 | 
						|
 | 
						|
      if (!FINITO)
 | 
						|
      {
 | 
						|
        cur->save_status();
 | 
						|
        ++(*cur);
 | 
						|
        long numrsucc  = cur->file(LF_MOV).get_long(MOV_NUMREG);
 | 
						|
        _tipoelsucc    = cur->file(LF_MOV).get(MOV_TIPO);
 | 
						|
        _codclifosucc  = cur->file(LF_MOV).get_long(MOV_CODCF);
 | 
						|
        --(*cur);
 | 
						|
        cur->restore_status();
 | 
						|
      }
 | 
						|
 | 
						|
      if (FINITO || (_tipo_elenco != _tipoelsucc)||(_codcf != _codclifosucc))
 | 
						|
      {
 | 
						|
        reset_print();
 | 
						|
        TString blank = "";
 | 
						|
        set_row(1,(const char*)blank);
 | 
						|
        if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
 | 
						|
          set_row(2, "Totali Cliente@18gDocumenti Totale documenti@45gAllegati:@56gImponibile@75gImposta@94gop. esenti@112gop. non imp.");
 | 
						|
        else
 | 
						|
          set_row(2, "Totali Fornitore@18gDocumenti Totale documenti@47gAllegati:@56gImponibile@75gImposta@94gop. esenti@112gop. non imp.");
 | 
						|
        set_row(3, "@18g%9d", _documenti);
 | 
						|
        set_row(3, "@28g%r", &_totdocumenti);
 | 
						|
        set_row(3, "@56g%r", &_totimponibile);
 | 
						|
        set_row(3, "@75g%r", &_totimposta);
 | 
						|
        set_row(3, "@94g%r", &_op_esenti);
 | 
						|
        set_row(3, "@112g%r", &_op_non_imp);          
 | 
						|
        //_tipo_clifo_precedente = _tipo_elenco;
 | 
						|
        _totimposta    = 0;
 | 
						|
        _totimponibile = 0;
 | 
						|
        _op_esenti     = 0;
 | 
						|
        _op_non_imp    = 0;
 | 
						|
        _documenti     = 0;
 | 
						|
        _totdocumenti  = 0;
 | 
						|
        //_tipo_clifo_prec = "";
 | 
						|
        //_codcf_prec = 0l;
 | 
						|
        return REPEAT_PAGE;
 | 
						|
      }
 | 
						|
    }
 | 
						|
    /*
 | 
						|
    else if (file == LF_RMOVIVA)
 | 
						|
    {
 | 
						|
      long numrec;
 | 
						|
      TLocalisamfile* rmoviva = current_cursor()->file(LF_RMOVIVA);
 | 
						|
      
 | 
						|
      _numreg = current_cursor()->file(LF_RMOVIVA)->get_long(MOV_NUMREG); 
 | 
						|
      
 | 
						|
      TRecnotype recno = rmoviva.recno();
 | 
						|
      rmoviva.next();
 | 
						|
      numrec = rmoviva.get_long(RMI_NUMREG);
 | 
						|
      rmoviva.readat(recno);  
 | 
						|
      
 | 
						|
      if ( (_numreg != numrec) && (
 | 
						|
        _settata_prima_riga = FALSE;
 | 
						|
      else
 | 
						|
        _settata_prima_riga = TRUE;
 | 
						|
      
 | 
						|
    } 
 | 
						|
    */
 | 
						|
    break;
 | 
						|
 | 
						|
  case movimenti_sezionale:
 | 
						|
    break;
 | 
						|
 | 
						|
  default:
 | 
						|
    break;  
 | 
						|
    
 | 
						|
  }
 | 
						|
  return NEXT_PAGE; 
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
int CG3100_application::my_next(TLocalisamfile & mov)
 | 
						|
{
 | 
						|
  int     esito;
 | 
						|
  TString cod_reg, causale;
 | 
						|
  int     tipo_reg;
 | 
						|
  int     ann_reg;
 | 
						|
 | 
						|
  esito = mov.next(); 
 | 
						|
 | 
						|
  switch (_scelta_stampa)
 | 
						|
  {
 | 
						|
  case 0:
 | 
						|
    return esito;
 | 
						|
  case 1:
 | 
						|
    while (!mov.eof())
 | 
						|
    {
 | 
						|
      cod_reg  = mov.get     (MOV_REG);
 | 
						|
      ann_reg  = mov.get_int (MOV_ANNOIVA);
 | 
						|
      causale  = mov.get     (MOV_CODCAUS);
 | 
						|
 | 
						|
      //if (  ( ( _annoes != 0l) && (ann_reg != _annoes) )
 | 
						|
      //    || ( (causale < (const char*)_causale_ini) || (causale > (const char*)_causale_fin)) )
 | 
						|
      if (  ( _annoes != 0l) 
 | 
						|
          || ( (causale < (const char*)_causale_ini) || (causale > (const char*)_causale_fin)) )
 | 
						|
      {
 | 
						|
        esito=mov.next();
 | 
						|
        continue;
 | 
						|
      }
 | 
						|
      tipo_reg = CodiceRegistro (cod_reg, ann_reg);
 | 
						|
      if ( (tipo_reg != 1) && (tipo_reg != 2) )
 | 
						|
        return esito;
 | 
						|
 | 
						|
      esito=mov.next();
 | 
						|
    }
 | 
						|
    break;
 | 
						|
    
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
  return esito;
 | 
						|
}
 | 
						|
 | 
						|
print_action CG3100_application::postprocess_print(int file,int count)
 | 
						|
{
 | 
						|
  if (count)
 | 
						|
  {
 | 
						|
    reset_print();
 | 
						|
    return NEXT_PAGE;
 | 
						|
  }
 | 
						|
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
    if (file == LF_RMOV)
 | 
						|
    {
 | 
						|
      TRecnotype pos, items;
 | 
						|
      bool FINITO = FALSE;
 | 
						|
      
 | 
						|
      reset_print();
 | 
						|
      int n = 1;
 | 
						|
      if ((_scelta_stampa == 0)&&(_controllo_mov_errati != 3)&&(_tot_dare != _tot_avere))
 | 
						|
        set_row(n++, "@11g%s", ERR_77); 
 | 
						|
      
 | 
						|
      TLocalisamfile& mov =current_cursor()->file(LF_MOV);
 | 
						|
      // nrec = mov.recno();
 | 
						|
      
 | 
						|
      pos   = current_cursor()->pos();
 | 
						|
      items = current_cursor()->items();
 | 
						|
      
 | 
						|
      FINITO = (pos == items-1);
 | 
						|
 | 
						|
      _datareg = current_cursor()->file(LF_MOV).get_date(MOV_DATAREG);
 | 
						|
      _numreg  = current_cursor()->file(LF_MOV).get_long(MOV_NUMREG); 
 | 
						|
 | 
						|
      TDate datarec (_datareg);
 | 
						|
      if (!FINITO)
 | 
						|
      {
 | 
						|
        TCursor * cur = current_cursor();
 | 
						|
        cur->save_status();
 | 
						|
        ++(*cur);
 | 
						|
        datarec     = cur->file(LF_MOV).get_date(MOV_DATAREG);
 | 
						|
        --(*cur);
 | 
						|
        cur->restore_status();
 | 
						|
      }
 | 
						|
      /*
 | 
						|
         esito = my_next(mov);
 | 
						|
         if (esito == NOERR)
 | 
						|
         {
 | 
						|
         long numrec = mov.get_long(MOV_NUMREG);
 | 
						|
         datarec     = mov.get_date(MOV_DATAREG);
 | 
						|
         }
 | 
						|
         */
 | 
						|
      // mov.readat(nrec);
 | 
						|
      
 | 
						|
      _tot_avere_giornaliero += _tot_avere;
 | 
						|
      _tot_dare_giornaliero  += _tot_dare;                    
 | 
						|
 | 
						|
      //stampa i totali giornalieri
 | 
						|
      if ( FINITO ||
 | 
						|
          (_datareg != datarec)||(_numreg == _numreg_fin)) 
 | 
						|
      {
 | 
						|
        if ((  (_scelta_stampa == 0) && (_controllo_mov_errati != 1) && (_decidi == 2)) || ((_scelta_stampa == 1)&&(_decidi == 2))) 
 | 
						|
        {
 | 
						|
          TString data = _datareg.string();
 | 
						|
          set_row(n, "@50gTotali del");
 | 
						|
          set_row(n, "@61ggiorno %s", (const char *)data);
 | 
						|
          set_row(n, "@93g%r",         &_tot_dare_giornaliero);
 | 
						|
          set_row(n++, "@111g%r",      &_tot_avere_giornaliero);
 | 
						|
          _tot_avere_giornaliero = 0;
 | 
						|
          _tot_dare_giornaliero  = 0;
 | 
						|
          
 | 
						|
        }
 | 
						|
        else if (((_scelta_stampa == 0)&&(_controllo_mov_errati != 1)&&(_decidi == 1)&&(FINITO)) || ((_scelta_stampa == 1)&&(_decidi == 1)&&(FINITO)))
 | 
						|
        {
 | 
						|
          TString sep;     
 | 
						|
          sep = "";
 | 
						|
          set_row (n,(const char*)sep);   
 | 
						|
          set_row(++n, "@60gTotale generale");
 | 
						|
          set_row(n, "@93g%r",        &_tot_dare_generale);
 | 
						|
          set_row(n++, "@111g%r",     &_tot_avere_generale);
 | 
						|
        }  
 | 
						|
      } 
 | 
						|
      
 | 
						|
      if (n == 1)
 | 
						|
      {
 | 
						|
        force_setpage();
 | 
						|
        return NEXT_PAGE;
 | 
						|
      }
 | 
						|
      else
 | 
						|
      { 
 | 
						|
        _no_preprocess_page = TRUE;
 | 
						|
        force_setpage(FALSE);
 | 
						|
        return REPEAT_PAGE;
 | 
						|
      }
 | 
						|
      
 | 
						|
    }
 | 
						|
    
 | 
						|
    break;
 | 
						|
    
 | 
						|
  case fatture:
 | 
						|
    break;
 | 
						|
    
 | 
						|
  case movimenti_sezionale:
 | 
						|
    break;
 | 
						|
    
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
  return NEXT_PAGE;
 | 
						|
} 
 | 
						|
 | 
						|
bool CG3100_application::segnala_errori_primariga()
 | 
						|
{
 | 
						|
  int  tiporeg;
 | 
						|
 | 
						|
  if ((_tiporegistro == 1)||(_tiporegistro == 2)) //movimento iva
 | 
						|
  {
 | 
						|
    tiporeg = CodiceRegistro (_registro, _anno);
 | 
						|
 | 
						|
    if (   (tiporeg == 0)  ||
 | 
						|
        (_caus->bad())  ||
 | 
						|
        (_tipodocumento != _tipodoc) ||
 | 
						|
        ((_stampa_mess_alleg_iva) && (!_alleg_causale)))
 | 
						|
      return TRUE;
 | 
						|
  }
 | 
						|
  return FALSE;
 | 
						|
} 
 | 
						|
 | 
						|
 | 
						|
bool CG3100_application::segnala_errori_ogniriga()
 | 
						|
{
 | 
						|
  bool trovato = FALSE;   
 | 
						|
  TString dep1;
 | 
						|
 | 
						|
  if ((_tiporegistro == 1)||(_tiporegistro == 2)) //movimento iva
 | 
						|
  { 
 | 
						|
    long record, numreg;
 | 
						|
    TLocalisamfile& rmoviva = current_cursor()->file(LF_RMOVIVA);
 | 
						|
    _numreg = current_cursor()->file(LF_MOV).get_long(MOV_NUMREG);
 | 
						|
    if (current_cursor()->is_first_match(LF_RMOVIVA))
 | 
						|
    {
 | 
						|
      record = rmoviva.recno(); 
 | 
						|
      rmoviva.zero();
 | 
						|
      rmoviva.put(RMI_NUMREG, _numreg);
 | 
						|
      for (rmoviva.read(); !rmoviva.eof() ;rmoviva.next())
 | 
						|
      {
 | 
						|
        _cod    = rmoviva.get(RMI_CODIVA);         
 | 
						|
        _tipod  = rmoviva.get_int(RMI_TIPODET);
 | 
						|
        _impo   = rmoviva.get_real(RMI_IMPONIBILE);
 | 
						|
        _impos  = rmoviva.get_real(RMI_IMPOSTA);
 | 
						|
        _tipocr = rmoviva.get_int(RMI_TIPOCR);
 | 
						|
        numreg  = rmoviva.get_long(RMI_NUMREG);
 | 
						|
        if (numreg != _numreg)
 | 
						|
          break;
 | 
						|
        else
 | 
						|
        {
 | 
						|
          if (_tiporegistro == 1)
 | 
						|
            switch (_tipocr)
 | 
						|
            {
 | 
						|
              case 2 : case 3: case 5: case 8: case 9: _err1 = ERR_09;
 | 
						|
                                                       trovato = TRUE;
 | 
						|
                                                       break;
 | 
						|
              default: break;   
 | 
						|
            }
 | 
						|
          else
 | 
						|
            if (_tiporegistro == 2)
 | 
						|
              switch (_tipocr)
 | 
						|
              { 
 | 
						|
                case 4: case 9: _err1 = ERR_09;
 | 
						|
                              trovato = TRUE;
 | 
						|
                              break;
 | 
						|
                default: break;
 | 
						|
              }
 | 
						|
          if (_tipodoc != "AN")
 | 
						|
          {
 | 
						|
            _tabiva->setkey(1);
 | 
						|
            _tabiva->zero();
 | 
						|
            dep1.format("%-4s",(const char*) _cod);
 | 
						|
            _tabiva->put("CODTAB", (const char*)dep1);
 | 
						|
            _tabiva->read();
 | 
						|
            if (_tabiva->good())
 | 
						|
            {
 | 
						|
              TString colonnac = _tabiva->get("S7");
 | 
						|
              TString colonnaf = _tabiva->get("S8");
 | 
						|
              bool sospeso  = _tabiva->get_bool("B2");
 | 
						|
              if (sospeso)
 | 
						|
              {
 | 
						|
                _err = ERR_2;
 | 
						|
                trovato = TRUE;
 | 
						|
              }
 | 
						|
              else if ((_stampa_mess_alleg_iva)&&((colonnac==" ")
 | 
						|
                                                  ||(colonnaf==" ")))          
 | 
						|
              {
 | 
						|
                _msg  = MSG_54;
 | 
						|
                trovato = TRUE;
 | 
						|
              }
 | 
						|
              // break; 
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
              _err2 = ERR_1;
 | 
						|
              trovato = TRUE;
 | 
						|
            }  
 | 
						|
          }
 | 
						|
        }
 | 
						|
      } //for
 | 
						|
      rmoviva.readat (record);   
 | 
						|
    }
 | 
						|
  } 
 | 
						|
  return trovato;
 | 
						|
}       
 | 
						|
 | 
						|
void CG3100_application::incrementa_totali()
 | 
						|
{
 | 
						|
  TString dep1;
 | 
						|
  real imponibile, imposta;
 | 
						|
 | 
						|
  imponibile = current_cursor()->file(LF_RMOVIVA).get_real(RMI_IMPONIBILE);
 | 
						|
  imposta = current_cursor()->file(LF_RMOVIVA).get_real(RMI_IMPOSTA);
 | 
						|
  TString codiva = current_cursor()->file(LF_RMOVIVA).get(RMI_CODIVA);
 | 
						|
  _tabiva->zero();
 | 
						|
  dep1.format("%-4s",(const char*) codiva);
 | 
						|
  _tabiva->put("CODTAB", (const char*)dep1);
 | 
						|
  _tabiva->read();
 | 
						|
  if (_tabiva->bad())
 | 
						|
    _tabiva->zero();
 | 
						|
  if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
 | 
						|
  {
 | 
						|
    TString colonna = _tabiva->get("S7");
 | 
						|
    if ((colonna == "1")||(colonna == "3"))
 | 
						|
      _totimposta += imposta;
 | 
						|
    if (colonna == "1")
 | 
						|
      _totimponibile += imponibile;
 | 
						|
    else
 | 
						|
      if (colonna == "3")
 | 
						|
        _op_esenti += imponibile;  
 | 
						|
  }
 | 
						|
  else
 | 
						|
  {
 | 
						|
    TString colonna = _tabiva->get("S8");
 | 
						|
    if ((colonna == "1")||(colonna == "3")||(colonna == "4"))
 | 
						|
      _totimposta += imposta;
 | 
						|
    if (colonna == "1")
 | 
						|
      _totimponibile += imponibile;
 | 
						|
    else
 | 
						|
      if (colonna == "3")
 | 
						|
        _op_esenti += imponibile;
 | 
						|
      else 
 | 
						|
        if (colonna == "4")
 | 
						|
          _op_non_imp += imponibile;
 | 
						|
  }       
 | 
						|
}
 | 
						|
 | 
						|
bool CG3100_application::set_print(int m)
 | 
						|
{
 | 
						|
  _masc = "";
 | 
						|
  switch(m)
 | 
						|
  {
 | 
						|
  case 1: 
 | 
						|
    _masc = "cg3100a";
 | 
						|
    _tipo_lista = movimenti;
 | 
						|
    break;
 | 
						|
  case 2:
 | 
						|
    _masc = "cg3100b";
 | 
						|
    _tipo_lista = fatture;
 | 
						|
    break;
 | 
						|
  case 3:
 | 
						|
    _masc = "cg3100c";
 | 
						|
    _tipo_lista = movimenti_sezionale;
 | 
						|
    break;
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
 | 
						|
  TMask msk(_masc);
 | 
						|
  
 | 
						|
  msk.set_handler(F_ANNO, annoes);
 | 
						|
  msk.set_handler(F_DATAINI, data_inizio);
 | 
						|
  msk.set_handler(F_DATAFIN, data_fine);
 | 
						|
  
 | 
						|
  if (msk.run() != K_ENTER) return FALSE;
 | 
						|
 | 
						|
  reset_files();
 | 
						|
  //_curr1->set_filterfunction (0);
 | 
						|
  _curr1->set_filterfunction (filter_func);
 | 
						|
  _curr2->set_filterfunction (filter_func);
 | 
						|
  _curr3->set_filterfunction (filter_func_fatture);
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
   case movimenti:
 | 
						|
   {
 | 
						|
    _scelta_stampa = atoi(msk.get(F_MOVIMENTI));
 | 
						|
    _annoes = msk.get_int (F_ANNO);
 | 
						|
    _decidi = msk.get_int(F_DECIDI);
 | 
						|
    _causale_ini = msk.get(F_CAUSALEINI);
 | 
						|
    _causale_fin = msk.get(F_CAUSALEFIN);
 | 
						|
    if (_scelta_stampa == 0)
 | 
						|
    {
 | 
						|
      _registro_ini = msk.get(F_REGISTROINI);
 | 
						|
      _registro_fin = msk.get(F_REGISTROFIN);
 | 
						|
    }
 | 
						|
    _numreg_ini = atol(msk.get(F_NUMEROINI));
 | 
						|
    _data_ini = msk.get(F_DATAINI);
 | 
						|
    _data_fin = msk.get(F_DATAFIN);
 | 
						|
    _numreg_fin = atoi(msk.get(F_NUMEROFIN));
 | 
						|
    bool provvis = msk.get_bool(F_STAMPAMOVP);
 | 
						|
    if (_decidi == 1)
 | 
						|
    {
 | 
						|
      select_cursor(_cur1);
 | 
						|
      if (!provvis)
 | 
						|
        _curr1->setfilter("(PROVVIS=\"\")"); 
 | 
						|
      else _curr1->setfilter("");
 | 
						|
      TLocalisamfile& fl = current_cursor()->file(LF_MOV);
 | 
						|
      TRectype da (fl.curr());
 | 
						|
      TRectype a (fl.curr());
 | 
						|
      da.zero();
 | 
						|
      a.zero();
 | 
						|
      da.put(MOV_NUMREG, _numreg_ini);
 | 
						|
      a.put(MOV_NUMREG, _numreg_fin);
 | 
						|
      current_cursor()->setregion(da,a);
 | 
						|
      add_file(LF_MOV);
 | 
						|
      add_file(LF_RMOV,LF_MOV);
 | 
						|
      add_file(LF_RMOVIVA,LF_MOV);
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      select_cursor(_cur2);
 | 
						|
      if (!provvis)
 | 
						|
        _curr2->setfilter("(PROVVIS=\"\")");                                         
 | 
						|
      else 
 | 
						|
        _curr2->setfilter(""); 
 | 
						|
      TLocalisamfile& fl = current_cursor()->file(LF_MOV);
 | 
						|
      TRectype da (fl.curr());
 | 
						|
      TRectype a (fl.curr());
 | 
						|
      da.zero();
 | 
						|
      a.zero();
 | 
						|
      if (_data_ini.ok())  
 | 
						|
         da.put(MOV_DATAREG, _data_ini);
 | 
						|
      if (_data_fin.ok())
 | 
						|
         a.put(MOV_DATAREG, _data_fin);
 | 
						|
      current_cursor()->setregion(da,a);
 | 
						|
      add_file(LF_MOV);
 | 
						|
      add_file(LF_RMOV,LF_MOV);
 | 
						|
      add_file(LF_RMOVIVA,LF_MOV);
 | 
						|
    }
 | 
						|
  }
 | 
						|
  break;
 | 
						|
 | 
						|
 case fatture:
 | 
						|
{
 | 
						|
  TLocalisamfile& fl = current_cursor()->file(LF_MOV);
 | 
						|
  TString tipo = msk.get(F_TIPOELENCO);
 | 
						|
  bool movprov = msk.get_bool(F_STAMPAMOVP);
 | 
						|
  if (tipo=="C" || tipo=="F")
 | 
						|
  {
 | 
						|
    _codice_ini = atol(msk.get(F_CODICEINI));
 | 
						|
    _codice_fin = atol(msk.get(F_CODICEFIN));
 | 
						|
  }
 | 
						|
  else
 | 
						|
  {
 | 
						|
    _codice_ini = atol(msk.get(F_CODICEINI1));
 | 
						|
    _codice_fin = atol(msk.get(F_CODICEFIN1));
 | 
						|
  }
 | 
						|
 | 
						|
  //   _relmov.add(LF_MOV, "NUMREG=NUMREG",1, LF_RMOVIVA,100); //creo un alias per il file LF_MOV
 | 
						|
  if (tipo == "E")
 | 
						|
  {
 | 
						|
    _tipo_ini = "C";
 | 
						|
    _tipo_fin = "F";
 | 
						|
  }
 | 
						|
  else
 | 
						|
  {
 | 
						|
    _tipo_ini = tipo;
 | 
						|
    _tipo_fin = tipo;
 | 
						|
  }
 | 
						|
  select_cursor(_cur3);
 | 
						|
  if (!movprov)
 | 
						|
    _curr3->setfilter("(PROVVIS=\"\")");
 | 
						|
  else _curr3->setfilter("");
 | 
						|
  TRectype da (fl.curr());
 | 
						|
  TRectype a (fl.curr());
 | 
						|
  da.zero();
 | 
						|
  a.zero();
 | 
						|
  if (_codice_ini != 0)
 | 
						|
    da.put(MOV_CODCF, _codice_ini);
 | 
						|
  a.put(MOV_TIPO, _tipo_fin);
 | 
						|
  if (_codice_fin != 0)
 | 
						|
    a.put(MOV_CODCF, _codice_fin);
 | 
						|
  if (_data_ini.ok())
 | 
						|
     da.put(MOV_DATAREG, _data_ini);
 | 
						|
  if (_data_fin.ok())
 | 
						|
     a.put(MOV_DATAREG, _data_fin);
 | 
						|
  da.put(MOV_TIPO, _tipo_ini);
 | 
						|
  current_cursor()->setregion(da,a);
 | 
						|
  add_file(LF_MOV);
 | 
						|
  add_file(LF_RMOVIVA,LF_MOV);
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
break;
 | 
						|
 | 
						|
 | 
						|
 case movimenti_sezionale:
 | 
						|
 break;
 | 
						|
 | 
						|
 default:
 | 
						|
 break;
 | 
						|
}
 | 
						|
 | 
						|
init_print(msk);
 | 
						|
 | 
						|
return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
void CG3100_application::user_create()
 | 
						|
{
 | 
						|
  _relmov1 = new TRelation (LF_MOV);
 | 
						|
  _relmov2 = new TRelation (LF_MOV);
 | 
						|
  _relmov3 = new TRelation (LF_MOV);
 | 
						|
  
 | 
						|
  _relmov1->add(LF_RMOV,    "NUMREG=NUMREG",1);
 | 
						|
  _relmov1->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
 | 
						|
 | 
						|
  _relmov2->add(LF_RMOV,    "NUMREG=NUMREG",1); 
 | 
						|
  _relmov2->add(LF_RMOVIVA, "NUMREG=NUMREG",1);  
 | 
						|
 | 
						|
  _relmov3->add(LF_RMOVIVA, "NUMREG=NUMREG",1);   
 | 
						|
  _relmov3->add(LF_RMOV,    "NUMREG=NUMREG",1); 
 | 
						|
  
 | 
						|
  _curr1 = new TCursor (_relmov1, "", 1);
 | 
						|
  _curr2 = new TCursor (_relmov2, "", 2);
 | 
						|
  _curr3 = new TCursor (_relmov3, "", 3);
 | 
						|
  
 | 
						|
  _cur1 = add_cursor (_curr1);
 | 
						|
  _cur2 = add_cursor (_curr2);   
 | 
						|
  _cur3 = add_cursor (_curr3);
 | 
						|
 | 
						|
  //_curr1->set_filterfunction (filter_func);
 | 
						|
  //_curr2->set_filterfunction (filter_func);
 | 
						|
  //_curr3->set_filterfunction (filter_func_fatture);
 | 
						|
  
 | 
						|
  _caus    = new TLocalisamfile(LF_CAUSALI);
 | 
						|
  _clifo   = new TLocalisamfile(LF_CLIFO);
 | 
						|
  _comuni  = new TLocalisamfile(LF_COMUNI);
 | 
						|
  _attiv   = new TLocalisamfile(LF_ATTIV);
 | 
						|
  _pcon    = new TLocalisamfile(LF_PCON);
 | 
						|
  _rmoviva = new TLocalisamfile(LF_RMOVIVA);
 | 
						|
  _nditte  = new TLocalisamfile(LF_NDITTE);
 | 
						|
  _tabiva  = new TTable(TAB_IVA);
 | 
						|
  _tabtpd  = new TTable(TAB_TPD);
 | 
						|
  _tabreg  = new TTable("REG");
 | 
						|
  _tabes   = new TTable("ESC");
 | 
						|
}
 | 
						|
 | 
						|
void CG3100_application::user_destroy() // releasev e arrmask
 | 
						|
{ 
 | 
						|
  //delete _msk;
 | 
						|
  delete _relmov;
 | 
						|
  delete _clifo;
 | 
						|
  delete _caus;
 | 
						|
  delete _pcon;
 | 
						|
  delete _attiv;
 | 
						|
  delete _comuni;
 | 
						|
  delete _tabiva;
 | 
						|
  delete _tabreg;
 | 
						|
  delete _tabtpd;
 | 
						|
  delete _rmoviva;
 | 
						|
}
 | 
						|
 | 
						|
void CG3100_application::init_print(const TMask& msk)
 | 
						|
{
 | 
						|
  set_real_picture("###.###.###.###");
 | 
						|
 | 
						|
  TDate data (msk.get(F_DATASTAMPA));
 | 
						|
  printer().setdate(data);
 | 
						|
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
  {
 | 
						|
    reset_print();
 | 
						|
    _flags = 0;
 | 
						|
    _tot_dare_giornaliero  = 0;
 | 
						|
    _tot_avere_giornaliero = 0;
 | 
						|
    _tot_dare_generale     = 0;
 | 
						|
    _tot_avere_generale    = 0;
 | 
						|
    if (_scelta_stampa == 0)
 | 
						|
    {
 | 
						|
      _annoes = msk.get_int(F_ANNO);
 | 
						|
      _stampa_parte_iva = (bool)(msk.get(F_STAMPA)=="X");
 | 
						|
      if (_stampa_parte_iva)
 | 
						|
        _flags |= ST_DATI_IVA;
 | 
						|
      _stampa_mess_alleg_iva = (bool)(msk.get(F_ALLEGATO)=="X");
 | 
						|
      if (_stampa_mess_alleg_iva)
 | 
						|
        _flags |= ST_MESS_ALLEG;
 | 
						|
      _stampa_anno_comp = (bool)(msk.get(F_ANNOC)=="X");
 | 
						|
      if (_stampa_anno_comp)
 | 
						|
         _flags |= ST_ANNO_COMP;   
 | 
						|
      _controllo_mov_errati = atoi(msk.get(F_CONTROLLO));
 | 
						|
      if (_controllo_mov_errati == 1)
 | 
						|
        _flags |= ST_SOLO_MOVERR;
 | 
						|
      else if (_controllo_mov_errati == 2)
 | 
						|
        _flags |= ST_CONTROLLO;
 | 
						|
      else _flags |= ST_SENZA_CONTR;
 | 
						|
      if ((_numreg_ini != 0)&&(_decidi == 1))
 | 
						|
        _flags |= ST_NUMERO;
 | 
						|
      if ((_data_ini.ok())&&(_decidi == 2))
 | 
						|
        _flags |= ST_DATA;
 | 
						|
      _causale_ini = msk.get(F_CAUSALEINI);
 | 
						|
      if (_causale_ini != "")
 | 
						|
        _flags |= ST_CAUSALE;
 | 
						|
      _registro_ini = msk.get(F_REGISTROINI);
 | 
						|
      if (_registro_ini != "")
 | 
						|
        _flags |= ST_REGISTRO;
 | 
						|
      if ((_data_fin.ok())&&(_decidi == 2))
 | 
						|
        _flags |= ST_DATA;
 | 
						|
      if ((_numreg_fin != 0)&&(_decidi == 2))
 | 
						|
        _flags |= ST_NUMERO;
 | 
						|
      _causale_fin = msk.get(F_CAUSALEFIN);
 | 
						|
      if (_causale_fin != "")
 | 
						|
        _flags |= ST_CAUSALE;
 | 
						|
      _registro_fin = msk.get(F_REGISTROFIN);
 | 
						|
      if (_registro_fin != "")
 | 
						|
        _flags |= ST_REGISTRO;
 | 
						|
    }
 | 
						|
    else //_scelta_stampa == 1
 | 
						|
    {
 | 
						|
      _annoes = msk.get_int(F_ANNO);
 | 
						|
      if (_numreg_ini != 0)
 | 
						|
        _flags |= ST_NUMERO;
 | 
						|
      if (_data_ini.ok())
 | 
						|
        _flags |= ST_DATA;
 | 
						|
      _causale_ini = msk.get(F_CAUSALEINI);
 | 
						|
      if (_causale_ini != "")
 | 
						|
        _flags |= ST_CAUSALE;
 | 
						|
      if (_data_fin.ok())
 | 
						|
        _flags |= ST_DATA;
 | 
						|
      if (_numreg_fin != 0)
 | 
						|
        _flags |= ST_NUMERO;
 | 
						|
      _causale_fin = msk.get(F_CAUSALEFIN);
 | 
						|
      if (_causale_fin != "")
 | 
						|
        _flags |= ST_CAUSALE;
 | 
						|
    }
 | 
						|
  }
 | 
						|
  break;
 | 
						|
 | 
						|
 | 
						|
 case fatture:
 | 
						|
{
 | 
						|
  _flags = 0;
 | 
						|
{
 | 
						|
  reset_print();
 | 
						|
  _settata_prima_riga = FALSE;
 | 
						|
  _tipo_clifo_prec = "";
 | 
						|
  _tipo_clifo_precedente = "";
 | 
						|
  _codcf_prec = 0l;
 | 
						|
  _numeroregp = 0;
 | 
						|
  _documenti = 0;
 | 
						|
  _totdocumenti = 0;
 | 
						|
  _totimponibile = 0;
 | 
						|
  _totimposta = 0;
 | 
						|
  _op_esenti = 0;
 | 
						|
  _op_non_imp = 0;
 | 
						|
  _annoes = msk.get_int(F_ANNO);
 | 
						|
  _salto_pagina = (bool)(msk.get(F_CAMBIO)=="X");
 | 
						|
  _data_ini = msk.get(F_DATAINI);
 | 
						|
  if (_data_ini.ok())
 | 
						|
    _flags |= ST_DATA;
 | 
						|
  _data_fin = msk.get(F_DATAFIN);
 | 
						|
  if (_data_fin.ok())
 | 
						|
    _flags |= ST_DATA;
 | 
						|
  TString tipo = msk.get(F_TIPOELENCO);
 | 
						|
  if ((tipo=="C")||(tipo=="F"))
 | 
						|
  {
 | 
						|
    _codice_ini = atol(msk.get(F_CODICEINI));
 | 
						|
    _codice_fin = atol(msk.get(F_CODICEFIN));
 | 
						|
  }
 | 
						|
  else
 | 
						|
  {
 | 
						|
    _codice_ini = atol(msk.get(F_CODICEINI1));
 | 
						|
    _codice_fin = atol(msk.get(F_CODICEFIN1));
 | 
						|
  }
 | 
						|
  if (_codice_ini != 0)
 | 
						|
    _flags |= ST_CODICE;
 | 
						|
  if (_codice_fin != 0)
 | 
						|
    _flags |= ST_CODICE;
 | 
						|
  if (tipo == "E")
 | 
						|
  {
 | 
						|
    _tipo_ini = "C";
 | 
						|
    _tipo_fin = "F";
 | 
						|
  }
 | 
						|
  else
 | 
						|
  {
 | 
						|
    _tipo_ini = tipo;
 | 
						|
    _tipo_fin = tipo;
 | 
						|
  }
 | 
						|
}
 | 
						|
}
 | 
						|
break;
 | 
						|
 | 
						|
 | 
						|
 case movimenti_sezionale:
 | 
						|
 break;
 | 
						|
 | 
						|
default:
 | 
						|
break;
 | 
						|
}
 | 
						|
}  
 | 
						|
 | 
						|
void CG3100_application::preprocess_header()
 | 
						|
{
 | 
						|
  int soh;       // riga d'inizio dell'intestazione
 | 
						|
  TString sep(132);
 | 
						|
  TLocalisamfile nditte(LF_NDITTE); 
 | 
						|
 | 
						|
  nditte.zero();
 | 
						|
  nditte.put(NDT_CODDITTA, get_firm());   
 | 
						|
  if (nditte.read() == NOERR) 
 | 
						|
    _ragsoc = nditte.get(NDT_RAGSOC);
 | 
						|
  
 | 
						|
  reset_header();
 | 
						|
  soh=1;
 | 
						|
  sep << "Ditta  " << get_firm();
 | 
						|
  sep << " " << _ragsoc;
 | 
						|
  sep.left_just(132);
 | 
						|
  
 | 
						|
  set_header (soh++, (const char*) sep);
 | 
						|
  
 | 
						|
  sep = "Studio     ";
 | 
						|
  sep << "Data @<  Pag. @#";
 | 
						|
  
 | 
						|
  sep.right_just(127);
 | 
						|
  
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
    if (_scelta_stampa == 0)
 | 
						|
    {
 | 
						|
      sep.overwrite ("Lista movimenti");
 | 
						|
      set_header (soh++, (const char*)sep);
 | 
						|
      if (_decidi == 2)
 | 
						|
      {
 | 
						|
        if (_annoes != 0)
 | 
						|
        {
 | 
						|
           set_header (soh, "Anno %d", _annoes);
 | 
						|
           if (_flags & ST_DATA)
 | 
						|
           {
 | 
						|
             set_header (soh, "@10gda@13g%s",_data_ini.string()); 
 | 
						|
             set_header (soh, "@24ga@26g%s",_data_fin.string());
 | 
						|
           }
 | 
						|
        }
 | 
						|
        else
 | 
						|
           if (_flags & ST_DATA)
 | 
						|
           {
 | 
						|
             set_header (soh, "Dalla data@12g%s",_data_ini.string()); 
 | 
						|
             set_header (soh, "@24galla data@34g%s",_data_fin.string());
 | 
						|
           }   
 | 
						|
           else 
 | 
						|
             set_header (soh, "Completa in ordine di data");
 | 
						|
      }
 | 
						|
      else
 | 
						|
        if (_flags & ST_NUMERO)
 | 
						|
        {
 | 
						|
          set_header (soh, "dal numero@12g%d", _numreg_ini);
 | 
						|
          set_header (soh, "@20gal numero@30g%d", _numreg_fin);
 | 
						|
        } 
 | 
						|
        else
 | 
						|
          set_header (soh, "Completa in ordine di numero");
 | 
						|
      if (_flags & ST_CAUSALE)
 | 
						|
      {
 | 
						|
        set_header (soh, "@46gdalla causale@60g%s",(const char*)_causale_ini);
 | 
						|
        set_header (soh++, "@64galla causale@77g%s",(const char*)_causale_fin);
 | 
						|
      }
 | 
						|
      else
 | 
						|
        set_header (soh++, "     tutte le causali");
 | 
						|
      if (_flags & ST_REGISTRO)
 | 
						|
      {
 | 
						|
        set_header (soh, "dal registro@14g%s",(const char*)_registro_ini);
 | 
						|
        set_header (soh, "@18gal registro@30g%s",(const char*)_registro_fin);
 | 
						|
      }
 | 
						|
      else
 | 
						|
        set_header (soh, "tutti i registri");
 | 
						|
      if (_flags & ST_DATI_IVA)
 | 
						|
        set_header (soh, "@34gstampa dati iva");
 | 
						|
      if (_flags & ST_CONTROLLO)
 | 
						|
        set_header (soh, "@50g(controllo movimenti)");
 | 
						|
      else if (_flags & ST_SOLO_MOVERR)
 | 
						|
        set_header (soh, "@50g(solo movimenti errati)");
 | 
						|
      else set_header (soh, "@50g(senza controllo movimenti)");
 | 
						|
      if ((_flags & (ST_ANNO_COMP|ST_MESS_ALLEG)) == 1)
 | 
						|
        set_header (soh, "@78gcon messaggi: anno di competenza, allegato iva");
 | 
						|
      else if (_flags & ST_ANNO_COMP)
 | 
						|
        set_header (soh, "@78gcon messaggio: anno di competenza");
 | 
						|
      else if (_flags & ST_MESS_ALLEG)
 | 
						|
        set_header (soh, "@78gcon messaggio: allegato iva");
 | 
						|
      sep.fill('-');
 | 
						|
      set_header (++soh, (const char *) sep);
 | 
						|
      set_header (++soh, "Rg  Cod Causale@30gDescrizione@56gCodice conto@72gDescrizione conto@98gDare@116gAvere@130gSB");
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      sep.overwrite ("Lista movimenti di sola prima nota");
 | 
						|
      set_header (soh++, (const char*)sep);
 | 
						|
      if (_decidi == 2)
 | 
						|
      {
 | 
						|
       if (_annoes != 0)
 | 
						|
       {
 | 
						|
         set_header (soh, "Anno %d", (const char*)_annoes);
 | 
						|
         if (_flags & ST_DATA)
 | 
						|
         {
 | 
						|
           set_header (soh, "@10gda@13g%s",_data_ini.string()); 
 | 
						|
           set_header (soh, "@24ga@26g%s",_data_fin.string());
 | 
						|
         }
 | 
						|
       }
 | 
						|
       else
 | 
						|
         if (_flags & ST_DATA)
 | 
						|
         {
 | 
						|
           set_header (soh, "Dalla data@12g%s",_data_ini.string()); 
 | 
						|
           set_header (soh, "@24galla data@34g%s",_data_fin.string());
 | 
						|
         }   
 | 
						|
         else 
 | 
						|
           set_header (soh, "Completa in ordine di data");
 | 
						|
      } 
 | 
						|
      else 
 | 
						|
        if (_flags & ST_NUMERO)
 | 
						|
        {
 | 
						|
         set_header (soh, "@46gdal numero@57g%d", (const char*)_numreg_ini);
 | 
						|
         set_header (soh, "@65gal numero@75g%d",(const char*)_numreg_fin);
 | 
						|
        }
 | 
						|
        else
 | 
						|
          set_header (soh, "@46gCompleta in ordine di numero");
 | 
						|
      if (_flags & ST_CAUSALE)
 | 
						|
      {
 | 
						|
        set_header(soh, "@86gdalla causale@100g%3s",(const char*)_causale_ini);
 | 
						|
        set_header(soh++,"@103galla causale@116g%3s",(const char*)_causale_fin);
 | 
						|
      }
 | 
						|
      else
 | 
						|
        set_header (soh++, "@86gtutte le causali");
 | 
						|
      sep.fill('-');
 | 
						|
      set_header (soh++, (const char *) sep);
 | 
						|
      set_header (soh++, "Rg  Cod Causale@30gDescrizione@56gCodice conto@72gDescrizione conto@98gDare@116gAvere@130gSB");
 | 
						|
    }
 | 
						|
    break;
 | 
						|
 | 
						|
  case fatture:
 | 
						|
    sep.overwrite ("Lista fatture");
 | 
						|
    set_header (soh, (const char*)sep);
 | 
						|
    if (_annoes != 0)
 | 
						|
    {
 | 
						|
      set_header (soh, "@15gAnno %d", (const char*)_annoes);
 | 
						|
      if (_flags & ST_DATA)
 | 
						|
      { 
 | 
						|
        set_header (soh, "@25gdalla data@36g%s",_data_ini.string()); 
 | 
						|
        set_header (soh, "@47galla data@57g%s",_data_fin.string());
 | 
						|
      }
 | 
						|
    }
 | 
						|
    else
 | 
						|
      if (_flags & ST_DATA)
 | 
						|
      { 
 | 
						|
        set_header (soh, "@15gdalla data@26g%s",_data_ini.string()); 
 | 
						|
        set_header (soh, "@37galla data@47g%s",_data_fin.string());
 | 
						|
      }
 | 
						|
      else 
 | 
						|
        set_header (soh, "@15gcompleta in ordine di data");
 | 
						|
    if (_flags & ST_CODICE)
 | 
						|
    {
 | 
						|
      set_header (soh, "@99gdal codice@110g%d",_codice_ini);
 | 
						|
      set_header (soh, "@117gal codice@127g%d",_codice_fin);   
 | 
						|
    }
 | 
						|
    sep.fill('-');
 | 
						|
    set_header (++soh, (const char *) sep);
 | 
						|
    set_header (++soh, "Registrazione @17gCod Protoc.     Documento@49gCod Tp @68gTotale@101gCd  Tp  T O@129gNo");
 | 
						|
    set_header (++soh, "Numero  Data@17gReg Numero      Data@42gNumero@49gCau Dc @56gDescrizione@68gDocumento@84gImponibile @101gIv  Det A I@113gImposta@129gAll"); 
 | 
						|
    break;
 | 
						|
    
 | 
						|
  case movimenti_sezionale:
 | 
						|
    sep.fill(' ');
 | 
						|
    sep.overwrite ("Lista movimenti di solo sezionale");
 | 
						|
    set_header (soh++, (const char*)sep);
 | 
						|
    sep.fill('-');
 | 
						|
    set_header (soh++, (const char *) sep);
 | 
						|
    break;
 | 
						|
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
  set_header (++soh,(const char*)sep);
 | 
						|
  if (_tipo_lista != fatture)
 | 
						|
  {
 | 
						|
    sep = "";
 | 
						|
    set_header (++soh,(const char*)sep);
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
int cg3100(int argc, char* argv[])
 | 
						|
{
 | 
						|
  CG3100_application a;
 | 
						|
  a.run(argc, argv, "Stampa movimenti");
 | 
						|
  return 0;
 | 
						|
}
 | 
						|
 | 
						|
 |