Patch level : 12.0 798

Files correlati     : cg2100, fp0400, fplib, modaut
Commento            :
- Aggiunto campo in configurazione fatt. el. per data inizio fatturazione elett.
- Aggiunto controllo data operazione (cg) maggiore di inizio periodo fatt. el.
- Corretta numerazione moduli per problema discrepanza con campo.aut
This commit is contained in:
Simone Palacino 2019-05-27 16:06:02 +02:00
parent c6114c2df7
commit 2e9a22a566
10 changed files with 99 additions and 32 deletions

View File

@ -54,7 +54,7 @@ public:
TPrimanota_application::TPrimanota_application()
: _rel(NULL), _mode(0), _iva(nessuna_iva), _causale(NULL), _giornale(NULL),
_lastreg(0), _last_dreg(TODAY), _last_dcom(TODAY), _automatico(NULL), _swap_mask(false)
_lastreg(0), _last_dreg(TODAY), _last_dcom(TODAY), _automatico(NULL), _swap_mask(false), _is_set_fpcheck(false)
{
memset(_msk, 0, sizeof(_msk));
}
@ -125,7 +125,8 @@ TMask* TPrimanota_application::load_mask(int n)
ism.set_handler(CG_RISCONTO, sheet_risconto_handler);
if (!has_f1_db(m))
{
m->hide(F_PROTFPPRO);
if (m->find_by_id(F_PROTFPPRO) != NULL)
m->hide(F_PROTFPPRO);
if (m->find_by_id(F_COLFPPRO) != NULL)
m->hide(F_COLFPPRO);
if(m->find_by_id(DLG_LINK) != NULL)
@ -665,6 +666,7 @@ void TPrimanota_application::init_mask(TMask& m)
fill_sheet(m); // Riempe righe contabili coi conti della causale
m.hide(F_LINKDOC);
set_has_f1_db(&m);
}
void TPrimanota_application::init_query_mode(TMask& m)
@ -703,6 +705,7 @@ void TPrimanota_application::init_query_mode(TMask& m)
m.set(F_CODCAUS, ini.get(MOV_CODCAUS));
m.send_key(K_SPACE, DLG_NEWREC);
}
set_has_f1_db(&m);
}
@ -947,6 +950,22 @@ void TPrimanota_application::init_insert_mode(TMask& m)
}
}
void TPrimanota_application::f1_init_modify(TMask& m, const TRectype& mov)
{
const bool after_data_inizio_fe = TDate(mov.get(MOV_DATADOC)) >= TDate(fp_settings().get_data_start_fatt());
if (m.find_by_id(F_PROTFPPRO) != NULL && !m.field(F_PROTFPPRO).hidden() && after_data_inizio_fe)
{
m.set(F_PROTFPPRO, mov.get(MOV_PROGFPPRO));
m.set(F_COLFPPRO, mov.get(MOV_KEYFPPRO).empty() ? " " : "X");
}
else if(m.find_by_id(F_PROTFPPRO) != NULL && !m.field(F_PROTFPPRO).hidden() && !after_data_inizio_fe)
{
m.field(F_PROTFPPRO).hide();
m.field(F_COLFPPRO).hide();
m.field(DLG_LINK).hide();
}
}
void TPrimanota_application::init_modify_mode(TMask& m)
{
init_mask(m); // Inizializzazione standard
@ -1052,13 +1071,8 @@ void TPrimanota_application::init_modify_mode(TMask& m)
m.enable(F_BOLLACODCLI, causale().tipo_doc() == "BD");
m.enable(F_BOLLARAGCLI, causale().tipo_doc() == "BD");
}
if(m.find_by_id(F_PROTFPPRO) != NULL && !m.field(F_PROTFPPRO).hidden())
{
m.set(F_PROTFPPRO, mov.get(MOV_PROGFPPRO));
m.set(F_COLFPPRO, mov.get(MOV_KEYFPPRO).empty() ? " " : "X");
}
f1_init_modify(m, mov);
}
// Controlla sulla causale se il segno del totale documento (ritsoc=false)
@ -1594,14 +1608,26 @@ void TPrimanota_application::clean_fppro()
fp_db().sq_commit();
}
void TPrimanota_application::set_has_f1_db(TMask* m)
{
if (m->find_by_id(F_DATAREG) != NULL && !m->get(F_DATAREG).empty())
{
if (TDate(m->get(F_DATAREG)) >= TDate(fp_settings().get_data_start_fatt()))
_isfp = has_module(F1AUT) && !fp_settings().get_db_indirizzo().empty() && !fp_settings().is_f8();
else
_isfp = false;
_is_set_fpcheck = true;
}
else if (!_is_set_fpcheck)
{
_isfp = false;
_is_set_fpcheck = true;
}
}
bool TPrimanota_application::has_f1_db(TMask* m)
{
static bool is_set_fpcheck = false;
if (!is_set_fpcheck)
{
_isfp = has_module(F1AUT) && !fp_settings().get_db_indirizzo().empty() && !fp_settings().is_f8();
is_set_fpcheck = true;
}
set_has_f1_db(m);
return _isfp;
}

