Hi,
Thank You so much for the solution.I have solved that problem. But I am facing problem in export to pdf.I am using codeigniter and calling the reports from controller.
I need to export the chart in to pdf and I have used instant exporter function to export.But it gives empty pdf.
Here are the functions,
public function get_cash_detail_by_date()
{
if (!$this->ion_auth->logged_in()){
redirect('authentication/login', 'refresh');
}
$top_url_menu = str_replace(array("_","-"), ' ', strtolower($this->uri->segment(1)));
$left_url_menu = $this->input->get('id');
if(!$this->role_model->create_role_permission($top_url_menu, $left_url_menu, 'rr_update')){
$this->session->set_flashdata('check_permission', 'You do not have permission to edit attribute');
redirect($this->uri->segment(1) . '/'. $left_url_menu . "?menu=".$this->input->get('menu').($this->input->get('submenu')? "&submenu=".$this->input->get('submenu') : "" )."&id=".$this->input->get('id')."&dbc=1");
return false;
}
unset($_SESSION["from"]);
unset($_SESSION["to"]);
unset($_SESSION["type"]);
$from = $this->input->post('from')?$this->input->post('from'):date('Y-m-d');
$to = $this->input->post('to')?$this->input->post('to'):date('Y-m-d');
$type = $this->input->post('type');
$_SESSION['from']=$from;
$_SESSION['to']=$to;
$from = $_SESSION['from'];
$to = $_SESSION['to'];
$values = $this->reports_model->get_cash_detail_by_date($from, $to, $type);
// $_SESSION['values']=$values;
$data = array(
'title' => 'Cash Report',
'page_name' => 'reports/cash_reportpdf',
'top_menus' => $this->menu_model->top_menu(),
'topmenu_roles' => $this->role_model->get_user_role_for_topmenu(),
'all_clients' => $this->user_model->client_detail(),
'all_stores' => $this->user_model->get_all_store_details(),
'user_roles' => $this->role_model->user_roles_detail(),
'stores' => $this->user_model->get_store_detail(),
'menus' => $this->menu_model->menus($this->uri->segment(1)),
'roles' => $this->role_model->get_user_role(),
'orders1' => $values
);
$this->load->view('index', $data);
}
This is the function to display the chart in view page.
public function export(){
Exporter::export($_SERVER['DOCUMENT_ROOT']."/client/clienttool/application/views/pages/reports/cash_report.php")
->pdf(array(
"format"=>"A4",
"orientation"=>"portrait"
))
->toBrowser("myfile.pdf");
}
This is the export function.
Can you please tell me how to achieve export to pdf option in codeigniter? Please reply me asap.
Thank You.