Patch level : 12.0 no-patch
Files correlati : f90.exe Commento : - F9 ARCHIVIAZIONE SOSTITUTIVA: - Aggiunti codici societa' alle query - Aggiunte stringhe checksum dei file f9*.sql, si puo' anche aggiungere un controllo del checksum dei file prima di eseguire le query, stesso sistema si puo' aggiungere anche all'FP - Corretta query modifica tabella F9WA
This commit is contained in:
parent
086d1b538d
commit
96161ea90b
@ -22,6 +22,12 @@
|
|||||||
#define TAB_BASE_VERSION 100 // Versione base delle tabelle
|
#define TAB_BASE_VERSION 100 // Versione base delle tabelle
|
||||||
#define SQL_VERSION 104 // Utilizzo questo per controllare la versione attuale delle tabelle e nel caso aggiornarle
|
#define SQL_VERSION 104 // Utilizzo questo per controllare la versione attuale delle tabelle e nel caso aggiornarle
|
||||||
|
|
||||||
|
/* MD5 Check Sums dei file aggiornamento tabelle todo: possibile aggiunta: controllo del cheksum dei file (anche per FP)
|
||||||
|
* Aggiungo scritta in testa cosi da poter trovare la stringa anche da programma compilato e cambiare a mano il checksum se mi servisse. Attenzione! */
|
||||||
|
#define CHECKSUMSQL0100 "SUMFILE0100eed185fa8f122010f426d99a23f26c88"
|
||||||
|
#define CHECKSUMSQL0102 "SUMFILE010235333a5e3b49ed31980851243f83b94d"
|
||||||
|
#define CHECKSUMSQL0104 "SUMFILE01040affe32741cd741814ce2cab2d992f6b"
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// Utilities
|
// Utilities
|
||||||
@ -208,6 +214,9 @@ bool TMonitor_mask::save_conf_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
TMask& config_mask = f.mask();
|
TMask& config_mask = f.mask();
|
||||||
TF9_app& a = f9_app();
|
TF9_app& a = f9_app();
|
||||||
|
TString old_codsoc = a.get_ambiente();
|
||||||
|
if(config_mask.get(CF_CODSOC).empty())
|
||||||
|
warning_box("Codice Ambiente vuoto. Impossibile salvare i dati.");
|
||||||
a.set_ambiente (config_mask.get(CF_CODSOC));
|
a.set_ambiente (config_mask.get(CF_CODSOC));
|
||||||
a.set_addr_doc (config_mask.get(CF_ADDRDOC));
|
a.set_addr_doc (config_mask.get(CF_ADDRDOC));
|
||||||
a.set_has_vendext (config_mask.get_bool(CF_VENDEXT));
|
a.set_has_vendext (config_mask.get_bool(CF_VENDEXT));
|
||||||
@ -220,7 +229,7 @@ bool TMonitor_mask::save_conf_handler(TMask_field& f, KEY key)
|
|||||||
ini_set_bool(CONFIG_DITTA, PAR_MOD, VENDEXT_F9, a.get_has_vendext());
|
ini_set_bool(CONFIG_DITTA, PAR_MOD, VENDEXT_F9, a.get_has_vendext());
|
||||||
ini_set_bool(CONFIG_DITTA, PAR_MOD, VIEWMOV_F9, a.get_viewmov());
|
ini_set_bool(CONFIG_DITTA, PAR_MOD, VIEWMOV_F9, a.get_viewmov());
|
||||||
config_mask.close();
|
config_mask.close();
|
||||||
a.edit_wa();
|
a.edit_wa(old_codsoc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +249,7 @@ void TMonitor_mask::controllo_errori() const
|
|||||||
}
|
}
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
TControllo_mask controllo(id_estr);
|
TControllo_mask controllo(f9_app().get_ambiente(), id_estr);
|
||||||
controllo.run();
|
controllo.run();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -540,7 +549,7 @@ void TControllo_mask::associa() // todo: levare gli ultimi residui del vecchio
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
it->add(' ', 0);
|
it->add(' ', 0);
|
||||||
TF9_dberr::del_err(_id_estr, mov_sel->get_int(cid2index(F_CNUMREG)));
|
TF9_dberr::del_err(_cod_soc, _id_estr, mov_sel->get_int(cid2index(F_CNUMREG)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,7 +599,7 @@ vector<TToken_string>& TControllo_mask::import_error_list()
|
|||||||
static vector<TToken_string> controllo_mov;
|
static vector<TToken_string> controllo_mov;
|
||||||
controllo_mov.clear();
|
controllo_mov.clear();
|
||||||
TF9_dberr dberr;
|
TF9_dberr dberr;
|
||||||
_tipo_doc_err = TF9_dberr::get_errori(_id_estr, controllo_mov);
|
_tipo_doc_err = TF9_dberr::get_errori(_cod_soc, _id_estr, controllo_mov);
|
||||||
return controllo_mov;
|
return controllo_mov;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -822,9 +831,10 @@ bool TControllo_mask::on_field_event(TOperable_field& o, TField_event e, long jo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TControllo_mask::TControllo_mask(const char* id_estr, bool esclusi)
|
TControllo_mask::TControllo_mask(const char* codsoc, const char* id_estr, bool esclusi)
|
||||||
: TAutomask("f90100b"), _ordin('D'), _verso('A'), _selected_mov(0), _sel_esclusi(false)
|
: TAutomask("f90100b"), _ordin('D'), _verso('A'), _selected_mov(0), _sel_esclusi(false)
|
||||||
{
|
{
|
||||||
|
_cod_soc = codsoc;
|
||||||
_id_estr = id_estr;
|
_id_estr = id_estr;
|
||||||
field(B_ESCL).disable();
|
field(B_ESCL).disable();
|
||||||
field(B_ALLESCL).disable();
|
field(B_ALLESCL).disable();
|
||||||
@ -892,7 +902,8 @@ bool TF9_app::select_escl_notify(TSheet_field& s, int row, KEY key)
|
|||||||
|
|
||||||
bool TF9_app::controllo_escl_handler(TMask_field& field, KEY key)
|
bool TF9_app::controllo_escl_handler(TMask_field& field, KEY key)
|
||||||
{
|
{
|
||||||
TControllo_mask controllo(f9_app()._estr_escluso->get_id_estr(), true);
|
TF9_app& app = f9_app();
|
||||||
|
TControllo_mask controllo(app.get_ambiente(), app._estr_escluso->get_id_estr(), true);
|
||||||
controllo.run();
|
controllo.run();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1028,20 +1039,20 @@ void TF9_app::fill_esclusi()
|
|||||||
movimento_t TF9_app::escl2mov(TToken_string* row)
|
movimento_t TF9_app::escl2mov(TToken_string* row)
|
||||||
{
|
{
|
||||||
movimento_t t;
|
movimento_t t;
|
||||||
t.err = row->get(0)[0] == 'X',
|
t.err = row->get(0)[0] == 'X';
|
||||||
t.numreg = row->get_int(1),
|
t.numreg = row->get_int(1);
|
||||||
t.datareg = row->get(2),
|
t.datareg = row->get(2);
|
||||||
t.datadoc = row->get(3),
|
t.datadoc = row->get(3);
|
||||||
t.codcaus = row->get(4),
|
t.codcaus = row->get(4);
|
||||||
t.meseliq = row->get_int(5),
|
t.meseliq = row->get_int(5);
|
||||||
t.numdoc = row->get(6),
|
t.numdoc = row->get(6);
|
||||||
t.tot = row->get(7),
|
t.tot = row->get(7);
|
||||||
t.codcf = row->get_int(8),
|
t.codcf = row->get_int(8);
|
||||||
t.ragsoc = row->get_int(9),
|
t.ragsoc = row->get_int(9);
|
||||||
t.reg_protiva = row->get(10),
|
t.reg_protiva = row->get(10);
|
||||||
t.descr = row->get(11),
|
t.descr = row->get(11);
|
||||||
t.state = null_state,
|
t.state = null_state;
|
||||||
t.descr_err = "";
|
t.descr_err = "";
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1103,11 +1114,12 @@ bool TF9_app::mov_handler_escl(TMask_field& f, KEY key)
|
|||||||
return open_mov(mov);
|
return open_mov(mov);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TF9_app::edit_wa() const
|
void TF9_app::edit_wa(TString& old_codsoc) const
|
||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
query << "DELETE FROM F9WA00K WHERE true;" <<
|
if (!old_codsoc.empty())
|
||||||
"INSERT INTO F9WA00K (F9PCSOC, F9PPCDC0) VALUES (" << _config.ambiente << ", " << _config.addr_doc << ");";
|
query << "DELETE FROM " F9_WA " WHERE " WA_CODSOC " = '" << old_codsoc << "';\n";
|
||||||
|
query << "INSERT INTO " F9_WA " (" WA_CODSOC ", " WA_ADDR_DOC ") VALUES (" << _config.ambiente << ", " << _config.addr_doc << ");";
|
||||||
}
|
}
|
||||||
|
|
||||||
int TF9_app::estrai()
|
int TF9_app::estrai()
|
||||||
@ -1213,7 +1225,7 @@ bool TF9_app::segna_estratti(const bool escluso, const int numreg)
|
|||||||
vector<movimento_t>& movs_v = escluso ? escl : _movs;
|
vector<movimento_t>& movs_v = escluso ? escl : _movs;
|
||||||
|
|
||||||
TLocalisamfile mov(LF_MOV);
|
TLocalisamfile mov(LF_MOV);
|
||||||
TToken_string elab("", ';');
|
TToken_string elab("", ';');
|
||||||
elab.add("X", 0); elab.add(today.date2ansi()); elab.add(" "); // "[flag estratto];[data estrazione];[flag escluso]"
|
elab.add("X", 0); elab.add(today.date2ansi()); elab.add(" "); // "[flag estratto];[data estrazione];[flag escluso]"
|
||||||
for (auto it = movs_v.begin(); it != movs_v.end(); ++it)
|
for (auto it = movs_v.begin(); it != movs_v.end(); ++it)
|
||||||
{
|
{
|
||||||
@ -1260,7 +1272,7 @@ bool TF9_app::check_tabelle_f9() const
|
|||||||
"WHERE TABLE_NAME = '" F9_DRD "'))\n" <<
|
"WHERE TABLE_NAME = '" F9_DRD "'))\n" <<
|
||||||
"SELECT 1 AS EXIST ELSE SELECT 0 AS EXIST";
|
"SELECT 1 AS EXIST ELSE SELECT 0 AS EXIST";
|
||||||
fp_db().sq_set_exec(query);
|
fp_db().sq_set_exec(query);
|
||||||
if (fp_db().sq_get("EXIST") != "1") // Se non esiste la tabella la creo
|
if (fp_db().sq_get("EXIST") != "1") // Se non esiste la tabella la creo
|
||||||
ok &= create_tables();
|
ok &= create_tables();
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ class TF9_app : public TSkeleton_application
|
|||||||
TString addr_doc; // Indirizzo documenti cartacei
|
TString addr_doc; // Indirizzo documenti cartacei
|
||||||
bool vendext;
|
bool vendext;
|
||||||
bool viewmovpre;
|
bool viewmovpre;
|
||||||
} _config;
|
} _config; // todo: controllare che siano sqlsafe
|
||||||
unique_ptr<TEstrai_mask> _estr_msk;
|
unique_ptr<TEstrai_mask> _estr_msk;
|
||||||
unique_ptr<TMonitor_mask> _msk;
|
unique_ptr<TMonitor_mask> _msk;
|
||||||
vector<movimento_t> _movs;
|
vector<movimento_t> _movs;
|
||||||
@ -99,7 +99,7 @@ public:
|
|||||||
static bool mov_handler(TMask_field&, KEY key);
|
static bool mov_handler(TMask_field&, KEY key);
|
||||||
static bool mov_handler_escl(TMask_field&, KEY key);
|
static bool mov_handler_escl(TMask_field&, KEY key);
|
||||||
|
|
||||||
void edit_wa() const;
|
void edit_wa(TString& old_codsoc) const;
|
||||||
/** Caricamento di tutti i movimenti data un periodo di data registrazione.
|
/** Caricamento di tutti i movimenti data un periodo di data registrazione.
|
||||||
* \return See TEstrazione::estrai().
|
* \return See TEstrazione::estrai().
|
||||||
*/
|
*/
|
||||||
@ -165,6 +165,7 @@ class TControllo_mask : public TAutomask
|
|||||||
int _selected_mov;
|
int _selected_mov;
|
||||||
bool _sel_esclusi;
|
bool _sel_esclusi;
|
||||||
bool _is_escluso;
|
bool _is_escluso;
|
||||||
|
TString _cod_soc;
|
||||||
TString _id_estr;
|
TString _id_estr;
|
||||||
char _tipo_doc_err{};
|
char _tipo_doc_err{};
|
||||||
vector<TToken_string> _movs;
|
vector<TToken_string> _movs;
|
||||||
@ -186,7 +187,7 @@ class TControllo_mask : public TAutomask
|
|||||||
|
|
||||||
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||||||
public:
|
public:
|
||||||
explicit TControllo_mask(const char* id_estr, bool esclusi = false);
|
explicit TControllo_mask(const char* codsoc, const char* id_estr, bool esclusi = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool open_mov(const TRectype& mov)
|
inline bool open_mov(const TRectype& mov)
|
||||||
|
@ -5,6 +5,20 @@
|
|||||||
#define F9_ERR "F9ERROR"
|
#define F9_ERR "F9ERROR"
|
||||||
#define F9_MOVESTR "F9MOVESTR"
|
#define F9_MOVESTR "F9MOVESTR"
|
||||||
|
|
||||||
|
// FILE WA : PARAMETRI SOC E INDIRIZZO DOC CARTACEI
|
||||||
|
|
||||||
|
/* Percorso documenti cartaei viene costruito come :
|
||||||
|
* Parametro su f9pwa + ambiente + idlancio(ID drd) + categoria_documento(drt) + nome_documento
|
||||||
|
*
|
||||||
|
* esempio:
|
||||||
|
* (/softwaresirio/siaggf9) + '/001' + '/idlancio001' + '/Fatture'/ + nomedoc.pdf
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WA_CODSOC "F9PCSOC" // A(10) [K] - Codice societa'
|
||||||
|
#define WA_ADDR_DOC "F9PPCDC" // A(256) - Percorso documenti cartacei
|
||||||
|
// Gli altri campi servono solo per l'AS //////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
// FILE DRD : DRIVER ESTRAZIONE GIORNALE IVA
|
// FILE DRD : DRIVER ESTRAZIONE GIORNALE IVA
|
||||||
|
|
||||||
#define DRD_CODSOC "F9RCSOC" // A(10) [K]
|
#define DRD_CODSOC "F9RCSOC" // A(10) [K]
|
||||||
@ -104,6 +118,25 @@
|
|||||||
#define DRT_OPCEE "F9TFCEE" // A(6) - operatore CEE
|
#define DRT_OPCEE "F9TFCEE" // A(6) - operatore CEE
|
||||||
|
|
||||||
|
|
||||||
|
// F9ERROR: TABELLA MOVIMENTI IN ERRORE per controllo errori
|
||||||
|
|
||||||
|
#define ERR_CODSOC "IDSOC"
|
||||||
|
#define ERR_IDESTR "IDESTR"
|
||||||
|
#define ERR_NUMREG "NUMREG"
|
||||||
|
#define ERR_DATAREG "DATAREG"
|
||||||
|
#define ERR_DATADOC "DATADOC"
|
||||||
|
#define ERR_CODCAUS "CODCAUS"
|
||||||
|
#define ERR_MESELIQ "MESELIQ"
|
||||||
|
#define ERR_IMPTDOC "IMPTOTDOC"
|
||||||
|
#define ERR_FORN "FORN"
|
||||||
|
#define ERR_RAGSOC "RAGSOC"
|
||||||
|
#define ERR_PROTIVA "PROTIVA"
|
||||||
|
#define ERR_DESCR "DESCR"
|
||||||
|
#define ERR_ESCLUDI "ESCLUDI"
|
||||||
|
#define ERR_ESCLUSO "ESCLUSO"
|
||||||
|
#define ERR_DESCERR "DESCRERR"
|
||||||
|
|
||||||
|
|
||||||
// F9MOVESTR : TABELLA MOVIMENTI ESTRATTI
|
// F9MOVESTR : TABELLA MOVIMENTI ESTRATTI
|
||||||
|
|
||||||
#define MOV_CODSOC "IDSOC"
|
#define MOV_CODSOC "IDSOC"
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "mov.h"
|
#include "mov.h"
|
||||||
#include "../fp/fplib.h"
|
#include "../fp/fplib.h"
|
||||||
|
|
||||||
|
// Controlla eventuali apostrofi e li raddoppia
|
||||||
const char* check_str(const TString& str);
|
const char* check_str(const TString& str);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
@ -71,9 +72,10 @@ bool TEstrazione::check_periodo_def() const
|
|||||||
TString query;
|
TString query;
|
||||||
// Controllo se ci sono estrazioni (definitive) che si sovrappongono di periodo (con lo stesso tipo) e che non siano in stato di errore
|
// Controllo se ci sono estrazioni (definitive) che si sovrappongono di periodo (con lo stesso tipo) e che non siano in stato di errore
|
||||||
// Nel caso di stato di errore e' invece possibile la ri-estrazione
|
// Nel caso di stato di errore e' invece possibile la ri-estrazione
|
||||||
query << "SELECT *\nFROM F9DRD00K\n" <<
|
query << "SELECT *\nFROM " F9_DRD "\n"
|
||||||
"WHERE " << DRD_DATAA << " >= '" << _head.dal.date2ansi() << "' AND " DRD_DATADA " <= '" << _head.al.date2ansi() << "' AND "
|
"WHERE " DRD_CODSOC " = '" << _head.cod_soc << "' AND " DRD_DATAA " >= '" << _head.dal.date2ansi() << "' AND " DRD_DATADA " <= '" <<
|
||||||
DRD_FLAG_PD " = 'D' AND\n " DRD_STATO " <> '" D_GEST_ERR "' AND " DRD_STATO " <> '" D_WA_ERR "' AND " DRD_STATO " <> '" D_ERR_SOS "' AND " DRD_TIPODOC " = '" << _head.tipo_doc << "';";
|
_head.al.date2ansi() << "' AND " DRD_FLAG_PD " = 'D' AND\n " DRD_STATO " <> '" D_GEST_ERR "' AND " DRD_STATO " <> '" D_WA_ERR "' AND "
|
||||||
|
DRD_STATO " <> '" D_ERR_SOS "' AND " DRD_TIPODOC " = '" << _head.tipo_doc << "';";
|
||||||
fp_db().sq_set_exec(query);
|
fp_db().sq_set_exec(query);
|
||||||
return fp_db().sq_items() == 0;
|
return fp_db().sq_items() == 0;
|
||||||
}
|
}
|
||||||
@ -167,6 +169,8 @@ bool TEstrazione::export_error_list() const
|
|||||||
if (it->numreg == 187680)
|
if (it->numreg == 187680)
|
||||||
bool simo = true;
|
bool simo = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
dberr.add(_head.cod_soc);
|
||||||
dberr.add(_head.id_estr);
|
dberr.add(_head.id_estr);
|
||||||
for (int i = 1; i < 15; i++)
|
for (int i = 1; i < 15; i++)
|
||||||
{
|
{
|
||||||
@ -196,7 +200,8 @@ TString TEstrazione::next_estr_today(char tipo) const
|
|||||||
TString query;
|
TString query;
|
||||||
query << "SELECT TOP 1 " DRD_ID_EST " AS IDESTR\n"
|
query << "SELECT TOP 1 " DRD_ID_EST " AS IDESTR\n"
|
||||||
"FROM " F9_DRD "\n"
|
"FROM " F9_DRD "\n"
|
||||||
"WHERE " DRD_ID_EST " LIKE '" << today.date2ansi() << "%'\n" <<
|
"WHERE " DRD_CODSOC " = '" << _head.cod_soc << "' AND\n"
|
||||||
|
DRD_ID_EST " LIKE '" << today.date2ansi() << "%'\n" <<
|
||||||
"ORDER BY " DRD_ID_EST " DESC";
|
"ORDER BY " DRD_ID_EST " DESC";
|
||||||
fp_db().sq_set_exec(query);
|
fp_db().sq_set_exec(query);
|
||||||
|
|
||||||
@ -247,9 +252,9 @@ bool TEstrazione::update_drd_stato_estr() const
|
|||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
query << "UPDATE " F9_DRD "\n" \
|
query << "UPDATE " F9_DRD "\n" \
|
||||||
"SET " DRD_STATO " = '" << _head.stato_estr << "'\n" \
|
"SET " DRD_STATO " = '" << _head.stato_estr << "'\n"
|
||||||
"WHERE " DRD_CODSOC " = '" << _head.cod_soc << "'" \
|
"WHERE " DRD_CODSOC " = '" << _head.cod_soc << "'"
|
||||||
" AND " DRD_ID_EST " = '" << _head.id_estr << "'" \
|
" AND " DRD_ID_EST " = '" << _head.id_estr << "'"
|
||||||
" AND " DRD_FLAG_PD " = '" << (_head.flag_prov ? "P" : "D") << "'";
|
" AND " DRD_FLAG_PD " = '" << (_head.flag_prov ? "P" : "D") << "'";
|
||||||
ok = fp_db().sq_set_exec(query);
|
ok = fp_db().sq_set_exec(query);
|
||||||
ok = ok && fp_db().sq_commit();
|
ok = ok && fp_db().sq_commit();
|
||||||
@ -582,9 +587,11 @@ bool TEstrazione::exist_prov() const
|
|||||||
|
|
||||||
bool TEstrazione::gap_periodo() const
|
bool TEstrazione::gap_periodo() const
|
||||||
{
|
{
|
||||||
TString query; query << "SELECT F9RIDES AS ID, F9RUESA AS DATA_A FROM " F9_DRD "\n"
|
TString query; query << "SELECT " DRD_ID_EST " AS ID, " DRD_DATAA " AS DATA_A\n"
|
||||||
"WHERE " DRD_ID_EST " LIKE '%N%' AND " DRD_FLAG_PD " = 'D' AND " DRD_TIPODOC " = '" << _head.tipo_doc << "'\n"
|
"FROM " F9_DRD "\n"
|
||||||
"ORDER BY F9RUESA DESC";
|
"WHERE " DRD_CODSOC " = '" << _head.cod_soc << "' AND " DRD_ID_EST " LIKE '%N%' AND " // '%N%' = Pacchetto normale
|
||||||
|
DRD_FLAG_PD " = 'D' AND " DRD_TIPODOC " = '" << _head.tipo_doc << "'\n"
|
||||||
|
"ORDER BY " DRD_DATAA " DESC";
|
||||||
const bool ok = fp_db().sq_set_exec(query);
|
const bool ok = fp_db().sq_set_exec(query);
|
||||||
return ok && fp_db().sq_items() > 0 && _head.dal - fp_db().sq_get_date("DATA_A") > 1;
|
return ok && fp_db().sq_items() > 0 && _head.dal - fp_db().sq_get_date("DATA_A") > 1;
|
||||||
}
|
}
|
||||||
@ -602,20 +609,19 @@ TEstrazione::TEstrazione(const TString& ambiente, const bool flag_prov, const ch
|
|||||||
const TString& addrcart, const bool escluso, const TDate* const dal, const TDate* const al, const bool has_vendext)
|
const TString& addrcart, const bool escluso, const TDate* const dal, const TDate* const al, const bool has_vendext)
|
||||||
: _descr(descr), _has_vendext(has_vendext)
|
: _descr(descr), _has_vendext(has_vendext)
|
||||||
{
|
{
|
||||||
_head.cod_soc = ambiente;
|
_head.cod_soc = ambiente;
|
||||||
_head.flag_prov = flag_prov;
|
_head.flag_prov = flag_prov;
|
||||||
_head.descr = descr;
|
_head.descr = descr;
|
||||||
_head.tipo_doc = tipodoc;
|
_head.tipo_doc = tipodoc;
|
||||||
if (!escluso && dal != nullptr && al != nullptr)
|
if (!escluso && dal != nullptr && al != nullptr)
|
||||||
{
|
{
|
||||||
_head.dal = *dal;
|
_head.dal = *dal;
|
||||||
_head.al = *al;
|
_head.al = *al;
|
||||||
}
|
}
|
||||||
_head.addr_cart = addrcart;
|
_head.addr_cart = addrcart;
|
||||||
|
|
||||||
_escluso = escluso;
|
_escluso = escluso;
|
||||||
|
_error_sql = new ofstream;
|
||||||
_error_sql = new ofstream;
|
|
||||||
_error_sql->open("f9_TEstrazione_error_sql.txt");
|
_error_sql->open("f9_TEstrazione_error_sql.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -664,21 +670,40 @@ bool TF9_dberr::send()
|
|||||||
const bool ok = fp_db().sq_set_exec(_insert) && fp_db().sq_commit();
|
const bool ok = fp_db().sq_set_exec(_insert) && fp_db().sq_commit();
|
||||||
if(!ok)
|
if(!ok)
|
||||||
write_sqlerrlog(_insert);
|
write_sqlerrlog(_insert);
|
||||||
_insert.cut(0) << "INSERT INTO " F9_ERR " VALUES ()";
|
_insert.cut(0) << "INSERT INTO " F9_ERR " ("
|
||||||
|
ERR_CODSOC ", "
|
||||||
|
ERR_IDESTR ", "
|
||||||
|
ERR_NUMREG ", "
|
||||||
|
ERR_DATAREG ", "
|
||||||
|
ERR_DATADOC ", "
|
||||||
|
ERR_CODCAUS ", "
|
||||||
|
ERR_MESELIQ ", "
|
||||||
|
ERR_IMPTDOC ", "
|
||||||
|
ERR_FORN ", "
|
||||||
|
ERR_RAGSOC ", "
|
||||||
|
ERR_PROTIVA ", "
|
||||||
|
ERR_DESCR ", "
|
||||||
|
ERR_ESCLUDI ", "
|
||||||
|
ERR_ESCLUSO ", "
|
||||||
|
ERR_DESCERR ") VALUES ()";
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TF9_dberr::del_err(const TString& id_estr, int numreg)
|
void TF9_dberr::del_err(const TString& codsoc, const TString& id_estr, int numreg)
|
||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
query << "DELETE FROM " F9_ERR " WHERE IDESTR = '" << id_estr << "' AND NUMREG = '" << numreg << "';";
|
query << "DELETE FROM " F9_ERR
|
||||||
|
"\nWHERE " ERR_CODSOC " = '" << codsoc << "'"
|
||||||
|
"\nAND " ERR_IDESTR " = '" << id_estr << "' AND " ERR_NUMREG " = '" << numreg << "';";
|
||||||
fp_db().sq_set_exec(query);
|
fp_db().sq_set_exec(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
char TF9_dberr::get_errori(const TString& id_estr, vector<TToken_string>& controllo_mov)
|
char TF9_dberr::get_errori(const TString& codsoc, const TString& id_estr, vector<TToken_string>& controllo_mov)
|
||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
query << "SELECT * FROM " F9_ERR " WHERE IDESTR = '" << id_estr << "';";
|
query << "SELECT * FROM " F9_ERR
|
||||||
|
"\nWHERE " ERR_CODSOC " = '" << codsoc << "' AND "
|
||||||
|
ERR_IDESTR " = '" << id_estr << "';";
|
||||||
fp_db().sq_set_exec(query, false);
|
fp_db().sq_set_exec(query, false);
|
||||||
for (bool ok = fp_db().sq_next(); ok; ok = fp_db().sq_next())
|
for (bool ok = fp_db().sq_next(); ok; ok = fp_db().sq_next())
|
||||||
{
|
{
|
||||||
@ -695,14 +720,29 @@ char TF9_dberr::get_errori(const TString& id_estr, vector<TToken_string>& contro
|
|||||||
controllo_mov.insert(controllo_mov.end(), row);
|
controllo_mov.insert(controllo_mov.end(), row);
|
||||||
}
|
}
|
||||||
query.cut(0) << "SELECT " DRD_TIPODOC " FROM " F9_DRD "\n" <<
|
query.cut(0) << "SELECT " DRD_TIPODOC " FROM " F9_DRD "\n" <<
|
||||||
"WHERE " DRD_ID_EST " = '" << id_estr << "'";
|
"WHERE " DRD_CODSOC " = '" << codsoc << "' AND " DRD_ID_EST " = '" << id_estr << "'";
|
||||||
fp_db().sq_set_exec(query);
|
fp_db().sq_set_exec(query);
|
||||||
return fp_db().sq_get((unsigned)0)[0];
|
return fp_db().sq_get((unsigned)0)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
TF9_dberr::TF9_dberr()
|
TF9_dberr::TF9_dberr()
|
||||||
{
|
{
|
||||||
_insert.cut(0) << "INSERT INTO " F9_ERR " VALUES ()";
|
_insert.cut(0) << "INSERT INTO " F9_ERR " ("
|
||||||
|
ERR_CODSOC ", "
|
||||||
|
ERR_IDESTR ", "
|
||||||
|
ERR_NUMREG ", "
|
||||||
|
ERR_DATAREG ", "
|
||||||
|
ERR_DATADOC ", "
|
||||||
|
ERR_CODCAUS ", "
|
||||||
|
ERR_MESELIQ ", "
|
||||||
|
ERR_IMPTDOC ", "
|
||||||
|
ERR_FORN ", "
|
||||||
|
ERR_RAGSOC ", "
|
||||||
|
ERR_PROTIVA ", "
|
||||||
|
ERR_DESCR ", "
|
||||||
|
ERR_ESCLUDI ", "
|
||||||
|
ERR_ESCLUSO ", "
|
||||||
|
ERR_DESCERR ") VALUES ()";
|
||||||
_fout = new ofstream;
|
_fout = new ofstream;
|
||||||
_fout->open("f9_dberr.txt");
|
_fout->open("f9_dberr.txt");
|
||||||
}
|
}
|
||||||
|
@ -274,8 +274,8 @@ public:
|
|||||||
void add(long num);
|
void add(long num);
|
||||||
void add() { add_str("NULL"); }
|
void add() { add_str("NULL"); }
|
||||||
bool send();
|
bool send();
|
||||||
static void del_err(const TString& id_estr, int numreg);
|
static void del_err(const TString& codsoc, const TString& id_estr, int numreg);
|
||||||
static char get_errori(const TString& id_estr, vector<TToken_string>& controllo_mov);
|
static char get_errori(const TString& codsoc, const TString& id_estr, vector<TToken_string>& controllo_mov);
|
||||||
TF9_dberr();
|
TF9_dberr();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user