View File

@ -2262,19 +2262,21 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
void TPrimanota_application::check_fppro_fields(TMask& m)
{
if (app().has_f1_db(&m))
if (!check_causale(m.get(F_CODCAUS)) || !app().has_f1_db(&m))
{
if (!check_causale(m.get(F_CODCAUS)) && m.find_by_id(F_PROTFPPRO) != NULL)
{
if(m.find_by_id(F_PROTFPPRO) != NULL)
m.hide(F_PROTFPPRO);
if(m.find_by_id(DLG_LINK) != NULL)
m.disable(DLG_LINK);
}
else
if (check_causale(m.get(F_CODCAUS)) && m.find_by_id(F_PROTFPPRO) != NULL && m.field(F_PROTFPPRO).hidden())
{
m.show(F_PROTFPPRO);
m.enable(DLG_LINK);
}
}
else
{
if (m.find_by_id(F_PROTFPPRO) != NULL && m.field(F_PROTFPPRO).hidden())
m.show(F_PROTFPPRO);
if (m.find_by_id(DLG_LINK) != NULL)
m.enable(DLG_LINK);
if (m.find_by_id(F_COLFPPRO) != NULL)
m.show(F_COLFPPRO);
}
}
@ -2461,6 +2463,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
}
}
}
check_fppro_fields(f.mask());
return ok;
}

View File

@ -98,7 +98,9 @@ class TPrimanota_application : public TRelation_application
TAssoc_array _colori; // Colori delle righe
bool _isfp;
shared_ptr<TPro_msk> _pro_mask;
friend class TPro_msk;
bool _is_set_fpcheck;
int _last_date;
friend class TPro_msk;
static bool showpartite_handler(TMask_field& f, KEY k);
static bool speserimb_handler(TMask_field& f, KEY k);
@ -187,6 +189,8 @@ class TPrimanota_application : public TRelation_application
static void fppromask_set_handl(TMask* msk);
static void load_list(TMask* msk, KEY k);
static void f1_init_modify(TMask& m, const TRectype& mov);
void reset_sheet_row(TSheet_field& s, int n);
int crea_somma_spese(TImporto& imp);
void update_saldo_riga(int r);
@ -208,6 +212,7 @@ protected: // TApplication
bool save_dbmov() const;
// Pulisce il mov e db dai firerimenti FPPRO (in MODE_MOD per edit/delete)
void clean_fppro();
void set_has_f1_db(TMask* m);
bool has_f1_db(TMask* m);
virtual bool save(bool check_dirty);
@ -353,6 +358,7 @@ public:
static bool iva_notify(TSheet_field& s, int r, KEY key);
static bool cg_notify(TSheet_field& s, int r, KEY key);
bool get_isfp() const { return _isfp; }
int get_lastdate() { return _last_date; }
TMask * mask(CGMaskType type) { return _msk[type]; }

View File

@ -48,6 +48,7 @@ void TParametri_mask::save_all() const
fp_settings().set_check_not_block(get_bool(F_CHECK_NOT_BLOCK));
fp_settings().set_no_sconti_fatt(get_bool(F_CHECK_NO_SCONTI));
fp_settings().set_no_export_pronto(get_bool(F_CHECK_NO_EXPORT_PRONTO));
fp_settings().set_data_start_fatt(get_date(F_STARTFATTEL));
TFP_righe_custom().save_sheet(sfield(F_FORMPERS));
TFP_nota_piede_f().save_sheet(sfield(F_NPFSHEET));
}
@ -226,6 +227,10 @@ bool TParametri_mask::on_field_event(TOperable_field& o, TField_event e, long jo
}
}
break;
case F_STARTFATTEL:
if (e == fe_init)
field(F_STARTFATTEL).set(fp_settings().get_data_start_fatt());
break;
default:
break;
}

