Payroll bugs and All Reports

This commit is contained in:
velz2020 2017-10-26 14:22:38 +05:30
parent 6dc0c4e6e0
commit 80a5631773
8 changed files with 383 additions and 252 deletions

View File

@ -78,7 +78,7 @@ function phpAlert($msg) {
if($this->input->post('Bank_Report'))
{
$data['result'] = $this->payroll_model->getReportforBank($bank,$payon);
//print_r($data['result']);die();
$totamtwords = '';
$totalamt=0.00;
if(!empty($data['result'])){
@ -88,7 +88,8 @@ function phpAlert($msg) {
}
}
$totamtwords = $this->convertNumber($totalamt);
$data['BankName']=$bank;
$data['bankdetails']=$this->payroll_model->getBankInfo($bank);
$data['Totalamount']=$totalamt;
$data['Totalamtwords']=$totamtwords;
$data['PayMonth']=$month;
@ -99,15 +100,24 @@ function phpAlert($msg) {
{
$data['PFESI'] = $this->payroll_model->getReportforPFESI($payon);
$data['PayMonth']=$month;
$data['companyinfo']=$this->payroll_model->getCompanyInformation();
//print_r($data['companyinfo']);die();
$totamtwords = '';
$totalamt=0.00;
$totemppf = 0.00;
$totemprpf = 0.00;
if(!empty($data['PFESI'])){
foreach($data['PFESI'] as $pf)
{
$totalamt += ($pf->PF + $pf->CompanyPF);
$totemppf += ($pf->PF);
$totemprpf += ($pf->CompanyPF);
}
}
$data['Totalamount']=$totalamt;
$data['TotalEmployeeContribution']=$totemppf;
$data['TotalEmployerContribution']=$totemprpf;
$totamtwords = $this->convertNumber($totalamt);
$data['Totalamtwords']=$totamtwords;
if(empty($excel)){
@ -130,14 +140,16 @@ function phpAlert($msg) {
$this->excel->getActiveSheet()->setCellValue('D4', 'Employee Contribution');
$this->excel->getActiveSheet()->setCellValue('E4', 'Employeer Contribution');
$this->excel->getActiveSheet()->setCellValue('F4', 'Total Amount');
$this->excel->getActiveSheet()->setCellValue('F4', 'No Of Days Worked');
$this->excel->getActiveSheet()->setCellValue('G4', 'OT Hrs Worked');
$this->excel->getActiveSheet()->setCellValue('H4', 'Total Amount');
$this->excel->getActiveSheet()->mergeCells('A1:F1');
$this->excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(16);
$this->excel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setARGB('#333');
for($col = ord('A'); $col <= ord('F'); $col++){
for($col = ord('A'); $col <= ord('H'); $col++){
$this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(true);
$this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12);
@ -149,6 +161,10 @@ function phpAlert($msg) {
$j=1;
$total=0;
$overall=0;
$totemp = 0;
$overallemp = 0;
$totemr = 0;
$overallemr = 0;
foreach($data['PFESI'] as $row){
$this->excel->getActiveSheet()->setCellValue('A' . (string)($i),$j);
@ -160,15 +176,31 @@ function phpAlert($msg) {
$this->excel->getActiveSheet()->setCellValue('E' . (string)($i),number_format($row->CompanyPF,2,'.',''));
$this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getNumberFormat()->setFormatCode('0.00');
$this->excel->getActiveSheet()->setCellValue('E' . (string)($i+1),'Total');
$total = $row->PF + $row->CompanyPF;
$overall=$overall + $total;
$this->excel->getActiveSheet()->setCellValue('F' . (string)($i),($total));
$this->excel->getActiveSheet()->setCellValue('C' . (string)($i+1),'Total');
$this->excel->getActiveSheet()->setCellValue('F' . (string)($i),number_format($row->NoofDaysWorked,2,'.',''));
$this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getNumberFormat()->setFormatCode('0.00');
$this->excel->getActiveSheet()->setCellValue('F' . (string)($i+1),($overall));
$this->excel->getActiveSheet()->getStyle('F'.(string)($i+1))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('F'.(string)($i+1))->getNumberFormat()->setFormatCode('0.00');
$this->excel->getActiveSheet()->setCellValue('G' . (string)($i),number_format($row->OTperHours,2,'.',''));
$this->excel->getActiveSheet()->getStyle('G'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$total = $row->PF + $row->CompanyPF;
$totemp = $row->PF;
$totemr = $row->CompanyPF;
$overall=$overall + $total;
$overallemp = $overallemp + $totemp;
$overallemr = $overallemr + $totemr;
$this->excel->getActiveSheet()->setCellValue('H' . (string)($i),($total));
//$this->excel->getActiveSheet()->setCellValue('D' . (string)($i),($totemp));
//$this->excel->getActiveSheet()->setCellValue('E' . (string)($i),($totemr));
$this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getNumberFormat()->setFormatCode('0.00');
$this->excel->getActiveSheet()->setCellValue('H' . (string)($i+1),($overall));
$this->excel->getActiveSheet()->setCellValue('D' . (string)($i+1),($overallemp));
$this->excel->getActiveSheet()->setCellValue('E' . (string)($i+1),($overallemr));
$this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getNumberFormat()->setFormatCode('0.00');
//$this->excel->getActiveSheet()->setCellValue('A6','HI');
$i++;
$j++;
@ -212,16 +244,24 @@ function phpAlert($msg) {
$data['PFESI'] = $this->payroll_model->getReportforPFESI($payon);
//print_r($data['PFESI']);die();
$data['PayMonth']=$month;
$data['companyinfo']=$this->payroll_model->getCompanyInformation();
$totamtwords = '';
$totalamt=0.00;
$totemppf = 0.00;
$totemprpf = 0.00;
if(!empty($data['PFESI'])){
foreach($data['PFESI'] as $pf)
{
$totalamt += ($pf->EmployeeESI + $pf->CompanyESI);
$totemppf += ($pf->EmployeeESI);
$totemprpf += ($pf->CompanyESI);
}
}
$data['Totalamount']=$totalamt;
$totamtwords = $this->convertNumber($totalamt);
$totamtwords = $this->convertNumber($totalamt);
$data['TotalEmployeeContribution']=$totemppf;
$data['TotalEmployerContribution']=$totemprpf;
$data['Totalamtwords']=$totamtwords;
@ -244,14 +284,17 @@ function phpAlert($msg) {
$this->excel->getActiveSheet()->setCellValue('D4', 'Employee Contribution');
$this->excel->getActiveSheet()->setCellValue('E4', 'Employeer Contribution');
$this->excel->getActiveSheet()->setCellValue('F4', 'Total Amount');
$this->excel->getActiveSheet()->setCellValue('F4', 'No Of Days Worked');
$this->excel->getActiveSheet()->setCellValue('G4', 'OT Hrs Worked');
$this->excel->getActiveSheet()->setCellValue('H4', 'Total Amount');
$this->excel->getActiveSheet()->mergeCells('A1:F1');
$this->excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(16);
$this->excel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setARGB('#333');
for($col = ord('A'); $col <= ord('F'); $col++){
for($col = ord('A'); $col <= ord('H'); $col++){
$this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(true);
$this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12);
@ -263,6 +306,10 @@ function phpAlert($msg) {
$j=1;
$total=0;
$overall=0;
$totemp = 0;
$overallemp = 0;
$totemr = 0;
$overallemr = 0;
foreach($data['PFESI'] as $row){
$this->excel->getActiveSheet()->setCellValue('A' . (string)($i),$j);
@ -274,15 +321,27 @@ function phpAlert($msg) {
$this->excel->getActiveSheet()->setCellValue('E' . (string)($i),number_format($row->CompanyESI,2,'.',''));
$this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getNumberFormat()->setFormatCode('0.00');
$this->excel->getActiveSheet()->setCellValue('E' . (string)($i+1),'Total');
$this->excel->getActiveSheet()->setCellValue('C' . (string)($i+1),'Total');
$this->excel->getActiveSheet()->setCellValue('F' . (string)($i),number_format($row->NoofDaysWorked,2,'.',''));
$this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->setCellValue('G' . (string)($i),number_format($row->OTperHours,2,'.',''));
$this->excel->getActiveSheet()->getStyle('G'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$total = $row->EmployeeESI + $row->CompanyESI;
$overall=$overall + $total;
$this->excel->getActiveSheet()->setCellValue('F' . (string)($i),($total));
$this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getNumberFormat()->setFormatCode('0.00');
$this->excel->getActiveSheet()->setCellValue('F' . (string)($i+1),($overall));
$this->excel->getActiveSheet()->getStyle('F'.(string)($i+1))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('F'.(string)($i+1))->getNumberFormat()->setFormatCode('0.00');
$totemp = $row->EmployeeESI;
$totemr = $row->CompanyESI;
$overallemp = $overallemp + $totemp;
$overallemr = $overallemr + $totemr;
$this->excel->getActiveSheet()->setCellValue('H' . (string)($i),($total));
$this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getNumberFormat()->setFormatCode('0.00');
$this->excel->getActiveSheet()->setCellValue('D' . (string)($i+1),($overallemp));
$this->excel->getActiveSheet()->setCellValue('E' . (string)($i+1),($overallemr));
$this->excel->getActiveSheet()->setCellValue('H' . (string)($i+1),($overall));
$this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getNumberFormat()->setFormatCode('0.00');
//$this->excel->getActiveSheet()->setCellValue('A6','HI');
$i++;
$j++;
@ -348,7 +407,7 @@ function phpAlert($msg) {
{
$current = date("m-Y");
$data['month'] = $this-> monthlypay_model->monthlyListing($current);
$data['fresh'] = $this-> monthlypay_model->getEmpPayDetails();
$data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current);
$this->global['pageTitle'] = 'Siddharth : Payroll Monthly Inputs';
$this->loadViews("monthlypayinputs", $this->global,$data,NULL);
@ -361,7 +420,7 @@ function phpAlert($msg) {
$current = $this->input->post('param1');
$month = $this-> monthlypay_model->monthlyListing($current);
$fresh = $this-> monthlypay_model->getEmpPayDetails();
$fresh = $this-> monthlypay_model->getEmpPayDetails($current);
$data = json_encode(array_merge($month,$fresh));
echo $data;
}

View File

@ -25,11 +25,18 @@ class monthlypay_model extends CI_Model
return $result;
}
function getEmpPayDetails()
function getEmpPayDetails($current="")
{
$this->db->select('T_Emp_Pay_Data.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName');
$current = '01-'.$current;
//echo $current;
$current = date_create($current);
$current = date_format($current,"Y-m-d");
//echo $current;
$this->db->select('T_Emp_Pay_Data.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining');
$this->db->from('T_Emp_Pay_Data');
$this->db->join('T_Employee_Details','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID');
$this->db->join('T_Employee_Details ','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID');
$this->db->where('T_Employee_Details.DateofJoining <=',$current);
$this->db->order_by('EmpID','asc');
$query = $this->db->get();
$result = $query->result();
return $result;

View File

@ -182,11 +182,15 @@ class Payroll_model extends CI_Model
return $query->result();
}
function getBankInfo()
function getBankInfo($bank="")
{
$this->db->select('*');
$this->db->from('T_Bank_Details');
//$this->db->order_by("Month_Year", "desc");
$this->db->where("Is_Active",1);
if(!empty($bank))
{
$this->db->where('Bank_name',$bank);
}
$query = $this->db->get();
return $query->result();
}
@ -205,7 +209,7 @@ class Payroll_model extends CI_Model
function getReportforPFESI($payon)
{
$this->db->select('Pay.EmployeeESI,Pay.PF,Pay.CompanyESI,Pay.CompanyPF,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.PFNO,Emp.ESI');
$this->db->select('Pay.EmployeeESI,Pay.PF,Pay.CompanyESI,Pay.CompanyPF,Pay.NoofDaysWorked,Pay.OTperHours,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.PFNO,Emp.ESI');
$this->db->from('T_Payroll Pay');
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->where('Pay.PayOn',$payon);
@ -215,7 +219,7 @@ class Payroll_model extends CI_Model
}
/* *//**
* This function is used to get the PayOn details from T_Payroll_File
* This function is used to get the PayOn details from T_Payroll_FileOTperHours
* @return array $result : This is result of the query
*/
function getEmployeelist($Payon ='')
@ -317,5 +321,17 @@ class Payroll_model extends CI_Model
return $result;
}
function getCompanyInformation()
{
$subQuery = "select CompanyName,replace(Address,',','<br>') as Address,GSTNO,PAN,ContactNumber,EmailAddress,AlternateContactNumber,companyWebsite,StateCode
from T_Company_Details ";
$query = $this->db->query($subQuery);
//print_r($query->result());die();
return $query->result();
}
}
?>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,7 @@
<?php
$sample = array_merge($month,$fresh);
?>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
@ -9,6 +11,20 @@
</script>
<script>
$('html').bind('keypress', function(e)
{
//alert('Key Pressed');
if(e.keyCode == 13)
{
return false;
}
});
</script>
<style type="text/css">
.num {
text-align:right;
@ -162,7 +178,7 @@
?>
<tr>
<td style="text-align:right;"><?php echo $index; ?></td>
<td style="text-align:right;"><?php echo $index ?></td>
<td style="text-align:right;"><?php echo $record->EmpID ?></td>
<td><?php echo $record->FirstName ." ". $record->LastName ?></td>
<td contenteditable='true' style="text-align:right;"><?php if(!empty($record->LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?></td>
@ -225,7 +241,7 @@
{
var alldata = $("#monthlylistings").tableToJSON();
//alert(JSON.stringify(alldata));
// alert(JSON.stringify(alldata));
alldata=JSON.stringify(alldata)
var month = $('#monthyear').val();
$('#content').loader('hide');

View File

@ -77,7 +77,7 @@ $(function() {
var c=0;
$('#Employee').find('option').each(function() {
c++;
var employee=$(this).val();
$('#content').loader('show');
$.ajax({
@ -87,27 +87,21 @@ $(function() {
success:function(result)
{
if(result == 1)
if(result != 1)
{
$('form#PayslipGenerator').submit();
$('#content').loader('hide');
}
else{
c++;
$.ajax({
data:{payon:payon,employee:employee},
type:"POST",
url:"<?php echo base_url();?>payslip/callsp",
success:function(result){
$('form#PayslipGenerator').submit();
$('#content').loader('hide');
$('#content').loader('hide');
$.ajax({
data:{payon:payon,employee:employee},
type:"POST",
url:"<?php echo base_url();?>payslip/callsp",
success:function(result){
}
});
}
}
}
@ -116,7 +110,10 @@ $(function() {
});
alert("Employees Salary Added Successfully!");
alert(c + 'Employees Salary Added Successfully!');
$('form#PayslipGenerator').submit();
$('#content').loader('hide');

File diff suppressed because one or more lines are too long