Merge branch 'R_10_00' of http://10.65.20.33/sirio/CAMPO/campo into R_10_00

This commit is contained in:
Sirio Builder 2019-05-22 15:40:10 +02:00
commit 136cbcf617
3 changed files with 50 additions and 3 deletions

View File

@ -20,6 +20,10 @@
#include "tf0200a.h"
#define CAMPI_CON_BOOLEAN F_TOTOPATT
#define CONF_MODULO "tf"
#define LAST_DATACOMP "LASTCOMP"
#define FLAG_MOD "FLDATACOMPMOD"
#define STOP "$$"
// ComLiqPerIva: Comunicazione Liquidazioni Periodiche IVA
@ -209,6 +213,7 @@ void calcola_credito_prec(real& creprec, real& creaprec, bool mensile, int anno,
class TCom_liq_per_iva_msk : public TAutomask
{
bool _last_elab; // Flag per controllare se hanno cambiato il tipo di elaborazione (data competenza)
protected:
bool _mensile;
// Aggiunta questa variabile per specificare se è stato impostato un tipo di liquidazione.
@ -216,14 +221,34 @@ protected:
bool _init_liq;
TRectype _true_data;
void write_datacomp_mod(bool enabled);
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
void extractinator();
void check_old_value(int field, const real& val);
public:
TCom_liq_per_iva_msk() : TAutomask("tf0200a"), _true_data(LF_IVALIQ), _init_liq(false) { first_focus(F_ANNO); }
TCom_liq_per_iva_msk() : TAutomask("tf0200a"), _true_data(LF_IVALIQ), _init_liq(false)
{
_last_elab = ini_get_bool(CONFIG_DITTA, CONF_MODULO, LAST_DATACOMP, false);
first_focus(F_ANNO);
}
void save_gen();
};
void TCom_liq_per_iva_msk::write_datacomp_mod(const bool enabled)
{
int count = 0;
TString line = ini_get_string(CONFIG_DITTA, CONF_MODULO, FLAG_MOD, STOP, count);
for (; line != STOP; line = ini_get_string(CONFIG_DITTA, CONF_MODULO, FLAG_MOD, STOP, ++count)) { }
const TDate today(TODAY);
TString mod; mod << user() << (enabled ? "|E|" : "|D|") << today.month() << "." << today.day();
ini_set_string(CONFIG_DITTA, CONF_MODULO, FLAG_MOD, mod, count);
ini_set_bool(CONFIG_DITTA, CONF_MODULO, LAST_DATACOMP, enabled);
_last_elab = enabled;
}
bool TCom_liq_per_iva_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
@ -294,7 +319,21 @@ bool TCom_liq_per_iva_msk::on_field_event(TOperable_field& o, TField_event e, lo
}
}
break;
case F_DATA_COMP:
if(e == fe_init)
set(F_DATA_COMP, _last_elab ? "X" : " ");
else if(e == fe_modify)
warning_box("Attenzione la modifica di questo valore comporta un diverso calcolo dei righi VP2 VP3. L'utente è pregato di controllarne la correttezza.\nSi consiglia di ricalcolare e rispedire tutti periodi dell'anno");
break;
case DLG_SAVEREC:
if(e == fe_button)
{
bool data_comp = get_bool(F_DATA_COMP);
if (data_comp != _last_elab)
{
write_datacomp_mod(data_comp);
}
}
if(e != fe_init && !_true_data.empty())
_true_data.write_rewrite(TLocalisamfile(LF_IVALIQ));
}
@ -417,10 +456,11 @@ void TCom_liq_per_iva_msk::extractinator() // Per gli amici GTFO
real ivaver = ZERO;
real ivaverc = ZERO;
const bool elab_dt_comp = get_bool(F_DATA_COMP);
for(; start <= end; start++)
{
TDate data_da(1, start, anno);
TDate data_a(1, start + 1, anno); data_a.set_end_month();
TDate data_a(1, start + (elab_dt_comp ? 1 : 0), anno); data_a.set_end_month();
bool has_ixc = gestione_IVAxCassa(data_da);
/****************************************************************************************************************
@ -459,7 +499,8 @@ void TCom_liq_per_iva_msk::extractinator() // Per gli amici GTFO
const int month_reg = cur_iva.get("23." MOV_DATAREG).as_date().month();
const int month_liq = cur_iva.get("23." MOV_MESELIQ).as_int();
// month_liq viene valorizzato solo se è del mese precedente o sempre? Nei record vecchi ovviamente sarà a zero ma adesso che ci mette?
if ((month_reg == start && (month_liq == 0 || month_liq == month_reg)) || start == month_liq)
if (elab_dt_comp && ((month_reg == start && (month_liq == 0 || month_liq == month_reg)) || start == month_liq)
|| !elab_dt_comp)
{
// Prendo il tipo di registro
TRegistro reg(cur_iva.get(FIELD_NAME(LF_MOV, MOV_REG)).as_string(), anno);

View File

@ -33,6 +33,7 @@
#define F_IMPNOVER 133
#define F_VEREFF 134
#define F_GENERATA 135
#define F_DATA_COMP 136
/* Booleani controllo modifiche (+50 rispetto al campo a cui si riferisce) */

View File

@ -24,6 +24,11 @@ ENDPAGE
PAGE "Impostazioni" 0 2 0 0
BOOLEAN F_DATA_COMP
BEGIN
PROMPT 1 0 "@BElaborare per data competenza"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 1 1 "Codice "