Files correlati : tc1.exe Ricompilazione Demo : [ ] Commento : Correto il calcolo della Norma nell. invio a Zucchetti git-svn-id: svn://10.65.10.50/branches/R_10_00@21741 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			1083 lines
		
	
	
		
			26 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			1083 lines
		
	
	
		
			26 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#include <applicat.h>
 | 
						||
#include <automask.h>
 | 
						||
#include <filetext.h>
 | 
						||
#include <progind.h>
 | 
						||
#include <recarray.h>
 | 
						||
#include <reprint.h>
 | 
						||
#include <reputils.h>
 | 
						||
#include <utility.h>
 | 
						||
 | 
						||
#include "tc1.h"
 | 
						||
#include "tc1100a.h"
 | 
						||
 | 
						||
#include <clifo.h>
 | 
						||
#include <pconti.h>
 | 
						||
#include <mov.h>
 | 
						||
#include <rmov.h>
 | 
						||
#include <rmoviva.h>
 | 
						||
#include <multirel.h>
 | 
						||
 | 
						||
#define ALIAS_REG		100
 | 
						||
// restituisce un riferimento all' applicazione
 | 
						||
 | 
						||
///////////////////////////////////////////////////////////
 | 
						||
// TRiclassifica_cache
 | 
						||
///////////////////////////////////////////////////////////
 | 
						||
 | 
						||
class TRiclassifica_cache : public TCache
 | 
						||
{
 | 
						||
	TLocalisamfile _multirel;
 | 
						||
protected:
 | 
						||
  virtual TObject* key2obj(const char* key);
 | 
						||
 | 
						||
public:
 | 
						||
	const char* sdecode(const char* tab, const TString& cod);
 | 
						||
	long decode(const char* tab, const TString& cod);
 | 
						||
	TRiclassifica_cache() : _multirel(LF_MULTIREL) {}
 | 
						||
};
 | 
						||
 | 
						||
TObject* TRiclassifica_cache::key2obj(const char* key)
 | 
						||
{
 | 
						||
	TToken_string tok(key);
 | 
						||
	TString8 tab, cod;
 | 
						||
	tok.get(0,tab);
 | 
						||
	tok.get(1, cod);
 | 
						||
	_multirel.put(MULTI_COD, tab);
 | 
						||
	_multirel.put(MULTI_FIRST, cod);
 | 
						||
	int err = _multirel.read(_isgteq);
 | 
						||
	if (err == NOERR && _multirel.get(MULTI_FIRST) == cod)
 | 
						||
		return new TString16(_multirel.get(MULTI_DATA));
 | 
						||
	return NULL;
 | 
						||
}
 | 
						||
 | 
						||
long TRiclassifica_cache::decode(const char* tab, const TString& cod)
 | 
						||
{
 | 
						||
	TToken_string tok;
 | 
						||
	tok.add(tab);
 | 
						||
	tok.add(cod);
 | 
						||
	const TString* ric = (const TString*) objptr(tok);
 | 
						||
	return (ric ? atol(*ric) : 0);
 | 
						||
}
 | 
						||
 | 
						||
class TInvio;
 | 
						||
 | 
						||
inline TInvio& app() { return (TInvio&) main_app();}
 | 
						||
 | 
						||
class TInvio_file: public TFile_text
 | 
						||
{
 | 
						||
protected:
 | 
						||
  virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str);
 | 
						||
 | 
						||
public:
 | 
						||
	const TString& bill2ricl(const char t, int gr, int co, long so, bool completo);
 | 
						||
  TInvio_file(const TString& file_name);
 | 
						||
  virtual ~TInvio_file() { }
 | 
						||
};
 | 
						||
 | 
						||
TInvio_file::TInvio_file(const TString& file_name)
 | 
						||
          : TFile_text(file_name, "tc1100a.ini")
 | 
						||
{
 | 
						||
}
 | 
						||
 | 
						||
class TInvio_mask : public TAutomask
 | 
						||
{
 | 
						||
protected:
 | 
						||
  bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
						||
public:
 | 
						||
 | 
						||
  TInvio_mask();
 | 
						||
  
 | 
						||
  virtual ~TInvio_mask(){};
 | 
						||
};
 | 
						||
  
 | 
						||
TInvio_mask::TInvio_mask() :TAutomask ("tc1100a")
 | 
						||
{
 | 
						||
}  
 | 
						||
  
 | 
						||
bool TInvio_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
						||
{ 
 | 
						||
	switch (o.dlg())
 | 
						||
	{
 | 
						||
	case F_CODDITTA:                               
 | 
						||
		if (e==fe_init && o.empty())
 | 
						||
		{
 | 
						||
			set(F_CODDITTA, main_app().get_firm());
 | 
						||
			((TEdit_field&) o).check();
 | 
						||
			disable(F_CODDITTA);
 | 
						||
		}	
 | 
						||
		break;
 | 
						||
	default:
 | 
						||
		break;	
 | 
						||
	}
 | 
						||
  return true;
 | 
						||
}
 | 
						||
 | 
						||
class TInvio : public TSkeleton_application
 | 
						||
{                     
 | 
						||
	TCursor*				   _cur;
 | 
						||
  TInvio_mask* 			 _msk;
 | 
						||
  TInvio_file*			 _trasfile;
 | 
						||
	TLog_report *      _log;
 | 
						||
	TRiclassifica_cache * _tabelle;
 | 
						||
	TRecord_cache*		 _conti;
 | 
						||
	long 							 _nrecords, _nrecscorr, _nrecsfattvend, _nrecsfattacqu, _nrecsmocontab;
 | 
						||
  int								 _nfiles;
 | 
						||
  long							 _nrecsdettaglio;
 | 
						||
  TString16					 _descrdettaglio;
 | 
						||
  TDate							 _dataini, _datafin;
 | 
						||
  bool							 _totale, _finemov;
 | 
						||
	bool							 _trcau, _trcon, _triva, _trban;
 | 
						||
  
 | 
						||
protected:
 | 
						||
  virtual bool create(void);
 | 
						||
  virtual bool destroy(void);
 | 
						||
  virtual void main_loop() ;
 | 
						||
  void invio_zucchetti();
 | 
						||
  long i_zucchetti_causali(const bool invio = TRUE);
 | 
						||
  long i_zucchetti_clifor(const bool invio = TRUE);
 | 
						||
  long i_zucchetti_conti(const bool invio = TRUE);
 | 
						||
  long i_zucchetti_movcont(const bool invio = TRUE);
 | 
						||
  long i_zucchetti_moviva(const char acqven, const bool invio = TRUE);
 | 
						||
  void i_zucchetti_testa_dettaglio(const TString16& descr, const long nrecs);
 | 
						||
  void i_zucchetti_coda_dettaglio(const TString16& descr, const long nrecs);
 | 
						||
  void i_zucchetti_testa();
 | 
						||
  void i_zucchetti_coda();
 | 
						||
public:
 | 
						||
  int get_nfiles() {return _nfiles;}
 | 
						||
  long get_nrecords() {return _nrecords;}
 | 
						||
  long get_nrecsdettaglio() {return _nrecsdettaglio;}
 | 
						||
  TString16& get_descrdettaglio() {return _descrdettaglio;}
 | 
						||
  const bool totale() {return _totale;}
 | 
						||
  const bool finemov() {return _finemov;}
 | 
						||
	TRecord_cache& conti() {return *_conti;}
 | 
						||
	TRiclassifica_cache & tabelle() {	return * _tabelle;}
 | 
						||
	void log(int sev, const char* msg);
 | 
						||
	bool trcau() const { return _trcau; }
 | 
						||
	bool triva() const { return _triva; }
 | 
						||
	bool trcon() const { return _trcon; }
 | 
						||
	bool trban() const { return _trban; }
 | 
						||
 | 
						||
  TInvio() {} ;
 | 
						||
  virtual ~TInvio() {} ;
 | 
						||
};  
 | 
						||
 | 
						||
