@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; } $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.net_amt', 'p.weight', 'dp.name as dp_name', 'dp.weight_type as weight_type', 'p.consignment_no', 'r.name as receiver_name', 'c.name as city_name', 'p.remakrs', '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((double)($totalAmount - $bill->amount), 2); if ($final_value > 0) { $value = 'Positive'; } else { $value = 'Negative'; } sleep(2); @endphp
@if(count($all_parcels) > 0) @endif

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

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

TAX INVOICE (ORIGINAL FOR RECIPIENT)

Consignor Details
GSTIN : {{@$bill->gstno}}
PAN No :
Place of Supply
NAME : {{$bill->name}}
ADDRESS : {{@$bill->address1.' '.@$bill->address2.' '.@$bill->city}}
State Name : {{@$bill->state}}
Tax Details
SAC - SERVICE DESCRIPTION : 996812 - COURIER SERVICE
GST NO : {{@$branch['gstno']}}
STATE - STATE CODE : {{ (@$branch['gstno']) ? substr(@$branch['gstno'],0,2) : '' }}
Bill Details
BILL NO : {{$bill->billno}}
BILL DATE : {{date("d/m/Y", strtotime($bill->created_at))}}
PERIOD : {{strtoupper(date("d/m/Y", strtotime($bill->start_date)))}} ~ {{strtoupper(date("d/m/Y", strtotime($bill->end_last)))}}
PO NO. / VENDOR CODE : - / -
@php $previousDate = ''; $skipDate = false; $dayAmountTotal = 0; $srno = 1; @endphp @foreach($all_parcels as $parcels) @php $checkDate = strtotime(@$parcels->date); if ($previousDate != '' && $previousDate == $checkDate) { $skipDate = true; // $dayAmountTotal = $dayAmountTotal + $parcels->net_amt; } else { $skipDate = false; $previousDate = $checkDate; // $dayAmountTotal = $dayAmountTotal + $parcels->net_amt; } @endphp @if($skipDate == false) @endif @php $srno++; @endphp {{-- @if($skipDate == false) @endif --}} @endforeach
Date
No. Consignee Address Doc No. Package Type Remarks Weight Freight Charges
{{date("d/m/Y", strtotime(@$parcels->date))}}
{{$srno}} {{@$parcels->receiver_name}} {{@$parcels->city_name}} {{@$parcels->consignment_no}} {{@$parcels->dp_name}} {{@$parcels->remakrs}} {{@$parcels->weight}} {{strtoupper(@$parcels->weight_type)}} {{Laracore::showPrice(@$parcels->net_amt)}}
Day Total : ₹ {{Laracore::showPrice($dayAmountTotal)}}
Bank Name: {{@$branch['bank_address']}}
Account No.: {{@$branch['bank_acno']}}
IFSC Code: {{@$branch['ifsc_code']}}
MICR Code: {{@$branch['micr_code']}}
@if($value == 'Positive') @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif
Gross Total ++: ₹ {{Laracore::showPrice($bill->amount)}}
Discount: - {{ Laracore::showPrice($totalAmount - $bill->amount) }}
{{$bill->fchpercent}}% Fuel Surcharge: ₹ {{Laracore::showPrice(($bill->amount * $bill->fchpercent)/100)}}
Total value of supply: ₹ {{Laracore::showPrice($totAmount)}}
{{$bill->cgstpercent}}% CGST: ₹ {{Laracore::showPrice(($totAmount * $bill->cgstpercent)/100)}}
{{$bill->sgstpercent}}% SGST/UTGST: ₹ {{Laracore::showPrice(($totAmount * $bill->sgstpercent)/100)}}
{{$bill->igstpercent}}% IGST: ₹ {{Laracore::showPrice(($totAmount * $bill->igstpercent)/100)}}
Round Off (Add): ₹ {{Laracore::showPrice($roundValue)}}
Net Amt: ₹ {{ Laracore::showPrice($finalGrandTotal) }}
@if($branch['bill_terms_and_conditions'] != '') @endif
Amount in Words : {{ getIndianCurrency($finalGrandTotal) }}
For, {{@$branch['name']}}
Please make payment in favor of {{@$branch['name']}}
Remarks: Authorized Signature
    @php $termsAndConditionsArr = explode("\n", str_replace("\r", "", @$branch['bill_terms_and_conditions'])); @endphp @foreach($termsAndConditionsArr as $termsAndConditions)
  • {{$termsAndConditions}}
  • @endforeach
@endforeach