Patch level : 12.0 972
Files correlati : f90.exe d181.des f181.dir/.trr f9ProspIntegr.rep masks f90104.sql Commento : - Rimosso controllo vendite in ogni caso. Incompatibilita' con diverse situazioni tra cui note di credito interne che non sono fatture elettroniche. - Rimosso flag check vendite e il suo utilizzo nel codice. - Aggiornamento stato estrazione solo dopo scrittura f9iva. - Migliorata e resa piu' sicura query per iva aggiungendo tipi diversi e controllo lunghezza colonna. - Corretti nomi campi, che venivano invertiti IVA_ANNPROT e IVA_NUMPROT. - Aggiunto controllo in apertura controllo estrazione solo se il pacchetto e' in errore diag. gest. - Spostata in una classe separata la maschera per l'apertura del pacchetto (Apri estr.). - Corretta modifica f9wa rimaneva vuoto il record in alcuni casi. - Aggiunta possibilita' di esclusione movimenti dall'Apri estr. - Aggiunto controllo esistenza categorie documentali, caricamento cat. doc. di default e controllo tipi documento duplicati. - Aggiunta colonna a F9DRT in caso mancasse (Dovuta a creazione da fp). - Aggiunta funzione provvisoria per calcolo somma imponibili e imposte da rmoviva. - Aggiunto filtro datadoc per sheet fatture elettorniche (FPPRO) nel controllo estrazione: precarica automaticamente minimo e massimo secondo i movimenti in errore, e aggiunti i cambi nella finestra di ordinamento per impostare le date a mano. - Modificato messaggio dopo importazione categorie di default. - Modificata maschera impostazione programma gestione file cartacei. - Aggiunto controllo dal flag della configurazione se esportare anche i cartacei. - Movimenti di vendita esportano cartacei prima dalla gestione file importati nel caso se possibile genero io la fattura dal documento.
This commit is contained in:
parent
3376034627
commit
f71a3f8585
@ -3,7 +3,7 @@
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int rt = -1;
|
||||
int rt;
|
||||
const int r = (argc > 1) ? atoi( &argv[1][1] ) : 0;
|
||||
|
||||
switch (r)
|
||||
|
@ -159,7 +159,8 @@ int TEstrai_mask::estrai()
|
||||
{
|
||||
if (!progr->add_status())
|
||||
break;
|
||||
int numreg = recset_get_int(mov, MOV_NUMREG);
|
||||
//int numreg = recset_get_int(mov, MOV_NUMREG);
|
||||
|
||||
|
||||
TToken_string elab_f9(recset_get_string(mov, MOV_ELABF9), ';'); // Stringa del campo elaborazione f9 nel file mov
|
||||
const bool escluso = !(elab_f9.items() == 3 && elab_f9.get(2)[0] != 'X' || elab_f9.empty());
|
||||
@ -394,7 +395,7 @@ void TMonitor_mask::controllo_errori() const
|
||||
void TMonitor_mask::delete_estr_fld(const TString& idestr)
|
||||
{
|
||||
static const TFilename dir = TString() << F9CONF.get_addr_doc() << SLASH << F9CONF.get_ambiente() << SLASH << idestr << SLASH;
|
||||
unsigned long long i = experimental::filesystem::remove_all((const char*)dir);
|
||||
experimental::filesystem::remove_all((const char*)dir);
|
||||
}
|
||||
|
||||
void TMonitor_mask::delete_pack(const bool all) const
|
||||
@ -561,9 +562,6 @@ void TMonitor_mask::open_apri_estr_win()
|
||||
_inclusi_mask = std::make_unique<TApri_estr_msk>();
|
||||
_inclusi_mask->set_from_row_estrazione(*row_estrazione);
|
||||
|
||||
const TString& codsoc = F9CONF.get_ambiente();
|
||||
const char tipodoc = row_estrazione->get(cid2index(F_TIPODOC))[0];
|
||||
|
||||
_inclusi_mask->fill_estr();
|
||||
_inclusi_mask->fill_res ();
|
||||
last_fill_id = id;
|
||||
@ -1194,13 +1192,15 @@ void TApri_estr_msk::set_from_row_estrazione(TToken_string& row_estrazione)
|
||||
set(F_IAL, _dataal = row_estrazione.get(cid2index(F_DATAAL)));
|
||||
}
|
||||
|
||||
TApri_estr_msk::TApri_estr_msk() : TAutomask("f90100d.msk")
|
||||
TApri_estr_msk::TApri_estr_msk() : TAutomask("f90100d.msk"), _provv(true), _tipodoc('A')
|
||||
{
|
||||
field(B_IESCL).disable();
|
||||
field(B_IALLESCL).disable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// TF9_app
|
||||
////////////////////////////////////////////////////////
|
||||
|
@ -631,83 +631,7 @@ void TGestione_doc_cartacei_f9_msk::load_extensions()
|
||||
bool TGestione_doc_cartacei_f9_msk::load_file(const TFilename& file, const TString& numreg, const bool is_annesso,
|
||||
const TString& catannpadre, const TString& catdocann)
|
||||
{
|
||||
TString numreg_old;
|
||||
bool annesso;
|
||||
TF9_doccart f9cart;
|
||||
TLocalisamfile f9docs(LF_F9DOCS);
|
||||
TLocalisamfile f9annessi(LF_F9ANNESSI);
|
||||
if(f9cart.doc_already_exists(file, numreg_old, annesso))
|
||||
{
|
||||
warning_box("Attenzione: esiste gia' un %s con questo nome associato al num. di registrazione %s", annesso ? "annesso" : "documento", (const char*)numreg_old);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!is_annesso)
|
||||
{
|
||||
TFilename doc;
|
||||
if (f9cart.mov2doc(numreg, doc) && !doc.empty())
|
||||
{
|
||||
warning_box("Attenzione: la registrazione num. %s ha gia' un documento associato: %s.\n"
|
||||
"Se si tratta di un annesso inserire le informazioni per la cat. documentale.", (const char*)numreg, (const char*)doc);
|
||||
return false;
|
||||
}
|
||||
|
||||
f9docs.zero();
|
||||
f9docs.put(F9C_FILENAME, file.name());
|
||||
f9docs.put(F9C_NUMREG, numreg);
|
||||
f9docs.put(F9C_LOADDATE, TDate(TODAY));
|
||||
f9docs.put(F9C_USER, user());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Controllo che non sto gia' utilizzando questa categoria di annesso per questa registrazione
|
||||
// Prendo la lista degli annessi per questa registrazione e li controllo in cerca della categoria
|
||||
TF9_doccart doccart;
|
||||
vector<annesso_t> list_annessi;
|
||||
doccart.mov2listann_vect(numreg, list_annessi);
|
||||
bool exist = false;
|
||||
for(auto it = list_annessi.begin(); it != list_annessi.end(); ++it)
|
||||
{
|
||||
if(it->catdocann == catdocann)
|
||||
exist = true;
|
||||
}
|
||||
if(exist)
|
||||
{
|
||||
message_box("Attenzione: la registrazione num. %s ha gia' un annesso associato con questo tipo di annesso.", (const char*)numreg);
|
||||
return false;
|
||||
}
|
||||
f9annessi.zero();
|
||||
f9annessi.put(F9A_NUMREG, numreg);
|
||||
f9annessi.put(F9A_FILENAME, file.name());
|
||||
f9annessi.put(F9A_CATDOCPAD, catannpadre);
|
||||
f9annessi.put(F9A_CATDOCANN, catdocann);
|
||||
f9annessi.put(F9C_LOADDATE, TDate(TODAY));
|
||||
f9annessi.put(F9C_USER, user());
|
||||
}
|
||||
TFilename fdestin = F9CONF.get_addr_cart();
|
||||
const TString filename = file.name();
|
||||
fdestin << filename;
|
||||
const bool ok = CopyFile(file, fdestin, true);
|
||||
if (!ok)
|
||||
{
|
||||
if (fdestin.exist())
|
||||
warning_box("Errore nel copiare il file nella cartella di destinazione.\nEsiste gia' un file con questo nome.");
|
||||
else
|
||||
warning_box("Errore nel copiare il file nella cartella di destinazione. Ritentare.");
|
||||
f9docs.zero();
|
||||
return false;
|
||||
}
|
||||
if (!is_annesso)
|
||||
{
|
||||
f9docs.write();
|
||||
f9docs.rewrite();
|
||||
}
|
||||
else
|
||||
{
|
||||
f9annessi.write();
|
||||
f9annessi.rewrite();
|
||||
}
|
||||
return true;
|
||||
return TF9_doccart::add_cart(file, numreg, is_annesso, catannpadre, catdocann, false);
|
||||
}
|
||||
|
||||
void TGestione_doc_cartacei_f9_msk::open_config_win()
|
||||
|
@ -81,8 +81,9 @@ void TF9_test_app::main_loop()
|
||||
|
||||
CHECK(preload.get_array_rows().items() > 0, "Errore aggiunta o caricamento categorie documentali.");
|
||||
TCategorie_doc::annesso annesso;
|
||||
bool get_ann = preload.get_ann("GENACQ", annesso);
|
||||
TCategorie_doc::classe_doc get_classe_doc_right{ "ACQREV", "Fattura acq. con rev. charge", "FTA", "TD01", "052", "FA" };
|
||||
if (preload.get_ann("GENACQ", annesso))
|
||||
{ }
|
||||
TCategorie_doc::classe_doc get_classe_doc_right{ "ACQREV", "Fattura acq. con rev. charge", "FTA", "TD01", "052", "FA" };
|
||||
std::shared_ptr<TCategorie_doc::classe_doc> get_classe_doc = preload.get_classe_doc("ACQREV");
|
||||
CHECK(get_classe_doc->catdoc == get_classe_doc_right.catdoc &&
|
||||
get_classe_doc->descr == get_classe_doc_right.descr &&
|
||||
|
@ -365,8 +365,10 @@ class TEstrazione : public TObject
|
||||
static void fill_id(TLocalisamfile& clifo, TString& statopaiv, TString& idfisc, TString& paiv, TString& codfis);
|
||||
TipoIVA get_tipoiva() const { return _head.tipo_doc == 'A' ? iva_acquisti : iva_vendite; }
|
||||
static bool is_doc_xml(const TLocalisamfile& mov);
|
||||
static bool is_integr_rev(int numreg, _Out_ TString& numreg_rev_vend);
|
||||
static bool find_movcoll(int numreg, _Out_ TString& numreg_rev_vend);
|
||||
static bool load_annessi(movimento_t& movimento);
|
||||
// Se il movimento e' di vendita e ha i riferimenti al documento generatore provo a stamparlo con ve, e lo inserisco tra i cartacei F9.
|
||||
static bool stampa_documento(const movimento_t& movimento, TFilename& file);
|
||||
|
||||
public:
|
||||
static bool make_prosp_int_revc(int numreg, TCategorie_doc::annesso& annesso);
|
||||
@ -484,6 +486,8 @@ class TF9_doccart
|
||||
TLocalisamfile _tannessi;
|
||||
|
||||
public:
|
||||
static bool add_cart(const TFilename& file, const TString& numreg, bool is_annesso = false,
|
||||
const TString& catannpadre = "", const TString& catdocann = "", bool suppress_errors = true);
|
||||
bool doc_already_exists(const TFilename& file, _Out_ TString& numreg, _Out_ bool& annesso);
|
||||
bool mov2doc(const TString& numreg, _Out_ TFilename& doc);
|
||||
bool mov2listann(const TString& numreg, _Out_ TString_array& list_annessi);
|
||||
|
@ -10,6 +10,9 @@
|
||||
#include "mov.h"
|
||||
#include "../fp/fplib.h"
|
||||
#include "annessif9.h"
|
||||
#include "modaut.h"
|
||||
#include "dongle.h"
|
||||
#include "execp.h"
|
||||
|
||||
#define MODE_SHEETS 0xC
|
||||
|
||||
@ -251,7 +254,7 @@ bool TEstrazione::is_doc_xml(const TLocalisamfile& mov)
|
||||
&& clifo.get(CLI_COMCF) != "B513"; // Campione d'Italia
|
||||
}
|
||||
|
||||
bool TEstrazione::is_integr_rev(const int numreg, _Out_ TString& numreg_rev_vend)
|
||||
bool TEstrazione::find_movcoll(const int numreg, _Out_ TString& numreg_rev_vend)
|
||||
{
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
//TLocalisamfile mov_rev(LF_MOV);
|
||||
@ -300,13 +303,55 @@ bool TEstrazione::load_annessi(movimento_t& movimento)
|
||||
return doccart.mov2listann_vect(numreg, movimento.annessi);
|
||||
}
|
||||
|
||||
bool TEstrazione::stampa_documento(const movimento_t& movimento, TFilename& file)
|
||||
{
|
||||
bool ok = false;
|
||||
// Se il movimento e' di vendita e ha i riferimenti al documento generatore provo a stamparlo con ve, e lo inserisco tra i cartacei F9.
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, movimento.numreg);
|
||||
if (mov.read() == NOERR &&
|
||||
!mov.get(MOV_DPROVV).empty() && !mov.get(MOV_DANNO).empty() && !mov.get(MOV_DCODNUM).empty() && !mov.get(MOV_DNDOC).empty())
|
||||
{
|
||||
const TDocumento doc(mov.get(MOV_DPROVV)[0], mov.get_int(MOV_DANNO), mov.get(MOV_DCODNUM), mov.get_int(MOV_DNDOC));
|
||||
if(doc.ok() && !dongle().active(RSAUT))
|
||||
{
|
||||
// ve1 -2 {CODNUM} {ANNO} {PROVV} {NDOC}(-{ANDOC}) {TIPO_ELABORAZIONE} {TIPO_STAMPA} {NUM_COPIE} {ARCHIVIAZIONE}
|
||||
static TString commandline;
|
||||
commandline.cut(0) << "ve1 -2 " << doc.get(DOC_CODNUM) << ' ' << doc.get(DOC_ANNO)
|
||||
<< ' ' << doc.get(DOC_PROVV) << ' ' << doc.get(DOC_NDOC) << " X P 1 D"; // X: stampa su disco, P: provvisorio, 1: 1 copia, D: disabilita archiviazione
|
||||
TExternal_app interattivo(commandline);
|
||||
if (interattivo.run() == NOERR)
|
||||
{
|
||||
TFilename pdf; pdf.tempdir();
|
||||
pdf << SLASH << doc.get(DOC_ANNO) << '_' << doc.get(DOC_CODNUM) << '_' << doc.get(DOC_NDOC) << ".pdf";
|
||||
if (pdf.exist())
|
||||
{
|
||||
file.cut(0) << pdf;
|
||||
|
||||
TString numreg; numreg << movimento.numreg;
|
||||
// Controllo anche se false perche' potrebbe esistere gia'.
|
||||
if(!TF9_doccart::add_cart(file, numreg))
|
||||
{
|
||||
TF9_doccart filecart;
|
||||
TFilename fdoc;
|
||||
ok = filecart.mov2doc(numreg, fdoc) && fdoc.name() == file.name();
|
||||
}
|
||||
else
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TEstrazione::make_prosp_int_revc(const int numreg, TCategorie_doc::annesso& annesso)
|
||||
{
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
mov.read();
|
||||
TString rev_vend = mov.get(MOV_MOVCOLL);
|
||||
if((rev_vend.full() || is_integr_rev(numreg, rev_vend)) && rev_vend != "0")
|
||||
if((rev_vend.full() || find_movcoll(numreg, rev_vend)) && rev_vend != "0")
|
||||
{
|
||||
TF9Prospetto_integr prosp;
|
||||
TString acq; acq << numreg;
|
||||
@ -607,7 +652,8 @@ const char* TEstrazione::diagnostica_mov()
|
||||
mov_i.descr_err = "Errore controllo movimento: errore lettura db.";
|
||||
break;
|
||||
case no_guessed:
|
||||
// Controllo se esiste il cartaceo es. forfettari
|
||||
// Controllo se esiste il cartaceo es. forfettari => la considero cartacea.
|
||||
// Ma poi devo comunque avere il flag per l'esportazione dei cartacei
|
||||
if(check_cartaceo_acq(mov_i))
|
||||
{
|
||||
ok &= true;
|
||||
@ -648,21 +694,32 @@ const char* TEstrazione::diagnostica_mov()
|
||||
}
|
||||
|
||||
// Se cartaceo preparo il file.
|
||||
if (mov_i.cartaceo)
|
||||
if (F9CONF.get_has_cartexp()) // Se e' abilitata l'esportazione dei cartacei, altrimenti skip...
|
||||
{
|
||||
TF9_doccart filecart;
|
||||
TFilename file;
|
||||
TString reg; reg << it->numreg;
|
||||
if (filecart.mov2doc(reg, file) && file.exist())
|
||||
mov_i.nomefilecart << file;
|
||||
else
|
||||
if (mov_i.cartaceo)
|
||||
{
|
||||
mov_i.err = true;
|
||||
mov_i.estratto = false;
|
||||
mov_i.descr_err = "Non e' stato possibile reperire il file del documento cartaceo per questo movimento.";
|
||||
mov_i.descr_estr = movimento_t::no_filecart;
|
||||
TF9_doccart filecart;
|
||||
TFilename file;
|
||||
TString reg; reg << it->numreg;
|
||||
if (filecart.mov2doc(reg, file) && file.exist())
|
||||
mov_i.nomefilecart << file;
|
||||
else
|
||||
{
|
||||
mov_i.err = true;
|
||||
mov_i.estratto = false;
|
||||
mov_i.descr_err = "Non e' stato possibile reperire il file del documento cartaceo per questo movimento.";
|
||||
mov_i.descr_estr = movimento_t::no_filecart;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ok &= true;
|
||||
mov_i.err = false;
|
||||
mov_i.estratto = false;
|
||||
mov_i.descr_estr = movimento_t::no_cartaceo; // Cartaceo che non ha bisogno di essere estratto.
|
||||
++_stats.fa_skip;
|
||||
}
|
||||
copy_file_to_webapp_fld(mov_i);
|
||||
}
|
||||
}
|
||||
@ -743,21 +800,21 @@ const char* TEstrazione::diagnostica_mov()
|
||||
|
||||
if (mov_i.estratto)
|
||||
{
|
||||
if(mov_i.cartaceo)
|
||||
if (mov_i.cartaceo)
|
||||
{
|
||||
TF9_doccart filecart;
|
||||
TFilename file;
|
||||
TString reg; reg << it->numreg;
|
||||
if (filecart.mov2doc(reg, file) && file.exist())
|
||||
if (filecart.mov2doc(reg, file) && file.exist() || stampa_documento(mov_i, file) && file.exist())
|
||||
{
|
||||
mov_i.nomefilecart << file;
|
||||
}
|
||||
else
|
||||
{
|
||||
mov_i.err = true;
|
||||
mov_i.estratto = false;
|
||||
mov_i.descr_err = "Non e' stato possibile reperire il file del documento cartaceo per questo movimento.";
|
||||
mov_i.descr_estr = movimento_t::no_filecart;
|
||||
mov_i.err = true;
|
||||
mov_i.estratto = false;
|
||||
mov_i.descr_err = "Non e' stato possibile reperire il file del documento cartaceo per questo movimento.";
|
||||
mov_i.descr_estr = movimento_t::no_filecart;
|
||||
}
|
||||
}
|
||||
copy_file_to_webapp_fld(mov_i);
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <Windows.h>
|
||||
|
||||
#include "f9lib.h"
|
||||
|
||||
#include "applicat.h"
|
||||
@ -77,6 +79,94 @@ TF9_config::TF9_config()
|
||||
// TF9_doccart
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TF9_doccart::add_cart(const TFilename& file, const TString& numreg, const bool is_annesso,
|
||||
const TString& catannpadre, const TString& catdocann, bool suppress_errors)
|
||||
{
|
||||
TString numreg_old;
|
||||
bool annesso;
|
||||
TF9_doccart f9cart;
|
||||
TLocalisamfile f9docs(LF_F9DOCS);
|
||||
TLocalisamfile f9annessi(LF_F9ANNESSI);
|
||||
if (f9cart.doc_already_exists(file, numreg_old, annesso))
|
||||
{
|
||||
if(!suppress_errors)
|
||||
warning_box("Attenzione: esiste gia' un %s con questo nome associato al num. di registrazione %s", annesso ? "annesso" : "documento", (const char*)numreg_old);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_annesso)
|
||||
{
|
||||
TFilename doc;
|
||||
if (f9cart.mov2doc(numreg, doc) && !doc.empty())
|
||||
{
|
||||
if (!suppress_errors)
|
||||
warning_box("Attenzione: la registrazione num. %s ha gia' un documento associato: %s.\n"
|
||||
"Se si tratta di un annesso inserire le informazioni per la cat. documentale.", (const char*)numreg, (const char*)doc);
|
||||
return false;
|
||||
}
|
||||
|
||||
f9docs.zero();
|
||||
f9docs.put(F9C_FILENAME, file.name());
|
||||
f9docs.put(F9C_NUMREG, numreg);
|
||||
f9docs.put(F9C_LOADDATE, TDate(TODAY));
|
||||
f9docs.put(F9C_USER, user());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Controllo che non sto gia' utilizzando questa categoria di annesso per questa registrazione
|
||||
// Prendo la lista degli annessi per questa registrazione e li controllo in cerca della categoria
|
||||
TF9_doccart doccart;
|
||||
vector<annesso_t> list_annessi;
|
||||
doccart.mov2listann_vect(numreg, list_annessi);
|
||||
bool exist = false;
|
||||
for (auto it = list_annessi.begin(); it != list_annessi.end(); ++it)
|
||||
{
|
||||
if (it->catdocann == catdocann)
|
||||
exist = true;
|
||||
}
|
||||
if (exist)
|
||||
{
|
||||
if (!suppress_errors)
|
||||
message_box("Attenzione: la registrazione num. %s ha gia' un annesso associato con questo tipo di annesso.", (const char*)numreg);
|
||||
return false;
|
||||
}
|
||||
f9annessi.zero();
|
||||
f9annessi.put(F9A_NUMREG, numreg);
|
||||
f9annessi.put(F9A_FILENAME, file.name());
|
||||
f9annessi.put(F9A_CATDOCPAD, catannpadre);
|
||||
f9annessi.put(F9A_CATDOCANN, catdocann);
|
||||
f9annessi.put(F9C_LOADDATE, TDate(TODAY));
|
||||
f9annessi.put(F9C_USER, user());
|
||||
}
|
||||
TFilename fdestin = F9CONF.get_addr_cart();
|
||||
const TString filename = file.name();
|
||||
fdestin << filename;
|
||||
const bool ok = CopyFile(file, fdestin, true);
|
||||
if (!ok)
|
||||
{
|
||||
if (!suppress_errors)
|
||||
{
|
||||
if (fdestin.exist())
|
||||
warning_box("Errore nel copiare il file nella cartella di destinazione.\nEsiste gia' un file con questo nome.");
|
||||
else
|
||||
warning_box("Errore nel copiare il file nella cartella di destinazione. Ritentare.");
|
||||
}
|
||||
f9docs.zero();
|
||||
return false;
|
||||
}
|
||||
if (!is_annesso)
|
||||
{
|
||||
f9docs.write();
|
||||
f9docs.rewrite();
|
||||
}
|
||||
else
|
||||
{
|
||||
f9annessi.write();
|
||||
f9annessi.rewrite();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TF9_doccart::doc_already_exists(const TFilename& file, _Out_ TString& numreg, _Out_ bool& annesso)
|
||||
{
|
||||
numreg = "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user