281 lines
6.7 KiB
PHP
Executable File
281 lines
6.7 KiB
PHP
Executable File
<?php
|
||
|
||
$monthsoptions = array("01" => "Jan", "02" => "Feb","03" => "Mar","04" => "Apr","05" => "May","06" => "June","07"=> "July","08"=> "Aug","09" => "Sep","10"=> "Oct","11" => "Nov","12"=>"Dec");
|
||
?>
|
||
|
||
|
||
<script>
|
||
|
||
|
||
|
||
$(function() {
|
||
|
||
|
||
|
||
$(".select2").select2();
|
||
|
||
$('#All').click(function(){
|
||
|
||
if ($('#All').prop('checked'))
|
||
{
|
||
$('#Employee').attr('disabled', 'true');
|
||
|
||
}
|
||
else
|
||
{
|
||
$('#Employee').removeAttr('disabled');
|
||
|
||
}
|
||
|
||
});
|
||
|
||
$('#PayOn').change(function(){
|
||
|
||
var id = $('#PayOn').val();
|
||
if(id != '-1')
|
||
{
|
||
$('#content').loader('show');
|
||
|
||
$.ajax({
|
||
data:{id1:id},
|
||
|
||
type:"POST",
|
||
url:"<?php echo base_url();?>payslip/getEmployee",
|
||
success:function(result) {
|
||
if(result)
|
||
{
|
||
$("#Employee").empty();
|
||
$('#content').loader('hide');
|
||
$("#Employee").append(result);
|
||
|
||
}
|
||
|
||
}
|
||
});
|
||
}
|
||
else
|
||
{
|
||
alert('Please select the PayOn');
|
||
return false;
|
||
}
|
||
|
||
});
|
||
|
||
|
||
$("#Calculate").click(function(){
|
||
|
||
|
||
var payon = $('#PayOn').val();
|
||
var employee = $('#Employee').val();
|
||
|
||
// alert(payon+employee);
|
||
|
||
if(payon != '-1' && employee !='-1')
|
||
{
|
||
var check = $('#All').is(":checked");
|
||
if(check){
|
||
|
||
var c=0;
|
||
var time=0;
|
||
$('#Employee').find('option').each(function() {
|
||
c++;
|
||
var employee=$(this).val();
|
||
$('#content').loader('show');
|
||
$.ajax({
|
||
data:{payon:payon,employee:employee},
|
||
type:"POST",
|
||
url:"<?php echo base_url();?>payslip/checkExistPay",
|
||
|
||
success:function(result)
|
||
{
|
||
if(result != 1)
|
||
{
|
||
$.ajax({
|
||
data:{payon:payon,employee:employee},
|
||
type:"POST",
|
||
url:"<?php echo base_url();?>payslip/callsp",
|
||
success:function(result){
|
||
$('#content').loader('hide');
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
|
||
}
|
||
});
|
||
|
||
|
||
|
||
});
|
||
time = (c * 300);
|
||
// alert(time);
|
||
setTimeout(function(){alert(c + '-Employees Salary Added Successfully!');
|
||
$('form#PayslipGenerator').submit();
|
||
alert("Please wait while Payslip Downloading...!");
|
||
$('#content').loader('hide');
|
||
},time);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} // else for select all not selected
|
||
else{
|
||
|
||
$('#content').loader('show');
|
||
|
||
$.ajax({
|
||
data:{payon:payon,employee:employee},
|
||
type:"POST",
|
||
url:"<?php echo base_url();?>payslip/checkExistPay",
|
||
|
||
success:function(result) {
|
||
|
||
|
||
if(result == 1)
|
||
{
|
||
|
||
$('form#PayslipGenerator').submit();
|
||
$('#content').loader('hide');
|
||
alert("Payslip Downloaded Successfully..!");
|
||
}
|
||
else{
|
||
|
||
$.ajax({
|
||
data:{payon:payon,employee:employee},
|
||
type:"POST",
|
||
url:"<?php echo base_url();?>payslip/callsp",
|
||
success:function(result){
|
||
$('form#PayslipGenerator').submit();
|
||
$('#content').loader('hide');
|
||
alert("Salary Calculated Successfully..!");
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
|
||
}
|
||
});
|
||
|
||
}// else for select all not selected
|
||
|
||
}// check payon select/not selected
|
||
else
|
||
{
|
||
alert('Please select the PayOn');
|
||
return false;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
});
|
||
|
||
|
||
});
|
||
|
||
|
||
|
||
</script>
|
||
|
||
<div class="content-wrapper">
|
||
<!-- Content Header (Page header) -->
|
||
<section class="content-header">
|
||
<h1>
|
||
<center>Siddharth Industries - PaySlip Generator</center>
|
||
|
||
</h1>
|
||
</section>
|
||
<section class="content">
|
||
<div class="row" style="border:2px dotted; padding:5%">
|
||
<form id="PayslipGenerator" action="<?php echo base_url() ?>PrintPdf" method="post" role="form" >
|
||
<div class="row" >
|
||
<div class="col-md-4">
|
||
|
||
<span for="selectmonth">Select Month</span>
|
||
<select id="PayOn" name="PayOn" class="form-control select2" style="width: 100%;">
|
||
<option value="-1">Select Payon Month</option>
|
||
<?php
|
||
if(!empty($Payon))
|
||
{
|
||
|
||
foreach ($Payon as $rl)
|
||
{
|
||
$m = substr($rl->Month_Year,0,2);
|
||
$y = substr($rl->Month_Year,3);
|
||
$tot = $monthsoptions[$m]."-".$y;
|
||
|
||
echo "<option value=\"".$rl->Month_Year."\">".$tot."</option>";
|
||
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</div>
|
||
<div id="content"></div>
|
||
<div class="col-md-4 col-md-offset-2">
|
||
|
||
|
||
<span>Employee</span>
|
||
<select id="Employee" name="Employee" class="form-control select2" type="text" class="form-control">
|
||
<option value="-1">Select Employee</option>
|
||
|
||
</select>
|
||
<br/>
|
||
<input type="checkbox" name="All" id="All" > Select All<br>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="col-md-4 col-md-offset-6" align = "right">
|
||
|
||
<input type="button" class="btn btn-info" id="Calculate" value="Calculate Pay"/>
|
||
|
||
|
||
|
||
|
||
</div>
|
||
<div class="row" >
|
||
|
||
|
||
|
||
<?php
|
||
$this->load->helper('form');
|
||
$error = $this->session->flashdata('error');
|
||
if($error)
|
||
{
|
||
?>
|
||
<div class="alert alert-danger alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button>
|
||
<?php echo $this->session->flashdata('error'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
<?php
|
||
$success = $this->session->flashdata('success');
|
||
if($success)
|
||
{
|
||
?>
|
||
<div class="alert alert-success alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button>
|
||
<?php echo $this->session->flashdata('success'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
|
||
<div class="row">
|
||
<div class="col-md-4">
|
||
<?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button></div>'); ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</section>
|
||
</div>
|