@php $no_of_bills = 0; @endphp @foreach($bills as $bill) @php $no_of_bills = $no_of_bills + 1; $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; } $billAmount = $bill->amount; $serviceChAmount = ($billAmount * $bill->service_charge_percent)/100; $amountAndService = $billAmount + $serviceChAmount; $fuelAmount = ($amountAndService * $bill->fchpercent)/100; $otherChAmount = $bill->other_charge; $totAmount = $amountAndService + $fuelAmount + $otherChAmount; $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.amont', 'p.doc_amt', 'p.oda_amt', 'p.fov_amt', 'p.net_amt', 'p.weight', 'dp.name as dp_name', 'dp.weight_type', 'p.consignment_no', 'r.name as receiver_name', 'c.name as city_name', 'car.name as carrier_name', 'p.date', 'p.insurance_amt', 'p.remakrs', '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
@if($branch['image']) logo @endif

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

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

GST:- {{@$branch['gstno']}}
tax invoice
Bill To: {{$bill->name}} {{@$bill->address1.' '.@$bill->address2.' '.@$bill->city}} GSTIN : {{@$bill->gstno}} Inovice No:{{$bill->billno}} Inovice Date:{{date("d-M-Y", strtotime($bill->created_at))}} Inovice From:{{date("d-M-Y", strtotime($bill->start_date))}} Inovice To:{{date("d-M-Y", strtotime($bill->end_last))}}
{{-- --}} @php $srno = 1; @endphp @foreach($all_parcels as $parcel) @php $net_amount = $parcel->net_amt; $fuel_ch = ($net_amount * $bill->fchpercent) / 100; $fuel_with_net_amount = $net_amount + $fuel_ch; @endphp {{-- --}} @php $srno++; @endphp @endforeach
S.No. Date AWB No. Destination ReceiverPcsWeight Freight Doc Ch Fov Ch Oda Ch Fuel Ch Amount
{{$srno}} {{date("d-M-Y", strtotime(@$parcel->date))}} {{@$parcel->consignment_no}} {{@$parcel->city_name}} {{@$parcel->receiver_name}}3{{@$parcel->weight}} {{strtoupper(@$parcel->weight_type)}} {{Laracore::showPrice(@$parcel->amont + @$parcel->insurance_amt)}} {{Laracore::showPrice(@$parcel->doc_amt)}} {{Laracore::showPrice(@$parcel->oda_amt)}} {{Laracore::showPrice(@$parcel->fov_amt)}} {{Laracore::showPrice(@$fuel_ch)}} {{Laracore::showPrice(@$fuel_with_net_amount)}}
Bank Details:

Beneficiary Name : {{@$branch['name']}}

Account No : {{@$branch['bank_acno']}}

IFSC Code : {{@$branch['ifsc_code']}}

Bank Name : {{@$branch['bank_address']}}

{{--

Branch : Wadala

--}}
@if($value == 'Positive') @endif @if($bill->igstpercent > 0) @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif
Discount : - {{Laracore::showPrice($parcels[0]->total_amount - $bill->amount)}}
Total : {{Laracore::showPrice(@$totAmount)}}
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 Off : {{Laracore::showPrice($roundValue)}}
Net Amount : {{ Laracore::showPrice($finalGrandTotal) }}
Amount in Words : {{ getIndianCurrency($finalGrandTotal) }}
@if($branch['bill_terms_and_conditions'] != '') Terms & Condition @php $termsAndConditionsArr = explode("\n", str_replace("\r", "", @$branch['bill_terms_and_conditions'])); @endphp @foreach($termsAndConditionsArr as $termsAndConditions)

{{$termsAndConditions}}

@endforeach @endif
For {{@$branch['name']}}

Authorized Signature

@endforeach