[eluser]maria clara[/eluser]
in the controller:
Code:
function listview()
{
$data = $this->AR_salesorder_db->getList();
$this->load->view('template/table',$data)
;
}
function detaillistview()
{
$data = $this->AR_salesorder_db->getDetailList();
$this->load->view('template/table',$data);
}
in the MOdel:
Code:
function getDetails($data)
{
$data['ar_so.is_deleted'] = '0';
$this->db->join('maint_customers b','ar_so.client_id=b.cust_id','left');
$this->db->join('maint_customers c','ar_so.del_client_id=c.cust_id','left');
$this->db->join('maint_employee d','ar_so.salesman_id=d.emp_id','left');
$this->db->join('maint_marketsegment e','ar_so.ms_id=e.ms_id','left');
$this->db->join('sec_dataset f','ar_so.type_id=f.data_id','left');
$this->db->join('sec_dataset g','ar_so.currency_id=g.data_id','left');
$this->db->join('sec_dataset h','ar_so.pay_type_id=h.data_id','left');
$this->db->join('sec_dataset i','ar_so.term_id=i.data_id','left');
$this->db->join('sec_dataset j','ar_so.int_term_id=j.data_id','left');
$this->db->join('sec_dataset k','ar_so.status=k.data_value AND k.data_code = "TRAN_STATUS"','left');
$this->db->join('sec_users l','ar_so.prepared_by_id=l.user_id','left');
$this->db->select( "ar_so.*,
b.customer_code, b.customer_name,
c.customer_code as delcustomer_code, c.customer_name as delcustomer_name, c.telephone, c.mobile,
c.fax, c.email,
d.emp_code,d.emp_name,
e.ms_code,e.ms_desc,
f.data_display as order_type,
g.data_display as currency_type,
h.data_display as pay_type,
i.data_display as term_type,
j.data_display as intterm_type,
k.data_display as status_name,
concat_ws(' ', l.first_name,l.last_name) as first_name", false
);
$this->db->where($data);
return $this->db->get('ar_so')->row_array();