const char * TRiclassifica_cache::sdecode(const char* tab, const TString& cod)
 | 
						||
{
 | 
						||
	const TString* ric = NULL;
 | 
						||
 | 
						||
	if (cod.full())
 | 
						||
	{
 | 
						||
		TToken_string tok;
 | 
						||
 | 
						||
		tok.add(tab);
 | 
						||
		tok.add(cod);
 | 
						||
		ric = (const TString*) objptr(tok);
 | 
						||
 | 
						||
		if (ric == NULL || ric->blank())
 | 
						||
		{
 | 
						||
			TString msg;
 | 
						||
 | 
						||
			msg << TR("Tabella") << " "<< &(tab[2])  << " " << TR("Codice") << " " << cod  << " :" << TR("Non presente in tabella");
 | 
						||
			app().log(2, msg);
 | 
						||
		}
 | 
						||
	}
 | 
						||
	else 
 | 
						||
		int i = 1;
 | 
						||
	return ric ? (const char *) *ric : "";
 | 
						||
	
 | 
						||
}
 | 
						||
 
 | 
						||
void TInvio::log(int sev, const char* msg)
 | 
						||
{ 
 | 
						||
	if (_log != NULL)
 | 
						||
	{
 | 
						||
		if (sev > 0)
 | 
						||
		{
 | 
						||
			TString m;
 | 
						||
			m << TR(" Errore : ") << msg;
 | 
						||
			_log->log(sev, m); 
 | 
						||
		}
 | 
						||
		else
 | 
						||
			_log->log(sev, msg);
 | 
						||
	}
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
const TString& TInvio_file::bill2ricl(const char t, int gr, int co, long so, bool completo)
 | 
						||
{
 | 
						||
  TString & codricl = get_tmp_string();
 | 
						||
 | 
						||
	if (gr > 0&& co >0 && so > 0)
 | 
						||
	{
 | 
						||
		if (!app().trcon())
 | 
						||
		{
 | 
						||
			if (completo && t <= ' ')
 | 
						||
				codricl.format("%02d%03d", co, so);
 | 
						||
			else
 | 
						||
				codricl.format("%05d",so);
 | 
						||
		}
 | 
						||
		else
 | 
						||
		{
 | 
						||
			TToken_string cod("ZUCONTI");
 | 
						||
			cod.add(gr);
 | 
						||
			cod.add(co);
 | 
						||
			cod.add(t <= ' ' ? so : 0);
 | 
						||
 | 
						||
			// Provo il sottoconto ma se non riesco provo con conto e poi anche gruppo
 | 
						||
			for (int c = t == ' ' ? 3 : 2; c > 0 && codricl.blank(); c--)
 | 
						||
			{
 | 
						||
				const TRectype & rec = app().conti().get(cod);
 | 
						||
 | 
						||
				codricl = rec.get("CODICE");
 | 
						||
				cod.add(0, c);
 | 
						||
			}
 | 
						||
			if (codricl.blank())
 | 
						||
			{
 | 
						||
				TString msg;
 | 
						||
				msg << TR("Conto") << " " << gr << " " << co << " " << so  << " :" << TR("Non presente in tabella");
 | 
						||
				app().log(2, msg);
 | 
						||
			}
 | 
						||
		}
 | 
						||
	}
 | 
						||
	return codricl;
 | 
						||
}
 | 
						||
// gestione dei messaggi estesi nei campi
 | 
						||
void TInvio_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TString& str)
 | 
						||
{
 | 
						||
  const TString code(s.get(0));
 | 
						||
  TString valore;
 | 
						||
  if (code == "_FISSO")
 | 
						||
  {
 | 
						||
    // gestione dei campi fissi per i record delle riba
 | 
						||
    // sintassi: _FISSO,!<valore>
 | 
						||
    // dove: <valore> <20> la stringa fissa da emettere
 | 
						||
    TString in(s.get());
 | 
						||
    CHECK(in[0]=='!',"Macro _FISSO senza carattere '!'");
 | 
						||
    in.ltrim(1);
 | 
						||
    in.trim();
 | 
						||
    valore = in;
 | 
						||
  } 
 | 
						||
  else if (code == "_ANNO")
 | 
						||
  {
 | 
						||
    TDate data(str);
 | 
						||
    int anno = data.year();
 | 
						||
    valore.format("%ld", anno);
 | 
						||
  } 
 | 
						||
  else if (code == "_MESE")
 | 
						||
  {
 | 
						||
    TDate data(str);
 | 
						||
    int mese = data.month();
 | 
						||
    valore.format("%ld", mese);
 | 
						||
  } 
 | 
						||
  else if (code.starts_with("_SEZIONE"))
 | 
						||
  {
 | 
						||
		const TRectype & rmov = cur.curr(LF_RMOV);
 | 
						||
		const char sezione = s.get()[0];  	
 | 
						||
		const char sezriga = rmov.get_char(RMV_SEZIONE);		
 | 
						||
	  const bool completo = code.starts_with("_SEZIONEC");
 | 
						||
 | 
						||
		valore = str;
 | 
						||
		if (sezione != sezriga)
 | 
						||
			valore = "";
 | 
						||
		else
 | 
						||
		{
 | 
						||
			const int gr = rmov.get_int(RMV_GRUPPO);
 | 
						||
			const int co = rmov.get_int(RMV_CONTO);
 | 
						||
			const long so = rmov.get_long(RMV_SOTTOCONTO);
 | 
						||
			const char t = rmov.get_char(RMV_TIPOC);
 | 
						||
			valore = bill2ricl(t, gr, co, so, completo);
 | 
						||
		}
 | 
						||
  }
 | 
						||
  else if (code == "_CAUSALE")
 | 
						||
  {
 | 
						||
		const TRectype & mov = cur.curr(LF_MOV);
 | 
						||
		const bool prima_nota = mov.get(MOV_REG).blank();
 | 
						||
 | 
						||
		if (prima_nota && valore.blank())
 | 
						||
			valore = "999";
 | 
						||
		else
 | 
						||
		{
 | 
						||
			if (app().trcau())
 | 
						||
				valore = app().tabelle().sdecode("ZUCAU", str);
 | 
						||
			else
 | 
						||
			{
 | 
						||
				if (valore.blank())
 | 
						||
				{
 | 
						||
					if (!prima_nota)
 | 
						||
						valore = str;
 | 
						||
					else
 | 
						||
						valore = "999";
 | 
						||
				}
 | 
						||
			}
 | 
						||
		}
 | 
						||
  } 
 | 
						||
  else if (code == "_TIPOSOG")
 | 
						||
	{
 | 
						||
		if (cur.curr().get_int(CLI_ALLEG) == 6)
 | 
						||
			valore = "P";
 | 
						||
		else
 | 
						||
			valore = "S";
 | 
						||
 | 
						||
	}
 | 
						||
  else if (code == "_FLSMR")
 | 
						||
	{
 | 
						||
		if (cur.curr().get(CLI_STATOPAIV) == "SM")
 | 
						||
			valore = "S";
 | 
						||
		else
 | 
						||
		{
 | 
						||
			const TRectype & r = cache().get("%STA", cur.curr().get(CLI_STATOCF));
 | 
						||
			valore = r.get_bool("B1") ? "S" : " ";
 | 
						||
		}
 | 
						||
	}
 | 
						||
	else if (code == "_BLACKLIST")
 | 
						||
	{
 | 
						||
		const TRectype & r = cache().get("%STA", cur.curr().get(CLI_STATOCF));
 | 
						||
		valore = r.get_bool("B0") ? "S" : " ";
 | 
						||
	}
 | 
						||
  else if (code == "_ATTIVITA")
 | 
						||
  {
 | 
						||
		int att = atoi(cur.file("REG").get("S8"));
 | 
						||
		att = att-1;
 | 
						||
		if (att == 0)
 | 
						||
  		valore = " ";
 | 
						||
		else
 | 
						||
			valore = format("%02d", att);
 | 
						||
  } 
 | 
						||
  else if (code == "_SEZIONALE")
 | 
						||
  {
 | 
						||
		int att = atoi(cur.file("REG").get("I8"));
 | 
						||
		valore = format("%02d", att);
 | 
						||
  } 
 | 
						||
  else if (code == "_IVA" || code == "_NORMA")
 | 
						||
  {
 | 
						||
		if (app().triva())
 | 
						||
    {
 | 
						||
      // Il codice Campo 206 diventa il codice "20Z1" (codice+norma) oppure "20" (solo codice con eventuale norma associata)
 | 
						||
			valore = app().tabelle().sdecode("ZUIVA", str);  
 | 
						||
		  if (code == "_NORMA")
 | 
						||
			{
 | 
						||
        if (valore.len() > 2) // Se e' piu' lungo di 2 la norma Zucchetti sono gli ultimi due
 | 
						||
          valore.ltrim(2);
 | 
						||
				else
 | 
						||
					valore = "" ;
 | 
						||
		  }
 | 
						||
      else
 | 
						||
        valore.cut(2);
 | 
						||
    }
 | 
						||
    if (valore.blank())
 | 
						||
    {
 | 
						||
      if (code == "_IVA")
 | 
						||
        valore = str.left(2);
 | 
						||
      else
 | 
						||
        valore = str.mid(2);
 | 
						||
    }
 | 
						||
  } 
 | 
						||
  else if (code == "_BANCA")
 | 
						||
	{
 | 
						||
		if (app().trban())
 | 
						||
			valore = app().tabelle().sdecode("ZUBAN", str);
 | 
						||
		if (valore.blank())
 | 
						||
		{
 | 
						||
			valore = str.mid(2, 3);
 | 
						||
			valore << str.mid(7, 3);
 | 
						||
		}
 | 
						||
 | 
						||
	}
 | 
						||
  else if (code == "_NUMFILES")
 | 
						||
  {                                       
 | 
						||
  	const int nfiles = app().get_nfiles();
 | 
						||
  	valore.format("%ld", nfiles);
 | 
						||
  }
 | 
						||
  else if (code == "_NUMRECORDS")
 | 
						||
  {                 
 | 
						||
  	const long nrecords = app().get_nrecords(); 
 | 
						||
  	valore.format("%ld", nrecords);
 | 
						||
  }
 | 
						||
  else if (code == "_NUMRECORDSDETTAGLIO")
 | 
						||
  {                 
 | 
						||
  	const long nrecords = app().get_nrecsdettaglio(); 
 | 
						||
  	valore.format("%ld", nrecords);
 | 
						||
  }
 | 
						||
  else if (code == "_TIPOFILE")
 | 
						||
  {                 
 | 
						||
  	valore = app().get_descrdettaglio();
 | 
						||
  }
 | 
						||
  else if (code == "_OPZIONI")
 | 
						||
	{
 | 
						||
		const TString80 code = s.get();
 | 
						||
		if (code == "ZUNUMEROINVIO")
 | 
						||
		{
 | 
						||
			const int inv = ini_get_int(CONFIG_DITTA, "tc", code) + 1;
 | 
						||
	
 | 
						||
			valore.format("%d", inv);
 | 
						||
		}
 | 
						||
		else
 | 
						||
			valore = ini_get_string(CONFIG_DITTA, "tc", code);
 | 
						||
	}
 | 
						||
  else if (code == "_OGGI")
 | 
						||
  {
 | 
						||
    TDate data(TODAY);
 | 
						||
  	valore = data.string(full, '-', full, full, amg_date);
 | 
						||
  	valore.strip("-");
 | 
						||
  } 
 | 
						||
  else if (code == "_CODIFICA")
 | 
						||
  {
 | 
						||
  	const char tipocf = str[0];
 | 
						||
  	if (tipocf == 'C')
 | 
						||
  		valore = "P";
 | 
						||
  	else
 | 
						||
  		valore = "R";
 | 
						||
  } 
 | 
						||
  else if (code == "_NUMDOC")
 | 
						||
  {
 | 
						||
  	if (cur.file("REG").get("I0") == 1)
 | 
						||
  		valore = cur.curr().get(MOV_NUMDOC);
 | 
						||
  	else
 | 
						||
  		valore = cur.curr().get(MOV_PROTIVA);	
 | 
						||
  }
 | 
						||
  else if (code == "_SEGNO")
 | 
						||
  {
 | 
						||
 		TString archivio(s.get()); 	
 | 
						||
 		TString campo(s.get()); 	
 | 
						||
 		const real importo = cur.curr(archivio).get_real(campo);
 | 
						||
 		valore = "+";
 | 
						||
 		if (importo < 0)
 | 
						||
 			valore = "-";
 | 
						||
  }
 | 
						||
  else if (code == "_IMPORTO")
 | 
						||
  { 
 | 
						||
		real importo(str);
 | 
						||
		valore = importo.string(0,2);
 | 
						||
  	valore.strip("-");
 | 
						||
  	valore.strip("+");
 | 
						||
  	valore.strip(".");
 | 
						||
  }
 | 
						||
  else if (code == "_TIPODOC")
 | 
						||
  { 
 | 
						||
		const char tipodoc = str[0];
 | 
						||
		valore = (tipodoc == 'F') ? "1" : "2";
 | 
						||
  }
 | 
						||
  else if (code == "_TIPOCORR")
 | 
						||
  { 
 | 
						||
		valore = str;
 | 
						||
 | 
						||
		if (valore != "SC" && valore != "RF")
 | 
						||
			valore = "CN";
 | 
						||
  }
 | 
						||
  else if (code == "_DIVERSI")
 | 
						||
  { 
 | 
						||
  	valore = (app().finemov() ? "X" : " ");
 | 
						||
  }
 | 
						||
  else if (code == "_TOTALE")
 | 
						||
  { 
 | 
						||
  	real importo(ZERO);
 | 
						||
  	if (app().totale())    
 | 
						||
  	{ 
 | 
						||
  		importo = cur.curr(LF_MOV).get_real(MOV_TOTDOC);
 | 
						||
  		importo+=cur.curr(LF_MOV).get_real(MOV_RITFIS);
 | 
						||
  	}	
 | 
						||
		valore = importo.string(11,2);
 | 
						||
  	valore.strip("-");
 | 
						||
  	valore.strip("+");
 | 
						||
  	valore.strip(".");
 | 
						||
  }
 | 
						||
  else if (code == "_SEGNOTOTALE")
 | 
						||
  {          
 | 
						||
  	real importo(ZERO);
 | 
						||
  	if (app().totale())
 | 
						||
  	{
 | 
						||
  		importo = cur.curr(LF_MOV).get_real(MOV_TOTDOC);
 | 
						||
  		importo+=cur.curr(LF_MOV).get_real(MOV_RITFIS);
 | 
						||
  	}	
 | 
						||
  	valore = importo.string(11,2);
 | 
						||
  	valore.trim();
 | 
						||
  	valore = valore.sub(0,1);	
 | 
						||
  	if (valore[0] != '-' && valore[0] != '+')
 | 
						||
  		valore = "+";
 | 
						||
  }
 | 
						||
	else if (code == "_GIUFIS")
 | 
						||
	{
 | 
						||
		const char tipopers = cur.curr(LF_CLIFO).get_char(CLI_TIPOPERS);
 | 
						||
		valore = (tipopers == 'F') ? " " : "S";
 | 
						||
	}
 | 
						||
	else if (code.starts_with("_CONTO"))
 | 
						||
	{
 | 
						||
 		const int ln = s.get_int(); 	
 | 
						||
		const TRectype & rec = cur.curr(ln);
 | 
						||
		char t = ' ';
 | 
						||
		const TString& tiponame = s.get();
 | 
						||
		const bool completo = code.starts_with("_CONTOC");
 | 
						||
 | 
						||
		if (tiponame.full())
 | 
						||
			t = rec.get_char(tiponame);
 | 
						||
 | 
						||
		if (ln == LF_CLIFO)
 | 
						||
		{
 | 
						||
			const int gr = rec.get_int(CLI_GRUPPORIC);
 | 
						||
			const int co = rec.get_int(CLI_CONTORIC);
 | 
						||
			const long so = rec.get_long(CLI_SOTTOCRIC);
 | 
						||
		
 | 
						||
			valore = bill2ricl(t, gr, co, so, completo);
 | 
						||
		}
 | 
						||
		else
 | 
						||
		{
 | 
						||
			const int gr = rec.get_int("GRUPPO");
 | 
						||
			const int co = rec.get_int("CONTO");
 | 
						||
			const long so = rec.get_long("SOTTOCONTO");
 | 
						||
 | 
						||
			valore = bill2ricl(t, gr, co, so, completo);
 | 
						||
		}
 | 
						||
 | 
						||
	}
 | 
						||
	else if (code.starts_with("_TCONTO"))
 | 
						||
	{
 | 
						||
		const TRectype & mov = cur.curr(LF_MOV);
 | 
						||
		TToken_string key(mov.get(MOV_NUMREG));
 | 
						||
		key.add(1);
 | 
						||
		
 | 
						||
		const TRectype & rmov = cache().get(LF_RMOV,key);
 | 
						||
		const char t = rmov.get_char(RMV_TIPOC);
 | 
						||
		const int gr = rmov.get_int(RMV_GRUPPO);
 | 
						||
		const int co = rmov.get_int(RMV_CONTO);
 | 
						||
		const long so = rmov.get_long(RMV_SOTTOCONTO);
 | 
						||
 | 
						||
		valore = bill2ricl(t, gr, co, so, false);
 | 
						||
	}
 | 
						||
  else if (code == "_CFPI")
 | 
						||
  {
 | 
						||
		const TRectype & rmov = cur.curr(LF_RMOV);
 | 
						||
		const char sezione = s.get()[0];  	
 | 
						||
		const int fldcod = atoi(s.get());
 | 
						||
		const char sezriga = rmov.get_char(RMV_SEZIONE);		
 | 
						||
 | 
						||
		valore = "";
 | 
						||
		if (sezione == sezriga)
 | 
						||
		{
 | 
						||
			const TString & t = rmov.get(RMV_TIPOC);
 | 
						||
 | 
						||
			if (t.full())
 | 
						||
			{
 | 
						||
				TToken_string key(t);
 | 
						||
 | 
						||
				key.add(rmov.get_long(RMV_SOTTOCONTO));
 | 
						||
 | 
						||
				const TRectype & clifo = cache().get(LF_CLIFO, key);
 | 
						||
 | 
						||
				valore = clifo.get(CLI_COFI);
 | 
						||
				if (valore.blank())
 | 
						||
					valore = clifo.get(CLI_PAIV);
 | 
						||
			}
 | 
						||
		}
 | 
						||
		add_field(rec, fldcod, valore.len() == 16 ? "F" : (valore.len() == 0 ? "" : "P"));
 | 
						||
  }
 | 
						||
  else if (code == "_CFPIT")
 | 
						||
  {
 | 
						||
		const TRectype & mov = cur.curr(LF_MOV);
 | 
						||
		TToken_string key(mov.get(MOV_TIPO));
 | 
						||
		const int fldcod = atoi(s.get());
 | 
						||
		const int fldcodcf = atoi(s.get());
 | 
						||
 | 
						||
		key.add(mov.get_long(MOV_CODCF));
 | 
						||
		const TRectype & clifo = cache().get(LF_CLIFO, key);
 | 
						||
 | 
						||
		valore = clifo.get(CLI_COFI);
 | 
						||
		if (valore.blank())
 | 
						||
		{
 | 
						||
			valore = clifo.get(CLI_PAIV);
 | 
						||
			add_field(rec, fldcod, (valore.blank() ? "" : "P"));
 | 
						||
		}
 | 
						||
		else
 | 
						||
			add_field(rec, fldcod, "F");
 | 
						||
		if (!clifo.empty())
 | 
						||
		{
 | 
						||
			key.cut(0);
 | 
						||
			key.add(mov.get(MOV_NUMREG));
 | 
						||
			key.add(1);
 | 
						||
			const TRectype & rmov = cache().get(LF_RMOV,key);
 | 
						||
			const char t = rmov.get_char(RMV_TIPOC);
 | 
						||
			const int gr = rmov.get_int(RMV_GRUPPO);
 | 
						||
			const int co = rmov.get_int(RMV_CONTO);
 | 
						||
			const long so = rmov.get_long(RMV_SOTTOCONTO);
 | 
						||
 | 
						||
			const TString codcf = bill2ricl(t, gr, co, so, false);
 | 
						||
			add_field(rec, fldcodcf, codcf);
 | 
						||
		}
 | 
						||
	}
 | 
						||
  else NFCHECK("Macro non definita: %s", (const char *)code);
 | 
						||
  str = valore;
 | 
						||
}
 | 
						||
 | 
						||
