<div class="card printbdy" id="printbdy">
	<div class="card-body">

	<div class="">
		<div class="row margin-0">
		  <div class="col-sm-5 border-style" style="border-right: 0;">
			<p class="m-0 pt-2" style="font-size: 13px;">
			<span style="font-size: 15px;"><b>ASTAR MOBILES PRIVATE LIMITED</b></span><br />
			SECOND FLOOR, NO.36/1, MODEL SCHOOL ROAD<br />
			CHENNAI - 600006<br />
			GST Number: 33AASCA1416F1ZZ<br />
			CIN: U74999TN2019PTC128558<br />
			E-Mail: astarmobiles7@gmail.com 
			</p>
		  </div>
  
		  <div class="col-sm-7 padding-0">
			<table class="table border-style-td m-0" cellspacing="0" cellpadding="10">
			  <tbody class="head-pad">
			  <tr>
				<td class="first width-td border-right border-bottom">
				<span><p>Invoice No</p></span>
				<span class="dis-block"><b>{{ !empty($sales->invoice_no) ? $sales->invoice_no :'' }}</b></span>
				</td>
				<td class="first border-bottom">
				<span><p>Dated</p></span>
				<span class="dis-block"><b>{{ !empty($sales->sales_date) ? $sales->sales_date :'' }}</b></span></td>
			  </tr>
			  
			  <tr>
				<td class="width-td border-bottom border-right">
				<span><p>Delivery Note</p></span>
				<span class="dis-block">courier</span>
				</td>
				<td class="border-bottom">
				<span><p>Mode/Terms of Payment</p></span>
				<span class="dis-block">gpay</span></td>
			  </tr>
			  
			  <tr>
				<td class="last width-td border-bottom border-right">
				<span><p>Supplier's Ref.</p></span>
				<span class="dis-block">#3764747589</span></td>
				<td class="last border-bottom">
				<span><p>Other Reference(s)</p></span>
				<span class="dis-block">#9786777998</span></td>
			  </tr>

			  <tr>
				<td class="last width-td border-right">
				<span><p>Buyer's Order No.</p></span>
				<span class="dis-block">#AJDH9087739</span></td>
				<td class="last">
				<span><p>Dated</p></span>
				<span class="dis-block">09-09-2023</span></td>
			  </tr>
			  </tbody>
			</table>
		  </div>
		</div>
		
		<div class="row margin-0">
		  <div class="col-sm-5 border-style-1">
			<p class="m-0 pt-2 pb-3"><b>Buyer :</b><br/><b>

			{{!empty($sales->vendor_name)?$sales->vendor_name:''}}</b><br />

			{{!empty($sales->vendorName->company_name)?$sales->vendorName->company_name:''}}<br/>

			{{!empty($sales->vendorName->address)?$sales->vendorName->address:''}}<br />

			Phone: {{!empty($sales->vendorName->mobile_number)?$sales->vendorName->mobile_number:''}}<br />

			E-Mail: {{!empty($sales->vendorName->email_id)?$sales->vendorName->email_id:''}}<br />

			GSTIN/UIN : {{!empty($sales->vendorName->gst)?$sales->vendorName->gst:''}}<br />

			<!--PAN No : {{!empty($sales->vendorName->pan)?$sales->vendorName->pan:''}}<br />-->

			</p>
		  </div>
		  <div class="col-sm-7 padding-0">
			<table class="table m-0 h-100 border-style-td" style="border-top: 0;">
			  <tbody class="head-pad">
    			  <tr>
            		<td class="first b-left width-td border-right border-bottom" style="border-top: 0;">
            			<span><p>Despatch Document No.</p></span>
            			<span class="dis-block">11/12/2016</span></td>
            		<td class="first border-bottom" style="border-top: 0;">
            			<span><p>Delivery Note Date</p></span>
            			<span class="dis-block">11/12/2016</span></td>
    			  </tr>
    			  <tr>
    				<td class="first b-left width-td border-right border-bottom">
    				    <span><p>Despatched Through</p></span>
    				    <span class="dis-block">11/12/2016</span></td>
    				<td class="first border-bottom">
    				    <span><p>Destination</p></span>
    				    <span class="dis-block">11/12/2016</span></td>
    			  </tr>
    			  <tr>
    				<td class="first b-left width-td " style="border-right: 0;">
    				    <span><p>Terms Of Delivery</p></span>
    				    <span class="dis-block">11/12/2016</span></td>
    				<td class="first"><span></span><span></span></td>
    			  </tr>
			  </tbody>
			</table>
		  </div>
		</div>

	@php 

		$invoice_no = !empty($sales->invoice_no) ? $sales->invoice_no : '0';
		$qnty = !empty($sales->pro_count) ? $sales->pro_count : '0';

		if(!empty($invoice_no)) {

			$paymentsd = \App\Models\Invoice::where('invoice_no', $invoice_no)->sum('nlc_price');
			$payments = number_format($paymentsd, 2, '.', '');

			$mopprices = \App\Models\Invoice::where('invoice_no', $invoice_no)->sum('mop_price');
			$mopprice = number_format($mopprices, 2, '.', '');

		} else {
			$payments = '0';
			$mopprice = '0';
		}

		if(!empty($qnty)) {		
			$avmuntss = $payments / $qnty;
			$avmunts = number_format($avmuntss, 2, '.', '');
		} else {
			$avmunts = $payments;
		}

		if(!empty($payments)) {

			$margamut = $mopprice;
			
		} else {
			$margamut = '0';
		}
		

		if(!empty($margamut)) {

			$cgstd = $margamut - ($margamut *(100 / (100 + 18)));
			$cgst = number_format($cgstd, 2, '.', '');
		} else {
			$cgst = '0';
		}
		
		$lstgst = $margamut - $cgst;		
		$lstgstn = $lstgst + $cgst;

		$total = $payments - $cgst;

	@endphp

		<div class="row margin-0">
		  <div class="col-sm-12 padding-0">

			<table class="invoice-bill table border-style-td m-0">
			  <tr>
				<th class="serial-no top-bor border-bottom border-right" style="min-width:82px;"><span class="w-100"><b style="font-size:15px">SL. No.</b></span></th>
				<th class="particulars top-bor border-bottom border-right" ><b style="font-size:15px">Description Of Goods</b></th>
				<th class="amount top-bor border-bottom border-right" ><b style="font-size:15px">HSN/SAC</b></th>
				<th class="amount top-bor border-bottom border-right" style="width: 70px;"><b style="font-size:15px">Quantity</b></th>
				<th class="amount top-bor border-bottom border-right" style="width: 60px;"><b style="font-size:15px">Rate</b></th>
				<th class="amount top-bor border-bottom border-right" style="width: 50px;"><b style="font-size:15px">Per</b></th>
				<th class="amount top-bor border-bottom border-right" style="width: 100px;"><b style="font-size:15px">Amount</b></th>
			  </tr>

			<tr>
				<td style="min-width:82px;"><div >1</div></td>
				<td class="border-bottom">
					<div class="particular-items"><span class="table-p"><p><b>MIXED PHONES - Exempted</b></p></span></div>
				</td>
				<td class="border-bottom">
					<div class="particular-items amount-items"><span class="table-p"><p>85171290</p></span></div>
				</td>
				<td class="border-bottom">
					<span class="table-p alignment"><p>{{ $qnty }}</p></span>
				</td>
				<td class="border-bottom">
					<div class="particular-items"><span class="table-p alignment"><p>₹{{$avmunts}}</p></span></div>
				</td>
				<td class="border-bottom">
					<div class="particular-items amount-items"><span class="table-p"><p>Nos</p></span></div>
				</td>
				<td class="border-bottom">
					<div class="particular-items amount-items"><span class="table-p alignment"><p><b>₹{{ $payments }}</b></p></span></div>
				</td>
			</tr>
			
			<tr>
				<td><div style="width:25px;"><span class="table-p">2</span></div></td>
				<td>
					<div class="particular-items"><span class="table-p"><b>MIXED PHONES - Taxable</b></span></div>
				</td>
				<td>
					<div class="particular-items amount-items"><span class="table-p"><p></p></span></div>
				</td>
				<td><p></p></td>
				<td>
					<div class="particular-items"><span class="table-p"><p></p></span></div>
				</td>
				<td>
					<div class="particular-items amount-items"><span class="table-p"><p></p></span></div>
				</td>
				<td>
					<div class="particular-items amount-items"><span class="table-p alignment"><p><b>₹{{ $margamut }}</b></p></span></div>
				</td>
			</tr>
			<tr><td></td><td><div class="particular-items"><b></b></div></td><td>
			<div class="particular-items amount-items"><p></p></div></td><td><p> </p></td><td>
			<div class="particular-items"><p></p></div></td><td><div class="particular-items amount-items"><p>
			</p></div></td><td><div class="particular-items amount-items"><p></p></div></td></tr><tr><td></td><td><div class="particular-items text-right"><span class="table-p"><b>CGST 9% Output</b></span></div></td><td>
			<div class="particular-items amount-items"><p></p></div></td><td><p></p></td>
			<td><div class="particular-items"><span class="table-p alignment"><p class="m-0">9</p></span></div></td>
			<td><div class="particular-items amount-items"><span class="table-p"><p class="m-0">%</p></span></div></td>
			
			<td><div class="particular-items amount-items text-right"><span class="table-p"><p><b>₹{{$cgst}}</b></p></span></div></td>

			</tr><tr><td></td><td><div class="particular-items text-right"><span class="table-p"><b>SGST 9% Output</b></span></div>
			</td><td><div class="particular-items amount-items"><p></p></div></td>
			<td><p class="m-0"></p></td><td><div class="particular-items"><span class="table-p alignment"><p class="m-0">9</p></span></div>
			</td><td><div class="particular-items amount-items"><span class="table-p"><p class="m-0">%</p></span></div></td>

			<td><div class="particular-items amount-items text-right"><span class="table-p"><p class="m-0"><b>₹{{$cgst}}</b></p></span></div></td>
			
			</tr>
			<tr><td></td><td><div class="particular-items"></div></td>
			<td><div class="particular-items amount-items"><p></p></div></td><td><p></p>
			</td><td><div class="particular-items"><p></p></div></td><td><div class="particular-items amount-items">
			<p></p></div></td><td><div class="particular-items amount-items"></div></td></tr>
			<tr><td></td><td><b>Total</b></td><td></td>

			<td class="alignment"><span class="table-p alignment">{{ $qnty }}</span></td>

			<td></td><td></td>

			<td><span class="table-p alignment"><p>₹{{ $total }}</p></span></td>
		  </tr>
		</table>
		  </div>
		</div>
				<div class="row margin-0">
				    <div class="col-sm-12 px-2 amount-table">
			            <div class="d-flex justify-content-between pt-1">
				            <p>Amount chargeable (in words)</p>
			        	    <p>E. O.E</p>
				        </div>
				            <p><b>INR FIVE LAKHS SEVENTY THOUSAND FIVE HUNDRED AND NINETY EIGHT ONLY</b></p>
				    </div>
				<table class="hsc-table" width="100%">
				  <tr>
					<td align="center">HSC </td>
					<td align="center">Taxable </td>
					<td>
					    <table width="100%" border="0" class="tasis" cellspacing="0" cellpadding="0">
    					  <tr>
    						<td colspan="2" class="border-top border-left border-right border-bottom" align="center">Central Tax</td>
    						</tr>
    					  <tr>
    						<td class="border-left border-bottom" width="50%" align="center">Rate</td>
    						<td class="border-left border-right border-bottom" width="50%" align="center">Amount</td>
    					  </tr>
					    </table>
					</td>
					<td>
					    <table class="tasis" width="100%" border="0" cellspacing="0" cellpadding="0">
        					  <tr>
        						<td colspan="2" class="border-top border-left border-right border-bottom" align="center">Sales Tax</td>
        						</tr>
        					  <tr>
        						<td class="border-left border-bottom" width="50%" align="center">Rate</td>
        						<td class="border-left border-right border-bottom" width="50%" align="center">Amount</td>
        					  </tr>
				    	</table>
					</td>
					<td align="center">Total Tax Amount</td>
				  </tr>
				  <tr class="text-right">
					<td>&nbsp;</td>
					<td class="tab-align"><span class="table-p">₹{{ $margamut }}</span></td>
					<td>
					    <table class="tasis" width="100%" border="0" cellspacing="0" cellpadding="0">
    					  <tr>
    						<td width="50%" class="border-top border-left border-bottom tab-align" align="right"><span class="table-p">9%</span></td>
    						<td width="50%" class="border-top border-left border-right border-bottom tab-align"><span class="table-p">₹{{$cgst}}</span></td>
    					  </tr>
					    </table>
					</td>
					<td>
					    <table class="tasis" width="100%" border="0" cellspacing="0" cellpadding="0">
        					<tr>
        						<td width="50%" class="border-top border-left border-bottom tab-align" align="right"><span class="table-p">9%</span></td>
        						<td width="50%" class="border-top border-left border-right border-bottom tab-align"><span class="table-p">₹{{$cgst}}</span></td>
        					 </tr>
					    </table>
					</td>
					<td class="tab-align"><span class="table-p">₹{{$cgst + $cgst}}</span></td>
				  </tr>
				  <tr class="text-right">
					<td class="tab-align"><span class="table-p">Total</span></td>
					<td class="tab-align"><span class="table-p"><b>₹{{ $margamut }}</b></span></td>
					<td>
					    <table class="tasis" width="100%" border="0" cellspacing="0" cellpadding="0">
    					  <tr>
    						<td width="50%" class="border-top border-left border-bottom tab-align"><span class="table-p"></span></td>
    						<td class="border-top border-left border-right border-bottom tab-align"><span class="table-p"><b>₹{{$cgst}}</b></span></td>
    					  </tr>
					    </table>
					</td>
					<td>
					    <table class="" width="100%" border="0" cellspacing="0" cellpadding="0">
    					  <tr> 
    					    <td width="50%" class="border-top border-left border-bottom tab-align"><span class="table-p"></span></td>
    						<td class="border-top border-left border-right border-bottom tab-align"><span class="table-p"><b>₹{{$cgst}}</b></span></td>
    					  </tr>
					    </table>
					</td>
					<td class="tab-align"><span class="table-p"><b>₹{{$cgst + $cgst}}</b></span></td>
				  </tr>
				</table>
				</div>
				<div class="row margin-0 bottom-table">
				  <div class="col-sm-12">
				  
				  @php 
				  $ttax = $cgst + $cgst;
				  @endphp
					 
				<p class="m-0 pt-3">Tax Amount (in Words)<b>: {{ getIndianCurrency($ttax) }}</b></p>

					<p class="m-0">Company's PAN <b>: {{!empty($sales->vendorName->pan)?$sales->vendorName->pan:''}}</b></p>
					<p class="m-0"><b>Declaration :</b></p>
					<div class="d-flex justify-content-between">
					<div class="pull-left authorised-sign-wrapper left-width">
					  <p class="m-0"> As  Per GST rule 32(5) of the CGST Rule, 2017,
						Used goods as such or after minor processing
						which does not change the nature of the goods and
						where no input tax credit has beeb available on the
						purchase of such Goods</p>
					</div>
					<div class="d-flex justify-content-between flex-column authorised-sign-wrapper">
					  <p class="m-0"><b>For Astar Mobiles Pvt Ltd.,</b></p>
					  <p class="m-0">Authorised Signature</p>
					</div>
					</div>
				  </div>
				</div>
			</div>
			<!--<p class="text-center m-0 pt-2">This is a Computer Generated Invoice</p>-->

	<div class="d-print-none">
		<div class="float-end d-flex prntbtn mt-3">
			<a href="javascript:(0)" class="btn btn-success waves-effect waves-light me-2 prntbtns">
			<i class="fa fa-print"></i></a>
		</div>
	</div>

	</div></div>


@section('scripts')

<script src="https://cdn.bootcss.com/html2pdf.js/0.9.1/html2pdf.bundle.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.1/html2pdf.bundle.min.js"></script>

<script>

$(document).on("click", ".prntbtns", function () {
	$(".prntbtn").html('');
	var element = document.getElementById('printbdy');
	html2pdf(element, {
		margin: 0.2,
		padding: 0,
		filename: 'invoice.pdf',
		image: { type: 'element', quality: 1 },
		html2canvas: { scale: 2, logging: true },
		jsPDF: { unit: 'in', format: 'A4', orientation: 'P' },
		pagebreak: { before: '.beforeClass', after: ['#after1', '#after2'], avoid: 'img' }
	});

const myTimeout = setTimeout(myGreeting, 2000);

});

function myGreeting() {
  $(".prntbtn").html('<a href="javascript:(0)" class="btn btn-success waves-effect waves-light me-2 prntbtns"><i class="fa fa-print"></i></a>');
}

</script> 

@endsection