Patch level :10.0 CD

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
aggiunto il caricamento\aggiornamento dei nuovi comuni italiani


git-svn-id: svn://10.65.10.50/branches/R_10_00@22038 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2011-04-28 10:22:52 +00:00
parent eaeba9c57e
commit 629f887695
3 changed files with 47 additions and 9 deletions

View File

@ -1,3 +1,4 @@
#include <comuni.h>
#include <config.h> #include <config.h>
#include <execp.h> #include <execp.h>
#include <modaut.h> #include <modaut.h>
@ -20,6 +21,9 @@ protected:
virtual bool something_to_load() const; virtual bool something_to_load() const;
virtual bool something_checked() const; virtual bool something_checked() const;
bool iva_to_load() const;
bool comuni_to_load() const;
public: public:
virtual ~TInstall_BA () {} virtual ~TInstall_BA () {}
}; };
@ -84,16 +88,32 @@ bool TInstall_BA::post_installer()
bool TInstall_BA::something_checked() const bool TInstall_BA::something_checked() const
{ {
return _m->get_bool(F_DATI_IVA) || TInstallmodule_app::something_checked(); return _m->get_bool(F_DATI_IVA) || _m->get_bool(F_COMUNI) || TInstallmodule_app::something_checked();
}
bool TInstall_BA::iva_to_load() const
{
TTable iva("%IVA");
return iva.empty();
}
bool TInstall_BA::comuni_to_load() const
{
//controlla se il file con i comuni è da aggiornare
//guarda se esiste il codice M314 che è l'ultimo creato al 28/04/2011...
TLocalisamfile comuni(LF_COMUNI);
comuni.put(COM_COM, "M314");
//se il comune M314 non c'è -> il file dei comuni è da aggiornare
const int err = comuni.read();
return err != NOERR;
} }
bool TInstall_BA::something_to_load() const bool TInstall_BA::something_to_load() const
{ {
if (test_database()) if (test_database())
{ {
TTable iva("%IVA"); if (iva_to_load() || comuni_to_load())
if (iva.empty()) return true;
return true;
} }
return TInstallmodule_app::something_to_load(); return TInstallmodule_app::something_to_load();
} }
@ -102,12 +122,18 @@ bool TInstall_BA::preload_mask()
{ {
if (has_module(CGAUT) || has_module(VEAUT)) if (has_module(CGAUT) || has_module(VEAUT))
{ {
if (something_to_load()) if (iva_to_load())
_m->set(F_DATI_IVA, "X"); _m->set(F_DATI_IVA, "X");
} }
else else
_m->hide(F_DATI_IVA); _m->hide(F_DATI_IVA);
if (comuni_to_load())
_m->set(F_COMUNI, "X");
else
_m->hide(F_COMUNI);
return TInstallmodule_app::preload_mask(); return TInstallmodule_app::preload_mask();
} }
@ -115,12 +141,18 @@ bool TInstall_BA::install_com()
{ {
//i codici iva vanno a parte //i codici iva vanno a parte
TStd_filename txtfile; TStd_filename txtfile;
if (_m->get_bool(F_DATI_IVA) && txtfile.check(TRUE,"lfiva.txt")) if (_m->get_bool(F_DATI_IVA) && txtfile.check(true, "lfiva.txt"))
{ {
TSystemisamfile tabcom(LF_TABCOM); TSystemisamfile tabcom(LF_TABCOM);
tabcom.load(txtfile); tabcom.load(txtfile);
} }
if (_m->get_bool(F_COMUNI) && txtfile.check(true, "comuni.txt"))
{
TSystemisamfile comuni(LF_COMUNI);
comuni.load(txtfile);
}
return TInstallmodule_app::install_com(); return TInstallmodule_app::install_com();
} }

View File

@ -1,2 +1,3 @@
#include "bainsta.h" #include "bainsta.h"
#define F_DATI_IVA 102 #define F_DATI_IVA 102
#define F_COMUNI 103

View File

@ -4,12 +4,17 @@ PAGE "Installazione dati IVA" -1 -1 78 8
BOOL F_DEFAULTSDATA BOOL F_DEFAULTSDATA
BEGIN BEGIN
PROMPT 2 2 "Carica le tabelle del modulo Base" PROMPT 2 1 "Carica le tabelle del modulo Base"
END END
BOOL F_DATI_IVA BOOL F_DATI_IVA
BEGIN BEGIN
PROMPT 2 4 "Installa dati IVA" PROMPT 2 2 "Installa dati IVA"
END
BOOL F_COMUNI
BEGIN
PROMPT 2 3 "Aggiorna l'elenco dei comuni italiani"
END END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2