refactor
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user