@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]) ->whereBetween('p.date', array($bill->start_date, $bill->end_last)) ->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, 'is_period'=>1]) ->whereBetween('p.date', array($bill->start_date, $bill->end_last)) ->select([ 'p.net_amt', 'p.weight', 'p.number_of_box', '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.remakrs', '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((double)($totalAmount - $bill->amount), 2); if ($final_value > 0) { $value = 'Positive'; } else { $value = 'Negative'; } sleep(1); @endphp

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

{{@$branch['person_name']}}

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

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

Estimation

Name: {{$bill->name}}

Bill Duration:

{{strtoupper(date("d/m/Y", strtotime($bill->start_date)))}} To {{strtoupper(date("d/m/Y", strtotime($bill->end_last)))}}

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

Bill No:

{{$bill->billno}}

Bill Date:

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

@if(count($all_parcels) > 0) @php $total_booking_amount = 0; @endphp @foreach($all_parcels as $parcels) @php $total_booking_amount = $total_booking_amount+ @$parcels->net_amt; @endphp @endforeach
Date Receiver Destination Cons. No. Remark Weight Amout
{{date("d/m/y", strtotime(@$parcels->date))}} {{@$parcels->receiver_name}} {{@$parcels->city_name}} {{@$parcels->consignment_no}} {{@$parcels->remakrs}} {{@$parcels->weight}} @if($parcels->number_of_box != null) ({{$parcels->number_of_box}} Box) @endif {{Laracore::showPrice(@$parcels->net_amt)}}
@endif @if($value == 'Positive') @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif
Gross Amount: {{Laracore::showPrice($total_booking_amount)}}
Discount: - {{ Laracore::showPrice($totalAmount - $bill->amount) }}
Fuel Surcharge: {{$bill->fchpercent}}% {{Laracore::showPrice(($bill->amount * $bill->fchpercent)/100)}}
Net Taxable Amount: {{Laracore::showPrice($totAmount)}}
Round Of: {{Laracore::showPrice($roundValue)}}
Bill Amount: {{ Laracore::showPrice($finalGrandTotal) }}
Rupees: {{ getIndianCurrency($finalGrandTotal) }}
SAC Code: 996812 -- Type of Service: Courier Services For, {{@$branch['name']}}
Remark :
Please Make Payment in favour of
{{@$branch['name']}} Authorised Signature
@if($branch['bill_terms_and_conditions'] != '')
Terms and Conditions
    @php $termsAndConditionsArr = explode("\n", str_replace("\r", "", @$branch['bill_terms_and_conditions'])); @endphp @foreach($termsAndConditionsArr as $termsAndConditions)
  • {{$termsAndConditions}}
  • @endforeach
@endif
@endforeach