<style type="text/css">
.report_view_th{
	background-color:#428bca;
	color:#fff !important;
	font-size:14px;	
}
.table-responsive td{
	font-size:14px;	
}
h4{
	font-size:13px;
}
.fa-3x {
  font-size: 2em !important;
}
</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('transfer'); ?>">
										List Transfer 
									</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>
									Transfer Number <?php echo $trnsfr_id ?>
									<div class="panel-tools" style="top:2px;">
												
												
									</div> <!--panel-tools-->
								</div> <!--panel-heading-->
								<div class="panel-body">
									 
<div class="well well-sm">                      

<div class="col-xs-4 border-right">
<div class="col-xs-2"><i class="fa fa-3x fa-file-text-o padding010 text-muted"></i></div>
<div class="col-xs-10">
<h4 class="">Reference No : <?php echo $trnsfr_details['trnsfr_reference_no'];?></h4>
<p>Date: <?php echo display_date_time_format($trnsfr_details['trnsfr_datetime'])?></p>

<p> Note : <?php echo ($trnsfr_details['trnsfr_note'])?></p>

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

<div class="col-xs-4 border-right">
<div class="col-xs-2"><i class="fa fa-3x fa-user padding010 text-muted"></i></div>

<h4 class="">From:<?php echo $warehouse_details['name']; ?> (<?php echo $warehouse_details['code']; ?>)</h4>
<p><?php echo $warehouse_details['address']; ?></p>
<p>Tel: <?php echo $warehouse_details['phone']; ?></p>
</div>

<div class="col-xs-4">
<div class="col-xs-2"><i class="fa fa-3x fa-building-o padding010 text-muted"></i></div>
<div class="col-xs-10">
<h4 class="">To:<?php echo $to_warehouse_details['name']; ?> (<?php echo $to_warehouse_details['code']; ?>)</h4>

<p><?php echo $warehouse_details['address']; ?></p>
<p>Tel: <?php echo $warehouse_details['phone']; ?></p> </div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div> <!--col-xs-4-->



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


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





<?php
$tmpcount_2=0;
?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped print-table order-table">
<thead>
<tr class="report_view_th">
<th>No</th>
<th>Description (Code)</th>
<th>Quantity</th>
<th style="text-align:center; vertical-align:middle;">Cost</th> <th style="padding-right:20px;">Discount</th>
<th style="padding-right:20px;">Subtotal</th>
</tr>
</thead>
<tbody>
 <?php 
  $tra_mod=new Transfer_Model();
 $tmpcount=0;
 
  foreach ($trnsfr_item_list as $row)
 {
	 $tmpcount++;
	 $subtotal=0;
	 $subtotal=$subtotal+$row['trnsfr_itm_quantity']*$row['trnsfr_itm_unit_price'];
	 
	 $tmpcount_2=$tmpcount_2+$row['trnsfr_itm_quantity'];
 ?>  
<tr>
<td style="text-align:center; width:40px; vertical-align:middle;"><?php echo $tmpcount ?></td>
<td style="vertical-align:middle;"><?php echo $row['product_name']; ?> (<?php echo $row['product_code']; ?>)
<?php if ($row['product_part_no']) echo ", Part No.:".$row['product_part_no']; ?>
<?php if ($row['product_oem_part_number']) echo ", OEM Part No.:".$row['product_oem_part_number']; ?>

 <?php 
 $sn_list=$tra_mod->get_transfer_serial_by_id($trnsfr_id,$row['trnsfr_itm_id']);
if(!empty($sn_list)){
echo "<br/> Serial No. ";
foreach ($sn_list as $sn) { 
echo "($sn->tis_number) , ";

}
}
?>
</td>
<td style="width: 100px; text-align:center; vertical-align:middle;">
<?php echo number_format($row['trnsfr_itm_quantity'], 2, '.', ''); ?>
</td>
<td><?php echo number_format($row['trnsfr_itm_unit_price'], 2, '.', ','); ?></td>
 <td style="text-align:right; width:120px; padding-right:10px;"></td>
<td style="text-align:right; width:120px; padding-right:10px;"><?php echo number_format($subtotal, 2, '.', ','); ?></td>
</tr>
<?php }?>
</tbody>
<tfoot>
<!--<tr>
  <td style="text-align:right; padding-right:10px;" colspan="5">Order Discount</td>
  <td style="text-align:right; padding-right:10px;"><?php echo number_format($trnsfr_details['trnsfr_inv_discount_amount'], 2, '.', ',') ?></td>
</tr>-->
<tr>
<td style="text-align:right; padding-right:10px;" colspan="2">Total  
</td>
<td style="text-align:right; padding-right:10px;" colspan="">  
<?php echo $tmpcount_2;?></td>
<td style="text-align:right; padding-right:10px;" colspan="">  
</td>
<td style="text-align:right; padding-right:10px;" colspan="">  
</td>
<td style="text-align:right; padding-right:10px;"><?php echo number_format($trnsfr_details['trnsfr_total'], 2, '.', ',') ?></td>
</tr>

