Patch level : 12.0 972
Files correlati : f90.exe d181.des f181.dir/.trr f9ProspIntegr.rep masks f90104.sql Commento : - Rimosso controllo vendite in ogni caso. Incompatibilita' con diverse situazioni tra cui note di credito interne che non sono fatture elettroniche. - Rimosso flag check vendite e il suo utilizzo nel codice. - Aggiornamento stato estrazione solo dopo scrittura f9iva. - Migliorata e resa piu' sicura query per iva aggiungendo tipi diversi e controllo lunghezza colonna. - Corretti nomi campi, che venivano invertiti IVA_ANNPROT e IVA_NUMPROT. - Aggiunto controllo in apertura controllo estrazione solo se il pacchetto e' in errore diag. gest. - Spostata in una classe separata la maschera per l'apertura del pacchetto (Apri estr.). - Corretta modifica f9wa rimaneva vuoto il record in alcuni casi. - Aggiunta possibilita' di esclusione movimenti dall'Apri estr.
This commit is contained in:
parent
907d3da0f8
commit
cf3c4d54aa
@ -28,18 +28,18 @@
|
||||
#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) */
|
||||
const TString v_check_sums[] = {
|
||||
"SUMFILE0100e e d 1 8 5 f a 8 f 1 2 2 0 1 0 f 4 2 6 d 9 9 a 2 3 f 2 6 c 8 8",
|
||||
"SUMFILE01023 5 3 3 3 a 5 e 3 b 4 9 e d 3 1 9 8 0 8 5 1 2 4 3 f 8 3 b 9 4 d",
|
||||
"SUMFILE01040 a f f e 3 2 7 4 1 c d 7 4 1 8 1 4 c e 2 c a b 2 d 9 9 2 f 6 b" };
|
||||
|
||||
TString get_checksum(const int version)
|
||||
{
|
||||
TString cs = v_check_sums[(version - 100) / 2];
|
||||
cs.ltrim(11);
|
||||
cs.replace(" ", "");
|
||||
return cs;
|
||||
}
|
||||
//const TString v_check_sums[] = {
|
||||
// "SUMFILE0100e e d 1 8 5 f a 8 f 1 2 2 0 1 0 f 4 2 6 d 9 9 a 2 3 f 2 6 c 8 8",
|
||||
// "SUMFILE01023 5 3 3 3 a 5 e 3 b 4 9 e d 3 1 9 8 0 8 5 1 2 4 3 f 8 3 b 9 4 d",
|
||||
// "SUMFILE01040 a f f e 3 2 7 4 1 c d 7 4 1 8 1 4 c e 2 c a b 2 d 9 9 2 f 6 b" };
|
||||
//
|
||||
//TString get_checksum(const int version)
|
||||
//{
|
||||
// TString cs = v_check_sums[(version - 100) / 2];
|
||||
// cs.ltrim(11);
|
||||
// cs.replace(" ", "");
|
||||
// return cs;
|
||||
//}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// Utilities
|
||||
@ -141,7 +141,7 @@ int TEstrai_mask::estrai()
|
||||
false, // Estrazione di un escluso
|
||||
&dataini, // Data estr. mov dal
|
||||
&dataend, // Data estr. mov al
|
||||
F9CONF.get_has_checkvend(), // Flag in configurazione per aggiungere controllo f.e. in vendite
|
||||
false, //F9CONF.get_has_checkvend(), // Flag in configurazione per aggiungere controllo f.e. in vendite
|
||||
F9CONF.get_has_cartexp() // Flag per estrarre anche i doc. cartacei
|
||||
);
|
||||
|
||||
@ -352,48 +352,40 @@ bool TMonitor_mask::save_conf_handler(TMask_field& f, KEY key)
|
||||
|
||||
bool TMonitor_mask::open_mov_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TMask& sf = f.mask();
|
||||
TRectype mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, sf.get(F_NUMREG));
|
||||
return open_mov(mov);
|
||||
}
|
||||
|
||||
TMask& TMonitor_mask::inclusi_mask()
|
||||
{
|
||||
if (_inclusi_mask == nullptr)
|
||||
if(key == K_SPACE)
|
||||
{
|
||||
_inclusi_mask = std::make_unique<TMask>("f90100d.msk");
|
||||
TMask& m = *_inclusi_mask;
|
||||
((TSheet_field&)m.field(S_INCL)).set_notify(TF9_app::select_escl_notify);
|
||||
// Handler dello sheet per selezione singola
|
||||
|
||||
TMask& sheet_m = ((TSheet_field&)m.field(S_INCL)).sheet_mask(); // Maschera dei campi dello sheet
|
||||
sheet_m.set_handler(DLG_USER, open_mov_handler); // Bottone collega movimento
|
||||
|
||||
TMask& sheet_res = ((TSheet_field&)m.field(S_RES)).sheet_mask();
|
||||
sheet_res.set_handler(DLG_USER, open_mov_handler);
|
||||
TMask& sf = f.mask();
|
||||
TRectype mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, sf.get(F_NUMREG));
|
||||
return open_mov(mov);
|
||||
}
|
||||
return *_inclusi_mask;
|
||||
return true;
|
||||
}
|
||||
|
||||
void TMonitor_mask::controllo_errori() const
|
||||
{
|
||||
TString id_estr;
|
||||
TSheet_field& sf = sfield(S_ELAB);
|
||||
bool flag = false;
|
||||
TString id_estr, stato;
|
||||
TSheet_field& sf = sfield(S_ELAB);
|
||||
bool flag = false;
|
||||
FOR_EACH_SHEET_ROW(sf, nr, row)
|
||||
{
|
||||
if (row->get(0)[0] == 'X')
|
||||
{
|
||||
id_estr << row->get(cid2index(F_IDESTR));
|
||||
stato << row->get(cid2index(F_ISTATOESTR));
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
TControllo_mask controllo(F9CONF.get_ambiente(), id_estr);
|
||||
controllo.run();
|
||||
if(stato.cut(2) == D_GEST_ERR)
|
||||
{
|
||||
TControllo_mask controllo(F9CONF.get_ambiente(), id_estr);
|
||||
controllo.run();
|
||||
}
|
||||
else
|
||||
warning_box("Impossibile controllare un'estrazione che non e'\nin stato di %s ('" D_GEST_ERR "').", TF9_app::traduci_stato(D_GEST_ERR));
|
||||
}
|
||||
else
|
||||
warning_box("Selezionare un'estrazione.");
|
||||
@ -538,110 +530,11 @@ bool TMonitor_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TMonitor_mask::on_key(const KEY key)
|
||||
{
|
||||
return TAutomask::on_key(key);
|
||||
}
|
||||
|
||||
void TMonitor_mask::fill_estr(const char* codsoc, const char* id, const char tipodoc) const
|
||||
{
|
||||
TString query;
|
||||
query << "SELECT " IVA_SEZIVA ", " IVA_DATADOC ", " IVA_NUMDOC ", " IVA_NPROT "\n"
|
||||
"FROM " F9_IVA "\n"
|
||||
"WHERE " IVA_CODSOC " = '" << codsoc << "' AND " IVA_IDLAN " = '" << id << "'";
|
||||
// REG + DATAREG + PROTIVA + DATAINC + DATA74TER + NUMREG
|
||||
TString sql;
|
||||
TSQL_recordset rec("");
|
||||
fp_db().sq_set_exec(query, false);
|
||||
TSheet_field& sf = _inclusi_mask->sfield(S_ESCL);
|
||||
sf.destroy();
|
||||
|
||||
TProgress_monitor prog(fp_db().sq_items(), "Caricamento dati estrazione...");
|
||||
for (bool ok = fp_db().sq_next(); ok; ok = fp_db().sq_next())
|
||||
{
|
||||
if (!prog.add_status())
|
||||
break;
|
||||
|
||||
sql.cut(0) << "SELECT NUMREG, DATAREG, DATADOC, CODCAUS, TIPODOC, MESELIQ, NUMDOC, TOTDOC, CODCF, REG, PROTIVA, DESCR\n"
|
||||
"FROM MOV\n"
|
||||
"WHERE REG = '" << fp_db().sq_get(IVA_SEZIVA) << "' AND DATADOC=" << TDate(fp_db().sq_get_date(IVA_DATADOC)).date2ansi() <<
|
||||
" AND PROTIVA = " << fp_db().sq_get(IVA_NPROT);
|
||||
rec.set(sql);
|
||||
rec.move_first();
|
||||
TToken_string& r = sf.row(-1);
|
||||
r.add(" ", 0);
|
||||
r.add(rec.get(0).as_string()); // Numreg
|
||||
r.add(rec.get(1).as_string()); // Data reg
|
||||
r.add(rec.get(2).as_string()); // Data doc
|
||||
TString codcaus; codcaus << rec.get(3).as_string();
|
||||
const int len = codcaus.len();
|
||||
for (int i = 0; i < 3 - len; ++i)
|
||||
codcaus.add_front("0");
|
||||
r.add(codcaus); // Cod caus
|
||||
r.add(rec.get(4).as_string()); // Tipo doc
|
||||
r.add(rec.get(5).as_string()); // Mese liq
|
||||
r.add(rec.get(6).as_string()); // Num doc
|
||||
r.add(rec.get(7).as_string()); // Tot doc
|
||||
r.add(rec.get(8).as_string()); // Clifo
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.put(CLI_CODCF, rec.get(8).as_string());
|
||||
clifo.put(CLI_TIPOCF, tipodoc == 'A' ? "F" : "C");
|
||||
clifo.read();
|
||||
r.add(clifo.get(CLI_RAGSOC)); // Rag soc
|
||||
r.add(TString(rec.get(9).as_string()) << "/" << rec.get(10).as_string()); // Prot iva
|
||||
r.add(rec.get(11).as_string()); // Descr
|
||||
}
|
||||
}
|
||||
|
||||
void TMonitor_mask::fill_res(const char* codsoc, const char* id, const char tipodoc) const
|
||||
{
|
||||
TString query;
|
||||
query << "SELECT * FROM " F9_MOVESTR "\n"
|
||||
"WHERE " MES_CODSOC " = '" << codsoc << "' AND " MES_IDESTR " = '" << id << "'";
|
||||
|
||||
fp_db().sq_set_exec(query, false);
|
||||
TSheet_field& sf = _inclusi_mask->sfield(S_RES);
|
||||
sf.destroy();
|
||||
|
||||
TProgress_monitor prog(fp_db().sq_items(), "Caricamento dati estrazione...");
|
||||
for (bool ok = fp_db().sq_next(); ok; ok = fp_db().sq_next())
|
||||
{
|
||||
if (!prog.add_status())
|
||||
break;
|
||||
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, fp_db().sq_get(MES_NUMREG));
|
||||
mov.read();
|
||||
TToken_string& r = sf.row(-1);
|
||||
r.add(fp_db().sq_get_int(MES_ESTR) ? "X" : " ", 0); // Estratto
|
||||
r.add(mov.get (MOV_NUMREG)); // Numreg
|
||||
r.add(mov.get_date(MOV_DATAREG)); // Data reg
|
||||
r.add(mov.get_date(MOV_DATADOC)); // Data doc
|
||||
r.add(mov.get (MOV_CODCAUS)); // Cod caus
|
||||
r.add(mov.get (MOV_TIPODOC)); // Tipo doc
|
||||
r.add(mov.get_int (MOV_MESELIQ)); // Mese liq
|
||||
r.add(mov.get (MOV_NUMDOC)); // Num doc
|
||||
r.add(mov.get_real(MOV_TOTDOC)); // Tot doc
|
||||
r.add(mov.get_int (MOV_CODCF)); // Clifo
|
||||
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.put(CLI_CODCF, mov.get(MOV_CODCF));
|
||||
clifo.put(CLI_TIPOCF, mov.get(MOV_TIPO));
|
||||
clifo.read();
|
||||
|
||||
r.add(clifo.get(CLI_RAGSOC)); // Rag soc
|
||||
r.add(TString(mov.get(MOV_REG)) << "/" << mov.get(MOV_PROTIVA)); // Prot iva
|
||||
r.add(mov.get(MOV_DESCR)); // Descr
|
||||
r.add(fp_db().sq_get(MES_ERR)); // Descrizione errore
|
||||
}
|
||||
}
|
||||
|
||||
void TMonitor_mask::open_mostra_estrazione()
|
||||
{
|
||||
TMask& msk = inclusi_mask();
|
||||
|
||||
TString id;
|
||||
TToken_string* _row = nullptr;
|
||||
static TString last_fill_id = 0;
|
||||
TString id;
|
||||
TToken_string* row_estrazione = nullptr;
|
||||
FOR_EACH_SHEET_ROW(sfield(S_ELAB), nr, row)
|
||||
{
|
||||
if (row->get(0)[0] == 'X')
|
||||
@ -652,34 +545,30 @@ void TMonitor_mask::open_mostra_estrazione()
|
||||
"Usare il 'Controllo Estrazioni' per vedere i movimenti in errore.");
|
||||
return;
|
||||
}
|
||||
_row = row;
|
||||
row_estrazione = row;
|
||||
id = row->get(cid2index(F_IDESTR));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_row == nullptr)
|
||||
if (row_estrazione == nullptr)
|
||||
{
|
||||
message_box("Selezionare un pacchetto.");
|
||||
return;
|
||||
}
|
||||
msk.set(F_IIDESTR, _row->get(cid2index(F_IDESTR)));
|
||||
msk.set(F_IDATA, _row->get(cid2index(F_DATAESTR)));
|
||||
msk.set(F_IPROV, _row->get(cid2index(F_PROV_B)));
|
||||
msk.set(F_ITIPOD, _row->get(cid2index(F_TIPODOC)));
|
||||
msk.set(F_IDAL, _row->get(cid2index(F_DATADAL)));
|
||||
msk.set(F_IAL, _row->get(cid2index(F_DATAAL)));
|
||||
|
||||
const TString& codsoc = F9CONF.get_ambiente();
|
||||
const char tipodoc = _row->get(cid2index(F_TIPODOC))[0];
|
||||
|
||||
static TString last_fill_id = 0;
|
||||
if (last_fill_id != id)
|
||||
{
|
||||
fill_estr(codsoc, id, tipodoc);
|
||||
fill_res (codsoc, id, tipodoc);
|
||||
_inclusi_mask = std::make_unique<TApri_estr_msk>();
|
||||
_inclusi_mask->set_from_row_estrazione(*row_estrazione);
|
||||
|
||||
const TString& codsoc = F9CONF.get_ambiente();
|
||||
const char tipodoc = row_estrazione->get(cid2index(F_TIPODOC))[0];
|
||||
|
||||
_inclusi_mask->fill_estr();
|
||||
_inclusi_mask->fill_res ();
|
||||
last_fill_id = id;
|
||||
}
|
||||
msk.run();
|
||||
_inclusi_mask->run();
|
||||
}
|
||||
|
||||
void TMonitor_mask::open_win_estr()
|
||||
@ -689,7 +578,7 @@ void TMonitor_mask::open_win_estr()
|
||||
else f9_app().run_estr_msk();
|
||||
}
|
||||
|
||||
void TMonitor_mask::open_win_conf() const
|
||||
void TMonitor_mask::open_win_conf()
|
||||
{
|
||||
static TMask* m = nullptr;
|
||||
|
||||
@ -706,7 +595,7 @@ void TMonitor_mask::open_win_conf() const
|
||||
m->add_groupbox (CF_ADDRGROUP, 0, "Indicare percorso documenti cartacei:", 1, 3, 69, 3, "");
|
||||
m->add_string (CF_ADDRDOC, 0, "Percorso", 2, 4, 256, "", 40);
|
||||
m->add_groupbox (CF_ESTRGROUP, 0, "Opzioni estrazione", 1, 6, 69, 5, "");
|
||||
m->add_boolean (CF_CHECKVEND, 0, "Abilita controllo movimenti di vendita: esiste il documento elettronico inviato.", 2, 7);
|
||||
m->add_boolean (CF_CHECKVEND, 0, "Abilita controllo movimenti di vendita: esiste il documento elettronico inviato.", 2, 7, "D");
|
||||
m->add_boolean (CF_CARTEXP, 0, "Estrai anche documenti cartacei", 2, 8);
|
||||
m->add_boolean (CF_VIEWMOVPRE, 0, "Visualizza movimenti preparati prima di lanciare l'estrazione", 2, 9, "D");
|
||||
|
||||
@ -714,7 +603,7 @@ void TMonitor_mask::open_win_conf() const
|
||||
|
||||
m->set(CF_CODSOC, F9CONF.get_ambiente());
|
||||
m->set(CF_ADDRDOC, F9CONF.get_addr_doc());
|
||||
m->set(CF_CHECKVEND, F9CONF.get_has_checkvend());
|
||||
m->set(CF_CHECKVEND, "");//F9CONF.get_has_checkvend() ? "X" : "";
|
||||
m->set(CF_CARTEXP, F9CONF.get_has_cartexp());
|
||||
m->set(CF_VIEWMOVPRE, F9CONF.get_viewmov());
|
||||
}
|
||||
@ -1059,7 +948,224 @@ TControllo_mask::TControllo_mask(const char* codsoc, const char* id_estr, bool e
|
||||
fill();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// TApri_estr_msk
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TApri_estr_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case DLG_USER:
|
||||
if(e == fe_button)
|
||||
{
|
||||
TSheet_field& sf = sfield(S_INCL);
|
||||
TToken_string& row = sf.row(sf.selected());
|
||||
TRectype mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, row.get(sf.cid2index(F_NUMREG)));
|
||||
open_mov(mov);
|
||||
}
|
||||
break;
|
||||
case B_ISELESCL:
|
||||
if (e == fe_button)
|
||||
inselect_handler();
|
||||
break;
|
||||
case B_IESCL:
|
||||
if (e == fe_button)
|
||||
inescludi_handler();
|
||||
break;
|
||||
case B_IALLESCL:
|
||||
if (e == fe_button)
|
||||
inall_handler();
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TApri_estr_msk::inall_handler() const
|
||||
{
|
||||
TSheet_field& sf = sfield(S_INCL);
|
||||
sf.hide();
|
||||
const bool active = *sf.row(0).get(cid2index(F_IESCLUDI)) == 'S';
|
||||
FOR_EACH_SHEET_ROW(sf, nr, row)
|
||||
row->add(active ? "N" : "S", cid2index(F_IESCLUDI));
|
||||
sf.force_update();
|
||||
sf.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TApri_estr_msk::inescludi_handler() const
|
||||
{
|
||||
conferma_esclusi();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TApri_estr_msk::inselect_handler() const
|
||||
{
|
||||
static bool sel_esclusi = false;
|
||||
if (_provv || TF9_app::is_stato_errore(_statoestr))
|
||||
{
|
||||
sel_esclusi = !sel_esclusi;
|
||||
field(B_IESCL).enable(sel_esclusi);
|
||||
field(B_IALLESCL).enable(sel_esclusi);
|
||||
sfield(S_INCL).enable_column(cid2index(F_IESCLUDI), sel_esclusi);
|
||||
sfield(S_INCL).force_update();
|
||||
return true;
|
||||
}
|
||||
warning_box("E' possibile escludere i movimenti solo per pacchetti bloccati\nin stato di errore '" D_WA_ERR " - %s'",
|
||||
TF9_app::traduci_stato(D_WA_ERR));
|
||||
return false;
|
||||
}
|
||||
|
||||
void TApri_estr_msk::conferma_esclusi() const
|
||||
{
|
||||
TSheet_field& sf = sfield(S_INCL);
|
||||
sf.hide();
|
||||
FOR_EACH_SHEET_ROW(sf, nr, row)
|
||||
{
|
||||
TLocalisamfile movs(LF_MOV);
|
||||
movs.put(MOV_NUMREG, row->get_int(cid2index(F_NUMREG)));
|
||||
movs.read();
|
||||
if (*row->get(cid2index(F_IESCLUDI)) == 'S')
|
||||
{
|
||||
const TDate today(TODAY);
|
||||
TToken_string stato("", ';');
|
||||
stato.add("", 0);
|
||||
stato.add(today.date2ansi());
|
||||
stato.add("X");
|
||||
movs.put(MOV_ELABF9, stato);
|
||||
movs.rewrite();
|
||||
row->add("X", cid2index(F_IESCLUSO));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (movs.get(MOV_ELABF9).full())
|
||||
{
|
||||
movs.put(MOV_ELABF9, "");
|
||||
row->add("", cid2index(F_IESCLUSO));
|
||||
movs.rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
sf.force_update();
|
||||
sf.show();
|
||||
}
|
||||
|
||||
void TApri_estr_msk::fill_estr() const
|
||||
{
|
||||
TString query;
|
||||
query << "SELECT " IVA_SEZIVA ", " IVA_DATADOC ", " IVA_NUMDOC ", " IVA_NPROT "\n"
|
||||
"FROM " F9_IVA "\n"
|
||||
"WHERE " IVA_CODSOC " = '" << F9CONF.get_ambiente() << "' AND " IVA_IDLAN " = '" << _idestr << "'";
|
||||
// REG + DATAREG + PROTIVA + DATAINC + DATA74TER + NUMREG
|
||||
TString sql;
|
||||
TSQL_recordset rec("");
|
||||
fp_db().sq_set_exec(query, false);
|
||||
TSheet_field& sf = sfield(S_ESCL);
|
||||
sf.hide();
|
||||
sf.destroy();
|
||||
|
||||
TProgress_monitor prog(fp_db().sq_items(), "Caricamento dati estrazione...");
|
||||
for (bool ok = fp_db().sq_next(); ok; ok = fp_db().sq_next())
|
||||
{
|
||||
if (!prog.add_status())
|
||||
break;
|
||||
|
||||
sql.cut(0) << "SELECT NUMREG, DATAREG, DATADOC, CODCAUS, TIPODOC, MESELIQ, NUMDOC, TOTDOC, CODCF, REG, PROTIVA, DESCR, ELABF9\n"
|
||||
"FROM MOV\n"
|
||||
"WHERE REG = '" << fp_db().sq_get(IVA_SEZIVA) << "' AND DATADOC=" << TDate(fp_db().sq_get_date(IVA_DATADOC)).date2ansi() <<
|
||||
" AND PROTIVA = " << fp_db().sq_get(IVA_NPROT);
|
||||
rec.set(sql);
|
||||
rec.move_first();
|
||||
TToken_string& r = sf.row(-1);
|
||||
r.add(" ", 0);
|
||||
r.add(rec.get(0).as_string()); // Numreg
|
||||
r.add(rec.get(1).as_string()); // Data reg
|
||||
r.add(rec.get(2).as_string()); // Data doc
|
||||
TString codcaus; codcaus << rec.get(3).as_string();
|
||||
const int len = codcaus.len();
|
||||
for (int i = 0; i < 3 - len; ++i)
|
||||
codcaus.add_front("0");
|
||||
r.add(codcaus); // Cod caus
|
||||
r.add(rec.get(4).as_string()); // Tipo doc
|
||||
r.add(rec.get(5).as_string()); // Mese liq
|
||||
r.add(rec.get(6).as_string()); // Num doc
|
||||
r.add(rec.get(7).as_string()); // Tot doc
|
||||
r.add(rec.get(8).as_string()); // Clifo
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.put(CLI_CODCF, rec.get(8).as_string());
|
||||
clifo.put(CLI_TIPOCF, _tipodoc == 'A' ? "F" : "C");
|
||||
clifo.read();
|
||||
r.add(clifo.get(CLI_RAGSOC)); // Rag soc
|
||||
r.add(TString(rec.get(9).as_string()) << "/" << rec.get(10).as_string()); // Prot iva
|
||||
r.add(rec.get(11).as_string()); // Descr
|
||||
r.add(""); // Flag escludi
|
||||
r.add(TToken_string(rec.get(12).as_string(), ';').get_bool(2)); // Escluso
|
||||
}
|
||||
sf.force_update();
|
||||
sf.show();
|
||||
}
|
||||
|
||||
void TApri_estr_msk::fill_res() const
|
||||
{
|
||||
TString query;
|
||||
query << "SELECT * FROM " F9_MOVESTR "\n"
|
||||
"WHERE " MES_CODSOC " = '" << F9CONF.get_ambiente() << "' AND " MES_IDESTR " = '" << _idestr << "'";
|
||||
|
||||
fp_db().sq_set_exec(query, false);
|
||||
TSheet_field& sf = sfield(S_RES);
|
||||
sf.destroy();
|
||||
|
||||
TProgress_monitor prog(fp_db().sq_items(), "Caricamento dati estrazione...");
|
||||
for (bool ok = fp_db().sq_next(); ok; ok = fp_db().sq_next())
|
||||
{
|
||||
if (!prog.add_status())
|
||||
break;
|
||||
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, fp_db().sq_get(MES_NUMREG));
|
||||
mov.read();
|
||||
TToken_string& r = sf.row(-1);
|
||||
r.add(fp_db().sq_get_int(MES_ESTR) ? "X" : " ", 0); // Estratto
|
||||
r.add(mov.get(MOV_NUMREG)); // Numreg
|
||||
r.add(mov.get_date(MOV_DATAREG)); // Data reg
|
||||
r.add(mov.get_date(MOV_DATADOC)); // Data doc
|
||||
r.add(mov.get(MOV_CODCAUS)); // Cod caus
|
||||
r.add(mov.get(MOV_TIPODOC)); // Tipo doc
|
||||
r.add(mov.get_int(MOV_MESELIQ)); // Mese liq
|
||||
r.add(mov.get(MOV_NUMDOC)); // Num doc
|
||||
r.add(mov.get_real(MOV_TOTDOC)); // Tot doc
|
||||
r.add(mov.get_int(MOV_CODCF)); // Clifo
|
||||
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.put(CLI_CODCF, mov.get(MOV_CODCF));
|
||||
clifo.put(CLI_TIPOCF, mov.get(MOV_TIPO));
|
||||
clifo.read();
|
||||
|
||||
r.add(clifo.get(CLI_RAGSOC)); // Rag soc
|
||||
r.add(TString(mov.get(MOV_REG)) << "/" << mov.get(MOV_PROTIVA)); // Prot iva
|
||||
r.add(mov.get(MOV_DESCR)); // Descr
|
||||
r.add(fp_db().sq_get(MES_ERR)); // Descrizione errore
|
||||
}
|
||||
}
|
||||
|
||||
void TApri_estr_msk::set_from_row_estrazione(TToken_string& row_estrazione)
|
||||
{
|
||||
set(F_IIDESTR, _idestr.cut(0) << row_estrazione.get(cid2index(F_IDESTR)));
|
||||
set(F_IDATA, _dataestr = row_estrazione.get(cid2index(F_DATAESTR)));
|
||||
set(F_IPROV, _provv = *row_estrazione.get(cid2index(F_PROV_B)) == 'X');
|
||||
set(F_ITIPOD, _tipodoc = *row_estrazione.get(cid2index(F_TIPODOC)));
|
||||
(_statoestr.cut(0) << row_estrazione.get(cid2index(F_STATESTR))).cut(2);
|
||||
set(F_ISTATOESTR, TString(_statoestr) << " - " << TF9_app::traduci_stato(_statoestr));
|
||||
set(F_IDAL, _datadal = row_estrazione.get(cid2index(F_DATADAL)));
|
||||
set(F_IAL, _dataal = row_estrazione.get(cid2index(F_DATAAL)));
|
||||
}
|
||||
|
||||
TApri_estr_msk::TApri_estr_msk() : TAutomask("f90100d.msk")
|
||||
{
|
||||
field(B_IESCL).disable();
|
||||
field(B_IALLESCL).disable();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
@ -1096,6 +1202,11 @@ const char* TF9_app::traduci_stato(const TString& cod)
|
||||
return (const char*)stato;
|
||||
}
|
||||
|
||||
bool TF9_app::is_stato_errore(const TString& stato_etr)
|
||||
{
|
||||
return stato_etr == D_GEST_ERR || stato_etr == D_WA_ERR || stato_etr == D_ERR_SOS;
|
||||
}
|
||||
|
||||
void TF9_app::notify_estraction() const
|
||||
{
|
||||
_msk->fill();
|
||||
@ -1332,9 +1443,13 @@ void TF9_app::edit_wa(TString& old_codsoc) const
|
||||
{
|
||||
TString query;
|
||||
if (!old_codsoc.empty())
|
||||
{
|
||||
query << "DELETE FROM " F9_WA " WHERE " WA_CODSOC " = '" << old_codsoc << "';\n";
|
||||
query << "INSERT INTO " F9_WA " (" WA_CODSOC ", " WA_ADDR_DOC ") VALUES (" <<
|
||||
F9CONF.get_ambiente() << ", " << F9CONF.get_addr_doc() << ");";
|
||||
fp_db().sq_set_exec(query) && fp_db().sq_commit();
|
||||
}
|
||||
query.cut(0) << "INSERT INTO " F9_WA " (" WA_CODSOC ", " WA_ADDR_DOC ") VALUES ('" <<
|
||||
F9CONF.get_ambiente() << "', '" << F9CONF.get_addr_doc() << "');";
|
||||
fp_db().sq_set_exec(query) && fp_db().sq_commit();
|
||||
}
|
||||
|
||||
void TF9_app::print_log()
|
||||
|
@ -49,6 +49,7 @@ class TF9_app : public TSkeleton_application
|
||||
//friend class TEstrai_mask;
|
||||
friend class TMonitor_mask;
|
||||
friend class TControllo_mask;
|
||||
friend class TApri_estr_msk;
|
||||
friend class TEstrazione;
|
||||
|
||||
|
||||
@ -70,6 +71,7 @@ class TF9_app : public TSkeleton_application
|
||||
|
||||
// Dato il codice stato estrazione (es. "01") viene restituito il suo significato a parole (es. "in diagnostica").
|
||||
static const char* traduci_stato(const TString& cod);
|
||||
static bool is_stato_errore(const TString& stato_etr);
|
||||
|
||||
public:
|
||||
/** Mostra la finestrella per l'inserimento delle opzioni per l'estrazione e avviarla. */
|
||||
@ -128,34 +130,33 @@ inline TF9_app& f9_app()
|
||||
|
||||
|
||||
|
||||
|
||||
class TApri_estr_msk;
|
||||
class TMonitor_mask : public TAutomask
|
||||
{
|
||||
friend class TF9_app;
|
||||
vector<TToken_string> _fppro;
|
||||
std::unique_ptr<TMask> _inclusi_mask;
|
||||
vector<TToken_string> _fppro;
|
||||
std::unique_ptr<TApri_estr_msk> _inclusi_mask;
|
||||
|
||||
// Configurazione mask
|
||||
static bool save_conf_handler(TMask_field& f, KEY key);
|
||||
// Apri Estr. mask
|
||||
static bool open_mov_handler(TMask_field& f, KEY key);
|
||||
TMask& inclusi_mask(); // Crea la maschera per 'Apri Estr.'
|
||||
void fill_estr(const char* codsoc, const char* id, char tipodoc) const;
|
||||
void fill_res(const char* codsoc, const char* id, char tipodoc) const;
|
||||
|
||||
// Metodi per la maschera 'Apri Estr.'
|
||||
|
||||
void open_mostra_estrazione();
|
||||
|
||||
// Controllo estr. mask
|
||||
void controllo_errori() const;
|
||||
void controllo_errori() const;
|
||||
static void delete_estr_fld(const TString& idestr);
|
||||
void delete_pack(bool all = false) const;
|
||||
void delete_pack(bool all = false) const;
|
||||
|
||||
// Riempie sheet per visualizzare le estrazioni
|
||||
void fill() const;
|
||||
|
||||
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||||
bool on_key(KEY key) override;
|
||||
void open_mostra_estrazione();
|
||||
static void open_win_estr();
|
||||
void open_win_conf() const;
|
||||
static void open_win_conf();
|
||||
void sel() const;
|
||||
|
||||
public:
|
||||
@ -194,6 +195,33 @@ public:
|
||||
explicit TControllo_mask(const char* codsoc, const char* id_estr, bool esclusi = false);
|
||||
};
|
||||
|
||||
class TApri_estr_msk : public TAutomask
|
||||
{
|
||||
TString _idestr;
|
||||
TDate _dataestr;
|
||||
bool _provv;
|
||||
char _tipodoc;
|
||||
TString _statoestr;
|
||||
TDate _datadal;
|
||||
TDate _dataal;
|
||||
|
||||
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||||
|
||||
bool inall_handler() const;
|
||||
bool inescludi_handler() const;
|
||||
bool inselect_handler() const;
|
||||
void conferma_esclusi() const;
|
||||
public:
|
||||
void fill_estr() const;
|
||||
void fill_res() const;
|
||||
void set_from_row_estrazione(TToken_string& row_estrazione);
|
||||
|
||||
TApri_estr_msk();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
inline bool open_mov(const TRectype& mov)
|
||||
{
|
||||
TFilename ininame; ininame.temp("lnk", "ini");
|
||||
|
@ -1,12 +1,15 @@
|
||||
#define S_INCL 201
|
||||
#define F_ETEXT 202
|
||||
#define B_ESTRAI 203
|
||||
#define F_IIDESTR 204
|
||||
#define F_IDATA 205
|
||||
#define F_IPROV 206
|
||||
#define F_ITIPOD 207
|
||||
#define F_IDAL 208
|
||||
#define F_IAL 209
|
||||
#define B_ISELESCL 203
|
||||
#define B_IESCL 204
|
||||
#define B_IALLESCL 205
|
||||
#define F_IIDESTR 206
|
||||
#define F_IDATA 207
|
||||
#define F_IPROV 208
|
||||
#define F_ITIPOD 209
|
||||
#define F_ISTATOESTR 210
|
||||
#define F_IDAL 211
|
||||
#define F_IAL 212
|
||||
|
||||
#define S_RES 301
|
||||
|
||||
@ -24,6 +27,8 @@
|
||||
#define F_RAGSOC 111
|
||||
#define F_PROTIVA 112
|
||||
#define F_DESCR 113
|
||||
#define F_IESCLUDI 114
|
||||
#define F_IESCLUSO 115
|
||||
|
||||
// Elenco risultato movimenti (S_RES)
|
||||
#define F_RSEL 101
|
||||
|
@ -22,6 +22,33 @@ BEGIN
|
||||
PICTURE 0
|
||||
END
|
||||
|
||||
BUTTON B_ISELESCL 2 2
|
||||
BEGIN
|
||||
PROMPT 1 8 "Sel. esclusi"
|
||||
PICTURE TOOL_MULTISEL
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
BUTTON B_IESCL 2 2
|
||||
BEGIN
|
||||
PROMPT 1 7 "Conf. esclusi"
|
||||
PICTURE TOOL_WARNING
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
BUTTON B_IALLESCL 2 2
|
||||
BEGIN
|
||||
PROMPT 1 7 "Sel. tutti"
|
||||
PICTURE TOOL_MULTISEL
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
BUTTON DLG_NULL 2 2
|
||||
BEGIN
|
||||
PROMPT -1 0 ""
|
||||
PICTURE 0
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 2 2
|
||||
BEGIN
|
||||
PROMPT 3 1 "Fine"
|
||||
@ -40,7 +67,7 @@ END
|
||||
|
||||
DATA F_IDATA
|
||||
BEGIN
|
||||
PROMPT 45 0 "Data estrazione"
|
||||
PROMPT 45 0 "Data estrazione "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
@ -56,6 +83,12 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING F_ISTATOESTR 38
|
||||
BEGIN
|
||||
PROMPT 45 1 "Stato estrazione"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
DATA F_IDAL
|
||||
BEGIN
|
||||
PROMPT 0 2 "Dal"
|
||||
@ -68,8 +101,6 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
|
||||
|
||||
TEXT F_ETEXT
|
||||
BEGIN
|
||||
PROMPT 0 3 "@BMovimenti estratti nel pacchetto:"
|
||||
@ -91,6 +122,8 @@ BEGIN
|
||||
ITEM "Ragione\nSociale@8"
|
||||
ITEM "Cod. regis./\nprot.IVA@8"
|
||||
ITEM "Descrizione@8"
|
||||
ITEM "ESCLUDI@5"
|
||||
ITEM "ESCLUSO@6"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
@ -114,7 +147,7 @@ BEGIN
|
||||
ITEM "Ragione\nSociale@8"
|
||||
ITEM "Cod. regis./\nprot.IVA@8"
|
||||
ITEM "Descrizione@8"
|
||||
ITEM "Descrizione Errore@30"
|
||||
ITEM "Descrizione Estrazione@30"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
@ -202,6 +235,21 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
LIST F_IESCLUDI 2
|
||||
BEGIN
|
||||
PROMPT 1 1 "Escludi"
|
||||
ITEM "|"
|
||||
ITEM "S|SI"
|
||||
ITEM "N|NO"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
BOOLEAN F_IESCLUSO
|
||||
BEGIN
|
||||
PROMPT 1 1 "ESCLUSO"
|
||||
FLAG "D"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define F9_WA "F9WA00K"
|
||||
#define F9_WA "F9PWA00K"
|
||||
#define F9_DRD "F9DRD00K"
|
||||
#define F9_IVA "F9IVA00K"
|
||||
#define F9_DRT "F9DRT00K"
|
||||
@ -11,7 +11,7 @@
|
||||
* Parametro su f9pwa + ambiente + idlancio(ID drd) + categoria_documento(drt) + nome_documento
|
||||
*
|
||||
* esempio:
|
||||
* 'C:/Campo/DATIE/doc_archiviazione' + '/CORTEL' + '/20200421PN00000013' + '/FATTACQ'/ + mov5423.pdf
|
||||
* 'C:/Campo/DATIE/doc_archiviazione/' + 'PALA/' + '20200421PN00000013/' + 'FATTACQ'/ + mov5423.pdf
|
||||
*/
|
||||
|
||||
#define WA_CODSOC "F9PCSOC" // A(10) [K] - Codice societa'
|
||||
@ -100,8 +100,8 @@
|
||||
#define IVA_TIMEWEB "F9IUHEW" // D - Data e ora elaborazione WEBAPP
|
||||
#define IVA_DESCDOC "F9IDDES" // A(30) - Descrizione documento
|
||||
#define IVA_TIPPROT "F9ITPRT" // A(2) - Tipo protocollo ricezione
|
||||
#define IVA_NUMPROT "F9IAPRT" // I(4) - Numero protocollo ricezione
|
||||
#define IVA_ANNPROT "F9INPRT" // I(10) - Anno protocollo ricezione
|
||||
#define IVA_ANNPROT "F9IAPRT" // I(4) - Anno protocollo ricezione
|
||||
#define IVA_NUMPROT "F9INPRT" // I(10) - Numero protocollo ricezione
|
||||
#define IVA_TIMERIC "F9IURIC" // D - Data/ora ricezione fattura
|
||||
|
||||
|
||||
|
@ -15,9 +15,6 @@
|
||||
|
||||
statistics _stats = { 0 };
|
||||
|
||||
// Controlla eventuali apostrofi e li raddoppia
|
||||
const char* check_str(const TString& str);
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// TEstrazione
|
||||
////////////////////////////////////////////////////////
|
||||
@ -563,11 +560,8 @@ const char* TEstrazione::diagnostica_mov()
|
||||
break;
|
||||
|
||||
movimento_t& mov_i = *it;
|
||||
#ifdef DBG
|
||||
if (mov_i.numreg == 9552)
|
||||
bool simo = true;
|
||||
#endif
|
||||
// Se escluso passo avanti
|
||||
|
||||
// Se gia' escluso passo avanti
|
||||
if (!mov_i.estratto && mov_i.descr_estr == movimento_t::escluso)
|
||||
continue;
|
||||
|
||||
@ -702,9 +696,10 @@ const char* TEstrazione::diagnostica_mov()
|
||||
mov_i.cartaceo = !is_doc_xml(mov);
|
||||
bool exist_doc;
|
||||
unsigned short skip = 0;
|
||||
if (!_has_cartacei && mov_i.cartaceo) skip |= 0x1;
|
||||
else if (pura_iva(mov)) skip |= 0x2;
|
||||
if (!_has_cartacei && mov_i.cartaceo) skip |= 0x1;
|
||||
else if (pura_iva(mov)) skip |= 0x2;
|
||||
else if (mov_i.datadoc.empty() || mov_i.numdoc.empty()) skip |= 0x4;
|
||||
|
||||
if(skip)
|
||||
{
|
||||
++_stats.fv_cart_skip;
|
||||
@ -718,7 +713,7 @@ const char* TEstrazione::diagnostica_mov()
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else if(!mov_i.cartaceo && _has_checkvend && !check_documento_vendita(mov, exist_doc))
|
||||
/*else if(!mov_i.cartaceo && _has_checkvend && !check_documento_vendita(mov, exist_doc))
|
||||
{
|
||||
mov_i.err = true;
|
||||
mov_i.estratto = false;
|
||||
@ -726,7 +721,7 @@ const char* TEstrazione::diagnostica_mov()
|
||||
"Il movimento non ha un documento generatore. (Escludere? o Rimuovere flag controllo vendite)"
|
||||
: "Non e' stato trovato il documento elettronico nel database delle F.E. (Escludere? o Rimuovere flag controllo vendite)";
|
||||
mov_i.descr_estr = !exist_doc ? movimento_t::no_doc : movimento_t::notfound_elet;
|
||||
}
|
||||
}*/
|
||||
else
|
||||
{
|
||||
std::shared_ptr<TCategorie_doc::classe_doc> cd = categorie_doc().mov2cat(mov_i.numreg);
|
||||
@ -830,7 +825,6 @@ result_estr TEstrazione::estrai()
|
||||
// Faccio partire la diagnostica e mi salvo il nuovo stato.
|
||||
diagnostica_mov();
|
||||
ok &= insert_into_f9movestr();
|
||||
ok &= update_drd_stato_estr();
|
||||
|
||||
if (_head.stato_estr == D_GEST_ERR)
|
||||
{
|
||||
@ -847,10 +841,8 @@ result_estr TEstrazione::estrai()
|
||||
// tabella IVA i movimenti. F9IVA
|
||||
const result_estr res = estrazione_iva() ? estr_ok : estr_err_db_iva;
|
||||
if (res == estr_err_db_iva)
|
||||
{
|
||||
_head.stato_estr = D_GEST_ERR;
|
||||
update_drd_stato_estr();
|
||||
}
|
||||
ok &= update_drd_stato_estr();
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -876,37 +868,37 @@ bool TEstrazione::estrazione_iva(bool escluso)
|
||||
cli.put(CLI_CODCF, mov.get(MOV_CODCF));
|
||||
cli.read();
|
||||
|
||||
const TString& tipodoc = _head.tipo_doc;
|
||||
const TString& name_reg = TRegistro(TCausale(mov.get(MOV_CODCAUS), mov.get_date(MOV_DATAREG).year()).reg()).name();
|
||||
const char tipodoc = _head.tipo_doc;
|
||||
const TString& name_registro = TRegistro(TCausale(mov.get(MOV_CODCAUS), mov.get_date(MOV_DATAREG).year()).reg()).name();
|
||||
fill_id(cli, statopaiv, idfisc, paiv, codfis);
|
||||
numdoc.cut(0) << (mov.get(MOV_NUMDOCEXT).full() ? mov.get(MOV_NUMDOCEXT) : mov.get(MOV_NUMDOC));
|
||||
TString datadoc; datadoc << mov.get_date(MOV_DATADOC).date2ansi();
|
||||
TString datareg; datareg << mov.get_date(MOV_DATAREG).date2ansi();
|
||||
TDate datadoc = mov.get_date(MOV_DATADOC);
|
||||
TDate datareg = mov.get_date(MOV_DATAREG);
|
||||
|
||||
TIva_insert_prepared_stat iva_query;
|
||||
|
||||
iva_query.add(IVA_CODSOC, _head.cod_soc);
|
||||
iva_query.add(IVA_IDLAN, _head.id_estr);
|
||||
iva_query.add(IVA_FLAG_PD, _head.flag_prov ? "P" : "D");
|
||||
iva_query.add(IVA_ANNOES, mov.get(MOV_ANNOES));
|
||||
iva_query.add(IVA_CODSOC, _head.cod_soc, 10);
|
||||
iva_query.add(IVA_IDLAN, _head.id_estr, 18);
|
||||
iva_query.add(IVA_FLAG_PD, _head.flag_prov ? 'P' : 'D');
|
||||
iva_query.add(IVA_ANNOES, mov.get_int(MOV_ANNOES));
|
||||
iva_query.add(IVA_GIVA, tipodoc);
|
||||
iva_query.add(IVA_TIPOG, name_reg);
|
||||
iva_query.add(IVA_DOCXML, it->cartaceo ? "N" : "S");
|
||||
iva_query.add(IVA_TIPOCF, mov.get(MOV_TIPO));
|
||||
iva_query.add(IVA_CODCF, mov.get(MOV_CODCF));
|
||||
iva_query.add(IVA_TIPOG, name_registro, 10);
|
||||
iva_query.add(IVA_DOCXML, it->cartaceo ? 'N' : 'S');
|
||||
iva_query.add(IVA_TIPOCF, mov.get_char(MOV_TIPO));
|
||||
iva_query.add(IVA_CODCF, mov.get_long(MOV_CODCF));
|
||||
|
||||
iva_query.add(IVA_RAGSOC, check_str(cli.get(CLI_RAGSOC)));
|
||||
iva_query.add(IVA_IDFISC, idfisc);
|
||||
iva_query.add(IVA_PIVA, paiv);
|
||||
iva_query.add(IVA_CODFIS, codfis);
|
||||
iva_query.add(IVA_CATDOC, it->catdoc->catdoc);
|
||||
iva_query.add(IVA_CAUSSOS, it->catdoc->caus_sost);
|
||||
iva_query.add(IVA_RAGSOC, cli.get(CLI_RAGSOC), 60);
|
||||
iva_query.add(IVA_IDFISC, idfisc, 30);
|
||||
iva_query.add(IVA_PIVA, paiv, 28);
|
||||
iva_query.add(IVA_CODFIS, codfis, 16);
|
||||
iva_query.add(IVA_CATDOC, it->catdoc->catdoc, 10);
|
||||
iva_query.add(IVA_CAUSSOS, it->catdoc->caus_sost, 6);
|
||||
|
||||
iva_query.add(IVA_NUMDOC, numdoc);
|
||||
iva_query.add(IVA_NUMDOC, numdoc, 20);
|
||||
iva_query.add(IVA_DATADOC, datadoc);
|
||||
iva_query.add(IVA_SEZIVA, mov.get(MOV_REG));
|
||||
iva_query.add(IVA_TIPOREG, "");
|
||||
iva_query.add(IVA_NPROT, mov.get(MOV_PROTIVA));
|
||||
iva_query.add(IVA_SEZIVA, mov.get(MOV_REG), 10);
|
||||
iva_query.add(IVA_TIPOREG, "", 6);
|
||||
iva_query.add(IVA_NPROT, mov.get(MOV_PROTIVA), 20);
|
||||
iva_query.add(IVA_DATPROT, datareg);
|
||||
|
||||
/*if(is_autofattura(mov))
|
||||
@ -914,11 +906,11 @@ bool TEstrazione::estrazione_iva(bool escluso)
|
||||
iva_query.add(IVA_FORNOR, "");
|
||||
iva_query.add(IVA_REGOR, "");
|
||||
iva_query.add(IVA_NUMOR, N ORI);
|
||||
iva_query.add(IVA_DATAOR, 20010101);
|
||||
iva_query.add(IVA_DATAOR, TDate(20010101));
|
||||
}*/
|
||||
|
||||
iva_query.add(IVA_CLASDOC, it->catdoc->class_sost);
|
||||
iva_query.add(IVA_NOMFD, it->nomefilecart.name());
|
||||
iva_query.add(IVA_CLASDOC, it->catdoc->class_sost, 10);
|
||||
iva_query.add(IVA_NOMFD, it->nomefilecart.name(), 100);
|
||||
|
||||
// Load annessi...
|
||||
if(!it->annessi.empty())
|
||||
@ -927,72 +919,72 @@ bool TEstrazione::estrazione_iva(bool escluso)
|
||||
TCategorie_doc cd;
|
||||
size_t i = 0;
|
||||
size_t size = ann.size();
|
||||
iva_query.add(IVA_CLASAN1, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF1, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN1, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF1, ann[i++].filename, 100);
|
||||
// HOW DID MY LIFE COME TO THIS?....
|
||||
if (size > i)
|
||||
{
|
||||
iva_query.add(IVA_CLASAN2, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF2, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN2, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF2, ann[i++].filename, 100);
|
||||
}
|
||||
if (size > i)
|
||||
{
|
||||
iva_query.add(IVA_CLASAN3, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF3, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN3, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF3, ann[i++].filename, 100);
|
||||
}
|
||||
if (size > i)
|
||||
{
|
||||
iva_query.add(IVA_CLASAN4, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF4, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN4, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF4, ann[i++].filename, 100);
|
||||
}
|
||||
if (size > i)
|
||||
{
|
||||
iva_query.add(IVA_CLASAN5, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF5, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN5, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF5, ann[i++].filename, 100);
|
||||
}
|
||||
if (size > i)
|
||||
{
|
||||
iva_query.add(IVA_CLASAN4, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF4, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN4, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF4, ann[i++].filename, 100);
|
||||
}
|
||||
if (size > i)
|
||||
{
|
||||
iva_query.add(IVA_CLASAN6, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF6, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN6, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF6, ann[i++].filename, 100);
|
||||
}
|
||||
if (size > i)
|
||||
{
|
||||
iva_query.add(IVA_CLASAN7, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF7, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN7, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF7, ann[i++].filename, 100);
|
||||
}
|
||||
if (size > i)
|
||||
{
|
||||
iva_query.add(IVA_CLASAN8, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF8, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN8, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF8, ann[i++].filename, 100);
|
||||
}
|
||||
if (size > i)
|
||||
{
|
||||
iva_query.add(IVA_CLASAN9, ann[i].catdocann);
|
||||
iva_query.add(IVA_NOMF9, ann[i++].filename);
|
||||
iva_query.add(IVA_CLASAN9, ann[i].catdocann, 10);
|
||||
iva_query.add(IVA_NOMF9, ann[i++].filename, 100);
|
||||
}
|
||||
}
|
||||
|
||||
iva_query.add(IVA_USERELA, user());
|
||||
iva_query.add(IVA_USERELA, user(), 10);
|
||||
iva_query.add_getdate(IVA_TIMEELA);
|
||||
|
||||
if (_head.tipo_doc == 'A' && !it->cartaceo)
|
||||
{
|
||||
TToken_string keys(mov.get(MOV_KEYFPPRO), ';');
|
||||
fppro_db().set_keys(keys);
|
||||
iva_query.add(IVA_TIPPROT, fppro_db().get_tipoprot());
|
||||
iva_query.add(IVA_NUMPROT, fppro_db().get_numprot());
|
||||
iva_query.add(IVA_ANNPROT, fppro_db().get_annoprot());
|
||||
iva_query.add(IVA_TIMERIC, fppro_db().get_dataoraric());
|
||||
iva_query.add(IVA_TIPPROT, fppro_db().get_tipoprot(), 2);
|
||||
iva_query.add(IVA_ANNPROT, TVariant(fppro_db().get_annoprot()).as_int());
|
||||
iva_query.add(IVA_NUMPROT, fppro_db().get_numprot(), 10); // Non controllo che sia in realta' un numero...
|
||||
iva_query.add(IVA_TIMERIC, TDate(fppro_db().get_dataoraric()));
|
||||
}
|
||||
|
||||
const bool ok = fp_db().sq_set_exec(iva_query.get()) && fp_db().sq_commit();
|
||||
TString sql;
|
||||
const bool ok = iva_query.get(sql) && fp_db().sq_set_exec(sql) && fp_db().sq_commit();
|
||||
if (!ok)
|
||||
write_errorsql_log(iva_query.get());
|
||||
write_errorsql_log(sql);
|
||||
|
||||
stato &= ok;
|
||||
}
|
||||
@ -1631,7 +1623,7 @@ TRecord_categorie::TRecord_categorie(type table): _table(table)
|
||||
const char* check_str(const TString& str)
|
||||
{
|
||||
static TString n_str; n_str.cut(0) << str;
|
||||
n_str.replace("'", "\'\'");
|
||||
n_str.replace("'", "''");
|
||||
n_str.replace(" ", " ");
|
||||
return (const char*)n_str;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public:
|
||||
void set_ambiente(const TString& cod_amb);
|
||||
void set_addr_doc(const TString& path);
|
||||
void set_has_cartexp(bool flag);
|
||||
void set_has_checkvend(bool flag);
|
||||
void set_has_checkvend(bool flag); // Inutilizzato
|
||||
void set_viewmov(bool flag);
|
||||
|
||||
void set_addr_cart(const TString& path);
|
||||
@ -463,15 +463,22 @@ public:
|
||||
|
||||
class TIva_insert_prepared_stat
|
||||
{
|
||||
TString _query;
|
||||
vector<pair<TString, TString>> _fields;
|
||||
bool _ok{ true };
|
||||
TString _query;
|
||||
|
||||
void add_value(const char* field, const TString& value);
|
||||
void write();
|
||||
public:
|
||||
void add(const char* field, const TString& value);
|
||||
void add_getdate(const char* field);
|
||||
const char* get() { if(_query.empty()) write(); return _query; }
|
||||
void reset();
|
||||
void add(const char* field, const TString& str, int len = -1);
|
||||
void add(const char* field, const char* str, int len = -1);
|
||||
void add(const char* field, const TDate& date);
|
||||
void add(const char* field, char c);
|
||||
void add(const char* field, long l);
|
||||
void add(const char* field, const int n) { add(field, (long)n); }
|
||||
void add_getdate(const char* field);
|
||||
bool get(TString& query);
|
||||
void reset();
|
||||
};
|
||||
|
||||
class TF9_doccart
|
||||
@ -563,4 +570,7 @@ public:
|
||||
TF9Prospetto_integr();
|
||||
};
|
||||
|
||||
// Controlla eventuali apostrofi e li raddoppia
|
||||
const char* check_str(const TString& str);
|
||||
|
||||
#endif // #ifndef __F901001_H
|
||||
|
@ -40,7 +40,7 @@ void TF9_config::set_has_cartexp(const bool flag)
|
||||
|
||||
void TF9_config::set_has_checkvend(const bool flag)
|
||||
{
|
||||
ini_set_bool(CONFIG_DITTA, "F9", CHECKVEND_F9, flag);
|
||||
ini_set_bool(CONFIG_DITTA, "F9", CHECKVEND_F9, false);
|
||||
_checkvend = flag;
|
||||
}
|
||||
|
||||
@ -179,6 +179,11 @@ bool TF9_doccart::mov2listann_vect(const TString& numreg, _Out_ vector<annesso_t
|
||||
// TIva_insert_prepared_stat
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TIva_insert_prepared_stat::add_value(const char* field, const TString& value)
|
||||
{
|
||||
_fields.insert(_fields.end(), { field, value });
|
||||
}
|
||||
|
||||
void TIva_insert_prepared_stat::write()
|
||||
{
|
||||
TString vals_appo;
|
||||
@ -205,9 +210,42 @@ void TIva_insert_prepared_stat::write()
|
||||
_query << "\n)\nVALUES (\n" << vals_appo << "\n)";
|
||||
}
|
||||
|
||||
void TIva_insert_prepared_stat::add(const char* field, const TString& value)
|
||||
void TIva_insert_prepared_stat::add(const char* field, const TString& str, const int len)
|
||||
{
|
||||
_fields.insert(_fields.end(), { field, TString("'") << value << "'" });
|
||||
if (len == -1 || str.len() <= len)
|
||||
{
|
||||
TString v; v << "'" << check_str(str) << "'";
|
||||
add_value(field, v);
|
||||
}
|
||||
else
|
||||
_ok &= false;
|
||||
}
|
||||
|
||||
void TIva_insert_prepared_stat::add(const char* field, const TDate& date)
|
||||
{
|
||||
TString v;
|
||||
if (date.ok())
|
||||
v << "'" << date.date2ansi() << "'";
|
||||
else
|
||||
v << "'00010101'";
|
||||
add_value(field, v);
|
||||
}
|
||||
|
||||
void TIva_insert_prepared_stat::add(const char* field, const char* str, const int len)
|
||||
{
|
||||
add(field, TString(str), len);
|
||||
}
|
||||
|
||||
void TIva_insert_prepared_stat::add(const char* field, char c)
|
||||
{
|
||||
TString v; v << "'" << c << "'";
|
||||
add_value(field, v);
|
||||
}
|
||||
|
||||
void TIva_insert_prepared_stat::add(const char* field, long l)
|
||||
{
|
||||
TString v; v << l;
|
||||
add_value(field, v);
|
||||
}
|
||||
|
||||
void TIva_insert_prepared_stat::add_getdate(const char* field)
|
||||
@ -215,10 +253,19 @@ void TIva_insert_prepared_stat::add_getdate(const char* field)
|
||||
_fields.insert(_fields.end(), { field, "GETDATE()" });
|
||||
}
|
||||
|
||||
bool TIva_insert_prepared_stat::get(TString& query)
|
||||
{
|
||||
if (_query.empty())
|
||||
write();
|
||||
query.cut(0) << _query;
|
||||
return _ok;
|
||||
}
|
||||
|
||||
void TIva_insert_prepared_stat::reset()
|
||||
{
|
||||
_query.cut(0);
|
||||
_fields.clear();
|
||||
_ok = true;
|
||||
_query.cut(0);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user