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 <execp.h>
#include <modaut.h>
@ -20,6 +21,9 @@ protected:
virtual bool something_to_load() const;
virtual bool something_checked() const;
bool iva_to_load() const;
bool comuni_to_load() const;
public:
virtual ~TInstall_BA () {}
};
@ -84,16 +88,32 @@ bool TInstall_BA::post_installer()
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
{
if (test_database())
{
TTable iva("%IVA");
if (iva.empty())
return true;
if (iva_to_load() || comuni_to_load())
return true;
}
return TInstallmodule_app::something_to_load();
}
@ -102,12 +122,18 @@ bool TInstall_BA::preload_mask()
{
if (has_module(CGAUT) || has_module(VEAUT))
{
if (something_to_load())
if (iva_to_load())
_m->set(F_DATI_IVA, "X");
}
else
_m->hide(F_DATI_IVA);
if (comuni_to_load())
_m->set(F_COMUNI, "X");
else
_m->hide(F_COMUNI);
return TInstallmodule_app::preload_mask();
}
@ -115,12 +141,18 @@ bool TInstall_BA::install_com()
{
//i codici iva vanno a parte
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);
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();
}

View File

@ -1,2 +1,3 @@
#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
BEGIN
PROMPT 2 2 "Carica le tabelle del modulo Base"
PROMPT 2 1 "Carica le tabelle del modulo Base"
END
BOOL F_DATI_IVA
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
BUTTON DLG_OK 10 2