	<?php $this->load->view("common/header"); ?>
	<!-- end: HEAD -->
		<!-- start: CSS REQUIRED FOR THIS PAGE ONLY -->
		
        <!--<link href="<?php echo asset_url(); ?>plugins/bootstrap-modal/css/bootstrap-modal.css" rel="stylesheet" type="text/css"/>
		<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/datepicker/css/datepicker.css">
		<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css">
		<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-daterangepicker/daterangepicker-bs3.css">
        
          <link rel="stylesheet" type="text/css" href="<?php echo asset_url(); ?>css/jquery.dataTables.css">
-->
		<style type="text/css">
			.table > thead:first-child > tr:first-child > th, .table > thead:first-child > tr:first-child > td, .table-striped thead tr.primary:nth-child(2n+1) th {
			    background-color: #428bca;
			    border-color: #357ebd;
			    border-top: 1px solid #357ebd;
			    color: white;
			    text-align: center;
			}
			td{
				vertical-align:top !important;
				
			}
.sn_list_table td{
	padding:3px;
	
}
		</style>
		<!-- end: CSS REQUIRED FOR THIS PAGE ONLY -->
	<!-- end: HEAD -->
	<!-- start: BODY -->
	<body>
		<!-- start: HEADER -->
		<div class="navbar navbar-inverse navbar-fixed-top">
			<!-- start: TOP NAVIGATION CONTAINER -->
			<div class="container">
				<div class="navbar-header">
					<!-- start: RESPONSIVE MENU TOGGLER -->
					<button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
						<span class="clip-list-2"></span>
					</button>
					<!-- end: RESPONSIVE MENU TOGGLER -->
					<!-- start: LOGO -->
					<!-- start: LOGO -->
					<?php $this->load->view("common/logo"); ?>
					<!-- end: LOGO -->
					<!-- end: LOGO -->
				</div>
				<div class="navbar-tools">
					<!-- start: TOP NAVIGATION MENU -->
				<?php $this->load->view("common/notifications.php"); ?>
					<!-- end: TOP NAVIGATION MENU -->
				</div>
			</div>
			<!-- end: TOP NAVIGATION CONTAINER -->
		</div>
		<!-- end: HEADER -->
		<!-- start: MAIN CONTAINER -->
		<div class="main-container">
			<div class="navbar-content">
				<!-- start: SIDEBAR -->
				<?php $this->load->view("common/navigation"); ?>
				<!-- end: SIDEBAR -->
			</div>
			<!-- start: PAGE -->
			<div class="main-content">
				<!-- end: SPANEL CONFIGURATION MODAL FORM -->
				<div class="container">
					<!-- start: PAGE HEADER -->
					<div class="row">
						<div class="col-sm-12">
							<!-- start: PAGE TITLE & BREADCRUMB -->
							<ol class="breadcrumb">
								<li>
									<a href="<?php echo base_url('dashboard'); ?>">
										 Dashboard 
									</a>
								</li>
                                <li>
									<a href="#">
										 Purchases 
									</a>
								</li>
                                
								<li class="active">
									View
								</li>
								<li class="search-box">
									<form class="sidebar-search">
										<div class="form-group">
											<input type="text" placeholder="Start Searching...">
											<button class="submit">
												<i class="clip-search-3"></i>
											</button>
										</div>
									</form>
								</li>
							</ol>
							<div class="page-header">
							</div>
						</div>
					</div>
					<!-- end: PAGE HEADER -->
					<!-- start: PAGE CONTENT 
                    <!-- start grid -->
                    <style type="text/css">
						                    	h2 {
						    font-size: 16px;
						    font-weight: bold;
						    line-height: 16px;
						}
                    </style>
                    <div class="row">
						<div class="col-md-12">
							<!-- start: DYNAMIC TABLE PANEL -->
							<div class="panel panel-default">
								<div class="panel-heading">
									<i class="fa fa-external-link-square"></i>
								</div>
								<div class="panel-body">
									<div class="box-content">
									   <div class="row">
									      <div class="col-lg-12">
									         <div class="well well-sm">
									            <div class="col-xs-4 border-right">
									               <div class="col-xs-2"><i class="fa fa-3x fa-building padding010 text-muted"></i></div>
									               <div class="col-xs-10">
									               <?php //print_r($po_header) ?>
									               		<input type="hidden" id="sale_id" value="<?php echo $purchas_id; ?>">
									               		<input type="hidden" id="sale_type" value="grn">
									                  <h2 class=""><?php echo $po_header[0]->supp_company_name; ?></h2>
									                  Supplier Address<br>
									                  <?php echo $po_header[0]->supp_address; ?>
									                  <p></p>
									                  Tel: <?php echo $po_header[0]->supp_contact_person_phone; ?>
									                  <br>Email: <?php echo $po_header[0]->supp_contact_person_email; ?>
									               </div>
									               <div class="clearfix"></div>
									            </div>
									            <div class="col-xs-4">
									               <div class="col-xs-2"><i class="fa fa-3x fa-truck padding010 text-muted"></i></div>
									               <div class="col-xs-10">
									                  <h2 class="">Stock Manager Advance</h2>
									                  <?php echo $po_header[0]->name; ?>
									                  <p><?php echo $po_header[0]->address; ?></p>
									               </div>
									               <div class="clearfix"></div>
									            </div>
									            <div class="col-xs-4 border-left">
									               <div class="col-xs-2"><i class="fa fa-3x fa-file-text-o padding010 text-muted"></i></div>
									               <div class="col-xs-10">
									                  <h2 class=""><?php echo $po_header[0]->reference_no; ?></h2>
									                  <p style="font-weight:bold;">Date: <?php echo $po_header[0]->date; ?></p>
									                  <p>Supplier Ref. No.<?php echo $po_header[0]->supp_invocie_no; ?>  </p>
									                  
									                  <p><strong>Note: <?php echo $po_header[0]->note; ?></strong> </p>
									               </div>
									               <div class="clearfix"></div>
									            </div>
									            <div class="clearfix"></div>
									         </div>
									         <div class="table-responsive">
									            <table class="table table-bordered table-hover table-striped print-table order-table">
									               <thead>
									                  <tr>
									                     <th>#</th>
									                     <th>Description (Code)</th>
									                     <th>Product ID<!-- Warranty (Month) --> </th>
									                     <th>Quantity</th>
									                     <th style="padding-right:20px;">Unit Cost</th>
									                       <th style="padding-right:20px;">Min. Sell. Price</th>
									                         <th style="padding-right:20px;">Selling Price</th>
									                    <!--  <th style="padding-right:20px; text-align:center; vertical-align:middle;">Tax</th> -->
									                     <th style="padding-right:20px; text-align:center; vertical-align:middle;">Discount</th>
									                     <th style="padding-right:20px;">Subtotal</th>
									                  </tr>
									               </thead>
									               <tbody>
									               <?php 
												 //  print_r($po_header[0]);
												   $pur_ord_mod=new purchases_model();
												  $j=0;
												  // print_r($sn_list);
												   foreach ($po_middle as $po_middle) { 
												   $j++;
												   ?>
									                  <tr>
									                     <td style="text-align:center; width:40px; vertical-align:middle;"><?php echo $j ?></td>
									                     <td style="vertical-align:middle;">
<?php echo $po_middle->product_name_c; ?> (<?php echo $po_middle->product_id; ?>)
<br/>
<!-- 
<a onClick="print_barcode('<?php echo $po_middle->product_id; ?>'); return false;" href="#"><i class="fa fa-print"></i> Print Barcode</a> -->
<?php 
 $sn_list=$pur_ord_mod->get_purchese_serial_by_id($purchas_id,$po_middle->id);
 if(!empty($sn_list)){
     
echo "<br/> Serial No. : ";
?>
<table class="sn_list_table">

<?php
$k=0;
foreach ($sn_list as $sn) { 
    $k++;
    $pis_cash_price=$sn->pis_cash_price;
   // echo "pis_min_cash_price:".  
    $pis_min_cash_price=$sn->pis_min_cash_price;
    
    $pieces = explode("_", $sn->pis_number);
    //echo $pieces[0]; // piece1
   // echo $pieces[1]; // piece2
    
?>
<tr>
<td>
     <?php echo $k; ?>. <!--<input onClick="set_old_sn(this.value)" name="" id="sn_val_<?php echo $sn->pis_id;?>" type="text" value="<?php echo "$sn->pis_number";?>" <?php echo 'readonly'; ?>>-->  <?php echo $pieces[0]; //echo "$sn->pis_number ";?>   
<?php //echo " Price :$sn->pis_cash_price";?></td>
<td>
<?php if($this->session->userdata('ss_group_id')==1){?>
<!--<span class="label label-success" onClick="update_serial_no_by_id('<?php echo $sn->pis_id;?>')" style="cursor:pointer">
 <i class="fa fa-edit" style="font-size:11px; margin-top:9px;"></i></span>-->
 <?php }?>
 </td>
</tr>
<?php

}
?>
</tr></table>
<?php
 }
?>


<div style="cursor:pointer;" onClick="print_grn_item_barcode('<?php echo $purchas_id;?>','<?php echo $po_middle->id;?>','<?php echo $po_middle->quantity; ?>'); return false;">
    <i class="fa fa-print"></i> Print Serial</div>
 </td>
									                     <td style="width: 120px; text-align:center; vertical-align:middle;"><?php //echo $po_middle->product_w; ?>
									            <?php echo $po_middle->product_id; ?>          
									                     </td>
									                     <td style="width: 120px; text-align:center; vertical-align:middle;"><?php echo $po_middle->quantity; ?></td>
									                     <td style="text-align:right; width:120px; padding-right:10px;"><?php echo $po_middle->unit_price; ?></td>
									                     <td style="text-align:right; width:120px; padding-right:10px;"><?php echo $pis_min_cash_price; ?></td>
									                     <td style="text-align:right; width:120px; padding-right:10px;"><?php echo $pis_cash_price; ?></td>
									                     
									                    <!--  <td style="width: 120px; text-align:right; vertical-align:middle;">00.00</td> -->
									                     <td style="width: 120px; text-align:right; vertical-align:middle;"> <?php echo $po_middle->discount; ?></td>
									                     <td style="text-align:right; width:120px; padding-right:10px;"><?php echo $po_middle->sub_total; ?></td>
									                  </tr>
									                <?php } ?>

									               </tbody>
									               <tfoot>
									                  <tr>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="8">
									                        Total Amount (LKR)
									                     </td>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;">
									                        <?php echo number_format($po_header[0]->total,2,'.',','); ?> 
									                     </td>
									                  </tr>
									                  <tr>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="8">Deduction</td>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;"><?php echo $po_header[0]->discount; ?></td>
									                  </tr>
									                  
									                  <tr>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="8">Addition</td>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;"><?php echo $po_header[0]->poaddition; ?></td>
									                  </tr>
									                  
									                  <tr>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="8">Grand Total (LKR)</td>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;"><?php echo number_format($po_header[0]->grand_total,2,'.',','); ?>
   <input id="pur_grand_tot_amt" type="hidden" value="<?php echo $po_header[0]->grand_total;?>">                                                       
                                                         </td>
									                  </tr>
									                  <tr>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="8">Paid (LKR)</td>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;">
														 <?php echo number_format($po_paid_total[0]->grn_paid_total,2,'.',','); ?>
                                                         <input id="pur_paid_amt" type="hidden" value="<?php echo $po_paid_total[0]->grn_paid_total;?>">
                                                         </td>
									                  </tr>
									                  <tr>
									                     <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="8">Balance (LKR)</td>

									                     <td style="text-align:right; padding-right:10px; font-weight:bold;">
									                     <?php 
									                     echo number_format($po_header[0]->grand_total - $po_paid_total[0]->grn_paid_total,2,'.',',');
									                     ?>
									                     </td>
									                  </tr>
									               </tfoot>
									            </table>
									         </div>
  
  <!-- added user details -->
  <div class="well well-sm col-xs-6 pull-right">                      


