@foreach($bills as $bill) @php $isNewBill = isset($bill->rounding_amount) && !is_null($bill->rounding_amount) && $bill->rounding_amount != 0; if ($isRoundingEnabled) { if ($isNewBill) { $finalGrandTotal = $bill->grandtotal; $roundValue = $bill->rounding_amount; } else { $grandAmount = $bill->grandtotal; $ceilAmount = ceil($grandAmount); $floorAmount = floor($grandAmount); $roundValue = $ceilAmount - $grandAmount; $finalGrandTotal = ($roundValue > 0 && $roundValue <= 0.50) ? $ceilAmount : $floorAmount; } } else { $finalGrandTotal = $isNewBill ? $bill->grandtotal - $bill->rounding_amount : $bill->grandtotal; $roundValue = 0; } $fuelAmount = ($bill->amount * $bill->fchpercent)/100; $totAmount = $bill->amount + $fuelAmount; $parcels = DB::table('bills as bl') ->leftJoin('parcels as p','p.client_id','=','bl.clientid') ->leftJoin('receivers as r','r.id','=','p.receiver_id') ->where(['bl.id'=>$bill->id, 'p.bill_id'=>$bill->id, 'p.is_international'=>0, 'bl.branch_id'=>$branchId]) ->where(DB::raw('DATE_FORMAT(p.date,"%Y-%m")'), '=', DB::raw("'$month'")) ->select([DB::raw('SUM(p.net_amt) as total_amount')])->get(); $all_parcels = DB::table('bills as bl') ->leftJoin('parcels as p','p.client_id','=','bl.clientid') ->leftJoin('receivers as r','r.id','=','p.receiver_id') ->leftJoin('centers as c','c.id','=','p.center_id') ->leftJoin('carriers as car','car.id','=','p.carrier_id') ->leftJoin('clients as clnt','clnt.id','=','bl.clientid') ->leftJoin('default_packagetypes as dp','dp.id','=','p.package_type') ->where(['bl.id'=>$bill->id, 'p.bill_id'=>$bill->id, 'p.is_international'=>0, 'bl.branch_id'=>$branchId]) ->where(DB::raw('DATE_FORMAT(p.date,"%Y-%m")'), '=', DB::raw("'$month'")) ->select([ 'p.net_amt', 'p.weight', 'dp.name as dp_name', 'p.consignment_no', 'r.name as receiver_name', 'c.name as city_name', 'car.name as carrier_name', 'p.date', 'p.insurance_amt', 'clnt.weight_in_mails as clientWeight', 'clnt.charge_in_mails as clientCharge', ])->orderBy('p.date')->orderBy('p.consignment_no')->get(); $totalAmount = isset($parcels[0]) ? $parcels[0]->total_amount : 0; $grandAlount = $bill->grandtotal; $final_value = number_format((float)($totalAmount - $bill->amount), 2); if ($final_value > 0) { $value = 'Positive'; } else { $value = 'Negative'; } sleep(1); @endphp
M/S. {{@$branch['name']}}

{{@$branch['address']}}, {{@$branch['city']}} - {{@$branch['zipcode']}}

Phone : {{@$branch['contact_no']}}

ESTIMATION

: {{$bill->billno}}
: {{date("d/m/Y", strtotime($bill->created_at))}}

: 996812
: {{strtoupper(date("d/m/Y", strtotime($bill->start_date)))}}
: {{strtoupper(date("d/m/Y", strtotime($bill->end_last)))}}
: M/S. {{$bill->name}}

{{@$bill->address1.' '.@$bill->address2.' '.@$bill->city}}

@if(count($all_parcels) > 0) @php $srno = 1; $total_weight = $total_booking_amount = 0; @endphp @foreach($all_parcels as $parcels) @php $srno++; $total_weight = $total_weight+ @$parcels->weight; $total_booking_amount = $total_booking_amount+ @$parcels->net_amt; @endphp @endforeach @endif @if($value == 'Positive') @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif
Sl Consignment Number Booking Date Destination City Weight Gm Amount Rs. Ps.
{{$srno}} {{@$parcels->consignment_no}} {{date("d/m/Y", strtotime(@$parcels->date))}} {{@$parcels->city_name}} {{@$parcels->weight}} {{Laracore::showPrice(@$parcels->net_amt)}}
TOTAL {{$total_weight}} {{Laracore::showPrice($total_booking_amount)}}
TOTAL {{Laracore::showPrice($bill->amount)}}
Discount - {{ Laracore::showPrice($totalAmount - $bill->amount) }}
Fuel Surcharge {{Laracore::showPrice(($bill->amount * $bill->fchpercent)/100)}}
Sub Total {{Laracore::showPrice($totAmount)}}
Round Of {{Laracore::showPrice($roundValue)}}
Total {{ Laracore::showPrice($finalGrandTotal) }}
: {{ getIndianCurrency($finalGrandTotal) }}
: PLEASE ISSUE CHEQUE IN FAVOUR OF M/S. {{@$branch['name']}}

Bank Details

{{@$branch['bank_address']}} A/C. No. - {{@$branch['bank_acno']}} IFSC CODE - {{@$branch['ifsc_code']}}

For, {{@$branch['name']}}

Authorised Signatory
@endforeach