From 80a56317736068e7ae8c6a5494e58411309dafc5 Mon Sep 17 00:00:00 2001 From: velz2020 Date: Thu, 26 Oct 2017 14:22:38 +0530 Subject: [PATCH] Payroll bugs and All Reports --- application/controllers/payslip.php | 107 ++++++++++++---- application/models/monthlypay_model.php | 13 +- application/models/payroll_model.php | 24 +++- application/views/bankreportprint.php | 155 +++++++++++++----------- application/views/esireportprint.php | 141 +++++++++++---------- application/views/monthlypayinputs.php | 20 ++- application/views/payslipgenerate.php | 37 +++--- application/views/pfreportprint.php | 138 +++++++++++---------- 8 files changed, 383 insertions(+), 252 deletions(-) diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index 4b0566ba..dfae35e3 100755 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -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; } diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index 36fe5ab5..d0207103 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -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; diff --git a/application/models/payroll_model.php b/application/models/payroll_model.php index e28a0614..060f618b 100755 --- a/application/models/payroll_model.php +++ b/application/models/payroll_model.php @@ -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,',','
') 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(); + + } } ?> \ No newline at end of file diff --git a/application/views/bankreportprint.php b/application/views/bankreportprint.php index 9040decc..34ccd065 100755 --- a/application/views/bankreportprint.php +++ b/application/views/bankreportprint.php @@ -1,83 +1,98 @@ -BAddress; - //die(); - } - } - - -?> - - - - - -

Bank Letter

- -To
    The bank Manager,
-     ,
-     .
-
- - - Sir/Madam, -

- For Your kindly information please credit employees salary of for Siddharth Indistries.Total Amount - Rs. -   () with cheque No:123456789

- -

Employee List given Below:

- - - + + +
+ +
+ - - - - - + +
+ - - - - + + + +
Employee NameSalary AmountAc NoIFSCBANK NameSIDDHARTH INDUSTRIES
168/1C3, Pennalur Pet Road, Goonipalayam Village Post, Uthukottai Taluk, Thiruvallur Dist-602026
Mobile: +91 99410 14891 / 9941014890 | E-mail: accounts@sidharthindustries.com
+ + + Bank_name ; + $bankaddress = $b->Address; + } + } + ?> +
+
+

To,

+

The Branch Manager,
,
+

+
+

Dear Sir,

+

Sub: Salary transfer of respective SB a/c through Account Transfer.

+

Please find herewith enclosed a Cheque bearing No: _________________ dated ________________ for /- () Kindly transfer the same to the respective account holders mentioned below

+
+ + + + + + + + + + + + + + - - - - - + + + + + + - + -
SnoEmployee NameSalary AmountAcc NoIFSCBank Name
FName . " ".$data->Lname;?>LessAdvance,2,'.','');?>BankAccountNumber;?>IFSC;?>BankName;?>FName . " ".$data->Lname;?>LessAdvance,2,'.','');?>BankAccountNumber;?>IFSC;?>BankName;?>
- - \ No newline at end of file +
+

Kindly do the needful,
Thanking you,
Yours faithfully.

K.Subramanian.

+ +
+
+ \ No newline at end of file diff --git a/application/views/esireportprint.php b/application/views/esireportprint.php index 15339aa9..e70e9c5a 100755 --- a/application/views/esireportprint.php +++ b/application/views/esireportprint.php @@ -1,85 +1,96 @@ BAddress; - //die(); - } + $cname = $info->CompanyName; + $caddress = $info->Address; } +} ?> - - - - - -

ESI Letter

+ + -To
    The Consultant,
-     For Employees State Insurance,
-     Chennai.
-
- - - Sir/Madam, -

- For Your kindly information please credit employees ESI of for Siddharth Indistries. -    - -

Employee List given Below:

+
+
- + + + +
+ +
+ +
+
+
+ + +
+
+ +
+

Employeer ESIC account No: 51001187050000999

+
- - - - - - + + + + + + + + - - - - + + - - - - - - + $index++; + ?> + + + + + + + + + + + + + + + + + + - -
Employee NameESI Account NoEmployee ESICompany ShareTotal Amount
SnoESI Account NoEmployee ContributionEmployeer ContributionNo of days PresentOT hoursTotal
FName . " ".$data->Lname;?>ESI;?>EmployeeESI,2,'.','');?>CompanyESI,2,'.','');?>EmployeeESI + $data->CompanyESI),2,'.','');?>
ESI;?>EmployeeESI,2,'.','');?>CompanyESI,2,'.','');?>NoofDaysWorked;?>OTperHours;?>EmployeeESI + $data->CompanyESI),2,'.','');?>
Total   
-

Total Amount:

-

Total Amount:

- - - \ No newline at end of file +

Total:                   

+

words:

+
+ \ No newline at end of file diff --git a/application/views/monthlypayinputs.php b/application/views/monthlypayinputs.php index 75c79bf9..c80ac1c8 100755 --- a/application/views/monthlypayinputs.php +++ b/application/views/monthlypayinputs.php @@ -1,5 +1,7 @@ @@ -9,6 +11,20 @@ + + - - -

PF Letter

+ + -To
    The Consultant,
-     For Provident Fund,
-     Chennai.
-
- - - Sir/Madam, -

- For Your kindly information please credit employees PF of for Siddharth Indistries. -    - -

Employee List given Below:

+
+
- + + + +
+ +
+ +
+
+
+ + +
+
+ +
+

Employeer ESIC account No: TNAMB1556420000

+
- - - - - - + + + + + + + + - - - - + + - - - - - - + + + + + + + + + + + + + + + + + - -
Employee NamePF Account NoEmployee PFCompany ShareTotal Amount
SnoESI Account NoEmployee ContributionEmployeer ContributionNo of days PresentOT hoursTotal
FName . " ".$data->Lname;?>PFNO;?>PF,2,'.','');?>CompanyPF,2,'.','');?>PF + $data->CompanyPF),2,'.','');?>
PFNO;?>PF,2,'.','');?>CompanyPF,2,'.','');?>NoofDaysWorked;?>OTperHours;?>PF + $data->CompanyPF),2,'.','');?>
Total   
-

Total Amount:

-

Total Amount:

- - - \ No newline at end of file +

Total:                   

+

words:

+
+ \ No newline at end of file