Files correlati : cg3.exe Ricompilazione Demo : [ ] Commento : 0000994: selezione per causale Nella lista fatture per cliente e fornitore, seleziono per una causale mai utilizzata e mi vengono stampate tutte le fatture di vendita dell'esercizio. git-svn-id: svn://10.65.10.50/trunk@17699 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			2469 lines
		
	
	
		
			70 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			2469 lines
		
	
	
		
			70 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
//
 | 
						|
//Lista movimenti
 | 
						|
//
 | 
						|
 | 
						|
#include "cg3.h"
 | 
						|
#include "cg3100.h"
 | 
						|
 | 
						|
#include "cglib01.h"
 | 
						|
#include "cglib03.h"
 | 
						|
 | 
						|
#include <mask.h>
 | 
						|
#include <modaut.h>
 | 
						|
#include <printapp.h>
 | 
						|
#include <recarray.h>
 | 
						|
 | 
						|
#include <attiv.h>
 | 
						|
#include <causali.h>
 | 
						|
#include <clifo.h>
 | 
						|
#include <comuni.h>
 | 
						|
#include <mov.h>
 | 
						|
#include <nditte.h>
 | 
						|
#include <pconti.h>
 | 
						|
#include <rmov.h>
 | 
						|
#include <rmoviva.h>
 | 
						|
#include <saldi.h>
 | 
						|
 | 
						|
enum liste { movimenti=1,  fatture=2, };
 | 
						|
 | 
						|
class TListaMov_application : public TPrintapp
 | 
						|
{
 | 
						|
  static bool filter_func (const TRelation *);
 | 
						|
  static bool filter_func_fatture (const TRelation *);
 | 
						|
  static bool annoes_handler(TMask_field&, KEY);
 | 
						|
  static bool data_inizio (TMask_field&, KEY);
 | 
						|
  static bool data_fine   (TMask_field&, KEY);
 | 
						|
 | 
						|
  TRigaiva_array      _c; 
 | 
						|
  TRelation      * _relmov1,* _relmov2,* _relmov3;
 | 
						|
  TCursor * _curr1, * _curr2, * _curr3; 
 | 
						|
  TBit_array _err;
 | 
						|
  TDate   _data_ini, _data_fin, _datareg, _data_prec, _datacomp;
 | 
						|
  TString _descr, _descr_doc, _descr_causale;
 | 
						|
  TString _tipo_ini, _causale, _app;
 | 
						|
  TString4 _causale_ini, _causale_fin, _registro,_registro_ini, _registro_fin;
 | 
						|
  TString _tipoatt, _tipo_elenco,_tipo_clifo_prec,_tipoelsucc;
 | 
						|
  char    _appoggio;
 | 
						|
  TString4 _tipodoc, _tipodocumento;
 | 
						|
  TString _ragsoc, _indcf, _civcf, _paiv, _codcaus, _dencom, _provcom, _cofi;
 | 
						|
  TString _capcf, _codval, _simbolo, _statocf, _comcf, _tipo_fin, _reg_causale;
 | 
						|
  long _documenti, _codice_ini, _codice_fin, _numero_reg, _codcf;
 | 
						|
	long _gen_documenti;
 | 
						|
  long _numreg, _numreg_fin, _numreg_ini, _codalleg, _numeroregp,_codclifosucc;
 | 
						|
  long _codcf_prec, _numr, _numero;
 | 
						|
  int  _ae, _anno, _annoes, _annoeser;
 | 
						|
  bool _noseparator, _competence_only;
 | 
						|
  real _totdocumenti, _totdoc, _totimponibile, _totimposta, _importo;
 | 
						|
  real _gen_totdocumenti, _gen_totimponibile, _gen_totimposta, _gen_op_esenti, _gen_op_non_imp;
 | 
						|
  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 _no_preprocess_page, _salto_pagina, _stampa_anno_comp,_esiste_riga_iva,_nonesiste_riga_iva;
 | 
						|
  bool _stampa_parte_iva,_alleg_causale,_stampa_mess_alleg_iva,_allegb;
 | 
						|
  int  _ricser;
 | 
						|
  bool _settata_prima_riga, _causale_gia_stampata,_mov_di_sola_iva;
 | 
						|
  int  _cur1,_cur2,_cur2b,_cur3,_cur4,_decidi,/*_tipod,*/_controllo_mov_errati;
 | 
						|
  int  _numero_riga, _alleg, _tiporegistro, _scelta_stampa, _nr, _n;
 | 
						|
  int  _provvis;
 | 
						|
  liste _tipo_lista;
 | 
						|
  word _flags;
 | 
						|
  char _tipoc;   
 | 
						|
  TString4 _dacodiva, _acodiva;
 | 
						|
 | 
						|
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);
 | 
						|
 | 
						|
  void print_intra(int& rr);
 | 
						|
  
 | 
						|
  void filtra_cursore_provvisori(TCursor* cur) const;
 | 
						|
  void imposta_parametri_stampa(const TMask& msk);
 | 
						|
 | 
						|
  bool codiva_filter(const TRelation* rel) const;
 | 
						|
  bool rmoviva_filter(const TRectype& rmoviva) const;
 | 
						|
 
 | 
						|
public:
 | 
						|
  bool user_create();
 | 
						|
  bool user_destroy();
 | 
						|
  bool segnala_errori_primariga();
 | 
						|
  bool segnala_errori_ogniriga();
 | 
						|
  bool segnala_errori_iva();
 | 
						|
  bool contropartita(int, int, long, char);
 | 
						|
  void stampa_errori_rmov();
 | 
						|
  void stampa_errori_mov(); 
 | 
						|
  void stampa_errori_iva(int* r, const TRigaiva& riva);
 | 
						|
  void stampa_errori_contropartita(int, int, long, char);
 | 
						|
  void stampa_intestazione();
 | 
						|
  void incrementa_totali();
 | 
						|
  void compila_clifo();
 | 
						|
  void compila_comuni();
 | 
						|
	const char * get_error(int error) const;
 | 
						|
 | 
						|
  bool RicercaDoc(const char* cod) const;
 | 
						|
  const TString& SimboloValuta (const char* cod) const;
 | 
						|
  const TString& DescrDoc(const char* cod) const;
 | 
						|
  const TString& AttivitaRegistro(const char * cod, int anno) const;
 | 
						|
  
 | 
						|
  TListaMov_application(char tipost);
 | 
						|
  virtual ~TListaMov_application() {}
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
HIDDEN inline TListaMov_application& app()
 | 
						|
{ return (TListaMov_application&)main_app();}
 | 
						|
 | 
						|
bool TListaMov_application::annoes_handler(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
  if (k == K_TAB && f.focusdirty() && !f.empty())
 | 
						|
  {
 | 
						|
    const int anno = atoi(f.get());  
 | 
						|
    TDate dataini, datafin;
 | 
						|
    TEsercizi_contabili esc;
 | 
						|
    if (esc.code2range(anno, dataini, datafin))
 | 
						|
    {
 | 
						|
      f.mask().set(F_DATAINI, dataini);
 | 
						|
      const int prossimo = esc.next(anno);
 | 
						|
      if (prossimo > 0)
 | 
						|
        datafin = esc[prossimo].fine();
 | 
						|
      f.mask().set(F_DATAFIN, datafin);
 | 
						|
    }
 | 
						|
  }
 | 
						|
  return true; 
 | 
						|
} 
 | 
						|
 | 
						|
