Patch level : 12.0 no-patch
Files correlati : fp Commento : - Tolte le utilities ormai inutilizzate su fp0300 - Aggiunto filtro codice numerazione - Sistemata configurazione per gestione allegati - Aggiunto esportazione documento come pdf nell'xml - Aggiunta funzione che gestisce gli allegati - Implementata funzione di esecuzione query batch ma non va come desiderato, disabilitata al momento (si abilita con set_cache_insert(true)
This commit is contained in:
parent
694f8732f0
commit
8080003131
@ -20,45 +20,6 @@
|
|||||||
#define LEN_HFATT 20
|
#define LEN_HFATT 20
|
||||||
#define LEN_BFATT 50
|
#define LEN_BFATT 50
|
||||||
|
|
||||||
#define FLD_TIPO_SDI "S3[37,40]"
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Utilities
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Cerca una stringa all'interno di una SLIST (Potrebbe diventare una funzione di XVT.h)
|
|
||||||
static SLIST_ELT xvt_slist_find_str(SLIST list, const char* str)
|
|
||||||
{
|
|
||||||
SLIST_ELT e = NULL;
|
|
||||||
for (e = xvt_slist_get_first(list); e; e = xvt_slist_get_next(list, e))
|
|
||||||
{
|
|
||||||
const char* val = xvt_slist_get(list, e, NULL);
|
|
||||||
if (xvt_str_compare_ignoring_case(str, val) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Aggiorna il file dst se più vecchio di src (Potrebbe diventare una funzione di XVT.h)
|
|
||||||
bool xvt_fsys_fupdate(const char* src, const char* dst)
|
|
||||||
{
|
|
||||||
bool ok = false;
|
|
||||||
if (xvt_fsys_file_exists(src))
|
|
||||||
{
|
|
||||||
const long tsrc = xvt_fsys_file_attr(src, XVT_FILE_ATTR_MTIME);
|
|
||||||
if (tsrc > 0)
|
|
||||||
{
|
|
||||||
long tdst = 0;
|
|
||||||
if (xvt_fsys_file_exists(dst))
|
|
||||||
tdst = xvt_fsys_file_attr(dst, XVT_FILE_ATTR_MTIME);
|
|
||||||
if (tsrc > tdst)
|
|
||||||
ok = xvt_fsys_fcopy(src, dst) != 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// TPa_mask
|
// TPa_mask
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -94,6 +55,26 @@ bool TPA_mask::is_fattura(const TRectype& doc) const
|
|||||||
return cn.tipo() == 2 && !cn.get_bool("B10"); // Controlla se fattura provvisioria esclusa da P.A.
|
return cn.tipo() == 2 && !cn.get_bool("B10"); // Controlla se fattura provvisioria esclusa da P.A.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TString& add_filter(const TString& field, const TString& from, const TString& to)
|
||||||
|
{
|
||||||
|
TString& query = get_tmp_string();
|
||||||
|
const TString qf = field.find('.') < 0 ? field : field.sub(field.find('.') + 1);
|
||||||
|
|
||||||
|
if (from.full() && to.full())
|
||||||
|
{
|
||||||
|
query << "&&(BETWEEN(" << field << ", #DA" << qf << ", #A" << qf << "))";
|
||||||
|
}
|
||||||
|
else if (from.full())
|
||||||
|
{
|
||||||
|
query << "&&(" << field << ">=#DA" << qf << ")";
|
||||||
|
}
|
||||||
|
else if (to.full())
|
||||||
|
{
|
||||||
|
query << "&&(" << field << "<=#A" << qf << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
void TPA_mask::fill()
|
void TPA_mask::fill()
|
||||||
{
|
{
|
||||||
@ -116,18 +97,9 @@ void TPA_mask::fill()
|
|||||||
|
|
||||||
query << "USE 33 " <<
|
query << "USE 33 " <<
|
||||||
"SELECT (BETWEEN(33.DATADOC,#DADATADOC,#ADATADOC))&&(33.TIPOCF=='C')";
|
"SELECT (BETWEEN(33.DATADOC,#DADATADOC,#ADATADOC))&&(33.TIPOCF=='C')";
|
||||||
if(get(F_DATIPODOC).full() && get(F_ATIPODOC).full())
|
|
||||||
{
|
query << add_filter("33.TIPODOC", get(F_DATIPODOC), get(F_ATIPODOC));
|
||||||
query << "&&(BETWEEN(33.TIPODOC, #DATIPODOC, #ATIPODOC))";
|
|
||||||
}
|
|
||||||
else if(get(F_DATIPODOC).full())
|
|
||||||
{
|
|
||||||
query << "&&(33.TIPODOC>=#DATIPODOC)";
|
|
||||||
}
|
|
||||||
else if (get(F_ATIPODOC).full())
|
|
||||||
{
|
|
||||||
query << "&&(33.TIPODOC<=#ATIPODOC)";
|
|
||||||
}
|
|
||||||
query << "\nJOIN 20 INTO TIPOCF==TIPOCF CODCF==CODCF \n" <<
|
query << "\nJOIN 20 INTO TIPOCF==TIPOCF CODCF==CODCF \n" <<
|
||||||
"JOIN 17 TO 33 INTO TIPOCF==TIPOCF CODCF==CODCF \n" <<
|
"JOIN 17 TO 33 INTO TIPOCF==TIPOCF CODCF==CODCF \n" <<
|
||||||
"JOIN %TIP TO 33 ALIAS 400 INTO CODTAB==TIPODOC";
|
"JOIN %TIP TO 33 ALIAS 400 INTO CODTAB==TIPODOC";
|
||||||
@ -376,9 +348,10 @@ void TDoc2Paf::main_loop()
|
|||||||
while (mask.run() == K_ENTER)
|
while (mask.run() == K_ENTER)
|
||||||
{
|
{
|
||||||
TString_array& sht = mask.sfield(F_DOCS).rows_array();
|
TString_array& sht = mask.sfield(F_DOCS).rows_array();
|
||||||
|
TDoc_fp elab;
|
||||||
|
//elab.set_cache_insert(true);
|
||||||
if (!sht.empty())
|
if (!sht.empty())
|
||||||
{
|
{
|
||||||
TDoc_fp elab;
|
|
||||||
TProgress_monitor pi(sht.items(), "Esportazione Fatture");
|
TProgress_monitor pi(sht.items(), "Esportazione Fatture");
|
||||||
ndocs = 0;
|
ndocs = 0;
|
||||||
FOR_EACH_ARRAY_ROW(sht, r, riga)
|
FOR_EACH_ARRAY_ROW(sht, r, riga)
|
||||||
@ -395,6 +368,7 @@ void TDoc2Paf::main_loop()
|
|||||||
if (!pi.add_status(1))
|
if (!pi.add_status(1))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (ndocs > 0)
|
if (ndocs > 0)
|
||||||
{
|
{
|
||||||
if (elab.commit() > 0)
|
if (elab.commit() > 0)
|
||||||
@ -407,7 +381,6 @@ void TDoc2Paf::main_loop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool TDoc2Paf::create()
|
bool TDoc2Paf::create()
|
||||||
{
|
{
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
#define F_DATAINI 301
|
#define F_DATAINI 301
|
||||||
#define F_DATAEND 302
|
#define F_DATAEND 302
|
||||||
#define F_FATTSEL 303
|
#define F_FATTSEL 303
|
||||||
#define F_DATIPODOC 304
|
#define F_DACODNUM 304
|
||||||
#define F_ATIPODOC 305
|
#define F_DATIPODOC 305
|
||||||
|
#define F_ACODNUM 306
|
||||||
|
#define F_ATIPODOC 307
|
||||||
#define END_MASK 399
|
#define END_MASK 399
|
||||||
|
|
||||||
#define F_DOCS 201
|
#define F_DOCS 201
|
||||||
|
@ -21,7 +21,7 @@ BEGIN
|
|||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
|
|
||||||
RADIOBUTTON F_FATTSEL 25
|
RADIOBUTTON F_FATTSEL 100
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "Fatture da visualizzare"
|
PROMPT 1 1 "Fatture da visualizzare"
|
||||||
ITEM "|Da inviare"
|
ITEM "|Da inviare"
|
||||||
@ -30,11 +30,28 @@ BEGIN
|
|||||||
ITEM "X|XML Generato"
|
ITEM "X|XML Generato"
|
||||||
ITEM "E|In errore"
|
ITEM "E|In errore"
|
||||||
ITEM "N|Accettate"
|
ITEM "N|Accettate"
|
||||||
|
FLAGS "Z"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DACODNUM 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 4 "Da Numerazione"
|
||||||
|
FIELD CODNUM
|
||||||
|
HELP "Codice numerazione"
|
||||||
|
USE %NUM
|
||||||
|
INPUT CODTAB F_DACODNUM
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
OUTPUT F_DACODNUM CODTAB
|
||||||
|
CHECKTYPE FORCED
|
||||||
|
FLAG "UPA"
|
||||||
|
WARNING "Numerazione assente"
|
||||||
|
KEY 1 2
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_DATIPODOC 4
|
STRING F_DATIPODOC 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 30 2 "Da tipo doc "
|
PROMPT 30 4 "Da tipo doc "
|
||||||
FIELD TIPODOC
|
FIELD TIPODOC
|
||||||
HELP "Codice tipo documento"
|
HELP "Codice tipo documento"
|
||||||
USE %TIP
|
USE %TIP
|
||||||
@ -48,9 +65,25 @@ BEGIN
|
|||||||
FLAG "UP"
|
FLAG "UP"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
STRING F_ACODNUM 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 5 "A Numerazione "
|
||||||
|
FIELD CODNUM
|
||||||
|
HELP "Codice numerazione"
|
||||||
|
USE %NUM
|
||||||
|
INPUT CODTAB F_ACODNUM
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
OUTPUT F_ACODNUM CODTAB
|
||||||
|
CHECKTYPE FORCED
|
||||||
|
FLAG "UPA"
|
||||||
|
WARNING "Numerazione assente"
|
||||||
|
KEY 1 2
|
||||||
|
END
|
||||||
|
|
||||||
STRING F_ATIPODOC 4
|
STRING F_ATIPODOC 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 30 3 "A tipo doc "
|
PROMPT 30 5 "A tipo doc "
|
||||||
FIELD TIPODOC
|
FIELD TIPODOC
|
||||||
HELP "Codice tipo documento"
|
HELP "Codice tipo documento"
|
||||||
USE %TIP
|
USE %TIP
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include <isam.h>
|
#include <isam.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
|
#include <dongle.h>
|
||||||
|
#include <execp.h>
|
||||||
|
|
||||||
#include "../fe/felib.h"
|
#include "../fe/felib.h"
|
||||||
#include "../cg/cglib03.h"
|
#include "../cg/cglib03.h"
|
||||||
@ -19,6 +21,7 @@
|
|||||||
#include <unloc.h>
|
#include <unloc.h>
|
||||||
#include <causali.h>
|
#include <causali.h>
|
||||||
#include "../cg/cfban.h"
|
#include "../cg/cfban.h"
|
||||||
|
#include "modaut.h"
|
||||||
|
|
||||||
void set_connection(SSimple_query& s)
|
void set_connection(SSimple_query& s)
|
||||||
{
|
{
|
||||||
@ -31,13 +34,6 @@ void set_connection(SSimple_query& s)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string getline(ifstream& f)
|
|
||||||
{
|
|
||||||
string app;
|
|
||||||
getline(f, app);
|
|
||||||
return app;
|
|
||||||
}
|
|
||||||
|
|
||||||
SSimple_query& db()
|
SSimple_query& db()
|
||||||
{
|
{
|
||||||
static SSimple_query* db = nullptr;
|
static SSimple_query* db = nullptr;
|
||||||
@ -52,7 +48,12 @@ SSimple_query& db()
|
|||||||
return *db;
|
return *db;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getline(ifstream& f);
|
string getline(ifstream& f)
|
||||||
|
{
|
||||||
|
string app;
|
||||||
|
getline(f, app);
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
bool check_tables()
|
bool check_tables()
|
||||||
{
|
{
|
||||||
@ -275,10 +276,9 @@ const TString& TPaf_record::var2str(const TString& fldname, const TVariant& var)
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elimina il record in base ai campi chiave
|
TString& TPaf_record::remove_string()
|
||||||
bool TPaf_record::remove()
|
|
||||||
{
|
{
|
||||||
TString256 query;
|
TString& query = get_tmp_string().cut(0);
|
||||||
query << "DELETE FROM " << _table << " WHERE ";
|
query << "DELETE FROM " << _table << " WHERE ";
|
||||||
int nkf = 0;
|
int nkf = 0;
|
||||||
FOR_EACH_TOKEN(_key, fld)
|
FOR_EACH_TOKEN(_key, fld)
|
||||||
@ -293,7 +293,14 @@ bool TPaf_record::remove()
|
|||||||
}
|
}
|
||||||
CHECKS(nkf >= 2, "Can't remove partial key on table ", (const char*)_table);
|
CHECKS(nkf >= 2, "Can't remove partial key on table ", (const char*)_table);
|
||||||
query << ';';
|
query << ';';
|
||||||
return db().sq_set_exec(query);
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Elimina il record in base ai campi chiave
|
||||||
|
bool TPaf_record::remove()
|
||||||
|
{
|
||||||
|
return db().sq_set_exec(remove_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carica un record in base ai campi chiave
|
// Carica un record in base ai campi chiave
|
||||||
@ -329,12 +336,11 @@ bool TPaf_record::search(const char* k1, const char* k2, const char* k3)
|
|||||||
return search();
|
return search();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggiunge un record al db
|
TString & TPaf_record::insert_string()
|
||||||
bool TPaf_record::insert()
|
|
||||||
{
|
{
|
||||||
CHECKS(_fields.items() >= _key.items(), "Can't insert empty record on table ", _table);
|
CHECKS(_fields.items() >= _key.items(), "Can't insert empty record on table ", _table);
|
||||||
|
|
||||||
TString query, values;
|
TString& query = get_tmp_string().cut(0), values = get_tmp_string().cut(0);
|
||||||
query << "INSERT INTO " << _table << "\n(";
|
query << "INSERT INTO " << _table << "\n(";
|
||||||
FOR_EACH_ASSOC_OBJECT(_fields, obj, fld, itm)
|
FOR_EACH_ASSOC_OBJECT(_fields, obj, fld, itm)
|
||||||
{
|
{
|
||||||
@ -348,7 +354,13 @@ bool TPaf_record::insert()
|
|||||||
query.rtrim(1);
|
query.rtrim(1);
|
||||||
values.rtrim(1);
|
values.rtrim(1);
|
||||||
query << ")\nVALUES (" << values << ");";
|
query << ")\nVALUES (" << values << ");";
|
||||||
return db().sq_set_exec(query);
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggiunge un record al db
|
||||||
|
bool TPaf_record::insert()
|
||||||
|
{
|
||||||
|
return db().sq_set_exec(insert_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crea un record della tabella data ed imposta i nomi dei campi chiave
|
// Crea un record della tabella data ed imposta i nomi dei campi chiave
|
||||||
@ -556,6 +568,49 @@ int TDoc_fp::find_ancestors(const TRiga_documento& rdoc, TArray& ancestors) cons
|
|||||||
return ancestors.items();
|
return ancestors.items();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TDoc_fp::insert(TPaf_record& p)
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
if(_cache_insert)
|
||||||
|
{
|
||||||
|
_query.push_back(p.insert_string());
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok = p.insert();
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TDoc_fp::remove(TPaf_record& p)
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
if (_cache_insert)
|
||||||
|
{
|
||||||
|
_query.push_back(p.remove_string());
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok = p.remove();
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TDoc_fp::save_paf()
|
||||||
|
{
|
||||||
|
bool ok = true;
|
||||||
|
if (_cache_insert)
|
||||||
|
{
|
||||||
|
string query;
|
||||||
|
for (auto i = _query.begin(); i != _query.end(); ++i)
|
||||||
|
query += *i;
|
||||||
|
ok = db().sq_set_exec(query);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
const TRectype& TDoc_fp::cco(const TRectype& doc) const
|
const TRectype& TDoc_fp::cco(const TRectype& doc) const
|
||||||
{
|
{
|
||||||
TString80 conkey;
|
TString80 conkey;
|
||||||
@ -643,7 +698,7 @@ bool TDoc_fp::add_row_art(const TString codice_tipo, const TString& codice_valor
|
|||||||
paf.set("PY_KEYNLINAR", ++riga_art);
|
paf.set("PY_KEYNLINAR", ++riga_art);
|
||||||
paf.set("PY_TIPOARTICOLO", codice_tipo);
|
paf.set("PY_TIPOARTICOLO", codice_tipo);
|
||||||
paf.set("PY_VALOREARTICOLO", codice_valore);
|
paf.set("PY_VALOREARTICOLO", codice_valore);
|
||||||
const bool ok = paf.insert();
|
const bool ok = insert(paf);
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if (!ok)
|
if (!ok)
|
||||||
error_box("Allah al bar!");
|
error_box("Allah al bar!");
|
||||||
@ -651,6 +706,31 @@ bool TDoc_fp::add_row_art(const TString codice_tipo, const TString& codice_valor
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TDoc_fp::add_row_alleg(TFilename& file, long& nprogr, TPaf_record& paf)
|
||||||
|
{
|
||||||
|
static TString dest_path;
|
||||||
|
static TString dest_usr_path;
|
||||||
|
bool ok = false;
|
||||||
|
|
||||||
|
dest_path.cut(0) << _def_fld << file.name();
|
||||||
|
dest_usr_path.cut(0) << _def_usr_fld << file.name();
|
||||||
|
if (!fcopy(file, dest_usr_path))
|
||||||
|
{
|
||||||
|
return yesno_box("Errore critico nel copiare il file %s, si desidera continuare?", file.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Provo a copiare il file
|
||||||
|
paf.set("PP_NUMEROLINEA", ++nprogr);
|
||||||
|
paf.set("PP_NOMEATTACHMENT", file.name());
|
||||||
|
paf.set("PP_ATTACHMENT", dest_path);
|
||||||
|
file.upper(); // serve estensione maiuscola
|
||||||
|
paf.set("PP_FMTATTACHMENT", file.ext());
|
||||||
|
ok = insert(paf);
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||||
{
|
{
|
||||||
TString8 hfatt; // Codice univoco di 6 caratteri dell'ufficio P.A. o di 7 caratteri per un privato
|
TString8 hfatt; // Codice univoco di 6 caratteri dell'ufficio P.A. o di 7 caratteri per un privato
|
||||||
@ -693,7 +773,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record paf0100f("PAF0100F");
|
TPaf_record paf0100f("PAF0100F");
|
||||||
paf0100f.set("P1_KEYHEADERFATT", hfatt);
|
paf0100f.set("P1_KEYHEADERFATT", hfatt);
|
||||||
paf0100f.set("P1_KEYBODYFATT", bfatt);
|
paf0100f.set("P1_KEYBODYFATT", bfatt);
|
||||||
paf0100f.remove();
|
remove(paf0100f);
|
||||||
|
|
||||||
paf0100f.set("P1_TRASMITTPAESE", paese);
|
paf0100f.set("P1_TRASMITTPAESE", paese);
|
||||||
paf0100f.set("P1_TRASMITTCOD", _cofi);
|
paf0100f.set("P1_TRASMITTCOD", _cofi);
|
||||||
@ -705,7 +785,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf0100f.set("P1_TELEFONO", tel);
|
paf0100f.set("P1_TELEFONO", tel);
|
||||||
paf0100f.set("P1_MAIL", firm.get(NDT_MAIL));
|
paf0100f.set("P1_MAIL", firm.get(NDT_MAIL));
|
||||||
paf0100f.set("P1_GESTIONE", "D");
|
paf0100f.set("P1_GESTIONE", "D");
|
||||||
ok &= paf0100f.insert();
|
ok &= insert(paf0100f);
|
||||||
// </DatiTrassmissione>
|
// </DatiTrassmissione>
|
||||||
|
|
||||||
if (enapec)
|
if (enapec)
|
||||||
@ -714,9 +794,9 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record paf3200f("PAF3200F");
|
TPaf_record paf3200f("PAF3200F");
|
||||||
paf3200f.set("PU_KEYHEADERFATT", hfatt);
|
paf3200f.set("PU_KEYHEADERFATT", hfatt);
|
||||||
paf3200f.set("PU_KEYBODYFATT", bfatt);
|
paf3200f.set("PU_KEYBODYFATT", bfatt);
|
||||||
paf3200f.remove();
|
remove(paf3200f);
|
||||||
paf3200f.set("PU_PEC", pec);
|
paf3200f.set("PU_PEC", pec);
|
||||||
ok &= paf3200f.insert();
|
ok &= insert(paf3200f);
|
||||||
// </Datipec>
|
// </Datipec>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,7 +804,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record paf0200f("PAF0200F");
|
TPaf_record paf0200f("PAF0200F");
|
||||||
paf0200f.set("P2_KEYHEADERFATT", hfatt);
|
paf0200f.set("P2_KEYHEADERFATT", hfatt);
|
||||||
paf0200f.set("P2_KEYBODYFATT", bfatt);
|
paf0200f.set("P2_KEYBODYFATT", bfatt);
|
||||||
paf0200f.remove();
|
remove(paf0200f);
|
||||||
|
|
||||||
if (_ditta.partita_IVA().full())
|
if (_ditta.partita_IVA().full())
|
||||||
{
|
{
|
||||||
@ -788,7 +868,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
else
|
else
|
||||||
paf0200f.set("P2_ISCRREASLIQUID", "LN");
|
paf0200f.set("P2_ISCRREASLIQUID", "LN");
|
||||||
|
|
||||||
ok &= paf0200f.insert();
|
ok &= insert(paf0200f);
|
||||||
|
|
||||||
// </CedentePrestatore>
|
// </CedentePrestatore>
|
||||||
|
|
||||||
@ -797,7 +877,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record paf0400f("PAF0400F");
|
TPaf_record paf0400f("PAF0400F");
|
||||||
paf0400f.set("P4_KEYHEADERFATT", hfatt);
|
paf0400f.set("P4_KEYHEADERFATT", hfatt);
|
||||||
paf0400f.set("P4_KEYBODYFATT", bfatt);
|
paf0400f.set("P4_KEYBODYFATT", bfatt);
|
||||||
paf0400f.remove();
|
remove(paf0400f);
|
||||||
|
|
||||||
if (cliente.partita_IVA().full())
|
if (cliente.partita_IVA().full())
|
||||||
{
|
{
|
||||||
@ -824,14 +904,14 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf0400f.set("P4_SEDEPROV", cliente.provincia_residenza());
|
paf0400f.set("P4_SEDEPROV", cliente.provincia_residenza());
|
||||||
paf0400f.set("P4_SEDENAZ", cliente.stato_residenza_ISO());
|
paf0400f.set("P4_SEDENAZ", cliente.stato_residenza_ISO());
|
||||||
paf0400f.set("P4_GESTIONE", "D");
|
paf0400f.set("P4_GESTIONE", "D");
|
||||||
ok &= paf0400f.insert();
|
ok &= insert(paf0400f);
|
||||||
// </CessionarioCommittente>
|
// </CessionarioCommittente>
|
||||||
|
|
||||||
// <DatiGenerali>
|
// <DatiGenerali>
|
||||||
TPaf_record paf0700f("PAF0700F");
|
TPaf_record paf0700f("PAF0700F");
|
||||||
paf0700f.set("P7_KEYHEADERFATT", hfatt);
|
paf0700f.set("P7_KEYHEADERFATT", hfatt);
|
||||||
paf0700f.set("P7_KEYBODYFATT", bfatt);
|
paf0700f.set("P7_KEYBODYFATT", bfatt);
|
||||||
paf0700f.remove();
|
remove(paf0700f);
|
||||||
paf0700f.set("P7_TIPODOC", doc.tipo().tipo_doc_sdi());
|
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", "EUR"); // Aggiungere codice ISO 4217 a tabella divise (%VAL)
|
||||||
paf0700f.set("P7_DATA", doc.data());
|
paf0700f.set("P7_DATA", doc.data());
|
||||||
@ -859,7 +939,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record paf0900f("PAF0900F");
|
TPaf_record paf0900f("PAF0900F");
|
||||||
paf0900f.set("P9_KEYHEADERFATT", hfatt);
|
paf0900f.set("P9_KEYHEADERFATT", hfatt);
|
||||||
paf0900f.set("P9_KEYBODYFATT", bfatt);
|
paf0900f.set("P9_KEYBODYFATT", bfatt);
|
||||||
paf0900f.remove();
|
remove(paf0900f);
|
||||||
|
|
||||||
TString80 sconto_expr = doc.get(DOC_SCONTOPERC);
|
TString80 sconto_expr = doc.get(DOC_SCONTOPERC);
|
||||||
TToken_string sconti;
|
TToken_string sconti;
|
||||||
@ -883,7 +963,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf0900f.set("P9_PERCSCONTO", -sconto);
|
paf0900f.set("P9_PERCSCONTO", -sconto);
|
||||||
}
|
}
|
||||||
paf0900f.set("P9_GESTIONE", "D");
|
paf0900f.set("P9_GESTIONE", "D");
|
||||||
ok &= paf0900f.insert();
|
ok &= insert(paf0900f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -893,7 +973,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record paf2700f("PAF2700F");
|
TPaf_record paf2700f("PAF2700F");
|
||||||
paf2700f.set("PQ_KEYHEADERFATT", hfatt);
|
paf2700f.set("PQ_KEYHEADERFATT", hfatt);
|
||||||
paf2700f.set("PQ_KEYBODYFATT", bfatt);
|
paf2700f.set("PQ_KEYBODYFATT", bfatt);
|
||||||
paf2700f.remove();
|
remove(paf2700f);
|
||||||
paf2700f.set("PQ_IMPTOTDOC", doc.totale_doc());
|
paf2700f.set("PQ_IMPTOTDOC", doc.totale_doc());
|
||||||
|
|
||||||
const TRectype& cont_conv_off = cco(doc);
|
const TRectype& cont_conv_off = cco(doc);
|
||||||
@ -910,14 +990,14 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf2700f.set("PQ_CAUSALE", causale);
|
paf2700f.set("PQ_CAUSALE", causale);
|
||||||
// paf2700f.set("PQ_ART73", true);
|
// paf2700f.set("PQ_ART73", true);
|
||||||
paf2700f.set("PQ_GESTIONE", "D");
|
paf2700f.set("PQ_GESTIONE", "D");
|
||||||
ok &= paf2700f.insert();
|
ok &= insert(paf2700f);
|
||||||
// </DatiGenerali>
|
// </DatiGenerali>
|
||||||
|
|
||||||
// Azzera DDT
|
// Azzera DDT
|
||||||
TPaf_record paf1600f("PAF1600F");
|
TPaf_record paf1600f("PAF1600F");
|
||||||
paf1600f.set("PF_KEYHEADERFATT", hfatt);
|
paf1600f.set("PF_KEYHEADERFATT", hfatt);
|
||||||
paf1600f.set("PF_KEYBODYFATT", bfatt);
|
paf1600f.set("PF_KEYBODYFATT", bfatt);
|
||||||
paf1600f.remove();
|
remove(paf1600f);
|
||||||
|
|
||||||
// Fuori dallo scope per dopo
|
// Fuori dallo scope per dopo
|
||||||
const TString16 cup = doc.get(DOC_CUP);
|
const TString16 cup = doc.get(DOC_CUP);
|
||||||
@ -930,19 +1010,19 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record paf1000f("PAF1000F");
|
TPaf_record paf1000f("PAF1000F");
|
||||||
paf1000f.set("P0_KEYHEADERFATT", hfatt);
|
paf1000f.set("P0_KEYHEADERFATT", hfatt);
|
||||||
paf1000f.set("P0_KEYBODYFATT", bfatt);
|
paf1000f.set("P0_KEYBODYFATT", bfatt);
|
||||||
paf1000f.remove();
|
remove(paf1000f);
|
||||||
|
|
||||||
// Azzera convenzioni
|
// Azzera convenzioni
|
||||||
TPaf_record paf1100f("PAF1100F");
|
TPaf_record paf1100f("PAF1100F");
|
||||||
paf1100f.set("PA_KEYHEADERFATT", hfatt);
|
paf1100f.set("PA_KEYHEADERFATT", hfatt);
|
||||||
paf1100f.set("PA_KEYBODYFATT", bfatt);
|
paf1100f.set("PA_KEYBODYFATT", bfatt);
|
||||||
paf1100f.remove();
|
remove(paf1100f);
|
||||||
|
|
||||||
// Azzera ordini
|
// Azzera ordini
|
||||||
TPaf_record paf1200f("PAF1200F");
|
TPaf_record paf1200f("PAF1200F");
|
||||||
paf1200f.set("PB_KEYHEADERFATT", hfatt);
|
paf1200f.set("PB_KEYHEADERFATT", hfatt);
|
||||||
paf1200f.set("PB_KEYBODYFATT", bfatt);
|
paf1200f.set("PB_KEYBODYFATT", bfatt);
|
||||||
paf1200f.remove();
|
remove(paf1200f);
|
||||||
|
|
||||||
TString80 con = doc.get(DOC_CONTRATTO);
|
TString80 con = doc.get(DOC_CONTRATTO);
|
||||||
if (con.full() || cup.full() || cig.full())
|
if (con.full() || cup.full() || cig.full())
|
||||||
@ -972,7 +1052,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf1000f.set("P0_CODCUP", cup);
|
paf1000f.set("P0_CODCUP", cup);
|
||||||
paf1000f.set("P0_CODCIG", cig);
|
paf1000f.set("P0_CODCIG", cig);
|
||||||
paf1000f.set("P0_GESTIONE", "D");
|
paf1000f.set("P0_GESTIONE", "D");
|
||||||
ok &= paf1000f.insert();
|
ok &= insert(paf1000f);
|
||||||
}
|
}
|
||||||
else if (tcon == 'C')
|
else if (tcon == 'C')
|
||||||
{
|
{
|
||||||
@ -983,7 +1063,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf1100f.set("PA_CODCUP", cup);
|
paf1100f.set("PA_CODCUP", cup);
|
||||||
paf1100f.set("PA_CODCIG", cig);
|
paf1100f.set("PA_CODCIG", cig);
|
||||||
paf1000f.set("PA_GESTIONE", "D");
|
paf1000f.set("PA_GESTIONE", "D");
|
||||||
ok &= paf1100f.insert();
|
ok &= insert(paf1100f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -994,7 +1074,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf1200f.set("PB_CODCUP", cup);
|
paf1200f.set("PB_CODCUP", cup);
|
||||||
paf1200f.set("PB_CODCIG", cig);
|
paf1200f.set("PB_CODCIG", cig);
|
||||||
paf1200f.set("PB_GESTIONE", "D");
|
paf1200f.set("PB_GESTIONE", "D");
|
||||||
ok &= paf1200f.insert();
|
ok &= insert(paf1200f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,17 +1086,17 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record paf1800f("PAF1800F");
|
TPaf_record paf1800f("PAF1800F");
|
||||||
paf1800f.set("PI_KEYHEADERFATT", hfatt);
|
paf1800f.set("PI_KEYHEADERFATT", hfatt);
|
||||||
paf1800f.set("PI_KEYBODYFATT", bfatt);
|
paf1800f.set("PI_KEYBODYFATT", bfatt);
|
||||||
paf1800f.remove(); // Cancella tutte le righe documento
|
remove(paf1800f); // Cancella tutte le righe documento
|
||||||
|
|
||||||
TPaf_record paf2000f("PAF2000F");
|
TPaf_record paf2000f("PAF2000F");
|
||||||
paf2000f.set("PJ_KEYHEADERFATT", hfatt);
|
paf2000f.set("PJ_KEYHEADERFATT", hfatt);
|
||||||
paf2000f.set("PJ_KEYBODYFATT", bfatt);
|
paf2000f.set("PJ_KEYBODYFATT", bfatt);
|
||||||
paf2000f.remove(); // Cancella tutti gli sconti di riga
|
remove(paf2000f); // Cancella tutti gli sconti di riga
|
||||||
|
|
||||||
TPaf_record paf1900f("PAF1900F");
|
TPaf_record paf1900f("PAF1900F");
|
||||||
paf1900f.set("PY_KEYHEADERFATT", hfatt);
|
paf1900f.set("PY_KEYHEADERFATT", hfatt);
|
||||||
paf1900f.set("PY_KEYBODYFATT", bfatt);
|
paf1900f.set("PY_KEYBODYFATT", bfatt);
|
||||||
paf1900f.remove(); // Cancella tutte le righe articoli del documento
|
remove(paf1900f); // Cancella tutte le righe articoli del documento
|
||||||
|
|
||||||
|
|
||||||
long riga = 0;
|
long riga = 0;
|
||||||
@ -1118,7 +1198,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf2000f.set("PJ_PERCSCONTO", -perc);
|
paf2000f.set("PJ_PERCSCONTO", -perc);
|
||||||
}
|
}
|
||||||
paf2000f.set("PJ_GESTIONE", "D");
|
paf2000f.set("PJ_GESTIONE", "D");
|
||||||
ok &= paf2000f.insert();
|
ok &= insert(paf2000f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1144,7 +1224,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf1600f.set("PF_NUMDDDT", a._numdoc);
|
paf1600f.set("PF_NUMDDDT", a._numdoc);
|
||||||
paf1600f.set("PF_DATADDT", a._datadoc);
|
paf1600f.set("PF_DATADDT", a._datadoc);
|
||||||
paf1600f.set("PF_GESTIONE", "D");
|
paf1600f.set("PF_GESTIONE", "D");
|
||||||
ok &= paf1600f.insert();
|
ok &= insert(paf1600f);
|
||||||
// </DatiDDT>
|
// </DatiDDT>
|
||||||
}
|
}
|
||||||
else if (i == 3)
|
else if (i == 3)
|
||||||
@ -1163,7 +1243,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf1000f.set("P0_CODCIG", cig);
|
paf1000f.set("P0_CODCIG", cig);
|
||||||
}
|
}
|
||||||
paf1000f.set("P0_GESTIONE", "D");
|
paf1000f.set("P0_GESTIONE", "D");
|
||||||
ok &= paf1000f.insert();
|
ok &= insert(paf1000f);
|
||||||
// </DatiOrdineAcquisto>
|
// </DatiOrdineAcquisto>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1224,7 +1304,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
paf1800f.set("PI_GESTIONE", "D");
|
paf1800f.set("PI_GESTIONE", "D");
|
||||||
ok &= paf1800f.insert();
|
ok &= insert(paf1800f);
|
||||||
}
|
}
|
||||||
// </DatiBeniServizi>
|
// </DatiBeniServizi>
|
||||||
|
|
||||||
@ -1241,13 +1321,13 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
// </DatiTrasporto>
|
// </DatiTrasporto>
|
||||||
|
|
||||||
// Salvo la testata
|
// Salvo la testata
|
||||||
ok &= paf0700f.insert();
|
ok &= insert(paf0700f);
|
||||||
|
|
||||||
// <DatiRiepilogo>
|
// <DatiRiepilogo>
|
||||||
TPaf_record paf2200f("PAF2200F");
|
TPaf_record paf2200f("PAF2200F");
|
||||||
paf2200f.set("PL_KEYHEADERFATT", hfatt);
|
paf2200f.set("PL_KEYHEADERFATT", hfatt);
|
||||||
paf2200f.set("PL_KEYBODYFATT", bfatt);
|
paf2200f.set("PL_KEYBODYFATT", bfatt);
|
||||||
paf2200f.remove(); // Cancella tutte le righe di riepilogo IVA
|
remove(paf2200f); // Cancella tutte le righe di riepilogo IVA
|
||||||
|
|
||||||
const char* eiva = "I"; // Esigibilità IVA: Immediata, Differita, Split payment
|
const char* eiva = "I"; // Esigibilità IVA: Immediata, Differita, Split payment
|
||||||
if (doc.is_split_payment())
|
if (doc.is_split_payment())
|
||||||
@ -1273,7 +1353,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
else
|
else
|
||||||
paf2200f.set("PL_RIFNORMATIVO", riva.cod_iva().descrizione());
|
paf2200f.set("PL_RIFNORMATIVO", riva.cod_iva().descrizione());
|
||||||
paf2200f.set("PL_GESTIONE", "D");
|
paf2200f.set("PL_GESTIONE", "D");
|
||||||
ok &= paf2200f.insert();
|
ok &= insert(paf2200f);
|
||||||
}
|
}
|
||||||
// </DatiRiepilogo>
|
// </DatiRiepilogo>
|
||||||
|
|
||||||
@ -1281,7 +1361,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record paf2400f("PAF2400F");
|
TPaf_record paf2400f("PAF2400F");
|
||||||
paf2400f.set("PN_KEYHEADERFATT", hfatt);
|
paf2400f.set("PN_KEYHEADERFATT", hfatt);
|
||||||
paf2400f.set("PN_KEYBODYFATT", bfatt);
|
paf2400f.set("PN_KEYBODYFATT", bfatt);
|
||||||
paf2400f.remove(); // Cancella i dati pagamento
|
remove(paf2400f); // Cancella i dati pagamento
|
||||||
|
|
||||||
TPagamento& pag = doc.pagamento();
|
TPagamento& pag = doc.pagamento();
|
||||||
doc.scadenze_recalc(); // Ricalcola array delle rate
|
doc.scadenze_recalc(); // Ricalcola array delle rate
|
||||||
@ -1291,12 +1371,12 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf2400f.set("PN_RIGA", ZERO); // Al momento non gestiamo più tipologie di pagamento per documento
|
paf2400f.set("PN_RIGA", ZERO); // Al momento non gestiamo più tipologie di pagamento per documento
|
||||||
paf2400f.set("PN_CONDPAGAMENTO", rateazione);
|
paf2400f.set("PN_CONDPAGAMENTO", rateazione);
|
||||||
paf2400f.set("PN_GESTIONE", "D");
|
paf2400f.set("PN_GESTIONE", "D");
|
||||||
ok &= paf2400f.insert();
|
ok &= insert(paf2400f);
|
||||||
|
|
||||||
TPaf_record paf2500f("PAF2500F");
|
TPaf_record paf2500f("PAF2500F");
|
||||||
paf2500f.set("PO_KEYHEADERFATT", hfatt);
|
paf2500f.set("PO_KEYHEADERFATT", hfatt);
|
||||||
paf2500f.set("PO_KEYBODYFATT", bfatt);
|
paf2500f.set("PO_KEYBODYFATT", bfatt);
|
||||||
paf2500f.remove(); // Cancella tutte le rate
|
remove(paf2500f); // Cancella tutte le rate
|
||||||
|
|
||||||
// Imposto i campi uguali per tutte le rate
|
// Imposto i campi uguali per tutte le rate
|
||||||
paf2500f.set("PO_CONDPAGAMENTO", rateazione); // Condizione di pagamento PA
|
paf2500f.set("PO_CONDPAGAMENTO", rateazione); // Condizione di pagamento PA
|
||||||
@ -1334,13 +1414,57 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf2500f.set("PO_IMPORTO", real(riga.get())); // Importo rata
|
paf2500f.set("PO_IMPORTO", real(riga.get())); // Importo rata
|
||||||
|
|
||||||
paf2500f.set("PO_GESTIONE", "D");
|
paf2500f.set("PO_GESTIONE", "D");
|
||||||
ok &= paf2500f.insert();
|
ok &= insert(paf2500f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_gestioneallegati)
|
||||||
|
{
|
||||||
TPaf_record paf2600f("PAF2600F");
|
TPaf_record paf2600f("PAF2600F");
|
||||||
paf2600f.set("PP_KEYHEADERFATT", hfatt);
|
paf2600f.set("PP_KEYHEADERFATT", hfatt);
|
||||||
paf2600f.set("PP_KEYBODYFATT", bfatt);
|
paf2600f.set("PP_KEYBODYFATT", bfatt);
|
||||||
paf2600f.remove(); // Cancella eventuali allegati
|
remove(paf2600f); // Cancella eventuali allegati
|
||||||
|
long nprogr = 0; // Numero di file allegati
|
||||||
|
// Se abilitato stampo il documento e lo allego
|
||||||
|
if (_allegafattura)
|
||||||
|
{
|
||||||
|
//ve1 - 2 FPA 2017 D 202 P D / uADMIN
|
||||||
|
TFilename rep;
|
||||||
|
int filter = dongle().active(RSAUT) ? 2 : 1;
|
||||||
|
while (filter > 0 && !doc.tipo().main_print_profile(rep, filter))
|
||||||
|
filter--;
|
||||||
|
if (filter > 0)
|
||||||
|
{
|
||||||
|
// Costruisco la chiamata
|
||||||
|
TString commandline = "ve1 -";
|
||||||
|
if (filter == 2)
|
||||||
|
commandline << 2; // Esiste il nuovo report :-)
|
||||||
|
else
|
||||||
|
commandline << 0; // Esiste il vecchio form :-(
|
||||||
|
|
||||||
|
commandline << ' ' << doc.get(DOC_CODNUM) << ' ' << doc.get(DOC_ANNO)
|
||||||
|
<< ' ' << doc.get(DOC_PROVV) << ' ' << doc.get(DOC_NDOC) << " X P"; // X: stampa su disco, P: provvisorio
|
||||||
|
TExternal_app interattivo(commandline);
|
||||||
|
if (interattivo.run() != NOERR)
|
||||||
|
{
|
||||||
|
TString msgerr = "Fallita generazione PDF documento ";
|
||||||
|
msgerr << doc.get(DOC_CODNUM) << ' ' << doc.get(DOC_ANNO)
|
||||||
|
<< ' ' << doc.get(DOC_PROVV) << ' ' << doc.get(DOC_NDOC);
|
||||||
|
error_box(msgerr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TFilename pdf; pdf.tempdir();
|
||||||
|
pdf << SLASH << doc.get(DOC_ANNO) << '_' << doc.get(DOC_CODNUM) << '_' << doc.get(DOC_NDOC) << ".pdf";
|
||||||
|
if (!pdf.exist() && !yesno_box("Attenzione! Non è stato possibile creare il pdf, continuare?"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!add_row_alleg(pdf, nprogr, paf2600f))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TToken_string allegati(doc.get("COLL_GOLEM"), '\n');
|
TToken_string allegati(doc.get("COLL_GOLEM"), '\n');
|
||||||
bool load_allegati = true;
|
bool load_allegati = true;
|
||||||
if (allegati.full())
|
if (allegati.full())
|
||||||
@ -1354,34 +1478,16 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
long nprogr = 0; // Numero di file allegati
|
|
||||||
TFilename fname;
|
TFilename fname;
|
||||||
FOR_EACH_TOKEN(allegati, row)
|
FOR_EACH_TOKEN(allegati, row)
|
||||||
{
|
{
|
||||||
const TToken_string entry(row);
|
const TToken_string entry(row);
|
||||||
if (entry.get(0, fname) && fname.exist())
|
if (entry.get(0, fname) && fname.exist())
|
||||||
{
|
{
|
||||||
static TString dest_path;
|
if (!add_row_alleg(fname, nprogr, paf2600f))
|
||||||
static TString dest_usr_path;
|
|
||||||
|
|
||||||
dest_path.cut(0) << _def_fld << fname.name();
|
|
||||||
dest_usr_path.cut(0) << _def_usr_fld << fname.name();
|
|
||||||
|
|
||||||
if (!fcopy(fname, dest_usr_path))
|
|
||||||
{
|
|
||||||
if (yesno_box("Errore critico nel copiare il file %s, si desidera continuare?", fname.name()))
|
|
||||||
continue;
|
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provo a copiare il file
|
|
||||||
paf2600f.set("PP_NUMEROLINEA", ++nprogr);
|
|
||||||
paf2600f.set("PP_NOMEATTACHMENT", fname.name());
|
|
||||||
paf2600f.set("PP_ATTACHMENT", dest_path);
|
|
||||||
fname.upper(); // serve estensione maiuscola
|
|
||||||
paf2600f.set("PP_FMTATTACHMENT", fname.ext());
|
|
||||||
ok &= paf2600f.insert();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1390,15 +1496,15 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
|
|
||||||
// Tabella di non invio XML
|
// Tabella di non invio XML
|
||||||
TPaf_record pafw300f("PAFW300F");
|
TPaf_record pafw300f("PAFW300F");
|
||||||
pafw300f.set("PW_KEYPRGINVIO", hfatt);
|
pafw300f.set("PW_KEYHEADERFATT", hfatt);
|
||||||
pafw300f.set("PW_KEYHEADERFATT", bfatt);
|
pafw300f.set("PW_KEYBODYFATT", bfatt);
|
||||||
pafw300f.remove(); // Cancella eventuali allegati
|
remove(pafw300f); // Cancella eventuali allegati
|
||||||
const TTipo_documento& td = cached_tipodoc(doc.get(DOC_TIPODOC));
|
const TTipo_documento& td = cached_tipodoc(doc.get(DOC_TIPODOC));
|
||||||
const TString codsdi = !td.invio_xml() ? "**********" : (enapec ? pec : coddest);
|
const TString codsdi = !td.invio_xml() ? "**********" : (enapec ? pec : coddest);
|
||||||
pafw300f.set("PW_CODSDI", codsdi);
|
pafw300f.set("PW_CODSDI", codsdi);
|
||||||
ok &= pafw300f.insert();
|
ok &= insert(pafw300f);
|
||||||
|
|
||||||
return _to_commit = ok;
|
return _to_commit = (ok && save_paf());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TDoc_fp::doc_to_paf(const TRectype& rec)
|
bool TDoc_fp::doc_to_paf(const TRectype& rec)
|
||||||
@ -1431,7 +1537,7 @@ bool TDoc_fp::doc_to_paf(const TFilename& ini)
|
|||||||
return doc_to_paf(key);
|
return doc_to_paf(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
TDoc_fp::TDoc_fp() : _log(nullptr)
|
TDoc_fp::TDoc_fp() : _log(nullptr), _cache_insert(false)
|
||||||
{
|
{
|
||||||
_ditta.init(LF_NDITTE, prefix().get_codditta());
|
_ditta.init(LF_NDITTE, prefix().get_codditta());
|
||||||
_cofi = ini_get_string(CONFIG_DITTA, "fp", "cofitras");
|
_cofi = ini_get_string(CONFIG_DITTA, "fp", "cofitras");
|
||||||
@ -1439,6 +1545,9 @@ TDoc_fp::TDoc_fp() : _log(nullptr)
|
|||||||
if (_cofi.blank())
|
if (_cofi.blank())
|
||||||
_cofi = _ditta.codice_fiscale();
|
_cofi = _ditta.codice_fiscale();
|
||||||
|
|
||||||
|
_gestioneallegati = ini_get_bool(CONFIG_DITTA, "fp", "gestioneallegati");
|
||||||
|
_allegafattura = ini_get_bool(CONFIG_DITTA, "fp", "allegafatt");
|
||||||
|
|
||||||
_def_fld = ini_get_string(CONFIG_DITTA, "fp", "flddest");
|
_def_fld = ini_get_string(CONFIG_DITTA, "fp", "flddest");
|
||||||
if (!_def_fld.ends_with("\\"))
|
if (!_def_fld.ends_with("\\"))
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "../ve/velib05.h"
|
#include "../ve/velib05.h"
|
||||||
#include "../fe/felib.h"
|
#include "../fe/felib.h"
|
||||||
#include <reputils.h>
|
#include <reputils.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define SQL_FLD "sql/"
|
#define SQL_FLD "sql/"
|
||||||
|
|
||||||
@ -49,7 +50,9 @@ public:
|
|||||||
void set(const char* fld, bool var);
|
void set(const char* fld, bool var);
|
||||||
const TString sq_get(const char* fld) const;
|
const TString sq_get(const char* fld) const;
|
||||||
|
|
||||||
|
TString& insert_string();
|
||||||
bool insert();
|
bool insert();
|
||||||
|
TString& remove_string();
|
||||||
bool remove();
|
bool remove();
|
||||||
bool search();
|
bool search();
|
||||||
bool search(const char* k1, const char* k2, const char* k3 = NULL);
|
bool search(const char* k1, const char* k2, const char* k3 = NULL);
|
||||||
@ -76,21 +79,27 @@ private:
|
|||||||
TFilename _dbname;
|
TFilename _dbname;
|
||||||
TLog_report* _log;
|
TLog_report* _log;
|
||||||
TString _logpaf;
|
TString _logpaf;
|
||||||
|
bool _gestioneallegati;
|
||||||
|
bool _allegafattura;
|
||||||
TString _def_fld;
|
TString _def_fld;
|
||||||
TString _def_usr_fld;
|
TString _def_usr_fld;
|
||||||
bool _to_commit;
|
bool _to_commit;
|
||||||
|
bool _cache_insert;
|
||||||
|
vector<TString> _query;
|
||||||
|
|
||||||
int parse_line(const TString& line, TString& var, TString& val) const;
|
int parse_line(const TString& line, TString& var, TString& val) const;
|
||||||
bool create_table(TScanner& paf, const TString& table);
|
bool create_table(TScanner& paf, const TString& table);
|
||||||
|
|
||||||
const TRectype* find_parent_row(const TRectype& rdoc) const;
|
const TRectype* find_parent_row(const TRectype& rdoc) const;
|
||||||
int find_ancestors(const TRiga_documento& rdoc, TArray& ancestors) const;
|
int find_ancestors(const TRiga_documento& rdoc, TArray& ancestors) const;
|
||||||
|
bool insert(TPaf_record& p);
|
||||||
|
bool remove(TPaf_record& p);
|
||||||
|
bool save_paf();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parse_sconto(const TString& formula, TToken_string& sconti) const;
|
bool parse_sconto(const TString& formula, TToken_string& sconti) const;
|
||||||
static bool get_bnp_iban(const TString& abi, const TString& cab, int prg, TString& iban);
|
static bool get_bnp_iban(const TString& abi, const TString& cab, int prg, TString& iban);
|
||||||
bool get_bank(const TDocumento& doc, TString& iban, TString& abi, TString& cab,
|
bool get_bank(const TDocumento& doc, TString& iban, TString& abi, TString& cab, TString& istituto) const;
|
||||||
TString& istituto) const;
|
|
||||||
const char* descrizione(const TRiga_documento& rdoc) const;
|
const char* descrizione(const TRiga_documento& rdoc) const;
|
||||||
const TRectype& cco(const TRectype& doc) const; // Contratto/Convenzione/Offerta
|
const TRectype& cco(const TRectype& doc) const; // Contratto/Convenzione/Offerta
|
||||||
|
|
||||||
@ -98,7 +107,8 @@ static bool get_bnp_iban(const TString& abi, const TString&
|
|||||||
const char* natura(const TString& codiva) const;
|
const char* natura(const TString& codiva) const;
|
||||||
static void set_IVA(const TString& codiva, TPaf_record& paf);
|
static void set_IVA(const TString& codiva, TPaf_record& paf);
|
||||||
static void set_IVA(const TRiga_documento& rdoc, TPaf_record& paf);
|
static void set_IVA(const TRiga_documento& rdoc, TPaf_record& paf);
|
||||||
static bool add_row_art(const TString codice_tipo, const TString& codice_valore, TPaf_record& paf);
|
bool add_row_art(const TString codice_tipo, const TString& codice_valore, TPaf_record& paf);
|
||||||
|
bool add_row_alleg(TFilename& file, long& nprogr, TPaf_record& paf);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool doc_to_paf(TDocumentoEsteso& doc);
|
bool doc_to_paf(TDocumentoEsteso& doc);
|
||||||
@ -108,6 +118,7 @@ public:
|
|||||||
// Mostra il log a fine esecuzione
|
// Mostra il log a fine esecuzione
|
||||||
bool show_log();
|
bool show_log();
|
||||||
const int commit();
|
const int commit();
|
||||||
|
void set_cache_insert(const bool v) { _cache_insert = v; }
|
||||||
|
|
||||||
TDoc_fp();
|
TDoc_fp();
|
||||||
~TDoc_fp();
|
~TDoc_fp();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user