		<?php 
	//	echo "ss:".$ss;
		?>
		<style type="text/css">
		
			body .modal {
	    /* new custom width */
	    width: 750px;
	    /* must be half of the width, minus scrollbar on the left (30px) */
	    margin-left: -375px;
			}

			</style>
            
            <form role="form" class="form-horizontal" id="create_fixed_assets_form" action="#" method="post">
<input type="hidden" value="<?php echo $type;?>" name="type" id="type"/>
<input type="hidden" value="<?php echo $acctrnss_id;?>" name="acctrnss_id" id="acctrnss_id"/>
<form role="form" class="form-horizontal" id="create_fixed_assets_form" action="#">

<div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title"><?php echo $pageName ?></h4>
            <font style="color:#333;">Please fill in the information below. The field labels marked with * are required input fields.</font>
            </div>
    
            
            <div class="modal-body">
            <div id="error"></div>
                <div class="row">
                <div class="col-md-12">
                 <div class="col-md-12">
                

                 <?php $ss_group_id=$this->session->userdata('ss_group_id') ?>
                 <div class="form-group" <?php if ($ss_group_id!=1) echo " style=\"display:none;\""; ?>>
                   
                      <h5>Warehouse * </h5>
                      
                      <?php 
                      $ss_warehouse_id=$this->session->userdata('ss_warehouse_id');
                      $mod_warehouse=new Common_Model();
						
						$warehouse_des=$mod_warehouse->get_warehouse_info($ss_warehouse_id);
						if($ss){
						echo $warehouse_des['name'];
						}
                      ?>
                      
                      
                      <select id="warehouse_id" class="form-control warehouse_id_multi search-select" name="warehouse_id" <?php if($ss) echo 'style="display:none;"'; ?> >
                        
                        <!--<option value="">-- Select Warehouse --</option>-->
                        
                        <?php 

																 $ss_warehouse_id=$this->session->userdata('ss_warehouse_id'); 

                                                              foreach ($warehouse_list as $row)

                                                              {

																  $sel='';

																  if($ss_warehouse_id==$row->id)

																  {

																	  $sel=' selected="selected"';
																  }
																	  
																	  
																	  ?>
																	  <option value="<?php echo $row->id; ?>" <?php echo $sel ?> > <?php echo $row->name; ?> </option>
																	  
																	  <?php

																  

                                                              ?>
                        
                        <?php }?>
                      </select>
                    </div>
                    </div>
                    
                    
                    <div class="col-md-5">
                        
                        
                    
                    
                    <?php //print_r($transactions_details);?>
                    <!-- <div class="form-group">
                        <h5>Code*</h5>
                       <input type="text" class="form-control" name="fxd_ass_serial_no" id="fxd_ass_serial_no" <?php echo (isset($transactions_details['fxd_ass_serial_no']))?'value="'.$transactions_details['fxd_ass_serial_no'].'"':null;?>>
                        </div>-->
                        
                        
                        
                        
                
                       
                        <div class="form-group">
                        <h5>Supplier * </h5>
                        <?php //print_r($transactions_type);?>
                            
                            	<select id="supplier_id" name="supplier_id" class="form-control search-select">

								                                <option value="">&nbsp;</option>

									                             <?php foreach ($supplier as $key => $sup) {

									                                echo"<option value=".$sup->supp_id.">".$sup->supp_company_name."</option>";

									                             } ?>  

								                             </select>
								                             
                        </div>
                        
                        <div class="form-group" id="to_warehouse_id_wap" style="display:none;">
                   
                      <h5>To Warehouse * </h5>
                      <select id="to_warehouse_id" class="form-control" name="to_warehouse_id">
                        
                        <option value="">-- Select --</option>
                        
                        <?php 

																 $ss_warehouse_id=$this->session->userdata('ss_warehouse_id'); 

                                                              foreach ($warehouse_list as $row)

                                                              {

																  $sel='';

																  if($ss_warehouse_id==$row->id)

																  {

																	 // $sel=' selected="selected"';

																  }

                                                              ?>
                        <option value="<?php echo $row->id; ?>" <?php echo $sel ?> > <?php echo $row->name; ?> </option>
                        <?php }?>
                      </select>
                    </div>
                       
                   <div class="form-group">
                        <h5> Amount*</h5>
                       <input type="text" class="form-control" name="spa_amount" id="spa_amount" <?php echo (isset($transactions_details['spa_amount']))?'value="'.$transactions_details['spa_amount'].'"':null;?>>
                        </div>
                        
                        <div class="form-group">
                        <h5> Deduction/Addition</h5>
                        
                        <input type="radio" checked  name="spa_debit_credit" value="1"  <?php //if(isset($salary_pay_byid['sp_is_sal_advance']) && $salary_pay_byid['sp_is_sal_advance'] == 1){echo 'checked';} else{echo 'checked';} ?>/>Deduction
                            <input type="radio"  name="spa_debit_credit" value="0"  <?php //if(isset($salary_pay_byid['sp_is_sal_advance'])){if($salary_pay_byid['sp_is_sal_advance'] == 0){echo 'checked';}} ?>/>Addition
                       
                       
                        </div>
                      
                        </div>
                  <div class="col-md-5 pull-right">
                   <div class="form-group" <?php if ($ss_group_id!=1) echo " style=\"display:none;\""; ?>>
                               <h5> Date *</h5>
                              <?php $nowdate=date("Y-m-d H:i:s");?>
                              <input id="spa_datetime" name="spa_datetime" type='text' class="form-control date"  value="<?php echo date("Y/m/d");?>" readonly/> 
                    </div> 
                   <div class="form-group">
                        <h5>Details</h5>
                       <textarea type="text" class="form-control" name="acctrnss_details" id="acctrnss_details" style="height:60px"><?php if(isset($transactions_details['acctrnss_details'])){echo htmlentities($transactions_details['acctrnss_details']);}?> </textarea>
                       </div>
                
       
       
              
                
                
         
                </div>
                
                </div> <!--col-md-12-->
            </div>
            <div class="modal-footer">
            <input id="add_category" type="submit" name="add_category" value="<?php echo $btnText; ?>" class="btn btn-primary">
            </div>
