Patch level : 12.0 no-patch
Files correlati : f90.exe d181.des f181.dir f181.trr all-masks Commento : - F9: migliorato codice. - Risolta sovrapposizione barre progresso.
This commit is contained in:
parent
10f1d6d195
commit
c1e4c0935c
@ -41,6 +41,8 @@ TString get_checksum(const int version)
|
|||||||
// Utilities
|
// Utilities
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TF9_config F9CONF;
|
||||||
|
|
||||||
TMask& descr_msk()
|
TMask& descr_msk()
|
||||||
{
|
{
|
||||||
static std::unique_ptr<TMask> m = nullptr;
|
static std::unique_ptr<TMask> m = nullptr;
|
||||||
@ -73,24 +75,6 @@ TMask& esclusi_mask()
|
|||||||
return *_esclusi_mask;
|
return *_esclusi_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
TMask& inclusi_mask()
|
|
||||||
{
|
|
||||||
static std::unique_ptr<TMask> _inclusi_mask = nullptr;
|
|
||||||
if (_inclusi_mask == nullptr)
|
|
||||||
{
|
|
||||||
_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, TF9_app::mov_handler); // Bottone collega movimento
|
|
||||||
|
|
||||||
TMask& sheet_res = ((TSheet_field&)m.field(S_RES)).sheet_mask();
|
|
||||||
sheet_res.set_handler(DLG_USER, TF9_app::mov_handler);
|
|
||||||
}
|
|
||||||
return *_inclusi_mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TString& recset_get_string(const TRecordset& rec, const char* field, const int zero_filled)
|
const TString& recset_get_string(const TRecordset& rec, const char* field, const int zero_filled)
|
||||||
{
|
{
|
||||||
const TString& str = rec.get(rec.find_column(field)).as_string();
|
const TString& str = rec.get(rec.find_column(field)).as_string();
|
||||||
@ -127,38 +111,125 @@ real recset_get_real(const TRecordset& rec, const char* field)
|
|||||||
// TEstrai_mask
|
// TEstrai_mask
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TEstrai_mask::TEstrai_mask() : TMask("Estrazione", 1, 60, 16)
|
int TEstrai_mask::estrai()
|
||||||
{
|
{
|
||||||
add_button_tool(DLG_ELABORA, "Estrai", TOOL_ELABORA);
|
const TDate dataini = get_dataini();
|
||||||
add_button_tool(DLG_NULL, "", 0);
|
const TDate dataend = get_dataend();
|
||||||
add_button_tool(DLG_QUIT, "Esci", TOOL_QUIT);
|
const char tipodoc = get_tipodoc();
|
||||||
|
const bool flagpro = is_provviso();
|
||||||
|
|
||||||
add_groupbox(ES_DATEGROUP, 0, "Inserire periodo per estrazione:", 1, 0, 59, 3, "");
|
// Vero e proprio oggetto estrazione
|
||||||
add_date(ES_DATAINI, 0, "dal", 4, 1, "");
|
_estrazione = make_unique<TEstrazione>(
|
||||||
add_date(ES_DATAEND, 0, " al", 33, 1, "");
|
F9CONF.get_ambiente(), // Codice ambiente
|
||||||
add_groupbox(ES_FLAGGROUP, 0, "Selezionare tipo di estrazione:", 1, 3, 28, 3, "");
|
flagpro, // Flag prov.
|
||||||
add_list(ES_FLAGPROV, 0, "Flag provvisorio", 2, 4, 1, "", "P|D", "Provvisorio|Definitivo");
|
tipodoc, // Tipo doc.
|
||||||
add_groupbox(ES_TIPOGROUP, 0, "Selezionare documenti da estrarre:", 32, 3, 28, 3, "");
|
get_descr(), // Descrizione estrazione
|
||||||
add_list(ES_TIPODOC, 0, "Tipi documento", 33, 4, 1, "", "A|V", "Acquisti|Vendite");
|
F9CONF.get_addr_doc(), // Cartella documenti
|
||||||
add_groupbox(ES_DESCGROUP, 0, "Inserire descrizione estrazione:", 1, 6, 59, 3, "");
|
false, // Estrazione di un escluso
|
||||||
add_string(ES_DESCR, 0, "Descrizione", 2, 7, 250, "", 40);
|
&dataini, // Data estr. mov dal
|
||||||
|
&dataend, // Data estr. mov al
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
TMask::set_handler(DLG_ELABORA, estrai_handler);
|
// Leggo i movimenti e li carico nell'estrazione. /////////////
|
||||||
TMask::set_handler(ES_DATAINI, dataini_handler);
|
TString query;
|
||||||
TMask::set_handler(ES_DATAEND, dataend_handler);
|
query << "SELECT * FROM MOV WHERE DATAREG>=" << dataini.date2ansi() << " AND DATAREG<=" << dataend.date2ansi() << ";";
|
||||||
|
TSQL_recordset mov(query);
|
||||||
|
|
||||||
TDate dt(TODAY); dt.set_day(1); dt.set_month(1);
|
TProgress_monitor* progr = new TProgress_monitor(mov.items(), "Acquisizione movimenti", false);
|
||||||
set(ES_DATAINI, dt);
|
TLocalisamfile clifo(LF_CLIFO);
|
||||||
set(ES_DATAEND, today);
|
const TipoIVA tipo = tipodoc == 'A' ? iva_acquisti : iva_vendite;
|
||||||
|
|
||||||
|
// Prendo tutti i movimenti a partire da una data e li carico tutti fino alla data finale
|
||||||
|
for (bool ok = mov.move_first(); ok; ok = mov.move_next())
|
||||||
|
{
|
||||||
|
if (!progr->add_status())
|
||||||
|
break;
|
||||||
|
|
||||||
|
TToken_string elab_f9(recset_get_string(mov, MOV_ELABF9), ';'); // Stringa del campo elaborazione f9 nel file mov
|
||||||
|
const bool escluso = !(elab_f9.items() == 3 && elab_f9.get(2)[0] != 'X' || elab_f9.empty());
|
||||||
|
const TCausale caus(recset_get_string(mov, MOV_CODCAUS, 3));
|
||||||
|
const bool stampato = recset_get_bool(mov, MOV_REGST);
|
||||||
|
const TString& numdoc = recset_get_string(mov, MOV_NUMDOC);
|
||||||
|
const TRegistro& reg = caus.reg();
|
||||||
|
const TipoIVA& iva = reg.iva();
|
||||||
|
// Se definitivo controllo il flag di stampato REGST
|
||||||
|
if ((flagpro || stampato) && numdoc.full() && iva == tipo)
|
||||||
|
{
|
||||||
|
clifo.zero();
|
||||||
|
clifo.put(CLI_TIPOCF, tipo == iva_acquisti ? "F" : "C");
|
||||||
|
clifo.put(CLI_CODCF, recset_get_string(mov, MOV_CODCF));
|
||||||
|
|
||||||
|
// Creo il movimento da inserire
|
||||||
|
movimento_t t;
|
||||||
|
t.err = false;
|
||||||
|
t.numreg = recset_get_int(mov, MOV_NUMREG);
|
||||||
|
t.datareg = recset_get_string(mov, MOV_DATAREG);
|
||||||
|
t.datadoc = recset_get_string(mov, MOV_DATADOC);
|
||||||
|
t.codcaus = recset_get_string(mov, MOV_CODCAUS, 3);
|
||||||
|
t.meseliq = recset_get_int(mov, MOV_MESELIQ);
|
||||||
|
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.codcf = recset_get_int(mov, MOV_CODCF);
|
||||||
|
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.descr = recset_get_string(mov, MOV_DESCR);
|
||||||
|
if (escluso)
|
||||||
|
{
|
||||||
|
t.estratto = false;
|
||||||
|
t.descr_estr = movimento_t::escluso;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Effettivo inserimento del movimento
|
||||||
|
_estrazione->add_mov(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete progr;
|
||||||
|
|
||||||
|
_stats = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
const result_estr result = _estrazione->estrai();
|
||||||
|
#ifdef DBG
|
||||||
|
TString msg;
|
||||||
|
msg << "total: " << (int)_stats.total << "\n";
|
||||||
|
if (tipodoc == 'A')
|
||||||
|
{
|
||||||
|
msg << "Movimenti saltati: " << (int)_stats.fa_skip << "\n";
|
||||||
|
msg << "Movimenti in errore: " << (int)_stats.fa_err << "\n";
|
||||||
|
msg << "Movimenti estratti: " << (int)_stats.fa_estr << "\n";
|
||||||
|
msg << "Movimenti senza cat. doc.: " << (int)_stats.fa_nocatdoc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg << "Movimenti saltati poiche' cartacei: " << (int)_stats.fv_cart_skip << "\n";
|
||||||
|
msg << "Movimenti in errore: " << (int)_stats.fv_err << "\n";
|
||||||
|
msg << "Movimenti estratti: " << (int)_stats.fv_estr << "\n";
|
||||||
|
msg << "Movimenti senza cat. doc.: " << (int)_stats.fv_nocatdoc;
|
||||||
|
}
|
||||||
|
message_box(msg);
|
||||||
|
#endif
|
||||||
|
// Ricalcolo sheet estrazioni
|
||||||
|
f9_app().notify_estraction();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TEstrai_mask::segna_in_errore() const
|
||||||
|
{
|
||||||
|
TString query;
|
||||||
|
query << "UPDATE " F9_DRD "\n"
|
||||||
|
"SET " DRD_STATO " = '" D_GEST_ERR "'\n"
|
||||||
|
"WHERE " DRD_ID_EST " = '" << _estrazione->get_id_estr() << "'\n";
|
||||||
|
fp_db().sq_set_exec(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TEstrai_mask::estrai_handler(TMask_field& f, KEY key)
|
bool TEstrai_mask::estrai_handler(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
TEstrai_mask& msk = (TEstrai_mask&)f.mask(); // this estrai_mask
|
TEstrai_mask& msk = (TEstrai_mask&)f.mask();
|
||||||
TF9_app& a = f9_app();
|
TF9_app& a = f9_app();
|
||||||
|
|
||||||
// Estraggo
|
// Estraggo
|
||||||
const int stato = a.estrai(); // Main function
|
const int stato = msk.estrai(); // Main function
|
||||||
|
|
||||||
// Gestione risultato estrazione
|
// Gestione risultato estrazione
|
||||||
if (stato == 1)
|
if (stato == 1)
|
||||||
@ -170,7 +241,7 @@ bool TEstrai_mask::estrai_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
warning_box("L'estrazione non e' stata completata. Controllare il log degli errori.");
|
warning_box("L'estrazione non e' stata completata. Controllare il log degli errori.");
|
||||||
if (stato == 0) // Errore scrittura F9IVA, non segno in errore in testata...
|
if (stato == 0) // Errore scrittura F9IVA, non segno in errore in testata...
|
||||||
TF9_app::segna_in_errore(); // ... se l'errore e' dovuto alla scrittura sul db
|
msk.segna_in_errore(); // ... se l'errore e' dovuto alla scrittura sul db.
|
||||||
}
|
}
|
||||||
a.print_log();
|
a.print_log();
|
||||||
msk.field(ES_DESCR).set("");
|
msk.field(ES_DESCR).set("");
|
||||||
@ -214,6 +285,31 @@ bool TEstrai_mask::dataend_handler(TMask_field& f, KEY key)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEstrai_mask::TEstrai_mask() : TMask("Estrazione", 1, 60, 16), _estrazione(nullptr)
|
||||||
|
{
|
||||||
|
add_button_tool(DLG_ELABORA, "Estrai", TOOL_ELABORA);
|
||||||
|
add_button_tool(DLG_NULL, "", 0);
|
||||||
|
add_button_tool(DLG_QUIT, "Esci", TOOL_QUIT);
|
||||||
|
|
||||||
|
add_groupbox(ES_DATEGROUP, 0, "Inserire periodo per estrazione:", 1, 0, 59, 3, "");
|
||||||
|
add_date(ES_DATAINI, 0, "dal", 4, 1, "");
|
||||||
|
add_date(ES_DATAEND, 0, " al", 33, 1, "");
|
||||||
|
add_groupbox(ES_FLAGGROUP, 0, "Selezionare tipo di estrazione:", 1, 3, 28, 3, "");
|
||||||
|
add_list(ES_FLAGPROV, 0, "Flag provvisorio", 2, 4, 1, "", "P|D", "Provvisorio|Definitivo");
|
||||||
|
add_groupbox(ES_TIPOGROUP, 0, "Selezionare documenti da estrarre:", 32, 3, 28, 3, "");
|
||||||
|
add_list(ES_TIPODOC, 0, "Tipi documento", 33, 4, 1, "", "A|V", "Acquisti|Vendite");
|
||||||
|
add_groupbox(ES_DESCGROUP, 0, "Inserire descrizione estrazione:", 1, 6, 59, 3, "");
|
||||||
|
add_string(ES_DESCR, 0, "Descrizione", 2, 7, 250, "", 40);
|
||||||
|
|
||||||
|
TMask::set_handler(DLG_ELABORA, estrai_handler);
|
||||||
|
TMask::set_handler(ES_DATAINI, dataini_handler);
|
||||||
|
TMask::set_handler(ES_DATAEND, dataend_handler);
|
||||||
|
|
||||||
|
TDate dt(TODAY); dt.set_day(1); dt.set_month(1);
|
||||||
|
set(ES_DATAINI, dt);
|
||||||
|
set(ES_DATAEND, today);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -224,28 +320,54 @@ bool TEstrai_mask::dataend_handler(TMask_field& f, KEY key)
|
|||||||
bool TMonitor_mask::save_conf_handler(TMask_field& f, KEY key)
|
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();
|
TString old_codsoc = F9CONF.get_ambiente();
|
||||||
TString old_codsoc = a.get_ambiente();
|
|
||||||
if(config_mask.get(CF_CODSOC).empty())
|
if(config_mask.get(CF_CODSOC).empty())
|
||||||
warning_box("Codice Ambiente vuoto. Impossibile salvare i dati.");
|
warning_box("Codice Ambiente vuoto. Impossibile salvare i dati.");
|
||||||
a.set_ambiente (config_mask.get(CF_CODSOC));
|
F9CONF.set_ambiente (config_mask.get(CF_CODSOC));
|
||||||
a.set_addr_doc (config_mask.get(CF_ADDRDOC));
|
F9CONF.set_addr_doc (config_mask.get(CF_ADDRDOC));
|
||||||
a.set_has_cartexp (config_mask.get_bool(CF_CARTEXP));
|
F9CONF.set_has_cartexp (config_mask.get_bool(CF_CARTEXP));
|
||||||
a.set_has_checkvend (config_mask.get_bool(CF_CHECKVEND));
|
F9CONF.set_has_checkvend (config_mask.get_bool(CF_CHECKVEND));
|
||||||
a.set_viewmov (config_mask.get_bool(CF_VIEWMOVPRE));
|
F9CONF.set_viewmov (config_mask.get_bool(CF_VIEWMOVPRE));
|
||||||
|
|
||||||
if (a.get_ambiente().full())
|
if (F9CONF.get_ambiente().full())
|
||||||
ini_set_string(CONFIG_DITTA, PAR_MOD, AMBIENTE_F9, a.get_ambiente());
|
ini_set_string(CONFIG_DITTA, PAR_MOD, AMBIENTE_F9, F9CONF.get_ambiente());
|
||||||
if (a.get_addr_doc().full())
|
if (F9CONF.get_addr_doc().full())
|
||||||
ini_set_string(CONFIG_DITTA, PAR_MOD, ADDRCART_F9, a.get_addr_doc());
|
ini_set_string(CONFIG_DITTA, PAR_MOD, ADDRCART_F9, F9CONF.get_addr_doc());
|
||||||
ini_set_bool(CONFIG_DITTA, PAR_MOD, CHECKVEND_F9, a.get_has_checkvend());
|
ini_set_bool(CONFIG_DITTA, PAR_MOD, CHECKVEND_F9, F9CONF.get_has_checkvend());
|
||||||
ini_set_bool(CONFIG_DITTA, PAR_MOD, CARTEXP_F9, a.get_has_cartexp());
|
ini_set_bool(CONFIG_DITTA, PAR_MOD, CARTEXP_F9, F9CONF.get_has_cartexp());
|
||||||
ini_set_bool(CONFIG_DITTA, PAR_MOD, VIEWMOV_F9, a.get_viewmov());
|
ini_set_bool(CONFIG_DITTA, PAR_MOD, VIEWMOV_F9, F9CONF.get_viewmov());
|
||||||
config_mask.close();
|
config_mask.close();
|
||||||
a.edit_wa(old_codsoc);
|
f9_app().edit_wa(old_codsoc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMonitor_mask::estr_mov_handler(TMask_field& f, KEY key)
|
||||||
|
{
|
||||||
|
TSheet_field& sf = ((TMonitor_mask&)f.mask())._inclusi_mask->sfield(S_ESCL);
|
||||||
|
TToken_string& row = sf.row(sf.selected());
|
||||||
|
TRectype mov(LF_MOV);
|
||||||
|
mov.put(MOV_NUMREG, row.get(sf.cid2index(F_NUMREG)));
|
||||||
|
return open_mov(mov);
|
||||||
|
}
|
||||||
|
|
||||||
|
TMask& TMonitor_mask::inclusi_mask()
|
||||||
|
{
|
||||||
|
if (_inclusi_mask == nullptr)
|
||||||
|
{
|
||||||
|
_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, estr_mov_handler); // Bottone collega movimento
|
||||||
|
|
||||||
|
TMask& sheet_res = ((TSheet_field&)m.field(S_RES)).sheet_mask();
|
||||||
|
sheet_res.set_handler(DLG_USER, estr_mov_handler);
|
||||||
|
}
|
||||||
|
return *_inclusi_mask;
|
||||||
|
}
|
||||||
|
|
||||||
void TMonitor_mask::controllo_errori() const
|
void TMonitor_mask::controllo_errori() const
|
||||||
{
|
{
|
||||||
TString id_estr;
|
TString id_estr;
|
||||||
@ -262,7 +384,7 @@ void TMonitor_mask::controllo_errori() const
|
|||||||
}
|
}
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
TControllo_mask controllo(f9_app().get_ambiente(), id_estr);
|
TControllo_mask controllo(F9CONF.get_ambiente(), id_estr);
|
||||||
controllo.run();
|
controllo.run();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -280,7 +402,7 @@ void TMonitor_mask::delete_pack(const bool all) const
|
|||||||
flag = true;
|
flag = true;
|
||||||
const TString id_estr(row->get(cid2index(F_IDESTR)));
|
const TString id_estr(row->get(cid2index(F_IDESTR)));
|
||||||
TString query;
|
TString query;
|
||||||
const TString codsoc(f9_app().get_ambiente());
|
const TString& codsoc(F9CONF.get_ambiente());
|
||||||
query << "BEGIN\n"
|
query << "BEGIN\n"
|
||||||
" DECLARE @stato CHAR(2);\n\n"
|
" DECLARE @stato CHAR(2);\n\n"
|
||||||
" SELECT @stato = " DRD_STATO "\n"
|
" SELECT @stato = " DRD_STATO "\n"
|
||||||
@ -405,7 +527,7 @@ bool TMonitor_mask::on_key(const KEY key)
|
|||||||
return TAutomask::on_key(key);
|
return TAutomask::on_key(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_escl(TMask& msk, const char* codsoc, const char* id, const char tipodoc)
|
void TMonitor_mask::fill_estr(const char* codsoc, const char* id, const char tipodoc) const
|
||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
query << "SELECT " IVA_SEZIVA ", " IVA_DATADOC ", " IVA_NUMDOC ", " IVA_NPROT "\n"
|
query << "SELECT " IVA_SEZIVA ", " IVA_DATADOC ", " IVA_NUMDOC ", " IVA_NPROT "\n"
|
||||||
@ -415,13 +537,13 @@ void fill_escl(TMask& msk, const char* codsoc, const char* id, const char tipodo
|
|||||||
TString sql;
|
TString sql;
|
||||||
TSQL_recordset rec("");
|
TSQL_recordset rec("");
|
||||||
fp_db().sq_set_exec(query, false);
|
fp_db().sq_set_exec(query, false);
|
||||||
TSheet_field& sf = msk.sfield(S_ESCL);
|
TSheet_field& sf = _inclusi_mask->sfield(S_ESCL);
|
||||||
sf.destroy();
|
sf.destroy();
|
||||||
|
|
||||||
TProgress_monitor* prog = new TProgress_monitor(fp_db().sq_items(), "Caricamento dati estrazione...");
|
TProgress_monitor prog(fp_db().sq_items(), "Caricamento dati estrazione...");
|
||||||
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())
|
||||||
{
|
{
|
||||||
if (!prog->add_status())
|
if (!prog.add_status())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
sql.cut(0) << "SELECT NUMREG, DATAREG, DATADOC, CODCAUS, TIPODOC, MESELIQ, NUMDOC, TOTDOC, CODCF, REG, PROTIVA, DESCR\n"
|
sql.cut(0) << "SELECT NUMREG, DATAREG, DATADOC, CODCAUS, TIPODOC, MESELIQ, NUMDOC, TOTDOC, CODCF, REG, PROTIVA, DESCR\n"
|
||||||
@ -449,23 +571,22 @@ void fill_escl(TMask& msk, const char* codsoc, const char* id, const char tipodo
|
|||||||
r.add(TString(rec.get(9).as_string()) << "/" << rec.get(10).as_string()); // Prot iva
|
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(rec.get(11).as_string()); // Descr
|
||||||
}
|
}
|
||||||
delete prog; // Distruggo l'oggetto subito, altrimenti rimane aperta la finestrella.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_res(TMask& msk, const char* codsoc, const char* id, const char tipodoc)
|
void TMonitor_mask::fill_res(const char* codsoc, const char* id, const char tipodoc) const
|
||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
query << "SELECT * FROM " F9_MOVESTR "\n"
|
query << "SELECT * FROM " F9_MOVESTR "\n"
|
||||||
"WHERE " MES_CODSOC " = '" << codsoc << "' AND " MES_IDESTR " = '" << id << "'";
|
"WHERE " MES_CODSOC " = '" << codsoc << "' AND " MES_IDESTR " = '" << id << "'";
|
||||||
|
|
||||||
fp_db().sq_set_exec(query, false);
|
fp_db().sq_set_exec(query, false);
|
||||||
TSheet_field& sf = msk.sfield(S_RES);
|
TSheet_field& sf = _inclusi_mask->sfield(S_RES);
|
||||||
sf.destroy();
|
sf.destroy();
|
||||||
|
|
||||||
TProgress_monitor* prog = new TProgress_monitor(fp_db().sq_items(), "Caricamento dati estrazione...");
|
TProgress_monitor prog(fp_db().sq_items(), "Caricamento dati estrazione...");
|
||||||
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())
|
||||||
{
|
{
|
||||||
if (!prog->add_status())
|
if (!prog.add_status())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
TLocalisamfile mov(LF_MOV);
|
TLocalisamfile mov(LF_MOV);
|
||||||
@ -493,10 +614,9 @@ void fill_res(TMask& msk, const char* codsoc, const char* id, const char tipodoc
|
|||||||
r.add(mov.get(MOV_DESCR)); // Descr
|
r.add(mov.get(MOV_DESCR)); // Descr
|
||||||
r.add(fp_db().sq_get(MES_ERR)); // Descrizione errore
|
r.add(fp_db().sq_get(MES_ERR)); // Descrizione errore
|
||||||
}
|
}
|
||||||
delete prog; // Distruggo l'oggetto subito, altrimenti rimane aperta la finestrella.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMonitor_mask::open_mostra_estrazione() const
|
void TMonitor_mask::open_mostra_estrazione()
|
||||||
{
|
{
|
||||||
TMask& msk = inclusi_mask();
|
TMask& msk = inclusi_mask();
|
||||||
|
|
||||||
@ -529,14 +649,14 @@ void TMonitor_mask::open_mostra_estrazione() const
|
|||||||
msk.set(F_IDAL, _row->get(cid2index(F_DATADAL)));
|
msk.set(F_IDAL, _row->get(cid2index(F_DATADAL)));
|
||||||
msk.set(F_IAL, _row->get(cid2index(F_DATAAL)));
|
msk.set(F_IAL, _row->get(cid2index(F_DATAAL)));
|
||||||
|
|
||||||
const TString& codsoc = f9_app().get_ambiente();
|
const TString& codsoc = F9CONF.get_ambiente();
|
||||||
const char tipodoc = _row->get(cid2index(F_TIPODOC))[0];
|
const char tipodoc = _row->get(cid2index(F_TIPODOC))[0];
|
||||||
|
|
||||||
static TString last_fill_id = 0;
|
static TString last_fill_id = 0;
|
||||||
if (last_fill_id != id)
|
if (last_fill_id != id)
|
||||||
{
|
{
|
||||||
fill_escl(msk, codsoc, id, tipodoc);
|
fill_estr(codsoc, id, tipodoc);
|
||||||
fill_res (msk, codsoc, id, tipodoc);
|
fill_res (codsoc, id, tipodoc);
|
||||||
last_fill_id = id;
|
last_fill_id = id;
|
||||||
}
|
}
|
||||||
msk.run();
|
msk.run();
|
||||||
@ -544,7 +664,7 @@ void TMonitor_mask::open_mostra_estrazione() const
|
|||||||
|
|
||||||
void TMonitor_mask::open_win_estr()
|
void TMonitor_mask::open_win_estr()
|
||||||
{
|
{
|
||||||
if (!f9_app().get_ambiente().full())
|
if (!F9CONF.get_ambiente().full())
|
||||||
warning_box("Inserire codice ambiente societa' in configurazione");
|
warning_box("Inserire codice ambiente societa' in configurazione");
|
||||||
else f9_app().run_estr_msk();
|
else f9_app().run_estr_msk();
|
||||||
}
|
}
|
||||||
@ -595,8 +715,6 @@ void TMonitor_mask::sel() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// TControllo_mask
|
// TControllo_mask
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
@ -961,6 +1079,11 @@ const char* TF9_app::traduci_stato(const TString& cod)
|
|||||||
return (const char*)stato;
|
return (const char*)stato;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TF9_app::notify_estraction() const
|
||||||
|
{
|
||||||
|
_msk->fill();
|
||||||
|
}
|
||||||
|
|
||||||
// Estrazione esclusi
|
// Estrazione esclusi
|
||||||
|
|
||||||
bool TF9_app::select_escl_notify(TSheet_field& s, int row, KEY key)
|
bool TF9_app::select_escl_notify(TSheet_field& s, int row, KEY key)
|
||||||
@ -982,7 +1105,7 @@ 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)
|
||||||
{
|
{
|
||||||
TF9_app& app = f9_app();
|
TF9_app& app = f9_app();
|
||||||
TControllo_mask controllo(app.get_ambiente(), app._estr_escluso->get_id_estr(), true);
|
TControllo_mask controllo(F9CONF.get_ambiente(), app._estr_escluso->get_id_estr(), true);
|
||||||
controllo.run();
|
controllo.run();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1148,7 +1271,7 @@ bool TF9_app::estrai_escl_handler(TMask_field&, KEY key)
|
|||||||
descr_msk().set(DES_TEXT, "");
|
descr_msk().set(DES_TEXT, "");
|
||||||
|
|
||||||
a._estr_escluso =
|
a._estr_escluso =
|
||||||
new TEstrazione(a.get_ambiente(), a._flagprov_escl, a._tipodoc_escl, descr, a.get_addr_doc(), true);
|
new TEstrazione(F9CONF.get_ambiente(), a._flagprov_escl, a._tipodoc_escl, descr, F9CONF.get_addr_doc(), true);
|
||||||
|
|
||||||
// Prendo la riga selezionata (e controllo che sia selezionato qualcosa)
|
// Prendo la riga selezionata (e controllo che sia selezionato qualcosa)
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
@ -1177,15 +1300,6 @@ bool TF9_app::estrai_escl_handler(TMask_field&, KEY key)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TF9_app::mov_handler(TMask_field& f, KEY key)
|
|
||||||
{
|
|
||||||
TSheet_field& sf = inclusi_mask().sfield(S_ESCL);
|
|
||||||
TToken_string& row = sf.row(sf.selected());
|
|
||||||
TRectype mov(LF_MOV);
|
|
||||||
mov.put(MOV_NUMREG, row.get(sf.cid2index(F_NUMREG)));
|
|
||||||
return open_mov(mov);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TF9_app::mov_handler_escl(TMask_field& f, KEY key)
|
bool TF9_app::mov_handler_escl(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
TSheet_field& sf = esclusi_mask().sfield(S_ESCL);
|
TSheet_field& sf = esclusi_mask().sfield(S_ESCL);
|
||||||
@ -1201,109 +1315,7 @@ void TF9_app::edit_wa(TString& old_codsoc) const
|
|||||||
if (!old_codsoc.empty())
|
if (!old_codsoc.empty())
|
||||||
query << "DELETE FROM " F9_WA " WHERE " WA_CODSOC " = '" << old_codsoc << "';\n";
|
query << "DELETE FROM " F9_WA " WHERE " WA_CODSOC " = '" << old_codsoc << "';\n";
|
||||||
query << "INSERT INTO " F9_WA " (" WA_CODSOC ", " WA_ADDR_DOC ") VALUES (" <<
|
query << "INSERT INTO " F9_WA " (" WA_CODSOC ", " WA_ADDR_DOC ") VALUES (" <<
|
||||||
_config.ambiente << ", " << _config.addr_doc << ");";
|
F9CONF.get_ambiente() << ", " << F9CONF.get_addr_doc() << ");";
|
||||||
}
|
|
||||||
|
|
||||||
int TF9_app::estrai()
|
|
||||||
{
|
|
||||||
const TDate dataini = get_dataini();
|
|
||||||
const TDate dataend = get_dataend();
|
|
||||||
const char tipodoc = get_tipodoc();
|
|
||||||
const bool flagpro = is_provviso();
|
|
||||||
|
|
||||||
// Vero e proprio oggetto estrazione
|
|
||||||
_estrazione = make_unique<TEstrazione>(
|
|
||||||
get_ambiente(), // Codice ambiente
|
|
||||||
flagpro, // Flag prov.
|
|
||||||
tipodoc, // Tipo doc.
|
|
||||||
get_descr(), // Descrizione estrazione
|
|
||||||
get_addr_doc(), // Cartella documenti
|
|
||||||
false, // Estrazione di un escluso
|
|
||||||
&dataini, // Data estr. mov dal
|
|
||||||
&dataend, // Data estr. mov al
|
|
||||||
get_has_checkvend(), // Flag in configurazione per aggiungere controllo f.e. in vendite
|
|
||||||
get_has_cartexp() // Flag per estrarre anche i doc. cartacei
|
|
||||||
);
|
|
||||||
|
|
||||||
// Leggo i movimenti e li carico nell'estrazione. /////////////
|
|
||||||
TString query;
|
|
||||||
query << "SELECT * FROM MOV WHERE DATAREG>=" << dataini.date2ansi() << " AND DATAREG<=" << dataend.date2ansi() << ";";
|
|
||||||
TSQL_recordset mov(query);
|
|
||||||
|
|
||||||
TProgress_monitor progr(mov.items(), "Acquisizione movimenti", false);
|
|
||||||
TLocalisamfile clifo(LF_CLIFO);
|
|
||||||
const TipoIVA tipo = tipodoc == 'A' ? iva_acquisti : iva_vendite;
|
|
||||||
|
|
||||||
// Prendo tutti i movimenti a partire da una data e li carico tutti fino alla data finale
|
|
||||||
for (bool ok = mov.move_first(); ok; ok = mov.move_next())
|
|
||||||
{
|
|
||||||
if (!progr.add_status())
|
|
||||||
break;
|
|
||||||
|
|
||||||
TToken_string elab_f9(recset_get_string(mov, MOV_ELABF9), ';'); // Stringa del campo elaborazione f9 nel file mov
|
|
||||||
const bool escluso = !(elab_f9.items() == 3 && elab_f9.get(2)[0] != 'X' || elab_f9.empty());
|
|
||||||
const TCausale caus(recset_get_string(mov, MOV_CODCAUS, 3));
|
|
||||||
const bool stampato = recset_get_bool(mov, MOV_REGST);
|
|
||||||
const TString& numdoc = recset_get_string(mov, MOV_NUMDOC);
|
|
||||||
const TRegistro& reg = caus.reg();
|
|
||||||
const TipoIVA& iva = reg.iva();
|
|
||||||
// Se definitivo controllo il flag di stampato REGST
|
|
||||||
if ((flagpro || stampato) && numdoc.full() && iva == tipo)
|
|
||||||
{
|
|
||||||
clifo.zero();
|
|
||||||
clifo.put(CLI_TIPOCF, tipo == iva_acquisti ? "F" : "C");
|
|
||||||
clifo.put(CLI_CODCF, recset_get_string(mov, MOV_CODCF));
|
|
||||||
|
|
||||||
// Creo il movimento da inserire
|
|
||||||
movimento_t t;
|
|
||||||
t.err = false;
|
|
||||||
t.numreg = recset_get_int (mov, MOV_NUMREG);
|
|
||||||
t.datareg = recset_get_string(mov, MOV_DATAREG);
|
|
||||||
t.datadoc = recset_get_string(mov, MOV_DATADOC);
|
|
||||||
t.codcaus = recset_get_string(mov, MOV_CODCAUS, 3);
|
|
||||||
t.meseliq = recset_get_int (mov, MOV_MESELIQ);
|
|
||||||
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.codcf = recset_get_int (mov, MOV_CODCF);
|
|
||||||
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.descr = recset_get_string(mov, MOV_DESCR);
|
|
||||||
if (escluso)
|
|
||||||
{
|
|
||||||
t.estratto = false;
|
|
||||||
t.descr_estr = movimento_t::escluso;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Effettivo inserimento del movimento
|
|
||||||
_estrazione->add_mov(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_stats = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
const result_estr result = _estrazione->estrai();
|
|
||||||
#ifdef DBG
|
|
||||||
TString msg;
|
|
||||||
msg << "total: " << (int)_stats.total << "\n";
|
|
||||||
if (tipodoc == 'A')
|
|
||||||
{
|
|
||||||
msg << "Movimenti saltati: " << (int)_stats.fa_skip << "\n";
|
|
||||||
msg << "Movimenti in errore: " << (int)_stats.fa_err << "\n";
|
|
||||||
msg << "Movimenti estratti: " << (int)_stats.fa_estr << "\n";
|
|
||||||
msg << "Movimenti senza cat. doc.: " << (int)_stats.fa_nocatdoc;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg << "Movimenti saltati poiche' cartacei: " << (int)_stats.fv_cart_skip << "\n";
|
|
||||||
msg << "Movimenti in errore: " << (int)_stats.fv_err << "\n";
|
|
||||||
msg << "Movimenti estratti: " << (int)_stats.fv_estr << "\n";
|
|
||||||
msg << "Movimenti senza cat. doc.: " << (int)_stats.fv_nocatdoc;
|
|
||||||
}
|
|
||||||
message_box(msg);
|
|
||||||
#endif
|
|
||||||
// Ricalcolo sheet estrazioni
|
|
||||||
_msk->fill();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TF9_app::print_log()
|
void TF9_app::print_log()
|
||||||
@ -1343,15 +1355,6 @@ bool TF9_app::segna_estratti(const bool escluso, const int numreg)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TF9_app::segna_in_errore()
|
|
||||||
{
|
|
||||||
TString query;
|
|
||||||
query << "UPDATE " F9_DRD "\n"
|
|
||||||
"SET " DRD_STATO " = '" D_GEST_ERR "'\n"
|
|
||||||
"WHERE " DRD_ID_EST " = '" << f9_app()._estrazione->get_id_estr() << "'\n";
|
|
||||||
fp_db().sq_set_exec(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TF9_app::create_tables() const
|
bool TF9_app::create_tables() const
|
||||||
{
|
{
|
||||||
bool ok = aggiorna_tab_f9(100);
|
bool ok = aggiorna_tab_f9(100);
|
||||||
@ -1508,12 +1511,9 @@ void TF9_app::main_loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF9_app::TF9_app()
|
TF9_app::TF9_app()
|
||||||
: _config({ "", "", false, false, false }), _estr_msk(nullptr), _msk(nullptr), _mov_escl("", '|'),
|
: _estr_msk(nullptr), _msk(nullptr), _mov_escl("", '|'),
|
||||||
_tipodoc_escl('A'), _flagprov_escl('P'), _estrazione(nullptr), _estr_escluso(nullptr)
|
_tipodoc_escl('A'), _flagprov_escl('P'), _estr_escluso(nullptr)
|
||||||
{
|
{ }
|
||||||
_config.ambiente = ini_get_string(CONFIG_DITTA, PAR_MOD, AMBIENTE_F9);
|
|
||||||
_config.addr_doc = ini_get_string(CONFIG_DITTA, PAR_MOD, ADDRCART_F9);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
119
src/f9/f90100.h
119
src/f9/f90100.h
@ -21,13 +21,30 @@
|
|||||||
class TEstrai_mask : public TMask
|
class TEstrai_mask : public TMask
|
||||||
{
|
{
|
||||||
TString _descr;
|
TString _descr;
|
||||||
|
unique_ptr<TEstrazione> _estrazione; // Oggetto estrazione in corso di elaborazione
|
||||||
|
|
||||||
void enable_fields(bool en = true);
|
void enable_fields(bool en = true);
|
||||||
|
|
||||||
|
TDate get_dataini() const { return get_date(ES_DATAINI); }
|
||||||
|
TDate get_dataend() const { return get_date(ES_DATAEND); }
|
||||||
|
char get_tipodoc() const { return get(ES_TIPODOC)[0]; }
|
||||||
|
TipoIVA get_tipoiva() const { return get_tipodoc() == 'A' ? iva_acquisti : iva_vendite; }
|
||||||
|
TString get_descr() const { return get(ES_DESCR); }
|
||||||
|
bool is_provviso() const { return get(ES_FLAGPROV)[0] == 'P'; }
|
||||||
|
|
||||||
|
/* Prepara l'estrazione caricando tutti i movimenti dato un periodo (data registrazione),
|
||||||
|
* e avvia la procedura di estrazione.
|
||||||
|
* [See TEstrazione::estrai()].
|
||||||
|
*/
|
||||||
|
int estrai();
|
||||||
|
/** Segna su DRD che l'estrazione e' in errore diag. gestionale. */
|
||||||
|
void segna_in_errore() const;
|
||||||
|
|
||||||
static bool estrai_handler(TMask_field& f, KEY key);
|
static bool estrai_handler(TMask_field& f, KEY key);
|
||||||
static bool enable_handler(TMask_field& f, KEY key);
|
static bool enable_handler(TMask_field& f, KEY key);
|
||||||
static bool dataini_handler(TMask_field& f, KEY key);
|
static bool dataini_handler(TMask_field& f, KEY key);
|
||||||
static bool dataend_handler(TMask_field& f, KEY key);
|
static bool dataend_handler(TMask_field& f, KEY key);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TString& get_descr() { return _descr; }
|
TString& get_descr() { return _descr; }
|
||||||
TEstrai_mask();
|
TEstrai_mask();
|
||||||
@ -36,6 +53,41 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TF9_config
|
||||||
|
{
|
||||||
|
// todo: controllare che siano sqlsafe
|
||||||
|
|
||||||
|
TString _ambiente; // Codice ambiente (codsoc)
|
||||||
|
TString _addr_doc; // Indirizzo documenti cartacei
|
||||||
|
bool _cartexp{ false };
|
||||||
|
bool _checkvend{ false };
|
||||||
|
bool _viewmovpre{ false };
|
||||||
|
|
||||||
|
public:
|
||||||
|
const TString& get_ambiente() const { return _ambiente; }
|
||||||
|
const TString& get_addr_doc() const { return _addr_doc; }
|
||||||
|
bool get_has_cartexp() const { return _cartexp; }
|
||||||
|
bool get_has_checkvend() const { return _checkvend; }
|
||||||
|
bool get_viewmov() const { return _viewmovpre; }
|
||||||
|
|
||||||
|
void set_ambiente(const char* cod) { _ambiente.cut(0) << cod; }
|
||||||
|
void set_addr_doc(const char* add) { _addr_doc.cut(0) << add; }
|
||||||
|
void set_has_cartexp(const bool flag) { _cartexp = flag; }
|
||||||
|
void set_has_checkvend(const bool flag){ _checkvend = flag; }
|
||||||
|
void set_viewmov(const bool flag) { _viewmovpre = flag; } // Unused.
|
||||||
|
|
||||||
|
TF9_config()
|
||||||
|
{
|
||||||
|
_ambiente = ini_get_string(CONFIG_DITTA, PAR_MOD, AMBIENTE_F9);
|
||||||
|
_addr_doc = ini_get_string(CONFIG_DITTA, PAR_MOD, ADDRCART_F9);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
extern TF9_config F9CONF;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TF9_app : public TSkeleton_application
|
class TF9_app : public TSkeleton_application
|
||||||
{
|
{
|
||||||
//friend class TEstrai_mask;
|
//friend class TEstrai_mask;
|
||||||
@ -43,14 +95,7 @@ class TF9_app : public TSkeleton_application
|
|||||||
friend class TControllo_mask;
|
friend class TControllo_mask;
|
||||||
friend class TEstrazione;
|
friend class TEstrazione;
|
||||||
|
|
||||||
struct config
|
|
||||||
{
|
|
||||||
TString ambiente; // Codice ambiente (codsoc)
|
|
||||||
TString addr_doc; // Indirizzo documenti cartacei
|
|
||||||
bool cartexp;
|
|
||||||
bool checkvend;
|
|
||||||
bool viewmovpre;
|
|
||||||
} _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;
|
||||||
@ -61,36 +106,19 @@ class TF9_app : public TSkeleton_application
|
|||||||
char _flagprov_escl;
|
char _flagprov_escl;
|
||||||
TString _log;
|
TString _log;
|
||||||
|
|
||||||
unique_ptr<TEstrazione> _estrazione;
|
|
||||||
TEstrazione* _estr_escluso;
|
TEstrazione* _estr_escluso;
|
||||||
|
|
||||||
TDate get_dataini() const { return _estr_msk->get_date(ES_DATAINI); }
|
|
||||||
TDate get_dataend() const { return _estr_msk->get_date(ES_DATAEND); }
|
|
||||||
char get_tipodoc() const { return _estr_msk->get(ES_TIPODOC)[0]; }
|
|
||||||
char get_tipodoc_escl() const { return _tipodoc_escl; }
|
|
||||||
TipoIVA get_tipoiva() const { return get_tipodoc() == 'A' ? iva_acquisti : iva_vendite; }
|
|
||||||
TipoIVA get_tipoiva_escl() const { return get_tipodoc_escl() == 'A' ? iva_acquisti : iva_vendite; }
|
|
||||||
TString get_descr() const { return _estr_msk->get(ES_DESCR); }
|
|
||||||
bool is_provviso() const { return _estr_msk->get(ES_FLAGPROV)[0] == 'P'; }
|
|
||||||
|
|
||||||
// Dato il codice stato estrazione (es. '01') viene restituito il suo significato a parole.
|
char get_tipodoc_escl() const { return _tipodoc_escl; }
|
||||||
|
TipoIVA get_tipoiva_escl() const { return get_tipodoc_escl() == 'A' ? iva_acquisti : iva_vendite; }
|
||||||
|
|
||||||
|
// 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 const char* traduci_stato(const TString& cod);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const TString& get_ambiente() const { return _config.ambiente; }
|
/** Mostra la finestrella per l'inserimento delle opzioni per l'estrazione e avviarla. */
|
||||||
const TString& get_addr_doc() const { return _config.addr_doc; }
|
|
||||||
bool get_has_cartexp() const { return _config.cartexp; }
|
|
||||||
bool get_has_checkvend() const { return _config.checkvend; }
|
|
||||||
bool get_viewmov() const { return _config.viewmovpre; }
|
|
||||||
|
|
||||||
void set_ambiente(const char* cod) { _config.ambiente.cut(0) << cod; }
|
|
||||||
void set_addr_doc(const char* add) { _config.addr_doc.cut(0) << add; }
|
|
||||||
void set_has_cartexp(const bool flag) { _config.cartexp = flag; }
|
|
||||||
void set_has_checkvend(const bool flag){ _config.checkvend = flag; }
|
|
||||||
void set_viewmov(const bool flag) { _config.viewmovpre = flag; }
|
|
||||||
|
|
||||||
/** Esegue la maschera di inserimento opzioni per avviare l'estrazione. */
|
|
||||||
void run_estr_msk() const { _estr_msk->run(); }
|
void run_estr_msk() const { _estr_msk->run(); }
|
||||||
|
void notify_estraction() const;
|
||||||
|
|
||||||
// Estrazione esclusi - handlers
|
// Estrazione esclusi - handlers
|
||||||
|
|
||||||
@ -104,16 +132,10 @@ public:
|
|||||||
|
|
||||||
static movimento_t escl2mov(TToken_string* row);
|
static movimento_t escl2mov(TToken_string* row);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
/** Aggiorna tabella F9WA. */
|
/** Aggiorna tabella F9WA. */
|
||||||
void edit_wa(TString& old_codsoc) const;
|
void edit_wa(TString& old_codsoc) const;
|
||||||
/** Prepara l'estrazione caricando tutti i movimenti dato un periodo (data registrazione),
|
|
||||||
* e avvia la procedura di estrazione.
|
|
||||||
* \return See \a TEstrazione::estrai().
|
|
||||||
*/
|
|
||||||
int estrai();
|
|
||||||
|
|
||||||
// logs
|
// logs
|
||||||
|
|
||||||
@ -125,20 +147,16 @@ public:
|
|||||||
|
|
||||||
/** Segna su mov che il movimento e' stato estratto. */
|
/** Segna su mov che il movimento e' stato estratto. */
|
||||||
bool segna_estratti(bool escluso = false, int numreg = 0);
|
bool segna_estratti(bool escluso = false, int numreg = 0);
|
||||||
/** Segna su DRD che l'estrazione e' in errore diag. gestionale. */
|
|
||||||
static void segna_in_errore();
|
|
||||||
|
|
||||||
// Controllo e aggiornamento tabelle F9
|
// Controllo e aggiornamento tabelle F9
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool create_tables() const; // Creazione tabelle F9.
|
bool create_tables() const; // Creazione tabelle F9.
|
||||||
bool check_tabelle_f9() const; // Controllo esistenza delle tabelle e in caso le crea.
|
bool check_tabelle_f9() const; // Controllo esistenza delle tabelle e in caso le crea.
|
||||||
bool aggiorna_tab_f9(int version) const; // Aggiorna modifiche alle tabelle F9 come descritto in cima al file f90100.cpp.
|
bool aggiorna_tab_f9(int version) const; // Aggiorna modifiche alle tabelle F9 come descritto in cima al file f90100.cpp.
|
||||||
bool check_tab_version() const; // Controllo della versione e in caso aggiorna le tabelle.
|
bool check_tab_version() const; // Controllo della versione e in caso aggiorna le tabelle.
|
||||||
|
bool check_table() const; // Controllo e aggiornamento versione sql. Chiamata in main_loop.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool check_table() const; /**< Controllo e aggiornamento versione sql. */
|
|
||||||
|
|
||||||
void main_loop() override;
|
void main_loop() override;
|
||||||
|
|
||||||
TF9_app();
|
TF9_app();
|
||||||
@ -152,13 +170,24 @@ inline TF9_app& f9_app()
|
|||||||
return *app;
|
return *app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TMonitor_mask : public TAutomask
|
class TMonitor_mask : public TAutomask
|
||||||
{
|
{
|
||||||
friend class TF9_app;
|
friend class TF9_app;
|
||||||
vector<TToken_string> _fppro;
|
vector<TToken_string> _fppro;
|
||||||
|
std::unique_ptr<TMask> _inclusi_mask;
|
||||||
|
|
||||||
|
// Configurazione mask
|
||||||
static bool save_conf_handler(TMask_field& f, KEY key);
|
static bool save_conf_handler(TMask_field& f, KEY key);
|
||||||
|
// Apri Estr. mask
|
||||||
|
static bool estr_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;
|
||||||
|
|
||||||
|
// Controllo estr. mask
|
||||||
void controllo_errori() const;
|
void controllo_errori() const;
|
||||||
void delete_pack(bool all = false) const;
|
void delete_pack(bool all = false) const;
|
||||||
|
|
||||||
@ -167,13 +196,13 @@ class TMonitor_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;
|
||||||
bool on_key(KEY key) override;
|
bool on_key(KEY key) override;
|
||||||
void open_mostra_estrazione() const;
|
void open_mostra_estrazione();
|
||||||
static void open_win_estr();
|
static void open_win_estr();
|
||||||
void open_win_conf() const;
|
void open_win_conf() const;
|
||||||
|
|
||||||
void sel() const;
|
void sel() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TMonitor_mask() : TAutomask("f90100a") { fill(); }
|
TMonitor_mask() : TAutomask("f90100a"), _inclusi_mask(nullptr) { fill(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TControllo_mask : public TAutomask
|
class TControllo_mask : public TAutomask
|
||||||
|
Loading…
x
Reference in New Issue
Block a user