Patch level : 12.0 no-patch
Files correlati : fplib01 Commento : Sistema di cache per il paffrecord
This commit is contained in:
parent
00976de463
commit
030766fbb9
@ -66,6 +66,7 @@ public:
|
||||
void set(const char* fld, const TDate& var);
|
||||
void set(const char* fld, bool var);
|
||||
const TString sq_get(const char* fld) const;
|
||||
bool is_full() const { return _fields.items() > _key.items(); }
|
||||
|
||||
TString& insert_string();
|
||||
bool insert();
|
||||
@ -82,11 +83,21 @@ public:
|
||||
copy(rec);
|
||||
return *this;
|
||||
}
|
||||
|
||||
TPaf_record() { };
|
||||
TPaf_record(const TPaf_record& rec) { copy(rec); }
|
||||
TPaf_record(const char* table);
|
||||
};
|
||||
|
||||
class TPaf_container : public TObject
|
||||
{
|
||||
std::map<const char *, TPaf_record> _pafs;
|
||||
static const char* paf_to_prefix(const char * paf);
|
||||
public:
|
||||
TPaf_record& get_paf(const char * paf);
|
||||
bool clean_and_erase_paf(const TString& hfatt, const TString& bfatt);
|
||||
TPaf_container();
|
||||
};
|
||||
|
||||
// Gestione PAF
|
||||
class TDoc_fp : public TObject
|
||||
{
|
||||
@ -118,6 +129,9 @@ private:
|
||||
bool _has_bolla;
|
||||
TString _codivadefault;
|
||||
long _index_cassa_previdenziale;
|
||||
int _num_linea;
|
||||
int _counter;
|
||||
TPaf_container _paf_container;
|
||||
|
||||
// Classe interna per gestire righe aggiuntive in riepilogo
|
||||
class TRiepilogo_agg
|
||||
@ -137,9 +151,8 @@ private:
|
||||
real _cambio;
|
||||
} _doc_cambio;
|
||||
|
||||
|
||||
int parse_line(const TString& line, TString& var, TString& val) const;
|
||||
bool create_table(TScanner& paf, const TString& table);
|
||||
//int parse_line(const TString& line, TString& var, TString& val) const;
|
||||
//bool create_table(TScanner& paf, const TString& table);
|
||||
|
||||
const TRectype* find_parent_row(const TRectype& rdoc) const;
|
||||
int find_ancestors(const TRiga_documento& rdoc, TArray& ancestors) const;
|
||||
@ -187,10 +200,13 @@ protected:
|
||||
bool export_paf3200f();
|
||||
|
||||
// Record clifo
|
||||
void set_rec_clifo(char tipocf, long codcf);
|
||||
//void set_rec_clifo(char tipocf, long codcf);
|
||||
|
||||
public:
|
||||
|
||||
// Set Altri Dati Gestionali
|
||||
void set_ads(int r);
|
||||
// Get Altri Dati Gestionali
|
||||
void get_ads();
|
||||
bool doc_to_paf(TDocumentoEsteso& doc);
|
||||
bool doc_to_paf(const TRectype& rec);
|
||||
bool doc_to_paf(const TDoc_key& key);
|
||||
|
@ -27,7 +27,7 @@ void set_connection(SSimple_query& s)
|
||||
TString ip = fp_settings().get_db_indirizzo();
|
||||
if (ip.upper() != "TESTCAMPO2012")
|
||||
{
|
||||
if (s.sq_connect("TESTCAMPO2012@FP_CISLAGHI",
|
||||
if (s.sq_connect("TESTCAMPO2012@campo_fp",
|
||||
"fp",
|
||||
"fp",
|
||||
TSDB_MSSQL) != NOERR)
|
||||
@ -466,6 +466,133 @@ TPaf_record::TPaf_record(const char* table) : _table(table), _key(15, ',')
|
||||
}
|
||||
CHECKS(!_key.empty_items(), "Invalid primary key for table ", table);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// TPaf_container
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
bool TPaf_container::clean_and_erase_paf(const TString& hfatt, const TString& bfatt)
|
||||
{
|
||||
bool ok = true;
|
||||
for (auto i = _pafs.begin(); i != _pafs.end() && ok; ++i)
|
||||
{
|
||||
if (i->second.is_full())
|
||||
{
|
||||
if (strcmp(i->first, "PAF0200F") != 0)
|
||||
i->second.reset();
|
||||
}
|
||||
const char * prefix = paf_to_prefix(i->first);
|
||||
|
||||
i->second.set(TString(prefix) << "_KEYHEADERFATT", hfatt);
|
||||
i->second.set(TString(prefix) << "_KEYBODYFATT", bfatt);
|
||||
ok = i->second.remove();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
const char* TPaf_container::paf_to_prefix(const char * paf)
|
||||
{
|
||||
static TString paf_name;
|
||||
paf_name.cut(0) << paf;
|
||||
if (paf_name == "PAF0100F")
|
||||
return "P1";
|
||||
if (paf_name == "PAF0200F")
|
||||
return "P2";
|
||||
if (paf_name == "PAF0400F")
|
||||
return "P4";
|
||||
if (paf_name == "PAF0700F")
|
||||
return "P7";
|
||||
if (paf_name == "PAF0800F")
|
||||
return "P8";
|
||||
if (paf_name == "PAF1000F")
|
||||
return "P0";
|
||||
if (paf_name == "PAF1100F")
|
||||
return "PA";
|
||||
if (paf_name == "PAF1200F")
|
||||
return "PB";
|
||||
if (paf_name == "PAF1600F")
|
||||
return "PF";
|
||||
if (paf_name == "PAF1700F")
|
||||
return "PG";
|
||||
if (paf_name == "PAF1800F")
|
||||
return "PI";
|
||||
if (paf_name == "PAF1900F")
|
||||
return "PY";
|
||||
if (paf_name == "PAF2000F")
|
||||
return "PJ";
|
||||
if (paf_name == "PAF2100F")
|
||||
return "PK";
|
||||
if (paf_name == "PAF2200F")
|
||||
return "PL";
|
||||
if (paf_name == "PAF2400F")
|
||||
return "PN";
|
||||
if (paf_name == "PAF2500F")
|
||||
return "PO";
|
||||
if (paf_name == "PAF2600F")
|
||||
return "PP";
|
||||
if (paf_name == "PAF2700F")
|
||||
return "PQ";
|
||||
if (paf_name == "PAF3000F")
|
||||
return "PT";
|
||||
if (paf_name == "PAF3200F")
|
||||
return "PU";
|
||||
if (paf_name == "PAFW300F")
|
||||
return "PW";
|
||||
return "ERROR";
|
||||
}
|
||||
|
||||
TPaf_record& TPaf_container::get_paf(const char * paf)
|
||||
{
|
||||
return _pafs[paf];
|
||||
}
|
||||
|
||||
TPaf_container::TPaf_container()
|
||||
{
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF0100F", TPaf_record("PAF0100F")));
|
||||
// Cedente/Prestatore
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF0200F", TPaf_record("PAF0200F")));
|
||||
// Cessionario/Committente
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF0400F", TPaf_record("PAF0400F")));
|
||||
// Testata documento
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF0700F", TPaf_record("PAF0700F")));
|
||||
// Cassa previdenziale
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF0800F", TPaf_record("PAF0800F")));
|
||||
// Contratti
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF1000F", TPaf_record("PAF1000F")));
|
||||
// Convenzioni
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF1100F", TPaf_record("PAF1100F")));
|
||||
// Ordini
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF1200F", TPaf_record("PAF1200F")));
|
||||
// DDT Testata
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF1600F", TPaf_record("PAF1600F")));
|
||||
// DDT Righe
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF1700F", TPaf_record("PAF1700F")));
|
||||
// Righe documento
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF1800F", TPaf_record("PAF1800F")));
|
||||
// Righe articoli del documento
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF1900F", TPaf_record("PAF1900F")));
|
||||
// Sconti di riga
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF2000F", TPaf_record("PAF2000F")));
|
||||
// Altri dati gestionali per le righe documento
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF2100F", TPaf_record("PAF2100F")));
|
||||
// Dati Riepilogo
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF2200F", TPaf_record("PAF2200F")));
|
||||
// Dati pagamento
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF2400F", TPaf_record("PAF2400F")));
|
||||
// Rate
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF2500F", TPaf_record("PAF2500F")));
|
||||
// Allegati
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF2600F", TPaf_record("PAF2600F")));
|
||||
// Testata documento (aggiunte)
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF2700F", TPaf_record("PAF2700F")));
|
||||
// Descrizione
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF3000F", TPaf_record("PAF3000F")));
|
||||
// PEC
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAF3200F", TPaf_record("PAF3200F")));
|
||||
// Non invio XML
|
||||
_pafs.insert(std::pair<const char *, TPaf_record>("PAFW300F", TPaf_record("PAFW300F")));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* TAncestor
|
||||
***************************************************************************/
|
||||
@ -625,6 +752,7 @@ const TString& TDoc_fp::descrizione(const TRiga_documento& rdoc)
|
||||
}
|
||||
return rdoc.get(RDOC_DESCR);
|
||||
}
|
||||
|
||||
const TRectype* TDoc_fp::find_parent_row(const TRectype& rdoc) const
|
||||
{
|
||||
const long id = rdoc.get_long(RDOC_DAIDRIGA);
|
||||
@ -870,9 +998,15 @@ bool TDoc_fp::initialize(TDocumentoEsteso& doc)
|
||||
// Azzero indici
|
||||
_index_cassa_previdenziale = 1;
|
||||
|
||||
return check_initial(doc) || fp_settings().get_check_not_block();
|
||||
if(check_initial(doc) || fp_settings().get_check_not_block())
|
||||
{
|
||||
return _paf_container.clean_and_erase_paf(_hfatt, _bfatt);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const TRectype& TDoc_fp::cco(const TRectype& doc) const
|
||||
{
|
||||
TString80 conkey;
|
||||
@ -989,8 +1123,7 @@ bool TDoc_fp::add_row_art(long& riga_art, const TString& codice_tipo, const TStr
|
||||
paf.set("PY_KEYNLINAR", ++riga_art);
|
||||
paf.set("PY_TIPOARTICOLO", codice_tipo);
|
||||
paf.set("PY_VALOREARTICOLO", codice_valore);
|
||||
const bool ok = insert(paf);
|
||||
return ok;
|
||||
return insert(paf);
|
||||
}
|
||||
bool TDoc_fp::add_row_alleg(TFilename& file, long& nprogr, TPaf_record& paf)
|
||||
{
|
||||
@ -1170,7 +1303,7 @@ bool TDoc_fp::add_riepilogo_iva(TPaf_record& paf2200f, const TCodiceIVA& cod_iva
|
||||
|
||||
bool TDoc_fp::add_cassa_previdenziale(TRiga_documento& rdoc)
|
||||
{
|
||||
static TPaf_record paf0800f("PAF0800F");
|
||||
TPaf_record& paf0800f = _paf_container.get_paf("PAF0800F");
|
||||
paf0800f.reset();
|
||||
if (_index_cassa_previdenziale == 1)
|
||||
{
|
||||
@ -1217,10 +1350,7 @@ const TFirm& TDoc_fp::get_firm()
|
||||
bool TDoc_fp::export_paf0100f()
|
||||
{
|
||||
// <DatiTrassmissione>
|
||||
TPaf_record paf0100f("PAF0100F");
|
||||
paf0100f.set("P1_KEYHEADERFATT", _hfatt);
|
||||
paf0100f.set("P1_KEYBODYFATT", _bfatt);
|
||||
remove(paf0100f);
|
||||
TPaf_record& paf0100f = _paf_container.get_paf("PAF0100F");
|
||||
paf0100f.set("P1_TRASMITTPAESE", _paese);
|
||||
paf0100f.set("P1_TRASMITTCOD", _cofi);
|
||||
paf0100f.set("P1_FMTTRASMISS", _privato ? "FPR12" : "FPA12"); // SDI11 si usa dal 2015 per lo split payment (prima era SDI10)
|
||||
@ -1242,10 +1372,7 @@ bool TDoc_fp::export_paf3200f()
|
||||
if (_enapec)
|
||||
{
|
||||
// <Datipec>
|
||||
TPaf_record paf3200f("PAF3200F");
|
||||
paf3200f.set("PU_KEYHEADERFATT", _hfatt);
|
||||
paf3200f.set("PU_KEYBODYFATT", _bfatt);
|
||||
remove(paf3200f);
|
||||
TPaf_record& paf3200f = _paf_container.get_paf("PAF3200F");
|
||||
paf3200f.set("PU_PEC", _pec);
|
||||
// </Datipec>
|
||||
return insert(paf3200f);
|
||||
@ -1254,6 +1381,17 @@ bool TDoc_fp::export_paf3200f()
|
||||
return true;
|
||||
}
|
||||
|
||||
void TDoc_fp::set_ads(int r)
|
||||
{
|
||||
_num_linea = r;
|
||||
_counter = 0;
|
||||
}
|
||||
|
||||
void TDoc_fp::get_ads()
|
||||
{
|
||||
//static TPaf_record paf2000f;
|
||||
}
|
||||
|
||||
bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
{
|
||||
if (!initialize(doc))
|
||||
@ -1268,71 +1406,69 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
#endif
|
||||
|
||||
// <CedentePrestatore>
|
||||
TPaf_record paf0200f("PAF0200F");
|
||||
paf0200f.set("P2_KEYHEADERFATT", _hfatt);
|
||||
paf0200f.set("P2_KEYBODYFATT", _bfatt);
|
||||
remove(paf0200f);
|
||||
if (_ditta.partita_IVA().full())
|
||||
TPaf_record& paf0200f = _paf_container.get_paf("PAF0200F");
|
||||
TAnagrafica cliente(doc.clifor());
|
||||
if (!paf0200f.is_full())
|
||||
{
|
||||
if (_ditta.partita_IVA().full())
|
||||
{
|
||||
paf0200f.set("P2_FISCIVAPAESE", _ditta.stato_partita_IVA());
|
||||
paf0200f.set("P2_FISCIVACOD", _ditta.partita_IVA());
|
||||
}
|
||||
paf0200f.set("P2_CODFISCALE", _ditta.codice_fiscale());
|
||||
if (_ditta.fisica())
|
||||
{
|
||||
}
|
||||
paf0200f.set("P2_CODFISCALE", _ditta.codice_fiscale());
|
||||
if (_ditta.fisica())
|
||||
{
|
||||
paf0200f.set("P2_ANANOME", _ditta.nome());
|
||||
paf0200f.set("P2_ANACOGNOME", _ditta.cognome());
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
paf0200f.set("P2_ANADENOMIN", _ditta.ragione_sociale());
|
||||
}
|
||||
paf0200f.set("P2_REGFISCALE", doc.tipo().reg_fisc());
|
||||
// DatiSede
|
||||
paf0200f.set("P2_SEDEIND", _ditta.via_residenza());
|
||||
paf0200f.set("P2_SEDENRCIVICO", _ditta.civico_residenza().left(8));
|
||||
paf0200f.set("P2_SEDECAP", _ditta.CAP_residenza());
|
||||
paf0200f.set("P2_SEDECOMUNE", _ditta.comune_residenza());
|
||||
paf0200f.set("P2_SEDEPROV", _ditta.provincia_residenza());
|
||||
paf0200f.set("P2_SEDENAZ", _paese);
|
||||
paf0200f.set("P2_GESTIONE", "D");
|
||||
TAnagrafica cliente(doc.clifor());
|
||||
TString rifamm = cco(doc).get("S4");
|
||||
if (rifamm.blank())
|
||||
}
|
||||
paf0200f.set("P2_REGFISCALE", doc.tipo().reg_fisc());
|
||||
// DatiSede
|
||||
paf0200f.set("P2_SEDEIND", _ditta.via_residenza());
|
||||
paf0200f.set("P2_SEDENRCIVICO", _ditta.civico_residenza().left(8));
|
||||
paf0200f.set("P2_SEDECAP", _ditta.CAP_residenza());
|
||||
paf0200f.set("P2_SEDECOMUNE", _ditta.comune_residenza());
|
||||
paf0200f.set("P2_SEDEPROV", _ditta.provincia_residenza());
|
||||
paf0200f.set("P2_SEDENAZ", _paese);
|
||||
paf0200f.set("P2_GESTIONE", "D");
|
||||
|
||||
TString rifamm = cco(doc).get("S4");
|
||||
if (rifamm.blank())
|
||||
rifamm = doc.clifor().vendite().get(CFV_PARIFAMM);
|
||||
paf0200f.set("P2_RIFAMMINISTR", rifamm);
|
||||
paf0200f.set("P2_ISCRREASOCIOU", _ditta.sociounico() == 'S' ? "SU" : "SM");
|
||||
TISAM_recordset unloc("USE UNLOC\nJOIN COMUNI INTO COM==COMCCIAA\nFROM CODDITTA=#DITTA\nTO CODDITTA=#DITTA");
|
||||
unloc.set_var("#DITTA", get_firm().get(NDT_CODDITTA));
|
||||
if (unloc.move_first())
|
||||
{
|
||||
paf0200f.set("P2_RIFAMMINISTR", rifamm);
|
||||
paf0200f.set("P2_ISCRREASOCIOU", _ditta.sociounico() == 'S' ? "SU" : "SM");
|
||||
TISAM_recordset unloc("USE UNLOC\nJOIN COMUNI INTO COM==COMCCIAA\nFROM CODDITTA=#DITTA\nTO CODDITTA=#DITTA");
|
||||
unloc.set_var("#DITTA", get_firm().get(NDT_CODDITTA));
|
||||
if (unloc.move_first())
|
||||
{
|
||||
const TString& numrea = unloc.get(ULC_NUMCCIAA).as_string();
|
||||
if (numrea.full())
|
||||
{
|
||||
paf0200f.set("P2_ISCRREANUM", numrea);
|
||||
paf0200f.set("P2_ISCRREAUFF", unloc.get("13->" COM_PROVCOM));
|
||||
paf0200f.set("P2_ISCRREANUM", numrea);
|
||||
paf0200f.set("P2_ISCRREAUFF", unloc.get("13->" COM_PROVCOM));
|
||||
}
|
||||
}
|
||||
if (_ditta.giuridica())
|
||||
{
|
||||
}
|
||||
if (_ditta.giuridica())
|
||||
{
|
||||
TISAM_recordset anagiu("USE ANAGIU\nFROM CODANAGR=#CODICE\nTO CODANAGR=#CODICE");
|
||||
anagiu.set_var("#CODICE", get_firm().get(NDT_CODANAGR));
|
||||
if (anagiu.move_first())
|
||||
{
|
||||
paf0200f.set("P2_ISCRREACAP", anagiu.get(ANG_CAPSOC));
|
||||
const int ss = anagiu.get(ANG_STATOSOC).as_int();
|
||||
paf0200f.set("P2_ISCRREASLIQUID", (ss == 2 || ss == 3) ? "LS" : "LN");
|
||||
paf0200f.set("P2_ISCRREACAP", anagiu.get(ANG_CAPSOC));
|
||||
const int ss = anagiu.get(ANG_STATOSOC).as_int();
|
||||
paf0200f.set("P2_ISCRREASLIQUID", (ss == 2 || ss == 3) ? "LS" : "LN");
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
paf0200f.set("P2_ISCRREASLIQUID", "LN");
|
||||
}
|
||||
ok &= insert(paf0200f);
|
||||
// </CedentePrestatore>
|
||||
// <CessionarioCommittente>
|
||||
TPaf_record paf0400f("PAF0400F");
|
||||
paf0400f.set("P4_KEYHEADERFATT", _hfatt);
|
||||
paf0400f.set("P4_KEYBODYFATT", _bfatt);
|
||||
remove(paf0400f);
|
||||
TPaf_record& paf0400f = _paf_container.get_paf("PAF0400F");
|
||||
#ifndef DBG
|
||||
if (cliente.partita_IVA().full())
|
||||
{
|
||||
@ -1373,10 +1509,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
ok &= insert(paf0400f);
|
||||
// </CessionarioCommittente>
|
||||
// <DatiGenerali>
|
||||
TPaf_record paf0700f("PAF0700F");
|
||||
paf0700f.set("P7_KEYHEADERFATT", _hfatt);
|
||||
paf0700f.set("P7_KEYBODYFATT", _bfatt);
|
||||
remove(paf0700f);
|
||||
TPaf_record& paf0700f = _paf_container.get_paf("PAF0700F");
|
||||
paf0700f.set("P7_TIPODOC", tipo_doc_sdi(doc));
|
||||
paf0700f.set("P7_DIVISA", "EUR"); // Fisso su euro in quanto effettuiamo il cambio
|
||||
paf0700f.set("P7_DATA", doc.data());
|
||||
@ -1407,10 +1540,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
*/
|
||||
|
||||
// <DatiGenerali>
|
||||
TPaf_record paf2700f("PAF2700F");
|
||||
paf2700f.set("PQ_KEYHEADERFATT", _hfatt);
|
||||
paf2700f.set("PQ_KEYBODYFATT", _bfatt);
|
||||
remove(paf2700f);
|
||||
TPaf_record& paf2700f = _paf_container.get_paf("PAF2700F");
|
||||
// Disabilitata la scrittura del totale del documento, questo causa problemi se è presente uno sconto in testata e l'addebito del bollo.
|
||||
// Campo calcola prima il totale, poi lo sconta e ci applica il bollo mentre lo SDI sconta a bollo già applicato.
|
||||
|
||||
@ -1432,33 +1562,21 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
ok &= insert(paf2700f);
|
||||
// </DatiGenerali>
|
||||
// Azzera DDT
|
||||
TPaf_record paf1600f("PAF1600F");
|
||||
paf1600f.set("PF_KEYHEADERFATT", _hfatt);
|
||||
paf1600f.set("PF_KEYBODYFATT", _bfatt);
|
||||
remove(paf1600f);
|
||||
TPaf_record& paf1600f = _paf_container.get_paf("PAF1600F");
|
||||
// Fuori dallo scope per dopo
|
||||
const TString16 cup = doc.get(DOC_CUP);
|
||||
const TString16 cig = doc.get(DOC_CIG);
|
||||
const TString80 com = doc.get(DOC_CODCMS);
|
||||
// SEMPRE
|
||||
// Azzera contratti
|
||||
TPaf_record paf1000f("PAF1000F");
|
||||
paf1000f.set("P0_KEYHEADERFATT", _hfatt);
|
||||
paf1000f.set("P0_KEYBODYFATT", _bfatt);
|
||||
TPaf_record& paf1000f = _paf_container.get_paf("PAF1000F");
|
||||
paf1000f.set("P0_RIFNUMLINEA", 0L);
|
||||
remove(paf1000f);
|
||||
// Azzera convenzioni
|
||||
TPaf_record paf1100f("PAF1100F");
|
||||
paf1100f.set("PA_KEYHEADERFATT", _hfatt);
|
||||
paf1100f.set("PA_KEYBODYFATT", _bfatt);
|
||||
TPaf_record& paf1100f = _paf_container.get_paf("PAF1100F");
|
||||
paf1100f.set("PA_RIFNUMLINEA", 0L);
|
||||
remove(paf1100f);
|
||||
// Azzera ordini
|
||||
TPaf_record paf1200f("PAF1200F");
|
||||
paf1200f.set("PB_KEYHEADERFATT", _hfatt);
|
||||
paf1200f.set("PB_KEYBODYFATT", _bfatt);
|
||||
TPaf_record& paf1200f = _paf_container.get_paf("PAF1200F");
|
||||
paf1200f.set("PB_RIFNUMLINEA", 0L);
|
||||
remove(paf1200f);
|
||||
TString80 con = doc.get(DOC_CONTRATTO);
|
||||
if (con.full() || cup.full() || cig.full())
|
||||
{
|
||||
@ -1513,26 +1631,11 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
if (_is_pa && cup.blank() && cig.blank())
|
||||
log(1, "CIG e CUP assenti");
|
||||
// <DatiBeniServizi>
|
||||
TPaf_record paf1800f("PAF1800F");
|
||||
paf1800f.set("PI_KEYHEADERFATT", _hfatt);
|
||||
paf1800f.set("PI_KEYBODYFATT", _bfatt);
|
||||
remove(paf1800f); // Cancella tutte le righe documento
|
||||
TPaf_record paf2000f("PAF2000F");
|
||||
paf2000f.set("PJ_KEYHEADERFATT", _hfatt);
|
||||
paf2000f.set("PJ_KEYBODYFATT", _bfatt);
|
||||
remove(paf2000f); // Cancella tutti gli sconti di riga
|
||||
TPaf_record paf2100f("PAF2100F");
|
||||
paf2100f.set("PK_KEYHEADERFATT", _hfatt);
|
||||
paf2100f.set("PK_KEYBODYFATT", _bfatt);
|
||||
remove(paf2000f); // Cancella tutti i "altri dati gestionali"
|
||||
TPaf_record paf1900f("PAF1900F");
|
||||
paf1900f.set("PY_KEYHEADERFATT", _hfatt);
|
||||
paf1900f.set("PY_KEYBODYFATT", _bfatt);
|
||||
remove(paf1900f); // Cancella tutte le righe articoli del documento
|
||||
TPaf_record paf3000f("PAF3000F");
|
||||
paf3000f.set("PT_KEYHEADERFATT", _hfatt);
|
||||
paf3000f.set("PT_KEYBODYFATT", _bfatt);
|
||||
remove(paf3000f);
|
||||
TPaf_record& paf1800f = _paf_container.get_paf("PAF1800F");
|
||||
TPaf_record& paf2000f = _paf_container.get_paf("PAF2000F");
|
||||
TPaf_record& paf2100f = _paf_container.get_paf("PAF2100F");
|
||||
TPaf_record& paf1900f = _paf_container.get_paf("PAF1900F");
|
||||
TPaf_record& paf3000f = _paf_container.get_paf("PAF3000F");
|
||||
long riga = 1;
|
||||
|
||||
|
||||
@ -1542,6 +1645,8 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
if (check_row(*rdoc) && !fp_settings().get_check_not_block())
|
||||
return false;
|
||||
|
||||
set_ads(r);
|
||||
|
||||
bool skip_riga = false;
|
||||
paf1800f.reset();
|
||||
paf1800f.set("PI_KEYHEADERFATT", _hfatt);
|
||||
@ -1580,6 +1685,15 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
paf1900f.set("PY_KEYNLINEA", riga);
|
||||
ok &= add_row_art(riga_art, "Codice articolo cliente", codart, paf1900f);
|
||||
}
|
||||
// Controllo se ha il CONAI in tal caso aggiungo i dati
|
||||
FOR_EACH_CONFIGURED_CONAI_CLASS(cc)
|
||||
{
|
||||
const TString conai_fld(conai_peso_name(cc, LF_RIGHEDOC));
|
||||
if(rdoc->get(conai_fld).full())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// </CodiceArticolo>
|
||||
@ -1932,10 +2046,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
// </DatiBeniServizi>
|
||||
// <DatiDDT>
|
||||
// Metto qua i dati DDT per capire se la fattura è accompagnatoria o deriva da bolla
|
||||
TPaf_record paf1700f("PAF1700F");
|
||||
paf1700f.set("PG_KEYHEADERFATT", _hfatt);
|
||||
paf1700f.set("PG_KEYBODYFATT", _bfatt);
|
||||
remove(paf1700f); // Cancella la riga del vettore
|
||||
TPaf_record& paf1700f = _paf_container.get_paf("PAF1700F");
|
||||
if (doc.get("CODVETT1").full() && !_has_bolla)
|
||||
{
|
||||
TRectype vet = cache().get("%VET", doc.get("CODVETT1"));
|
||||
@ -1970,10 +2081,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
ok &= insert(paf0700f);
|
||||
|
||||
// <DatiRiepilogo>
|
||||
TPaf_record paf2200f("PAF2200F");
|
||||
paf2200f.set("PL_KEYHEADERFATT", _hfatt);
|
||||
paf2200f.set("PL_KEYBODYFATT", _bfatt);
|
||||
remove(paf2200f); // Cancella tutte le righe di riepilogo IVA
|
||||
TPaf_record& paf2200f = _paf_container.get_paf("PAF2200F");
|
||||
const char* eiva = get_esigibilita_iva(doc);
|
||||
long num_riep = 0;
|
||||
TAssoc_array& tiva = doc.tabella_iva(false);
|
||||
@ -1998,10 +2106,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
|
||||
// </DatiRiepilogo>
|
||||
// <DatiPagamento>
|
||||
TPaf_record paf2400f("PAF2400F");
|
||||
paf2400f.set("PN_KEYHEADERFATT", _hfatt);
|
||||
paf2400f.set("PN_KEYBODYFATT", _bfatt);
|
||||
remove(paf2400f); // Cancella i dati pagamento
|
||||
TPaf_record& paf2400f = _paf_container.get_paf("PAF2400F");
|
||||
TPagamento& pag = doc.pagamento();
|
||||
|
||||
doc.scadenze_recalc(); // Ricalcola array delle rate
|
||||
@ -2012,10 +2117,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
paf2400f.set("PN_CONDPAGAMENTO", rateazione);
|
||||
paf2400f.set("PN_GESTIONE", "D");
|
||||
ok &= insert(paf2400f);
|
||||
TPaf_record paf2500f("PAF2500F");
|
||||
paf2500f.set("PO_KEYHEADERFATT", _hfatt);
|
||||
paf2500f.set("PO_KEYBODYFATT", _bfatt);
|
||||
remove(paf2500f); // Cancella tutte le rate
|
||||
TPaf_record& paf2500f = _paf_container.get_paf("PAF2500F");
|
||||
// Imposto i campi uguali per tutte le rate
|
||||
paf2500f.set("PO_CONDPAGAMENTO", rateazione); // Condizione di pagamento PA
|
||||
paf2500f.set("PO_CODICEPAGAM", pag.code()); // Condizione di pagamento CAMPO
|
||||
@ -2052,10 +2154,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
// </DatiPagamento>
|
||||
if (_gestioneallegati)
|
||||
{
|
||||
TPaf_record paf2600f("PAF2600F");
|
||||
paf2600f.set("PP_KEYHEADERFATT", _hfatt);
|
||||
paf2600f.set("PP_KEYBODYFATT", _bfatt);
|
||||
remove(paf2600f); // Cancella eventuali allegati
|
||||
TPaf_record& paf2600f = _paf_container.get_paf("PAF2600F");
|
||||
long nprogr = 0; // Numero di file allegati
|
||||
// Se abilitato stampo il documento e lo allego
|
||||
TFilename rep;
|
||||
@ -2126,10 +2225,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
}
|
||||
|
||||
// Tabella di non invio XML
|
||||
TPaf_record pafw300f("PAFW300F");
|
||||
pafw300f.set("PW_KEYHEADERFATT", _hfatt);
|
||||
pafw300f.set("PW_KEYBODYFATT", _bfatt);
|
||||
remove(pafw300f);
|
||||
TPaf_record& pafw300f = _paf_container.get_paf("PAFW300F");
|
||||
pafw300f.set("PW_TIPODOC", tipo_doc_sdi(doc));
|
||||
pafw300f.set("PW_TIPONUM", doc.codice_numerazione().codice());
|
||||
pafw300f.set("PW_NUMERO", doc.numero());
|
||||
|
Loading…
x
Reference in New Issue
Block a user