@php $generalsetting = \App\GeneralSetting::first(); $id= @$data['order_products'][0]->order->id; $product = \App\Product::select('order_details.product_id', 'shops.id as shop_id') ->leftJoin('order_details', 'products.id', '=', 'order_details.product_id') ->leftJoin('shops', 'shops.user_id', '=', 'products.seller_id') ->where(['order_details.order_id' => $id, 'products.manage_by' => '0'])->get(); if(count($product) > 0){ $ecom_invoice = 1; }else{ $ecom_invoice = 0; } $productKhadi = \App\Product::select('order_details.product_id', 'shops.id as shop_id') ->leftJoin('order_details', 'products.id', '=', 'order_details.product_id') ->leftJoin('shops', 'shops.user_id', '=', 'products.seller_id') ->where(['order_details.order_id' => $id, 'products.manage_by' => '1']); $countsKhadi = $productKhadi->get(); if(count($countsKhadi)){ $KhadiIds = $productKhadi->pluck('product_id'); $seller = \App\OrderDetail::where('order_id', $id)->whereIn('product_id', $KhadiIds)->groupBy('seller_id')->pluck('seller_id')->toArray(); if(!empty($seller)){ $sell_array = array(); foreach ($seller as $key => $sell) { $sell_array[] = $sell; } } } if(empty($sell_array)){ $sell_array = array(); } if(count($sell_array) > 0){ $totalIncoiceNumber = $ecom_invoice + count($sell_array); }else{ $totalIncoiceNumber = $ecom_invoice; } if($totalIncoiceNumber == 0){ $totalIncoiceNumber = 1; } @endphp

ekhadiindia.com

Tax Invoice/Bill of Supply/Cash Memo


@php @$billing_address = json_decode($data['order_products'][0]->order->billing_address); @endphp @php $shipping_address = json_decode(@$data['order_products'][0]->order->shipping_address); @endphp
Sold By :

{{@$data['seller_address']->name}}

{{@$data['seller_address']->address}}

PAN No: {{@$data['seller_address']->company_pan}}

GST Registration No: {{@$data['seller_address']->gst_no}}

{{ translate('Billing Address') }} :

{{ @$billing_address->name }}

{{ @$billing_address->address }}, {{ @$billing_address->city }}, {{ @$billing_address->country }}

{{ translate('Email') }}: {{ @$billing_address->email }}

{{ translate('Phone') }}: {{ @$billing_address->phone }}

{{ translate('State') }}: {{ @$billing_address->state }}

{{ translate('Postal Code') }}: {{ @$billing_address->postal_code }}

@if(!empty($billing_address->gst_number))

{{ translate('GST Number') }}: {{ @$billing_address->gst_number }}

@else

{{ translate('GST Number') }}: {{ 'N/A' }}

@endif
{{ translate('Shipping Address') }} :

{{ @$shipping_address->name }}

{{ @$shipping_address->address }}, {{ @$shipping_address->city }}, {{ @$shipping_address->country }}

{{ translate('Email') }}: {{ @$shipping_address->email }}

{{ translate('Phone') }}: {{ @$shipping_address->phone }}

{{ translate('State') }}: {{ @$shipping_address->state }}

{{ translate('Postal Code') }}: {{ @$shipping_address->postal_code }}

