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

class Mbank extends CI_Model{
  public function __construct()
  {
    parent::__construct();
    //Codeigniter : Write Less Do More
  }

  public function get_data($status_anggota = 0){
    if ($status_anggota != 1) {
      $this->db->where("idbank !=","2");
    }
    return $this->db->get("bank");
  }

  function get_list()
  {
    return $this->db->get("bank");
  }

  function get_data_detail($idbank)
  {
    $this->db->where("idbank", $idbank);
    return $this->db->get("bank");
  }

  public function get_metode_pembayaran($idbank=null)
  {
    if ($idbank!=null || $idbank!='' ) {
      $this->db->where("bank.idbank", $idbank);
    }
    return $this->db->get("bank");
  }

  public function get_bank_pusat($idpusat=null)
  {
    if ($idpusat!=null||$idpusat!='' ) {
      $this->db->where("bank.pusat_idpusat", $idpusat);
    }
    return $this->db->get("bank");
  }

  public function get_bank_mitra($idmitra=null)
  {
    if ($idmitra!=null||$idmitra!='' ) {
      $this->db->where("bank.mitra_idmitra", $idmitra);
    }
    return $this->db->get("bank");
  }

  public function get_ongkir_mitra($iddesa=null,$idmitra=null)
  {
    if ($iddesa!=null||$iddesa!='') {
      $this->db->where("ongkir.villages_id", $iddesa);
    }
    if ($idmitra!=null||$idmitra!='' ) {
      $this->db->where("ongkir.mitra_idmitra", $idmitra);
    }
    return $this->db->get("ongkir");
  }

}
