2007-03-16 13:33:09 +00:00
|
|
|
#include <applicat.h>
|
|
|
|
#include <recarray.h>
|
|
|
|
#include <relation.h>
|
|
|
|
#include <reputils.h>
|
|
|
|
#include <textset.h>
|
|
|
|
|
2010-01-06 18:42:26 +00:00
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// TRiclassifica_cache
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class TTSRiclassifica_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);
|
|
|
|
TTSRiclassifica_cache() : _multirel(LF_MULTIREL) { _multirel.setkey(2);}
|
|
|
|
};
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// TTS_sender
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
const long TSbill2ricl(char & t, int gr, int co, long so);
|
|
|
|
|
2007-03-16 13:33:09 +00:00
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// TTS_sender
|
|
|
|
///////////////////////////////////////////////////////////
|
2007-03-30 13:51:17 +00:00
|
|
|
class TTS_textset;
|
2007-03-16 13:33:09 +00:00
|
|
|
|
|
|
|
class TTS_sender : public TSkeleton_application
|
|
|
|
{
|
2010-01-06 18:42:26 +00:00
|
|
|
TTSRiclassifica_cache* _tabelle;
|
2007-03-16 13:33:09 +00:00
|
|
|
TAssoc_array _riclassifica;
|
|
|
|
TTS_textset* _tsfile;
|
|
|
|
TLog_report* _log;
|
2014-10-27 08:28:19 +00:00
|
|
|
long _numreg;
|
2007-03-16 13:33:09 +00:00
|
|
|
bool _errors_logged;
|
|
|
|
TString8 _dittamulti;
|
2008-03-11 15:50:42 +00:00
|
|
|
TAssoc_array _dittemulti;
|
|
|
|
long _empty_caus;
|
2007-03-16 13:33:09 +00:00
|
|
|
TArray _recsets;
|
|
|
|
TAssoc_array _iva;
|
|
|
|
TAssoc_array _contiiva;
|
|
|
|
TAssoc_array _contirit;
|
2008-03-11 15:50:42 +00:00
|
|
|
bool _professionista;
|
2008-03-17 23:19:14 +00:00
|
|
|
bool _ventilazione;
|
2008-03-11 15:50:42 +00:00
|
|
|
real _rit_acc;
|
2007-03-16 13:33:09 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
TRecordset * get_recset(const int logicnum) const { return (TRecordset *) _recsets.objptr(logicnum);}
|
|
|
|
TRecordset * set_recset(const int logicnum, TRecordset * r) { _recsets.add(r, logicnum); return r;}
|
|
|
|
TArray & recsets() { return _recsets;}
|
2010-02-16 00:01:16 +00:00
|
|
|
const TString & descr2agg(const char* d);
|
2007-03-30 13:51:17 +00:00
|
|
|
bool new_rec(const char* t);
|
2007-03-16 13:33:09 +00:00
|
|
|
void remove_last();
|
|
|
|
void set(const char* field, const TVariant& var);
|
2009-02-14 17:13:09 +00:00
|
|
|
void set(const char* field, const TString & str) { set(field, TVariant(str)); }
|
2007-03-16 13:33:09 +00:00
|
|
|
void set(const char* field, const int n) { set(field, TVariant((long)n)); }
|
|
|
|
void set(const char* field, const char* s) { set(field, TVariant(s)); }
|
|
|
|
void set(const char* field, const TDate& d) { set(field, TVariant(d)); }
|
|
|
|
void set(const char* field, const real& v) { set(field, TVariant(v)); }
|
|
|
|
|
|
|
|
const TVariant& get(const char* field);
|
2007-09-17 15:33:04 +00:00
|
|
|
void add_mov(TRecordset& mov);
|
2007-03-16 13:33:09 +00:00
|
|
|
void add_clifor(char tipocf, long codcf);
|
|
|
|
void add_header(const TRecordset& mov, const bool fullhead = true);
|
|
|
|
void add_datiiva(const TRecordset& mov);
|
|
|
|
void add_tot_fattura(const TRecordset& mov);
|
|
|
|
void add_conti_ricavo_costo(const TRecordset& mov);
|
|
|
|
void add_new_rec(const TRecordset& mov);
|
|
|
|
void add_diversi(const TRecordset& mov, const bool moviva);
|
|
|
|
void add_ratei_risconti(const TRecordset& mov);
|
2007-09-17 15:33:04 +00:00
|
|
|
void add_ulteriori(TRecordset& mov);
|
|
|
|
bool add_regol(TRecordset& mov, bool rec_to_add);
|
2008-03-11 15:50:42 +00:00
|
|
|
bool add_optional_rec(TRecordset& mov, bool rec_to_add);
|
2007-03-16 13:33:09 +00:00
|
|
|
const TString & scod2ricl(const char* tab, const TString& cod);
|
|
|
|
const TString & scod2ricl(const char* tab, const TVariant& cod);
|
|
|
|
const long cod2ricl(const char* tab, const TString& cod);
|
|
|
|
const long cod2ricl(const char* tab, const TVariant& cod);
|
2010-01-06 18:42:26 +00:00
|
|
|
const long bill2ricl(char & t, int gr, int co, long so, const bool header_cli = true);
|
|
|
|
|
2007-03-16 13:33:09 +00:00
|
|
|
virtual void get_citta_provincia(const TRecordset& cli, TString & dencom, TString & provcom, bool nascita = false);
|
2007-03-30 13:51:17 +00:00
|
|
|
virtual const char * decode_causale(const TRecordset& mov) { return EMPTY_STRING; }
|
|
|
|
virtual bool test_swap(const TRecordset& mov) { return false;}
|
|
|
|
virtual bool swap_ritsoc(const TRecordset& mov) { return false;}
|
|
|
|
virtual bool mov_regolarizzazione(const TRecordset& mov) { return false;}
|
|
|
|
virtual bool mov_intra(const TRecordset& mov) { return false;}
|
|
|
|
virtual bool mov_reverse_charge(const TRecordset& mov) { return false;}
|
2007-09-17 15:33:04 +00:00
|
|
|
virtual long iva11_reverse(const TRecordset & mov) { return 0L;}
|
2007-03-30 13:51:17 +00:00
|
|
|
bool add_iva_to_mov(const TRecordset& mov) { return mov_intra(mov) || mov_reverse_charge(mov);}
|
|
|
|
|
|
|
|
protected:
|
2014-10-27 08:28:19 +00:00
|
|
|
virtual bool find_regolarizzazione(TRecordset& mov) { return false; }
|
2007-03-30 13:51:17 +00:00
|
|
|
virtual TRecordset & movrecset() pure;
|
|
|
|
virtual TRecordset & rmovrecset(const TRecordset & mov) pure;
|
|
|
|
virtual TRecordset & rivarecset(const TRecordset & mov) pure;
|
|
|
|
virtual const TRecordset & clirecset(const char tipocf, const long codcf) pure;
|
2009-04-17 08:08:23 +00:00
|
|
|
virtual bool regime_agricolo(const TRecordset& mov) const { return false; }
|
2007-03-30 13:51:17 +00:00
|
|
|
virtual TMask & get_mask() pure ;
|
2007-03-16 13:33:09 +00:00
|
|
|
|
|
|
|
public:
|
2014-10-27 08:28:19 +00:00
|
|
|
void set_log_numreg(long n) { _numreg = n; }
|
2007-03-16 13:33:09 +00:00
|
|
|
void log(int sev, const char* msg);
|
2008-03-11 15:50:42 +00:00
|
|
|
virtual bool multi_activity() const { return true; }
|
2009-02-14 17:13:09 +00:00
|
|
|
virtual const TString & dittamulti(const TRecordset& mov) const ;
|
2007-03-16 13:33:09 +00:00
|
|
|
TAssoc_array & riclassifica() {return _riclassifica;}
|
|
|
|
|
2007-03-30 13:51:17 +00:00
|
|
|
virtual void postprocess_movs(TRecordset & mov) {}
|
2007-03-16 13:33:09 +00:00
|
|
|
virtual void set_parameters();
|
|
|
|
virtual bool create();
|
|
|
|
virtual void main_loop();
|
|
|
|
virtual bool destroy();
|
2010-01-06 18:42:26 +00:00
|
|
|
TTS_sender() : _tabelle(NULL), _tsfile(NULL), _log(NULL) {}
|
2007-03-16 13:33:09 +00:00
|
|
|
};
|