@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]) ->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'=>1, 'bl.branch_id'=>$branchId]) ->where(DB::raw('DATE_FORMAT(p.date,"%Y-%m")'), '=', DB::raw("'$month'")) ->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 @if(count($all_parcels) > 0) @endif

{{$branch->name}}

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

{{$branch->contact_no}}

GST NO. {{$branch->gstno}}

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

tax invoice

To

{{$bill->name}}

{{$bill->address1}} {{$bill->address2}}, CITY - {{$bill->city}}, STATE - {{$bill->state}} M.:{{$bill->phone1}}

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

GSTIN/Unique ID: {{$bill->gstno}}

Place of supply (State Name & Code): {{$bill->state}} & {{(@$bill->gstno) ? substr(@$bill->gstno,0,2) : ''}}

@if($value == 'Positive') @else @endif @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($parcels[0]->total_amount - $total_fuel_for_main_bill)}}

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

Discount

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

Fuel Surcharges

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

Other Charges

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

Sub 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 Of

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

Grand Total

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

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

Statutory Guidelines

01. PAN No:{{$branch->pancard}}, SAC Code No. 996812

02. GST No:{{$branch->gstno}}

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

General Guidelines

1. PAN No. {{$branch->pancard}}, GST No. {{$branch->gstno}}, 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