</form>
		<!-- start: JAVASCRIPTS REQUIRED FOR THIS PAGE ONLY VALIDATION -->
		<script src="<?php echo base_url(); ?>thems/js/form-validation-supplier-payment-adjustment.js"></script>
		<!-- end: JAVASCRIPTS REQUIRED FOR THIS PAGE ONLY  VALIDATION-->
      
        
<script type="text/javascript">

$( "#fxd_ass_id" ).change(function() {
    if(this.value==3){
        
        $("#to_warehouse_id_wap").show();
    }
    else {
        
         $("#to_warehouse_id_wap").hide();
    }
 // alert(this.value);
});

//$("#warehouse_id").select2();
$(".warehouse_id_multi").select2();

jQuery(document).ready(function() {
	
				FormValidator.init();
				
				$("#supplier_id").select2();
				
				<?php if($ss){ ?>
				$('#fxd_ass_id option:not(:selected)').prop('disabled', true);
				<?php } ?>
				//$("#fa_type_id").select2();
				
				/*
				var currentDate = new Date();
				if($('#type').val()=="E"){
				$('#acctrnss_date').datetimepicker({
				 format: 'YYYY/MM/DD',
				defaultDate:"<?php if(isset($transactions_details['acctrnss_date'])){ echo $transactions_details['acctrnss_date'];}?>"
				});
				 }
				 if($('#type').val()=="A"){
				$('#acctrnss_date').datetimepicker({
				 format: 'YYYY/MM/DD',
				defaultDate:currentDate
				});
				 }
				 */
				 
			});
			
			
			
function insertFixedAssetsData(){
	
	 $("#add_category").prop("disabled", true);

		  $("#add_category").val('Please wait...');
		  
var fields=$('#create_fixed_assets_form').serialize();
//alert(fields);
$.post( "<?php echo base_url('supplier_payment_adjustment/save_supplier_payment_adjustment'); ?>",fields)
	  .done(function( data ) {
		
	
	  var obj = jQuery.parseJSON(data);
	  //alert(obj.status);
	  var status=parseInt(obj.status);
	  if(status==0){
	     // alert(1111);
	       alert(obj.error_msg);
	       
	        $("#add_category").prop("disabled", false);

		  $("#add_category").val('Add');
	       /*
	      $('div#error').html('<div class="alert alert-block alert-danger fade in"><button type="button" class="close" data-dismiss="alert">×</button><h4 class="alert-heading"><i class="fa fa-times-circle"></i> Error!</h4>'+obj.validation+obj+error_msg+'</div>');
	      */
		//$('body').modalmanager('removeLoading');
	//	$('body').attr('class','');
	  }else{
	     //alert(222);
	  }
	  
	  
	 if (obj.status=='0') 
	{
	    /*
	    alert(error_msg);
	    
		$('div#error').html('<div class="alert alert-block alert-danger fade in"><button type="button" class="close" data-dismiss="alert">×</button><h4 class="alert-heading"><i class="fa fa-times-circle"></i> Error!</h4>'+obj.validation+obj+error_msg+'</div>');
		*/
	//	$('body').attr('class','');
		
	} else {
		
	  $('div#ajax-modal').modal('hide');
	  
	 
			 // loadGrid();// load customer data
	  if(obj.type=='E'){
		 displayNotice('page','Supplier Payment Adjustment has been updated successfully!');
		 
	  }
	  if(obj.type=='A'){
		displayNotice('page','Supplier Payment Adjustment has been added successfully!')  ;
	  }	
	  
	  setTimeout(
  function() 
  {
      
	  location.reload(true);
    //do something special
  }, 1000);
  
	  
	}
	  

	  });
return false;
}
$(':checkbox').on('change',function(){
$(':checkbox').not(this).prop('checked',false);
});
    </script>