Files
shopee-apps/application/delete/models/ModelServiceBackup.php
T
2026-06-13 16:02:07 +10:00

142 lines
4.4 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class ModelService extends CI_Model {
public function create($table, $data, $batch = false)
{
if($batch === false){
$insert = $this->db->insert($table, $data);
}else{
$insert = $this->db->insert_batch($table, $data);
}
return $insert;
}
public function update($table, $data, $pk, $id = null, $batch = false)
{
if($batch === false){
$insert = $this->db->update($table, $data, array($pk => $id));
}else{
$insert = $this->db->update_batch($table, $data, $pk);
}
return $insert;
}
public function delete($table, $data, $pk)
{
$this->db->where_in($pk, $data);
return $this->db->delete($table);
}
public function getDataService($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('service a');
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
$this->db->join('operator c','c.ID_OPERATOR=a.OPERATOR_ID');
}else{
$this->db->select('*');
$this->db->from('service a');
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
$this->db->join('operator c','c.ID_OPERATOR=a.OPERATOR_ID');
$this->db->where(['ID_SERVICE' => $id]);
}
return $this->db->get()->result_array();
}
public function getDataService2($id = null){
if ($id === null) {
$this->db->select('*,CONCAT(DATE_FORMAT(b.TANGGAL_SERVICE,"%d %M %Y")) AS WAKTU');
$this->db->from('progress a');
$this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID');
$this->db->join('barang c','c.ID_BARANG=a.BARANG_ID');
$this->db->join('pelanggan d','d.ID_PELANGGAN=b.PELANGGAN_ID');
$this->db->join('operator e','e.ID_OPERATOR=b.OPERATOR_ID');
}else{
$this->db->select('*,CONCAT(DATE_FORMAT(b.TANGGAL_SERVICE,"%d %M %Y")) AS WAKTU');
$this->db->from('progress a');
$this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID');
$this->db->join('barang c','c.ID_BARANG=a.BARANG_ID');
$this->db->join('pelanggan d','d.ID_PELANGGAN=b.PELANGGAN_ID');
$this->db->join('operator e','e.ID_OPERATOR=b.OPERATOR_ID');
$this->db->where(['ID_PROGRESS' => $id]);
}
return $this->db->get()->result_array();
}
public function getDataOperator($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('operator');
}else{
$this->db->select('*');
$this->db->from('operator');
$this->db->where(['ID_OPERATOR' => $id]);
}
return $this->db->get()->result_array();
}
public function getDataPelanggan($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('pelanggan');
}else{
$this->db->select('*');
$this->db->from('pelanggan');
$this->db->where(['ID_PELANGGAN' => $id]);
}
return $this->db->get()->result_array();
}
public function getDataBarang($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('barang');
}else{
$this->db->select('*');
$this->db->from('barang');
$this->db->where(['ID_BARANG' => $id]);
}
return $this->db->get()->result_array();
}
public function getDataProgress($id = null){
$this->db->select('*');
$this->db->from('progress a');
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
$this->db->where(['a.SERVICE_ID' => null]);
return $this->db->get()->result_array();
}
public function getIDService($kode_service)
{
$this->db->select('*');
$this->db->from('service');
$this->db->where(['KODE_SERVICE' => $kode_service]);
return $this->db->get()->result_array();
}
public function getIDProgress()
{
$this->db->select('*');
$this->db->from('progress');
$this->db->where(['SERVICE_ID' => null]);
return $this->db->get()->result_array();
}
public function cekPass($id, $pass)
{
$this->db->select('*');
$this->db->from('karyawan');
$this->db->where(['ID_KARYAWAN' => $id]);
$this->db->where(['PASSWORD' => $pass]);
return $this->db->get()->result_array();
}
}
?>