@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'), 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'=>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', 'p.number_of_box', 'r.name as receiver_name', 'c.name as city_name', '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(); $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(count($all_parcels) > 0) @endif

{{$branch->name}}

{{$branch->address}}, {{$branch->city}} - {{$branch->zipcode}}

{{$branch->contact_no}}

@if($branch->image) logo @endif

Estimation

To

{{$bill->name}}

{{$bill->address1}} {{$bill->address2}}, CITY - {{$bill->city}}, STATE - {{$bill->state}}

Mobile: {{(@$bill->phone1)}}

@if($value == 'Positive') @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif

Invoice Period

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

Invoice No

{{$bill->billno}}

Invoice Date

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

T/S Amount

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

Discount

- {{Laracore::showPrice($parcels[0]->total_amount - $bill->amount)}}

Other Charges

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

Fuel Surcharges({{$bill->fchpercent}})

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

Sub Total

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

Round Of

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

Grand Total

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

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

Statutory Guidelines

01. SAC Code No. 996812

02. PAYMENT DUE DATE: {{ date("d/m/Y", strtotime($bill->created_at . ' +10 days')) }}

General Guidelines

1. SAC Code No.996812

2. Payment Should be made ONLY by crossed cheque or DD in favour of {{$branch->name}} after obtaining money receipt positively OR NEFT / RTGS designated Account

3. Payment mist be made within ten days of receipt of invoice.

4. Any delay in payment after due date will be charged 24% per annum on prorata basis.

5. Kindly acknowledge the receipt of the bill by handing over the bill-acknowledgement, duly filled up, to our representative who delivers the bill to you.

Payment QR Code

@if($branch->payment_qr_code) Payment QR Code @endif

Bank Details

Branch: {{$branch->bank_address}}

Account Number: {{$branch->bank_acno}}

IFSC Code: {{$branch->ifsc_code}}

Digital Signature Only

Digital signed by {{$branch->name}} Date: {{date("Y.m.d H:i:s", strtotime(now()))}} IST

{{$branch->name}}

Payment Advice (Please detach and return with your payment)

Invoice No: {{$bill->billno}}

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

Client Code: {{$bill->name}}

{{$branch->name}}

{{$bill->name}}

Name of the Bank

Cheque / DD Number

Cheque / DD Date

Invoice Amount(Rs.)

TDS (Rs.)

Net Amount (Rs.)

{{$branch->bank_address}}

00.00

00.00

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

00.00

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

Name:

Signature:

Date:

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

Please make crossed Cheque or DD in favour of "{{$branch->name}}."

{{$branch->name}}

BILL ACKNOWLEDGEMENT

Code : {{$bill->name}}

Inv No : {{$bill->billno}}

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

Net Amount (Rs.): {{ Laracore::showPrice($finalGrandTotal) }}

Due Date : {{ date("d/m/Y", strtotime($bill->created_at . ' +10 days')) }}

Client Name: {{$bill->name}}

Name of the Receiver

Received Date

Sign & Seal

@php $srno = 1; @endphp @foreach($all_parcels as $parcels) @php $srno++; @endphp @endforeach

{{$bill->name}}

Bill No. {{$bill->billno}}

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

S.NO.

AWB NO(C.N)

DATE

RECEIVER

SERVICE

DESTINATION

PCS

WEIGHT

AMOUNT(rs)

{{$srno}}

{{$parcels->consignment_no}}

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

{{$parcels->receiver_name}}

{{$parcels->dp_name}}

{{$parcels->city_name}}

{{$parcels->number_of_box}}

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

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

@endforeach