PDF generater added
This commit is contained in:
parent
729443d39b
commit
9ea6c46a8b
@ -100,35 +100,68 @@ class payslip extends BaseController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$Payon = $this->input->post('PayOn');
|
$Payon = $this->input->post('PayOn');
|
||||||
$EmpID = $this->input->post('Employee');
|
|
||||||
|
|
||||||
//echo $EmpID;
|
|
||||||
|
|
||||||
$Data['PayDetails'] = $this->Payroll_model->GetPayslipdata($Payon,$EmpID);
|
if($All != '')
|
||||||
|
{
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : Generate PDF';
|
$result = $this->Payroll_model->getEmpAll();
|
||||||
|
if($result > 0 )
|
||||||
|
{
|
||||||
|
for($i=0;$i <count($result) ;$i++ )
|
||||||
|
{
|
||||||
|
|
||||||
|
$EmpID = $result[$i]['EmpId'];
|
||||||
|
|
||||||
|
$Data['PayDetails'] = $this->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 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$php = $this->output->get_output();
|
||||||
|
|
||||||
//$this->loadViews("payslipgenerateprint", $this->global, $Data , NULL);
|
|
||||||
$this->load->View("payslipgenerateprint", $Data, NULL);
|
|
||||||
// Get output html
|
|
||||||
$php = $this->output->get_output();
|
|
||||||
|
|
||||||
// Load library
|
// Load library
|
||||||
$this->load->library('dompdf_gen');
|
$this->load->library('dompdf_gen');
|
||||||
|
|
||||||
// Convert to PDF
|
if($All != '')
|
||||||
//$this->dompdf->load_html($php);
|
{
|
||||||
//$this->dompdf->render();
|
$filename = 'Payslip-'.$Payon.'.pdf' ;
|
||||||
|
}
|
||||||
//$data['Attachment'] = FALSE;
|
else
|
||||||
//$this->dompdf->stream("payslipgenerate.pdf",$data,$php);
|
{
|
||||||
$filename = 'Payslip-'.$EmpID . '-' .$Payon.'.pdf' ;
|
$filename = 'Payslip-'.$EmpID . '-' .$Payon.'.pdf' ;
|
||||||
|
}
|
||||||
|
|
||||||
require_once(APPPATH .'third_party/dompdf/dompdf_config.inc.php');
|
require_once(APPPATH .'third_party/dompdf/dompdf_config.inc.php');
|
||||||
$dompdf = new DOMPDF();
|
$dompdf = new DOMPDF();
|
||||||
//$dompdf->set_paper('A4', 'landscape');
|
//$dompdf->set_paper('A4', 'landscape');
|
||||||
$dompdf->load_html($php);
|
$dompdf->load_html($php);
|
||||||
|
|
||||||
$dompdf->render();
|
$dompdf->render();
|
||||||
|
|
||||||
|
// 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);
|
$dompdf->stream($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user