Order Number : {{@$data['order_products'][0]->order->code}}
{{ translate('Order Date') }} : {{ date('d-m-Y', @$data['order_products'][0]->order->date) }}
Invoice Number : {{ substr(@$data['invoice_number'], 0,-4) }}
{{ translate('Invoice Date') }} : {{ date('d-m-Y', @$data['order_products'][0]->order->date) }}
@php $Product_tax = 0; $finalProduct_tax = 0; $completeOrderGrandTotal = \App\OrderDetail::where('order_id', @$data['order_products'][0]->order->id)->sum('price'); $grandTotal = 0; $shippingPriceFraction = (float)100/(float)$data['no_of_invoice']; $discountonShipping = 51; $max_tax = array(); $rupees = ''; @endphp @foreach($data['order_products'] as $key => $orderDetail) @if(!empty($orderDetail)) @php $max_tax[] = $orderDetail->product->tax; if($billing_address->state == @$data['seller_address']->state) { $unitPrice = ($orderDetail->product->unit_price/(100+$orderDetail->product->tax))*100; $discount = ($orderDetail->product->unit_price*$orderDetail->product->discount)/100; $discountAmout = $orderDetail->product->unit_price-$discount; $grandTotal += $discountAmout*$orderDetail->quantity; $netAmount = $unitPrice*$orderDetail->quantity; $tax_amount = $orderDetail->product->unit_price*$orderDetail->quantity - $netAmount; $Product_tax+= $tax_amount; if($orderDetail->product->tax != "" || $orderDetail->product->tax != '0' || $orderDetail->product->tax != '0.00'){ $tax_type_lable = "

CGST

SGST

"; $taxP = $orderDetail->product->tax/2; $finalTaxP = '

'.$taxP.'%'.'

'.$taxP.'%'.'

'; $tax_amt = $tax_amount/2; $finalTax_amt = '

'. $rupees.number_format((float)@$tax_amt, 2, '.', '').'

'.$rupees.number_format((float)@$tax_amt, 2, '.', '').'

'; }else{ $tax_type_lable = "

N/A

"; $taxP = $orderDetail->product->tax; $finalTaxP = '

'.$taxP.'%'.'

'; $tax_amt = $tax_amount; $finalTax_amt = '

'. $rupees.number_format((float)@$tax_amt, 2, '.', '').'

'; } } else { if($orderDetail->product->tax != "" || $orderDetail->product->tax != '0' || $orderDetail->product->tax != '0.00'){ $tax_type_lable = "

IGST

"; }else{ $tax_type_lable = "

N/A

"; } $unitPrice = ($orderDetail->product->unit_price/(100+$orderDetail->product->tax))*100; $discount = ($orderDetail->product->unit_price*$orderDetail->product->discount)/100; $discountAmout = $orderDetail->product->unit_price - $discount; $grandTotal += $discountAmout*$orderDetail->quantity; $netAmount = $unitPrice*$orderDetail->quantity; $taxP = $orderDetail->product->tax; $finalTaxP = $taxP.'%'; $tax_amount = ($orderDetail->product->unit_price*$orderDetail->quantity - $netAmount); $Product_tax+= $tax_amount; $finalTax_amt = $rupees.number_format((float)@$tax_amount, 2, '.', ''); } @endphp @php if(!empty($orderDetail->variation)){ $productStock = \App\ProductStock::with('product')->where('product_id', $orderDetail->product_id)->where('variant', @$orderDetail->variation)->first(); }else{ $productStock = \App\ProductStock::with('product')->where('product_id', $orderDetail->product_id)->first(); } @endphp @endif @endforeach @if(@$data['order_products'][0]->order->coupon_discount > 0) @php $dicountAmount = @$data['order_products'][0]->order->coupon_discount / $totalIncoiceNumber; $dicountper = @$dicountAmount/$completeOrderGrandTotal * 100; $finalTaxP = max($max_tax); $gst_amount = $dicountAmount * @$finalTaxP / 100; $dicountTaxPrice = $finalPriceTax * $dicountper / 100; if(@$data['order_products'][0]->order->coupon_id != null){ $couponCode = \App\Coupon::where('id', @$data['order_products'][0]->order->coupon_id)->first(); if(!empty($couponCode)){ $coupon_code = $couponCode->code; }else{ $coupon_code = null; } }else{ $coupon_code = null; } @endphp @endif @php $minShippingAmount = minShippingAmountOrder(@$data['order_products'][0]->order->id); @endphp @if($completeOrderGrandTotal < $minShippingAmount) @else @endif
{{ translate('S. NO') }} {{ translate('Product Name') }} {{ translate('Unit Price') }} {{ translate('Discount') }} {{ translate('Quantity') }} {{ translate('Net Amount') }} {{ translate('Tax Rates') }} {{ translate('Tax Type') }} {{ translate('Tax Amount') }} {{ translate('Total Amount') }}
{{$key+1}} {{ $orderDetail->product->name }}
{{@$orderDetail->variation}}
{{'HSN code: '.@$orderDetail->product->hsn_code }}
{{'SKU: '.@$productStock->sku}}
{!! $rupees.number_format((float)$unitPrice, 2, '.', '') !!} @php $productdiscount = $unitPrice * $orderDetail->product->discount/100; @endphp {!! $rupees.number_format((float)@$productdiscount, 2, '.', '') !!} {{ $orderDetail->quantity }} @php $singlenetAmount = @$netAmount / @$orderDetail->quantity; $singleDiscountAmount = $singlenetAmount - $productdiscount; $productDiscountAmount = $singleDiscountAmount * @$orderDetail->quantity; @endphp {!! $rupees.number_format((float)@$productDiscountAmount, 2, '.', '') !!} {!! @$finalTaxP !!} {!! @$tax_type_lable !!} @php $finalPriceTax = @$productDiscountAmount * @$taxP / 100; $finalProduct_tax += $finalPriceTax; @endphp {!! $rupees.number_format((float)@$finalPriceTax, 2, '.', '') !!} {!! $rupees.number_format((float)@$discountAmout*$orderDetail->quantity, 2, '.', '') !!}
Coupon discount {{ '('.number_format((float)@$dicountper, 2, '.', '').' %)' }}
@if($coupon_code != null) {{ '('.$coupon_code.')' }} @endif
{!! $rupees.number_format((float)@$dicountTaxPrice, 2, '.', '') !!} {{number_format((float)$dicountAmount, 2, '.', '')}}
Shipping & Handling Charge {!! $rupees.number_format((float)$shippingUniPrice, 2, '.', '') !!} {!! $rupees.number_format((float)$discountonShipping/(float)$data['no_of_invoice'], 2, '.', '') !!} N/A {!! $rupees.number_format((float)$shippingUniPrice - $discountonShipping/(float)$data['no_of_invoice'], 2, '.', '') !!} {!! @$finalTaxP !!} {!! @$tax_type_lable !!} {!! @$shippinc !!} @php $finalPriceAfterDiscount = $shippingprice - $discountonShipping/(float)$data['no_of_invoice']; @endphp {{number_format((float)@$finalPriceAfterDiscount, 2, '.', '')}}
Handling Charge {!! $rupees.number_format((float)$shippingUniPrice, 2, '.', '') !!} {!! $rupees.number_format((float)0.00, 2, '.', '') !!} N/A {!! $rupees !!} 0.00 {{'0%'}} N/A @php $finalPriceAfterDiscount = $shippingUniPrice; @endphp {!! $rupees.number_format((float)$finalPriceAfterDiscount, 2, '.', '') !!} {!! $rupees.'0.00'; !!}
Total Amount @if($completeOrderGrandTotal < 1000) @if($finalProduct_tax + ($shippingPriceFraction-$shippingUniPrice) > @$dicountTaxPrice) {{ number_format((float)@$finalProduct_tax - @$dicountTaxPrice + ($shippingPriceFraction-$shippingUniPrice), 2, '.', '') }} @else {{ number_format((float) @$dicountTaxPrice - @$finalProduct_tax +($shippingPriceFraction-$shippingUniPrice), 2, '.', '') }} @endif @else @if($finalProduct_tax > @$dicountTaxPrice) {{ number_format((float)@$finalProduct_tax - @$dicountTaxPrice, 2, '.', '') }} @else {{ number_format((float)@$dicountTaxPrice - @$finalProduct_tax , 2, '.', '') }} @endif @endif {{number_format($grandTotal + @$finalPriceAfterDiscount - @$dicountAmount, 2, '.', '')}}
Total Amount in words: {{AmountInWords(number_format($grandTotal + @$finalPriceAfterDiscount - @$dicountAmount, 2, '.', ''))}} Only
whether tax is payable under reverse charge-No

Authorized Signatory