Jump to content


abhinay1435

Member Since 09 Mar 2019
Offline Last Active Mar 09 2019 01:38 PM
-----

Topics I've Started

Export and Print Not working with GET and POST Data

09 March 2019 - 10:24 AM

Hello Sir,

I just Starting Using GROCERY CRUD

I like it a lot

but I am facing Some Issues

The First ONe is

When I am using Export and Print with GET and POST data in Function It is showing no Data

 

I am Using a Form which sends a actionrequest to Controller-->Function with get data in URL

It is showing the Data in Table but when I am clicking on Print It Shows Empty

I have verified that this error is due to I am using GET Data in Function and Print is not taking that GET Data

 

Case 1: When Print Not Showing any Data

Attachment:- 1.png

 

Case 2:- Print Showing Data when I add "?customer_id=1" in URL

Attachment:- 2.png

This Shows that due to GET data not being sent from function to Print Button URL

 

Please suggest a solution for this

 

 

Below is my Controller Code

 

<?php
class pending_list extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->database();
$this->load->helper('url');
$this->load->model("login_model");
$this->load->model('form_model');
$this->load->helper('form');
$this->load->library('grocery_CRUD');
}
public function callback_date($val, $row)
{
        return date('d-m-Y', strtotime($val));
}
function index() {
 
$data['customers'] = $this->form_model-> get_customers();
$data['sellers'] = $this->form_model-> get_sellers();
$this->load->view('form',$data);
}
 
public function _example_output($output = null)
{
  $this->load->view('page.php',(array)$output);
}
public function bill_management()
{
 
    $crud = new grocery_CRUD();
    $crud->set_theme('tablestrap');
 
      $crud->set_table('bill_table');
      $crud->columns('bill_date','bill_no','customer_id','seller_id','bill_amount','paid');
 
 
       $crud->required_fields('seller_id','bill_date','bill_no','customer_id','bill_amount','paid');
       $crud->unset_edit_fields('timestamp');
       $crud->unset_add_fields('timestamp');
       $crud->set_relation('seller_id','seller_table','seller_firm_name');
       $crud->set_relation('customer_id','customer_table','customer_firm_name');
 
    $seller_id = $this->input->get('seller_id');
       $customer_id = $this->input->get('customer_id');
       $paid = $this->input->get('payment_status');
 
 
       if($customer_id!=="")
       {
         $crud->where('bill_table.customer_id',$customer_id);
         //$crud->where('bill_table.bill_date>=','2019-03-01');
       }
       if($seller_id!="")
       {
         $crud->where('bill_table.seller_id',$seller_id);
       }
       if($paid!="")
       {
         $crud->where('bill_table.paid',$paid);
 
       }
 
      // $crud->where($where);
 
 
      $crud->order_by('bill_no','asc');
 
       $crud->display_as('customer_id','Customer');
       $crud->display_as('seller_id','Seller');
 
 
       $permission = $this->login_model->permission();
 
 
       if($permission=="admin"){
       $crud->unset_clone();
       }
 
 
       if($permission=="view_only"){
       $crud->unset_add();
       $crud->unset_edit();
       $crud->unset_delete();
       }
 
       if($permission==""){
       echo "I think you shouldn't be here...";
       //and we can force a login to the user with
       //$this->login_model->logout();
       }
$crud->callback_column('bill_date', array($this, 'callback_date'));
 
    $output = $crud->render();
 
    $this->_example_output($output);
}
 
}
 
?>