PAYROLL EXCEL REPOT

This commit is contained in:
velz2020 2017-10-11 12:28:00 +05:30
parent 900e2ccff9
commit 71b51bb358
5 changed files with 204 additions and 9 deletions

View File

@ -60,10 +60,20 @@ function phpAlert($msg) {
$m = substr($payon,0,2);
$y = substr($payon,3);
$month = $monthsoptions[$m]."-".$y;
$excel = $this->input->post('excel');
//echo $excel;
// if(empty($excel))
// {
// echo "PDF";
// }
// else
// {
// echo "EXCEL";
// }
// die();
$filename = '';
if($this->input->post('Bank_Report'))
{
@ -100,13 +110,107 @@ function phpAlert($msg) {
$data['Totalamount']=$totalamt;
$totamtwords = $this->convertNumber($totalamt);
$data['Totalamtwords']=$totamtwords;
if(empty($excel)){
$filename = 'PF Report for'.$payon.'pdf' ;
$this->load->View("pfreportprint",$data);
}
// echo "PDF PART 1";
}
else{
$this->load->library('excel');
// $this->global['pageTitle'] = 'Siddharth : PF Excel Report';
// $this->loadViews('pfexcel',$this->global,$data,NULL);
$this->excel->setActiveSheetIndex(0);
$this->excel->getActiveSheet()->setTitle('Employee PF Report ' . $data['PayMonth']);
$this->excel->getActiveSheet()->setCellValue('A1', 'Employee PF Report ' . $data['PayMonth']);
$this->excel->getActiveSheet()->setCellValue('A4', 'S.No.');
$this->excel->getActiveSheet()->setCellValue('B4', 'Employee Name');
$this->excel->getActiveSheet()->setCellValue('C4', 'PF Account No');
$this->excel->getActiveSheet()->setCellValue('D4', 'Employee Contribution');
$this->excel->getActiveSheet()->setCellValue('E4', 'Employeer Contribution');
$this->excel->getActiveSheet()->setCellValue('F4', '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++){
$this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(true);
$this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle(chr($col))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
}
// print_r($data['PFESI']);die();
$i=6;
$j=1;
$total=0;
$overall=0;
foreach($data['PFESI'] as $row){
$this->excel->getActiveSheet()->setCellValue('A' . (string)($i),$j);
$this->excel->getActiveSheet()->setCellValue('B' . (string)($i),$row->FName . $row->Lname);
$this->excel->getActiveSheet()->setCellValue('C' . (string)($i),$row->PFNO);
$this->excel->getActiveSheet()->setCellValue('D' . (string)($i),number_format($row->PF,2,'.',''));
$this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getNumberFormat()->setFormatCode('0.00');
$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()->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('A6','HI');
$i++;
$j++;
}
$this->excel->getActiveSheet()->getProtection()->setSheet(true);
$this->excel->getActiveSheet()->getProtection()->setSort(true);
$this->excel->getActiveSheet()->getProtection()->setInsertRows(true);
$this->excel->getActiveSheet()->getProtection()->setFormatCells(true);
$filename='EmployeePFReport.xls';
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$filename.'"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
$objWriter->save('php://output');
}
}
if($this->input->post('ESI_Report'))
{
$data['PFESI'] = $this->payroll_model->getReportforPFESI($payon);
//print_r($data['PFESI']);die();
$data['PayMonth']=$month;
$totamtwords = '';
$totalamt=0.00;
@ -119,11 +223,86 @@ function phpAlert($msg) {
$data['Totalamount']=$totalamt;
$totamtwords = $this->convertNumber($totalamt);
$data['Totalamtwords']=$totamtwords;
if(empty($excel)){
$filename = 'ESI Report for'.$payon.'pdf';
$this->load->View("esireportprint",$data);
// echo "PDF PART 1";
}
else{
$this->load->library('excel');
$this->excel->setActiveSheetIndex(0);
$this->excel->getActiveSheet()->setTitle('Employee ESI Report ' . $data['PayMonth']);
$this->excel->getActiveSheet()->setCellValue('A1', 'Employee ESI Report ' . $data['PayMonth']);
$this->excel->getActiveSheet()->setCellValue('A4', 'S.No.');
$this->excel->getActiveSheet()->setCellValue('B4', 'Employee Name');
$this->excel->getActiveSheet()->setCellValue('C4', 'ESI Account No');
$this->excel->getActiveSheet()->setCellValue('D4', 'Employee Contribution');
$this->excel->getActiveSheet()->setCellValue('E4', 'Employeer Contribution');
$this->excel->getActiveSheet()->setCellValue('F4', '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++){
$this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(true);
$this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle(chr($col))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
}
// print_r($data['PFESI']);die();
$i=6;
$j=1;
$total=0;
$overall=0;
foreach($data['PFESI'] as $row){
$this->excel->getActiveSheet()->setCellValue('A' . (string)($i),$j);
$this->excel->getActiveSheet()->setCellValue('B' . (string)($i),$row->FName . $row->Lname);
$this->excel->getActiveSheet()->setCellValue('C' . (string)($i),$row->ESI);
$this->excel->getActiveSheet()->setCellValue('D' . (string)($i),number_format($row->EmployeeESI,2,'.',''));
$this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getNumberFormat()->setFormatCode('0.00');
$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');
$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');
//$this->excel->getActiveSheet()->setCellValue('A6','HI');
$i++;
$j++;
}
$this->excel->getActiveSheet()->getProtection()->setSheet(true);
$this->excel->getActiveSheet()->getProtection()->setSort(true);
$this->excel->getActiveSheet()->getProtection()->setInsertRows(true);
$this->excel->getActiveSheet()->getProtection()->setFormatCells(true);
$filename='EmployeePFReport.xls';
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$filename.'"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
$objWriter->save('php://output');
}
}
if(empty($excel)){
$php = $this->output->get_output();
// Load library
@ -145,9 +324,11 @@ function phpAlert($msg) {
$font, 6, array(0,0,0));
$dompdf->stream($filename);
//echo "PDF PART 2";
}
}
@ -355,7 +536,7 @@ function phpAlert($msg) {
$this->global['pageTitle'] = 'Siddharth : Edit Employee Payslip';
$data['PayInfo'] = $this->payroll_model->GetPayslipdata($PayOn,$EmpID);
$this->loadViews("editPayslip", $this->global, $data , NULL);
$this->loadViews("editpayslip", $this->global, $data , NULL);
}
public function viewGenerator()
{

View File

@ -0,0 +1,4 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
ERROR - 2017-10-11 08:49:12 --> Severity: Warning --> DOMXPath::query(): Invalid expression C:\5.6\xampp\htdocs\SIA\SIANEW\siddharth_application\application\third_party\dompdf\include\stylesheet.cls.php 697
ERROR - 2017-10-11 08:49:12 --> Severity: Warning --> DOMXPath::query(): Invalid expression C:\5.6\xampp\htdocs\SIA\SIANEW\siddharth_application\application\third_party\dompdf\include\stylesheet.cls.php 697

View File

@ -1 +1 @@
<span style='color: #900'>4,096 KB</span> <span style='color: #090'>595.2981 ms</span><br />
<span style='color: #900'>14,080 KB</span> <span style='color: #090'>1,982.8620 ms</span><br />

View File

@ -14,10 +14,16 @@ $("#bankreport").click(function(){
var bank = $('#bank').val();
var payon = $('#month').val();
var excel = $('#excel').is(":checked");
// alert(excel);
if(bank != '-1' && payon !='-1')
if(excel == true)
{
alert('Excel Report Not Available for Bank Report..!');
return false;
}
if(bank != '-1' && payon !='-1')
{
$('#content').loader('show');
$('#BankReportGenerator').attr('action', '<?php echo base_url() ?>payslip/getBankReport');
@ -27,6 +33,7 @@ $("#bankreport").click(function(){
else
{
alert('Select Bank Name and Pay Date');
return false;
}
@ -144,6 +151,9 @@ $("#esireport").click(function(){
</div>
<div class="col-md-4 col-md-offset-6">
<input type="checkbox" class="" id="excel" name="excel" value="excel" /><span>Excel</span>
</div>
</div>
<br/>

View File

@ -44,7 +44,7 @@ To<br> &nbsp;&nbsp;&nbsp; The bank Manager,<br>
Sir/Madam,
<br><br><p>
For Your kindly information please credit employees salary of <?php echo $PayMonth;?> for Siddharth Indistries.Total Amount i- <b>Rs.<?php echo number_format($Totalamount,2,'.','');?></b>
For Your kindly information please credit employees salary of <?php echo $PayMonth;?> for Siddharth Indistries.Total Amount - <b>Rs.<?php echo number_format($Totalamount,2,'.','');?></b>
&nbsp;&nbsp;<b>(<?php echo $Totalamtwords;?>)</b> with cheque <b>No:123456789</b></p>
<p>Employee List given Below:</p>