void TInvio::i_zucchetti_testa()
 | 
						||
{
 | 
						||
	// cursore fittizio
 | 
						||
  TRelation rel(LF_CAUSALI);
 | 
						||
  TCursor cur(&rel);
 | 
						||
  _nrecords = 0;
 | 
						||
  _nfiles = 0;
 | 
						||
	if (_msk->get_bool(F_CAUSALI))
 | 
						||
	{
 | 
						||
		_nrecords += i_zucchetti_causali(FALSE)+2;
 | 
						||
		_nfiles++;
 | 
						||
	}	
 | 
						||
	if (_msk->get_bool(F_CLIFOR))
 | 
						||
	{
 | 
						||
		_nrecords += i_zucchetti_clifor(FALSE)+2;
 | 
						||
		_nfiles++;
 | 
						||
	}	
 | 
						||
	if (_msk->get_bool(F_CONTI))
 | 
						||
	{
 | 
						||
		_nrecords += i_zucchetti_conti(FALSE)+2;
 | 
						||
		_nfiles++;
 | 
						||
	}	
 | 
						||
	if (_msk->get_bool(F_MOVCONT))
 | 
						||
	{
 | 
						||
		_nrecsmocontab = i_zucchetti_movcont(FALSE);
 | 
						||
		if (_nrecsmocontab > 0)
 | 
						||
		{
 | 
						||
			_nrecords += _nrecsmocontab+2;
 | 
						||
			_nfiles++;
 | 
						||
		}	
 | 
						||
	}	
 | 
						||
	if (_msk->get_bool(F_MOVIVA))
 | 
						||
	{ 
 | 
						||
		_nrecsfattvend = i_zucchetti_moviva('V', FALSE);
 | 
						||
		if (_nrecsfattvend > 0)
 | 
						||
		{
 | 
						||
			_nrecords += _nrecsfattvend+2;
 | 
						||
			_nfiles++;
 | 
						||
		}	
 | 
						||
		_nrecscorr = i_zucchetti_moviva('C', FALSE);
 | 
						||
		if (_nrecscorr > 0)
 | 
						||
		{
 | 
						||
			_nrecords += _nrecscorr+2;
 | 
						||
			_nfiles++;
 | 
						||
		}	
 | 
						||
		_nrecsfattacqu = i_zucchetti_moviva('A', FALSE);
 | 
						||
		if (_nrecsfattacqu > 0)
 | 
						||
		{
 | 
						||
			_nrecords += _nrecsfattacqu+2;
 | 
						||
			_nfiles++;
 | 
						||
		}	
 | 
						||
	}	
 | 
						||
	TRecord_text rec;
 | 
						||
	rec.set_type("I");
 | 
						||
	_trasfile->autoload(rec, cur); 
 | 
						||
	_trasfile->write(rec);
 | 
						||
}
 | 
						||
 | 
						||
