Patch level : 12.0 280

Files correlati     : 
Commento            :
- Corretto l'handler sul campo pagamento in modo che compili correttamente il campo mandato vuoto solo se si è in inserimento e la condizione di pagamento prevede i RID
- Aggiunti inline operator aritmetici anche per i longdouble


git-svn-id: svn://10.65.10.50/branches/R_10_00@23281 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
mtollari 2016-09-14 13:34:43 +00:00
parent 3c33752048
commit 8cf2ffbcbd
8 changed files with 26 additions and 20 deletions

View File

@ -58,7 +58,7 @@ bool TConf_vendite::check_fields_iva(TMask_field& f, KEY k)
for (short i = F_EX_PERCIVA1; i <= F_EX_PERCIVA5; i+=2)
tot += m.get_real(i);
if (tot != ZERO && tot != 100.0)
if (tot != ZERO && tot != CENTO)
return f.error_box("La somma delle percentuali di esclusione deve dare 100 oppure 0.");
}
return TRUE;

View File

@ -554,7 +554,8 @@ void TGenerazioneEffetti_app::generate()
if (doc_tipo_stato_ok(doc)) // controlla che il tipo documento e lo stato siano coerenti con la ELD selezionata
{
TPagamento & pag = doc->pagamento();
if (pag.code().not_empty())
if (pag.code().not_empty())
{
const bool raggruppabile = doc->get_bool(DOC_RAGGREFF);
if (!_raggruppa || (_raggruppa && !raggruppabile))

View File

@ -1674,7 +1674,7 @@ void TDocumento::calc_provvigione(TProvvigioni_agente & provv, const TString & k
TCurrency_documento tot_doc(totale_doc(), *this);
TCurrency_documento tot_netto(totale_netto(), *this);
TCurrency_documento tot_provv(provvigione(first), *this);
TCurrency_documento provv_fat((tot_provv.get_num() / 100.0) * perc, *this); // Provvigione sul fatturato (rata 0)
TCurrency_documento provv_fat((tot_provv.get_num() / CENTO) * perc, *this); // Provvigione sul fatturato (rata 0)
TCurrency_documento provv_pag = tot_provv - provv_fat; // Provvigione sul pagato (da suddivere secondo il pagamento)
const bool valuta = in_valuta();
@ -1709,7 +1709,7 @@ void TDocumento::calc_provvigione(TProvvigioni_agente & provv, const TString & k
//
// Un anticipo su di una nota di credito non dovrebbe comunque mai esistere, non ha senso.
// Se esiste è un errore in inserimento da parte del cliente.
if (anticipo.get_num() < abs(tot_doc.get_num()))
if ((double)anticipo.get_num() < abs(tot_doc.get_num()))
{
TGeneric_distrib d(anticipo.get_num(), decimals());

View File

@ -644,7 +644,7 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
real & r = stack.peek_real();
if (_doc)
r = _doc->spese_incasso(real(r - _doc->ritenute()), ndec, netto ? _netto : _lordo);
r = _doc->spese_incasso(real(r - (const real)_doc->ritenute()), ndec, netto ? _netto : _lordo);
else
r = ZERO;
}
@ -925,7 +925,7 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
TString80 s;
if (_doc && scontoexpr2perc(_doc->get(DOC_SCONTOPERC), FALSE, s, val) && val != ZERO)
val = 1 - val;
val = UNO - val;
stack.push(val);
}
break;

View File

@ -2781,7 +2781,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
const real totdocval(head.get(MOV_TOTDOCVAL));
const bool in_valuta = cambio.in_valuta();
const bool swapped = !in_valuta && test_swap();
const TCurrency_documento td((in_valuta ? totdocval : totdoc) * (swapped ? -1 : 1), doc);
const TCurrency_documento td((in_valuta ? totdocval : totdoc) * (swapped ? -UNO : UNO), doc);
partita.put(PART_IMPTOTDOC, totdoc);
@ -2797,7 +2797,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
real imposte;
for (int j = _movimento->iva_items()-1; j >= 0; j--)
imposte += _movimento->iva(j).get_real(RMI_IMPOSTA) * (swapped ? -1 : 1);
imposte += _movimento->iva(j).get_real(RMI_IMPOSTA) * (swapped ? -UNO : UNO);
if (_caus->iva() == iva_acquisti) // Ricalcola precisamente il totale imposte
{
real ti = imposte;

View File

@ -626,7 +626,7 @@ void TGenerazione_effetti::generate_bill(TDocumento& doc, bool interattivo) // b
if (data.empty())
data = doc.get(DOC_DATADOC);
const real tot = doc.totale_doc() - doc.ritenute();
const real tot = doc.totale_doc() - doc.ritenute();
const TCurrency_documento totale_fatt(tot, doc); // Importo in valuta
const TCurrency_documento imppagato(doc.get_real(DOC_IMPPAGATO), doc); // Anticipo pagamento
if (totale_fatt > imppagato && !doc.get_bool(DOC_ACCSALDO)) // procede se non e' a saldo
@ -674,7 +674,7 @@ void TGenerazione_effetti::generate_bill(TDocumento& doc, bool interattivo) // b
effetto.put(EFF_DATASCAD, pag.data_rata(i));
effetto.put(EFF_TIPOPAG,pag.tipo_rata(i));
effetto.put(EFF_ULTCLASS,pag.ulc_rata(i));
effetto.put(EFF_MANDATO,doc.get(DOC_MANDATO));
effetto.put(EFF_MANDATO,doc.get(DOC_MANDATO));
effetto.put(EFF_TIPOCF, tipocf);
effetto.put(EFF_CODCF, codcf);
effetto.put(EFF_CODVAL, codval);

View File

@ -144,7 +144,7 @@ TDocumento_mask::TDocumento_mask(const char* td)
set_field_handler( F_CODCF, clifo_handler );
set_field_handler( F_CODPAG, condpag_hndl );
set_field_handler( F_DATAINSC, condpag_hndl );
set_field_handler( F_MANDATO, mandato_hndl );
set_field_handler( F_MANDATO, mandato_hndl );
set_field_handler( F_CODNOTE, note_hndl );
set_field_handler( F_DATADOC, data_hndl );
set_field_handler( F_CODLIST, codlist_handler );

View File

@ -296,14 +296,19 @@ bool condpag_hndl( TMask_field& field, KEY key )
TMask_field* mandato = m.find_by_id(F_MANDATO);
if (mandato != NULL)
{
if (is_rid && main_app().has_module(EFAUT) && m.get_long(F_CODCF))
if (is_rid && main_app().has_module(EFAUT) && !m.field(F_CODCF).empty())
{
mandato->enable();
mandato->check_type(CHECK_REQUIRED);
TString query; query << "USE &EFMAN SELECT I0=" << m.get_long(F_CODCF);
TISAM_recordset man(query);
if (man.items() == 1)
m.set(F_MANDATO, man.get("CODTAB").as_string(), 0x3);
if (m.insert_mode() && mandato->empty())
{
TString query;
query << "USE &EFMAN SELECT I0=" << m.get_long(F_CODCF);
TISAM_recordset man(query);
if (man.items() == 1)
m.set(F_MANDATO, man.get("CODTAB").as_string(), 0x3);
}
}
else
{
@ -870,10 +875,10 @@ bool pricerange_handler(TMask_field& f, KEY key )
}
else
{
real inf = old_price * (UNO - (decr/CENTO));
real inf = old_price * (UNO - ((real)decr/CENTO));
if (inf > new_price && !yesno_box("Il prezzo è diminuito di più del %d%%, confermare", decr))
return false;
real sup = old_price * (UNO + (incr/CENTO));
real sup = old_price * (UNO + ((real)incr/CENTO));
if (sup < new_price && !yesno_box("Il prezzo è aumentato di più del %d%%, confermare", incr))
return false;
}
@ -2257,13 +2262,13 @@ bool qtaart_handler( TMask_field& f, KEY key )
if (doc.tipo().check_giac())
{
const real giac = mask.get(F_CURGIAC);
if (giac < -(c.sgn(s_giac) * qta) && !yesno_box("Attenzione giacenza negativa: si desidera continuare?"))
if (giac < -((real)c.sgn(s_giac) * qta) && !yesno_box("Attenzione giacenza negativa: si desidera continuare?"))
return false;
} else
if (doc.tipo().check_disp())
{
const real disp = mask.get(F_CURDISP);
if (disp < -(c.sgn(s_giac) * qta) && !yesno_box("Attenzione disponibilità negativa: si desidera continuare?"))
if (disp < -((real)c.sgn(s_giac) * qta) && !yesno_box("Attenzione disponibilità negativa: si desidera continuare?"))
return false;
}
}