183 lines
5.3 KiB
C
183 lines
5.3 KiB
C
|
#pragma once
|
||
|
#include "applicat.h"
|
||
|
#include "f90100a.h"
|
||
|
#include <automask.h>
|
||
|
|
||
|
#define PAR_MOD "F9"
|
||
|
#define AMBIENTE_F9 "CODSOC" // Codice ambiente (codsoc)
|
||
|
#define ADDRCART_F9 "ADDDOC" // Indirizzo documenti cartacei
|
||
|
|
||
|
TDate today(TODAY);
|
||
|
|
||
|
enum state_fppro
|
||
|
{
|
||
|
correct = 1,
|
||
|
reg_with_err = -1,
|
||
|
not_fa = -10, // Non e' fattura acquisti
|
||
|
guessed = 100,
|
||
|
no_guessed = 0
|
||
|
};
|
||
|
|
||
|
struct drd
|
||
|
{
|
||
|
TString cod_soc;
|
||
|
TString id_estr;
|
||
|
bool flag_prov{ true };
|
||
|
TString descr;
|
||
|
char tipo_doc{ 'A' };
|
||
|
TDate dal;
|
||
|
TDate al;
|
||
|
TString user;
|
||
|
TString timestamp;
|
||
|
TString4 stato_estr{ "01" };
|
||
|
TString addr_cart;
|
||
|
};
|
||
|
|
||
|
SSimple_query& db();
|
||
|
|
||
|
class TEstrai_mask : public TMask
|
||
|
{
|
||
|
TString _descr;
|
||
|
|
||
|
void enable_fields(bool en = true);
|
||
|
|
||
|
static bool estrai_handler(TMask_field& f, unsigned short key);
|
||
|
static bool enable_handler(TMask_field& f, unsigned short key);
|
||
|
static bool dataini_handler(TMask_field& f, unsigned short key);
|
||
|
static bool dataend_handler(TMask_field& f, unsigned short key);
|
||
|
public:
|
||
|
TString& get_descr() { return _descr; }
|
||
|
TEstrai_mask();
|
||
|
};
|
||
|
|
||
|
class TEstrai_mask;
|
||
|
class TMonitor_mask;
|
||
|
class TControllo_mask;
|
||
|
class TF9_app : public TSkeleton_application
|
||
|
{
|
||
|
//friend class TEstrai_mask;
|
||
|
friend class TMonitor_mask;
|
||
|
friend class TControllo_mask;
|
||
|
drd _head;
|
||
|
TEstrai_mask* _estr_msk;
|
||
|
TMonitor_mask* _msk;
|
||
|
//TControllo_mask* _controllo_msk;
|
||
|
vector<TToken_string> _movs;
|
||
|
vector<TToken_string> _esclusi; // Vettore con i movimenti esclusi
|
||
|
TToken_string _mov_escl;
|
||
|
int _tot_movs;
|
||
|
TString _ambiente; // Codice ambiente (codsoc)
|
||
|
TString _addr_doc; // Indirizzo documenti cartacei
|
||
|
int _last_estr_p;
|
||
|
int _last_estr_d;
|
||
|
char _tipodoc_escl;
|
||
|
char _flagprov_escl;
|
||
|
|
||
|
static const char* traduci_stato(const TString& cod);
|
||
|
|
||
|
state_fppro check_fppro(int numreg) const;
|
||
|
const char* prepara_movimenti(TipoIVA tipo);
|
||
|
const char* prepara_movimenti_escl(TipoIVA tipo, int numreg, TString& err) const;
|
||
|
static bool is_doc_xml(const TLocalisamfile& mov);
|
||
|
static bool check_periodo_def(const drd& head);
|
||
|
|
||
|
static TString& drd_attr();
|
||
|
TString& drd_tovalues() const;
|
||
|
|
||
|
TString next_estr_today(char tipo) const;
|
||
|
bool esporta();
|
||
|
bool new_extr() const;
|
||
|
|
||
|
TDate get_dataini() const { return _estr_msk->get_date(ES_DATAINI); }
|
||
|
TDate get_dataend() const { return _estr_msk->get_date(ES_DATAEND); }
|
||
|
char get_tipodoc() const { return _estr_msk->get(ES_TIPODOC)[0]; }
|
||
|
char get_tipodoc_escl() const { return _tipodoc_escl; }
|
||
|
TipoIVA get_tipoiva() const { return get_tipodoc() == 'V' ? iva_vendite : iva_acquisti; }
|
||
|
TipoIVA get_tipoiva_escl() const { return get_tipodoc_escl() == 'V' ? iva_vendite : iva_acquisti; }
|
||
|
TString& get_descr() const { return _estr_msk->get_descr(); }
|
||
|
bool is_provviso() const { return _estr_msk->get(ES_FLAGPROV)[0] == 'P'; }
|
||
|
|
||
|
void fill();
|
||
|
void load();
|
||
|
|
||
|
public:
|
||
|
const TString& get_ambiente() const { return _ambiente; };
|
||
|
const TString& get_addr_doc() const { return _addr_doc; };
|
||
|
|
||
|
void set_ambiente(const char* cod) { _ambiente.cut(0) << cod; };
|
||
|
void set_addr_doc(const char* add) { _addr_doc.cut(0) << add; };
|
||
|
|
||
|
void run_estr_msk() const { _estr_msk->run(); }
|
||
|
|
||
|
static TMask& descr_msk();
|
||
|
|
||
|
// Estrazione esclusi
|
||
|
static bool select_escl_notify(TSheet_field& s, int row, KEY key);
|
||
|
static bool controllo_escl_handler(TMask_field& field, KEY key);
|
||
|
static bool year_handler(TMask_field& field, KEY key);
|
||
|
void open_esclusi();
|
||
|
|
||
|
void edit_wa() const;
|
||
|
int estrai(); // Estrazione per pacchetti "normali"
|
||
|
int estrai_single(TToken_string& row, char flagprov, char tipodoc); // Estrazione singole per esclusi
|
||
|
bool estrazione_iva(bool escluso = false); // Estrazione dati IVA sia per pacch. normali che per esclusi
|
||
|
void segna_in_errore() const;
|
||
|
|
||
|
static const char* categoria_doc();
|
||
|
static const char* caus_sos(const TLocalisamfile& mov, TipoIVA acquisti);
|
||
|
static bool is_autofattura(const TLocalisamfile& mov);
|
||
|
|
||
|
void main_loop() override;
|
||
|
TF9_app() : _estr_msk(nullptr), _msk(nullptr), _mov_escl("", '|'), _tot_movs(0), _ambiente(""), _addr_doc(""), _last_estr_p(0), _last_estr_d(0),
|
||
|
_tipodoc_escl('A'), _flagprov_escl('P') { }
|
||
|
};
|
||
|
TF9_app& app();
|
||
|
|
||
|
class TMonitor_mask : public TAutomask
|
||
|
{
|
||
|
vector<TToken_string> _fppro;
|
||
|
|
||
|
static bool save_conf_handler(TMask_field& f, unsigned short key);
|
||
|
|
||
|
static void controllo_errori();
|
||
|
// Riempie sheet per visualizzare le estrazioni
|
||
|
bool on_key(KEY key) override;
|
||
|
static void open_win_estr();
|
||
|
void open_win_conf() const;
|
||
|
|
||
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||
|
|
||
|
public:
|
||
|
void disable_controllo_err();
|
||
|
TMonitor_mask() : TAutomask("f90100a")
|
||
|
{
|
||
|
disable(DLG_FINDREC);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
class TControllo_mask : public TAutomask
|
||
|
{
|
||
|
char _ordin;
|
||
|
char _verso;
|
||
|
int _selected_mov;
|
||
|
bool _sel_esclusi;
|
||
|
bool _esclusi;
|
||
|
|
||
|
void fill() const;
|
||
|
void fill_fppro_sheet() const;
|
||
|
TMask& get_win_order();
|
||
|
void open_win_order();
|
||
|
|
||
|
TToken_string* selected_mov();
|
||
|
TToken_string* selected_fat() const;
|
||
|
|
||
|
// Gestisce la selezione multipla negli sheet di controllo movimenti
|
||
|
void selfatt(TOperable_field& o, long jolly) const;
|
||
|
void conferma_esclusi() const;
|
||
|
void associa();
|
||
|
|
||
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||
|
|
||
|
public:
|
||
|
TControllo_mask(bool esclusi = false);
|
||
|
};
|