void TInvio::i_zucchetti_testa_dettaglio(const TString16& descr, const long nrecs)
 | 
						||
{
 | 
						||
	// cursore fittizio
 | 
						||
  TRelation rel(LF_CAUSALI);
 | 
						||
  TCursor cur(&rel);
 | 
						||
  _nrecsdettaglio = nrecs;
 | 
						||
  _descrdettaglio = descr;
 | 
						||
	TRecord_text rec;
 | 
						||
	rec.set_type("F");
 | 
						||
	_trasfile->autoload(rec, cur); 
 | 
						||
	_trasfile->write(rec);
 | 
						||
}
 | 
						||
 | 
						||
void TInvio::i_zucchetti_coda_dettaglio(const TString16& descr, const long nrecs)
 | 
						||
{
 | 
						||
	// cursore fittizio
 | 
						||
  TRelation rel(LF_CAUSALI);
 | 
						||
  TCursor cur(&rel);
 | 
						||
  _nrecsdettaglio = nrecs;
 | 
						||
  _descrdettaglio = descr;
 | 
						||
	TRecord_text rec;
 | 
						||
	rec.set_type("E");
 | 
						||
	_trasfile->autoload(rec, cur); 
 | 
						||
	_trasfile->write(rec);
 | 
						||
}
 | 
						||
 | 
						||
