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

@ -363,7 +363,7 @@ const char* get_ini_codcaus()
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);
cfven.put(CFV_TIPOCF, "F");

@ -137,7 +137,7 @@ public:
TFppro& fppro_db();
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();
TString get_datainireg();
TString get_dataendreg();

@ -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));
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 << "';";
fp_db().sq_set_exec(query);

@ -91,7 +91,7 @@ void TPAR_mask::load_all_fields()
for (int i = 0;; i++)
{
TString16 caus = ini_get_string(CONFIG_DITTA, "fp", "CAUSALE", "", i);
if (caus.full())
scaus.set_row_cell(S_COD_CAUS, caus);
else
@ -109,9 +109,9 @@ bool caus_filter(const TRelation* r)
void TPAR_mask::fill()
{
const TDate dal = get(F_DATAINI);
const TDate al = get(F_DATAEND);
TString filter_selected = get(F_REGSEL);
const TDate dal = get(F_DATAINI);
const TDate al = get(F_DATAEND);
TString filter_selected = get(F_REGSEL);
// Record di controllo per eventuali elaborazioni precedenti
TString hfatt, bfatt;
TPaf_record paf0100f("PAF0100F");
@ -124,11 +124,11 @@ void TPAR_mask::fill()
enable(DLG_PRINT, _enable_chiave_fixer && filter_selected.empty());
query << "USE " << LF_MOV << " KEY 3 SELECT (BETWEEN(" << MOV_DATAREG << ","
<< dal.date2ansi() << ',' << al.date2ansi() << "))&&(REG!=\"\")"
<< dal.date2ansi() << ',' << al.date2ansi() << "))&&(REG!=\"\")"
<< "\nFROM " << MOV_TIPO << "=C\nTO " << MOV_TIPO "=C";
TISAM_recordset rec(query);
rec.set_filterfunction(caus_filter);
TProgress_monitor pi(rec.items(), nullptr);
@ -152,14 +152,14 @@ void TPAR_mask::fill()
if (chiave_paf_mov(mov, tipodocsdi, hfatt, bfatt))
{
if (paf0100f.search(nullptr, hfatt, bfatt) && paf0100f.sq_get("P1_GESTIONE") != " " && paf0100f.sq_get("P1_ERRINT") != "*")
{
if (paf0100f.sq_get("P1_GESTIONE") != filter_selected)
continue;
sent = true;
}
else if (filter_selected.not_empty())
continue;
if (paf0100f.search(nullptr, hfatt, bfatt) && paf0100f.sq_get("P1_GESTIONE") != " " && paf0100f.sq_get("P1_ERRINT") != "*")
{
if (paf0100f.sq_get("P1_GESTIONE") != filter_selected)
continue;
sent = true;
}
else if (filter_selected.not_empty())
continue;
}
int r = regs.set_row_cell(S_SELECTED, sent);
@ -170,11 +170,11 @@ void TPAR_mask::fill()
regs.set_row_cell(S_CLIENTE, rec.get_long(MOV_CODCF), r);
regs.set_row_cell(S_RAGSOC, cli.get(CLI_RAGSOC), r);
// non c'è ? TString cod_ind_sped = rec.get(DOC_CODINDSP).as_string();
// non c'è ? TString cod_ind_sped = rec.get(DOC_CODINDSP).as_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
if(rif.empty())
if (rif.empty())
{
// Segno la riga errata
if (first)
@ -198,7 +198,7 @@ void TPAR_mask::fill()
if (numreg > 0)
{
const TRectype& mov = cache().get(LF_MOV, numreg);
split = is_split_payment(mov);
split = is_split_payment(mov);
}
}
regs.set_row_cell(S_SPLITPAY, split, r);
@ -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
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";
legno.log(9000, msg_log);
@ -284,14 +284,14 @@ void TPAR_mask::connect_keys()
// Provo a cercare il documento nel paf07 come un vero uomo
query.cut(0) << "SELECT P7_KEYPRGINVIO, P7_KEYHEADERFATT, P7_KEYBODYFATT FROM PAF0700F WHERE P7_KEYHEADERFATT = '" << campo_hfatt
<< "' AND P7_TIPODOC = '" << tipo_doc_sdi(doc) << "' AND P7_DATA = '" << doc.data().date2ansi() << "' AND P7_NUMERO LIKE '%" << doc.numero() << "%'";
<< "' AND P7_TIPODOC = '" << tipo_doc_sdi(doc) << "' AND P7_DATA = '" << doc.data().date2ansi() << "' AND P7_NUMERO LIKE '%" << doc.numero() << "%'";
if (fp_db().sq_set_exec(query, false))
{
bool found = false;
// Valori nel db
static TString db_prginv, db_hfatt, db_bfatt;
// Posso avere più di un risulatato, per esempio se effettuo la fatturazione di gennaio potrei avere la fattura 1, 10 e 11 del cliente 100.
for (bool ok = fp_db().sq_set_exec(query); ok && !found; ok = fp_db().sq_next())
{
@ -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";
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 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;
legno.log(0, msg_log);
@ -445,42 +445,42 @@ bool TPAR_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
if (e == fe_button && jolly > 0)
{
TSheet_field& regs = sfield(F_REGS);
TToken_string& row = regs.row(regs.selected());
TToken_string& row = regs.row(regs.selected());
// Salvo subito su file le impostazioni di esportazione, in fplib accedo ai file
save_all_fields();
fill();
}
break;
case DLG_ALL:
{
if (e == fe_button)
{
if (e == fe_button)
{
TSheet_field& regs = sfield(F_REGS);
TString_array& sht = regs.rows_array();
const int items = sht.items();
TSheet_field& regs = sfield(F_REGS);
TString_array& sht = regs.rows_array();
const int items = sht.items();
if (items > 0)
{
const TString4 select = *(sht.row(0).get(0)) == 'X' ? "" : "X";
for (int i = 0; i < items; i++)
sht.row(i).add(select, 0);
regs.force_update();
}
if (items > 0)
{
const TString4 select = *(sht.row(0).get(0)) == 'X' ? "" : "X";
for (int i = 0; i < items; i++)
sht.row(i).add(select, 0);
regs.force_update();
}
}
break;
}
break;
case DLG_SAVEREC:
{
{
if (e == fe_button)
set_err_paf();
}
break;
set_err_paf();
}
break;
case DLG_FINDREC:
{
{
if (e == fe_button)
set_pronto();
}
break;
}
break;
case DLG_PRINT:
{
if (e == fe_button)
@ -489,7 +489,7 @@ bool TPAR_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
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)
{
@ -511,7 +511,7 @@ void TPAR_mask::next_page(int p)
_filter_changed = false;
}
}
if(ok)
if (ok)
TAutomask::next_page(p);
}
@ -625,16 +625,16 @@ void TPAR_mask::set_err_paf()
"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
"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);
}
}
else
{
TString err = "Impossibile trovare la fattura "; err << nreg << "\nVerrà saltata.";
TString err = "Impossibile trovare la fattura "; err << nreg << "\nVerrà saltata.";
error_box(err);
}
}
@ -677,8 +677,8 @@ void Treg2Paf::main_loop()
bool Treg2Paf::create()
{
open_files(LF_TAB, LF_TABCOM, LF_TABMOD, LF_ANAG,
LF_CLIFO, LF_CFVEN, LF_CFBAN, LF_NDITTE,
LF_DOC, LF_RIGHEDOC, LF_CODCORR, LF_ANAMAG, 0);
LF_CLIFO, LF_CFVEN, LF_CFBAN, LF_NDITTE,
LF_DOC, LF_RIGHEDOC, LF_CODCORR, LF_ANAMAG, 0);
const TRectype cfven(LF_CFVEN);
if (cfven.length(CFV_PADESTIN) != 7) // Nuova lunghezza per privati

