70 lines
1.9 KiB
PHP
70 lines
1.9 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class ModelVoucer extends CI_Model{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
//Codeigniter : Write Less Do More
|
|
}
|
|
|
|
function getData_all($idpusat = null)
|
|
{
|
|
if ($idpusat != null || $idpusat != "") {
|
|
$this->db->where("pusat_idpusat", $idpusat);
|
|
}
|
|
return $this->db->get("voucer");
|
|
}
|
|
|
|
function getData($idvoucer)
|
|
{
|
|
$this->db->where("idvoucer", $idvoucer);
|
|
return $this->db->get("voucer");
|
|
}
|
|
|
|
function get_anggota($id, $idpusat = null)
|
|
{
|
|
$this->db->join("voucer_user", "voucer_user.data_user_iddata_user = data_user.iddata_user AND voucer_user.voucer_idvoucer = ".$id,"left");
|
|
$this->db->where("data_user.status_anggota", 1);
|
|
if ($idpusat != null || $idpusat != "") {
|
|
$this->db->where("data_user.pusat_idpusat", $idpusat);
|
|
}
|
|
return $this->db->get("data_user");
|
|
}
|
|
|
|
public function get_voucer_anggota($iduser=null, $idvoucer = null, $status_voucer = null, $idpemesanan = null)
|
|
{
|
|
if ($idpemesanan != null) {
|
|
$this->db->where("pemesanan_idpemesanan", $idpemesanan);
|
|
}
|
|
if ($iduser != null) {
|
|
$this->db->where("data_user_iddata_user", $iduser);
|
|
}
|
|
if ($idvoucer != null) {
|
|
$this->db->where("voucer_idvoucer", $idvoucer);
|
|
}
|
|
if ($status_voucer != null) {
|
|
$this->db->where("status_voucer", $status_voucer);
|
|
}
|
|
$this->db->join("voucer", "voucer.idvoucer = voucer_user.voucer_idvoucer");
|
|
return $this->db->get("voucer_user");
|
|
}
|
|
|
|
public function get_voucer($idmitra=null, $voucer=null)
|
|
{
|
|
$this->db->join('mitra', 'mitra.pusat_idpusat=voucer.pusat_idpusat');
|
|
if ($idmitra!=null||$idmitra!='') {
|
|
$this->db->where('mitra.idmitra',$idmitra);
|
|
}
|
|
if ($voucer!=null||$voucer!='') {
|
|
$this->db->where('voucer.idvoucer',$voucer);
|
|
}
|
|
return $this->db->get('voucer');
|
|
// code...
|
|
}
|
|
|
|
|
|
|
|
}
|