<style type="text/css">
label {
	font-weight: 700;
}
.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:#666;
			    border-color: #666;
			    border-top: 1px solid #666;
			    color: white;
			    text-align: center;
}
.form-horizontal .form-group {
	margin-left: 0;
	margin-right: 0;
}
</style>
<style type="text/css">

td {
	font-size: 13px;
}
</style>


		<style type="text/css">
			label {
					font-weight: 700;
				  }

				.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;
				}
				
				.form-horizontal .form-group {
 					 margin-left: 0;
 					 margin-right: 0;
				}
		</style>

	<?php $this->load->view("common/header"); ?>
	<!-- end: HEAD -->
       
		<!-- start: CSS REQUIRED FOR THIS PAGE ONLY -->
		<link rel="stylesheet" type="text/css" href="<?php echo asset_url(); ?>plugins/select2/select2.css" />
		<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/DataTables/media/css/DT_bootstrap.css" />
		<link href="<?php echo asset_url(); ?>plugins/bootstrap-modal/css/bootstrap-modal-bs3patch.css" rel="stylesheet" type="text/css"/>
		<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/bootstrap-fileupload/bootstrap-fileupload.min.css">
		<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/select2/select2.css">


		<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/select2/select2.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" href="<?php echo asset_url(); ?>plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.css">
		<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/jQuery-Tags-Input/jquery.tagsinput.css">
		<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-fileupload/bootstrap-fileupload.min.css">
		<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/summernote/build/summernote.css">
        
          <link rel="stylesheet" type="text/css" href="<?php echo asset_url(); ?>css/jquery.dataTables.css">
          
          
          
          


		<!-- 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 -->
					<?php $this->load->view("common/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="<?php echo base_url('purchases_order'); ?>">
										 List Purchases Order 
									</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">  
                               <?php  
							   $message = $this->session->flashdata('message');
							   if($message){ ?>
                               	<div class="alert alert-success">
									<button type="button" class="close" data-dismiss="alert">×</button>
<?php echo $message ?> </div>
                               		
                               <?php
                               }
							    ?>
                               
                                 
							</div>

                            
						</div>
					</div>
					<!-- end: PAGE HEADER -->
					<!-- start: PAGE CONTENT 
                    <!-- start grid -->
                    <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>
									Reference ID <?php echo $po_id ?>
									<div class="panel-tools" style="top:2px;">
                                   <!-- <button class="btn btn-blue dropdown-toggle" data-toggle="dropdown">
													<i class="clip-list-5"></i> Purchases Order Details
												</button>
												<ul class="dropdown-menu dropdown-light pull-right">
														<li>
															<a id="" data-toggle="modal" href="<?php echo base_url("purchases_order/manage/$po_id"); ?>">
																<i class="fa fa-plus"></i> Update Purchases Order Details
															</a>
														</li>
														
													</ul>-->
												
									</div> <!--panel-tools-->
								</div> <!--panel-heading-->
								<div class="panel-body">
									 
<div class="well well-sm">                      
<?php //print_r($po_details);?>
<div class="col-xs-4 border-right pull-right">

<div class="col-xs-10">
<h4 class="">PO No. : <?php echo $po_details->po_reference_no;?></h4>
<p>Order Date: <?php echo date('d/M/Y', strtotime($po_details->po_datetime));?></p>
<p>Company Vat No.: </p>
<p>Delivery Date: <?php echo $po_details->po_delivery_date ?></p>
<p>Payment Term: <?php echo $po_details->po_payment_term ?> Days</p>





</div>
<div class="clearfix"></div>
</div>

<div class="col-xs-4 border-right">

<div class="col-xs-10">
<h4 class=""><p>Supplier: <?php echo $po_details->name;?></p></h4>
<p>Vat No.: <?php echo $po_details->name ?></p>
<p>Fax: </p>
<p>Project Name: <?php echo $po_details->name;?></p>

</div>
<div class="clearfix"></div>
</div>

<div class="col-xs-4 border-right">


<div class="clearfix"></div>
</div>


<div class="clearfix"></div>
</div>

 <!--col-xs-4-->



<div class="col-xs-5">
<input name="po_id" type="hidden" id="po_id" value="<?php echo $po_id ?>">
<input type="hidden" id="sale_type" name="sale_type" value="sale">


<div class="clearfix"></div>
</div> <!--col-xs-4"-->
<div class="clearfix"></div>






<div class="col-xs-12">
<br>

Note: 
	<?php //echo $purchases_order_details->purchases_order_note; ?>
    <br>
<br>


</div>

<div class="clearfix"></div>




<!-- payment list -->

<div class="row">
<div class="col-xs-12">
<div class="table-responsive">
<table class="table items table-striped table-bordered table-condensed table-hover" id="purchases_order_tbl">
															<thead>
																<tr>
																	<th class="col-md-4">Item Name</th>
																	<th style="width:80px;">Unit</th>
																	<th style="width:80px;"">Ord. Qty</th>
																	<th class="col-md-1 text-right">Rate</th>
																	<th style="width:60px;">Discount</th>
																	<th class="text-right col-md-2">Amount</th>
																</tr>
                                                                </thead>
																	<tbody>
<?php 
//print_r($reqitm_list);
$tmp_th_e=0;
if(count($reqitm_list)){ 
foreach ($reqitm_list as $key => $reqitm_dtls) {
	$tmp_th_e++;
?>
<tr id="row_e_<?php echo $tmp_th_e;?>">
			<td class="text-left">
			<?php echo $reqitm_dtls->product_name; ?>/
            <?php echo $reqitm_dtls->product_code; ?>/
            <?php echo $reqitm_dtls->product_part_no; ?>
			</td>
			<td>
            <?php echo $reqitm_dtls->unit_name; ?>
			
			</td>
			<td>
			<?php echo $reqitm_dtls->poitm_qty; ?>
			</td>
			
			
			<td><?php echo $reqitm_dtls->product_cost; ?></td>
			<td><?php echo $reqitm_dtls->poitm_dis_val; ?></td>
			<td class="text-right" style="text-align:right;">
            <?php echo number_format($reqitm_dtls->sub_total_item, 2, '.', ''); ?>
			 <?php //echo $reqitm_dtls->sub_total_item; ?>
			  
			  </td>
			
<?php  } }?>
															
																		
																	<tr>
																	  <td colspan="5" class="text-right">Total</td>
																	  <td align="right"><?php echo number_format($po_details->po_total, 2, '.', ','); ?></td>
                                                                      </tr>
																	  <tr>
																	    <td colspan="5" class="text-right">Discount</td>
																	    <td align="right"><?php $po_details->po_discount ?></td>
                                                                        </tr>
                                                                        <tr>
																	    <td colspan="5" class="text-right"><?php echo  $po_details->po_exepences_dtls ?></td>
																	    <td align="right"><?php echo number_format($po_details->po_exepences, 2, '.', ','); ?></td>
                                                                        </tr>
																      <tr>
																	    <td colspan="5" class="text-right">Vat (<?php echo $po_details->po_vat; ?>)</td>
																	    <td align="right"><?php echo $po_details->po_vat_val; ?></td>
                                                                        </tr>
																      <tr>
                                                                      
                                                                       <tr>
																	    <td colspan="5" class="text-right">NBT(<?php echo $po_details->nbt_fld_val; ?>)</td>
																	    <td align="right">
                                                                        <?php echo number_format($po_details->nbt_amount, 2, '.', ','); ?></td>
                                                                        </tr>
																      <tr>
                                                                      
                                                                     
																	  <td colspan="5" class="text-right">Net Total</td>
																	  <td align="right"><?php echo number_format($po_details->po_net_total, 2, '.', ','); ?>
																	 </td>
                                                                      </tr>
																    </tbody>
															<tfoot>
															
                                                              
															</tfoot>
														</table>


</div>
</div>
</div>
<div class="clearfix"></div>
<br>
<div class="clearfix"></div>
<!-- end payment list-->


<!-- status ox -->
<?php 
 $ref_id = new User_Model();
?>
<form role="form" class="" id="update_po_status_form" action="#" method="post">
 <div class="footer-status-change">
<div class="col-md-12">
<br>
<input name="po_id" type="hidden" value="<?php echo $po_id;?>">
<div class="panel panel-default">
<div style="font-weight: 700;" class="panel-heading">Prepared Status</div>
<div class="panel-body">
<?php //if ($this->session->userdata('ss_group_id')==1)
{ ?>
<div class="col-sm-3">
<div class="form-group">
<label>Prepared Status</label>
<select  id="po_prepared_status" class="form-control" name="po_prepared_status">
<?php 
$sel_p='';
$sel_n='';
if(isset($po_details->po_prepared_status) && $po_details->po_prepared_status=='Prepared'){
$sel_p=' selected';
}
if(isset($po_details->po_prepared_status) && $po_details->po_prepared_status==0){
$sel_n=' selected';
}	
?> 
<?php if(!$po_details->po_prepared_status){?>
<option value="0"<?php echo $sel_n;?>>Pending</option>
<?php }?>
<option value="Prepared"<?php echo $sel_p; ?>>Prepared</option>
</select>
<?php 
//echo 'pr:'.$po_details->po_approved_status;
if (check_is_avalable_permission('prepared_permission'))
{ ?>
<?php if(!$po_details->po_prepared_status){?>
     <a href="#" class="btn btn-primary show-tab" id="update_po_status_btn" onClick="update_po_status_btn('prepared');" style="margin-top:10px"> Update Prepared Status </a>
      <?php }else {
	$data['user_details']=$ref_id->get_user_info($po_details->prepared_user);
	 echo '<br/>Prepared by: '; 
	 echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
	 if($po_details->prepared_date!='0000-00-00 00:00:00'){
		  echo "<br/>Date : ".site_date_time($po_details->prepared_date);
	 }	  
		//  echo  '22';
		  ?> 
   
      <?php }?>
	 
	 <?php }?>  
             
</div>
</div>
<?php }?> 

<?php // if ($this->session->userdata('ss_group_id')==1)
{ ?>
<div class="col-sm-3">
<div class="form-group">
<label>Checked Status</label>
<select  id="po_checked_status" class="form-control" name="po_checked_status">
<?php 
$sel_c='';
$sel_n='';
if(isset($po_details->po_checked_status) && $po_details->po_checked_status=='Checked'){
$sel_c=' selected';
}
if(isset($po_details->po_checked_status) && $po_details->po_checked_status==0){
$sel_n=' selected';
}	
?> 
<?php if(!$po_details->po_checked_status){?>
<option value="0"<?php echo $sel_n;?>>Pending</option>
<?php }?>
<option value="Checked"<?php echo $sel_c; ?>>Checked</option>
</select><?php 
if (check_is_avalable_permission('checked_permission'))
{ ?>
<?php if(!$po_details->po_checked_status){?>
<?php if ($po_details->po_prepared_status){ ?>
  <a href="#" class="btn btn-primary show-tab" id="update_po_status_btn" onClick="update_po_status_btn('checked');" style="margin-top:10px"> Update Checked Status </a>  <?php }
  
  
   }?> <?php }
   
   if($po_details->po_checked_status){
    $data['user_details']=$ref_id->get_user_info($po_details->checked_user);
	 echo '<br/>Checked by: '; 
	 echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
	  if($po_details->checked_date!='0000-00-00 00:00:00'){
		  echo "<br/>Date : ".site_date_time($po_details->checked_date);
	 }
   }
   ?>                 
</div>
</div>
<?php }?>
  
  
   <?php //if ($this->session->userdata('ss_group_id')==1)
{ ?>
<div class="col-sm-3">
<div class="form-group">
<label>Authorized Status</label>
<select  id="po_authorized_status" class="form-control" name="po_authorized_status">
<?php 
$sel_a='';
$sel_n='';
if(isset($po_details->po_authorized_status) && $po_details->po_authorized_status=='Authorized'){
$sel_a=' selected';
}
if(isset($po_details->po_authorized_status) && $po_details->po_authorized_status==0){
$sel_n=' selected';
}	
?> 
<?php if(!$po_details->po_authorized_status){?>
<option value="0"<?php echo $sel_n;?>>Pending</option>
<?php }?>
<option value="Authorized"<?php echo $sel_a; ?>>Authorized</option>
</select><?php 
if (check_is_avalable_permission('authorized_permission'))
{ ?>
<?php if($po_details->po_checked_status){?>
<?php if (!$po_details->po_authorized_status){ ?>
   <a href="#" class="btn btn-primary show-tab" id="update_po_status_btn" onClick="update_po_status_btn('authorized');" style="margin-top:10px"> Update Authorized Status </a>   <?php }
   
    }}
	if ($po_details->po_authorized_status){
	$data['user_details']=$ref_id->get_user_info($po_details->authorized_user);
	 echo '<br/>Authorized by: '; 
	 echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
	  if($po_details->authorized_date!='0000-00-00 00:00:00'){
		  echo "<br/>Date : ".site_date_time($po_details->authorized_date);
	 }
}
	?>               
</div>
</div>
<?php }?>
  <?php //if ($this->session->userdata('ss_group_id')==1)
{ ?>
<div class="col-sm-3">
<div class="form-group">
<label>Approved Status</label>
<select  id="po_approved_status" class="form-control" name="po_approved_status">
<?php 
$sel_a='';
$sel_n='';
if(isset($po_details->po_approved_status) && $po_details->po_approved_status=='Approved'){
$sel_a=' selected';
}
if(isset($po_details->po_approved_status) && $po_details->po_approved_status==0){
$sel_n=' selected';
}	
?> 
<?php if(!$po_details->po_approved_status){?>
<option value="0"<?php echo $sel_n;?>>Pending</option>
<?php }?>
<option value="Approved"<?php echo $sel_a; ?>>Approved</option>
</select><?php 
if (check_is_avalable_permission('approved_permission'))
{ ?>
     <?php if($po_details->po_authorized_status){?>
     <?php if (!$po_details->po_approved_status){ ?>
       <a href="#" class="btn btn-primary show-tab" id="update_po_status_btn" onClick="update_po_status_btn('approved');" style="margin-top:10px"> Update Approved Status </a> <?php
	    } 
		
		
		} }
		if ($po_details->po_approved_status){
		$data['user_details']=$ref_id->get_user_info($po_details->approved_user);
	 echo '<br/>Approved by: '; 
	 echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
	  if($po_details->approved_date!='0000-00-00 00:00:00'){
		  echo "<br/>Date : ".site_date_time($po_details->approved_date);
	 }
		}
		?>             
</div>
</div>
<?php }?>

<div class="col-sm-12">
<div class="col-sm-3">
<div class="form-group">

<?php 
$printed_avalable=false;

 //if ($this->session->userdata('ss_user_id')==23 || $this->session->userdata('ss_group_id')==1)
 {
	if(!$po_details->printed_status)
	{
		//echo '<br/>test';
		//if($po_details->printed_status){
			
		//}
		$printed_avalable=true;
	}
	
 }

if ($printed_avalable){ ?>
<label>Printed Status</label>
<select  id="printed_status" class="form-control" name="printed_status">
<?php 
$sel_c='';
$sel_n='';
if(isset($po_details->printed_status) && $po_details->printed_status=='Printed')
{
$sel_c=' selected';
}
if(isset($po_details->printed_status) && $po_details->printed_status==0){
$sel_n=' selected';
}

		
?> 
<option value="0"<?php echo $sel_n;?>>Pending</option>

<option value="Printed"<?php echo $sel_c; ?>>Printed</option>
</select>
<a href="#" class="btn btn-primary show-tab" id="update_po_status_btn" onClick="update_po_status_btn('printed');" style="margin-top:10px"> Update Printed Status </a>
<?php }else {?>
<?php 
?>
<?php 


?>
<?php   }?>	
<?php 
  if($po_details->printed_status=='Printed'){
	  echo '<br/>'.$po_details->printed_status;
	  $ref_id = new User_Model();
	  $data['user_details']=$ref_id->get_user_info($po_details->printed_user);
	 echo '<br/>Printed by: '; 
	 echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
	  if($po_details->printed_date!='0000-00-00 00:00:00'){
		  echo "<br/>Date : ".site_date_time($po_details->printed_date);
	 }
}
  ?>
                
</div>
</div>
</div>


<div class="col-sm-3 pull-right">
<div class="form-group">
<div>&nbsp;</div>
               
</div>
</div>
   


</div>
</div>
</div>
                        </div>
                        </form>
<!-- end status box -->


<div class="buttons">
<div class="btn-group btn-group-justified">


<!--<div class="btn-group"><a title="" class="tip btn btn-primary tip" data-target="#myModal" data-toggle="modal" href="#" data-original-title="Add Payment" id="modal_ajax_sales_payment_btn"><i class="fa fa-money"></i> <span class="hidden-sm hidden-xs">Add Payment</span></a></div>
-->
<!--<div class="btn-group"><a title="" class="tip btn btn-primary tip" data-target="#myModal" data-toggle="modal" href="http://sma.tecdiary.org/sales/add_payment/2" data-original-title="Add Payment"><i class="fa fa-money"></i> <span class="hidden-sm hidden-xs">View Payment</span></a></div>-->
<!--<div class="btn-group"><a title="" class="tip btn btn-primary tip" data-target="#myModal" data-toggle="modal" href="http://sma.tecdiary.org/sales/add_delivery/2" data-original-title="Add Delivery"><i class="fa fa-truck"></i> <span class="hidden-sm hidden-xs">Add Delivery</span></a></div>-->

<div class="btn-group" onClick="fbs_click(<?php echo $po_id; ?>)"><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>
</div> <!--buttons-->
                                     
                                   
								</div> <!--panel-body-->
							</div><!--panel-->
							
						</div> <!--col-md-12-->
					</div> <!--row-->

					
                    <!-- end grid -->
                    
					
			</div>
			<!-- end: PAGE -->
		</div>
		<!-- end: MAIN CONTAINER -->
		<!-- start: FOOTER -->
		<div class="footer clearfix">
			<div class="footer-inner">
				<?php echo date("Y");?> &copy;  System by sallelanka solutions. 
			</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>

		<!-- 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"); ?>
		<!-- end: MAIN JAVASCRIPTS -->

        
  
        
		<!-- 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>

		<!-- end: JAVASCRIPTS REQUIRED FOR THIS PAGE ONLY -->
		<script>
			jQuery(document).ready(function() {
				TableData.init();
				//Main.init();
				//TableData.init();
				//UIModals.init();

			});
			





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

//$( "#update_po_status_btn" ).click(
function update_po_status_btn(type) {
	//alert(type);
	$("#update_po_status_btn").prop("disabled", true);
	 var fields = $("#update_po_status_form").serialize();
	 $.post( "<?php echo base_url();?>purchases_order/update_po_status?type="+type, fields)
	.done(function( data ) {
		  //alert();
		  var obj = jQuery.parseJSON(data);
			if(obj.error==1){
				$('.alert-success').hide();
				$('.alert-danger').show();
				//$( ".errortxt" ).text( obj.disMsg );
				bootbox.alert(obj.msg, function () {
                        
                    });
			}
			if(obj.error==0){
				displayNotice('page','Status successfully updated!');
				
				//sendUrl='<?php echo base_url();?>loan/manage/'+obj.loan_id;
				//window.location.href = sendUrl;
				
				 $("#update_po_status_btn").prop("disabled", false);
		 		 $("#update_po_status_btn").val('Update Status');
				//clearForm();
				location.reload();
			}
			
	  });
	return false;
	
}//);


var j = jQuery.noConflict();
function loadGrid(){
	alert();
	j('#employee-grid').DataTable().ajax.reload();
}
	jQuery(document).ready(function() {
		var dataTable = j('#employee-grid').DataTable( {
			"processing": true,
			"serverSide": true,
			"ajax":{
				url :"sales/list_sales", // json datasource
				type: "post",  // method  , by default get
				error: function(){  // error handling
					j(".employee-grid-error").html("");
					j("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="3">No data found in the server</th></tr></tbody>');
					//$("#employee-grid_processing").css("display","none");
				}
			}
		} );
		
	} );
	

	
<!--/purchases_order/po_details/11-->


function fbs_click(id,d) {
	u=location.href;
	t=document.title;
	window.open('<?php echo base_url() ?>purchases_order/po_details/'+id,'sharer','toolbar=0,status=0,width=700,height=700, left=10, top=10,scrollbars=yes');return false;
}
</script>
	</body>
	<!-- end: BODY -->
</html>