<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Epay_model extends CI_Model {
  
    /**
     * CONSTRUCTOR | LOAD DB
    */
    public function __construct() {
       parent::__construct();
       $this->load->database();
    }

    /**
     * SHOW | GET method.
     *
     * @return Response
    */
	public function show($id_cust = 0,$id_club = 0, $page = 0, $limit = 10)
	{
        if(empty($id_cust)) $id_cust=0;
        if(empty($id_club)) $id_club=0;
        if(empty($page)) $page=0;
        if(empty($limit)) $limit=10;

        $offset = ($page-1)*$limit;
        $sql = "SELECT a.*,b.jenis_kelamin, b.url_image ".
        " FROM `transaksi_epay` a LEFT OUTER JOIN `customer` b ".
        " ON a.id_customer=b.id ".
        " where a.id_customer='".$id_cust."' and a.id_club='".$id_club."' and a.terhapus=0 ".
        " order by a.id DESC limit ".$offset.",".$limit;        
// echo $sql;
        // $query = $this->db->query($sql)->row_array();
        $query = $this->db->query($sql)->result();
        return $query;
	}
      

}