<div class="col-xs-10">
<p>
<?php


if($po_header[0]->user){
	  $ref_id = new User_Model();
	  $data['user_details']=$ref_id->get_user_info($po_header[0]->user);
	 echo '<br/>Created by: '; 
	 echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name']; 
}


// echo $sale_details['user'];?>
<!--<br>

Created by : <?php echo $this->session->userdata('ss_user_first_name'); ?> (<?php echo $this->session->userdata('ss_user_group_name'); ?>) --></p>

<p>Date:<?php echo display_date_time_format($po_header[0]->date)?></p>
 </div>
<div class="clearfix"></div>

<div class="clearfix"></div>
</div> <!--well well-sm col-xs-6 pull-right--> 
  </div>  
  <!-- end added user details -->                                           
 <div class="row">
 <div class="col-xs-12"></div>
 </div>                                             
                                             
                                             
                                             
									         <div class="row">
									            <div class="col-xs-7"></div>
									         </div>
									      </div>
									   </div>
									   <div class="row">
									      <div class="col-xs-12">
									         <div class="table-responsive">
									            <table class="table table-bordered table-striped table-condensed">
									               <thead>
									                  <tr>
									                     <th>Date</th>
									                     <th>Payment Reference</th>
									                     <th>Paid by</th>
									                     <th>Amount</th>
									                     <th>Created by</th>
									                  </tr>
									               </thead>
									               <tbody>
									               <?php foreach ($po_payment as $key => $po_payment) {?>
									                  <tr>
									                     <td valign="top"><?php echo $po_payment->sale_pymnt_date_time; ?></td>
									                     <td valign="top">
														 <?php 
														 echo $po_payment->sale_pymnt_id;
														  if($po_payment->sale_pymnt_ref_no) echo "<br/>Ref.: ".$po_payment->sale_pymnt_ref_no;
														 if($po_payment->sale_pymnt_cheque_no) echo "<br/>Cheque No.: ".$po_payment->sale_pymnt_cheque_no;
														 if($po_payment->sale_pymnt_note) echo "<br/>Note: ".$po_payment->sale_pymnt_note;
														 
														 ?>
                                                         </td>
									                     <td valign="top"><?php echo $po_payment->sale_pymnt_paying_by;?></td>
									                     <td valign="top">LKR <?php echo number_format($po_payment->sale_pymnt_amount,2,'.',',');?></td>
									                     <td valign="top">Owner</td>
									                  </tr>
									               <?php } ?>
									               </tbody>
									            </table>
									         </div>
									      </div>
									   </div>
									   <div class="buttons">
									      <div class="btn-group btn-group-justified">
                                          
                                          <!-- 
									         <div class="btn-group">
                                             <a data-toggle="modal" data-target="#myModal" title="" class="tip btn btn-primary tip" href="#" id="" data-original-title="" onClick="print_barcode_grn('<?php echo $purchas_id; ?>'); return false;">
                                             <i class="fa fa-money"></i>
									            <span class="hidden-sm hidden-xs">Print All Items Barcode</span></a>
									         </div> -->
									         
									          <div class="btn-group">
                                             <a data-toggle="modal" data-target="#myModal" title="" class="tip btn btn-primary tip" href="#" id="" data-original-title="" onClick="print_grn_item_barcode('<?php echo $purchas_id; ?>',''); return false;">
                                             <i class="fa fa-money"></i>
									            <span class="hidden-sm hidden-xs">Print All Serial</span></a>
									         </div>
                                             <!-- 
                                              <div class="btn-group">
                                             <a data-toggle="modal" data-target="#myModal" title="" class="tip btn btn-primary tip" href="#" id="" data-original-title="" onClick="print_barcode_grn_v2('<?php echo $purchas_id; ?>'); return false;">
                                             <i class="fa fa-money"></i>
									            <span class="hidden-sm hidden-xs">Print All Items Barcode V2</span></a>
									         </div>
									         -->
                                            
                                             
                                              <div class="btn-group">
                                             <a data-toggle="modal" data-target="#myModal" title="" class="tip btn btn-primary tip" href="#" id="modal_ajax_sales_payment_btn" data-original-title="Add Payment">
                                             <i class="fa fa-money"></i>
									            <span class="hidden-sm hidden-xs">Add Payment</span></a>
									         </div>
									         
									         <div class="btn-group" onClick="fbs_click(<?php echo $purchas_id; ?>,'yes')"><a title="" class="tip btn btn-primary" data-original-title="Print"><i class="fa fa-print"></i> <span class="hidden-sm hidden-xs">Print</span></a></div>
									      
                                          
                                          <div class="btn-group" onClick="fbs_click(<?php echo $purchas_id; ?>,'no')"><a title="" class="tip btn btn-primary" data-original-title="Print"><i class="fa fa-print"></i> <span class="hidden-sm hidden-xs">Print Without Serial Number</span></a></div> 
                                             
                                             
									      </div>
									   </div>
									</div>
								</div>
							</div>
							<!-- end: DYNAMIC TABLE PANEL -->
						</div>
					</div>

                    <!-- end grid -->
                    
					
			</div>
			<!-- end: PAGE -->
		</div>
		<!-- end: MAIN CONTAINER -->
		<!-- start: FOOTER -->
		<div class="footer clearfix">
			<div class="footer-inner">
				<?php date("Y");?> Developed by: Sallelanka Solutions (pvt) Ltd.
			</div>
			<div class="footer-items">
				<span class="go-top"><i class="clip-chevron-up"></i></span>
			</div>
		</div>
		<!-- end: FOOTER -->
		<!-- start: RIGHT SIDEBAR -->
		<!-- end: RIGHT SIDEBAR -->
		<div id="event-management" class="modal fade" tabindex="-1" data-width="760" style="display: none;">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							&times;
						</button>
						<h4 class="modal-title">Event Management</h4>
					</div>
					<div class="modal-body"></div>
					<div class="modal-footer">
						<button type="button" data-dismiss="modal" class="btn btn-light-grey">
							Close
						</button>
						<button type="button" class="btn btn-danger remove-event no-display">
							<i class='fa fa-trash-o'></i> Delete Event
						</button>
						<button type='submit' class='btn btn-success save-event'>
							<i class='fa fa-check'></i> Save
						</button>
					</div>
				</div>
			</div>
		</div>
