f8426f5944
Files correlati : tp0.exe Ricompilazione Demo : [ ] Commento : Corretto trasferimento IBAN git-svn-id: svn://10.65.10.50/branches/R_10_00@22445 c028cbd2-c16b-5b4b-a496-9718f37d4682
256 lines
7.2 KiB
C++
Executable File
256 lines
7.2 KiB
C++
Executable File
#ifndef __TP0100_H
|
|
#define __TP0100_H
|
|
|
|
#ifndef __CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#ifndef __DICTION_H
|
|
#include <diction.h>
|
|
#endif
|
|
|
|
#ifndef __ISAM_H
|
|
#include <isam.h>
|
|
#endif
|
|
|
|
#ifndef __ODBCRECSET_H
|
|
#include <odbcrset.h>
|
|
#endif
|
|
|
|
#ifndef __PROGIND_H
|
|
class TProgind;
|
|
#endif
|
|
|
|
#ifndef __MODAUT_H
|
|
#include <modaut.h>
|
|
#endif
|
|
|
|
#ifndef __CLIFOR_H
|
|
#include "../ve/clifor.h"
|
|
#endif
|
|
|
|
#include "../ve/velib.h"
|
|
|
|
class TPack_log;
|
|
class TCache_tp;
|
|
|
|
class TPack_transfer : public TObject
|
|
{
|
|
TString _query_header;
|
|
TPack_log* _log;
|
|
TConfig _config;
|
|
|
|
TRecordset* _recset;
|
|
bool _write_enabled;
|
|
TODBC_recordset* _outset;
|
|
TCache_tp* _tab;
|
|
|
|
protected:
|
|
const TString& build_insert_query(const char* table, const char* f, const char* v) const;
|
|
|
|
TRecordset& create_recordset(const char* query);
|
|
long odbc_exec(const char* command);
|
|
|
|
const TString& decode_value(const char* tab, const TString& field_value);
|
|
const TString& decode_field(const char* tab, const char* recset_field);
|
|
|
|
TPack_transfer();
|
|
virtual bool trasferisci() pure;
|
|
|
|
public:
|
|
void init(const char* rh, const char* qh, TPack_log& log);
|
|
const TString& title() const;
|
|
TConfig& config() { return _config; }
|
|
const TString& query_header() const { return _query_header; }
|
|
|
|
void log(const char* msg, int sev = 0) const;
|
|
bool log_error(const char* msg);
|
|
bool log_cancelled();
|
|
const TRecordset& recordset() const;
|
|
TRecordset& recordset();
|
|
|
|
const TString& get_str(const char* campo) const; // Get string from current recordset
|
|
const TString& get_real_str(const char* campo) const; // Get eventually empty string from numeric field
|
|
long get_long(const char* campo) const;
|
|
|
|
bool write_enabled() const { return _write_enabled; }
|
|
|
|
bool test_write(TBaseisamfile& file, bool re = false);
|
|
bool test_rewrite(TBaseisamfile& file) { return test_write(file, true); }
|
|
|
|
virtual ~TPack_transfer();
|
|
};
|
|
|
|
// Classe candidata alla libreria
|
|
class TPack_iterator
|
|
{
|
|
TPack_transfer* _pt;
|
|
TProgind* _pi;
|
|
TRecnotype _rec;
|
|
|
|
public:
|
|
bool ok() const;
|
|
bool cancelled() const;
|
|
TPack_iterator& operator=(TRecnotype n);
|
|
TPack_iterator& operator++();
|
|
operator int() const { return ok(); }
|
|
|
|
TPack_iterator(TPack_transfer* pt);
|
|
~TPack_iterator();
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Cache generica per il trasferimento DDT di Pack
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TCache_tp : public TCache
|
|
{
|
|
TPack_transfer* _pt;
|
|
|
|
protected:
|
|
void log(const char* msg, int sev) const { _pt->log(msg, sev); }
|
|
bool test_write(TLocalisamfile& file) const { return _pt->test_write(file); }
|
|
bool test_rewrite(TLocalisamfile& file) const { return _pt->test_rewrite(file); }
|
|
const TRecordset& recordset() const { return _pt->recordset(); }
|
|
TConfig& config() const { return _pt->config(); }
|
|
const TString& query_header() const { return _pt->query_header(); }
|
|
|
|
public:
|
|
const TString& get_str(const char* campo) const { return _pt->get_str(campo); }
|
|
const TString& get_real_str(const char* campo) const { return _pt->get_real_str(campo); }
|
|
long get_long(const char* campo) const { return _pt->get_long(campo); }
|
|
virtual const TString& decode(const TToken_string& tokens) pure;
|
|
|
|
TCache_tp(TPack_transfer* pt) : _pt(pt) {}
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Trasferimenti veri e propri
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TPack_conti : public TPack_transfer
|
|
{
|
|
public:
|
|
virtual bool trasferisci();
|
|
};
|
|
|
|
class TPack_pag : public TPack_transfer
|
|
{
|
|
public:
|
|
virtual bool trasferisci();
|
|
};
|
|
|
|
class TPack_clifo : public TPack_transfer
|
|
{
|
|
TCache_tp* _agenti;
|
|
TCache_tp* _banche;
|
|
bool _only_agenti;
|
|
|
|
protected:
|
|
int cancella_clifo(TBaseisamfile& clifo) const;
|
|
long get_next_key(const char tipocf) const;
|
|
void update_statusflag_codcontab(const TString& custsuppcode, const int statusflag, const TString& codcontab);
|
|
bool aggiorna_record(TBaseisamfile& file, const TString_array& lista_campi);
|
|
void aggiorna_banca();
|
|
void trasferisci_conai(TRectype& rec);
|
|
const TString& decode_agente(const long codforn);
|
|
const TString& get_agente();
|
|
|
|
public:
|
|
virtual bool trasferisci();
|
|
TPack_clifo(bool only_agenti);
|
|
~TPack_clifo();
|
|
};
|
|
|
|
class TPack_indsped : public TPack_clifo
|
|
{
|
|
protected:
|
|
bool get_clifo(char& tipocf, long& codcf);
|
|
int get_next_key(const char tipocf, const long codcf) const;
|
|
|
|
public:
|
|
virtual bool trasferisci();
|
|
TPack_indsped():TPack_clifo(false) {}
|
|
};
|
|
|
|
class TCache_art;
|
|
class TCache_umart;
|
|
class TDocumento;
|
|
|
|
//////////////////////////////////////////////////////////
|
|
// Cache articoli
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TArticolo_pack : public TRectype
|
|
{
|
|
TString _cust_code, _paper_comp;
|
|
|
|
TString4 _conai_scat[CONAI_CLASSES];
|
|
real _conai_peso[CONAI_CLASSES];
|
|
|
|
public:
|
|
void set_customer_code(const TString& cc) { _cust_code = cc; }
|
|
const TString& customer_code() const { return _cust_code; }
|
|
|
|
void set_paper_composition(const TString& pc) { _paper_comp = pc; }
|
|
const TString& paper_composition() const { return _paper_comp; }
|
|
|
|
const TString& conai_subclass(TCONAI_class cc) const { CHECK_CONAI(cc); return _conai_scat[cc]; }
|
|
const real& conai_weight(TCONAI_class cc) const { CHECK_CONAI(cc); return _conai_peso[cc]; }
|
|
bool set_conai(TCONAI_class cc, const TString& scat, const real& weight);
|
|
|
|
TArticolo_pack(const TRectype& anamag);
|
|
TArticolo_pack();
|
|
};
|
|
|
|
class TPack_ddt : public TPack_transfer
|
|
{
|
|
TCache_art* _art;
|
|
TCache_umart* _umart;
|
|
bool _cust_ref, _paper_info, _paper_size, _ref_info, _cust_code;
|
|
bool _cms_ref, _order_paper_info, _extended_discount, _order_date;
|
|
TString _rif, _ord;
|
|
TDate _data_limite;
|
|
TAssoc_array _iva; // Codici IVA PACK
|
|
TCli_for _cli;
|
|
|
|
protected:
|
|
bool signal_row_error(const char* msg);
|
|
|
|
bool get_tipodoc(TString& codnum, TString& tipodoc);
|
|
bool get_um_qta(TString& um, real& qta);
|
|
bool get_clifo(char& tipocf, long& codcf);
|
|
const TString& get_indsped() const;
|
|
const TArticolo_pack& get_articolo(TString& um, real& qta, TString& custcode);
|
|
const TString& get_codice_iva(const TDate & datadoc);
|
|
const TString& get_customer_reference() const;
|
|
bool get_paper_from_order(TString& desc) const;
|
|
const TString& get_iban(const TRectype& clifo) const;
|
|
const TString & custrif() { return _rif; }
|
|
const TString & ordrif() { return _ord; }
|
|
bool order_date() { return _order_date; }
|
|
|
|
bool save_doc(TDocumento* &doc, const int doc_code);
|
|
|
|
public:
|
|
virtual bool trasferisci();
|
|
|
|
void activate_custref(bool on) { _cust_ref = on; }
|
|
void activate_paper_info(bool on) { _paper_info = on; }
|
|
void activate_paper_size(bool on) { _paper_size = on; }
|
|
void activate_ref_info(bool on) { _ref_info = on; }
|
|
void activate_cmsref(bool on) { _cms_ref = on; }
|
|
void set_data_limite(const TDate& data) { _data_limite = data; }
|
|
void activate_customer_code(bool on);
|
|
void activate_order_paper_info(bool on) { _order_paper_info = on; }
|
|
void activate_extended_discount(bool on) { _extended_discount = on; }
|
|
void set_custrif(const char * s) { _rif = s && *s ? s : "Vs. rifer.: "; }
|
|
void set_ordrif(const char * s) { _ord = s && *s ? s : "Ns. Ordine nr. "; }
|
|
void activate_order_date(bool on) { _order_date = on; }
|
|
|
|
TPack_ddt();
|
|
~TPack_ddt();
|
|
};
|
|
|
|
#endif
|