|
|
|
|
|
|
|
|
$productOrder->taxRate->value, |
|
|
$productOrder->taxRate->value, |
|
|
$taxCalculationMethod |
|
|
$taxCalculationMethod |
|
|
) * $productOrder->quantity; |
|
|
) * $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'); |
|
|
$fieldName = $this->getFieldNameAmount($typeTotal, 'vat'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->$fieldName[$taxRate->id] = 0; |
|
|
$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) |
|
|
public function getTotalVat($typeTotal = self::AMOUNT_TOTAL) |