Patch level : 12.0 no-patch
Files correlati : f90.exe f90200a.msk f90104.sql Commento : - F9 ARCHIVIAZIONE SOSTITUTIVA: - Aggiunto qualche controllo degli errori in piu'. - Aggiunta tabella per movimenti pronti all'estrazione per poter controllare quale e' stato saltato. - Corretto aggiornamento stato estrazione DRD - Modificata diagnostica non tutti i casi ora sono bloccanti, alcuni fanno saltare semplicemente il movimento (si possono poi controllare nel caso) - In diagnostica controllo se deve essere estratto secondo le cat. documentali.
This commit is contained in:
parent
e3fe3e0718
commit
2a027fd07e
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#define TABMOD_TABVER "S0" // Campo per la memorizzazione della versione attuale delle tabelle
|
#define TABMOD_TABVER "S0" // Campo per la memorizzazione della versione attuale delle tabelle
|
||||||
#define TAB_BASE_VERSION 100 // Versione base delle tabelle
|
#define TAB_BASE_VERSION 100 // Versione base delle tabelle
|
||||||
#define SQL_VERSION 102 // 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
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
@ -587,7 +587,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 = dberr.get_errori(_id_estr, controllo_mov);
|
_tipo_doc_err = TF9_dberr::get_errori(_id_estr, controllo_mov);
|
||||||
return controllo_mov;
|
return controllo_mov;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,7 +819,8 @@ 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) : TAutomask("f90100b"), _ordin('D'), _verso('A'), _selected_mov(0), _sel_esclusi(false)
|
TControllo_mask::TControllo_mask(const char* id_estr, bool esclusi)
|
||||||
|
: TAutomask("f90100b"), _ordin('D'), _verso('A'), _selected_mov(0), _sel_esclusi(false)
|
||||||
{
|
{
|
||||||
_id_estr = id_estr;
|
_id_estr = id_estr;
|
||||||
field(B_ESCL).disable();
|
field(B_ESCL).disable();
|
||||||
@ -1146,7 +1147,7 @@ int TF9_app::estrai()
|
|||||||
const bool stampato = recset_get_bool(mov, MOV_REGST);
|
const bool stampato = recset_get_bool(mov, MOV_REGST);
|
||||||
const TString& numdoc = recset_get_string(mov, MOV_NUMDOC);
|
const TString& numdoc = recset_get_string(mov, MOV_NUMDOC);
|
||||||
// Se definitivo controllo il flag di stampato REGST
|
// Se definitivo controllo il flag di stampato REGST
|
||||||
if ((flagpro || stampato) && numdoc.full() && caus.reg().iva() == tipo && !escluso) // Controllo anche che non sia escluso
|
if ((flagpro || stampato) && numdoc.full() && caus.reg().iva() == tipo)
|
||||||
{
|
{
|
||||||
clifo.zero();
|
clifo.zero();
|
||||||
clifo.put(CLI_TIPOCF, tipo == iva_acquisti ? "F" : "C");
|
clifo.put(CLI_TIPOCF, tipo == iva_acquisti ? "F" : "C");
|
||||||
@ -1158,7 +1159,7 @@ int TF9_app::estrai()
|
|||||||
t.numreg = recset_get_int (mov, MOV_NUMREG);
|
t.numreg = recset_get_int (mov, MOV_NUMREG);
|
||||||
t.datareg = recset_get_string(mov, MOV_DATAREG);
|
t.datareg = recset_get_string(mov, MOV_DATAREG);
|
||||||
t.datadoc = recset_get_string(mov, MOV_DATADOC);
|
t.datadoc = recset_get_string(mov, MOV_DATADOC);
|
||||||
t.codcaus = recset_get_string(mov, MOV_CODCAUS);
|
t.codcaus = recset_get_string(mov, MOV_CODCAUS, 3);
|
||||||
t.meseliq = recset_get_int (mov, MOV_MESELIQ);
|
t.meseliq = recset_get_int (mov, MOV_MESELIQ);
|
||||||
t.numdoc = recset_get_string(mov, MOV_NUMDOC);
|
t.numdoc = recset_get_string(mov, MOV_NUMDOC);
|
||||||
t.tot = recset_get_real (mov, MOV_TOTDOC) + recset_get_real(mov, MOV_RITFIS) + recset_get_real(mov, MOV_RITSOC);
|
t.tot = recset_get_real (mov, MOV_TOTDOC) + recset_get_real(mov, MOV_RITFIS) + recset_get_real(mov, MOV_RITSOC);
|
||||||
@ -1166,6 +1167,11 @@ int TF9_app::estrai()
|
|||||||
t.ragsoc = clifo.read() == NOERR ? clifo.get(CLI_RAGSOC) : " ";
|
t.ragsoc = clifo.read() == NOERR ? clifo.get(CLI_RAGSOC) : " ";
|
||||||
t.reg_protiva = TString(recset_get_string(mov, MOV_REG)) << "/" << recset_get_string(mov, MOV_PROTIVA);
|
t.reg_protiva = TString(recset_get_string(mov, MOV_REG)) << "/" << recset_get_string(mov, MOV_PROTIVA);
|
||||||
t.descr = recset_get_string(mov, MOV_DESCR);
|
t.descr = recset_get_string(mov, MOV_DESCR);
|
||||||
|
if (escluso)
|
||||||
|
{
|
||||||
|
t.estratto = false;
|
||||||
|
t.descr_estr = movimento_t::escluso;
|
||||||
|
}
|
||||||
|
|
||||||
// Effettivo inserimento del movimento
|
// Effettivo inserimento del movimento
|
||||||
_estrazione->add_mov(t);
|
_estrazione->add_mov(t);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#define F9_IVA "F9IVA00K"
|
#define F9_IVA "F9IVA00K"
|
||||||
#define F9_DRT "F9DRT00K"
|
#define F9_DRT "F9DRT00K"
|
||||||
#define F9_ERR "F9ERROR"
|
#define F9_ERR "F9ERROR"
|
||||||
|
#define F9_MOVESTR "F9MOVESTR"
|
||||||
|
|
||||||
// FILE DRD : DRIVER ESTRAZIONE GIORNALE IVA
|
// FILE DRD : DRIVER ESTRAZIONE GIORNALE IVA
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ BEGIN
|
|||||||
ITEM "Categoria\nDocumento (Codice)@15"
|
ITEM "Categoria\nDocumento (Codice)@15"
|
||||||
ITEM "Descrizione\nDocumento@26"
|
ITEM "Descrizione\nDocumento@26"
|
||||||
ITEM "Classe Documentale\nSostitutiva@18"
|
ITEM "Classe Documentale\nSostitutiva@18"
|
||||||
ITEM "Causale per\nSostitutiva (TD01...)@12"
|
ITEM "Causale per\nSostitutiva (TD01...)@25"
|
||||||
ITEM "Causale\nContabile@8"
|
ITEM "Causale\nContabile@8"
|
||||||
ITEM "Tipo Causale\nContabile@8"
|
ITEM "Tipo Causale\nContabile@8"
|
||||||
ITEM "Tipo Movimento\nContabile@10"
|
ITEM "Tipo Movimento\nContabile@10"
|
||||||
|
@ -50,7 +50,10 @@ state_fppro TEstrazione::check_fppro(int numreg)
|
|||||||
return correct;
|
return correct;
|
||||||
TString err(fppro_db().get_last_error());
|
TString err(fppro_db().get_last_error());
|
||||||
if (!err.empty())
|
if (!err.empty())
|
||||||
|
{
|
||||||
error_box(err.cut(0) << "Errore durante il controllo del movimento n. " << numreg << "\n" << err);
|
error_box(err.cut(0) << "Errore durante il controllo del movimento n. " << numreg << "\n" << err);
|
||||||
|
return err_read_db;
|
||||||
|
}
|
||||||
return reg_with_err;
|
return reg_with_err;
|
||||||
}
|
}
|
||||||
else // Se non ho i riferimenti faccio guessing
|
else // Se non ho i riferimenti faccio guessing
|
||||||
@ -110,7 +113,7 @@ TString& TEstrazione::drd_tovalues() const
|
|||||||
_head.stato_estr << "', '" << _head.addr_cart << "'";
|
_head.stato_estr << "', '" << _head.addr_cart << "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TEstrazione::new_extr() const
|
bool TEstrazione::insert_into_drd() const
|
||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
query << "INSERT INTO " F9_DRD " ( " << drd_attr() << " ) \nVALUES ( " << drd_tovalues() << " );";
|
query << "INSERT INTO " F9_DRD " ( " << drd_attr() << " ) \nVALUES ( " << drd_tovalues() << " );";
|
||||||
@ -121,9 +124,25 @@ bool TEstrazione::new_extr() const
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TEstrazione::scrivi_testata_su_db() const
|
bool TEstrazione::insert_into_f9movestr() const
|
||||||
{
|
{
|
||||||
return new_extr();
|
TString query;
|
||||||
|
query << "INSERT INTO " F9_MOVESTR " (IDESTR, NUMREG, DATAREG, ESTRATTO, DESCR_ERR)\nVALUES ";
|
||||||
|
for(auto it = _movs.begin(); it != _movs.end(); ++it)
|
||||||
|
{
|
||||||
|
query << " ('" << _head.id_estr << "', '" << it->numreg << "', '" << it->datareg.date2ansi() << "', " <<
|
||||||
|
(it->estratto ? "1" : "0") << ", '" << check_str(it->get_descr_estr()) << "'),\n";
|
||||||
|
#ifdef DBG
|
||||||
|
if (TString(check_str(it->get_descr_estr())).empty())
|
||||||
|
bool simo = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
query.rtrim(2);
|
||||||
|
bool ok = fp_db().sq_set_exec(query);
|
||||||
|
ok = ok && fp_db().sq_commit();
|
||||||
|
if (!ok)
|
||||||
|
write_errorsql_log(query);
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TEstrazione::export_error_list() const
|
bool TEstrazione::export_error_list() const
|
||||||
@ -215,7 +234,7 @@ void TEstrazione::add_mov(const movimento_t& movimento)
|
|||||||
_movs.insert(_movs.end(), movimento);
|
_movs.insert(_movs.end(), movimento);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TEstrazione::aggiorna_stato() const
|
bool TEstrazione::update_drd_stato_estr() const
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
do
|
do
|
||||||
@ -225,12 +244,13 @@ void TEstrazione::aggiorna_stato() const
|
|||||||
"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 << "'";
|
" 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();
|
||||||
if (!ok)
|
if (!ok)
|
||||||
write_errorsql_log(query);
|
write_errorsql_log(query);
|
||||||
} while (!ok && yesno_box("Impossibile aggiornare stato dell'estrazione.\nRiprovare?"));
|
} while (!ok && yesno_box("Impossibile aggiornare stato dell'estrazione.\nRiprovare?"));
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TEstrazione::diagnostica_mov()
|
const char* TEstrazione::diagnostica_mov()
|
||||||
@ -246,33 +266,69 @@ const char* TEstrazione::diagnostica_mov()
|
|||||||
{
|
{
|
||||||
if (!bar.add_status())
|
if (!bar.add_status())
|
||||||
break;
|
break;
|
||||||
|
#ifdef DBG
|
||||||
|
if (it->numreg == 96963)
|
||||||
|
bool simo = true;
|
||||||
|
#endif
|
||||||
|
// Se escluso passo avanti
|
||||||
|
if (!it->estratto && it->descr_estr == movimento_t::escluso)
|
||||||
|
continue;
|
||||||
|
|
||||||
movimento_t& mov_i = *it;
|
movimento_t& mov_i = *it;
|
||||||
//const int numreg = row.get_int(cid2index(F_NUMREG));
|
const int numreg = mov_i.numreg;
|
||||||
const int numreg = mov_i.numreg;
|
const state_fppro res = check_fppro(numreg);
|
||||||
switch (check_fppro(numreg))
|
switch (res)
|
||||||
{
|
{
|
||||||
|
// OK
|
||||||
case guessed:
|
case guessed:
|
||||||
ok &= fppro_db().associa_mov(numreg);
|
ok &= fppro_db().associa_mov(numreg);
|
||||||
//row.add(fppro_db().get_keys_fppro());
|
|
||||||
case correct:
|
case correct:
|
||||||
|
/*ok &= true;
|
||||||
|
mov_i.err = false;
|
||||||
|
mov_i.state = res;
|
||||||
|
break;*/
|
||||||
|
|
||||||
|
// ERRORS
|
||||||
|
// Errore non bloccante
|
||||||
|
case not_fa:
|
||||||
ok &= true;
|
ok &= true;
|
||||||
mov_i.state = correct;
|
mov_i.err = false;
|
||||||
|
mov_i.state = res;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case not_fa:
|
// ERRORI BLOCCANTI
|
||||||
mov_i.descr_err = "Non fattura";
|
|
||||||
mov_i.state = not_fa;
|
|
||||||
case reg_with_err:
|
case reg_with_err:
|
||||||
mov_i.descr_err = "Registrazione con errori";
|
ok &= false;
|
||||||
mov_i.state = reg_with_err;
|
mov_i.err = true;
|
||||||
|
mov_i.estratto = false;
|
||||||
|
mov_i.descr_err = "Errore controllo movimento: associazione movimento con fattura elettronica passiva sbagliato.";
|
||||||
|
mov_i.state = res;
|
||||||
|
break;
|
||||||
|
case err_read_db:
|
||||||
|
ok &= false;
|
||||||
|
mov_i.err = true;
|
||||||
|
mov_i.estratto = false;
|
||||||
|
mov_i.descr_err = "Errore controllo movimento: errore lettura db.";
|
||||||
|
mov_i.state = res;
|
||||||
|
break;
|
||||||
case no_guessed:
|
case no_guessed:
|
||||||
ok &= false;
|
ok &= false;
|
||||||
mov_i.err = true; // Mi segno il movimento che ha un problema
|
mov_i.err = true;
|
||||||
|
mov_i.estratto = false;
|
||||||
mov_i.descr_err = "Non associato a fattura elettr. abbinamento automatico non riuscito. Abbinare manualmente, o escludere";
|
mov_i.descr_err = "Non associato a fattura elettr. abbinamento automatico non riuscito. Abbinare manualmente, o escludere";
|
||||||
mov_i.state = no_guessed;
|
mov_i.state = res;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Per quelli che hanno passato il primo controllo errori controllo che debba essere estratto
|
||||||
|
* secondo le categorie documentali. */
|
||||||
|
if(!mov_i.err && mov_i.estratto)
|
||||||
|
{
|
||||||
|
std::shared_ptr<TCategorie_doc::classe_doc> cd = categorie_doc().causcont2cat(mov_i.codcaus);
|
||||||
|
mov_i.estratto = cd.get();
|
||||||
|
mov_i.descr_estr = cd ? movimento_t::no_err : movimento_t::no_catdoc;
|
||||||
|
mov_i.catdoc = cd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tipo == iva_vendite)
|
else if (tipo == iva_vendite)
|
||||||
@ -313,7 +369,6 @@ const char* TEstrazione::diagnostica_mov()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_head.stato_estr = ok ? D_GEST_OK : D_GEST_ERR;
|
_head.stato_estr = ok ? D_GEST_OK : D_GEST_ERR;
|
||||||
aggiorna_stato();
|
|
||||||
return _head.stato_estr;
|
return _head.stato_estr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,8 +388,8 @@ result_estr TEstrazione::estrai()
|
|||||||
return estr_stop;
|
return estr_stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non so come usare questi 18 caaratteri...
|
// Non so come usare questi 18 caratteri...
|
||||||
// Ci metto un po' di roba anche se sono dati gia' noti in altri campi (I know..) + un numero incrementale.
|
// Uso dati anche se gia' noti in altri campi (I know..) + un numero incrementale.
|
||||||
_head.id_estr.cut(0) << today.date2ansi() << (_head.flag_prov ? "P" : "D") << (!_escluso ? "N" : "X") <<
|
_head.id_estr.cut(0) << today.date2ansi() << (_head.flag_prov ? "P" : "D") << (!_escluso ? "N" : "X") <<
|
||||||
next_estr_today(_head.tipo_doc);
|
next_estr_today(_head.tipo_doc);
|
||||||
_head.user = user();
|
_head.user = user();
|
||||||
@ -343,9 +398,8 @@ result_estr TEstrazione::estrai()
|
|||||||
if (_escluso)
|
if (_escluso)
|
||||||
set_dates(); // Se escluso imposto data inizio e fine uguali
|
set_dates(); // Se escluso imposto data inizio e fine uguali
|
||||||
|
|
||||||
// Scrivo record estrazione in stato '01'.
|
// Scrivo record estrazione (in stato '01': in diagnostica).
|
||||||
const bool ok = scrivi_testata_su_db();
|
bool ok = insert_into_drd();
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
TString msg;
|
TString msg;
|
||||||
@ -357,9 +411,9 @@ result_estr TEstrazione::estrai()
|
|||||||
|
|
||||||
// Faccio partire la diagnostica e mi salvo il nuovo stato.
|
// Faccio partire la diagnostica e mi salvo il nuovo stato.
|
||||||
diagnostica_mov();
|
diagnostica_mov();
|
||||||
|
ok &= insert_into_f9movestr();
|
||||||
|
ok &= update_drd_stato_estr();
|
||||||
|
|
||||||
//_esclusi.clear();
|
|
||||||
//_esclusi.insert(_esclusi.end(), row);
|
|
||||||
if (_head.stato_estr == D_GEST_ERR)
|
if (_head.stato_estr == D_GEST_ERR)
|
||||||
{
|
{
|
||||||
warning_box("Attenzione l'estrazione ha prodotto degli errori.\n" \
|
warning_box("Attenzione l'estrazione ha prodotto degli errori.\n" \
|
||||||
@ -367,12 +421,15 @@ result_estr TEstrazione::estrai()
|
|||||||
// Se in errore, esporto lista errori sul db
|
// Se in errore, esporto lista errori sul db
|
||||||
if (!export_error_list())
|
if (!export_error_list())
|
||||||
warning_box("Errore scrittura db. Controllare log errori.");
|
warning_box("Errore scrittura db. Controllare log errori.");
|
||||||
|
|
||||||
return estr_diag_err; // Errore diagnostica gestionale
|
return estr_diag_err; // Errore diagnostica gestionale
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se va tutto ben fino a qui, posso andare a scrivere nella
|
// Se va tutto ben fino a qui, posso andare a scrivere nella
|
||||||
// tabella IVA i movimenti.
|
// tabella IVA i movimenti. F9IVA
|
||||||
return estrazione_iva() ? estr_ok : estr_err_db_iva;
|
const result_estr res = estrazione_iva() ? estr_ok : estr_err_db_iva;
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TEstrazione::estrazione_iva(bool escluso)
|
bool TEstrazione::estrazione_iva(bool escluso)
|
||||||
@ -486,7 +543,7 @@ TEstrazione::TEstrazione(const TString& ambiente, const bool flag_prov, const ch
|
|||||||
|
|
||||||
_escluso = escluso;
|
_escluso = escluso;
|
||||||
|
|
||||||
_error_sql = new fstream;
|
_error_sql = new ofstream;
|
||||||
_error_sql->open("f9_TEstrazione_error_sql.txt");
|
_error_sql->open("f9_TEstrazione_error_sql.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,10 +589,11 @@ void TF9_dberr::add(const long num)
|
|||||||
|
|
||||||
bool TF9_dberr::send()
|
bool TF9_dberr::send()
|
||||||
{
|
{
|
||||||
fp_db().sq_set_exec(_insert);
|
const bool ok = fp_db().sq_set_exec(_insert) && fp_db().sq_commit();
|
||||||
write_sqlerrlog(_insert);
|
if(!ok)
|
||||||
|
write_sqlerrlog(_insert);
|
||||||
_insert.cut(0) << "INSERT INTO " F9_ERR " VALUES ()";
|
_insert.cut(0) << "INSERT INTO " F9_ERR " VALUES ()";
|
||||||
return true;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TF9_dberr::del_err(const TString& id_estr, int numreg)
|
void TF9_dberr::del_err(const TString& id_estr, int numreg)
|
||||||
@ -614,7 +672,7 @@ void TCategorie_doc::load_all()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TCategorie_doc::classe_doc* TCategorie_doc::causcont2cat(const char* caus)
|
std::shared_ptr<TCategorie_doc::classe_doc> TCategorie_doc::causcont2cat(const char* caus)
|
||||||
{
|
{
|
||||||
const TCausale c(caus);
|
const TCausale c(caus);
|
||||||
const TString& tipodoc = c.tipo_doc();
|
const TString& tipodoc = c.tipo_doc();
|
||||||
@ -645,11 +703,10 @@ TCategorie_doc::classe_doc* TCategorie_doc::causcont2cat(const char* caus)
|
|||||||
caus_sost = "TD04";
|
caus_sost = "TD04";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const vector<classe_doc>::iterator it = find(class_sost, caus_sost, op_cee);
|
const vector<classe_doc>::iterator it = find(class_sost, caus_sost, op_cee);
|
||||||
classe_doc* cd = nullptr;
|
std::shared_ptr<classe_doc> cd = nullptr;
|
||||||
if (it != _rows.end())
|
if (it != _rows.end())
|
||||||
cd = &*it; // todo: Test it!
|
cd = std::make_shared<classe_doc>(*it); // Creo una copia e la restituisco. todo: Test it!
|
||||||
return cd;
|
return cd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
134
src/f9/f9lib01.h
134
src/f9/f9lib01.h
@ -36,15 +36,63 @@ enum result_estr
|
|||||||
enum state_fppro
|
enum state_fppro
|
||||||
{
|
{
|
||||||
correct = 1,
|
correct = 1,
|
||||||
reg_with_err = -1,
|
reg_with_err = -1, // Movimento associato male con FPPRO
|
||||||
not_fa = -10, // Non e' fattura acquisti
|
not_fa = -10, // Non e' fattura acquisti
|
||||||
guessed = 100,
|
guessed = 100,
|
||||||
no_guessed = 0,
|
no_guessed = 0,
|
||||||
null_state = -100
|
null_state = -100,
|
||||||
|
err_read_db = 999 // Errore lettura da fppro
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _movimento_t
|
class TCategorie_doc
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
struct classe_doc
|
||||||
|
{
|
||||||
|
TString catdoc;
|
||||||
|
TString descr;
|
||||||
|
TString class_sost;
|
||||||
|
TString caus_sost;
|
||||||
|
TString causcont;
|
||||||
|
TString tipocaus;
|
||||||
|
TString tipomov;
|
||||||
|
TString opcee;
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
vector<classe_doc> _rows;
|
||||||
|
|
||||||
|
vector<classe_doc>::iterator find(const TString& class_sost, const TString& caus_sost, const TString& op_cee);
|
||||||
|
void load_all();
|
||||||
|
public:
|
||||||
|
std::shared_ptr<classe_doc> causcont2cat(const char* caus);
|
||||||
|
void reload()
|
||||||
|
{
|
||||||
|
_rows.clear();
|
||||||
|
load_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
TCategorie_doc() { load_all(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
inline TCategorie_doc& categorie_doc()
|
||||||
|
{
|
||||||
|
static unique_ptr<TCategorie_doc> cd = nullptr;
|
||||||
|
if (cd == nullptr)
|
||||||
|
cd = make_unique<TCategorie_doc>();
|
||||||
|
else
|
||||||
|
cd->reload();
|
||||||
|
return *cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct movimento_t
|
||||||
|
{
|
||||||
|
enum err_mov
|
||||||
|
{
|
||||||
|
no_err, // Estratto normalmente
|
||||||
|
escluso, // Movimento con flag escluso
|
||||||
|
no_catdoc // Nessuna cat. doc. riconosciuta per questo movimento, o non e' una fattura
|
||||||
|
};
|
||||||
|
|
||||||
bool err;
|
bool err;
|
||||||
int numreg;
|
int numreg;
|
||||||
TDate datareg;
|
TDate datareg;
|
||||||
@ -57,10 +105,32 @@ typedef struct _movimento_t
|
|||||||
TString ragsoc;
|
TString ragsoc;
|
||||||
TString reg_protiva;
|
TString reg_protiva;
|
||||||
TString descr;
|
TString descr;
|
||||||
state_fppro state;
|
state_fppro state{ null_state };
|
||||||
TString descr_err;
|
TString descr_err;
|
||||||
|
bool estratto{ true };
|
||||||
|
err_mov descr_estr{ no_err };
|
||||||
|
std::shared_ptr<TCategorie_doc::classe_doc> catdoc;
|
||||||
|
|
||||||
TString get(int i) const
|
static const char* err_mov2name(const err_mov descr_estr)
|
||||||
|
{
|
||||||
|
switch (descr_estr)
|
||||||
|
{
|
||||||
|
case no_err:
|
||||||
|
return "OK";
|
||||||
|
case escluso:
|
||||||
|
return "Il movimemnto e' segnato come escluso. Saltato.";
|
||||||
|
case no_catdoc:
|
||||||
|
return "Nessuna categoria documentale riconosciuta per questo movimento, o non e' una fattura.";
|
||||||
|
default: return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* get_descr_estr() const
|
||||||
|
{
|
||||||
|
return err_mov2name(descr_estr);
|
||||||
|
}
|
||||||
|
|
||||||
|
TString get(const int i) const
|
||||||
{
|
{
|
||||||
TString a;
|
TString a;
|
||||||
switch (i)
|
switch (i)
|
||||||
@ -85,20 +155,20 @@ typedef struct _movimento_t
|
|||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} movimento_t;
|
};
|
||||||
|
|
||||||
class TEstrazione : public TObject
|
class TEstrazione : public TObject
|
||||||
{
|
{
|
||||||
drd _head;
|
drd _head;
|
||||||
vector<movimento_t> _movs;
|
vector<movimento_t> _movs;
|
||||||
fstream* _error_sql;
|
ofstream* _error_sql;
|
||||||
bool _escluso;
|
bool _escluso;
|
||||||
const TString _descr;
|
const TString _descr;
|
||||||
|
|
||||||
/** Aggiorna stato estrazione. Utilizzato ad esempio dopo la diagnostica per riportare
|
/** Aggiorna stato estrazione. Utilizzato ad esempio dopo la diagnostica per riportare
|
||||||
* il nuovo stato sul db.
|
* il nuovo stato sul db.
|
||||||
*/
|
*/
|
||||||
void aggiorna_stato() const;
|
bool update_drd_stato_estr() const;
|
||||||
static const char* categoria_doc();
|
static const char* categoria_doc();
|
||||||
static const char* caus_sos(const TLocalisamfile& mov, TipoIVA acquisti);
|
static const char* caus_sos(const TLocalisamfile& mov, TipoIVA acquisti);
|
||||||
/** CHECK RIFERIMENTO FPPRO
|
/** CHECK RIFERIMENTO FPPRO
|
||||||
@ -117,10 +187,10 @@ class TEstrazione : public TObject
|
|||||||
static bool is_doc_xml(const TLocalisamfile& mov);
|
static bool is_doc_xml(const TLocalisamfile& mov);
|
||||||
|
|
||||||
static TString& drd_attr();
|
static TString& drd_attr();
|
||||||
TString& drd_tovalues() const;
|
TString& drd_tovalues() const;
|
||||||
bool new_extr() const; /**< See \a scrivi_testata_su_db(). */
|
bool insert_into_drd() const; /**< Scrittura testata estrazione. Tabella F9DRD. */
|
||||||
bool scrivi_testata_su_db() const; /**< Scrittura testata estrazione. Tabella F9DRD. Chiama \a new_extr(). */
|
bool insert_into_f9movestr() const; /**< Scrittura su db dell'elenco di movimenti presi. */
|
||||||
bool export_error_list() const; /**< Esporta sheet controllo fatture sul db. */
|
bool export_error_list() const; /**< Esporta sheet controllo fatture sul db. */
|
||||||
|
|
||||||
/** Controlla ultimo id estrazione della giornata e in base al tipo di estrazione,
|
/** Controlla ultimo id estrazione della giornata e in base al tipo di estrazione,
|
||||||
* genera il progressivo seguente. Chiamata da \a estrai() e \a estrai_single().
|
* genera il progressivo seguente. Chiamata da \a estrai() e \a estrai_single().
|
||||||
@ -199,44 +269,4 @@ public:
|
|||||||
TF9_dberr();
|
TF9_dberr();
|
||||||
};
|
};
|
||||||
|
|
||||||
class TCategorie_doc
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct classe_doc
|
|
||||||
{
|
|
||||||
TString catdoc;
|
|
||||||
TString descr;
|
|
||||||
TString class_sost;
|
|
||||||
TString caus_sost;
|
|
||||||
TString causcont;
|
|
||||||
TString tipocaus;
|
|
||||||
TString tipomov;
|
|
||||||
TString opcee;
|
|
||||||
};
|
|
||||||
private:
|
|
||||||
vector<classe_doc> _rows;
|
|
||||||
|
|
||||||
vector<classe_doc>::iterator find(const TString& class_sost, const TString& caus_sost, const TString& op_cee);
|
|
||||||
void load_all();
|
|
||||||
public:
|
|
||||||
classe_doc* causcont2cat(const char* caus);
|
|
||||||
void reload()
|
|
||||||
{
|
|
||||||
_rows.clear();
|
|
||||||
load_all();
|
|
||||||
}
|
|
||||||
|
|
||||||
TCategorie_doc() { load_all(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
inline TCategorie_doc& categorie_doc()
|
|
||||||
{
|
|
||||||
static unique_ptr<TCategorie_doc> cd = nullptr;
|
|
||||||
if(cd == nullptr)
|
|
||||||
cd = make_unique<TCategorie_doc>();
|
|
||||||
else
|
|
||||||
cd->reload();
|
|
||||||
return *cd;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // #ifndef __F901001_H__
|
#endif // #ifndef __F901001_H__
|
||||||
|
8
src/f9/sql/f90104.sql
Normal file
8
src/f9/sql/f90104.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
CREATE TABLE F9MOVESTR(
|
||||||
|
IDESTR CHAR(18) NOT NULL,
|
||||||
|
NUMREG NUMERIC(7,0) NOT NULL,
|
||||||
|
DATAREG DATE,
|
||||||
|
ESTRATTO BIT DEFAULT '0' NOT NULL,
|
||||||
|
DESCR_ERR VARCHAR(1024)
|
||||||
|
);
|
||||||
|
ALTER TABLE F9MOVESTR ADD CONSTRAINT F9MOVESTR_PK PRIMARY KEY(IDESTR, NUMREG);
|
Loading…
x
Reference in New Issue
Block a user