diff --git a/build/Cg0.vcxproj b/build/Cg0.vcxproj
index cdd5a7570..7ce0b57c1 100644
--- a/build/Cg0.vcxproj
+++ b/build/Cg0.vcxproj
@@ -194,7 +194,9 @@
%(PreprocessorDefinitions)
-
+
+ true
+
%(AdditionalIncludeDirectories)
%(PreprocessorDefinitions)
@@ -207,7 +209,9 @@
%(AdditionalIncludeDirectories)
%(PreprocessorDefinitions)
-
+
+ true
+
%(AdditionalIncludeDirectories)
%(PreprocessorDefinitions)
@@ -220,7 +224,7 @@
true
- true
+ false
diff --git a/build/fplib.vcxproj.filters b/build/fplib.vcxproj.filters
index e1b32cde7..496188529 100644
--- a/build/fplib.vcxproj.filters
+++ b/build/fplib.vcxproj.filters
@@ -15,6 +15,9 @@
Sources
+
+ Sources
+
diff --git a/src/fp/fplib.h b/src/fp/fplib.h
index 1dac8af55..aadf1ab81 100644
--- a/src/fp/fplib.h
+++ b/src/fp/fplib.h
@@ -65,6 +65,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();
@@ -81,11 +82,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 _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
{
@@ -117,6 +128,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
@@ -136,9 +150,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;
@@ -186,10 +199,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);
diff --git a/src/fp/fplib01.cpp b/src/fp/fplib01.cpp
index ea7a3e9a7..93693e15c 100644
--- a/src/fp/fplib01.cpp
+++ b/src/fp/fplib01.cpp
@@ -27,7 +27,8 @@ void set_connection(SSimple_query& s)
TString ip = fp_settings().get_db_indirizzo();
if (ip.upper() != "TESTCAMPO2012")
{
- if (s.sq_connect("TESTCAMPO2012@campo_fp", "fp",
+ if (s.sq_connect("TESTCAMPO2012@campo_fp",
+ "fp",
"fp",
TSDB_MSSQL) != NOERR)
fatal_box("Impossibile connettersi al DB esterno");
@@ -195,7 +196,7 @@ bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString&
inline const TString& no_special(char a)
{
TString& r = get_tmp_string().cut(0);
- switch(a)
+
if(a != '\'')
{
r << a;
@@ -463,6 +464,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("PAF0100F", TPaf_record("PAF0100F")));
+ // Cedente/Prestatore
+ _pafs.insert(std::pair("PAF0200F", TPaf_record("PAF0200F")));
+ // Cessionario/Committente
+ _pafs.insert(std::pair("PAF0400F", TPaf_record("PAF0400F")));
+ // Testata documento
+ _pafs.insert(std::pair("PAF0700F", TPaf_record("PAF0700F")));
+ // Cassa previdenziale
+ _pafs.insert(std::pair("PAF0800F", TPaf_record("PAF0800F")));
+ // Contratti
+ _pafs.insert(std::pair("PAF1000F", TPaf_record("PAF1000F")));
+ // Convenzioni
+ _pafs.insert(std::pair("PAF1100F", TPaf_record("PAF1100F")));
+ // Ordini
+ _pafs.insert(std::pair("PAF1200F", TPaf_record("PAF1200F")));
+ // DDT Testata
+ _pafs.insert(std::pair("PAF1600F", TPaf_record("PAF1600F")));
+ // DDT Righe
+ _pafs.insert(std::pair("PAF1700F", TPaf_record("PAF1700F")));
+ // Righe documento
+ _pafs.insert(std::pair("PAF1800F", TPaf_record("PAF1800F")));
+ // Righe articoli del documento
+ _pafs.insert(std::pair("PAF1900F", TPaf_record("PAF1900F")));
+ // Sconti di riga
+ _pafs.insert(std::pair("PAF2000F", TPaf_record("PAF2000F")));
+ // Altri dati gestionali per le righe documento
+ _pafs.insert(std::pair("PAF2100F", TPaf_record("PAF2100F")));
+ // Dati Riepilogo
+ _pafs.insert(std::pair("PAF2200F", TPaf_record("PAF2200F")));
+ // Dati pagamento
+ _pafs.insert(std::pair("PAF2400F", TPaf_record("PAF2400F")));
+ // Rate
+ _pafs.insert(std::pair("PAF2500F", TPaf_record("PAF2500F")));
+ // Allegati
+ _pafs.insert(std::pair("PAF2600F", TPaf_record("PAF2600F")));
+ // Testata documento (aggiunte)
+ _pafs.insert(std::pair("PAF2700F", TPaf_record("PAF2700F")));
+ // Descrizione
+ _pafs.insert(std::pair("PAF3000F", TPaf_record("PAF3000F")));
+ // PEC
+ _pafs.insert(std::pair("PAF3200F", TPaf_record("PAF3200F")));
+ // Non invio XML
+ _pafs.insert(std::pair("PAFW300F", TPaf_record("PAFW300F")));
+}
+
/***************************************************************************
* TAncestor
***************************************************************************/
@@ -622,6 +750,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);
@@ -867,9 +996,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;
@@ -986,8 +1121,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)
{
@@ -1167,7 +1301,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)
{
@@ -1214,10 +1348,7 @@ const TFirm& TDoc_fp::get_firm()
bool TDoc_fp::export_paf0100f()
{
//
- 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)
@@ -1239,10 +1370,7 @@ bool TDoc_fp::export_paf3200f()
if (_enapec)
{
//
- 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);
//
return insert(paf3200f);
@@ -1251,6 +1379,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))
@@ -1265,71 +1404,69 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
#endif
//
- 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);
//
//
- 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())
{
@@ -1370,10 +1507,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
ok &= insert(paf0400f);
//
//
- 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());
@@ -1404,10 +1538,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
*/
//
- 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.
@@ -1429,33 +1560,21 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
ok &= insert(paf2700f);
//
// 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())
{
@@ -1510,26 +1629,11 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (_is_pa && cup.blank() && cig.blank())
log(1, "CIG e CUP assenti");
//
- 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(paf2100f); // 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;
@@ -1539,6 +1643,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);
@@ -1577,6 +1683,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())
+ {
+
+ }
+ }
}
}
//
@@ -1929,10 +2044,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
//
//
// 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"));
@@ -1967,10 +2079,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
ok &= insert(paf0700f);
//
- 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);
@@ -1995,10 +2104,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
//
//
- 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
@@ -2009,10 +2115,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
@@ -2049,10 +2152,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
//
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;
@@ -2123,10 +2223,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());