{{ $i }} |
{{ $row['doctor'] }}
|
@php
$total_basic_amount = $total_commission = 0 ;
@endphp
@foreach($row['vouchers'] as $value)
@php
$incentive_setting = !empty($incentive_settings[$value->product_id]) ? $incentive_settings[$value->product_id] : [];
$amount = $value->basic_amount ?? 0 ;
$discount = !empty($value->discount_amount) ? $value->discount_amount : (!empty($value->sale_discount_amount) ? $value->sale_discount_amount : '0');
$amount = $amount - $discount;
$commission = 0 ;
if (!empty($value->calculation_type) && (!empty($value->percentage) || !empty($value->price))) {
$type = $value->calculation_type ?? '' ;
$percentage = $value->percentage ?? 0 ;
$price = $value->price ?? 0 ;
$commission = 0 ;
if ($type == 'quantity') {
$commission = $price;
} else if ($type == 'percentage') {
$commission = ($percentage / 100) * $amount;
}
} else if (!empty($incentive_setting)) {
$type = $incentive_setting->calculation_type != '' ? $incentive_setting->calculation_type : ($incentive_setting->default_calculation_type ?? '') ;
$percentage = $incentive_setting->percentage != '' ? $incentive_setting->percentage : ($incentive_setting->default_percentage ?? '0') ;
$price = $incentive_setting->price != '' ? $incentive_setting->price : ($incentive_setting->default_price ?? '0') ;
$commission = 0 ;
if ($type == 'quantity') {
$commission = $price;
} else if ($type == 'percentage') {
$commission = ($percentage / 100) * $amount;
}
} else if (!empty($incentive_slab)) {
$type = $incentive_slab->calculation_type != '' ? $incentive_slab->calculation_type : '' ;
$percentage = $incentive_slab->percentage != '' ? $incentive_slab->percentage : '0' ;
$price = $incentive_slab->price != '' ? $incentive_slab->price : '0' ;
$commission = 0 ;
if ($type == 'quantity') {
$commission = $price;
} else if ($type == 'percentage') {
$commission = ($percentage / 100) * $amount;
}
}
$total_basic_amount += $amount;
$total_commission += $commission;
@endphp
@endforeach
{{ $total_basic_amount }} |
{{ $total_commission }} |
@php $i++; @endphp
@endforeach
@else