void TInvio::i_zucchetti_coda()
 | 
						||
{
 | 
						||
  TRelation rel(LF_CAUSALI);
 | 
						||
  TCursor cur(&rel);
 | 
						||
	TRecord_text rec;
 | 
						||
	rec.set_type("C");
 | 
						||
	_trasfile->autoload(rec, cur); 
 | 
						||
	_trasfile->write(rec);
 | 
						||
}
 | 
						||
 | 
						||
long TInvio::i_zucchetti_causali(const bool invio)
 | 
						||
{
 | 
						||
  TRelation rel(LF_CAUSALI);
 | 
						||
  TCursor cur(&rel);
 | 
						||
  const long cur_items = cur.items();
 | 
						||
  if (cur_items != 0 && invio) 
 | 
						||
  {
 | 
						||
		TProgind pi(cur_items, rel.file().description(), true, true);
 | 
						||
		i_zucchetti_testa_dettaglio("CAUSMOVM", cur_items);
 | 
						||
	  cur.freeze();
 | 
						||
    TRectype& cur_rec = cur.curr();
 | 
						||
    for (cur = 0; cur.pos() < cur_items; ++(cur))
 | 
						||
    {
 | 
						||
			if (!pi.addstatus(1))
 | 
						||
				break;
 | 
						||
			TRecord_text rec;
 | 
						||
			rec.set_type("21");
 | 
						||
			_trasfile->autoload(rec, cur); 
 | 
						||
			_trasfile->write(rec);
 | 
						||
    }	
 | 
						||
		i_zucchetti_coda_dettaglio("CAUSMOVM", cur_items);
 | 
						||
  }                  
 | 
						||
  return cur_items;
 | 
						||
}
 | 
						||
 | 
						||
