Patch level : 12.0 654
Files correlati : fp Commento : - Aggiunta lettura codice SDI da documento - Aggiunta possibilià selezione codice SDI nello Sheet - Aggiunta salvataggio codice SDI se diverso da documento
This commit is contained in:
parent
a95bc75374
commit
85ad7cd2be
@ -4,6 +4,7 @@
|
||||
#include "fplib01.h"
|
||||
#include <progind.h>
|
||||
#include <cfven.h>
|
||||
#include <doc.h>
|
||||
|
||||
#include "../ve/velib05.h"
|
||||
#include "../cg/cglib03.h"
|
||||
@ -446,6 +447,8 @@ void TDoc2Paf::main_loop()
|
||||
{
|
||||
int ndocs = 0;
|
||||
TPA_mask mask;
|
||||
TLocalisamfile doc(LF_DOC);
|
||||
static const int col_cod_sdi = mask.sfield(F_DOCS).cid2index(S_CODSDI);
|
||||
while (mask.run() == K_ENTER)
|
||||
{
|
||||
TString_array& sht = mask.sfield(F_DOCS).rows_array();
|
||||
@ -463,8 +466,20 @@ void TDoc2Paf::main_loop()
|
||||
const long ndoc = riga->get_long(mask.sfield(F_DOCS).cid2index(S_NDOC));
|
||||
const TFixed_string codnum(riga->get(mask.sfield(F_DOCS).cid2index(S_CODNUM))); // lascio sapientemente per ultima la get di una stringa
|
||||
const TDoc_key key(anno, codnum, ndoc);
|
||||
if (elab.doc_to_paf(key))
|
||||
ndocs++;
|
||||
|
||||
// Verifico che il codice sdi nello sheet sia lo stesso sulla testata del documento in caso contrario lo aggiorno
|
||||
TRectype rec_doc = elab.key_to_doc(key);
|
||||
if(rec_doc.read(doc) == NOERR)
|
||||
{
|
||||
if(rec_doc.get(DOC_TIPODOCSDI).compare(riga->get(col_cod_sdi)) != 0)
|
||||
{
|
||||
rec_doc.put(DOC_TIPODOCSDI, riga->get(col_cod_sdi));
|
||||
rec_doc.rewrite(doc);
|
||||
}
|
||||
|
||||
if (elab.doc_to_paf(key))
|
||||
ndocs++;
|
||||
}
|
||||
}
|
||||
if (!pi.add_status(1))
|
||||
break;
|
||||
|
@ -177,10 +177,16 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING S_CODSDI 4
|
||||
LIST S_CODSDI 35
|
||||
BEGIN
|
||||
PROMPT 41 2 "Tipo SDI "
|
||||
FLAGS "D"
|
||||
PROMPT 41 2 "Tipo Doc SDI"
|
||||
ITEM "TD01|TD01 Fattura"
|
||||
ITEM "TD02|TD02 Acconto/Anticipo su fattura"
|
||||
ITEM "TD03|TD03 Acconto/Anticipo su parcella"
|
||||
ITEM "TD04|TD04 Nota di credito"
|
||||
ITEM "TD05|TD05 Nota di debito"
|
||||
ITEM "TD06|TD06 Parcella"
|
||||
ITEM "TD20|TD20 Autofattura"
|
||||
END
|
||||
|
||||
NUMBER S_NDOC 7
|
||||
|
@ -154,7 +154,7 @@ bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt)
|
||||
TString16 fullnumdoc;
|
||||
codnum.complete_num(ndoc, fullnumdoc);
|
||||
|
||||
bfatt.cut(0) << doc.get_date(DOC_DATADOC).date2ansi() << '_' << doc.tipo().tipo_doc_sdi() << '_' << fullnumdoc;
|
||||
bfatt.cut(0) << doc.get_date(DOC_DATADOC).date2ansi() << '_' << tipo_doc_sdi(doc) << '_' << fullnumdoc;
|
||||
return hfatt.full() && bfatt.full();
|
||||
}
|
||||
|
||||
@ -220,6 +220,11 @@ inline const TString& no_special(char a)
|
||||
return r;
|
||||
}
|
||||
|
||||
const TString& tipo_doc_sdi(const TDocumento& doc)
|
||||
{
|
||||
return doc.get(DOC_TIPODOCSDI).full() ? doc.get(DOC_TIPODOCSDI) : doc.tipo().tipo_doc_sdi();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* TPaf_record
|
||||
***************************************************************************/
|
||||
@ -1031,7 +1036,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
paf0700f.set("P7_KEYHEADERFATT", _hfatt);
|
||||
paf0700f.set("P7_KEYBODYFATT", _bfatt);
|
||||
remove(paf0700f);
|
||||
paf0700f.set("P7_TIPODOC", doc.tipo().tipo_doc_sdi());
|
||||
paf0700f.set("P7_TIPODOC", tipo_doc_sdi(doc));
|
||||
paf0700f.set("P7_DIVISA", "EUR"); // Aggiungere codice ISO 4217 a tabella divise (%VAL)
|
||||
paf0700f.set("P7_DATA", doc.data());
|
||||
|
||||
@ -1757,12 +1762,7 @@ bool TDoc_fp::doc_to_paf(const TRectype& rec)
|
||||
|
||||
bool TDoc_fp::doc_to_paf(const TDoc_key& key)
|
||||
{
|
||||
TRectype rec(LF_DOC);
|
||||
rec.put(DOC_PROVV, key.provv());
|
||||
rec.put(DOC_ANNO, key.anno());
|
||||
rec.put(DOC_CODNUM, key.codnum());
|
||||
rec.put(DOC_NDOC, key.ndoc());
|
||||
return doc_to_paf(rec);
|
||||
return doc_to_paf(key_to_doc(key));
|
||||
}
|
||||
|
||||
bool TDoc_fp::doc_to_paf(const TFilename& ini)
|
||||
@ -1775,7 +1775,25 @@ bool TDoc_fp::doc_to_paf(const TFilename& ini)
|
||||
return doc_to_paf(key);
|
||||
}
|
||||
|
||||
TDoc_fp::TDoc_fp() : _log(nullptr), _cache_insert(false)
|
||||
bool TDoc_fp::doc_to_paf()
|
||||
{
|
||||
return _doc_rec != nullptr ? doc_to_paf(*_doc_rec) : false;
|
||||
}
|
||||
|
||||
TRectype& TDoc_fp::key_to_doc(const TDoc_key& key)
|
||||
{
|
||||
if(_doc_rec != nullptr)
|
||||
delete _doc_rec;
|
||||
|
||||
_doc_rec = new TRectype(LF_DOC);
|
||||
_doc_rec->put(DOC_PROVV, key.provv());
|
||||
_doc_rec->put(DOC_ANNO, key.anno());
|
||||
_doc_rec->put(DOC_CODNUM, key.codnum());
|
||||
_doc_rec->put(DOC_NDOC, key.ndoc());
|
||||
return *_doc_rec;
|
||||
}
|
||||
|
||||
TDoc_fp::TDoc_fp() : _doc_rec(nullptr), _log(nullptr), _cache_insert(false)
|
||||
{
|
||||
_ditta.init(LF_NDITTE, prefix().get_codditta());
|
||||
_cofi = ini_get_string(CONFIG_DITTA, "fp", "cofitras");
|
||||
@ -1810,4 +1828,6 @@ TDoc_fp::TDoc_fp() : _log(nullptr), _cache_insert(false)
|
||||
TDoc_fp::~TDoc_fp()
|
||||
{
|
||||
commit();
|
||||
if (_doc_rec != nullptr)
|
||||
delete _doc_rec;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt);
|
||||
bool chiave_paf(const TRectype& doc, TString& hfatt, TString& bfatt);
|
||||
bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString& pec);
|
||||
inline const TString& no_special(char a);
|
||||
const TString& tipo_doc_sdi(const TDocumento& doc);
|
||||
|
||||
// Contenitore di campi di un record di database MSSQLServer
|
||||
class TPaf_record : public TObject
|
||||
@ -76,6 +77,7 @@ public:
|
||||
class TDoc_fp
|
||||
{
|
||||
private:
|
||||
TRectype *_doc_rec;
|
||||
TAnagrafica _ditta;
|
||||
TString16 _cofi;
|
||||
TFilename _dbname;
|
||||
@ -99,6 +101,7 @@ private:
|
||||
bool insert(TPaf_record& p);
|
||||
bool remove(TPaf_record& p);
|
||||
bool save_paf();
|
||||
|
||||
|
||||
protected:
|
||||
bool parse_sconto(const TString& formula, TToken_string& sconti) const;
|
||||
@ -120,10 +123,13 @@ public:
|
||||
bool doc_to_paf(const TRectype& rec);
|
||||
bool doc_to_paf(const TDoc_key& key);
|
||||
bool doc_to_paf(const TFilename& ini);
|
||||
bool doc_to_paf();
|
||||
TRectype& key_to_doc(const TDoc_key& key);
|
||||
// Mostra il log a fine esecuzione
|
||||
bool show_log();
|
||||
const int commit();
|
||||
void set_cache_insert(const bool v) { _cache_insert = v; }
|
||||
|
||||
|
||||
TDoc_fp();
|
||||
~TDoc_fp();
|
||||
|
Loading…
x
Reference in New Issue
Block a user