|
|
@@ -180,19 +180,16 @@ class ProducerAdminController extends BackendController |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
public function actionProducerInstallTaxUpdatePrices($idProducer, $idTaxRate) |
|
|
|
public function actionProducerInstallTaxUpdatePrices($idProducer) |
|
|
|
{ |
|
|
|
$taxRate = TaxRate::searchOne([ |
|
|
|
'id' => $idTaxRate |
|
|
|
]) ; |
|
|
|
|
|
|
|
// product |
|
|
|
$productsArray = Product::searchAll([ |
|
|
|
'id_producer' => $idProducer |
|
|
|
]) ; |
|
|
|
|
|
|
|
foreach($productsArray as $product) { |
|
|
|
$product->price = $product->price / (1 + $taxRate->value) ; |
|
|
|
$product->price = $product->price / (1 + $product->taxRate->value) ; |
|
|
|
$product->save() ; |
|
|
|
} |
|
|
|
|
|
|
|
// product_order |
|
|
@@ -201,7 +198,7 @@ class ProducerAdminController extends BackendController |
|
|
|
]) ; |
|
|
|
foreach($ordersArray as $order) { |
|
|
|
foreach($order->productOrder as $productOrder) { |
|
|
|
$productOrder->price = $productOrder->price / (1 + $taxRate->value) ; |
|
|
|
$productOrder->price = $productOrder->price / (1 + $productOrder->taxRate->value) ; |
|
|
|
$productOrder->save() ; |
|
|
|
} |
|
|
|
} |
|
|
@@ -212,7 +209,7 @@ class ProducerAdminController extends BackendController |
|
|
|
]) ; |
|
|
|
foreach($subscriptionsArray as $subscription) { |
|
|
|
foreach($subscription->productSubscription as $productSubscription) { |
|
|
|
$productSubscription->price = $productSubscription->price / (1 + $taxRate->value) ; |
|
|
|
$productSubscription->price = $productSubscription->price / (1 + $productSubscription->taxRate->value) ; |
|
|
|
$productSubscription->save() ; |
|
|
|
} |
|
|
|
} |