
PK 
<!DOCTYPE html>
<html>
<head>
<title>Order @if($order)- {{$order->order_number}} @endif</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
</style>
</head>
<body>
@if($order)
<style type="text/css">
.invoice-header {
background: #f7f7f7;
padding: 10px 20px 10px 20px;
border-bottom: 1px solid gray;
}
.site-logo {
margin-top: 20px;
}
.invoice-right-top h3 {
padding-right: 20px;
margin-top: 20px;
color: green;
font-size: 30px!important;
font-family: serif;
}
.invoice-left-top {
border-left: 4px solid green;
padding-left: 20px;
padding-top: 20px;
}
.invoice-left-top p {
margin: 0;
line-height: 20px;
font-size: 16px;
margin-bottom: 3px;
}
thead {
background: green;
color: #FFF;
}
.authority h5 {
margin-top: -10px;
color: green;
}
.thanks h4 {
color: green;
font-size: 25px;
font-weight: normal;
font-family: serif;
margin-top: 20px;
}
.site-address p {
line-height: 6px;
font-weight: 300;
}
.table tfoot .empty {
border: none;
}
.table-bordered {
border: none;
}
.table-header {
padding: .75rem 1.25rem;
margin-bottom: 0;
background-color: rgba(0,0,0,.03);
border-bottom: 1px solid rgba(0,0,0,.125);
}
.table td, .table th {
padding: .30rem;
}
.gst-details {
margin-top: 20px;
border-top: 1px solid #ddd;
padding-top: 10px;
}
</style>
<div class="invoice-header">
<div class="float-left site-logo">
<img src="{{asset('backend/img/logo.png')}}" alt="">
</div>
<div class="float-right site-address">
<h4>{{env('APP_NAME')}}</h4>
<p>{{env('APP_ADDRESS')}}</p>
<p>GSTIN: {{env('COMPANY_GSTIN')}}</p>
<p>Phone: <a href="tel:{{env('APP_PHONE')}}">{{env('APP_PHONE')}}</a></p>
<p>Email: <a href="mailto:{{env('APP_EMAIL')}}">{{env('APP_EMAIL')}}</a></p>
</div>
<div class="clearfix"></div>
</div>
<div class="invoice-description">
<div class="invoice-left-top float-left">
<h6>Invoice to</h6>
<h3>{{$order->first_name}}</h3>
<div class="address">
<p>
<strong>State: </strong>
{{$order->country}}
</p>
<p>
<strong>Address: </strong>
{{ $order->address1 }} OR {{ $order->address2}}
</p>
<p><strong>Phone:</strong> {{ $order->phone }}</p>
<p><strong>Email:</strong> {{ $order->email }}</p>
@if($order->gst_number)
<p><strong>GSTIN:</strong> {{ $order->gst_number }}</p>
@endif
</div>
</div>
<div class="invoice-right-top float-right" class="text-right">
<h3>Invoice #{{$order->order_number}}</h3>
<p>{{ $order->created_at->format('D d m Y') }}</p>
</div>
<div class="clearfix"></div>
</div>
<section class="order_details pt-3">
<div class="table-header">
<h5>Order Details (Prices include GST)</h5>
</div>
<table class="table table-bordered table-stripe">
<thead>
<tr>
<th scope="col">Product</th>
<th scope="col" class="text-right">Price (incl. GST)</th>
<th scope="col" class="text-center">Qty</th>
<th scope="col" class="text-right">Total (incl. GST)</th>
<th scope="col" class="text-right">GST Amount</th>
<th scope="col" class="text-right">Taxable Value</th>
</tr>
</thead>
<tbody>
@php
$totalTaxableValue = 0;
$totalGST = 0;
$totalCGST = 0;
$totalSGST = 0;
$totalIGST = 0;
// Check if customer is in the same state (Delhi)
$isIntraState = ($order->country === 'Delhi');
@endphp
@foreach($order->cart_info as $cart)
@php
$product=DB::table('products')->select('title')->where('id',$cart->product_id)->get();
$totalWithGST = $cart->price * $cart->quantity;
// Calculate GST components (price includes 18% GST)
$taxableValue = $totalWithGST / (1 + 0.18); // Reverse calculate base price
$gstAmount = $totalWithGST - $taxableValue;
$totalTaxableValue += $taxableValue;
$totalGST += $gstAmount;
if($isIntraState) {
// CGST and SGST (9% each for Delhi customer)
$cgst = $gstAmount / 2;
$sgst = $gstAmount / 2;
$totalCGST += $cgst;
$totalSGST += $sgst;
$igst = 0;
} else {
// IGST (18% for out of state customer)
$igst = $gstAmount;
$totalIGST += $igst;
$cgst = 0;
$sgst = 0;
}
@endphp
<tr>
<td>
@foreach($product as $pro)
{{$pro->title}}
@endforeach
</td>
<td class="text-right">{{number_format($cart->price,2)}}</td>
<td class="text-center">x{{$cart->quantity}}</td>
<td class="text-right">{{number_format($totalWithGST,2)}}</td>
<td class="text-right">{{number_format($gstAmount,2)}}</td>
<td class="text-right">{{number_format($taxableValue,2)}}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th colspan="3" class="empty"></th>
<th class="text-right">Subtotal (incl. GST):</th>
<th colspan="2" class="text-right">{{number_format($order->sub_total,2)}}</th>
</tr>
<tr>
<th colspan="3" class="empty"></th>
<th class="text-right">Total Taxable Value:</th>
<th colspan="2" class="text-right">{{number_format($totalTaxableValue,2)}}</th>
</tr>
@if($isIntraState)
<tr>
<th colspan="3" class="empty"></th>
<th class="text-right">Total CGST (9%):</th>
<th colspan="2" class="text-right">{{number_format($totalCGST,2)}}</th>
</tr>
<tr>
<th colspan="3" class="empty"></th>
<th class="text-right">Total SGST (9%):</th>
<th colspan="2" class="text-right">{{number_format($totalSGST,2)}}</th>
</tr>
@else
<tr>
<th colspan="3" class="empty"></th>
<th class="text-right">Total IGST (18%):</th>
<th colspan="2" class="text-right">{{number_format($totalIGST,2)}}</th>
</tr>
@endif
<tr>
<th colspan="3" class="empty"></th>
<th class="text-right">Shipping:</th>
<th colspan="2" class="text-right">{{number_format($order->shipping_charge,2)}}</th>
</tr>
<tr>
<th colspan="3" class="empty"></th>
<th class="text-right">Grand Total:</th>
<th colspan="2" class="text-right">{{number_format($order->total_amount,2)}}</th>
</tr>
</tfoot>
</table>
<div class="gst-details">
<h6>GST Details:</h6>
<p>Company GSTIN: {{env('COMPANY_GSTIN')}}</p>
@if($order->gst_number)
<p>Customer GSTIN: {{$order->gst_number}}</p>
@endif
<p>Place of Supply: {{$order->country}}</p>
@if($isIntraState)
<p>Tax Type: CGST + SGST (Intra-State)</p>
@else
<p>Tax Type: IGST (Inter-State)</p>
@endif
<p>Note: All product prices include 18% GST</p>
</div>
</section>
<div class="thanks mt-3">
<h4>Thank you for your business !!</h4>
</div>
<div class="authority float-right mt-5">
<p>-----------------------------------</p>
<h5>Authority Signature:</h5>
</div>
<div class="clearfix"></div>
@else
<h5 class="text-danger">Invalid</h5>
@endif
</body>
</html>


PK 99