update form barang
This commit is contained in:
@@ -65,6 +65,7 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
->from('item_barcodes ib')
|
||||
->join('items i', 'i.id = ib.item_id', 'left')
|
||||
->where('ib.barcode', $barcode)
|
||||
->where('ib.qty_sisa >', 0)
|
||||
->get()
|
||||
->row();
|
||||
|
||||
@@ -74,6 +75,7 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
->from('item_barcodes ib')
|
||||
->join('items i', 'i.id = ib.item_id', 'left')
|
||||
->where('ib.serial_number', $barcode)
|
||||
->where('ib.qty_sisa >', 0)
|
||||
->get()
|
||||
->row();
|
||||
}
|
||||
@@ -163,6 +165,19 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
|
||||
return ['status' => true, 'message' => $msg, 'errors' => $errors];
|
||||
}
|
||||
|
||||
public function get_dates_by_employee_id($user_id)
|
||||
{
|
||||
return $this->db
|
||||
->select("DATE(it.created_at) as tanggal")
|
||||
->from('item_technician it')
|
||||
->where('it.user_id', $user_id)
|
||||
->where('it.status', 'active')
|
||||
->group_by("DATE(it.created_at)")
|
||||
->order_by("DATE(it.created_at)", "DESC")
|
||||
->get()
|
||||
->result();
|
||||
}
|
||||
|
||||
public function batch_dibawa(array $barcodes, $user_id)
|
||||
{
|
||||
@@ -362,10 +377,11 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
public function get_teknisi_items_data($user_id, $start, $length, $search, $order_col, $order_dir)
|
||||
{
|
||||
$sort_cols = [
|
||||
1 => 'it.barcode',
|
||||
2 => 'i.nama_barang',
|
||||
3 => 'ib.serial_number',
|
||||
4 => 'it.status'
|
||||
1 => 'it.created_at',
|
||||
2 => 'it.barcode',
|
||||
3 => 'i.nama_barang',
|
||||
4 => 'ib.serial_number',
|
||||
5 => 'it.status'
|
||||
];
|
||||
|
||||
$this->db
|
||||
@@ -375,7 +391,7 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
ib.serial_number,
|
||||
ib.qty_sisa,
|
||||
it.status,
|
||||
it.created_at
|
||||
DATE_FORMAT(it.created_at, '%d/%m/%Y') as tanggal
|
||||
")
|
||||
->from('item_technician it')
|
||||
->join('items i', 'i.id = it.item_id', 'left')
|
||||
@@ -484,21 +500,28 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
->row();
|
||||
}
|
||||
|
||||
public function get_teknisi_items_full($user_id)
|
||||
public function get_teknisi_items_full($user_id, $tanggal = null)
|
||||
{
|
||||
return $this->db
|
||||
$this->db
|
||||
->select("
|
||||
it.barcode,
|
||||
i.nama_barang,
|
||||
ib.serial_number,
|
||||
ib.qty_sisa,
|
||||
it.status
|
||||
it.status,
|
||||
DATE_FORMAT(it.created_at, '%d/%m/%Y') as tanggal
|
||||
")
|
||||
->from('item_technician it')
|
||||
->join('items i', 'i.id = it.item_id', 'left')
|
||||
->join('item_barcodes ib', 'ib.barcode = it.barcode', 'left')
|
||||
->where('it.user_id', $user_id)
|
||||
->where('it.status', 'active')
|
||||
->where('it.status', 'active');
|
||||
|
||||
if ($tanggal AND $tanggal != 'all') {
|
||||
$this->db->where('DATE(it.created_at)', $tanggal);
|
||||
}
|
||||
|
||||
return $this->db
|
||||
->order_by('it.created_at', 'ASC')
|
||||
->get()
|
||||
->result();
|
||||
|
||||
Reference in New Issue
Block a user