@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; $otherChAmount = $bill->other_charge; $totAmount = $amountAndService + $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'=>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'), DB::raw('SUM(p.insurance_amt) as total_ins_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'=>1, 'bl.branch_id'=>$branchId]) ->whereBetween('p.date', array($bill->start_date, $bill->end_last)) ->select([ 'p.net_amt', 'p.amont', 'p.weight', 'dp.name as dp_name', 'dp.weight_type as weight_type', 'p.consignment_no', 'p.number_of_box', 'r.name as receiver_name', 'c.name as city_name', 'car.name as carrier_name', 'p.date', 'p.insurance_amt', 'p.fuel_charge', 'p.ess_charge', 'p.remakrs', 'clnt.weight_in_mails as clientWeight', 'clnt.charge_in_mails as clientCharge', DB::raw('(SELECT SUM(parcel_charges.charge_amount) FROM parcel_charges WHERE parcel_charges.parcel_id = p.id) as total_other_charges_amount'), ])->orderBy('p.date')->orderBy('p.consignment_no')->get(); $data = array(); $total_fuel_for_main_bill = 0; foreach ($all_parcels as $parcel) { $parcel_array = array(); $parcel_array['receiver'] = $parcel->receiver_name; $parcel_array['center'] = $parcel->city_name; $parcel_array['carrier'] = $parcel->carrier_name; $parcel_array['date'] = $parcel->date; $parcel_array['cons_no'] = $parcel->consignment_no; $parcel_array['number_of_box'] = $parcel->number_of_box; $parcel_array['remakrs'] = $parcel->remakrs; $parcel_array['parcel_amount'] = $parcel->amont; $parcel_array['weight'] = $parcel->weight; $parcel_array['weight_type'] = $parcel->weight_type; $parcel_array['insurance'] = $parcel->insurance_amt; $parcel_array['ess_charge'] = $parcel->ess_charge; $parcel_array['ess_charge_amount'] = (($parcel->amont + $parcel->total_other_charges_amount) * ($parcel->ess_charge) / 100); $parcel_array['fuel_percentage'] = $parcel->fuel_charge; $parcel_array['fuel_amount'] = (($parcel->amont + $parcel->total_other_charges_amount + $parcel_array['ess_charge_amount']) * $parcel->fuel_charge) / 100; $parcel_array['amount'] = $parcel->amont + $parcel_array['ess_charge_amount'] + $parcel_array['fuel_amount'] + $parcel->insurance_amt; $parcel_array['total_other_charges_amount'] = $parcel->total_other_charges_amount; $total_fuel_for_main_bill = $total_fuel_for_main_bill + $parcel_array['fuel_amount']; $data[] = $parcel_array; } $final_value = number_format((double)($parcels[0]->total_amount - $bill->amount), 2); if($final_value > 0){ $value = 'Positive'; }else{ $value = 'Negative'; } sleep(1); @endphp

Tax Inovice

logo

Billed By

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

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

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

Email : {{@$branch_email}}

PAN No. : {{ @$branch['pancard'] }}

GSTIn : {{ @$branch['gstno'] }}

Invoice Details

Invoice Date : {{ date('d/m/Y', strtotime($bill->created_at)) }}
From Date : {{ date('d/m/Y', strtotime($bill->start_date)) }}
Date To : {{ date('d/m/Y', strtotime($bill->end_last)) }}
Invoice No. : {{ $bill->billno }}
SAC Code : {{ $branch->sac_code }}
Description Of Services : Courier Services

Billed To

{{$bill->name}}

Code :

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

GST No. : {{ @$bill->gstno }}

State Code: {{ @$bill->gstno ? substr(@$bill->gstno, 0, 2) : '' }}

Summary of Charges

@if($value == 'Positive') @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif
Invoice Amount : {{ Laracore::showPrice($billAmount) }}
Fuel Surcharges : {{ Laracore::showPrice($total_fuel_for_main_bill) }}
Development Charge : 0.00
Discount : {{Laracore::showPrice($parcels[0]->total_amount - $bill->amount)}}
Taxable value {{ Laracore::showPrice($billAmount + $total_fuel_for_main_bill) }}
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 Invoice Value (INR) {{ Laracore::showPrice($finalGrandTotal) }}

Amount in words (Rounded Off): {{ getIndianCurrency($finalGrandTotal) }}

Terms & Conditions
@php $termsAndConditionsArr = explode("\n", str_replace("\r", "", @$branch['bill_terms_and_conditions'])); @endphp @foreach($termsAndConditionsArr as $termsAndConditions) {{$termsAndConditions}}
@endforeach

Payment Details

Payment QR Code
Payment QR Code
Account No. : {{ $branch->bank_acno }}
IFSC Code : {{ $branch->ifsc_code }}
Branch Name : {{ $branch->bank_address }}
@if (count($all_parcels) > 0) @php $srno = 1; $total_amount = 0; @endphp @foreach ($all_parcels as $parcels) @php $total_amount += $parcels->net_amt; $srno++; @endphp @endforeach @endif
{{$bill->name}} . ({{@$branch['city']}}) GST No. {{ @$branch['gstno'] }}

SNO.

DATE

AWB No.

Dest

Mode

PCS

Weight

Amount

{{ $srno }}

{{ date('d/m/Y', strtotime(@$parcels->date)) }}

{{ $parcels->consignment_no }}

{{ $parcels->city_name }}

{{ $parcels->dp_name }}

{{ $parcels->number_of_box }}

{{ $parcels->weight }} {{ strtoupper(@$parcels->weight_type) }}

{{ Laracore::showPrice($parcels->net_amt) }}

Grand Total

{{ Laracore::showPrice($total_amount) }}

@endforeach