This commit is contained in:
Bilal Catic
2018-10-29 13:59:10 +01:00
parent bc39a69b7a
commit d2ce84b3fb
3 changed files with 6 additions and 33 deletions

View File

@@ -50,29 +50,14 @@ function wiaas_get_price_margin($fixed_price, $principal_amount, $total_cost) {
return $total_gain - $total_cost;
}
function wiaas_get_package_hardware_procurement_cost($package) {
function wiaas_get_package_product_procurement_cost($package){
$bundled_items = $package->get_bundled_items();
$total_cost = 0;
foreach ($bundled_items as $bundled_item) {
$product = $bundled_item->product;
if (Wiaas_Product_Category::get_category($product) === 'hardware') {
$total_cost += Wiaas_Pricing::get_product_total_cost($product) * $bundled_item->get_quantity();
}
}
return $total_cost;
}
function wiaas_get_package_software_procurement_cost($package) {
$bundled_items = $package->get_bundled_items();
$total_cost = 0;
foreach ($bundled_items as $bundled_item) {
$product = $bundled_item->product;
if (Wiaas_Product_Category::get_category($product) === 'software') {
if (Wiaas_Product_Category::is_product($product)) {
$total_cost += Wiaas_Pricing::get_product_total_cost($product) * $bundled_item->get_quantity();
}
}