@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'=>1, '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('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'=>1, 'bl.branch_id'=>$branchId]) ->whereBetween('p.date', array($bill->start_date, $bill->end_last)) ->select([ 'p.id as parcel_id', 'p.net_amt', 'p.amont', 'p.weight', 'dp.name as dp_name', 'p.consignment_no', 'r.name as receiver_name', 'c.name as city_name', 'p.date', 'p.insurance_amt', 'p.fuel_charge', 'clnt.weight_in_mails as clientWeight', 'clnt.charge_in_mails as clientCharge', ])->orderBy('p.date')->orderBy('p.consignment_no')->get(); $final_value = number_format((double)($parcels[0]->total_amount - $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']}}
GST Number : {{@$branch['gstno']}}

INVOICE

: {{@$branch['gstno']}}
: {{$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}}

GST Number : {{@$bill->gstno}}
@if(count($all_parcels) > 0) @php $srno = 1; $total_weight = $total_booking_amount = $parcel_fuel_amount = 0; @endphp @foreach($all_parcels as $parcel) @php $srno++; $total_weight = $total_weight+ @$parcel->weight; $total_booking_amount = $total_booking_amount+ @$parcel->net_amt - (($parcel->amont * $parcel->fuel_charge)/100); $parcel_fuel_amount = $parcel_fuel_amount + ($parcel->amont * $parcel->fuel_charge)/100; @endphp @endforeach @endif @if($value == 'Positive') @endif @if($bill->igstpercent != 0) @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif
Sl Consignment Number Booking Date Destination City Weight Gm Amount Rs. Ps.
{{$srno}} {{$parcel->consignment_no}} {{date("d/m/Y", strtotime(@$parcel->date))}} {{@$parcel->city_name}} {{@$parcel->weight}} {{Laracore::showPrice(@$parcel->net_amt - (($parcel->amont * $parcel->fuel_charge)/100))}}
TOTAL {{$total_weight}} {{Laracore::showPrice($total_booking_amount)}}
TOTAL {{Laracore::showPrice($total_booking_amount)}}
Discount {{Laracore::showPrice($parcels[0]->total_amount - $bill->amount)}}
Fuel Surcharge {{Laracore::showPrice(@$parcel_fuel_amount)}}
Sub Total {{Laracore::showPrice($bill->amount)}}
CGST({{$bill->cgstpercent}}%) {{Laracore::showPrice(($totAmount * $bill->cgstpercent)/100)}}
SGST({{$bill->sgstpercent}}%) {{Laracore::showPrice(($totAmount * $bill->sgstpercent)/100)}}
IGST({{$bill->igstpercent}}%) {{Laracore::showPrice(($totAmount * $bill->igstpercent)/100)}}
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