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);
}
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");

View File

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

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));
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);

View File

@ -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

View File

@ -14,7 +14,7 @@
#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;
@ -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
@ -422,7 +424,7 @@ inline TFP_custom_cache& cached_custom_fp()
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 };
@ -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);

View File

@ -77,7 +77,7 @@ string getline(ifstream& f)
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
*/
SLIST files = xvt_fsys_list_files(".sql", "sql/fp0/", false);
@ -232,7 +232,7 @@ bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString&
{
if (pec.full() || get_esp_pri_empty())
coddest = "0000000";
// Controllo se è straniero
// Controllo se straniero
else if (anag.estero() && anag.stato_partita_IVA() != "IT")
{
coddest = get_esp_est() ? get_esp_est_cod() : "";
@ -842,7 +842,7 @@ const TString& TDoc_fp::descrizione(const TRiga_documento& rdoc)
if (tmp.len() > 900)
{
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);
}
return tmp.left(900);
@ -1039,7 +1039,7 @@ bool TDoc_fp::initialize(TDocumentoEsteso& doc)
return false;
// Preparo il log
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())
{
log(3, "Il documento non e' stato ancora stampato, verra' saltato");
@ -1085,8 +1085,8 @@ const TRectype& TDoc_fp::cco(const TRectype& doc) const
}
static TLocalisamfile tabmod(LF_TABMOD);
// Controllo se non sono già sul record, così evito read inutili
// Lo sto facendo a mano perchè usare cache() metterebbe FP nella colonna "MOD"
// Controllo se non sono gi sul record, cos evito read inutili
// 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)
{
tabmod.zero();
@ -1193,7 +1193,7 @@ const TString & TDoc_fp::natura(const char* codiva) const
}
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";
if (doc.is_split_payment())
eiva = "S";
@ -1205,7 +1205,7 @@ void TDoc_fp::set_IVA(TString codiva, TPaf_record& paf) const
{
if (codiva.empty())
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_NATURA", natura(codiva));
}
@ -1258,7 +1258,7 @@ const TString& TDoc_fp::converti_prezzo(const real& prezzo) 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));
const real qta = rdoc->quantita();
// Prendendo la stringa non ho problemi in scrittura della query, a volte accadono cose stupide
@ -1267,7 +1267,7 @@ void TDoc_fp::set_qta_prezzo(TPaf_record& paf1800f, TFPRiga_documento* rdoc) con
real prezzo_tot = rdoc->imponibile(false);
if (qta < ZERO)
{
// Metto la qualità senza il segno
// Metto la qualit senza il segno
qta_string = qta_string.mid(1);
// E i prezzi in negativo
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));
// Imposta
paf2200f.set("PL_IMPOSTA", converti_prezzo(imposta + riepilogo_agg.imposta));
// Esigibilità IVA
// Esigibilit IVA
paf2200f.set("PL_ESIGIVA", eiva);
if (*eiva == 'S')
paf2200f.set("PL_RIFNORMATIVO", "Scissione pagamenti art.17-ter DPR 633/72");
@ -1399,7 +1399,7 @@ bool TDoc_fp::export_info_articolo(TFPRiga_documento* rdoc, TPaf_record& paf1900
paf1900f.set("PY_KEYNLINEA", riga_xml);
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)
{
reset(paf1900f);
@ -1705,14 +1705,14 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
// <DatiCassaPrevidenziale>
// Non la mettiamo!
// </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>
TPaf_record& paf2700f = _paf_container.get_paf("PAF2700F");
// Disabilitata la scrittura del totale del documento, questo causa problemi se è presente uno sconto in testata e l'addebito del bollo.
// Campo calcola prima il totale, poi lo sconta e ci applica il bollo mentre lo SDI sconta a bollo già applicato.
// 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.
paf2700f.set("PQ_IMPTOTDOC", doc.totale_doc());
const TRectype& cont_conv_off = cco(doc);
if (_has_cust)
@ -1757,7 +1757,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
// Codice commessa, spostato nel campo S5 di TABCOM
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"))
{
com.add_front_and_back("#");
@ -1931,7 +1931,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (rdoc->get(RDOC_QTA).is_zero())
{
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);
}
set_qta_prezzo(paf1800f, rdoc);
@ -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)
{
@ -2012,7 +2012,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (qta.is_zero())
{
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);
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_PRZTOTALE", converti_prezzo(imp));
set_IVA(*rdoc, paf1800f);
// Controllo se è una ritenuta fiscale
// Controllo se una ritenuta fiscale
if (sp.tipo_ritenuta() == 'F')
{
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())
{
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";
log(2, msg);
return false;
@ -2066,7 +2066,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (rdoc->get(RDOC_QTA).is_zero())
{
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);
}
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)));
TRiepilogo_agg& riepilogo_agg = _riepilogo_agg[rdoc->iva().codice()];
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);
}
else
@ -2277,7 +2277,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
riga++;
}
// 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")
{
TAssoc_array& tiva = doc.tabella_iva(false);
@ -2344,7 +2344,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
// </DatiBeniServizi>
// <DatiDDT>
// Metto qua i dati DDT per capire se la fattura è accompagnatoria o deriva da bolla
// Metto qua i dati DDT per capire se la fattura accompagnatoria o deriva da bolla
TPaf_record& paf1700f = _paf_container.get_paf("PAF1700F");
if (doc.get("CODVETT1").full() && !_has_bolla)
{
@ -2355,7 +2355,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if (piva.empty() && codfisc.empty())
{
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);
}
if (piva.full())
@ -2405,7 +2405,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
doc.scadenze_recalc(); // Ricalcola array delle rate
TString_array& scad = doc.scadenze();
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_GESTIONE", "D");
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"));
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++)
{
@ -2455,11 +2455,11 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
{
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))
{
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
{
@ -2480,7 +2480,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
{
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?"))
if (!pdf.exist() && !yesno_box("Attenzione! Non stato possibile creare il pdf, continuare?"))
{
return false;
}
@ -2494,7 +2494,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
{
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;
if (!yesno_box(msgerr))
return false;

View File

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

View File

@ -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(); }

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

View File

@ -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;}

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)
{
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,6 +2457,11 @@ bool TBook::esporta()
if (ok)
xvt_sys_goto_url(fname, "open");
break;
case K_DBF:
ok = export_dbase(fname, signature);
if (ok)
xvt_sys_goto_url(fname, "open");
break;
default:
break;
}
@ -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;

View File

@ -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;

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());
// 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!