Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 855 git-svn-id: svn://10.65.10.50/trunk@15071 c028cbd2-c16b-5b4b-a496-9718f37d4682
135 lines
4.6 KiB
C++
Executable File
135 lines
4.6 KiB
C++
Executable File
#include <applicat.h>
|
|
#include <recarray.h>
|
|
#include <relation.h>
|
|
#include <reputils.h>
|
|
#include <textset.h>
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// 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) { _multirel.setkey(2);}
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TTS_textset
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TTS_textset : public TAS400_recordset
|
|
{
|
|
TAssoc_array _contatori;
|
|
|
|
protected:
|
|
long add_count(const char* tipo, long n = 1);
|
|
|
|
protected:
|
|
void add_field(const char* trc, const char* name = "Filler", int len = 0, char tipo = 'a',
|
|
int from = -1, const char* def = NULL);
|
|
|
|
public:
|
|
virtual bool destroy(TRecnotype r);
|
|
virtual const TString& rec_type(TRecnotype r = -1) const;
|
|
virtual bool set(const char* field, const TVariant& v);
|
|
|
|
TTS_textset(const char* query = "");
|
|
};
|
|
|
|
class TIVA_item : public TObject
|
|
{
|
|
int _row;
|
|
long _conto;
|
|
long _codiva;
|
|
long _codiva11;
|
|
real _imponibile;
|
|
real _imposta;
|
|
public:
|
|
int & row() { return _row;}
|
|
long & conto() { return _conto;}
|
|
long & codiva() { return _codiva;}
|
|
long & codiva11() { return _codiva11;}
|
|
real & imponibile() { return _imponibile;}
|
|
real & imposta() { return _imposta;}
|
|
TIVA_item(int row, long conto, long codiva, long codiva11) : _row(row), _conto(conto), _codiva(codiva), _codiva11(codiva11) {}
|
|
virtual ~TIVA_item() {}
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TTS_sender
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TTS_sender : public TSkeleton_application
|
|
{
|
|
TRiclassifica_cache* _tabelle;
|
|
TRecord_cache* _conti;
|
|
TAssoc_array _riclassifica;
|
|
TTS_textset* _tsfile;
|
|
TLog_report* _log;
|
|
bool _errors_logged;
|
|
TString8 _dittamulti;
|
|
TDate _from;
|
|
TArray _recsets;
|
|
TAssoc_array _iva;
|
|
TAssoc_array _contiiva;
|
|
TAssoc_array _contirit;
|
|
|
|
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;}
|
|
bool new_rec(const char* t) { CHECK(t && *t, "Tipo non valido"); return _tsfile->new_rec(t) >= 0; }
|
|
void remove_last();
|
|
void set(const char* field, const TVariant& var);
|
|
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);
|
|
void add_mov(const TRecordset& mov);
|
|
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);
|
|
void add_ulteriori(const TRecordset& mov);
|
|
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);
|
|
const long bill2ricl(char & t, int gr, int co, long so, const bool header_cli = false);
|
|
|
|
virtual TRecordset & movrecset(const TMask & m);
|
|
virtual TRecordset & rmovrecset(const TRecordset & mov);
|
|
virtual TRecordset & rivarecset(const TRecordset & mov);
|
|
virtual const TRecordset & clirecset(const char tipocf, const long codcf);
|
|
virtual void get_citta_provincia(const TRecordset& cli, TString & dencom, TString & provcom, bool nascita = false);
|
|
virtual const char * decode_causale(const TRecordset& mov);
|
|
virtual bool test_swap(const TRecordset& mov);
|
|
virtual bool swap_ritsoc(const TRecordset& mov);
|
|
virtual TMask * get_mask();
|
|
|
|
public:
|
|
void log(int sev, const char* msg);
|
|
|
|
TString & dittamulti() { return _dittamulti;}
|
|
TAssoc_array & riclassifica() {return _riclassifica;}
|
|
|
|
virtual void update_parameters(const TMask & m, TRecordset & mov);
|
|
virtual void set_parameters();
|
|
virtual bool create();
|
|
virtual void main_loop();
|
|
virtual bool destroy();
|
|
TTS_sender() : _tabelle(NULL), _conti(NULL), _tsfile(NULL), _log(NULL) {}
|
|
};
|