<input name="old_val" type="text" id="old_val" value="0">
		<!-- start ajax model -->
		<div id="ajax-modal" class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" style="display: none;"></div>
		<!-- end ajax model -->

		<!-- start: MAIN JAVASCRIPTS -->
		<?php $this->load->view("common/footer"); ?>
		
		 <script src="<?php echo asset_url(); ?>js/jquery-ui.js" ></script>		
		<script src="<?php echo asset_url(); ?>js/moment-with-locales.js"></script>
		<script type="text/javascript" src="<?php echo asset_url(); ?>js/bootstrap-datetimepicker.js"></script>
		
        
		<!-- start: JAVASCRIPTS REQUIRED FOR THIS PAGE ONLY -->
		<script src="<?php echo asset_url(); ?>plugins/jquery-inputlimiter/jquery.inputlimiter.1.3.1.min.js"></script>
		<script src="<?php echo asset_url(); ?>plugins/jquery.maskedinput/src/jquery.maskedinput.js"></script>
		<script type="text/javascript" src="<?php echo asset_url(); ?>plugins/bootbox/bootbox.min.js"></script>
		<script type="text/javascript" src="<?php echo asset_url(); ?>plugins/jquery-mockjax/jquery.mockjax.js"></script>
		<script type="text/javascript" src="<?php echo asset_url(); ?>plugins/DataTables/media/js/jquery.dataTables.min.js"></script>
		<script type="text/javascript" src="<?php echo asset_url(); ?>plugins/DataTables/media/js/DT_bootstrap.js"></script>
		<script src="<?php echo asset_url(); ?>js/table-data.js"></script>
		<script src="<?php echo asset_url(); ?>plugins/bootstrap-modal/js/bootstrap-modal.js"></script>
		<script src="<?php echo asset_url(); ?>plugins/bootstrap-modal/js/bootstrap-modalmanager.js"></script>
		<script src="<?php echo asset_url(); ?>js/ui-modals.js"></script>
		<script src="<?php echo asset_url(); ?>plugins/bootstrap-fileupload/bootstrap-fileupload.min.js"></script>
		<script src="<?php echo asset_url(); ?>plugins/select2/select2.min.js"></script>
        
       <script src="<?php echo asset_url(); ?>plugins/jQuery-lib/2.0.3/jquery.min.js"></script>
		<script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>js/jquery.dataTables.js"></script>

        
