Patch level : 12.0 672
Files correlati : fp Commento : - Nuova gestione sheet di selezione documenti - Sistemata divisa estera
This commit is contained in:
parent
a80257ad25
commit
7ef28262bd
@ -68,19 +68,11 @@ void TPA_mask::save_all_fields() const
|
||||
ini_set_string(CONFIG_DITTA, "fp", "dataini", get(F_DATAINI));
|
||||
ini_set_string(CONFIG_DITTA, "fp", "dataend", get(F_DATAEND));
|
||||
|
||||
TToken_string tipidocs(get_tmp_string(), ';');
|
||||
FOR_EACH_SHEET_ROW(sfield(F_DOCUMENTI_TIPO), n, r)
|
||||
{
|
||||
TToken_string app;
|
||||
// Prendo tutta la riga tranne il cod sdi
|
||||
app.add(r->get(_codnum));
|
||||
app.add(r->get(_tipodoc));
|
||||
app.add(r->get(_dastato));
|
||||
app.add(r->get(_astato));
|
||||
tipidocs.add(app);
|
||||
}
|
||||
ini_set_string(CONFIG_DITTA, "fp", "accepted_docs", tipidocs);
|
||||
// Salvo lo sheet
|
||||
TFP_selected_docs selected_docs;
|
||||
selected_docs.save_sheet(sfield(F_DOCUMENTI_TIPO));
|
||||
|
||||
// Salvo le impostazioni
|
||||
fp_settings().set_esp_pri_empty(get_bool(F_SETDEFCOD));
|
||||
fp_settings().set_esp_est(get_bool(F_SETCODEST));
|
||||
fp_settings().set_esp_est_cod(get(F_VALCODEST));
|
||||
@ -96,7 +88,14 @@ void TPA_mask::load_all_fields()
|
||||
auto& sheet = sfield(F_DOCUMENTI_TIPO);
|
||||
sheet.hide();
|
||||
|
||||
if(s_accepted_docs.full())
|
||||
TFP_selected_docs selected_docs;
|
||||
|
||||
if (selected_docs.has_selected_docs())
|
||||
{
|
||||
// Super nuova gestione super avanzata!
|
||||
selected_docs.fill_sheet(sheet);
|
||||
}
|
||||
else if(s_accepted_docs.full())
|
||||
{
|
||||
// Nuova gestione avanzata!
|
||||
FOR_EACH_STR_TOKEN(s_accepted_docs, tok)
|
||||
@ -431,7 +430,6 @@ void TPA_mask::set_err_paf()
|
||||
TSheet_field& sfld = sfield(F_DOCS);
|
||||
TString_array& sht = sfld.rows_array();
|
||||
TLocalisamfile fdoc(LF_DOC);
|
||||
TRectype doc(LF_DOC);
|
||||
if (!sht.empty())
|
||||
{
|
||||
TProgress_monitor pi(sht.items(), "Cambio stato fatture");
|
||||
@ -447,16 +445,16 @@ void TPA_mask::set_err_paf()
|
||||
const TFixed_string codnum(riga->get(sfield(F_DOCS).cid2index(S_CODNUM))); // lascio sapientemente per ultima la get di una stringa
|
||||
const TDoc_key key(anno, codnum, ndoc);
|
||||
|
||||
// Verifico che il codice sdi nello sheet sia lo stesso sulla testata del documento in caso contrario lo aggiorno
|
||||
doc.zero();
|
||||
doc.put(DOC_PROVV, key.provv());
|
||||
doc.put(DOC_ANNO, key.anno());
|
||||
doc.put(DOC_CODNUM, key.codnum());
|
||||
doc.put(DOC_NDOC, key.ndoc());
|
||||
// Ricontrollo che la fattura sia presente in Campo prima di cambiare stato
|
||||
fdoc.zero();
|
||||
fdoc.put(DOC_PROVV, key.provv());
|
||||
fdoc.put(DOC_ANNO, key.anno());
|
||||
fdoc.put(DOC_CODNUM, key.codnum());
|
||||
fdoc.put(DOC_NDOC, key.ndoc());
|
||||
|
||||
TString hfatt, bfatt;
|
||||
TPaf_record paf0100f("PAF0100F");
|
||||
if (doc.read(fdoc) == NOERR && chiave_paf(doc, hfatt, bfatt) && paf0100f.search(nullptr, hfatt, bfatt))
|
||||
if (fdoc.read() == NOERR && chiave_paf(fdoc.curr(), hfatt, bfatt) && paf0100f.search(nullptr, hfatt, bfatt))
|
||||
{
|
||||
TString query = "UPDATE PAF0100F SET P1_GESTIONE = 'E' WHERE P1_KEYHEADERFATT = '"; query << hfatt << "' AND P1_KEYBODYFATT = '" << bfatt << "';";
|
||||
if(!fp_db().sq_set_exec(query))
|
||||
|
@ -193,4 +193,21 @@ inline TFP_settings& fp_settings()
|
||||
return *erbuggo;
|
||||
}
|
||||
|
||||
class TFP_selected_docs : public TObject
|
||||
{
|
||||
TRelation _r_tabmod;
|
||||
TRectype _flt;
|
||||
std::unique_ptr<TCursor> _cur;
|
||||
TRectype fill_rectype() const;
|
||||
|
||||
enum { _codnum, _tipodoc, _dastato, _astato, _tiposdi };
|
||||
|
||||
public:
|
||||
void fill_sheet(TSheet_field& sheet) const;
|
||||
inline bool has_selected_docs() const { return _cur->items() > 0; }
|
||||
void save_sheet(const TSheet_field& sheet) const;
|
||||
|
||||
TFP_selected_docs();
|
||||
};
|
||||
|
||||
#endif // __FPLIB_H
|
||||
|
@ -150,6 +150,7 @@ bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt)
|
||||
CHECK(hfatt.full(), "Destinatario fattura P.A. non valido");
|
||||
|
||||
const TCodice_numerazione& codnum = doc.codice_numerazione();
|
||||
//20180101_TD01_123456712345671234567
|
||||
bfatt.cut(0) << doc.get_date(DOC_DATADOC).date2ansi() << '_' << tipo_doc_sdi(doc) << '_' << doc.numero();
|
||||
return hfatt.full() && bfatt.full();
|
||||
}
|
||||
@ -1084,7 +1085,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
paf0700f.set("P7_KEYBODYFATT", _bfatt);
|
||||
remove(paf0700f);
|
||||
paf0700f.set("P7_TIPODOC", tipo_doc_sdi(doc));
|
||||
paf0700f.set("P7_DIVISA", _doc_cambio._cod_val.full() ? _doc_cambio._cod_val : "EUR");
|
||||
paf0700f.set("P7_DIVISA", "EUR"); // Fisso su euro in quanto effettuiamo il cambio
|
||||
paf0700f.set("P7_DATA", doc.data());
|
||||
|
||||
paf0700f.set("P7_NUMERO", doc.numero());
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
#define FILE_CONFIG CONFIG_DITTA
|
||||
#define FILE_SECTION "fp"
|
||||
#define FP_TAB_MOD "FP"
|
||||
|
||||
|
||||
|
||||
#define FP_IP "ip"
|
||||
#define FP_DB "db"
|
||||
@ -17,6 +20,14 @@
|
||||
#define FP_ESP_EST_COD "espestcod"
|
||||
#define FP_F8 "f8"
|
||||
|
||||
#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"
|
||||
|
||||
|
||||
|
||||
const TString& TFP_settings::get_db_indirizzo() const
|
||||
{
|
||||
@ -153,3 +164,58 @@ void TFP_settings::set_f8(const bool f8) const
|
||||
ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_F8, f8);
|
||||
}
|
||||
|
||||
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));
|
||||
row.add(TTipo_documento(TString() << rec.get("S0") << "|" << rec.get("S1")).tipo_doc_sdi());
|
||||
}
|
||||
}
|
||||
|
||||
void TFP_selected_docs::save_sheet(const TSheet_field& sheet) const
|
||||
{
|
||||
// Svuoto il db
|
||||
TLocalisamfile tabmod(LF_TABMOD);
|
||||
TRectype rec(LF_TABMOD);
|
||||
|
||||
for (*_cur = 0; _cur->pos() < _cur->items(); ++*_cur)
|
||||
{
|
||||
rec = _cur->curr();
|
||||
rec.remove(tabmod);
|
||||
}
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user