<?php
/*
Fungsi : Model untuk modul Cabang report
*/
class Supp_map_model extends CI_Model {
	/**
	 * Constructor
	 */
	function Branch_model()
	{
		parent::__construct();
	}
	
/* Insialiasi nama table */

	var $table_supp         = 'm_supp';
	var $table_m_cab		= 'm_cab';
	
/*-----------------------CABANG MODEL---------------------------*/	
	function get_cabang()
	{
		$where = "idcab <> '1'";
		$this->db->where($where);
  		return $this->db->get($this->table_m_cab);
	}	
	
	function get_cabang_byidcab($idcab)
	{
		$this->db->where('idcab',$idcab);
  		return $this->db->get($this->table_m_cab);
	}	
/*-----------------------CABANG MODEL---------------------------*/	
	
/*-----------------------OP REPORT MODEL---------------------------*/	
function get_op_byidcab($date1, $date2, $idcab)
		{
			$where = "DATE_FORMAT(m_op.adddate, '%Y-%m-%d') between '".$date1."' and '".$date2."'";
			$this->db->select('m_cab.cabname,
							   m_cab.idcab,
							  m_op.idop,
							  m_op.idstb,
							  m_op.c_amt_bapi,
							  m_op.opnumb,
							  m_op.prnumb,
							  m_op.type,
							  m_op.invoice,
							  m_op.vol,
							  m_op.pur,
							  m_op.fee,
							  m_op.inf,
							  m_op.ambil,
							  m_op.nocpvform,
							  m_op.donumb,
							  m_op.adddate,
							  m_op.transname,
							  m_op.vnumb,
							  m_op.addby');
			$this->db->from('m_op');
			$this->db->join('m_cab', 'm_cab.idcab = m_op.idcab');
			$this->db->where($where);
			$this->db->where('m_op.idcab',$idcab);
			$this->db->order_by('m_op.adddate', 'ASC'); 
			$query = $this->db->get();
			return $query;
		}
/*-----------------------OP REPORT MODEL---------------------------*/	


}