2019-01-02 14:48:09 +01:00
|
|
|
#include "fplib.h"
|
|
|
|
|
|
|
|
#define FILE_CONFIG CONFIG_DITTA
|
|
|
|
#define FILE_SECTION "fp"
|
2019-01-10 14:11:28 +01:00
|
|
|
#define FP_TAB_MOD "FP"
|
|
|
|
|
|
|
|
|
2019-01-02 14:48:09 +01:00
|
|
|
|
|
|
|
#define FP_IP "ip"
|
|
|
|
#define FP_DB "db"
|
|
|
|
#define FP_USR "usr"
|
|
|
|
#define FP_PSW "psw"
|
|
|
|
#define FP_FLD_DEST "flddest"
|
|
|
|
#define FP_FLD_USR_DEST "fldusrdest"
|
|
|
|
#define FP_COFI_TRAS "cofitras"
|
|
|
|
#define FP_GEST_ALLEG "gestioneallegati"
|
|
|
|
#define FP_ALLEG_FAT "allegafatt"
|
|
|
|
#define FP_ESP_PRI "esppri"
|
|
|
|
#define FP_ESP_EST "espest"
|
|
|
|
#define FP_ESP_EST_COD "espestcod"
|
2019-01-07 18:00:02 +01:00
|
|
|
#define FP_F8 "f8"
|
2019-01-02 14:48:09 +01:00
|
|
|
|
2019-01-10 14:11:28 +01:00
|
|
|
#define FP_SLD_COD "SLD"
|
|
|
|
#define FP_SLD_CODTAB "CODTAB"
|
|
|
|
#define FP_SLD_CODNUM "S0"
|
|
|
|
#define FP_SLD_TIPODOC "S1"
|
|
|
|
#define FP_SLD_DASTATO "I0"
|
|
|
|
#define FP_SLD_ASTATO "I1"
|
|
|
|
|
|
|
|
|
2019-01-02 14:48:09 +01:00
|
|
|
|
|
|
|
const TString& TFP_settings::get_db_indirizzo() const
|
|
|
|
{
|
|
|
|
return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_IP);
|
|
|
|
}
|
|
|
|
|
|
|
|
const TString& TFP_settings::get_db_database() const
|
|
|
|
{
|
|
|
|
return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_DB);
|
|
|
|
}
|
|
|
|
|
|
|
|
const TString& TFP_settings::get_db_str_con() const
|
|
|
|
{
|
|
|
|
return get_tmp_string().cut(0) << get_db_indirizzo() << "@" << get_db_database();
|
|
|
|
}
|
|
|
|
|
|
|
|
const TString& TFP_settings::get_db_user() const
|
|
|
|
{
|
|
|
|
return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_USR);
|
|
|
|
}
|
|
|
|
|
|
|
|
const TString& TFP_settings::get_db_password() const
|
|
|
|
{
|
|
|
|
return get_tmp_string().cut(0) << decode(ini_get_string(FILE_CONFIG, FILE_SECTION, FP_PSW));
|
|
|
|
}
|
|
|
|
|
|
|
|
const TString& TFP_settings::get_fld_dest() const
|
|
|
|
{
|
|
|
|
return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_FLD_DEST);
|
|
|
|
}
|
|
|
|
|
|
|
|
const TString& TFP_settings::get_fld_dest_usr() const
|
|
|
|
{
|
|
|
|
return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_FLD_USR_DEST, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
const TString& TFP_settings::get_cofi_tras() const
|
|
|
|
{
|
|
|
|
return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_COFI_TRAS);
|
|
|
|
}
|
|
|
|
|
|
|
|
const bool TFP_settings::get_gest_alleg() const
|
|
|
|
{
|
|
|
|
return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_GEST_ALLEG);
|
|
|
|
}
|
|
|
|
|
|
|
|
const bool TFP_settings::get_allega_fat() const
|
|
|
|
{
|
|
|
|
return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_ALLEG_FAT);
|
|
|
|
}
|
|
|
|
|
|
|
|
const bool TFP_settings::get_esp_pri_empty() const
|
|
|
|
{
|
|
|
|
return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_PRI);
|
|
|
|
}
|
|
|
|
|
|
|
|
const bool TFP_settings::get_esp_est() const
|
|
|
|
{
|
|
|
|
return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_EST);
|
|
|
|
}
|
|
|
|
|
|
|
|
const TString& TFP_settings::get_esp_est_cod() const
|
|
|
|
{
|
|
|
|
return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_ESP_EST_COD, "XXXXXXX");
|
|
|
|
}
|
|
|
|
|
2019-01-07 18:00:02 +01:00
|
|
|
const bool TFP_settings::is_f8() const
|
|
|
|
{
|
|
|
|
return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_F8);
|
|
|
|
}
|
|
|
|
|
2019-01-02 14:48:09 +01:00
|
|
|
void TFP_settings::set_db_indirizzo(const TString& ind) const
|
|
|
|
{
|
|
|
|
ini_set_string(FILE_CONFIG, FILE_SECTION, FP_IP, ind);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_db_database(const TString& db) const
|
|
|
|
{
|
|
|
|
ini_set_string(FILE_CONFIG, FILE_SECTION, FP_DB, db);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_db_user(const TString& usr) const
|
|
|
|
{
|
|
|
|
ini_set_string(FILE_CONFIG, FILE_SECTION, FP_USR, usr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_db_password(const TString& psw) const
|
|
|
|
{
|
|
|
|
ini_set_string(FILE_CONFIG, FILE_SECTION, FP_PSW, encode(psw));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_fld_dest(const TString& fld_dest) const
|
|
|
|
{
|
|
|
|
ini_set_string(FILE_CONFIG, FILE_SECTION, FP_FLD_DEST, fld_dest);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_fld_dest_usr(const TString& fld_dest_usr) const
|
|
|
|
{
|
|
|
|
ini_set_string(FILE_CONFIG, FILE_SECTION, FP_FLD_USR_DEST, fld_dest_usr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_cofi_tras(const TString& cofi) const
|
|
|
|
{
|
|
|
|
ini_set_string(FILE_CONFIG, FILE_SECTION, FP_COFI_TRAS, cofi);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_gest_alleg(const bool gest_alleg) const
|
|
|
|
{
|
|
|
|
ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_GEST_ALLEG, gest_alleg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_allega_fat(const bool allega_fatt) const
|
|
|
|
{
|
|
|
|
ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_ALLEG_FAT, allega_fatt);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_esp_pri_empty(const bool esp_pri) const
|
|
|
|
{
|
|
|
|
ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_PRI, esp_pri);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_esp_est(const bool esp_est) const
|
|
|
|
{
|
|
|
|
ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_EST, esp_est);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_settings::set_esp_est_cod(const TString& esp_est_cod) const
|
|
|
|
{
|
|
|
|
ini_set_string(FILE_CONFIG, FILE_SECTION, FP_ESP_EST_COD, esp_est_cod);
|
|
|
|
}
|
|
|
|
|
2019-01-07 18:00:02 +01:00
|
|
|
void TFP_settings::set_f8(const bool f8) const
|
|
|
|
{
|
|
|
|
ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_F8, f8);
|
|
|
|
}
|
|
|
|
|
2019-01-10 14:11:28 +01:00
|
|
|
TRectype TFP_selected_docs::fill_rectype() const
|
|
|
|
{
|
|
|
|
TRectype r(LF_TABMOD);
|
|
|
|
r.put("MOD", FP_TAB_MOD);
|
|
|
|
r.put("COD", FP_SLD_COD);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_selected_docs::fill_sheet(TSheet_field& sheet) const
|
|
|
|
{
|
|
|
|
for(*_cur = 0; _cur->pos() < _cur->items(); ++*_cur)
|
|
|
|
{
|
|
|
|
TRectype rec = _cur->curr();
|
|
|
|
TToken_string& row = sheet.row(-1);
|
|
|
|
row.add(rec.get(FP_SLD_CODNUM));
|
|
|
|
row.add(rec.get(FP_SLD_TIPODOC));
|
|
|
|
row.add(rec.get(FP_SLD_DASTATO));
|
|
|
|
row.add(rec.get(FP_SLD_ASTATO));
|
2019-01-25 14:47:19 +01:00
|
|
|
row.add(TTipo_documento(rec.get(FP_SLD_TIPODOC)).tipo_doc_sdi());
|
2019-01-10 14:11:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TFP_selected_docs::save_sheet(const TSheet_field& sheet) const
|
|
|
|
{
|
|
|
|
// Svuoto il db
|
|
|
|
TLocalisamfile tabmod(LF_TABMOD);
|
|
|
|
TRectype rec(LF_TABMOD);
|
|
|
|
|
2019-01-25 16:36:29 +01:00
|
|
|
for (*_cur = 0; _cur->pos() != _cur->items();)
|
2019-01-10 14:11:28 +01:00
|
|
|
{
|
|
|
|
rec = _cur->curr();
|
2019-01-25 16:36:29 +01:00
|
|
|
int err = rec.remove(tabmod);
|
2019-01-10 14:11:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Carico il db
|
|
|
|
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, n, r)
|
|
|
|
{
|
|
|
|
// Chissene anche se copio ogni volta
|
|
|
|
rec = fill_rectype();
|
|
|
|
rec.put(FP_SLD_CODTAB, n);
|
|
|
|
|
|
|
|
// Prendo tutta la riga tranne il cod sdi
|
|
|
|
rec.put(FP_SLD_CODNUM, r->get(_codnum));
|
|
|
|
rec.put(FP_SLD_TIPODOC, r->get(_tipodoc));
|
|
|
|
rec.put(FP_SLD_DASTATO, r->get(_dastato));
|
|
|
|
rec.put(FP_SLD_ASTATO, r->get(_astato));
|
|
|
|
rec.write(tabmod);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TFP_selected_docs::TFP_selected_docs() : _r_tabmod(LF_TABMOD), _flt(fill_rectype())
|
|
|
|
{
|
|
|
|
_cur.reset(new TCursor(&_r_tabmod, "", 1, &_flt, &_flt));
|
|
|
|
}
|