long TInvio::i_zucchetti_conti(const bool invio)
 | 
						||
{
 | 
						||
  TRelation rel(LF_PCON);
 | 
						||
  TCursor cur(&rel);
 | 
						||
 | 
						||
	cur.setfilter("(CONTO>=0)&&(SOTTOCONTO>0)");
 | 
						||
  const long cur_items = cur.items();
 | 
						||
  if (cur_items != 0 && invio) 
 | 
						||
  {
 | 
						||
		TProgind pi(cur_items, rel.file().description(), true, true);
 | 
						||
		i_zucchetti_testa_dettaglio("DESCONTI", cur_items);
 | 
						||
	  cur.freeze();
 | 
						||
    TRectype& cur_rec = cur.curr();
 | 
						||
    for (cur = 0; cur.pos() < cur_items; ++(cur))
 | 
						||
    {
 | 
						||
			if (!pi.addstatus(1))
 | 
						||
				break;
 | 
						||
			TRecord_text rec;
 | 
						||
			rec.set_type("20");
 | 
						||
			_trasfile->autoload(rec, cur); 
 | 
						||
			_trasfile->write(rec);
 | 
						||
    }	
 | 
						||
		i_zucchetti_coda_dettaglio("DESCONTI", cur_items);
 | 
						||
  }                  
 | 
						||
  return cur_items;
 | 
						||
}
 | 
						||
 | 
						||
long TInvio::i_zucchetti_movcont(const bool invio)
 | 
						||
{
 | 
						||
  TRectype da(LF_MOV);
 | 
						||
  TRectype a(LF_MOV);
 | 
						||
  da.put(MOV_DATAREG, _dataini);
 | 
						||
  a.put(MOV_DATAREG, _datafin);
 | 
						||
  TRelation rel(LF_MOV);
 | 
						||
  rel.add(LF_RMOV, "NUMREG==NUMREG", 1);
 | 
						||
  TCursor cur(&rel, "23->PROTIVA == \"\"", 2, &da, &a);
 | 
						||
 | 
						||
  const long cur_items = cur.items();
 | 
						||
  long totrec = 0;
 | 
						||
  if (cur_items != 0) 
 | 
						||
  {
 | 
						||
		TProgind pi(cur_items, rel.file().description(), true, true);
 | 
						||
  	if (invio)
 | 
						||
			i_zucchetti_testa_dettaglio("MOCONTAB", _nrecsmocontab);
 | 
						||
	  cur.freeze();
 | 
						||
    TRectype& cur_rec = cur.curr();
 | 
						||
    for (cur = 0; cur.pos() < cur_items; ++(cur))
 | 
						||
    { 
 | 
						||
			if (!pi.addstatus(1))
 | 
						||
				break;
 | 
						||
			const long numreg = cur.curr().get_long(MOV_NUMREG);
 | 
						||
 			bool continua = TRUE;
 | 
						||
 			while (continua)
 | 
						||
 			{                                                   
 | 
						||
 				const long numregrig = cur.curr(LF_RMOV).get_long(RMV_NUMREG);
 | 
						||
 				if (numreg == numregrig)
 | 
						||
 				{      
 | 
						||
 					if (invio)
 | 
						||
 					{
 | 
						||
			    	TRectype& cur_rec_righe = cur.curr(LF_RMOV);
 | 
						||
						TRecord_text recrighe;
 | 
						||
						recrighe.set_type("50");
 | 
						||
						cur.save_status();
 | 
						||
						_finemov = !(cur.next_match(LF_RMOV, "NUMREG"));
 | 
						||
						cur.restore_status();
 | 
						||
						_trasfile->autoload(recrighe, cur); 
 | 
						||
						_trasfile->write(recrighe);
 | 
						||
					}
 | 
						||
					totrec++;	
 | 
						||
 				}
 | 
						||
		  	continua = cur.next_match(LF_RMOV, "NUMREG");
 | 
						||
 			}	
 | 
						||
    }	
 | 
						||
    if (invio)
 | 
						||
			i_zucchetti_coda_dettaglio("MOCONTAB", _nrecsmocontab);
 | 
						||
  }                  
 | 
						||
  return totrec;
 | 
						||
}
 | 
						||
 | 
						||
