copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,249 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class ModelKonfigurasi 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 getData_SetHakMaster_groupKARYAWAN() { // Konfigurasi = [1]
|
||||
$this->db->select('*');
|
||||
$this->db->from('set_hakmaster a');
|
||||
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
||||
$this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC');
|
||||
$this->db->group_by('a.KARYAWAN_ID');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Karyawan_byID($id=null) { // Konfigurasi = [1]
|
||||
if ($id==null) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('karyawan');
|
||||
$this->db->where('STATUS_KARYAWAN=1');
|
||||
$this->db->where('USERNAME!="insentive"');
|
||||
$this->db->where('USERNAME!="louis"');
|
||||
$this->db->where('USERNAME!="service"');
|
||||
$this->db->where('USERNAME!="itp"');
|
||||
$this->db->where('USERNAME!="none"');
|
||||
$this->db->where('USERNAME!="sugeng"');
|
||||
$this->db->where('USERNAME!="hwely"');
|
||||
$this->db->where('USERNAME!="admin"');
|
||||
$this->db->where('USERNAME!="irwan"');
|
||||
$this->db->order_by('USERNAME ASC');
|
||||
} else {
|
||||
$this->db->select('*');
|
||||
$this->db->from('karyawan');
|
||||
$this->db->where(['ID_KARYAWAN' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SetHakMaster_byKARYAWAN($id) { // Konfigurasi = [1, 2, 3]
|
||||
$this->db->select('*');
|
||||
$this->db->from('set_hakmaster a');
|
||||
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
||||
$this->db->where('a.KARYAWAN_ID=', $id);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SetHariLibur() { // Konfigurasi = [4]
|
||||
$this->db->select('*,DATE_FORMAT(TGL_SHL,"%d/%m/%Y") as TANGGAL');
|
||||
$this->db->from('set_harilibur');
|
||||
$this->db->order_by('ID_SHL DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SetHariLibur_byID($id) { // Konfigurasi = [6, 7]
|
||||
$this->db->select('*,DATE_FORMAT(TGL_SHL,"%d/%m/%Y") as TANGGAL');
|
||||
$this->db->from('set_harilibur');
|
||||
$this->db->where('ID_SHL=', $id);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Komisi($id = null) { // Konfigurasi = [8, 10]
|
||||
if ($id === null) {
|
||||
$this->db->select('*,FORMAT(BIAYA_SERVICE,2) as BIAYA');
|
||||
$this->db->from('jenis');
|
||||
$this->db->order_by('NAMA_JENIS ASC');
|
||||
} else {
|
||||
$this->db->select('*');
|
||||
$this->db->from('jenis');
|
||||
$this->db->where(['ID_JENIS' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Jenis_byID($id) { // Konfigurasi = [9, 11]
|
||||
$this->db->select('*');
|
||||
$this->db->from('jenis');
|
||||
$this->db->where('ID_JENIS=', $id);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Kuartal($id = null) { // Konfigurasi = [12, 13, 14, 16, 17]
|
||||
if ($id === null) {
|
||||
$this->db->select('*,DATE_FORMAT(AWAL_KUARTAL,"%d/%m/%Y") as AWAL,DATE_FORMAT(AKHIR_KUARTAL,"%d/%m/%Y") as AKHIR,DATE_FORMAT(KUNCI_KUARTAL,"%d/%m/%Y") as KUNCI');
|
||||
$this->db->from('kuartal');
|
||||
$this->db->order_by('STATUS_KUARTAL ASC, ID_KUARTAL DESC');
|
||||
} else {
|
||||
$this->db->select('*');
|
||||
$this->db->from('kuartal');
|
||||
$this->db->where(['ID_KUARTAL' => $id]);
|
||||
$this->db->order_by('ID_KUARTAL ASC');
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_RekapKuartal_byKUARTAL($id) { // Konfigurasi = [12, 15]
|
||||
$this->db->select('*');
|
||||
$this->db->from('rekap_kuartal a');
|
||||
$this->db->join('kuartal b','b.ID_KUARTAL=a.KUARTAL_ID');
|
||||
$this->db->where(['a.KUARTAL_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SetTargetSales_byKUARTAL($id) { // Konfigurasi = [12, 15]
|
||||
$this->db->select('*');
|
||||
$this->db->from('set_targetsales a');
|
||||
$this->db->join('kuartal b','b.ID_KUARTAL=a.KUARTAL_ID');
|
||||
$this->db->where(['a.KUARTAL_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_RumusKuartal($id = null) { // Konfigurasi = [18, 20, 22, 23, 24, 25]
|
||||
if ($id === null) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('rumus_kuartal');
|
||||
$this->db->order_by('ID_RMQ DESC');
|
||||
} else {
|
||||
$this->db->select('*');
|
||||
$this->db->from('rumus_kuartal');
|
||||
$this->db->where(['ID_RMQ' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarRumusKuartal_byRMQ($id) { // Konfigurasi = [18, 21, 22, 23, 24]
|
||||
$this->db->select('*,FORMAT(a.BAWAH_DRMQ,2) as BAWAH,FORMAT(a.ATAS_DRMQ,2) as ATAS,FORMAT((a.RATE_DRMQ*100),2) as RATE');
|
||||
$this->db->from('daftar_rumuskuartal a');
|
||||
$this->db->join('rumus_kuartal b','b.ID_RMQ=a.RMQ_ID');
|
||||
$this->db->where(['a.RMQ_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarRumusKuartal_byID($id) { // Konfigurasi = [24]
|
||||
$this->db->select('*,FORMAT(a.BAWAH_DRMQ,2) as BAWAH,FORMAT(a.ATAS_DRMQ,2) as ATAS,FORMAT((a.RATE_DRMQ*100),2) as RATE');
|
||||
$this->db->from('daftar_rumuskuartal a');
|
||||
$this->db->join('rumus_kuartal b','b.ID_RMQ=a.RMQ_ID');
|
||||
$this->db->where(['a.ID_DRMQ' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarRumusKuartal_byRMQ_orderDESC_limit1($id) { // Konfigurasi = [25]
|
||||
$this->db->select('*,FORMAT(a.BAWAH_DRMQ,2) as BAWAH,FORMAT(a.ATAS_DRMQ,2) as ATAS,FORMAT((a.RATE_DRMQ*100),2) as RATE');
|
||||
$this->db->from('daftar_rumuskuartal a');
|
||||
$this->db->join('rumus_kuartal b','b.ID_RMQ=a.RMQ_ID');
|
||||
$this->db->where(['a.RMQ_ID' => $id]);
|
||||
$this->db->order_by('a.ID_DRMQ DESC');
|
||||
$this->db->limit('1');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_ListSalesTarget($id=null) { // Konfigurasi = [26, 27, 29, 31, 32]
|
||||
if ($id==null) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('list_sales_target a');
|
||||
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID','left');
|
||||
$this->db->order_by('a.ID_LST ASC');
|
||||
} else {
|
||||
$this->db->select('*');
|
||||
$this->db->from('list_sales_target a');
|
||||
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID','left');
|
||||
$this->db->where(['a.ID_LST' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Kuartal_byTAHUN($id) { // Konfigurasi = [26, 27, 28]
|
||||
$this->db->select('*,DATE_FORMAT(AWAL_KUARTAL,"%d/%m/%Y") as AWAL,DATE_FORMAT(AKHIR_KUARTAL,"%d/%m/%Y") as AKHIR');
|
||||
$this->db->from('kuartal');
|
||||
$this->db->where(['TAHUN_KUARTAL' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SetTargetSales_byKUARTAL_byKARYAWAN($id1, $id2) { // Konfigurasi = [26, 27]
|
||||
$this->db->select('*');
|
||||
$this->db->from('set_targetsales a');
|
||||
$this->db->join('kuartal b','b.ID_KUARTAL=a.KUARTAL_ID');
|
||||
$this->db->where(['a.KUARTAL_ID' => $id1]);
|
||||
$this->db->where(['a.KARYAWAN_ID' => $id2]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SetTargetSales_byTAHUN($year) { // Konfigurasi = [26]
|
||||
$this->db->select('*');
|
||||
$this->db->from('set_targetsales a');
|
||||
$this->db->join('kuartal b','b.ID_KUARTAL=a.KUARTAL_ID');
|
||||
$this->db->where(['b.TAHUN_KUARTAL' => $year]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_ListSalesTarget_byKARYAWAN($id) { // Konfigurasi = [28, 29, 30]
|
||||
$this->db->select('*');
|
||||
$this->db->from('list_sales_target a');
|
||||
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
||||
$this->db->where(['a.KARYAWAN_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_ListSalesTarget_byTEAM($id) { // Konfigurasi = [28]
|
||||
$this->db->select('*');
|
||||
$this->db->from('list_sales_target a');
|
||||
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
||||
$this->db->where(['a.TEAM_LST' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SetTargetSales_byKARYAWAN($id) { // Konfigurasi = [29]
|
||||
$this->db->select('*');
|
||||
$this->db->from('set_targetsales a');
|
||||
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
||||
$this->db->where(['a.KARYAWAN_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Karyawan_SALES() { // Konfigurasi = [29]
|
||||
$this->db->select('*');
|
||||
$this->db->from('karyawan a');
|
||||
$this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID');
|
||||
$this->db->like('b.NAMA_JABATAN','SALES');
|
||||
$this->db->not_like('a.NAMA_PANGGILAN_KARYAWAN','ITP');
|
||||
$this->db->not_like('a.NAMA_PANGGILAN_KARYAWAN','Insentive');
|
||||
$this->db->not_like('a.NAMA_PANGGILAN_KARYAWAN','None');
|
||||
$this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user