$factor = 0;
     $discount = Product::calculateDiscount($price_uvp, $price_selling);
     $net_price = Product::calculateNetPrice($price_selling, VAT);
     $profit = Product::calculateProfit($net_price, $cogs);
     $margin = Product::calculateMargin($profit, $net_price);
     $premium = Product::calculatePremium($price_selling, $cogs);
 } else {
     if ($sp_type == 'B2B-ND') {
         $factor = Product::calculateFactor($price_uvp, $price_selling);
         $discount = 0;
         $net_price = $price_selling;
         $profit = Product::calculateProfit($net_price, $cogs);
         $margin = Product::calculateMargin($profit, $net_price);
         $premium = Product::calculatePremium($price_selling, $cogs);
     } else {
         $factor = Product::calculateFactor($price_uvp, $price_selling);
         $discount = Product::calculateDiscount($b2b_price_selling_old, $price_selling);
         $net_price = $price_selling;
         $profit = Product::calculateProfit($net_price, $cogs);
         $margin = Product::calculateMargin($profit, $net_price);
         $premium = Product::calculatePremium($price_selling, $cogs);
     }
 }
 $margin_text = Product::displayMargin($price_selling, $margin);
 $result = array();
 $result['target_id'] = $target_id;
 $result['column_count'] = $column_count;
 $result['factor'] = $factor == 0 ? '-' : $factor;
 $result['discount'] = $discount == 0 ? '-' : $discount . '%';
 $result['cogs'] = $cogs;
 $result['profit'] = $profit;