<script src="js/ajax.js" type="text/javascript"></script>
>
<div class="page-content-wrapper">
                <div class="page-content">
                    <div class="page-bar">
                        <div class="page-title-breadcrumb">
                            <div class=" pull-left">
                                <div class="page-title"><?php echo 'Add Salary'; ?></div>
                            </div>
                            <ol class="breadcrumb page-breadcrumb pull-right">
                                <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="index.php?page=home">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
                                </li>
                                <li><a class="parent-item" href="index.php?page=view_staff&id=<?php echo $staffId; ?>">Staff</a>&nbsp;<i class="fa fa-angle-right"></i></li><li class="active">Add Salary</li>
                            </ol>
                        </div>
                    </div>
<div class="row">
                        <div class="col-md-12 col-sm-12">
                            <div class="card card-box">
                                <div class="card-head">
                                    <header><?php echo 'Add Salary'; ?></header>                                    
                                </div>
                                <div class="card-body" id="bar-parent1">
                                	<?php if(isset($error) && $error!='') { ?> 
                                	<div class="alert alert-danger"><?php echo $error; ?></div>
                                	<?php } else if(isset($success) && $success!=''){ ?>                                		
                                		<div class="alert alert-success"><?php echo $success; ?></div>
                                	<?php } else if(isset($_REQUEST['success'])){ ?>                                		
                                		<div class="alert alert-success"><?php echo $_REQUEST['success']; ?></div>
                                	<?php } ?>
                                    <form action="" id="form_staff_add" class="form-horizontal" method="post">
                                        <div class="form-body">                                            
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Select Staff</label>
                                                <div class="col-md-4">                                                    
                                                    <select class="form-control" name="staff" id="staff" onchange="getStaffData()" >
                                                        <option value="">Select Staff</option>
                                                        <?php if(mysqli_num_rows($staffListRs)>0){
                                                        	while($staffRec = mysqli_fetch_array($staffListRs)){ ?>   
                                                        	<option value="<?php echo $staffRec['id']; ?>" <?php if(isset($_POST['staff']) && $_POST['staff']==$staffRec['id']){ echo 'selected';} else if(isset($staffId) && $staffId==$staffRec['id']){ echo 'selected';}?> ><?php echo getStaffName($staffRec['id']); ?></option>
                                                        <?php } } ?>                                                     
                                                    </select>
                                                </div>                                                  
                                            </div> 
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Salary</label>
                                                <div class="col-md-4">                                                    
                                                    <input readonly="readonly" name="salary" type="text" id="salary" data-required="1" class="form-control" value="<?php if(isset($basicSalary) && $basicSalary!=''){ echo $basicSalary;} ?>"/>
                                                </div>
                                            </div> 
                                            <?php //echo $_POST['year'].$_POST['month'];?>
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Select Year, Month</label>
                                                <div class="col-md-2">                                                    
                                                    <select class="form-control" name="year" id="year"  onchange="getStaffData()" >
                                                        <option value="">Select Year</option>
                                                        <?php for($yr=date('Y')-1;$yr<=date('Y');$yr++){ ?>
                                                        <option value="<?php echo $yr; ?>" <?php if(isset($_POST['year']) && $_POST['year']=$yr){ echo 'selected';}?> ><?php echo $yr; ?></option>
                                                        <?php } ?>
                                                    </select>
                                                </div>    
                                                <div class="col-md-2">
                                                    <select name="month" id="month" class="form-control" onchange="getStaffData()">
														<option value="">Select Month</option>
														<?php
														 for($i=1; $i<=12; $i++) {
															 $month_name = date('F', mktime(0, 0, 0, $i, 1, 2011)); ?>
																<option value="<?php echo($i); ?>" <?php if(isset($_POST['month']) && $_POST['month']==$i) { echo('selected'); } ?>><?php echo($month_name); ?></option>
														<?php	 }	?>									 
													</select>
                                                </div>
                                            </div>                                            
                                            <div class="form-group row">
	                                            <label class="col-md-3 control-label">Salary Date</label>
	                                            <div class="input-group date form_date col-md-4" data-date="" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
	                                                <input class="form-control" size="16" value="" type="text">
	                                                <span class="input-group-addon"><span class="fa fa-remove"></span></span>
	                                                <span class="input-group-addon"><span class="fa fa-calendar"></span></span>
	                                            </div>
	                                            <input name="salary_date" id="dtp_input2" value="<?php if(isset($_POST['salary_date'])){ echo $_POST['salary_date']; }?>" type="hidden">
	                                            <br>
	                                        </div>
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Total Leaves</label>
                                                <div class="col-md-4">                                                    
                                                    <input name="tot_leaves" type="text" id="tot_leaves" data-required="1" class="form-control" value="<?php if(isset($_POST['tot_leaves']) && $_POST['tot_leaves']!=''){ echo $_POST['tot_leaves'];} ?>"/>
                                                    <div style="color:#8F0AA9;" id="msg-leaves"></div>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Incentives</label>
                                                <div class="col-md-4">                                                    
                                                    <input name="insentives" onblur="changeNetAmount()" type="text" id="insentives" data-required="1" class="form-control" value="<?php if(isset($_POST['insentives']) && $_POST['insentives']!=''){ echo $_POST['insentives'];} else { echo '0';} ?>"/>
                                                </div>
                                            </div> 
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Deductions</label>
                                                <div class="col-md-4">                                                    
                                                    <input name="deductions" onblur="changeNetAmount()" type="text" id="deductions" data-required="1" class="form-control" value="<?php if(isset($_POST['deductions']) && $_POST['deductions']!=''){ echo $_POST['deductions'];} else { echo '0';}  ?>"/>
                                                    <div style="color:#8F0AA9;" id="msg-leaves2"></div>
                                                </div>
                                            </div>  
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Advances</label>
                                                <div class="col-md-4">                                                    
                                                    <input name="advances" readonly="readonly" type="text" id="advances" data-required="1" class="form-control" value="<?php if(isset($_POST['advances']) && $_POST['advances']!=''){ echo $_POST['advances'];} else if($advanceAmount>0){ echo $advanceAmount; } ?>"/>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Advances Return</label>
                                                <div class="col-md-4">                                                    
                                                    <input name="advance_return" onblur="changeNetAmount()" type="text" id="advance_return" data-required="1" class="form-control" value="<?php if(isset($_POST['advance_return']) && $_POST['advance_return']!=''){ echo $_POST['advance_return'];} else if($advanceAmount>0){ echo $advanceAmount; } else { echo '0'; } ?>"/>
                                                </div>
                                            </div>   
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Net Amount</label>
                                                <div class="col-md-4">                                                    
                                                    <input name="net_amount" readonly="net_amount" type="text" id="net_amount" data-required="1" class="form-control" value="<?php if(isset($_POST['net_amount']) && $_POST['net_amount']!=''){ echo $_POST['net_amount'];} else if(isset($netAmount) && $netAmount!=''){ echo $netAmount;} else { echo '0';}  ?>"/>
                                                    <input name="net_amount2" readonly="net_amount2" type="hidden" id="net_amount2" data-required="1" class="form-control" value="<?php if(isset($_POST['net_amount2']) && $_POST['net_amount2']!=''){ echo $_POST['net_amount2'];} else if($basicSalary>0){ echo $basicSalary; } else { echo '0';}  ?>"/>
                                                </div>
                                            </div>                                        
                                                                                     
                                            
                                        </div>
                                      <div class="form-group">
                                            <div class="offset-md-3 col-md-9">
                                            	<?php /*if($isEdit){ ?>
                                            		<button type="submit" name="update" class="btn btn-info">Update</button>
                                            	<?php } else {*/ ?>
                                            		<button type="submit" name="add" class="btn btn-info">Add</button>
                                            	<?php //} ?>                                                
                                                <!--<button type="button" class="btn btn-default">Cancel</button>-->
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
	</div>
</div>
<script>
/*$(document).ready(function(){
    $("#insentives").change(function(){
	   alert('aa');
	});
});*/
</script>