@ -58,7 +58,7 @@ DATE F_DATAEND
BEGIN
PROMPT 50 1 "Data finale "
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
END
@ -284,4 +284,4 @@ BEGIN
END
ENDPAGE
ENDMASK
ENDMASK

@ -14,14 +14,14 @@
#include <map>
#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 TString MCodice_riga;
typedef TString MTipo_documento;
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);
// Ritorna la connessione al DB paf secondo i parametri impostati nel programma di configurazione
@ -59,9 +59,9 @@ class TPaf_record : public TObject
protected:
void copy(const TPaf_record& rec)
{
_table = rec._table;
_key = rec._key;
_fields = rec._fields;
_table = rec._table;
_key = rec._key;
_fields = rec._fields;
}
const TString& var2str(const TString& fld, const TVariant& var) const;
@ -93,8 +93,8 @@ public:
TPaf_record& operator=(const TPaf_record& rec)
{
copy(rec);
return *this;
copy(rec);
return *this;
}
TPaf_record() { };
TPaf_record(const TPaf_record& rec) { copy(rec); }
@ -283,7 +283,9 @@ public:
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)
{ 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
@ -304,22 +306,22 @@ public:
class TFPBuono_di_consegna
{
public:
TString20 _numdoc;
TDate _datadoc;
TString20 _numdoc;
TDate _datadoc;
bool already_exist(map<TString20, TDate>& ancestors_s) const;
bool already_exist(map<TString20, TDate>& ancestors_s) const;
TFPBuono_di_consegna() { }
TFPBuono_di_consegna(const TString20& numdoc, const TDate& datadoc) : _numdoc(numdoc), _datadoc(datadoc) { }
TFPBuono_di_consegna() { }
TFPBuono_di_consegna(const TString20& numdoc, const TDate& datadoc) : _numdoc(numdoc), _datadoc(datadoc) { }
};
inline bool operator==(const TFPBuono_di_consegna& l, const TFPBuono_di_consegna& r)
{
TToken_string appo(l._numdoc, '/');
if(appo.items() == 3)
return TString(appo.get(2)) == r._numdoc && l._datadoc == r._datadoc;
return l._numdoc == r._numdoc && l._datadoc == r._datadoc;
TToken_string appo(l._numdoc, '/');
if (appo.items() == 3)
return TString(appo.get(2)) == r._numdoc && l._datadoc == r._datadoc;
return l._numdoc == r._numdoc && l._datadoc == r._datadoc;
}
#define FOR_EACH_BUONI(__buoni, __n, __buono) TFPBuono_di_consegna* (buono) = NULL; \
@ -351,15 +353,15 @@ struct TFP_adg
TFP_adg(const TString& tipo_dato, const TString& riferimento_testo, const int riferimento_numero,
const TDate& riferimento_data)
: _tipo_dato(tipo_dato),
_riferimento_testo(riferimento_testo),
_riferimento_numero(riferimento_numero),
_riferimento_data(riferimento_data){}
_riferimento_testo(riferimento_testo),
_riferimento_numero(riferimento_numero),
_riferimento_data(riferimento_data) {}
};
/**<
* Classe per la gestione di personalizzazioni FP
*/
class TFP_custom : public TMultiple_rectype
class TFP_custom : public TMultiple_rectype
{
protected:
TString _codcust;
@ -415,14 +417,14 @@ public:
inline TFP_custom_cache& cached_custom_fp()
{
static std::shared_ptr<TFP_custom_cache> carmelo;
if(carmelo == nullptr)
if (carmelo == nullptr)
{
carmelo.reset(new TFP_custom_cache);
}
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 };
@ -444,9 +446,9 @@ public:
static const TVariant parse_expression(const TString& expr, TDocumento& doc) { return parse_expression(expr, doc[1]); }
static bool check_condition(const TString& cond, TRiga_documento& rdoc);
static bool check_condition(const TString& cond, TDocumento& doc) { return check_condition(cond, doc[1]); }
TFP_expression() {};
virtual ~TFP_expression() {};
TFP_expression() {};
virtual ~TFP_expression() {};
};
// Gestione PAF
@ -504,7 +506,7 @@ private:
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;
real _cambio;
} _doc_cambio;
@ -523,7 +525,7 @@ private:
protected:
/**< 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);
/**< Controllo di riga */
bool check_row(const TRiga_documento& rdoc);
@ -562,7 +564,7 @@ protected:
//void set_rec_clifo(char tipocf, long codcf);
public:
static void fill_buoni(map<TString20, TFPBuono_di_consegna>& buoni, const TString& memo, bool last = false);
static void fill_buoni(map<TString20, TFPBuono_di_consegna>& buoni, const TString& memo, bool last = false);
bool doc_to_paf(TDocumentoEsteso& doc);
bool doc_to_paf(const TRectype& rec);
bool doc_to_paf(const TDoc_key& key);