long TInvio::i_zucchetti_moviva(const char acqven, const bool invio)
 | 
						||
{
 | 
						||
  TRectype da(LF_MOV);
 | 
						||
  TRectype a(LF_MOV);
 | 
						||
  da.put(MOV_DATAREG, _dataini);
 | 
						||
  a.put(MOV_DATAREG, _datafin);
 | 
						||
  TRelation rel(LF_MOV);
 | 
						||
  rel.add(LF_RMOVIVA, "NUMREG==NUMREG", 1);
 | 
						||
  rel.add("REG", "CODTAB[1,4]==ANNOIVA|CODTAB[5,7]==REG", 1);
 | 
						||
  TString filtro = "(23->PROTIVA != \"\")&&";
 | 
						||
	const bool vend = acqven == 'V';
 | 
						||
	const bool corrisp = acqven == 'C';
 | 
						||
  if (vend)
 | 
						||
  	filtro << "(REG->I0==\"1\")&&(REG->B0!=\"X\")";
 | 
						||
  else 
 | 
						||
		if (corrisp)
 | 
						||
  		filtro << "(REG->I0 ==\"1\")&&(REG->B0==\"X\")";
 | 
						||
		else 
 | 
						||
  		filtro << "(REG->I0 == 2)";
 | 
						||
  TCursor cur(&rel, "", 2, &da, &a);
 | 
						||
  cur.setfilter(filtro, true);
 | 
						||
  const long cur_items = cur.items();
 | 
						||
  long totrec = 0;
 | 
						||
  if (cur_items != 0) 
 | 
						||
  {   
 | 
						||
		TProgind pi(cur_items, rel.file().description(), true, true);
 | 
						||
  	if (invio)
 | 
						||
		{
 | 
						||
			if (vend)
 | 
						||
				i_zucchetti_testa_dettaglio("FATTVEND", _nrecsfattvend);
 | 
						||
			else
 | 
						||
				if (corrisp)
 | 
						||
					i_zucchetti_testa_dettaglio("CORRNORM", _nrecscorr);
 | 
						||
				else
 | 
						||
					i_zucchetti_testa_dettaglio("FATTACQU", _nrecsfattacqu);
 | 
						||
		}
 | 
						||
	  cur.freeze();
 | 
						||
    TRectype& cur_rec = cur.curr();
 | 
						||
    for (cur = 0; cur.pos() < cur_items; ++(cur))
 | 
						||
    { 
 | 
						||
			if (!pi.addstatus(1))
 | 
						||
				break;
 | 
						||
			if (!corrisp)
 | 
						||
			{
 | 
						||
				if (invio)
 | 
						||
				{
 | 
						||
					TRecord_text rec;
 | 
						||
					rec.set_type("30");
 | 
						||
					_trasfile->autoload(rec, cur); 
 | 
						||
					_trasfile->write(rec);
 | 
						||
				}	
 | 
						||
				totrec++;
 | 
						||
			}
 | 
						||
			const long numreg = cur.curr().get_long(MOV_NUMREG);
 | 
						||
 			bool continua = TRUE;
 | 
						||
 			while (continua)
 | 
						||
 			{                                                   
 | 
						||
 				const long numregrig = cur.curr(LF_RMOVIVA).get_long(RMI_NUMREG);
 | 
						||
 				if (numreg == numregrig)
 | 
						||
 				{      
 | 
						||
 					if (invio)
 | 
						||
 					{
 | 
						||
			    	TRectype& cur_rec_righe = cur.curr(LF_RMOVIVA);
 | 
						||
						TRecord_text recrighe;
 | 
						||
						recrighe.set_type(corrisp ? "40" : "31");
 | 
						||
						cur.save_status();
 | 
						||
						_totale = !(cur.next_match(LF_RMOVIVA, "NUMREG"));
 | 
						||
						cur.restore_status();
 | 
						||
						_trasfile->autoload(recrighe, cur); 
 | 
						||
						_trasfile->write(recrighe);
 | 
						||
					}
 | 
						||
					totrec++;	
 | 
						||
 				}
 | 
						||
		  	continua = cur.next_match(LF_RMOVIVA, "NUMREG");
 | 
						||
 			}	
 | 
						||
    }	
 | 
						||
    if (invio)
 | 
						||
		{
 | 
						||
			if (vend)
 | 
						||
				i_zucchetti_coda_dettaglio("FATTVEND", _nrecsfattvend);
 | 
						||
			else
 | 
						||
				if (corrisp)
 | 
						||
					i_zucchetti_coda_dettaglio("CORRNORM", _nrecscorr);
 | 
						||
				else
 | 
						||
					i_zucchetti_coda_dettaglio("FATTACQU", _nrecsfattacqu);
 | 
						||
		}
 | 
						||
  }                  
 | 
						||
  return totrec;
 | 
						||
}
 | 
						||
 | 
						||
long TInvio::i_zucchetti_clifor(const bool invio)
 | 
						||
{
 | 
						||
  TRelation rel(LF_CLIFO);
 | 
						||
  TCursor cur(&rel);
 | 
						||
 | 
						||
	if (!ini_get_bool(CONFIG_DITTA, "tc", "ZUCLISOSP"))
 | 
						||
		cur.setfilter("SOSPESO!=\"X\"");
 | 
						||
 | 
						||
	const long cur_items = cur.items();
 | 
						||
  if (cur_items != 0 && invio) 
 | 
						||
  {
 | 
						||
		TProgind pi(cur_items, rel.file().description(), true, true);
 | 
						||
		i_zucchetti_testa_dettaglio("CLIEFORN", cur_items*2);
 | 
						||
	  cur.freeze();
 | 
						||
    TRectype& cur_rec = cur.curr();
 | 
						||
    for (cur = 0; cur.pos() < cur_items; ++(cur))
 | 
						||
    {
 | 
						||
			if (!pi.addstatus(1))
 | 
						||
				break;
 | 
						||
			TRecord_text rec;
 | 
						||
 | 
						||
			rec.set_type("10");
 | 
						||
			_trasfile->autoload(rec, cur); 
 | 
						||
			_trasfile->write(rec);
 | 
						||
 | 
						||
			rec.set_type("11");
 | 
						||
			_trasfile->autoload(rec, cur); 
 | 
						||
			_trasfile->write(rec);
 | 
						||
    }	
 | 
						||
		i_zucchetti_coda_dettaglio("CLIEFORN", cur_items*2);
 | 
						||
  }                  
 | 
						||
  return cur_items+cur_items;
 | 
						||
}
 | 
						||
 | 
						||
//metodone globale che chiama, come un menu, i vari sottometodi in base alle scelte sulla maschera
 | 
						||
void TInvio::invio_zucchetti()
 | 
						||
{
 | 
						||
	//prepara il file su cui scrivere, ovvero il _trasfile
 | 
						||
	TFilename filename = _msk->get(F_PATH);
 | 
						||
	
 | 
						||
	filename.add(_msk->get(F_FILE));
 | 
						||
	if (filename.exist())
 | 
						||
		remove(filename);
 | 
						||
	_trasfile = new TInvio_file(filename);
 | 
						||
	_trasfile->open(filename,'w');
 | 
						||
  _log = new TLog_report("Trasferimento Zucchetti");
 | 
						||
  _log->kill_duplicates();
 | 
						||
 | 
						||
	_trcau = ini_get_bool(CONFIG_DITTA, "tc", "ZUTRCAU");
 | 
						||
	_triva = ini_get_bool(CONFIG_DITTA, "tc", "ZUTRIVA");
 | 
						||
	_trcon = ini_get_bool(CONFIG_DITTA, "tc", "ZUTRCON");
 | 
						||
	_trban = ini_get_bool(CONFIG_DITTA, "tc", "ZUTRBAN");
 | 
						||
 | 
						||
	i_zucchetti_testa();
 | 
						||
 | 
						||
	if (_msk->get_bool(F_CAUSALI))
 | 
						||
		i_zucchetti_causali();
 | 
						||
	if (_msk->get_bool(F_CLIFOR))
 | 
						||
		i_zucchetti_clifor();
 | 
						||
	if (_msk->get_bool(F_CONTI))
 | 
						||
		i_zucchetti_conti();
 | 
						||
	if (_msk->get_bool(F_MOVCONT))
 | 
						||
		i_zucchetti_movcont();
 | 
						||
	if (_msk->get_bool(F_MOVIVA))
 | 
						||
	{
 | 
						||
		i_zucchetti_moviva('V');
 | 
						||
		i_zucchetti_moviva('C');
 | 
						||
		i_zucchetti_moviva('A');
 | 
						||
	}	
 | 
						||
	i_zucchetti_coda();
 | 
						||
    
 | 
						||
	TReport_book book;
 | 
						||
 | 
						||
  book.add(*_log);
 | 
						||
  book.preview();
 | 
						||
 | 
						||
	_trasfile->close();
 | 
						||
	delete _trasfile;
 | 
						||
	_trasfile = NULL;
 | 
						||
	delete _log;
 | 
						||
	_log = NULL;
 | 
						||
	if (yesno_box("Confermi il trasferimento"))
 | 
						||
	{
 | 
						||
		const TDate from(_msk->get_date(F_DATAINI));
 | 
						||
		const TDate to(_msk->get_date(F_DATAFIN));
 | 
						||
		TString query = "USE MOV KEY 2 SELECT INVIATO!=\"X\"";           
 | 
						||
 | 
						||
		query << "\nFROM DATAREG=#DATA_DA";      
 | 
						||
		query << "\nTO DATAREG=#DATA_AL";      
 | 
						||
 | 
						||
		TISAM_recordset mov(query);
 | 
						||
		
 | 
						||
		mov.set_var("#DATA_DA", TVariant(from));
 | 
						||
		mov.set_var("#DATA_AL", TVariant(to));
 | 
						||
 | 
						||
    if (mov.items() > 0L)
 | 
						||
		{
 | 
						||
			TProgind pi(mov.items(), TR("Conferma trasferimento"), true, true);
 | 
						||
			TLocalisamfile cgmov(LF_MOV);
 | 
						||
		
 | 
						||
			for (bool ok = mov.move_first(); ok; ok = mov.move_next())
 | 
						||
			{
 | 
						||
				if (!pi.addstatus(1))
 | 
						||
					break;
 | 
						||
				const long numreg = mov.get(MOV_NUMREG).as_int();
 | 
						||
 | 
						||
				cgmov.put(MOV_NUMREG, numreg);
 | 
						||
				if (cgmov.read(_isequal, _lock) == NOERR)
 | 
						||
				{
 | 
						||
					cgmov.put(MOV_INVIATO, "X");
 | 
						||
					cgmov.rewrite();
 | 
						||
				}
 | 
						||
			}
 | 
						||
		}
 | 
						||
		ini_set_int(CONFIG_DITTA, "tc", "ZUNUMEROINVIO", _msk->get_int(F_NUMEROINVIO));
 | 
						||
		ini_set_string(CONFIG_DITTA, "tc", "ZUULTINV", to);
 | 
						||
	}
 | 
						||
}
 | 
						||
 | 
						||