View File

@ -11,6 +11,7 @@
#define F_CHECK_NOT_BLOCK 211
#define F_CHECK_NO_SCONTI 212
#define F_CHECK_NO_EXPORT_PRONTO 213
#define F_STARTFATTEL 214
#define F_SETPATCH 301
#define F_ENPTYTABLE 302

View File

@ -87,6 +87,16 @@ BEGIN
FLAGS ""
END
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 16 "@BInizio Fatturazione Elettronica"
END
DATE F_STARTFATTEL
BEGIN
PROMPT 2 17 "Data inizio (default 01-01-2019)"
END
ENDPAGE
PAGE "Configurazione (2) " 0 2 0 0

View File

@ -855,8 +855,11 @@ bool TPassive_mask::on_field_event(TOperable_field& o, TField_event e, long joll
break;
case DLG_SAVEREC:
if (e == fe_button)
if(curr_page() == elenco_fe)
if (curr_page() == elenco_fe)
{
salva_for();
fill();
}
break;
case DLG_NEWREC:
if(e == fe_button)
@ -939,6 +942,7 @@ void TPassive_app::load_mask(const TPassive_mask& mask) const
{
if (check_f1())
{
message_box("Attivo");
mask.field(F_CAUSFA).set(get_ini_codcaus());
mask.field(F_CAUSNC).set(get_ini_codcaus(true));
mask.field(F_DATAINIREG).enable(mask.get_fattsel() == FILTER_CONT);

View File

@ -302,6 +302,7 @@ public:
const TString& get_fld_dest() const;
const TString& get_fld_dest_usr() const;
const TString& get_cofi_tras() const;
const TString& get_data_start_fatt() const;
const bool get_gest_alleg() const;
const bool get_allega_fat() const;
const bool get_esp_pri_empty() const;
@ -334,6 +335,7 @@ public:
void set_body_mail(const char* msg, int idx = -1) const;
void set_no_sconti_fatt(const bool no_sconti_fatt) const;
void set_no_export_pronto(const bool no_export_pronto) const;
void set_data_start_fatt(const char* date) const;
void set_npf(const char * tipodoc, const char* msg, int idx) const;
void set_npf_tipodoc(const TString& tipodoc, int indx) const;

View File

@ -24,6 +24,7 @@
#define FP_NOTA_PIEDE_F "npf" // Nota piede fattura
#define FP_CHECK_NO_SCONTI_FATT "noscontifatt"
#define FP_CHECK_NO_EXPORT_PRONTO "noexportpronto"
#define FP_DATASTARTFATT "datastartfatt"
// Sheet fp0300
#define FP_SLD_COD "SLD"
@ -87,6 +88,11 @@ const TString& TFP_settings::get_cofi_tras() const
return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_COFI_TRAS);
}
const TString& TFP_settings::get_data_start_fatt() const
{
return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_DATASTARTFATT, "01-01-2019");
}
const bool TFP_settings::get_gest_alleg() const
{
return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_GEST_ALLEG);
@ -241,6 +247,11 @@ void TFP_settings::set_no_export_pronto(const bool no_export_pronto) const
ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_CHECK_NO_EXPORT_PRONTO, no_export_pronto);
}
void TFP_settings::set_data_start_fatt(const char* date) const
{
ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_DATASTARTFATT, date);
}
void TFP_settings::remove_para_ini(int idx)
{
ini_remove(FILE_CONFIG, FILE_SECTION, FP_MAIL, idx);

View File

@ -48,12 +48,11 @@
#define BSAUT 45
#define HAAUT 46
#define RIAUT 47
#define VDAUT 48
#define GVAUT 49
#define TFAUT 50
#define F1AUT 51
#define F9AUT 52
#define ENDAUT 53
#define GVAUT 48
#define TFAUT 49
#define F1AUT 50
#define F9AUT 51
#define ENDAUT 52
// Moduli disabilitati