HR Dashboard Salary Issues
This commit is contained in:
parent
a6b5f73ac4
commit
366794633a
@ -1045,6 +1045,7 @@ function phpAlert($msg) {
|
||||
|
||||
}
|
||||
}
|
||||
$total = $total -1;
|
||||
//echo "<script> alert($ErrorEmpId + '- are have Invalid Data!'); </script>";
|
||||
if(!empty($ErrorEmpId))
|
||||
{
|
||||
|
||||
@ -80,14 +80,14 @@ class user extends BaseController
|
||||
|
||||
|
||||
/* HR DASHBOARD Controller Start*/
|
||||
|
||||
|
||||
|
||||
$data['totemp'] = $this->dahsboard_Model->totemp();
|
||||
$data['totloan'] = $this->dahsboard_Model->totloan();
|
||||
$data['totpay'] = $this->dahsboard_Model->totpay();
|
||||
$data['totrec'] = $this->dahsboard_Model->totrec();
|
||||
$data['emplist'] = $this->dahsboard_Model->emplist();
|
||||
|
||||
//print_r($data['totemp']);die;
|
||||
|
||||
|
||||
|
||||
@ -108,20 +108,10 @@ class user extends BaseController
|
||||
|
||||
$yesterday = $this->dahsboard_Model->attyesterday($WH, $date);
|
||||
//print_r($yesterday);die;
|
||||
$valuess = 0;
|
||||
foreach ($yesterday as $weekda => $value)
|
||||
{
|
||||
|
||||
if ($value[$WH] == 0)
|
||||
{
|
||||
|
||||
$valuess++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// echo $values;
|
||||
$data['today'] = $valuess;
|
||||
$data['today'] = sizeof($yesterday);
|
||||
|
||||
|
||||
|
||||
@ -388,7 +378,7 @@ class user extends BaseController
|
||||
$data['totalSalary'] = $totalSalary;
|
||||
// print_r( 'totalSalary');die;
|
||||
|
||||
|
||||
|
||||
$this->loadViews("dashboard", $this->global, $data, NULL);
|
||||
}
|
||||
|
||||
@ -565,7 +555,130 @@ function dateFunctionChangeVales()
|
||||
|
||||
$data['employeeSalary'] = $employeeSalary;
|
||||
|
||||
$working = array();
|
||||
$overtime = array();
|
||||
//$holid = array();
|
||||
$len = date('d',strtotime($date));
|
||||
for ($i = 1; $i <= $len; $i++) //echo $dat; die;
|
||||
{
|
||||
|
||||
|
||||
$Working [] = 'WH' . $i;
|
||||
$overtime [] = 'OT' . $i;
|
||||
|
||||
$CUR_month = date('t');
|
||||
// echo $CUR_month; die;
|
||||
// foreach ($holiday as $value)
|
||||
// {
|
||||
// //$holid []= 'WH'.$value;
|
||||
// if($i==$value) {
|
||||
// $holid []=$value;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
//print_r($Working);die;
|
||||
$WH = implode(",", $Working);
|
||||
|
||||
|
||||
$OT = implode(",", $overtime);
|
||||
$salarycurrentdate = array();
|
||||
|
||||
|
||||
|
||||
$toDayEmployee = $this->dahsboard_Model->dayAllPersentEmpSalary($WH, $OT, $daydate);
|
||||
|
||||
|
||||
$totalSalary = 0;
|
||||
$working = explode(",", $WH);
|
||||
$overtime = explode(",", $OT);
|
||||
foreach ($toDayEmployee as $value)
|
||||
{
|
||||
$values = 0;
|
||||
foreach ($working as $work)
|
||||
{
|
||||
// foreach ($overtime as $extra) {
|
||||
|
||||
if ($value[$work] != 0 || $value['OT' . substr($work, 2)] != 0)
|
||||
{
|
||||
$totalothour = $value['OT' . substr($work, 2)];
|
||||
//echo $totalothour;
|
||||
$values = 1;
|
||||
|
||||
//print_r($values); die;
|
||||
$Empid = $value['EmpID'];
|
||||
//echo $Empid;
|
||||
|
||||
$totalEmployeePersent = $this->dahsboard_Model->persentEmployeeDetails($Empid);
|
||||
if(!empty($totalEmployeePersent))
|
||||
{
|
||||
|
||||
$HRA_Amount = $totalEmployeePersent[0]->HRA_Amount;
|
||||
$Basic_Pay = $totalEmployeePersent[0]->Basic_Pay;
|
||||
$totalsalary = $totalEmployeePersent[0]->TotalSalary;
|
||||
$dayFoodAmt = $totalEmployeePersent[0]->Food_Allowances;
|
||||
//$allowances =$totalEmployeePersent[0]->Allowances;
|
||||
|
||||
// $Allowances = $allowances * $values;
|
||||
|
||||
|
||||
$Food_Allowances = $dayFoodAmt * $values;
|
||||
|
||||
$daySalary = $Basic_Pay / $CUR_month;
|
||||
/**per day salary working hour**/
|
||||
//echo $daySalary.'<br/>';
|
||||
|
||||
$dayHra = $HRA_Amount / $CUR_month;
|
||||
/** per day hra amount **/
|
||||
//echo $dayHra.'<br/>';
|
||||
$onehoursSalary = ($daySalary + $dayHra) / 8;
|
||||
/**one hour salay ot calculation**/
|
||||
if ($totalothour != 0) /** if ot not equal zero **/
|
||||
{
|
||||
$totSalayOT = $totalothour * $onehoursSalary;
|
||||
}
|
||||
else
|
||||
{
|
||||
$totSalayOT = 0;
|
||||
}
|
||||
$currentDaySalary = $daySalary * $values;
|
||||
/** current day salary working days calculation**/
|
||||
|
||||
|
||||
$currentDayHra = $dayHra * $values;
|
||||
/** total working days hra calculations**/
|
||||
// echo $currentDayHra.'<br/>';
|
||||
$currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
|
||||
/** current date pf calculation**/
|
||||
if ($totalsalary <= 20000)
|
||||
{
|
||||
|
||||
$esiAmount = $currentDatePF * 1.75 / 100;
|
||||
/** esiamount not elgiable for 20000 **/
|
||||
} else {
|
||||
$esiAmount = 0;
|
||||
}
|
||||
$pfAmount = $currentDaySalary * 12 / 100;
|
||||
/** pf amount per day**/
|
||||
|
||||
//echo $totalothour;die;
|
||||
$salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $Food_Allowances ;
|
||||
|
||||
$salaryInCurrentday = $salaryInCurrentdays -($esiAmount+$pfAmount);
|
||||
$totalSalarys = $totalSalary + $salaryInCurrentday;
|
||||
|
||||
$totalSalary = round($totalSalarys);
|
||||
// $salarycurrentdate[] = $salaryInCurrentday;;
|
||||
// echo 'totalSalary';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$data['totalSalary'] = $totalSalary;
|
||||
|
||||
//print_r($data['totalSalary']);die;
|
||||
// }
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
@ -7,10 +7,15 @@ class dahsboard_Model extends CI_Model
|
||||
/* HR DASHBOART Model START*/
|
||||
function totemp()
|
||||
{
|
||||
|
||||
$sql="select count(EmpID) as totemp FROM T_Employee_Details where IsActive ='1'";
|
||||
$query =$this->db->query($sql);
|
||||
return $query->result();
|
||||
$yes_date = date('Y-m-d',strtotime("-1 days"));
|
||||
// $sql="select count(*) as emp_count from T_Employee_Details where date(T_Employee_Details.Created_date) <= ? and isActive = 1";
|
||||
// $query =$this->db->query($sql,array($yes_date));
|
||||
$this->db->select('count(*) as totemp');
|
||||
$this->db->where('date(T_Employee_Details.Created_date)<=',$yes_date);
|
||||
$this->db->where('isActive',1);
|
||||
$query = $this->db->get('T_Employee_Details');
|
||||
// print_r($query->row());die;
|
||||
return $query->row();
|
||||
|
||||
}
|
||||
|
||||
@ -60,12 +65,12 @@ $sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM T_Employee_Detai
|
||||
//echo 'model' . $WH.'-'.$date;
|
||||
// $sql="select EmpID,".$WH." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)" ;
|
||||
|
||||
|
||||
$yes_date = date('Y-m-d',strtotime("-1 days"));
|
||||
$sql="select att.EmpID,".$WH.",a.FirstName from T_Attendance as att
|
||||
join T_Employee_Details as a on a.EmpID= att.EmpID
|
||||
where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance)";
|
||||
where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance) and ".$WH."=0 and date(a.Created_date) <= '".$yes_date."' and isActive=1";
|
||||
$query = $this->db->query($sql,array($date));
|
||||
// print_r($query->result());
|
||||
//print_r($query->result_array());die;
|
||||
//echo count($query->result());
|
||||
return $query->result_array();
|
||||
}
|
||||
@ -2263,30 +2268,22 @@ if ($cname!= ''){
|
||||
}
|
||||
|
||||
//home--report--Day Wise Report //
|
||||
function today_data()
|
||||
function today_data($value='')
|
||||
{
|
||||
$sql="SELECT sum(if(type = 'RECEIPT',total,0)) as daily_income_amt,
|
||||
sum(if(type = 'PAYMENT',total,0)) as daily_expenses_amt
|
||||
FROM t_income_expense
|
||||
WHERE DATE(date) = CURRENT_DATE";
|
||||
$query = $this->db->query($sql);
|
||||
$sql="SELECT type,Sum(total) as todaydata FROM t_income_expense WHERE type = ? AND DATE(date) = CURRENT_DATE";
|
||||
$query = $this->db->query($sql,array($value));
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
function monthwise_data()
|
||||
function monthwise_data($value='')
|
||||
{
|
||||
//$sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())";
|
||||
$sql="SELECT sum(if(type = 'RECEIPT',total,0)) as monthly_income_amt,
|
||||
sum(if(type = 'PAYMENT',total,0)) as monthly_expenses_amt
|
||||
FROM t_income_expense
|
||||
WHERE YEAR(date) = YEAR(curdate()) AND MONTH(date) = MONTH(curdate())";
|
||||
$query = $this->db->query($sql);
|
||||
//,array($value));
|
||||
$sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())";
|
||||
$query = $this->db->query($sql,array($value));
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
function yearwise_data()
|
||||
function yearwise_data($value='')
|
||||
{
|
||||
if (date('m') >= 4) {
|
||||
$yearl = date('Y').'-'.(date('Y')+1);
|
||||
@ -2297,47 +2294,13 @@ if ($cname!= ''){
|
||||
$fa=substr($ab,0,-5);
|
||||
$aa=substr($ab,5,5);
|
||||
|
||||
$sql="SELECT sum(if(type = 'RECEIPT',total,0)) as yearly_income_amt,
|
||||
sum(if(type = 'PAYMENT',total,0)) as yearly_expenses_amt
|
||||
FROM t_income_expense
|
||||
WHERE (date >= '".$fa."-04-01' and date <= '".$aa."-03-31')";
|
||||
$query = $this->db->query($sql);
|
||||
$sql="SELECT type,sum(total) as yearlydata from t_income_expense
|
||||
where
|
||||
type = ? and (date >= '".$fa."-04-01' and date <= '".$aa."-03-31')";
|
||||
$query = $this->db->query($sql,array($value));
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
// function today_data($value='')
|
||||
// {
|
||||
// $sql="SELECT type,Sum(total) as todaydata FROM t_income_expense WHERE type = ? AND DATE(date) = CURRENT_DATE";
|
||||
// $query = $this->db->query($sql,array($value));
|
||||
// return $query->result();
|
||||
|
||||
// }
|
||||
|
||||
// function monthwise_data($value='')
|
||||
// {
|
||||
// $sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())";
|
||||
// $query = $this->db->query($sql,array($value));
|
||||
// return $query->result();
|
||||
|
||||
// }
|
||||
// function yearwise_data($value='')
|
||||
// {
|
||||
// if (date('m') >= 4) {
|
||||
// $yearl = date('Y').'-'.(date('Y')+1);
|
||||
// } else {
|
||||
// $yearl = (date('Y')-1).'-'.date('Y');
|
||||
// }
|
||||
// $ab=$yearl;
|
||||
// $fa=substr($ab,0,-5);
|
||||
// $aa=substr($ab,5,5);
|
||||
|
||||
// $sql="SELECT type,sum(total) as yearlydata from t_income_expense
|
||||
// where
|
||||
// type = ? and (date >= '".$fa."-04-01' and date <= '".$aa."-03-31')";
|
||||
// $query = $this->db->query($sql,array($value));
|
||||
// return $query->result();
|
||||
|
||||
// }
|
||||
function departmentwise($sid='',$d='',$c='')
|
||||
{
|
||||
$sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,
|
||||
@ -2584,73 +2547,40 @@ function INRSymbol()
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
// function monthbeforetotal($month,$year){
|
||||
function monthbeforetotal($month,$year){
|
||||
|
||||
// $sql="SELECT month(date) as monthnum ,year(date) as yearnum,
|
||||
// sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||
// sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||
// FROM t_income_expense
|
||||
// WHERE
|
||||
// month(date) = '".$month."'and year(date) = '".$year."'";
|
||||
// $query = $this->db->query($sql);
|
||||
// return $query->result();
|
||||
$sql="SELECT month(date) as monthnum ,year(date) as yearnum,
|
||||
sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||
sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||
FROM t_income_expense
|
||||
WHERE
|
||||
month(date) = '".$month."'and year(date) = '".$year."'";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
// function yearbeforetotal($pre,$curr){
|
||||
// $sql="SELECT
|
||||
// sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||
// sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||
// FROM t_income_expense
|
||||
// where date >= '".$pre."-04-01' and date <= '".$curr."-03-31'";
|
||||
// $query = $this->db->query($sql);
|
||||
// return $query->result();
|
||||
// //print_r($query->result());
|
||||
function yearbeforetotal($pre,$curr){
|
||||
$sql="SELECT
|
||||
sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||
sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||
FROM t_income_expense
|
||||
where date >= '".$pre."-04-01' and date <= '".$curr."-03-31'";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
//print_r($query->result());
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
// function daybeforetotal($yesterday){
|
||||
// $sql="select date,
|
||||
// sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||
// sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||
// from t_income_expense
|
||||
// where date = ? ";
|
||||
// $query = $this->db->query($sql,array($yesterday));
|
||||
// return $query->result();
|
||||
// }
|
||||
|
||||
|
||||
function getYearlyOpeningAmt($prev_year){
|
||||
$sql="SELECT min(date),(sum(if(type = 'RECEIPT',total,0)) - sum(if(type = 'PAYMENT',total,0)) ) as opening_amt
|
||||
FROM t_income_expense
|
||||
WHERE date >= (select min(date) from t_income_expense) and date <= '".$prev_year."-03-31' ";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
//print_r($query->result());
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getMonthlyOpeningAmt($dateformat){
|
||||
//echo $dateformat;
|
||||
//die();
|
||||
$sql="SELECT month('".$dateformat."') as monthnum ,year('".$dateformat."') as yearnum,
|
||||
(sum(if(type = 'RECEIPT',total,0)) - sum(if(type = 'PAYMENT',total,0))) as opening_amt
|
||||
FROM t_income_expense
|
||||
WHERE date >= (select min(date) from t_income_expense) and date <= '".$dateformat."'";
|
||||
//WHERE month(date) between (select month(min(date)) from t_income_expense) and '".$month."' and year(date) = '".$year."'";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
function getDailyOpeningAmt($yesterday){
|
||||
$sql="select date,(sum(if(type = 'RECEIPT',total,0)) - sum(if(type = 'PAYMENT',total,0))) as opening_amt
|
||||
from t_income_expense
|
||||
where date between (select min(date) from t_income_expense) and '".$yesterday."'";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
}
|
||||
function daybeforetotal($yesterday){
|
||||
$sql="select date,
|
||||
sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||
sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||
from t_income_expense
|
||||
where date = ? ";
|
||||
$query = $this->db->query($sql,array($yesterday));
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function accountname()
|
||||
{
|
||||
|
||||
@ -109,18 +109,16 @@ if(!empty($EmpCount))
|
||||
<a href="#" class="small-box-footer"><p> <strong>TOTAL NO OF EMPLOYEES</strong> </p> </a>
|
||||
<div class="inner">
|
||||
<?php
|
||||
if(!empty($totemp))
|
||||
{
|
||||
foreach($totemp as $req)
|
||||
{
|
||||
if(!empty($totemp)){
|
||||
|
||||
|
||||
?>
|
||||
<h3><?php echo $req->totemp;?></h3>
|
||||
<h3><?php echo $totemp->totemp;?></h3>
|
||||
<p> </p>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
@ -195,7 +193,7 @@ if(!empty($EmpCount))
|
||||
|
||||
<i class="ion ion-calculator"></i>
|
||||
</div>
|
||||
<a class="small-box-footer" style="z-index:0;"> THIS MONTH : <i class="fa fa-rupee"></i> <?php echo $totalSalary;?>
|
||||
<a class="small-box-footer" style="z-index:0; "> THIS MONTH : <i class="fa fa-rupee"></i> <div id="totalSalary"> <?php echo $totalSalary;?> </div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -444,7 +442,7 @@ if(!empty($EmpCount))
|
||||
<!-- <h3> <?php echo $abs_name;?></h3>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if(!empty($abs_name)){
|
||||
foreach ($abs_name as $abs) {
|
||||
@ -456,7 +454,7 @@ if(!empty($EmpCount))
|
||||
<?php }
|
||||
}?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -581,11 +579,12 @@ $("#monthabs").val('');
|
||||
$('#datepick').change(function() {
|
||||
//var datepick = $('#emp').val();
|
||||
//alert();
|
||||
|
||||
$('#abs_name').empty();
|
||||
var id = $(this).val();
|
||||
//alert(id);
|
||||
|
||||
|
||||
|
||||
$.ajax({
|
||||
data:{id:id},
|
||||
dataType: 'json',
|
||||
@ -593,11 +592,11 @@ $('#datepick').change(function() {
|
||||
url:"<?php echo base_url();?>user/dateFunctionChangeVales",
|
||||
success:function(json) {
|
||||
// console.log(json.employeeSalary);
|
||||
|
||||
$('#abs_name').removeData();
|
||||
var abs_name = json.absname;
|
||||
$.each(abs_name,function(i,obj){
|
||||
//alert(obj);
|
||||
|
||||
|
||||
|
||||
$("#abs_name").append(obj+'<br/>');
|
||||
//$("#abs_name").html("<br/>");
|
||||
});
|
||||
@ -606,10 +605,12 @@ $('#datepick').change(function() {
|
||||
|
||||
$("#values").text(json.values);
|
||||
$("#today_salary").text(json.employeeSalary);
|
||||
//$("#totalSalary").text(json.totalSalary);
|
||||
$("#totalSalary").text(json.totalSalary);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user