<?php 
/*
Fungsi : Controller untuk Cabang report
*/

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Cop_approve extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	
/*-------------Inisialisasi variabel--------------*/ 
	
	//Menu ID utk keperluan otorisasi
	
	
	//var $menu_pusat_stb_rpt
	var $menu_branch_op_periode  = 116;
	
	var $menu_branch_op_periode_detail   = 197;
	
	var $menu_branch_po_periode = 117;
	
	var $menu_branch_stb_rpt = 99;
	
	var $menu_branch_qcstb_rpt = 182;
	
	var $menu_branch_qcsj_rpt = 183;
	
	var $menu_branch_dn_rpt = 118;
	
	var $menu_branch_mutasi_stok_rpt = 163;
	
	var $menu_branch_supp_report = 168;
	
	var $menu_branch_real_stock_report = 181;
	
	var $menu_branch_act_report = 184;
	
	var $menu_branch_po_credit_report = 185;
	
	var $menu_vendor_credit_detail = 190;
	
	//var $menu_branch_pc_rpt = ;
	
/*-------------Inisialisasi variabel--------------*/ 	

/*------------Fungsi lokal------------------------*/
	


/*------------Fungsi local------------------------*/	
	function __construct()
	{
		parent::__construct();
		
		$this->load->model('admin/branch_report_model', '', TRUE);
		$this->fungsi->check_login();
	}
	
	
	public function index()
	{	
		$this->list_cop2();
		
	}
function list_cop2()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu = $this->branch_report_model->get_cop_paging2($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_cop2/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/print_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/list_approve_cop', $data);
	
}
function approve_op()
{
	$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		       $query2 = $this->db->query("update m_op set cop_request = 2,cop_approve = 1  where idop = ".$offset."  ")->result();										 //          
	       /* $data['cop'] = $this->db->query("SELECT *
	                           
								FROM m_op inner join m_cab on m_cab.idcab = m_op.idcab 
								          inner join m_transport on m_transport.idtrans = m_op.idtrans
										   inner join m_supp on m_supp.idsupp = m_op.idsupp
										   where m_op.idop = ".$op."  ")->result();*/
	
		$this->load->view('admin/request_cop', $data);
	

}

