View Issue Details

IDProjectCategoryView StatusLast Update
0002442OXID eShop (all versions)1.02. Price calculations (discounts, coupons, additional costs etc.)public2012-12-07 15:19
Reportertjungcl 
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.5.0_beta1 
Target VersionFixed in Version4.5.1 revision 38045 
Summary0002442: Netto ist rounded in brutto mode
DescriptionIn class oxprice the static function
    netto2brutto($dNetto, $dVat)
rounds the given $dNetto, than adds the $dVat.

- Rounding the netto is correct, if _blNetPriceMode is true, else it can result in differing bruttoprices.

- netto2brutto is static, so it cant access $this->_blNetPriceMode, so it has no possibility to decide, if netto has to be rounded or not.

- netto2brutto is used at two places:
   - oxprice->_recalculate, inside the (_blNetPriceMode) case, just after rounding the netto. --> so netto is already rounded.
   - oxprice->setUserVat, inside (!_blNetPriceMode) case, where the netto must not be rounded (but it will in netto2brutto).

--> so if you just dont round the netto within netto2brutto, in nettomode all is still correct, and in bruttomode the netto no longer gets rounded.

===========
The same problem, just harmless:

The static function brutto2netto rounds the brutto before calculating the netto.
This is only correct in bruttomode, otherwise it must not be rounded.
Fortunatelly the function brutto2netto is only called twice, and in both cases in bruttomode.

Nevertheless the static funtion brutto2netto should not round anything - it is static and so it cant access $this->_blNetPriceMode, so it cant know if to round or not.
Instead the function recalculate should round brutto in bruttomode (which it doesnt), before calling brutto2netto.

Additional Informationin the documentation for this method is an error:
the docu says:
     Converts Netto price to Brotto
     using formula:
     X = $dBrutto + $dVat%
     returns X

In fact the formula at the moment is
     X = round($dNetto) + $dVat%
and it should be
     X = $dNetto + $dVat%
as stated above.
TagsVAT
Theme
BrowserAll
PHP Versionany
Database Versionany

Activities

sarunas_valaskevicius

2011-04-28 14:11

reporter   ~0004412

fixed in oxprice