|
Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/laciasmara.com/public_html/shop/application/models/ |
Upload File : |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Transfer_stock_m extends MY_Model
{
protected $_table_name = 'transfer_stock';
protected $_primary_key = 'id_transfer_stock';
protected $_order_by = 'id_transfer_stock';
public $add_transfer_rules = array(
array(
'field' => 'warehouse_id',
'label' => 'warehouse',
'rules' => 'trim|required'
),
);
function __construct()
{
parent::__construct();
}
public function add_transfer_stock($data)
{
$this->db->insert('transfer_stock', $data);
return $this->db->insert_id();
}
//function count all record for orders
public function record_count()
{
return $this->db->get('transfer_stock')->num_rows();
}
//pagination included
function get_all_transfer_stock($limit, $start)
{
$this->db->select('*');
$this->db->from('transfer_stock');
// Menambahkan kondisi untuk menghindari nilai tertentu di in_warehouse_id dan out_warehouse_id
$this->db->where_not_in('in_warehouse_id', [3, 7, 8, 9]);
$this->db->where_not_in('out_warehouse_id', [3, 7, 8, 9]);
$this->db->order_by('id_transfer_stock', 'desc');
$this->db->limit($limit, $start);
$query = $this->db->get();
return $query->result();
}
//get specific order with its customer details
function get_transfer_stock($id)
{
$this->db->select('*');
$this->db->from('transfer_stock');
$this->db->where('id_transfer_stock', $id);
$query = $this->db->get();
return $query->row();
}
}