Pārlūkot izejas kodu

Merge branch 'dev'

prodstable
Guillaume Bourgeois pirms 2 gadiem
vecāks
revīzija
0d1605c239
2 mainītis faili ar 6 papildinājumiem un 6 dzēšanām
  1. +3
    -3
      common/helpers/Price.php
  2. +3
    -3
      common/models/Order.php

+ 3
- 3
common/helpers/Price.php Parādīt failu

@@ -64,9 +64,9 @@ class Price
return $priceWithoutTax + $vat;
}

public static function getVat($priceTotalWithoutTax, $taxRate, $taxCalculationMethod = Document::TAX_CALCULATION_METHOD_DEFAULT)
public static function getVat($priceWithoutTax, $taxRate, $taxCalculationMethod = Document::TAX_CALCULATION_METHOD_DEFAULT)
{
$vat = $priceTotalWithoutTax * $taxRate;
$vat = $priceWithoutTax * $taxRate;

if($taxCalculationMethod == Document::TAX_CALCULATION_METHOD_SUM_OF_ROUNDINGS) {
$vat = self::round($vat);
@@ -80,4 +80,4 @@ class Price
return number_format(( ($number * 100)) / 100, 2) ;
}

}
}

+ 3
- 3
common/models/Order.php Parādīt failu

@@ -278,10 +278,10 @@ class Order extends ActiveRecordCommon
$productOrder->taxRate->value,
$taxCalculationMethod
) * $productOrder->quantity;
$this->addVat($typeTotal, $price * $productOrder->quantity, $productOrder->taxRate, $taxCalculationMethod);
$this->addVat($typeTotal, $price, $productOrder->quantity, $productOrder->taxRate, $taxCalculationMethod);
}

public function addVat($typeTotal, $priceTotalWithoutTax, $taxRate, $taxCalculationMethod)
public function addVat($typeTotal, $priceWithoutTax, $quantity, $taxRate, $taxCalculationMethod)
{
$fieldName = $this->getFieldNameAmount($typeTotal, 'vat');

@@ -289,7 +289,7 @@ class Order extends ActiveRecordCommon
$this->$fieldName[$taxRate->id] = 0;
}

$this->$fieldName[$taxRate->id] += Price::getVat($priceTotalWithoutTax, $taxRate->value, $taxCalculationMethod);
$this->$fieldName[$taxRate->id] += Price::getVat($priceWithoutTax, $taxRate->value, $taxCalculationMethod) * $quantity;
}

public function getTotalVat($typeTotal = self::AMOUNT_TOTAL)

Notiek ielāde…
Atcelt
Saglabāt