diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index 91d5d754..92a1736f 100644 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -100,36 +100,69 @@ class payslip extends BaseController else { $Payon = $this->input->post('PayOn'); - $EmpID = $this->input->post('Employee'); + + + if($All != '') + { + + $result = $this->Payroll_model->getEmpAll(); + if($result > 0 ) + { + for($i=0;$i Payroll_model->GetPayslipdata($Payon,$EmpID); + $Data['Count'] = $i; + + $this->load->View("payslipgenerateprint", $Data ); + + } + + } + } + else + { + $EmpID = $this->input->post('Employee'); + $Data['PayDetails'] = $this->Payroll_model->GetPayslipdata($Payon,$EmpID); + + $this->load->View("payslipgenerateprint", $Data ); + + } - //echo $EmpID; - $Data['PayDetails'] = $this->Payroll_model->GetPayslipdata($Payon,$EmpID); + $php = $this->output->get_output(); - $this->global['pageTitle'] = 'Siddharth : Generate PDF'; - - //$this->loadViews("payslipgenerateprint", $this->global, $Data , NULL); - $this->load->View("payslipgenerateprint", $Data, NULL); - // Get output html - $php = $this->output->get_output(); - + // Load library $this->load->library('dompdf_gen'); - // Convert to PDF - //$this->dompdf->load_html($php); - //$this->dompdf->render(); - - //$data['Attachment'] = FALSE; - //$this->dompdf->stream("payslipgenerate.pdf",$data,$php); - $filename = 'Payslip-'.$EmpID . '-' .$Payon.'.pdf' ; + if($All != '') + { + $filename = 'Payslip-'.$Payon.'.pdf' ; + } + else + { + $filename = 'Payslip-'.$EmpID . '-' .$Payon.'.pdf' ; + } require_once(APPPATH .'third_party/dompdf/dompdf_config.inc.php'); $dompdf = new DOMPDF(); //$dompdf->set_paper('A4', 'landscape'); $dompdf->load_html($php); + $dompdf->render(); - $dompdf->stream($filename); + + // add the header + $canvas = $dompdf->get_canvas(); + $font = Font_Metrics::get_font("helvetica", "bold"); + + // the same call as in my previous example + $canvas->page_text(72, 18, "Page: {PAGE_NUM} of {PAGE_COUNT}", + $font, 6, array(0,0,0)); + + $dompdf->stream($filename); } }