bool TListaMov_application::data_inizio(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
  if (k == K_ENTER)
 | 
						|
  {
 | 
						|
    int decidi;
 | 
						|
    int anno   = f.mask().get_int (F_ANNO);
 | 
						|
    TDate data = f.mask().get_date(F_DATAINI);
 | 
						|
    if (app()._tipo_lista == movimenti)
 | 
						|
      decidi = f.mask().get_int (F_DECIDI);
 | 
						|
    
 | 
						|
    TEsercizi_contabili esc;
 | 
						|
    if (esc.exist(anno) && ( (app()._tipo_lista == fatture) || 
 | 
						|
        ((app()._tipo_lista == movimenti ) && (decidi == 2)) ) )
 | 
						|
    {
 | 
						|
      const TDate inizio = esc[anno].inizio();
 | 
						|
      if (data.ok()) 
 | 
						|
      {                           
 | 
						|
        if (data < inizio)
 | 
						|
        {
 | 
						|
          f.error_box(TR("La data indicata non deve essere inferiore alla data di inizio esercizio"));   
 | 
						|
          return FALSE;
 | 
						|
        }
 | 
						|
      }
 | 
						|
      else //se la data e' vuota
 | 
						|
        f.mask().field(F_DATAINI).set(inizio);
 | 
						|
    }
 | 
						|
  }      
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::data_fine(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
  if (k == K_ENTER)
 | 
						|
  {
 | 
						|
    int decidi = 0;
 | 
						|
    int anno      = f.mask().get_int (F_ANNO);
 | 
						|
    TDate dataini = f.mask().get_date(F_DATAINI);
 | 
						|
    TDate datafin = f.mask().get_date(F_DATAFIN); 
 | 
						|
    if (app()._tipo_lista == movimenti)
 | 
						|
      decidi = f.mask().get_int (F_DECIDI);
 | 
						|
    if ( (app()._tipo_lista == fatture) || 
 | 
						|
        ((app()._tipo_lista == movimenti) && (decidi == 2)) ) 
 | 
						|
      if ( dataini.ok() && datafin.ok() ) 
 | 
						|
        if (dataini > datafin) 
 | 
						|
        {
 | 
						|
          f.error_box(TR("La data iniziale non deve essere superiore alla data finale"));
 | 
						|
          return FALSE;
 | 
						|
        }          
 | 
						|
        
 | 
						|
    TEsercizi_contabili esc;    
 | 
						|
    if (esc.exist(anno) && ( (app()._tipo_lista == fatture) || ((app()._tipo_lista == movimenti) && (decidi == 2)) ) )
 | 
						|
    {                   
 | 
						|
      const int prossimo = esc.next(anno);
 | 
						|
      const TDate fine = esc[prossimo > 0 ? prossimo : anno].fine();
 | 
						|
      if (datafin.ok())           
 | 
						|
      {
 | 
						|
        if (datafin > fine)
 | 
						|
        {
 | 
						|
          f.error_box(TR("La data indicata non deve essere superiore alla data di fine esercizio successivo, oppure, in caso questo non esista, dell'esercizio indicato"));   
 | 
						|
          return FALSE;
 | 
						|
        }
 | 
						|
      }  
 | 
						|
      else  //se la data e' vuota 
 | 
						|
        f.mask().set(F_DATAFIN, fine);
 | 
						|
    }
 | 
						|
  }      
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::RicercaDoc(const char* tipo) const
 | 
						|
{
 | 
						|
  const TRectype& tab_tpd = cache().get(TAB_TPD, tipo);
 | 
						|
  return !tab_tpd.empty();
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::compila_clifo()
 | 
						|
{
 | 
						|
	TToken_string key;
 | 
						|
	key.add(_tipo_elenco);
 | 
						|
	key.add(_codcf);
 | 
						|
	const TRectype& clifo = cache().get(LF_CLIFO, key);
 | 
						|
  
 | 
						|
  char tipoa = clifo.get_char(CLI_TIPOAPER);
 | 
						|
  _alleg     = clifo.get_int(CLI_ALLEG);
 | 
						|
  _statocf   = clifo.get(CLI_STATOCF);
 | 
						|
  _comcf     = clifo.get(CLI_COMCF);
 | 
						|
  _ragsoc    = clifo.get(CLI_RAGSOC);
 | 
						|
  if (tipoa == 'F')
 | 
						|
  {
 | 
						|
    TString80 cognome, nome;
 | 
						|
    cognome = _ragsoc.mid(0, 30); cognome.trim();
 | 
						|
    nome    = _ragsoc.mid(30,20); nome.trim();     
 | 
						|
    _ragsoc = cognome;
 | 
						|
    _ragsoc << ' ' << nome;
 | 
						|
  }
 | 
						|
  _indcf    = clifo.get(CLI_INDCF);
 | 
						|
  _civcf    = clifo.get(CLI_CIVCF);
 | 
						|
  _paiv     = clifo.get(CLI_PAIV);
 | 
						|
  _capcf    = clifo.get(CLI_CAPCF);
 | 
						|
  _dencom   = clifo.get(CLI_LOCCF);
 | 
						|
  _cofi     = clifo.get(CLI_COFI); 
 | 
						|
  _codalleg = clifo.get_long(CLI_CODALLEG);
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::compila_comuni()
 | 
						|
{
 | 
						|
	TToken_string key;
 | 
						|
	key.add(_statocf);
 | 
						|
	key.add(_comcf);
 | 
						|
	const TRectype & comuni = cache().get(LF_COMUNI, key);
 | 
						|
  //modifica del 26/04/1995
 | 
						|
  _dencom  = comuni.get(COM_DENCOM);
 | 
						|
  if (!_dencom.empty())
 | 
						|
    _app = "Com";
 | 
						|
  else _app = "Loc";   
 | 
						|
  //fine modifica
 | 
						|
  _provcom = comuni.get(COM_PROVCOM);
 | 
						|
}
 | 
						|
 | 
						|
const char * TListaMov_application::get_error(int err) const
 | 
						|
{
 | 
						|
	switch (err)
 | 
						|
	{
 | 
						|
		case 0:
 | 
						|
			return TR("La data operazione non appartiene a nessun esercizio");
 | 
						|
			break;
 | 
						|
		case 1:
 | 
						|
			return TR("Anno IVA non compatibile con data operazione");
 | 
						|
			break;
 | 
						|
		case 2:
 | 
						|
			return TR("Data operazione successiva all'esercizio di competenza");
 | 
						|
			break;
 | 
						|
		case 3:
 | 
						|
			return TR("Movimento con competenza anno precedente");
 | 
						|
			break;
 | 
						|
		case 4:
 | 
						|
			return TR("La data di competenza non appartiene a nessun esercizio");
 | 
						|
			break;
 | 
						|
		case 5:
 | 
						|
			return TR("Data competenza incompatibile con data operazione");
 | 
						|
			break;
 | 
						|
		case 6:
 | 
						|
			return TR("Esercizio incompatibile con data competenza");
 | 
						|
			break;
 | 
						|
		case 7:
 | 
						|
			return TR("Codice causale non presente in tabella");
 | 
						|
			break;
 | 
						|
		case 8:
 | 
						|
			return TR("Codice causale sospeso");
 | 
						|
			break;
 | 
						|
		case 9:
 | 
						|
			return TR("Nella causale e' stato attivato il segnale non va in allegato");
 | 
						|
			break;
 | 
						|
		case 10:
 | 
						|
			return TR("Tipo documento non corrisponde a quello indicato in causale");
 | 
						|
			break;
 | 
						|
		case 11:
 | 
						|
			return TR("Tipo documento non presente in tabella");
 | 
						|
			break;
 | 
						|
		case 12:
 | 
						|
			return TR("Codice registro non corrisponde a quello indicato in causale");
 | 
						|
			break;
 | 
						|
		case 13:
 | 
						|
			return TR("Codice registro non presente in tabella");
 | 
						|
			break;
 | 
						|
		case 14:
 | 
						|
			return TR("Codice registro sospeso");
 | 
						|
			break;
 | 
						|
		case 15:
 | 
						|
			return TR("Tipo registro incompatibile con tipo documento");
 | 
						|
			break;
 | 
						|
		case 16:
 | 
						|
			return TR("Non indicato codice cliente/fornitore");
 | 
						|
			break;
 | 
						|
		case 17:
 | 
						|
			return TR("Tipo cliente/fornitore non compatibile con tipo registro");
 | 
						|
			break;
 | 
						|
		case 18:
 | 
						|
			return TR("Codice cliente/fornitore sospeso");
 | 
						|
			break;
 | 
						|
		case 19:
 | 
						|
			return TR("Nel cliente/fornitore e' stato attivato il segnale: non va in allegato");
 | 
						|
			break;
 | 
						|
		case 20:
 | 
						|
			return TR("Indicato codice C/F per allegato che richiama se stesso");
 | 
						|
			break;
 | 
						|
		case 21:
 | 
						|
			return TR("Indicato codice C/F per allegato sospeso");
 | 
						|
			break;
 | 
						|
		case 22:
 | 
						|
			return TR("C/F per allegato riporta un altro C/F per allegato");
 | 
						|
			break;
 | 
						|
		case 23:
 | 
						|
			return TR("Indicato codice C/F per allegato con segnale: non va in allegato");
 | 
						|
			break;
 | 
						|
		case 24:
 | 
						|
			return TR("Indicato codice C/F per allegato non presente in anagrafica");
 | 
						|
			break;
 | 
						|
		case 25:
 | 
						|
			return TR("Codice cliente/fornitore non presente in anagrafica");
 | 
						|
			break;
 | 
						|
		case 26:
 | 
						|
			return TR("Movimento con data competenza diversa da data operazione");
 | 
						|
			break;
 | 
						|
		default:
 | 
						|
			return "";
 | 
						|
			break;
 | 
						|
		}
 | 
						|
}
 | 
						|
 | 
						|
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)
 | 
						|
{  
 | 
						|
	TString& tmp = get_tmp_string(50);
 | 
						|
 | 
						|
	TString16 key;
 | 
						|
	key << gruppo;
 | 
						|
  if (conto != 0)
 | 
						|
    key << '|' << conto;
 | 
						|
  if (sottoconto != 0)
 | 
						|
			key << '|' << sottoconto;
 | 
						|
  tmp = cache().get(LF_PCON, key, PCN_DESCR);
 | 
						|
 | 
						|
  if (tmp.empty())
 | 
						|
  {
 | 
						|
    key.format("%s|%ld",tipocf , sottoconto);
 | 
						|
 | 
						|
		const TRectype & clifo = cache().get(LF_CLIFO, key);
 | 
						|
    if (!clifo.empty())
 | 
						|
    {
 | 
						|
      char tipoa = clifo.get_char("TIPOAPER");
 | 
						|
      if (tipoa == 'F')  //persona fisica
 | 
						|
      {
 | 
						|
				const TString& ragsoc = clifo.get("RAGSOC");
 | 
						|
        tmp = ragsoc.mid(0,30);
 | 
						|
        tmp.trim();
 | 
						|
        tmp << ' ' << ragsoc.mid(30);
 | 
						|
      }
 | 
						|
      else
 | 
						|
        tmp = clifo.get("RAGSOC");
 | 
						|
    }   
 | 
						|
  }
 | 
						|
  return tmp;  
 | 
						|
}
 | 
						|
 | 
						|
bool CausAlleg (const char * cod)
 | 
						|
{
 | 
						|
  const TRectype & caus = cache().get(LF_CAUSALI, cod);
 | 
						|
  const bool allegb = caus.get_bool(CAU_ALLEG);
 | 
						|
  
 | 
						|
  return allegb;
 | 
						|
}
 | 
						|
 | 
						|
const char* TipoAttivita (const char* attreg, long codice_ditta)
 | 
						|
{
 | 
						|
  TString16 key;	key.format("%ld|%s", codice_ditta, attreg);
 | 
						|
  return cache().get(LF_ATTIV, key, ATT_TIPOATT);
 | 
						|
}
 | 
						|
 | 
						|
const TString& TListaMov_application::SimboloValuta(const char* cod) const
 | 
						|
{ return cache().get(TAB_VAL, cod, "S7"); }
 | 
						|
 | 
						|
const TString& TListaMov_application::DescrDoc(const char* tipo) const
 | 
						|
{ return cache().get(TAB_TPD, tipo, "S0"); } 
 | 
						|
 | 
						|
const TString& TListaMov_application::AttivitaRegistro(const char* cod, int anno) const
 | 
						|
{
 | 
						|
  TString8 key;	key.format("%04d%-3s", anno, cod);
 | 
						|
  return cache().get("REG", key, "S8");
 | 
						|
}
 | 
						|
 | 
						|
HIDDEN int tipo_registro(const char* cod, int anno)
 | 
						|
{            
 | 
						|
  TString8 codtab; codtab.format("%4d%-3s", anno, cod);
 | 
						|
  const TString& tipo_reg = cache().get("REG", codtab, "I0");
 | 
						|
  return atoi(tipo_reg);
 | 
						|
}
 | 
						|
 | 
						|
static bool between(const TString& code, const TString& mini, const TString& maxi)
 | 
						|
{
 | 
						|
  if (mini.full() && code < mini)
 | 
						|
    return false;
 | 
						|
  if (maxi.full() && code > maxi)
 | 
						|
    return false;
 | 
						|
  return true;
 | 
						|
}
 | 
						|
 | 
						|
static bool between(const TDate& code, const TDate& mini, const TDate& maxi)
 | 
						|
{
 | 
						|
  if (mini.ok() && code < mini)
 | 
						|
    return false;
 | 
						|
  if (maxi.ok() && code > maxi)
 | 
						|
    return false;
 | 
						|
  return true;
 | 
						|
}
 | 
						|
 | 
						|
static bool between(long code, long mini, long maxi)
 | 
						|
{
 | 
						|
  if (mini > 0 && code < mini)
 | 
						|
    return false;
 | 
						|
  if (maxi > 0 && code > maxi)
 | 
						|
    return false;
 | 
						|
  return true;
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::rmoviva_filter(const TRectype& rmoviva) const
 | 
						|
{
 | 
						|
  const TString& codiva = rmoviva.get(RMI_CODIVA);
 | 
						|
  return between(codiva, _dacodiva, _acodiva);
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::codiva_filter(const TRelation* rel) const
 | 
						|
{  
 | 
						|
  bool ok = _dacodiva.empty() && _acodiva.empty(); // Test su range codici iva
 | 
						|
  if (!ok)
 | 
						|
  {
 | 
						|
    const TRectype& mov = rel->curr(LF_MOV);
 | 
						|
    TRectype rmoviva(LF_RMOVIVA);
 | 
						|
    rmoviva.put(RMI_NUMREG, mov.get(MOV_NUMREG));
 | 
						|
    TRecord_array righe(rmoviva, RMI_NUMRIG);
 | 
						|
    for (int i = 1; !ok && i <= righe.rows(); i++)
 | 
						|
      ok = rmoviva_filter(righe[i]);
 | 
						|
  }
 | 
						|
  return ok;
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::filter_func_fatture (const TRelation* rel)
 | 
						|
{
 | 
						|
  const TRectype& mov = rel->curr(LF_MOV); 
 | 
						|
  
 | 
						|
  // Altrimenti stampa anche i corrispettivi! Pseudo errore MI2396
 | 
						|
  const long codcf = mov.get_long(MOV_CODCF);
 | 
						|
  if (codcf <= 0)
 | 
						|
    return FALSE;
 | 
						|
 | 
						|
  const TString& causale = mov.get(MOV_CODCAUS);
 | 
						|
  if (!between(causale, app()._causale_ini, app()._causale_fin))
 | 
						|
    return false;
 | 
						|
  
 | 
						|
  const int ann_reg = mov.get_int(MOV_ANNOIVA);
 | 
						|
  const TString4 cod_reg = mov.get(MOV_REG); 
 | 
						|
  const int tipo_reg = tipo_registro(cod_reg, ann_reg);
 | 
						|
 | 
						|
  // Considera solo iva acquisti o vendite
 | 
						|
  if (tipo_reg != 1 && tipo_reg != 2)
 | 
						|
    return FALSE;
 | 
						|
  
 | 
						|
  if (app()._annoes > 0) //anno esercizio specificato nella maschera
 | 
						|
  {
 | 
						|
    const int annoes = mov.get_int(MOV_ANNOES);
 | 
						|
    if (annoes != app()._annoes)
 | 
						|
      return false;
 | 
						|
  }
 | 
						|
 | 
						|
  if (!between(mov.get_date(MOV_DATAREG), app()._data_ini, app()._data_fin))
 | 
						|
    return false;
 | 
						|
 | 
						|
  if (!between(mov.get(MOV_TIPO), app()._tipo_ini, app()._tipo_fin))
 | 
						|
    return false;
 | 
						|
 | 
						|
  if (!between(mov.get_long(MOV_CODCF), app()._codice_ini, app()._codice_fin))
 | 
						|
    return false;
 | 
						|
 | 
						|
  return app().codiva_filter(rel);
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::filter_func (const TRelation * rel)
 | 
						|
{                             
 | 
						|
  const TRectype& mov = rel->curr(LF_MOV); 
 | 
						|
 | 
						|
  if ( (app()._decidi == 2) && (app()._annoes != 0) )
 | 
						|
  { 
 | 
						|
    const int annoes = mov.get_int(MOV_ANNOES);
 | 
						|
    if (annoes != app()._annoes)
 | 
						|
      return false;
 | 
						|
  }
 | 
						|
 | 
						|
  const TString& causale = mov.get(MOV_CODCAUS);
 | 
						|
  if (!between(causale, app()._causale_ini, app()._causale_fin))
 | 
						|
    return false;
 | 
						|
 | 
						|
  if (app()._scelta_stampa == 0) // Lista movimenti
 | 
						|
  {
 | 
						|
    const TString& codreg = mov.get(MOV_REG);
 | 
						|
    if (!between(codreg, app()._registro_ini, app()._registro_fin))
 | 
						|
      return false;
 | 
						|
  }
 | 
						|
  else // Lista movimenti sola prima nota
 | 
						|
  {
 | 
						|
    const TString& cod_reg  = mov.get(MOV_REG); 
 | 
						|
    const int ann_reg  = mov.get_int(MOV_ANNOIVA); 
 | 
						|
    const int tipo_reg = tipo_registro(cod_reg, ann_reg);
 | 
						|
    if (tipo_reg == 1 || tipo_reg == 2)
 | 
						|
      return false;
 | 
						|
  }
 | 
						|
 | 
						|
  if (app()._competence_only && app()._annoes == 0)
 | 
						|
  {
 | 
						|
    const TDate datareg = mov.get_date(MOV_DATAREG);
 | 
						|
    const int annoes = mov.get_int(MOV_ANNOES);
 | 
						|
    TEsercizi_contabili esc;
 | 
						|
    // La data di registrazione appartiene allo stesso esercizio della data di competenza
 | 
						|
    if (esc.date2esc(datareg) == annoes)  
 | 
						|
      return false;
 | 
						|
  }
 | 
						|
  
 | 
						|
  return true;
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::stampa_errori_rmov()
 | 
						|
{
 | 
						|
  const TRectype& rec  = current_cursor()->curr(LF_RMOV);
 | 
						|
  int gruppo = rec.get_int(RMV_GRUPPO);
 | 
						|
  int conto  = rec.get_int(RMV_CONTO);
 | 
						|
  long sottoconto  = rec.get_long(RMV_SOTTOCONTO);
 | 
						|
  int anno         = rec.get_int(RMV_ANNOES);
 | 
						|
  TDate datareg    = rec.get_date(RMV_DATAREG);
 | 
						|
  char sez         = rec.get_char(RMV_SEZIONE);
 | 
						|
  char tipo        = rec.get_char(RMV_TIPOC);
 | 
						|
  int  gruppoc     = rec.get_int(RMV_GRUPPOC);
 | 
						|
  int  contoc      = rec.get_int(RMV_CONTOC);
 | 
						|
  long sottocontoc = rec.get_long(RMV_SOTTOCONTOC);
 | 
						|
  char tipoc       = rec.get_char(RMV_TIPOCC);
 | 
						|
  
 | 
						|
  bool g = FALSE;
 | 
						|
  char t;
 | 
						|
  
 | 
						|
  TBill tc (gruppo,conto,sottoconto);
 | 
						|
  
 | 
						|
  _nr++;
 | 
						|
  
 | 
						|
  if (anno != _annoeser || datareg != _datareg)
 | 
						|
    set_row(_nr++, FR("@11gUno o piu' campi non sono costanti nella riga dell' operazione"));    
 | 
						|
  if (sez != 'D' && sez != 'A')
 | 
						|
    set_row(_nr++, FR("@11gIndicato tipo movimento Dare/Avere errato"));    
 | 
						|
  if (tc.empty())
 | 
						|
    set_row(_nr++, FR("@11gNon presente codice gruppo/conto/sottoconto"));    
 | 
						|
  if (!tc.ok())
 | 
						|
    set_row(_nr++, FR("@11gCodice gruppo/conto/sottoconto non corrisponde ad un sottoconto"));    
 | 
						|
  
 | 
						|
  TRectype pc (LF_PCON);
 | 
						|
  tc.set(gruppo,0,0l);
 | 
						|
  if (!tc.read(pc))
 | 
						|
    g = TRUE; 
 | 
						|
  tc.set(gruppo,conto,0l);
 | 
						|
  if (!tc.read(pc))
 | 
						|
    set_row(_nr++, FR("@11gCodice gruppo/conto/sottoconto non presente in Piano dei Conti"));    
 | 
						|
  else
 | 
						|
  {
 | 
						|
    t = pc.get_char(PCN_TMCF);
 | 
						|
    if (t != tipo)
 | 
						|
      set_row(_nr++, FR("@11gIl tipo C/F indicato non corrisponde a quello presente su Piano dei Conti"));    
 | 
						|
    else
 | 
						|
    {
 | 
						|
      tc.set(gruppo,conto,sottoconto);
 | 
						|
      if (t != 'C' && t != 'F')
 | 
						|
      {
 | 
						|
        if (!tc.read(pc) || g )
 | 
						|
          set_row(_nr++, FR("@11gCodice gruppo/conto/sottoconto non presente in Piano dei Conti"));    
 | 
						|
        else
 | 
						|
        { 
 | 
						|
          bool sosp = tc.sospeso();
 | 
						|
          if (sosp)
 | 
						|
            set_row(_nr++, FR("@11gCodice gruppo/conto/sottoconto sospeso in Piano dei Conti")); 
 | 
						|
        }  
 | 
						|
      }
 | 
						|
      else
 | 
						|
      {
 | 
						|
				TToken_string key;
 | 
						|
				key.add(t);
 | 
						|
				key.add(sottoconto);
 | 
						|
        const TRectype & clifo = cache().get(LF_CLIFO, key);
 | 
						|
 | 
						|
        if (!clifo.empty())   
 | 
						|
        {
 | 
						|
          bool sosp = clifo.get_bool(CLI_SOSPESO);
 | 
						|
          if (sosp)
 | 
						|
            set_row(_nr++, FR("@11gCodice C/F sospeso in Anagrafica"));    
 | 
						|
        } 
 | 
						|
        else set_row(_nr++, FR("@11gCodice C/F non presente in Anagrafica"));    
 | 
						|
        if (_registro.not_empty()) //se su mov e' indicato il codice registro
 | 
						|
        {
 | 
						|
          TRegistro rg (_registro, _ae);
 | 
						|
          const int tiporeg = rg.tipo();
 | 
						|
          if ((tiporeg == 1 && t != 'C') || (tiporeg == 2 && t != 'F'))
 | 
						|
            set_row(_nr++, FR("@11gTipo C/F non compatibile con tipo registro"));    
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
  }
 | 
						|
  TString key(30);
 | 
						|
 | 
						|
  key.format("%d||%d|%d|%ld", anno, gruppo, conto, sottoconto); 
 | 
						|
 | 
						|
  const TRectype & saldi = cache().get(LF_SALDI, key);
 | 
						|
 | 
						|
  if (saldi.empty()) 
 | 
						|
    set_row(_nr++, FR("@11gCodice gruppo/conto/sottoconto non presente in Saldi p.d.c."));    
 | 
						|
  
 | 
						|
  if (gruppoc != 0 || contoc != 0 || sottocontoc != 0l)
 | 
						|
    stampa_errori_contropartita(gruppoc, contoc, sottocontoc, tipoc); 
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::stampa_errori_contropartita(int gruppo, int conto, long sottoconto, char t)
 | 
						|
{
 | 
						|
  bool g = FALSE;
 | 
						|
  
 | 
						|
  TBill tc;
 | 
						|
  TRectype pc (LF_PCON);
 | 
						|
  tc.set(gruppo,0,0l);
 | 
						|
  if (!tc.read(pc))
 | 
						|
    g = TRUE; 
 | 
						|
  tc.set(gruppo,conto,0l);
 | 
						|
  if (!tc.read(pc))
 | 
						|
    set_row(_nr++, FR("@11gCodice gruppo/conto/sottoconto di contropartita non presente in Piano dei Conti"));    
 | 
						|
  else
 | 
						|
  {
 | 
						|
    //t = pc.get_char(PCN_TMCF);
 | 
						|
    tc.set(gruppo,conto,sottoconto);
 | 
						|
    if (t != 'C' && t != 'F')
 | 
						|
    {
 | 
						|
      if (!tc.read(pc) || g )
 | 
						|
        set_row(_nr++, FR("@11gCodice gruppo/conto/sottoconto di contropartita non presente in Piano dei Conti"));    
 | 
						|
      else
 | 
						|
      {
 | 
						|
        bool sosp = tc.sospeso();
 | 
						|
        if (sosp)
 | 
						|
          set_row(_nr++, FR("@11gCodice gruppo/conto/sottoconto di contropartita sospeso in Piano dei Conti")); 
 | 
						|
      }
 | 
						|
    }
 | 
						|
    else if (sottoconto != 0l)
 | 
						|
    {
 | 
						|
			TToken_string key;
 | 
						|
			key.add(t);
 | 
						|
			key.add(sottoconto);
 | 
						|
      const TRectype & clifo = cache().get(LF_CLIFO, key);
 | 
						|
 | 
						|
      if (!clifo.empty())   
 | 
						|
      {
 | 
						|
        bool sosp = clifo.get_bool(CLI_SOSPESO);
 | 
						|
        if (sosp)
 | 
						|
          set_row(_nr++, FR("@11gCodice C/F di contropartita sospeso in Anagrafica"));    
 | 
						|
      } 
 | 
						|
      else set_row(_nr++, FR("@11gCodice C/F di contropartita non presente in Anagrafica"));    
 | 
						|
    }
 | 
						|
  }
 | 
						|
}  
 | 
						|
 | 
						|
void TListaMov_application::stampa_errori_iva(int* nr, const TRigaiva& riva)
 | 
						|
{
 | 
						|
  const TRectype& tab_iva = cache().get("%IVA", riva._codiva);
 | 
						|
  if (!tab_iva.empty())
 | 
						|
  {
 | 
						|
    const bool sosp = tab_iva.get_bool("B2");
 | 
						|
    if (sosp)
 | 
						|
      set_row(++(*nr), FR("@11gCodice IVA sospeso"));    
 | 
						|
    if (_stampa_mess_alleg_iva)
 | 
						|
    {
 | 
						|
      const int allc = tab_iva.get_int("S7");
 | 
						|
      const int allf = tab_iva.get_int("S8");
 | 
						|
      if (allc == 0 || allf == 0)
 | 
						|
        set_row(++(*nr), FR("@11gSul Codice IVA non e' stato indicato un valore per allegato"));    
 | 
						|
    }
 | 
						|
  } 
 | 
						|
  else
 | 
						|
    set_row(++(*nr), FR("@11gCodice IVA non presente in tabella"));    
 | 
						|
 | 
						|
  const int tipodet = riva._tipodet;
 | 
						|
  const int tipocr = riva._tipocr;
 | 
						|
 | 
						|
  if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9)
 | 
						|
    if (_tiporegistro != 2)
 | 
						|
      set_row(++(*nr), FR("@11gCodice di indetraibilita' errato"));    
 | 
						|
 | 
						|
  if (_tiporegistro == 1)
 | 
						|
    if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9)
 | 
						|
      set_row(++(*nr), FR("@11gTipo costo/ricavo non valido"));    
 | 
						|
 | 
						|
  if (_tiporegistro == 2)
 | 
						|
    if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9)
 | 
						|
      set_row(++(*nr), FR("@11gTipo costo/ricavo non valido"));    
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::stampa_errori_mov()
 | 
						|
{
 | 
						|
  long i = _err.first_one();
 | 
						|
  if (i != -1)
 | 
						|
  {
 | 
						|
    for (; i <= _err.last_one(); i++)
 | 
						|
      if (_err[i])
 | 
						|
        set_row(++_n, "@11g%s", (const char*) get_error(i));
 | 
						|
  }  
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::set_page(int file, int count)
 | 
						|
{
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
    if (file == LF_RMOVIVA)
 | 
						|
      break;
 | 
						|
    if (file == LF_RMOV)
 | 
						|
    {
 | 
						|
      _nr = 1;
 | 
						|
      const TRectype& rec = current_cursor()->curr(LF_RMOV);
 | 
						|
 | 
						|
      set_row(_nr,"@3n",FLD(LF_RMOV,RMV_NUMRIG));
 | 
						|
      set_row(_nr,"@30g@22s",FLD(LF_RMOV,RMV_DESCR));
 | 
						|
      set_row(_nr,"@54g@3,rn",FLD(LF_RMOV,RMV_GRUPPO));
 | 
						|
      set_row(_nr,"@58g@3,rn",FLD(LF_RMOV,RMV_CONTO));
 | 
						|
      set_row(_nr,"@62g@6,rn",FLD(LF_RMOV,RMV_SOTTOCONTO));
 | 
						|
      set_row(_nr,"@69g#.20t",&_descr);
 | 
						|
      _appoggio = toupper(current_cursor()->curr(LF_RMOV).get_char(RMV_SEZIONE));
 | 
						|
      if (_appoggio=='D')
 | 
						|
        set_row(_nr,"@90g@n",FLD(LF_RMOV,RMV_IMPORTO)); 
 | 
						|
      else
 | 
						|
        set_row(_nr,"@110g@n",FLD(LF_RMOV,RMV_IMPORTO));
 | 
						|
    }                     
 | 
						|
    else if (file == LF_MOV)
 | 
						|
    {
 | 
						|
      _n = 1;
 | 
						|
      set_row (_n++,""); 
 | 
						|
      set_row (_n, FR("Operazione n. @14g@7n"), FLD(LF_MOV,MOV_NUMREG));
 | 
						|
      set_row (_n, FR("@22gdel@26g@d"),FLD(LF_MOV,MOV_DATAREG));
 | 
						|
      set_row (_n, "@37g@36s",FLD(LF_MOV,MOV_DESCR));
 | 
						|
      set_row (_n, FR("@75gdoc. @7s"),FLD(LF_MOV,MOV_NUMDOC));
 | 
						|
      set_row (_n, FR("@88gdel@92g@d"), FLD(LF_MOV,MOV_DATADOC));
 | 
						|
      current_cursor()->curr(LF_MOV).get_int(MOV_ANNOES);  // qui verificare
 | 
						|
      TDate data    = current_cursor()->curr(LF_MOV).get_date(MOV_DATAREG);
 | 
						|
      TDate dcomp   = current_cursor()->curr(LF_MOV).get_date(MOV_DATACOMP);
 | 
						|
      TString16 reg = current_cursor()->curr(LF_MOV).get(MOV_REG);
 | 
						|
      int      anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA);
 | 
						|
      char     prov = current_cursor()->curr(LF_MOV).get_char(MOV_PROVVIS);
 | 
						|
      int tipo = tipo_registro(reg, anno);
 | 
						|
      
 | 
						|
      TEsercizi_contabili esc;
 | 
						|
      esc.date2esc(data); // qui verificare  
 | 
						|
      if ( (tipo == 1) || (tipo == 2) )
 | 
						|
      {
 | 
						|
        set_row (_n, FR("@103greg @3s"),FLD(LF_MOV,MOV_REG));
 | 
						|
        set_row (_n, FR("@111gpr @5n"),FLD(LF_MOV,MOV_PROTIVA));
 | 
						|
      }
 | 
						|
      else if (_provvis == 2 && prov >= ' ')
 | 
						|
        set_row (_n, FR("@103gMov.Provvisorio"));
 | 
						|
      if (data != dcomp)           
 | 
						|
        set_row (_n, "@119gc.%s", (const char*)dcomp.string(brief, '-'));
 | 
						|
      //fine
 | 
						|
      set_row (_n, "@130g@f", FLD(LF_MOV,MOV_STAMPATO));
 | 
						|
    }
 | 
						|
    break;
 | 
						|
    
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::stampa_intestazione()
 | 
						|
{
 | 
						|
  set_row (1,"");
 | 
						|
  if (_tipo_elenco == "C")
 | 
						|
    set_row (2, FR("@bCliente@8g@6n"), FLD(LF_MOV,MOV_CODCF));
 | 
						|
  else 
 | 
						|
    set_row (2, FR("@bFornitore@10g@6n"), FLD(LF_MOV,MOV_CODCF));
 | 
						|
  set_row (2, "@b@18g#.35t", &_ragsoc);
 | 
						|
  set_row (2, FR("@b@54gInd #-.29t #-.10t"), &_indcf, &_civcf);
 | 
						|
  set_row (2, FR("@b@98gP.I. #11t"), &_paiv);
 | 
						|
  if (_alleg == 0)
 | 
						|
    set_row (2, FR("@b@121gAllegato SI"));
 | 
						|
  else 
 | 
						|
    set_row (2, FR("@b@121gAllegato NO"));
 | 
						|
  set_row (3, FR("@b@54gCap #5t"),  &_capcf);
 | 
						|
  set_row (3,"@b@64g%s #-.20t Pr #-.5t", 
 | 
						|
          (const char*)_app, &_dencom, &_provcom);
 | 
						|
  set_row (3, FR("@b@98gC.F. #-16t"), &_cofi);
 | 
						|
  if (_alleg == 0)
 | 
						|
    set_row (3, FR("@b@120gRifer@126g#6d"), &_codalleg);
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::preprocess_page(int file,int counter)
 | 
						|
{
 | 
						|
  if (counter) 
 | 
						|
    return TRUE;
 | 
						|
 | 
						|
  TCursor* cur = current_cursor();
 | 
						|
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
    if (_scelta_stampa == 0)
 | 
						|
    {
 | 
						|
      if (file == LF_MOV)
 | 
						|
      {
 | 
						|
        const TRectype& curmov = cur->curr(LF_MOV);
 | 
						|
 | 
						|
        _tot_avere = 0;
 | 
						|
        _tot_dare  = 0;
 | 
						|
        _c.destroy();
 | 
						|
        _no_preprocess_page = FALSE;
 | 
						|
        _esiste_riga_iva    = FALSE;
 | 
						|
        _nonesiste_riga_iva = FALSE;
 | 
						|
        _annoeser = curmov.get_int(MOV_ANNOES);
 | 
						|
        _datacomp = curmov.get_date(MOV_DATACOMP);
 | 
						|
        _causale  = curmov.get(MOV_CODCAUS);
 | 
						|
        _registro = curmov.get(MOV_REG);
 | 
						|
        _anno     = curmov.get_int(MOV_ANNOIVA);
 | 
						|
        _tipodoc = curmov.get(MOV_TIPODOC);
 | 
						|
        _datareg = curmov.get_date(MOV_DATAREG);
 | 
						|
        _tipo_elenco = curmov.get(MOV_TIPO);
 | 
						|
        _codcf   = curmov.get_long(MOV_CODCF);
 | 
						|
        _numero  = curmov.get_long(MOV_NUMREG);
 | 
						|
        _codval  = curmov.get(MOV_CODVALI);
 | 
						|
        _tiporegistro = tipo_registro(_registro, _anno);
 | 
						|
 | 
						|
        _causale_gia_stampata = FALSE;
 | 
						|
        TEsercizi_contabili esc;
 | 
						|
        _ae = esc.date2esc(_datareg);
 | 
						|
        
 | 
						|
        if (_registro.not_empty()) //si tratta di fattura
 | 
						|
          _mov_di_sola_iva = !cur->is_first_match(LF_RMOV);
 | 
						|
        
 | 
						|
        _descr_doc = DescrDoc(_tipodoc);
 | 
						|
        
 | 
						|
        TRectype da (LF_MOV);
 | 
						|
        TRectype a  (LF_MOV);
 | 
						|
        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 ((curmov >= da) && (curmov <= a))
 | 
						|
        {
 | 
						|
					const TRectype& caus = cache().get(LF_CAUSALI, _causale);
 | 
						|
 
 | 
						|
					_reg_causale   = caus.get(CAU_REG);  
 | 
						|
          _descr_causale = caus.get(CAU_DESCR); 
 | 
						|
          _alleg_causale = caus.get_bool(CAU_ALLEG);
 | 
						|
          _tipodocumento = caus.get(CAU_TIPODOC);
 | 
						|
          
 | 
						|
          if (_controllo_mov_errati == 1 || _controllo_mov_errati == 2)
 | 
						|
          {
 | 
						|
            bool controlla = segnala_errori_primariga();
 | 
						|
            bool verifica  = (_stampa_parte_iva && segnala_errori_iva()) || segnala_errori_ogniriga();
 | 
						|
 | 
						|
            if ((_controllo_mov_errati == 1 && controlla)
 | 
						|
                || _controllo_mov_errati == 2 ) 
 | 
						|
            { 
 | 
						|
              stampa_errori_mov();
 | 
						|
              return TRUE;
 | 
						|
            }
 | 
						|
            else if (_controllo_mov_errati == 1 && !verifica)
 | 
						|
              return FALSE;
 | 
						|
            else return TRUE;
 | 
						|
          }
 | 
						|
          else 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;
 | 
						|
        }
 | 
						|
        const TRectype& currig = cur->curr(LF_RMOV);
 | 
						|
        int gruppo = currig.get_int(RMV_GRUPPO);
 | 
						|
        int conto  = currig.get_int(RMV_CONTO);
 | 
						|
        long sottoconto = currig.get_long(RMV_SOTTOCONTO);
 | 
						|
        const TString4 tipoc = currig.get(RMV_TIPOC);
 | 
						|
        _descr = DescrConto(gruppo, conto, sottoconto, tipoc);
 | 
						|
        _alleg = AllegClifo(gruppo, conto, sottoconto);
 | 
						|
        _importo = currig.get_real(RMV_IMPORTO);
 | 
						|
        _appoggio = currig.get_char(RMV_SEZIONE);
 | 
						|
        if (!_no_preprocess_page)
 | 
						|
        {
 | 
						|
          if (_appoggio=='D')
 | 
						|
          {
 | 
						|
            _tot_dare_generale += _importo;
 | 
						|
            _tot_dare          += _importo;
 | 
						|
          }
 | 
						|
          else
 | 
						|
          {
 | 
						|
            _tot_avere += _importo;
 | 
						|
            _tot_avere_generale += _importo;
 | 
						|
          }
 | 
						|
          if (_controllo_mov_errati != 3) 
 | 
						|
            stampa_errori_rmov();  
 | 
						|
        }
 | 
						|
        return TRUE;                  
 | 
						|
      }
 | 
						|
      else if ( _stampa_parte_iva && file == LF_RMOVIVA)
 | 
						|
      {
 | 
						|
        const TRectype& iva = cur->curr(LF_RMOVIVA);
 | 
						|
        _c.add_riga(iva);
 | 
						|
        return TRUE;
 | 
						|
      }
 | 
						|
    }
 | 
						|
    else //_scelta_stampa == 1
 | 
						|
    {
 | 
						|
      if (file == LF_MOV)
 | 
						|
      {
 | 
						|
        _tot_avere = 0;
 | 
						|
        _tot_dare  = 0; 
 | 
						|
        _no_preprocess_page = FALSE; 
 | 
						|
 | 
						|
        const TRectype& curmov = cur->curr(LF_MOV);
 | 
						|
        _causale = curmov.get(MOV_CODCAUS);
 | 
						|
        _registro = curmov.get(MOV_REG);
 | 
						|
        _anno = curmov.get_int(MOV_ANNOES);
 | 
						|
        _tipodoc = curmov.get(MOV_TIPODOC);
 | 
						|
        
 | 
						|
        _causale_gia_stampata = FALSE;
 | 
						|
        
 | 
						|
        TRectype da (LF_MOV);
 | 
						|
        TRectype a (LF_MOV);
 | 
						|
        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 ((curmov >= da) && (curmov <= a))
 | 
						|
        {
 | 
						|
				  const TRectype & caus = cache().get(LF_CAUSALI, _causale);
 | 
						|
 | 
						|
          _descr_causale = caus.get(CAU_DESCR); 
 | 
						|
          _alleg_causale = caus.get_bool(CAU_ALLEG);
 | 
						|
          _tipodocumento = caus.get(CAU_TIPODOC);
 | 
						|
 | 
						|
          _tiporegistro = tipo_registro (_registro, _anno);
 | 
						|
 | 
						|
          if ((_tiporegistro != 1)&&(_tiporegistro != 2))//se si tratta di un movimento di sola prima nota
 | 
						|
            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;
 | 
						|
        }
 | 
						|
        const TRectype& rmov = current_cursor()->curr(LF_RMOV);
 | 
						|
        int gruppo = rmov.get_int(RMV_GRUPPO);
 | 
						|
        int conto = rmov.get_int(RMV_CONTO);
 | 
						|
        long sottoconto = rmov.get_long(RMV_SOTTOCONTO);
 | 
						|
        const TString4 tipoc = rmov.get(RMV_TIPOC); 
 | 
						|
        _descr = DescrConto(gruppo, conto, sottoconto, tipoc);
 | 
						|
        _importo = rmov.get_real(RMV_IMPORTO);
 | 
						|
        _appoggio = toupper(rmov.get_char(RMV_SEZIONE));
 | 
						|
        if (!_no_preprocess_page)
 | 
						|
        {
 | 
						|
          if (_appoggio=='D')
 | 
						|
          {
 | 
						|
            _tot_dare_generale += _importo;
 | 
						|
            _tot_dare += _importo;
 | 
						|
          }
 | 
						|
          else
 | 
						|
          {
 | 
						|
            _tot_avere += _importo;
 | 
						|
            _tot_avere_generale += _importo;
 | 
						|
          }
 | 
						|
        }
 | 
						|
        return TRUE;
 | 
						|
      }
 | 
						|
    } 
 | 
						|
    break;
 | 
						|
    
 | 
						|
  case fatture:
 | 
						|
  {
 | 
						|
    if (file == LF_MOV)
 | 
						|
    {
 | 
						|
      const TRectype& curmov = current_cursor()->curr(LF_MOV);
 | 
						|
      const int anno = curmov.get_int(MOV_ANNOIVA);
 | 
						|
      const TString4 codreg = curmov.get(MOV_REG);
 | 
						|
      _numr        = curmov.get_long(MOV_NUMREG); 
 | 
						|
      _tipo_elenco = curmov.get(MOV_TIPO); 
 | 
						|
      _codcf       = curmov.get_long(MOV_CODCF);
 | 
						|
      int tiporeg = tipo_registro (codreg, anno);
 | 
						|
      const TString8 attreg = AttivitaRegistro (codreg, anno); 
 | 
						|
      
 | 
						|
      if (tiporeg == 1 || tiporeg == 2)//se si tratta di un movimento iva
 | 
						|
      {  
 | 
						|
        _tipoatt     = TipoAttivita(attreg, get_firm());  
 | 
						|
        _tipo_elenco = curmov.get(MOV_TIPO);
 | 
						|
        _codcf       = curmov.get_long(MOV_CODCF);
 | 
						|
        _codcaus     = curmov.get(MOV_CODCAUS);
 | 
						|
        _tipodoc     = curmov.get(MOV_TIPODOC);      
 | 
						|
        _codval      = curmov.get(MOV_CODVALI); 
 | 
						|
        _totdoc      = curmov.get_real(MOV_TOTDOC);
 | 
						|
 | 
						|
        if (_tipo_elenco != _tipo_clifo_prec && _tipo_clifo_prec != "") 
 | 
						|
          printer().formfeed();
 | 
						|
        
 | 
						|
        TRectype da (LF_MOV);
 | 
						|
        TRectype a (LF_MOV);
 | 
						|
        
 | 
						|
        if (_annoes != 0) //anno specificato nella maschera
 | 
						|
        {
 | 
						|
          da.put(MOV_ANNOES, _annoes);
 | 
						|
          a.put(MOV_ANNOES, _annoes);
 | 
						|
        }
 | 
						|
    
 | 
						|
        da.put(MOV_CODCAUS, _causale_ini);
 | 
						|
        a.put(MOV_CODCAUS, _causale_fin);
 | 
						|
        
 | 
						|
        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 ((curmov >= da) && (curmov <= 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
 | 
						|
            {
 | 
						|
              if ( _salto_pagina && _tipo_clifo_prec == _tipo_elenco )
 | 
						|
                printer().formfeed();
 | 
						|
              stampa_intestazione();
 | 
						|
              _tipo_clifo_prec = _tipo_elenco;
 | 
						|
              _codcf_prec      = _codcf;
 | 
						|
              _settata_prima_riga = FALSE;
 | 
						|
            }    
 | 
						|
          return TRUE;
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
    else if (file == LF_RMOVIVA)
 | 
						|
    { 
 | 
						|
      const TRectype& rmov = current_cursor()->curr(LF_RMOV);
 | 
						|
      int  gruppo = rmov.get_int(RMV_GRUPPO);
 | 
						|
      int  conto  = rmov.get_int(RMV_CONTO);          
 | 
						|
      
 | 
						|
			TToken_string key;
 | 
						|
			key.add(gruppo);
 | 
						|
			key.add(conto);
 | 
						|
			key.add("");
 | 
						|
		  const TRectype & pcon = cache().get(LF_PCON, key);
 | 
						|
      
 | 
						|
      _ricser = pcon.get_int(PCN_RICSER);
 | 
						|
      
 | 
						|
      _simbolo   = SimboloValuta(_codval);
 | 
						|
      _allegb    = CausAlleg(_codcaus);
 | 
						|
      _descr_doc = DescrDoc(_tipodoc);
 | 
						|
      //_intra     = cur->curr(LF_RMOVIVA).get_bool(RMI_INTRA);          
 | 
						|
 | 
						|
      if (!_settata_prima_riga)
 | 
						|
      {
 | 
						|
        reset_print();
 | 
						|
        set_row(1, "");    
 | 
						|
        set_row(2,"@7,rn",FLD(LF_MOV,MOV_NUMREG));
 | 
						|
        set_row(2,"@8g@d",FLD(LF_MOV,MOV_DATAREG)); 
 | 
						|
        set_row(2,"@17g@3,rs",FLD(LF_MOV,MOV_REG));
 | 
						|
        set_row(2,"@20g@5,rn",FLD(LF_MOV,MOV_PROTIVA));
 | 
						|
        set_row(2,"@26g@2,rn",FLD(LF_MOV,MOV_MESELIQ));
 | 
						|
        
 | 
						|
        const TString8 protiva  = cur->curr(LF_MOV).get(MOV_PROTIVA);
 | 
						|
        TString8 uprotiva = cur->curr(LF_MOV).get(MOV_UPROTIVA);
 | 
						|
        
 | 
						|
        if (uprotiva.full())
 | 
						|
        {      
 | 
						|
        	int i;   	                      
 | 
						|
          for (i = 0; protiva[i] && (protiva[i] == uprotiva[i]); i++); 
 | 
						|
          uprotiva = uprotiva.mid(i);
 | 
						|
          set_row(2, "@24g/@25g%s", (const char*) uprotiva);
 | 
						|
        }
 | 
						|
        set_row(2, "@32g@d", FLD(LF_MOV,MOV_DATADOC)); 
 | 
						|
        set_row(2,"@41g@6,rs",FLD(LF_MOV,MOV_NUMDOC));
 | 
						|
        set_row(2,"@48g@3s",FLD(LF_MOV,MOV_CODCAUS));
 | 
						|
        set_row(2,"@52g@2s",FLD(LF_MOV,MOV_TIPODOC));
 | 
						|
        set_row(2,"@55g%-.12s", (const char *)_descr_doc);
 | 
						|
        set_row(2,"@67g@n",FLD(LF_MOV,MOV_TOTDOC));
 | 
						|
        set_row(2,"@84g@n",FLD(LF_RMOVIVA,RMI_IMPONIBILE));      
 | 
						|
        set_row(2,"@101g@4s",FLD(LF_RMOVIVA,RMI_CODIVA));
 | 
						|
        set_row(2,"@105g@1s",FLD(LF_RMOVIVA,RMI_TIPODET));
 | 
						|
        if (_tipoatt == "E")
 | 
						|
        {
 | 
						|
          if (_ricser == 1)        
 | 
						|
            set_row(2,"@109g1");
 | 
						|
          else if (_ricser == 2)
 | 
						|
            set_row(2,"@109g2");
 | 
						|
        }
 | 
						|
        set_row(2,"@111g@f",FLD(LF_RMOVIVA,RMI_INTRA));
 | 
						|
        set_row(2,"@114g@n",FLD(LF_RMOVIVA,RMI_IMPOSTA));
 | 
						|
        if (_allegb)
 | 
						|
          set_row(2,"@131g*");
 | 
						|
 | 
						|
        incrementa_totali();        
 | 
						|
        _settata_prima_riga = TRUE;        
 | 
						|
        ++_documenti;
 | 
						|
      }       
 | 
						|
      else if (_settata_prima_riga)
 | 
						|
      {
 | 
						|
        reset_print();
 | 
						|
        set_row(1,"@84g@n", FLD(LF_RMOVIVA,RMI_IMPONIBILE));
 | 
						|
        set_row(1,"@101g@4s", FLD(LF_RMOVIVA,RMI_CODIVA));
 | 
						|
        set_row(1,"@105g@1s",FLD(LF_RMOVIVA,RMI_TIPODET));
 | 
						|
        set_row(1,"@114g@n", FLD(LF_RMOVIVA,RMI_IMPOSTA));
 | 
						|
        incrementa_totali();                           
 | 
						|
      }
 | 
						|
      return TRUE;                  
 | 
						|
    }
 | 
						|
  }      
 | 
						|
    break;   
 | 
						|
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
  return FALSE;
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::print_intra(int& rr)
 | 
						|
{
 | 
						|
  const TRectype& mov = current_cursor()->curr(LF_MOV);
 | 
						|
  const real corrval = mov.get_real(MOV_CORRVALUTA);
 | 
						|
  if (corrval != ZERO)
 | 
						|
  {               
 | 
						|
    const TString16 codval = mov.get(MOV_CODVALI);
 | 
						|
    TString80 str;
 | 
						|
    
 | 
						|
    rr++;
 | 
						|
    
 | 
						|
    const TCurrency cl(mov.get_real(MOV_CORRLIRE));
 | 
						|
    str = cl.string(TRUE); str.right_just(19);
 | 
						|
    set_row(rr,FR("Corrispettivo@14g%s"), (const char*)str);
 | 
						|
 | 
						|
    const TCurrency cv(corrval, codval);
 | 
						|
    str = cv.string(TRUE); str.right_just(19);
 | 
						|
    set_row(rr,FR("@34gCorr.in valuta@49g%s"), (const char*)str);
 | 
						|
    
 | 
						|
    set_row(rr,"@70g%-3s", (const char*)codval);
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
print_action TListaMov_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 (file == LF_MOV)
 | 
						|
    {       
 | 
						|
      reset_print();
 | 
						|
      _err.reset();
 | 
						|
      int n = 1;
 | 
						|
      int r = 0;
 | 
						|
      if (_scelta_stampa == 0)
 | 
						|
        if (_registro.not_empty() && _mov_di_sola_iva)
 | 
						|
        {
 | 
						|
          compila_clifo();
 | 
						|
          set_row(++r, "@1g%3s %-50s %6ld %-50s", (const char*)_causale, (const char*)_descr_causale, _codcf, (const char*)_ragsoc);  
 | 
						|
        }
 | 
						|
      if ( _scelta_stampa == 0 && _stampa_parte_iva )
 | 
						|
      { 
 | 
						|
        for (int j = 0; j < _c.items(); j++)
 | 
						|
        {
 | 
						|
          const TRigaiva& riga = (const TRigaiva&)_c[j];
 | 
						|
          //r = j+1;
 | 
						|
          r++;
 | 
						|
          set_row(r, FR("Imponibile@11g%r"), &riga._imponibile);
 | 
						|
          set_row(r, FR("@31gImposta@38g%r"), &riga._imposta);
 | 
						|
          set_row(r, FR("@58gCodice Iva@69g%3s"), (const char*)riga._codiva);
 | 
						|
          set_row(r, "@76g%s", (const char*)riga.descr_det());
 | 
						|
 | 
						|
          if (j == 0) // Se e' la prima riga che stampa
 | 
						|
          {
 | 
						|
            const int meseliq = current_cursor()->file(LF_MOV).get_int(MOV_MESELIQ);
 | 
						|
            if (meseliq > 0) // Stampa il mese liquidazione
 | 
						|
              set_row(r,FR("  Mese liq. %2d"), meseliq);
 | 
						|
          }
 | 
						|
          if (riga._intra)
 | 
						|
            set_row(r, FR("@111gOper.intrac."));
 | 
						|
          if (_controllo_mov_errati != 3) 
 | 
						|
            if (!_esiste_riga_iva && ! _nonesiste_riga_iva)
 | 
						|
              stampa_errori_iva(&r, riga);
 | 
						|
        } 
 | 
						|
 | 
						|
        print_intra(r);
 | 
						|
        if (_esiste_riga_iva)
 | 
						|
          set_row(++r, FR("@11gPresenti righe IVA in una registrazione senza IVA"));
 | 
						|
        if (_nonesiste_riga_iva)   
 | 
						|
          set_row(++r, FR("@11gNon presente alcuna riga IVA in una registrazione con IVA"));    
 | 
						|
        _c.destroy();
 | 
						|
      }	//if(_scelta_stampa==0...
 | 
						|
 | 
						|
      if (r > 0)
 | 
						|
        n = ++r;
 | 
						|
 | 
						|
      TRecnotype pos, items;
 | 
						|
      bool FINITO = FALSE;
 | 
						|
      if ((_scelta_stampa == 0)&&(_controllo_mov_errati != 3)&&(_tot_dare != _tot_avere))
 | 
						|
        set_row(n++, FR("@11gIl movimento risulta sbilanciato")); 
 | 
						|
      
 | 
						|
      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();
 | 
						|
      }
 | 
						|
      
 | 
						|
      _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)) 
 | 
						|
        {
 | 
						|
          set_row(n, FR("@b@60gTotali del giorno %s"), _datareg.string());
 | 
						|
          set_row(n++, "@b@90g%r %r", &_tot_dare_giornaliero, &_tot_avere_giornaliero);
 | 
						|
          _tot_avere_giornaliero = 0;
 | 
						|
          _tot_dare_giornaliero  = 0;
 | 
						|
        }
 | 
						|
        if ((_scelta_stampa == 0 && _controllo_mov_errati != 1 && FINITO) || (_scelta_stampa == 1 && FINITO))
 | 
						|
 | 
						|
        {
 | 
						|
          set_row(n++,"");   
 | 
						|
          set_row(n, FR("@b@60gTotale generale"));
 | 
						|
          set_row(n++, "@b@90g%r %r", &_tot_dare_generale, &_tot_avere_generale);
 | 
						|
        }  
 | 
						|
      } 
 | 
						|
 | 
						|
      
 | 
						|
      if (n == 1)
 | 
						|
      {
 | 
						|
        force_setpage(); //probabilmente e' inutile
 | 
						|
        return NEXT_PAGE;
 | 
						|
      }
 | 
						|
      else
 | 
						|
      { 
 | 
						|
        _no_preprocess_page = TRUE;
 | 
						|
        force_setpage(FALSE);
 | 
						|
        return REPEAT_PAGE;
 | 
						|
      }
 | 
						|
    }
 | 
						|
    break;
 | 
						|
  case fatture:
 | 
						|
    if (file == LF_MOV)
 | 
						|
    {
 | 
						|
      reset_print();
 | 
						|
      TCursor* cur = current_cursor(); 
 | 
						|
      int rr = 1;
 | 
						|
      print_intra(rr);
 | 
						|
      _totdocumenti += _totdoc;
 | 
						|
      TRecnotype pos, items;
 | 
						|
      bool FINITO = FALSE;
 | 
						|
 | 
						|
      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))
 | 
						|
      {
 | 
						|
        set_row(rr++,"");
 | 
						|
        if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
 | 
						|
          set_row(rr++, FR("@bTotali Cliente@18gDocumenti Totale documenti@47gAllegati:@63gImponibile@82gImposta@95gop. esenti@110gop. non imp."));
 | 
						|
        else
 | 
						|
          set_row(rr++, FR("@bTotali Fornitore@18gDocumenti Totale documenti@49gAllegati:@63gImponibile@82gImposta@95gop. esenti@110gop. non imp."));
 | 
						|
        set_row(rr, "@b@18g%9d", _documenti);
 | 
						|
        set_row(rr, "@b@28g%r",  &_totdocumenti);
 | 
						|
        set_row(rr, "@b@57g%r",  &_totimponibile);
 | 
						|
        set_row(rr, "@b@73g%r",  &_totimposta);
 | 
						|
        set_row(rr, "@b@92g%r",  &_op_esenti);
 | 
						|
        set_row(rr, "@b@110g%r", &_op_non_imp);          
 | 
						|
 | 
						|
        //incrementa i totali generali di stampa!!!
 | 
						|
		_gen_documenti += _documenti;
 | 
						|
		_gen_totdocumenti += _totdocumenti;
 | 
						|
		_gen_totimponibile += _totimponibile;
 | 
						|
		_gen_totimposta += _totimposta;
 | 
						|
		_gen_op_esenti += _op_esenti;
 | 
						|
		_gen_op_non_imp += _op_non_imp;
 | 
						|
 | 
						|
        _totimposta    = 0;
 | 
						|
        _totimponibile = 0;
 | 
						|
        _op_esenti     = 0;
 | 
						|
        _op_non_imp    = 0;
 | 
						|
        _documenti     = 0;
 | 
						|
        _totdocumenti  = 0;
 | 
						|
        //return REPEAT_PAGE;
 | 
						|
      }
 | 
						|
    
 | 
						|
      if (FINITO)	//ha veramente finito questa stupida stampa: stampa i totali generali!
 | 
						|
	  {
 | 
						|
		TString blank = "";
 | 
						|
		set_row(rr++,(const char*)blank);
 | 
						|
		set_row(rr++,(const char*)blank);
 | 
						|
		set_row(rr++,(const char*)blank);
 | 
						|
 | 
						|
    	set_row(rr++, FR("@bTOTALI GENERALI @18gDocumenti Totale documenti@47gAllegati:@63gImponibile@82gImposta@95gop. esenti@110gop. non imp."));
 | 
						|
			
 | 
						|
		set_row(rr, "@b@18g%9d", _gen_documenti);
 | 
						|
		set_row(rr, "@b@28g%r",  &_gen_totdocumenti);
 | 
						|
		set_row(rr, "@b@57g%r",  &_gen_totimponibile);
 | 
						|
		set_row(rr, "@b@73g%r",  &_gen_totimposta);
 | 
						|
		set_row(rr, "@b@89g%r",  &_gen_op_esenti);
 | 
						|
		set_row(rr, "@b@104g%r", &_gen_op_non_imp);
 | 
						|
 | 
						|
		//alla fine della stampa azzera i totali generali
 | 
						|
		_gen_documenti			= 0;
 | 
						|
		_gen_totdocumenti		= 0;
 | 
						|
		_gen_totimponibile	= 0;
 | 
						|
		_gen_totimposta			= 0;
 | 
						|
		_gen_op_esenti			= 0;
 | 
						|
		_gen_op_non_imp			= 0;
 | 
						|
	  }
 | 
						|
 | 
						|
      if (rr > 1)
 | 
						|
        return REPEAT_PAGE;
 | 
						|
    }
 | 
						|
    break;
 | 
						|
  default:
 | 
						|
    break;  
 | 
						|
  }
 | 
						|
 | 
						|
 | 
						|
  return NEXT_PAGE;
 | 
						|
}
 | 
						|
 | 
						|
print_action TListaMov_application::postprocess_print(int file,int count)
 | 
						|
{
 | 
						|
  if (count)
 | 
						|
  {
 | 
						|
    reset_print();
 | 
						|
    return NEXT_PAGE;
 | 
						|
  }
 | 
						|
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
    break;
 | 
						|
    
 | 
						|
  case fatture:
 | 
						|
    break;
 | 
						|
    
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
  return NEXT_PAGE;
 | 
						|
} 
 | 
						|
 | 
						|
//cerca errori sulla testata (MOV)
 | 
						|
bool TListaMov_application::segnala_errori_primariga()
 | 
						|
{
 | 
						|
  TEsercizi_contabili esc;
 | 
						|
  const int ae = esc.date2esc(_datacomp);
 | 
						|
  
 | 
						|
  if (_ae == 0)  
 | 
						|
    _err.set(0l);
 | 
						|
  
 | 
						|
  if (_registro.not_empty()) //si tratta di fattura
 | 
						|
    if (_datareg.year() != _anno)
 | 
						|
      _err.set(1);
 | 
						|
  
 | 
						|
  if ( _scelta_stampa == 0 && _stampa_anno_comp )
 | 
						|
    if (_ae != _annoeser)
 | 
						|
    {
 | 
						|
      if (_annoes) //specificato l'anno nella maschera
 | 
						|
        _err.set(2); 
 | 
						|
      else _err.set(3);   
 | 
						|
    }
 | 
						|
    else
 | 
						|
      if (_datacomp != _datareg) // altrimenti se gli esercizi corrispondono controlla datacomp e dataop
 | 
						|
        _err.set(26);
 | 
						|
      
 | 
						|
  if (ae)
 | 
						|
  {                        
 | 
						|
    const int ar = esc.date2esc(_datareg);    // Esercizio in corso
 | 
						|
    const int pr = esc.pred(ar);              // Esercizio precedente
 | 
						|
    if (ae != ar && ae != pr)
 | 
						|
      _err.set(4);
 | 
						|
  }  
 | 
						|
  else 
 | 
						|
    _err.set(5); 
 | 
						|
  
 | 
						|
  if (_annoeser != ae)
 | 
						|
    _err.set(6);
 | 
						|
  
 | 
						|
  if (_tipodoc != "")
 | 
						|
    if (!RicercaDoc(_tipodoc)) 
 | 
						|
      _err.set(11);
 | 
						|
  
 | 
						|
  if (_causale.not_empty()) //se indicata la causale
 | 
						|
  {
 | 
						|
    const TRectype & caus = cache().get(LF_CAUSALI, _causale);
 | 
						|
    if (caus.empty())
 | 
						|
      _err.set(7);
 | 
						|
    else
 | 
						|
    {
 | 
						|
      bool sos = caus.get_bool(CAU_SOSPESO);
 | 
						|
      if (sos)
 | 
						|
        _err.set(8);
 | 
						|
      if (_stampa_mess_alleg_iva && _alleg_causale)
 | 
						|
        _err.set(9);
 | 
						|
    }
 | 
						|
    if (_tipodoc != _tipodocumento)
 | 
						|
      _err.set(10);
 | 
						|
    if (_registro != _reg_causale)
 | 
						|
      _err.set(12);              
 | 
						|
    
 | 
						|
    if (_registro.not_empty()) //movimento iva (fatture)
 | 
						|
    {
 | 
						|
      TRegistro rg (_registro, _datareg.year());   
 | 
						|
      if (rg.name().empty())
 | 
						|
        _err.set(13);
 | 
						|
      else  
 | 
						|
      {
 | 
						|
        const int tipo = rg.tipo();
 | 
						|
//        TipoIVA i = nessuna_iva;
 | 
						|
        const TRectype& tabtpd = cache().get("%TPD", _tipodoc);
 | 
						|
        if (!tabtpd.empty())
 | 
						|
        {
 | 
						|
          const bool cor = tabtpd.get_bool("B0");
 | 
						|
          const int i = tabtpd.get_int("I0");
 | 
						|
          if (i == 1 && tipo != 1)
 | 
						|
            _err.set(15);
 | 
						|
          if (i == 2 && tipo != 2)
 | 
						|
            _err.set(15);
 | 
						|
          if (i == 9 && (tipo != 1 && tipo != 2))
 | 
						|
            _err.set(15);
 | 
						|
          if (cor && !rg.corrispettivi())
 | 
						|
            _err.set(15);
 | 
						|
          if (!cor)
 | 
						|
            if (_codcf == 0l)
 | 
						|
              _err.set(16);
 | 
						|
        }
 | 
						|
        if (_codcf != 0l)
 | 
						|
        {
 | 
						|
          if ((tipo == 1 && _tipo_elenco != "C") || (tipo == 2 && _tipo_elenco != "F"))
 | 
						|
            _err.set(17); 
 | 
						|
          
 | 
						|
					TToken_string key;
 | 
						|
					key.add(_tipo_elenco);
 | 
						|
					key.add(_codcf);
 | 
						|
					const TRectype & clifo = cache().get(LF_CLIFO, key);
 | 
						|
 | 
						|
					if (!clifo.empty())   
 | 
						|
          {
 | 
						|
            bool sosp = clifo.get_bool(CLI_SOSPESO);
 | 
						|
            if (sosp)
 | 
						|
              _err.set(18);
 | 
						|
            bool occ    = clifo.get_bool(CLI_OCCAS);
 | 
						|
            char alleg  = clifo.get_char(CLI_ALLEG);
 | 
						|
            long calleg = clifo.get_long(CLI_CODALLEG);
 | 
						|
            if (!occ)
 | 
						|
            { 
 | 
						|
              if (_stampa_mess_alleg_iva && alleg == '1')
 | 
						|
                _err.set(19);      
 | 
						|
              if (calleg != 0l)
 | 
						|
              {
 | 
						|
                if (calleg == _codcf)
 | 
						|
                  _err.set(20);
 | 
						|
								TToken_string key;
 | 
						|
								key.add(_tipo_elenco);
 | 
						|
								key.add(calleg);
 | 
						|
								const TRectype & clifo = cache().get(LF_CLIFO, key);
 | 
						|
                if (!clifo.empty())
 | 
						|
                {
 | 
						|
                  bool sospall = clifo.get_bool(CLI_SOSPESO);
 | 
						|
                  long codall  = clifo.get_long(CLI_CODALLEG); 
 | 
						|
                  char alleg   = clifo.get_char(CLI_ALLEG);
 | 
						|
                  if (sospall)
 | 
						|
                    _err.set(21);
 | 
						|
                  if (codall != 0l)
 | 
						|
                    _err.set(22);
 | 
						|
                  if (_stampa_mess_alleg_iva && alleg == '1') 
 | 
						|
                    _err.set(23);     
 | 
						|
                }
 | 
						|
                else _err.set(24);
 | 
						|
              }   
 | 
						|
            }
 | 
						|
          }  
 | 
						|
          else _err.set(25);
 | 
						|
        }       
 | 
						|
      }
 | 
						|
    }  
 | 
						|
  }
 | 
						|
  if (_err.ones())
 | 
						|
    return TRUE;
 | 
						|
  
 | 
						|
  return FALSE;
 | 
						|
} 
 | 
						|
 | 
						|
//controlli sulla contropartita
 | 
						|
bool TListaMov_application::contropartita(int gruppo, int conto, long sottoconto, char t)
 | 
						|
{
 | 
						|
  TBill tc;
 | 
						|
  TRectype pc (LF_PCON);
 | 
						|
  tc.set(gruppo,0,0l);
 | 
						|
  if (!tc.read(pc))
 | 
						|
    return TRUE;
 | 
						|
  tc.set(gruppo,conto,0l);
 | 
						|
  if (!tc.read(pc))
 | 
						|
    return TRUE;
 | 
						|
  //else t = pc.get_char(PCN_TMCF);
 | 
						|
  tc.set(gruppo,conto,sottoconto);
 | 
						|
  if (t != 'C' && t != 'F')
 | 
						|
  {
 | 
						|
    if (!tc.read(pc))
 | 
						|
      return TRUE; 
 | 
						|
    else
 | 
						|
    { 
 | 
						|
      bool sosp = tc.sospeso();
 | 
						|
      if (sosp)
 | 
						|
        return TRUE;
 | 
						|
    }               
 | 
						|
  }
 | 
						|
  else if (sottoconto != 0l)
 | 
						|
  {
 | 
						|
		TToken_string key;
 | 
						|
		key.add(t);
 | 
						|
		key.add(sottoconto);
 | 
						|
    const TRectype & clifo = cache().get(LF_CLIFO, key);
 | 
						|
 | 
						|
    if (!clifo.empty())   
 | 
						|
    {
 | 
						|
      bool sosp = clifo.get_bool(CLI_SOSPESO);
 | 
						|
      if (sosp) 
 | 
						|
        return TRUE;
 | 
						|
    }
 | 
						|
    else 
 | 
						|
      return TRUE;
 | 
						|
  }    
 | 
						|
  return FALSE;
 | 
						|
}  
 | 
						|
 | 
						|
//guarda se c'e' almeno un errore su almeno una riga (rmov)
 | 
						|
bool TListaMov_application::segnala_errori_ogniriga()
 | 
						|
{
 | 
						|
  TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
 | 
						|
  int gruppo, conto, anno, gruppoc, contoc;
 | 
						|
  long sottoconto, sottocontoc;
 | 
						|
  TDate datareg;
 | 
						|
  char sez, tipo, t, tipoc; 
 | 
						|
  real importo;
 | 
						|
  real dare, avere;
 | 
						|
  
 | 
						|
  if (current_cursor()->is_first_match(LF_RMOV))
 | 
						|
  {
 | 
						|
    dare = avere = ZERO;
 | 
						|
    TRecnotype nrec = rmov.recno();
 | 
						|
    rmov.zero();
 | 
						|
    rmov.setkey(1);
 | 
						|
    rmov.put(RMV_NUMREG, _numero);
 | 
						|
    TRectype recc (rmov.curr());
 | 
						|
    for (rmov.read(_isgteq); !rmov.eof() ;rmov.next())
 | 
						|
    {
 | 
						|
      TRectype rec (rmov.curr());
 | 
						|
      if (rec > recc) break;
 | 
						|
      gruppo = rec.get_int(RMV_GRUPPO);
 | 
						|
      conto  = rec.get_int(RMV_CONTO);
 | 
						|
      sottoconto = rec.get_long(RMV_SOTTOCONTO);
 | 
						|
      gruppoc = rec.get_int(RMV_GRUPPOC);
 | 
						|
      contoc  = rec.get_int(RMV_CONTOC);
 | 
						|
      sottocontoc = rec.get_long(RMV_SOTTOCONTOC);
 | 
						|
      tipoc   = rec.get_char(RMV_TIPOCC);  
 | 
						|
      anno    = rec.get_int(RMV_ANNOES);
 | 
						|
      datareg = rec.get_date(RMV_DATAREG);
 | 
						|
      sez     = rec.get_char(RMV_SEZIONE);
 | 
						|
      tipo    = rec.get_char(RMV_TIPOC);
 | 
						|
      importo = rec.get_real(RMV_IMPORTO);
 | 
						|
      
 | 
						|
      if (sez == 'D') 
 | 
						|
        dare += importo;
 | 
						|
      if (sez == 'A')
 | 
						|
        avere += importo;
 | 
						|
      
 | 
						|
      TBill tc (gruppo,conto,sottoconto);
 | 
						|
      
 | 
						|
      if (gruppoc != 0 || contoc != 0 || sottocontoc != 0l)
 | 
						|
        if (contropartita(gruppoc, contoc, sottocontoc, tipoc))
 | 
						|
        { 
 | 
						|
          rmov.readat(nrec);
 | 
						|
          return true; 
 | 
						|
        }
 | 
						|
      
 | 
						|
      if (anno != _annoeser || datareg != _datareg)
 | 
						|
      {
 | 
						|
        rmov.readat(nrec);
 | 
						|
        return true;
 | 
						|
      }
 | 
						|
      if (sez != 'D' && sez != 'A')
 | 
						|
      { 
 | 
						|
        rmov.readat(nrec);
 | 
						|
        return true;                       
 | 
						|
      }   
 | 
						|
      if (tc.empty())
 | 
						|
      {
 | 
						|
        rmov.readat(nrec);
 | 
						|
        return true;
 | 
						|
      }   
 | 
						|
      if (!tc.ok())
 | 
						|
      {
 | 
						|
        rmov.readat(nrec);
 | 
						|
        return true;
 | 
						|
      }
 | 
						|
      TRectype pc (LF_PCON);
 | 
						|
      tc.set(gruppo,0,0l);
 | 
						|
      
 | 
						|
      if (!tc.read(pc))
 | 
						|
      {
 | 
						|
        rmov.readat(nrec);
 | 
						|
        return true;
 | 
						|
      }
 | 
						|
      tc.set(gruppo,conto,0l);
 | 
						|
      if (!tc.read(pc))
 | 
						|
      {
 | 
						|
        rmov.readat(nrec);
 | 
						|
        return true;
 | 
						|
      }
 | 
						|
      else t = pc.get_char(PCN_TMCF);
 | 
						|
      if (t != tipo)
 | 
						|
      {
 | 
						|
        rmov.readat(nrec);
 | 
						|
        return true;
 | 
						|
      }   
 | 
						|
      tc.set(gruppo,conto,sottoconto);
 | 
						|
      if (t != 'C' && t != 'F')
 | 
						|
      {
 | 
						|
        if (!tc.read(pc))
 | 
						|
        {
 | 
						|
          rmov.readat(nrec);
 | 
						|
          return true; 
 | 
						|
        }
 | 
						|
        else 
 | 
						|
        {
 | 
						|
          bool sosp = tc.sospeso();
 | 
						|
          if (sosp)
 | 
						|
          {
 | 
						|
            rmov.readat(nrec);
 | 
						|
            return true;
 | 
						|
          }
 | 
						|
        }               
 | 
						|
      }
 | 
						|
      else
 | 
						|
      {
 | 
						|
				TToken_string key;
 | 
						|
				key.add(t);
 | 
						|
				key.add(sottoconto);
 | 
						|
				const TRectype & clifo = cache().get(LF_CLIFO, key);
 | 
						|
 | 
						|
				if (!clifo.empty())   
 | 
						|
        {
 | 
						|
          bool sosp = clifo.get_bool(CLI_SOSPESO);
 | 
						|
          if (sosp) 
 | 
						|
          {
 | 
						|
            rmov.readat(nrec);
 | 
						|
            return true;
 | 
						|
          }   
 | 
						|
        }
 | 
						|
        else
 | 
						|
        { 
 | 
						|
          rmov.readat(nrec);
 | 
						|
          return true;
 | 
						|
        }
 | 
						|
        if (_registro.not_empty()) //se su mov e' indicato il codice registro
 | 
						|
        {
 | 
						|
          TRegistro rg (_registro, _ae);
 | 
						|
          const int tiporeg = rg.tipo();
 | 
						|
          if ((tiporeg == 1 && t != 'C') || (tiporeg == 2 && t != 'F'))
 | 
						|
          {
 | 
						|
            rmov.readat(nrec);
 | 
						|
            return true; 
 | 
						|
          }   
 | 
						|
        }
 | 
						|
      } 
 | 
						|
      TLocalisamfile saldi(LF_SALDI);
 | 
						|
      saldi.setkey(1);   
 | 
						|
      saldi.zero();
 | 
						|
      saldi.put(SLD_ANNOES,anno);
 | 
						|
      saldi.put(SLD_GRUPPO,gruppo);
 | 
						|
      saldi.put(SLD_CONTO, conto);
 | 
						|
      saldi.put(SLD_SOTTOCONTO,sottoconto);
 | 
						|
      saldi.put(SLD_FLSCA, "");
 | 
						|
 | 
						|
      if (saldi.read() != NOERR)
 | 
						|
      { 
 | 
						|
        rmov.readat(nrec);
 | 
						|
        return true;   
 | 
						|
      }
 | 
						|
    } //for
 | 
						|
    if (dare != avere)
 | 
						|
    {
 | 
						|
      rmov.readat(nrec);
 | 
						|
      return true;
 | 
						|
    }       
 | 
						|
    rmov.readat(nrec);
 | 
						|
  }
 | 
						|
  return false;  
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::segnala_errori_iva()
 | 
						|
{
 | 
						|
  TLocalisamfile& rmoviva = current_cursor()->file(LF_RMOVIVA);
 | 
						|
  const TRectype& mv  = current_cursor()->curr(LF_RMOV);
 | 
						|
 | 
						|
  if (current_cursor()->is_first_match(LF_RMOVIVA))
 | 
						|
  {
 | 
						|
    const TRecnotype nrec = rmoviva.recno();
 | 
						|
    rmoviva.setkey(1);
 | 
						|
    rmoviva.zero();
 | 
						|
    rmoviva.put(RMI_NUMREG, _numero);
 | 
						|
    const TRectype& rec = rmoviva.curr();
 | 
						|
    const TRectype recc (rec);
 | 
						|
    for (rmoviva.read(_isgteq); !rmoviva.eof() ;rmoviva.next())
 | 
						|
    {
 | 
						|
      if (rec > recc) 
 | 
						|
        break;
 | 
						|
      if (_registro.empty()) 
 | 
						|
      {
 | 
						|
        rmoviva.readat(nrec);
 | 
						|
        _esiste_riga_iva = true;
 | 
						|
        return true;
 | 
						|
      }
 | 
						|
      const TString4 cod = rec.get(RMI_CODIVA);
 | 
						|
      real percind;
 | 
						|
      const int tipodet = get_tipodet_from_rmi(rec, mv, percind);
 | 
						|
      const int tipocr  = rec.get_int(RMI_TIPOCR); 
 | 
						|
      const TRectype& tab_iva = cache().get("%IVA", cod);
 | 
						|
      if (!tab_iva.empty())
 | 
						|
      {
 | 
						|
        int allc = tab_iva.get_int("S7");
 | 
						|
        int allf = tab_iva.get_int("S8");
 | 
						|
        bool s = tab_iva.get_bool("B2");
 | 
						|
        if (s)
 | 
						|
        {
 | 
						|
          rmoviva.readat(nrec);
 | 
						|
          return true;
 | 
						|
        }
 | 
						|
        if (_stampa_mess_alleg_iva)
 | 
						|
          if (allc == 0 || allf == 0)
 | 
						|
          {
 | 
						|
            rmoviva.readat(nrec);
 | 
						|
            return true;
 | 
						|
          }   
 | 
						|
      } 
 | 
						|
      else
 | 
						|
      {
 | 
						|
        rmoviva.readat(nrec);
 | 
						|
        return true;
 | 
						|
      }
 | 
						|
      if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9)
 | 
						|
        if (_tiporegistro != 2)
 | 
						|
        {
 | 
						|
          rmoviva.readat(nrec);
 | 
						|
          return true;
 | 
						|
        }
 | 
						|
      if (_tiporegistro == 1)
 | 
						|
        if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9)
 | 
						|
        {
 | 
						|
          rmoviva.readat(nrec);
 | 
						|
          return true;
 | 
						|
        }   
 | 
						|
      if (_tiporegistro == 2)
 | 
						|
        if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9)
 | 
						|
        {
 | 
						|
          rmoviva.readat(nrec);
 | 
						|
          return true;
 | 
						|
        }
 | 
						|
    }    
 | 
						|
    rmoviva.readat(nrec);    
 | 
						|
  }
 | 
						|
  else if (_registro.not_empty()) //cioe' si tratta di fattura
 | 
						|
  {
 | 
						|
    _nonesiste_riga_iva = true;
 | 
						|
    return true;
 | 
						|
  } 
 | 
						|
  return false; 
 | 
						|
}       
 | 
						|
 | 
						|
void TListaMov_application::incrementa_totali()
 | 
						|
{
 | 
						|
  const TRectype& rmoviva = current_cursor()->curr(LF_RMOVIVA);
 | 
						|
  const real imponibile = rmoviva.get_real(RMI_IMPONIBILE);
 | 
						|
  const real imposta = rmoviva.get_real(RMI_IMPOSTA);
 | 
						|
  const TString4 codiva = rmoviva.get(RMI_CODIVA);
 | 
						|
 | 
						|
  const TRectype& tabiva = cache().get("%IVA", codiva);
 | 
						|
  if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
 | 
						|
  {
 | 
						|
    const int colonna = tabiva.get_int("S7");
 | 
						|
    if ((colonna == 1)||(colonna == 3))
 | 
						|
      _totimposta += imposta;
 | 
						|
    if (colonna == 1)
 | 
						|
      _totimponibile += imponibile;
 | 
						|
    else
 | 
						|
      if (colonna == 3)
 | 
						|
        _op_esenti += imponibile;  
 | 
						|
  }
 | 
						|
  else
 | 
						|
  {
 | 
						|
    const int colonna = tabiva.get_int("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;
 | 
						|
  }       
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::filtra_cursore_provvisori(TCursor* cur) const
 | 
						|
{
 | 
						|
  TString filter;
 | 
						|
  switch (_provvis)
 | 
						|
  {
 | 
						|
  case  1: filter = "(PROVVIS=\"\")"; break; //normale
 | 
						|
  case  2: filter = ""; break;               //globale 
 | 
						|
  default: filter = "(PROVVIS!=\"\")"; break; //solo provvisori   
 | 
						|
  }
 | 
						|
  cur->setfilter(filter); 
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::imposta_parametri_stampa(const TMask& msk)
 | 
						|
{
 | 
						|
  set_magic_currency(TRUE);
 | 
						|
  
 | 
						|
  reset_files();
 | 
						|
  _curr1->set_filterfunction (filter_func);
 | 
						|
  _curr2->set_filterfunction (filter_func);
 | 
						|
  _curr3->set_filterfunction (filter_func_fatture);
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
  {
 | 
						|
    _scelta_stampa = msk.get_int(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 = msk.get_long(F_NUMEROINI);
 | 
						|
    _numreg_fin = msk.get_long(F_NUMEROFIN);
 | 
						|
    _data_ini = msk.get(F_DATAINI);
 | 
						|
    _data_fin = msk.get(F_DATAFIN);
 | 
						|
    _provvis = msk.get_int(F_STAMPAMOVP);
 | 
						|
    _competence_only = msk.get_bool(F_COMPETENZA);
 | 
						|
    
 | 
						|
    TRectype da (LF_MOV), a(LF_MOV);
 | 
						|
    if (_decidi == 1)
 | 
						|
    {
 | 
						|
      select_cursor(_cur1);
 | 
						|
      filtra_cursore_provvisori(_curr1);
 | 
						|
 | 
						|
      da.put(MOV_NUMREG, _numreg_ini);
 | 
						|
      a.put(MOV_NUMREG, _numreg_fin);
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      select_cursor(_cur2);
 | 
						|
      filtra_cursore_provvisori(_curr2);
 | 
						|
 | 
						|
      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:
 | 
						|
  {
 | 
						|
    _noseparator = msk.get_bool(F_SEPARATOR);
 | 
						|
    TString tipo = msk.get(F_TIPOELENCO);
 | 
						|
 | 
						|
    _data_ini = msk.get(F_DATAINI);
 | 
						|
    _data_fin = msk.get(F_DATAFIN);
 | 
						|
    _annoes   = msk.get_int(F_ANNO);
 | 
						|
    _causale_ini = msk.get(F_DACODCAUS);
 | 
						|
    _causale_fin = msk.get(F_ACODCAUS);
 | 
						|
    _dacodiva = msk.get(F_DACODIVA);
 | 
						|
    _acodiva = msk.get(F_ACODIVA);
 | 
						|
    
 | 
						|
    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 (tipo == "E")
 | 
						|
    {
 | 
						|
      _tipo_ini = "C";
 | 
						|
      _tipo_fin = "F";
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      _tipo_ini = tipo;
 | 
						|
      _tipo_fin = tipo;
 | 
						|
    }
 | 
						|
    select_cursor(_cur3);
 | 
						|
    _curr3->setfilter("");
 | 
						|
    TRectype da(LF_MOV), a(LF_MOV);
 | 
						|
    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);
 | 
						|
    da.put(MOV_TIPO, _tipo_ini);
 | 
						|
    current_cursor()->setregion(da,a);
 | 
						|
    add_file(LF_MOV);
 | 
						|
    add_file(LF_RMOVIVA,LF_MOV);
 | 
						|
  }
 | 
						|
  break;
 | 
						|
    
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }
 | 
						|
  init_print(msk);
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::set_print(int)
 | 
						|
{
 | 
						|
  const char* masc;
 | 
						|
  switch(toupper(_tipoc))
 | 
						|
  {
 | 
						|
  case 'C':
 | 
						|
    masc = "cg3100b";
 | 
						|
    _tipo_lista = fatture;
 | 
						|
    break;
 | 
						|
  case 'M': 
 | 
						|
  default :
 | 
						|
    masc = "cg3100a";
 | 
						|
    _tipo_lista = movimenti;
 | 
						|
    break;
 | 
						|
  }
 | 
						|
 | 
						|
  TMask msk(masc);
 | 
						|
  if (main_app().has_module(CMAUT))  
 | 
						|
    msk.show(-4);
 | 
						|
  else     
 | 
						|
  {
 | 
						|
    msk.hide(-4);
 | 
						|
    msk.reset(-4);
 | 
						|
  }
 | 
						|
  msk.set_handler(F_ANNO,    annoes_handler);
 | 
						|
  msk.set_handler(F_DATAINI, data_inizio);
 | 
						|
  msk.set_handler(F_DATAFIN, data_fine);
 | 
						|
  
 | 
						|
  while (msk.run() == K_ENTER) 
 | 
						|
  {
 | 
						|
   imposta_parametri_stampa(msk);
 | 
						|
    print();
 | 
						|
 | 
						|
    msk.reset(-5);
 | 
						|
  }
 | 
						|
  return false;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
bool TListaMov_application::user_create()
 | 
						|
{
 | 
						|
  _relmov1 = new TRelation (LF_MOV);
 | 
						|
  _relmov1->add(LF_RMOV,    "NUMREG=NUMREG",1);
 | 
						|
  _relmov1->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
 | 
						|
  _curr1 = new TCursor (_relmov1, "", 1);
 | 
						|
  _cur1 = add_cursor (_curr1);
 | 
						|
 | 
						|
  _relmov2 = new TRelation (LF_MOV);
 | 
						|
  _relmov2->add(LF_RMOV,    "NUMREG=NUMREG",1); 
 | 
						|
  _relmov2->add(LF_RMOVIVA, "NUMREG=NUMREG",1);  
 | 
						|
  _curr2 = new TCursor (_relmov2, "", 2);
 | 
						|
  _cur2 = add_cursor (_curr2);   
 | 
						|
 | 
						|
  _relmov3 = new TRelation (LF_MOV);
 | 
						|
  _relmov3->add(LF_RMOVIVA, "NUMREG==NUMREG",1);   
 | 
						|
  _relmov3->add(LF_RMOV,    "NUMREG==NUMREG",1); 
 | 
						|
  _curr3 = new TCursor (_relmov3, "", 3);
 | 
						|
  _cur3 = add_cursor (_curr3);
 | 
						|
 | 
						|
  open_files(LF_TAB, LF_TABCOM, LF_CAUSALI, LF_CLIFO, LF_COMUNI, LF_ATTIV,
 | 
						|
						 LF_PCON, LF_SALDI, LF_RMOVIVA, LF_NDITTE, 0);
 | 
						|
  
 | 
						|
  return true;
 | 
						|
}
 | 
						|
 | 
						|
bool TListaMov_application::user_destroy() // releasev e arrmask
 | 
						|
{ 
 | 
						|
  delete _relmov1;  
 | 
						|
  delete _relmov2;  
 | 
						|
  delete _relmov3;  
 | 
						|
  
 | 
						|
  return true;
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
void TListaMov_application::init_print(const TMask& msk)
 | 
						|
{
 | 
						|
  const TDate data (msk.get(F_DATASTAMPA));
 | 
						|
  printer().setdate(data);
 | 
						|
  printer().footerlen(5);
 | 
						|
 | 
						|
  set_magic_currency(TRUE);
 | 
						|
  
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
  {
 | 
						|
    set_real_picture("###.###.###.###.###");
 | 
						|
    reset_print();
 | 
						|
    _flags = 0;
 | 
						|
    _err.reset();
 | 
						|
    _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 = msk.get_bool(F_STAMPA);
 | 
						|
      if (_stampa_parte_iva)
 | 
						|
        _flags |= ST_DATI_IVA;
 | 
						|
      _stampa_mess_alleg_iva = msk.get_bool(F_ALLEGATO);
 | 
						|
      if (_stampa_mess_alleg_iva)
 | 
						|
        _flags |= ST_MESS_ALLEG;
 | 
						|
      _stampa_anno_comp = msk.get_bool(F_ANNOC);
 | 
						|
      if (_stampa_anno_comp)
 | 
						|
        _flags |= ST_ANNO_COMP;   
 | 
						|
      _controllo_mov_errati = msk.get_int(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:
 | 
						|
  {
 | 
						|
    if (_noseparator)                      
 | 
						|
      set_real_picture("################");
 | 
						|
    else
 | 
						|
      set_real_picture("####.###.###.###");
 | 
						|
 | 
						|
    //resettaggio di tutte le incasinatissime variabili membro...(membro stara' per cazzo?)
 | 
						|
    _flags = 0;
 | 
						|
    reset_print();
 | 
						|
    _settata_prima_riga = FALSE;
 | 
						|
    _tipo_clifo_prec = "";
 | 
						|
    _codcf_prec = 0l;
 | 
						|
    _numeroregp = 0;
 | 
						|
    _documenti = 0;
 | 
						|
    _totdocumenti = 0;
 | 
						|
    _totimponibile = 0;
 | 
						|
    _totimposta = 0;
 | 
						|
    _op_esenti = 0;
 | 
						|
    _op_non_imp = 0;
 | 
						|
    _gen_documenti = 0;
 | 
						|
    _gen_totdocumenti = 0;
 | 
						|
    _gen_totimponibile = 0;
 | 
						|
    _gen_totimposta = 0;
 | 
						|
		_gen_op_esenti = 0;
 | 
						|
    _gen_op_non_imp = 0;
 | 
						|
 | 
						|
		//caricamento dati dalla maschera
 | 
						|
    _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);
 | 
						|
    _causale_ini = msk.get(F_DACODCAUS);
 | 
						|
    if (_causale_ini != "")
 | 
						|
      _flags |= ST_CAUSALE;
 | 
						|
    if (_data_fin.ok())
 | 
						|
      _flags |= ST_DATA;
 | 
						|
    _causale_fin = msk.get(F_ACODCAUS);
 | 
						|
    if (_causale_fin != "")
 | 
						|
      _flags |= ST_CAUSALE;
 | 
						|
    TString tipo = msk.get(F_TIPOELENCO);
 | 
						|
    if ((tipo=="C")||(tipo=="F"))
 | 
						|
    {
 | 
						|
      _codice_ini = msk.get_long(F_CODICEINI);
 | 
						|
      _codice_fin = msk.get_long(F_CODICEFIN);
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      _codice_ini = msk.get_long(F_CODICEINI1);
 | 
						|
      _codice_fin = msk.get_long(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;
 | 
						|
  default:
 | 
						|
  break;
 | 
						|
  }
 | 
						|
}  
 | 
						|
 | 
						|
void TListaMov_application::preprocess_header()
 | 
						|
{
 | 
						|
  int soh = 1;       // riga d'inizio dell'intestazione
 | 
						|
  
 | 
						|
	TString sep(132);
 | 
						|
	TString key; key.format("%d", get_firm());
 | 
						|
  const TString & ragsoc = cache().get(LF_NDITTE, key, NDT_RAGSOC);
 | 
						|
  
 | 
						|
  reset_header();
 | 
						|
  sep << TR("Ditta  ") << get_firm();
 | 
						|
  sep << " " << ragsoc;
 | 
						|
  sep.left_just(132);
 | 
						|
  
 | 
						|
  set_header (soh++, (const char*) sep);
 | 
						|
  
 | 
						|
  sep.cut(0) << FR("Data @> Pag. @#");
 | 
						|
  sep.right_just(122);
 | 
						|
  
 | 
						|
  switch (_tipo_lista)
 | 
						|
  {
 | 
						|
  case movimenti:
 | 
						|
    if (_scelta_stampa == 0)
 | 
						|
    {
 | 
						|
      sep.overwrite (TR("Lista movimenti"));
 | 
						|
      set_header (soh++, (const char*)sep);
 | 
						|
      if (_decidi == 2) // se _decidi e' 1 _annoes e' sempre uguale a zero
 | 
						|
      {
 | 
						|
        if (_annoes != 0)
 | 
						|
        {
 | 
						|
          set_header (soh, FR("Cod. eserc.%d"), _annoes);
 | 
						|
          if (_flags & ST_DATA)
 | 
						|
          {
 | 
						|
            set_header (soh, FR("@16gda@19g%s"),_data_ini.string()); 
 | 
						|
            set_header (soh, FR("@30ga@32g%s"),_data_fin.string());
 | 
						|
          }
 | 
						|
        }
 | 
						|
        else  // _annoes == 0
 | 
						|
          if (_flags & ST_DATA)
 | 
						|
          {
 | 
						|
            set_header (soh, FR("Dalla data@11g%s"),_data_ini.string()); 
 | 
						|
            if (_data_fin.ok())
 | 
						|
              set_header (soh, FR("@23galla data@33g%s"),_data_fin.string());
 | 
						|
          }   
 | 
						|
          else 
 | 
						|
            set_header (soh, TR("Completa in ordine di data"));
 | 
						|
      }
 | 
						|
      else
 | 
						|
        if (_flags & ST_NUMERO)
 | 
						|
        {
 | 
						|
          set_header (soh, FR("dal numero@12g%ld"), _numreg_ini);
 | 
						|
          if (_numreg_fin != 0)
 | 
						|
            set_header (soh, FR("@20gal numero@30g%ld"), _numreg_fin);
 | 
						|
        } 
 | 
						|
        else
 | 
						|
          set_header (soh, TR("Completa in ordine di numero"));
 | 
						|
      if (_flags & ST_CAUSALE)
 | 
						|
      {
 | 
						|
        set_header (soh, FR("@46gdalla causale@60g%s"),(const char*)_causale_ini);
 | 
						|
        set_header (soh++, FR("@64galla causale@77g%s"),(const char*)_causale_fin);
 | 
						|
      }
 | 
						|
      else
 | 
						|
        set_header (soh++, TR("     tutte le causali"));
 | 
						|
      if (_flags & ST_REGISTRO)
 | 
						|
      {
 | 
						|
        set_header (soh, FR("dal registro %s"),(const char*)_registro_ini);
 | 
						|
        set_header (soh, FR("@17gal registro %s"),(const char*)_registro_fin);
 | 
						|
      }
 | 
						|
      else
 | 
						|
        set_header (soh, TR("tutti i registri"));
 | 
						|
      if (_flags & ST_DATI_IVA)
 | 
						|
        set_header (soh, FR("@34gstampa dati iva"));
 | 
						|
      if (_flags & ST_CONTROLLO)
 | 
						|
        set_header (soh, FR("@50g(controllo movimenti)"));
 | 
						|
      else if (_flags & ST_SOLO_MOVERR)
 | 
						|
        set_header (soh, FR("@50g(solo movimenti errati)"));
 | 
						|
      else set_header (soh, FR("@50g(senza controllo movimenti)"));
 | 
						|
      if (_flags & ST_MESS_ALLEG)
 | 
						|
      {
 | 
						|
        if (_flags & ST_ANNO_COMP) 
 | 
						|
          set_header (soh, FR("@78gcon messaggi: data competenza, allegato iva"));
 | 
						|
        else 
 | 
						|
          set_header (soh, FR("@78gcon messaggio: allegato iva"));
 | 
						|
      }
 | 
						|
      else if (_flags & ST_ANNO_COMP)
 | 
						|
      {
 | 
						|
        if (_flags & ST_MESS_ALLEG) 
 | 
						|
          set_header (soh, FR("@78gcon messaggi: data competenza, allegato iva"));
 | 
						|
        else 
 | 
						|
          set_header (soh, FR("@78gcon messaggio: data competenza"));
 | 
						|
      } 
 | 
						|
      sep.fill('_');
 | 
						|
      set_header (++soh, (const char *) sep);
 | 
						|
      set_header (++soh, FR("Rg  Cod Causale@30gDescrizione@56gCodice conto@71gDescrizione conto@103gDare@120gAvere@130gSB"));
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      sep.overwrite (TR("Lista movimenti di sola prima nota"));
 | 
						|
      set_header (soh++, (const char*)sep);
 | 
						|
      if (_decidi == 2)
 | 
						|
      {
 | 
						|
        if (_annoes != 0)
 | 
						|
        {
 | 
						|
          set_header (soh, FR("Cod. comp. %d"), _annoes);
 | 
						|
          if (_flags & ST_DATA)
 | 
						|
          {
 | 
						|
            set_header (soh, FR("@16gda@19g%s"), (const char*)_data_ini.string()); 
 | 
						|
            set_header (soh, FR("@30ga@32g%s"),  (const char*)_data_fin.string());
 | 
						|
          }
 | 
						|
        }
 | 
						|
        else
 | 
						|
          if (_flags & ST_DATA)
 | 
						|
          {
 | 
						|
            set_header (soh, FR("Dalla data@11g%s"), (const char*)_data_ini.string()); 
 | 
						|
            set_header (soh, FR("@23galla data@33g%s"), (const char*)_data_fin.string());
 | 
						|
          }   
 | 
						|
          else 
 | 
						|
            set_header (soh, TR("Completa in ordine di data"));
 | 
						|
      } 
 | 
						|
      else 
 | 
						|
        if (_flags & ST_NUMERO)
 | 
						|
        {
 | 
						|
          set_header (soh, FR("@46gdal numero@57g%ld"), _numreg_ini);
 | 
						|
          set_header (soh, FR("@65gal numero@75g%ld"), _numreg_fin);
 | 
						|
        }
 | 
						|
        else
 | 
						|
          set_header (soh, FR("@46gCompleta in ordine di numero"));
 | 
						|
      if (_flags & ST_CAUSALE)
 | 
						|
      {
 | 
						|
        set_header(soh, FR("@86gdalla causale@100g%3s"),(const char*)_causale_ini);
 | 
						|
        set_header(soh,FR("@104galla causale@117g%3s"),(const char*)_causale_fin);
 | 
						|
      }
 | 
						|
      else
 | 
						|
        set_header (soh, TR("@86gtutte le causali"));
 | 
						|
      sep.fill('_');
 | 
						|
      set_header (++soh, (const char *) sep);
 | 
						|
      set_header (++soh, FR("Rg  Cod Causale@30gDescrizione@56gCodice conto@71gDescrizione conto@103gDare@120gAvere@130gSB"));
 | 
						|
    }
 | 
						|
    break;
 | 
						|
 | 
						|
  case fatture:
 | 
						|
    sep.overwrite (TR("Lista fatture"));
 | 
						|
    set_header (soh, (const char*)sep);
 | 
						|
    if (_annoes != 0)
 | 
						|
    {
 | 
						|
      set_header (soh, FR("@15gCod. comp %d"), _annoes);
 | 
						|
      if (_flags & ST_DATA)
 | 
						|
      { 
 | 
						|
        set_header (soh, FR("@30gdalla data@41g%s"), (const char*)_data_ini.string()); 
 | 
						|
        set_header (soh, FR("@52galla data@62g%s"), (const char*)_data_fin.string());
 | 
						|
      }
 | 
						|
    }
 | 
						|
    else
 | 
						|
      if (_flags & ST_DATA)
 | 
						|
      { 
 | 
						|
        set_header (soh, FR("@15gdalla data %s"), (const char*)_data_ini.string()); 
 | 
						|
        set_header (soh, FR("@37galla data %s"), (const char*)_data_fin.string());
 | 
						|
      }
 | 
						|
      else 
 | 
						|
        set_header (soh, TR("@15gcompleta in ordine di data"));
 | 
						|
    if (_flags & ST_CODICE)
 | 
						|
    {
 | 
						|
      set_header (soh, FR("@74gdal codice %ld"), _codice_ini);
 | 
						|
      set_header (soh, FR("@92gal codice %ld"), _codice_fin);   
 | 
						|
    }
 | 
						|
    sep.fill('_');
 | 
						|
    set_header (++soh, sep);
 | 
						|
    set_header (++soh, FR("Numero  Data    Cod Prot.  M   Documento@48gCod Tp @75gTotale@101gCd  Tp  T O@129gNo"));
 | 
						|
    set_header (++soh, FR("Regis.  Operaz. Reg Num.   L   Data@41gNumero@48gCau Dc @55gDescrizione@75gDocumento@90gImponibile@101gIv  Det A I@121gImposta@129gAll")); 
 | 
						|
    break;
 | 
						|
  default:
 | 
						|
    break;
 | 
						|
  }   
 | 
						|
  
 | 
						|
  set_header (++soh, sep);
 | 
						|
}
 | 
						|
 | 
						|
TListaMov_application::TListaMov_application(char tipost)
 | 
						|
                     : _err(80),_tipoc(tipost)
 | 
						|
{ }
 | 
						|
 | 
						|
int cg3100(int argc, char* argv[])
 | 
						|
{
 | 
						|
  const char tipo = argc > 2 ? toupper(*argv[2]) : 'M'; 
 | 
						|
  TListaMov_application a(tipo);
 | 
						|
 | 
						|
  const char* title = NULL;
 | 
						|
  switch (tipo)
 | 
						|
  {
 | 
						|
  case 'C': title = TR("Lista fatture clienti/fornitori");  break;
 | 
						|
  default : title = TR("Lista movimenti"); break;    
 | 
						|
  }
 | 
						|
  a.run(argc, argv, title);
 | 
						|
  return TRUE;
 | 
						|
}
 |