139 lines
3.8 KiB
C++
139 lines
3.8 KiB
C++
#ifndef _F1LIB_H_
|
|
#define _F1LIB_H_
|
|
|
|
#include "strings.h"
|
|
#include "reputils.h"
|
|
#include "tsdb.h"
|
|
|
|
#define FILE_CONFIG CONFIG_DITTA
|
|
#define FILE_SECTION "f1"
|
|
#define F1_INIREGCONT "cg2_"
|
|
#define F1_CAUS "caus"
|
|
#define LOG_MSG 0
|
|
#define LOG_WARN 1
|
|
#define LOG_ERR 2
|
|
|
|
enum err_cont
|
|
{
|
|
no_codcaus = -1,
|
|
no_selected = -2,
|
|
is_already_cont = -3,
|
|
cancel = -4,
|
|
forn_err = -5, // Manca un codice fornitore
|
|
is_ready = 0,
|
|
no_err_c = 1
|
|
};
|
|
|
|
typedef struct _prot_s
|
|
{
|
|
const char* tipo;
|
|
const char* num;
|
|
int anno;
|
|
} prot_s;
|
|
|
|
|
|
/** \class TFppro
|
|
* Tutti i metodi che settano le chiavi, possono fallire principalmente per due motivi:
|
|
* 1) Possibile SQL Injection;
|
|
* 2) Chiavi settate non valide (una delle tre e' vuota).
|
|
*/
|
|
class TFppro : public TObject
|
|
{
|
|
TToken_string _keys;
|
|
SSimple_query* _db;
|
|
bool _keys_setted;
|
|
bool _is_set; // Query is setted
|
|
TString _fppro_query;
|
|
TString _last_error;
|
|
|
|
bool sql_inj(TToken_string& keys);
|
|
public:
|
|
const char* where_str();
|
|
|
|
bool check_reg(TToken_string& keys, int numreg);
|
|
// Se un mov. registrato non e' collegato all'FPPRO cerco di capire qual'e`
|
|
bool guess_the_doc(const TLocalisamfile& mov);
|
|
// Getters
|
|
const char* get_keys_fppro();
|
|
long get_numreg();
|
|
long get_numreg(TToken_string& keys);
|
|
long get_codforn();
|
|
TDate get_datareg();
|
|
TDate get_datadoc();
|
|
TDate get_datareg(TToken_string& keys);
|
|
real get_ritenute();
|
|
TDate get_data_first_doc() const;
|
|
TDate get_dataorarioric();
|
|
long get_numregcont();
|
|
|
|
|
|
TString get_last_error(bool clear = true);
|
|
// Setters
|
|
bool set_query();
|
|
TFppro& set_keys(TToken_string& keys);
|
|
|
|
bool associa_mov(long numreg);
|
|
const TString & get_tipoprot();
|
|
const TString & get_numprot();
|
|
const TString & get_annoprot();
|
|
const TString & get_dataoraric();
|
|
const TString & get_tipodoc();
|
|
const TString & get_numdoc();
|
|
TDate get_data_doc();
|
|
|
|
TFppro();
|
|
TFppro(TToken_string& keys) : TFppro() { set_keys(keys); }
|
|
};
|
|
|
|
class TProtocollo : TObject
|
|
{
|
|
TString _tipoprot;
|
|
TString _progres;
|
|
int _year{};
|
|
|
|
public:
|
|
TProtocollo() = default;
|
|
TProtocollo(const int year, const char* tipoprot, const char* progres) : _tipoprot(tipoprot), _progres(progres), _year(year) { }
|
|
|
|
void set(const TProtocollo& prot);
|
|
void sset(const char* prot);
|
|
const TString& get_prot_str() const;
|
|
prot_s get_prot();
|
|
|
|
int get_year() const { return _year; }
|
|
const TString& get_tipoprot() const { return _tipoprot; }
|
|
const TString& get_progres() const { return _progres; }
|
|
const TString& prot_in(int year, const char* tipoprot, const char* progres) const;
|
|
};
|
|
|
|
class TF1_log : public TLog_report
|
|
{
|
|
public:
|
|
TF1_log() : TLog_report("Stato contabilizzazione:") {}
|
|
bool show_log() { export_text("f1_cg.log", 0, false); return preview(); }
|
|
};
|
|
|
|
TFppro& fppro_db();
|
|
|
|
const char* get_ini_codcaus();
|
|
const char* get_codcaus(const char * tipodoc, long codcf);
|
|
bool get_endatareg();
|
|
const TString & get_datainireg();
|
|
const TString & get_dataendreg();
|
|
bool get_periodprec();
|
|
|
|
void set_ini_codcaus(const TString& codcaus);
|
|
void set_endatareg(bool enable);
|
|
void set_datainireg(const TString& date);
|
|
void set_dataendreg(const TString& date);
|
|
void set_periodprec(bool flag);
|
|
|
|
// Controlla se il "cod_caus" e' per Fatture d'acquisto o Note Credito d'Acquisto
|
|
bool check_causale(const TString& cod_caus, int year=2022, bool acq = true);
|
|
// Controlla se il "cod_caus" ha come "tipo_doc" FA o NC (di acquisto)
|
|
bool check_causale(const TString& cod_caus, int year, const TString& tipo_doc, bool acq = true);
|
|
bool check_caus_has_rit(const TString& cod_caus, int year = 0);
|
|
void run_cont_ini(bool liq);
|
|
|
|
#endif // _F1LIB_H_
|