Merge branch 'R12.00.1136' of http://10.65.20.33/sirio/CAMPO/campo into R12.00.1136

This commit is contained in:
New_Macchina_Compilatrice 2022-10-11 12:06:30 +02:00
commit a1234cd3e0
3 changed files with 21 additions and 16 deletions

View File

@ -1572,7 +1572,7 @@ void TPrimanota_application::set_movcoll(const long movcoll, const long numreg)
}
int TPrimanota_application::controlli_f1(const TMask& m)
{
if (iva_mask(m) && m.get(F_PROKEY).full() && has_f1_db(m) && fp_db().sq_is_connect() && check_causale(m.get(F_CODCAUS)))
if (iva_mask(m) && m.get(F_PROKEY).full() && has_f1_db(m) && fp_db().sq_is_connect() && check_causale(m.get(F_CODCAUS), m.get_date(F_DATAREG).year()))
{
TToken_string keys(m.get(F_PROKEY), ';');
const TDate dataoraric = fppro_db().set_keys(keys).get_dataorarioric();
@ -1906,18 +1906,18 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
{
TSheet_field & iva = app().ivas();
const int items = iva.items();
const TCausale & causreg = cached_causale(causimm);
const TDate datareg = m.get_date(F_DATAREG);
const TCausale & causreg = cached_causale(causimm, datareg.year());
TRegistro registro = causreg.codice_registro();
const TString8 tipo_doc_sdi = causreg.tipodocsdi();
const int tipo_doc = atoi(tipo_doc_sdi.mid(2));
if (tipo_doc_sdi.starts_with("TD") && (tipo_doc > 15 && tipo_doc < 20))
{
_automatico->_datadoc = m.get(F_DATAREG);
_automatico->_numdoc.cut(0);
TRegistro & cr = (TRegistro &) cached_registro(causreg.codice_registro());
// cr.reread();
_automatico->_numdoc << cr.protocol() + 1;
_automatico->_datadoc = datareg;
//TRegistro & cr = (TRegistro &) cached_registro(causreg.codice_registro());
registro.reread();
_automatico->_numdoc << registro.protocol() + 1;
}
else
{
@ -2012,7 +2012,7 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
break;
case 2: // Regolarizzazione IVA
{
TCausale caus_reg(_automatico->_causale);
TCausale caus_reg(_automatico->_causale, _automatico->_datadoc.year());
TBill contocf; caus_reg.bill(1, contocf);
char tcf_reg = contocf.tipo();
@ -2746,12 +2746,13 @@ int TPrimanota_application::save_fppro()
else return pro_notsaved; // In altre modalita' esco senza fare nulla sul db
}
// Controllo che sto registrando un documento d'acquisto
if (!check_causale(msk.get(F_CODCAUS)))
return pro_notsaved;
const TDate data_operazione(msk.get(F_DATAREG));
const TDate data_documento(msk.get(F_DATADOC));
// Controllo che sto registrando un documento d'acquisto
if (!check_causale(msk.get(F_CODCAUS), data_operazione.year()))
return pro_notsaved;
const TString& numero_docext = msk.get(F_NUMDOCEXT);
real tot_doc = msk.get_real(F_TOTALE);
const real ritfis = msk.get_real(F_RITFIS);

View File

@ -2260,7 +2260,7 @@ void TPrimanota_application::check_fppro_fields(TMask& m)
{
const bool after_data = m.get_date(F_DATAREG) >= get_data_start_fatt();
if (!check_causale(m.get(F_CODCAUS)) || !app().has_module(FPAUT) || !after_data)
if (!check_causale(m.get(F_CODCAUS), m.get_date(F_DATAREG).year()) || !app().has_module(FPAUT) || !after_data)
{
if(m.find_by_id(DLG_LINK) != nullptr)
m.disable(DLG_LINK);
@ -4140,8 +4140,9 @@ void TPrimanota_application::insert_part_scad(TConfig& ini) // che cazzo signifi
bool TPrimanota_application::fppro_mask(TMask_field& f, KEY key)
{
TMask& cg_msk = f.mask();
const int year = cg_msk.get_date(F_DATAREG).year();
if (!app().has_module(FPAUT) || key != K_SPACE && key != K_TAB || !check_causale(cg_msk.get(F_CODCAUS)))
if (!app().has_module(FPAUT) || key != K_SPACE && key != K_TAB || !check_causale(cg_msk.get(F_CODCAUS), year))
return true;
TPro_msk * msk = app()._pro_mask;
@ -4186,7 +4187,7 @@ bool TPrimanota_application::scollega_handler(TMask_field& f, KEY key)
{
TMask& cg_msk = f.mask();
if (check_causale(cg_msk.get(F_CODCAUS)) && cg_msk.get_bool(F_COLFPPRO))
if (check_causale(cg_msk.get(F_CODCAUS), cg_msk.get_date(F_DATAREG).year()) && cg_msk.get_bool(F_COLFPPRO))
{
scollega(true);
app().clean_fppro();

View File

@ -65,6 +65,9 @@ bool TCausale::read(const char* cod, int year)
_corrisp = false;
_year = year;
if (_year <= 0)
_year = today.year();
if (cod && *cod > ' ')
{
_rec = cache().get(LF_CAUSALI, cod);