⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Invoice system: Displaying multiple forms (GC-render outputs) on single page



Nitin Thokare
  • profile picture
  • Member

Posted 11 June 2014 - 07:11 AM

I'm working on an Invoice creation project in which I want to manage two tables as request_for_quote and request_for_quote_items (item list for given request_for_quote) on single form.

 

For this I'm trying out following approach::

 

I want to display two GC-render outputs in a single view:

 

I have following controller and view, with single GC-output, which is working fine (see attchment1):

 
MyCI_View:
<?php
  $data = array(
    'title' => 'Request For Quote'
  );
?>
<?php $this->load->view('includes/header',$data); ?>
<?php $this->load->view('sidebars/sidebar_inventory_purchase'); ?>

<div class="content">
    <h3>Request For Quote</h3>
    <div>
      <?php echo $output; ?>
    </div>
</div><!-- end .content -->
<?php $this->load->view('includes/footer'); ?>
MyCI_Controller:
 
<?php
function request_for_quote(){
  $this->check_logged_in();
  $this->load->model('model_global_ops');
  $newdb = $this->model_global_ops->getDB();
  $this->db = $newdb;

  $crud = new grocery_CRUD();
  $crud->set_table('requestforquote');
  $crud->set_subject('RFQ');

  $crud->columns('Id','Date','VendorId','Remark');
  $crud->fields('Date','VendorId','Remark');
  $crud->display_as('VendorId','Vendor');

  $crud->field_type('Data','date');
  $crud->field_type('Remark','text');
  $crud->set_relation('VendorId', 'vendor', '{id}-{name}');
  $crud->required_fields('Date','VendorId');

  $crud->add_action('Items List', base_url('assets/grocery_crud/themes/flexigrid/css/images/list.png'), 'purchase/request_for_quote_items','','');

  $output = $crud->render();
  $this->load->view('erp_purchase/request_for_quote',$output);
}
?>

Now I'm trying to view two GC-outputs on same page with following page, this is resulting into unformatted output as shown in attachment2:

 

MyCI_View:
<?php
  $data = array(
    'title' => 'Request For Quote'
  );
?>
<?php $this->load->view('includes/header',$data); ?>
<?php $this->load->view('sidebars/sidebar_inventory_purchase'); ?>

<div class="content">
<?php var_dump($o1->output);?>
    <h3>Request For Quote</h3>
    <div>
      <?php echo $o1->output; ?>
    </div>
    <div>
      <?php echo $o2->output; ?>
    </div>
</div><!-- end .content -->
<?php $this->load->view('includes/footer'); ?>
MyCI_Controller:
 
<?php
function request_for_quote(){
  $this->check_logged_in();
  $this->load->model('model_global_ops');
  $newdb = $this->model_global_ops->getDB();
  $this->db = $newdb;

  $crud = new grocery_CRUD();
  $crud->set_table('requestforquote');
  $crud->set_subject('RFQ');

  $crud->columns('Id','Date','VendorId','Remark');
  $crud->fields('Date','VendorId','Remark');
  $crud->display_as('VendorId','Vendor');

  $crud->field_type('Data','date');
  $crud->field_type('Remark','text');
  $crud->set_relation('VendorId', 'vendor', '{id}-{name}');
  $crud->required_fields('Date','VendorId');

  $crud->add_action('Items List', base_url('assets/grocery_crud/themes/flexigrid/css/images/list.png'), 'purchase/request_for_quote_items','','');

  $output = $crud->render();
  $out = array('o1'=>$output,
               'o2'=>$output);
  $this->load->view('erp_purchase/request_for_quote',$out);
}
?>

Can anybody tell me where is the problem? Is it due to multiple forms, one each in o1 and o2?

 

I'm planning this for displaying list of Items from request_for_quote in second GC-output. So that, the items in a request_for_quote can be processed on single page.

 

Is this approach correct? or can anybody suggest other/better approach to handle request_for_quote and request_for_quote_items on same page?