	<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<link href="assets/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="assets/css/main.css" rel="stylesheet" type="text/css">
	<link href="assets/css/my-custom-styles.css" rel="stylesheet" type="text/css">
<!-- main -->
	<div class="content">
		<div class="main-header">
			<h2>Purchase Receipt</h2>
			<em>Print or Download Purchase Receipt</em>
		</div>			
												<div class="main-content">
					<!-- INVOICE -->
					<div class="invoice">
						<!-- invoice header -->
						<div class="invoice-header">
							<div class="row">
								<div class="col-lg-3 col-print-3">
									<img src="assets/img/kingadmin-logo.png" alt="KingAdmin Logo" />
								</div>
								<div class="col-lg-9 col-print-9">
									<ul class="list-inline">
										<li>Invoice #: <strong><?php echo $data['ViewPurchase']->bil_no;?></strong></li>
										<li>Invoice Date: <strong><?php 
											$date=$data['ViewPurchase']->bil_date; 
											$date1=explode('-',$date);
											$year=$date1[0]; 
											$month=$date1[1];
											$dat=$date1[2];  
											echo $todates=$dat.'-'.$month.'-'.$year; 
											?></strong></li>
									</ul>
								</div>
							</div>
						</div>
						<!-- end invoice header -->

					
						<!-- invoice address -->
						<div class="invoice-from-to">
						
							<div class="col-sm-6 col-print-6">
									<span>Purchased from</span>
									<p class="name">{{$data['ViewPurchase']->cst_name}}.</p>
									<address>
										{{$data['ViewPurchase']->cst_address}}<br>
										{{$data['ViewPurchase']->cst_city}}<br>
										{{$data['ViewPurchase']->cst_state}},<br>
										{{$data['ViewPurchase']->cst_country}}<br />
						<!--
										<div class="contact">
											<p><span>Email:</span> email@example.com</p>
											<p><span>Phone:</span> (1800) 888 - 4321</p>
											<p><span>Fax:</span> (1800) 888 - 4322</p>
										</div>
						-->
									</address>
							</div>
						
							<div class="row">
								<div class="col-sm-6 col-print-6">
									<span>Purchased to:</span>
									<address>
										<p class="name">{{$data['CompanyData']->frm_name}}</p><br>
										{{$data['CompanyData']->frm_address}}<br>
										{{$data['CompanyData']->frm_city}}<br>
										{{$data['CompanyData']->frm_state}}, {{$data['CompanyData']->frm_country}}</br>
										PH:{{$data['CompanyData']->frm_ph1}}, {{$data['CompanyData']->frm_ph2}}</br>
										Mail:{{$data['CompanyData']->frm_email}}</br>
									</address>
								</div>								
							</div>
						</div>
						<!-- end invoice address -->
						

						<!-- invoice item table -->
						<div class="table-responsive">
							<table class="table invoice-table">
								<thead>
									<tr>
										<td><strong>SL. No.</strong></td>
										<td><strong>Item</strong></td>
										<td class="text-center"><strong>Cost</strong></td>
										<td class="text-center"><strong>Quantity</strong></td>
										<td class="text-right"><strong>Total</strong></td>
									</tr>		
								</thead>
								<tbody>
								<?php $slno=0; $sumtotal=0; ?>
    							@foreach ($data['ViewPurchaseItem'] as $Item) 
									<tr>
										<td><?php echo $slno+=1;?></td>
										<td>{{$Item->itm_name}}</td>
										<td class="text-center">Rs. {{$Item->bit_cost}}</td>
										<td class="text-center">{{$Item->bit_qty}}</td>
										<td class="text-center">
											Rs. <?php echo $Item->bit_qty * $Item->bit_cost;
											$sumtotal = $sumtotal + ($Item->bit_qty * $Item->bit_cost); ?></td>
									</tr>
								@endforeach
								</tbody>
								<thead>
									<tr>
										<td></td>
										<td></td>
										<td class="text-center"></td>
										<td class="text-right"><strong>Sub Total</strong></td>
										<td class="text-right"><strong>Rs. <?php echo $sumtotal; ?></strong></td>
									</tr>		
								</thead>
							</table>
						</div>
						<!-- end invoice item table -->
						<?php	
						$discamt =0;
						?>
						<!-- Discount table -->
						<div class="table-responsive">
							<table class="table invoice-table">
								<tbody> 
									<tr>
										<th align="right">Total Discount Amount</th>
										<td>
										<?php										
											if($data['Discount']->bds_type == "Percentage Discount")
											{
												echo $data['Discount']->bds_amt . "%";
											}
											if($data['Discount']->bds_type == "Flat Discount")
											{
												echo "Rs. " . $data['Discount']->bds_amt;
											}
										?> Discount
										</td>
										<td>
										<?php
											if($data['Discount']->bds_type == "Percentage Discount")
											{
												echo "Rs. ". $discamt = ($sumtotal * $data['Discount']->bds_amt) / 100;
											}
											if($data['Discount']->bds_type == "Flat Discount")
											{
												echo "Rs. ". $discamt = $data['Discount']->bds_amt;
											}
										?>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<!-- end Discount table -->
						<?php
						$amtafterdisc = $sumtotal - $discamt;
						$sumtax=0;
						?>
						<!-- TAX entry table -->
						<div class="table-responsive">
							<table class="table invoice-table">
								<tbody>
    							@foreach ($data['Taxrecord'] as $Taxrecord) 
									<tr>
										<td>{{$Taxrecord->tax_type}}</td>
										<td class="text-center">{{$Taxrecord->tax_amt}}% Tax</td>
										<td class="text-center">Rs. <?php
										echo ($amtafterdisc * $Taxrecord->tax_amt)/100; 
										$sumtax = $sumtax + (($amtafterdisc * $Taxrecord->tax_amt)/100);
										?></td>
									</tr>
								@endforeach
								</tbody>
								<tfoot>
									<tr>
										<th class="text-left">Total Tax amount</th>
										<th></th>
										<th class="text-right"><strong>Rs. <?php echo $sumtax; ?></strong></th>
									</tr>		
								</tfoot>
							</table>
						</div>
						<!-- End of TAX entry table -->						
						<?php
						$amtaftertax = $amtafterdisc + $sumtax;
						$sumoth = 0;
						?>
						<!-- Other charges table -->
						<div class="table-responsive">
							<table class="table invoice-table">
								<tbody>
    							@foreach ($data['OtherCharges'] as $oth) 
									<tr>
										<td>{{$oth->bch_type}}</td>
										<td></td>
										<td class="text-center">{{$oth->bch_amt}}
										<?php
										$sumoth = $sumoth + $oth->bch_amt;
										?>
										</td>
									</tr>
								@endforeach
								</tbody>
								<tfoot>
									<tr>
										<th class="text-left">Total Other Charges</th>
										<th></th>
										<th class="text-right"><strong>Rs. <?php echo $sumoth; ?></strong></th>
									</tr>		
								</tfoot>
							</table>
						</div>
						<!-- End of Other charges table -->
						
						
						<!-- Grand total table -->
						<div class="table-responsive">
							<table class="table invoice-table">
								<thead>
									<tr>
										<th>Grand Total</th>
										<th></th>
										<th class="text-right">
										<?php
										echo $amtaftertax + $sumoth;
										?>
										</th>
									</tr>
								</thead>
							</table>
						</div>
						<!-- End of Grand total table -->
						
						

						<!-- invoice footer -->
						<div class="invoice-footer">
							<div class="row">
								<div class="col-sm-12 col-print-12 left-col">
									<blockquote class="invoice-notes">
										<strong>Notes:</strong>
										<p>{{$data['ViewPurchase']->bil_note}}</p>
									</blockquote>
								</div>
							</div>
						</div>
						<!-- end invoice footer -->
						


						<!-- invoice action buttons -->
						<div class="invoice-buttons">
				<button class="btn btn-default print-btn"><i class="fa fa-print"></i> Print</button>
				<!-- <a href="#" class="btn btn-custom-primary"><i class="fa fa-arrow-right"></i> Download</a> -->
						</div>
						<!-- end invoice action buttons -->
					</div>
					<!-- INVOICE -->
				</div>
			</div>
			<!-- /main -->
	
	
	<!-- Javascript -->
	<script src="assets/js/jquery/jquery-2.1.0.min.js"></script>
	<script src="assets/js/bootstrap/bootstrap.js"></script>
	<script src="assets/js/plugins/modernizr/modernizr.js"></script>
	<script src="assets/js/plugins/bootstrap-tour/bootstrap-tour.custom.js"></script>
	<script src="assets/js/plugins/jquery-slimscroll/jquery.slimscroll.min.js"></script>
	<script src="assets/js/king-common.js"></script>
	<script src="assets/js/king-page.js"></script>
