Sales Report
{{date('d-m-Y',strtotime($startdate))}} To {{date('d-m-Y',strtotime($enddate))}}
{{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} @php $totalAmount1 = 0; $totalBill1 = 0; $third_party_cost1 = 0; $bandwidth_cost1 = 0; $entertainment_cost1 = 0; $bandwith1 = 0; $facebook1 = 0; $youtube1 = 0; $bdix1 = 0; $dataMB1 = 0; $totalBandwithG1 = 0; $totalUp = 0; $totalDown = 0; @endphp @php $upgradeResult1 = DB::table('tbl_customer_updowngrade as ug') ->select('ug.*','ac.company_name','ac.billing_address','ac.otc_cost','ac.installing_cost','ac.security_money','ac.third_party_cost','ac.bandwidth_cost','ac.entertainment_cost','users.name') ->leftJoin('tbl_customer_registration as ac','ac.id','=','ug.cu_id') ->leftJoin('users','users.id','=','ug.create_by') ->where('ug.status',2); if($type=='All') { $upgradeResult = $upgradeResult1->whereBetween('ug.effective_date',[$startdate,$enddate]) ->get(); }else{ $upgradeResult = $upgradeResult1->where('ug.create_by', $type) ->whereBetween('ug.effective_date',[$startdate,$enddate]) ->get(); } @endphp @foreach ($upgradeResult as $key => $val) @php $totalAmount1 += ($val->cu_bandwith * $val->cu_bandwith_price) + ($val->cu_youtube * $val->cu_youtube_price) + ($val->cu_facebook * $val->cu_facebook_price) + ($val->cu_data * $val->cu_data_price) + ($val->cu_bdix * $val->cu_bdix_price); $third_party_cost1 += $val->third_party_cost; $bandwidth_cost1 += $val->bandwidth_cost; $entertainment_cost1 += $val->entertainment_cost; $totalBandwith1 = $val->cu_bandwith + $val->cu_facebook + $val->cu_youtube + $val->cu_bdix + $val->cu_data; $bandwith1 += $val->cu_bandwith; $facebook1 += $val->cu_facebook; $youtube1 += $val->cu_youtube; $bdix1 += $val->cu_bdix; $dataMB1 += $val->cu_data; $totalBandwithG1 += $totalBandwith1; $billSubUpGrade = 0 ; if(($val->type_bandwith == 'upgrade') || ($val->type_bandwith == '')){ $billSubUpGrade += ($val->cu_bandwith * $val->cu_bandwith_price); } if(($val->type_youtube == 'upgrade') || ($val->type_youtube == '')){ $billSubUpGrade += ($val->cu_youtube * $val->cu_youtube_price); } if(($val->type_facebook == 'upgrade') || ($val->type_facebook == '')){ $billSubUpGrade += ($val->cu_facebook * $val->cu_facebook_price); } if(($val->type_bdix == 'upgrade') || ($val->type_bdix == '')){ $billSubUpGrade += ($val->cu_bdix * $val->cu_bdix_price); } if(($val->type_data == 'upgrade') || ($val->type_data == '')){ $billSubUpGrade += ($val->cu_data * $val->cu_data_price); } $billSubDownGrade = 0 ; if(($val->type_bandwith == 'downgrade')){ $billSubDownGrade += ($val->cu_bandwith * $val->cu_bandwith_price); } if(($val->type_youtube == 'downgrade')){ $billSubDownGrade += ($val->cu_youtube * $val->cu_youtube_price); } if(($val->type_facebook == 'downgrade')){ $billSubDownGrade += ($val->cu_facebook * $val->cu_facebook_price); } if(($val->type_bdix == 'downgrade')){ $billSubDownGrade += ($val->cu_bdix * $val->cu_bdix_price); } if(($val->type_data == 'downgrade')){ $billSubDownGrade += ($val->cu_data * $val->cu_data_price); } $rowWiseBillAmount = $billSubUpGrade !=0 ? $billSubUpGrade - $billSubDownGrade : $billSubDownGrade; $rowWiseProfitAmount = $val->flag == 'new' ? $rowWiseBillAmount - ($val->third_party_cost + $val->bandwidth_cost + $val->entertainment_cost) : $rowWiseBillAmount ; $totalUp += $billSubUpGrade - ($val->third_party_cost + $val->bandwidth_cost + $val->entertainment_cost); $totalDown += $billSubDownGrade; @endphp {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} @endforeach @php $finalA = ($totalUp - $totalDown); $x = explode(".",$finalA); $finalAmount = $x[0]; //+ 1; @endphp
SL Month Customer Address KAM InternetUnit PriceFacebookUnit PriceYoutubeUnit PriceBDIXUnit PriceDataUnit PriceTotal Bandwidth Bill Third Party Cost Bandwidth Cost Commission Cost Profit Type
{{ $key+1 }} {{ date('M',strtotime($val->effective_date)) }} {{ $val->company_name }} {{ $billSubUpGrade }} {{ $val->billing_address }} {{ $val->name }} {{ $val->cu_bandwith != "" ? $val->cu_bandwith : "0" }} MB
{{ $val->cu_bandwith_price }}
{{ $val->cu_bandwith_price }}{{ $val->cu_facebook != "" ? $val->cu_facebook : "0" }} MB
{{ $val->cu_facebook_price }}
{{ $val->cu_facebook_price }}{{ $val->cu_youtube != "" ? $val->cu_youtube : "0" }} MB
{{ $val->cu_youtube_price }}
{{ $val->cu_youtube_price }}{{ $val->cu_bdix != "" ? $val->cu_bdix : "0" }} MB
{{ $val->cu_bdix_price }}
{{ $val->cu_bdix_price }}{{ $val->cu_data != "" ? $val->cu_data : "0" }} MB
{{ $val->cu_data_price }}
{{ $val->cu_data_price }} {{ $totalBandwith1 }} MB {{ number_format($rowWiseBillAmount) }} {{ $val->flag == 'new' ? $val->third_party_cost : null }} {{ $val->flag == 'new' ? $val->bandwidth_cost : null }} {{ $val->flag == 'new' ? $val->entertainment_cost : null }} {{ number_format($rowWiseProfitAmount) }} {{$val->flag}}
Total : {{ $bandwith1 }} MB {{ $facebook1 }} MB {{ $youtube1 }} MB {{ $bdix1 }} MB {{ $dataMB1 }} MB {{ $totalBandwithG1 }} MB {{ number_format($finalAmount) }} {{ number_format($third_party_cost1) }} {{ number_format($bandwidth_cost1) }} {{ number_format($entertainment_cost1) }} {{ number_format($totalUp - ($totalDown + $third_party_cost1 + $bandwidth_cost1 + $entertainment_cost1)) }}