function list_cop3()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu3 = $this->branch_report_model->get_cop_paging3($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop2( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_cop3/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Action</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu3  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							  <td align="center">Approval</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/cop_approve/print_op/'.$menus->idop,'View',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 else 
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#CCFF99">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/cetak_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
	
}

function list_tangerang()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu3 = $this->branch_report_model->get_tangerang($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop2( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_tangerang/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Action</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu3  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							  <td align="center">Approval</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/cop_approve/print_op/'.$menus->idop,'View',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 else 
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#CCFF99">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/cetak_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
	
}

function list_surabaya()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu3 = $this->branch_report_model->get_surabaya($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop2( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_surabaya/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Action</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu3  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							  <td align="center">Approval</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/cop_approve/print_op/'.$menus->idop,'View',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 else 
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#CCFF99">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/cetak_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
	
}

function list_bandung()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu3 = $this->branch_report_model->get_bandung($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop2( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_bandung/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Action</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu3  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							  <td align="center">Approval</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/cop_approve/print_op/'.$menus->idop,'View',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 else 
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#CCFF99">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/cetak_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
	
}

function list_cirebon()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu3 = $this->branch_report_model->get_cirebon($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop2( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_bandung/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Action</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu3  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							  <td align="center">Approval</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/cop_approve/print_op/'.$menus->idop,'View',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 else 
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#CCFF99">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/cetak_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
	
}

function list_semarang()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu3 = $this->branch_report_model->get_semarang($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop2( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_bandung/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Action</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu3  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							  <td align="center">Approval</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/cop_approve/print_op/'.$menus->idop,'View',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 else 
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#CCFF99">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/cetak_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
	
}

function list_samarinda()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu3 = $this->branch_report_model->get_samarinda($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop2( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_bandung/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Action</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu3  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							  <td align="center">Approval</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/cop_approve/print_op/'.$menus->idop,'View',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 else 
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#CCFF99">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/cetak_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
	
}

function list_banjarmasin()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu3 = $this->branch_report_model->get_banjarmasin($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop2( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_bandung/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Action</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu3  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							  <td align="center">Approval</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/cop_approve/print_op/'.$menus->idop,'View',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 else 
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#CCFF99">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/cetak_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
	
}

function list_balikpapan()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu3 = $this->branch_report_model->get_balikpapan($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop2( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_bandung/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Action</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu3  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							  <td align="center">Approval</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 2 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/cop_approve/print_op/'.$menus->idop,'View',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 else 
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#CCFF99">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">'. anchor_popup('admin/branch_report/cetak_op/'.$menus->idop,'Print',array('class' => 'update')).'</td>
							     <td align="center">'. anchor('admin/cop_approve/history_op/'.$menus->idop,'Go to History',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
	
}

function list_cop4()
{
		
		/* Setting Parameter Untuk Paging */
		$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		
		//$data['menu_path'] = 'ADMIN > BRANCH OIL PURCHASE REPORT';
		//$query_menu2_edit = $this->admin_model->get_menu2($this->uri->segment(4));
		//foreach ($query_menu2_edit->result() as $row_menu2)
		{	
		//Kirim value form yang tidak termasuk dalam validasi
		//$jenis = $row_menu2->desk;
		}
		
		$menu4 = $this->branch_report_model->get_cop_paging4($this->config->item('paging_limit'), $offset,$data['search'])->result();
		$num_rows = $this->branch_report_model->count_all_cop( $data['search']);
		$config['base_url'] = site_url('admin/cop_approve/list_cop4/');
		$data['total'] = $num_rows;
		if ($num_rows > 0) // Jika query menghasilkan data
				{
					// Membuat pagination			
					$config['total_rows'] = $num_rows;
					$config['per_page'] = $this->config->item('paging_limit');
					$config['uri_segment'] = $uri_segment;
					$this->pagination->initialize($config);
					$data['pagination'] = $this->pagination->create_links();
					$i = 0 + $offset;
					
					
		            $data['tables'] = '<table style="width : 100%; border-spacing:0;" border="1" cellpadding="6"         cellspacing="0" >
      <tr>
       <th bg bgcolor="#00FF00">COP ID</th>
      <th bg bgcolor="#00FF00" width="50">No. OP</th>
      <th bg bgcolor="#00FF00">NO. PR</th>
	  <th bg bgcolor="#00FF00">TYPE</th>
	  <th bg bgcolor="#00FF00">INVOICE</th>
	  <th bg bgcolor="#00FF00">VOLUME BELI</th>
	   <th bg bgcolor="#00FF00">NO.POLISI</th>
      <th bg bgcolor="#00FF00">NO. DO</th>
	  <th bg bgcolor="#00FF00">Supplier</th>
	  <th bg bgcolor="#00FF00">NO. MANIFEST</th>
      <th bg bgcolor="#00FF00">TGL TRANSAKSI	</th>
	  <th bg bgcolor="#00FF00">Status</th>
	   <th bg bgcolor="#00FF00">Detail</th>
	   <th bg bgcolor="#00FF00">Request Ulang</th>
	  </tr>';
					
					/*COP ID', 'NO. OP', 'NO. PR','TYPE','INVOICE','VOLUME BELI','NO. POLISI','NO. DO','NO. MANIFEST','TGL TRANSAKSI', 'Option'
					$this->table->set_heading('No. Count', 'No. DO', 'Jenis Antrian', 'No. POL / sopir', 'lokasi','Jam in','Jam out','Status','Tujuan',   'Action');*/
					foreach ($menu4  as $menus)
					{
					
					 
					  if( ($menus->cop_request)== 1 )
{$data['tables'] .= '<tr bgcolor="#FFFF99">
                              <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">'. anchor('admin/cop_approve/approve_op/'.$menus->idop,'Approve',array('class' => 'update')).'</td>
							  <td align="center">'. anchor_popup('admin/branch_report/detail_op/'.$menus->idop,'Detail',array('class' => 'update')).'</td>
							    <td align="center">On Progress</td>
                     </tr>';}	
					 else
					 if($menus->cop_request == 3 )
					 {$data['tables'] .= '<tr bgcolor="#99FFCC">

                           <td align="center">'.$menus->idop.'</td>
    						   <td align="center">'. $menus->opnumb.'</td>
                              <td align="center">'. $menus->prnumb.'</td>
							  <td align="center">'. $menus->type.'</td>
							  <td align="center">'. $menus->invoice.'</td>
							  <td align="center">'. $menus->vol.'</td>
							  <td align="center">'. $menus->vnumb.'</td>
							  <td align="center">'. $menus->donumb.'</td>
						      <td align="center">'. $menus->suppname.'</td>
							  <td align="center">'. $menus->mnfst.'</td>
							  <td align="center">'. date("d-m-Y", strtotime($menus->postdate)).'</td>
							   <td align="center">Approved</td>
							   <td align="center">Printed</td>
							   <td align="center">'. anchor('admin/cop_approve/request_ulang/'.$menus->idop,'Request',array('class' => 'update')).'</td>
                     </tr>';}
					 
					}
					//$data['tables'] = $this->table->generate();
					$data['tables'] .= '</table>';
					$list = $data['tables'];
					//echo $list;
				}
			else
				{
					$data['message'] = 'No data to display';
				}		
	
	
		$this->load->view('admin/listcop', $data);
}
function request_ulang()
{

	$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		       $query2 = $this->db->query("update m_op set cop_request = 1  where idop = ".$offset."  ")->result();	
			   
			   /*$data['cop'] = $this->db->query("SELECT *
	                           
								FROM m_op inner join m_cab on m_cab.idcab = m_op.idcab 
								          inner join m_transport on m_transport.idtrans = m_op.idtrans
										   inner join m_supp on m_supp.idsupp = m_op.idsupp
										   where m_op.idop = ".$offset."  ")->result();	*/								 //          
	        // $data['form_action']= site_url('admin/branch_report/request_op');
	
		$this->load->view('admin/request_cop', $data);
}
function history_op()
{

	$uri_segment = 4;
		$offset =    $this->uri->segment($uri_segment);
		       $query2 = $this->db->query("update m_op set cop_request = 3  where idop = ".$offset."  ")->result();	
			   
			   /*$data['cop'] = $this->db->query("SELECT *
	                           
								FROM m_op inner join m_cab on m_cab.idcab = m_op.idcab 
								          inner join m_transport on m_transport.idtrans = m_op.idtrans
										   inner join m_supp on m_supp.idsupp = m_op.idsupp
										   where m_op.idop = ".$offset."  ")->result();	*/								 //          
	        // $data['form_action']= site_url('admin/branch_report/request_op');
	
		$this->load->view('admin/request_cop', $data);
}
function approve_all_op()
{
	//$uri_segment = 4;
		//$offset =    $this->uri->segment($uri_segment);
		       $query2 = $this->db->query("update m_op set cop_request = 2,cop_approve = 1  where cop_request = 1  ")->result();										 //          
	       /* $data['cop'] = $this->db->query("SELECT *
	                           
								FROM m_op inner join m_cab on m_cab.idcab = m_op.idcab 
								          inner join m_transport on m_transport.idtrans = m_op.idtrans
										   inner join m_supp on m_supp.idsupp = m_op.idsupp
										   where m_op.idop = ".$op."  ")->result();*/
	
		//$this->load->view('admin/request_cop', $data);
	

}

function print_op()
{
	$uri_segment = 4;
		$op =    $this->uri->segment($uri_segment);

	$data['cop'] = $this->db->query("SELECT *
	                           
								FROM m_op inner join m_cab on m_cab.idcab = m_op.idcab 
								          inner join m_transport on m_transport.idtrans = m_op.idtrans
										   inner join m_supp on m_supp.idsupp = m_op.idsupp
										   inner join t_stb on t_stb.idstb = m_op.idstb
										   where m_op.idop = ".$op."  ")->result();
	//$query10 = $this->db->query("update m_op set cop_request = 3  where idop = ".$op."   ")->result();	
	$data['form_action']= site_url('admin/branch_report/cetak_op');
		$this->load->view('admin/print_cop', $data);
}
}