<script type="text/javascript" language="javascript" >

function print_barcode (product_id) {
				window.open('<?php echo base_url(); ?>products/single_barcode/'+product_id, 'sma_popup', 'width=900,height=600,scrollbars=yes,menubar=yes,status=no,resizable=yes,screenx=0,screeny=0');
			}
			
			
			function print_barcode_grn (id) {
				window.open('<?php echo base_url(); ?>products/single_barcode_grn/'+id, 'sma_popup', 'width=900,height=600,scrollbars=yes,menubar=yes,status=no,resizable=yes,screenx=0,screeny=0');
			}
			
				function print_barcode_grn_v2 (id) {
				window.open('<?php echo base_url(); ?>products/single_barcode_grn_v2/'+id, 'sma_popup', 'width=900,height=600,scrollbars=yes,menubar=yes,status=no,resizable=yes,screenx=0,screeny=0');
			}


var j = jQuery.noConflict();

function set_old_sn(val){
	$('#old_val').val(val);
}

function update_serial_no_by_id(val){
	
	if (confirm("Please confirm to update serial no")) {
   var fld_sn="#sn_val_"+val;
var updated_val=$(fld_sn).val();
var old_val=$('#old_val').val();
var id=$('#sale_id').val();
$.post( "<?php echo base_url() ?>purchases/update_serial_no_by_id", {val:val,updated_val:updated_val,old_val:old_val,id:id})

		     .done(function( data ) {

		     var obj = jQuery.parseJSON(data);

			 if(obj.status==1)// load customer data

			 {

			 displayNotice('page','Successfully updated!')

			 	//setTimeout(function(){location.reload();},1000);

			 }

			 if(obj.status==0)// load customer data

			 { 

			 displayNotice('page','Error!')

			 }

	      });

	    }
else {
   // txt = "You pressed Cancel!";
} 



}


									if (localStorage.getItem('poitems')) {
					                    localStorage.removeItem('poitems');
					                }
					                if (localStorage.getItem('podiscount')) {
					                    localStorage.removeItem('podiscount');
					                }
					                if (localStorage.getItem('tax_select')) {
					                    localStorage.removeItem('tax_select');
					                }
					                if (localStorage.getItem('poref')) {
					                    localStorage.removeItem('poref');
					                }
					                if (localStorage.getItem('powarehouse')) {
					                    localStorage.removeItem('powarehouse');
					                }
					                if (localStorage.getItem('ponote')) {
					                    localStorage.removeItem('ponote');
					                }
					                if (localStorage.getItem('posupplier')) {
					                    localStorage.removeItem('posupplier');
					                }
					                if (localStorage.getItem('supplier')) {
					                    localStorage.removeItem('supplier');
					                }
					                if (localStorage.getItem('poextras')) {
					                    localStorage.removeItem('poextras');
					                }
					                if (localStorage.getItem('podate')) {
					                    localStorage.removeItem('podate');
					                }
					                if (localStorage.getItem('postatus')) {
					                    localStorage.removeItem('postatus');
					                }
					                if (localStorage.getItem('poshipping')) {
					                    localStorage.removeItem('poshipping');
					                }
					                
function fbs_click(id ,status) {
	sendUrl='sales2/add_sales';
				//alert(sendUrl);
				//window.location.href = "<?php echo base_url();?>"+sendUrl;
		
	u=location.href;
	t=document.title;
	if(status == 'yes'){
            window.open('<?php echo base_url() ;?>purchases/purchase_details?purchase_id='+id,'sharer','toolbar=0,status=0,width=700,height=700, left=10, top=10,scrollbars=yes');return false;
        }else{
            window.open('<?php echo base_url() ;?>purchases/purchase_details?purchase_id='+id+'&status='+status,'sharer','toolbar=0,status=0,width=700,height=700, left=10, top=10,scrollbars=yes');return false;
        }
	
//	window.alert(id);
	
	
	
	
}					                
					                
	
	function print_grn_item_barcode (product_id,qty) {

				window.open('<?php echo base_url();?>purchases/single_barcode/'+product_id+'/'+qty, 'sma_popup', 'width=900,height=600,scrollbars=yes,menubar=yes,status=no,resizable=yes,screenx=0,screeny=0');

			}
						
</script>
</body>
	<!-- end: BODY -->
</html>