bool TInvio::create()
 | 
						||
{
 | 
						||
	_tabelle = new TRiclassifica_cache;
 | 
						||
  _msk = new TInvio_mask();
 | 
						||
  _trasfile = NULL;
 | 
						||
	_conti = new TRecord_cache(LF_RICLPDC, 1);
 | 
						||
  return TSkeleton_application::create();
 | 
						||
}
 | 
						||
 | 
						||
bool TInvio::destroy()
 | 
						||
{ 
 | 
						||
	if (_trasfile)  
 | 
						||
  	delete _trasfile;
 | 
						||
  delete _msk;
 | 
						||
	delete _conti;
 | 
						||
	delete _tabelle;
 | 
						||
  return TSkeleton_application::destroy();
 | 
						||
}
 | 
						||
 | 
						||
void TInvio::main_loop()
 | 
						||
{
 | 
						||
	_msk->set(F_NUMEROINVIO, ini_get_int(CONFIG_DITTA, "tc", "ZUNUMEROINVIO") + 1);
 | 
						||
	
 | 
						||
	TDate data(ini_get_string(CONFIG_DITTA, "tc", "ZUULTINV"));
 | 
						||
 | 
						||
	++data;
 | 
						||
	_msk->set(F_DATAINI, data);
 | 
						||
	data.addmonth();
 | 
						||
	--data;
 | 
						||
	_msk->set(F_DATAFIN, data);
 | 
						||
	_msk->set(F_PATH, ini_get_string(CONFIG_DITTA, "tc", "ZUPATH"));
 | 
						||
	_msk->set(F_FILE, ini_get_string(CONFIG_DITTA, "tc", "ZUFILE", "im000000"));
 | 
						||
	_msk->set(F_CAUSALI, ini_get_string(CONFIG_DITTA, "tc", "ZUCAUSALI"));
 | 
						||
	_msk->set(F_CONTI, ini_get_string(CONFIG_DITTA, "tc", "ZUCONTI"));
 | 
						||
	_msk->set(F_CLIFOR, ini_get_string(CONFIG_DITTA, "tc", "ZUCLIFOR"));
 | 
						||
	_msk->set(F_MOVCONT, ini_get_string(CONFIG_DITTA, "tc", "ZUMOVCONT"));
 | 
						||
	_msk->set(F_MOVIVA, ini_get_string(CONFIG_DITTA, "tc", "ZUMOVIVA"));
 | 
						||
	_msk->set(F_CORRISP, ini_get_string(CONFIG_DITTA, "tc", "ZUCORRISP"));
 | 
						||
	_msk->set(F_SALDACONTO, ini_get_string(CONFIG_DITTA, "tc", "ZUSALDACONTO"));
 | 
						||
 | 
						||
  while (_msk->run() != K_QUIT)
 | 
						||
  {                                  
 | 
						||
  	_totale = false;
 | 
						||
  	_finemov = false;
 | 
						||
		ini_set_string(CONFIG_DITTA, "tc", "ZUPATH", _msk->get(F_PATH));
 | 
						||
		ini_set_string(CONFIG_DITTA, "tc", "ZUFILE", _msk->get(F_FILE));
 | 
						||
	  ini_set_string(CONFIG_DITTA, "tc", "ZUCAUSALI", _msk->get(F_CAUSALI));
 | 
						||
	  ini_set_string(CONFIG_DITTA, "tc", "ZUCONTI", _msk->get(F_CONTI));
 | 
						||
		ini_set_string(CONFIG_DITTA, "tc", "ZUCLIFOR",_msk->get(F_CLIFOR));
 | 
						||
		ini_set_string(CONFIG_DITTA, "tc", "ZUMOVCONT", _msk->get(F_MOVCONT));
 | 
						||
		ini_set_string(CONFIG_DITTA, "tc", "ZUMOVIVA", _msk->get(F_MOVIVA));
 | 
						||
		ini_set_string(CONFIG_DITTA, "tc", "ZUCORRISP", _msk->get(F_CORRISP));
 | 
						||
		ini_set_string(CONFIG_DITTA, "tc", "ZUSALDACONTO", _msk->get(F_SALDACONTO));
 | 
						||
		_dataini = _msk->get_date(F_DATAINI);
 | 
						||
		_datafin = _msk->get_date(F_DATAFIN);
 | 
						||
		invio_zucchetti();
 | 
						||
	}	
 | 
						||
}
 | 
						||
 | 
						||
int tc1100(int argc, char **argv) 
 | 
						||
{
 | 
						||
  TInvio a;
 | 
						||
  a.run(argc, argv, "Invio dati contabilit<69> Zucchetti");
 | 
						||
  return 0;
 | 
						||
}
 | 
						||
 |