copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class ModelClaim 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 getDataClaim($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('garansi a');
|
||||
$this->db->join('progress b','b.GARANSI_ID=a.ID_GARANSI');
|
||||
$this->db->join('service c','c.PROGRESS_ID=b.ID_PROGRESS');
|
||||
$this->db->join('agen d','d.ID_AGEN=a.AGEN_ID');
|
||||
$this->db->order_by('ID_GARANSI','ASC');
|
||||
}else{
|
||||
$this->db->select('*');
|
||||
$this->db->from('garansi a');
|
||||
$this->db->join('progress b','b.GARANSI_ID=a.ID_GARANSI');
|
||||
$this->db->join('service c','c.PROGRESS_ID=b.ID_PROGRESS');
|
||||
$this->db->join('agen d','d.ID_AGEN=a.AGEN_ID');
|
||||
$this->db->order_by('ID_GARANSI','ASC');
|
||||
$this->db->where(['ID_GARANSI' => $id]);
|
||||
}
|
||||
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getViewClaim($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('*,CONCAT(DATE_FORMAT(g.TANGGAL_GARANSI,"%d %M %Y %H:%i")) AS WAKTU_CLAIM');
|
||||
$this->db->from('service a');
|
||||
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
||||
$this->db->join('operator c','c.ID_OPERATOR=a.OPERATOR_ID');
|
||||
$this->db->join('pelanggan d','d.ID_PELANGGAN=a.PELANGGAN_ID');
|
||||
$this->db->join('progress e','a.PROGRESS_ID=e.ID_PROGRESS','left');
|
||||
$this->db->join('teknisi f','f.ID_TEKNISI=e.TEKNISI_ID','left');
|
||||
$this->db->join('garansi g','g.ID_GARANSI=e.GARANSI_ID','left');
|
||||
$this->db->join('agen h','h.ID_AGEN=g.AGEN_ID','left');
|
||||
$this->db->where('g.STATUS_GARANSI="Belum Proses"');
|
||||
$this->db->order_by('TANGGAL_GARANSI','ASC');
|
||||
}
|
||||
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getViewUpClaim($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('*,CONCAT(DATE_FORMAT(g.TANGGAL_GARANSI,"%d %M %Y %H:%i")) AS WAKTU_CLAIM');
|
||||
$this->db->from('service a');
|
||||
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
||||
$this->db->join('operator c','c.ID_OPERATOR=a.OPERATOR_ID');
|
||||
$this->db->join('pelanggan d','d.ID_PELANGGAN=a.PELANGGAN_ID');
|
||||
$this->db->join('progress e','a.PROGRESS_ID=e.ID_PROGRESS','left');
|
||||
$this->db->join('teknisi f','f.ID_TEKNISI=e.TEKNISI_ID','left');
|
||||
$this->db->join('garansi g','g.ID_GARANSI=e.GARANSI_ID','left');
|
||||
$this->db->join('agen h','h.ID_AGEN=g.AGEN_ID','left');
|
||||
$this->db->where('g.STATUS_GARANSI="Proses Claim"');
|
||||
$this->db->order_by('TANGGAL_GARANSI','ASC');
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getDataClaimID($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select_max('ID_CLAIMDELL');
|
||||
$this->db->from('claimdell');
|
||||
}else{
|
||||
$this->db->select_max('ID_CLAIMDELL');
|
||||
$this->db->from('claimdell');
|
||||
}
|
||||
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getDataIDService($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('a.ID_SERVICE');
|
||||
$this->db->from('service a');
|
||||
$this->db->join('claimdell b','b.ID_CLAIMDELL=a.CLAIMDELL_ID');
|
||||
}else{
|
||||
$this->db->select('a.ID_SERVICE');
|
||||
$this->db->from('service a');
|
||||
$this->db->join('claimdell b','b.ID_CLAIMDELL=a.CLAIMDELL_ID');
|
||||
$this->db->where(['ID_CLAIMDELL' => $id]);
|
||||
}
|
||||
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getDataIDProgress($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('b.ID_PROGRESS');
|
||||
$this->db->from('service a');
|
||||
$this->db->join('progress b','b.ID_PROGRESS=a.PROGRESS_ID');
|
||||
}else{
|
||||
$this->db->select('b.ID_PROGRESS');
|
||||
$this->db->from('service a');
|
||||
$this->db->join('progress b','b.ID_PROGRESS=a.PROGRESS_ID');
|
||||
$this->db->where(['ID_SERVICE' => $id]);
|
||||
}
|
||||
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getGaransiIDProgress($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('a.ID_PROGRESS');
|
||||
$this->db->from('progress a');
|
||||
$this->db->join('garansi b','b.ID_GARANSI=a.GARANSI_ID');
|
||||
}else{
|
||||
$this->db->select('a.ID_PROGRESS');
|
||||
$this->db->from('progress a');
|
||||
$this->db->join('garansi b','b.ID_GARANSI=a.GARANSI_ID');
|
||||
$this->db->where(['b.ID_GARANSI' => $id]);
|
||||
}
|
||||
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getProgressIDService($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('a.ID_SERVICE');
|
||||
$this->db->from('service a');
|
||||
$this->db->join('progress b','b.ID_PROGRESS=a.PROGRESS_ID');
|
||||
}else{
|
||||
$this->db->select('a.ID_SERVICE');
|
||||
$this->db->from('service a');
|
||||
$this->db->join('progress b','b.ID_PROGRESS=a.PROGRESS_ID');
|
||||
$this->db->where(['b.ID_PROGRESS' => $id]);
|
||||
}
|
||||
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getDataTeknisiID($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('ID_PROGRESS,STATUS_PROGRESS,TEKNISI_ID');
|
||||
$this->db->from('progress');
|
||||
}else{
|
||||
$this->db->select('ID_PROGRESS,STATUS_PROGRESS,TEKNISI_ID');
|
||||
$this->db->from('progress');
|
||||
$this->db->where(['ID_PROGRESS' => $id]);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user