Patch level : 12.0 654
Files correlati : fp Commento : Rifatta gestione campi nei filtri con aggiunta del controllo sullo stato
This commit is contained in:
parent
59418e49a0
commit
82699bcf52
@ -20,7 +20,6 @@
|
||||
|
||||
#define LEN_HFATT 20
|
||||
#define LEN_BFATT 50
|
||||
#define MAPPA_DOC_SCELTI map<TString,TToken_string>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// TPa_mask
|
||||
@ -36,7 +35,7 @@ protected:
|
||||
void next_page(int p);
|
||||
bool check_not_empty();
|
||||
bool check_full_fields() const;
|
||||
bool check_doc_filter(const TDocumentoEsteso& td);
|
||||
bool check_doc_filter(const TDocumentoEsteso& td) const;
|
||||
void fill();
|
||||
void init();
|
||||
bool is_fattura(const TRectype& doc) const;
|
||||
@ -44,7 +43,6 @@ protected:
|
||||
void load_all_fields();
|
||||
|
||||
bool _filter_changed;
|
||||
unique_ptr<MAPPA_DOC_SCELTI> _doc_scelti;
|
||||
|
||||
public:
|
||||
TPA_mask() : TAutomask("fp0300a"), _filter_changed(true)
|
||||
@ -147,9 +145,6 @@ TString& add_filter(const TString& field, const TString& from, const TString& to
|
||||
|
||||
void TPA_mask::fill()
|
||||
{
|
||||
// Pulisco i tipi documento
|
||||
_doc_scelti.reset();
|
||||
|
||||
TSheet_field& docs = sfield(F_DOCS);
|
||||
TString_array& sht = docs.rows_array();
|
||||
docs.hide();
|
||||
@ -400,30 +395,23 @@ bool TPA_mask::check_full_fields() const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TPA_mask::check_doc_filter(const TDocumentoEsteso& d)
|
||||
bool TPA_mask::check_doc_filter(const TDocumentoEsteso& d) const
|
||||
{
|
||||
const TString codnum = d.get(DOC_CODNUM);
|
||||
const TString tipodoc = d.get(DOC_TIPODOC);
|
||||
const char stato = d.stato();
|
||||
const TTipo_documento& td = cached_tipodoc(d.get(DOC_TIPODOC));
|
||||
|
||||
// Mi precarico la tabella dei documenti scelti
|
||||
if(_doc_scelti == nullptr)
|
||||
FOR_EACH_SHEET_ROW(sfield(F_DOCUMENTI_TIPO), nr, row)
|
||||
{
|
||||
_doc_scelti.reset(new MAPPA_DOC_SCELTI);
|
||||
FOR_EACH_SHEET_ROW(sfield(F_DOCUMENTI_TIPO), n, r)
|
||||
{
|
||||
MAPPA_DOC_SCELTI & app = *_doc_scelti;
|
||||
TToken_string& tipi = app[r->get(_codnum)];
|
||||
if(tipi.find(r->get(_tipodoc)) < 0)
|
||||
{
|
||||
tipi.add(r->get(_tipodoc));
|
||||
}
|
||||
}
|
||||
if (codnum.compare(row->get(_codnum)) == 0 && // Codice numerazione
|
||||
tipodoc.compare(row->get(_tipodoc)) == 0 && // Tipo documento
|
||||
td.reg_fisc().full() && // Regime fiscale
|
||||
row->get_char(_dastato) <= stato && // Da stato
|
||||
row->get_char(_astato) >= stato) // A stato
|
||||
return true;
|
||||
}
|
||||
// Controllo innanzitutto che sia tra quelli scelti
|
||||
return
|
||||
_doc_scelti->find(d.codice_numerazione().codice()) != _doc_scelti->end() && // Esiste il codice numerazione
|
||||
(*_doc_scelti)[d.codice_numerazione().codice()].find(td.codice()) >= 0 && // Se esiste il tipo documento
|
||||
td.reg_fisc().full(); // Se ha il regime fiscale
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -804,10 +804,6 @@ bool TDoc_fp::add_row_art(const TString codice_tipo, const TString& codice_valor
|
||||
paf.set("PY_TIPOARTICOLO", codice_tipo);
|
||||
paf.set("PY_VALOREARTICOLO", codice_valore);
|
||||
const bool ok = insert(paf);
|
||||
#ifdef DBG
|
||||
if (!ok)
|
||||
error_box("Allah al bar!");
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -1032,7 +1028,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
paf0700f.set("P7_KEYBODYFATT", _bfatt);
|
||||
remove(paf0700f);
|
||||
paf0700f.set("P7_TIPODOC", doc.tipo().tipo_doc_sdi());
|
||||
paf0700f.set("P7_DIVISA", "EUR"); // Aggiungere codice ISO 4217 a tabella divise (%VAL)
|
||||
paf0700f.set("P7_DIVISA", ); // Aggiungere codice ISO 4217 a tabella divise (%VAL)
|
||||
paf0700f.set("P7_DATA", doc.data());
|
||||
|
||||
const TCodice_numerazione& codnum = doc.codice_numerazione();
|
||||
|
Loading…
x
Reference in New Issue
Block a user