</tfoot>
</table>
</div> <!--table-responsive-->



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

<form role="form" class="" id="update_trnsfr_status_form" action="#" method="post">
<input name="trnsfr_id" type="hidden" value="<?php echo $trnsfr_id;?>">
<div class="well well-sm col-xs-3 pull-left">  
<p>
<div class="form-group">
<?php //echo 'test:'.$trnsfr_details->requisitioned_status; ?>
<label>Approved Status</label>
<select  id="reviewed_status" class="form-control" name="reviewed_status" <?php if(($trnsfr_details['reviewed_status'])) echo 'style="display:none"';?>>
<?php 

$sel_r='';
$sel_n='';
if(isset($trnsfr_details['reviewed_status']) && $trnsfr_details['reviewed_status']=='Approved'){
$sel_r=' selected';
}
if(isset($trnsfr_details['reviewed_status']) && $trnsfr_details['reviewed_status']==''){
$sel_n=' selected';
}
if(isset($trnsfr_details['reviewed_status']) && $trnsfr_details['reviewed_status']=='Rejected'){
$sel_d=' selected';
}
if(!$trnsfr_details['reviewed_status'])
{	
?> 
<option value=""<?php echo $sel_n;?>>Pending</option>
<?php }?>
<?php 
 $ss_group_id=$this->session->userdata('ss_group_id');
  $ss_warehouse_id=$this->session->userdata('ss_warehouse_id'); 
 if($ss_group_id==1 || $ss_warehouse_id==$trnsfr_details['trnsfr_to_warehouse_id'])
  {?>
<option value="Approved"<?php echo $sel_r; ?>>Approved</option>
<?php }?>
<?php if($ss_group_id==1 || $ss_warehouse_id==$trnsfr_details['trnsfr_from_warehouse_id'])
{?>
<option value="Rejected"<?php echo $sel_d; ?>>Rejected </option>
<?php }?>
</select><?php 

//if (check_is_avalable_permission('reviewed_permission'))
{ ?>
<?php if(!$trnsfr_details['reviewed_status'])
{?>
<a href="#" class="btn btn-primary show-tab" id="update_po_status_btn" onClick="update_po_status_btn('reviewed');" style="margin-top:10px"> Update Approved Status </a> <?php }}?>

  <?php 
  if($trnsfr_details['reviewed_status']){
	  
	  //echo "reviewed_user:".$trnsfr_details['reviewed_user'];
	  $ref_id = new User_Model();
	  $data['user_details']=$ref_id->get_user_info($trnsfr_details['reviewed_user']);
	  echo '<br/>'.$trnsfr_details['reviewed_status']; 
	 echo '<br/>Reviewed by: '; 
	 echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
	 if($trnsfr_details['reviewed_date']!='0000-00-00 00:00:00'){
		  echo "<br/>Date : ".site_date_time($trnsfr_details['reviewed_date']);
	 }
	 
	 
	 
  }
  
  /* if($trnsfr_details['disable_status']=='Disable'){
	  $ref_id = new User_Model();
	  $data['user_details']=$ref_id->get_user_info($trnsfr_details['disable_user']);
	 echo '<br/>Disable by: '; 
	 echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
	 if($trnsfr_details['disable_date']!='0000-00-00 00:00:00'){
		  echo "<br/>Date : ".site_date_time($trnsfr_details['disable_date']);
	 }
  }*/
  ?>              
</div>
</div>
</form>
</p>
</div>

<div class="well well-sm col-xs-6 pull-right">                      


<div class="col-xs-10">

<p>Created by :

<?php 
if($trnsfr_details['user_id']){
	  $ref_id = new User_Model();
	  $data['user_details']=$ref_id->get_user_info($trnsfr_details['user_id']);
	
	 echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name']; 
}

?>

  </p>
<p>Date:<?php echo display_date_time_format($trnsfr_details['trnsfr_datetime'])?></p>

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

<div class="clearfix"></div>
</div> <!--well well-sm col-xs-6 pull-right-->



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


<div class="btn-group" onClick="fbs_click(<?php echo $trnsfr_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 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>

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

function update_po_status_btn(type) {
				$("#update_trnsfr_status_btn").prop("disabled", true);
	 var fields = $("#update_trnsfr_status_form").serialize();
	 $.post( "<?php echo base_url();?>transfer/update_trnsfr_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_trnsfr_status_btn").prop("disabled", false);
		 		 $("#update_trnsfr_status_btn").val('Update Status');
				location.reload();
				//clearForm();
			}
			
	  });
	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 :"transfer/list_transfer", // 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");
				}
			}
		} );
		
	} );
	
	function test1(){
		alert();
	}
	

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