Patch level : 2.0 564
Files correlati : sv2.exe Ricompilazione Demo : [ ] Commento : Errore gia' segnalato in SV git-svn-id: svn://10.65.10.50/trunk@11416 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
dcacf87142
commit
b6cd17add9
@ -419,13 +419,13 @@ public:
|
||||
|
||||
class TRiga_documento : public TAuto_variable_rectype // velib02
|
||||
{
|
||||
TDocumento * _doc;
|
||||
TDocumento* _doc;
|
||||
static long _firm;
|
||||
static TAssoc_array _tipi;
|
||||
static TAssoc_array _spese;
|
||||
static TAssoc_array _ive;
|
||||
static TCache_articoli * _articoli;
|
||||
bool _iva_calc;
|
||||
static int _iva_calc_mode;
|
||||
|
||||
protected:
|
||||
// @cmember Setta il contenuto del campo <p fieldname> (non tipizzata)
|
||||
@ -498,7 +498,8 @@ public:
|
||||
real sconto() const { return importo(FALSE,FALSE) - importo(TRUE,FALSE); }
|
||||
real iva(int ndec) const;
|
||||
real imponibile(bool lordo = FALSE) const;
|
||||
real imponibile_omaggio() const;
|
||||
real imponibile_omaggio(int iva_calc_mode = 1) const;
|
||||
real iva_omaggio(int ndec, int iva_calc_mode = 1) const;
|
||||
real imposta(bool round = TRUE) const;
|
||||
real provvigione(int ndec = AUTO_DECIMALS) const;
|
||||
|
||||
|
@ -166,15 +166,18 @@ TAssoc_array TRiga_documento::_spese;
|
||||
TAssoc_array TRiga_documento::_ive;
|
||||
TCache_articoli * TRiga_documento::_articoli = NULL;
|
||||
|
||||
// 0=ignora IVA; 1=consedera iva solo se c'e' addebito; 2=considera sempre IVA
|
||||
int TRiga_documento::_iva_calc_mode = 0;
|
||||
|
||||
TRiga_documento::TRiga_documento(TDocumento* doc, const char * tipo)
|
||||
: TAuto_variable_rectype(LF_RIGHEDOC), _doc(doc), _iva_calc(FALSE)
|
||||
: TAuto_variable_rectype(LF_RIGHEDOC), _doc(doc)
|
||||
{
|
||||
if (tipo)
|
||||
set_tipo(tipo);
|
||||
}
|
||||
|
||||
TRiga_documento::TRiga_documento(const TRiga_documento & row)
|
||||
: TAuto_variable_rectype(LF_RIGHEDOC), _doc(NULL), _iva_calc(FALSE)
|
||||
: TAuto_variable_rectype(LF_RIGHEDOC), _doc(NULL)
|
||||
|
||||
{
|
||||
copy(row);
|
||||
@ -182,7 +185,7 @@ TRiga_documento::TRiga_documento(const TRiga_documento & row)
|
||||
|
||||
TRiga_documento::TRiga_documento(const TRiga_documento& rec, TDocumento* doc,
|
||||
const char * tipo)
|
||||
: TAuto_variable_rectype(rec), _doc(doc), _iva_calc(FALSE)
|
||||
: TAuto_variable_rectype(rec), _doc(doc)
|
||||
{
|
||||
if (tipo)
|
||||
set_tipo(tipo);
|
||||
@ -484,7 +487,7 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||
}
|
||||
break;
|
||||
case RIGA_OMAGGI:
|
||||
if (_iva_calc && get_bool("ADDIVA"))
|
||||
if (_iva_calc_mode > 1 || (_iva_calc_mode == 1 && get_bool("ADDIVA")))
|
||||
c = _qtaprezzo;
|
||||
default:
|
||||
break;
|
||||
@ -529,20 +532,29 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||
|
||||
real TRiga_documento::iva(int ndec) const
|
||||
{
|
||||
if (ndec == AUTO_DECIMALS)
|
||||
ndec = doc().decimals();
|
||||
|
||||
((TRiga_documento *) this)->_iva_calc = TRUE;
|
||||
const real zanicchi = is_sconto() ? ZERO : iva().imposta(imponibile(), ndec);
|
||||
((TRiga_documento *) this)->_iva_calc = FALSE;
|
||||
real zanicchi;
|
||||
if (!is_sconto())
|
||||
{
|
||||
if (ndec == AUTO_DECIMALS)
|
||||
ndec = doc().decimals();
|
||||
zanicchi = is_omaggio() ? iva_omaggio(ndec) : iva().imposta(imponibile(), ndec);
|
||||
}
|
||||
return zanicchi;
|
||||
}
|
||||
|
||||
real TRiga_documento::imponibile_omaggio() const
|
||||
real TRiga_documento::iva_omaggio(int ndec, int tipo_iva_calc) const
|
||||
{
|
||||
if (ndec == AUTO_DECIMALS)
|
||||
ndec = doc().decimals();
|
||||
const real zanicchi = iva().imposta(imponibile_omaggio(tipo_iva_calc), ndec);
|
||||
return zanicchi;
|
||||
}
|
||||
|
||||
real TRiga_documento::imponibile_omaggio(int tipo_iva_calc) const
|
||||
{
|
||||
((TRiga_documento *) this)->_iva_calc = TRUE;
|
||||
const real imp = imponibile();
|
||||
((TRiga_documento *) this)->_iva_calc = FALSE;
|
||||
_iva_calc_mode = tipo_iva_calc;
|
||||
const real imp = imponibile();
|
||||
_iva_calc_mode = 0;
|
||||
return imp;
|
||||
}
|
||||
|
||||
@ -552,7 +564,7 @@ real TRiga_documento::imponibile(bool lordo) const
|
||||
if (field.not_empty())
|
||||
{
|
||||
real r;
|
||||
if (is_omaggio() && _iva_calc)
|
||||
if (is_omaggio() && _iva_calc_mode > 0)
|
||||
{
|
||||
TDocumento_variable_field * f = (TDocumento_variable_field *) variable_field(field);
|
||||
CHECKS(f, "Field UNKNOWN : ", field);
|
||||
|
Loading…
x
Reference in New Issue
Block a user