diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index 6b528415..651fad97 100755 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -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() { diff --git a/application/logs/log-2017-10-11.php b/application/logs/log-2017-10-11.php new file mode 100644 index 00000000..820de848 --- /dev/null +++ b/application/logs/log-2017-10-11.php @@ -0,0 +1,4 @@ + + +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 diff --git a/application/third_party/dompdf/lib/fonts/log.htm b/application/third_party/dompdf/lib/fonts/log.htm index 523881ae..4f069625 100755 --- a/application/third_party/dompdf/lib/fonts/log.htm +++ b/application/third_party/dompdf/lib/fonts/log.htm @@ -1 +1 @@ -4,096 KB 595.2981 ms
\ No newline at end of file +14,080 KB 1,982.8620 ms
\ No newline at end of file diff --git a/application/views/bankreport.php b/application/views/bankreport.php index 79031004..67f36313 100644 --- a/application/views/bankreport.php +++ b/application/views/bankreport.php @@ -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', '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(){ +
+ Excel +

diff --git a/application/views/bankreportprint.php b/application/views/bankreportprint.php index 8aa13b4e..9040decc 100644 --- a/application/views/bankreportprint.php +++ b/application/views/bankreportprint.php @@ -44,7 +44,7 @@ To
    The bank Manager,
Sir/Madam,

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

Employee List given Below: