Patch level : 12.0 nopatch

Files correlati     :
Commento        :

Implementazione invio regolarizzazioni al 07/11/2021
This commit is contained in:
smen 2021-11-08 17:43:12 +01:00
parent 4405d1fb25
commit 5e3ae2faaa
14 changed files with 924 additions and 759 deletions

View File

@ -363,7 +363,7 @@ const char* get_ini_codcaus()
return ini_get_string(FILE_CONFIG, FILE_SECTION, F1_CAUS); return ini_get_string(FILE_CONFIG, FILE_SECTION, F1_CAUS);
} }
const char* get_codcaus(const char * tipodoc, const char* codcf) const char* get_codcaus(const char * tipodoc, const long codcf)
{ {
TLocalisamfile cfven(LF_CFVEN); TLocalisamfile cfven(LF_CFVEN);
cfven.put(CFV_TIPOCF, "F"); cfven.put(CFV_TIPOCF, "F");

View File

@ -137,7 +137,7 @@ public:
TFppro& fppro_db(); TFppro& fppro_db();
const char* get_ini_codcaus(); const char* get_ini_codcaus();
const char* get_codcaus(const char * tipodoc, const char* codcf); const char* get_codcaus(const char * tipodoc, const long codcf);
bool get_endatareg(); bool get_endatareg();
TString get_datainireg(); TString get_datainireg();
TString get_dataendreg(); TString get_dataendreg();

View File

@ -114,7 +114,7 @@ bool TEstrazione::check_documento_vendita(const TLocalisamfile& mov, _Out_ bool&
const TDocumento doc(mov.get(MOV_DPROVV)[0], mov.get_int(MOV_DANNO), mov.get(MOV_DCODNUM), mov.get_int(MOV_DNDOC)); const TDocumento doc(mov.get(MOV_DPROVV)[0], mov.get_int(MOV_DANNO), mov.get(MOV_DCODNUM), mov.get_int(MOV_DNDOC));
exist_doc = true; exist_doc = true;
if (chiave_paf(doc, hfatt, bfatt)) if (chiave_paf_doc(doc, hfatt, bfatt))
{ {
query << "SELECT * FROM PAF0100F WHERE P1_KEYHEADERFATT = '" << hfatt << "' AND P1_KEYBODYFATT = '" << bfatt << "';"; query << "SELECT * FROM PAF0100F WHERE P1_KEYHEADERFATT = '" << hfatt << "' AND P1_KEYBODYFATT = '" << bfatt << "';";
fp_db().sq_set_exec(query); fp_db().sq_set_exec(query);

View File

@ -174,7 +174,7 @@ void TPAR_mask::fill()
TString rif = get_dest_sdi(rec.get_string(CFV_TIPOCF)[0], rec.get_long(CFV_CODCF), EMPTY_STRING); TString rif = get_dest_sdi(rec.get_string(CFV_TIPOCF)[0], rec.get_long(CFV_CODCF), EMPTY_STRING);
// Se è ancora vuoto potrebbe essere estero // Se è ancora vuoto potrebbe essere estero
if(rif.empty()) if (rif.empty())
{ {
// Segno la riga errata // Segno la riga errata
if (first) if (first)
@ -275,7 +275,7 @@ void TPAR_mask::connect_keys()
{ {
// Come prima cosa controllo che effettivamente la chiave di questo doc sia in giro per il mondo // Come prima cosa controllo che effettivamente la chiave di questo doc sia in giro per il mondo
query.cut(0) << "SELECT * FROM PAF0100F WHERE P1_KEYHEADERFATT = '" << campo_hfatt << "' AND P1_KEYBODYFATT = '" << campo_bfatt << "'"; query.cut(0) << "SELECT * FROM PAF0100F WHERE P1_KEYHEADERFATT = '" << campo_hfatt << "' AND P1_KEYBODYFATT = '" << campo_bfatt << "'";
if(fp_db().sq_set_exec(query)) if (fp_db().sq_set_exec(query))
{ {
msg_log.cut(0) << "Il documento " << campo_bfatt << " è già presente nel DB, verrà saltato"; msg_log.cut(0) << "Il documento " << campo_bfatt << " è già presente nel DB, verrà saltato";
legno.log(9000, msg_log); legno.log(9000, msg_log);
@ -315,7 +315,7 @@ void TPAR_mask::connect_keys()
} }
} }
if(!found) if (!found)
{ {
msg_log.cut(0) << "Il documento " << campo_bfatt << " non è presente nel DB PAF, verrà saltato"; msg_log.cut(0) << "Il documento " << campo_bfatt << " non è presente nel DB PAF, verrà saltato";
legno.log(9000, msg_log); legno.log(9000, msg_log);
@ -347,7 +347,7 @@ void TPAR_mask::connect_keys()
"UPDATE PAF3200F SET PU_KEYHEADERFATT = '" << campo_hfatt << "', PU_KEYBODYFATT = '" << campo_bfatt << "' WHERE PU_KEYPRGINVIO = '" << db_prginv << "' AND PU_KEYHEADERFATT = '" << db_hfatt << "' AND PU_KEYBODYFATT = '" << db_bfatt << "'\n" << "UPDATE PAF3200F SET PU_KEYHEADERFATT = '" << campo_hfatt << "', PU_KEYBODYFATT = '" << campo_bfatt << "' WHERE PU_KEYPRGINVIO = '" << db_prginv << "' AND PU_KEYHEADERFATT = '" << db_hfatt << "' AND PU_KEYBODYFATT = '" << db_bfatt << "'\n" <<
"UPDATE PAFW300F SET PW_KEYHEADERFATT = '" << campo_hfatt << "', PW_KEYBODYFATT = '" << campo_bfatt << "' WHERE PW_KEYPRGINVIO = '" << db_prginv << "' AND PW_KEYHEADERFATT = '" << db_hfatt << "' AND PW_KEYBODYFATT = '" << db_bfatt << "'\n"; "UPDATE PAFW300F SET PW_KEYHEADERFATT = '" << campo_hfatt << "', PW_KEYBODYFATT = '" << campo_bfatt << "' WHERE PW_KEYPRGINVIO = '" << db_prginv << "' AND PW_KEYHEADERFATT = '" << db_hfatt << "' AND PW_KEYBODYFATT = '" << db_bfatt << "'\n";
if(fp_db().sq_set_exec(query)) if (fp_db().sq_set_exec(query))
{ {
msg_log.cut(0) << "Il documento " << campo_bfatt << " e' stato aggiornato correttamente\nChiave precedente: " << db_bfatt << " chiave nuova: " << campo_bfatt; msg_log.cut(0) << "Il documento " << campo_bfatt << " e' stato aggiornato correttamente\nChiave precedente: " << db_bfatt << " chiave nuova: " << campo_bfatt;
legno.log(0, msg_log); legno.log(0, msg_log);
@ -489,7 +489,7 @@ bool TPAR_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
break; break;
default: break; default: break;
} }
if((e == fe_modify || e >= se_enter) && jolly == 0) if ((e == fe_modify || e >= se_enter) && jolly == 0)
{ {
if (o.dlg() >= START_MASK && o.dlg() <= END_MASK) if (o.dlg() >= START_MASK && o.dlg() <= END_MASK)
{ {
@ -511,7 +511,7 @@ void TPAR_mask::next_page(int p)
_filter_changed = false; _filter_changed = false;
} }
} }
if(ok) if (ok)
TAutomask::next_page(p); TAutomask::next_page(p);
} }
@ -625,7 +625,7 @@ void TPAR_mask::set_err_paf()
"UPDATE PAF3200F SET PU_GESTIONE = 'E', PU_KEYPRGINVIO = 'DELETED' WHERE PU_KEYHEADERFATT = '" << hfatt << "' AND PU_KEYBODYFATT = '" << bfatt << "';\n" << "UPDATE PAF3200F SET PU_GESTIONE = 'E', PU_KEYPRGINVIO = 'DELETED' WHERE PU_KEYHEADERFATT = '" << hfatt << "' AND PU_KEYBODYFATT = '" << bfatt << "';\n" <<
// PAFW3 non ha il flag di gestione // PAFW3 non ha il flag di gestione
"UPDATE PAFW300F SET PW_KEYPRGINVIO = 'DELETED' WHERE PW_KEYHEADERFATT = '" << hfatt << "' AND PW_KEYBODYFATT = '" << bfatt << "';\n"; "UPDATE PAFW300F SET PW_KEYPRGINVIO = 'DELETED' WHERE PW_KEYHEADERFATT = '" << hfatt << "' AND PW_KEYBODYFATT = '" << bfatt << "';\n";
if(!fp_db().sq_set_exec(query)) if (!fp_db().sq_set_exec(query))
{ {
TString err = "Impossibile salvare la regolarizzazione "; err << nreg << "\nVerrà saltata."; TString err = "Impossibile salvare la regolarizzazione "; err << nreg << "\nVerrà saltata.";
error_box(err); error_box(err);

View File

@ -58,7 +58,7 @@ DATE F_DATAEND
BEGIN BEGIN
PROMPT 50 1 "Data finale " PROMPT 50 1 "Data finale "
VALIDATE DATE_CMP_FUNC >= F_DATAINI VALIDATE DATE_CMP_FUNC >= F_DATAINI
WARNING "La data finale non può essere minore della data iniziale" WARNING "La data finale non pu essere minore della data iniziale"
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
END END

View File

@ -14,14 +14,14 @@
#include <map> #include <map>
#define SQL_FLD "sql/" #define SQL_FLD "sql/"
#define MANCATA_SEND "S" // Se la mail di mancata consegna è già stata inviata P1_ERRINT è segnato con "S" #define MANCATA_SEND "S" // Se la mail di mancata consegna gi stata inviata P1_ERRINT segnato con "S"
// Typedef per aiutare a capire cosa sono le chiavi // Typedef per aiutare a capire cosa sono le chiavi
typedef TString MCodice_riga; typedef TString MCodice_riga;
typedef TString MTipo_documento; typedef TString MTipo_documento;
class TDoc_fp; class TDoc_fp;
enum { no_pdf = -1, pdf_ok = 0, no_alleg = -2}; enum { no_pdf = -1, pdf_ok = 0, no_alleg = -2 };
bool set_connection(SSimple_query& s); bool set_connection(SSimple_query& s);
// Ritorna la connessione al DB paf secondo i parametri impostati nel programma di configurazione // Ritorna la connessione al DB paf secondo i parametri impostati nel programma di configurazione
@ -283,7 +283,9 @@ public:
TFp_mail_sender() { _error = -1; } TFp_mail_sender() { _error = -1; }
TFp_mail_sender(const int anno, const long ndoc, const TFixed_string& codnum, const TFixed_string& tipodoc, const long codcf, TString mail, bool accord, TString ragsoc, bool sent) TFp_mail_sender(const int anno, const long ndoc, const TFixed_string& codnum, const TFixed_string& tipodoc, const long codcf, TString mail, bool accord, TString ragsoc, bool sent)
{ set_doc(anno, ndoc, codnum, tipodoc, codcf, mail, accord, ragsoc, sent); } {
set_doc(anno, ndoc, codnum, tipodoc, codcf, mail, accord, ragsoc, sent);
}
}; };
class TFPRiga_documento : public TRiga_documento class TFPRiga_documento : public TRiga_documento
@ -317,7 +319,7 @@ public:
inline bool operator==(const TFPBuono_di_consegna& l, const TFPBuono_di_consegna& r) inline bool operator==(const TFPBuono_di_consegna& l, const TFPBuono_di_consegna& r)
{ {
TToken_string appo(l._numdoc, '/'); TToken_string appo(l._numdoc, '/');
if(appo.items() == 3) if (appo.items() == 3)
return TString(appo.get(2)) == r._numdoc && l._datadoc == r._datadoc; return TString(appo.get(2)) == r._numdoc && l._datadoc == r._datadoc;
return l._numdoc == r._numdoc && l._datadoc == r._datadoc; return l._numdoc == r._numdoc && l._datadoc == r._datadoc;
} }
@ -353,7 +355,7 @@ struct TFP_adg
: _tipo_dato(tipo_dato), : _tipo_dato(tipo_dato),
_riferimento_testo(riferimento_testo), _riferimento_testo(riferimento_testo),
_riferimento_numero(riferimento_numero), _riferimento_numero(riferimento_numero),
_riferimento_data(riferimento_data){} _riferimento_data(riferimento_data) {}
}; };
/**< /**<
@ -415,14 +417,14 @@ public:
inline TFP_custom_cache& cached_custom_fp() inline TFP_custom_cache& cached_custom_fp()
{ {
static std::shared_ptr<TFP_custom_cache> carmelo; static std::shared_ptr<TFP_custom_cache> carmelo;
if(carmelo == nullptr) if (carmelo == nullptr)
{ {
carmelo.reset(new TFP_custom_cache); carmelo.reset(new TFP_custom_cache);
} }
return *carmelo; return *carmelo;
} }
class TFP_expression : public TObject // ma perchè non derivano da expre documento cazzone ? se sono più espressioni prima si separa la token string class TFP_expression : public TObject // ma perch non derivano da expre documento cazzone ? se sono pi espressioni prima si separa la token string
{ {
enum TFP_operator { error, eq, neq, gt, ls, gteq, lseq, and, or }; enum TFP_operator { error, eq, neq, gt, ls, gteq, lseq, and, or };
@ -504,7 +506,7 @@ private:
struct struct
{ {
bool _is_valuta_estera{ false }; // Se il documento è in valuta estera bool _is_valuta_estera{ false }; // Se il documento in valuta estera
TString4 _cod_val; TString4 _cod_val;
real _cambio; real _cambio;
} _doc_cambio; } _doc_cambio;
@ -523,7 +525,7 @@ private:
protected: protected:
/**< Funzioni di controllo */ /**< Funzioni di controllo */
/**< Controlli di testata, non è const per il calcolo della codizione di pagamento */ /**< Controlli di testata, non const per il calcolo della codizione di pagamento */
bool check_initial(TDocumentoEsteso& doc); bool check_initial(TDocumentoEsteso& doc);
/**< Controllo di riga */ /**< Controllo di riga */
bool check_row(const TRiga_documento& rdoc); bool check_row(const TRiga_documento& rdoc);

View File

@ -77,7 +77,7 @@ string getline(ifstream& f)
bool check_tables() bool check_tables()
{ {
/* /*
* Da questo programma in poi verrà utilizzato un sistema diverso per la creazione e aggiornamento delle tabelle * Da questo programma in poi verr utilizzato un sistema diverso per la creazione e aggiornamento delle tabelle
* Verranno utilizzati dei file.sql aggiornati con il numero di patch, leggermente scomodo durante la creazione ma facile per i controlli successivamente * Verranno utilizzati dei file.sql aggiornati con il numero di patch, leggermente scomodo durante la creazione ma facile per i controlli successivamente
*/ */
SLIST files = xvt_fsys_list_files(".sql", "sql/fp0/", false); SLIST files = xvt_fsys_list_files(".sql", "sql/fp0/", false);
@ -88,7 +88,7 @@ bool check_tables()
TString version; TString version;
if (tabmod.read() == NOERR) if (tabmod.read() == NOERR)
version = tabmod.get("S0"); version = tabmod.get("S0");
for(SLIST_ELT file = xvt_slist_get_first(files); file; file = xvt_slist_get_next(files, file)) for (SLIST_ELT file = xvt_slist_get_first(files); file; file = xvt_slist_get_next(files, file))
{ {
TString file_version = TFilename(file->str).name_only(); TString file_version = TFilename(file->str).name_only();
file_version = file_version.mid(2, 4); file_version = file_version.mid(2, 4);
@ -96,10 +96,10 @@ bool check_tables()
if (file_version <= version) if (file_version <= version)
continue; continue;
ifstream f(file->str); ifstream f(file->str);
if(f.is_open()) if (f.is_open())
{ {
string s; string s;
while(!f.eof()) while (!f.eof())
{ {
static string r; static string r;
r = getline(f); r = getline(f);
@ -108,11 +108,11 @@ bool check_tables()
s += r + '\n'; s += r + '\n';
// Cerco un ; // Cerco un ;
const int limiter = s.find(';') + 1; const int limiter = s.find(';') + 1;
if(limiter > 0) if (limiter > 0)
{ {
string query = s.substr(0, limiter); string query = s.substr(0, limiter);
s.erase(0, limiter); s.erase(0, limiter);
if(!fp_db().sq_set_exec(query, false) || !fp_db().sq_commit()) if (!fp_db().sq_set_exec(query, false) || !fp_db().sq_commit())
{ {
fatal_box("Impossibile eseguire/salvare la query:\n%s\n%s", query.c_str(), fp_db().sq_get_text_error(false)); fatal_box("Impossibile eseguire/salvare la query:\n%s\n%s", query.c_str(), fp_db().sq_get_text_error(false));
} }
@ -130,7 +130,7 @@ bool check_tables()
tabmod.put("COD", "SQL"); tabmod.put("COD", "SQL");
tabmod.put("CODTAB", "VERSION"); tabmod.put("CODTAB", "VERSION");
tabmod.put("S0", file_version); tabmod.put("S0", file_version);
if(tabmod.rewrite_write() != NOERR && !yesno_box("Attenzione! Errore di aggiornamento versione di Database in Campo, continuare? %s", file_version)) if (tabmod.rewrite_write() != NOERR && !yesno_box("Attenzione! Errore di aggiornamento versione di Database in Campo, continuare? %s", file_version))
{ {
return false; return false;
} }
@ -144,7 +144,7 @@ TString& complete_num_fp(const TCodice_numerazione& codnum, const int numdoc)
const TString& prefisso = codnum.prefisso(); const TString& prefisso = codnum.prefisso();
const TString& postfisso = codnum.postfisso(); const TString& postfisso = codnum.postfisso();
static TString ndoc; ndoc.cut(0) << numdoc; static TString ndoc; ndoc.cut(0) << numdoc;
if(prefisso.full() || postfisso.full()) if (prefisso.full() || postfisso.full())
{ {
for (; ndoc.len() < len_num_doc;) for (; ndoc.len() < len_num_doc;)
ndoc.add_front("0"); ndoc.add_front("0");
@ -215,7 +215,7 @@ bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString&
const TCli_for clifo(tipocf, codcf); const TCli_for clifo(tipocf, codcf);
pec = clifo.get("PEC"); pec = clifo.get("PEC");
if(!cod_ind_sped.empty()) if (!cod_ind_sped.empty())
{ {
TLocalisamfile indsp(LF_INDSP); TLocalisamfile indsp(LF_INDSP);
indsp.put(IND_TIPOCF, tipocf); indsp.put(IND_TIPOCF, tipocf);
@ -224,7 +224,7 @@ bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString&
indsp.read(); indsp.read();
coddest = indsp.get(IND_PADESTIN); coddest = indsp.get(IND_PADESTIN);
} }
if(coddest.empty()) if (coddest.empty())
coddest = clifo.vendite().get("PADESTIN"); coddest = clifo.vendite().get("PADESTIN");
const TAnagrafica anag(LF_CLIFO, tipocf, codcf); const TAnagrafica anag(LF_CLIFO, tipocf, codcf);
@ -232,7 +232,7 @@ bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString&
{ {
if (pec.full() || get_esp_pri_empty()) if (pec.full() || get_esp_pri_empty())
coddest = "0000000"; coddest = "0000000";
// Controllo se è straniero // Controllo se straniero
else if (anag.estero() && anag.stato_partita_IVA() != "IT") else if (anag.estero() && anag.stato_partita_IVA() != "IT")
{ {
coddest = get_esp_est() ? get_esp_est_cod() : ""; coddest = get_esp_est() ? get_esp_est_cod() : "";
@ -248,7 +248,7 @@ inline const TString& no_special(char a)
{ {
TString& r = get_tmp_string().cut(0); TString& r = get_tmp_string().cut(0);
if(a != '\'') if (a != '\'')
{ {
r << a; r << a;
} }
@ -299,7 +299,7 @@ TString& add_filter(const TString& field, const TString& from, const TString& to
/*************************************************************************** /***************************************************************************
* TPaf_record * TPaf_record
***************************************************************************/ ***************************************************************************/
// Imposta il valore di un campo variant // Imposta il valore di un campo variant
void TPaf_record::set(const char* fld, const TVariant& var) void TPaf_record::set(const char* fld, const TVariant& var)
{ {
CHECK(fld && *fld, "Null field name"); CHECK(fld && *fld, "Null field name");
@ -340,7 +340,7 @@ void TPaf_record::set(const char* fld, const char* val)
void TPaf_record::set(const char* fld, const TString& val) void TPaf_record::set(const char* fld, const TString& val)
{ {
const TVariant var(val); const TVariant var(val);
if(!var.is_string() || (val.full())) if (!var.is_string() || (val.full()))
set(fld, var); set(fld, var);
} }
@ -403,7 +403,7 @@ const TString& TPaf_record::var2str(const TString& fldname, const TVariant& var)
if (apici && str[0] != '0' && real::is_natural(str)) if (apici && str[0] != '0' && real::is_natural(str))
apici = false; apici = false;
// Parso i caratteri speciali // Parso i caratteri speciali
for(int i = 0; i < str.len(); i++) for (int i = 0; i < str.len(); i++)
{ {
tmp << no_special(str[i]); tmp << no_special(str[i]);
} }
@ -694,7 +694,7 @@ TAncestor::TAncestor(const TRectype& rdoc)
***************************************************************************/ ***************************************************************************/
bool TFPBuono_di_consegna::already_exist(map<TString20, TDate>& ancestors_s) const bool TFPBuono_di_consegna::already_exist(map<TString20, TDate>& ancestors_s) const
{ {
for(auto it = ancestors_s.begin(); it != ancestors_s.end(); ++it) for (auto it = ancestors_s.begin(); it != ancestors_s.end(); ++it)
{ {
TFPBuono_di_consegna b(it->first, it->second); TFPBuono_di_consegna b(it->first, it->second);
if (b == *this) if (b == *this)
@ -751,11 +751,11 @@ bool TDoc_fp::get_bnp_iban(const TString& abi, const TString& cab, int nprog, TS
bool TDoc_fp::get_bank(TDocumento& doc, TString& iban, TString& abi, TString& cab, TString& istituto) const bool TDoc_fp::get_bank(TDocumento& doc, TString& iban, TString& abi, TString& cab, TString& istituto) const
{ {
bool found = false; bool found = false;
if(doc.pagamento().tipo_rata(0) == TTipo_pag::_bonfico) if (doc.pagamento().tipo_rata(0) == TTipo_pag::_bonfico)
{ {
found = get_bank_presentazione(doc, iban, abi, cab, istituto); found = get_bank_presentazione(doc, iban, abi, cab, istituto);
} }
else if(doc.pagamento().tipo_rata(0) == TTipo_pag::_ric_ban || doc.pagamento().tipo_rata(0) == TTipo_pag::_rid) else if (doc.pagamento().tipo_rata(0) == TTipo_pag::_ric_ban || doc.pagamento().tipo_rata(0) == TTipo_pag::_rid)
{ {
found = get_bank_appoggio(doc, iban, abi, cab, istituto); found = get_bank_appoggio(doc, iban, abi, cab, istituto);
} }
@ -788,7 +788,7 @@ bool TDoc_fp::get_bank_presentazione(const TDocumento& doc, TString& iban, TStri
get_bnp_iban(abi, cab, -1, iban); get_bnp_iban(abi, cab, -1, iban);
} }
} }
if(!found) // Se non trovo banca su CFBAN la cerco su CFVEN if (!found) // Se non trovo banca su CFBAN la cerco su CFVEN
{ {
const TRectype& cfven = doc.clifor().vendite(); const TRectype& cfven = doc.clifor().vendite();
abi = cfven.get(CFV_CODABIPR); abi = cfven.get(CFV_CODABIPR);
@ -810,7 +810,7 @@ bool TDoc_fp::get_bank_appoggio(const TDocumento& doc, TString& iban, TString& a
bool found = abi.full() && cab.full(); bool found = abi.full() && cab.full();
if (found) if (found)
istituto = cache().get("%BAN", abi, "S0"); istituto = cache().get("%BAN", abi, "S0");
if(iban.empty()) if (iban.empty())
{ {
TToken_string key; TToken_string key;
key.add("C"); key.add("C");
@ -839,10 +839,10 @@ const TString& TDoc_fp::descrizione(const TRiga_documento& rdoc)
tmp.replace('\n', ' '); tmp.replace('\n', ' ');
tmp.strip_double_spaces(); tmp.strip_double_spaces();
tmp.trim(); tmp.trim();
if(tmp.len() > 900) if (tmp.len() > 900)
{ {
TString err; TString err;
err << "Il documento " << rdoc.doc().anno() << " " << rdoc.doc().codice_numerazione().codice() << " " << rdoc.doc().numero() << " ha la riga numero " << rdoc.numero() << " più lunga di quanto supportato dal formato dell'agenzia delle entrate, verrà troncata a 900 caratteri"; err << "Il documento " << rdoc.doc().anno() << " " << rdoc.doc().codice_numerazione().codice() << " " << rdoc.doc().numero() << " ha la riga numero " << rdoc.numero() << " pi lunga di quanto supportato dal formato dell'agenzia delle entrate, verr troncata a 900 caratteri";
log(1, err); log(1, err);
} }
return tmp.left(900); return tmp.left(900);
@ -894,7 +894,7 @@ int TDoc_fp::find_ancestors(const TRiga_documento& rdoc, TArray& ancestors) cons
bool TDoc_fp::insert(TPaf_record& p) bool TDoc_fp::insert(TPaf_record& p)
{ {
bool ok; bool ok;
if(_cache_insert) if (_cache_insert)
{ {
_query.push_back(p.insert_string()); _query.push_back(p.insert_string());
ok = true; ok = true;
@ -966,7 +966,7 @@ bool TDoc_fp::check_initial(TDocumentoEsteso& doc)
} }
TPagamento& pag = doc.pagamento(); TPagamento& pag = doc.pagamento();
if(pag.cond_pag_sdi().empty()) if (pag.cond_pag_sdi().empty())
{ {
msg.cut(0) << "Non e' valorizzata la condizione di pagamento SDI (TP01, TP02, TP03) per la condizione di pagamento " << pag.code(); msg.cut(0) << "Non e' valorizzata la condizione di pagamento SDI (TP01, TP02, TP03) per la condizione di pagamento " << pag.code();
log(1, msg); log(1, msg);
@ -978,7 +978,7 @@ bool TDoc_fp::check_initial(TDocumentoEsteso& doc)
{ {
const int rp = nr < pag.n_rate() ? nr : 0; const int rp = nr < pag.n_rate() ? nr : 0;
static TString key_class; key_class.cut(0) << pag.tipo_rata(rp) << pag.ulc_rata(rp); static TString key_class; key_class.cut(0) << pag.tipo_rata(rp) << pag.ulc_rata(rp);
if(cache().get("%CLR", key_class, "S12").empty()) if (cache().get("%CLR", key_class, "S12").empty())
{ {
msg.cut(0) << "Non e' valorizzata la tipologia di pagamento SDI (MPXX) per la condizione di pagamento " << pag.code(); msg.cut(0) << "Non e' valorizzata la tipologia di pagamento SDI (MPXX) per la condizione di pagamento " << pag.code();
log(1, msg); log(1, msg);
@ -991,10 +991,10 @@ bool TDoc_fp::check_row(const TRiga_documento& rdoc)
{ {
bool ok = false; bool ok = false;
static TString msg; static TString msg;
if(rdoc.is_spese()) if (rdoc.is_spese())
{ {
const TSpesa_prest& spesa = rdoc.spesa(); const TSpesa_prest& spesa = rdoc.spesa();
if(spesa.is_percentuale() && spesa.perc().is_zero()) if (spesa.is_percentuale() && spesa.perc().is_zero())
{ {
msg.cut(0) << "E' corretto che per la spesa " << spesa.codice() << " la percentuale sia zero?"; msg.cut(0) << "E' corretto che per la spesa " << spesa.codice() << " la percentuale sia zero?";
log(1, msg); log(1, msg);
@ -1013,7 +1013,7 @@ bool TDoc_fp::check_riepilogo(const TDocumentoEsteso& doc, const TRiepilogo_iva&
{ {
bool ok = true; bool ok = true;
static TString msg; static TString msg;
if(*get_esigibilita_iva(doc) == 'S' && natura(riva.cod_iva().codice()) == "N6") if (*get_esigibilita_iva(doc) == 'S' && natura(riva.cod_iva().codice()) == "N6")
{ {
msg.cut(0) << "Impossibile avere un documento con scissione dei pagamenti e natura iva N6, codice: " << riva.cod_iva().codice(); msg.cut(0) << "Impossibile avere un documento con scissione dei pagamenti e natura iva N6, codice: " << riva.cod_iva().codice();
log(1, msg); log(1, msg);
@ -1039,7 +1039,7 @@ bool TDoc_fp::initialize(TDocumentoEsteso& doc)
return false; return false;
// Preparo il log // Preparo il log
log(-1, _bfatt); log(-1, _bfatt);
// Controllo se il documento è almeno in stato di stampa // Controllo se il documento almeno in stato di stampa
if (doc.stato() < doc.tipo().stato_finale_stampa()) if (doc.stato() < doc.tipo().stato_finale_stampa())
{ {
log(3, "Il documento non e' stato ancora stampato, verra' saltato"); log(3, "Il documento non e' stato ancora stampato, verra' saltato");
@ -1067,7 +1067,7 @@ bool TDoc_fp::initialize(TDocumentoEsteso& doc)
_idx_cassa_previdenziale = 1; _idx_cassa_previdenziale = 1;
// Controllo custom // Controllo custom
_has_cust = cached_custom_fp().has_custom(doc); _has_cust = cached_custom_fp().has_custom(doc);
if(check_initial(doc) || get_check_not_block()) if (check_initial(doc) || get_check_not_block())
{ {
return _paf_container.clean_and_erase_paf(_hfatt, _bfatt); return _paf_container.clean_and_erase_paf(_hfatt, _bfatt);
} }
@ -1085,15 +1085,15 @@ const TRectype& TDoc_fp::cco(const TRectype& doc) const
} }
static TLocalisamfile tabmod(LF_TABMOD); static TLocalisamfile tabmod(LF_TABMOD);
// Controllo se non sono già sul record, così evito read inutili // Controllo se non sono gi sul record, cos evito read inutili
// Lo sto facendo a mano perchè usare cache() metterebbe FP nella colonna "MOD" // Lo sto facendo a mano perch usare cache() metterebbe FP nella colonna "MOD"
if (tabmod.get("MOD") != "PA" || tabmod.get("COD") != "CON" || tabmod.get("CODTAB") != conkey) if (tabmod.get("MOD") != "PA" || tabmod.get("COD") != "CON" || tabmod.get("CODTAB") != conkey)
{ {
tabmod.zero(); tabmod.zero();
tabmod.put("MOD", "PA"); tabmod.put("MOD", "PA");
tabmod.put("COD", "CON"); tabmod.put("COD", "CON");
tabmod.put("CODTAB", conkey); tabmod.put("CODTAB", conkey);
if(tabmod.read() != NOERR) if (tabmod.read() != NOERR)
tabmod.zero(); tabmod.zero();
} }
return tabmod.curr(); return tabmod.curr();
@ -1123,7 +1123,7 @@ void TDoc_fp::log(int severity, const char* msg)
_log->log(severity, txt); _log->log(severity, txt);
// Scrivo anche su file // Scrivo anche su file
std::filebuf fb; std::filebuf fb;
fb.open("fp_err.log", std::ios::out|std::ios::app); fb.open("fp_err.log", std::ios::out | std::ios::app);
std::ostream os(&fb); std::ostream os(&fb);
os << txt << std::endl; os << txt << std::endl;
fb.close(); fb.close();
@ -1162,7 +1162,7 @@ int TDoc_fp::commit()
{ {
log(2, "Le fatture sono state esportate in stato diagnosticato"); log(2, "Le fatture sono state esportate in stato diagnosticato");
} }
if(r >= 0 && fp_db().sq_commit()) if (r >= 0 && fp_db().sq_commit())
{ {
r += 2; r += 2;
} }
@ -1193,7 +1193,7 @@ const TString & TDoc_fp::natura(const char* codiva) const
} }
const char* TDoc_fp::get_esigibilita_iva(const TDocumentoEsteso& doc) const char* TDoc_fp::get_esigibilita_iva(const TDocumentoEsteso& doc)
{ {
// Esigibilità IVA: Immediata, Differita, Split payment // Esigibilit IVA: Immediata, Differita, Split payment
const char* eiva = "I"; const char* eiva = "I";
if (doc.is_split_payment()) if (doc.is_split_payment())
eiva = "S"; eiva = "S";
@ -1205,7 +1205,7 @@ void TDoc_fp::set_IVA(TString codiva, TPaf_record& paf) const
{ {
if (codiva.empty()) if (codiva.empty())
codiva = _codivadefault; codiva = _codivadefault;
// É necessario il cast a real? // necessario il cast a real?
paf.set("PI_ALIQUOTAIVA", static_cast<real>(cache().get("%IVA", codiva, "R0"))); paf.set("PI_ALIQUOTAIVA", static_cast<real>(cache().get("%IVA", codiva, "R0")));
paf.set("PI_NATURA", natura(codiva)); paf.set("PI_NATURA", natura(codiva));
} }
@ -1258,16 +1258,16 @@ const TString& TDoc_fp::converti_prezzo(const real& prezzo) const
} }
void TDoc_fp::set_qta_prezzo(TPaf_record& paf1800f, TFPRiga_documento* rdoc) const void TDoc_fp::set_qta_prezzo(TPaf_record& paf1800f, TFPRiga_documento* rdoc) const
{ {
// Setto l'unità di misura // Setto l'unit di misura
paf1800f.set("PI_UNITAMISURA", rdoc->get(RDOC_UMQTA)); paf1800f.set("PI_UNITAMISURA", rdoc->get(RDOC_UMQTA));
const real qta = rdoc->quantita(); const real qta = rdoc->quantita();
// Prendendo la stringa non ho problemi in scrittura della query, a volte accadono cose stupide // Prendendo la stringa non ho problemi in scrittura della query, a volte accadono cose stupide
TString& qta_string = rdoc->quantita_string(); TString& qta_string = rdoc->quantita_string();
real prezzo_unit = rdoc->prezzo(_nascondi_sconti_righe_fatt, false); real prezzo_unit = rdoc->prezzo(_nascondi_sconti_righe_fatt, false);
real prezzo_tot = rdoc->imponibile(false); real prezzo_tot = rdoc->imponibile(false);
if(qta < ZERO) if (qta < ZERO)
{ {
// Metto la qualità senza il segno // Metto la qualit senza il segno
qta_string = qta_string.mid(1); qta_string = qta_string.mid(1);
// E i prezzi in negativo // E i prezzi in negativo
prezzo_unit = -abs(prezzo_unit); prezzo_unit = -abs(prezzo_unit);
@ -1338,7 +1338,7 @@ bool TDoc_fp::add_riepilogo_iva(TPaf_record& paf2200f, const TCodiceIVA& cod_iva
paf2200f.set("PL_IMPONIBILE", converti_prezzo(imponibile + riepilogo_agg.imponibile)); paf2200f.set("PL_IMPONIBILE", converti_prezzo(imponibile + riepilogo_agg.imponibile));
// Imposta // Imposta
paf2200f.set("PL_IMPOSTA", converti_prezzo(imposta + riepilogo_agg.imposta)); paf2200f.set("PL_IMPOSTA", converti_prezzo(imposta + riepilogo_agg.imposta));
// Esigibilità IVA // Esigibilit IVA
paf2200f.set("PL_ESIGIVA", eiva); paf2200f.set("PL_ESIGIVA", eiva);
if (*eiva == 'S') if (*eiva == 'S')
paf2200f.set("PL_RIFNORMATIVO", "Scissione pagamenti art.17-ter DPR 633/72"); paf2200f.set("PL_RIFNORMATIVO", "Scissione pagamenti art.17-ter DPR 633/72");
@ -1369,7 +1369,7 @@ bool TDoc_fp::add_cassa_previdenziale(TRiga_documento& rdoc)
paf0800f.set("P8_IMPONCASSA", converti_prezzo(imponibile_doc)); paf0800f.set("P8_IMPONCASSA", converti_prezzo(imponibile_doc));
// Aliquota applicata alla riga spesa // Aliquota applicata alla riga spesa
paf0800f.set("P8_ALIQIVA", rdoc.iva().percentuale()); paf0800f.set("P8_ALIQIVA", rdoc.iva().percentuale());
if(sp.sogg_a_rit()) if (sp.sogg_a_rit())
paf0800f.set("P8_RITENUTA", "SI"); paf0800f.set("P8_RITENUTA", "SI");
paf0800f.set("P8_NATURA", natura(rdoc.iva().codice())); paf0800f.set("P8_NATURA", natura(rdoc.iva().codice()));
// Inserisco il tutto nei dati riepilogo // Inserisco il tutto nei dati riepilogo
@ -1385,7 +1385,7 @@ bool TDoc_fp::export_info_articolo(TFPRiga_documento* rdoc, TPaf_record& paf1900
const TString& codartmag = rdoc->get(RDOC_CODARTMAG); const TString& codartmag = rdoc->get(RDOC_CODARTMAG);
const TString& codart = rdoc->get(RDOC_CODART); const TString& codart = rdoc->get(RDOC_CODART);
long riga_art = 0; long riga_art = 0;
if(_has_cust) if (_has_cust)
{ {
cached_custom_fp().get_custom(rdoc->doc()).load_articolo_paf(paf1900f, *rdoc, riga_xml, *this); cached_custom_fp().get_custom(rdoc->doc()).load_articolo_paf(paf1900f, *rdoc, riga_xml, *this);
} }
@ -1399,7 +1399,7 @@ bool TDoc_fp::export_info_articolo(TFPRiga_documento* rdoc, TPaf_record& paf1900
paf1900f.set("PY_KEYNLINEA", riga_xml); paf1900f.set("PY_KEYNLINEA", riga_xml);
ok &= add_row_art(riga_art, "Codice articolo interno", codartmag, paf1900f); ok &= add_row_art(riga_art, "Codice articolo interno", codartmag, paf1900f);
} }
// Se il codice articolo del magazzino è diverso quello è del cliente // Se il codice articolo del magazzino diverso quello del cliente
if (codart.full() && codart != codartmag) if (codart.full() && codart != codartmag)
{ {
reset(paf1900f); reset(paf1900f);
@ -1580,7 +1580,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
indsp.put(IND_CODIND, doc.get(DOC_CODINDSP)); indsp.put(IND_CODIND, doc.get(DOC_CODINDSP));
indsp.read(); indsp.read();
rifamm = indsp.get(IND_PARIFAMM); rifamm = indsp.get(IND_PARIFAMM);
if(rifamm.blank()) if (rifamm.blank())
rifamm = doc.clifor().vendite().get(CFV_PARIFAMM); rifamm = doc.clifor().vendite().get(CFV_PARIFAMM);
} }
paf0200f.set("P2_RIFAMMINISTR", rifamm); paf0200f.set("P2_RIFAMMINISTR", rifamm);
@ -1624,7 +1624,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
fisc = cliente.codice_fiscale(); fisc = cliente.codice_fiscale();
if (!stato.full()) if (!stato.full())
stato = "IT"; stato = "IT";
if(tab_codiso.get_bool("B0") || stato == "IT") // Cliente EU if (tab_codiso.get_bool("B0") || stato == "IT") // Cliente EU
{ {
if (piva.full()) if (piva.full())
{ {
@ -1642,7 +1642,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf0400f.set("P4_FISCIVAPAESE", stato); paf0400f.set("P4_FISCIVAPAESE", stato);
paf0400f.set("P4_FISCIVACOD", piva); paf0400f.set("P4_FISCIVACOD", piva);
} }
if(fisc.full()) if (fisc.full())
paf0400f.set("P4_CODFISC", fisc); paf0400f.set("P4_CODFISC", fisc);
} }
else // Cliente EXTRA-EU sempre nel campo della partita iva sui paf else // Cliente EXTRA-EU sempre nel campo della partita iva sui paf
@ -1679,7 +1679,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf0400f.set("P4_SEDEPROV", cliente.provincia_residenza()); paf0400f.set("P4_SEDEPROV", cliente.provincia_residenza());
} }
// Titolo onorifico! // Titolo onorifico!
if(_rec_clifo.vendite().get(CFV_TITOLO).full()) if (_rec_clifo.vendite().get(CFV_TITOLO).full())
{ {
paf0400f.set("P4_ANATITOLO", cache().get("TIT", _rec_clifo.vendite().get(CFV_TITOLO), "S0")); paf0400f.set("P4_ANATITOLO", cache().get("TIT", _rec_clifo.vendite().get(CFV_TITOLO), "S0"));
} }
@ -1705,17 +1705,17 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
// <DatiCassaPrevidenziale> // <DatiCassaPrevidenziale>
// Non la mettiamo! // Non la mettiamo!
// </DatiCassaPrevidenziale> // </DatiCassaPrevidenziale>
// Non inserisco più adesso il paf0700f ma lo faccio alla fine (per inserire le ritenute) // Non inserisco pi adesso il paf0700f ma lo faccio alla fine (per inserire le ritenute)
/* /*
* Lo sconto in testata è stato disabilitato in quanto su Campo influenza solo le righe merci mentre dovrebbe modificare tutte le righe * Lo sconto in testata stato disabilitato in quanto su Campo influenza solo le righe merci mentre dovrebbe modificare tutte le righe
*/ */
// <DatiGenerali> // <DatiGenerali>
TPaf_record& paf2700f = _paf_container.get_paf("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. // 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. // Campo calcola prima il totale, poi lo sconta e ci applica il bollo mentre lo SDI sconta a bollo gi applicato.
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);
if(_has_cust) if (_has_cust)
{ {
TPaf_record& paf3400f = _paf_container.get_paf("PAF3400F"); TPaf_record& paf3400f = _paf_container.get_paf("PAF3400F");
reset(paf3400f); reset(paf3400f);
@ -1739,7 +1739,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf2700f.set("PQ_GESTIONE", "D"); paf2700f.set("PQ_GESTIONE", "D");
ok &= insert(paf2700f); ok &= insert(paf2700f);
// <DatiOrdineAcquisto> // <DatiOrdineAcquisto>
if((doc.is_nota_credito() || get_send_all_rifs()) && doc.get(DOC_NUMDOCRIF).full()) if ((doc.is_nota_credito() || get_send_all_rifs()) && doc.get(DOC_NUMDOCRIF).full())
{ {
TPaf_record& paf1400f = _paf_container.get_paf("PAF1400F"); TPaf_record& paf1400f = _paf_container.get_paf("PAF1400F");
reset(paf1400f); reset(paf1400f);
@ -1757,8 +1757,8 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
// Codice commessa, spostato nel campo S5 di TABCOM // Codice commessa, spostato nel campo S5 di TABCOM
TString80 com = cco(doc).get("S5"); TString80 com = cco(doc).get("S5");
// Se è una commessa della sanità bisogna aggiungere un cancelletto davanti e dietro // Se una commessa della sanit bisogna aggiungere un cancelletto davanti e dietro
if(cco(doc).get_bool("B0")) if (cco(doc).get_bool("B0"))
{ {
com.add_front_and_back("#"); com.add_front_and_back("#");
} }
@ -1919,7 +1919,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
ok &= export_info_articolo(rdoc, paf1900f, paf2100f, riga, r); ok &= export_info_articolo(rdoc, paf1900f, paf2100f, riga, r);
} }
// </CodiceArticolo> // </CodiceArticolo>
if(rdoc->is_descrizione()) if (rdoc->is_descrizione())
{ {
paf1800f.set("PI_QUANTITA", UNO); paf1800f.set("PI_QUANTITA", UNO);
paf1800f.set("PI_PREZZOUNIT", ZERO); paf1800f.set("PI_PREZZOUNIT", ZERO);
@ -1931,11 +1931,11 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (rdoc->get(RDOC_QTA).is_zero()) if (rdoc->get(RDOC_QTA).is_zero())
{ {
TString msg; TString msg;
msg.format("La riga merce %d ha quantità nulla", riga); msg.format("La riga merce %d ha quantit nulla", riga);
log(1, msg); log(1, msg);
} }
set_qta_prezzo(paf1800f, rdoc); set_qta_prezzo(paf1800f, rdoc);
if(rdoc->iva().codice().empty()) if (rdoc->iva().codice().empty())
{ {
set_IVA(_codivadefault, paf1800f); set_IVA(_codivadefault, paf1800f);
} }
@ -1948,7 +1948,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
*/ */
/* /*
* Ogni riga si può rifare a un DDT/Ordine diverso, per questo devo inserire i dati da qua e non in testata * Ogni riga si pu rifare a un DDT/Ordine diverso, per questo devo inserire i dati da qua e non in testata
*/ */
if (!riftesta) if (!riftesta)
{ {
@ -2012,7 +2012,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (qta.is_zero()) if (qta.is_zero())
{ {
TString msg; TString msg;
msg.format("La riga spese a quantità %d ha quantità nulla (campo %s)", riga, static_cast<const char*>(rdoc->field_qta())); msg.format("La riga spese a quantit %d ha quantit nulla (campo %s)", riga, static_cast<const char*>(rdoc->field_qta()));
log(1, msg); log(1, msg);
qta = UNO; qta = UNO;
} }
@ -2036,7 +2036,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf1800f.set("PI_PREZZOUNIT", converti_prezzo(qta_inverse ? -abs(prz) : abs(prz))); paf1800f.set("PI_PREZZOUNIT", converti_prezzo(qta_inverse ? -abs(prz) : abs(prz)));
paf1800f.set("PI_PRZTOTALE", converti_prezzo(imp)); paf1800f.set("PI_PRZTOTALE", converti_prezzo(imp));
set_IVA(*rdoc, paf1800f); set_IVA(*rdoc, paf1800f);
// Controllo se è una ritenuta fiscale // Controllo se una ritenuta fiscale
if (sp.tipo_ritenuta() == 'F') if (sp.tipo_ritenuta() == 'F')
{ {
paf1800f.set("PI_RITENUTA", "SI"); paf1800f.set("PI_RITENUTA", "SI");
@ -2056,7 +2056,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
else if (rdoc->is_sconto() || rdoc->is_sconto_perc()) else if (rdoc->is_sconto() || rdoc->is_sconto_perc())
{ {
TString msg; TString msg;
msg << "Il documento " << doc.codice_numerazione().codice() << " " << doc.tipo().codice() << " " << doc.numero() << " presenta una o più righe di tipo sconto o sconto percentuale.\n" \ msg << "Il documento " << doc.codice_numerazione().codice() << " " << doc.tipo().codice() << " " << doc.numero() << " presenta una o pi righe di tipo sconto o sconto percentuale.\n" \
"Esportazione impossibile"; "Esportazione impossibile";
log(2, msg); log(2, msg);
return false; return false;
@ -2066,7 +2066,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (rdoc->get(RDOC_QTA).is_zero()) if (rdoc->get(RDOC_QTA).is_zero())
{ {
TString msg; TString msg;
msg.format("La riga omaggi %d ha quantità nulla", riga); msg.format("La riga omaggi %d ha quantit nulla", riga);
log(1, msg); log(1, msg);
} }
paf1800f.set("PI_TIPOCESSPREST", "AB"); paf1800f.set("PI_TIPOCESSPREST", "AB");
@ -2086,7 +2086,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf1800f.set("PI_PRZTOTALE", converti_prezzo(rdoc->prezzo(false, false) * rdoc->get_real(RDOC_QTA))); paf1800f.set("PI_PRZTOTALE", converti_prezzo(rdoc->prezzo(false, false) * rdoc->get_real(RDOC_QTA)));
TRiepilogo_agg& riepilogo_agg = _riepilogo_agg[rdoc->iva().codice()]; TRiepilogo_agg& riepilogo_agg = _riepilogo_agg[rdoc->iva().codice()];
riepilogo_agg.imponibile += rdoc->imponibile_omaggio(2); riepilogo_agg.imponibile += rdoc->imponibile_omaggio(2);
// Non metto l'imposta, è già presente nei totali // Non metto l'imposta, gi presente nei totali
//riepilogo_agg.imposta += rdoc->iva_omaggio(8, 2); //riepilogo_agg.imposta += rdoc->iva_omaggio(8, 2);
} }
else else
@ -2139,7 +2139,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
// </ScontoMaggiorazione> // </ScontoMaggiorazione>
if (!skip_riga) if (!skip_riga)
{ {
if(_has_cust) if (_has_cust)
{ {
cached_custom_fp().get_custom(doc).load_adg_paf(paf2100f, *rdoc, *this, riga); cached_custom_fp().get_custom(doc).load_adg_paf(paf2100f, *rdoc, *this, riga);
} }
@ -2183,7 +2183,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (doc.is_fattura() && !doc.is_nota_credito()) if (doc.is_fattura() && !doc.is_nota_credito())
{ {
doc.set_riga_esenzione(); doc.set_riga_esenzione();
if(doc.ha_riga_esenzione()) if (doc.ha_riga_esenzione())
{ {
const TRiga_documento& riga_es = doc.get_riga_esenzione(); const TRiga_documento& riga_es = doc.get_riga_esenzione();
reset(paf1800f); reset(paf1800f);
@ -2227,7 +2227,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
} }
// Se il bollo va fatto pagare bisogna aggiungere una riga! // Se il bollo va fatto pagare bisogna aggiungere una riga!
const real importo_bolli = doc.get_real(DOC_BOLLI); const real importo_bolli = doc.get_real(DOC_BOLLI);
if(doc.get_bool(DOC_ADDBOLLI) && importo_bolli > ZERO) if (doc.get_bool(DOC_ADDBOLLI) && importo_bolli > ZERO)
{ {
reset(paf1800f); reset(paf1800f);
paf1800f.set("PI_NUMEROLINEA", riga); paf1800f.set("PI_NUMEROLINEA", riga);
@ -2244,7 +2244,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
// OMAGGI???? // OMAGGI????
// Aggiungo le spese incasso // Aggiungo le spese incasso
if(doc.get_real("SPESINC") > ZERO) if (doc.get_real("SPESINC") > ZERO)
{ {
reset(paf1800f); reset(paf1800f);
paf1800f.set("PI_NUMEROLINEA", riga); paf1800f.set("PI_NUMEROLINEA", riga);
@ -2262,7 +2262,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
} }
// Conai assolto // Conai assolto
if(doc.clifor().vendite().get_bool("CONAIASS")) if (doc.clifor().vendite().get_bool("CONAIASS"))
{ {
reset(paf1800f); reset(paf1800f);
paf1800f.set("PI_NUMEROLINEA", riga); paf1800f.set("PI_NUMEROLINEA", riga);
@ -2277,8 +2277,8 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
riga++; riga++;
} }
// Riga sconto di testata // Riga sconto di testata
// Se è presente uno sconto in testata devo sottrarlo come riga sconto o lo SDI urla // Se presente uno sconto in testata devo sottrarlo come riga sconto o lo SDI urla
if(doc.get(DOC_SCONTOPERC).full() && doc.get(DOC_SCONTOPERC) != "0") if (doc.get(DOC_SCONTOPERC).full() && doc.get(DOC_SCONTOPERC) != "0")
{ {
TAssoc_array& tiva = doc.tabella_iva(false); TAssoc_array& tiva = doc.tabella_iva(false);
FOR_EACH_ASSOC_OBJECT(tiva, obj, key, itm) FOR_EACH_ASSOC_OBJECT(tiva, obj, key, itm)
@ -2290,7 +2290,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf3000f.set("PT_RIFNUMLINEA", riga); paf3000f.set("PT_RIFNUMLINEA", riga);
paf1800f.set("PI_TIPOCESSPREST", "AB"); paf1800f.set("PI_TIPOCESSPREST", "AB");
TString msg = "Riga sconto merci in testata "; TString msg = "Riga sconto merci in testata ";
if(riva.cod_iva().percentuale() > ZERO) if (riva.cod_iva().percentuale() > ZERO)
msg << riva.cod_iva().percentuale() << "%"; msg << riva.cod_iva().percentuale() << "%";
else else
msg << riva.cod_iva().codice(); msg << riva.cod_iva().codice();
@ -2304,7 +2304,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
} }
} }
const TString& nota_piede_fatt = _riga_npf.get_nota_piede(doc.tipo().codice()); const TString& nota_piede_fatt = _riga_npf.get_nota_piede(doc.tipo().codice());
if(nota_piede_fatt.full()) if (nota_piede_fatt.full())
{ {
reset(paf1800f); reset(paf1800f);
paf1800f.set("PI_NUMEROLINEA", riga); paf1800f.set("PI_NUMEROLINEA", riga);
@ -2320,7 +2320,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
} }
// Se dopo tutto ha ancora delle righe di altri dati gestionali che vanno messi a parte // Se dopo tutto ha ancora delle righe di altri dati gestionali che vanno messi a parte
if(_has_cust && cached_custom_fp().get_custom(doc).has_adg_split()) if (_has_cust && cached_custom_fp().get_custom(doc).has_adg_split())
{ {
reset(paf1800f); reset(paf1800f);
paf1800f.set("PI_NUMEROLINEA", riga); paf1800f.set("PI_NUMEROLINEA", riga);
@ -2336,7 +2336,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
_idx_adg_doc_row = 1L; _idx_adg_doc_row = 1L;
ok &= cached_custom_fp().get_custom(doc).load_adg_paf(paf2100f, doc[1], *this, riga, true); ok &= cached_custom_fp().get_custom(doc).load_adg_paf(paf2100f, doc[1], *this, riga, true);
if(_idx_adg_doc_row > 1L) if (_idx_adg_doc_row > 1L)
ok &= insert(paf1800f) && insert(paf3000f); ok &= insert(paf1800f) && insert(paf3000f);
riga++; riga++;
@ -2344,7 +2344,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
// </DatiBeniServizi> // </DatiBeniServizi>
// <DatiDDT> // <DatiDDT>
// Metto qua i dati DDT per capire se la fattura è accompagnatoria o deriva da bolla // Metto qua i dati DDT per capire se la fattura accompagnatoria o deriva da bolla
TPaf_record& paf1700f = _paf_container.get_paf("PAF1700F"); TPaf_record& paf1700f = _paf_container.get_paf("PAF1700F");
if (doc.get("CODVETT1").full() && !_has_bolla) if (doc.get("CODVETT1").full() && !_has_bolla)
{ {
@ -2355,7 +2355,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (piva.empty() && codfisc.empty()) if (piva.empty() && codfisc.empty())
{ {
TString msg = "Il vettore "; TString msg = "Il vettore ";
msg << vet.get("S0").mid(0, 50) << " non ha nè codice fiscale nè partita IVA, la fattura " << doc.anno() << " " << doc.codice_numerazione().codice() << " " << doc.numero() << " non può essere trasmessa"; msg << vet.get("S0").mid(0, 50) << " non ha n codice fiscale n partita IVA, la fattura " << doc.anno() << " " << doc.codice_numerazione().codice() << " " << doc.numero() << " non pu essere trasmessa";
log(3, msg); log(3, msg);
} }
if (piva.full()) if (piva.full())
@ -2382,16 +2382,16 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
const char* eiva = get_esigibilita_iva(doc); const char* eiva = get_esigibilita_iva(doc);
long num_riep = 0; long num_riep = 0;
TAssoc_array& tiva = doc.tabella_iva(false); TAssoc_array& tiva = doc.tabella_iva(false);
for(TObject* itm = tiva.first_item(); itm != nullptr; itm = tiva.succ_item()) for (TObject* itm = tiva.first_item(); itm != nullptr; itm = tiva.succ_item())
{ {
const TRiepilogo_iva& riva = *dynamic_cast<const TRiepilogo_iva*>(itm); const TRiepilogo_iva& riva = *dynamic_cast<const TRiepilogo_iva*>(itm);
if (!check_riepilogo(doc, riva) && !get_check_not_block()) if (!check_riepilogo(doc, riva) && !get_check_not_block())
return false; return false;
add_riepilogo_iva(paf2200f, riva.cod_iva(), eiva, riva.imponibile(), riva.imposta()); add_riepilogo_iva(paf2200f, riva.cod_iva(), eiva, riva.imponibile(), riva.imposta());
} }
if(!_riepilogo_agg.empty()) if (!_riepilogo_agg.empty())
{ {
for(auto i = _riepilogo_agg.begin(); i != _riepilogo_agg.end(); ++i) for (auto i = _riepilogo_agg.begin(); i != _riepilogo_agg.end(); ++i)
{ {
const TCodiceIVA cod_iva(i->first); const TCodiceIVA cod_iva(i->first);
add_riepilogo_iva(paf2200f, cod_iva, eiva); add_riepilogo_iva(paf2200f, cod_iva, eiva);
@ -2405,7 +2405,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
doc.scadenze_recalc(); // Ricalcola array delle rate doc.scadenze_recalc(); // Ricalcola array delle rate
TString_array& scad = doc.scadenze(); TString_array& scad = doc.scadenze();
const char* rateazione = pag.cond_pag_sdi(); // A rate (TP01) o una soluzione(TP02)? const char* rateazione = pag.cond_pag_sdi(); // A rate (TP01) o una soluzione(TP02)?
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 &= insert(paf2400f); ok &= insert(paf2400f);
@ -2429,7 +2429,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
log(2, TR("Non sono presenti ABI, CAB, IBAN per il pagamento")); log(2, TR("Non sono presenti ABI, CAB, IBAN per il pagamento"));
if ((tipo_pag == 8 || tipo_pag == 9) && iban.blank()) // R.I.D. o Bonifico if ((tipo_pag == 8 || tipo_pag == 9) && iban.blank()) // R.I.D. o Bonifico
{ {
log(1, TR("Non è presente il codice IBAN per il pagamento")); log(1, TR("Non presente il codice IBAN per il pagamento"));
} }
for (int nr = 0; nr < scad.items(); nr++) for (int nr = 0; nr < scad.items(); nr++)
{ {
@ -2455,11 +2455,11 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
{ {
if (!dongle().active(RSAUT)) if (!dongle().active(RSAUT))
{ {
log(1, "Impossibile generare la fattura, il modulo RS non è abilitato!"); log(1, "Impossibile generare la fattura, il modulo RS non abilitato!");
} }
else if (!doc.tipo().main_print_profile(rep, 2)) else if (!doc.tipo().main_print_profile(rep, 2))
{ {
log(1, "Impossibile generare la fattura, non è disponibile un profilo di stampa per questo tipo documento!"); log(1, "Impossibile generare la fattura, non disponibile un profilo di stampa per questo tipo documento!");
} }
else else
{ {
@ -2480,7 +2480,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
{ {
TFilename pdf; pdf.tempdir(); TFilename pdf; pdf.tempdir();
pdf << SLASH << doc.get(DOC_ANNO) << '_' << doc.get(DOC_CODNUM) << '_' << doc.get(DOC_NDOC) << ".pdf"; 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?")) if (!pdf.exist() && !yesno_box("Attenzione! Non stato possibile creare il pdf, continuare?"))
{ {
return false; return false;
} }
@ -2494,7 +2494,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
{ {
if (_def_fld.empty()) if (_def_fld.empty())
{ {
TString msgerr; msgerr << "Errore: il documento " << _bfatt << " ha degli allegati ma nella configurazione non è stato impostato come trametterli\nCaricare il documento senza allegati?"; TString msgerr; msgerr << "Errore: il documento " << _bfatt << " ha degli allegati ma nella configurazione non stato impostato come trametterli\nCaricare il documento senza allegati?";
load_allegati = false; load_allegati = false;
if (!yesno_box(msgerr)) if (!yesno_box(msgerr))
return false; return false;
@ -2581,7 +2581,7 @@ bool TDoc_fp::doc_to_paf()
TRectype& TDoc_fp::key_to_doc(const TDoc_key& key) TRectype& TDoc_fp::key_to_doc(const TDoc_key& key)
{ {
if(_doc_rec != nullptr) if (_doc_rec != nullptr)
delete _doc_rec; delete _doc_rec;
_doc_rec = new TRectype(LF_DOC); _doc_rec = new TRectype(LF_DOC);
_doc_rec->put(DOC_PROVV, key.provv()); _doc_rec->put(DOC_PROVV, key.provv());

View File

@ -1,4 +1,4 @@
#ifndef __ISAM_H +#ifndef __ISAM_H
#define __ISAM_H #define __ISAM_H
#ifndef __CURRENCY_H #ifndef __CURRENCY_H

View File

@ -165,6 +165,7 @@ protected:
public: public:
bool valid_cursor() const { return _cursor != NULL; } bool valid_cursor() const { return _cursor != NULL; }
virtual TCursor* cursor() const; virtual TCursor* cursor() const;
void set_filterfunction(FILTERFUNCTION ff, bool update = false) { cursor()->set_filterfunction(ff, update); }
virtual void freeze(bool on = true) { return cursor()->freeze(on); } virtual void freeze(bool on = true) { return cursor()->freeze(on); }
virtual void unfreeze() { return cursor()->freeze(false); } virtual void unfreeze() { return cursor()->freeze(false); }
virtual bool frozen() const { return cursor()->frozen(); } virtual bool frozen() const { return cursor()->frozen(); }

View File

@ -2920,6 +2920,55 @@ void TReport::mask2report(const TMask & m)
} }
} }
void TReport::reset_export_sections()
{
FOR_EACH_ASSOC_OBJECT(_sections, os, sec_key, sec_item)
{
TReport_section * sect = (TReport_section *)sec_item;
const bool section_shown = _default_shown_sections.is_key(sec_key);
sect->show(section_shown);
}
}
void TReport::set_export_sections(export_type type)
{
switch (type)
{
case _export_printer :
break;
case _export_visualize :
break;
case _export_excel :
{
FOR_EACH_ASSOC_OBJECT(_sections, os, sec_key, sec_item)
{
const TString4 sec_id(sec_key);
TReport_section * sect = (TReport_section *)sec_item;
sect->show(sect->shown() && (sec_id == "H0" || sec_id.starts_with("B")));
}
}
break;
case _export_dbase:
{
FOR_EACH_ASSOC_OBJECT(_sections, os, sec_key, sec_item)
{
const TString4 sec_id(sec_key);
TReport_section * sect = (TReport_section *)sec_item;
sect->show(sect->shown() && sec_id.starts_with("B"));
}
}
break;
case _export_pdf :
break;
case _export_text :
default:
break;
}
}
KEY TReport::run_form(TMask& m) KEY TReport::run_form(TMask& m)
{ {
report2mask(m); report2mask(m);

View File

@ -370,7 +370,6 @@ protected:
virtual int compare(const TSortable& s) const; virtual int compare(const TSortable& s) const;
void copy(const TReport_field& rf); void copy(const TReport_field& rf);
TFieldtypes var_type() const; TFieldtypes var_type() const;
const TString& formatted_text() const;
void get_currency(TCurrency& cur) const; void get_currency(TCurrency& cur) const;
TReport_array_item* get_array_item() const; TReport_array_item* get_array_item() const;
@ -381,6 +380,9 @@ public:
TReport_section& section() const { return *_section; } TReport_section& section() const { return *_section; }
void set_section(TReport_section* sec) { _section = sec; } void set_section(TReport_section* sec) { _section = sec; }
const TString& formatted_text() const;
bool has_font() const { return _font != NULL; } bool has_font() const { return _font != NULL; }
const TReport_font& font() const; const TReport_font& font() const;
const TReport_font& print_font() const; const TReport_font& print_font() const;
@ -535,6 +537,7 @@ public:
// Internal usage only // Internal usage only
typedef void (*FLDMSG_FUNC)(TReport_field& rf, void* jolly); typedef void (*FLDMSG_FUNC)(TReport_field& rf, void* jolly);
typedef enum { _export_printer, _export_visualize, _export_excel, _export_pdf, _export_text, _export_dbase } export_type;
class TReport : public TAlex_virtual_machine class TReport : public TAlex_virtual_machine
{ {
@ -556,6 +559,7 @@ class TReport : public TAlex_virtual_machine
TString_array _allegati; TString_array _allegati;
TReport_field* _curr_field; TReport_field* _curr_field;
bool _page_split, _page_merge; bool _page_split, _page_merge;
TAssoc_array _default_shown_sections;
protected: protected:
virtual const char* class_name() const { return "Report"; } virtual const char* class_name() const { return "Report"; }
@ -590,6 +594,9 @@ public:
bool kill_section(char type, int level); bool kill_section(char type, int level);
int find_max_level(char type) const; int find_max_level(char type) const;
virtual void reset_export_sections();
virtual void set_export_sections(export_type type);
virtual bool on_link(const TReport_link& link); virtual bool on_link(const TReport_link& link);
virtual bool use_mask() { return true;} virtual bool use_mask() { return true;}

View File

@ -1647,6 +1647,9 @@ HIDDEN bool ask_export_filename(TFilename& fname)
bool TBook::export_text(TFilename& fname, bool signature, int size, bool goto_url, bool ask_filename) bool TBook::export_text(TFilename& fname, bool signature, int size, bool goto_url, bool ask_filename)
{ {
TString ext = fname.ext(); ext.lower(); TString ext = fname.ext(); ext.lower();
if (ext.blank())
fname.ext("txt");
if (ext == "pdf") if (ext == "pdf")
return export_pdf(fname, signature, goto_url, ask_filename); return export_pdf(fname, signature, goto_url, ask_filename);
if (ext.starts_with("xls") || ext.starts_with("htm")) if (ext.starts_with("xls") || ext.starts_with("htm"))
@ -1843,10 +1846,101 @@ static void reformat_excel(TString& str)
} }
} }
bool TBook::export_dbase(TFilename& fname, bool signature, TTrec * desc, bool goto_url, bool ask_filename)
{
TFilename temp;
TToken_string line(8192, '\t');
TString ext = fname.ext(); ext.lower();
if (ext.blank())
fname.ext("dbf");
if (desc == nullptr)
{
ifstream ifstream(temp);
int nfields = 0;
while (!ifstream.eof())
{
ifstream.getline(line.get_buffer(), line.size());
if (nfields < line.items())
nfields = line.items();
}
desc = new TTrec;
for (int i = 0; i < nfields; i++)
desc->update_fielddef(i, TToken_string(format("FLD%03d|1|80|0", i)));
desc->update_keydef(0, TToken_string("FLD001|"));
}
if (fname.exist())
{
TFilename f(fname);
f.ext("*");
remove_files(f, false);
}
TExternisamfile dbf(fname, *desc);
temp.temp("exp", "xls");
export_excel(temp, signature);
ifstream ifstream(temp);
while (!ifstream.eof())
{
int i = 0;
ifstream.getline(line.get_buffer(), line.size());
if (line.full())
{
dbf.zero();
FOR_EACH_STR_TOKEN(line, val)
if (*desc->rec().Fd[i].Name != '\0')
switch (desc->rec().Fd[i].TypeF)
{
case _alfafld:
case _charfld:
case _boolfld:
case _memofld:
dbf.put(desc->rec().Fd[i++].Name, val);
break;
case _intfld :
case _longfld :
case _realfld :
case _wordfld :
case _intzerofld :
case _longzerofld :
dbf.put(desc->rec().Fd[i++].Name, real::ita2eng(val));
break;
case _datefld :
dbf.put(desc->rec().Fd[i++].Name, TDate(atoi(val.left(2)), atoi(val.mid(3,2)), 2000 + atoi(val.right(2))));
break;
default :
break;
}
dbf.write();
}
}
remove(temp);
safe_delete(desc);
if (signature && main_app().has_module(FDAUT))
{
char outfile[_MAX_PATH] = "";
if (xvt_sign_file(fname, outfile))
fname = outfile;
}
if (goto_url)
xvt_sys_goto_url(fname, "open");
return true;
}
bool TBook::export_excel(TFilename& fname, bool signature, bool goto_url, bool ask_filename) bool TBook::export_excel(TFilename& fname, bool signature, bool goto_url, bool ask_filename)
{ {
TTabulator tab; TTabulator tab;
TString ext = fname.ext(); ext.lower();
if (ext.blank())
fname.ext("xls");
if (ask_filename && !ask_export_filename(fname)) if (ask_filename && !ask_export_filename(fname))
return false; return false;
@ -2286,6 +2380,10 @@ bool TBook::print(size_t pagefrom, size_t pageto, word copies)
bool TBook::export_pdf(TFilename& filename, bool signature, bool goto_url, bool ask_filename) bool TBook::export_pdf(TFilename& filename, bool signature, bool goto_url, bool ask_filename)
{ {
TString ext = filename.ext(); ext.lower();
if (ext.blank())
filename.ext("pdf");
bool ok = (pages() > 0) && main_app().has_module(RSAUT); // Controllo paranoico dei permessi bool ok = (pages() > 0) && main_app().has_module(RSAUT); // Controllo paranoico dei permessi
if (ok) if (ok)
{ {
@ -2359,6 +2457,11 @@ bool TBook::esporta()
if (ok) if (ok)
xvt_sys_goto_url(fname, "open"); xvt_sys_goto_url(fname, "open");
break; break;
case K_DBF:
ok = export_dbase(fname, signature);
if (ok)
xvt_sys_goto_url(fname, "open");
break;
default: default:
break; break;
} }
@ -2891,7 +2994,7 @@ void TReport_book::add_doc(const TString& name)
TReport* rep = _report; // Salvo variabile globale TReport* rep = _report; // Salvo variabile globale
add(*eminem, true); add(*eminem, _export_printer, true);
_report = rep; // Ripristino variabile globale _report = rep; // Ripristino variabile globale
} }
delete eminem; delete eminem;
@ -2900,11 +3003,12 @@ void TReport_book::add_doc(const TString& name)
TBook::add_doc(name); TBook::add_doc(name);
} }
bool TReport_book::add(TReport& rep, bool progind) bool TReport_book::add(TReport& rep, export_type type, bool progind)
{ {
if (!init(rep)) if (!init(rep))
return false; return false;
_report->set_export_sections(type);
if (!_report->execute_prescript()) if (!_report->execute_prescript())
return false; return false;

View File

@ -97,6 +97,8 @@ public:
virtual bool archive(const char* repname, bool signature); virtual bool archive(const char* repname, bool signature);
virtual bool preview(); virtual bool preview();
// esporta il book in un file dbf il tracciato record passato viene disallocato
virtual bool export_dbase(TFilename& fname, bool signature, TTrec * desc = nullptr, bool goto_url = false, bool ask_filename = false);
virtual bool export_excel(TFilename& fname, bool signature, bool goto_url = false, bool ask_filename = false); virtual bool export_excel(TFilename& fname, bool signature, bool goto_url = false, bool ask_filename = false);
virtual bool export_pdf(TFilename& fname, bool signature, bool goto_url = false, bool ask_filename = false); virtual bool export_pdf(TFilename& fname, bool signature, bool goto_url = false, bool ask_filename = false);
virtual bool export_text(TFilename& fname, bool signature, int size, bool goto_url = false, bool ask_filename = false); virtual bool export_text(TFilename& fname, bool signature, int size, bool goto_url = false, bool ask_filename = false);
@ -134,7 +136,7 @@ protected:
void print_subsections(int father); void print_subsections(int father);
public: public:
bool add(TReport& report, bool progind = true); bool add(TReport& report, export_type type = _export_printer, bool progind = true);
virtual int lpi() const; virtual int lpi() const;
virtual int cpi() const; virtual int cpi() const;

View File

@ -134,7 +134,7 @@ bool check_record(TISAM_recordset* rec, const bool mod_esterometro,
rdoc.put(DOC_NDOC, rec->get("23.DNDOC").as_string()); rdoc.put(DOC_NDOC, rec->get("23.DNDOC").as_string());
// Se riesco a generare la chiave, trovo il record e non ha il flag di gestione in errore o un errore esterno, so che è stato inviato // Se riesco a generare la chiave, trovo il record e non ha il flag di gestione in errore o un errore esterno, so che è stato inviato
const bool is_sent = rdoc.read(doc) == NOERR && chiave_paf(rdoc, hfatt, bfatt) && paf0100f.search(nullptr, hfatt, bfatt) && paf0100f.sq_get("P1_GESTIONE") != "E" && paf0100f.sq_get("P1_ERREST") != "*"; const bool is_sent = rdoc.read(doc) == NOERR && chiave_paf_doc(rdoc, hfatt, bfatt) && paf0100f.search(nullptr, hfatt, bfatt) && paf0100f.sq_get("P1_GESTIONE") != "E" && paf0100f.sq_get("P1_ERREST") != "*";
// Se voglio solo quelli inviati e non è stato inviato o // Se voglio solo quelli inviati e non è stato inviato o
// voglio solo quelli non inviati ed è stato inviato, RUSPA! // voglio solo quelli non inviati ed è stato inviato, RUSPA!