File diff suppressed because it is too large Load Diff

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

@ -165,6 +165,7 @@ protected:
public:
bool valid_cursor() const { return _cursor != NULL; }
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 unfreeze() { return cursor()->freeze(false); }
virtual bool frozen() const { return cursor()->frozen(); }

@ -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)
{
report2mask(m);

@ -370,7 +370,6 @@ protected:
virtual int compare(const TSortable& s) const;
void copy(const TReport_field& rf);
TFieldtypes var_type() const;
const TString& formatted_text() const;
void get_currency(TCurrency& cur) const;
TReport_array_item* get_array_item() const;
@ -381,6 +380,9 @@ public:
TReport_section& section() const { return *_section; }
void set_section(TReport_section* sec) { _section = sec; }
const TString& formatted_text() const;
bool has_font() const { return _font != NULL; }
const TReport_font& font() const;
const TReport_font& print_font() const;
@ -535,6 +537,7 @@ public:
// Internal usage only
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
{
@ -556,6 +559,7 @@ class TReport : public TAlex_virtual_machine
TString_array _allegati;
TReport_field* _curr_field;
bool _page_split, _page_merge;
TAssoc_array _default_shown_sections;
protected:
virtual const char* class_name() const { return "Report"; }
@ -590,6 +594,9 @@ public:
bool kill_section(char type, int level);
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 use_mask() { return true;}

@ -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)
{
TString ext = fname.ext(); ext.lower();
if (ext.blank())
fname.ext("txt");
if (ext == "pdf")
return export_pdf(fname, signature, goto_url, ask_filename);
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)
{
TTabulator tab;
TString ext = fname.ext(); ext.lower();
if (ext.blank())
fname.ext("xls");
if (ask_filename && !ask_export_filename(fname))
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)
{
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
if (ok)
{
@ -2359,7 +2457,12 @@ bool TBook::esporta()
if (ok)
xvt_sys_goto_url(fname, "open");
break;
default:
case K_DBF:
ok = export_dbase(fname, signature);
if (ok)
xvt_sys_goto_url(fname, "open");
break;
default:
break;
}
return ok;
@ -2891,7 +2994,7 @@ void TReport_book::add_doc(const TString& name)
TReport* rep = _report; // Salvo variabile globale
add(*eminem, true);
add(*eminem, _export_printer, true);
_report = rep; // Ripristino variabile globale
}
delete eminem;
@ -2900,11 +3003,12 @@ void TReport_book::add_doc(const TString& 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))
return false;
_report->set_export_sections(type);
if (!_report->execute_prescript())
return false;

@ -97,6 +97,8 @@ public:
virtual bool archive(const char* repname, bool signature);
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_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);
@ -134,7 +136,7 @@ protected:
void print_subsections(int father);
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 cpi() const;

@ -134,7 +134,7 @@ bool check_record(TISAM_recordset* rec, const bool mod_esterometro,
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
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
// voglio solo quelli non inviati ed è stato inviato, RUSPA!