<?php 

class M_member extends CI_Model{
	public function __construct()
	{
		$this->load->database();
	}
	 
	public function member()
	{
		$this->db->order_by('nama_member', 'asc');
		$this->db->where(" tb_member.id_member != '1' ");
		$query = $this->db->get('tb_member');
		return $query->result();
	} 
	function struk($id_member)
	{
		 
		 
	 	$this->db->where('id_member',$id_member);
		 
		$query = $this->db->get('tb_member');
		return $query->result();
	} 
	public function cari_member($ktp)
	{
		$this->db->where(" tb_member.ktp = '$ktp' ");
		$query = $this->db->get('tb_member');
		return $query->result();
	} 

	public function history_point($ktp)
	{
		$this->db->order_by('date', 'asc');
		$this->db->select(" tb_history_point_member.point, tb_history_point_member.status, tb_history_point_member.id_transaksi,  tb_history_point_member.date ");
		$this->db->where(" tb_member.ktp = '$ktp' ");
		$this->db->where(" tb_history_point_member.id_member = tb_member.id_member");
		$query = $this->db->get("tb_member, tb_history_point_member");
		return $query->result();
	} 
 
	 
	 
	 
}