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); } // Daftar Fungsi generate public function generate_addDay($date, $day) { // Used $sum = strtotime(date("Y-m-d", strtotime("$date")) . " +$day days"); $dateTo=date('Y-m-d',$sum); return $dateTo; } public function generate_addHour($date, $hour) { // Used $sum = strtotime(date("H:i", strtotime("$date")) . " +$hour hours"); $dateTo=date('H:i',$sum); return $dateTo; } public function generate_addMonth($date, $month) { // Used $sum = strtotime(date("Y-m-d", strtotime("$date")) . " +$month months"); $dateTo=date('Y-m-d',$sum); return $dateTo; } public function generate_hasilLembur($jabatan, $awal ,$akhir, $jenis, $tgl = null) { // Used if ($jenis==1) { //Pembeda perhitungan awal, divisi Keuangan dan lainnya if (strpos($jabatan,"KEUANGAN")!==FALSE) { $setawal = date('17:00'); } else { $setawal = date('18:00'); } //Check apakah hari Libur atau Tidak $day = strtotime($tgl); $day = date("D", $day); if ($day=="Sat") { $setawal = date('13:00'); } else if ($day=="Sun") { $setawal = $awal; } //Eliminasi Jam yang tidak sesuai if (strtotime($awal)=strtotime($setmalam1)){ $lembur = $lembur + 20000; } //Eliminasi Jam Luar Kota Lebih dari Jam 10 Malam $setmalam2 = date('22:00'); if (strtotime($akhir)>=strtotime($setmalam2)){ $lembur = $lembur + 20000; } //Eliminasi Inap if ($inap==1){ $lembur = $lembur + 20000; } } else if ($jenis==4) { $lembur = 70000; //Eliminasi Inap if ($inap==1){ $lembur = $lembur + 20000; } } else if ($jenis==6) { $lembur = 0; //Eliminasi Inap if ($inap==2){ $lembur = $lembur + 60000; } } return $lembur; } public function generate_inisialCorp($id) { // Used if ($id==1) { $nama_corp = "TMP"; } else if ($id==2) { $nama_corp = "DMT"; } else if ($id==3) { $nama_corp = "PCM"; } else if ($id==4) { $nama_corp = "SFTR"; } else if ($id==5) { $nama_corp = "ITP"; } else { $nama_corp = "OPNAME"; } return $nama_corp; } public function generate_inisialDay($day) { // Used if ($day=="Monday") { $hari = "Senin"; } else if ($day=="Tuesday") { $hari = "Selasa"; } else if ($day=="Wednesday") { $hari = "Rabu"; } else if ($day=="Thursday") { $hari = "Kamis"; } else if ($day=="Friday") { $hari = "Jumat"; } else if ($day=="Saturday") { $hari = "Sabtu"; } else if ($day=="Sunday") { $hari = "Minggu"; } return $hari; } public function generate_inisialMonth($month) { // Used if ($month == "01") { $dateTo = "Januari"; } elseif ($month == "02") { $dateTo = "Februari"; } elseif ($month == "03") { $dateTo = "Maret"; } elseif ($month == "04") { $dateTo = "April"; } elseif ($month == "05") { $dateTo = "Mei"; } elseif ($month == "06") { $dateTo = "Juni"; } elseif ($month == "07") { $dateTo = "Juli"; } elseif ($month == "08") { $dateTo = "Agustus"; } elseif ($month == "09") { $dateTo = "September"; } elseif ($month == "10") { $dateTo = "Oktober"; } elseif ($month == "11") { $dateTo = "November"; } elseif ($month == "12") { $dateTo = "Desember"; } return $dateTo; } public function generate_INVPenjualan($id) { // Used $this->db->select('MAX(INV_PENJUALAN) AS KODE'); $this->db->from('penjualan'); if ($id==1) { $this->db->like('INV_PENJUALAN','INV/TMP', 'after'); $corp = "TMP"; } else if ($id==2) { $this->db->like('INV_PENJUALAN','INV/DMT', 'after'); $corp = "DMT"; } else if ($id==3) { $this->db->like('INV_PENJUALAN','INV/PCM', 'after'); $corp = "PCM"; } else if ($id==4) { $this->db->like('INV_PENJUALAN','INV/SFT', 'after'); $corp = "SFT"; } else if ($id==5) { $this->db->like('INV_PENJUALAN','INV/ITP', 'after'); $corp = "ITP"; } $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "INV/$corp/".$tgl."000001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 8, -6); if ($tgl_lama!=$tgl) { return "INV/$corp/".$tgl."000001"; } else { $panjang = 6; $data = substr($str, 10, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 16 - strlen($str); $data = "INV/$corp/".$tgl."000000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_INVReturPembelian($id) { // Used $this->db->select('MAX(INV_RB) AS KODE'); $this->db->from('retur_pembelian'); if ($id==1) { $this->db->like('INV_RB','RT/TMP', 'after'); $corp = "TMP"; } else if ($id==2) { $this->db->like('INV_RB','RT/DMT', 'after'); $corp = "DMT"; } else if ($id==3) { $this->db->like('INV_RB','RT/PCM', 'after'); $corp = "PCM"; } else if ($id==4) { $this->db->like('INV_RB','RT/SFT', 'after'); $corp = "SFT"; } else if ($id==5) { $this->db->like('INV_RB','RT/ITP', 'after'); $corp = "ITP"; } $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "RT/$corp/".$tgl."000001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 7, -6); if ($tgl_lama!=$tgl) { return "RT/$corp/".$tgl."000001"; } else { $panjang = 6; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 15 - strlen($str); $data = "RT/$corp/".$tgl."000000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_INVReturPenjualan() { // Used $this->db->select('MAX(INV_RJ) AS KODE'); $this->db->from('retur_penjualan'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PI".$tgl."000001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -6); if ($tgl_lama!=$tgl) { return "PI".$tgl."000001"; } else { $panjang = 6; $data = substr($str, 4, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "PI".$tgl."000000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeCabutan() { // Used $this->db->select('MAX(KODE_CABUTAN) AS KODE'); $this->db->from('cabutan'); $this->db->like('KODE_CABUTAN','CAB', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "CAB".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -5); if ($tgl_lama!=$tgl) { return "CAB".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 6, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "CAB".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeCreditNote() { // Used $this->db->select('MAX(KODE_CN) AS KODE'); $this->db->from('creditnote'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "CN".$tgl."000001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -6); if ($tgl_lama!=$tgl) { return "CN".$tgl."000001"; } else { $panjang = 6; $data = substr($str, 4, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "CN".$tgl."000000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeFormFeePelanggan() { // Used $this->db->select('MAX(KODE_FFP) AS KODE'); $this->db->from('form_feepelanggan'); $this->db->like('KODE_FFP','FFP/', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "FFP/".$tgl."0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 4, -4); if ($tgl_lama!=$tgl) { return "FFP/".$tgl."0001"; } else { $panjang = 4; $data = substr($str, 6, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "FFP/".$tgl."0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeFormKaryawan() { // Used $this->db->select('MAX(KODE_FK) AS KODE'); $this->db->from('form_karyawan'); $this->db->like('KODE_FK','FK/', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "FK/".$tgl."0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -4); if ($tgl_lama!=$tgl) { return "FK/".$tgl."0001"; } else { $panjang = 4; $data = substr($str, 5, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 9 - strlen($str); $data = "FK/".$tgl."0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeJurnalMemo() { // Used $this->db->select('MAX(KODE_AKUNTANSI) AS KODE'); $this->db->from('akuntansi'); $this->db->like('KODE_AKUNTANSI','JM','after'); $max = $this->db->get()->result_array(); $datPak = $this->Amod->getData_PeriodeAkuntansi_bySTATUS(0); $tgl = date_format(date_create($datPak[0]['AKHIR_PAK']), "y/m"); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "JM/$tgl/00001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -6); if ($tgl_lama!=$tgl) { return "JM/$tgl/00001"; } else { $panjang = 5; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 14 - strlen($str); $data = "JM/$tgl/00000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeKasbank($id_perkiraan, $jenis_akuntansi) { // Used $this->db->select('MAX(KODE_AKUNTANSI) AS KODE'); $this->db->from('akuntansi'); if ($id_perkiraan==1 AND $jenis_akuntansi==0) { $this->db->like('KODE_AKUNTANSI','KK','after'); } else if ($id_perkiraan==1 AND $jenis_akuntansi==1) { $this->db->like('KODE_AKUNTANSI','KM','after'); } else if ($id_perkiraan==2 AND $jenis_akuntansi==0) { $this->db->like('KODE_AKUNTANSI','BK','after'); } else if ($id_perkiraan==2 AND $jenis_akuntansi==1) { $this->db->like('KODE_AKUNTANSI','BM','after'); } $max = $this->db->get()->result_array(); $datPak = $this->Amod->getData_PeriodeAkuntansi_bySTATUS(0); $tgl = date_format(date_create($datPak[0]['AKHIR_PAK']), "y/m"); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { if ($id_perkiraan==1 AND $jenis_akuntansi==0) { return "KK/$tgl/00001"; } else if ($id_perkiraan==1 AND $jenis_akuntansi==1) { return "KM/$tgl/00001"; } else if ($id_perkiraan==2 AND $jenis_akuntansi==0) { return "BK/$tgl/00001"; } else if ($id_perkiraan==2 AND $jenis_akuntansi==1) { return "BM/$tgl/00001"; } } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -6); if ($tgl_lama!=$tgl) { if ($id_perkiraan==1 AND $jenis_akuntansi==0) { return "KK/$tgl/00001"; } else if ($id_perkiraan==1 AND $jenis_akuntansi==1) { return "KM/$tgl/00001"; } else if ($id_perkiraan==2 AND $jenis_akuntansi==0) { return "BK/$tgl/00001"; } else if ($id_perkiraan==2 AND $jenis_akuntansi==1) { return "BM/$tgl/00001"; } } else { $panjang = 5; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 14 - strlen($str); if ($id_perkiraan==1 AND $jenis_akuntansi==0) { $data = "KK/$tgl/00000"; } else if ($id_perkiraan==1 AND $jenis_akuntansi==1) { $data = "KM/$tgl/00000"; } else if ($id_perkiraan==2 AND $jenis_akuntansi==0) { $data = "BK/$tgl/00000"; } else if ($id_perkiraan==2 AND $jenis_akuntansi==1) { $data = "BM/$tgl/00000"; } $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeKonsinyasi() { // Used $this->db->select('MAX(KODE_KONSINYASI) AS KODE'); $this->db->from('konsinyasi'); $this->db->like('KODE_KONSINYASI','KS', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "KS".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -5); if ($tgl_lama!=$tgl) { return "KS".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 5, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 9 - strlen($str); $data = "KS".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeKwitansi($id) { // Used $this->db->select('MAX(KODE_KWITANSI) AS KODE'); $this->db->from('kwitansi'); if ($id==1) { $this->db->like('KODE_KWITANSI','KW/TMP', 'after'); $corp = "TMP"; } else if ($id==2) { $this->db->like('KODE_KWITANSI','KW/DMT', 'after'); $corp = "DMT"; } else if ($id==3) { $this->db->like('KODE_KWITANSI','KW/PCM', 'after'); $corp = "PCM"; } else if ($id==4) { $this->db->like('KODE_KWITANSI','KW/SFT', 'after'); $corp = "SFT"; } else if ($id==5) { $this->db->like('KODE_KWITANSI','KW/ITP', 'after'); $corp = "ITP"; } $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "KW/$corp/".$tgl."000001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 7, -6); if ($tgl_lama!=$tgl) { return "KW/$corp/".$tgl."000001"; } else { $panjang = 6; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 15 - strlen($str); $data = "KW/$corp/".$tgl."000000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeModifikasi() { // Used $this->db->select('MAX(KODE_MODIFIKASI) AS KODE'); $this->db->from('modifikasi'); $this->db->like('KODE_MODIFIKASI','MOD', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "MOD".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -5); if ($tgl_lama!=$tgl) { return "MOD".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 6, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "MOD".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeMutasiBarang($jenis) { // Used $this->db->select('MAX(KODE_MB) AS KODE'); $this->db->from('mutasi_barang'); if ($jenis==0 OR $jenis==2) { $this->db->like('KODE_MB','MB/PCM', 'after'); } else if ($jenis==1) { $this->db->like('KODE_MB','MB/ITP', 'after'); } else if ($jenis==3) { $this->db->like('KODE_MB','MB/SRV', 'after'); } $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { if ($jenis==0 OR $jenis==2) { return "MB/PCM/".$tgl."0001"; } else if ($jenis == 1) { return "MB/ITP/".$tgl."0001"; } else if ($jenis == 3) { return "MB/SRV/".$tgl."0001"; } } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 7, -4); if ($tgl_lama!=$tgl) { if ($jenis==0 OR $jenis==2) { return "MB/PCM/".$tgl."0001"; } else if ($jenis == 1) { return "MB/ITP/".$tgl."0001"; } else if ($jenis == 3) { return "MB/SRV/".$tgl."0001"; } } else { $panjang = 6; $data = substr($str, 7, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 13 - strlen($str); if ($jenis==0 OR $jenis==2) { $data = "MB/PCM/".$tgl."0001"; } else if ($jenis == 1) { $data = "MB/ITP/".$tgl."0001"; } else if ($jenis == 3) { $data = "MB/SRV/".$tgl."0001"; } $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeNotaBebas($jenis, $id) { // Used $this->db->select('MAX(KODE_NB) AS KODE'); $this->db->from('nota_bebas'); if ($id==1) { if ($jenis==1) { $this->db->like('KODE_NB','DP/TMP', 'after'); } else if ($jenis==2) { $this->db->like('KODE_NB','OK/TMP', 'after'); } $corp = "TMP"; } else if ($id==2) { if ($jenis==1) { $this->db->like('KODE_NB','DP/DMT', 'after'); } else if ($jenis==2) { $this->db->like('KODE_NB','OK/DMT', 'after'); } $corp = "DMT"; } else if ($id==3) { if ($jenis==1) { $this->db->like('KODE_NB','DP/PCM', 'after'); } else if ($jenis==2) { $this->db->like('KODE_NB','OK/PCM', 'after'); } $corp = "PCM"; } else if ($id==4) { if ($jenis==1) { $this->db->like('KODE_NB','DP/SFT', 'after'); } else if ($jenis==2) { $this->db->like('KODE_NB','OK/SFT', 'after'); } $corp = "SFT"; } else if ($id==5) { if ($jenis==1) { $this->db->like('KODE_NB','DP/ITP', 'after'); } else if ($jenis==2) { $this->db->like('KODE_NB','OK/ITP', 'after'); } $corp = "ITP"; } $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { if ($jenis==1) { return "DP/$corp/".$tgl."000001"; } else if ($jenis==2) { return "OK/$corp/".$tgl."000001"; } } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 7, -6); if ($tgl_lama!=$tgl) { if ($jenis==1) { return "DP/$corp/".$tgl."000001"; } else if ($jenis==2) { return "OK/$corp/".$tgl."000001"; } } else { $panjang = 6; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 15 - strlen($str); if ($jenis==1) { $data = "DP/$corp/".$tgl."000000"; } else if ($jenis==2) { $data = "OK/$corp/".$tgl."000000"; } $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeOpname() { // Used $this->db->select('MAX(KODE_OPNAME) AS KODE'); $this->db->from('opname'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "OP".$tgl."001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -3); if ($tgl_lama!=$tgl) { return "OP".$tgl."001"; } else { $panjang = 3; $data = substr($str, 4, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 7 - strlen($str); $data = "OP".$tgl."000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodePembelian($verse, $month=null) { // Used $this->db->select('MAX(KODE_PEMBELIAN) AS KODE'); $this->db->from('pembelian'); $max = $this->db->get()->result_array(); if ($verse==1) { $tgl = date('y/m'); } else if ($verse==2) { $tgl = date("y/$month"); } if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PB/$tgl/00001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -6); if ($tgl_lama!=$tgl) { return "PB/$tgl/00001"; } else { $panjang = 5; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 14 - strlen($str); $data = "PB/$tgl/00000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodePeminjaman($id) { // Used $this->db->select('MAX(KODE_PEMINJAMAN) AS KODE'); $this->db->from('peminjaman'); if ($id==1) { $this->db->like('KODE_PEMINJAMAN','PIN/PCM', 'after'); $jenis = "PCM"; } else if ($id==2) { $this->db->like('KODE_PEMINJAMAN','PIN/ITP', 'after'); $jenis = "ITP"; } $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PIN/$jenis/".$tgl."0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 8, -4); if ($tgl_lama!=$tgl) { return "PIN/$jenis/".$tgl."0001"; } else { $panjang = 4; $data = substr($str, 10, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 14 - strlen($str); $data = "PIN/$jenis/".$tgl."0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodePenarikanKonsi() { // Used $this->db->select('MAX(KODE_PK) AS KODE'); $this->db->from('penarikan_konsi'); $this->db->like('KODE_PK','PK', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PK".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -5); if ($tgl_lama!=$tgl) { return "PK".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 5, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 9 - strlen($str); $data = "PK".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodePenarikanService() { // Used $this->db->select('MAX(KODE_PSV) AS KODE'); $this->db->from('penarikan_service'); $this->db->like('KODE_PSV','PSV', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PSV".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -5); if ($tgl_lama!=$tgl) { return "PSV".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 6, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "PSV".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodePenarikanSewa() { // Used $this->db->select('MAX(KODE_PS) AS KODE'); $this->db->from('penarikan_sewa'); $this->db->like('KODE_PS','PS', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PS".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -5); if ($tgl_lama!=$tgl) { return "PS".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 5, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 9 - strlen($str); $data = "PS".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodePenawaran() { // Used $this->db->select('MAX(KODE_PENAWARAN) AS KODE'); $this->db->from('penawaran'); $max = $this->db->get()->result_array(); $tgl = date('y/m'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "QL/$tgl/0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -5); if ($tgl_lama!=$tgl) { return "QL/$tgl/0001"; } else { $panjang = 4; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 13 - strlen($str); $data = "QL/$tgl/0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodePending() { // Used $this->db->select('MAX(KODE_PENDING) AS KODE'); $this->db->from('pending'); $this->db->like('KODE_PENDING','PEN', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PEN".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -5); if ($tgl_lama!=$tgl) { return "PEN".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 6, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "PEN".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodePengadaan() { // Used $this->db->select('MAX(KODE_PENGADAAN) AS KODE'); $this->db->from('pengadaan'); $max = $this->db->get()->result_array(); $tgl = date('y/m'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PG/$tgl/0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -5); if ($tgl_lama!=$tgl) { return "PG/$tgl/0001"; } else { $panjang = 4; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 13 - strlen($str); $data = "PG/$tgl/0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodePenjualan() { // Used $this->db->select('MAX(KODE_PENJUALAN) AS KODE'); $this->db->from('penjualan'); $max = $this->db->get()->result_array(); $tgl = date('y/m'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PJ/$tgl/00001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -6); if ($tgl_lama!=$tgl) { return "PJ/$tgl/00001"; } else { $panjang = 5; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 14 - strlen($str); $data = "PJ/$tgl/00000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeProforma($id) { // Used $this->db->select('MAX(KODE_PF) AS KODE'); $this->db->from('proforma'); if ($id==1) { $this->db->like('KODE_PF','PF/TMP', 'after'); $corp = "TMP"; } else if ($id==2) { $this->db->like('KODE_PF','PF/DMT', 'after'); $corp = "DMT"; } else if ($id==3) { $this->db->like('KODE_PF','PF/PCM', 'after'); $corp = "PCM"; } else if ($id==4) { $this->db->like('KODE_PF','PF/SFT', 'after'); $corp = "SFT"; } else if ($id==5) { $this->db->like('KODE_PF','PF/ITP', 'after'); $corp = "ITP"; } $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PF/$corp/".$tgl."000001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 7, -6); if ($tgl_lama!=$tgl) { return "PF/$corp/".$tgl."000001"; } else { $panjang = 6; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 15 - strlen($str); $data = "PF/$corp/".$tgl."000000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeProyek() { // Used $this->db->select('MAX(KODE_PROYEK) AS KODE'); $this->db->from('proyek'); $this->db->like('KODE_PROYEK','PRO', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "PRO".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -5); if ($tgl_lama!=$tgl) { return "PRO".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 6, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "PRO".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeReturPembelian() { // Used $this->db->select('MAX(KODE_RB) AS KODE'); $this->db->from('retur_pembelian'); $max = $this->db->get()->result_array(); $tgl = date('y/m'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "RB/$tgl/00001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -6); if ($tgl_lama!=$tgl) { return "RB/$tgl/00001"; } else { $panjang = 5; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 14 - strlen($str); $data = "RB/$tgl/00000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeReturPenjualan() { // Used $this->db->select('MAX(KODE_RJ) AS KODE'); $this->db->from('retur_penjualan'); $max = $this->db->get()->result_array(); $tgl = date('y/m'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "RJ/$tgl/00001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -6); if ($tgl_lama!=$tgl) { return "RJ/$tgl/00001"; } else { $panjang = 5; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 14 - strlen($str); $data = "RJ/$tgl/00000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeSalesOrder() { // Used $this->db->select('MAX(KODE_SO) AS KODE'); $this->db->from('sales_order'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "SO".$tgl."000001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -6); if ($tgl_lama!=$tgl) { return "SO".$tgl."000001"; } else { $panjang = 6; $data = substr($str, 4, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "SO".$tgl."000000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeService() { // Used $this->db->select('MAX(KODE_SERVICE) AS KODE'); $this->db->from('service'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "SRV".$tgl."00001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -5); if ($tgl_lama!=$tgl) { return "SRV".$tgl."00001"; } else { $panjang = 5; $data = substr($str, 5, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 10 - strlen($str); $data = "SRV".$tgl."00000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeSewa() { // Used $this->db->select('MAX(KODE_SEWA) AS KODE'); $this->db->from('sewa'); $this->db->like('KODE_SEWA','SW', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "SW".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -5); if ($tgl_lama!=$tgl) { return "SW".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 5, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 9 - strlen($str); $data = "SW".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeSjService() { // Used $this->db->select('MAX(KODE_SJS) AS KODE'); $this->db->from('sj_service'); $this->db->like('KODE_SJS','SJS', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "SJS".$tgl."-001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 3, -4); if ($tgl_lama!=$tgl) { return "SJS".$tgl."-001"; } else { $panjang = 4; $data = substr($str, 6, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 9 - strlen($str); $data = "SJS".$tgl."-000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeStokAntik() { // Used $this->db->select('MAX(KODE_SA) AS KODE'); $this->db->from('stok_antik'); $this->db->like('KODE_SA','SA', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "SA".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -5); if ($tgl_lama!=$tgl) { return "SA".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 5, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 9 - strlen($str); $data = "SA".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeTransaksiStock() { // Used $this->db->select('MAX(KODE_BUKTI) AS KODE'); $this->db->from('transaksi_stock'); $this->db->like('KODE_BUKTI','KM', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "KM".$tgl."-0001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 2, -5); if ($tgl_lama!=$tgl) { return "KM".$tgl."-0001"; } else { $panjang = 4; $data = substr($str, 5, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 9 - strlen($str); $data = "KM".$tgl."-0000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_kodeUangMuka() { // Used $this->db->select('MAX(KODE_UM) AS KODE'); $this->db->from('uang_muka'); $this->db->like('KODE_UM','DP/OPM', 'after'); $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "DP/OPM/".$tgl."000001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 7, -6); if ($tgl_lama!=$tgl) { return "DP/OPM/".$tgl."000001"; } else { $panjang = 6; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 15 - strlen($str); $data = "DP/OPM/".$tgl."000000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_loginData($username, $password) { // Used return $this->db->query("SELECT * FROM karyawan WHERE username='$username' AND password='$password'"); } public function generate_nilaiInsentifPromoClearance($id) { // Used $datDpc = $this->Amod->getData_DaftarPromoClearance_byID($id); if ($datDpc==FALSE) { $nilai_fk = 0; } else { $datDo = $this->Amod->getData_DaftarOrder_byPENJUALAN_byBARANG($datDpc[0]['PENJUALAN_ID'], $datDpc[0]['BARANG_ID']); $nilai_fk = $datDpc[0]['NILAI_PC']*$datDo[0]['QTY_DO']; } return $nilai_fk; } public function generate_SJPenjualan($id) { // Used $this->db->select('MAX(SJ_PENJUALAN) AS KODE'); $this->db->from('penjualan'); if ($id==1) { $this->db->like('SJ_PENJUALAN','SJ/TMP', 'after'); $corp = "TMP"; } else if ($id==2) { $this->db->like('SJ_PENJUALAN','SJ/DMT', 'after'); $corp = "DMT"; } else if ($id==3) { $this->db->like('SJ_PENJUALAN','SJ/PCM', 'after'); $corp = "PCM"; } else if ($id==4) { $this->db->like('SJ_PENJUALAN','SJ/SFT', 'after'); $corp = "SFT"; } else if ($id==5) { $this->db->like('SJ_PENJUALAN','SJ/ITP', 'after'); $corp = "ITP"; } $max = $this->db->get()->result_array(); $tgl = date('y'); if (is_array($max) || is_object($max)) { foreach ($max as $row) { if ($row['KODE'] == null) { return "SJ/$corp/".$tgl."000001"; } else { $str = (string) $row['KODE']; $tgl_lama = substr($str, 7, -6); if ($tgl_lama!=$tgl) { return "SJ/$corp/".$tgl."000001"; } else { $panjang = 6; $data = substr($str, 9, $panjang); $ko = (int) $data + 1; $str = (string) $ko; $panjang = 15 - strlen($str); $data = "SJ/$corp/".$tgl."000000"; $data = substr($data, 0, $panjang) . $str; return $data; } } } } } public function generate_statusTELAT($id, $sel) { // Used if ($id==1) { $stat = "ONTIME"; $fill = "93C47D"; } else if ($id==2) { $stat = "TERLAMBAT"; $fill = "F57C7C"; } else if ($id==3) { $stat = "CUTI"; $fill = "6FA8DC"; } else if ($id==4) { $stat = "SAKIT"; $fill = "F6B26B"; } else if ($id==5) { $stat = "WFH"; $fill = "CFE2F3"; } else if ($id==8) { $stat = "TIDAK MASUK"; $fill = "F3CFEF"; } else if ($id==9) { $stat = "LIBUR"; $fill = "BE87EC"; } $result = [ 'STAT' => $stat, 'FILL' => $fill, ]; return $result; } public function generate_subDay($date, $day) { // Used $sum = strtotime(date("Y-m-d", strtotime("$date")) . " -$day days"); $dateTo=date('Y-m-d',$sum); return $dateTo; } public function generate_subMinute($date, $minute) { // Used $sum = strtotime(date("Y-m-d H:i:s", strtotime("$date")) . " -$minute minute"); $dateTo=date('Y-m-d H:i:s',$sum); return $dateTo; } public function generate_subMonth($date, $month) { // Used $sum = strtotime(date("Y-m-d", strtotime("$date")) . " -$month months"); $dateTo=date('Y-m-d',$sum); return $dateTo; } public function generate_subYear($date, $year) { // Used $sum = strtotime(date("Y-m-d", strtotime("$date")) . " -$year years"); $dateTo=date('Y-m-d',$sum); return $dateTo; } public function generate_textAngka($angka) { // Used if ($angka==0) { $text = "Nol"; } else if ($angka==1) { $text = "Satu"; } else if ($angka==2) { $text = "Dua"; } else if ($angka==3) { $text = "Tiga"; } else if ($angka==4) { $text = "Empat"; } else if ($angka==5) { $text = "Lima"; } else if ($angka==6) { $text = "Enam"; } else if ($angka==7) { $text = "Tujuh"; } else if ($angka==8) { $text = "Delapan"; } else if ($angka==9) { $text = "Sembilan"; } else if ($angka==10) { $text = "Sepuluh"; } else if ($angka==11) { $text = "Sebelas"; } else if ($angka==12) { $text = "Dua Belas"; } else if ($angka==13) { $text = "Tiga Belas"; } else if ($angka==14) { $text = "Empat Belas"; } else if ($angka==15) { $text = "Lima Belas"; } return $text; } public function generate_textUrutan($angka) { // Used if ($angka==1) { $text = "Pertama"; } else if ($angka==2) { $text = "Kedua"; } else if ($angka==3) { $text = "Ketiga"; } else if ($angka==4) { $text = "Keempat"; } else if ($angka==5) { $text = "Kelima"; } else if ($angka==6) { $text = "Keenam"; } else if ($angka==7) { $text = "Ketujuh"; } else if ($angka==8) { $text = "Kedelapan"; } else if ($angka==9) { $text = "Kesembilan"; } else if ($angka==10) { $text = "Kesepuluh"; } else if ($angka==11) { $text = "Kesebelas"; } else if ($angka==12) { $text = "Kedua Belas"; } else if ($angka==13) { $text = "Ketiga Belas"; } else if ($angka==14) { $text = "Keempat Belas"; } else if ($angka==15) { $text = "Kelima Belas"; } return $text; } // Daftar Fungsi getCount public function getCount_Absensi_byKARYAWAN($id) { // Used $this->db->select('ID_ABSENSI'); $this->db->from('absensi'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_Absensi_byKARYAWAN_bySTATUS($id, $awal, $akhir, $status) { // Used $this->db->select('ID_ABSENSI'); $this->db->from('absensi'); $this->db->where('KARYAWAN_ID=', $id); $this->db->where('TGL_ABSENSI>=', $awal); $this->db->where('TGL_ABSENSI<=', $akhir); $this->db->where('STATUS_ABSENSI=', $status); return $this->db->count_all_results(); } public function getCount_Akuntansi_byBANK_bySTATUS_byPERIODE($id, $status, $awal, $akhir){ // Used $this->db->select('ID_AKUNTANSI'); $this->db->from('akuntansi'); $this->db->where('BANK_AKUNTANSI=', $id); $this->db->where('STATUS_AKUNTANSI=', $status); $this->db->where('TGL_AKUNTANSI>=', $awal); $this->db->where('TGL_AKUNTANSI<=', $akhir); return $this->db->count_all_results(); } public function getCount_Akuntansi_byKAS_bySTATUS_byPERIODE($id, $status, $awal, $akhir){ // Used $this->db->select('ID_AKUNTANSI'); $this->db->from('akuntansi'); $this->db->where('KAS_AKUNTANSI=', $id); $this->db->where('STATUS_AKUNTANSI=', $status); $this->db->where('TGL_AKUNTANSI>=', $awal); $this->db->where('TGL_AKUNTANSI<=', $akhir); return $this->db->count_all_results(); } public function getCount_Akuntansi_bySTATUS_byPERIODE_forJM($status, $awal, $akhir){ // Used $this->db->select('ID_AKUNTANSI'); $this->db->from('akuntansi'); $this->db->where('STATUS_AKUNTANSI=', $status); $this->db->where('TGL_AKUNTANSI>=', $awal); $this->db->where('TGL_AKUNTANSI<=', $akhir); $this->db->like('KODE_AKUNTANSI','JM','after'); return $this->db->count_all_results(); } public function getCount_Barang_byJENIS($id) { // Used $this->db->select('ID_BARANG'); $this->db->from('barang'); $this->db->where('JENIS_ID=', $id); return $this->db->count_all_results(); } public function getCount_Barang_byMERK($id) { // Used $this->db->select('ID_BARANG'); $this->db->from('barang'); $this->db->where('MERK_ID=', $id); return $this->db->count_all_results(); } public function getCount_Barang_byMODEL($id) { // Used $this->db->select('ID_BARANG'); $this->db->from('barang'); $this->db->where('MODEL_ID=', $id); return $this->db->count_all_results(); } public function getCount_Barang_byPRODUK($id) { // Used $this->db->select('ID_BARANG'); $this->db->from('barang'); $this->db->where('PRODUK_ID=', $id); return $this->db->count_all_results(); } public function getCount_BiayaProyek_byPROYEK($id) { // Used $this->db->select('ID_BPRY'); $this->db->from('biaya_proyek'); $this->db->where('PROYEK_ID=', $id); return $this->db->count_all_results(); } public function getCount_Cabutan_bySTATUS($status) { // Used $this->db->select('ID_CABUTAN'); $this->db->from('cabutan'); $this->db->where('STATUS_CABUTAN=', $status); return $this->db->count_all_results(); } public function getCount_CetakDokumen_byVERSE_byPERIODE($verse, $awal, $akhir) { // Used if ($verse==1) { $this->db->select('a.ID_CD'); $this->db->from('cetak_dokumen a'); $this->db->join('retur_pembelian b','b.ID_RB=a.RB_ID'); $this->db->join('histori_cetakdokumen c','c.CD_ID=a.ID_CD','left'); $this->db->where('b.TGL_RB>=', $awal); $this->db->where('b.TGL_RB<=', $akhir); $this->db->where('c.ID_HCD is NULL'); } return $this->db->count_all_results(); } public function getCount_CreditNote_bySTATUS($status) { // Used $this->db->select('ID_CN'); $this->db->from('creditnote'); $this->db->where('STATUS_CN=', $status); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byAKUNTANSI($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('AKUNTANSI_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byBANK($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('BANK_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byKARYAWAN($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byKAS($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('KAS_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byKENDARAAN($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('KENDARAAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byPELANGGAN($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('PELANGGAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byPEMBELIAN($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('PEMBELIAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byPERKIRAAN($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('PERKIRAAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byPERKIRAAN_byUM($id1, $id2) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('PERKIRAAN_ID=', $id1); $this->db->where('UM_ID=', $id2); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byPIHAKKE3($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('PIHAKKE3_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byPROYEK($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('PROYEK_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_bySUPPLIER($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('SUPPLIER_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarAkuntansi_byUNITPROYEK($id) { // Used $this->db->select('ID_DAK'); $this->db->from('daftar_akuntansi'); $this->db->where('UNITPROYEK_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarBeli_byBARANG($id) { // Used $this->db->select('ID_DB'); $this->db->from('daftar_beli'); $this->db->where('BARANG_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarBeli_byPEMBELIAN($id){ // Used $this->db->select('ID_DB'); $this->db->from('daftar_beli'); $this->db->where('PEMBELIAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarFormKaryawan_byKARYAWAN_byJFK_byPERIODE($id_karyawan, $id_jfk, $awal, $akhir) { // Used $this->db->select('b.ID_FK'); $this->db->from('daftar_formkaryawan a'); $this->db->join('form_karyawan b','b.ID_FK=a.FK_ID'); $this->db->where('b.KARYAWAN_ID=', $id_karyawan); $this->db->where('b.JENIS_FK=', $id_jfk); $this->db->where('a.TGL_DFFK>=', $awal); $this->db->where('a.TGL_DFFK<=', $akhir); $this->db->where('b.STATUS_FK=1'); return $this->db->count_all_results(); } public function getCount_DaftarKonsi_byKONSINYASI($id) { // Used $this->db->select('ID_DFK'); $this->db->from('daftar_konsi'); $this->db->where('KONSINYASI_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarMutasiBarang_byMB($id) { // Used $this->db->select('ID_DMB'); $this->db->from('daftar_mutasibarang'); $this->db->where('MB_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarOpname_byOPNAME($id) { // Used $this->db->select('ID_DOP'); $this->db->from('daftar_opname'); $this->db->where('OPNAME_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarOrder_byBARANG($id) { // Used $this->db->select('ID_DO'); $this->db->from('daftar_order'); $this->db->where('BARANG_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarOrder_bySO($id){ // Used $this->db->select('ID_DO'); $this->db->from('daftar_order'); $this->db->where('SO_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarPenarikanKonsi_byPK($id) { // Used $this->db->select('ID_DPK'); $this->db->from('daftar_penarikankonsi'); $this->db->where('PK_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarPenarikanService_byPSV($id) { // Used $this->db->select('ID_DPSV'); $this->db->from('daftar_penarikanservice'); $this->db->where('PSV_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarPenarikanSewa_byPS($id) { // Used $this->db->select('ID_DPS'); $this->db->from('daftar_penarikansewa'); $this->db->where('PS_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarPenawaran_bySATUAN($id) { // Used $this->db->select('ID_DPNE'); $this->db->from('daftar_penawaran'); $this->db->where('SATUAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarPengadaan_byBARANG($id) { // Used $this->db->select('ID_DPG'); $this->db->from('daftar_pengadaan'); $this->db->where('BARANG_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarPinjam_byPEMINJAMAN($id) { // Used $this->db->select('ID_DFP'); $this->db->from('daftar_pinjam'); $this->db->where('PEMINJAMAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarProforma_byPF($id) { // Used $this->db->select('ID_DPF'); $this->db->from('daftar_proforma'); $this->db->where('PF_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarPromoClearance_byKARYAWAN_bySTATUS_NotStpc($id=null, $status=null) { // Used $stpc = $this->getData_SetPelangganClearance(); $this->db->select('*'); $this->db->from('daftar_promoclearance a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=c.SALES_ID'); if ($id!=null) { $this->db->where('c.SALES_ID=', $id); } $this->db->where('a.STATUS_DPC=', $status); if ($stpc!=null) { foreach ($stpc as $key) { if ($key['PELANGGAN_ID']!=NULL) { $pel = $key['PELANGGAN_ID']; $this->db->where("c.PELANGGAN_ID NOT LIKE '$pel'"); } else if ($key['SALES_ID']!=NULL) { $sal = $key['SALES_ID']; $this->db->where("c.SALES_ID NOT LIKE '$sal'"); } } } return $this->db->count_all_results(); } public function getCount_DaftarProyek_byPROYEK($id) { // Used $this->db->select('ID_DPR'); $this->db->from('daftar_proyek'); $this->db->where('PROYEK_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarRekapPajak_PPH22Selected() { // Used $this->db->select('a.ID_DRPJ'); $this->db->from('daftar_rekappajak a'); $this->db->join('pajak_dibayardimuka b','b.ID_PDD=a.PDD_ID'); $this->db->join('pajak_penghasilan c','c.ID_PPH=b.PPH_ID'); $this->db->where('a.RPJ_ID is NULL'); $this->db->where('c.KODE_PPH=22'); return $this->db->count_all_results(); } public function getCount_DaftarRekapPajak_PPH23Selected() { // Used $this->db->select('a.ID_DRPJ'); $this->db->from('daftar_rekappajak a'); $this->db->join('pajak_dibayardimuka b','b.ID_PDD=a.PDD_ID'); $this->db->join('pajak_penghasilan c','c.ID_PPH=b.PPH_ID'); $this->db->where('a.RPJ_ID is NULL'); $this->db->where('c.KODE_PPH=23'); return $this->db->count_all_results(); } public function getCount_DaftarReturBeli_byRB($id) { // Used $this->db->select('ID_DRB'); $this->db->from('daftar_returbeli'); $this->db->where('RB_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarReturJual_byRJ($id) { // Used $this->db->select('ID_DRJ'); $this->db->from('daftar_returjual'); $this->db->where('RJ_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarRumusGp_byRGP($id) { // Used $this->db->select('ID_DRGP'); $this->db->from('daftar_rumusgp'); $this->db->where('RGP_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarService_bySERVICE($id) { // Used $this->db->select('ID_DFS'); $this->db->from('daftar_service'); $this->db->where('SERVICE_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarSewa_bySEWA($id) { // Used $this->db->select('ID_DFSW'); $this->db->from('daftar_sewa'); $this->db->where('SEWA_ID=', $id); return $this->db->count_all_results(); } public function getCount_DaftarSjParsial_byPERIODE_notCetak_groupCD($awal, $akhir) { // Used $this->db->select('a.ID_SJP'); $this->db->from('daftar_sjparsial a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('cetak_dokumen c','c.ID_CD=a.CD_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=d.SALES_ID'); $this->db->join('histori_cetakdokumen h','h.CD_ID=c.ID_CD','left'); $this->db->where('h.ID_HCD is NULL'); $this->db->where('c.TGL_CD>=', $awal); $this->db->where('c.TGL_CD<=', $akhir); $this->db->group_by('a.CD_ID'); return $this->db->count_all_results(); } public function getCount_DaftarSjParsial_bySO_CDNull($id) { // Used $this->db->select('ID_SJP'); $this->db->from('daftar_sjparsial'); $this->db->where('SO_ID=', $id); $this->db->where('CD_ID is NULL'); return $this->db->count_all_results(); } public function getCount_DaftarSjParsial_bySO_groupCD($id) { // Used $this->db->select('CD_ID'); $this->db->from('daftar_sjparsial'); $this->db->where('SO_ID=', $id); $this->db->where('CD_ID is NOT NULL'); $this->db->group_by('CD_ID'); return $this->db->count_all_results(); } public function getCount_DaftarSjService_bySJS($id) { // Used $this->db->select('ID_DFSJS'); $this->db->from('daftar_sjservice'); $this->db->where('SJS_ID=', $id); return $this->db->count_all_results(); } public function getCount_FormKaryawan_byACC_byKARYAWAN($acc, $karyawan=null, $jabatan=null) { // Used $this->db->select('a.ID_FK'); $this->db->from('form_karyawan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID','left'); $this->db->join('jabatan c','c.ID_JABATAN=b.JABATAN_ID','left'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID','left'); $this->db->join('daftar_promoclearance e','e.FK_ID=a.ID_FK','left'); $this->db->join('hasil_hitungpda f','f.PENJUALAN_ID=e.PENJUALAN_ID','left'); if ($acc==1) { $this->db->where('a.SALES_ID=', $karyawan); $this->db->where('a.STATUS_FK=0'); $this->db->where('a.CONFIRM_FK_S is NULL'); } else if ($acc==2) { if ($jabatan=="KADIV SALES") { $this->db->where('a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.JENIS_FK<=2 AND a.SALES_ID=KARYAWAN_ID'); $this->db->or_where('a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.JENIS_FK=4 AND a.SALES_ID!=KARYAWAN_ID'); } else if ($jabatan=="KADIV ICT") { $this->db->where("a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND d.NAMA_PANGGILAN_KARYAWAN LIKE '%Ricky%'"); $this->db->or_where("a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND d.NAMA_PANGGILAN_KARYAWAN LIKE '%Rachman%'"); $this->db->or_where("a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND d.NAMA_PANGGILAN_KARYAWAN LIKE '%Fajrun%'"); $this->db->or_where("a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND d.NAMA_PANGGILAN_KARYAWAN LIKE '%Fahmi%'"); } else if ($jabatan=="KADIV GUDANG") { $this->db->where("a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.JENIS_FK<=2 AND a.SALES_ID!=a.KARYAWAN_ID AND c.NAMA_JABATAN LIKE '%UMUM%'"); $this->db->or_where("a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.JENIS_FK<=2 AND a.SALES_ID!=a.KARYAWAN_ID AND c.NAMA_JABATAN LIKE '%ICT%'"); $this->db->or_where("a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.JENIS_FK<=2 AND a.SALES_ID!=a.KARYAWAN_ID AND c.NAMA_JABATAN LIKE '%TEKNISI%'"); $this->db->or_where("a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.JENIS_FK<=2 AND a.SALES_ID!=a.KARYAWAN_ID AND c.NAMA_JABATAN LIKE '%SERVICE%'"); $this->db->not_like('d.NAMA_PANGGILAN_KARYAWAN','Fajrun'); $this->db->not_like('d.NAMA_PANGGILAN_KARYAWAN','Ricky'); $this->db->not_like('d.NAMA_PANGGILAN_KARYAWAN','Rachman'); $this->db->not_like('d.NAMA_PANGGILAN_KARYAWAN','Fahmi'); } else if ($jabatan=="KADIV SERVICE") { $this->db->where('a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.JENIS_FK<=2 AND d.NAMA_PANGGILAN_KARYAWAN="Service"'); } else if ($jabatan=="KADIV KEUANGAN") { $this->db->where('a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.JENIS_FK=4 AND a.SALES_ID=a.KARYAWAN_ID AND f.STATUS_HHPDA=1'); $this->db->or_where('a.CONFIRM_FK_O is NULL AND a.STATUS_FK=0 AND a.JENIS_FK=4 AND a.SALES_ID=a.KARYAWAN_ID AND f.STATUS_HHPDA is NULL'); } } else if ($acc==3) { $this->db->where('a.STATUS_FK=0'); $this->db->where('a.CONFIRM_FK_S is NOT NULL'); $this->db->where('a.CONFIRM_FK_O is NOT NULL'); $this->db->where('a.CONFIRM_FK_P is NULL'); } else if ($acc==4) { $this->db->where('a.STATUS_FK=0'); $this->db->where('a.CONFIRM_FK_S is NOT NULL'); $this->db->where('a.CONFIRM_FK_O is NOT NULL'); $this->db->where('a.CONFIRM_FK_P is NOT NULL'); } return $this->db->count_all_results(); } public function getCount_FormKaryawan_byKARYAWAN_cariStatus($id, $verse, $jabatan=null) { // Used $this->db->select('a.ID_FK'); $this->db->from('form_karyawan a'); $this->db->join('jenis_fk b','b.ID_JFK=a.JENIS_FK'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('daftar_formkaryawan e','e.FK_ID=a.ID_FK'); $this->db->join('proyek f','f.ID_PROYEK=a.PROYEK_ID','left'); $this->db->join('pelanggan g','g.ID_PELANGGAN=f.PELANGGAN_ID','left'); $this->db->join('daftar_promoclearance h','h.FK_ID=a.ID_FK','left'); $this->db->join('hasil_hitungpda i','i.PENJUALAN_ID=h.PENJUALAN_ID','left'); $this->db->join('jabatan j','j.ID_JABATAN=c.JABATAN_ID','left'); if ($verse==0) { $this->db->where('a.STATUS_FK=0 AND a.CONFIRM_FK_O is NULL AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.CONFIRM_FK_S is NULL AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.CONFIRM_FK_P is NULL AND a.KARYAWAN_ID=', $id); } else if ($verse==1) { $this->db->where('a.STATUS_FK=0 AND a.CONFIRM_FK_S is NOT NULL AND a.CONFIRM_FK_O is NOT NULL AND a.CONFIRM_FK_P is NOT NULL AND a.KARYAWAN_ID=', $id); } else if ($verse==2) { $tgl = date('Y-m-d'); $limit = $this->generate_subDay($tgl, 14); $this->db->where("a.STATUS_FK=2 AND a.KET_BATAL is NOT NULL AND a.KARYAWAN_ID=$id AND a.TGL_BATAL>='$limit'"); } else if ($verse==3) { if ($jabatan=="ADMINISTRATOR") { $this->db->where('a.STATUS_FK=0'); } else if ($jabatan=="PIMPINAN") { $this->db->where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.CONFIRM_FK_P is NULL'); } else if ($jabatan=="KADIV GUDANG") { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK=1 AND a.SALES_ID=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%ICT%' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%GUDANG%' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%UMUM%' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%SERVICE%' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.JENIS_FK<=6 AND a.CONFIRM_FK_P is NULL"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK=7 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%GUDANG%'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK=7 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%UMUM%'"); } else if ($jabatan=="KADIV ICT") { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Ricky"'); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Rachman"'); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Fajrun"'); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Fahmi"'); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%ICT%'"); } else if ($jabatan=="KADIV KEUANGAN") { $this->db->where('a.STATUS_FK=0 AND a.JENIS_FK=4 AND a.CONFIRM_FK_O is NULL'); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%KEUANGAN%'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%ADMIN ITP%'"); } else if ($jabatan=="KADIV SALES") { if ($id==54) { $this->db->where('a.STATUS_FK=0 AND a.CONFIRM_FK_S is NULL AND a.SALES_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.KARYAWAN_ID=28 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL'); $this->db->or_where("a.STATUS_FK=0 AND c.ANGGOTA_KARYAWAN=$id AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL"); } else { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=2 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_S is NULL AND a.SALES_ID=', $id); $this->db->or_where("a.STATUS_FK=0 AND d.ANGGOTA_KARYAWAN=$id AND a.JENIS_FK=2 AND a.SALES_ID=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL"); $this->db->or_where("a.STATUS_FK=0 AND d.ANGGOTA_KARYAWAN=$id AND a.JENIS_FK=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND d.ANGGOTA_KARYAWAN=$id AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%SALES%'"); } } else if ($jabatan=="KADIV SERVICE") { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Service"'); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%SERVICE%'"); } else if (strpos($jabatan,"SALES")!==FALSE AND $jabatan!="KADIV SALES") { $this->db->where('a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.CONFIRM_FK_S is NULL AND a.SALES_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK=4 AND a.SALES_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); } else { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); } } $this->db->group_by('a.ID_FK'); return $this->db->count_all_results(); } public function getCount_FormKaryawan_byKARYAWAN_byVERSE($id, $verse) { // Used $this->db->select('ID_FK'); $this->db->from('form_karyawan'); if ($verse==0) { $this->db->where('STATUS_FK=0 AND CONFIRM_FK_S is NULL AND KARYAWAN_ID=', $id); $this->db->or_where('STATUS_FK=0 AND CONFIRM_FK_O is NULL AND KARYAWAN_ID=', $id); $this->db->or_where('STATUS_FK=0 AND CONFIRM_FK_P is NULL AND KARYAWAN_ID=', $id); } else if ($verse==1) { $this->db->where('STATUS_FK=0 AND CONFIRM_FK_S is NOT NULL AND CONFIRM_FK_O is NOT NULL AND CONFIRM_FK_P is NOT NULL AND KARYAWAN_ID=', $id); } else if ($verse==2) { $tgl = date('Y-m-d'); $limit = $this->generate_subDay($tgl, 14); $this->db->where("STATUS_FK=2 AND KARYAWAN_ID=$id AND TGL_BATAL>='$limit'"); } return $this->db->count_all_results(); } public function getCount_FormFeePelanggan_ACC($jabatan) { // Used $this->db->select('ID_FFP'); $this->db->from('form_feepelanggan'); if ($jabatan=="ADMINISTRATOR") { $this->db->where('STATUS_FFP=0 AND CON_FFP_K is NULL'); $this->db->or_where('STATUS_FFP=0 AND CON_FFP_P is NULL'); } else if ($jabatan=="KADIV KEUANGAN") { $this->db->where('STATUS_FFP=0 AND CON_FFP_K is NULL'); } else if ($jabatan=="PIMPINAN") { $this->db->where('STATUS_FFP=0 AND CON_FFP_P is NULL'); } return $this->db->count_all_results(); } public function getCount_FormFeePelanggan_byACC($acc) { // Used $this->db->select('ID_FFP'); $this->db->from('form_feepelanggan'); if ($acc==1) { $this->db->where('STATUS_FFP=0'); $this->db->where('CON_FFP_K is NULL'); } else if ($acc==2) { $this->db->where('STATUS_FFP=0'); $this->db->where('CON_FFP_P is NULL'); $this->db->where('CON_FFP_K is NOT NULL'); } else if ($acc==3) { $this->db->where('STATUS_FFP=0'); $this->db->where('CON_FFP_K is NOT NULL'); $this->db->where('CON_FFP_P is NOT NULL'); } else if ($acc==4) { $this->db->where('STATUS_FFP=0 AND CON_FFP_K is NOT NULL AND CON_FFP_P is NOT NULL AND KARYAWAN_ID=28'); $this->db->or_where('STATUS_FFP=0 AND CON_FFP_K is NOT NULL AND CON_FFP_P is NOT NULL AND KARYAWAN_ID=30'); } else { $this->db->where('STATUS_FFP=0'); $this->db->where('ID_FFP is NULL'); } return $this->db->count_all_results(); } public function getCount_HasilHitungBfe_bySALES_bySTATUS($id, $status) { // Used $this->db->select('a.ID_HHBFE'); $this->db->from('hasil_hitungbfe a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->where('c.SALES_ID=', $id); $this->db->where('a.STATUS_HHBFE=', $status); return $this->db->count_all_results(); } public function getCount_HasilHitungHda_byCORP($id) { // Used $this->db->select('ID_HHHDA'); $this->db->from('hasil_hitunghda'); $this->db->where('CORP_ID=', $id); return $this->db->count_all_results(); } public function getCount_HasilHitungHda_bySTATUS($id) { // Used $this->db->select('ID_HHHDA'); $this->db->from('hasil_hitunghda'); $this->db->where('STATUS_HHHDA=', $id); return $this->db->count_all_results(); } public function getCount_HasilHitungHda_bySUPPLIER($id) { // Used $this->db->select('ID_HHHDA'); $this->db->from('hasil_hitunghda'); $this->db->where('SUPPLIER_ID=', $id); return $this->db->count_all_results(); } public function getCount_HasilHitungPda_byCORP($id) { // Used $this->db->select('ID_HHPDA'); $this->db->from('hasil_hitungpda'); $this->db->where('CORP_ID=', $id); return $this->db->count_all_results(); } public function getCount_HasilHitungPda_byKELOMPOK_belumLunasOnly($id=null, $mode=null) { // Used $now = date('Y-m-d'); $this->db->select('a.ID_HHPDA, SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA) as SISA'); $this->db->from('hasil_hitungpda a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->having('SISA>0'); $this->db->group_by('a.PELANGGAN_ID'); if ($id!=null) { if ($mode==1) { $limit = $this->generate_addDay($now, 3); $this->db->where('b.KELOMPOK_ID=', $id); $this->db->where('c.TEMPO_PENJUALAN>=', $now); $this->db->where('c.TEMPO_PENJUALAN<=', $limit); } else if ($mode==2) { $this->db->where('a.CORP_ID=0 AND b.KELOMPOK_ID=', $id); } else if ($mode==3) { $this->db->where('a.CORP_ID>0'); $this->db->where('b.KELOMPOK_ID=', $id); $this->db->where('c.TEMPO_PENJUALAN<=', $now); } else if ($mode==4) { $this->db->where('a.CORP_ID>0'); $this->db->where('b.KELOMPOK_ID=', $id); $this->db->where('c.TEMPO_PENJUALAN>', $now); } else if ($mode==5) { $this->db->where('b.KELOMPOK_ID=', $id); } } else { if ($mode==1) { $limit = $this->generate_addDay($now, 3); $this->db->where('c.TEMPO_PENJUALAN>=', $now); $this->db->where('c.TEMPO_PENJUALAN<=', $limit); } else if ($mode==2) { $this->db->where('a.CORP_ID=0'); } else if ($mode==3) { $this->db->where('a.CORP_ID>0'); $this->db->where('c.TEMPO_PENJUALAN<=', $now); } else if ($mode==4) { $this->db->where('a.CORP_ID>0'); $this->db->where('c.TEMPO_PENJUALAN>', $now); } } return $this->db->count_all_results(); } public function getCount_HasilHitungPda_byPELANGGAN($id) { // Used $this->db->select('ID_HHPDA'); $this->db->from('hasil_hitungpda'); $this->db->where('PELANGGAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_HasilHitungPda_bySTATUS($id) { // Used $this->db->select('ID_HHPDA'); $this->db->from('hasil_hitungpda'); $this->db->where('STATUS_HHPDA=', $id); return $this->db->count_all_results(); } public function getCount_HistoriCetakDokumen_byCD($id) { // Used $this->db->select('ID_HCD'); $this->db->from('histori_cetakdokumen'); $this->db->where('CD_ID=', $id); return $this->db->count_all_results(); } public function getCount_HistoriKuantiti() { // Used $this->db->select('ID_HQ'); $this->db->from('histori_kuantiti'); return $this->db->count_all_results(); } public function getCount_HistoriKuantiti_byBARANG($id) { // Used $this->db->select('ID_HQ'); $this->db->from('histori_kuantiti'); $this->db->where('BARANG_ID=', $id); return $this->db->count_all_results(); } public function getCount_HistoriKuantiti_lessthan0() { // Used $this->db->select('ID_HQ'); $this->db->from('histori_kuantiti'); $this->db->where('SISA_HQ<0'); return $this->db->count_all_results(); } public function getCount_HistoriOtomasiBooster_byOB($id) { // Used $this->db->select('ID_HOB'); $this->db->from('histori_otomasibooster'); $this->db->where('OB_ID=', $id); return $this->db->count_all_results(); } public function getCount_HistoriOtomasiBooster_byOB_batalNotNull($id) { // Used $this->db->select('ID_HOB'); $this->db->from('histori_otomasibooster'); $this->db->where('OB_ID=', $id); $this->db->where('BATAL_HOB is NOT NULL'); return $this->db->count_all_results(); } public function getCount_HistoriPenawaran_byPENAWARAN($id) { // Used $this->db->select('ID_HPNE'); $this->db->from('histori_penawaran'); $this->db->where('PENAWARAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_Karyawan_byJABATAN($id) { // Used $this->db->select('ID_KARYAWAN'); $this->db->from('karyawan'); $this->db->where('JABATAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_KlaimProgram_bySUPPLIER($id) { // Used $this->db->select('ID_KPR'); $this->db->from('klaim_program'); $this->db->where('SUPPLIER_ID=', $id); return $this->db->count_all_results(); } public function getCount_Konsinyasi_allStatus() { // Used $this->db->select('ID_KONSINYASI'); $this->db->from('konsinyasi'); $this->db->where('STATUS_KONSINYASI>0'); return $this->db->count_all_results(); } public function getCount_Kuantiti_proseslessthan0() { // Used $this->db->select('ID_KUANTITI'); $this->db->from('kuantiti'); $this->db->where('PROSES_KUANTITI<0'); return $this->db->count_all_results(); } public function getCount_Kunjungan_byTGL_statusNot9($tgl) { // Used $this->db->select('ID_KUNJUNGAN'); $this->db->from('kunjungan'); $this->db->where('TGL_KUNJUNGAN=', $tgl); $this->db->where('STATUS_KUNJUNGAN!=9'); return $this->db->count_all_results(); } public function getCount_MutasiBarang_allStatus() { // Used $this->db->select('ID_MB'); $this->db->from('mutasi_barang'); $this->db->where('STATUS_MB>=1'); return $this->db->count_all_results(); } public function getCount_MutasiBarang_HQOnly() { // Used $this->db->select('ID_MB'); $this->db->from('mutasi_barang'); $this->db->where('JENIS_MB=1 AND STATUS_MB=1'); $this->db->or_where('JENIS_MB=3 AND STATUS_MB=1'); return $this->db->count_all_results(); } public function getCount_MutasiBarang_ITPOnly() { // Used $this->db->select('ID_MB'); $this->db->from('mutasi_barang'); $this->db->where('JENIS_MB=0 AND STATUS_MB=1'); return $this->db->count_all_results(); } public function getCount_MutasiBarang_ServiceOnly() { // Used $this->db->select('ID_MB'); $this->db->from('mutasi_barang'); $this->db->where('JENIS_MB=2 AND STATUS_MB=1'); return $this->db->count_all_results(); } public function getCount_PajakDibayarDimuka_PPH22Only() { // Used $this->db->select('a.ID_PDD'); $this->db->from('pajak_dibayardimuka a'); $this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID'); $this->db->join('daftar_akuntansi c','c.ID_DAK=a.DAK_ID'); $this->db->join('penjualan d','d.ID_PENJUALAN=a.PEN_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID'); $this->db->join('kota g','g.ID_KOTA=f.KOTA_ID'); $this->db->join('daftar_rekappajak h','h.PDD_ID=a.ID_PDD','left'); $this->db->where('b.KODE_PPH=22'); $this->db->where('h.RPJ_ID is NULL'); $this->db->order_by('h.ID_DRPJ DESC,a.ID_PDD DESC'); return $this->db->count_all_results(); } public function getCount_PajakDibayarDimuka_PPH23Only() { // Used $this->db->select('a.ID_PDD'); $this->db->from('pajak_dibayardimuka a'); $this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID'); $this->db->join('daftar_akuntansi c','c.ID_DAK=a.DAK_ID'); $this->db->join('daftar_rekappajak d','d.PDD_ID=a.ID_PDD','left'); $this->db->where('b.KODE_PPH=23'); $this->db->where('d.RPJ_ID is NULL'); return $this->db->count_all_results(); } public function getCount_Pelanggan_byKELOMPOK($id) { // Used $this->db->select('ID_PELANGGAN'); $this->db->from('pelanggan'); $this->db->where('KELOMPOK_ID=', $id); return $this->db->count_all_results(); } public function getCount_Pelanggan_byKOTA($id) { // Used $this->db->select('ID_PELANGGAN'); $this->db->from('pelanggan'); $this->db->where('KOTA_ID=', $id); return $this->db->count_all_results(); } public function getCount_Pembelian_byCORP($id) { // Used $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('CORP_ID=', $id); return $this->db->count_all_results(); } public function getCount_Pembelian_bySTATUS($status) { // Used $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('STATUS_PEMBELIAN=', $status); return $this->db->count_all_results(); } public function getCount_Pembelian_bySTATUS_byPERIODE($status, $awal, $akhir) { // Used $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('STATUS_PEMBELIAN=', $status); $this->db->where('TGL_PEMBELIAN>=', $awal); $this->db->where('TGL_PEMBELIAN<=', $akhir); return $this->db->count_all_results(); } public function getCount_Pembelian_bySTATUS_byPERIODE_fpNull_ttNull($status, $awal, $akhir) { // Used $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where("STATUS_PEMBELIAN=$status AND TGL_PEMBELIAN>='$awal' AND TGL_PEMBELIAN<='$akhir' AND FP_PEMBELIAN is NULL"); $this->db->or_where("STATUS_PEMBELIAN=$status AND TGL_PEMBELIAN>='$awal' AND TGL_PEMBELIAN<='$akhir' AND TT_PEMBELIAN is NULL"); return $this->db->count_all_results(); } public function getCount_Pembelian_bySTATUS_byPERIODE_potonganNotNull($status, $awal, $akhir) { // Used $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('STATUS_PEMBELIAN=', $status); $this->db->where('TGL_PEMBELIAN>=', $awal); $this->db->where('TGL_PEMBELIAN<=', $akhir); $this->db->where('POTONGAN_PEMBELIAN is NOT NULL'); return $this->db->count_all_results(); } public function getCount_Pembelian_bySUPPLIER($id) { // Used $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('SUPPLIER_ID=', $id); return $this->db->count_all_results(); } public function getCount_Pembelian_statusNull() { // Used $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('STATUS_PEMBELIAN is NULL'); return $this->db->count_all_results(); } public function getCount_Pembelian_tahanNotNull() { // Used $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('TAHAN_PEMBELIAN is NOT NULL'); $this->db->where('LENGTH(TAHAN_PEMBELIAN)<=12', null, false); $this->db->where('STATUS_PEMBELIAN=1'); $this->db->where('ALUR_PEMBELIAN=2'); return $this->db->count_all_results(); } public function getCount_PenarikanKonsi_allStatus() { // Used $this->db->select('ID_PK'); $this->db->from('penarikan_konsi'); $this->db->where('STATUS_PK=1'); return $this->db->count_all_results(); } public function getCount_Pengadaan_bySTATUS($status) { // Used $this->db->select('ID_PENGADAAN'); $this->db->from('pengadaan'); $this->db->where('STATUS_PENGADAAN=', $status); return $this->db->count_all_results(); } public function getCount_PengingatPiutang_bySTATUS_beforeTGL($status, $tgl) { // Used $this->db->select('ID_PPIU'); $this->db->from('pengingat_piutang'); $this->db->where('STATUS_PPIU=', $status); $this->db->where('FU_PPIU<=', $tgl); return $this->db->count_all_results(); } public function getCount_Penjualan_byKOP($id) { // Used $this->db->select('ID_PENJUALAN'); $this->db->from('penjualan'); $this->db->where('KOP_ID=', $id); return $this->db->count_all_results(); } public function getCount_Penjualan_bySJINV_byPERIODE_notCetak_orderDESC($mode, $awal, $akhir) { // Used $this->db->select('a.ID_PENJUALAN'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('cetak_dokumen e','e.PENJUALAN_ID=a.ID_PENJUALAN'); $this->db->join('karyawan f','f.ID_KARYAWAN=b.SALES_ID'); $this->db->join('histori_cetakdokumen g','g.CD_ID=e.ID_CD','left'); $this->db->where('g.ID_HCD is NULL'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('e.SJ_INV=', $mode); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); if ($mode==0) { $this->db->where('a.SJ_PENJUALAN=e.KODE_BUKTI'); } else if ($mode==1) { $this->db->where('a.INV_PENJUALAN=e.KODE_BUKTI'); } $this->db->group_by('a.ID_PENJUALAN'); return $this->db->count_all_results(); } public function getCount_Penjualan_bySTATUS_byPERIODE($status, $awal, $akhir) { // Used $this->db->select('ID_PENJUALAN'); $this->db->from('penjualan'); $this->db->where('STATUS_PENJUALAN=', $status); $this->db->where('TGL_PENJUALAN>=', $awal); $this->db->where('TGL_PENJUALAN<=', $akhir); return $this->db->count_all_results(); } public function getCount_Penjualan_PPNOnly() { // Used $this->db->select('a.ID_PENJUALAN'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('daftar_rekappajak e','e.PENJUALAN_ID=a.ID_PENJUALAN','left'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('e.RPJ_ID is NULL'); $this->db->like('a.FP_PENJUALAN','02','after'); $this->db->or_like('a.FP_PENJUALAN','03','after'); $this->db->order_by('e.ID_DRPJ DESC'); return $this->db->count_all_results(); } public function getCount_Penjualan_PPNSelected() { // Used $this->db->select('a.ID_DRPJ'); $this->db->from('daftar_rekappajak a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->where('a.RPJ_ID is NULL'); return $this->db->count_all_results(); } public function getCount_Penjualan_status1_forBatal() { // Used $awal = date('Y-m-01'); $akhir = $this->generate_addMonth($awal, 1); $akhir = $this->generate_subDay($akhir, 1); $this->db->select('ID_PENJUALAN'); $this->db->from('penjualan'); $this->db->where('STATUS_PENJUALAN=1'); $this->db->where('TGL_PENJUALAN>=', $awal); $this->db->where('TGL_PENJUALAN<=', $akhir); return $this->db->count_all_results(); } public function getCount_Pihakke3_byKOTA($id) { // Used $this->db->select('ID_PIHAKKE3'); $this->db->from('pihakke3'); $this->db->where('KOTA_ID=', $id); return $this->db->count_all_results(); } public function getCount_Proforma_byPELANGGAN($id) { // Used $this->db->select('ID_PF'); $this->db->from('proforma'); $this->db->where('PELANGGAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_Proyek_byKARYAWAN_byRP($id1, $id2) { // Used $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('SALES_ID=', $id1); $this->db->where('RP_ID=', $id2); return $this->db->count_all_results(); } public function getCount_Proyek_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('SALES_ID=', $id); $this->db->where('STATUS_PROYEK=', $status); return $this->db->count_all_results(); } public function getCount_Proyek_byPELANGGAN($id) { // Used $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('PELANGGAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_Proyek_byRP_orderPELANGGAN($id) { // Used $this->db->select('a.ID_PROYEK'); $this->db->from('proyek a'); $this->db->join('rekap_proyek b','b.ID_RP=a.RP_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.RP_ID=', $id); return $this->db->count_all_results(); } public function getCount_Proyek_bySALES_byPERIODE_statusUntil1($id, $awal, $akhir) { // Used $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('SALES_ID=', $id); $this->db->where('TGL_PROYEK>=', $awal); $this->db->where('TGL_PROYEK<=', $akhir); $this->db->where('STATUS_PROYEK<=1'); $this->db->where('JENIS_PROYEK<=2'); return $this->db->count_all_results(); } public function getCount_Proyek_bySTATUS($status) { // Used $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('STATUS_PROYEK=', $status); return $this->db->count_all_results(); } public function getCount_Proyek_status9_tglBatalNull() { // Used $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('STATUS_PROYEK=9'); $this->db->where('TGL_BATAL is NULL'); return $this->db->count_all_results(); } public function getCount_RekapKlaimProgram_byMERK($id) { // Used $this->db->select('ID_RKPR'); $this->db->from('rekap_klaimprogram'); $this->db->where('MERK_ID=', $id); return $this->db->count_all_results(); } public function getCount_RekapKlaimProgram_byPKL($id) { // Used $this->db->select('ID_RKPR'); $this->db->from('rekap_klaimprogram'); $this->db->where('PKL_ID=', $id); return $this->db->count_all_results(); } public function getCount_RekapKlaimProgram_byPRODUK($id) { // Used $this->db->select('ID_RKPR'); $this->db->from('rekap_klaimprogram'); $this->db->where('PRODUK_ID=', $id); return $this->db->count_all_results(); } public function getCount_RekapPajak_byCORP($id) { // Used $this->db->select('ID_RPJ'); $this->db->from('rekap_pajak'); $this->db->where('CORP_ID=', $id); return $this->db->count_all_results(); } public function getCount_RekapPajak_byWAJIBPAJAK($id) { // Used $this->db->select('ID_RPJ'); $this->db->from('rekap_pajak'); $this->db->where('WAJIBPAJAK_ID=', $id); return $this->db->count_all_results(); } public function getCount_RekapProyek_byPP($id) { // Used $this->db->select('ID_RP'); $this->db->from('rekap_proyek'); $this->db->where('PP_ID=', $id); return $this->db->count_all_results(); } public function getCount_RekapProyek_bySTATUS($status) { // Used $this->db->select('ID_RP'); $this->db->from('rekap_proyek'); $this->db->where('STATUS_RP=', $status); return $this->db->count_all_results(); } public function getCount_ReturPembelian_bySTATUS($status) { // Used $this->db->select('ID_RB'); $this->db->from('retur_pembelian'); $this->db->where('STATUS_RB=', $status); return $this->db->count_all_results(); } public function getCount_ReturPenjualan_status0() { // Used $this->db->select('ID_RJ'); $this->db->from('retur_penjualan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->where('a.STATUS_RJ=0'); return $this->db->count_all_results(); } public function getCount_SalesOrder_byCORP($id) { // Used $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('CORP_ID=', $id); return $this->db->count_all_results(); } public function getCount_SalesOrder_byKARYAWAN_aktifOnly($id=null, $jabatan=null) { // Used $this->db->select('ID_SO'); $this->db->from('sales_order'); if (strpos($jabatan,"SALES")!==FALSE) { $this->db->where('STATUS_SO is NOT NULL AND STATUS_SO!=1 AND STATUS_SO>=0 AND STATUS_SO<=3 AND SALES_ID=', $id); } else { $this->db->where('STATUS_SO is NOT NULL AND STATUS_SO!=1 AND STATUS_SO>=0 AND STATUS_SO<=3'); } return $this->db->count_all_results(); } public function getCount_SalesOrder_byPELANGGAN($id) { // Used $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('PELANGGAN_ID=', $id); return $this->db->count_all_results(); } public function getCount_SalesOrder_byPERIODE_forCetak($awal, $akhir) { // Used $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO is NOT NULL AND STATUS_SO!=5 AND STATUS_SO!=9'); $this->db->where('TGL_SO>=', $awal); $this->db->where('TGL_SO<=', $akhir); return $this->db->count_all_results(); } public function getCount_SalesOrder_bySALES($id) { // Used $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('SALES_ID=', $id); return $this->db->count_all_results(); } public function getCount_SalesOrder_bySALES_bySTATUS($id, $status) { // Used $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('SALES_ID=', $id); $this->db->where('STATUS_SO=', $status); return $this->db->count_all_results(); } public function getCount_SalesOrder_bySALES_statusNull($id) { // Used $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO is NULL AND SALES_ID=', $id); return $this->db->count_all_results(); } public function getCount_SalesOrder_bySALES_statusNull_0_2_3($sales) { // Used $this->db->select('*'); $this->db->from('sales_order'); $this->db->where('STATUS_SO is NULL AND SALES_ID=', $sales); $this->db->or_where('STATUS_SO=0 AND SALES_ID=', $sales); $this->db->or_where('STATUS_SO=2 AND SALES_ID=', $sales); $this->db->or_where('STATUS_SO=3 AND SALES_ID=', $sales); return $this->db->count_all_results(); } public function getCount_SalesOrder_bySALES_0_2_3($sales) { // Used $this->db->select('*'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=0 AND SALES_ID=', $sales); $this->db->or_where('STATUS_SO=2 AND SALES_ID=', $sales); $this->db->or_where('STATUS_SO=3 AND SALES_ID=', $sales); return $this->db->count_all_results(); } public function getCount_SalesOrder_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=', $id); return $this->db->count_all_results(); } public function getCount_SalesOrder_bySTATUS_afterTGL($id, $tgl) { // Used $this->db->select('*'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=', $id); $this->db->where('TGL_SO>=', $tgl); return $this->db->count_all_results(); } public function getCount_SalesOrder_status0_2_3() { // Used $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=0 OR STATUS_SO=2 OR STATUS_SO=3'); return $this->db->count_all_results(); } public function getCount_SalesOrder_status0_3() { // Used $this->db->select('*'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=0 OR STATUS_SO=3'); return $this->db->count_all_results(); } public function getCount_SalesOrder_status1_TargetSales($id) { // Used $limit = date('Y-01-01'); $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=1'); $this->db->where('TGL_SO>=', $limit); if ($id!=1) { $this->db->where('SALES_ID=', $id); } return $this->db->count_all_results(); } public function getCount_SalesOrder_status1_terkirimNull() { // Used $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=1'); $this->db->where('TERKIRIM_SO is NULL'); return $this->db->count_all_results(); } public function getCount_Service_status1_jenisNot0() { // Used $this->db->select('ID_SERVICE'); $this->db->from('service'); $this->db->where('STATUS_SERVICE=1 AND JENIS_SERVICE!=0'); return $this->db->count_all_results(); } public function getCount_SetHariLibur_byJENIS_byPERIODE($jenis, $awal, $akhir) { // Used $this->db->select('ID_SHL'); $this->db->from('set_harilibur'); $this->db->where('JENIS_SHL=', $jenis); $this->db->where('TGL_SHL>=', $awal); $this->db->where('TGL_SHL<=', $akhir); return $this->db->count_all_results(); } public function getCount_SetSalesProduk_byMERK($id) { // Used $this->db->select('ID_SSP'); $this->db->from('set_salesproduk'); $this->db->where('MERK_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnBeli_byDB($id){ // Used $this->db->select('ID_SNB'); $this->db->from('sn_beli'); $this->db->where('DB_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnIo_byIO($id){ // Used $this->db->select('ID_SNIO'); $this->db->from('sn_io'); $this->db->where('IO_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnJual_byDO($id){ // Used $this->db->select('ID_SNJ'); $this->db->from('sn_jual'); $this->db->where('DO_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnKlaimProgram_byBARANG_bySUPPLIER_byMERK_byPRODUK_bySTATUS($id_barang=null, $id_supplier=null, $id_merk=null, $id_produk=null, $status_snkpr=null) { // Used $this->db->select('a.ID_SNKPR'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->where('b.BARANG_ID=', $id_barang); if ($id_supplier!=null) { $this->db->where('b.SUPPLIER_ID=', $id_supplier); } if ($id_merk!=null) { $this->db->where('c.MERK_ID=', $id_merk); } if ($id_produk!=null) { $this->db->where('c.PRODUK_ID=', $id_produk); } if ($status_snkpr==8) { } else { $this->db->where('a.STATUS_SNKPR=', $status_snkpr); } return $this->db->count_all_results(); } public function getCount_SnKlaimProgram_byKPR($id){ // Used $this->db->select('ID_SNKPR'); $this->db->from('sn_klaimprogram'); $this->db->where('KPR_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnKlaimProgram_byKPR_statusNot0($id){ // Used $this->db->select('ID_SNKPR'); $this->db->from('sn_klaimprogram'); $this->db->where('KPR_ID=', $id); $this->db->where('STATUS_SNKPR!=0'); return $this->db->count_all_results(); } public function getCount_SnKlaimProgram_byKPR_status0($id){ // Used $this->db->select('ID_SNKPR'); $this->db->from('sn_klaimprogram'); $this->db->where('KPR_ID=', $id); $this->db->where('STATUS_SNKPR=0'); return $this->db->count_all_results(); } public function getCount_SnKonsi_byDFK($id) { // Used $this->db->select('ID_SNK'); $this->db->from('sn_konsi'); $this->db->where('DFK_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnModifikasi_byMODIFIKASI_byJENIS($id1, $id2) { // Used $this->db->select('ID_SNMD'); $this->db->from('sn_modifikasi'); $this->db->where('MODIFIKASI_ID=', $id1); $this->db->where('JENIS_SNMD=', $id2); return $this->db->count_all_results(); } public function getCount_SnMutasiBarang_byMB_byDMB($id1, $id2){ // Used $this->db->select('ID_SNMB'); $this->db->from('sn_mutasibarang'); $this->db->where('MB_ID=', $id1); $this->db->where('DMB_ID=', $id2); return $this->db->count_all_results(); } public function getCount_SnOpname_byDOP_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_opname'); $this->db->where('DOP_ID=', $id); $this->db->where('STATUS_SOP=', $status); return $this->db->count_all_results(); } public function getCount_SnPinjam_byDFP($id) { // Used $this->db->select('ID_SNP'); $this->db->from('sn_pinjam'); $this->db->where('DFP_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnProyek_byDPR($id){ // Used $this->db->select('ID_SNPR'); $this->db->from('sn_proyek'); $this->db->where('DPR_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnService_byDFS($id) { // Used $this->db->select('ID_SNS'); $this->db->from('sn_service'); $this->db->where('DFS_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnService_byUNITSERVICE($id) { // Used $this->db->select('ID_SNS'); $this->db->from('sn_service'); $this->db->where('UNITSERVICE_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnService_statusNull_selesaiNull() { // Used $this->db->select('ID_SNS'); $this->db->from('sn_service'); $this->db->where('STATUS_SNS is NULL'); $this->db->where('SELESAI_SNS is NULL'); return $this->db->count_all_results(); } public function getCount_SnSewa_byDFSW($id) { // Used $this->db->select('ID_SNSW'); $this->db->from('sn_sewa'); $this->db->where('DFSW_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnSjParsial_bySJP($id){ // Used $this->db->select('ID_SNSJ'); $this->db->from('sn_sjparsial'); $this->db->where('SJP_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnStock_allStatus() { // Used $this->db->select('ID_SNSTOCK'); $this->db->from('sn_stock'); return $this->db->count_all_results(); } public function getCount_SnStock_byBARANG($id) { // Used $this->db->select('ID_SNSTOCK'); $this->db->from('sn_stock'); $this->db->where('BARANG_ID=', $id); return $this->db->count_all_results(); } public function getCount_SnStock_byBARANG_byKOP_status0_statusMore4($id, $kop) { // Used $this->db->select('ID_SNSTOCK'); $this->db->from('sn_stock'); $this->db->where("STATUS_SNSTOCK=0 AND BARANG_ID=$id AND KOP_SNSTOCK=$kop"); $this->db->or_where("STATUS_SNSTOCK>4 AND BARANG_ID=$id AND KOP_SNSTOCK=$kop"); return $this->db->count_all_results(); } public function getCount_SoProyek_byPROYEK($id) { // Used $this->db->select('ID_SPR'); $this->db->from('so_proyek'); $this->db->where('PROYEK_ID=', $id); return $this->db->count_all_results(); } public function getCount_Submenu_byPRICELIST($id) { // Used $this->db->select('ID_SMPL'); $this->db->from('submenu_pricelist'); $this->db->where('PRICELIST_ID=', $id); return $this->db->count_all_results(); } public function getCount_Supplier_byKOTA($id) { // Used $this->db->select('ID_SUPPLIER'); $this->db->from('supplier'); $this->db->where('KOTA_ID=', $id); return $this->db->count_all_results(); } public function getCount_TransaksiStock_byBARANG($id) { // Used $this->db->select('ID_IO'); $this->db->from('transaksi_stock'); $this->db->where('BARANG_ID=', $id); return $this->db->count_all_results(); } public function getCount_TransaksiStock_byPART($id) { // Used $this->db->select('a.ID_IO'); $this->db->from('transaksi_stock a'); $this->db->join('harga_part b','b.ID_HPAR=a.HPAR_ID'); $this->db->where('b.PART_ID=', $id); return $this->db->count_all_results(); } public function getCount_TransaksiStock_byPROYEK($id) { // Used $this->db->select('ID_IO'); $this->db->from('transaksi_stock'); $this->db->where('PROYEK_ID=', $id); return $this->db->count_all_results(); } public function getCount_TransaksiStock_bySO($id){ // Used $this->db->select('ID_IO'); $this->db->from('transaksi_stock'); $this->db->where('SO_ID=', $id); return $this->db->count_all_results(); } public function getCount_TransaksiStock_status1_groupKODE() { // Used $this->db->select('ID_IO'); $this->db->from('transaksi_stock'); $this->db->where('STATUS_IO=1'); $this->db->group_by('KODE_BUKTI'); return $this->db->count_all_results(); } public function getCount_UangMuka_byCORP($id) { // Used $this->db->select('ID_UM'); $this->db->from('uang_muka'); $this->db->where('CORP_ID=', $id); return $this->db->count_all_results(); } // Daftar Fungsi getData public function getData_Absensi_byKARYAWAN_bySTATUS_byPERIODE($id, $status, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_ABSENSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('absensi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); if ($id==0) { } else { $this->db->where('a.KARYAWAN_ID=', $id); } $this->db->where('b.KODE_KARYAWAN is NOT NULL'); $this->db->where('a.STATUS_ABSENSI=', $status); $this->db->where('a.TGL_ABSENSI>=', $awal); $this->db->where('a.TGL_ABSENSI<=', $akhir); $this->db->order_by('a.TGL_ABSENSI DESC'); return $this->db->get()->result_array(); } public function getData_Absensi_byKARYAWAN_byTGL($id, $tgl, $username=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_ABSENSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('absensi a'); $this->db->join('status_absensi b','b.ID_SABS=a.STATUS_ABSENSI'); $this->db->where(['a.TGL_ABSENSI' => $tgl]); if ($username=="service") { $this->db->where('a.KARYAWAN_ID=22'); } else { $this->db->where(['a.KARYAWAN_ID' => $id]); } return $this->db->get()->result_array(); } public function getData_Absensi_byKARYAWAN_moreNow($id) { // Used $now = date('Y-m-d'); $this->db->select('*,DATE_FORMAT(TGL_ABSENSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('absensi'); $this->db->where('STATUS_ABSENSI=3'); $this->db->where('TGL_ABSENSI>', $now); $this->db->where('KARYAWAN_ID=', $id); $this->db->order_by('TGL_ABSENSI ASC'); return $this->db->get()->result_array(); } public function getData_Absensi_status3_groupKARYAWAN() { // Used $now = date('Y-m-d'); $this->db->select('*'); $this->db->from('absensi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where('b.KODE_KARYAWAN is NOT NULL'); $this->db->where('a.STATUS_ABSENSI=3'); $this->db->where('a.TGL_ABSENSI>', $now); $this->db->group_by('a.KARYAWAN_ID'); $this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Akuntansi_byBANK_bySEARCH_limit20_status1_thisMonth($id, $search=null) { // Used $limit = date('Y-m-01'); $now = date('Y-m-d'); $this->db->select('*, DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); if ($search!=null) { $this->db->where("a.STATUS_AKUNTANSI=1 AND a.BANK_AKUNTANSI=$id AND a.TGL_AKUNTANSI>='$limit' AND a.TGL_AKUNTANSI<='$now' AND a.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.STATUS_AKUNTANSI=1 AND a.BANK_AKUNTANSI=$id AND a.TGL_AKUNTANSI>='$limit' AND a.TGL_AKUNTANSI<='$now' AND a.CIPTA_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.STATUS_AKUNTANSI=1 AND a.BANK_AKUNTANSI=$id AND a.TGL_AKUNTANSI>='$limit' AND a.TGL_AKUNTANSI<='$now' AND b.KET_DAK LIKE '%$search%'"); } else { $this->db->where("a.STATUS_AKUNTANSI=1 AND a.TGL_AKUNTANSI>='$limit' AND a.TGL_AKUNTANSI<='$now' AND a.BANK_AKUNTANSI=", $id); } $this->db->group_by('a.ID_AKUNTANSI'); $this->db->order_by('a.ID_AKUNTANSI DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Akuntansi_byBANK_bySTATUS_joinDak($id, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(b.DEBET_DAK, 2) as DEBET, FORMAT(b.KREDIT_DAK, 2) as KREDIT, SUM(b.DEBET_DAK-b.KREDIT_DAK) as TOTAL'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); $this->db->where(['a.BANK_AKUNTANSI' => $id]); $this->db->where(['a.STATUS_AKUNTANSI' => $status]); $this->db->group_by('a.ID_AKUNTANSI'); return $this->db->get()->result_array(); } public function getData_Akuntansi_byID($id) { // Used $this->db->select('*,DATE_FORMAT(TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('akuntansi'); $this->db->where(['ID_AKUNTANSI' => $id]); return $this->db->get()->result_array(); } public function getData_Akuntansi_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('akuntansi'); $this->db->where(['ID_AKUNTANSI' => $id]); $this->db->where(['STATUS_AKUNTANSI' => $status]); return $this->db->get()->result_array(); } public function getData_Akuntansi_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('akuntansi'); $this->db->where('KARYAWAN_AKUNTANSI=', $id); $this->db->where('STATUS_AKUNTANSI=', $status); return $this->db->get()->result_array(); } public function getData_Akuntansi_byKAS_bySEARCH_limit20_status1_thisMonth($id, $search=null) { // Used $limit = date('Y-m-01'); $now = date('Y-m-d'); $this->db->select('*, DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); if ($search!=null) { $this->db->where("a.STATUS_AKUNTANSI=1 AND a.KAS_AKUNTANSI=$id AND a.TGL_AKUNTANSI>='$limit' AND a.TGL_AKUNTANSI<='$now' AND a.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.STATUS_AKUNTANSI=1 AND a.KAS_AKUNTANSI=$id AND a.TGL_AKUNTANSI>='$limit' AND a.TGL_AKUNTANSI<='$now' AND a.CIPTA_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.STATUS_AKUNTANSI=1 AND a.KAS_AKUNTANSI=$id AND a.TGL_AKUNTANSI>='$limit' AND a.TGL_AKUNTANSI<='$now' AND b.KET_DAK LIKE '%$search%'"); } else { $this->db->where("a.STATUS_AKUNTANSI=1 AND a.TGL_AKUNTANSI>='$limit' AND a.TGL_AKUNTANSI<='$now' AND a.KAS_AKUNTANSI=", $id); } $this->db->group_by('a.ID_AKUNTANSI'); $this->db->order_by('a.ID_AKUNTANSI DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Akuntansi_byKAS_bySTATUS_joinDak($id, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(b.DEBET_DAK, 2) as DEBET, FORMAT(b.KREDIT_DAK, 2) as KREDIT, SUM(b.DEBET_DAK-b.KREDIT_DAK) as TOTAL'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); $this->db->where(['a.KAS_AKUNTANSI' => $id]); $this->db->where(['a.STATUS_AKUNTANSI' => $status]); $this->db->group_by('a.ID_AKUNTANSI'); return $this->db->get()->result_array(); } public function getData_Akuntansi_byKODE($kode) { // Used $this->db->select('*'); $this->db->from('akuntansi'); $this->db->where('KODE_AKUNTANSI=', $kode); return $this->db->get()->result_array(); } public function getData_Akuntansi_byKODE_bySTATUS($kode, $status) { // Used $this->db->select('*'); $this->db->from('akuntansi'); $this->db->where('KODE_AKUNTANSI=', $kode); $this->db->where('STATUS_AKUNTANSI=', $status); return $this->db->get()->result_array(); } public function getData_Akuntansi_byPERIODE_bySTATUS($awal, $akhir, $status) { // Used $this->db->select('*, DATE_FORMAT(TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('akuntansi'); $this->db->where('TGL_AKUNTANSI>=', $awal); $this->db->where('TGL_AKUNTANSI<=', $akhir); $this->db->where('STATUS_AKUNTANSI=', $status); return $this->db->get()->result_array(); } public function getData_Akuntansi_bySEARCH_limit20_status1_status2_forJM($search=null, $verse=null) { // Used if ($verse==1) { $limit = date('Y-m-01'); } else if ($verse==2) { $limit = date('2022-05-01'); } $this->db->select('*, DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); if ($search!=null) { $this->db->where("a.TGL_AKUNTANSI>='$limit' AND a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'JM%'"); $this->db->or_where("a.TGL_AKUNTANSI>='$limit' AND a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.CIPTA_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'JM%'"); $this->db->or_where("a.TGL_AKUNTANSI>='$limit' AND a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND b.KET_DAK LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'JM%'"); } else { $this->db->where("a.TGL_AKUNTANSI>='$limit' AND a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE 'JM%'"); } $this->db->group_by('a.ID_AKUNTANSI'); $this->db->order_by('a.ID_AKUNTANSI DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Akuntansi_bySEARCH_limit20_status1_status2_forJS($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); if ($search!=null) { $this->db->where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'JS%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.CIPTA_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'JS%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND b.KET_DAK LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'JS%'"); } else { $this->db->where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE 'JS%'"); } $this->db->group_by('a.ID_AKUNTANSI'); $this->db->order_by('a.ID_AKUNTANSI DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Akuntansi_bySEARCH_limit20_status1_status2_forKasbank($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); if ($search!=null) { $this->db->where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'BK%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.CIPTA_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'BK%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND b.KET_DAK LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'BK%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'BM%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.CIPTA_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'BM%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND b.KET_DAK LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'BM%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'KM%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.CIPTA_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'KM%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND b.KET_DAK LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'KM%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'KK%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.CIPTA_AKUNTANSI LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'KK%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND b.KET_DAK LIKE '%$search%' AND a.KODE_AKUNTANSI LIKE 'KK%'"); } else { $this->db->where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE 'BK%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE 'BM%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE 'KM%'"); $this->db->or_where("a.STATUS_AKUNTANSI<=2 AND a.STATUS_AKUNTANSI!=0 AND a.KODE_AKUNTANSI LIKE 'KK%'"); } $this->db->group_by('a.ID_AKUNTANSI'); $this->db->order_by('a.ID_AKUNTANSI DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Akuntansi_bySTATUS_byPERIODE_groupID_forProsesNeraca($status, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); $this->db->where(['a.STATUS_AKUNTANSI' => $status]); $this->db->where('a.TGL_AKUNTANSI>=', $awal); $this->db->where('a.TGL_AKUNTANSI<=', $akhir); $this->db->group_by('a.ID_AKUNTANSI'); return $this->db->get()->result_array(); } public function getData_Akuntansi_JMOnly_bySTATUS_groupID($status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(SUM(b.DEBET_DAK),2) as DEBET, FORMAT(SUM(b.KREDIT_DAK),2) as KREDIT'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); $this->db->where(['a.STATUS_AKUNTANSI' => $status]); $this->db->like('a.KODE_AKUNTANSI', 'JM', 'after'); $this->db->group_by('a.ID_AKUNTANSI'); return $this->db->get()->result_array(); } public function getData_Akuntansi_JSOnly_bySTATUS_groupID($status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(SUM(b.DEBET_DAK),2) as DEBET, FORMAT(SUM(b.KREDIT_DAK),2) as KREDIT'); $this->db->from('akuntansi a'); $this->db->join('daftar_akuntansi b','b.AKUNTANSI_ID=a.ID_AKUNTANSI'); $this->db->where(['a.STATUS_AKUNTANSI' => $status]); $this->db->like('a.KODE_AKUNTANSI', 'JS', 'after'); $this->db->group_by('a.ID_AKUNTANSI'); return $this->db->get()->result_array(); } public function getData_AkunTrialBalance() { // Used $this->db->select('*'); $this->db->from('akun_trialbalance'); return $this->db->get()->result_array(); } public function getData_Bank_byID($id) { // Used $this->db->select('*'); $this->db->from('bank'); $this->db->where('ID_BANK=', $id); return $this->db->get()->result_array(); } public function getData_Bank_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('bank'); $this->db->where('ID_BANK=', $id); $this->db->where('STATUS_BANK=', $status); return $this->db->get()->result_array(); } public function getData_Bank_byKODE_bySTATUS($kode, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('bank'); $this->db->where('KODE_BANK=', $kode); $this->db->where('STATUS_BANK=', $status); if ($id!=null) { $this->db->where('ID_BANK!=', $id); } return $this->db->get()->result_array(); } public function getData_Bank_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('bank'); $this->db->where('STATUS_BANK=', $id); $this->db->order_by('ID_BANK ASC'); return $this->db->get()->result_array(); } public function getData_Bank_notThis($id) { // Used $this->db->select('*'); $this->db->from('bank'); $this->db->where('ID_BANK!=', $id); $this->db->order_by('KODE_BANK ASC'); return $this->db->get()->result_array(); } public function getData_Barang_allJenis() { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->order_by('a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Barang_byID($id) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->join('merk d','d.ID_MERK=a.MERK_ID'); $this->db->join('model e','e.ID_MODEL=a.MODEL_ID'); $this->db->where(['a.ID_BARANG' => $id]); return $this->db->get()->result_array(); } public function getData_Barang_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('barang'); $this->db->where('ID_BARANG=', $id); $this->db->where('STATUS_BARANG=', $status); return $this->db->get()->result_array(); } public function getData_Barang_byID_bySTATUS_spNotNull($id, $status) { // Used $this->db->select('*'); $this->db->from('barang'); $this->db->where('ID_BARANG=', $id); $this->db->where('STATUS_BARANG=', $status); $this->db->where('SP_BARANG is NOT NULL'); return $this->db->get()->result_array(); } public function getData_Barang_byGUDANG_bySTATUS($gudang, $status) { //Used if ($gudang==1) { $this->db->select('*,b.PCM_KUANTITI as QTY'); } else if ($gudang==2) { $this->db->select('*,b.ITP_KUANTITI as QTY'); } else if ($gudang==3) { $this->db->select('*,b.SERVICE_KUANTITI as QTY'); } $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('a.STATUS_BARANG=', $status); if ($gudang==1) { $this->db->order_by('b.PCM_KUANTITI DESC, a.ID_BARANG ASC'); } else if ($gudang==2) { $this->db->order_by('b.ITP_KUANTITI DESC, a.ID_BARANG ASC'); } else if ($gudang==3) { $this->db->order_by('b.SERVICE_KUANTITI DESC, a.ID_BARANG ASC'); } return $this->db->get()->result_array(); } public function getData_Barang_byJENIS_byMERK_byMODEL_byPRODUK_bySTATUS($id1, $id2, $id3, $id4, $id5) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('merk c','c.ID_MERK=a.MERK_ID'); $this->db->join('model d','d.ID_MODEL=a.MODEL_ID'); $this->db->join('produk e','e.ID_PRODUK=a.PRODUK_ID'); if ($id1!=null) { $this->db->where('a.JENIS_ID=', $id1); } if ($id2!=null) { $this->db->where('a.MERK_ID=', $id2); } if ($id3!=null) { $this->db->where('a.MODEL_ID=', $id3); } if ($id4!=null) { $this->db->where('a.PRODUK_ID=', $id4); } $this->db->where('a.STATUS_BARANG=', $id5); $this->db->order_by('b.NAMA_JENIS ASC, c.NAMA_MERK ASC, d.NAMA_MODEL ASC, e.NAMA_PRODUK ASC, a.KODE_BARANG ASC, a.NAMA_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Barang_byKODE_bySTATUS($kode, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('barang'); $this->db->where('KODE_BARANG=', $kode); $this->db->where('STATUS_BARANG=', $status); if ($id!=null) { $this->db->where('ID_BARANG!=', $id); } return $this->db->get()->result_array(); } public function getData_Barang_byMERK_byPRODUK($id1, $id2) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('produk c','c.ID_PRODUK=a.PRODUK_ID'); $this->db->where('a.MERK_ID=', $id1); $this->db->where('a.PRODUK_ID=', $id2); return $this->db->get()->result_array(); } public function getData_Barang_byMERK_byPRODUK_jenisSKU_kuantitiMore0_spNull($id1, $id2) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('produk c','c.ID_PRODUK=a.PRODUK_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis e','e.ID_JENIS=a.JENIS_ID'); $this->db->where('a.MERK_ID=', $id1); $this->db->where('a.PRODUK_ID=', $id2); $this->db->where('a.SP_BARANG is NULL'); $this->db->where('d.GLOBAL_KUANTITI>0'); $this->db->where('e.SKU_JENIS=1'); $this->db->order_by('a.ID_BARANG DESC'); return $this->db->get()->result_array(); } public function getData_Barang_byMERK_byPRODUK_jenisSKU_spNotNull_orderASC($id1, $id2) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('a.STATUS_BARANG=1'); $this->db->where('a.MERK_ID=', $id1); $this->db->where('a.PRODUK_ID=', $id2); $this->db->where('a.SP_BARANG is NOT NULL'); $this->db->where('c.SKU_JENIS=1'); $this->db->order_by('a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Barang_byMERK_byPRODUK_jenisSKU_spNull_orderASC($id1, $id2) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('a.STATUS_BARANG=1'); $this->db->where('a.MERK_ID=', $id1); $this->db->where('a.PRODUK_ID=', $id2); $this->db->where('a.SP_BARANG is NULL'); $this->db->where('c.SKU_JENIS=1'); $this->db->order_by('a.ID_BARANG DESC'); return $this->db->get()->result_array(); } public function getData_Barang_byMERK_byPRODUK_jenisSKU_spNull_orderDESC_linkHhkpr($id1, $id2) { // Used $this->db->select('*, FORMAT((d.PERSEDIAAN_HHKPR/d.QTY_HHKPR),2) as HARGA, FORMAT((d.REBATE_HHKPR/d.QTY_HHKPR),2) as REBATE, FORMAT((d.PP_HHKPR/d.QTY_HHKPR),2) as PP,FORMAT((d.SUPPORT_HHKPR/d.QTY_HHKPR),2) as SUPPORT, (b.PCM_KUANTITI+b.ITP_KUANTITI) as READY, FORMAT(((d.PERSEDIAAN_HHKPR-d.PP_HHKPR-d.REBATE_HHKPR-d.SUPPORT_HHKPR)/d.QTY_HHKPR),0) as BOTTOMHPP'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->join('hasil_hitungkpr d','d.BARANG_ID=a.ID_BARANG','left'); $this->db->where('a.STATUS_BARANG=1'); $this->db->where('a.MERK_ID=', $id1); $this->db->where('a.PRODUK_ID=', $id2); $this->db->where('a.SP_BARANG is NULL'); $this->db->where('c.SKU_JENIS=1'); $this->db->order_by('a.ID_BARANG DESC'); return $this->db->get()->result_array(); } public function getData_Barang_byMERK_byPRODUK_status1_groupMODEL_forSku($id_merk, $id_produk) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('model b','b.ID_MODEL=a.MODEL_ID'); $this->db->where('a.STATUS_BARANG=1'); $this->db->where('a.MERK_ID=', $id_merk); $this->db->where('a.PRODUK_ID=', $id_produk); $this->db->group_by('a.MODEL_ID'); return $this->db->get()->result_array(); } public function getData_Barang_byMERK_jenisSKU_spNotNull_orderASC($id) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('a.STATUS_BARANG=1'); $this->db->where('a.MERK_ID=', $id); $this->db->where('a.SP_BARANG is NOT NULL'); $this->db->where('c.SKU_JENIS=1'); $this->db->order_by('a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Barang_byMERK_produk0_jenisSKU_spNull_orderDESC($id) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('a.STATUS_BARANG=1'); $this->db->where('a.PRODUK_ID=0'); $this->db->where('a.MERK_ID=', $id); $this->db->where('a.SP_BARANG is NULL'); $this->db->where('c.SKU_JENIS=1'); $this->db->order_by('c.NAMA_JENIS ASC, a.ID_BARANG DESC'); return $this->db->get()->result_array(); } public function getData_Barang_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('barang'); $this->db->where('NAMA_BARANG=', $nama); $this->db->where('STATUS_BARANG=', $status); if ($id!=null) { $this->db->where('ID_BARANG!=', $id); } return $this->db->get()->result_array(); } public function getData_Barang_bySEARCH_byMODE_status1_limit10($search, $mode, $gudang=null) { // Used if ($gudang==1) { $this->db->select('*, d.PCM_KUANTITI as QTY'); } else if ($gudang==2) { $this->db->select('*, d.ITP_KUANTITI as QTY'); } else if ($gudang==3) { $this->db->select('*, d.SERVICE_KUANTITI as QTY'); } $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('merk c','c.ID_MERK=a.MERK_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.ID_BARANG'); if ($mode==1) { $this->db->where("a.STATUS_BARANG=1 AND a.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND a.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND b.NAMA_JENIS LIKE '%$search%'"); } if ($gudang==null) { $this->db->order_by('a.KODE_BARANG ASC'); } else { if ($gudang==1) { $this->db->order_by('d.PCM_KUANTITI DESC, a.KODE_BARANG ASC'); } else if ($gudang==2) { $this->db->order_by('d.ITP_KUANTITI DESC, a.KODE_BARANG ASC'); } else if ($gudang==3) { $this->db->order_by('d.SERVICE_KUANTITI DESC, a.KODE_BARANG ASC'); } } $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_Barang_bySEARCH_byMODE_status1_limit20($search=null, $mode=null, $tipe=null) { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('merk c','c.ID_MERK=a.MERK_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.ID_BARANG'); if ($search!=null) { if ($mode==1) { $this->db->where("a.STATUS_BARANG=1 AND b.TYPE_JENIS!=2 AND a.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND b.TYPE_JENIS!=2 AND a.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND b.TYPE_JENIS!=2 AND b.NAMA_JENIS LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND b.TYPE_JENIS!=2 AND c.NAMA_MERK LIKE '%$search%'"); } else if ($mode==2) { $this->db->where("a.STATUS_BARANG=1 AND a.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND a.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND b.NAMA_JENIS LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND c.NAMA_MERK LIKE '%$search%'"); } else if ($mode==3) { $this->db->where("a.STATUS_BARANG=1 AND b.TYPE_JENIS='$tipe' AND a.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND b.TYPE_JENIS='$tipe' AND a.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND b.TYPE_JENIS='$tipe' AND b.NAMA_JENIS LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND b.TYPE_JENIS='$tipe' AND c.NAMA_MERK LIKE '%$search%'"); } else if ($mode==4) { $this->db->where("a.STATUS_BARANG=1 AND d.GLOBAL_KUANTITI>0 AND b.TYPE_JENIS='$tipe' AND a.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND d.GLOBAL_KUANTITI>0 AND b.TYPE_JENIS='$tipe' AND a.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND d.GLOBAL_KUANTITI>0 AND b.TYPE_JENIS='$tipe' AND b.NAMA_JENIS LIKE '%$search%'"); $this->db->or_where("a.STATUS_BARANG=1 AND d.GLOBAL_KUANTITI>0 AND b.TYPE_JENIS='$tipe' AND c.NAMA_MERK LIKE '%$search%'"); } } else { if ($mode==1) { $this->db->where('a.STATUS_BARANG=1 AND b.TYPE_JENIS!=2'); } else if ($mode==2) { $this->db->where('a.STATUS_BARANG=1'); } else if ($mode==3) { $this->db->where("a.STATUS_BARANG=1 AND b.TYPE_JENIS='$tipe'"); } else if ($mode==4) { $this->db->where("a.STATUS_BARANG=1 AND d.GLOBAL_KUANTITI>0 AND b.TYPE_JENIS='$tipe'"); } } $this->db->order_by('a.KODE_BARANG ASC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Barang_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('barang'); $this->db->where('STATUS_BARANG=', $id); $this->db->order_by('KODE_BARANG ASC, NAMA_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Barang_bySTATUS_byJENIS_forModifikasi($status, $jenis) { // Used $this->db->select('*, c.PCM_KUANTITI as QTY'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('b.TYPE_JENIS=', $jenis); $this->db->where('a.STATUS_BARANG=', $status); $this->db->where('c.PCM_KUANTITI>0'); $this->db->order_by('b.NAMA_JENIS ASC, a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Barang_bySTATUS_jenisNot2($status, $gudang=null) { // Used if ($gudang==null) { $this->db->select('*'); } else if ($gudang==1) { $this->db->select('*,c.PCM_KUANTITI as QTY'); } else if ($gudang==2) { $this->db->select('*,c.ITP_KUANTITI as QTY'); } else if ($gudang==3) { $this->db->select('*,c.SERVICE_KUANTITI as QTY'); } $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('b.TYPE_JENIS!=2'); $this->db->where('a.STATUS_BARANG=', $status); if ($gudang!=null) { if ($gudang==1) { $this->db->where('c.PCM_KUANTITI>0'); } else if ($gudang==2) { $this->db->where('c.ITP_KUANTITI>0'); } else if ($gudang==3) { $this->db->where('c.SERVICE_KUANTITI>0'); } } $this->db->order_by('b.NAMA_JENIS ASC, a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Barang_jenisNot2() { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('b.TYPE_JENIS!=2'); $this->db->order_by('a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Barang_jenisOnly1_moreThan1_linkPC() { // Used $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->join('promo_clearance d','d.BARANG_ID=a.ID_BARANG','left'); $this->db->where('b.TYPE_JENIS=1'); $this->db->where('b.ID_JENIS<=5'); $this->db->where('a.STATUS_BARANG=1'); $this->db->where('c.GLOBAL_KUANTITI>0'); $this->db->where('d.ID_PC is NULL'); $this->db->order_by('a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_BiayaProyek_byID($id) { // Used $this->db->select('*,FORMAT(a.NILAI_BPRY,2) as NILAI'); $this->db->from('biaya_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->where('a.ID_BPRY=', $id); return $this->db->get()->result_array(); } public function getData_BiayaProyek_byPROYEK($id) { // Used $this->db->select('*,FORMAT(a.NILAI_BPRY,2) as NILAI'); $this->db->from('biaya_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->where('a.PROYEK_ID=', $id); return $this->db->get()->result_array(); } public function getData_BiayaProyek_byPROYEK_beforeRP($id, $rp) { // Used $this->db->select('*,FORMAT(a.NILAI_BPRY,2) as NILAI'); $this->db->from('biaya_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->where('a.PROYEK_ID=', $id); $this->db->where('a.RP_ID_BPRY<', $rp); return $this->db->get()->result_array(); } public function getData_BiayaProyek_byPROYEK_byRP_jenis3($id1, $id2) { // Used $this->db->select('*,FORMAT(a.NILAI_BPRY,2) as NILAI'); $this->db->from('biaya_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->where('a.PROYEK_ID=', $id1); $this->db->where('a.RP_ID_BPRY=', $id2); return $this->db->get()->result_array(); } public function getData_BiayaProyek_byRP_jenis3($id) { // Used $this->db->select('*,FORMAT(a.NILAI_BPRY,2) as NILAI'); $this->db->from('biaya_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('rekap_proyek c','c.ID_RP=a.RP_ID_BPRY'); $this->db->where('a.RP_ID_BPRY=', $id); return $this->db->get()->result_array(); } public function getData_BiayaService($id=null) { // Used if ($id==null) { $this->db->select('*, FORMAT(HARGA_BS, 2) as HARGA'); $this->db->from('biaya_service'); } else { $this->db->select('*, FORMAT(HARGA_BS, 2) as HARGA'); $this->db->from('biaya_service'); $this->db->where('ID_BS=', $id); } return $this->db->get()->result_array(); } public function getData_Cabutan_byGUDANG_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('cabutan a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where('a.GUDANG_ID=', $id); $this->db->where('a.STATUS_CABUTAN=', $status); return $this->db->get()->result_array(); } public function getData_Cabutan_byGUDANG_bySTATUS_beforeTGL($id, $status, $tgl) { // Used $this->db->select('*'); $this->db->from('cabutan a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where('a.GUDANG_ID=', $id); $this->db->where('a.STATUS_CABUTAN=', $status); $this->db->where('a.TGL_CABUTAN<', $tgl); return $this->db->get()->result_array(); } public function getData_Cabutan_byID($id) { // Used $this->db->select('*'); $this->db->from('cabutan a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where('a.ID_CABUTAN=', $id); return $this->db->get()->result_array(); } public function getData_Cabutan_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('cabutan a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where('a.ID_CABUTAN=', $id); $this->db->where('a.STATUS_CABUTAN=', $status); return $this->db->get()->result_array(); } public function getData_Cabutan_byID_bySTATUS_byGUDANG($id, $status, $gudang) { // Used $this->db->select('*'); $this->db->from('cabutan a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where('a.ID_CABUTAN=', $id); $this->db->where('a.STATUS_CABUTAN=', $status); $this->db->where('a.GUDANG_ID=', $gudang); return $this->db->get()->result_array(); } public function getData_Cabutan_bySNSTOCK_activeOnly($id, $id_cabutan=null) { // Used $this->db->select('*'); $this->db->from('cabutan a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where('a.SNSTOCK_ID=', $id); $this->db->where('a.STATUS_CABUTAN<=1'); if ($id_cabutan!=null) { $this->db->where('a.ID_CABUTAN!=', $id_cabutan); } return $this->db->get()->result_array(); } public function getData_Cabutan_bySTATUS($status) { // Used $this->db->select('*'); $this->db->from('cabutan a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->where('a.STATUS_CABUTAN=', $status); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byID($id) { // Used $this->db->select('*,DATE_FORMAT(TGL_CD,"%d/%m/%Y") as TANGGAL'); $this->db->from('cetak_dokumen'); $this->db->where(['ID_CD' => $id]); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byJENIS_byVERSE_byID($jenis, $verse, $id) { // Used $this->db->select('*,DATE_FORMAT(TGL_CD,"%d/%m/%Y") as TGLCD'); $this->db->from('cetak_dokumen'); $this->db->where('SJ_INV=', $jenis); if ($verse==1) { $this->db->where('RB_ID=', $id); } else if ($verse==2) { $this->db->where('NB_ID=', $id); } else if ($verse==3 OR $verse==4) { $this->db->where('PENJUALAN_ID=', $id); } return $this->db->get()->result_array(); } public function getData_CetakDokumen_byKONSINYASI_byPERIODE_orderDESC($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('cetak_dokumen a'); $this->db->join('konsinyasi b','b.ID_KONSINYASI=a.KONSINYASI_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=b.SALES_ID'); $this->db->where('b.STATUS_KONSINYASI>=1'); $this->db->where('b.TGL_KONSINYASI>=', $awal); $this->db->where('b.TGL_KONSINYASI<=', $akhir); $this->db->order_by('a.ID_CD DESC'); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byMB_byPERIODE_orderDESC($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_MB,"%d/%m/%Y") as TANGGAL'); $this->db->from('cetak_dokumen a'); $this->db->join('mutasi_barang b','b.ID_MB=a.MB_ID'); $this->db->where('b.STATUS_MB>=1'); $this->db->where('b.TGL_MB>=', $awal); $this->db->where('b.TGL_MB<=', $akhir); $this->db->order_by('a.ID_CD DESC'); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byPEMINJAMAN_byPERIODE_orderDESC($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_PEMINJAMAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('cetak_dokumen a'); $this->db->join('peminjaman b','b.ID_PEMINJAMAN=a.PEMINJAMAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('b.STATUS_PEMINJAMAN>=1'); $this->db->where('b.TGL_PEMINJAMAN>=', $awal); $this->db->where('b.TGL_PEMINJAMAN<=', $akhir); $this->db->order_by('a.ID_CD DESC'); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byPENAWARAN_byPERIODE_orderDESC($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_CD,"%d/%m/%Y") as TANGGAL, FORMAT(b.NILAI_PENAWARAN, 2) as NILAI'); $this->db->from('cetak_dokumen a'); $this->db->join('penawaran b','b.ID_PENAWARAN=a.PENAWARAN_ID'); $this->db->where("b.STATUS_PENAWARAN>=1 AND b.STATUS_PENAWARAN!=9 AND a.TGL_CD>='$awal' AND a.TGL_CD<='$akhir'"); $this->db->order_by('a.ID_CD DESC'); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byPENAWARAN_byVERSI($id, $verse) { // Used $this->db->select('*'); $this->db->from('cetak_dokumen a'); $this->db->join('penawaran b','b.ID_PENAWARAN=a.PENAWARAN_ID'); $this->db->where(['a.PENAWARAN_ID' => $id]); $this->db->where(['a.SJ_INV' => $verse]); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byPENJUALAN($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_CD,"%d/%m/%Y") as TANGGAL'); $this->db->from('cetak_dokumen a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->where(['a.PENJUALAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byPK_byPERIODE_orderDESC($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_PK,"%d/%m/%Y") as TANGGAL'); $this->db->from('cetak_dokumen a'); $this->db->join('penarikan_konsi b','b.ID_PK=a.PK_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('b.STATUS_PK=1'); $this->db->where('b.TGL_PK>=', $awal); $this->db->where('b.TGL_PK<=', $akhir); $this->db->order_by('a.ID_CD DESC'); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byPROYEK($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_CD,"%d/%m/%Y") as TANGGAL,c.NAMA_PANGGILAN_KARYAWAN as NAKAR,d.NAMA_PANGGILAN_KARYAWAN as NAMIN'); $this->db->from('cetak_dokumen a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID','left'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.ADMIN_ID','left'); $this->db->where(['a.PROYEK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_CetakDokumen_byVERSE_byPERIODE($verse, $awal, $akhir) { // Used if ($verse==1) { $this->db->select('*, DATE_FORMAT(b.TGL_RB,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(c.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('cetak_dokumen a'); $this->db->join('retur_pembelian b','b.ID_RB=a.RB_ID'); $this->db->join('pembelian c','c.ID_PEMBELIAN=b.PEMBELIAN_ID'); $this->db->join('supplier d','d.ID_SUPPLIER=c.SUPPLIER_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('corp f','f.ID_CORP=c.CORP_ID'); $this->db->join('histori_cetakdokumen g','g.CD_ID=a.ID_CD','left'); $this->db->where('b.TGL_RB>=', $awal); $this->db->where('b.TGL_RB<=', $akhir); $this->db->where('g.ID_HCD is NULL'); $this->db->order_by('a.KODE_BUKTI DESC'); } return $this->db->get()->result_array(); } public function getData_Corp_byID($id) { // Used $this->db->select('*'); $this->db->from('corp'); $this->db->where('ID_CORP=', $id); return $this->db->get()->result_array(); } public function getData_Corp_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('corp'); $this->db->where('ID_CORP=', $id); $this->db->where('STATUS_CORP=', $status); return $this->db->get()->result_array(); } public function getData_Corp_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('corp'); $this->db->where('NAMA_CORP=', $nama); $this->db->where('STATUS_CORP=', $status); if ($id!=null) { $this->db->where('ID_CORP!=', $id); } return $this->db->get()->result_array(); } public function getData_Corp_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('corp'); $this->db->where('STATUS_CORP=', $id); $this->db->order_by('ID_CORP ASC'); return $this->db->get()->result_array(); } public function getData_Corp_forPPH() { // Used $this->db->select('*'); $this->db->from('corp'); $this->db->where('ID_CORP=1'); $this->db->or_where('ID_CORP=2'); $this->db->or_where('ID_CORP=4'); return $this->db->get()->result_array(); } public function getData_CreditNote_byID($id) { // Used $this->db->select('*'); $this->db->from('creditnote a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where(['a.ID_CN' => $id]); return $this->db->get()->result_array(); } public function getData_CreditNote_byID_bySTATUS($id, $status=null) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_CN,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_CN, 2) as NILAI'); $this->db->from('creditnote a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where(['a.ID_CN' => $id]); if ($status!=null OR $status==0) { $this->db->where(['a.STATUS_CN' => $status]); } return $this->db->get()->result_array(); } public function getData_CreditNote_byJENIS_status0($id) { // Used $this->db->select('*, FORMAT(a.NILAI_CN, 2) as NILAI'); $this->db->from('creditnote a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('merk d','d.ID_MERK=a.MERK_ID'); $this->db->where('a.JENIS_CN=', $id); $this->db->where('a.STATUS_CN=0'); return $this->db->get()->result_array(); } public function getData_CreditNote_byMERK_byPRODUK_bySTATUS($id_merk, $id_produk, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_CN,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_CN, 2) as NILAI'); $this->db->from('creditnote a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('produk e','e.ID_PRODUK=a.PRODUK_ID'); $this->db->join('rekap_klaimprogram f','f.ID_RKPR=a.RKPR_ID','left'); $this->db->join('potongan_klaimprogram g','g.ID_PKPR=f.PKPR_ID','left'); $this->db->where(['a.MERK_ID' => $id_merk]); $this->db->where(['a.PRODUK_ID' => $id_produk]); $this->db->where(['a.STATUS_CN' => $status]); return $this->db->get()->result_array(); } public function getData_CreditNote_byMERK_byPRODUK_bySTATUS_byLIMIT($id_merk, $id_produk, $status, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_CN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.LOCK_CN,"%d/%m/%Y") as TGLLOCK, FORMAT(a.NILAI_CN, 2) as NILAI'); $this->db->from('creditnote a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('produk c','c.ID_PRODUK=a.PRODUK_ID'); $this->db->join('supplier d','d.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->where(['a.MERK_ID' => $id_merk]); $this->db->where(['a.PRODUK_ID' => $id_produk]); $this->db->where(['a.STATUS_CN' => $status]); $this->db->where('a.LOCK_CN>=', $limit); $this->db->order_by('a.KODE_CN DESC'); return $this->db->get()->result_array(); } public function getData_CreditNote_byRKPR($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_CN,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_CN,2) as NILAI'); $this->db->from('creditnote a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID','left'); $this->db->join('pembelian c','c.ID_PEMBELIAN=a.PEMBELIAN_ID','left'); $this->db->where(['a.RKPR_ID' => $id]); return $this->db->get()->result_array(); } public function getData_CreditNote_bySTATUS_byLIMIT($status, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_CN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.LOCK_CN,"%d/%m/%Y") as TGLLOCK, FORMAT(a.NILAI_CN, 2) as NILAI'); $this->db->from('creditnote a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('produk c','c.ID_PRODUK=a.PRODUK_ID'); $this->db->join('supplier d','d.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->where(['a.STATUS_CN' => $status]); $this->db->where('a.LOCK_CN>=', $limit); $this->db->order_by('a.KODE_CN DESC'); return $this->db->get()->result_array(); } public function getData_CreditNote_cekCn($jenis, $merk, $produk, $rkpr, $supplier, $tgl, $nama, $nilai, $id=null) { // Used $this->db->select('*'); $this->db->from('creditnote'); $this->db->where('JENIS_CN=', $jenis); $this->db->where('MERK_ID=', $merk); $this->db->where('PRODUK_ID=', $produk); $this->db->where('RKPR_ID=', $rkpr); $this->db->where('SUPPLIER_ID=', $supplier); $this->db->where('TGL_CN=', $tgl); $this->db->where('NAMA_CN=', $nama); $this->db->where('NILAI_CN=', $nilai); if ($id!=null) { $this->db->where('ID_CN!=', $id); } return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byAKUNTANSI($id) { // Used $this->db->select('*,FORMAT(a.DEBET_DAK,2) as DEBET,FORMAT(a.KREDIT_DAK,2) as KREDIT,DATE_FORMAT(c.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('perkiraan b','b.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->join('akuntansi c','c.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.AKUNTANSI_ID' => $id]); $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byAKUNTANSI_byBANK($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi'); $this->db->where(['AKUNTANSI_ID' => $id1]); $this->db->where(['BANK_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byAKUNTANSI_byKAS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi'); $this->db->where(['AKUNTANSI_ID' => $id1]); $this->db->where(['KAS_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byAKUNTANSI_byPEMBELIAN_byPERKIRAAN($id1, $id2, $id3) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.AKUNTANSI_ID' => $id1]); $this->db->where(['a.PEMBELIAN_ID' => $id2]); $this->db->where(['a.PERKIRAAN_ID' => $id3]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byAKUNTANSI_byPERKIRAAN_byDEBET_byKREDIT_byKET($id1, $id2, $debet, $kredit, $ket) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi'); $this->db->where(['AKUNTANSI_ID' => $id1]); $this->db->where(['PERKIRAAN_ID' => $id2]); $this->db->where(['DEBET_DAK' => $debet]); $this->db->where(['KREDIT_DAK' => $kredit]); $this->db->where(['KET_DAK' => $ket]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byAKUNTANSI_orderASC_limit1($id) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.AKUNTANSI_ID' => $id]); $this->db->order_by('a.ID_DAK ASC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byBANK_byPERIODE_forSaldoBank($id_bank, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, d.KODE_BANK as DKOBA, d.NAMA_BANK as DNABA, e.KODE_BANK as EKOBA, e.NAMA_BANK as ENABA'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->join('bank d','d.ID_BANK=a.BANK_ID','left'); $this->db->join('bank e','e.ID_BANK=a.AS_BANK','left'); $this->db->where("a.JENIS_DAK=0 AND a.BANK_ID=$id_bank AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.STATUS_AKUNTANSI>=1"); $this->db->or_where("a.JENIS_DAK=2 AND a.BANK_ID=$id_bank AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.STATUS_AKUNTANSI>=1"); $this->db->or_where("a.JENIS_DAK=2 AND a.AS_BANK=$id_bank AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.STATUS_AKUNTANSI>=1"); $this->db->order_by('b.TGL_AKUNTANSI ASC, b.ID_AKUNTANSI ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly($id, $awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.BANK_ID=', $id); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','JM','after'); $this->db->order_by('c.KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly($id, $awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.BANK_ID=', $id); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','B','after'); $this->db->group_by('a.PERKIRAAN_ID'); $this->db->order_by('c.KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byID($id) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('perkiraan b','b.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->join('akuntansi c','c.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.ID_DAK' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('*, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('b.KARYAWAN_AKUNTANSI=', $id); $this->db->where('b.STATUS_AKUNTANSI=', $status); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byKARYAWAN_forPiutangKaryawan($id_karyawan, $search=null) { // Used $this->db->select('*,FORMAT(a.DEBET_DAK,2) as DEBET,FORMAT(a.KREDIT_DAK,2) as KREDIT,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); if ($search!=null) { $this->db->where("a.PERKIRAAN_ID=5 AND b.STATUS_AKUNTANSI>=1 AND a.KARYAWAN_ID=$id_karyawan AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=5 AND b.STATUS_AKUNTANSI>=1 AND a.KARYAWAN_ID=$id_karyawan AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=5 AND b.STATUS_AKUNTANSI>=1 AND a.KARYAWAN_ID=$id_karyawan AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=5 AND b.STATUS_AKUNTANSI>=1 AND a.KARYAWAN_ID=$id_karyawan AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=5 AND b.STATUS_AKUNTANSI>=1 AND a.KARYAWAN_ID=$id_karyawan AND b.KODE_AKUNTANSI LIKE '%$search%'"); } else { $this->db->where("a.PERKIRAAN_ID=5 AND b.STATUS_AKUNTANSI>=1 AND a.KARYAWAN_ID=$id_karyawan"); } $this->db->order_by('b.TGL_AKUNTANSI ASC, b.ID_AKUNTANSI ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byKAS_byPERIODE_forSaldoKas($id_kas, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, d.KODE_KAS as DKOKAS, d.NAMA_KAS as DNAKAS, e.KODE_KAS as EKOKAS, e.NAMA_KAS as ENAKAS'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->join('kas d','d.ID_KAS=a.KAS_ID','left'); $this->db->join('kas e','e.ID_KAS=a.AS_KAS','left'); $this->db->where("a.JENIS_DAK=0 AND a.KAS_ID=$id_kas AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.STATUS_AKUNTANSI>=1"); $this->db->or_where("a.JENIS_DAK=2 AND a.KAS_ID=$id_kas AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.STATUS_AKUNTANSI>=1"); $this->db->or_where("a.JENIS_DAK=2 AND a.AS_KAS=$id_kas AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.STATUS_AKUNTANSI>=1"); $this->db->order_by('b.TGL_AKUNTANSI ASC, b.ID_AKUNTANSI ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byKAS_byPERIODE_groupPERKIRAAN_jurnalMemoOnly($id, $awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.KAS_ID=', $id); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','JM','after'); $this->db->order_by('c.KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byKAS_byPERIODE_groupPERKIRAAN_kasbankOnly($id, $awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.KAS_ID=', $id); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','K','after'); $this->db->group_by('a.PERKIRAAN_ID'); $this->db->order_by('c.KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byKODE_byPERIODE($kode, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->where('b.STATUS_AKUNTANSI>=1'); if ($kode=="ALL") { } else if ($kode=="JS") { $this->db->where('c.TYPE_PERKIRAAN!=2 AND c.TYPE_PERKIRAAN!=3'); $this->db->like('b.KODE_AKUNTANSI', $kode, 'after'); } else { $this->db->like('b.KODE_AKUNTANSI', $kode, 'after'); } $this->db->order_by('b.KODE_AKUNTANSI ASC, b.TGL_AKUNTANSI ASC, a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byMAINDPB($id) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('akuntansi c','c.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.MAIN_DPB' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPELANGGAN_byPROYEK_byUNITPROYEK_byKARYAWAN_byPERIODE_forSearchProyek($id_pelanggan=null, $id_proyek=null, $id_unitproyek=null, $id_karyawan=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('proyek c','c.ID_PROYEK=a.PROYEK_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('unitproyek f','f.ID_UNITPROYEK=a.UNITPROYEK_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=a.KARYAWAN_ID'); if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_proyek==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_proyek==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_proyek==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_proyek==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_proyek!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_proyek==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_proyek==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_proyek!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_proyek==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_proyek!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_proyek!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_proyek==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_proyek!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_proyek!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_proyek!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_proyek==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_proyek==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_proyek==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_proyek==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_proyek!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_proyek==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_proyek==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_proyek!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_proyek==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_proyek!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_proyek!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_proyek==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_proyek!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_proyek!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_proyek!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.PROYEK_ID=$id_proyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPELANGGAN_byUNITPROYEK_byKARYAWAN_byKENDARAAN_byPERIODE_forSearchProyek($id_pelanggan=null, $id_unitproyek=null, $id_karyawan=null, $id_kendaraan=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('proyek c','c.ID_PROYEK=a.PROYEK_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('unitproyek f','f.ID_UNITPROYEK=a.UNITPROYEK_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('kendaraan h','h.ID_KENDARAAN=a.KENDARAAN_ID','left'); if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_kendaraan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_kendaraan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_kendaraan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_kendaraan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_kendaraan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_kendaraan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_kendaraan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_kendaraan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_kendaraan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_kendaraan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_kendaraan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_kendaraan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_kendaraan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_kendaraan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_kendaraan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_kendaraan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_kendaraan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_kendaraan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_kendaraan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_kendaraan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_kendaraan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_kendaraan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek==NULL AND $id_karyawan==NULL AND $id_kendaraan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_kendaraan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_kendaraan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek==NULL AND $id_karyawan!=NULL AND $id_kendaraan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_kendaraan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan==NULL AND $id_kendaraan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan==NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_kendaraan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $id_unitproyek!=NULL AND $id_karyawan!=NULL AND $id_kendaraan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND f.NAMA_UNITPROYEK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=70 AND c.PELANGGAN_ID=$id_pelanggan AND a.KARYAWAN_ID=$id_karyawan AND a.UNITPROYEK_ID=$id_unitproyek AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND g.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPELANGGAN_forDpPenjualan($id, $text=null) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM((a.KREDIT_DAK-a.DEBET_DAK)),2) as SISA'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.PERKIRAAN_ID=19'); $this->db->where('a.PELANGGAN_ID=', $id); $this->db->group_by('a.UM_ID'); $this->db->having('SISA!="0.00"'); if ($text!="") { $this->db->like('b.KODE_AKUNTANSI', $text); } return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPELANGGAN_groupPENJUALAN_belumLunas($id) { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,FORMAT(SUM(a.DEBET_DAK-a.KREDIT_DAK),2) as SELISIH,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where(['a.PELANGGAN_ID' => $id]); $this->db->group_by('a.PENJUALAN_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('c.NAMA_PELANGGAN ASC, b.INV_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPEMBELIAN($id) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi'); $this->db->where(['PEMBELIAN_ID' => $id]); $this->db->order_by('ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN_orderDESC_limit1($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PEMBELIAN_ID' => $id1]); $this->db->where(['a.PERKIRAAN_ID' => $id2]); $this->db->order_by('a.ID_DAK DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPENJUALAN($id) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi'); $this->db->where(['PENJUALAN_ID' => $id]); $this->db->order_by('ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN_jenis0($id1, $id2) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL,FORMAT(a.DEBET_DAK,2) as DEBET,FORMAT(a.KREDIT_DAK,2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PENJUALAN_ID' => $id1]); $this->db->where(['a.PERKIRAAN_ID' => $id2]); $this->db->where('a.JENIS_PDA=0'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN_orderDESC_limit1($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PENJUALAN_ID' => $id1]); $this->db->where(['a.PERKIRAAN_ID' => $id2]); $this->db->order_by('a.ID_DAK DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_jurnalMemoOnly_notKasbank($awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('c.TYPE_PERKIRAAN!=0'); $this->db->where('c.TYPE_PERKIRAAN!=3'); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','JM','after'); $this->db->not_like('a.PERKIRAAN_ID','1','none'); $this->db->not_like('a.PERKIRAAN_ID','2','none'); $this->db->group_by('a.PERKIRAAN_ID'); $this->db->order_by('c.KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_jurnalSistemOnly($awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('c.TYPE_PERKIRAAN!=0'); $this->db->where('c.TYPE_PERKIRAAN!=3'); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','JS','after'); $this->db->not_like('a.PERKIRAAN_ID','21','none'); $this->db->group_by('a.PERKIRAAN_ID'); $this->db->order_by('c.KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_pembelianOnly($awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','PB','after'); $this->db->group_by('a.PERKIRAAN_ID'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_penjualanOnly($awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','PJ','after'); $this->db->group_by('a.PERKIRAAN_ID'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_returBeliOnly($awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','RB','after'); $this->db->group_by('a.PERKIRAAN_ID'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_returJualOnly($awal, $akhir) { // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET, SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->like('b.KODE_AKUNTANSI','RJ','after'); $this->db->group_by('a.PERKIRAAN_ID'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byBANK_byPERIODE_bySEARCH($id_perkiraan, $id_bank, $awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan d','d.ID_PERKIRAAN=a.PERKIRAAN_ID'); if ($search!=null) { $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI=", $search); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI=", $search); } else { $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byBANK_byPERIODE_forSearch($id_perkiraan, $id_bank=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, d.KODE_BANK as DKOBA, d.NAMA_BANK as DNABA, e.KODE_BANK as EKOBA, e.NAMA_BANK as ENABA'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->join('bank d','d.ID_BANK=a.BANK_ID','left'); $this->db->join('bank e','e.ID_BANK=a.AS_BANK','left'); if ($id_bank==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_bank==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.KODE_BANK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_BANK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.KODE_BANK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_BANK LIKE '%$search%'"); } else if ($id_bank!=NULL AND $search==NULL) { $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_bank!=NULL AND $search!=NULL) { $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.KODE_BANK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.BANK_ID=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_BANK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.KODE_BANK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_BANK=$id_bank AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_BANK LIKE '%$search%'"); } $this->db->order_by('b.TGL_AKUNTANSI ASC, b.ID_AKUNTANSI ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_byPERIODE_bySEARCH($id_perkiraan, $id_karyawan, $awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('perkiraan d','d.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.PERKIRAAN_ID=', $id_perkiraan); $this->db->where('a.KARYAWAN_ID=', $id_karyawan); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); if ($search!=null) { $this->db->where('b.KODE_AKUNTANSI=', $search); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_byPERIODE_forSearch($id_perkiraan, $id_karyawan=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jabatan d','d.ID_JABATAN=c.JABATAN_ID'); if ($id_karyawan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_karyawan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_JABATAN LIKE '%$search%'"); } else if ($id_karyawan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_karyawan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KARYAWAN_ID=$id_karyawan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_JABATAN LIKE '%$search%'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byKAS_byPERIODE_bySEARCH($id_perkiraan, $id_kas, $awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); if ($search!=null) { $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI=", $search); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI=", $search); } else { $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byKAS_byPERIODE_forSearch($id_perkiraan, $id_kas=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, d.KODE_KAS as DKOKAS, d.NAMA_KAS as DNAKAS, e.KODE_KAS as EKOKAS, e.NAMA_KAS as ENAKAS'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->join('kas d','d.ID_KAS=a.KAS_ID','left'); $this->db->join('kas e','e.ID_KAS=a.AS_KAS','left'); if ($id_kas==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_kas==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.KODE_KAS LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_KAS LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.KODE_KAS LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KAS LIKE '%$search%'"); } else if ($id_kas!=NULL AND $search==NULL) { $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_kas!=NULL AND $search!=NULL) { $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.KODE_KAS LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id_perkiraan AND a.KAS_ID=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_KAS LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.KODE_KAS LIKE '%$search%'"); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id_perkiraan AND a.AS_KAS=$id_kas AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND e.NAMA_KAS LIKE '%$search%'"); } $this->db->order_by('b.TGL_AKUNTANSI ASC, b.ID_AKUNTANSI ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_bySEARCH($id_perkiraan, $id_kendaraan, $awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('kendaraan c','c.ID_KENDARAAN=a.KENDARAAN_ID'); $this->db->join('perkiraan d','d.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.PERKIRAAN_ID=', $id_perkiraan); $this->db->where('a.KENDARAAN_ID=', $id_kendaraan); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); if ($search!=null) { $this->db->where('b.KODE_AKUNTANSI=', $search); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_forSearch($id_perkiraan, $id_kendaraan=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('kendaraan c','c.ID_KENDARAAN=a.KENDARAAN_ID'); if ($id_kendaraan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_kendaraan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_KENDARAAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NOPOL_KENDARAAN LIKE '%$search%'"); } else if ($id_kendaraan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_kendaraan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_KENDARAAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.KENDARAAN_ID=$id_kendaraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NOPOL_KENDARAAN LIKE '%$search%'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_bySEARCH($id_perkiraan, $id_pelanggan, $awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('perkiraan d','d.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.PERKIRAAN_ID=', $id_perkiraan); $this->db->where('a.PELANGGAN_ID=', $id_pelanggan); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); if ($search!=null) { $this->db->where('b.KODE_AKUNTANSI=', $search); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_bySEARCH_forProyek($id_perkiraan, $id_pelanggan, $awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->join('proyek d','d.ID_PROYEK=a.PROYEK_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->where('a.PERKIRAAN_ID=', $id_perkiraan); $this->db->where('d.PELANGGAN_ID=', $id_pelanggan); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); if ($search!=null) { $this->db->where('b.KODE_AKUNTANSI=', $search); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch($id_perkiraan, $id_pelanggan=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); if ($id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PELANGGAN_ID=$id_pelanggan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPEMBELIAN($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id1]); $this->db->where(['a.PEMBELIAN_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN($id1, $id2, $search=null) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL,FORMAT(a.DEBET_DAK,2) as DEBET,FORMAT(a.KREDIT_DAK,2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id1]); $this->db->where(['a.PENJUALAN_ID' => $id2]); if ($search!=null) { $this->db->where(['a.ID_DAK' => $search]); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE($id, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.PERKIRAAN_ID=', $id); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE_forSearchPerkiraan($id_perkiraan, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID'); if ($id_perkiraan==NULL AND $search==NULL) { $this->db->where("b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_perkiraan==NULL AND $search!=NULL) { $this->db->where("b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PERKIRAAN LIKE '%$search%'"); } else if ($id_perkiraan!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_perkiraan!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.KODE_PERKIRAAN LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PERKIRAAN LIKE '%$search%'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE_groupPELANGGAN($id, $awal, $akhir) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('akuntansi e','e.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->where('e.TGL_AKUNTANSI>=', $awal); $this->db->where('e.TGL_AKUNTANSI<=', $akhir); $this->db->group_by('b.PEL_ID'); $this->db->order_by('c.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE_groupPELANGGAN_forProyek($id, $awal, $akhir) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('akuntansi e','e.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->where('e.TGL_AKUNTANSI>=', $awal); $this->db->where('e.TGL_AKUNTANSI<=', $akhir); $this->db->group_by('b.PELANGGAN_ID'); $this->db->order_by('c.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_byPERIODE_bySEARCH($id_perkiraan, $id_pihakke3, $awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('pihakke3 c','c.ID_PIHAKKE3=a.PIHAKKE3_ID'); $this->db->join('perkiraan d','d.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.PERKIRAAN_ID=', $id_perkiraan); $this->db->where('a.PIHAKKE3_ID=', $id_pihakke3); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); if ($search!=null) { $this->db->where('b.KODE_AKUNTANSI=', $search); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_byPERIODE_forSearch($id_perkiraan, $id_pihakke3=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('pihakke3 c','c.ID_PIHAKKE3=a.PIHAKKE3_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); if ($id_pihakke3==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pihakke3==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PIHAKKE3 LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id_pihakke3!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.PIHAKKE3_ID=$id_pihakke3 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_pihakke3!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.PIHAKKE3_ID=$id_pihakke3 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PIHAKKE3_ID=$id_pihakke3 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PIHAKKE3_ID=$id_pihakke3 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PIHAKKE3_ID=$id_pihakke3 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PIHAKKE3_ID=$id_pihakke3 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PIHAKKE3_ID=$id_pihakke3 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_PIHAKKE3 LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.PIHAKKE3_ID=$id_pihakke3 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_bySEARCH($id_perkiraan, $id_supplier, $awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('perkiraan d','d.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where('a.PERKIRAAN_ID=', $id_perkiraan); $this->db->where('a.SUPPLIER_ID=', $id_supplier); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); if ($search!=null) { $this->db->where('b.KODE_AKUNTANSI=', $search); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_forSearch($id_perkiraan, $id_supplier=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL, FORMAT(a.DEBET_DAK, 2) as DEBET, FORMAT(a.KREDIT_DAK, 2) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); if ($id_supplier==NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_supplier==NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id_supplier!=NULL AND $search==NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.SUPPLIER_ID=$id_supplier AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir'"); } else if ($id_supplier!=NULL AND $search!=NULL) { $this->db->where("a.PERKIRAAN_ID=$id_perkiraan AND a.SUPPLIER_ID=$id_supplier AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.SUPPLIER_ID=$id_supplier AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.SUPPLIER_ID=$id_supplier AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.SUPPLIER_ID=$id_supplier AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.SUPPLIER_ID=$id_supplier AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND b.KODE_AKUNTANSI LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.SUPPLIER_ID=$id_supplier AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=$id_perkiraan AND a.SUPPLIER_ID=$id_supplier AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); } $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_byUM_orderASC($id1, $id2) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id1]); $this->db->where(['a.UM_ID' => $id2]); $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_groupKARYAWAN_belumLunas($id) { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL,FORMAT(SUM(a.DEBET_DAK-a.KREDIT_DAK),2) as TOTALSISA'); $this->db->from('daftar_akuntansi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jabatan c','c.ID_JABATAN=b.JABATAN_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->group_by('a.KARYAWAN_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_groupMAINDPB_belumLunas($id) { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL,FORMAT(SUM(a.DEBET_DAK-a.KREDIT_DAK),2) as TOTALSISA'); $this->db->from('daftar_akuntansi a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->group_by('a.MAIN_DPB'); $this->db->having('TOTAL>0'); $this->db->order_by('b.NAMA_SUPPLIER ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_groupPELANGGAN_belumLunas($id) { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,SUM(a.KREDIT_DAK-a.DEBET_DAK) as TOTAL,FORMAT(SUM(a.KREDIT_DAK-a.DEBET_DAK),2) as TOTALSISA'); $this->db->from('daftar_akuntansi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->group_by('a.PELANGGAN_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('b.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_groupPEMBELIAN_belumLunas($id) { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,SUM(a.KREDIT_DAK-a.DEBET_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->group_by('a.PEMBELIAN_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('c.NAMA_SUPPLIER ASC, b.INV_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_groupPENJUALAN_belumLunas($id) { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->group_by('a.PENJUALAN_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('d.NAMA_PELANGGAN ASC, b.INV_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_groupPIHAKKE3_belumLunas($id) { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL,FORMAT(SUM(a.DEBET_DAK-a.KREDIT_DAK),2) as TOTALSISA'); $this->db->from('daftar_akuntansi a'); $this->db->join('pihakke3 b','b.ID_PIHAKKE3=a.PIHAKKE3_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->group_by('a.PIHAKKE3_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('b.NAMA_PIHAKKE3 ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPERKIRAAN_groupSUPPLIER_belumLunas($id) { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL,FORMAT(SUM(a.DEBET_DAK-a.KREDIT_DAK),2) as TOTALSISA'); $this->db->from('daftar_akuntansi a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->group_by('a.SUPPLIER_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('b.NAMA_SUPPLIER ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPIHAKKE3_forPiutangPihakke3($id_pihakke3, $search=null) { // Used $this->db->select('*,FORMAT(a.DEBET_DAK,2) as DEBET,FORMAT(a.KREDIT_DAK,2) as KREDIT,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); if ($search!=null) { $this->db->where("a.PERKIRAAN_ID=6 AND b.STATUS_AKUNTANSI>=1 AND a.PIHAKKE3_ID=$id_pihakke3 AND a.CIPTA_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=6 AND b.STATUS_AKUNTANSI>=1 AND a.PIHAKKE3_ID=$id_pihakke3 AND a.KET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=6 AND b.STATUS_AKUNTANSI>=1 AND a.PIHAKKE3_ID=$id_pihakke3 AND a.DEBET_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=6 AND b.STATUS_AKUNTANSI>=1 AND a.PIHAKKE3_ID=$id_pihakke3 AND a.KREDIT_DAK LIKE '%$search%'"); $this->db->or_where("a.PERKIRAAN_ID=6 AND b.STATUS_AKUNTANSI>=1 AND a.PIHAKKE3_ID=$id_pihakke3 AND b.KODE_AKUNTANSI LIKE '%$search%'"); } else { $this->db->where("a.PERKIRAAN_ID=6 AND b.STATUS_AKUNTANSI>=1 AND a.PIHAKKE3_ID=$id_pihakke3"); } $this->db->order_by('b.TGL_AKUNTANSI ASC, b.ID_AKUNTANSI ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPROYEK($id) { // Used $this->db->select('*,FORMAT(a.DEBET_DAK,2) as NILAI,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('unitproyek c','c.ID_UNITPROYEK=a.UNITPROYEK_ID'); $this->db->where(['a.PROYEK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPROYEK_byPERKIRAAN_bySearch($id1, $id2, $textSearch=null) { // Used $this->db->select('*,FORMAT(a.DEBET_DAK,2) as DEBET,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('unitproyek c','c.ID_UNITPROYEK=a.UNITPROYEK_ID'); $this->db->where(['a.PROYEK_ID' => $id1]); $this->db->where(['a.PERKIRAAN_ID' => $id2]); if ($textSearch!=null) { $this->db->like('b.KODE_AKUNTANSI', $textSearch); } return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPROYEK_beforeRP($id1, $id2) { // Used $this->db->select('*,FORMAT(a.DEBET_DAK,2) as NILAI,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('unitproyek c','c.ID_UNITPROYEK=a.UNITPROYEK_ID'); $this->db->where(['a.PROYEK_ID' => $id1]); $this->db->where('a.RP_ID_DAK<', $id2); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPROYEK_byRP($id1, $id2) { // Used $this->db->select('*,FORMAT(a.DEBET_DAK,2) as NILAI,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('unitproyek c','c.ID_UNITPROYEK=a.UNITPROYEK_ID'); $this->db->where(['a.PROYEK_ID' => $id1]); $this->db->where(['a.RP_ID_DAK' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_bySALES_BelumLunasOnly($id, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(c.NILAI_SO,2) as NILAI, FORMAT(SUM(a.DEBET_DAK-a.KREDIT_DAK),2) as TOTAL,DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=c.SALES_ID'); $this->db->join('kop g','g.ID_KOP=c.CORP_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('b.STATUS_PENJUALAN=1'); $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); if ($id!=1) { $this->db->where('c.SALES_ID=', $id); } $this->db->order_by('b.TEMPO_PENJUALAN ASC'); $this->db->group_by('a.PENJUALAN_ID'); $this->db->having('TOTAL>0'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_bySALES_BrutoOnly($id_sales, $awal, $akhir) { // Used $this->db->select('*,FORMAT(a.DEBET_DAK,2) as DEBET,DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(c.FEE_SO,2) as FEE'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=c.SALES_ID'); $this->db->join('kop g','g.ID_KOP=c.CORP_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('a.JENIS_PDA=0'); $this->db->where('b.STATUS_PENJUALAN=1'); if ($id_sales!=1) { $this->db->where('c.SALES_ID=', $id_sales); } $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_bySALES_ReturOnly($id_sales, $awal, $akhir) { // Used $this->db->select('*,FORMAT(a.KREDIT_DAK,2) as KREDIT,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('retur_penjualan c','c.KODE_RJ=b.KODE_AKUNTANSI'); $this->db->join('penjualan d','d.ID_PENJUALAN=c.PENJUALAN_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID'); $this->db->join('kota g','g.ID_KOTA=f.KOTA_ID'); $this->db->join('karyawan h','h.ID_KARYAWAN=e.SALES_ID'); $this->db->join('kop i','i.ID_KOP=e.CORP_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('a.JENIS_PDA=2'); $this->db->where('c.STATUS_RJ=1'); $this->db->where('c.TGL_INPUT>=', $awal); $this->db->where('c.TGL_INPUT<=', $akhir); if ($id_sales!=1) { $this->db->where('e.SALES_ID=', $id_sales); } return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_bySALES_TahunBeforeOnly($id) { // Used $yearNow = date('Y'); $yearBefore = $yearNow-1; $awal = date("$yearBefore-01-01"); $now = date('Y-01-01'); $akhir = $this->generate_subDay($now, 1); $this->db->select('*,DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(c.NILAI_SO,2) as NILAI, FORMAT(SUM(a.DEBET_DAK-a.KREDIT_DAK),2) as TOTAL,DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=c.SALES_ID'); $this->db->join('kop g','g.ID_KOP=c.CORP_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('b.STATUS_PENJUALAN=1'); $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); if ($id!=1) { $this->db->where('c.SALES_ID=', $id); } $this->db->group_by('a.PENJUALAN_ID'); $this->db->having('TOTAL>0'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_bySALES_TerbayarOnly($id, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(c.NILAI_SO,2) as NILAI'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=c.SALES_ID'); $this->db->join('kop g','g.ID_KOP=c.CORP_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('a.JENIS_PDA=1'); $this->db->where('b.STATUS_PENJUALAN=1'); $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); if ($id!=1) { $this->db->where('c.SALES_ID=', $id); } $this->db->group_by('a.PENJUALAN_ID'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_bySUPPLIER_forDpPembelian($id, $text=null) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM((a.DEBET_DAK-a.KREDIT_DAK)),2) as SISA'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->where('a.PERKIRAAN_ID=7'); $this->db->where('a.SUPPLIER_ID=', $id); $this->db->group_by('a.MAIN_DPB'); $this->db->having('SISA!="0.00"'); if ($text!="") { $this->db->like('b.KODE_AKUNTANSI', $text); } return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_bySUPPLIER_groupPEMBELIAN_belumLunas($id) { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,FORMAT(SUM(a.KREDIT_DAK-a.DEBET_DAK),2) as SELISIH,SUM(a.KREDIT_DAK-a.DEBET_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->where('a.PERKIRAAN_ID=15'); $this->db->where(['a.SUPPLIER_ID' => $id]); $this->db->group_by('a.PEMBELIAN_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('c.NAMA_SUPPLIER ASC, b.INV_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byUM($id) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('uang_muka b','b.ID_UM=a.UM_ID'); $this->db->join('akuntansi c','c.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.UM_ID' => $id]); $this->db->order_by('a.ID_DAK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_cekDak($id_perkiraan, $debet_dak=null, $kredit_dak=null, $ket_dak, $tgl_akuntansi=null) { // Used $this->db->select('*'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id_perkiraan]); if ($debet_dak!=null) { $this->db->where(['a.DEBET_DAK' => $debet_dak]); } if ($kredit_dak!=null) { $this->db->where(['a.KREDIT_DAK' => $kredit_dak]); } if ($tgl_akuntansi!=null) { $this->db->where(['b.TGL_AKUNTANSI' => $tgl_akuntansi]); } $this->db->where(['a.KET_DAK' => $ket_dak]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_perkiraan3_groupPENJUALAN_belumLunas() { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,FORMAT(SUM(a.DEBET_DAK-a.KREDIT_DAK),2) as SELISIH,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->group_by('a.PENJUALAN_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('c.NAMA_PELANGGAN ASC, b.INV_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_perkiraan15_groupPEMBELIAN_belumLunas() { // Used $this->db->select('*,FORMAT(SUM(a.KREDIT_DAK),2) as KREDIT,FORMAT(SUM(a.DEBET_DAK),2) as DEBET,FORMAT(SUM(a.KREDIT_DAK-a.DEBET_DAK),2) as SELISIH,SUM(a.KREDIT_DAK-a.DEBET_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->where('a.PERKIRAAN_ID=15'); $this->db->group_by('a.PEMBELIAN_ID'); $this->db->having('TOTAL>0'); $this->db->order_by('c.NAMA_SUPPLIER ASC, b.INV_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byBARANG($id){ // Used $this->db->select('*'); $this->db->from('daftar_beli'); $this->db->where('BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byBARANG_byGUDANG_bySTATUS($id, $gudang, $status){ // Used $this->db->select('*, DATE_FORMAT(b.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_beli a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('corp c','c.ID_CORP=b.CORP_ID'); $this->db->where('a.BARANG_ID=', $id); $this->db->where('b.GUDANG_PEMBELIAN=', $gudang); $this->db->where('b.STATUS_PEMBELIAN=', $status); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byBARANG_bySTATUS_dbNull($id, $status){ // Used $this->db->select('*, a.BARANG_ID as BID, b.SUPPLIER_ID as SID'); $this->db->from('daftar_beli a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('klaim_program d','d.DB_ID=a.ID_DB','left'); $this->db->where('a.BARANG_ID=', $id); $this->db->where('b.STATUS_PEMBELIAN=', $status); $this->db->where('d.DB_ID is NULL'); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byCORP_bySUPPLIER_byJENIS_byMERK_byMODEL_byPRODUK_byPERIODE_groupBARANG_status1($id_corp=null, $id_supplier=null, $id_jenis=null, $id_merk=null, $id_model=null, $id_produk=null, $awal=null, $akhir=null) { // Used $this->db->select('*, SUM(a.QTY_DB) as TOTAL'); $this->db->from('daftar_beli a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->join('merk e','e.ID_MERK=c.MERK_ID'); $this->db->join('model f','f.ID_MODEL=c.MODEL_ID'); $this->db->join('produk g','g.ID_PRODUK=c.PRODUK_ID'); $this->db->where('b.STATUS_PEMBELIAN=1'); $this->db->where('b.TGL_INVBELI>=', $awal); $this->db->where('b.TGL_INVBELI<=', $akhir); if ($id_corp!=null) { $this->db->where('b.CORP_ID=', $id_corp); } if ($id_supplier!=null) { $this->db->where('b.SUPPLIER_ID=', $id_supplier); } if ($id_jenis!=null) { $this->db->where('c.JENIS_ID=', $id_jenis); } if ($id_merk!=null) { $this->db->where('c.MERK_ID=', $id_merk); } if ($id_model!=null) { $this->db->where('c.MODEL_ID=', $id_model); } if ($id_produk!=null) { $this->db->where('c.PRODUK_ID=', $id_produk); } $this->db->group_by('a.BARANG_ID'); $this->db->order_by('d.NAMA_JENIS ASC, e.NAMA_MERK ASC, f.NAMA_MODEL ASC, g.NAMA_PRODUK ASC, c.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byCORP_bySUPPLIER_byMERK_byPRODUK_byPERIODE_status1($id_corp=null, $id_supplier=null, $id_merk=null, $id_produk=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_INVBELI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_beli a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('barang e','e.ID_BARANG=a.BARANG_ID'); $this->db->join('merk f','f.ID_MERK=e.MERK_ID'); $this->db->join('produk g','g.ID_PRODUK=e.PRODUK_ID'); if ($id_corp==NULL AND $id_supplier==NULL AND $id_merk==NULL AND $search==NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir'"); } else if ($id_corp==NULL AND $id_supplier==NULL AND $id_merk==NULL AND $search!=NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND a.QTY_DB LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND f.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND g.NAMA_PRODUK LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_supplier==NULL AND $id_merk==NULL AND $search==NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp"); } else if ($id_corp!=NULL AND $id_supplier==NULL AND $id_merk==NULL AND $search!=NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND a.QTY_DB LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND f.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND g.NAMA_PRODUK LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_supplier!=NULL AND $id_merk==NULL AND $search==NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier"); } else if ($id_corp==NULL AND $id_supplier!=NULL AND $id_merk==NULL AND $search!=NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND a.QTY_DB LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND f.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND g.NAMA_PRODUK LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_supplier==NULL AND $id_merk!=NULL AND $search==NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk"); } else if ($id_corp==NULL AND $id_supplier==NULL AND $id_merk!=NULL AND $search!=NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND a.QTY_DB LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND e.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND e.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND f.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND g.NAMA_PRODUK LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_supplier!=NULL AND $id_merk==NULL AND $search==NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier"); } else if ($id_corp!=NULL AND $id_supplier!=NULL AND $id_merk==NULL AND $search!=NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND a.QTY_DB LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND f.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND g.NAMA_PRODUK LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_supplier==NULL AND $id_merk!=NULL AND $search==NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk"); } else if ($id_corp!=NULL AND $id_supplier==NULL AND $id_merk!=NULL AND $search!=NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND a.QTY_DB LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND bTGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND bTGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND bTGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND bTGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND e.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND bTGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND e.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND bTGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND f.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND bTGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND g.NAMA_PRODUK LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_supplier!=NULL AND $id_merk!=NULL AND $search==NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk"); } else if ($id_corp==NULL AND $id_supplier!=NULL AND $id_merk!=NULL AND $search!=NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND a.QTY_DB LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND e.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND e.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND f.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND g.NAMA_PRODUK LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_supplier!=NULL AND $id_merk!=NULL AND $search==NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk"); } else if ($id_corp!=NULL AND $id_supplier!=NULL AND $id_merk!=NULL AND $search!=NULL) { $this->db->where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND a.QTY_DB LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND e.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND e.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND f.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("b.STATUS_PEMBELIAN=1 AND b.TGL_INVBELI>='$awal' AND b.TGL_INVBELI<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND e.MERK_ID=$id_merk AND e.PRODUK_ID=$id_produk AND g.NAMA_PRODUK LIKE '%$search%'"); } $this->db->order_by('b.TGL_INVBELI ASC, b.INV_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byDPG($id){ // Used $this->db->select('*'); $this->db->from('daftar_beli'); $this->db->where('DPG_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byID($id){ // Used $this->db->select('*'); $this->db->from('daftar_beli a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('pembelian d','d.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where('a.ID_DB=', $id); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byPEMBELIAN($id){ // Used $this->db->select('*,FORMAT(a.HARGA_DB,2) as SATUAN,FORMAT((a.QTY_DB*a.HARGA_DB),2) as SUBTOTAL'); $this->db->from('daftar_beli a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('pembelian d','d.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where('a.PEMBELIAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byPEMBELIAN_byBARANG($id1, $id2, $id3=null) { // Used $this->db->select('*'); $this->db->from('daftar_beli'); $this->db->where(['PEMBELIAN_ID' => $id1]); $this->db->where(['BARANG_ID' => $id2]); if ($id3!=null) { $this->db->where('ID_DB!=', $id3); } return $this->db->get()->result_array(); } public function getData_DaftarBeli_byPEMBELIAN_kembaliNotFull($id) { // Used $this->db->select('*,SUM(a.QTY_DB-a.RETUR_DB) as SISA'); $this->db->from('daftar_beli a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('pembelian d','d.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where('a.PEMBELIAN_ID=', $id); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('SISA DESC, b.KODE_BARANG ASC'); $this->db->having('SISA>0'); return $this->db->get()->result_array(); } public function getData_DaftarBeli_forStokAging($awalbeli, $akhirbeli, $id_corp=null, $id_merk=null, $id_produk=null, $search=null) { // Used $this->db->select('*,SUM(a.QTY_DB) as TOTALQTY'); $this->db->from('daftar_beli a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('pembelian c','c.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('merk d','d.ID_MERK=b.MERK_ID'); $this->db->join('produk e','e.ID_PRODUK=b.PRODUK_ID'); $this->db->where('c.STATUS_PEMBELIAN=1'); $this->db->where('c.TGL_INVBELI>=', $awalbeli); $this->db->where('c.TGL_INVBELI<=', $akhirbeli); if ($id_corp != NULL) { $this->db->where('c.CORP_ID', $id_corp); } if ($id_merk != NULL) { $this->db->where('b.MERK_ID', $id_merk); } if ($id_produk != NULL) { $this->db->where('b.PRODUK_ID', $id_produk); } if ($search != NULL) { $this->db->like('b.KODE_BARANG', $search); } $this->db->where('b.JENIS_ID<=7'); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('b.KODE_BARANG'); return $this->db->get()->result_array(); } public function getData_DaftarDokumenTagihan_byDT($id) { // Used $this->db->select('*, DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(c.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO, FORMAT((b.DEBET_HHPDA-b.KREDIT_HHPDA), 2) as JUMLAH, (b.DEBET_HHPDA-b.KREDIT_HHPDA) as TOTAL'); $this->db->from('daftar_dokumentagihan a'); $this->db->join('hasil_hitungpda b','b.ID_HHPDA=a.HHPDA_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=b.PENJUALAN_ID'); $this->db->join('sales_order d','d.ID_SO=c.SO_ID'); $this->db->join('dokumen_tagihan e','e.ID_DT=a.DT_ID'); $this->db->where('a.DT_ID=', $id); $this->db->order_by('c.INV_PENJUALAN ASC, c.TGL_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarDokumenTagihan_DTNull() { // Used $this->db->select('*'); $this->db->from('daftar_dokumentagihan'); $this->db->where('DT_ID is NULL'); return $this->db->get()->result_array(); } public function getData_DaftarFormKaryawan_byFK($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_DFFK,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_DFFK,0) as NILAI'); $this->db->from('daftar_formkaryawan a'); $this->db->join('form_karyawan b','b.ID_FK=a.FK_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=b.KARYAWAN_ID'); $this->db->join('jabatan d','d.ID_JABATAN=c.JABATAN_ID'); $this->db->where('a.FK_ID=', $id); $this->db->order_by('a.ID_DFFK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarFormKaryawan_byFK_byTGL($id, $tgl, $notid = null) { // Used if ($notid==null) { $this->db->select('*'); $this->db->from('daftar_formkaryawan'); $this->db->where('FK_ID=', $id); $this->db->where('TGL_DFFK=', $tgl); } else { $this->db->select('*'); $this->db->from('daftar_formkaryawan'); $this->db->where('FK_ID=', $id); $this->db->where('TGL_DFFK=', $tgl); $this->db->where('ID_DFFK!=', $notid); } return $this->db->get()->result_array(); } public function getData_DaftarFormKaryawan_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_formkaryawan a'); $this->db->join('form_karyawan b','b.ID_FK=a.FK_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=b.KARYAWAN_ID'); $this->db->join('jabatan d','d.ID_JABATAN=c.JABATAN_ID'); $this->db->where('a.ID_DFFK=', $id); return $this->db->get()->result_array(); } public function getData_DaftarFormKaryawan_byKARYAWAN_byJENIS_byPERIODE($id_karyawan, $id_jfk, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_DFFK,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_formkaryawan a'); $this->db->join('form_karyawan b','b.ID_FK=a.FK_ID'); $this->db->where('b.KARYAWAN_ID=', $id_karyawan); $this->db->where('b.JENIS_FK=', $id_jfk); $this->db->where('a.TGL_DFFK>=', $awal); $this->db->where('a.TGL_DFFK<=', $akhir); $this->db->where('b.STATUS_FK=1'); return $this->db->get()->result_array(); } public function getData_DaftarKlaimProgram_byID($id) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_KPR,"%d/%m%/%Y") as TANGGAL'); $this->db->from('daftar_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.MIX_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->join('supplier d','d.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->where(['a.ID_DKPR' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarKlaimProgram_byKPR($id) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_KPR,"%d/%m%/%Y") as TANGGAL'); $this->db->from('daftar_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.MIX_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->join('supplier d','d.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->where(['a.KPR_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarKlaimProgram_byKPR_byMIX($id1, $id2) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_KPR,"%d/%m%/%Y") as TANGGAL'); $this->db->from('daftar_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.MIX_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->join('supplier d','d.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->where(['a.KPR_ID' => $id1]); $this->db->where(['a.MIX_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarKonsi_byBARANG_byJENIS_statusMore1($barang, $jenis) { // Used $this->db->select('*, DATE_FORMAT(d.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_konsi a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('konsinyasi d','d.ID_KONSINYASI=a.KONSINYASI_ID'); $this->db->where('a.BARANG_ID=', $barang); $this->db->where('d.JENIS_KONSINYASI=', $jenis); $this->db->where('d.STATUS_KONSINYASI>=1'); return $this->db->get()->result_array(); } public function getData_DaftarKonsi_byBARANG_byPELANGGAN_byJENIS_bySTATUS_byORDER($barang, $pelanggan, $jenis, $status, $order) { // Used $this->db->select('*'); $this->db->from('daftar_konsi a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('konsinyasi d','d.ID_KONSINYASI=a.KONSINYASI_ID'); $this->db->where('a.BARANG_ID=', $barang); $this->db->where('d.PELANGGAN_ID=', $pelanggan); $this->db->where('d.JENIS_KONSINYASI=', $jenis); $this->db->where('d.STATUS_KONSINYASI=', $status); if ($order==1) { $this->db->order_by('a.ID_DFK ASC'); } else if ($order==2) { $this->db->order_by('a.ID_DFK DESC'); } return $this->db->get()->result_array(); } public function getData_DaftarKonsi_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_konsi a'); $this->db->join('konsinyasi b','b.ID_KONSINYASI=a.KONSINYASI_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.ID_DFK' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarKonsi_byKONSINYASI($id) { // Used $this->db->select('*'); $this->db->from('daftar_konsi a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('konsinyasi d','d.ID_KONSINYASI=a.KONSINYASI_ID'); $this->db->where('a.KONSINYASI_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarKonsi_byKONSINYASI_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_konsi a'); $this->db->join('konsinyasi b','b.ID_KONSINYASI=a.KONSINYASI_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.KONSINYASI_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarKonsi_byPELANGGAN_byJENIS_bySTATUS_kembaliNotFull($id, $jenis, $status) { // Used $this->db->select('*,SUM(a.QTY_DFK-a.KEMBALI_DFK) as SISA'); $this->db->from('daftar_konsi a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('konsinyasi d','d.ID_KONSINYASI=a.KONSINYASI_ID'); $this->db->where('d.PELANGGAN_ID=', $id); $this->db->where('d.JENIS_KONSINYASI=', $jenis); $this->db->where('d.STATUS_KONSINYASI=', $status); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('SISA DESC, b.KODE_BARANG ASC'); $this->db->having('SISA>0'); return $this->db->get()->result_array(); } public function getData_DaftarKpi_byDIVISI_byPUM_byKARYAWAN_orderURUTAN($divisi, $pum, $karyawan) { // Used $this->db->select('*, FORMAT(a.TARGET_DKPI, 2) as TARGET, FORMAT(a.BOBOT_DKPI, 0) as BOBOT'); $this->db->from('daftar_kpi a'); $this->db->join('kpi b','b.ID_KPI=a.KPI_ID'); $this->db->join('satuan c','c.ID_SATUAN=b.SATUAN_ID'); $this->db->join('periode_umum d','d.ID_PUM=a.PUM_ID'); $this->db->where(['b.DIVISI_ID' => $divisi]); $this->db->where(['a.PUM_ID' => $pum]); $this->db->where(['a.KARYAWAN_ID' => $karyawan]); $this->db->order_by('a.URUTAN_DKPI ASC'); return $this->db->get()->result_array(); } public function getData_DaftarKpi_byDIVISI_byPUM_byTIM_orderURUTAN($divisi, $pum, $tim) { // Used $this->db->select('*, FORMAT(a.TARGET_DKPI, 2) as TARGET, FORMAT(a.BOBOT_DKPI, 0) as BOBOT'); $this->db->from('daftar_kpi a'); $this->db->join('kpi b','b.ID_KPI=a.KPI_ID'); $this->db->join('satuan c','c.ID_SATUAN=b.SATUAN_ID'); $this->db->join('periode_umum d','d.ID_PUM=a.PUM_ID'); $this->db->where(['b.DIVISI_ID' => $divisi]); $this->db->where(['a.PUM_ID' => $pum]); $this->db->where(['a.TIM_ID' => $tim]); $this->db->order_by('a.URUTAN_DKPI ASC'); return $this->db->get()->result_array(); } public function getData_DaftarKpi_byID($id) { // Used $this->db->select('*, FORMAT(a.TARGET_DKPI, 2) as TARGET'); $this->db->from('daftar_kpi a'); $this->db->join('kpi b','b.ID_KPI=a.KPI_ID'); $this->db->where(['a.ID_DKPI' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarKpi_byKPI_byPUM_byKARYAWAN($kpi, $pum, $karyawan) { // Used $this->db->select('*'); $this->db->from('daftar_kpi a'); $this->db->join('kpi b','b.ID_KPI=a.KPI_ID'); $this->db->where(['a.KPI_ID' => $kpi]); $this->db->where(['a.PUM_ID' => $pum]); $this->db->where(['a.KARYAWAN_ID' => $karyawan]); return $this->db->get()->result_array(); } public function getData_DaftarKpi_byKPI_byPUM_byTIM($kpi, $pum, $tim) { // Used $this->db->select('*'); $this->db->from('daftar_kpi a'); $this->db->join('kpi b','b.ID_KPI=a.KPI_ID'); $this->db->where(['a.KPI_ID' => $kpi]); $this->db->where(['a.PUM_ID' => $pum]); $this->db->where(['a.TIM_ID' => $tim]); return $this->db->get()->result_array(); } public function getData_DaftarKpi_byPKPI($id) { // Used $this->db->select('*'); $this->db->from('daftar_kpi'); $this->db->where(['PKPI_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarMutasiBarang_byBARANG_byGUDANG_statusMore1($barang, $gudang) { // Used $this->db->select('*, DATE_FORMAT(d.TGL_MB, "%d/%m%/%Y") as TANGGAL'); $this->db->from('daftar_mutasibarang a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('mutasi_barang d','d.ID_MB=a.MB_ID'); $this->db->where('d.STATUS_MB>=1'); $this->db->where(['a.BARANG_ID' => $barang]); if ($gudang==1) { $this->db->where('d.JENIS_MB>=0'); } else if ($gudang==2) { $this->db->where('d.JENIS_MB<=1'); } else if ($gudang==3) { $this->db->where('d.JENIS_MB>=2'); } return $this->db->get()->result_array(); } public function getData_DaftarMutasiBarang_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_mutasibarang a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('mutasi_barang d','d.ID_MB=a.MB_ID'); $this->db->where(['a.ID_DMB' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarMutasiBarang_byMB($id) { // Used $this->db->select('*'); $this->db->from('daftar_mutasibarang a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('mutasi_barang d','d.ID_MB=a.MB_ID'); $this->db->where(['a.MB_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarMutasiBarang_byMB_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_mutasibarang'); $this->db->where(['MB_ID' => $id1]); $this->db->where(['BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarNotaBebas_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_notabebas a'); $this->db->join('nota_bebas b','b.ID_NB=a.NB_ID'); $this->db->where('a.ID_DNB=', $id); return $this->db->get()->result_array(); } public function getData_DaftarNotaBebas_byNB($id) { // Used $this->db->select('*'); $this->db->from('daftar_notabebas a'); $this->db->join('nota_bebas b','b.ID_NB=a.NB_ID'); $this->db->where('a.NB_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarOpname_byBARANG_byGUDANG_byLIMIT_statusNot2_orderDESC($id_barang, $gudang, $limit) { // Used $this->db->select('*'); $this->db->from('daftar_opname a'); $this->db->join('opname b','b.ID_OPNAME=a.OPNAME_ID'); $this->db->where('a.BARANG_ID=', $id_barang); $this->db->where('b.GUDANG_OPNAME=', $gudang); $this->db->where('b.TGL_OPNAME>=', $limit); $this->db->where('b.STATUS_OPNAME!=9'); $this->db->order_by('b.TGL_OPNAME DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_DaftarOpname_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_opname a'); $this->db->join('opname b','b.ID_OPNAME=a.OPNAME_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.ID_DOP' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarOpname_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('daftar_opname a'); $this->db->join('opname b','b.ID_OPNAME=a.OPNAME_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.ID_DOP' => $id]); $this->db->where(['b.STATUS_OPNAME' => $status]); return $this->db->get()->result_array(); } public function getData_DaftarOpname_byOPNAME($id) { // Used $this->db->select('*'); $this->db->from('daftar_opname a'); $this->db->join('opname b','b.ID_OPNAME=a.OPNAME_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where('a.OPNAME_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarOpname_byOPNAME_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_opname a'); $this->db->join('opname b','b.ID_OPNAME=a.OPNAME_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.OPNAME_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byBARANG($id){ // Used $this->db->select('*'); $this->db->from('daftar_order'); $this->db->where('BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byBARANG_byGUDANG_bySTATUS($id, $gudang, $status){ // Used $this->db->select('*, DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('penjualan c','c.SO_ID=a.SO_ID'); $this->db->join('corp d','d.ID_CORP=b.CORP_ID'); if ($gudang==1) { //$this->db->where('a.BARANG_ID=', $id); //$this->db->where('c.STATUS_PENJUALAN=', $status); //$this->db->where('b.GUDANG_SO=', $gudang); //$this->db->where("a.BARANG_ID=$id AND c.STATUS_PENJUALAN=$status AND b.CORP_ID<=3"); $this->db->where("a.BARANG_ID=$id AND c.STATUS_PENJUALAN=$status AND b.GUDANG_SO=$gudang"); } else if ($gudang==2) { //$this->db->where('a.BARANG_ID=', $id); //$this->db->where('c.STATUS_PENJUALAN=', $status); //$this->db->where('b.GUDANG_SO=', $gudang); //$this->db->where("a.BARANG_ID=$id AND c.STATUS_PENJUALAN=$status AND b.CORP_ID>3"); $this->db->where("a.BARANG_ID=$id AND c.STATUS_PENJUALAN=$status AND b.GUDANG_SO=$gudang"); } else if ($gudang==3) { $this->db->where('a.BARANG_ID=', $id); $this->db->where('c.STATUS_PENJUALAN=', $status); $this->db->where('b.GUDANG_SO=', $gudang); //$this->db->where("a.BARANG_ID=$id AND c.STATUS_PENJUALAN=$status AND b.SALES_ID=53"); //$this->db->or_where("a.BARANG_ID=$id AND c.STATUS_PENJUALAN=$status AND b.GUDANG_SO=$gudang"); } return $this->db->get()->result_array(); } public function getData_DaftarOrder_byBARANG_byPERIODE_status1($id_barang, $awal, $akhir) { // Used $this->db->select('*'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->join('penjualan d','d.SO_ID=c.ID_SO'); $this->db->where('d.STATUS_PENJUALAN=1'); $this->db->where('a.BARANG_ID=', $id_barang); $this->db->where('d.TGL_PENJUALAN>=', $awal); $this->db->where('d.TGL_PENJUALAN<=', $akhir); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byBARANG_status0_3($id) { // Used $this->db->select('*'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->where('b.STATUS_SO=0 AND a.BARANG_ID=', $id); $this->db->or_where('b.STATUS_SO=3 AND a.BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byCORP_byMERK_byPRODUK_bySALES_byPERIODE_status1($id_corp=null, $id_merk=null, $id_produk=null, $id_sales=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, SUM(a.QTY_DO) as TOTALQTY, SUM(a.QTY_DO*a.HARGA_DO) as TOTALDPP, FORMAT(SUM(a.QTY_DO*a.HARGA_DO),2) as TOTALDPPFOR'); $this->db->from('daftar_order a'); $this->db->join('penjualan b','b.SO_ID=a.SO_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('merk d','d.ID_MERK=c.MERK_ID'); $this->db->join('produk e','e.ID_PRODUK=c.PRODUK_ID'); $this->db->join('sales_order f','f.ID_SO=a.SO_ID'); if ($id_corp==NULL AND $id_merk==NULL AND $search==NULL) { if ($id_sales==NULL) { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir'"); } else { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND f.SALES_ID=$id_sales"); } } else if ($id_corp==NULL AND $id_merk==NULL AND $search!=NULL) { if ($id_sales==NULL) { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND d.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND e.NAMA_PRODUK LIKE '%$search%'"); } else { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.KODE_BARANG LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.NAMA_BARANG LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND d.NAMA_MERK LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND e.NAMA_PRODUK LIKE '%$search%' AND f.SALES_ID=$id_sales"); } } else if ($id_corp!=NULL AND $id_merk==NULL AND $search==NULL) { if ($id_sales==NULL) { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp"); } else { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND f.SALES_ID=$id_sales"); } } else if ($id_corp!=NULL AND $id_merk==NULL AND $search!=NULL) { if ($id_sales==NULL) { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND d.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND e.NAMA_PRODUK LIKE '%$search%'"); } else { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.KODE_BARANG LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.NAMA_BARANG LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND d.NAMA_MERK LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND e.NAMA_PRODUK LIKE '%$search%' AND f.SALES_ID=$id_sales"); } } else if ($id_corp==NULL AND $id_merk!=NULL AND $search==NULL) { if ($id_sales==NULL) { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk"); } else { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND f.SALES_ID=$id_sales"); } } else if ($id_corp==NULL AND $id_merk!=NULL AND $search!=NULL) { if ($id_sales==NULL) { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND d.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND e.NAMA_PRODUK LIKE '%$search%'"); } else { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND c.KODE_BARANG LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND c.NAMA_BARANG LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND d.NAMA_MERK LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND e.NAMA_PRODUK LIKE '%$search%' AND f.SALES_ID=$id_sales"); } } else if ($id_corp!=NULL AND $id_merk!=NULL AND $search==NULL) { if ($id_sales==NULL) { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk"); } else { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND f.SALES_ID=$id_sales"); } } else if ($id_corp!=NULL AND $id_merk!=NULL AND $search!=NULL) { if ($id_sales==NULL) { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND d.NAMA_MERK LIKE '%$search%'"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND e.NAMA_PRODUK LIKE '%$search%'"); } else { $this->db->where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND c.KODE_BARANG LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND c.NAMA_BARANG LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND d.NAMA_MERK LIKE '%$search%' AND f.SALES_ID=$id_sales"); $this->db->or_where("c.JENIS_ID<=7 AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND b.KOP_ID=$id_corp AND c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND e.NAMA_PRODUK LIKE '%$search%' AND f.SALES_ID=$id_sales"); } } $this->db->group_by('a.BARANG_ID'); $this->db->order_by('d.NAMA_MERK ASC, e.NAMA_PRODUK ASC, c.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byCORP_bySALES_byPELANGGAN_byJENIS_byMERK_byMODEL_byPRODUK_byKONDISI_byPERIODE_groupBARANG_status1_forSearch($id_corp=null, $id_sales=null, $id_pelanggan=null, $id_jenis=null, $id_merk=null, $id_model=null, $id_produk=null, $kondisi=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, SUM(a.QTY_DO) as TOTAL'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('penjualan c','c.SO_ID=a.SO_ID'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis e','e.ID_JENIS=d.JENIS_ID'); $this->db->join('merk f','f.ID_MERK=d.MERK_ID'); $this->db->join('model g','g.ID_MODEL=d.MODEL_ID'); $this->db->join('produk h','h.ID_PRODUK=d.PRODUK_ID'); if ($kondisi==2) { $this->db->where('e.TYPE_JENIS!=2'); } $this->db->where('c.STATUS_PENJUALAN=1'); $this->db->where('c.TGL_PENJUALAN>=', $awal); $this->db->where('c.TGL_PENJUALAN<=', $akhir); if ($id_corp!=null) { $this->db->where('b.CORP_ID=', $id_corp); } if ($id_sales!=null) { $this->db->where('b.SALES_ID=', $id_sales); } if ($id_pelanggan!=null) { $this->db->where('b.PELANGGAN_ID=', $id_pelanggan); } if ($id_jenis!=null) { $this->db->where('d.JENIS_ID=', $id_jenis); } if ($id_merk!=null) { $this->db->where('d.MERK_ID=', $id_merk); } if ($id_model!=null) { $this->db->where('d.MODEL_ID=', $id_model); } if ($id_produk!=null) { $this->db->where('d.PRODUK_ID=', $id_produk); } if ($search!=null) { $this->db->where('a.BARANG_ID=', $search); } $this->db->group_by('a.BARANG_ID'); $this->db->order_by('e.NAMA_JENIS ASC, f.NAMA_MERK ASC, g.NAMA_MODEL ASC, h.NAMA_PRODUK ASC, d.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byCORP_bySALES_byTGL_status1($id_corp=null, $id_sales=null, $tgl=null) { // Used $this->db->select('*, FORMAT((((b.PPN_SO+100)/100)*a.HARGA_DO),2) as SATUAN, FORMAT((((b.PPN_SO+100)/100)*(a.HARGA_DO*a.QTY_DO)),2) as SUBTOTAL, (a.HARGA_DO*a.QTY_DO) as NILAI, DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('penjualan c','c.SO_ID=a.SO_ID'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=b.SALES_ID'); $this->db->join('pelanggan f','f.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota g','g.ID_KOTA=f.KOTA_ID'); $this->db->where('c.STATUS_PENJUALAN=1'); $this->db->where('c.TGL_PENJUALAN=', $tgl); if ($id_corp!=null) { $this->db->where('b.CORP_ID=', $id_corp); } if ($id_sales!=null) { $this->db->where('b.SALES_ID=', $id_sales); } $this->db->order_by('e.NAMA_PANGGILAN_KARYAWAN ASC, c.TGL_PENJUALAN ASC, c.INV_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byID($id) { //Used $this->db->select('*, FORMAT(a.HARGA_DO,2) as SATUAN'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.BARANG_ID'); $this->db->where(['a.ID_DO' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byPENJUALAN($id) { // Used $this->db->select('*, FORMAT(a.HARGA_DO,2) as SATUAN, FORMAT((a.HARGA_DO*a.QTY_DO),2) as SUBTOTAL, DATE_FORMAT(e.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('penjualan e','e.SO_ID=a.SO_ID'); $this->db->join('pelanggan f','f.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('kota g','g.ID_KOTA=f.KOTA_ID'); $this->db->where(['e.ID_PENJUALAN' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byPENJUALAN_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('penjualan e','e.SO_ID=a.SO_ID'); $this->db->where(['e.ID_PENJUALAN' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byPENJUALAN_kembaliNotFull($id) { // Used $this->db->select('*,SUM(a.QTY_DO-a.RETUR_DO) as SISA'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('penjualan e','e.SO_ID=a.SO_ID'); $this->db->where('e.ID_PENJUALAN=', $id); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('SISA DESC, b.KODE_BARANG ASC'); $this->db->having('SISA>0'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byRP($id) { // Used $this->db->select('*'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('so_proyek c','c.SO_ID=a.SO_ID'); $this->db->join('proyek d','d.ID_PROYEK=c.PROYEK_ID'); $this->db->join('barang e','e.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis f','f.ID_JENIS=e.JENIS_ID'); $this->db->where('d.RP_ID=', $id); $this->db->where('f.TYPE_JENIS!=2'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_bySALES_byPERIODE_status1($id_karyawan, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('penjualan c','c.SO_ID=a.SO_ID'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=b.SALES_ID'); $this->db->join('jenis h','h.ID_JENIS=d.JENIS_ID'); $this->db->where(['b.SALES_ID' => $id_karyawan]); $this->db->where('c.TGL_PENJUALAN>=', $awal); $this->db->where('c.TGL_PENJUALAN<=', $akhir); $this->db->where('c.STATUS_PENJUALAN=1'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_bySO($id=null) { // Used if ($id==null) { $this->db->select('*'); $this->db->from('daftar_order'); $this->db->where('SO_ID is NULL'); } else { $this->db->select('*,FORMAT(a.HARGA_DO,2) as SATUAN,FORMAT((a.HARGA_DO*a.QTY_DO),2) as SUBTOTAL'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.BARANG_ID'); $this->db->join('sales_order e','e.ID_SO=a.SO_ID'); $this->db->where(['a.SO_ID' => $id]); } return $this->db->get()->result_array(); } public function getData_DaftarOrder_bySO_byBARANG($id1, $id2, $id3=null) { // Used $this->db->select('*'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.SO_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); if ($id3!=null) { $this->db->where('a.ID_DO!=', $id3); } return $this->db->get()->result_array(); } public function getData_DaftarOrder_bySO_jenisNot2($id) { // Used $this->db->select('*,DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('penjualan d','d.SO_ID=a.SO_ID'); $this->db->where(['a.SO_ID' => $id]); $this->db->where('c.TYPE_JENIS!=2'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_bySO_jenis1($id) { // Used $this->db->select('*'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.SO_ID' => $id]); $this->db->where('c.TYPE_JENIS=1'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_forKomisiNonGp($id_sales, $jenis_analisa, $awal_nota, $akhir_nota, $awal_lunas, $akhir_lunas, $produk=null) { // Used $this->db->select('*, (a.HARGA_DO*(a.QTY_DO-a.RETUR_DO)) as TOTAL, FORMAT((a.HARGA_DO*(a.QTY_DO-a.RETUR_DO)),2) as SUBTOTAL, DATE_FORMAT(d.TGL_PENJUALAN, "%d/%m/%Y") as TANGGAL, DATE_FORMAT(e.TGLLOCK_HHPDA, "%d/%m/%Y") as TGLLUNAS'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->join('penjualan d','d.SO_ID=c.ID_SO'); $this->db->join('hasil_hitungpda e','e.PENJUALAN_ID=d.ID_PENJUALAN'); $this->db->join('pelanggan f','f.ID_PELANGGAN=d.PEL_ID'); $this->db->join('kota g','g.ID_KOTA=f.KOTA_ID'); $this->db->join('jenis h','h.ID_JENIS=b.JENIS_ID'); $this->db->join('karyawan i','i.ID_KARYAWAN=c.SALES_ID'); $this->db->join('jabatan j','j.ID_JABATAN=i.JABATAN_ID'); if ($jenis_analisa==1 OR $jenis_analisa==2) { $this->db->where('c.GP_SO=0'); $this->db->where('d.STATUS_PENJUALAN=1'); $this->db->where('e.STATUS_HHPDA=1'); $this->db->where('c.SALES_ID=', $id_sales); $this->db->where('d.TGL_PENJUALAN>=', $awal_nota); $this->db->where('d.TGL_PENJUALAN<=', $akhir_nota); $this->db->where('e.TGLLOCK_HHPDA>=', $awal_lunas); $this->db->where('e.TGLLOCK_HHPDA<=', $akhir_lunas); } else if ($jenis_analisa==3) { $this->db->where("c.GP_SO=0 AND d.STATUS_PENJUALAN=1 AND e.STATUS_HHPDA=1 AND d.TGL_PENJUALAN>='$awal_nota' AND d.TGL_PENJUALAN<='$akhir_nota' AND e.TGLLOCK_HHPDA>='$awal_lunas' AND e.TGLLOCK_HHPDA<='$akhir_lunas' AND c.SALES_ID!=$id_sales AND a.SP_DO='$produk' AND j.NAMA_JABATAN LIKE '%SALES CHANNEL%'"); $this->db->or_where("c.GP_SO=0 AND d.STATUS_PENJUALAN=1 AND e.STATUS_HHPDA=1 AND d.TGL_PENJUALAN>='$awal_nota' AND d.TGL_PENJUALAN<='$akhir_nota' AND e.TGLLOCK_HHPDA>='$awal_lunas' AND e.TGLLOCK_HHPDA<='$akhir_lunas' AND c.SALES_ID!=$id_sales AND a.SP_DO='$produk' AND i.NAMA_PANGGILAN_KARYAWAN LIKE '%Anton%'"); } $this->db->order_by('d.TGL_PENJUALAN ASC, d.INV_PENJUALAN ASC, h.KOMISI_USER DESC, TOTAL DESC'); return $this->db->get()->result_array(); } public function getData_DaftarOtomasiBooster_byBARANG_byJENIS_bySTATUS($id_barang, $jenis_ob, $status) { // Used $this->db->select('*'); $this->db->from('daftar_otomasibooster a'); $this->db->join('otomasi_booster b','b.ID_OB=a.OB_ID'); $this->db->join('potongan_klaimprogram c','c.ID_PKPR=b.PKPR_ID'); $this->db->where('a.BARANG_ID=', $id_barang); $this->db->where('b.JENIS_OB=', $jenis_ob); $this->db->where('b.STATUS_OB=', $status); return $this->db->get()->result_array(); } public function getData_DaftarOtomasiBooster_byBARANG_byJENIS_bySTATUS_byLIMIT($id_barang, $jenis_ob, $status, $limit) { // Used $this->db->select('*, FORMAT(a.NILAI_DOB, 2) as NILAI, DATE_FORMAT(b.AWAL_OB,"%d/%m/%Y") as AWAL, DATE_FORMAT(b.AKHIR_OB,"%d/%m/%Y") as AKHIR'); $this->db->from('daftar_otomasibooster a'); $this->db->join('otomasi_booster b','b.ID_OB=a.OB_ID'); $this->db->join('potongan_klaimprogram c','c.ID_PKPR=b.PKPR_ID'); $this->db->where('a.BARANG_ID=', $id_barang); $this->db->where('b.JENIS_OB=', $jenis_ob); $this->db->where('b.STATUS_OB=', $status); $this->db->where('b.AWAL_OB<=', $limit); $this->db->where('b.AKHIR_OB>=', $limit); return $this->db->get()->result_array(); } public function getData_DaftarOtomasiBooster_byBARANG_bySTATUS_byLIMIT($id, $status, $limit) { // Used $this->db->select('*'); $this->db->from('daftar_otomasibooster a'); $this->db->join('otomasi_booster b','b.ID_OB=a.OB_ID'); $this->db->join('potongan_klaimprogram c','c.ID_PKPR=b.PKPR_ID'); $this->db->where('a.BARANG_ID=', $id); $this->db->where('b.STATUS_OB=', $status); $this->db->where('b.AWAL_OB<=', $limit); $this->db->where('b.AKHIR_OB>=', $limit); return $this->db->get()->result_array(); } public function getData_DaftarOtomasiBooster_byBARANG_status1($id) { // Used $this->db->select('*, DATE_FORMAT(c.AWAL_OB,"%d/%m/%Y") as AWAL, DATE_FORMAT(c.AKHIR_OB,"%d/%m/%Y") as AKHIR, FORMAT(a.NILAI_DOB, 2) as NILAI'); $this->db->from('daftar_otomasibooster a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('otomasi_booster c','c.ID_OB=a.OB_ID'); $this->db->join('potongan_klaimprogram d','d.ID_PKPR=c.PKPR_ID'); $this->db->where(['a.BARANG_ID' => $id]); $this->db->where('c.STATUS_OB=1'); return $this->db->get()->result_array(); } public function getData_DaftarOtomasiBooster_byID($id) { // Used $this->db->select('*,FORMAT(a.NILAI_DOB,2) as NILAI,DATE_FORMAT(b.AWAL_OB,"%d/%m/%Y") as AWAL,DATE_FORMAT(b.AKHIR_OB,"%d/%m/%Y") as AKHIR'); $this->db->from('daftar_otomasibooster a'); $this->db->join('otomasi_booster b','b.ID_OB=a.OB_ID'); $this->db->join('potongan_klaimprogram c','c.ID_PKPR=b.PKPR_ID'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID'); $this->db->where('a.ID_DOB=', $id); return $this->db->get()->result_array(); } public function getData_DaftarOtomasiBooster_byOB($id) { // Used $this->db->select('*,FORMAT(a.NILAI_DOB,2) as NILAI,DATE_FORMAT(b.AWAL_OB,"%d/%m/%Y") as AWAL,DATE_FORMAT(b.AKHIR_OB,"%d/%m/%Y") as AKHIR'); $this->db->from('daftar_otomasibooster a'); $this->db->join('otomasi_booster b','b.ID_OB=a.OB_ID'); $this->db->join('potongan_klaimprogram c','c.ID_PKPR=b.PKPR_ID'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID'); $this->db->where('a.OB_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarOtomasiBooster_byOB_byBARANG($id1, $id2, $id3=null) { // Used $this->db->select('*'); $this->db->from('daftar_otomasibooster'); $this->db->where(['OB_ID' => $id1]); $this->db->where(['BARANG_ID' => $id2]); if ($id3!=null) { $this->db->where('ID_DOB!=', $id3); } return $this->db->get()->result_array(); } public function getData_DaftarOtomasiBooster_byMERK_status1_groupBARANG($id) { // Used $this->db->select('*, DATE_FORMAT(d.AWAL_OB,"%d/%m/%Y") as AWAL, DATE_FORMAT(d.AKHIR_OB,"%d/%m/%Y") as AKHIR'); $this->db->from('daftar_otomasibooster a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('merk c','c.ID_MERK=b.MERK_ID'); $this->db->join('otomasi_booster d','d.ID_OB=a.OB_ID'); if ($id==0) { } else { $this->db->where(['b.MERK_ID' => $id]); } $this->db->where('d.STATUS_OB=1'); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getData_DaftarPenarikanKonsi_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_penarikankonsi a'); $this->db->join('penarikan_konsi b','b.ID_PK=a.PK_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.ID_DPK' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarPenarikanKonsi_byPK($id) { // Used $this->db->select('*'); $this->db->from('daftar_penarikankonsi a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('penarikan_konsi d','d.ID_PK=a.PK_ID'); $this->db->where('a.PK_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarPenarikanKonsi_byPK_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_penarikankonsi a'); $this->db->join('penarikan_konsi b','b.ID_PK=a.PK_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.PK_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarPenarikanService_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_penarikanservice a'); $this->db->join('penarikan_service b','b.ID_PSV=a.PSV_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.ID_DPSV' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarPenarikanService_byPSV($id) { // Used $this->db->select('*'); $this->db->from('daftar_penarikanservice a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('penarikan_service d','d.ID_PSV=a.PSV_ID'); $this->db->where('a.PSV_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarPenarikanService_byPSV_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_penarikanservice a'); $this->db->join('penarikan_service b','b.ID_PSV=a.PSV_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.PSV_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarPenarikanSewa_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_penarikansewa a'); $this->db->join('penarikan_sewa b','b.ID_PS=a.PS_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.ID_DPS' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarPenarikanSewa_byPS($id) { // Used $this->db->select('*'); $this->db->from('daftar_penarikansewa a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('penarikan_sewa d','d.ID_PS=a.PS_ID'); $this->db->where('a.PS_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarPenarikanSewa_byPS_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_penarikansewa a'); $this->db->join('penarikan_sewa b','b.ID_PS=a.PS_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.PS_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarPenawaran_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_penawaran a'); $this->db->join('penawaran b','b.ID_PENAWARAN=a.PENAWARAN_ID'); $this->db->where(['a.ID_DPNE' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarPenawaran_byPENAWARAN_byVERSI($id, $versi) { // Used $this->db->select('*, FORMAT(a.HARGA_DPNE, 2) as HARGA, FORMAT((a.HARGA_DPNE*a.QTY_DPNE), 2) as SUBTOTAL, FORMAT((a.HARGA_DPNE*((100+b.PPN_PENAWARAN)/100)), 2) as HARGAIN, FORMAT((a.HARGA_DPNE*a.QTY_DPNE)*((100+b.PPN_PENAWARAN)/100), 2) as SUBTOTALIN'); $this->db->from('daftar_penawaran a'); $this->db->join('penawaran b','b.ID_PENAWARAN=a.PENAWARAN_ID'); $this->db->join('satuan c','c.ID_SATUAN=a.SATUAN_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SAL_ID','left'); $this->db->where(['a.PENAWARAN_ID' => $id]); $this->db->where(['a.VERSI_DPNE' => $versi]); $this->db->order_by('a.ID_DPNE ASC'); return $this->db->get()->result_array(); } public function getData_DaftarPengadaan_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_pengadaan a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.ID_DPG' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarPengadaan_byPENGADAAN($id) { // Used $this->db->select('*, FORMAT((a.HARGA_DPG-a.DISKON_DPG), 2) as SATUAN, FORMAT(a.HARGA_DPG, 2) as HARGA, FORMAT(a.DISKON_DPG, 2) as DISKON, FORMAT(((a.HARGA_DPG-a.DISKON_DPG)*a.QTY_DPG), 2) as SUBTOTAL, FORMAT((a.HARGA_DPG*(111/100)), 2) as HARGAIN, FORMAT((a.DISKON_DPG*(111/100)), 2) as DISKONIN, FORMAT(((a.HARGA_DPG-a.DISKON_DPG)*a.QTY_DPG)*(111/100), 2) as SUBTOTALIN'); $this->db->from('daftar_pengadaan a'); $this->db->join('pengadaan b','b.ID_PENGADAAN=a.PENGADAAN_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.PENGADAAN_ID' => $id]); $this->db->order_by('a.ID_DPG ASC'); return $this->db->get()->result_array(); } public function getData_DaftarPengadaan_byPENGADAAN_byBARANG($id1, $id2, $id3=null) { // Used $this->db->select('*'); $this->db->from('daftar_pengadaan'); $this->db->where(['PENGADAAN_ID' => $id1]); $this->db->where(['BARANG_ID' => $id2]); if ($id3!=null) { $this->db->where('ID_DPG!=', $id3); } return $this->db->get()->result_array(); } public function getData_DaftarPinjam_byBARANG_byGUDANG_bySTATUS($id, $gudang, $status) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_PEMINJAMAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_pinjam a'); $this->db->join('peminjaman b','b.ID_PEMINJAMAN=a.PEMINJAMAN_ID'); $this->db->where('a.BARANG_ID=', $id); $this->db->where('b.JENIS_PEMINJAMAN=', $gudang); $this->db->where('b.STATUS_PEMINJAMAN=', $status); return $this->db->get()->result_array(); } public function getData_DaftarPinjam_byBARANG_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_PEMINJAMAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_pinjam a'); $this->db->join('peminjaman b','b.ID_PEMINJAMAN=a.PEMINJAMAN_ID'); $this->db->where('a.BARANG_ID=', $id); $this->db->where('b.STATUS_PEMINJAMAN=', $status); return $this->db->get()->result_array(); } public function getData_DaftarPinjam_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_pinjam a'); $this->db->join('peminjaman b','b.ID_PEMINJAMAN=a.PEMINJAMAN_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.ID_DFP' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarPinjam_byPEMINJAMAN($id) { // Used $this->db->select('*'); $this->db->from('daftar_pinjam a'); $this->db->join('peminjaman b','b.ID_PEMINJAMAN=a.PEMINJAMAN_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where('a.PEMINJAMAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarPinjam_byPEMINJAMAN_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_pinjam a'); $this->db->join('peminjaman b','b.ID_PEMINJAMAN=a.PEMINJAMAN_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.PEMINJAMAN_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarPricelist_byID($id) { // Used $this->db->select('*, FORMAT(a.MDP_DFPL, 0) as MDP, FORMAT(a.DEALER_DFPL, 0) as DEALER, FORMAT(a.SRP_DFPL, 0) as SRP, FORMAT(a.MSRP_DFPL, 0) as MSRP, (d.PCM_KUANTITI+d.ITP_KUANTITI) as TOTAL, FORMAT(a.OFF_COMPETE_DFPL, 0) as OFFCOMPETE, FORMAT(a.OFF_SPECIAL_DFPL, 0) as OFFSPECIAL , FORMAT(a.ON_COMPETE_DFPL, 0) as ONCOMPETE, FORMAT(a.ON_TECHNOSIFY_DFPL, 0) as ONTECHNOSIFY, FORMAT(a.ON_ITP_DFPL, 0) as ONITP'); $this->db->from('daftar_pricelist a'); $this->db->join('submenu_pricelist b','b.ID_SMPL=a.SMPL_ID'); $this->db->join('pricelist c','c.ID_PRICELIST=b.PRICELIST_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.BARANG_ID','left'); $this->db->where('a.ID_DFPL=', $id); return $this->db->get()->result_array(); } public function getData_DaftarPricelist_byPRICELIST($id, $search=null, $filter=null) { // Used $this->db->select('*, FORMAT(a.MDP_DFPL, 0) as MDP, FORMAT(a.DEALER_DFPL, 0) as DEALER, FORMAT(a.SRP_DFPL, 0) as SRP, FORMAT(a.MSRP_DFPL, 0) as MSRP, (d.PCM_KUANTITI+d.ITP_KUANTITI) as TOTAL'); $this->db->from('daftar_pricelist a'); $this->db->join('submenu_pricelist b','b.ID_SMPL=a.SMPL_ID'); $this->db->join('pricelist c','c.ID_PRICELIST=b.PRICELIST_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.BARANG_ID','left'); if ($search==null) { $this->db->where('b.PRICELIST_ID=', $id); } else { foreach ($search as $key) { if ($filter==2) { $this->db->where("b.PRICELIST_ID=$id AND a.MODEL_DFPL LIKE '%$key%'"); } else if ($filter==3) { $this->db->where("b.PRICELIST_ID=$id AND a.MTM_DFPL LIKE '%$key%'"); } else if ($filter==4) { $this->db->where("b.PRICELIST_ID=$id AND a.PN_DFPL LIKE '%$key%'"); } else if ($filter==5) { $this->db->where("b.PRICELIST_ID=$id AND a.DESKRIPSI_DFPL LIKE '%$key%'"); } else if ($filter==6) { $this->db->where("b.PRICELIST_ID=$id AND a.DEALER_DFPL LIKE '%$key%'"); } else if ($filter==7) { $this->db->where("b.PRICELIST_ID=$id AND a.SRP_DFPL LIKE '%$key%'"); } else if ($filter==8) { $this->db->where("b.PRICELIST_ID=$id AND a.MSRP_DFPL LIKE '%$key%'"); } else if ($filter==11) { $this->db->where("b.PRICELIST_ID=$id AND a.MDP_DFPL LIKE '%$key%'"); } } } return $this->db->get()->result_array(); } public function getData_DaftarPricelist_bySMPL($id) { // Used $this->db->select('*, FORMAT(a.DEALER_DFPL, 0) as DEALER, FORMAT(a.SRP_DFPL, 0) as SRP, FORMAT(a.MSRP_DFPL, 0) as MSRP, (d.PCM_KUANTITI+d.ITP_KUANTITI) as TOTAL'); $this->db->from('daftar_pricelist a'); $this->db->join('submenu_pricelist b','b.ID_SMPL=a.SMPL_ID'); $this->db->join('pricelist c','c.ID_PRICELIST=b.PRICELIST_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.BARANG_ID','left'); $this->db->where('a.SMPL_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarPricelist_bySMPL_orderURUTAN($id, $search=null, $filter=null) { // Used $this->db->select('*, FORMAT(a.MDP_DFPL, 0) as MDP, FORMAT(a.DEALER_DFPL, 0) as DEALER, FORMAT(a.SRP_DFPL, 0) as SRP, FORMAT(a.MSRP_DFPL, 0) as MSRP, (d.PCM_KUANTITI+d.ITP_KUANTITI) as TOTAL'); $this->db->from('daftar_pricelist a'); $this->db->join('submenu_pricelist b','b.ID_SMPL=a.SMPL_ID'); $this->db->join('pricelist c','c.ID_PRICELIST=b.PRICELIST_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.BARANG_ID','left'); if ($search==null) { $this->db->where('a.SMPL_ID=', $id); $this->db->order_by('a.URUTAN_DFPL ASC'); } else { foreach ($search as $key) { if ($filter==2) { $this->db->where("a.SMPL_ID=$id AND a.MODEL_DFPL LIKE '%$key%'"); } else if ($filter==3) { $this->db->where("a.SMPL_ID=$id AND a.MTM_DFPL LIKE '%$key%'"); } else if ($filter==4) { $this->db->where("a.SMPL_ID=$id AND a.PN_DFPL LIKE '%$key%'"); } else if ($filter==5) { $this->db->where("a.SMPL_ID=$id AND a.DESKRIPSI_DFPL LIKE '%$key%'"); } else if ($filter==6) { $this->db->where("a.SMPL_ID=$id AND a.DEALER_DFPL LIKE '%$key%'"); } else if ($filter==7) { $this->db->where("a.SMPL_ID=$id AND a.SRP_DFPL LIKE '%$key%'"); } else if ($filter==8) { $this->db->where("a.SMPL_ID=$id AND a.MSRP_DFPL LIKE '%$key%'"); } else if ($filter==11) { $this->db->where("a.SMPL_ID=$id AND a.MDP_DFPL LIKE '%$key%'"); } } } return $this->db->get()->result_array(); } public function getData_DaftarPricelist_bySMPL_afterAwal_beforePengganti($id, $awal, $pengganti) { // Used $this->db->select('*'); $this->db->from('daftar_pricelist a'); $this->db->join('submenu_pricelist b','b.ID_SMPL=a.SMPL_ID'); $this->db->where(['a.SMPL_ID' => $id]); $this->db->where('a.URUTAN_DFPL>', $awal); $this->db->where('a.URUTAN_DFPL<=', $pengganti); $this->db->order_by('a.URUTAN_DFPL ASC'); return $this->db->get()->result_array(); } public function getData_DaftarPricelist_bySMPL_beforeAwal_afterPengganti($id, $awal, $pengganti) { // Used $this->db->select('*'); $this->db->from('daftar_pricelist a'); $this->db->join('submenu_pricelist b','b.ID_SMPL=a.SMPL_ID'); $this->db->where(['a.SMPL_ID' => $id]); $this->db->where('a.URUTAN_DFPL>', $awal); $this->db->where('a.URUTAN_DFPL<=', $pengganti); $this->db->order_by('a.URUTAN_DFPL ASC'); return $this->db->get()->result_array(); } public function getData_DaftarProforma_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_proforma a'); $this->db->join('proforma b','b.ID_PF=a.PF_ID'); $this->db->where('a.ID_DPF=', $id); return $this->db->get()->result_array(); } public function getData_DaftarProforma_byPF($id) { // Used $this->db->select('*'); $this->db->from('daftar_proforma a'); $this->db->join('proforma b','b.ID_PF=a.PF_ID'); $this->db->where('a.PF_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarPromoClearance_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_promoclearance a'); $this->db->join('promo_clearance b','b.ID_PC=a.PC_ID'); $this->db->where('a.ID_DPC=', $id); $this->db->where('b.STATUS_PC=1'); return $this->db->get()->result_array(); } public function getData_DaftarPromoClearance_byKARYAWAN_bySTATUS($id=null, $status) { // Used $this->db->select('*'); $this->db->from('daftar_promoclearance a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('promo_clearance d','d.ID_PC=a.PC_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=c.PELANGGAN_ID'); if ($id!=null) { $this->db->where('c.SALES_ID=', $id); } $this->db->where('a.STATUS_DPC=', $status); return $this->db->get()->result_array(); } public function getData_DaftarPromoClearance_byPENJUALAN($id) { // Used $this->db->select('*'); $this->db->from('daftar_promoclearance'); $this->db->where('PENJUALAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($id_sales, $awal, $akhir, $jenis, $search=null) { // Used $this->db->select('*, DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_promoclearance a'); $this->db->join('promo_clearance b','b.ID_PC=a.PC_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('daftar_order d','d.SO_ID=c.SO_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); $this->db->join('barang f','f.ID_BARANG=b.BARANG_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=e.SALES_ID'); $this->db->join('pelanggan h','h.ID_PELANGGAN=e.PELANGGAN_ID'); $this->db->join('kota i','i.ID_KOTA=h.KOTA_ID'); if ($search==null) { $this->db->where("b.BARANG_ID=d.BARANG_ID AND c.STATUS_PENJUALAN=1 AND e.SALES_ID=$id_sales AND f.JENIS_ID=$jenis AND c.TGL_PENJUALAN>='$awal' AND c.TGL_PENJUALAN<='$akhir'"); } else { $this->db->where("b.BARANG_ID=d.BARANG_ID AND c.STATUS_PENJUALAN=1 AND e.SALES_ID=$id_sales AND f.JENIS_ID=$jenis AND c.TGL_PENJUALAN>='$awal' AND c.TGL_PENJUALAN<='$akhir' AND e.KODE_SO LIKE '%$search%'"); $this->db->or_where("b.BARANG_ID=d.BARANG_ID AND c.STATUS_PENJUALAN=1 AND e.SALES_ID=$id_sales AND f.JENIS_ID=$jenis AND c.TGL_PENJUALAN>='$awal' AND c.TGL_PENJUALAN<='$akhir' AND h.NAMA_PELANGGAN LIKE '%$search%'"); } return $this->db->get()->result_array(); } public function getData_DaftarPromoClearance_bySALES_byPERIODE_byJENIS($id1=null, $id2, $id3) { // Used $this->db->select('*, DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, FORMAT(d.HARGA_DO, 2) as NILAI'); $this->db->from('daftar_promoclearance a'); $this->db->join('promo_clearance b','b.ID_PC=a.PC_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('daftar_order d','d.SO_ID=c.SO_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); $this->db->join('barang f','f.ID_BARANG=b.BARANG_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=e.SALES_ID'); $this->db->join('pelanggan h','h.ID_PELANGGAN=e.PELANGGAN_ID'); $this->db->join('kota i','i.ID_KOTA=h.KOTA_ID'); if ($id1!=null) { $this->db->where('e.SALES_ID=', $id1); } else { $this->db->not_like('g.USERNAME', 'none'); $this->db->not_like('g.USERNAME', 'insentive'); } $this->db->where('c.TGL_PENJUALAN>=', $id2); $this->db->where('f.JENIS_ID', $id3); $this->db->where('c.STATUS_PENJUALAN=1'); $this->db->where('b.BARANG_ID=d.BARANG_ID'); return $this->db->get()->result_array(); } public function getData_DaftarProyek_byBARANG_bySTATUS_groupPROYEK_groupBARANG($id, $status) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_PROYEK,"%d/%m/%Y") as TANGGAL,SUM(a.KELUAR_DPR-a.MASUK_DPR) as QTY'); $this->db->from('daftar_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->where('a.BARANG_ID=', $id); $this->db->where('b.STATUS_PROYEK=', $status); $this->db->group_by('a.PROYEK_ID, a.BARANG_ID'); return $this->db->get()->result_array(); } public function getData_DaftarProyek_byCD($id) { // Used $this->db->select('*'); $this->db->from('daftar_proyek a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.CD_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarProyek_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_proyek'); $this->db->where(['ID_DPR' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarProyek_byPROYEK($id) { // Used $this->db->select('*'); $this->db->from('daftar_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.PROYEK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarProyek_byPROYEK_byBARANG_CDNull($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.PROYEK_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); $this->db->where('a.CD_ID is NULL'); return $this->db->get()->result_array(); } public function getData_DaftarProyek_byPROYEK_byCD($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_proyek a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.PROYEK_ID' => $id1]); $this->db->where(['a.CD_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarProyek_byPROYEK_bySJ($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_proyek a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.PROYEK_ID' => $id1]); $this->db->where(['a.SJ_DPR' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarProyek_byPROYEK_CDNull($id) { // Used $this->db->select('*'); $this->db->from('daftar_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.PROYEK_ID' => $id]); $this->db->where('a.CD_ID is NULL'); return $this->db->get()->result_array(); } public function getData_DaftarProyek_byRP($id) { // Used $this->db->select('*, SUM(a.KELUAR_DPR-a.MASUK_DPR) as QTY'); $this->db->from('daftar_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->where(['b.RP_ID' => $id]); $this->db->group_by('a.PROYEK_ID'); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_byCORP_jenis1($id, $awal, $akhir, $status=null) { // Used $this->db->select('*,FORMAT(a.DPP_DRPJ,2) as DPP,DATE_FORMAT(b.TGL_RPJ,"%d/%m/%Y") as TGLRPJ,DATE_FORMAT(e.TGL_PENJUALAN,"%d/%m/%Y") as TGLJUAL'); $this->db->from('daftar_rekappajak a'); $this->db->join('rekap_pajak b','b.ID_RPJ=a.RPJ_ID'); $this->db->join('pajak_dibayardimuka c','c.ID_PDD=a.PDD_ID'); $this->db->join('pajak_penghasilan d','d.ID_PPH=c.PPH_ID'); $this->db->join('penjualan e','e.ID_PENJUALAN=c.PEN_ID'); $this->db->join('wajibpajak f','f.ID_WAJIBPAJAK=b.WAJIBPAJAK_ID','left'); $this->db->where('b.JENIS_RPJ=1'); $this->db->where('b.CORP_ID=', $id); $this->db->where('b.TGL_RPJ>=', $awal); $this->db->where('b.TGL_RPJ<=', $akhir); if ($status!=9) { $this->db->where('b.STATUS_RPJ=', $status); } $this->db->order_by('b.TGL_RPJ ASC'); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_byCORP_jenis2($id, $awal, $akhir, $status=null) { // Used $this->db->select('*,FORMAT(a.DPP_DRPJ,2) as DPP,DATE_FORMAT(b.TGL_RPJ,"%d/%m/%Y") as TGLRPJ,DATE_FORMAT(e.TGL_PENJUALAN,"%d/%m/%Y") as TGLJUAL'); $this->db->from('daftar_rekappajak a'); $this->db->join('rekap_pajak b','b.ID_RPJ=a.RPJ_ID'); $this->db->join('pajak_dibayardimuka c','c.ID_PDD=a.PDD_ID'); $this->db->join('pajak_penghasilan d','d.ID_PPH=c.PPH_ID'); $this->db->join('penjualan e','e.ID_PENJUALAN=c.PEN_ID'); $this->db->join('wajibpajak f','f.ID_WAJIBPAJAK=b.WAJIBPAJAK_ID','left'); $this->db->where('b.JENIS_RPJ=2'); $this->db->where('b.CORP_ID=', $id); $this->db->where('b.TGL_RPJ>=', $awal); $this->db->where('b.TGL_RPJ<=', $akhir); if ($status!=9) { $this->db->where('b.STATUS_RPJ=', $status); } $this->db->order_by('b.TGL_RPJ ASC'); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_byCORP_jenis3($id, $awal, $akhir, $status=null) { // Used $this->db->select('*,FORMAT(a.DPP_DRPJ,2) as DPP,DATE_FORMAT(b.TGL_RPJ,"%d/%m/%Y") as TGLRPJ,DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m/%Y") as TGLJUAL'); $this->db->from('daftar_rekappajak a'); $this->db->join('rekap_pajak b','b.ID_RPJ=a.RPJ_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order d','d.ID_SO=c.SO_ID'); $this->db->join('wajibpajak e','e.ID_WAJIBPAJAK=b.WAJIBPAJAK_ID','left'); $this->db->where('b.JENIS_RPJ=3'); $this->db->where('b.CORP_ID=', $id); $this->db->where('b.TGL_RPJ>=', $awal); $this->db->where('b.TGL_RPJ<=', $akhir); if ($status!=9) { $this->db->where('b.STATUS_RPJ=', $status); } $this->db->order_by('b.TGL_RPJ ASC'); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_rekappajak'); $this->db->where(['ID_DRPJ' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_byPDD($id) { // Used $this->db->select('*'); $this->db->from('daftar_rekappajak'); $this->db->where(['PDD_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_byPENJUALAN($id) { // Used $this->db->select('*'); $this->db->from('daftar_rekappajak a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->where(['a.PENJUALAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_byRPJ_DPPNotNull($id) { // Used $this->db->select('*,FORMAT(a.DPP_DRPJ,2) as NILAI'); $this->db->from('daftar_rekappajak a'); $this->db->join('pajak_dibayardimuka b','b.ID_PDD=a.PDD_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=b.PEN_ID'); $this->db->join('pajak_penghasilan d','d.ID_PPH=b.PPH_ID'); $this->db->where(['a.RPJ_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_byRPJ_PenjualanNotNull($id) { // Used $this->db->select('*,FORMAT(a.DPP_DRPJ,2) as NILAI'); $this->db->from('daftar_rekappajak a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->where(['a.RPJ_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_RPJNull_PPH22Only() { // Used $this->db->select('*'); $this->db->from('daftar_rekappajak a'); $this->db->join('pajak_dibayardimuka b','b.ID_PDD=a.PDD_ID'); $this->db->join('pajak_penghasilan c','c.ID_PPH=b.PPH_ID'); $this->db->where('a.RPJ_ID is NULL'); $this->db->where('c.KODE_PPH=22'); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_RPJNull_PPH23Only() { // Used $this->db->select('*'); $this->db->from('daftar_rekappajak a'); $this->db->join('pajak_dibayardimuka b','b.ID_PDD=a.PDD_ID'); $this->db->join('pajak_penghasilan c','c.ID_PPH=b.PPH_ID'); $this->db->where('a.RPJ_ID is NULL'); $this->db->where('c.KODE_PPH=23'); return $this->db->get()->result_array(); } public function getData_DaftarRekapPajak_RPJNull_PPNOnly() { // Used $this->db->select('*'); $this->db->from('daftar_rekappajak a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->where('a.RPJ_ID is NULL'); $this->db->where('b.STATUS_PENJUALAN=1'); return $this->db->get()->result_array(); } public function getData_DaftarReturBeli_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_returbeli a'); $this->db->join('retur_pembelian b','b.ID_RB=a.RB_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('pembelian d','d.ID_PEMBELIAN=b.PEMBELIAN_ID'); $this->db->join('jenis e','e.ID_JENIS=c.JENIS_ID'); $this->db->where('a.ID_DRB=', $id); return $this->db->get()->result_array(); } public function getData_DaftarReturBeli_byRB($id) { // Used $this->db->select('*, FORMAT(a.HARGA_DRB, 2) as SATUAN, FORMAT((a.HARGA_DRB*a.QTY_DRB), 2) as SUBTOTAL'); $this->db->from('daftar_returbeli a'); $this->db->join('retur_pembelian b','b.ID_RB=a.RB_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->join('pembelian e','e.ID_PEMBELIAN=b.PEMBELIAN_ID'); $this->db->where('a.RB_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarReturBeli_byRB_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_returbeli'); $this->db->where(['RB_ID' => $id1]); $this->db->where(['BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarReturJual_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_returjual a'); $this->db->join('retur_penjualan b','b.ID_RJ=a.RJ_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('penjualan d','d.ID_PENJUALAN=b.PENJUALAN_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); $this->db->join('jenis f','f.ID_JENIS=c.JENIS_ID'); $this->db->where('a.ID_DRJ=', $id); return $this->db->get()->result_array(); } public function getData_DaftarReturJual_byRJ($id) { // Used $this->db->select('*'); $this->db->from('daftar_returjual a'); $this->db->join('retur_penjualan b','b.ID_RJ=a.RJ_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->join('penjualan e','e.ID_PENJUALAN=b.PENJUALAN_ID'); $this->db->where('a.RJ_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarReturJual_byRJ_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_returjual'); $this->db->where(['RJ_ID' => $id1]); $this->db->where(['BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarReturJual_bySALES_byPERIODE_status1($id_karyawan, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_INPUT,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_returjual a'); $this->db->join('retur_penjualan b','b.ID_RJ=a.RJ_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=b.PENJUALAN_ID'); $this->db->join('sales_order d','d.ID_SO=c.SO_ID'); $this->db->join('barang e','e.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis f','f.ID_JENIS=e.JENIS_ID'); $this->db->where(['d.SALES_ID' => $id_karyawan]); $this->db->where('b.TGL_INPUT>=', $awal); $this->db->where('b.TGL_INPUT<=', $akhir); $this->db->where('b.STATUS_RJ=1'); return $this->db->get()->result_array(); } public function getData_DaftarRumusGp_byID($id) { // Used $this->db->select('*,FORMAT(a.BAWAH_DRGP,2) as BAWAH,FORMAT(a.ATAS_DRGP,2) as ATAS'); $this->db->from('daftar_rumusgp a'); $this->db->join('rumus_gp b','b.ID_RGP=a.RGP_ID'); $this->db->where(['a.ID_DRGP' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarRumusGp_byRGP($id) { // Used $this->db->select('*,FORMAT(a.BAWAH_DRGP,2) as BAWAH,FORMAT(a.ATAS_DRGP,2) as ATAS,FORMAT((a.RATE_DRGP*100),2) as RATE'); $this->db->from('daftar_rumusgp a'); $this->db->join('rumus_gp b','b.ID_RGP=a.RGP_ID'); $this->db->where(['a.RGP_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarRumusGp_byRGP_byGP($id, $gp) { // Used $this->db->select('*, FORMAT((a.RATE_DRGP*100),2) as RATE'); $this->db->from('daftar_rumusgp a'); $this->db->join('rumus_gp b','b.ID_RGP=a.RGP_ID'); $this->db->where(['a.RGP_ID' => $id]); $this->db->where('a.BAWAH_DRGP<=', $gp); $this->db->where('a.ATAS_DRGP>=', $gp); return $this->db->get()->result_array(); } public function getData_DaftarRumusGp_byRGP_orderDESC_limit1($id1, $id2=null) { // Used $this->db->select('*,FORMAT(a.BAWAH_DRGP,2) as BAWAH,FORMAT(a.ATAS_DRGP,2) as ATAS'); $this->db->from('daftar_rumusgp a'); $this->db->join('rumus_gp b','b.ID_RGP=a.RGP_ID'); $this->db->where(['a.RGP_ID' => $id1]); if ($id2!=null) { $this->db->where('a.ID_DRGP<', $id2); } $this->db->order_by('a.ID_DRGP DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_DaftarService_byBARANG_byJENIS_bySTATUS_byORDER($barang, $jenis, $status, $order) { // Used $this->db->select('*'); $this->db->from('daftar_service a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('service d','d.ID_SERVICE=a.SERVICE_ID'); $this->db->where('a.BARANG_ID=', $barang); $this->db->where('d.JENIS_SERVICE=', $jenis); $this->db->where('d.STATUS_SERVICE=', $status); if ($order==1) { $this->db->order_by('a.ID_DFS ASC'); } else if ($order==2) { $this->db->order_by('a.ID_DFS DESC'); } return $this->db->get()->result_array(); } public function getData_DaftarService_bySERVICE_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_service 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('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.SERVICE_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarService_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_service 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('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.ID_DFS' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarService_byJENIS_bySTATUS_groupBARANG($id1, $id2) { // Used $this->db->select('*, SUM(a.QTY_DFS-a.KEMBALI_DFS) as SISA'); $this->db->from('daftar_service 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('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['b.JENIS_SERVICE' => $id1]); $this->db->where(['b.STATUS_SERVICE' => $id2]); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getData_DaftarService_byJENIS_bySTATUS_kembaliNotFull($jenis, $status) { // Used $this->db->select('*,SUM(a.QTY_DFS-a.KEMBALI_DFS) as SISA'); $this->db->from('daftar_service a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('service d','d.ID_SERVICE=a.SERVICE_ID'); $this->db->where('d.JENIS_SERVICE=', $jenis); $this->db->where('d.STATUS_SERVICE=', $status); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('SISA DESC, b.KODE_BARANG ASC'); $this->db->having('SISA>0'); return $this->db->get()->result_array(); } public function getData_DaftarService_bySERVICE($id) { // Used $this->db->select('*'); $this->db->from('daftar_service a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('service d','d.ID_SERVICE=a.SERVICE_ID'); $this->db->where('a.SERVICE_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarSewa_byBARANG_byPELANGGAN_bySTATUS_byORDER($barang, $pelanggan, $status, $order) { // Used $this->db->select('*'); $this->db->from('daftar_sewa a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sewa d','d.ID_SEWA=a.SEWA_ID'); $this->db->where('a.BARANG_ID=', $barang); $this->db->where('d.PELANGGAN_ID=', $pelanggan); $this->db->where('d.STATUS_SEWA=', $status); if ($order==1) { $this->db->order_by('a.ID_DFSW ASC'); } else if ($order==2) { $this->db->order_by('a.ID_DFSW DESC'); } return $this->db->get()->result_array(); } public function getData_DaftarSewa_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_sewa a'); $this->db->join('sewa b','b.ID_SEWA=a.SEWA_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.ID_DFSW' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarSewa_byPELANGGAN_bySTATUS_kembaliNotFull($id, $status) { // Used $this->db->select('*,SUM(a.QTY_DFSW-a.KEMBALI_DFSW) as SISA'); $this->db->from('daftar_sewa a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sewa d','d.ID_SEWA=a.SEWA_ID'); $this->db->where('d.PELANGGAN_ID=', $id); $this->db->where('d.STATUS_SEWA=', $status); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('SISA DESC, b.KODE_BARANG ASC'); $this->db->having('SISA>0'); return $this->db->get()->result_array(); } public function getData_DaftarSewa_bySEWA($id) { // Used $this->db->select('*'); $this->db->from('daftar_sewa a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sewa d','d.ID_SEWA=a.SEWA_ID'); $this->db->where('a.SEWA_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarSewa_bySEWA_byBARANG($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_sewa a'); $this->db->join('sewa b','b.ID_SEWA=a.SEWA_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.SEWA_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarSjParsial_byCD($id) { // Used $this->db->select('*'); $this->db->from('daftar_sjparsial a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.BARANG_ID'); $this->db->join('sales_order e','e.ID_SO=a.SO_ID'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=e.SALES_ID'); $this->db->join('cetak_dokumen h','h.ID_CD=a.CD_ID'); $this->db->where(['a.CD_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarSjParsial_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_sjparsial a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.BARANG_ID'); $this->db->where(['a.ID_SJP' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarSjParsial_byID_CDNull($id) { // Used $this->db->select('*'); $this->db->from('daftar_sjparsial a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.ID_SJP' => $id]); $this->db->where('a.CD_ID is NULL'); return $this->db->get()->result_array(); } public function getData_DaftarSjParsial_byPERIODE_groupCD($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(c.TGL_CD,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_sjparsial a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('cetak_dokumen c','c.ID_CD=a.CD_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=d.SALES_ID'); $this->db->where('c.TGL_CD>=', $awal); $this->db->where('c.TGL_CD<=', $akhir); $this->db->group_by('a.CD_ID'); return $this->db->get()->result_array(); } public function getData_DaftarSjParsial_byPERIODE_notCetak_groupCD($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(c.TGL_CD,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_sjparsial a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('cetak_dokumen c','c.ID_CD=a.CD_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=d.SALES_ID'); $this->db->join('histori_cetakdokumen h','h.CD_ID=c.ID_CD','left'); $this->db->where('h.ID_HCD is NULL'); $this->db->where('c.TGL_CD>=', $awal); $this->db->where('c.TGL_CD<=', $akhir); $this->db->group_by('a.CD_ID'); return $this->db->get()->result_array(); } public function getData_DaftarSjParsial_bySO($id) { // Used $this->db->select('*'); $this->db->from('daftar_sjparsial a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->where(['a.SO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarSjParsial_bySO_byBARANG_CDNull($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_sjparsial a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->where(['a.SO_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); $this->db->where('a.CD_ID is NULL'); return $this->db->get()->result_array(); } public function getData_DaftarSjParsial_bySO_CDNull($id) { // Used $this->db->select('*'); $this->db->from('daftar_sjparsial a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('kuantiti e','e.ID_KUANTITI=a.BARANG_ID'); $this->db->where(['a.SO_ID' => $id]); $this->db->where('a.CD_ID is NULL'); return $this->db->get()->result_array(); } public function getData_DaftarSjParsial_bySO_CDNotNull_groupCD($id) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_CD,"%d/%m/%Y") as TANGGAL'); $this->db->from('daftar_sjparsial a'); $this->db->join('cetak_dokumen b','b.ID_CD=a.CD_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->where('a.SO_ID=', $id); $this->db->where('a.CD_ID is NOT NULL'); $this->db->group_by('a.CD_ID'); return $this->db->get()->result_array(); } public function getData_DaftarSjService_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_sjservice a'); $this->db->join('sj_service b','b.ID_SJS=a.SJS_ID'); $this->db->where('a.ID_DFSJS=', $id); return $this->db->get()->result_array(); } public function getData_DaftarSjService_bySJS($id) { // Used $this->db->select('*'); $this->db->from('daftar_sjservice a'); $this->db->join('sj_service b','b.ID_SJS=a.SJS_ID'); $this->db->join('sn_service c','c.ID_SNS=a.SNS_ID'); $this->db->join('unitservice d','d.ID_UNITSERVICE=c.UNITSERVICE_ID'); $this->db->where('a.SJS_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarSjService_bySJS_bySNS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('daftar_sjservice'); $this->db->where('SJS_ID=', $id1); $this->db->where('SNS_ID=', $id2); return $this->db->get()->result_array(); } public function getData_DaftarTtKosong_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_ttkosong a'); $this->db->join('tt_kosong b','b.ID_TK=a.TK_ID'); $this->db->where(['a.ID_DTK' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarTtKosong_byTK_orderASC($id) { // Used $this->db->select('*'); $this->db->from('daftar_ttkosong a'); $this->db->join('tt_kosong b','b.ID_TK=a.TK_ID'); $this->db->where(['a.TK_ID' => $id]); $this->db->order_by('a.ID_DTK ASC'); return $this->db->get()->result_array(); } public function getData_DaftarTtNota_byID($id) { // Used $this->db->select('*'); $this->db->from('daftar_ttnota a'); $this->db->join('tt_nota b','b.ID_TN=a.TN_ID'); $this->db->where(['a.ID_DTN' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarTtNota_byTN_orderASC($id) { // Used $this->db->select('*'); $this->db->from('daftar_ttnota a'); $this->db->join('tt_nota b','b.ID_TN=a.TN_ID'); $this->db->where(['a.TN_ID' => $id]); $this->db->order_by('a.ID_DTN ASC'); return $this->db->get()->result_array(); } public function getData_DaftarTtNota_byTN_orderASC_cetakOnly($id) { // Used $this->db->select('*'); $this->db->from('daftar_ttnota a'); $this->db->join('tt_nota b','b.ID_TN=a.TN_ID'); $this->db->where(['a.TN_ID' => $id]); $this->db->where('a.STATUS_DTN=1'); $this->db->order_by('a.ID_DTN ASC'); return $this->db->get()->result_array(); } public function getData_DetailPengadaanMix_byDPG_byMIX($id1, $id2) { // Used $this->db->select('*'); $this->db->from('detail_pengadaan_mix a'); $this->db->join('daftar_pengadaan b','b.ID_DPG=a.MIX_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->where(['a.DPG_ID' => $id1]); $this->db->where(['a.MIX_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DetailPengadaanMix_byDPG_forMix($id) { // Used $this->db->select('*'); $this->db->from('detail_pengadaan_mix a'); $this->db->join('daftar_pengadaan b','b.ID_DPG=a.MIX_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->where('a.DPG_ID=', $id); return $this->db->get()->result_array(); } public function getData_DetailPengadaanMix_byID($id) { // Used $this->db->select('*'); $this->db->from('detail_pengadaan_mix'); $this->db->where('ID_DPMX=', $id); return $this->db->get()->result_array(); } public function getData_DetailPengadaanMix_byMIX($id) { // Used $this->db->select('*'); $this->db->from('detail_pengadaan_mix'); $this->db->where('MIX_ID=', $id); return $this->db->get()->result_array(); } public function getData_DokumenTagihan_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.JT_DT,"%d/%m%/%Y") as JT'); $this->db->from('dokumen_tagihan a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID','left'); $this->db->where('a.ID_DT=', $id); return $this->db->get()->result_array(); } public function getData_DokumenTagihan_orderDESC() { // Used $this->db->select('*, DATE_FORMAT(a.JT_DT,"%d/%m%/%Y") as JT'); $this->db->from('dokumen_tagihan a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('kop d','d.ID_KOP=a.CORP_ID','left'); $this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID','left'); $this->db->order_by('ID_DT DESC'); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_ACC($jabatan) { // Used $this->db->select('*, FORMAT(a.NILAI_FFP,2) as NILAI, DATE_FORMAT(a.TGL_FFP,"%d/%m/%Y") as TANGGAL'); $this->db->from('form_feepelanggan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order d','d.ID_SO=c.SO_ID'); $this->db->join('jenis_ffp e','e.ID_JFP=a.JENIS_FFP'); $this->db->join('pelanggan f','f.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('kota g','g.ID_KOTA=f.KOTA_ID'); $this->db->join('hasil_hitungpda h','h.PENJUALAN_ID=a.PENJUALAN_ID'); if ($jabatan=="ADMINISTRATOR") { $this->db->where('a.STATUS_FFP=0 AND a.CON_FFP_K is NULL'); $this->db->or_where('a.STATUS_FFP=0 AND a.CON_FFP_P is NULL'); } if ($jabatan=="KADIV KEUANGAN") { $this->db->where('a.STATUS_FFP=0 AND a.CON_FFP_K is NULL'); } if ($jabatan=="PIMPINAN") { $this->db->where('a.STATUS_FFP=0 AND a.CON_FFP_P is NULL'); } $this->db->order_by('a.ID_FFP ASC'); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_byID($id) { // Used $this->db->select('*, FORMAT(a.NILAI_FFP, 2) as NILAI'); $this->db->from('form_feepelanggan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jabatan c','c.ID_JABATAN=b.JABATAN_ID'); $this->db->join('penjualan d','d.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID'); $this->db->join('jenis_ffp g','g.ID_JFP=a.JENIS_FFP'); $this->db->where('a.ID_FFP=', $id); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_byID_allStatus($id) { // Used $this->db->select('*, FORMAT(a.NILAI_FFP, 2) as NILAI, DATE_FORMAT(a.TGL_FFP,"%d/%m%/%Y") as TANGGAL'); $this->db->from('form_feepelanggan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jenis_ffp c','c.ID_JFP=a.JENIS_FFP'); $this->db->join('penjualan d','d.ID_PENJUALAN=a.PENJUALAN_ID','left'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID','left'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID','left'); $this->db->where('a.ID_FFP=', $id); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('form_feepelanggan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jabatan c','c.ID_JABATAN=b.JABATAN_ID'); $this->db->join('penjualan d','d.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID'); $this->db->where('a.ID_FFP=', $id); $this->db->where('a.STATUS_FFP=', $status); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_byPENJUALAN($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_FFP,"%d/%m/%Y") as TANGGAL'); $this->db->from('form_feepelanggan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->where('a.PENJUALAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_byPENJUALAN_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_FFP,"%d/%m/%Y") as TANGGAL'); $this->db->from('form_feepelanggan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->where('a.PENJUALAN_ID=', $id); $this->db->where('a.STATUS_FFP=', $status); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_byPENJUALAN_statusNot2($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_FFP,"%d/%m/%Y") as TANGGAL'); $this->db->from('form_feepelanggan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->where('a.STATUS_FFP!=2 AND a.PENJUALAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_bySALES_byPELANGGAN_byJENIS_byPERIODE_bySEARCH_status01($id1=null, $id2=null, $id3=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_FFP,"%d/%m%/%Y") as TANGGAL, FORMAT(a.NILAI_FFP, 2) as NILAI'); $this->db->from('form_feepelanggan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order d','d.ID_SO=c.SO_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->join('jenis_ffp g','g.ID_JFP=a.JENIS_FFP'); if ($id1!=null) { $this->db->where('a.KARYAWAN_ID=', $id1); } if ($id2!=null) { $this->db->where('c.PEL_ID=', $id2); } if ($id3!=null) { $this->db->where('a.JENIS_FFP=', $id3); } if ($search!=null) { $this->db->where('a.ID_FFP=', $search); } $this->db->where('a.STATUS_FFP<=1'); $this->db->where('a.TGL_FFP>=', $awal); $this->db->where('a.TGL_FFP<=', $akhir); $this->db->order_by('a.ID_FFP ASC'); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_bySALES_bySEARCH_limit20($sales, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_FFP,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_FFP, 2) as NILAI'); $this->db->from('form_feepelanggan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jenis_ffp c','c.ID_JFP=a.JENIS_FFP'); if ($search==null) { $this->db->where('a.KARYAWAN_ID=', $sales); } else { $this->db->where("a.KARYAWAN_ID=$sales AND a.KODE_FFP LIKE '%$search%'"); $this->db->or_where("a.KARYAWAN_ID=$sales AND a.NILAI_FFP LIKE '%$search%'"); $this->db->or_where("a.KARYAWAN_ID=$sales AND a.KET_FFP LIKE '%$search%'"); $this->db->or_where("a.KARYAWAN_ID=$sales AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.KARYAWAN_ID=$sales AND c.NAMA_JFP LIKE '%$search%'"); } $this->db->order_by('a.KODE_FFP DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_bySEARCH_limit20($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_FFP,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_FFP, 2) as NILAI'); $this->db->from('form_feepelanggan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jenis_ffp c','c.ID_JFP=a.JENIS_FFP'); if ($search!=null) { $this->db->where("a.KODE_FFP LIKE '%$search%'"); $this->db->or_where("a.NILAI_FFP LIKE '%$search%'"); $this->db->or_where("a.KET_FFP LIKE '%$search%'"); $this->db->or_where("b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("c.NAMA_JFP LIKE '%$search%'"); } $this->db->order_by('a.KODE_FFP DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_bySEARCH_statusUntil1_limit20($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_FFP,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_FFP, 2) as NILAI'); $this->db->from('form_feepelanggan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jenis_ffp c','c.ID_JFP=a.JENIS_FFP'); $this->db->join('penjualan d','d.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); if ($search!=null) { $this->db->where("a.STATUS_FFP<=1 AND a.KODE_FFP LIKE '%$search%'"); $this->db->or_where("a.STATUS_FFP<=1 AND a.NILAI_FFP LIKE '%$search%'"); $this->db->or_where("a.STATUS_FFP<=1 AND a.KET_FFP LIKE '%$search%'"); $this->db->or_where("a.STATUS_FFP<=1 AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_FFP<=1 AND c.NAMA_JFP LIKE '%$search%'"); $this->db->or_where("a.STATUS_FFP<=1 AND e.KODE_SO LIKE '%$search%'"); } $this->db->order_by('a.KODE_FFP DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_ACC() { // Used $this->db->select('*,FORMAT(a.NILAI_FK,2) as NILAI,b.NAMA_PANGGILAN_KARYAWAN as NPKK,c.NAMA_PANGGILAN_KARYAWAN as NPKS'); $this->db->from('form_karyawan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->join('proyek d','d.ID_PROYEK=a.PROYEK_ID','left'); $this->db->where('a.STATUS_FK=0'); $this->db->where('a.CONFIRM_FK_O is NOT NULL'); $this->db->where('a.CONFIRM_FK_S is NOT NULL'); $this->db->where('a.CONFIRM_FK_P is NOT NULL'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_byID($id) { // Used $this->db->select('*, a.KARYAWAN_ID as KID, FORMAT(a.NILAI_FK, 0) as NILAI, b.NAMA_PANGGILAN_KARYAWAN as NAKAR, c.NAMA_PANGGILAN_KARYAWAN as NASAL, DATE_FORMAT(a.TGL_FK,"%d/%m/%Y") as TANGGAL'); $this->db->from('form_karyawan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->join('jenis_fk d','d.ID_JFK=a.JENIS_FK'); $this->db->join('daftar_akuntansi e','e.FK_ID=a.ID_FK','left'); $this->db->where('a.ID_FK=', $id); $this->db->group_by('a.ID_FK'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_byID_bySTATUS($id, $status) { // Used $this->db->select('*, c.NAMA_PANGGILAN_KARYAWAN as NASALES'); $this->db->from('form_karyawan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->join('jabatan d','d.ID_JABATAN=b.JABATAN_ID'); $this->db->where('a.ID_FK=', $id); $this->db->where('a.STATUS_FK=', $status); return $this->db->get()->result_array(); } public function getData_FormKaryawan_byJENIS_bySTATUS_allAcc($id, $status) { // Used $now = date('Y-m-d'); $this->db->select('*, DATE_FORMAT(b.TGL_DFFK,"%d/%m%/%Y") as TANGGAL'); $this->db->from('form_karyawan a'); $this->db->join('daftar_formkaryawan b','b.FK_ID=a.ID_FK'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jenis_fk d','d.ID_JFK=a.JENIS_FK'); $this->db->where("a.JENIS_FK=$id AND a.STATUS_FK=$status AND a.CONFIRM_FK_O is NOT NULL AND a.CONFIRM_FK_P is NOT NULL"); $this->db->or_where("a.JENIS_FK=$id AND a.STATUS_FK!=2 AND b.TGL_DFFK='$now' AND a.CONFIRM_FK_O is NOT NULL AND a.CONFIRM_FK_P is NOT NULL"); return $this->db->get()->result_array(); } public function getData_FormKaryawan_byKARYAWAN_cariStatus($id, $verse, $jabatan=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_FK, "%d/%m/%Y") as TANGGAL, c.NAMA_PANGGILAN_KARYAWAN as NAKAR, d.NAMA_PANGGILAN_KARYAWAN as NASAL, a.KARYAWAN_ID as KID, a.SALES_ID as SID, FORMAT(a.NILAI_FK, 0) as NILAI'); $this->db->from('form_karyawan a'); $this->db->join('jenis_fk b','b.ID_JFK=a.JENIS_FK'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('daftar_formkaryawan e','e.FK_ID=a.ID_FK'); $this->db->join('proyek f','f.ID_PROYEK=a.PROYEK_ID','left'); $this->db->join('pelanggan g','g.ID_PELANGGAN=f.PELANGGAN_ID','left'); $this->db->join('daftar_promoclearance h','h.FK_ID=a.ID_FK','left'); $this->db->join('hasil_hitungpda i','i.PENJUALAN_ID=h.PENJUALAN_ID','left'); $this->db->join('jabatan j','j.ID_JABATAN=c.JABATAN_ID','left'); if ($verse==0) { $this->db->where('a.STATUS_FK=0 AND a.CONFIRM_FK_O is NULL AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.CONFIRM_FK_S is NULL AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.CONFIRM_FK_P is NULL AND a.KARYAWAN_ID=', $id); } else if ($verse==1) { $this->db->where('a.STATUS_FK=0 AND a.CONFIRM_FK_S is NOT NULL AND a.CONFIRM_FK_O is NOT NULL AND a.CONFIRM_FK_P is NOT NULL AND a.KARYAWAN_ID=', $id); } else if ($verse==2) { $tgl = date('Y-m-d'); $limit = $this->generate_subDay($tgl, 14); $this->db->where("a.STATUS_FK=2 AND a.KET_BATAL is NOT NULL AND a.KARYAWAN_ID=$id AND a.TGL_BATAL>='$limit'"); } else if ($verse==3) { if ($jabatan=="ADMINISTRATOR") { $this->db->where('a.STATUS_FK=0'); } else if ($jabatan=="PIMPINAN") { $this->db->where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.CONFIRM_FK_P is NULL'); } else if ($jabatan=="KADIV GUDANG") { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK=1 AND a.SALES_ID=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%ICT%' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%GUDANG%' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%UMUM%' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%SERVICE%' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.JENIS_FK<=6 AND a.CONFIRM_FK_P is NULL"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK=7 AND a.CONFIRM_FK_P is NULL AND j.NAMA_JABATAN LIKE '%GUDANG%'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK=7 AND a.CONFIRM_FK_P is NULL AND j.NAMA_JABATAN LIKE '%UMUM%'"); } else if ($jabatan=="KADIV ICT") { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Ricky"'); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Rachman"'); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Fajrun"'); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Fahmi"'); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%ICT%'"); } else if ($jabatan=="KADIV KEUANGAN") { $this->db->where('a.STATUS_FK=0 AND a.JENIS_FK=4 AND a.CONFIRM_FK_O is NULL AND a.SALES_ID=a.KARYAWAN_ID'); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%KEUANGAN%'"); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%ADMIN ITP%'"); } else if ($jabatan=="KADIV SALES") { if ($id==54) { $this->db->where('a.STATUS_FK=0 AND a.CONFIRM_FK_S is NULL AND a.SALES_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.KARYAWAN_ID=28 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL'); $this->db->or_where("a.STATUS_FK=0 AND c.ANGGOTA_KARYAWAN=$id AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL"); } else { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK<=2 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_S is NULL AND a.SALES_ID=', $id); $this->db->or_where("a.STATUS_FK=0 AND d.ANGGOTA_KARYAWAN=$id AND a.JENIS_FK=2 AND a.SALES_ID=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL"); $this->db->or_where("a.STATUS_FK=0 AND d.ANGGOTA_KARYAWAN=$id AND a.JENIS_FK=4 AND a.SALES_ID!=a.KARYAWAN_ID AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN!='Ricky' AND d.NAMA_PANGGILAN_KARYAWAN!='Rachman' AND d.NAMA_PANGGILAN_KARYAWAN!='Fajrun' AND d.NAMA_PANGGILAN_KARYAWAN!='Fahmi'"); $this->db->or_where("a.STATUS_FK=0 AND d.ANGGOTA_KARYAWAN=$id AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%SALES%'"); } } else if ($jabatan=="KADIV SERVICE") { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.CONFIRM_FK_O is NULL AND d.NAMA_PANGGILAN_KARYAWAN="Service"'); $this->db->or_where("a.STATUS_FK=0 AND a.JENIS_FK>=5 AND a.CONFIRM_FK_O is NULL AND j.NAMA_JABATAN LIKE '%SERVICE%'"); } else if (strpos($jabatan,"SALES")!==FALSE AND $jabatan!="KADIV SALES") { $this->db->where('a.STATUS_FK=0 AND a.JENIS_FK<=3 AND a.CONFIRM_FK_S is NULL AND a.SALES_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.JENIS_FK=4 AND a.SALES_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); } else { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); } } $this->db->group_by('a.ID_FK'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_byKARYAWAN_statusNull($id) { // Used $this->db->select('*'); $this->db->from('form_karyawan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where('a.STATUS_FK is NULL AND a.KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_FormKaryawan_bySALES_byKARYAWAN_byJENIS_byPERIODE_bySEARCH_status1($id1=null, $id2=null, $id3=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_FK,"%d/%m%/%Y") as TANGGAL, FORMAT(a.NILAI_FK, 2) as NILAI, b.NAMA_PANGGILAN_KARYAWAN as NASEL, c.NAMA_PANGGILAN_KARYAWAN as NAKAR'); $this->db->from('form_karyawan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jenis_fk d','d.ID_JFK=a.JENIS_FK'); if ($id1!=null) { $this->db->where('a.SALES_ID=', $id1); } if ($id2!=null) { $this->db->where('a.KARYAWAN_ID=', $id2); } if ($id3!=null) { $this->db->where('a.JENIS_FK=', $id3); } if ($search!=null) { $this->db->where('a.ID_FK=', $search); } $this->db->where('a.STATUS_FK=1'); $this->db->where('a.TGL_FK>=', $awal); $this->db->where('a.TGL_FK<=', $akhir); $this->db->order_by('a.ID_FK ASC'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_bySEARCH_limit20($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_FK,"%d/%m/%Y") as TANGGAL, b.NAMA_PANGGILAN_KARYAWAN as NAKAR, c.NAMA_PANGGILAN_KARYAWAN as NASAL, FORMAT(a.NILAI_FK, 2) as NILAI'); $this->db->from('form_karyawan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->join('jenis_fk d','d.ID_JFK=a.JENIS_FK'); if ($search!=null) { $this->db->where("a.KODE_FK LIKE '%$search%'"); $this->db->or_where("a.NILAI_FK LIKE '%$search%'"); $this->db->or_where("b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("c.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("d.NAMA_JFK LIKE '%$search%'"); } $this->db->order_by('a.KODE_FK DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_bySTATUS_jenisLessEqual4_allACC($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_FK,"%d/%m/%Y") as TANGGAL, b.NAMA_PANGGILAN_KARYAWAN as NAKAR, c.NAMA_PANGGILAN_KARYAWAN as NASAL, FORMAT(a.NILAI_FK, 0) as NILAI, a.SALES_ID as SID, a.KARYAWAN_ID as KID, f.NAMA_PELANGGAN as NAPELPRO, k.NAMA_PELANGGAN as NAPELSO'); $this->db->from('form_karyawan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->join('jenis_fk d','d.ID_JFK=a.JENIS_FK'); $this->db->join('proyek e','e.ID_PROYEK=a.PROYEK_ID','left'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID','left'); $this->db->join('daftar_promoclearance g','g.FK_ID=a.ID_FK','left'); $this->db->join('hasil_hitungpda h','h.PENJUALAN_ID=g.PENJUALAN_ID','left'); $this->db->join('penjualan i','i.ID_PENJUALAN=h.PENJUALAN_ID','left'); $this->db->join('sales_order j','j.ID_SO=i.SO_ID','left'); $this->db->join('pelanggan k','k.ID_PELANGGAN=j.PELANGGAN_ID','left'); $this->db->where('a.STATUS_FK=', $status); $this->db->where('a.JENIS_FK<=4'); $this->db->order_by('a.KODE_FK ASC'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_tungguACC($id, $hak, $jabatan) { // Used $this->db->select('*,b.NAMA_PANGGILAN_KARYAWAN as NAMA_SALES,c.NAMA_PANGGILAN_KARYAWAN as NAMA_KARYAWAN,d.NAMA_PANGGILAN_KARYAWAN as NAMA_MENGETAHUI, FORMAT(a.NILAI_FK,2) as NILAI,DATE_FORMAT(a.TGL_FK,"%d/%m/%Y") as TANGGAL, a.SALES_ID as SID, j.NAMA_JABATAN as JABSAL'); $this->db->from('form_karyawan a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.MENGETAHUI_ID','left'); $this->db->join('proyek e','e.ID_PROYEK=a.PROYEK_ID','left'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID','left'); $this->db->join('daftar_promoclearance g','g.FK_ID=a.ID_FK','left'); $this->db->join('hasil_hitungpda h','h.PENJUALAN_ID=g.PENJUALAN_ID','left'); $this->db->join('jabatan i','i.ID_JABATAN=c.JABATAN_ID','left'); $this->db->join('jabatan j','j.ID_JABATAN=b.JABATAN_ID','left'); if ($hak>1) { if ($jabatan=="ADMINISTRATOR" OR $jabatan=="PIMPINAN" OR strpos($jabatan,"KEUANGAN")!==FALSE) { $this->db->where('a.STATUS_FK=0'); } else if ($jabatan=="KADIV SALES") { $this->db->where("a.STATUS_FK=0 AND a.SALES_ID=$id AND a.JENIS_FK<=2 AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fajrun%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Ricky%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Rachman%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fahmi%'"); $this->db->or_where("a.STATUS_FK=0 AND a.SALES_ID=a.KARYAWAN_ID AND a.JENIS_FK=4 AND a.SALES_ID=$id AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fajrun%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Ricky%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Rachman%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fahmi%'"); $this->db->or_where("a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND a.JENIS_FK=4 AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fajrun%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Ricky%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Rachman%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fahmi%'"); } else if ($jabatan=="KADIV GUDANG") { $this->db->where("a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND a.JENIS_FK<=2 AND i.NAMA_JABATAN LIKE '%UMUM%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Ricky%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Rachman%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fajrun%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fahmi%'"); $this->db->or_where("a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND a.JENIS_FK<=2 AND i.NAMA_JABATAN LIKE '%TEKNISI%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Ricky%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Rachman%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fajrun%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fahmi%'"); $this->db->or_where("a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND a.JENIS_FK<=2 AND i.NAMA_JABATAN LIKE '%ICT%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Ricky%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Rachman%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fajrun%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fahmi%'"); $this->db->or_where("a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND a.JENIS_FK<=2 AND i.NAMA_JABATAN LIKE '%SERVICE%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Ricky%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Rachman%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fajrun%' AND b.NAMA_PANGGILAN_KARYAWAN NOT LIKE '%Fahmi%'"); } else if ($jabatan=="KADIV ICT") { $this->db->where('a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND b.NAMA_PANGGILAN_KARYAWAN="Ricky"'); $this->db->or_where('a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND b.NAMA_PANGGILAN_KARYAWAN="Rachman"'); $this->db->or_where('a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND b.NAMA_PANGGILAN_KARYAWAN="Fajrun"'); $this->db->or_where('a.STATUS_FK=0 AND a.SALES_ID!=a.KARYAWAN_ID AND b.NAMA_PANGGILAN_KARYAWAN="Fahmi"'); } else if ($jabatan=="KADIV SERVICE") { $this->db->where('a.STATUS_FK=0 AND b.NAMA_PANGGILAN_KARYAWAN="Service"'); } } else if ($hak<=1) { $this->db->where('a.STATUS_FK=0 AND a.KARYAWAN_ID=', $id); $this->db->or_where('a.STATUS_FK=0 AND a.SALES_ID=', $id); } $this->db->order_by('a.KODE_FK ASC, a.TGL_FK ASC'); return $this->db->get()->result_array(); } public function getData_HargaPart_byID($id=null) { // Used if ($id==null) { $this->db->select('*,CONCAT("Rp ",FORMAT(a.HPP_HPAR,0)) as HPP'); $this->db->from('harga_part a'); $this->db->join('part b','b.ID_PART=a.PART_ID'); $this->db->order_by('b.NAMA_PART ASC, a.ID_HPAR DESC'); } else { $this->db->select('*,CONCAT("Rp ",FORMAT(a.HPP_HPAR,0)) as HPP'); $this->db->from('harga_part a'); $this->db->join('part b','b.ID_PART=a.PART_ID'); $this->db->order_by('b.NAMA_PART ASC, a.ID_HPAR DESC'); $this->db->where(['a.ID_HPAR' => $id]); } return $this->db->get()->result_array(); } public function getData_HargaPart_byPART_orderDESC_limit1($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_HPAR,"%d/%m/%Y") as TANGGAL,FORMAT(a.HPP_HPAR,2) as HPP'); $this->db->from('harga_part a'); $this->db->join('part b','b.ID_PART=a.PART_ID'); $this->db->where('a.PART_ID=', $id); $this->db->order_by('a.ID_HPAR DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HasilHitungBarangSo_byBARANG($id) { //Used $this->db->select('*'); $this->db->from('hasil_hitungbarangso'); $this->db->where(['BARANG_ID' => $id]); return $this->db->get()->result_array(); } public function getData_HasilHitungBarangSo_status0_2() { // Used $this->db->select('*'); $this->db->from('hasil_hitungbarangso a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('a.STATUS_HHBSO=0 OR a.STATUS_HHBSO=2'); return $this->db->get()->result_array(); } public function getData_HasilHitungBarangSo_status0_2_orderASC() { // Used $this->db->select('*'); $this->db->from('hasil_hitungbarangso a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('a.STATUS_HHBSO=0 OR a.STATUS_HHBSO=2'); $this->db->order_by('b.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungBfe_byPENJUALAN($id) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(a.KREDIT_HHBFE,2) as KREDIT,FORMAT(a.DEBET_HHBFE,2) as DEBET,FORMAT((a.KREDIT_HHBFE-a.DEBET_HHBFE),2) as SISA'); $this->db->from('hasil_hitungbfe a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=c.SALES_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=a.PEL_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->where('a.PENJUALAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_HasilHitungBfe_bySALES_bySTATUS($sales, $status) { //Used $this->db->select('*, a.PENJUALAN_ID as PID, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(a.KREDIT_HHBFE,2) as KREDIT,FORMAT(a.DEBET_HHBFE,2) as DEBET,FORMAT((a.KREDIT_HHBFE-a.DEBET_HHBFE),2) as SISA, FORMAT(c.NILAI_SO, 2) as NISO, FORMAT(c.FEE_SO, 2) as FEE'); $this->db->from('hasil_hitungbfe a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=c.SALES_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=a.PEL_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->join('corp g','g.ID_CORP=c.CORP_ID'); $this->db->join('form_feepelanggan h','h.PENJUALAN_ID=a.PENJUALAN_ID','left'); $this->db->where('c.SALES_ID=', $sales); $this->db->where('a.STATUS_HHBFE=', $status); return $this->db->get()->result_array(); } public function getData_HasilHitungBfe_bySTATUS($id) { //Used $this->db->select('*, a.PENJUALAN_ID as PID, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(a.KREDIT_HHBFE,2) as KREDIT,FORMAT(a.DEBET_HHBFE,2) as DEBET,FORMAT((a.KREDIT_HHBFE-a.DEBET_HHBFE),2) as SISA, FORMAT(c.NILAI_SO, 2) as NISO, FORMAT(c.FEE_SO, 2) as FEE'); $this->db->from('hasil_hitungbfe a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=c.SALES_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=a.PEL_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->join('form_feepelanggan g','g.PENJUALAN_ID=a.PENJUALAN_ID','left'); $this->db->where('a.STATUS_HHBFE=', $id); $this->db->order_by('c.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungHda_belumLunasOnly($search=null) { // Used $this->db->select('*,SUM(KREDIT_HHHDA-DEBET_HHHDA) as SISA,DATE_FORMAT(b.TGL_INVBELI,"%d/%m/%Y") as TANGGAL, a.SUPPLIER_ID as SID'); $this->db->from('hasil_hitunghda a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('kop e','e.ID_KOP=a.CORP_ID'); $this->db->group_by('a.PEMBELIAN_ID'); $this->db->having('SISA>0'); if ($search!=null) { $this->db->where("b.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("c.ALIAS_SUPPLIER LIKE '%$search%'"); $this->db->or_where("c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("e.NAMA_KOP LIKE '%$search%'"); } $this->db->limit('20'); $this->db->order_by('b.TGL_INVBELI DESC'); return $this->db->get()->result_array(); } public function getData_HasilHitungHda_byPEMBELIAN($id) { // Used $this->db->select('*'); $this->db->from('hasil_hitunghda a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where('a.PEMBELIAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_HasilHitungHda_bySUPPLIER_belumLunasOnly($id, $search=null) { // Used $this->db->select('*, FORMAT(SUM(a.DEBET_HHHDA), 2) as DEBET, FORMAT(SUM(a.KREDIT_HHHDA), 2) as KREDIT, FORMAT(SUM(a.KREDIT_HHHDA-a.DEBET_HHHDA),2) as SISA, DATE_FORMAT(b.TGL_INVBELI,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(b.TEMPO_INVBELI,"%d/%m/%Y") as TEMPO, DATE_FORMAT(b.TT_PEMBELIAN,"%d/%m/%Y") as TT,a.SUPPLIER_ID as SID'); $this->db->from('hasil_hitunghda a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); if ($search!=null) { $this->db->where("a.STATUS_HHHDA!=1 AND a.SUPPLIER_ID=$id AND b.INV_PEMBELIAN LIKE '%$search%'"); } else { $this->db->where("a.STATUS_HHHDA!=1 AND a.SUPPLIER_ID=$id"); } $this->db->group_by('a.PEMBELIAN_ID'); $this->db->having('SISA!="0.00"'); $this->db->order_by('b.TGL_INVBELI ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungHda_groupSUPPLIER_belumLunasOnly() { // Used $this->db->select('*,SUM(KREDIT_HHHDA-DEBET_HHHDA) as SISA,DATE_FORMAT(b.TGL_INVBELI,"%d/%m/%Y") as TANGGAL, a.SUPPLIER_ID as SID'); $this->db->from('hasil_hitunghda a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->group_by('a.SUPPLIER_ID'); $this->db->having('SISA>0'); $this->db->order_by('c.NAMA_SUPPLIER ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungHda_status0_groupSUPPLIER() { // Used $this->db->select('a.SUPPLIER_ID, b.NAMA_SUPPLIER, c.NAMA_KOTA,SUM(a.KREDIT_HHHDA-a.DEBET_HHHDA) as TOTAL'); $this->db->from('hasil_hitunghda a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.STATUS_HHHDA=0'); $this->db->group_by('a.SUPPLIER_ID'); $this->db->order_by('b.NAMA_SUPPLIER ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungKpr_byBARANG($id) { // Used $this->db->select('*'); $this->db->from('hasil_hitungkpr'); $this->db->where('BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id, $perkiraan) { // Used $this->db->select('*'); $this->db->from('hasil_hitungneraca'); $this->db->where('PAK_ID=', $id); $this->db->where('PERKIRAAN_ID=', $perkiraan); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_belumLunasOnly() { // Used $this->db->select('*,SUM(DEBET_HHPDA-KREDIT_HHPDA) as SISA,DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->group_by('a.PENJUALAN_ID'); $this->db->having('SISA>0'); $this->db->order_by('b.TGL_PENJUALAN DESC'); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byID($id) { // Used $this->db->select('*, DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m%/%Y") as TEMPO, DATE_FORMAT(b.TT_PENJUALAN,"%d/%m%/%Y") as TT, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m%/%Y") as TANGGAL , FORMAT(a.DEBET_HHPDA, 2) as DEBET, FORMAT(a.KREDIT_HHPDA, 2) as KREDIT, FORMAT(a.DEBET_HHPDA-a.KREDIT_HHPDA, 2) as SISA'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kop d','d.ID_KOP=a.CORP_ID'); $this->db->join('sales_order e','e.ID_SO=b.SO_ID','left'); $this->db->join('karyawan f','f.ID_KARYAWAN=e.SALES_ID','left'); $this->db->where('a.ID_HHPDA=', $id); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($id, $awal, $akhir, $search=null) { // Used $this->db->select('*, FORMAT(a.DEBET_HHPDA, 2) as NILAI, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=c.SALES_ID'); if ($search==null) { $this->db->where('c.SALES_ID=', $id); $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); $this->db->where('b.STATUS_PENJUALAN=1'); } else { $this->db->where("c.SALES_ID=$id AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND c.KODE_SO LIKE '%$search%'"); $this->db->or_where("c.SALES_ID=$id AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("c.SALES_ID=$id AND b.STATUS_PENJUALAN=1 AND b.TGL_PENJUALAN>='$awal' AND b.TGL_PENJUALAN<='$akhir' AND a.DEBET_HHPDA LIKE '%$search%'"); } return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byKARYAWAN_byPERIODE_status1($id=null, $limit) { // Used $this->db->select('*, FORMAT(a.DEBET_HHPDA, 2) as NILAI, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=c.SALES_ID'); if ($id!=null) { $this->db->where('c.SALES_ID=', $id); } else { $this->db->not_like('f.NAMA_PANGGILAN_KARYAWAN', 'None'); $this->db->not_like('f.NAMA_PANGGILAN_KARYAWAN', 'Insentive'); } $this->db->where('b.TGL_PENJUALAN>=', $limit); $this->db->where('b.STATUS_PENJUALAN=1'); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byKARYAWAN_byTEMPO_belumLunasOnly($id, $jt) { // Used $this->db->select('*,SUM(DEBET_HHPDA) as DEBET,SUM(KREDIT_HHPDA) as KREDIT,SUM(DEBET_HHPDA-KREDIT_HHPDA) as SISA, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO, DATE_FORMAT(b.TT_PENJUALAN,"%d/%m/%Y") as TT, a.CORP_ID as COP'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('sales_order e','e.ID_SO=b.SO_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=e.SALES_ID'); if ($id!=0) { $this->db->where('e.SALES_ID=', $id); } $this->db->where('b.TEMPO_PENJUALAN<=', $jt); $this->db->group_by('a.PELANGGAN_ID'); $this->db->having('SISA>0'); $this->db->order_by('c.NAMA_PELANGGAN ASC, b.TEMPO_PENJUALAN ASC, b.INV_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byKELOMPOK_belumLunasOnly($id=null) { // Used $this->db->select('*,SUM(DEBET_HHPDA) as DEBET,SUM(KREDIT_HHPDA) as KREDIT,SUM(DEBET_HHPDA-KREDIT_HHPDA) as SISA, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO, DATE_FORMAT(b.TT_PENJUALAN,"%d/%m/%Y") as TT, a.CORP_ID as COP'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('sales_order e','e.ID_SO=b.SO_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=e.SALES_ID'); if ($id!=null) { $this->db->where('c.KELOMPOK_ID=', $id); } $this->db->group_by('a.ID_HHPDA'); $this->db->having('SISA>0'); $this->db->order_by('c.NAMA_PELANGGAN ASC, b.TEMPO_PENJUALAN ASC, b.INV_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byKELOMPOK_groupPELANGGAN_belumLunasOnly($id=null, $mode=null) { // Used $now = date('Y-m-d'); $this->db->select('*, FORMAT(SUM(DEBET_HHPDA-KREDIT_HHPDA),2) as SISA, SUM(DEBET_HHPDA-KREDIT_HHPDA) as SELISIH,DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('kop e','e.ID_KOP=a.CORP_ID'); if ($id!=null) { if ($mode==1) { $limit = $this->generate_addDay($now, 3); $this->db->where('c.KELOMPOK_ID=', $id); $this->db->where('b.TEMPO_PENJUALAN>=', $now); $this->db->where('b.TEMPO_PENJUALAN<=', $limit); } else if ($mode==2) { $this->db->where('a.CORP_ID=0 AND c.KELOMPOK_ID=', $id); } else if ($mode==3) { $this->db->where('a.CORP_ID>0'); $this->db->where('c.KELOMPOK_ID=', $id); $this->db->where('b.TEMPO_PENJUALAN<=', $now); } else if ($mode==4) { $this->db->where('a.CORP_ID>0'); $this->db->where('c.KELOMPOK_ID=', $id); $this->db->where('b.TEMPO_PENJUALAN>', $now); } else if ($mode==5) { $this->db->where('c.KELOMPOK_ID=', $id); } } else { if ($mode==1) { $limit = $this->generate_addDay($now, 3); $this->db->where('b.TEMPO_PENJUALAN>=', $now); $this->db->where('b.TEMPO_PENJUALAN<=', $limit); } else if ($mode==2) { $this->db->where('a.CORP_ID=0'); } else if ($mode==3) { $this->db->where('a.CORP_ID>0'); $this->db->where('b.TEMPO_PENJUALAN<=', $now); } else if ($mode==4) { $this->db->where('a.CORP_ID>0'); $this->db->where('b.TEMPO_PENJUALAN>', $now); } } $this->db->group_by('a.PELANGGAN_ID'); $this->db->having('SISA>0'); $this->db->order_by('c.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byPELANGGAN_belumLunasOnly($id, $search=null) { // Used $this->db->select('*, FORMAT(SUM(a.DEBET_HHPDA), 2) as DEBET, FORMAT(SUM(a.KREDIT_HHPDA), 2) as KREDIT, FORMAT(SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA),2) as SISA, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO, DATE_FORMAT(b.TT_PENJUALAN,"%d/%m/%Y") as TT, a.PELANGGAN_ID as PID'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('sales_order e','e.ID_SO=b.SO_ID','left'); $this->db->join('karyawan f','f.ID_KARYAWAN=e.SALES_ID','left'); $this->db->join('kop g','g.ID_KOP=a.CORP_ID','left'); if ($search!=null) { $this->db->where("a.STATUS_HHPDA!=1 AND a.PELANGGAN_ID=$id AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_HHPDA!=1 AND a.PELANGGAN_ID=$id AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else { $this->db->where("a.STATUS_HHPDA!=1 AND a.PELANGGAN_ID=$id"); } $this->db->group_by('a.PENJUALAN_ID'); $this->db->having('SISA!="0.00"'); $this->db->order_by('b.TGL_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byPELANGGAN_bySALES_belumLunasOnly($id, $sales, $search=null) { // Used $this->db->select('*, FORMAT(SUM(a.DEBET_HHPDA), 2) as DEBET, FORMAT(SUM(a.KREDIT_HHPDA), 2) as KREDIT, FORMAT(SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA),2) as SISA, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO, DATE_FORMAT(b.TT_PENJUALAN,"%d/%m/%Y") as TT, a.PELANGGAN_ID as PID'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('sales_order e','e.ID_SO=b.SO_ID','left'); $this->db->join('karyawan f','f.ID_KARYAWAN=e.SALES_ID','left'); if ($search!=null) { if ($sales==0) { $this->db->where("a.STATUS_HHPDA!=1 AND a.PELANGGAN_ID=$id AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_HHPDA!=1 AND a.PELANGGAN_ID=$id AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else { $this->db->where("a.STATUS_HHPDA!=1 AND a.PELANGGAN_ID=$id AND e.SALES_ID=$sales AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_HHPDA!=1 AND a.PELANGGAN_ID=$id AND e.SALES_ID=$sales AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } } else { if ($sales==0) { $this->db->where("a.STATUS_HHPDA!=1 AND a.PELANGGAN_ID=$id"); } else { $this->db->where("a.STATUS_HHPDA!=1 AND a.PELANGGAN_ID=$id AND e.SALES_ID=$sales"); } } $this->db->group_by('a.PENJUALAN_ID'); $this->db->having('SISA!="0.00"'); $this->db->order_by('b.TGL_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byPELANGGAN_bySALES_byCORP_forDokumenTagihan($id_pelanggan=null, $id_sales=null, $id_corp=null, $jt=null) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO, SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA) as SISA, FORMAT(a.DEBET_HHPDA, 2) as DEBET, FORMAT(a.KREDIT_HHPDA, 2) as KREDIT, FORMAT(SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA),2) as SUBTOTAL'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('kop e','e.ID_KOP=a.CORP_ID'); $this->db->join('sales_order f','f.ID_SO=b.SO_ID','left'); $this->db->join('karyawan g','g.ID_KARYAWAN=f.SALES_ID','left'); if ($id_pelanggan!=null) { $this->db->where('b.PEL_ID=', $id_pelanggan); } else { $this->db->where('a.ID_HHPDA=0'); } if ($id_sales!=null) { $this->db->where('f.SALES_ID=', $id_sales); } if ($id_corp!=null) { $this->db->where('a.CORP_ID=', $id_corp); } else { $this->db->where('a.ID_HHPDA=0'); } $this->db->where('a.STATUS_HHPDA=0'); $this->db->group_by('a.PENJUALAN_ID'); $this->db->order_by('b.INV_PENJUALAN ASC, b.TGL_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byPENJUALAN_linkFormFee($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGLLOCK_HHPDA,"%d/%m/%Y") as TGLLOCK, DATE_FORMAT(b.TGL_FFP,"%d/%m/%Y") as TGLFFP'); $this->db->from('hasil_hitungpda a'); $this->db->join('form_feepelanggan b','b.PENJUALAN_ID=a.PENJUALAN_ID','left'); $this->db->where('a.PENJUALAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_byPENJUALAN($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGLLOCK_HHPDA,"%d/%m/%Y") as TGLLOCK'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->where('a.PENJUALAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_bySO($id) { // Used $this->db->select('*'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->where('b.SO_ID=', $id); return $this->db->get()->result_array(); } public function getData_HasilHitungPda_status0_groupPELANGGAN() { // Used $this->db->select('*, SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA) as TOTAL'); $this->db->from('hasil_hitungpda a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.STATUS_HHPDA=0'); $this->db->group_by('a.PELANGGAN_ID'); $this->db->order_by('b.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_HasilHitungTb_byID($id) { // Used $this->db->select('*'); $this->db->from('hasil_hitungtb'); $this->db->where('ID_HHTB=', $id); return $this->db->get()->result_array(); } public function getData_HasilHitungTb_byPAK($id) { // Used $this->db->select('*'); $this->db->from('hasil_hitungtb'); $this->db->where('PAK_ID=', $id); return $this->db->get()->result_array(); } public function getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id, $akun, $kolom) { // Used $this->db->select('*, FORMAT(NILAI_HHTB, 2) as NILAI'); $this->db->from('hasil_hitungtb'); $this->db->where('PAK_ID=', $id); $this->db->where('AKUN_HHTB=', $akun); $this->db->where('KOLOM_HHTB=', $kolom); return $this->db->get()->result_array(); } public function getData_HasilHitungTb_byPAK_byKOLOM($id, $kolom) { // Used $this->db->select('*, FORMAT(NILAI_HHTB, 2) as NILAI'); $this->db->from('hasil_hitungtb'); $this->db->where('PAK_ID=', $id); $this->db->where('KOLOM_HHTB=', $kolom); return $this->db->get()->result_array(); } public function getData_HistoriAktifTerakhir($id) { // Used $this->db->select('*'); $this->db->from('histori_aktifterakhir'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_HistoriAktifTerakhir_checkNow() { // Used $now = date('Y-m-d H:i:s'); $limit = $this->generate_subMinute($now, 10); $this->db->select('*,DATE_FORMAT(a.LAST_HAT,"%H:%i:%s") as TANGGAL'); $this->db->from('histori_aktifterakhir a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where('a.LAST_HAT<=', $now); $this->db->where('a.LAST_HAT>=', $limit); $this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_HistoriCetakDokumen_byCD_orderDESC_limit1($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_HCD,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_cetakdokumen a'); $this->db->join('cetak_dokumen b','b.ID_CD=a.CD_ID'); $this->db->where('a.CD_ID=', $id); $this->db->order_by('a.ID_HCD DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriCetakDokumen_byKODE_orderDESC_limit1($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_HCD,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_cetakdokumen a'); $this->db->join('cetak_dokumen b','b.ID_CD=a.CD_ID'); $this->db->where('b.KODE_BUKTI=', $id); $this->db->order_by('a.ID_HCD DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byBARANG($id) { // Used $this->db->select('*'); $this->db->from('histori_kuantiti'); $this->db->where('BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byBARANG_afterID($id1, $id2) { // Used $this->db->select('*'); $this->db->from('histori_kuantiti'); $this->db->where('BARANG_ID=', $id1); $this->db->where('ID_HQ>', $id2); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($id, $tgl) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_HQ,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('a.BARANG_ID=', $id); $this->db->where('a.TGL_HQ<=', $tgl); $this->db->order_by('a.ID_HQ DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byBARANG_byKODEBUKTI($barang, $kodebukti) { // Used $this->db->select('*'); $this->db->from('histori_kuantiti'); $this->db->where('BARANG_ID=', $barang); $this->db->where('KODE_BUKTI=', $kodebukti); $this->db->order_by('ID_HQ ASC'); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byBARANG_byKODEBUKTI_beforeTGL_orderDESC_limit1($barang, $kodebukti, $tgl) { // Used $this->db->select('*'); $this->db->from('histori_kuantiti'); $this->db->where('BARANG_ID=', $barang); $this->db->where('KODE_BUKTI=', $kodebukti); $this->db->where('TGL_HQ<=', $tgl); $this->db->order_by('ID_HQ DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byBARANG_byKODEBUKTI_byTGL($barang, $kodebukti, $tgl) { // Used $this->db->select('*'); $this->db->from('histori_kuantiti'); $this->db->where('BARANG_ID=', $barang); $this->db->where('KODE_BUKTI=', $kodebukti); $this->db->where('TGL_HQ=', $tgl); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byBARANG_bySTATUS_orderASC($id1, $id2, $id3=null) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_HQ,"%d/%m/%Y") as TANGGAL,FORMAT(a.AVG_HQ,2) as AVG,FORMAT(a.PERSEDIAAN_HQ,2) as PERSEDIAAN'); $this->db->from('histori_kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('a.BARANG_ID=', $id1); $this->db->where('b.STATUS_BARANG=', $id2); if ($id3!=null) { $this->db->where('a.ID_HQ=', $id3); } $this->db->order_by('a.ID_HQ ASC'); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byBARANG_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('histori_kuantiti'); $this->db->where('BARANG_ID=', $id); $this->db->order_by('ID_HQ DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($id1, $id2) { // Used $this->db->select('*'); $this->db->from('histori_kuantiti'); $this->db->where('BARANG_ID=', $id1); $this->db->where('ID_HQ<', $id2); $this->db->order_by('ID_HQ DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byKODE($id) { // Used $this->db->select('*, FORMAT(a.AVG_HQ, 2) as AVG'); $this->db->from('histori_kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.KODE_BUKTI' => $id]); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byKODE_afterTGL($id, $tgl) { // Used $this->db->select('*, FORMAT(a.AVG_HQ, 2) as AVG, FORMAT((a.AVG_HQ*a.KELUAR_HQ), 2) as SUB, (a.AVG_HQ*a.KELUAR_HQ) as SUBTOTAL'); $this->db->from('histori_kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.KODE_BUKTI' => $id]); $this->db->where('a.TGL_HQ>', $tgl); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byKODE_beforesameTGL($id, $tgl) { // Used $this->db->select('*, FORMAT(a.AVG_HQ, 2) as AVG, FORMAT((a.AVG_HQ*a.KELUAR_HQ), 2) as SUB, (a.AVG_HQ*a.KELUAR_HQ) as SUBTOTAL'); $this->db->from('histori_kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.KODE_BUKTI' => $id]); $this->db->where('a.TGL_HQ<=', $tgl); return $this->db->get()->result_array(); } public function getData_HistoriKuantiti_byKODE_byTGL($id, $tgl) { // Used $this->db->select('*, FORMAT(a.AVG_HQ, 2) as AVG, FORMAT((a.AVG_HQ*a.KELUAR_HQ), 2) as SUB, (a.AVG_HQ*a.KELUAR_HQ) as SUBTOTAL'); $this->db->from('histori_kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.KODE_BUKTI' => $id]); $this->db->where(['a.TGL_HQ' => $tgl]); return $this->db->get()->result_array(); } public function getData_HistoriOtomasiBooster_byLKPR($id) { // Used $this->db->select('*'); $this->db->from('histori_otomasibooster'); $this->db->where(['LKPR_ID' => $id]); return $this->db->get()->result_array(); } public function getData_HistoriOtomasiBooster_byOB($id) { // Used $this->db->select('*, FORMAT(b.NILAI_LKPR, 2) as NILKPR'); $this->db->from('histori_otomasibooster a'); $this->db->join('link_klaimprogram b','b.ID_LKPR=a.LKPR_ID'); $this->db->join('program c','c.ID_PROGRAM=b.PROGRAM_ID'); $this->db->join('sn_klaimprogram d','d.ID_SNKPR=b.SNKPR_ID'); $this->db->join('sn_stock e','e.ID_SNSTOCK=d.SNSTOCK_ID'); $this->db->join('barang f','f.ID_BARANG=e.BARANG_ID'); $this->db->where(['a.OB_ID' => $id]); return $this->db->get()->result_array(); } public function getData_HistoriOtomasiBooster_bySNKPR_batalNull($id) { // Used $this->db->select('*'); $this->db->from('histori_otomasibooster a'); $this->db->join('link_klaimprogram b','b.ID_LKPR=a.LKPR_ID'); $this->db->join('sn_klaimprogram c','c.ID_SNKPR=b.SNKPR_ID'); $this->db->where(['b.SNKPR_ID' => $id]); $this->db->where('a.BATAL_HOB is NULL'); return $this->db->get()->result_array(); } public function getData_HistoriOtomasiSellout_bySNKPR_batalNull($id) { // Used $this->db->select('*'); $this->db->from('histori_otomasisellout a'); $this->db->join('link_klaimprogram b','b.ID_LKPR=a.LKPR_ID'); $this->db->join('potongan_klaimprogram c','c.ID_PKPR=b.PKPR_ID'); $this->db->join('sn_klaimprogram d','d.ID_SNKPR=b.SNKPR_ID'); $this->db->where(['b.SNKPR_ID' => $id]); $this->db->where('a.BATAL_HOS is NULL'); return $this->db->get()->result_array(); } public function getData_HistoriPenawaran_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.FU_HPNE,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_penawaran a'); $this->db->join('status_penawaran b','b.ID_SPE=a.STATUS_HPNE'); $this->db->where('a.ID_HPNE=', $id); return $this->db->get()->result_array(); } public function getData_HistoriPenawaran_byPENAWARAN($id) { // Used $this->db->select('*, DATE_FORMAT(a.FU_HPNE,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_penawaran a'); $this->db->join('status_penawaran b','b.ID_SPE=a.STATUS_HPNE'); $this->db->where('a.PENAWARAN_ID=', $id); $this->db->order_by('a.ID_HPNE ASC'); return $this->db->get()->result_array(); } public function getData_HistoriPenawaran_byPENAWARAN_byKET($id, $ket) { // Used $this->db->select('*'); $this->db->from('histori_penawaran'); $this->db->where('PENAWARAN_ID=', $id); $this->db->where("KET_HPNE LIKE '%$ket%'"); return $this->db->get()->result_array(); } public function getData_HistoriPenawaran_byPENAWARAN_orderDESC_limit1($id) { // Used $this->db->select('*, DATE_FORMAT(a.FU_HPNE,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_penawaran a'); $this->db->join('status_penawaran b','b.ID_SPE=a.STATUS_HPNE'); $this->db->where('a.PENAWARAN_ID=', $id); $this->db->order_by('a.ID_HPNE DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriService_byID($id) { // Used $this->db->select('*'); $this->db->from('histori_service'); $this->db->where('ID_HSV=', $id); return $this->db->get()->result_array(); } public function getData_HistoriService_bySNS_orderASC($id) { // Used $this->db->select('*'); $this->db->from('histori_service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.TEKNISI_ID'); $this->db->where('a.SNS_ID=', $id); $this->db->order_by('a.ID_HSV ASC'); return $this->db->get()->result_array(); } public function getData_HistoriService_bySNS_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('histori_service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.TEKNISI_ID'); $this->db->where('a.SNS_ID=', $id); $this->db->order_by('a.ID_HSV DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriSn_byKODEBUKTI($kode) { // Used $this->db->select('*'); $this->db->from('histori_sn'); $this->db->where(['KODE_BUKTI' => $kode]); return $this->db->get()->result_array(); } public function getData_HistoriSn_byKODEBUKTI_bySNSTOCK($kode, $id) { // Used $this->db->select('*'); $this->db->from('histori_sn'); $this->db->where(['KODE_BUKTI' => $kode]); $this->db->where(['SNSTOCK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_HistoriSn_byMERK_byPRODUK_byPERIODE_jenis1_likePJ_groupSNSTOCK_forSku($id_merk=null, $id_produk=null, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_HSN,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_sn a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('c.JENIS_ID<=7'); $this->db->where('c.MERK_ID=', $id_merk); $this->db->where('c.PRODUK_ID=', $id_produk); $this->db->where('a.TGL_HSN>=', $awal); $this->db->where('a.TGL_HSN<=', $akhir); $this->db->like('a.KODE_BUKTI','PJ','after'); $this->db->group_by('a.SNSTOCK_ID'); $this->db->order_by('a.TGL_HSN ASC, c.KODE_BARANG ASC, b.NAMA_SNSTOCK ASC'); return $this->db->get()->result_array(); } public function getData_HistoriSn_bySNKPR_bySTATUS_limit1_forKlaim($id, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_HSN,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_sn a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('sn_klaimprogram c','c.SNSTOCK_ID=a.SNSTOCK_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('c.ID_SNKPR=', $id); $this->db->where('b.STATUS_SNSTOCK=', $status); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriSn_bySNSTOCK_forStokAging($id, $tgl_awal, $tgl_akhir) { // Used $this->db->select('*'); $this->db->from('histori_sn'); $this->db->where(['SNSTOCK_ID' => $id]); $this->db->where('TGL_HSN>=', $tgl_awal); $this->db->where('TGL_HSN<=', $tgl_akhir); $this->db->not_like('KODE_BUKTI','RJ','after'); $this->db->not_like('KODE_BUKTI','PB','after'); $this->db->not_like('KODE_BUKTI','SD','after'); $this->db->order_by('ID_HSN DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriSn_bySNSTOCK_orderASC($id) { // Used $this->db->select('*,DATE_FORMAT(TGL_HSN,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_sn'); $this->db->where(['SNSTOCK_ID' => $id]); $this->db->order_by('ID_HSN ASC'); return $this->db->get()->result_array(); } public function getData_HistoriSn_bySNSTOCK_orderASC_limit1($id) { // Used $this->db->select('*,DATE_FORMAT(TGL_HSN,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_sn'); $this->db->where(['SNSTOCK_ID' => $id]); $this->db->order_by('ID_HSN ASC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriSn_bySNSTOCK_orderDESC_limit1($id) { // Used $this->db->select('*,DATE_FORMAT(TGL_HSN,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_sn'); $this->db->where(['SNSTOCK_ID' => $id]); $this->db->order_by('ID_HSN DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_HistoriSn_bySNSTOCK_supplierNotNull_limit1($id) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_INVBELI,"%d/%m/%Y") as TANGGAL'); $this->db->from('histori_sn a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('pembelian c','c.INV_PEMBELIAN=a.INV_HSN'); $this->db->where(['a.SNSTOCK_ID' => $id]); $this->db->where('a.SUPPLIER_ID is NOT NULL'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_Jabatan_byID($id) { // Used $this->db->select('*'); $this->db->from('jabatan'); $this->db->where('ID_JABATAN=', $id); return $this->db->get()->result_array(); } public function getData_Jabatan_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('jabatan'); $this->db->where('ID_JABATAN=', $id); $this->db->where('STATUS_JABATAN=', $status); return $this->db->get()->result_array(); } public function getData_Jabatan_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('jabatan'); $this->db->where('NAMA_JABATAN=', $nama); $this->db->where('STATUS_JABATAN=', $status); if ($id!=null) { $this->db->where('ID_JABATAN!=', $id); } return $this->db->get()->result_array(); } public function getData_Jabatan_bySEARCH_status1_limit20($search=null) { // Used $this->db->select('*'); $this->db->from('jabatan'); if ($search!=null) { $this->db->where("STATUS_JABATAN=1 AND NAMA_JABATAN LIKE '%$search%'"); } else { $this->db->where('STATUS_JABATAN=1'); } $this->db->order_by('ID_JABATAN DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Jabatan_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('jabatan'); $this->db->where('STATUS_JABATAN=', $id); $this->db->order_by('NAMA_JABATAN ASC'); return $this->db->get()->result_array(); } public function getData_JadwalPengiriman_bySO($id) { // Used $this->db->select('*'); $this->db->from('jadwal_pengiriman a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where('a.SO_ID=', $id); return $this->db->get()->result_array(); } public function getData_JadwalPengiriman_tglKirimNow() { // Used $today = date('Y-m-d'); $this->db->select('*'); $this->db->from('jadwal_pengiriman a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=b.SALES_ID'); $this->db->join('penjualan f','f.SO_ID=a.SO_ID'); $this->db->where('b.TGL_KIRIM=', $today); return $this->db->get()->result_array(); } public function getData_JejakKunjungan_byPKPI($id) { // Used $this->db->select('*'); $this->db->from('jejak_kunjungan'); $this->db->where('PKPI_ID=', $id); return $this->db->get()->result_array(); } public function getData_Jenis_byID($id) { // Used $this->db->select('*'); $this->db->from('jenis'); $this->db->where('ID_JENIS=', $id); return $this->db->get()->result_array(); } public function getData_Jenis_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('jenis'); $this->db->where('ID_JENIS=', $id); $this->db->where('STATUS_JENIS=', $status); return $this->db->get()->result_array(); } public function getData_Jenis_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('jenis'); $this->db->where('NAMA_JENIS=', $nama); $this->db->where('STATUS_JENIS=', $status); if ($id!=null) { $this->db->where('ID_JENIS!=', $id); } return $this->db->get()->result_array(); } public function getData_Jenis_bySEARCH_status1_limit20_typeNotNonQty($search=null) { // Used $this->db->select('*'); $this->db->from('jenis'); if ($search!=null) { $this->db->where("STATUS_JENIS=1 AND TYPE_JENIS!=2 AND NAMA_JENIS LIKE '%$search%'"); } else { $this->db->where('STATUS_JENIS=1 AND TYPE_JENIS!=2'); } $this->db->order_by('ID_JENIS DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Jenis_bySKU_bySTATUS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('jenis'); $this->db->where('SKU_JENIS=', $id1); $this->db->where('STATUS_JENIS=', $id2); $this->db->order_by('NAMA_JENIS ASC'); return $this->db->get()->result_array(); } public function getData_Jenis_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('jenis'); $this->db->where('STATUS_JENIS=', $id); $this->db->order_by('NAMA_JENIS ASC'); return $this->db->get()->result_array(); } public function getData_Jenis_bySTATUS_typeNot2($status) { // Used $this->db->select('*'); $this->db->from('jenis'); $this->db->where('TYPE_JENIS!=2'); $this->db->where('STATUS_JENIS=', $status); $this->db->order_by('NAMA_JENIS ASC'); return $this->db->get()->result_array(); } public function getData_Jenis_byTYPE_bySTATUS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('jenis'); if ($id1!=null) { $this->db->where('TYPE_JENIS=', $id1); } $this->db->where('STATUS_JENIS=', $id2); $this->db->order_by('NAMA_JENIS ASC'); return $this->db->get()->result_array(); } public function getData_JenisKecuali() { // Used $this->db->select('*'); $this->db->from('jenis'); $this->db->where('ID_JENIS=1 OR ID_JENIS=3 OR ID_JENIS=4 OR ID_JENIS=5 OR ID_JENIS=6 OR ID_JENIS=7 OR ID_JENIS=8 OR ID_JENIS=25'); return $this->db->get()->result_array(); } public function getData_JenisFk() { // Used $this->db->select('*'); $this->db->from('jenis_fk'); $this->db->where('VERSI_JFK<=2'); $this->db->order_by('NAMA_JFK ASC'); return $this->db->get()->result_array(); } public function getData_JenisIo() { // Used $this->db->select('*'); $this->db->from('jenis_io'); $this->db->order_by('ID_JIO ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_allKaryawanOperasional() { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where('a.STATUS_KARYAWAN=1'); $this->db->where('a.ID_KARYAWAN!=1'); $this->db->where('a.USERNAME!="sugeng"'); $this->db->where('a.USERNAME!="none"'); $this->db->where('a.USERNAME!="itp"'); $this->db->where('a.USERNAME!="service"'); $this->db->where('a.USERNAME!="insentive"'); $this->db->where('a.USERNAME!="hwely"'); $this->db->where('a.USERNAME!="louis"'); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_allSales() { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where("a.STATUS_KARYAWAN=1 AND a.USERNAME LIKE 'sugeng'"); $this->db->or_where("b.NAMA_JABATAN LIKE '%SALES%'"); $this->db->not_like('a.USERNAME','hwely'); $this->db->not_like('a.USERNAME','itp'); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_allSalesKpi() { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where("a.STATUS_KARYAWAN=1 AND a.USERNAME LIKE 'sugeng'"); $this->db->or_where("a.STATUS_KARYAWAN=1 AND b.NAMA_JABATAN LIKE '%SALES%'"); //$this->db->or_where("b.NAMA_JABATAN LIKE '%SALES%'"); $this->db->not_like('a.USERNAME','hwely'); $this->db->not_like('a.USERNAME','itp'); $this->db->not_like('a.USERNAME','none'); $this->db->not_like('a.USERNAME','insentive'); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_allSalesProyek() { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where("b.NAMA_JABATAN LIKE '%SALES%'"); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_byID($id) { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where('a.ID_KARYAWAN=', $id); return $this->db->get()->result_array(); } public function getData_Karyawan_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('karyawan'); $this->db->where('ID_KARYAWAN=', $id); $this->db->where('STATUS_KARYAWAN=', $status); return $this->db->get()->result_array(); } public function getData_Karyawan_byDIVISI_byKADIV($divisi, $kadiv) { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where('b.DIVISI_ID=', $divisi); if ($kadiv==0) { $this->db->where("b.NAMA_JABATAN LIKE '%SALES%'"); } else { $this->db->where('a.ANGGOTA_KARYAWAN=', $kadiv); } $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_byTIM($id) { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where('a.TIM_KARYAWAN=', $id); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('karyawan'); $this->db->where('NAMA_KARYAWAN=', $nama); $this->db->where('STATUS_KARYAWAN=', $status); if ($id!=null) { $this->db->where('ID_KARYAWAN!=', $id); } return $this->db->get()->result_array(); } public function getData_Karyawan_byPANGGILAN($panggilan) { // Used $this->db->select('*'); $this->db->from('karyawan'); $this->db->where('NAMA_PANGGILAN_KARYAWAN=', $panggilan); return $this->db->get()->result_array(); } public function getData_Karyawan_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('karyawan'); $this->db->where('STATUS_KARYAWAN=', $id); $this->db->order_by('NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_byUSERNAME($id) { // Used $this->db->select('*'); $this->db->from('karyawan'); $this->db->where('USERNAME=', $id); return $this->db->get()->result_array(); } public function getData_Karyawan_forAbsensi() { // Used $this->db->select('*'); $this->db->from('karyawan'); $this->db->where('STATUS_KARYAWAN=1'); $this->db->where('KODE_KARYAWAN is NOT NULL'); $this->db->where('SYNC is NULL'); $this->db->order_by('NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_forAkuntansi() { // Used $this->db->select('*'); $this->db->from('karyawan'); $this->db->not_like('USERNAME','admin'); $this->db->not_like('USERNAME','insentive'); $this->db->not_like('USERNAME','none'); $this->db->not_like('USERNAME','itp'); $this->db->not_like('USERNAME','service'); $this->db->order_by('NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_status1_syncNULL_orderPANGGILAN() { // Used $this->db->select('*'); $this->db->from('karyawan'); $this->db->where('STATUS_KARYAWAN=1'); $this->db->where('SYNC is NULL'); $this->db->where('KODE_KARYAWAN is NOT NULL'); $this->db->order_by('NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_byJABATAN($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_MASUK,"%d/%m/%Y") as MASUK,DATE_FORMAT(a.TGL_LAHIR,"%d/%m/%Y") as LAHIR'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where('a.JABATAN_ID=', $id); $this->db->order_by('b.NAMA_JABATAN ASC, a.NAMA_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_byJABATAN_bySTATUS($id1, $id2) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_MASUK,"%d/%m/%Y") as MASUK,DATE_FORMAT(a.TGL_LAHIR,"%d/%m/%Y") as LAHIR'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); if ($id1!=null) { $this->db->where('a.JABATAN_ID=', $id1); } $this->db->where('a.STATUS_KARYAWAN=', $id2); $this->db->order_by('b.NAMA_JABATAN ASC, a.NAMA_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_bySEARCH_allStatus_limit30($search=null, $verse=null) { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); if ($search!=null) { if ($verse==1) { $this->db->where("a.STATUS_KARYAWAN=1 AND a.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%' AND b.NAMA_JABATAN LIKE '%SALES%'"); $this->db->or_where("a.STATUS_KARYAWAN=1 AND b.NAMA_JABATAN LIKE '%$search%' AND b.NAMA_JABATAN LIKE '%SALES%'"); $this->db->not_like('a.NAMA_PANGGILAN_KARYAWAN', 'Itp'); } else if ($verse==2) { $this->db->where("a.STATUS_KARYAWAN=1 AND a.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } } else { $this->db->where("a.STATUS_KARYAWAN=1 AND b.NAMA_JABATAN LIKE '%SALES%'"); $this->db->not_like('a.NAMA_PANGGILAN_KARYAWAN', 'Itp'); } $this->db->group_by('a.NAMA_PANGGILAN_KARYAWAN'); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); $this->db->limit('30'); return $this->db->get()->result_array(); } public function getData_Karyawan_Penjadwalan() { // Used $this->db->select('*, b.NAMA_JABATAN'); $this->db->from('karyawan a'); $this->db->join('jabatan b', 'b.ID_JABATAN=a.JABATAN_ID'); $this->db->where('a.ID_KARYAWAN!=1'); $this->db->where('a.STATUS_KARYAWAN=1'); $this->db->not_like('a.USERNAME','none'); $this->db->not_like('a.USERNAME','hwely'); $this->db->not_like('a.USERNAME','sugeng'); $this->db->not_like('a.USERNAME','insentive'); $this->db->not_like('a.USERNAME','itp'); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_SalesFormKaryawan() { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->like('a.USERNAME','sugeng'); $this->db->or_like('b.NAMA_JABATAN','SALES'); $this->db->not_like('a.USERNAME','amin'); $this->db->not_like('a.USERNAME','inas'); $this->db->not_like('a.USERNAME','insentive'); $this->db->not_like('a.USERNAME','itp'); $this->db->not_like('a.USERNAME','none'); $this->db->not_like('a.USERNAME','nurul'); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_byDIVISI_teamLeaderOnly($id) { // Used $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where('a.ANGGOTA_KARYAWAN=a.ID_KARYAWAN'); $this->db->where('b.DIVISI_ID=', $id); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Kas_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('kas'); $this->db->where('ID_KAS=', $id); $this->db->where('STATUS_KAS=', $status); return $this->db->get()->result_array(); } public function getData_Kas_byID($id) { // Used $this->db->select('*'); $this->db->from('kas'); $this->db->where('ID_KAS=', $id); return $this->db->get()->result_array(); } public function getData_Kas_byKODE_bySTATUS($kode, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('kas'); $this->db->where('KODE_KAS=', $kode); $this->db->where('STATUS_KAS=', $status); if ($id!=null) { $this->db->where('ID_KAS!=', $id); } return $this->db->get()->result_array(); } public function getData_Kas_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('kas'); $this->db->where('STATUS_KAS=', $id); $this->db->order_by('ID_KAS ASC'); return $this->db->get()->result_array(); } public function getData_Kas_notThis($id) { // Used $this->db->select('*'); $this->db->from('kas'); $this->db->where('ID_KAS!=', $id); $this->db->order_by('KODE_KAS ASC'); return $this->db->get()->result_array(); } public function getData_Kelompok_byID($id) { // Used $this->db->select('*'); $this->db->from('kelompok'); $this->db->where(['ID_KELOMPOK' => $id]); return $this->db->get()->result_array(); } public function getData_Kelompok_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('kelompok'); $this->db->where('ID_KELOMPOK=', $id); $this->db->where('STATUS_KELOMPOK=', $status); return $this->db->get()->result_array(); } public function getData_Kelompok_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('kelompok'); $this->db->where('NAMA_KELOMPOK=', $nama); $this->db->where('STATUS_KELOMPOK=', $status); if ($id!=null) { $this->db->where('ID_KELOMPOK!=', $id); } return $this->db->get()->result_array(); } public function getData_Kelompok_bySEARCH_status1_limit20($search=null) { // Used $this->db->select('*'); $this->db->from('kelompok'); if ($search!=null) { $this->db->where("STATUS_KELOMPOK=1 AND NAMA_KELOMPOK LIKE '%$search%'"); } else { $this->db->where('STATUS_KELOMPOK=1'); } $this->db->order_by('ID_KELOMPOK DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Kelompok_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('kelompok'); $this->db->where('STATUS_KELOMPOK=', $id); $this->db->order_by('NAMA_KELOMPOK ASC'); return $this->db->get()->result_array(); } public function getData_Kendaraan_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('kendaraan'); $this->db->where('ID_KENDARAAN=', $id); $this->db->where('STATUS_KENDARAAN=', $status); return $this->db->get()->result_array(); } public function getData_Kendaraan_byID($id) { // Used $this->db->select('*'); $this->db->from('kendaraan'); $this->db->where('ID_KENDARAAN=', $id); return $this->db->get()->result_array(); } public function getData_Kendaraan_byNOPOL_bySTATUS($nopol, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('kendaraan'); $this->db->where('NOPOL_KENDARAAN=', $nopol); $this->db->where('STATUS_KENDARAAN=', $status); if ($id!=null) { $this->db->where('ID_KENDARAAN!=', $id); } return $this->db->get()->result_array(); } public function getData_Kendaraan_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('kendaraan'); $this->db->where('STATUS_KENDARAAN=', $id); $this->db->order_by('TYPE_KENDARAAN ASC, NOPOL_KENDARAAN ASC'); return $this->db->get()->result_array(); } public function getData_Kendaraan_byTYPE_bySTATUS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('kendaraan'); if ($id1!=null) { $this->db->where('TYPE_KENDARAAN=', $id1); } $this->db->where('STATUS_KENDARAAN=', $id2); $this->db->order_by('TYPE_KENDARAAN ASC, NOPOL_KENDARAAN ASC'); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byBARANG_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('klaim_program'); $this->db->where(['BARANG_ID' => $id]); $this->db->where(['STATUS_KPR' => $status]); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byDB($id) { // Used $this->db->select('*'); $this->db->from('klaim_program a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.DB_ID' => $id]); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byID($id) { // Used $this->db->select('*'); $this->db->from('klaim_program a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.ID_KPR' => $id]); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byID_bySTATUS($id, $status=null) { // Used $this->db->select('*'); $this->db->from('klaim_program a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.ID_KPR' => $id]); if ($status!=null OR $status==0) { $this->db->where(['a.STATUS_KPR' => $status]); } return $this->db->get()->result_array(); } public function getData_KlaimProgram_byMERK_byPRODUK_byPERIODE($id_merk, $id_produk, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_KPR,"%d/%m/%Y") as TANGGAL'); $this->db->from('klaim_program a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('daftar_beli d','d.ID_DB=a.DB_ID'); $this->db->where('c.MERK_ID=', $id_merk); $this->db->where('c.PRODUK_ID=', $id_produk); $this->db->where('a.TGL_KPR>=', $awal); $this->db->where('a.TGL_KPR<=', $akhir); $this->db->where('a.STATUS_KPR!=9'); $this->db->order_by('a.TGL_KPR DESC, a.NOTA_KPR ASC'); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byMERK_byPRODUK_bySEARCH_limit20($id_merk, $id_produk, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_KPR,"%d/%m/%Y") as TANGGAL, FORMAT(a.HARGA_KPR, 2) as HARGA'); $this->db->from('klaim_program a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID'); if ($search!=null) { $this->db->where("d.MERK_ID=$id_merk AND d.PRODUK_ID=$id_produk AND a.STATUS_KPR!=9 AND a.NOTA_KPR LIKE '%$search%'"); $this->db->or_where("d.MERK_ID=$id_merk AND d.PRODUK_ID=$id_produk AND a.STATUS_KPR!=9 AND b.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("d.MERK_ID=$id_merk AND d.PRODUK_ID=$id_produk AND a.STATUS_KPR!=9 AND c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("d.MERK_ID=$id_merk AND d.PRODUK_ID=$id_produk AND a.STATUS_KPR!=9 AND d.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("d.MERK_ID=$id_merk AND d.PRODUK_ID=$id_produk AND a.STATUS_KPR!=9 AND d.NAMA_BARANG LIKE '%$search%'"); } else { $this->db->where('d.MERK_ID=', $id_merk); $this->db->where('d.PRODUK_ID=', $id_produk); $this->db->where('a.STATUS_KPR!=9'); } $this->db->order_by('a.ID_KPR DESC, d.KODE_BARANG DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byMERK_byPRODUK_bySTATUS_spNotNull($id_merk, $id_produk, $status) { // Used $this->db->select('*'); $this->db->from('klaim_program a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->where('b.MERK_ID=', $id_merk); $this->db->where('b.PRODUK_ID=', $id_produk); $this->db->where('a.STATUS_KPR=', $status); $this->db->where('a.SP_KPR is NOT NULL'); $this->db->order_by('a.ID_KPR DESC'); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byMERK_byPRODUK_groupBARANG($id_merk, $id_produk) { // Used $this->db->select('*'); $this->db->from('klaim_program a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('b.MERK_ID=', $id_merk); $this->db->where('b.PRODUK_ID=', $id_produk); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('b.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byMERK_byPRODUK_groupJENIS($id1=null, $id2=null) { // Used $this->db->select('*'); $this->db->from('klaim_program a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('merk c','c.ID_MERK=b.MERK_ID'); $this->db->join('produk d','d.ID_PRODUK=b.PRODUK_ID'); $this->db->join('jenis e','e.ID_JENIS=b.JENIS_ID'); if ($id1!=null) { $this->db->where('b.MERK_ID=', $id1); } if ($id2!=null) { $this->db->where('b.PRODUK_ID=', $id2); } $this->db->group_by('b.JENIS_ID'); $this->db->order_by('e.NAMA_JENIS ASC'); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byNOTA($nota) { // Used $this->db->select('*'); $this->db->from('klaim_program'); $this->db->where(['NOTA_KPR' => $nota]); return $this->db->get()->result_array(); } public function getData_KlaimProgram_groupBARANG() { // Used $this->db->select('*'); $this->db->from('klaim_program'); $this->db->where('STATUS_KPR=0'); $this->db->group_by('BARANG_ID'); $this->db->order_by('BARANG_ID ASC'); return $this->db->get()->result_array(); } public function getData_KlaimProgram_byMERK_byPRODUK_groupBARANG_status0($id_merk, $id_produk) { // Used $this->db->select('*'); $this->db->from('klaim_program a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('a.STATUS_KPR=0'); $this->db->where('b.SP_BARANG is NULL'); $this->db->where('b.MERK_ID=', $id_merk); $this->db->where('b.PRODUK_ID=', $id_produk); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('a.BARANG_ID ASC'); return $this->db->get()->result_array(); } public function getData_KlaimProgram_groupMERK() { // Used $this->db->select('*'); $this->db->from('klaim_program a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('merk c','c.ID_MERK=b.MERK_ID'); $this->db->group_by('b.MERK_ID'); $this->db->order_by('c.NAMA_MERK ASC'); return $this->db->get()->result_array(); } public function getData_Konsinyasi_byGUDANG_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('konsinyasi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->where(['a.GUDANG_ID' => $id]); $this->db->where(['a.STATUS_KONSINYASI' => $status]); return $this->db->get()->result_array(); } public function getData_Konsinyasi_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('konsinyasi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->join('status_konsinyasi d','d.ID_SKON=a.STATUS_KONSINYASI'); $this->db->where('a.ID_KONSINYASI=', $id); return $this->db->get()->result_array(); } public function getData_Konsinyasi_byID_byGUDANG_bySTATUS($id, $gudang, $status) { // Used $this->db->select('*'); $this->db->from('konsinyasi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->where(['a.ID_KONSINYASI' => $id]); $this->db->where(['a.GUDANG_ID' => $gudang]); $this->db->where(['a.STATUS_KONSINYASI' => $status]); return $this->db->get()->result_array(); } public function getData_Konsinyasi_byJENIS_bySTATUS_groupPELANGGAN($jenis, $status) { // Used $this->db->select('b.*'); $this->db->from('konsinyasi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.JENIS_KONSINYASI=', $jenis); $this->db->where('a.STATUS_KONSINYASI=', $status); $this->db->group_by('a.PELANGGAN_ID'); $this->db->order_by('b.ALIAS_PELANGGAN ASC, b.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_Konsinyasi_byJENIS_statusMore1($jenis) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('konsinyasi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where(['a.JENIS_KONSINYASI' => $jenis]); $this->db->where('a.STATUS_KONSINYASI>=1'); return $this->db->get()->result_array(); } public function getData_Konsinyasi_byPELANGGAN_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('konsinyasi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.PELANGGAN_ID=', $id); $this->db->where('a.STATUS_KONSINYASI=', $status); return $this->db->get()->result_array(); } public function getData_Konsinyasi_bySEARCH_allStatus_limit20($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL, d.NAMA_PANGGILAN_KARYAWAN as NAGUD, e.NAMA_PANGGILAN_KARYAWAN as NASAL'); $this->db->from('konsinyasi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID'); $this->db->join('status_konsinyasi f','f.ID_SKON=a.STATUS_KONSINYASI'); if ($search!=null) { $this->db->where("a.KODE_KONSINYASI LIKE '%$search%'"); $this->db->or_where("b.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("d.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("f.NAMA_SKON LIKE '%$search%'"); } $this->db->order_by('a.KODE_KONSINYASI DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Konsinyasi_bySTATUS_byJENIS($status, $jenis) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('konsinyasi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where(['a.STATUS_KONSINYASI' => $status]); $this->db->where(['a.JENIS_KONSINYASI' => $jenis]); return $this->db->get()->result_array(); } public function getData_Kop() { // Used $this->db->select('*'); $this->db->from('kop'); return $this->db->get()->result_array(); } public function getData_Kop_byID($id) { // Used $this->db->select('*'); $this->db->from('kop'); $this->db->where('ID_KOP=', $id); return $this->db->get()->result_array(); } public function getData_Kota_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('kota'); $this->db->where('ID_KOTA=', $id); $this->db->where('STATUS_KOTA=', $status); return $this->db->get()->result_array(); } public function getData_Kota_byID($id) { // Used $this->db->select('*'); $this->db->from('kota'); $this->db->where('ID_KOTA=', $id); return $this->db->get()->result_array(); } public function getData_Kota_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('kota'); $this->db->where('NAMA_KOTA=', $nama); $this->db->where('STATUS_KOTA=', $status); if ($id!=null) { $this->db->where('ID_KOTA!=', $id); } return $this->db->get()->result_array(); } public function getData_Kota_bySEARCH_status1_limit20($search=null) { // Used $this->db->select('*'); $this->db->from('kota'); if ($search!=null) { $this->db->where("STATUS_KOTA=1 AND NAMA_KOTA LIKE '%$search%'"); } else { $this->db->where('STATUS_KOTA=1'); } $this->db->order_by('ID_KOTA DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Kota_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('kota'); $this->db->where('STATUS_KOTA=', $id); $this->db->order_by('NAMA_KOTA ASC'); return $this->db->get()->result_array(); } public function getData_Kpi_byDIVISI($id) { // Used $this->db->select('*'); $this->db->from('kpi'); $this->db->where('DIVISI_ID=', $id); $this->db->order_by('NAMA_KPI ASC'); return $this->db->get()->result_array(); } public function getData_Kuantiti_byBARANG($id) { // Used $this->db->select('*,c.TYPE_JENIS'); $this->db->from('kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.ID_KUANTITI'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['b.ID_BARANG' => $id]); return $this->db->get()->result_array(); } public function getData_Kuantiti_byGUDANG_byJENIS_byMERK_byPRODUK($jenis_gudang, $id_jenis=null, $id_merk=null, $id_produk=null, $textSearch = null) { // Used if ($jenis_gudang==1) { $this->db->select('*,a.ANTIK_KUANTITI as QTY'); $this->db->where('a.ANTIK_KUANTITI>0'); } else if ($jenis_gudang==2) { $this->db->select('*,a.GLOBAL_KUANTITI as QTY'); $this->db->where('a.GLOBAL_KUANTITI>0'); } else if ($jenis_gudang==3) { $this->db->select('*,a.ITP_KUANTITI as QTY'); $this->db->where('a.ITP_KUANTITI>0'); } else if ($jenis_gudang==4) { $this->db->select('*,a.KONSINYASI_KUANTITI as QTY'); $this->db->where('a.KONSINYASI_KUANTITI>0'); } else if ($jenis_gudang==5) { $this->db->select('*,a.PCM_KUANTITI as QTY'); $this->db->where('a.PCM_KUANTITI>0'); } else if ($jenis_gudang==6) { $this->db->select('*,a.PEMINJAMAN_KUANTITI as QTY'); $this->db->where('a.PEMINJAMAN_KUANTITI>0'); } else if ($jenis_gudang==7) { $this->db->select('*,a.PENDING_KUANTITI as QTY'); $this->db->where('a.PENDING_KUANTITI>0'); } else if ($jenis_gudang==8) { $this->db->select('*,a.PROYEK_KUANTITI as QTY'); $this->db->where('a.PROYEK_KUANTITI>0'); } else if ($jenis_gudang==9) { $this->db->select('*,a.SERVICE_KUANTITI as QTY'); $this->db->where('a.SERVICE_KUANTITI>0'); } else if ($jenis_gudang==10) { $this->db->select('*,a.SEWA_KUANTITI as QTY'); $this->db->where('a.SEWA_KUANTITI>0'); } $this->db->from('kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.ID_KUANTITI'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->order_by('c.NAMA_JENIS ASC, b.KODE_BARANG ASC'); if ($id_jenis!=NULL) { $this->db->where('b.JENIS_ID=', $id_jenis); } if ($id_merk!=NULL) { $this->db->where('b.MERK_ID=', $id_merk); } if ($id_produk!=NULL) { $this->db->where('b.PRODUK_ID=', $id_produk); } if ($textSearch!=NULL) { $this->db->like('b.KODE_BARANG', $textSearch); } return $this->db->get()->result_array(); } public function getData_Kuantiti_byID($id=null) { // Used if ($id==null) { $this->db->select('*'); $this->db->from('kuantiti'); } else { $this->db->select('*'); $this->db->from('kuantiti'); $this->db->where(['ID_KUANTITI' => $id]); } return $this->db->get()->result_array(); } public function getData_Kuantiti_byJENISID_more0($id) { // Used $this->db->select('*'); $this->db->from('kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.ID_KUANTITI'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where('a.GLOBAL_KUANTITI>0'); $this->db->where('c.ID_JENIS=', $id); return $this->db->get()->result_array(); } public function getData_Kuantiti_byJENIS_more0($id) { // Used $this->db->select('*'); $this->db->from('kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.ID_KUANTITI'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where('a.GLOBAL_KUANTITI>0'); $this->db->where('c.TYPE_JENIS=', $id); return $this->db->get()->result_array(); } public function getData_Kuantiti_bySEARCH_allStatus_limit100($search=null, $filter1, $filter2, $filter3, $filter4=null, $filter5=null, $filter6) { // Used $this->db->select('*'); $this->db->from('kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.ID_KUANTITI'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where('b.STATUS_BARANG=1'); $this->db->where('c.TYPE_JENIS!=2'); if ($filter4!=null) { $this->db->where('b.JENIS_ID=', $filter4); } if ($filter5!=null) { $this->db->where('b.MERK_ID=', $filter5); } if ($search!=null) { if ($filter1==0) { if ($filter2==0) { $this->db->where('a.GLOBAL_KUANTITI=0'); } else if ($filter2==1) { $this->db->where('a.PCM_KUANTITI=0'); } else if ($filter2==2) { $this->db->where('a.ITP_KUANTITI=0'); } else if ($filter2==3) { $this->db->where('a.SERVICE_KUANTITI=0'); } } else if ($filter1==1) { if ($filter2==0) { $this->db->where('a.GLOBAL_KUANTITI>0'); } else if ($filter2==1) { $this->db->where('a.PCM_KUANTITI>0'); } else if ($filter2==2) { $this->db->where('a.ITP_KUANTITI>0'); } else if ($filter2==3) { $this->db->where('a.SERVICE_KUANTITI>0'); } } else if ($filter1==2) { if ($filter2==0) { $this->db->where('a.GLOBAL_KUANTITI>=0'); } else if ($filter2==1) { $this->db->where('a.PCM_KUANTITI>=0'); } else if ($filter2==2) { $this->db->where('a.ITP_KUANTITI>=0'); } else if ($filter2==3) { $this->db->where('a.SERVICE_KUANTITI>=0'); } } foreach ($search as $key) { if ($filter3==1) { $this->db->where("b.KODE_BARANG LIKE '%$key%'"); } else if ($filter3==2) { $this->db->where("b.NAMA_BARANG LIKE '%$key%'"); } } } else { $this->db->where('a.ID_KUANTITI is NULL'); } if ($filter6==1) { if ($filter2==0) { $this->db->order_by('a.GLOBAL_KUANTITI ASC, b.KODE_BARANG ASC'); } else if ($filter2==1) { $this->db->order_by('a.PCM_KUANTITI ASC, b.KODE_BARANG ASC'); } else if ($filter2==2) { $this->db->order_by('a.ITP_KUANTITI ASC, b.KODE_BARANG ASC'); } else if ($filter2==3) { $this->db->order_by('a.SERVICE_KUANTITI ASC, b.KODE_BARANG ASC'); } } else if ($filter6==2) { if ($filter2==0) { $this->db->order_by('a.GLOBAL_KUANTITI DESC, b.KODE_BARANG DESC'); } else if ($filter2==1) { $this->db->order_by('a.PCM_KUANTITI DESC, b.KODE_BARANG DESC'); } else if ($filter2==2) { $this->db->order_by('a.ITP_KUANTITI DESC, b.KODE_BARANG DESC'); } else if ($filter2==3) { $this->db->order_by('a.SERVICE_KUANTITI DESC, b.KODE_BARANG DESC'); } } $this->db->limit('100'); return $this->db->get()->result_array(); } public function getData_Kuantiti_forPricelist() { // Used $this->db->select('*, (a.PCM_KUANTITI+a.ITP_KUANTITI) as TOTAL'); $this->db->from('kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.ID_KUANTITI'); return $this->db->get()->result_array(); } public function getData_Kuantiti_morethan0() { // Used $this->db->select('*'); $this->db->from('kuantiti'); $this->db->where('GLOBAL_KUANTITI>0'); return $this->db->get()->result_array(); } public function getData_Kunjungan_byID($id) { // Used $this->db->select('*'); $this->db->from('kunjungan a'); $this->db->join('status_kunjungan b','b.ID_SKUN=a.STATUS_KUNJUNGAN'); $this->db->where('ID_KUNJUNGAN=', $id); return $this->db->get()->result_array(); } public function getData_Kunjungan_byPERIODE_statusNot9($awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_KUNJUNGAN,"%d/%m%/%Y") as TANGGAL'); $this->db->from('kunjungan a'); $this->db->join('status_kunjungan b','b.ID_SKUN=a.STATUS_KUNJUNGAN'); $this->db->where('a.TGL_KUNJUNGAN>=', $awal); $this->db->where('a.TGL_KUNJUNGAN<=', $akhir); $this->db->where('a.STATUS_KUNJUNGAN!=9'); if ($search!=null) { $this->db->where('a.ID_KUNJUNGAN=', $search); } $this->db->order_by('a.TGL_KUNJUNGAN ASC, a.PELANGGAN_KUNJUNGAN ASC'); return $this->db->get()->result_array(); } public function getData_Kunjungan_byTGL_statusNot9($tgl) { // Used $this->db->select('*'); $this->db->from('kunjungan a'); $this->db->join('status_kunjungan b','b.ID_SKUN=a.STATUS_KUNJUNGAN'); $this->db->where('TGL_KUNJUNGAN=', $tgl); $this->db->where('STATUS_KUNJUNGAN!=9'); return $this->db->get()->result_array(); } public function getData_Kwitansi_byID($id) { // Used $this->db->select('*, FORMAT(a.NILAI_KWITANSI, 2) as NILAI, DATE_FORMAT(a.TGL_KWITANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('kwitansi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.ID_KWITANSI=', $id); return $this->db->get()->result_array(); } public function getData_Kwitansi_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('kwitansi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_KWITANSI=', $id); $this->db->where('a.STATUS_KWITANSI=', $status); return $this->db->get()->result_array(); } public function getData_Kwitansi_byKARYAWAN_bySTATUS_orderDESC($id1, $id2) { // Used $this->db->select('*, FORMAT(a.NILAI_KWITANSI, 2) as NILAI, DATE_FORMAT(a.TGL_KWITANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('kwitansi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.KARYAWAN_ID=', $id1); $this->db->where('a.STATUS_KWITANSI=', $id2); $this->db->order_by('a.ID_KWITANSI DESC'); return $this->db->get()->result_array(); } public function getData_Kwitansi_bySTATUS_orderDESC($id) { // Used $this->db->select('*, FORMAT(a.NILAI_KWITANSI, 2) as NILAI, DATE_FORMAT(a.TGL_KWITANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('kwitansi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.STATUS_KWITANSI=', $id); $this->db->order_by('a.ID_KWITANSI DESC'); return $this->db->get()->result_array(); } public function getData_Kwitansi_joinUMNull_orderDESC() { // Used $this->db->select('*, FORMAT(a.NILAI_KWITANSI, 2) as NILAI, DATE_FORMAT(a.TGL_KWITANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('kwitansi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('uang_muka d','d.KWITANSI_ID=a.ID_KWITANSI','left'); $this->db->where('d.ID_UM is NULL'); $this->db->where('a.STATUS_KWITANSI=1'); $this->db->order_by('a.ID_KWITANSI DESC'); return $this->db->get()->result_array(); } public function getData_LinkKlaimProgram_byID_RKPRNull($id) { // Used $this->db->select('*'); $this->db->from('link_klaimprogram a'); $this->db->join('sn_klaimprogram b','b.ID_SNKPR=a.SNKPR_ID'); $this->db->join('klaim_program c','c.ID_KPR=b.KPR_ID'); $this->db->join('barang d','d.ID_BARANG=c.BARANG_ID'); $this->db->where('a.ID_LKPR=', $id); $this->db->where('a.RKPR_ID is NULL'); return $this->db->get()->result_array(); } public function getData_LinkKlaimProgram_byMERK_byPRODUK_byPROGRAM_byPERIODE($id_merk=null, $id_produk=null, $id_program=null, $nama_promo=null, $awal, $akhir) { // Used $this->db->select('*, FORMAT(a.NILAI_LKPR,2) as NILAI, DATE_FORMAT(a.TGL_LKPR,"%d/%m/%Y") as TANGGAL'); $this->db->from('link_klaimprogram a'); $this->db->join('program b','b.ID_PROGRAM=a.PROGRAM_ID'); $this->db->join('potongan_klaimprogram c','c.ID_PKPR=a.PKPR_ID'); $this->db->join('sn_klaimprogram d','d.ID_SNKPR=a.SNKPR_ID'); $this->db->join('klaim_program e','e.ID_KPR=d.KPR_ID'); $this->db->join('barang f','f.ID_BARANG=e.BARANG_ID'); if ($id_merk!=null) { $this->db->where('f.MERK_ID=', $id_merk); } if ($id_produk!=null) { $this->db->where('f.PRODUK_ID=', $id_produk); } if ($id_program!=null) { $this->db->where('a.PROGRAM_ID=', $id_program); if ($nama_promo!=null) { $this->db->where('c.NAMA_PKPR=', $nama_promo); } } $this->db->where('a.TGL_LKPR>=', $awal); $this->db->where('a.TGL_LKPR<=', $akhir); $this->db->order_by('a.TGL_LKPR ASC, f.NAMA_BARANG ASC, d.NAMA_SNKPR ASC'); return $this->db->get()->result_array(); } public function getData_LinkKlaimProgram_byMERK_byPRODUK_groupPKPR_forRekap($id_merk=null, $id_produk=null) { // Used $this->db->select('*,COUNT(d.ID_SNKPR) as CKP,FORMAT(SUM(a.NILAI_LKPR),2) as NILAI,DATE_FORMAT(a.TGL_LKPR,"%d/%m/%Y") as TANGGAL'); $this->db->from('link_klaimprogram a'); $this->db->join('program b','b.ID_PROGRAM=a.PROGRAM_ID'); $this->db->join('potongan_klaimprogram c','c.ID_PKPR=a.PKPR_ID'); $this->db->join('sn_klaimprogram d','d.ID_SNKPR=a.SNKPR_ID'); $this->db->join('klaim_program e','e.ID_KPR=d.KPR_ID'); $this->db->join('barang f','f.ID_BARANG=e.BARANG_ID'); if ($id_merk!=null) { $this->db->where('f.MERK_ID=', $id_merk); } if ($id_produk!=null) { $this->db->where('f.PRODUK_ID=', $id_produk); } $this->db->where('e.STATUS_KPR!=9'); $this->db->where('a.RKPR_ID is NULL'); $this->db->group_by('a.PKPR_ID'); $this->db->having('NILAI>0'); $this->db->order_by('c.NAMA_PKPR ASC'); return $this->db->get()->result_array(); } public function getData_LinkKlaimProgram_byPKPR_byMERK_byPRODUK_RKPRNull($id1, $id2, $id3, $id4=null) { // Used $this->db->select('*,FORMAT(a.NILAI_LKPR,2) as NILAI, DATE_FORMAT(a.TGL_LKPR,"%d/%m/%Y") as TANGGAL'); $this->db->from('link_klaimprogram a'); $this->db->join('sn_klaimprogram b','b.ID_SNKPR=a.SNKPR_ID'); $this->db->join('klaim_program c','c.ID_KPR=b.KPR_ID'); $this->db->join('barang d','d.ID_BARANG=c.BARANG_ID'); $this->db->join('program e','e.ID_PROGRAM=a.PROGRAM_ID'); $this->db->where('a.PKPR_ID=', $id1); $this->db->where('d.MERK_ID=', $id2); $this->db->where('d.PRODUK_ID=', $id3); if ($id4!=null) { $this->db->where('a.SNKPR_ID=', $id4); } $this->db->where('a.RKPR_ID is NULL'); $this->db->order_by('d.KODE_BARANG ASC,b.NAMA_SNKPR ASC'); return $this->db->get()->result_array(); } public function getData_LinkKlaimProgram_byRKPR($id) { // Used $this->db->select('*'); $this->db->from('link_klaimprogram'); $this->db->where('RKPR_ID=', $id); return $this->db->get()->result_array(); } public function getData_LinkKlaimProgram_bySNKPR($id) { // Used $this->db->select('*,FORMAT(a.NILAI_LKPR,2) as NILAI,DATE_FORMAT(a.TGL_LKPR,"%d/%m/%Y") as TANGGAL'); $this->db->from('link_klaimprogram a'); $this->db->join('program b','b.ID_PROGRAM=a.PROGRAM_ID'); $this->db->join('potongan_klaimprogram c','c.ID_PKPR=a.PKPR_ID'); $this->db->where('a.SNKPR_ID=', $id); $this->db->order_by('a.ID_LKPR ASC'); return $this->db->get()->result_array(); } public function getData_Menu_byKODE_byNAMA($id1, $id2) { // Used $this->db->select('*'); $this->db->from('menu'); $this->db->where('KODE_MENU=', $id1); $this->db->where('NAMA_MENU=', $id2); return $this->db->get()->result_array(); } public function getData_Merk_byID($id) { // Used $this->db->select('*'); $this->db->from('merk'); $this->db->where('ID_MERK=', $id); return $this->db->get()->result_array(); } public function getData_Merk_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('merk'); $this->db->where('ID_MERK=', $id); $this->db->where('STATUS_MERK=', $status); return $this->db->get()->result_array(); } public function getData_Merk_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('merk'); $this->db->where('NAMA_MERK=', $nama); $this->db->where('STATUS_MERK=', $status); if ($id!=null) { $this->db->where('ID_MERK!=', $id); } return $this->db->get()->result_array(); } public function getData_Merk_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('merk'); $this->db->where('STATUS_MERK=', $id); $this->db->order_by('NAMA_MERK ASC'); return $this->db->get()->result_array(); } public function getData_Model_byID($id) { // Used $this->db->select('*'); $this->db->from('model'); $this->db->where('ID_MODEL=', $id); return $this->db->get()->result_array(); } public function getData_Model_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('model'); $this->db->where('ID_MODEL=', $id); $this->db->where('STATUS_MODEL=', $status); return $this->db->get()->result_array(); } public function getData_Model_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('model'); $this->db->where('NAMA_MODEL=', $nama); $this->db->where('STATUS_MODEL=', $status); if ($id!=null) { $this->db->where('ID_MODEL!=', $id); } return $this->db->get()->result_array(); } public function getData_Model_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('model'); $this->db->where('STATUS_MODEL=', $id); $this->db->order_by('NAMA_MODEL ASC'); return $this->db->get()->result_array(); } public function getData_Modifikasi_byGUDANG_byJENIS_byBARANG_kunciNull($id1, $id2, $id3) { // Used $this->db->select('*'); $this->db->from('modifikasi'); $this->db->where(['GUDANG_ID' => $id1]); if ($id2==0) { $this->db->where(['ASAL_MODIFIKASI' => $id3]); } else if ($id2==1) { $this->db->where(['HASIL_MODIFIKASI' => $id3]); } $this->db->where('KUNCI_MODIFIKASI is NULL'); return $this->db->get()->result_array(); } public function getData_Modifikasi_byGUDANG_kunciNull($id) { // Used $this->db->select('*, c.KODE_BARANG as CKODE, c.NAMA_BARANG as CNAMA, d.KODE_BARANG as DKODE, d.NAMA_BARANG as DNAMA'); $this->db->from('modifikasi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('barang c','c.ID_BARANG=a.ASAL_MODIFIKASI'); $this->db->join('barang d','d.ID_BARANG=a.HASIL_MODIFIKASI','left'); $this->db->where(['a.GUDANG_ID' => $id]); $this->db->where('a.KUNCI_MODIFIKASI is NULL'); return $this->db->get()->result_array(); } public function getData_Modifikasi_byID_byGUDANG_kunciNull($id1, $id2) { // Used $this->db->select('*, c.KODE_BARANG as CKODE, c.NAMA_BARANG as CNAMA, d.KODE_BARANG as DKODE, d.NAMA_BARANG as DNAMA'); $this->db->from('modifikasi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('barang c','c.ID_BARANG=a.ASAL_MODIFIKASI'); $this->db->join('barang d','d.ID_BARANG=a.HASIL_MODIFIKASI','left'); $this->db->where(['a.ID_MODIFIKASI' => $id1]); $this->db->where(['a.GUDANG_ID' => $id2]); $this->db->where('a.KUNCI_MODIFIKASI is NULL'); return $this->db->get()->result_array(); } public function getData_MutasiBarang_byADMIN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('mutasi_barang a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.ADMIN_ID'); $this->db->where(['a.ADMIN_ID' => $id]); $this->db->where(['a.STATUS_MB' => $status]); return $this->db->get()->result_array(); } public function getData_MutasiBarang_byID($id) { // Used $this->db->select('*'); $this->db->from('mutasi_barang a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.ADMIN_ID'); $this->db->join('jenis_mb c','c.ID_JMB=a.JENIS_MB'); $this->db->where(['a.ID_MB' => $id]); return $this->db->get()->result_array(); } public function getData_MutasiBarang_byID_byADMIN_bySTATUS($id, $admin, $status) { // Used $this->db->select('*'); $this->db->from('mutasi_barang a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.ADMIN_ID'); $this->db->where(['a.ID_MB' => $id]); $this->db->where(['a.ADMIN_ID' => $admin]); $this->db->where(['a.STATUS_MB' => $status]); return $this->db->get()->result_array(); } public function getData_MutasiBarang_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('mutasi_barang a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.ADMIN_ID'); $this->db->where(['a.ID_MB' => $id]); $this->db->where(['a.STATUS_MB' => $status]); return $this->db->get()->result_array(); } public function getData_MutasiBarang_byMODE_byJENIS($mode, $jenis) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_MB,"%d/%m/%Y") as TANGGAL'); $this->db->from('mutasi_barang a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.ADMIN_ID'); if ($mode==1) { if ($jenis==0 OR $jenis==2) { $this->db->where('a.JENIS_MB=0 AND a.STATUS_MB=1'); $this->db->or_where('a.JENIS_MB=2 AND a.STATUS_MB=1'); } else if ($jenis==1) { $this->db->where('a.JENIS_MB=1 AND a.STATUS_MB=1'); } else if ($jenis==3) { $this->db->where('a.JENIS_MB=3 AND a.STATUS_MB=1'); } } else if ($mode==2) { if ($jenis==0 OR $jenis==2) { $this->db->where('a.JENIS_MB=1 AND a.STATUS_MB=1'); $this->db->or_where('a.JENIS_MB=3 AND a.STATUS_MB=1'); } else if ($jenis==1) { $this->db->where('a.JENIS_MB=0 AND a.STATUS_MB=1'); } else if ($jenis==3) { $this->db->where('a.JENIS_MB=2 AND a.STATUS_MB=1'); } } return $this->db->get()->result_array(); } public function getData_MutasiBarang_bySEARCH_allStatus_limit20($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_MB,"%d/%m/%Y") as TANGGAL'); $this->db->from('mutasi_barang a'); $this->db->join('jenis_mb b','b.ID_JMB=a.JENIS_MB'); if ($search!=null) { $this->db->where("a.KODE_MB LIKE '%$search%'"); $this->db->or_where("b.NAMA_JMB LIKE '%$search%'"); } $this->db->order_by('a.KODE_MB DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_NonSnService_byJENIS_groupBARANG_havingMore0($id=null) { // Used $this->db->select('*, SUM(a.MASUK_NONSNS-a.KELUAR_NONSNS) as SISA'); $this->db->from('nonsn_service a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); if ($id!=null) { $this->db->where('a.JENIS_NONSNS=', $id); } $this->db->group_by('a.BARANG_ID'); $this->db->having('SISA>0'); $this->db->order_by('b.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_NotaBebas_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_NB, "%d/%m/%Y") as TANGGAL'); $this->db->from('nota_bebas a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.ID_NB=', $id); return $this->db->get()->result_array(); } public function getData_NotaBebas_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('nota_bebas a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_NB=', $id); $this->db->where('a.STATUS_NB=', $status); return $this->db->get()->result_array(); } public function getData_NotaBebas_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('nota_bebas a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_NB=', $status); return $this->db->get()->result_array(); } public function getData_NotaBebas_byKARYAWAN_bySTATUS_orderDESC($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_NB,"%d/%m/%Y") as TANGGAL'); $this->db->from('nota_bebas a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_NB=', $status); $this->db->order_by('a.ID_NB DESC'); return $this->db->get()->result_array(); } public function getData_NotaBebas_bySTATUS_orderDESC($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_NB,"%d/%m/%Y") as TANGGAL'); $this->db->from('nota_bebas a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.STATUS_NB=', $status); $this->db->order_by('a.ID_NB DESC'); return $this->db->get()->result_array(); } public function getData_NotaBebas_byUM($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_NB, "%d/%m/%Y") as TANGGAL'); $this->db->from('nota_bebas a'); $this->db->join('uang_muka b','b.NB_ID=a.ID_NB'); $this->db->where('b.ID_UM=', $id); return $this->db->get()->result_array(); } public function getData_NotaBebas_joinUMNull_dpOnly_orderDESC() { // Used $this->db->select('*, DATE_FORMAT(a.TGL_NB,"%d/%m/%Y") as TANGGAL'); $this->db->from('nota_bebas a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('uang_muka d','d.NB_ID=a.ID_NB','left'); $this->db->where('d.ID_UM is NULL'); $this->db->where('a.JENIS_NB=1'); $this->db->where('a.STATUS_NB=1'); $this->db->order_by('a.ID_NB DESC'); return $this->db->get()->result_array(); } public function getData_Opname_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('opname a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where(['a.ID_OPNAME' => $id]); $this->db->where(['a.STATUS_OPNAME' => $status]); return $this->db->get()->result_array(); } public function getData_Opname_byID_byKARYAWAN_bySTATUS($id, $karyawan, $status) { // Used $this->db->select('*'); $this->db->from('opname a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where(['a.ID_OPNAME' => $id]); $this->db->where(['a.KARYAWAN_ID' => $karyawan]); $this->db->where(['a.STATUS_OPNAME' => $status]); return $this->db->get()->result_array(); } public function getData_Opname_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('opname a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_OPNAME=', $status); return $this->db->get()->result_array(); } public function getData_Opname_bySTATUS_byGUDANG($status, $gudang) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_OPNAME,"%d/%m/%Y") as TANGGAL'); $this->db->from('opname a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where(['a.STATUS_OPNAME' => $status]); $this->db->where(['a.GUDANG_OPNAME' => $gudang]); return $this->db->get()->result_array(); } public function getData_OtomasiBooster_byID_bySTATUS($id=null, $status=null) { // Used $this->db->select('*,DATE_FORMAT(a.AWAL_OB,"%d/%m/%Y") as AWAL,DATE_FORMAT(a.AKHIR_OB,"%d/%m/%Y") as AKHIR'); $this->db->from('otomasi_booster a'); $this->db->join('potongan_klaimprogram b','b.ID_PKPR=a.PKPR_ID'); if ($id!=null) { $this->db->where('a.ID_OB=', $id); } if ($status!=null OR $status==0) { $this->db->where('a.STATUS_OB=', $status); } return $this->db->get()->result_array(); } public function getData_OtomasiBooster_bySSP_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(a.AWAL_OB,"%d/%m/%Y") as AWAL,DATE_FORMAT(a.AKHIR_OB,"%d/%m/%Y") as AKHIR'); $this->db->from('otomasi_booster a'); $this->db->join('potongan_klaimprogram b','b.ID_PKPR=a.PKPR_ID'); $this->db->join('set_salesproduk c','c.ID_SSP=a.SSP_ID'); $this->db->join('program d','d.ID_PROGRAM=a.JENIS_OB'); $this->db->where('a.SSP_ID=', $id); $this->db->where('a.STATUS_OB=', $status); return $this->db->get()->result_array(); } public function getData_OtomasiBooster_bySSP_bySTATUS_byLIMIT($id, $status, $limit) { // Used $this->db->select('*,DATE_FORMAT(a.AWAL_OB,"%d/%m/%Y") as AWAL,DATE_FORMAT(a.AKHIR_OB,"%d/%m/%Y") as AKHIR'); $this->db->from('otomasi_booster a'); $this->db->join('potongan_klaimprogram b','b.ID_PKPR=a.PKPR_ID'); $this->db->join('set_salesproduk c','c.ID_SSP=a.SSP_ID'); $this->db->join('program d','d.ID_PROGRAM=a.JENIS_OB'); $this->db->where('a.SSP_ID=', $id); $this->db->where('a.STATUS_OB=', $status); $this->db->where('a.TGL_KUNCI>=', $limit); return $this->db->get()->result_array(); } public function getData_OtomasiBooster_sspNull() { // Used $this->db->select('*'); $this->db->from('otomasi_booster'); $this->db->where('SSP_ID is NULL'); return $this->db->get()->result_array(); } public function getData_PajakDibayarDimuka_byID($id) { // Used $this->db->select('*'); $this->db->from('pajak_dibayardimuka a'); $this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID'); $this->db->join('daftar_akuntansi c','c.ID_DAK=a.DAK_ID'); $this->db->where(['a.ID_PDD' => $id]); return $this->db->get()->result_array(); } public function getData_PajakDibayarDimuka_byKWITANSI($id) { // Used $this->db->select('*'); $this->db->from('pajak_dibayardimuka a'); $this->db->join('uang_muka b','b.ID_UM=a.UM_ID'); $this->db->join('kwitansi c','c.ID_KWITANSI=b.KWITANSI_ID'); $this->db->where(['b.KWITANSI_ID' => $id]); return $this->db->get()->result_array(); } public function getData_PajakDibayarDimuka_byNB($id) { // Used $this->db->select('*'); $this->db->from('pajak_dibayardimuka a'); $this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID'); $this->db->join('daftar_akuntansi c','c.ID_DAK=a.DAK_ID'); $this->db->where(['a.NB_ID' => $id]); return $this->db->get()->result_array(); } public function getData_PajakDibayarDimuka_byUM($id) { // Used $this->db->select('*'); $this->db->from('pajak_dibayardimuka a'); $this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID'); $this->db->join('daftar_akuntansi c','c.ID_DAK=a.DAK_ID'); $this->db->where(['a.UM_ID' => $id]); return $this->db->get()->result_array(); } public function getData_PajakDibayarDimuka_PPH22Only() { // Used $this->db->select('*,DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TGLNOTA'); $this->db->from('pajak_dibayardimuka a'); $this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID'); $this->db->join('daftar_akuntansi c','c.ID_DAK=a.DAK_ID'); $this->db->join('penjualan d','d.ID_PENJUALAN=a.PEN_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID'); $this->db->join('kota g','g.ID_KOTA=f.KOTA_ID'); $this->db->join('daftar_rekappajak h','h.PDD_ID=a.ID_PDD','left'); $this->db->where('b.KODE_PPH=22'); $this->db->where('h.RPJ_ID is NULL'); $this->db->order_by('h.ID_DRPJ DESC,a.ID_PDD DESC'); return $this->db->get()->result_array(); } public function getData_PajakDibayarDimuka_PPH23Only() { // Used $this->db->select('*, a.PEN_ID as PID, a.NB_ID as NID, a.UM_ID as UID, DATE_FORMAT(e.TGL_PENJUALAN,"%d/%m/%Y") as TGLPID, f.TYPE_PELANGGAN as TYPELPID, f.NAMA_PELANGGAN as NAPELPID, g.NAMA_KOTA as NAKOPID, DATE_FORMAT(i.TGL_NB,"%d/%m/%Y") as TGLNID, j.TYPE_PELANGGAN as TYPELNID, j.NAMA_PELANGGAN as NAPELNID, k.NAMA_KOTA as NAKONID, DATE_FORMAT(n.TGL_NB,"%d/%m/%Y") as TGLUID, l.TYPE_PELANGGAN as TYPELUID, l.NAMA_PELANGGAN as NAPELUID, m.NAMA_KOTA as NAKOUID'); $this->db->from('pajak_dibayardimuka a'); $this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID'); $this->db->join('daftar_akuntansi c','c.ID_DAK=a.DAK_ID'); $this->db->join('daftar_rekappajak d','d.PDD_ID=a.ID_PDD','left'); $this->db->join('penjualan e','e.ID_PENJUALAN=a.PEN_ID','left'); $this->db->join('pelanggan f','f.ID_PELANGGAN=e.PEL_ID','left'); $this->db->join('kota g','g.ID_KOTA=f.KOTA_ID','left'); $this->db->join('uang_muka h','h.ID_UM=a.UM_ID','left'); $this->db->join('nota_bebas i','i.ID_NB=a.NB_ID','left'); $this->db->join('pelanggan j','j.ID_PELANGGAN=i.PELANGGAN_ID','left'); $this->db->join('kota k','k.ID_KOTA=j.KOTA_ID','left'); $this->db->join('pelanggan l','l.ID_PELANGGAN=h.PEL_ID','left'); $this->db->join('kota m','m.ID_KOTA=l.KOTA_ID','left'); $this->db->join('nota_bebas n','n.ID_NB=h.NB_ID','left'); $this->db->where('b.KODE_PPH=23'); $this->db->where('d.RPJ_ID is NULL'); $this->db->order_by('d.ID_DRPJ DESC,a.ID_PDD DESC'); return $this->db->get()->result_array(); } public function getData_PajakPenghasilan_byID($id) { // Used $this->db->select('*'); $this->db->from('pajak_penghasilan'); $this->db->where(['ID_PPH' => $id]); return $this->db->get()->result_array(); } public function getData_PajakPenghasilan_NotNull() { // Used $this->db->select('*'); $this->db->from('pajak_penghasilan'); $this->db->where('NILAI_PPH is NOT NULL'); $this->db->order_by('KODE_PPH ASC, NILAI_PPH ASC'); return $this->db->get()->result_array(); } public function getData_Part_byID($id) { // Used $this->db->select('*'); $this->db->from('part'); $this->db->where('ID_PART=', $id); return $this->db->get()->result_array(); } public function getData_Part_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('part'); $this->db->where('ID_PART=', $id); $this->db->where('STATUS_PART=', $status); return $this->db->get()->result_array(); } public function getData_Part_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('part'); $this->db->where('NAMA_PART=', $nama); $this->db->where('STATUS_PART=', $status); if ($id!=null) { $this->db->where('ID_PART!=', $id); } return $this->db->get()->result_array(); } public function getData_Part_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('part'); $this->db->where('STATUS_PART=', $id); $this->db->order_by('NAMA_PART ASC'); return $this->db->get()->result_array(); } public function getData_Pelanggan_byID($id) { // Used $this->db->select('*'); $this->db->from('pelanggan a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->join('kelompok c','c.ID_KELOMPOK=a.KELOMPOK_ID'); $this->db->where(['a.ID_PELANGGAN' => $id]); return $this->db->get()->result_array(); } public function getData_Pelanggan_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('pelanggan'); $this->db->where('ID_PELANGGAN=', $id); $this->db->where('STATUS_PELANGGAN=', $status); return $this->db->get()->result_array(); } public function getData_Pelanggan_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('pelanggan'); $this->db->where('NAMA_PELANGGAN=', $nama); $this->db->where('STATUS_PELANGGAN=', $status); if ($id!=null) { $this->db->where('ID_PELANGGAN!=', $id); } return $this->db->get()->result_array(); } public function getData_Pelanggan_bySEARCH_status1_limit10($search=null) { // Used $this->db->select('*'); $this->db->from('pelanggan a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); if ($search!=null) { $this->db->where("a.STATUS_PELANGGAN=1 AND a.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PELANGGAN=1 AND a.ALIAS_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PELANGGAN=1 AND b.NAMA_KOTA LIKE '%$search%'"); } else { $this->db->where('a.STATUS_PELANGGAN=1'); } $this->db->order_by('a.NAMA_PELANGGAN ASC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_Pelanggan_bySTATUS($id) { //Used $this->db->select('*'); $this->db->from('pelanggan a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->where('a.STATUS_PELANGGAN=', $id); $this->db->order_by('a.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_Pelanggan_byTYPE_byKELOMPOK_byKOTA_bySTATUS($id1, $id2, $id3, $id4) { // Used $this->db->select('*,FORMAT(a.LIMIT_PELANGGAN,2) as LIM'); $this->db->from('pelanggan a'); $this->db->join('kelompok b','b.ID_KELOMPOK=a.KELOMPOK_ID'); $this->db->join('kota c','c.ID_KOTA=a.KOTA_ID'); if ($id1!=null) { $this->db->where('a.TYPE_PELANGGAN=', $id1); } if ($id2!=null) { $this->db->where('a.KELOMPOK_ID=', $id2); } if ($id3!=null) { $this->db->where('a.KOTA_ID=', $id3); } $this->db->where('a.STATUS_PELANGGAN=', $id4); $this->db->order_by('a.TYPE_PELANGGAN ASC, c.NAMA_KOTA ASC, b.NAMA_KELOMPOK ASC, a.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_byCORP($id) { // Used $this->db->select('*'); $this->db->from('pembelian'); $this->db->where('STATUS_PEMBELIAN=1'); $this->db->where('CORP_ID=', $id); return $this->db->get()->result_array(); } public function getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($id_corp=null, $id_supplier=null, $awal=null, $akhir=null, $status=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL,DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV,DATE_FORMAT(a.TEMPO_INVBELI,"%d/%m/%Y") as TEMPO, DATE_FORMAT(a.TT_PEMBELIAN,"%d/%m/%Y") as TT'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); $this->db->where('a.TGL_INVBELI>=', $awal); $this->db->where('a.TGL_INVBELI<=', $akhir); if ($id_corp!=null) { $this->db->where('a.CORP_ID=', $id_corp); } if ($id_supplier!=null) { $this->db->where('a.SUPPLIER_ID=', $id_supplier); } if ($status!=null) { $this->db->where('a.STATUS_PEMBELIAN=', $status); } $this->db->order_by('a.KODE_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_status1($id1, $id2, $awal, $akhir, $textSearch=null) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL,DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJBELI, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINVBELI,DATE_FORMAT(a.TEMPO_INVBELI,"%d/%m/%Y") as TEMPO, DATE_FORMAT(a.TT_PEMBELIAN,"%d/%m/%Y") as TT'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); $this->db->where('a.TGL_INVBELI>=', $awal); $this->db->where('a.TGL_INVBELI<=', $akhir); $this->db->where('a.STATUS_PEMBELIAN=1'); if ($id1!=null) { $this->db->where(['a.CORP_ID' => $id1]); } if ($id2!=null) { $this->db->where(['a.SUPPLIER_ID' => $id2]); } if ($textSearch!=null) { $this->db->like('a.INV_PEMBELIAN', $textSearch); } $this->db->order_by('a.KODE_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_status1_forSearch($id_corp=null, $id_supplier=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); if ($id_corp==NULL AND $id_supplier==NULL AND $search==NULL) { $this->db->where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir'"); } else if ($id_corp==NULL AND $id_supplier==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.PO_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.KET_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND b.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND c.NAMA_KOTA LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_supplier==NULL AND $search==NULL) { $this->db->where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.CORP_ID=$id_corp"); } else if ($id_corp!=NULL AND $id_supplier==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.PO_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.KET_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND b.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND c.NAMA_KOTA LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_supplier!=NULL AND $search==NULL) { $this->db->where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.SUPPLIER_ID=$id_supplier"); } else if ($id_corp==NULL AND $id_supplier!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_PEMBELIAN=1 AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.PO_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.KET_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND b.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND c.NAMA_KOTA LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_supplier!=NULL AND $search==NULL) { $this->db->where("a.STATUS_PEMBELIAN=1 AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.CORP_ID=$id_corp AND a.SUPPLIER_ID=$id_supplier"); } else if ($id_corp!=NULL AND $id_supplier!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.PO_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.KET_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND b.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_PEMBELIAN=1 AND a.CORP_ID=$id_corp AND a.SUPPLIER_ID=$id_supplier AND a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND c.NAMA_KOTA LIKE '%$search%'"); } $this->db->order_by('a.KODE_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TEMPO_INVBELI,"%d/%m/%Y") as TEMPO, DATE_FORMAT(a.TT_PEMBELIAN,"%d/%m/%Y") as TT, DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID','left'); $this->db->where(['a.ID_PEMBELIAN' => $id]); return $this->db->get()->result_array(); } public function getData_Pembelian_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->where('a.ID_PEMBELIAN=', $id); $this->db->where('a.STATUS_PEMBELIAN=', $status); return $this->db->get()->result_array(); } public function getData_Pembelian_byINV($inv, $id=null) { // Used $this->db->select('*'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); $this->db->where(['a.INV_PEMBELIAN' => $inv]); if ($id!=null) { $this->db->where('a.ID_PEMBELIAN!=', $id); } return $this->db->get()->result_array(); } public function getData_Pembelian_byKODE($id) { // Used $this->db->select('*'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->where(['a.KODE_PEMBELIAN' => $id]); return $this->db->get()->result_array(); } public function getData_Pembelian_byPERIODE_bySEARCH_status1_limit10($awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); if ($search!=null) { $this->db->where("a.TGL_PEMBELIAN>='$awal' AND a.TGL_PEMBELIAN<='$akhir' AND a.STATUS_PEMBELIAN=1 AND a.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.TGL_PEMBELIAN>='$awal' AND a.TGL_PEMBELIAN<='$akhir' AND a.STATUS_PEMBELIAN=1 AND a.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.TGL_PEMBELIAN>='$awal' AND a.TGL_PEMBELIAN<='$akhir' AND a.STATUS_PEMBELIAN=1 AND a.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.TGL_PEMBELIAN>='$awal' AND a.TGL_PEMBELIAN<='$akhir' AND a.STATUS_PEMBELIAN=1 AND b.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.TGL_PEMBELIAN>='$awal' AND a.TGL_PEMBELIAN<='$akhir' AND a.STATUS_PEMBELIAN=1 AND c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.TGL_PEMBELIAN>='$awal' AND a.TGL_PEMBELIAN<='$akhir' AND a.STATUS_PEMBELIAN=1 AND d.ALIAS_CORP LIKE '%$search%'"); } else { $this->db->where("a.TGL_PEMBELIAN>='$awal' AND a.TGL_PEMBELIAN<='$akhir' AND a.STATUS_PEMBELIAN=1"); } $this->db->order_by('a.KODE_PEMBELIAN DESC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_Pembelian_byPERIODE_bySTATUS($awal, $akhir, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.TGL_PEMBELIAN>=', $awal); $this->db->where('a.TGL_PEMBELIAN<=', $akhir); $this->db->where('a.STATUS_PEMBELIAN=', $status); $this->db->order_by('a.TGL_PEMBELIAN DESC, a.KODE_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_byPERIODE_fpNull_ttNull($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TANGGAL'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); $this->db->where("a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.STATUS_PEMBELIAN=1 AND a.FP_PEMBELIAN is NULL"); $this->db->or_where("a.TGL_INVBELI>='$awal' AND a.TGL_INVBELI<='$akhir' AND a.STATUS_PEMBELIAN=1 AND a.TT_PEMBELIAN is NULL"); $this->db->order_by('a.TGL_INVBELI DESC, a.KODE_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_byPERIODE_statusNull($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.TGL_PEMBELIAN>=', $awal); $this->db->where('a.TGL_PEMBELIAN<=', $akhir); $this->db->where('a.STATUS_PEMBELIAN is NULL'); $this->db->order_by('a.TGL_PEMBELIAN DESC, a.KODE_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_bySEARCH_allStatus_limit10($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); if ($search!=null) { $this->db->where("a.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("b.ALIAS_SUPPLIER LIKE '%$search%'"); $this->db->or_where("b.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("d.ALIAS_CORP LIKE '%$search%'"); } $this->db->order_by('a.KODE_PEMBELIAN DESC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_Pembelian_bySJ($sj, $id=null) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TANGGAL'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); $this->db->where(['a.SJ_PEMBELIAN' => $sj]); if ($id!=null) { $this->db->where('a.ID_PEMBELIAN!=', $id); } return $this->db->get()->result_array(); } public function getData_Pembelian_bySTATUS($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('kop d','d.ID_KOP=a.CORP_ID'); $this->db->where('a.STATUS_PEMBELIAN=', $status); $this->db->order_by('a.ID_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_bySTATUS_byLIMIT_orderDESC($status, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV, DATE_FORMAT(a.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('kop d','d.ID_KOP=a.CORP_ID'); $this->db->join('corp e','e.ID_CORP=a.CORP_ID'); $this->db->where('a.STATUS_PEMBELIAN=', $status); $this->db->where('a.TGL_PEMBELIAN>=', $limit); $this->db->order_by('a.ID_PEMBELIAN DESC'); return $this->db->get()->result_array(); } public function getData_Pembelian_bySTATUS_byLIMIT_potonganNotNull($status, $limit) { // Used $tgl = date('Y-m-d'); $this->db->select('*, DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV, FORMAT(a.POTONGAN_PEMBELIAN,2) as POTONGAN'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('kop d','d.ID_KOP=a.CORP_ID'); $this->db->where('a.STATUS_PEMBELIAN=', $status); $this->db->where('a.TGL_PEMBELIAN>=', $limit); $this->db->where('a.TGL_PEMBELIAN<=', $tgl); $this->db->where('a.POTONGAN_PEMBELIAN is NOT NULL'); $this->db->order_by('a.ID_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_bySTATUS_byLIMIT_potonganNull($status, $limit) { // Used $tgl = date('Y-m-d'); $this->db->select('*, DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV, FORMAT(a.POTONGAN_PEMBELIAN,2) as POTONGAN'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); $this->db->where('a.STATUS_PEMBELIAN=', $status); $this->db->where('a.TGL_PEMBELIAN>=', $limit); $this->db->where('a.TGL_PEMBELIAN<=', $tgl); $this->db->where('a.POTONGAN_PEMBELIAN is NULL'); $this->db->order_by('a.ID_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_bySUPPLIER_byPERIODE_bySTATUS_potonganNotNull($id, $awal, $akhir, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TANGGAL,DATE_FORMAT(a.TEMPO_INVBELI,"%d/%m/%Y") as TEMPO, DATE_FORMAT(a.TT_PEMBELIAN,"%d/%m/%Y") as TT,FORMAT(a.POTONGAN_PEMBELIAN,2) as POTONGAN'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.SUPPLIER_ID=', $id); $this->db->where('a.TGL_INVBELI>=', $awal); $this->db->where('a.TGL_INVBELI<=', $akhir); $this->db->where('a.STATUS_PEMBELIAN=', $status); $this->db->where('a.POTONGAN_PEMBELIAN is NOT NULL'); $this->db->order_by('a.INV_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_statusNull($id=null) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ,DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('kop d','d.ID_KOP=a.CORP_ID'); $this->db->where('a.STATUS_PEMBELIAN is NULL'); if ($id!=null) { $this->db->where(['a.ID_PEMBELIAN' => $id]); } $this->db->order_by('a.ID_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Pembelian_tahanNotNull($id=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TGLSJ, DATE_FORMAT(a.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('kop d','d.ID_KOP=a.CORP_ID'); if ($id!=null) { $this->db->where('a.ID_PEMBELIAN=', $id); } $this->db->where('a.TAHAN_PEMBELIAN is NOT NULL'); $this->db->where('LENGTH(a.TAHAN_PEMBELIAN)<=12', null, false); $this->db->where('a.STATUS_PEMBELIAN=1'); $this->db->where('a.ALUR_PEMBELIAN=2'); $this->db->order_by('a.ID_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getData_Peminjaman_byGUDANG_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('peminjaman a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBERI_ID'); $this->db->where(['a.PEMBERI_ID' => $id]); $this->db->where(['a.STATUS_PEMINJAMAN' => $status]); return $this->db->get()->result_array(); } public function getData_Peminjaman_byID($id) { // Used $this->db->select('*'); $this->db->from('peminjaman a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_PEMINJAMAN=', $id); return $this->db->get()->result_array(); } public function getData_Peminjaman_byID_byGUDANG_bySTATUS($id, $gudang, $status) { // Used $this->db->select('*'); $this->db->from('peminjaman a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBERI_ID'); $this->db->where(['a.ID_PEMINJAMAN' => $id]); $this->db->where(['a.PEMBERI_ID' => $gudang]); $this->db->where(['a.STATUS_PEMINJAMAN' => $status]); return $this->db->get()->result_array(); } public function getData_Peminjaman_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('peminjaman a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMINJAM_ID','left'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID','left'); $this->db->where('a.ID_PEMINJAMAN=', $id); $this->db->where('a.STATUS_PEMINJAMAN=', $status); return $this->db->get()->result_array(); } public function getData_Peminjaman_byJENIS_bySTATUS($jenis, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PEMINJAMAN,"%d/%m/%Y") as TANGGAL,c.NAMA_PANGGILAN_KARYAWAN as PEMBERI,d.NAMA_PANGGILAN_KARYAWAN as PEMINJAM'); $this->db->from('peminjaman a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID','left'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.PEMBERI_ID','left'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.PEMINJAM_ID','left'); $this->db->where('a.JENIS_PEMINJAMAN=', $jenis); $this->db->where('a.STATUS_PEMINJAMAN=', $status); return $this->db->get()->result_array(); } public function getData_Peminjaman_bySTATUS_byJENIS($status, $jenis) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PEMINJAMAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('peminjaman a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMINJAM_ID','left'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID','left'); $this->db->where(['a.STATUS_PEMINJAMAN' => $status]); $this->db->where(['a.JENIS_PEMINJAMAN' => $jenis]); return $this->db->get()->result_array(); } public function getData_PenarikanKonsi_byGUDANG_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('penarikan_konsi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where(['a.GUDANG_ID' => $id]); $this->db->where(['a.STATUS_PK' => $status]); return $this->db->get()->result_array(); } public function getData_PenarikanKonsi_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PK,"%d/%m/%Y") as TANGGAL'); $this->db->from('penarikan_konsi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where(['a.ID_PK' => $id]); return $this->db->get()->result_array(); } public function getData_PenarikanKonsi_byID_byGUDANG_bySTATUS($id, $gudang, $status) { // Used $this->db->select('*'); $this->db->from('penarikan_konsi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->where(['a.ID_PK' => $id]); $this->db->where(['a.GUDANG_ID' => $gudang]); $this->db->where(['a.STATUS_PK' => $status]); return $this->db->get()->result_array(); } public function getData_PenarikanKonsi_byPELANGGAN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('penarikan_konsi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where(['a.PELANGGAN_ID' => $id]); $this->db->where(['a.STATUS_PK' => $status]); return $this->db->get()->result_array(); } public function getData_PenarikanKonsi_bySEARCH_allStatus_limit20($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PK,"%d/%m/%Y") as TANGGAL'); $this->db->from('penarikan_konsi a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.GUDANG_ID'); if ($search!=null) { $this->db->where("a.KODE_PK LIKE '%$search%'"); $this->db->or_where("b.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("d.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.KODE_PK DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_PenarikanSewa_byGUDANG_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('penarikan_sewa a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where(['a.GUDANG_ID' => $id]); $this->db->where(['a.STATUS_PS' => $status]); return $this->db->get()->result_array(); } public function getData_PenarikanService_byID_byPENGAMBIL_bySTATUS($id, $pengambil, $status) { // Used $this->db->select('*'); $this->db->from('penarikan_service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PENGAMBIL_ID'); $this->db->where(['a.ID_PSV' => $id]); $this->db->where(['a.PENGAMBIL_ID' => $pengambil]); $this->db->where(['a.STATUS_PSV' => $status]); return $this->db->get()->result_array(); } public function getData_PenarikanService_byPENGAMBIL_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('penarikan_service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PENGAMBIL_ID'); $this->db->where(['a.PENGAMBIL_ID' => $id]); $this->db->where(['a.STATUS_PSV' => $status]); return $this->db->get()->result_array(); } public function getData_PenarikanSewa_byID_byGUDANG_bySTATUS($id, $gudang, $status) { // Used $this->db->select('*'); $this->db->from('penarikan_sewa a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->where(['a.ID_PS' => $id]); $this->db->where(['a.GUDANG_ID' => $gudang]); $this->db->where(['a.STATUS_PS' => $status]); return $this->db->get()->result_array(); } public function getData_Penawaran_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PENAWARAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('penawaran a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where('a.ID_PENAWARAN=', $id); return $this->db->get()->result_array(); } public function getData_Penawaran_byID_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(TGL_PENAWARAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('penawaran'); $this->db->where('ID_PENAWARAN=', $id); $this->db->where('STATUS_PENAWARAN=', $status); return $this->db->get()->result_array(); } public function getData_Penawaran_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('penawaran'); $this->db->where('KARYAWAN_ID=', $id); $this->db->where('STATUS_PENAWARAN=', $status); return $this->db->get()->result_array(); } public function getData_Penawaran_byLIMIT_allStatus_orderDESC($limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PENAWARAN,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_PENAWARAN, 2) as NILAI'); $this->db->from('penawaran a'); $this->db->join('kop b','b.ID_KOP=a.CORP_ID'); $this->db->where("a.STATUS_PENAWARAN>=1 AND a.STATUS_PENAWARAN!=9 AND a.TGL_PENAWARAN>='$limit'"); $this->db->order_by('a.KODE_PENAWARAN DESC'); return $this->db->get()->result_array(); } public function getData_Penawaran_byPERIODE_statusAktif($awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(TGL_PENAWARAN,"%d/%m/%Y") as TANGGAL, FORMAT(NILAI_PENAWARAN, 2) as NILAI'); $this->db->from('penawaran'); $this->db->where('TGL_PENAWARAN>=', $awal); $this->db->where('TGL_PENAWARAN<=', $akhir); $this->db->where('STATUS_PENAWARAN>=1 AND STATUS_PENAWARAN!=9'); if ($search!=null) { $this->db->where('ID_PENAWARAN=', $search); } return $this->db->get()->result_array(); } public function getData_Penawaran_bySTATUS($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PENAWARAN,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_PENAWARAN, 2) as NILAI'); $this->db->from('penawaran a'); $this->db->join('kop b','b.ID_KOP=a.CORP_ID'); $this->db->where('a.STATUS_PENAWARAN=', $status); return $this->db->get()->result_array(); } public function getData_Pending_byBARANG_bySTATUS($barang, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PENDING,"%d/%m/%Y") as TANGGAL'); $this->db->from('pending a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('barang e','e.ID_BARANG=a.BARANG_ID'); $this->db->where('a.BARANG_ID=', $barang); $this->db->where('a.STATUS_PENDING=', $status); return $this->db->get()->result_array(); } public function getData_Pending_byID_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PENDING,"%d/%m/%Y") as TANGGAL'); $this->db->from('pending a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('barang e','e.ID_BARANG=a.BARANG_ID'); $this->db->where('a.ID_PENDING=', $id); $this->db->where('a.STATUS_PENDING=', $status); return $this->db->get()->result_array(); } public function getData_Pending_byJENIS_bySTATUS($jenis, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PENDING,"%d/%m/%Y") as TANGGAL'); $this->db->from('pending a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('barang e','e.ID_BARANG=a.BARANG_ID'); $this->db->where('a.JENIS_PENDING=', $jenis); $this->db->where('a.STATUS_PENDING=', $status); return $this->db->get()->result_array(); } public function getData_Pengadaan_byID($id) { // Used $this->db->select('*, FORMAT(POTONGAN_PENGADAAN, 2) as POTONGAN'); $this->db->from('pengadaan'); $this->db->where('ID_PENGADAAN=', $id); return $this->db->get()->result_array(); } public function getData_Pengadaan_byID_bySTATUS($id, $status) { // Used $this->db->select('*, FORMAT(POTONGAN_PENGADAAN, 2) as POTONGAN'); $this->db->from('pengadaan'); $this->db->where('ID_PENGADAAN=', $id); $this->db->where('STATUS_PENGADAAN=', $status); return $this->db->get()->result_array(); } public function getData_Pengadaan_byKARYAWAN_bySTATUS_bySSP($id, $status, $ssp) { // Used $this->db->select('*, FORMAT(POTONGAN_PENGADAAN, 2) as POTONGAN'); $this->db->from('pengadaan'); $this->db->where('KARYAWAN_ID=', $id); $this->db->where('STATUS_PENGADAAN=', $status); $this->db->where('SSP_ID=', $ssp); return $this->db->get()->result_array(); } public function getData_Pengadaan_byPEMBELIAN($id) { // Used $this->db->select('*'); $this->db->from('pengadaan'); $this->db->where('PEMBELIAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_Pengadaan_bySSP_bySTATUS($id, $status) { // Used $this->db->select('*, FORMAT(a.POTONGAN_PENGADAAN,2) as POTONGAN'); $this->db->from('pengadaan a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.SSP_ID=', $id); $this->db->where('a.STATUS_PENGADAAN=', $status); return $this->db->get()->result_array(); } public function getData_Pengadaan_bySSP_bySTATUS_linkTerpakai($id, $status) { // Used $this->db->select('*, FORMAT(a.POTONGAN_PENGADAAN,2) as POTONGAN'); $this->db->from('pengadaan a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('pembelian d','d.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where('a.SSP_ID=', $id); $this->db->where('a.STATUS_PENGADAAN=', $status); $this->db->where('a.LINK_PENGADAAN is NOT NULL'); $this->db->order_by('a.ID_PENGADAAN DESC'); return $this->db->get()->result_array(); } public function getData_Pengadaan_bySTATUS($status) { // Used $this->db->select('*, FORMAT(a.POTONGAN_PENGADAAN, 2) as POTONGAN'); $this->db->from('pengadaan a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('kop d','d.ID_KOP=a.CORP_ID'); $this->db->where('a.STATUS_PENGADAAN=', $status); return $this->db->get()->result_array(); } public function getData_PengingatPiutang_afterTGL_bySTATUS($tgl, $status) { // Used $this->db->select('*, DATE_FORMAT(a.FU_PPIU,"%d/%m/%Y") as TANGGAL'); $this->db->from('pengingat_piutang a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID','left'); $this->db->where('a.FU_PPIU>', $tgl); $this->db->where(['a.STATUS_PPIU' => $status]); $this->db->order_by('a.FU_PPIU ASC, b.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_PengingatPiutang_beforeTGL_bySTATUS($tgl, $status) { // Used $this->db->select('*, DATE_FORMAT(a.FU_PPIU,"%d/%m/%Y") as TANGGAL'); $this->db->from('pengingat_piutang a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID','left'); $this->db->where('a.FU_PPIU<=', $tgl); $this->db->where(['a.STATUS_PPIU' => $status]); $this->db->order_by('a.FU_PPIU ASC, b.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_PengingatPiutang_byID_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.FU_PPIU,"%d/%m/%Y") as TANGGAL'); $this->db->from('pengingat_piutang a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where(['a.ID_PPIU' => $id]); $this->db->where(['a.STATUS_PPIU' => $status]); return $this->db->get()->result_array(); } public function getData_PengingatPiutang_bySTATUS($status) { // Used $this->db->select('*, DATE_FORMAT(a.FU_PPIU,"%d/%m/%Y") as TANGGAL'); $this->db->from('pengingat_piutang a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where(['a.STATUS_PPIU' => $status]); $this->db->order_by('a.FU_PPIU ASC, b.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_byCORP_byPERIODE_status1($id, $awal, $akhir, $textSearch=null) { // Used $this->db->select('*, DATE_FORMAT(TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('penjualan'); $this->db->where('TGL_PENJUALAN>=', $awal); $this->db->where('TGL_PENJUALAN<=', $akhir); $this->db->where('STATUS_PENJUALAN=1'); if ($id!=null) { $this->db->where(['KOP_ID' => $id]); } if ($textSearch!=null) { $this->db->like('INV_PENJUALAN', $textSearch); } $this->db->order_by('KODE_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPENJUALAN_byPERIODE_status1_groupTGL($id_corp=null, $id_sales=null, $id_pelanggan=null, $id_penjualan=null, $awal, $akhir) { // Used $this->db->select('*'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); if ($id_corp!=null) { $this->db->where('b.CORP_ID=', $id_corp); } if ($id_sales!=null) { $this->db->where('b.SALES_ID=', $id_sales); } if ($id_pelanggan!=null) { $this->db->where('b.PELANGGAN_ID=', $id_pelanggan); } if ($id_penjualan!=null) { $this->db->where('a.ID_PENJUALAN=', $id_penjualan); } $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->group_by('a.TGL_PENJUALAN'); $this->db->order_by('a.TGL_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($id1=null, $id2=null, $id3=null, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TGL_BATAL,"%d/%m/%Y") as TGLBTL, FORMAT(b.NILAI_SO, 2) as NILAI'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('corp e','e.ID_CORP=b.CORP_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=b.SALES_ID'); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); $this->db->where('a.STATUS_PENJUALAN=0'); if ($id1!=null) { $this->db->where('b.CORP_ID=', $id1); } if ($id2!=null) { $this->db->where('b.SALES_ID=', $id2); } if ($id3!=null) { $this->db->where('b.PELANGGAN_ID=', $id3); } $this->db->order_by('a.KODE_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0_forSearch($id_corp=null, $id_sales=null, $id_pelanggan=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TGL_BATAL,"%d/%m/%Y") as TGLBTL, FORMAT(b.NILAI_SO, 2) as NILAI'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=b.SALES_ID'); if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir'"); } else if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KET_BATAL '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.NILAI_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KOP_ID=$id_corp"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KET_BATAL LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.NILAI_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.SALES_ID=$id_sales"); } else if ($id_corp==NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KET_BATAL LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.NILAI_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.PEL_ID=$id_pelanggan"); } else if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KET_BATAL LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.NILAI_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KET_BATAL LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.NILAI_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KET_BATAL LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.NILAI_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KET_BATAL LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.NILAI_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=0 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.KODE_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($id1=null, $id2=null, $id3=null, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO,DATE_FORMAT(a.TT_PENJUALAN,"%d/%m/%Y") as TT'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('corp e','e.ID_CORP=b.CORP_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=b.SALES_ID'); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); $this->db->where('a.STATUS_PENJUALAN=1'); if ($id1!=null) { $this->db->where('b.CORP_ID=', $id1); } if ($id2!=null) { $this->db->where('b.SALES_ID=', $id2); } if ($id3!=null) { $this->db->where('b.PELANGGAN_ID=', $id3); } $this->db->order_by('a.KODE_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1_forSearch($id_corp=null, $id_sales=null, $id_pelanggan=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=b.SALES_ID'); if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir'"); } else if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KOP_ID=$id_corp"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.SALES_ID=$id_sales"); } else if ($id_corp==NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.PEL_ID=$id_pelanggan"); } else if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_sales!=NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan"); } else if ($id_corp==NULL AND $id_sales!=NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND b.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND a.KOP_ID=$id_corp AND b.SALES_ID=$id_sales AND a.PEL_ID=$id_pelanggan AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.KODE_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_byID($id) { // Used $this->db->select('*,a.SO_ID as SID,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,DATE_FORMAT(a.TT_PENJUALAN,"%d/%m/%Y") as TT,DATE_FORMAT(a.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID','left'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID','left'); $this->db->join('cetak_dokumen d','d.PENJUALAN_ID=a.ID_PENJUALAN','left'); $this->db->join('corp e','e.ID_CORP=a.KOP_ID','left'); $this->db->join('karyawan f','f.ID_KARYAWAN=b.SALES_ID','left'); $this->db->join('kota g','g.ID_KOTA=c.KOTA_ID','left'); $this->db->where('a.ID_PENJUALAN=', $id); return $this->db->get()->result_array(); } public function getData_Penjualan_byID_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(b.NILAI_SO, 2) as NILAI'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PEL_ID'); $this->db->where('a.ID_PENJUALAN=', $id); $this->db->where('a.STATUS_PENJUALAN=', $status); return $this->db->get()->result_array(); } public function getData_Penjualan_byDO($id) { // Used $this->db->select('*'); $this->db->from('penjualan a'); $this->db->join('daftar_order b','b.SO_ID=a.SO_ID'); $this->db->where(['b.ID_DO' => $id]); return $this->db->get()->result_array(); } public function getData_Penjualan_byKODE($id) { // Used $this->db->select('*'); $this->db->from('penjualan a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PEL_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->where(['a.KODE_PENJUALAN' => $id]); return $this->db->get()->result_array(); } public function getData_Penjualan_byPERIODE_bySEARCH_status1_limit20($awal, $akhir, $search=null) { // Used $this->db->select('*, FORMAT(d.NILAI_SO, 2) as NILAI, DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('penjualan a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PEL_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=d.SALES_ID'); if ($search!=null) { $this->db->where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND b.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.NILAI_SO LIKE '%$search%'"); $this->db->or_where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else { $this->db->where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1"); } $this->db->order_by('a.KODE_PENJUALAN DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Penjualan_byPERIODE_fpNull_ttNull($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('penjualan a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PEL_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND a.FP_PENJUALAN is NULL"); $this->db->or_where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND a.TT_PENJUALAN is NULL"); $this->db->order_by('a.TGL_PENJUALAN DESC, a.KODE_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_byPELANGGAN_forPPH($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('pajak_dibayardimuka d','d.PEN_ID=a.ID_PENJUALAN','left'); $this->db->where('d.PEN_ID is NULL'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('a.PEL_ID=', $id); return $this->db->get()->result_array(); } public function getData_Penjualan_bySALES_byPERIODE_status1_groupTGL($id_sales, $awal, $akhir) { // Used $this->db->select('*'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->where(['b.SALES_ID' => $id_sales]); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->group_by('a.TGL_PENJUALAN'); $this->db->order_by('a.TGL_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_bySEARCH_statusNot3_limit20($search=null) { // Used $this->db->select('*, FORMAT(b.NILAI_SO, 2) as NILAI, DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID','left'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID','left'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID','left'); $this->db->join('karyawan e','e.ID_KARYAWAN=b.SALES_ID','left'); if ($search!=null) { $this->db->where("a.KODE_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("b.KODE_SO LIKE '%$search%'"); $this->db->or_where("b.PO_SO LIKE '%$search%'"); $this->db->or_where("b.NILAI_SO LIKE '%$search%'"); $this->db->or_where("c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("e.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.KODE_PENJUALAN DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Penjualan_bySJINV_byPERIODE_orderDESC($mode, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, FORMAT(b.NILAI_SO, 2) as NILAI'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('cetak_dokumen e','e.PENJUALAN_ID=a.ID_PENJUALAN'); $this->db->join('karyawan f','f.ID_KARYAWAN=b.SALES_ID'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('e.SJ_INV=', $mode); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); if ($mode==0) { $this->db->having('a.SJ_PENJUALAN=e.KODE_BUKTI'); } else if ($mode==1) { $this->db->having('a.INV_PENJUALAN=e.KODE_BUKTI'); } $this->db->order_by('a.ID_PENJUALAN DESC'); return $this->db->get()->result_array(); } public function getData_Penjualan_bySJINV_byPERIODE_notCetak_orderDESC($mode, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, FORMAT(b.NILAI_SO, 2) as NILAI'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('cetak_dokumen e','e.PENJUALAN_ID=a.ID_PENJUALAN'); $this->db->join('karyawan f','f.ID_KARYAWAN=b.SALES_ID'); $this->db->join('histori_cetakdokumen g','g.CD_ID=e.ID_CD','left'); $this->db->where('g.ID_HCD is NULL'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('e.SJ_INV=', $mode); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); if ($mode==0) { $this->db->having('a.SJ_PENJUALAN=e.KODE_BUKTI'); } else if ($mode==1) { $this->db->having('a.INV_PENJUALAN=e.KODE_BUKTI'); } $this->db->group_by('a.ID_PENJUALAN'); $this->db->order_by('a.ID_PENJUALAN DESC'); return $this->db->get()->result_array(); } public function getData_Penjualan_bySO($id) { // Used $this->db->select('*'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID','left'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PEL_ID','left'); $this->db->where(['a.SO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Penjualan_bySO_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->where(['a.SO_ID' => $id]); $this->db->where('a.STATUS_PENJUALAN=', $status); return $this->db->get()->result_array(); } public function getData_Penjualan_PPNOnly() { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TGLNOTA'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('daftar_rekappajak e','e.PENJUALAN_ID=a.ID_PENJUALAN','left'); $this->db->where("a.STATUS_PENJUALAN=1 AND e.RPJ_ID is NULL AND a.FP_PENJUALAN LIKE '02%'"); $this->db->or_where("a.STATUS_PENJUALAN=1 AND e.RPJ_ID is NULL AND a.FP_PENJUALAN LIKE '03%'"); $this->db->order_by('e.ID_DRPJ DESC'); return $this->db->get()->result_array(); } public function getData_Penjualan_statusUntil1() { // Used $this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->where('a.STATUS_PENJUALAN<=1'); $this->db->order_by('a.ID_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Penjualan_status1_forBatal($id_penjualan=null) { // Used $awal = date('Y-m-01'); $akhir = $this->generate_addMonth($awal, 1); $akhir = $this->generate_subDay($akhir, 1); $this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(b.NILAI_SO,2) as NILAI'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=b.SALES_ID'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); if ($id_penjualan!=null) { $this->db->where('a.ID_PENJUALAN=', $id_penjualan); } $this->db->order_by('a.ID_PENJUALAN DESC'); return $this->db->get()->result_array(); } public function getData_PeriodeAbsensi($id = null) { // Used if ($id === null) { $this->db->select('*,DATE_FORMAT(AWAL_PAB,"%d/%m/%Y") as AWAL,DATE_FORMAT(AKHIR_PAB,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_absensi'); $this->db->order_by('ID_PAB DESC'); }else{ $this->db->select('*,DATE_FORMAT(AWAL_PAB,"%d/%m/%Y") as AWAL,DATE_FORMAT(AKHIR_PAB,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_absensi'); $this->db->where(['ID_PAB' => $id]); } return $this->db->get()->result_array(); } public function getData_PeriodeAbsensi_byTGL($now) { // Used $this->db->select('*'); $this->db->from('periode_absensi'); $this->db->where('AWAL_PAB<=', $now); $this->db->where('AKHIR_PAB>=', $now); return $this->db->get()->result_array(); } public function getData_PeriodeAbsensi_orderDESC_limit1() { // Used $this->db->select('*'); $this->db->from('periode_absensi'); $this->db->order_by('ID_PAB DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_PeriodeAkuntansi_byID($id) { // Used $this->db->select('*'); $this->db->from('periode_akuntansi'); $this->db->where('ID_PAK=', $id); return $this->db->get()->result_array(); } public function getData_PeriodeAkuntansi_byPERIODE($tgl) { // Used $this->db->select('*'); $this->db->from('periode_akuntansi'); $this->db->where('AWAL_PAK<=', $tgl); $this->db->where('AKHIR_PAK>=', $tgl); return $this->db->get()->result_array(); } public function getData_PeriodeAkuntansi_byPERIODE_bySTATUS($tgl, $status) { // Used $this->db->select('*'); $this->db->from('periode_akuntansi'); $this->db->where('AWAL_PAK<=', $tgl); $this->db->where('AKHIR_PAK>=', $tgl); $this->db->where('STATUS_PAK=', $status); return $this->db->get()->result_array(); } public function getData_PeriodeAkuntansi_bySEARCH_status1($search=null) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PAK,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PAK,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_akuntansi'); if ($search!=null) { $this->db->where("STATUS_PAK=1 AND NAMA_PAK LIKE '%$search%'"); } else { $this->db->where("STATUS_PAK=1"); } $this->db->order_by('ID_PAK DESC'); return $this->db->get()->result_array(); } public function getData_PeriodeAkuntansi_bySTATUS($id) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PAK,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PAK,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_akuntansi'); $this->db->where('STATUS_PAK=', $id); $this->db->order_by('ID_PAK DESC'); return $this->db->get()->result_array(); } public function getData_PeriodeAkuntansi_likeYear_orderASC_limit1($year) { // Used $this->db->select('*'); $this->db->from('periode_akuntansi'); $this->db->like('AWAL_PAK', $year); $this->db->not_like('ID_PAK', '1', 'none'); $this->db->order_by('ID_PAK ASC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_PeriodeAkuntansi_status0() { // Used $this->db->select('*'); $this->db->from('periode_akuntansi'); $this->db->where('STATUS_PAK=0'); return $this->db->get()->result_array(); } public function getData_PeriodeKlaimProgram_byID($id) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PKL, "%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PKL, "%d/%m/%Y") as AKHIR'); $this->db->from('periode_klaimprogram'); $this->db->where('ID_PKL=', $id); return $this->db->get()->result_array(); } public function getData_PeriodeKlaimProgram_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('periode_klaimprogram'); $this->db->where('ID_PKL=', $id); $this->db->where('STATUS_PKL=', $status); return $this->db->get()->result_array(); } public function getData_PeriodeKlaimProgram_byMERK_bySTATUS($id1, $id2) { // Used $this->db->select('*, DATE_FORMAT(a.AWAL_PKL,"%d/%m/%Y") as AWAL, DATE_FORMAT(a.AKHIR_PKL,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_klaimprogram a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); if ($id1!=null) { $this->db->where('a.MERK_ID=', $id1); } $this->db->where('a.STATUS_PKL=', $id2); $this->db->order_by('b.NAMA_MERK ASC, a.NAMA_PKL ASC'); return $this->db->get()->result_array(); } public function getData_PeriodeKlaimProgram_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('periode_klaimprogram'); $this->db->where('NAMA_PKL=', $nama); $this->db->where('STATUS_PKL=', $status); if ($id!=null) { $this->db->where('ID_PKL!=', $id); } return $this->db->get()->result_array(); } public function getData_PeriodeKlaimProgram_bySTATUS($id) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PKL,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PKL,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_klaimprogram'); $this->db->where('STATUS_PKL=', $id); $this->db->order_by('NAMA_PKL ASC'); return $this->db->get()->result_array(); } public function getData_PeriodeKpi_byID($id) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PKPI,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PKPI,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_kpi'); $this->db->where('ID_PKPI=', $id); return $this->db->get()->result_array(); } public function getData_PeriodeKpi_orderASC() { // Used $this->db->select('*, DATE_FORMAT(AWAL_PKPI,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PKPI,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_kpi'); $this->db->order_by('ID_PKPI ASC'); return $this->db->get()->result_array(); } public function getData_PeriodeKpi_orderDESC() { // Used $this->db->select('*, DATE_FORMAT(AWAL_PKPI,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PKPI,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_kpi'); $this->db->order_by('ID_PKPI DESC'); return $this->db->get()->result_array(); } public function getData_PeriodeKpi_orderDESC_limit1() { // Used $this->db->select('*'); $this->db->from('periode_kpi'); $this->db->order_by('ID_PKPI DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_PeriodeKpi_tahunIni_orderDESC() { // Used $year = date('Y'); $this->db->select('*'); $this->db->from('periode_kpi'); $this->db->like('NAMA_PKPI', $year); $this->db->order_by('ID_PKPI DESC'); return $this->db->get()->result_array(); } public function getData_PeriodeProyek_byID($id) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PP, "%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PP, "%d/%m/%Y") as AKHIR'); $this->db->from('periode_proyek'); $this->db->where('ID_PP=', $id); return $this->db->get()->result_array(); } public function getData_PeriodeProyek_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('periode_proyek'); $this->db->where('ID_PP=', $id); $this->db->where('STATUS_PP=', $status); return $this->db->get()->result_array(); } public function getData_PeriodeProyek_byJENIS_byPERIODE($id, $tgl) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PP,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_proyek'); $this->db->where('JENIS_PP=', $id); $this->db->where('AWAL_PP<=', $tgl); $this->db->where('AKHIR_PP>=', $tgl); return $this->db->get()->result_array(); } public function getData_PeriodeProyek_byJENIS_bySTATUS($id1, $id2) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PP,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_proyek'); if ($id1!=null) { $this->db->where('JENIS_PP=', $id1); } $this->db->where('STATUS_PP=', $id2); $this->db->order_by('JENIS_PP ASC, NAMA_PP ASC'); return $this->db->get()->result_array(); } public function getData_PeriodeProyek_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('periode_proyek'); $this->db->where('NAMA_PP=', $nama); $this->db->where('STATUS_PP=', $status); if ($id!=null) { $this->db->where('ID_PP!=', $id); } return $this->db->get()->result_array(); } public function getData_PeriodeProyek_bySTATUS($id) { // Used $this->db->select('*, DATE_FORMAT(a.AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(a.AKHIR_PP,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_proyek a'); $this->db->join('jenis_pp b','b.ID_JPP=a.JENIS_PP'); $this->db->where('a.STATUS_PP=', $id); $this->db->order_by('b.NAMA_JPP ASC, a.NAMA_PP ASC'); return $this->db->get()->result_array(); } public function getData_PeriodeUmum_byID($id) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PUM,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PUM,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_umum'); $this->db->where('ID_PUM=', $id); return $this->db->get()->result_array(); } public function getData_PeriodeUmum_byJENIS_byTGL($jenis, $tgl) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PUM,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PUM,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_umum'); $this->db->where('JENIS_PUM=', $jenis); $this->db->where('AWAL_PUM<=', $tgl); $this->db->where('AKHIR_PUM>=', $tgl); return $this->db->get()->result_array(); } public function getData_PeriodeUmum_byJENIS_orderDESC($jenis) { // Used $this->db->select('*, DATE_FORMAT(AWAL_PUM,"%d/%m/%Y") as AWAL, DATE_FORMAT(AKHIR_PUM,"%d/%m/%Y") as AKHIR'); $this->db->from('periode_umum'); $this->db->where('JENIS_PUM=', $jenis); $this->db->order_by('ID_PUM DESC'); return $this->db->get()->result_array(); } public function getData_Perkiraan_byID($id) { // Used $this->db->select('*'); $this->db->from('perkiraan'); $this->db->where('ID_PERKIRAAN=', $id); return $this->db->get()->result_array(); } public function getData_Perkiraan_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('perkiraan'); $this->db->where('ID_PERKIRAAN=', $id); $this->db->where('STATUS_PERKIRAAN=', $status); return $this->db->get()->result_array(); } public function getData_Perkiraan_byKODE_bySTATUS($kode, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('perkiraan'); $this->db->where('KODE_PERKIRAAN=', $kode); $this->db->where('STATUS_PERKIRAAN=', $status); if ($id!=null) { $this->db->where('ID_PERKIRAAN!=', $id); } return $this->db->get()->result_array(); } public function getData_Perkiraan_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('perkiraan'); $this->db->where('STATUS_PERKIRAAN=', $id); $this->db->order_by('KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_Perkiraan_byTYPE_bySTATUS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('perkiraan'); if ($id1!=null) { $this->db->where('TYPE_PERKIRAAN=', $id1); } $this->db->where('STATUS_PERKIRAAN=', $id2); $this->db->order_by('KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_Perkiraan_FormLemburLuarKota() { // Used $this->db->select('*'); $this->db->from('perkiraan'); $this->db->like('KODE_PERKIRAAN','6203'); $this->db->or_like('KODE_PERKIRAAN','6233'); return $this->db->get()->result_array(); } public function getData_Perkiraan_JurnalMemoOnly() { // Used $this->db->select('*'); $this->db->from('perkiraan'); $this->db->where('TYPE_PERKIRAAN!=3 AND TYPE_PERKIRAAN!=0'); $this->db->not_like('KODE_PERKIRAAN', '1110'); $this->db->not_like('KODE_PERKIRAAN', '1120'); $this->db->not_like('KODE_PERKIRAAN', '1140'); $this->db->not_like('KODE_PERKIRAAN', '1170'); $this->db->not_like('KODE_PERKIRAAN', '2150'); $this->db->not_like('KODE_PERKIRAAN', '6227'); $this->db->not_like('KODE_PERKIRAAN', '6233'); $this->db->order_by('KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_Perkiraan_KasbankKeluarOnly() { // Used $this->db->select('*'); $this->db->from('perkiraan'); $this->db->where('TYPE_PERKIRAAN=1'); $this->db->where('STATUS_PERKIRAAN=1'); $this->db->not_like('KODE_PERKIRAAN','1110'); $this->db->not_like('KODE_PERKIRAAN','1120'); $this->db->not_like('KODE_PERKIRAAN','1130'); $this->db->not_like('KODE_PERKIRAAN','2150'); $this->db->not_like('KODE_PERKIRAAN','2160'); $this->db->not_like('KODE_PERKIRAAN','6203'); $this->db->not_like('KODE_PERKIRAAN','7100'); $this->db->not_like('KODE_PERKIRAAN','7200'); $this->db->order_by('KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_Perkiraan_KasbankMasukOnly() { // Used $this->db->select('*'); $this->db->from('perkiraan'); $this->db->where('TYPE_PERKIRAAN=1'); $this->db->where('STATUS_PERKIRAAN=1'); $this->db->not_like('KODE_PERKIRAAN','1110'); $this->db->not_like('KODE_PERKIRAAN','1120'); //$this->db->not_like('KODE_PERKIRAAN','1180'); $this->db->not_like('KODE_PERKIRAAN','1190'); $this->db->not_like('KODE_PERKIRAAN','1210'); $this->db->not_like('KODE_PERKIRAAN','1220'); $this->db->not_like('KODE_PERKIRAAN','1230'); $this->db->not_like('KODE_PERKIRAAN','2110'); $this->db->not_like('KODE_PERKIRAAN','2120'); $this->db->not_like('KODE_PERKIRAAN','2160'); $this->db->not_like('KODE_PERKIRAAN','6227'); $this->db->not_like('KODE_PERKIRAAN','7300'); $this->db->not_like('KODE_PERKIRAAN','7400'); $this->db->not_like('KODE_PERKIRAAN','7500'); $this->db->not_like('KODE_PERKIRAAN','7600'); $this->db->order_by('KODE_PERKIRAAN ASC'); return $this->db->get()->result_array(); } public function getData_Pihakke3_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('pihakke3'); $this->db->where('ID_PIHAKKE3=', $id); $this->db->where('STATUS_PIHAKKE3=', $status); return $this->db->get()->result_array(); } public function getData_Pihakke3_byID($id) { // Used $this->db->select('*'); $this->db->from('pihakke3 a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->where('a.ID_PIHAKKE3=', $id); return $this->db->get()->result_array(); } public function getData_Pihakke3_byKOTA_bySTATUS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('pihakke3 a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); if ($id1!=null) { $this->db->where('a.KOTA_ID=', $id1); } $this->db->where('a.STATUS_PIHAKKE3=', $id2); $this->db->order_by('b.NAMA_KOTA ASC, a.NAMA_PIHAKKE3 ASC'); return $this->db->get()->result_array(); } public function getData_Pihakke3_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('pihakke3'); $this->db->where('NAMA_PIHAKKE3=', $nama); $this->db->where('STATUS_PIHAKKE3=', $status); if ($id!=null) { $this->db->where('ID_PIHAKKE3!=', $id); } return $this->db->get()->result_array(); } public function getData_Pihakke3_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('pihakke3'); $this->db->where('STATUS_PIHAKKE3=', $id); $this->db->order_by('NAMA_PIHAKKE3 ASC'); return $this->db->get()->result_array(); } public function getData_PotonganKlaimProgram() { // Used $this->db->select('*'); $this->db->from('potongan_klaimprogram'); $this->db->order_by('NAMA_PKPR ASC'); return $this->db->get()->result_array(); } public function getData_PotonganKlaimProgram_byID($id) { // Used $this->db->select('*'); $this->db->from('potongan_klaimprogram'); $this->db->where('ID_PKPR=', $id); return $this->db->get()->result_array(); } public function getData_PotonganKlaimProgram_byNAMA($id) { // Used $this->db->select('*'); $this->db->from('potongan_klaimprogram'); $this->db->where('NAMA_PKPR=', $id); return $this->db->get()->result_array(); } public function getData_PotonganKlaimProgram_byPROGRAM_groupNAMA($id) { // Used $this->db->select('*'); $this->db->from('potongan_klaimprogram a'); $this->db->join('link_klaimprogram b','b.PKPR_ID=a.ID_PKPR'); $this->db->join('program c','c.ID_PROGRAM=b.PROGRAM_ID'); $this->db->where('b.PROGRAM_ID=', $id); $this->db->group_by('a.NAMA_PKPR'); $this->db->order_by('c.KODE_PROGRAM ASC, a.NAMA_PKPR ASC'); return $this->db->get()->result_array(); } public function getData_Pricelist_byID($id) { // Used $this->db->select('*'); $this->db->from('pricelist'); $this->db->where('ID_PRICELIST=', $id); return $this->db->get()->result_array(); } public function getData_Pricelist_byNAMA($nama, $id=null) { // Used $this->db->select('*'); $this->db->from('pricelist'); $this->db->where('NAMA_PRICELIST=', $nama); if ($id!=null) { $this->db->where("ID_PRICELIST!=$id"); } return $this->db->get()->result_array(); } public function getData_Pricelist_bySSP($ssp) { // Used $this->db->select('*'); $this->db->from('pricelist'); $this->db->where('SSP_ID=', $ssp); $this->db->order_by('NAMA_PRICELIST ASC'); return $this->db->get()->result_array(); } public function getData_Pricelist_orderNAMA() { // Used $this->db->select('*'); $this->db->from('pricelist'); $this->db->order_by('NAMA_PRICELIST ASC'); return $this->db->get()->result_array(); } public function getData_Pricelist_orderNAMA_limit1() { // Used $this->db->select('*'); $this->db->from('pricelist'); $this->db->order_by('NAMA_PRICELIST ASC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_Produk_byID($id) { // Used $this->db->select('*'); $this->db->from('produk'); $this->db->where('ID_PRODUK=', $id); return $this->db->get()->result_array(); } public function getData_Produk_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('produk'); $this->db->where('ID_PRODUK=', $id); $this->db->where('STATUS_PRODUK=', $status); return $this->db->get()->result_array(); } public function getData_Produk_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('produk'); $this->db->where('NAMA_PRODUK=', $nama); $this->db->where('STATUS_PRODUK=', $status); if ($id!=null) { $this->db->where('ID_PRODUK!=', $id); } return $this->db->get()->result_array(); } public function getData_Produk_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('produk'); $this->db->where('STATUS_PRODUK=', $id); $this->db->order_by('NAMA_PRODUK ASC'); return $this->db->get()->result_array(); } public function getData_Proforma_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PF, "%d/%m/%Y") as TANGGAL'); $this->db->from('proforma a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.ID_PF=', $id); return $this->db->get()->result_array(); } public function getData_Proforma_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('proforma a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_PF=', $id); $this->db->where('a.STATUS_PF=', $status); return $this->db->get()->result_array(); } public function getData_Proforma_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('proforma a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_PF=', $status); return $this->db->get()->result_array(); } public function getData_Proforma_byKARYAWAN_bySTATUS_byPERIODE_orderDESC($id, $status, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PF,"%d/%m/%Y") as TANGGAL'); $this->db->from('proforma a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_PF=', $status); $this->db->where('a.TGL_PF>=', $awal); $this->db->where('a.TGL_PF<=', $akhir); $this->db->order_by('a.ID_PF DESC'); return $this->db->get()->result_array(); } public function getData_Proforma_bySTATUS_byPERIODE_orderDESC($status, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PF,"%d/%m/%Y") as TANGGAL'); $this->db->from('proforma a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.STATUS_PF=', $status); $this->db->where('a.TGL_PF>=', $awal); $this->db->where('a.TGL_PF<=', $akhir); $this->db->order_by('a.ID_PF DESC'); return $this->db->get()->result_array(); } public function getData_Program() { // Used $this->db->select('*'); $this->db->from('program'); $this->db->order_by('KODE_PROGRAM ASC'); return $this->db->get()->result_array(); } public function getData_PromoClearance_byBARANG($id) { // Used $this->db->select('*'); $this->db->from('promo_clearance'); $this->db->where('BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getData_PromoClearance_byBARANG_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('promo_clearance'); $this->db->where('BARANG_ID=', $id); $this->db->where('STATUS_PC=', $status); return $this->db->get()->result_array(); } public function getData_PromoClearance_byID($id) { // Used $this->db->select('*'); $this->db->from('promo_clearance'); $this->db->where('ID_PC=', $id); return $this->db->get()->result_array(); } public function getData_PromoClearance_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('promo_clearance'); $this->db->where('ID_PC=', $id); $this->db->where('STATUS_PC=', $status); return $this->db->get()->result_array(); } public function getData_PromoClearance_byJENIS_bySTATUS($id, $status) { // Used $this->db->select('*, FORMAT(a.NILAI_PC, 2) as NILAI'); $this->db->from('promo_clearance a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('b.JENIS_ID', $id); $this->db->where('a.STATUS_PC', $status); return $this->db->get()->result_array(); } public function getData_PromoClearance_bySTATUS($id) { // Used $this->db->select('*, FORMAT(a.NILAI_PC, 2) as NILAI'); $this->db->from('promo_clearance a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=b.ID_BARANG'); $this->db->join('jenis d','d.ID_JENIS=b.JENIS_ID'); $this->db->join('merk e','e.ID_MERK=b.MERK_ID'); $this->db->where('a.STATUS_PC=', $id); $this->db->order_by('d.NAMA_JENIS ASC, e.NAMA_MERK ASC, b.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_PromoClearance_bySTATUS_byMERK($id1, $id2=null) { // Used $this->db->select('*, FORMAT(a.NILAI_PC, 2) as NILAI'); $this->db->from('promo_clearance a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=b.ID_BARANG'); $this->db->join('jenis d','d.ID_JENIS=b.JENIS_ID'); $this->db->join('merk e','e.ID_MERK=b.MERK_ID'); $this->db->where('a.STATUS_PC=', $id1); if ($id2!=null) { $this->db->where('b.MERK_ID=', $id2); } $this->db->order_by('d.NAMA_JENIS ASC, e.NAMA_MERK ASC, b.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Proyek_batalThisMonth($limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, DATE_FORMAT(a.TGL_BATAL,"%d/%m/%Y") as TGLBTL,FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where("a.STATUS_PROYEK=9 AND a.TGL_BATAL is NULL"); $this->db->or_where("a.STATUS_PROYEK=9 AND a.TGL_BATAL>=", $limit); return $this->db->get()->result_array(); } public function getData_Proyek_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->join('jenis_pp d','d.ID_JPP=a.JENIS_PROYEK'); $this->db->where(['a.ID_PROYEK' => $id]); return $this->db->get()->result_array(); } public function getData_Proyek_byID_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where(['a.ID_PROYEK' => $id]); $this->db->where(['a.STATUS_PROYEK' => $status]); return $this->db->get()->result_array(); } public function getData_Proyek_byID_bySTATUS_beforeLimit_rpNotNull($id, $status, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.ID_PROYEK=', $id); $this->db->where('a.STATUS_PROYEK=', $status); $this->db->where('a.TGL_PROSES>=', $limit); $this->db->where('a.RP_ID is NOT NULL'); return $this->db->get()->result_array(); } public function getData_Proyek_byID_bySTATUS_rpNull($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.ID_PROYEK=', $id); $this->db->where('a.STATUS_PROYEK=', $status); $this->db->where('a.RP_ID is NULL'); return $this->db->get()->result_array(); } public function getData_Proyek_byID_statusRPNot2($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL'); $this->db->from('proyek a'); $this->db->join('rekap_proyek b','b.ID_RP=a.RP_ID'); $this->db->where(['a.ID_PROYEK' => $id]); $this->db->where('b.STATUS_RP!=2'); return $this->db->get()->result_array(); } public function getData_Proyek_byID_tglBatalNull($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->where(['a.ID_PROYEK' => $id]); $this->db->where('a.TGL_BATAL is NULL'); $this->db->where('a.STATUS_PROYEK=9'); return $this->db->get()->result_array(); } public function getData_Proyek_byPELANGGAN_statusNot9($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.PELANGGAN_ID=', $id); $this->db->where('a.STATUS_PROYEK!=9'); return $this->db->get()->result_array(); } public function getData_Proyek_byPO($po, $id=null) { // Used $this->db->select('*'); $this->db->from('proyek'); $this->db->where('PO_PROYEK=', $po); if ($id!=null) { $this->db->where('ID_PROYEK!=', $id); } return $this->db->get()->result_array(); } public function getData_Proyek_byRP($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL'); $this->db->from('proyek a'); $this->db->join('rekap_proyek b','b.ID_RP=a.RP_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.RP_ID=', $id); return $this->db->get()->result_array(); } public function getData_Proyek_byRP_orderPELANGGAN($id) { // Used $this->db->select('*, a.SALES_ID as SID, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO,FORMAT(a.NILAI_PROYEK, 2) as NILAI'); $this->db->from('proyek a'); $this->db->join('rekap_proyek b','b.ID_RP=a.RP_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.RP_ID=', $id); $this->db->order_by('c.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_Proyek_bySALES_batalThisMonth($id, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, DATE_FORMAT(a.TGL_BATAL,"%d/%m/%Y") as TGLBTL, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where("a.STATUS_PROYEK=9 AND a.SALES_ID=$id AND a.TGL_BATAL is NULL"); $this->db->or_where("a.STATUS_PROYEK=9 AND a.SALES_ID=$id AND a.TGL_BATAL>=", $limit); return $this->db->get()->result_array(); } public function getData_Proyek_bySALES_byPELANGGAN_byKONDISI_byPERIODE($id1, $id2, $id3, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT (a.NILAI_PROYEK, 2) as NILAI, FORMAT (a.GP_PROYEK+a.BIAYA_PROYEK, 2) as NIRE, FORMAT (a.BIAYA_PROYEK, 2) as BIAYA, FORMAT (a.GP_PROYEK, 2) as GP'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.TGL_PROYEK>=', $awal); $this->db->where('a.TGL_PROYEK<=', $akhir); if ($id1!=null) { $this->db->where(['a.SALES_ID' => $id1]); } if ($id2!=null) { $this->db->where(['a.PELANGGAN_ID' => $id2]); } if ($id3!=null) { if ($id3==0) { $this->db->where('a.STATUS_PROYEK=0'); } else if ($id3==1) { $this->db->where('a.STATUS_PROYEK>=1 AND a.STATUS_PROYEK<=2'); } else if ($id3==9) { $this->db->where('a.STATUS_PROYEK=9'); } } $this->db->order_by('a.KODE_PROYEK ASC'); return $this->db->get()->result_array(); } public function getData_Proyek_bySALES_byPERIODE_byJENIS_statusNot9_rpNull($id, $jenis, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.SALES_ID=', $id); $this->db->where('a.JENIS_PROYEK=', $jenis); $this->db->where('a.TGL_PROYEK>=', $awal); $this->db->where('a.TGL_PROYEK<=', $akhir); $this->db->where('a.STATUS_PROYEK!=9'); $this->db->where('a.RP_ID is NULL'); return $this->db->get()->result_array(); } public function getData_Proyek_bySALES_bySEARCH_allStatus_limit20($sales, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); if ($search!=null) { $this->db->where("a.SALES_ID=$sales AND a.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.SALES_ID=$sales AND a.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("a.SALES_ID=$sales AND b.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.SALES_ID=$sales AND b.ALIAS_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.SALES_ID=$sales AND c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.SALES_ID=$sales AND d.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else { $this->db->where('a.SALES_ID=', $sales); } $this->db->order_by('a.KODE_PROYEK DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Proyek_bySALES_bySEWA($id_sales, $sewa_proyek) { // Used $this->db->select('*'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.SALES_ID=', $id_sales); $this->db->where('a.SEWA_PROYEK=', $sewa_proyek); return $this->db->get()->result_array(); } public function getData_Proyek_bySALES_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.SALES_ID=', $id); $this->db->where('a.STATUS_PROYEK=', $status); return $this->db->get()->result_array(); } public function getData_Proyek_bySALES_bySTATUS_rpNotNull_beforeLimit($id, $status, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.TGL_PROSES>=', $limit); $this->db->where('a.STATUS_PROYEK=', $status); $this->db->where('a.SALES_ID=', $id); $this->db->where('a.RP_ID is NOT NULL'); return $this->db->get()->result_array(); } public function getData_Proyek_bySALES_bySTATUS_rpNull_jenis3($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_PROYEK,2) as NILAI, DATE_FORMAT(e.AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(e.AKHIR_PP,"%d/%m/%Y") as AKHIR'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('periode_proyek e','e.ID_PP=a.SEWA_PROYEK'); $this->db->where('a.SALES_ID=', $id); $this->db->where('a.STATUS_PROYEK=', $status); $this->db->where('a.RP_ID is NULL'); $this->db->where('a.JENIS_PROYEK=3'); return $this->db->get()->result_array(); } public function getData_Proyek_bySALES_bySTATUS_rpNull_jenisLess2($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.SALES_ID=', $id); $this->db->where('a.STATUS_PROYEK=', $status); $this->db->where('a.RP_ID is NULL'); $this->db->where('a.JENIS_PROYEK<=2'); return $this->db->get()->result_array(); } public function getData_Proyek_bySEARCH_allStatus_limit20($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); if ($search!=null) { $this->db->where("a.KODE_PROYEK LIKE '%$search%'"); $this->db->or_where("a.PO_PROYEK LIKE '%$search%'"); $this->db->or_where("b.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("b.ALIAS_PELANGGAN LIKE '%$search%'"); $this->db->or_where("c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("d.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.KODE_PROYEK DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Proyek_bySTATUS($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_PROYEK=', $status); return $this->db->get()->result_array(); } public function getData_Proyek_bySTATUS_rpNotNull($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_PROYEK=', $status); $this->db->where('a.RP_ID is NOT NULL'); return $this->db->get()->result_array(); } public function getData_Proyek_bySTATUS_rpNotNull_beforeLimit($status, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.TGL_PROSES>=', $limit); $this->db->where('a.STATUS_PROYEK=', $status); $this->db->where('a.RP_ID is NOT NULL'); return $this->db->get()->result_array(); } public function getData_Proyek_bySTATUS_rpNull_jenis3($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_PROYEK,2) as NILAI, DATE_FORMAT(e.AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(e.AKHIR_PP,"%d/%m/%Y") as AKHIR'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('periode_proyek e','e.ID_PP=a.SEWA_PROYEK'); $this->db->where('a.STATUS_PROYEK=', $status); $this->db->where('a.RP_ID is NULL'); $this->db->where('a.JENIS_PROYEK=3'); return $this->db->get()->result_array(); } public function getData_Proyek_bySTATUS_rpNull_jenisLess2($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_PROYEK=', $status); $this->db->where('a.RP_ID is NULL'); $this->db->where('a.JENIS_PROYEK<=2'); return $this->db->get()->result_array(); } public function getData_Proyek_forBerjalan() { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('jenis_pp e','e.ID_JPP=a.JENIS_PROYEK'); $this->db->where('a.STATUS_PROYEK=0'); $this->db->or_where('a.STATUS_PROYEK=1 AND a.JENIS_PROYEK=3 AND a.SEWA_PROYEK is NOT NULL'); return $this->db->get()->result_array(); } public function getData_Proyek_groupPELANGGAN_statusNot9() { // Used $this->db->select('*'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.STATUS_PROYEK!=9'); $this->db->group_by('a.PELANGGAN_ID'); $this->db->order_by('b.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_Proyek_statusUntil1() { // Used $this->db->select('*, DATE_FORMAT(a.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TEMPO_PROYEK,"%d/%m/%Y") as TEMPO, FORMAT(a.NILAI_PROYEK,2) as NILAI'); $this->db->from('proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_PROYEK<=1 AND a.RP_ID is NULL AND a.SEWA_PROYEK is NULL'); return $this->db->get()->result_array(); } public function getData_QualityControl_bySO($id_so) { //Used $this->db->select('*'); $this->db->from('quality_control a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where('a.SO_ID=', $id_so); return $this->db->get()->result_array(); } public function getData_RekapKlaimProgram_byID($id) { // Used $this->db->select('*, FORMAT(a.NILAI_RKPR, 2) as NILAI'); $this->db->from('rekap_klaimprogram a'); $this->db->join('potongan_klaimprogram b', 'b.ID_PKPR=a.PKPR_ID'); $this->db->where(['a.ID_RKPR' => $id]); return $this->db->get()->result_array(); } public function getData_RekapKlaimProgram_byID_bySTATUS($id, $status) { // Used $this->db->select('*, FORMAT(a.NILAI_RKPR, 2) as NILAI'); $this->db->from('rekap_klaimprogram a'); $this->db->join('potongan_klaimprogram b', 'b.ID_PKPR=a.PKPR_ID'); $this->db->where(['a.ID_RKPR' => $id]); $this->db->where(['a.STATUS_RKPR' => $status]); return $this->db->get()->result_array(); } public function getData_RekapKlaimProgram_byMERK_byPRODUK_bySTATUS($id_merk, $id_produk, $status) { // Used $this->db->select('*, FORMAT(a.NILAI_RKPR,2) as NILAI, DATE_FORMAT(e.AWAL_PKL,"%d/%m/%Y") as AWAL, DATE_FORMAT(e.AKHIR_PKL,"%d/%m/%Y") as AKHIR, a.MERK_ID as MID'); $this->db->from('rekap_klaimprogram a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('produk c','c.ID_PRODUK=a.PRODUK_ID'); $this->db->join('potongan_klaimprogram d','d.ID_PKPR=a.PKPR_ID'); $this->db->join('periode_klaimprogram e','e.ID_PKL=a.PKL_ID'); $this->db->where('a.MERK_ID=', $id_merk); $this->db->where('a.PRODUK_ID=', $id_produk); $this->db->where('a.STATUS_RKPR=', $status); $this->db->order_by('d.NAMA_PKPR ASC'); return $this->db->get()->result_array(); } public function getData_RekapKlaimProgram_byMERK_byPRODUK_bySTATUS_byPERIODE($id_merk=null, $id_produk=null, $status=null, $periode=null) { // Used $this->db->select('*,FORMAT(a.NILAI_RKPR,2) as NILAI, DATE_FORMAT(f.AWAL_PKL,"%d/%m/%Y") as AWAL, DATE_FORMAT(f.AKHIR_PKL,"%d/%m/%Y") as AKHIR'); $this->db->from('rekap_klaimprogram a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('produk c','c.ID_PRODUK=a.PRODUK_ID'); $this->db->join('potongan_klaimprogram e','e.ID_PKPR=a.PKPR_ID'); $this->db->join('periode_klaimprogram f','f.ID_PKL=a.PKL_ID'); if ($id_merk!=null) { $this->db->where('a.MERK_ID=', $id_merk); } if ($id_produk!=null) { $this->db->where('a.PRODUK_ID=', $id_produk); } if ($status!=null) { $this->db->where('a.STATUS_RKPR=', $status); } else { $this->db->where('a.STATUS_RKPR<=1'); } if ($periode!=null) { $this->db->where('a.PKL_ID=', $periode); } $this->db->order_by('f.AWAL_PKL ASC, f.AKHIR_PKL ASC, f.NAMA_PKL ASC, b.NAMA_MERK ASC, c.ID_PRODUK ASC, e.NAMA_PKPR ASC'); return $this->db->get()->result_array(); } public function getData_RekapPajak_byCORP_byJENIS_bySTATUS($id, $jenis, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_RPJ,"%d/%m/%Y") as TGLRPJ'); $this->db->from('rekap_pajak a'); $this->db->join('wajibpajak b','b.ID_WAJIBPAJAK=a.WAJIBPAJAK_ID'); if ($id!=0) { $this->db->where('a.CORP_ID=', $id); } $this->db->where('a.STATUS_RPJ=', $status); $this->db->where('a.JENIS_RPJ=', $jenis); $this->db->order_by('a.ID_RPJ DESC'); return $this->db->get()->result_array(); } public function getData_RekapPajak_byID($id) { // Used $this->db->select('*'); $this->db->from('rekap_pajak'); $this->db->where('ID_RPJ=', $id); return $this->db->get()->result_array(); } public function getData_RekapProyek_byID($id) { // Used $this->db->select('*, DATE_FORMAT(b.AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(b.AKHIR_PP,"%d/%m/%Y") as AKHIR'); $this->db->from('rekap_proyek a'); $this->db->join('periode_proyek b','b.ID_PP=a.PP_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SAL_ID'); $this->db->where(['a.ID_RP' => $id]); return $this->db->get()->result_array(); } public function getData_RekapProyek_byID_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(c.AWAL_PP,"%d/%m/%Y") as AWAL,DATE_FORMAT(c.AKHIR_PP,"%d/%m/%Y") as AKHIR,DATE_FORMAT(a.TGL_KUNCI,"%d/%m/%Y") as TANGGAL'); $this->db->from('rekap_proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SAL_ID'); $this->db->join('periode_proyek c','c.ID_PP=a.PP_ID'); $this->db->join('jenis_pp d','d.ID_JPP=c.JENIS_PP'); $this->db->where('a.ID_RP=', $id); $this->db->where('a.STATUS_RP=', $status); return $this->db->get()->result_array(); } public function getData_RekapProyek_byJENIS_bySTATUS_orderDESC($jenis, $status) { // Used $this->db->select('*,DATE_FORMAT(c.AWAL_PP,"%d/%m/%Y") as AWAL,DATE_FORMAT(c.AKHIR_PP,"%d/%m/%Y") as AKHIR,DATE_FORMAT(a.TGL_KUNCI,"%d/%m/%Y") as TANGGAL'); $this->db->from('rekap_proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SAL_ID'); $this->db->join('periode_proyek c','c.ID_PP=a.PP_ID'); $this->db->join('jenis_pp d','d.ID_JPP=c.JENIS_PP'); $this->db->where('c.JENIS_PP=', $jenis); $this->db->where('a.STATUS_RP=', $status); $this->db->order_by('a.TGL_KUNCI DESC, a.ID_RP DESC'); return $this->db->get()->result_array(); } public function getData_RekapProyek_byPP($id) { // Used $this->db->select('*'); $this->db->from('rekap_proyek'); $this->db->where('PP_ID=', $id); return $this->db->get()->result_array(); } public function getData_RekapProyek_bySALES_byPP($id_sales, $id_pp) { // Used $this->db->select('*, DATE_FORMAT(b.AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(b.AKHIR_PP,"%d/%m/%Y") as AKHIR, FORMAT(a.BIAYA_RP, 2) as BIAYA, FORMAT(a.GP_RP, 2) as GP, FORMAT((a.GP_RP+a.BIAYA_RP), 2) as NOTA'); $this->db->from('rekap_proyek a'); $this->db->join('periode_proyek b','b.ID_PP=a.PP_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SAL_ID'); $this->db->where('a.SAL_ID=', $id_sales); $this->db->where('a.PP_ID=', $id_pp); $this->db->order_by('a.ID_RP ASC'); return $this->db->get()->result_array(); } public function getData_RekapProyek_bySALES_byPP_byGRUP($id_sales, $id_pp, $grup) { // Used $this->db->select('*, DATE_FORMAT(b.AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(b.AKHIR_PP,"%d/%m/%Y") as AKHIR, FORMAT(a.BIAYA_RP, 2) as BIAYA, FORMAT(a.GP_RP, 2) as GP, FORMAT((a.GP_RP+a.BIAYA_RP), 2) as NOTA'); $this->db->from('rekap_proyek a'); $this->db->join('periode_proyek b','b.ID_PP=a.PP_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SAL_ID'); $this->db->where('a.SAL_ID=', $id_sales); $this->db->where('a.PP_ID=', $id_pp); $this->db->where('a.GRUP_ID=', $grup); return $this->db->get()->result_array(); } public function getData_RekapProyek_bySALES_byPP_bySTATUS($id_sales, $id_pp, $status) { // Used $this->db->select('*, DATE_FORMAT(b.AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(b.AKHIR_PP,"%d/%m/%Y") as AKHIR'); $this->db->from('rekap_proyek a'); $this->db->join('periode_proyek b','b.ID_PP=a.PP_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SAL_ID'); $this->db->where('a.SAL_ID=', $id_sales); $this->db->where('a.PP_ID=', $id_pp); $this->db->where('a.STATUS_RP=', $status); return $this->db->get()->result_array(); } public function getData_RekapProyek_bySALES_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(c.AWAL_PP,"%d/%m/%Y") as AWAL,DATE_FORMAT(c.AKHIR_PP,"%d/%m/%Y") as AKHIR,DATE_FORMAT(a.TGL_KUNCI,"%d/%m/%Y") as TANGGAL'); $this->db->from('rekap_proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SAL_ID'); $this->db->join('periode_proyek c','c.ID_PP=a.PP_ID'); $this->db->join('jenis_pp d','d.ID_JPP=c.JENIS_PP'); $this->db->where('a.SAL_ID=', $id); $this->db->where('a.STATUS_RP=', $status); $this->db->order_by('a.TGL_KUNCI DESC, a.ID_RP DESC'); return $this->db->get()->result_array(); } public function getData_RekapProyek_bySTATUS($status) { // Used $this->db->select('*,DATE_FORMAT(c.AWAL_PP,"%d/%m/%Y") as AWAL,DATE_FORMAT(c.AKHIR_PP,"%d/%m/%Y") as AKHIR,DATE_FORMAT(a.TGL_KUNCI,"%d/%m/%Y") as TANGGAL'); $this->db->from('rekap_proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SAL_ID'); $this->db->join('periode_proyek c','c.ID_PP=a.PP_ID'); $this->db->join('jenis_pp d','d.ID_JPP=c.JENIS_PP'); $this->db->where('a.STATUS_RP=', $status); $this->db->order_by('a.TGL_KUNCI DESC, a.ID_RP DESC'); return $this->db->get()->result_array(); } public function getData_RekapProyek_bySTATUS_afterLimit($status, $limit) { // Used $this->db->select('*, DATE_FORMAT(c.AWAL_PP,"%d/%m/%Y") as AWAL, DATE_FORMAT(c.AKHIR_PP,"%d/%m/%Y") as AKHIR, FORMAT(a.BIAYA_RP, 2) as BIAYA, FORMAT(a.GP_RP, 2) as GP'); $this->db->from('rekap_proyek a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SAL_ID'); $this->db->join('periode_proyek c','c.ID_PP=a.PP_ID'); $this->db->join('jenis_pp d','d.ID_JPP=c.JENIS_PP'); $this->db->where('a.STATUS_RP=', $status); $this->db->where('a.TGL_KUNCI>=', $limit); $this->db->order_by('a.TGL_KUNCI DESC, a.ID_RP DESC'); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($id_corp=null, $id_supplier=null, $awal=null, $akhir=null, $status=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_RB,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT, DATE_FORMAT(b.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('corp e','e.ID_CORP=b.CORP_ID'); $this->db->where('a.TGL_INPUT>=', $awal); $this->db->where('a.TGL_INPUT<=', $akhir); if ($id_corp!=null) { $this->db->where(['b.CORP_ID' => $id_corp]); } if ($id_supplier!=null) { $this->db->where(['b.SUPPLIER_ID' => $id_supplier]); } if ($status!=null) { $this->db->where(['a.STATUS_RB' => $status]); } $this->db->order_by('a.KODE_RB ASC'); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_forSearch($id_corp=null, $id_supplier=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_RB,"%d/%m/%Y") as TANGGAL'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); if ($id_corp==NULL AND $id_supplier==NULL AND $search==NULL) { $this->db->where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir'"); } else if ($id_corp==NULL AND $id_supplier==NULL AND $search!=NULL) { $this->db->where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND a.KODE_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND a.KET_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND a.INV_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_supplier==NULL AND $search==NULL) { $this->db->where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp"); } else if ($id_corp!=NULL AND $id_supplier==NULL AND $search!=NULL) { $this->db->where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND a.KODE_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND a.KET_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND a.INV_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_supplier!=NULL AND $search==NULL) { $this->db->where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.SUPPLIER_ID=$id_supplier"); } else if ($id_corp==NULL AND $id_supplier!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND a.KODE_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_TGL_RB<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND a.KET_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_TGL_RB<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND a.INV_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_TGL_RB<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND b.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_TGL_RB<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND b.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_TGL_RB<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_TGL_RB<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_TGL_RB<='$akhir' AND b.SUPPLIER_ID=$id_supplier AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_supplier!=NULL AND $search==NULL) { $this->db->where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier"); } else if ($id_corp!=NULL AND $id_supplier!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND a.KODE_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND a.KET_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND a.INV_RB LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND b.KODE_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND b.SJ_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_RB=1 AND a.TGL_RB>='$awal' AND a.TGL_RB<='$akhir' AND b.CORP_ID=$id_corp AND b.SUPPLIER_ID=$id_supplier AND d.NAMA_KOTA LIKE '%$search%'"); } $this->db->order_by('a.KODE_RB ASC'); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_status1($id1, $id2, $awal, $akhir, $textSearch=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_RB,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT, DATE_FORMAT(b.TGL_INVBELI,"%d/%m/%Y") as TGLINVBELI'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('corp e','e.ID_CORP=b.CORP_ID'); $this->db->where('a.TGL_INPUT>=', $awal); $this->db->where('a.TGL_INPUT<=', $akhir); $this->db->where('a.STATUS_RB=1'); if ($id1!=null) { $this->db->where(['b.CORP_ID' => $id1]); } if ($id2!=null) { $this->db->where(['b.SUPPLIER_ID' => $id2]); } if ($textSearch!=null) { $this->db->like('b.INV_PEMBELIAN', $textSearch); } $this->db->order_by('a.KODE_RB ASC'); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byID($id) { // Used $this->db->select('*'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('corp d','d.ID_CORP=b.CORP_ID'); $this->db->where('a.ID_RB=', $id); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byID_byKARYAWAN_statusNull($id1, $id2) { // Used $this->db->select('*'); $this->db->from('retur_pembelian'); $this->db->where('STATUS_RB is NULL'); $this->db->where('ID_RB=', $id1); $this->db->where('ADMIN_ID=', $id2); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byID_linkCetakDokumen($id) { // Used $this->db->select('*'); $this->db->from('retur_pembelian a'); $this->db->join('cetak_dokumen b','b.RB_ID=a.ID_RB'); $this->db->where('a.ID_RB=', $id); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->where('a.ID_RB=', $id); $this->db->where('a.STATUS_RB=', $status); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byID_statusNull($id) { // Used $this->db->select('*'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->where('a.ID_RB=', $id); $this->db->where('a.STATUS_RB is NULL'); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byKARYAWAN_beforeTGL_statusNull($id, $tgl) { // Used $this->db->select('*'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where('a.STATUS_RB is NULL'); $this->db->where('a.ADMIN_ID=', $id); $this->db->where('a.TGL_RB<', $tgl); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byKARYAWAN_statusNull($id) { // Used $this->db->select('*'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where('a.STATUS_RB is NULL AND a.ADMIN_ID=', $id); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byKODE($id) { // Used $this->db->select('*'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where('a.KODE_RB=', $id); return $this->db->get()->result_array(); } public function getData_ReturPembelian_byPERIODE_orderDESC($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(b.TGL_INVBELI,"%d/%m/%Y") as TGLINV'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('cetak_dokumen e','e.RB_ID=a.ID_RB'); $this->db->where('a.TGL_RB>=', $awal); $this->db->where('a.TGL_RB<=', $akhir); $this->db->order_by('a.ID_RB DESC'); return $this->db->get()->result_array(); } public function getData_ReturPembelian_bySEARCH_limit10($search=null) { // Used $this->db->select('*'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('corp e','e.ID_CORP=b.CORP_ID'); if ($search!=null) { $this->db->where("a.KODE_RB LIKE '%$search%'"); $this->db->or_where("a.INV_RB LIKE '%$search%'"); $this->db->or_where("b.INV_PEMBELIAN LIKE '%$search%'"); $this->db->or_where("c.ALIAS_SUPPLIER LIKE '%$search%'"); $this->db->or_where("c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("e.ALIAS_CORP LIKE '%$search%'"); } $this->db->order_by('a.KODE_RB DESC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_ReturPembelian_bySTATUS($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL'); $this->db->from('retur_pembelian a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('kop e','e.ID_KOP=b.CORP_ID'); $this->db->where('a.STATUS_RB=', $status); return $this->db->get()->result_array(); } public function getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_forSearch($id_corp=null, $id_sales=null, $id_pelanggan=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL'); $this->db->from('retur_penjualan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('karyawan f','f.ID_KARYAWAN=c.SALES_ID'); if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir'"); } else if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KODE_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.INV_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KET_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.KOP_ID=$id_corp"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KODE_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.INV_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KET_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND c.SALES_ID=$id_sales"); } else if ($id_corp==NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_RJ=1 AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KODE_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.INV_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KET_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.PEL_ID=$id_pelanggan"); } else if ($id_corp==NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_RJ=1 AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KODE_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.INV_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KET_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search==NULL) { $this->db->where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan==NULL AND $search!=NULL) { $this->db->where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KODE_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.INV_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KET_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.KOP_ID=$id_corp AND b.PEL_ID=$id_pelanggan"); } else if ($id_corp!=NULL AND $id_sales==NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KODE_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.INV_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KET_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan!=NULL AND $search==NULL) { $this->db->where("a.STATUS_RJ=1 AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND b.PEL_ID=$id_pelanggan"); } else if ($id_corp!=NULL AND $id_sales!=NULL AND $id_pelanggan!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KODE_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.INV_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND a.KET_RJ LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND e.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_RJ=1 AND b.KOP_ID=$id_corp AND c.SALES_ID=$id_sales AND b.PEL_ID=$id_pelanggan AND a.TGL_INPUT>='$awal' AND a.TGL_INPUT<='$akhir' AND f.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.KODE_RJ ASC'); return $this->db->get()->result_array(); } public function getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($id1=null, $id2=null, $id3=null, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL'); $this->db->from('retur_penjualan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('corp f','f.ID_CORP=c.CORP_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=c.SALES_ID'); $this->db->where('a.TGL_INPUT>=', $awal); $this->db->where('a.TGL_INPUT<=', $akhir); $this->db->where('a.STATUS_RJ=1'); if ($id1!=null) { $this->db->where('c.CORP_ID=', $id1); } if ($id2!=null) { $this->db->where('c.SALES_ID=', $id2); } if ($id3!=null) { $this->db->where('c.PELANGGAN_ID=', $id3); } $this->db->order_by('a.KODE_RJ ASC'); return $this->db->get()->result_array(); } public function getData_ReturPenjualan_byID($id) { // Used $this->db->select('*'); $this->db->from('retur_penjualan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=c.SALES_ID'); $this->db->where('a.ID_RJ=', $id); return $this->db->get()->result_array(); } public function getData_ReturPenjualan_byID_byKARYAWAN_statusNull($id1, $id2) { // Used $this->db->select('*'); $this->db->from('retur_penjualan'); $this->db->where('STATUS_RJ is NULL'); $this->db->where('ID_RJ=', $id1); $this->db->where('ADMIN_ID=', $id2); return $this->db->get()->result_array(); } public function getData_ReturPenjualan_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('retur_penjualan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('sales_order d','d.ID_SO=b.SO_ID'); $this->db->where('a.ID_RJ=', $id); $this->db->where('a.STATUS_RJ=', $status); return $this->db->get()->result_array(); } public function getData_ReturPenjualan_byKARYAWAN_statusNull($id) { // Used $this->db->select('*'); $this->db->from('retur_penjualan'); $this->db->where('STATUS_RJ is NULL'); $this->db->where('ADMIN_ID=', $id); return $this->db->get()->result_array(); } public function getData_ReturPenjualan_byPENJUALAN($id) { // Used $this->db->select('*'); $this->db->from('retur_penjualan'); $this->db->where('PENJUALAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_ReturPenjualan_bySEARCH_limit20($search=null) { // Used $this->db->select('*'); $this->db->from('retur_penjualan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); if ($search!=null) { $this->db->where("a.KODE_RJ LIKE '%$search%'"); $this->db->or_where("a.INV_RJ LIKE '%$search%'"); $this->db->or_where("b.SJ_PENJUALAN LIKE '%$search%'"); $this->db->or_where("b.INV_PENJUALAN LIKE '%$search%'"); $this->db->or_where("c.PO_SO LIKE '%$search%'"); $this->db->or_where("d.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("e.NAMA_KOTA LIKE '%$search%'"); } $this->db->order_by('a.KODE_RJ DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_ReturPenjualan_bySTATUS($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL'); $this->db->from('retur_penjualan a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_RJ=', $status); return $this->db->get()->result_array(); } public function getData_RumusGp_byID($id=null) { // Used $this->db->select('*'); $this->db->from('rumus_gp'); $this->db->where('ID_RGP=', $id); return $this->db->get()->result_array(); } public function getData_RumusGp_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('rumus_gp'); $this->db->where('ID_RGP=', $id); $this->db->where('STATUS_RGP=', $status); return $this->db->get()->result_array(); } public function getData_RumusGp_byJENIS_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('rumus_gp'); $this->db->where('JENIS_RGP=', $id); $this->db->where('STATUS_RGP=', $status); return $this->db->get()->result_array(); } public function getData_RumusGp_byNAMA($id) { // Used $this->db->select('*'); $this->db->from('rumus_gp'); $this->db->where('NAMA_RGP=', $id); return $this->db->get()->result_array(); } public function getData_RumusGp_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('rumus_gp a'); $this->db->join('jenis_pp b','b.ID_JPP=a.JENIS_RGP'); $this->db->where('a.STATUS_RGP=', $id); $this->db->order_by('b.NAMA_JPP ASC, a.NAMA_RGP ASC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_byALUR_statusUntil1($id) { //Used $this->db->select('*'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.STATUS_SO=0 AND a.ALUR_SO=', $id); $this->db->or_where('a.STATUS_SO=1 AND a.ALUR_SO=', $id); return $this->db->get()->result_array(); } public function getData_SalesOrder_byGUDANG_byPERIODE_bySTATUS($id, $awal, $akhir, $status) { //Used $this->db->select('*'); $this->db->from('sales_order'); $this->db->where('TGL_SO>=', $awal); $this->db->where('TGL_SO<=', $akhir); $this->db->where(['GUDANG_SO' => $id]); $this->db->where(['STATUS_SO' => $status]); return $this->db->get()->result_array(); } public function getData_SalesOrder_byID($id) { //Used $this->db->select('*, FORMAT(a.FEE_SO, 2) as FEE'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->join('kota d','d.ID_KOTA=b.KOTA_ID'); $this->db->join('corp e','e.ID_CORP=a.CORP_ID'); $this->db->where(['a.ID_SO' => $id]); return $this->db->get()->result_array(); } public function getData_SalesOrder_byID_bySTATUS($id, $status) { //Used $this->db->select('*'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('corp c','c.ID_CORP=a.CORP_ID'); $this->db->where(['a.ID_SO' => $id]); $this->db->where(['a.STATUS_SO' => $status]); return $this->db->get()->result_array(); } public function getData_SalesOrder_byID_status0_3($id) { // Used $this->db->select('*'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=0 AND ID_SO=', $id); $this->db->or_where('STATUS_SO=3 AND ID_SO=', $id); return $this->db->get()->result_array(); } public function getData_SalesOrder_byID_statusNull($id) { // Used $this->db->select('*'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.STATUS_SO is NULL AND a.ID_SO=', $id); return $this->db->get()->result_array(); } public function getData_SalesOrder_byKODE($kode) { // Used $this->db->select('*'); $this->db->from('sales_order'); $this->db->where('KODE_SO=', $kode); return $this->db->get()->result_array(); } public function getData_SalesOrder_byNAMAPEL_byPERIODE($nama, $awal, $akhir) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_SO,2) as NILAI'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('b.NAMA_PELANGGAN=', $nama); $this->db->where('a.TGL_SO>=', $awal); $this->db->where('a.TGL_SO<=', $akhir); $this->db->where('a.STATUS_SO!=5'); $this->db->where('a.STATUS_SO!=9'); $this->db->order_by('a.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_byPELANGGAN_bySALES_status1_forProyek($id_pelanggan, $id_sales) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_SO,2) as TOTAL'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('so_proyek d','d.SO_ID=a.ID_SO','left'); $this->db->where('d.ID_SPR is NULL'); $this->db->where('a.STATUS_SO=1'); $this->db->where('a.GP_SO=1'); $this->db->where('a.PELANGGAN_ID=', $id_pelanggan); $this->db->where('a.SALES_ID=', $id_sales); $this->db->order_by('a.ID_SO DESC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_byPENJUALAN($id) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, FORMAT(a.FEE_SO, 2) as FEE'); $this->db->from('sales_order a'); $this->db->join('penjualan b','b.SO_ID=a.ID_SO'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('b.ID_PENJUALAN=', $id); return $this->db->get()->result_array(); } public function getData_SalesOrder_byPERIODE_bySEARCH_limit20_forCetak($awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SO, "%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_SO, 2) as NILAI'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('kop e','e.ID_KOP=a.CORP_ID'); if ($search!=null) { $this->db->where("a.TGL_SO>='$awal' AND a.TGL_SO<='$akhir' AND a.STATUS_SO is NOT NULL AND a.STATUS_SO!=5 AND a.STATUS_SO!=9 AND a.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.TGL_SO>='$awal' AND a.TGL_SO<='$akhir' AND a.STATUS_SO is NOT NULL AND a.STATUS_SO!=5 AND a.STATUS_SO!=9 AND a.PO_SO LIKE '%$search%'"); $this->db->or_where("a.TGL_SO>='$awal' AND a.TGL_SO<='$akhir' AND a.STATUS_SO is NOT NULL AND a.STATUS_SO!=5 AND a.STATUS_SO!=9 AND a.NILAI_SO LIKE '%$search%'"); $this->db->or_where("a.TGL_SO>='$awal' AND a.TGL_SO<='$akhir' AND a.STATUS_SO is NOT NULL AND a.STATUS_SO!=5 AND a.STATUS_SO!=9 AND b.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.TGL_SO>='$awal' AND a.TGL_SO<='$akhir' AND a.STATUS_SO is NOT NULL AND a.STATUS_SO!=5 AND a.STATUS_SO!=9 AND c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.TGL_SO>='$awal' AND a.TGL_SO<='$akhir' AND a.STATUS_SO is NOT NULL AND a.STATUS_SO!=5 AND a.STATUS_SO!=9 AND d.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.TGL_SO>='$awal' AND a.TGL_SO<='$akhir' AND a.STATUS_SO is NOT NULL AND a.STATUS_SO!=5 AND a.STATUS_SO!=9 AND e.NAMA_KOP LIKE '%$search%'"); } else { $this->db->where("a.STATUS_SO is NOT NULL AND a.STATUS_SO!=5 AND a.STATUS_SO!=9"); } $this->db->order_by('a.KODE_SO DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_SalesOrder_byPERIODE_byGUDANG_bySTATUS($awal, $akhir, $gudang, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_SO, 2) as NILAI'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.TGL_SO>=', $awal); $this->db->where('a.TGL_SO<=', $akhir); $this->db->where('a.GUDANG_SO=', $gudang); $this->db->where('a.STATUS_SO=', $status); return $this->db->get()->result_array(); } public function getData_SalesOrder_byPERIODE_orderDESC($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_SO, 2) as NILAI'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.STATUS_SO is NOT NULL AND a.STATUS_SO!=5 AND a.STATUS_SO!=9'); $this->db->where('a.TGL_SO>=', $awal); $this->db->where('a.TGL_SO<=', $akhir); $this->db->order_by('a.ID_SO DESC'); return $this->db->get()->result_array(); } public function getData_SalerOrder_bySALES_byPELANGGAN_status1_joinSpr_notUsed($id1, $id2) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_SO, 2) as NILAI'); $this->db->from('sales_order a'); $this->db->join('so_proyek b','b.SO_ID=a.ID_SO','left'); $this->db->where(['a.SALES_ID' => $id1]); $this->db->where(['a.PELANGGAN_ID' => $id2]); $this->db->where('a.STATUS_SO=1'); $this->db->where('b.ID_SPR is NULL'); $this->db->order_by('a.KODE_SO DESC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_bySALES_byPERIODE($id=null, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_SO,2) as NILAI, FORMAT(a.FEE_SO,2) as FEE'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('kop e','e.ID_KOP=a.CORP_ID'); if ($id!=null) { $this->db->where(['a.SALES_ID' => $id]); } $this->db->where('a.TGL_SO>=', $awal); $this->db->where('a.TGL_SO<=', $akhir); $this->db->where('a.STATUS_SO is NOT NULL'); $this->db->order_by('a.KODE_SO DESC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_bySALES_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_SO,2) as NILAI, , DATE_FORMAT(a.TGL_REQUEST,"%d/%m/%Y") as REQUEST, FORMAT(a.FEE_SO,2) as FEE, ROUND(a.PPN_SO, 0) as PPN'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('corp e','e.ID_CORP=a.CORP_ID'); $this->db->join('status_persiapanso f','f.ID_SPSO=a.PERSIAPAN_SO','left'); $this->db->where(['a.SALES_ID' => $id]); $this->db->where(['a.STATUS_SO' => $status]); return $this->db->get()->result_array(); } public function getData_SalesOrder_bySALES_statusNull($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL, FORMAT(a.NILAI_SO,2) as NILAI, , DATE_FORMAT(a.TGL_REQUEST,"%d/%m/%Y") as REQUEST, FORMAT(a.FEE_SO,2) as FEE, ROUND(a.PPN_SO, 0) as PPN'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('corp e','e.ID_CORP=a.CORP_ID'); $this->db->where(['a.SALES_ID' => $id]); $this->db->where('a.STATUS_SO is NULL'); return $this->db->get()->result_array(); } public function getData_SalesOrder_bySEARCH_limit20_allStatus($search=null) { // Used $this->db->select('*, FORMAT(a.NILAI_SO, 2) as NILAI, DATE_FORMAT(a.TGL_SO, "%d/%m/%Y") as TANGGAL'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); if ($search!=null) { $this->db->where("a.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.PO_SO LIKE '%$search%'"); $this->db->or_where("b.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("d.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.KODE_SO DESC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_SalesOrder_bySEARCH_limit20_status1($search=null) { // Used $this->db->select('*, FORMAT(a.NILAI_SO, 2) as NILAI, DATE_FORMAT(a.TGL_SO, "%d/%m/%Y") as TANGGAL'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('penjualan e','e.SO_ID=a.ID_SO'); if ($search!=null) { $this->db->where("a.STATUS_SO=1 AND a.KODE_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_SO=1 AND a.PO_SO LIKE '%$search%'"); $this->db->or_where("a.STATUS_SO=1 AND b.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_SO=1 AND c.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("a.STATUS_SO=1 AND d.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_SO=1 AND e.INV_PENJUALAN LIKE '%$search%'"); } else { $this->db->where("a.STATUS_SO=1"); } $this->db->order_by('a.KODE_SO DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_SalesOrder_bySTATUS($status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('corp e','e.ID_CORP=a.CORP_ID'); $this->db->where('a.STATUS_SO=', $status); $this->db->order_by('a.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_bySTATUS_afterTGL($status, $tgl) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID'); $this->db->where("a.GP_SO=0 AND a.TGL_SO>='$tgl' AND a.STATUS_SO=$status"); $this->db->or_where("a.GP_SO=1 AND a.TGL_SO>='$tgl' AND a.STATUS_SO=$status"); $this->db->order_by('a.TGL_SO ASC, a.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_Null($id) { // Used $this->db->select('*'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.STATUS_SO is NULL AND a.ID_SO=', $id); return $this->db->get()->result_array(); } public function getData_SalesOrder_status0_2_3($id=null) { //Used if ($id==null) { $this->db->select('*, DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL,ROUND(a.PPN_SO) as PPNROUND, FORMAT(a.FEE_SO,2) as FEE, FORMAT(a.NILAI_SO,2) as NISO'); $this->db->from('sales_order a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_SO=0 OR a.STATUS_SO=2 OR a.STATUS_SO=3'); } else { $this->db->select('*, DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL, ROUND(a.PPN_SO) as PPNROUND, FORMAT(a.FEE_SO,2) as FEE, FORMAT(a.NILAI_SO,2) as NISO'); $this->db->from('sales_order a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_SO=0 AND a.SALES_ID=', $id); $this->db->or_where('a.STATUS_SO=2 AND a.SALES_ID=', $id); $this->db->or_where('a.STATUS_SO=3 AND a.SALES_ID=', $id); } return $this->db->get()->result_array(); } public function getData_SalesOrder_status0_3() { // Used $this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.STATUS_SO=0 OR a.STATUS_SO=3'); $this->db->order_by('a.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_status1_tglKirimNull() { // Used $this->db->select('*'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->join('penjualan e','e.SO_ID=a.ID_SO'); $this->db->where('a.STATUS_SO=1'); $this->db->where('a.TGL_KIRIM is NULL'); $this->db->order_by('a.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_status1_tglKirimNotNull_yearNow() { // Used $limit = date('Y-01-01'); $this->db->select('*'); $this->db->from('sales_order a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.STATUS_SO=1'); $this->db->where('a.TGL_KIRIM is NOT NULL'); $this->db->where('a.TGL_SO>=', $limit); $this->db->order_by('a.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_statusNull($id=null) { // Used if ($id==null) { $this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL,ROUND(a.PPN_SO) as PPNROUND,FORMAT(a.FEE_SO,2) as FEE'); $this->db->from('sales_order a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_SO is NULL'); } else { $this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL,ROUND(a.PPN_SO) as PPNROUND,FORMAT(a.FEE_SO,2) as FEE'); $this->db->from('sales_order a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_SO is NULL'); $this->db->where('a.SALES_ID=', $id); } return $this->db->get()->result_array(); } public function getData_Satuan_byID($id) { // Used $this->db->select('*'); $this->db->from('satuan'); $this->db->where(['ID_SATUAN' => $id]); return $this->db->get()->result_array(); } public function getData_Satuan_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('satuan'); $this->db->where('ID_SATUAN=', $id); $this->db->where('STATUS_SATUAN=', $status); return $this->db->get()->result_array(); } public function getData_Satuan_byJENIS_bySTATUS($jenis, $status) { // Used $this->db->select('*'); $this->db->from('satuan'); $this->db->where(['JENIS_SATUAN' => $jenis]); $this->db->where(['STATUS_SATUAN' => $status]); $this->db->order_by('NAMA_SATUAN ASC'); return $this->db->get()->result_array(); } public function getData_Satuan_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('satuan'); $this->db->where('NAMA_SATUAN=', $nama); $this->db->where('STATUS_SATUAN=', $status); if ($id!=null) { $this->db->where('ID_SATUAN!=', $id); } return $this->db->get()->result_array(); } public function getData_Satuan_bySTATUS($status) { // Used $this->db->select('*'); $this->db->from('satuan'); $this->db->where(['STATUS_SATUAN' => $status]); $this->db->order_by('NAMA_SATUAN ASC'); return $this->db->get()->result_array(); } public function getData_Service_byCIPTA($id) { // Used $this->db->select('*'); $this->db->from('service'); $this->db->where(['CIPTA_SERVICE' => $id]); return $this->db->get()->result_array(); } public function getData_Service_byID($id) { // Used $this->db->select('*'); $this->db->from('service a'); $this->db->join('biaya_service b','b.ID_BS=a.PAKET_SERVICE'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.PEMBUAT_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=a.PELANGGAN_ID','left'); $this->db->where(['a.ID_SERVICE' => $id]); return $this->db->get()->result_array(); } public function getData_Service_byID_byPEMBUAT_bySTATUS($id, $karyawan, $status) { // Used $this->db->select('*'); $this->db->from('service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBUAT_ID'); $this->db->where(['a.ID_SERVICE' => $id]); $this->db->where(['a.PEMBUAT_ID' => $karyawan]); $this->db->where(['a.STATUS_SERVICE' => $status]); return $this->db->get()->result_array(); } public function getData_Service_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBUAT_ID'); $this->db->where(['a.ID_SERVICE' => $id]); $this->db->where(['a.STATUS_SERVICE' => $status]); return $this->db->get()->result_array(); } public function getData_Service_byJENIS_bySTATUS_byTGL($id, $status, $tgl, $idSpesifik=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('service a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('sn_service c','c.SERVICE_ID=a.ID_SERVICE'); $this->db->join('unitservice d','d.ID_UNITSERVICE=c.UNITSERVICE_ID'); $this->db->where(['a.JENIS_SERVICE' => $id]); $this->db->where(['a.STATUS_SERVICE' => $status]); $this->db->where('a.TGL_SERVICE>=', $tgl); if ($idSpesifik!=null) { $this->db->where('a.ID_SERVICE=', $idSpesifik); } $this->db->group_by('a.ID_SERVICE'); return $this->db->get()->result_array(); } public function getData_Service_byPEMBUAT_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBUAT_ID'); $this->db->where(['a.PEMBUAT_ID' => $id]); $this->db->where(['a.STATUS_SERVICE' => $status]); return $this->db->get()->result_array(); } public function getData_Service_byPELANGGAN_byPAKET_byPERIODE_status1($id1=null, $id2=null, $awal, $akhir, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SERVICE,"%d/%m/%Y") as TANGGAL, FORMAT(b.HARGA_BS, 2) as HARGA'); $this->db->from('service a'); $this->db->join('biaya_service b','b.ID_BS=a.PAKET_SERVICE'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('sn_service e','e.SERVICE_ID=a.ID_SERVICE'); $this->db->where('a.TGL_SERVICE>=', $awal); $this->db->where('a.TGL_SERVICE<=', $akhir); $this->db->where('a.STATUS_SERVICE=1'); if ($id1!=null) { $this->db->where('a.PELANGGAN_ID=', $id1); } if ($id2!=null) { $this->db->where('a.PAKET_SERVICE', $id2); } if ($search!=null) { $this->db->where('a.ID_SERVICE', $search); } $this->db->order_by('a.KODE_SERVICE ASC'); return $this->db->get()->result_array(); } public function getData_Service_byPERIODE_byJENIS_bySTATUS($awal=null, $akhir, $jenis, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBUAT_ID'); $this->db->join('sn_service c','c.SERVICE_ID=a.ID_SERVICE'); $this->db->join('unitservice d','d.ID_UNITSERVICE=c.UNITSERVICE_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=a.PELANGGAN_ID','left'); if ($awal!=null) { $this->db->where('a.TGL_SERVICE>=', $awal); } $this->db->where('a.TGL_SERVICE<=', $akhir); $this->db->where(['a.JENIS_SERVICE' => $jenis]); $this->db->where(['a.STATUS_SERVICE' => $status]); $this->db->order_by('a.ID_SERVICE DESC'); return $this->db->get()->result_array(); } public function getData_Service_bySEARCH_allStatus_limit20($search=null) { // Used $this->db->select('*'); $this->db->from('service a'); $this->db->join('biaya_service b','b.ID_BS=a.PAKET_SERVICE'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID','left'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.PEMBUAT_ID','left'); if ($search!=null) { $this->db->where("a.KODE_SERVICE LIKE '%$search%'"); $this->db->or_where("b.NAMA_BS LIKE '%$search%'"); $this->db->or_where("c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("c.ALIAS_PELANGGAN LIKE '%$search%'"); $this->db->or_where("d.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); } $this->db->order_by('a.KODE_SERVICE DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Service_bySTATUS($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBUAT_ID'); $this->db->where('a.STATUS_SERVICE=', $status); return $this->db->get()->result_array(); } public function getData_Service_bySTATUS_byJENIS($status, $jenis) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBUAT_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID','left'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID','left'); $this->db->where(['a.STATUS_SERVICE' => $status]); $this->db->where(['a.JENIS_SERVICE' => $jenis]); return $this->db->get()->result_array(); } public function getData_Service_bySTATUS_jenisNot0($status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('service a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBUAT_ID'); $this->db->where('a.STATUS_SERVICE=', $status); $this->db->where('a.JENIS_SERVICE!=0'); return $this->db->get()->result_array(); } public function getData_SetGudang_byKARYAWAN_byMENU($id1, $id2) { // Used $this->db->select('*'); $this->db->from('set_gudang'); $this->db->where(['KARYAWAN_ID' => $id1]); $this->db->where(['MENU_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_SetHakAdminSo_byKARYAWAN($id) { //Used $this->db->select('*'); $this->db->from('set_hakadminso a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.HAK_ID'); $this->db->where(['a.KARYAWAN_ID' => $id]); $this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_SetHakAdminSo_byKARYAWAN_byHAK($id1, $id2) { //Used $this->db->select('*'); $this->db->from('set_hakadminso a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.HAK_ID'); $this->db->where(['a.KARYAWAN_ID' => $id1]); $this->db->where(['a.HAK_ID' => $id2]); $this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_SetHakAdminSo_groupKARYAWAN() { //Used $this->db->select('*'); $this->db->from('set_hakadminso a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->group_by('KARYAWAN_ID'); $this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id, $kode, $nama) { // Used $this->db->select('*'); $this->db->from('set_hakmenu a'); $this->db->join('menu b','b.ID_MENU=a.MENU_ID'); $this->db->join('akses c','c.ID_AKSES=a.AKSES_ID'); $this->db->where(['a.KARYAWAN_ID' => $id]); $this->db->where(['b.KODE_MENU' => $kode]); $this->db->where(['b.NAMA_MENU' => $nama]); return $this->db->get()->result_array(); } public function getData_SetHariLibur() { // Used $this->db->select('*, DATE_FORMAT(TGL_SHL,"%d/%m/%Y") as TANGGAL'); $this->db->from('set_harilibur'); $this->db->order_by('TGL_SHL DESC'); return $this->db->get()->result_array(); } public function getData_SetHariLibur_byID($id) { // Used $this->db->select('*'); $this->db->from('set_harilibur'); $this->db->where('ID_SHL=', $id); return $this->db->get()->result_array(); } public function getData_SetHariLibur_byJENIS_byPERIODE($jenis, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(TGL_SHL, "%d/%m/%Y") as TANGGAL'); $this->db->from('set_harilibur'); $this->db->where('JENIS_SHL=', $jenis); $this->db->where('TGL_SHL>=', $awal); $this->db->where('TGL_SHL<=', $akhir); return $this->db->get()->result_array(); } public function getData_SetHariLibur_byTGL($tgl) { // Used $this->db->select('*'); $this->db->from('set_harilibur'); $this->db->where('TGL_SHL=', $tgl); return $this->db->get()->result_array(); } public function getData_SetKasbankAktif_byKARYAWAN_byNAMA($id, $nama) { // Used $this->db->select('*'); $this->db->from('set_kasbankaktif'); $this->db->where(['KARYAWAN_ID' => $id]); $this->db->where(['NAMA_SKK' => $nama]); return $this->db->get()->result_array(); } public function getData_SetMerk_byKARYAWAN($id) { // Used $this->db->select('*'); $this->db->from('set_merk'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_SetModeInclude_byKARYAWAN($id) { // Used $this->db->select('*'); $this->db->from('set_modeinclude'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_SetOtomasiJs() { // Used $this->db->select('*, DATE_FORMAT(TGL_SOJS,"%d/%m/%Y") as TANGGAL'); $this->db->from('set_otomasijs'); return $this->db->get()->result_array(); } public function getData_SetPelangganClearance() { // Used $this->db->select('*'); $this->db->from('set_pelanggan_clearance a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID','left'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID','left'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID','left'); return $this->db->get()->result_array(); } public function getData_SetPelangganClearance_byID($id) { // Used $this->db->select('*'); $this->db->from('set_pelanggan_clearance'); $this->db->where('ID_STPC=', $id); return $this->db->get()->result_array(); } public function getData_SetPelangganClearance_byPELANGGAN($id) { // Used $this->db->select('*'); $this->db->from('set_pelanggan_clearance'); $this->db->where('PELANGGAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_SetPelangganClearance_bySALES($id) { // Used $this->db->select('*'); $this->db->from('set_pelanggan_clearance'); $this->db->where('SALES_ID=', $id); return $this->db->get()->result_array(); } public function getData_SetPengingatPiutang_byKARYAWAN($id) { // Used $this->db->select('*'); $this->db->from('set_pengingatpiutang'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_SetPricelist_byKARYAWAN($id) { // Used $this->db->select('*'); $this->db->from('set_pricelist'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_SetSalesProduk() { // Used $this->db->select('*'); $this->db->from('set_salesproduk a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('produk c','c.ID_PRODUK=a.PRODUK_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID','left'); $this->db->order_by('b.NAMA_MERK ASC, c.NAMA_PRODUK ASC'); return $this->db->get()->result_array(); } public function getData_SetSalesProduk_byID($id) { // Used $this->db->select('*'); $this->db->from('set_salesproduk a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('produk c','c.ID_PRODUK=a.PRODUK_ID'); $this->db->where('a.ID_SSP=', $id); return $this->db->get()->result_array(); } public function getData_SetSalesProduk_byMERK_byPRODUK($id1, $id2, $id3=null) { // Used $this->db->select('*'); $this->db->from('set_salesproduk'); $this->db->where('MERK_ID=', $id1); $this->db->where('PRODUK_ID=', $id2); if ($id3!=null) { $this->db->where('ID_SSP!=', $id3); } return $this->db->get()->result_array(); } public function getData_SetSalesProduk_bySALES($id) { // Used $this->db->select('*'); $this->db->from('set_salesproduk a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->join('produk c','c.ID_PRODUK=a.PRODUK_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.SALES_ID=', $id); $this->db->order_by('b.NAMA_MERK ASC'); return $this->db->get()->result_array(); } public function getData_SetSalesProduk_groupSALES() { // Used $this->db->select('*'); $this->db->from('set_salesproduk a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->group_by('a.SALES_ID'); $this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_SetStokGudang_byKARYAWAN($id) { // Used $this->db->select('*'); $this->db->from('set_stokgudang'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_SetSubToggle_byKARYAWAN_byMENU($id_karyawan, $menu) { // Used $this->db->select('*'); $this->db->from('set_subtoggle'); $this->db->where('KARYAWAN_ID=', $id_karyawan); $this->db->where('MENU_ID=', $menu); return $this->db->get()->result_array(); } public function getData_SetTema_byKARYAWAN($id) { // Used $this->db->select('*'); $this->db->from('set_tema'); $this->db->where(['KARYAWAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SetTertanda() { // Used $this->db->select('*'); $this->db->from('set_tertanda a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); return $this->db->get()->result_array(); } public function getData_SetTertanda_byMODE($mode) { // Used $this->db->select('*'); $this->db->from('set_tertanda a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where('a.MODE_STTD=', $mode); return $this->db->get()->result_array(); } public function getData_SetTimitp_byKARYAWAN($id) { // Used $this->db->select('*'); $this->db->from('set_timitp 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_SetToggleAs_byMERK_byPRODUK_bySTATUS($id_merk, $id_produk, $status) { // Used $this->db->select('*'); $this->db->from('set_toggleas a'); $this->db->join('set_salesproduk b','b.ID_SSP=a.SSP_ID'); $this->db->where('b.MERK_ID=', $id_merk); $this->db->where('b.PRODUK_ID=', $id_produk); $this->db->where('a.STATUS_STGAS=', $status); return $this->db->get()->result_array(); } public function getData_SetToggleAs_bySSP($id) { // Used $this->db->select('*'); $this->db->from('set_toggleas a'); $this->db->join('set_salesproduk b','b.ID_SSP=a.SSP_ID'); $this->db->where('a.SSP_ID=', $id); return $this->db->get()->result_array(); } public function getData_SetToggleKop_byKARYAWAN_byNAMA($id_karyawan, $nama) { // Used $this->db->select('*'); $this->db->from('set_togglekop'); $this->db->where('KARYAWAN_ID=', $id_karyawan); $this->db->where('NAMA_STK=', $nama); return $this->db->get()->result_array(); } public function getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $menu) { // Used $this->db->select('*'); $this->db->from('set_toggleposisi'); $this->db->where('KARYAWAN_ID=', $id_karyawan); $this->db->where('MENU_ID=', $menu); return $this->db->get()->result_array(); } public function getData_SetToggleSp_byKARYAWAN($id) { // Used $this->db->select('*'); $this->db->from('set_togglesp a'); $this->db->join('set_salesproduk b','b.ID_SSP=a.SSP_ID'); $this->db->join('merk c','c.ID_MERK=b.MERK_ID'); $this->db->join('produk d','d.ID_PRODUK=b.PRODUK_ID'); $this->db->where('a.KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_Sewa_byGUDANG_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sewa a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->where(['a.GUDANG_ID' => $id]); $this->db->where(['a.STATUS_SEWA' => $status]); return $this->db->get()->result_array(); } public function getData_Sewa_byID_byGUDANG_bySTATUS($id, $gudang, $status) { // Used $this->db->select('*'); $this->db->from('sewa a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->where(['a.ID_SEWA' => $id]); $this->db->where(['a.GUDANG_ID' => $gudang]); $this->db->where(['a.STATUS_SEWA' => $status]); return $this->db->get()->result_array(); } public function getData_Sewa_byPELANGGAN_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SEWA,"%d/%m/%Y") as TANGGAL'); $this->db->from('sewa a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID'); $this->db->where('a.PELANGGAN_ID=', $id); $this->db->where('a.STATUS_SEWA=', $status); return $this->db->get()->result_array(); } public function getData_Sewa_bySTATUS($status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_SEWA,"%d/%m/%Y") as TANGGAL'); $this->db->from('sewa a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where(['a.STATUS_SEWA' => $status]); return $this->db->get()->result_array(); } public function getData_Sewa_bySTATUS_groupPELANGGAN($status) { // Used $this->db->select('b.*'); $this->db->from('sewa a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.STATUS_SEWA=', $status); $this->db->group_by('a.PELANGGAN_ID'); $this->db->order_by('b.ALIAS_PELANGGAN ASC, b.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getData_SjPenjualan_bySTATUS_byTGL($id, $tgl) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SJPJ, "%d/%m/%Y") as TANGGAL'); $this->db->from('sj_penjualan a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('corp d','d.ID_CORP=a.CORP_ID'); $this->db->where('a.STATUS_SJPJ=', $id); $this->db->where('a.TGL_SJPJ>=', $tgl); return $this->db->get()->result_array(); } public function getData_SjService_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SJS, "%d/%m/%Y") as TANGGAL'); $this->db->from('sj_service a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.ID_SJS=', $id); return $this->db->get()->result_array(); } public function getData_SjService_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sj_service a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_SJS=', $id); $this->db->where('a.STATUS_SJS=', $status); return $this->db->get()->result_array(); } public function getData_SjService_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sj_service a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_SJS=', $status); return $this->db->get()->result_array(); } public function getData_SjService_byKARYAWAN_bySTATUS_byPERIODE_orderDESC($id, $status, $awal, $akhir) { // Used $this->db->select('*'); $this->db->from('sj_service a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_SJS=', $status); $this->db->where('a.TGL_SJS>=', $awal); $this->db->where('a.TGL_SJS<=', $akhir); $this->db->order_by('a.ID_SJS DESC'); return $this->db->get()->result_array(); } public function getData_SnAntik_bySA($id) { // Used $this->db->select('*'); $this->db->from('sn_antik'); $this->db->where('SA_ID=', $id); return $this->db->get()->result_array(); } public function getData_SnAntik_bySNSTOCK_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_SA,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_antik a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNA'); $this->db->join('stok_antik c','c.ID_SA=a.SA_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=c.GUDANG_ID'); $this->db->where('b.ID_SNSTOCK=', $id); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnBeli_byBARANG_byPEMBELIAN_bySTATUS_status0($barang, $pembelian, $status) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_SJBELI,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_beli a'); $this->db->join('daftar_beli b','b.ID_DB=a.DB_ID'); $this->db->join('pembelian c','c.ID_PEMBELIAN=b.PEMBELIAN_ID'); $this->db->join('sn_stock d','d.NAMA_SNSTOCK=a.NAMA_SNB'); $this->db->where('b.BARANG_ID=', $barang); $this->db->where('c.ID_PEMBELIAN=', $pembelian); $this->db->where('c.STATUS_PEMBELIAN=', $status); $this->db->where('d.STATUS_SNSTOCK=0'); $this->db->order_by('c.TGL_SJBELI ASC, a.NAMA_SNB ASC'); return $this->db->get()->result_array(); } public function getData_SnBeli_byDB($id) { // Used $this->db->select('*'); $this->db->from('sn_beli'); $this->db->where(['DB_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnBeli_byID($id) { // Used $this->db->select('*'); $this->db->from('sn_beli'); $this->db->where(['ID_SNB' => $id]); return $this->db->get()->result_array(); } public function getData_SnBeli_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_beli a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNB'); $this->db->where(['a.ID_SNB' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnBeli_byNAMA($id) { // Used $this->db->select('*'); $this->db->from('sn_beli a'); $this->db->join('daftar_beli b','b.ID_DB=a.DB_ID'); $this->db->join('pembelian c','c.ID_PEMBELIAN=b.PEMBELIAN_ID'); $this->db->where(['a.NAMA_SNB' => $id]); return $this->db->get()->result_array(); } public function getData_SnBeli_forStokAging($awalbeli, $akhirbeli, $id_barang, $id_corp=null, $id_merk=null, $id_produk=null) { // Used $this->db->select('a.NAMA_SNB'); $this->db->from('sn_beli a'); $this->db->join('daftar_beli b','b.ID_DB=a.DB_ID'); $this->db->join('pembelian c','c.ID_PEMBELIAN=b.PEMBELIAN_ID'); $this->db->join('barang d','d.ID_BARANG=b.BARANG_ID'); $this->db->where('c.STATUS_PEMBELIAN=1'); $this->db->where('c.TGL_INVBELI>=', $awalbeli); $this->db->where('c.TGL_INVBELI<=', $akhirbeli); $this->db->where(['b.BARANG_ID' => $id_barang]); if ($id_corp!=null) { $this->db->where(['c.CORP_ID' => $id_corp]); } if ($id_merk!=null) { $this->db->where(['d.MERK_ID' => $id_merk]); } if ($id_produk!=null) { $this->db->where(['d.PRODUK_ID' => $id_produk]); } return $this->db->get()->result_array(); } public function getData_SnIo_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_io a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNIO'); $this->db->where(['a.ID_SNIO' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnIo_byID_statusNull($id) { // Used $this->db->select('*'); $this->db->from('sn_io a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNIO'); $this->db->where(['a.ID_SNIO' => $id]); $this->db->where('b.STATUS_SNSTOCK is NULL'); return $this->db->get()->result_array(); } public function getData_SnIo_byIO($id) { // Used $this->db->select('*'); $this->db->from('sn_io'); $this->db->where(['IO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnIo_byNAMA_allJenis($id) { // Used $this->db->select('*'); $this->db->from('sn_io'); $this->db->where(['NAMA_SNIO' => $id]); return $this->db->get()->result_array(); } public function getData_SnIo_byNAMA_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('sn_io a'); $this->db->join('transaksi_stock b','b.ID_IO=a.IO_ID'); $this->db->where(['a.NAMA_SNIO' => $id]); $this->db->order_by('a.ID_SNIO DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnJual_byBARANG_byPENJUALAN_bySTATUS_status1($barang, $penjualan, $status) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_jual a'); $this->db->join('daftar_order b','b.ID_DO=a.DO_ID'); $this->db->join('penjualan c','c.SO_ID=b.SO_ID'); $this->db->join('sn_stock d','d.NAMA_SNSTOCK=a.NAMA_SNJ'); $this->db->where('b.BARANG_ID=', $barang); $this->db->where('c.ID_PENJUALAN=', $penjualan); $this->db->where('c.STATUS_PENJUALAN=', $status); $this->db->where('d.STATUS_SNSTOCK=1'); $this->db->order_by('c.TGL_PENJUALAN ASC, a.NAMA_SNJ ASC'); return $this->db->get()->result_array(); } public function getData_SnJual_byDO($id) { // Used $this->db->select('*'); $this->db->from('sn_jual'); $this->db->where(['DO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnJual_byDO_forBatalOtomasi($id) { // Used $this->db->select('*'); $this->db->from('sn_jual a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNJ'); $this->db->join('sn_klaimprogram c','c.SNSTOCK_ID=b.ID_SNSTOCK'); $this->db->where('c.STATUS_SNKPR=1'); $this->db->where(['a.DO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnJual_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_jual a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNJ'); $this->db->where(['a.ID_SNJ' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnJual_byNAMA_orderDESC_limit1($nama) { // Used $this->db->select('*'); $this->db->from('sn_jual a'); $this->db->join('daftar_order b','b.ID_DO=a.DO_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->where(['a.NAMA_SNJ' => $nama]); $this->db->order_by('a.ID_SNJ DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byBARANG_byDO_forOtomasiBooster($id1, $id2){ // Used $this->db->select('*'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('sn_stock c','c.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('sn_jual d','d.NAMA_SNJ=c.NAMA_SNSTOCK'); $this->db->where('b.BARANG_ID=', $id1); $this->db->where('d.DO_ID=', $id2); $this->db->where('b.STATUS_KPR=0'); $this->db->where('a.STATUS_SNKPR=0'); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byID($id){ // Used $this->db->select('*,FORMAT(b.HARGA_KPR,2) as HARGA'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('sn_stock c','c.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('barang d','d.ID_BARANG=c.BARANG_ID'); $this->db->where('a.ID_SNKPR=', $id); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byID_cetakNota($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_SALEOUT,"%d/%m/%Y") as TANGGAL,FORMAT(a.HARGA_SNKPR,2) as HARGA'); $this->db->from('sn_klaimprogram a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->where('a.ID_SNKPR=', $id); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byKPR($id){ // Used $this->db->select('*,FORMAT(b.HARGA_KPR,2) as HARGA'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('sn_stock c','c.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where('a.KPR_ID=', $id); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byKPR_orderSTATUS($id){ // Used $this->db->select('*,FORMAT(b.HARGA_KPR,2) as HARGA, b.BARANG_ID as BID, c.BARANG_ID as CID'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('sn_stock c','c.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where('a.KPR_ID=', $id); $this->db->order_by('a.STATUS_SNKPR ASC, a.NAMA_SNKPR ASC'); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byMERK_byPRODUK($id_merk, $id_produk){ // Used $this->db->select('*'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->join('merk d','d.ID_MERK=c.MERK_ID'); $this->db->join('produk e','e.ID_PRODUK=c.PRODUK_ID'); $this->db->where("c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND b.STATUS_KPR!=9"); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byMERK_byPRODUK_status1_notSaleOut($id_merk, $id_produk){ // Used $this->db->select('*, DATE_FORMAT(b.TGL_KPR,"%d/%m%/%Y") as TANGGAL'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->join('sn_stock d','d.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('supplier e','e.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->where("c.MERK_ID=$id_merk AND c.PRODUK_ID=$id_produk AND b.STATUS_KPR=0 AND d.STATUS_SNSTOCK=1 AND a.STATUS_SNKPR!=1 AND a.STATUS_SNKPR!=4"); $this->db->order_by('b.NOTA_KPR ASC, c.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byNAMA($id){ // Used $this->db->select('*'); $this->db->from('sn_klaimprogram'); $this->db->where('NAMA_SNKPR=', $id); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byPERIODE($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SALEOUT,"%d/%m/%Y") as TANGGAL, FORMAT(a.HARGA_SNKPR, 2) as HARGA'); $this->db->from('sn_klaimprogram a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PEL_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('sn_stock d','d.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('barang e','e.ID_BARANG=d.BARANG_ID'); $this->db->where('a.TGL_SALEOUT>=', $awal); $this->db->where('a.TGL_SALEOUT<=', $akhir); $this->db->order_by('a.NOTA_SNKPR DESC'); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_byPERIODE_cetakNull($awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SALEOUT,"%d/%m/%Y") as TANGGAL, FORMAT(a.HARGA_SNKPR, 2) as HARGA'); $this->db->from('sn_klaimprogram a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PEL_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('sn_stock d','d.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('barang e','e.ID_BARANG=d.BARANG_ID'); $this->db->where('a.TGL_SALEOUT>=', $awal); $this->db->where('a.TGL_SALEOUT<=', $akhir); $this->db->where('a.CETAK_SNKPR is NULL'); $this->db->order_by('a.NOTA_SNKPR DESC'); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_bySEARCH_limit20($search=null) { // Used $this->db->select('*'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('barang e','e.ID_BARANG=b.BARANG_ID'); if ($search!=null) { $this->db->where("a.NAMA_SNKPR LIKE '%$search%'"); $this->db->or_where("b.NOTA_KPR LIKE '%$search%'"); $this->db->or_where("c.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("d.NAMA_KOTA LIKE '%$search%'"); $this->db->or_where("e.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("e.NAMA_BARANG LIKE '%$search%'"); } $this->db->order_by('a.NAMA_SNKPR DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_bySNSTOCK($id) { // Used $this->db->select('*'); $this->db->from('sn_klaimprogram'); $this->db->where('SNSTOCK_ID=', $id); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_bySUPPLIER_byJENIS_byMERK_byPRODUK_bySTATUS($id_supplier=null, $id_jenis=null, $id_merk=null, $id_produk=null, $status_snkpr=null, $jenis_barang=null, $jenis_laporan=null) { // Used $this->db->select('*,FORMAT(b.HARGA_KPR,2) as HARGAAWAL,COUNT(a.ID_SNKPR) as TOTAL'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->join('supplier e','e.ID_SUPPLIER=b.SUPPLIER_ID'); if ($id_supplier!=null) { $this->db->where('b.SUPPLIER_ID=', $id_supplier); } if ($id_jenis!=null) { $this->db->where('c.JENIS_ID=', $id_jenis); } if ($id_merk!=null) { $this->db->where('c.MERK_ID=', $id_merk); } if ($id_produk!=null) { $this->db->where('c.PRODUK_ID=', $id_produk); } if ($status_snkpr==8) { } else { $this->db->where('a.STATUS_SNKPR=', $status_snkpr); } if ($jenis_laporan==1) { $this->db->group_by('b.BARANG_ID'); if ($jenis_barang==1) { $this->db->order_by('c.KODE_BARANG ASC'); } else if ($jenis_barang==2) { $this->db->order_by('d.NAMA_JENIS ASC, c.KODE_BARANG ASC'); } } else if ($jenis_laporan==2 OR $jenis_laporan==3) { $this->db->group_by('b.BARANG_ID, a.ID_SNKPR'); $this->db->order_by('c.KODE_BARANG ASC, a.NAMA_SNKPR ASC'); } return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_not123($id){ // Used $this->db->select('*,FORMAT(b.HARGA_KPR,2) as HARGA'); $this->db->from('sn_klaimprogram a'); $this->db->join('klaim_program b','b.ID_KPR=a.KPR_ID'); $this->db->join('sn_stock c','c.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->join('barang d','d.ID_BARANG=c.BARANG_ID'); $this->db->where('a.ID_SNKPR=', $id); $this->db->where('a.STATUS_SNKPR!=1 AND a.STATUS_SNKPR!=2 AND a.STATUS_SNKPR!=3'); return $this->db->get()->result_array(); } public function getData_SnKonsi_byBARANG_byPELANGGAN_byJENIS_bySTATUS_statusNull($barang, $pelanggan, $jenis, $status) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_konsi a'); $this->db->join('daftar_konsi b','b.ID_DFK=a.DFK_ID'); $this->db->join('konsinyasi c','c.ID_KONSINYASI=b.KONSINYASI_ID'); $this->db->where('b.BARANG_ID=', $barang); $this->db->where('c.PELANGGAN_ID=', $pelanggan); $this->db->where('c.JENIS_KONSINYASI=', $jenis); $this->db->where('c.STATUS_KONSINYASI=', $status); $this->db->where('a.STATUS_SNK is NULL'); $this->db->order_by('c.TGL_KONSINYASI ASC, a.NAMA_SNK ASC'); return $this->db->get()->result_array(); } public function getData_SnKonsi_byBARANG_byPK($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_konsi a'); $this->db->join('daftar_konsi b','b.ID_DFK=a.DFK_ID'); $this->db->where(['b.BARANG_ID' => $id1]); $this->db->where(['a.PK_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_SnKonsi_byDFK($id) { // Used $this->db->select('*'); $this->db->from('sn_konsi'); $this->db->where(['DFK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnKonsi_byDFK_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_konsi'); $this->db->where(['DFK_ID' => $id]); $this->db->where(['STATUS_SNK' => $status]); return $this->db->get()->result_array(); } public function getData_SnKonsi_byDFK_statusNull($id) { // Used $this->db->select('*'); $this->db->from('sn_konsi'); $this->db->where('STATUS_SNK is NULL'); $this->db->where(['DFK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnKonsi_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_konsi a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNK'); $this->db->where(['a.ID_SNK' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnKonsi_byID_pkNull_statusNull($id) { // Used $this->db->select('*'); $this->db->from('sn_konsi'); $this->db->where('ID_SNK=', $id); $this->db->where('PK_ID is NULL'); $this->db->where('STATUS_SNK is NULL'); return $this->db->get()->result_array(); } public function getData_SnKonsi_byNAMA_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('sn_konsi a'); $this->db->join('daftar_konsi b','b.ID_DFK=a.DFK_ID'); $this->db->join('konsinyasi c','c.ID_KONSINYASI=b.KONSINYASI_ID'); $this->db->where(['a.NAMA_SNK' => $id]); $this->db->order_by('a.ID_SNK DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnKonsi_byPK_byBARANG_bySTATUS($id1, $id2, $status) { // Used $this->db->select('*'); $this->db->from('sn_konsi a'); $this->db->join('penarikan_konsi b','b.ID_PK=a.PK_ID'); $this->db->join('daftar_konsi c','c.ID_DFK=a.DFK_ID'); $this->db->where('a.PK_ID=', $id1); $this->db->where('c.BARANG_ID=', $id2); $this->db->where('a.STATUS_SNK=', $status); return $this->db->get()->result_array(); } public function getData_SnKonsi_bySNSTOCK_pkNull_orderDESC_limit1($id) { // Used $this->db->select('*,DATE_FORMAT(d.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_konsi a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNK'); $this->db->join('daftar_konsi c','c.ID_DFK=a.DFK_ID'); $this->db->join('konsinyasi d','d.ID_KONSINYASI=c.KONSINYASI_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=d.SALES_ID'); $this->db->join('pelanggan f','f.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->where('b.ID_SNSTOCK=', $id); $this->db->where('a.PK_ID is NULL'); $this->db->order_by('a.ID_SNK DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnKonsi_bySNSTOCK_statusNull($id) { // Used $this->db->select('*,DATE_FORMAT(d.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_konsi a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNK'); $this->db->join('daftar_konsi c','c.ID_DFK=a.DFK_ID'); $this->db->join('konsinyasi d','d.ID_KONSINYASI=c.KONSINYASI_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->where('b.ID_SNSTOCK=', $id); $this->db->where('a.STATUS_SNK is NULL'); return $this->db->get()->result_array(); } public function getData_SnModifikasi_byID($id) { // Used $this->db->select('*'); $this->db->from('sn_modifikasi'); $this->db->where(['ID_SNMD' => $id]); return $this->db->get()->result_array(); } public function getData_SnModifikasi_byMODIFIKASI_byJENIS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_modifikasi'); $this->db->where('MODIFIKASI_ID=', $id1); $this->db->where('JENIS_SNMD=', $id2); return $this->db->get()->result_array(); } public function getData_SnMutasiBarang_byDMB($id) { // Used $this->db->select('*'); $this->db->from('sn_mutasibarang'); $this->db->where(['DMB_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnMutasiBarang_byDMB_byMB($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_mutasibarang'); $this->db->where(['DMB_ID' => $id1]); $this->db->where(['MB_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_SnMutasiBarang_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_mutasibarang a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNMB'); $this->db->where(['a.ID_SNMB' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnMutasiBarang_byNAMA_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('sn_mutasibarang a'); $this->db->join('mutasi_barang b','b.ID_MB=a.MB_ID'); $this->db->where(['a.NAMA_SNMB' => $id]); $this->db->order_by('a.ID_SNMB DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnMutasiBarang_bySNSTOCK_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(d.TGL_MB,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_mutasibarang a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNMB'); $this->db->join('daftar_mutasibarang c','c.ID_DMB=a.DMB_ID'); $this->db->join('mutasi_barang d','d.ID_MB=c.MB_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=d.ADMIN_ID'); $this->db->where('b.ID_SNSTOCK=', $id); $this->db->where('d.STATUS_MB=', $status); return $this->db->get()->result_array(); } public function getData_SnMutasiBarang_bySNSTOCK_orderDESC_limit1($id) { // Used $this->db->select('*,DATE_FORMAT(d.TGL_MB,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_mutasibarang a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNMB'); $this->db->join('daftar_mutasibarang c','c.ID_DMB=a.DMB_ID'); $this->db->join('mutasi_barang d','d.ID_MB=c.MB_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=d.ADMIN_ID','left'); $this->db->where('b.ID_SNSTOCK=', $id); $this->db->order_by('a.ID_SNMB DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnOpname_byDOP_bySNSTOCK_bySTATUS($id1, $id2, $status) { // Used $this->db->select('*'); $this->db->from('sn_opname a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where(['a.DOP_ID' => $id1]); $this->db->where(['a.SNSTOCK_ID' => $id2]); $this->db->where(['a.STATUS_SOP' => $status]); return $this->db->get()->result_array(); } public function getData_SnOpname_byDOP_bySNSTOCK_statusNot2($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_opname a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where(['a.DOP_ID' => $id1]); $this->db->where(['a.SNSTOCK_ID' => $id2]); $this->db->where('a.STATUS_SOP!=2'); return $this->db->get()->result_array(); } public function getData_SnOpname_byDOP_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_opname a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where(['a.DOP_ID' => $id]); $this->db->where(['a.STATUS_SOP' => $status]); return $this->db->get()->result_array(); } public function getData_SnOpname_byDOP_statusNot2($id) { // Used $this->db->select('*'); $this->db->from('sn_opname a'); $this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID'); $this->db->where(['a.DOP_ID' => $id]); $this->db->where('a.STATUS_SOP!=2'); return $this->db->get()->result_array(); } public function getData_SnPinjam_byDFP($id) { // Used $this->db->select('*'); $this->db->from('sn_pinjam'); $this->db->where(['DFP_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnPinjam_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_pinjam a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNP'); $this->db->where(['a.ID_SNP' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnPinjam_byNAMA_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('sn_pinjam a'); $this->db->join('daftar_pinjam b','b.ID_DFP=a.DFP_ID'); $this->db->join('peminjaman c','c.ID_PEMINJAMAN=b.PEMINJAMAN_ID'); $this->db->where(['a.NAMA_SNP' => $id]); $this->db->order_by('a.ID_SNP DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnPinjam_bySNSTOCK_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(d.TGL_PEMINJAMAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_pinjam a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNP'); $this->db->join('daftar_pinjam c','c.ID_DFP=a.DFP_ID'); $this->db->join('peminjaman d','d.ID_PEMINJAMAN=c.PEMINJAMAN_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=d.PEMINJAM_ID','left'); $this->db->join('pelanggan f','f.ID_PELANGGAN=d.PELANGGAN_ID','left'); $this->db->where('b.ID_SNSTOCK=', $id); $this->db->where('d.STATUS_PEMINJAMAN=', $status); return $this->db->get()->result_array(); } public function getData_SnProyek_byBARANG_byPROYEK($barang, $proyek) { // Used $this->db->select('*'); $this->db->from('sn_proyek a'); $this->db->join('daftar_proyek b','b.ID_DPR=a.DPR_ID'); $this->db->join('proyek c','c.ID_PROYEK=b.PROYEK_ID'); $this->db->join('sn_stock d','d.NAMA_SNSTOCK=a.NAMA_SNPR'); $this->db->where(['b.BARANG_ID' => $barang]); $this->db->where(['b.PROYEK_ID' => $proyek]); return $this->db->get()->result_array(); } public function getData_SnProyek_byBARANG_byPROYEK_status9_groupNAMASNPR($barang, $proyek) { // Used $this->db->select('*'); $this->db->from('sn_proyek a'); $this->db->join('daftar_proyek b','b.ID_DPR=a.DPR_ID'); $this->db->join('proyek c','c.ID_PROYEK=b.PROYEK_ID'); $this->db->join('sn_stock d','d.NAMA_SNSTOCK=a.NAMA_SNPR'); $this->db->where(['b.BARANG_ID' => $barang]); $this->db->where(['b.PROYEK_ID' => $proyek]); $this->db->where('d.STATUS_SNSTOCK=9'); $this->db->group_by('a.NAMA_SNPR'); return $this->db->get()->result_array(); } public function getData_SnProyek_byDPR($id) { // Used $this->db->select('*'); $this->db->from('sn_proyek'); $this->db->where(['DPR_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnProyek_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_proyek a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNPR'); $this->db->where(['a.ID_SNPR' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnProyek_bySNSTOCK_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(f.TGL_CD,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_proyek a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNPR'); $this->db->join('daftar_proyek c','c.ID_DPR=a.DPR_ID'); $this->db->join('proyek d','d.ID_PROYEK=c.PROYEK_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('cetak_dokumen f','f.ID_CD=c.CD_ID'); $this->db->where('b.ID_SNSTOCK=', $id); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnReturBeli_byDRB_byRB($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_returbeli'); $this->db->where(['DRB_ID' => $id1]); $this->db->where(['RB_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_SnReturBeli_byDRB($id) { // Used $this->db->select('*'); $this->db->from('sn_returbeli'); $this->db->where(['DRB_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnReturBeli_byID_12($id) { // Used $this->db->select('*'); $this->db->from('sn_returbeli a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNRB'); $this->db->where(['a.ID_SNRB' => $id]); $this->db->where('b.STATUS_SNSTOCK=12'); return $this->db->get()->result_array(); } public function getData_SnReturBeli_byNAMA_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('sn_returbeli a'); $this->db->join('retur_pembelian b','b.ID_RB=a.RB_ID'); $this->db->where(['a.NAMA_SNRB' => $id]); $this->db->order_by('a.ID_SNRB DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnReturJual_byDRJ($id) { // Used $this->db->select('*'); $this->db->from('sn_returjual'); $this->db->where(['DRJ_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnReturJual_byDRJ_byRJ($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_returjual'); $this->db->where(['DRJ_ID' => $id1]); $this->db->where(['RJ_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_SnReturJual_byID_11($id) { // Used $this->db->select('*'); $this->db->from('sn_returjual a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNRJ'); $this->db->where(['a.ID_SNRJ' => $id]); $this->db->where('b.STATUS_SNSTOCK=11'); return $this->db->get()->result_array(); } public function getData_SnReturJual_byNAMA($id) { // Used $this->db->select('*'); $this->db->from('sn_returjual'); $this->db->where(['NAMA_SNRJ' => $id]); return $this->db->get()->result_array(); } public function getData_SnReturJual_byNAMA_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('sn_returjual a'); $this->db->join('retur_penjualan b','b.ID_RJ=a.RJ_ID'); $this->db->where(['a.NAMA_SNRJ' => $id]); $this->db->order_by('a.ID_SNRJ DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnService_byBARANG_byJENIS_bySTATUS_statusNull($barang, $jenis, $status) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_service a'); $this->db->join('daftar_service b','b.ID_DFS=a.DFS_ID'); $this->db->join('service c','c.ID_SERVICE=b.SERVICE_ID'); $this->db->where('b.BARANG_ID=', $barang); $this->db->where('c.JENIS_SERVICE=', $jenis); $this->db->where('c.STATUS_SERVICE=', $status); $this->db->where('a.STATUS_SNS is NULL'); $this->db->order_by('c.TGL_SERVICE ASC, a.NAMA_SNS ASC'); return $this->db->get()->result_array(); } public function getData_SnService_byBARANG_byPSV($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('daftar_service b','b.ID_DFS=a.DFS_ID'); $this->db->where(['b.BARANG_ID' => $id1]); $this->db->where(['a.PSV_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_SnService_byBARANG_byPSV_bySTATUS($id1, $id2, $status) { // Used $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('penarikan_service b','b.ID_PSV=a.PSV_ID'); $this->db->join('daftar_service c','c.ID_DFS=a.DFS_ID'); $this->db->where('c.BARANG_ID=', $id1); $this->db->where('a.PSV_ID=', $id2); $this->db->where('a.STATUS_SNS=', $status); return $this->db->get()->result_array(); } public function getData_SnService_byDFS($id) { // Used $this->db->select('*'); $this->db->from('sn_service'); $this->db->where(['DFS_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnService_byDFS_statusNull($id) { // Used $this->db->select('*'); $this->db->from('sn_service'); $this->db->where('STATUS_SNS is NULL'); $this->db->where(['DFS_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnService_byID($id) { // Used $this->db->select('*, DATE_FORMAT(b.TGL_SERVICE,"%d/%m/%Y") as TANGGAL, c.NAMA_PANGGILAN_KARYAWAN as PEMBUAT'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=b.PEMBUAT_ID'); $this->db->join('unitservice d','d.ID_UNITSERVICE=a.UNITSERVICE_ID','left'); $this->db->join('pelanggan e','e.ID_PELANGGAN=b.PELANGGAN_ID','left'); $this->db->where(['a.ID_SNS' => $id]); return $this->db->get()->result_array(); } public function getData_SnService_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNS'); $this->db->where(['a.ID_SNS' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnService_byID_selesaiNotNull_psvNull_statusNull($id) { // Used $this->db->select('*'); $this->db->from('sn_service'); $this->db->where('ID_SNS=', $id); $this->db->where('SELESAI_SNS is NOT NULL'); $this->db->where('PSV_ID is NULL'); $this->db->where('STATUS_SNS is NULL'); return $this->db->get()->result_array(); } public function getData_SnService_byID_statusNull($id) { // Used $this->db->select('*'); $this->db->from('sn_service'); $this->db->where(['ID_SNS' => $id]); $this->db->where('STATUS_SNS is NULL'); return $this->db->get()->result_array(); } public function getData_SnService_byJENIS_selesaiNotNull_psvNull($id=null) { // Used $this->db->select('*, DATE_FORMAT(e.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_service a'); $this->db->join('daftar_service b','b.ID_DFS=a.DFS_ID'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->join('service e','e.ID_SERVICE=b.SERVICE_ID'); if ($id!=null) { $this->db->where('e.JENIS_SERVICE=', $id); } $this->db->where('a.SELESAI_SNS is NOT NULL'); $this->db->where('a.PSV_ID is NULL'); $this->db->order_by('a.ID_SNS ASC'); return $this->db->get()->result_array(); } public function getData_SnService_byNAMA_orderDESC($id) { // Used $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('unitservice d','d.ID_UNITSERVICE=a.UNITSERVICE_ID'); $this->db->join('biaya_service e','e.ID_BS=b.PAKET_SERVICE'); $this->db->where(['a.NAMA_SNS' => $id]); $this->db->order_by('a.ID_SNS DESC'); return $this->db->get()->result_array(); } public function getData_SnService_byNAMA_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('daftar_service b','b.ID_DFS=a.DFS_ID'); $this->db->join('service c','c.ID_SERVICE=b.SERVICE_ID'); $this->db->where(['a.NAMA_SNS' => $id]); $this->db->order_by('a.ID_SNS DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnService_byPELANGGAN_joinDfsjs($id) { // Used $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('unitservice d','d.ID_UNITSERVICE=a.UNITSERVICE_ID'); $this->db->join('daftar_sjservice e','e.SNS_ID=a.ID_SNS','left'); $this->db->where(['b.PELANGGAN_ID' => $id]); $this->db->where('e.SNS_ID is NULL'); return $this->db->get()->result_array(); } public function getData_SnService_byPSV_byBARANG_bySTATUS($id1, $id2, $status) { // Used $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('penarikan_service b','b.ID_PSV=a.PSV_ID'); $this->db->join('daftar_service c','c.ID_DFS=a.DFS_ID'); $this->db->where('a.PSV_ID=', $id1); $this->db->where('c.BARANG_ID=', $id2); $this->db->where('a.STATUS_SNS=', $status); return $this->db->get()->result_array(); } public function getData_SnService_bySEARCH_status1_limit20($search=null) { // Used $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('unitservice d','d.ID_UNITSERVICE=a.UNITSERVICE_ID'); if ($search!=null) { $this->db->where("a.NAMA_SNS LIKE '%$search%'"); $this->db->or_where("b.KODE_SERVICE LIKE '%$search%'"); $this->db->or_where("c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("d.NAMA_UNITSERVICE LIKE '%$search%'"); } $this->db->order_by('b.KODE_SERVICE DESC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_SnService_bySERVICE($id) { // Used $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('unitservice b','b.ID_UNITSERVICE=a.UNITSERVICE_ID','left'); $this->db->join('daftar_service c','c.ID_DFS=a.DFS_ID','left'); $this->db->join('barang d','d.ID_BARANG=c.BARANG_ID','left'); $this->db->where(['a.SERVICE_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnService_bySNSTOCK_orderDESC_limit1($id) { // Used $this->db->select('*,DATE_FORMAT(d.TGL_SERVICE,"%d/%m/%Y") as TANGGAL, e.NAMA_PANGGILAN_KARYAWAN as PENERIMA'); $this->db->from('sn_service a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNS'); $this->db->join('daftar_service c','c.ID_DFS=a.DFS_ID'); $this->db->join('service d','d.ID_SERVICE=c.SERVICE_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=d.PEMBUAT_ID'); $this->db->where('b.ID_SNSTOCK=', $id); $this->db->order_by('a.ID_SNS DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SjService_bySTATUS_byPERIODE_orderDESC($status, $awal, $akhir) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SJS,"%d/%m/%Y") as TANGGAL'); $this->db->from('sj_service a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.STATUS_SJS=', $status); $this->db->where('a.TGL_SJS>=', $awal); $this->db->where('a.TGL_SJS<=', $akhir); $this->db->order_by('a.ID_SJS DESC'); return $this->db->get()->result_array(); } public function getData_SnService_statusNull_externalOnly() { // Used $this->db->select('*, DATE_FORMAT(b.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('unitservice d','d.ID_UNITSERVICE=a.UNITSERVICE_ID'); $this->db->where('a.STATUS_SNS is NULL'); $this->db->where('a.SELESAI_SNS is NULL'); return $this->db->get()->result_array(); } public function getData_SnService_statusNull_internalOnly() { // Used $this->db->select('*, DATE_FORMAT(b.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->join('daftar_service c','c.ID_DFS=a.DFS_ID'); $this->db->join('barang d','d.ID_BARANG=c.BARANG_ID'); $this->db->where('a.STATUS_SNS is NULL'); $this->db->where('b.PELANGGAN_ID is NULL'); $this->db->where('a.SELESAI_SNS is NULL'); return $this->db->get()->result_array(); } public function getData_SnService_statusNull_selesaiNull() { // Used $this->db->select('*, DATE_FORMAT(b.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID','left'); $this->db->join('unitservice d','d.ID_UNITSERVICE=a.UNITSERVICE_ID','left'); $this->db->join('daftar_service e','e.ID_DFS=a.DFS_ID','left'); $this->db->join('barang f','f.ID_BARANG=e.BARANG_ID','left'); $this->db->join('karyawan g','g.ID_KARYAWAN=b.PEMBUAT_ID','left'); $this->db->join('biaya_service h','h.ID_BS=b.PAKET_SERVICE','left'); $this->db->where('a.STATUS_SNS is NULL'); $this->db->where('a.SELESAI_SNS is NULL'); return $this->db->get()->result_array(); } public function getData_SnService_status1_externalOnly() { // Used $this->db->select('*, DATE_FORMAT(b.TGL_SERVICE,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->join('unitservice d','d.ID_UNITSERVICE=a.UNITSERVICE_ID'); $this->db->where('a.STATUS_SNS=1'); $this->db->order_by('a.ID_SNS DESC'); $this->db->limit('300'); return $this->db->get()->result_array(); } public function getData_SnSewa_byBARANG_byPELANGGAN_bySTATUS_statusNull($barang, $pelanggan, $status) { // Used $this->db->select('*,DATE_FORMAT(c.TGL_SEWA,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_sewa a'); $this->db->join('daftar_sewa b','b.ID_DFSW=a.DFSW_ID'); $this->db->join('sewa c','c.ID_SEWA=b.SEWA_ID'); $this->db->where('b.BARANG_ID=', $barang); $this->db->where('c.PELANGGAN_ID=', $pelanggan); $this->db->where('c.STATUS_SEWA=', $status); $this->db->where('a.STATUS_SNSW is NULL'); $this->db->order_by('c.TGL_SEWA ASC, a.NAMA_SNSW ASC'); return $this->db->get()->result_array(); } public function getData_SnSewa_byBARANG_byPS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_sewa a'); $this->db->join('daftar_sewa b','b.ID_DFSW=a.DFSW_ID'); $this->db->where(['b.BARANG_ID' => $id1]); $this->db->where(['a.PS_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_SnSewa_byBARANG_byPS_bySTATUS($id1, $id2, $status) { // Used $this->db->select('*'); $this->db->from('sn_sewa a'); $this->db->join('penarikan_sewa b','b.ID_PS=a.PS_ID'); $this->db->join('daftar_sewa c','c.ID_DFSW=a.DFSW_ID'); $this->db->where('c.BARANG_ID=', $id1); $this->db->where('a.PS_ID=', $id2); $this->db->where('a.STATUS_SNSW=', $status); return $this->db->get()->result_array(); } public function getData_SnSewa_byDFSW($id) { // Used $this->db->select('*'); $this->db->from('sn_sewa'); $this->db->where(['DFSW_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnSewa_byDFSW_statusNull($id) { // Used $this->db->select('*'); $this->db->from('sn_sewa'); $this->db->where('STATUS_SNSW is NULL'); $this->db->where(['DFSW_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnSewa_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_sewa a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNSW'); $this->db->where(['a.ID_SNSW' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnSewa_byID_psNull_statusNull($id) { // Used $this->db->select('*'); $this->db->from('sn_sewa'); $this->db->where('ID_SNSW=', $id); $this->db->where('PS_ID is NULL'); $this->db->where('STATUS_SNSW is NULL'); return $this->db->get()->result_array(); } public function getData_SnSewa_byNAMA_orderDESC_limit1($id) { // Used $this->db->select('*'); $this->db->from('sn_sewa a'); $this->db->join('daftar_sewa b','b.ID_DFSW=a.DFSW_ID'); $this->db->join('sewa c','c.ID_SEWA=b.SEWA_ID'); $this->db->where(['a.NAMA_SNSW' => $id]); $this->db->order_by('a.ID_SNSW DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_SnSewa_byPS_byBARANG_bySTATUS($id1, $id2, $status) { // Used $this->db->select('*'); $this->db->from('sn_sewa a'); $this->db->join('penarikan_sewa b','b.ID_PS=a.PS_ID'); $this->db->join('daftar_sewa c','c.ID_DFSW=a.DFSW_ID'); $this->db->where('a.PS_ID=', $id1); $this->db->where('c.BARANG_ID=', $id2); $this->db->where('a.STATUS_SNSW=', $status); return $this->db->get()->result_array(); } public function getData_SnSewa_bySNSTOCK_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(d.TGL_SEWA,"%d/%m/%Y") as TANGGAL'); $this->db->from('sn_sewa a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNSW'); $this->db->join('daftar_sewa c','c.ID_DFSW=a.DFSW_ID'); $this->db->join('sewa d','d.ID_SEWA=c.SEWA_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->where('b.ID_SNSTOCK=', $id); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnSjParsial_byDO($id) { // Used $this->db->select('*'); $this->db->from('sn_sjparsial a'); $this->db->join('daftar_sjparsial b','b.ID_SJP=a.SJP_ID'); $this->db->where(['b.DO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnSjParsial_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_sjparsial a'); $this->db->join('sn_stock b','b.NAMA_SNSTOCK=a.NAMA_SNSJ'); $this->db->where(['a.ID_SNSJ' => $id]); $this->db->where('b.STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnSjParsial_bySJP($id) { // Used $this->db->select('*'); $this->db->from('sn_sjparsial'); $this->db->where(['SJP_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnStock_byBARANG_bySTATUS_joinSnkpr($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('sn_klaimprogram b','b.SNSTOCK_ID=a.ID_SNSTOCK','left'); $this->db->where(['a.BARANG_ID' => $id1]); $this->db->where(['a.STATUS_SNSTOCK' => $id2]); $this->db->where('b.ID_SNKPR is NULL'); return $this->db->get()->result_array(); } public function getData_SnStock_byBARANG_byGUDANG_bySTATUS($id1, $id2, $id3) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('status_sn b','b.ID_SSN=a.STATUS_SNSTOCK'); $this->db->where(['a.BARANG_ID' => $id1]); $this->db->where(['a.GUDANG_SNSTOCK' => $id2]); $this->db->where(['a.STATUS_SNSTOCK' => $id3]); $this->db->order_by('a.NAMA_SNSTOCK ASC'); return $this->db->get()->result_array(); } public function getData_SnStock_byBARANG_byGUDANG_bySTATUS_forModifikasiAsal($id1, $id2, $id3) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('sn_modifikasi b','b.NAMA_SNMD=a.NAMA_SNSTOCK','left'); $this->db->where(['a.BARANG_ID' => $id1]); $this->db->where(['a.GUDANG_SNSTOCK' => $id2]); $this->db->where(['a.STATUS_SNSTOCK' => $id3]); $this->db->where('b.ID_SNMD is NULL'); $this->db->order_by('a.NAMA_SNSTOCK ASC'); return $this->db->get()->result_array(); } public function getData_SnStock_byBARANG_bySTATUS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('status_sn b','b.ID_SSN=a.STATUS_SNSTOCK'); $this->db->where(['a.BARANG_ID' => $id1]); $this->db->where('a.STATUS_SNSTOCK=', $id2); $this->db->order_by('a.NAMA_SNSTOCK ASC'); return $this->db->get()->result_array(); } public function getData_SnStock_byBARANG_bySUPPLIER_byMERK_byPRODUK_Not1_Not2_Not3_Not4($id_barang, $id_supplier, $id_merk=null, $id_produk=null) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sn_beli d','d.NAMA_SNB=a.NAMA_SNSTOCK'); $this->db->join('daftar_beli e','e.ID_DB=d.DB_ID'); $this->db->join('pembelian f','f.ID_PEMBELIAN=e.PEMBELIAN_ID'); if ($id_merk==NULL AND $id_produk==NULL) { $this->db->where("a.BARANG_ID=$id_barang AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("a.BARANG_ID=$id_barang AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk!=NULL AND $id_produk==NULL) { $this->db->where("b.MERK_ID=$id_merk AND a.BARANG_ID=$id_barang AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.MERK_ID=$id_merk AND a.BARANG_ID=$id_barang AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk==NULL AND $id_produk!=NULL) { $this->db->where("b.PRODUK_ID=$id_produk AND a.BARANG_ID=$id_barang AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.PRODUK_ID=$id_produk AND a.BARANG_ID=$id_barang AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk!=NULL AND $id_produk!=NULL) { $this->db->where("b.MERK_ID=$id_merk AND b.PRODUK_ID=$id_produk AND a.BARANG_ID=$id_barang AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.MERK_ID=$id_merk AND b.PRODUK_ID=$id_produk AND a.BARANG_ID=$id_barang AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } $this->db->order_by('a.NAMA_SNSTOCK ASC'); return $this->db->get()->result_array(); } public function getData_SnStock_byBARANG_groupSTATUS_forListSNReady($id, $status=null) { // Used $this->db->select('*,COUNT(a.ID_SNSTOCK) as TOTSN'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('status_sn c','c.ID_SSN=a.STATUS_SNSTOCK'); $this->db->where('a.BARANG_ID=', $id); if ($status!=null) { $this->db->where('a.STATUS_SNSTOCK=', $status); } $this->db->group_by('a.STATUS_SNSTOCK'); $this->db->order_by('c.ID_SSN ASC'); return $this->db->get()->result_array(); } public function getData_SnStock_byGUDANG_bySTATUS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('a.GUDANG_SNSTOCK=', $id1); $this->db->where('a.STATUS_SNSTOCK=', $id2); $this->db->order_by('b.KODE_BARANG ASC, a.NAMA_SNSTOCK ASC'); return $this->db->get()->result_array(); } public function getData_SnStock_byID($id) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.ID_SNSTOCK' => $id]); return $this->db->get()->result_array(); } public function getData_SnStock_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('sn_stock'); $this->db->where(['ID_SNSTOCK' => $id]); $this->db->where(['STATUS_SNSTOCK' => $status]); return $this->db->get()->result_array(); } public function getData_SnStock_byMODE_bySEARCH_allStatus_limit20($mode, $search=null) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('status_sn c','c.ID_SSN=a.STATUS_SNSTOCK'); if ($search!=null) { if ($mode==1) { $this->db->where("a.STATUS_SNSTOCK=0 AND a.GUDANG_SNSTOCK<=2 AND a.NAMA_SNSTOCK LIKE '%$search%'"); $this->db->or_where("a.STATUS_SNSTOCK=0 AND a.GUDANG_SNSTOCK<=2 AND b.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_SNSTOCK=0 AND a.GUDANG_SNSTOCK<=2 AND b.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_SNSTOCK=0 AND a.GUDANG_SNSTOCK<=2 AND c.NAMA_SSN LIKE '%$search%'"); $this->db->or_where("a.STATUS_SNSTOCK=10 AND a.GUDANG_SNSTOCK<=2 AND a.NAMA_SNSTOCK LIKE '%$search%'"); $this->db->or_where("a.STATUS_SNSTOCK=10 AND a.GUDANG_SNSTOCK<=2 AND b.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_SNSTOCK=10 AND a.GUDANG_SNSTOCK<=2 AND b.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_SNSTOCK=10 AND a.GUDANG_SNSTOCK<=2 AND c.NAMA_SSN LIKE '%$search%'"); } } else { if ($mode==1) { $this->db->where("a.STATUS_SNSTOCK=0 AND a.GUDANG_SNSTOCK<=2"); $this->db->or_where("a.STATUS_SNSTOCK=10 AND a.GUDANG_SNSTOCK<=2"); $this->db->order_by('a.NAMA_SNSTOCK DESC'); } } $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_SnStock_byNAMA_allStatus($id) { // Used $this->db->select('*'); $this->db->from('sn_stock'); $this->db->where(['NAMA_SNSTOCK' => $id]); return $this->db->get()->result_array(); } public function getData_SnStock_byNAMA_bySTATUS($nama, $status) { // Used $this->db->select('*'); $this->db->from('sn_stock'); $this->db->where(['NAMA_SNSTOCK' => $nama]); $this->db->where('STATUS_SNSTOCK=', $status); return $this->db->get()->result_array(); } public function getData_SnStock_byNAMA_statusNull($id) { // Used $this->db->select('ID_SNSTOCK'); $this->db->from('sn_stock'); $this->db->where(['NAMA_SNSTOCK' => $id]); $this->db->where('STATUS_SNSTOCK is NULL'); return $this->db->get()->result_array(); } public function getData_SnStock_bySEARCH_allStatus_limit20($search=null) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('status_sn c','c.ID_SSN=a.STATUS_SNSTOCK'); if ($search!=null) { $this->db->where("a.NAMA_SNSTOCK LIKE '%$search%'"); $this->db->or_where("b.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("b.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("c.NAMA_SSN LIKE '%$search%'"); } $this->db->order_by('a.NAMA_SNSTOCK DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_SnStock_bySTATUS_joinSNB($id) { // Used $this->db->select('*'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('sn_beli c','c.NAMA_SNB=a.NAMA_SNSTOCK'); $this->db->where('a.STATUS_SNSTOCK=', $id); $this->db->order_by('b.KODE_BARANG ASC, a.NAMA_SNSTOCK ASC'); return $this->db->get()->result_array(); } public function getData_SnStock_bySUPPLIER_byMERK_byPRODUK_forStokSupplier($id_supplier, $id_merk=null, $id_produk=null, $kode=null) { // Used $this->db->select('COUNT(a.ID_SNSTOCK) as TOTAL, b.ID_BARANG, b.KODE_BARANG, b.NAMA_BARANG, c.NAMA_JENIS, g.NAMA_MERK'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sn_beli d','d.NAMA_SNB=a.NAMA_SNSTOCK'); $this->db->join('daftar_beli e','e.ID_DB=d.DB_ID'); $this->db->join('pembelian f','f.ID_PEMBELIAN=e.PEMBELIAN_ID'); $this->db->join('merk g','g.ID_MERK=b.MERK_ID'); if ($id_merk==NULL AND $id_produk==NULL AND $kode==NULL) { $this->db->where("f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk!=NULL AND $id_produk==NULL AND $kode==NULL) { $this->db->where("b.MERK_ID=$id_merk AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.MERK_ID=$id_merk AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk==NULL AND $id_produk!=NULL AND $kode==NULL) { $this->db->where("b.PRODUK_ID=$id_produk AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.PRODUK_ID=$id_produk AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk!=NULL AND $id_produk!=NULL AND $kode==NULL) { $this->db->where("b.MERK_ID=$id_merk AND b.PRODUK_ID=$id_produk AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.MERK_ID=$id_merk AND b.PRODUK_ID=$id_produk AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk==NULL AND $id_produk==NULL AND $kode!=NULL) { $this->db->where("b.KODE_BARANG=$kode AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.KODE_BARANG=$kode AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk!=NULL AND $id_produk==NULL AND $kode!=NULL) { $this->db->where("b.MERK_ID=$id_merk AND b.KODE_BARANG=$kode AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.MERK_ID=$id_merk AND b.KODE_BARANG=$kode AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk==NULL AND $id_produk!=NULL AND $kode!=NULL) { $this->db->where("b.PRODUK_ID=$id_produk AND b.KODE_BARANG=$kode AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.PRODUK_ID=$id_produk AND b.KODE_BARANG=$kode AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } else if ($id_merk!=NULL AND $id_produk!=NULL AND $kode!=NULL) { $this->db->where("b.MERK_ID=$id_merk AND b.PRODUK_ID=$id_produk AND b.KODE_BARANG=$kode AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK=0"); $this->db->or_where("b.MERK_ID=$id_merk AND b.PRODUK_ID=$id_produk AND b.KODE_BARANG=$kode AND f.SUPPLIER_ID=$id_supplier AND a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=2 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=4"); } $this->db->group_by('a.BARANG_ID'); $this->db->order_by('g.NAMA_MERK ASC, b.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_SoProyek_byID($id) { // Used $this->db->select('*, FORMAT(c.NILAI_SO,2) as NILAI, DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('so_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->join('penjualan d','d.SO_ID=a.SO_ID'); $this->db->where('a.ID_SPR=', $id); return $this->db->get()->result_array(); } public function getData_SoProyek_byPROYEK($id) { // Used $this->db->select('*, FORMAT(c.NILAI_SO,2) as NILAI, FORMAT(c.FEE_SO,2) as FEE, DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, a.SO_ID as SID'); $this->db->from('so_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->join('penjualan d','d.SO_ID=a.SO_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PEL_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->where('a.PROYEK_ID=', $id); return $this->db->get()->result_array(); } public function getData_SoProyek_byPROYEK_beforeRP($id, $rp) { // Used $this->db->select('*, FORMAT(c.NILAI_SO,2) as NILAI, FORMAT(c.FEE_SO,2) as FEE, DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, a.SO_ID as SID'); $this->db->from('so_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->join('penjualan d','d.SO_ID=a.SO_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PEL_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->where('a.PROYEK_ID=', $id); $this->db->where('a.RP_ID_SPR<', $rp); return $this->db->get()->result_array(); } public function getData_SoProyek_byRP($id) { // Used $this->db->select('*, a.SO_ID as SOID, FORMAT(d.FEE_SO,2) as FEE, DATE_FORMAT(b.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m%/%Y") as TGLNOTA, DATE_FORMAT(g.TGLLOCK_HHPDA,"%d/%m%/%Y") as TGLLUNAS'); $this->db->from('so_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('penjualan c','c.SO_ID=a.SO_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->join('hasil_hitungpda g','g.PENJUALAN_ID=c.ID_PENJUALAN'); $this->db->where('b.RP_ID=', $id); $this->db->order_by('e.NAMA_PELANGGAN ASC, b.KODE_PROYEK ASC, d.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getData_SoProyek_byRP_jenis3($id, $search=null) { // Used $this->db->select('*, a.SO_ID as SOID, FORMAT(d.NILAI_SO,2) as NILAI, FORMAT(d.FEE_SO,2) as FEE, DATE_FORMAT(b.TGL_PROYEK,"%d/%m/%Y") as TANGGAL, DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m%/%Y") as TGLNOTA, DATE_FORMAT(g.TGLLOCK_HHPDA,"%d/%m%/%Y") as TGLLUNAS'); $this->db->from('so_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('penjualan c','c.SO_ID=a.SO_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); $this->db->join('hasil_hitungpda g','g.PENJUALAN_ID=c.ID_PENJUALAN'); $this->db->where('a.RP_ID_SPR=', $id); if ($search!=null) { $this->db->where('a.ID_SPR=', $search); } $this->db->order_by('a.ID_SPR ASC'); return $this->db->get()->result_array(); } public function getData_SoProyek_bySO($id) { // Used $this->db->select('*,FORMAT(c.NILAI_SO,2) as NILAI,DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL'); $this->db->from('so_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->join('penjualan d','d.SO_ID=a.SO_ID'); $this->db->where('a.SO_ID=', $id); return $this->db->get()->result_array(); } public function getData_SoSjPenjualan_bySO($id) { // Used $this->db->select('*'); $this->db->from('so_sjpenjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->where(['a.SO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_StatusKunjungan_not9($id=null) { // Used $this->db->select('*'); $this->db->from('status_kunjungan'); if ($id!=null) { $this->db->where('ID_SKUN=', $id); } $this->db->where('ID_SKUN!=9'); $this->db->order_by('ID_SKUN ASC'); return $this->db->get()->result_array(); } public function getData_StatusPenawaran_not09($id=null) { // Used $this->db->select('*'); $this->db->from('status_penawaran'); if ($id!=null) { $this->db->where('ID_SPE=', $id); } $this->db->where('ID_SPE>0 AND ID_SPE<9'); $this->db->order_by('ID_SPE ASC'); return $this->db->get()->result_array(); } public function getData_StatusSn($id=null) { // Used $this->db->select('*'); $this->db->from('status_sn'); if ($id!=null) { $this->db->where('ID_SSN=', $id); } $this->db->order_by('ID_SSN ASC'); return $this->db->get()->result_array(); } public function getData_StokAntik_byBARANG_byGUDANG_bySTATUS($id1, $id2, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SA,"%d/%m/%Y") as TANGGAL'); $this->db->from('stok_antik a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where('a.BARANG_ID=', $id1); $this->db->where('a.GUDANG_ID=', $id2); $this->db->where('a.STATUS_SA=', $status); return $this->db->get()->result_array(); } public function getData_StokAntik_byID_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SA,"%d/%m/%Y") as TANGGAL'); $this->db->from('stok_antik a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where('a.ID_SA=', $id); $this->db->where('a.STATUS_SA=', $status); return $this->db->get()->result_array(); } public function getData_StokAntik_byGUDANG_bySTATUS($id, $status) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_SA,"%d/%m/%Y") as TANGGAL'); $this->db->from('stok_antik a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where('a.GUDANG_ID=', $id); $this->db->where('a.STATUS_SA=', $status); return $this->db->get()->result_array(); } public function getData_StokKuantitiSn($id_barang, $jenis_gudang) { // Used $this->db->select('a.NAMA_SNSTOCK, a.BARANG_ID, b.KODE_BARANG, b.NAMA_BARANG'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); if ($jenis_gudang == 1) { // ANTIK $this->db->where('a.STATUS_SNSTOCK=19 AND a.BARANG_ID=', $id_barang); } else if ($jenis_gudang == 2) { // Global $this->db->where('a.STATUS_SNSTOCK=0 AND a.BARANG_ID=', $id_barang); } else if ($jenis_gudang == 3) { // ITP $this->db->where('a.STATUS_SNSTOCK=0 AND a.GUDANG_SNSTOCK=2 AND a.BARANG_ID=', $id_barang); } else if ($jenis_gudang == 4) { // KONSINYASI $this->db->where('a.STATUS_SNSTOCK=6 AND a.BARANG_ID=', $id_barang); } else if ($jenis_gudang == 5) { // PCM $this->db->where('a.STATUS_SNSTOCK=0 AND a.GUDANG_SNSTOCK=1 AND a.BARANG_ID=', $id_barang); } else if ($jenis_gudang == 6) { // PEMINJAMAN $this->db->where('a.STATUS_SNSTOCK=5 AND a.BARANG_ID=', $id_barang); } else if ($jenis_gudang == 8) { // PROYEK $this->db->where('a.STATUS_SNSTOCK=9 AND a.BARANG_ID=', $id_barang); } else if ($jenis_gudang == 9) { // SERVICE $this->db->where('a.STATUS_SNSTOCK=7 AND a.GUDANG_SNSTOCK=3 AND a.BARANG_ID=', $id_barang); } else if ($jenis_gudang == 10) { // SEWA $this->db->where('a.STATUS_SNSTOCK=20 AND a.GUDANG_SNSTOCK=1 AND a.BARANG_ID=', $id_barang); } $this->db->order_by('a.NAMA_SNSTOCK ASC'); return $this->db->get()->result_array(); } public function getData_SubmenuPricelist_byID($id) { // Used $this->db->select('*'); $this->db->from('submenu_pricelist a'); $this->db->join('pricelist b','b.ID_PRICELIST=a.PRICELIST_ID'); $this->db->where(['a.ID_SMPL' => $id]); return $this->db->get()->result_array(); } public function getData_SubmenuPricelist_byPRICELIST($id) { // Used $this->db->select('*'); $this->db->from('submenu_pricelist a'); $this->db->join('pricelist b','b.ID_PRICELIST=a.PRICELIST_ID'); $this->db->where(['a.PRICELIST_ID' => $id]); $this->db->order_by('a.ID_SMPL ASC'); return $this->db->get()->result_array(); } public function getData_SubmenuPricelist_byPRICELIST_afterAwal_beforePengganti($id, $awal, $pengganti) { // Used $this->db->select('*'); $this->db->from('submenu_pricelist a'); $this->db->join('pricelist b','b.ID_PRICELIST=a.PRICELIST_ID'); $this->db->where(['a.PRICELIST_ID' => $id]); $this->db->where('a.URUTAN_SMPL>', $awal); $this->db->where('a.URUTAN_SMPL<=', $pengganti); $this->db->order_by('a.URUTAN_SMPL ASC'); return $this->db->get()->result_array(); } public function getData_SubmenuPricelist_byPRICELIST_beforeAwal_afterPengganti($id, $awal, $pengganti) { // Used $this->db->select('*'); $this->db->from('submenu_pricelist a'); $this->db->join('pricelist b','b.ID_PRICELIST=a.PRICELIST_ID'); $this->db->where(['a.PRICELIST_ID' => $id]); $this->db->where('a.URUTAN_SMPL<', $awal); $this->db->where('a.URUTAN_SMPL>=', $pengganti); $this->db->order_by('a.URUTAN_SMPL ASC'); return $this->db->get()->result_array(); } public function getData_SubmenuPricelist_byPRICELIST_orderURUTAN($id) { // Used $this->db->select('*'); $this->db->from('submenu_pricelist a'); $this->db->join('pricelist b','b.ID_PRICELIST=a.PRICELIST_ID'); $this->db->where(['a.PRICELIST_ID' => $id]); $this->db->order_by('a.URUTAN_SMPL ASC'); return $this->db->get()->result_array(); } public function getData_Supplier_byID($id) { // Used $this->db->select('*'); $this->db->from('supplier a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->where(['a.ID_SUPPLIER' => $id]); return $this->db->get()->result_array(); } public function getData_Supplier_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('supplier'); $this->db->where('ID_SUPPLIER=', $id); $this->db->where('STATUS_SUPPLIER=', $status); return $this->db->get()->result_array(); } public function getData_Supplier_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('supplier'); $this->db->where('NAMA_SUPPLIER=', $nama); $this->db->where('STATUS_SUPPLIER=', $status); if ($id!=null) { $this->db->where('ID_SUPPLIER!=', $id); } return $this->db->get()->result_array(); } public function getData_Supplier_byKOTA_bySTATUS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('supplier a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); if ($id1!=null) { $this->db->where('a.KOTA_ID=', $id1); } $this->db->where('a.STATUS_SUPPLIER=', $id2); $this->db->order_by('b.NAMA_KOTA ASC, a.NAMA_SUPPLIER ASC'); return $this->db->get()->result_array(); } public function getData_Supplier_bySEARCH_status1_limit20($search=null) { // Used $this->db->select('*'); $this->db->from('supplier a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); if ($search!=null) { $this->db->where("a.STATUS_SUPPLIER=1 AND a.NAMA_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_SUPPLIER=1 AND a.ALIAS_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_SUPPLIER=1 AND a.ALAMAT_SUPPLIER LIKE '%$search%'"); $this->db->or_where("a.STATUS_SUPPLIER=1 AND b.NAMA_KOTA LIKE '%$search%'"); } else { $this->db->where('a.STATUS_SUPPLIER=1'); } $this->db->order_by('a.ID_SUPPLIER DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_Supplier_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('supplier a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->where('a.STATUS_SUPPLIER=', $id); $this->db->order_by('a.NAMA_SUPPLIER ASC'); return $this->db->get()->result_array(); } public function getData_Tim_byID($id) { // Used $this->db->select('*'); $this->db->from('tim'); $this->db->where(['ID_TIM' => $id]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byBARANG($id){ // Used $this->db->select('*'); $this->db->from('transaksi_stock'); $this->db->where('BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byBARANG_byGUDANG_bySTATUS($id, $gudang, $status){ // Used $this->db->select('*, DATE_FORMAT(TGL_IO, "%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock'); $this->db->where('BARANG_ID=', $id); $this->db->where('GUDANG_IO=', $gudang); $this->db->where('STATUS_IO=', $status); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byBARANG_byJIO_byJENIS_byPERIODE_status1($id_barang=null, $id_jio=null, $jenis=null, $awal=null, $akhir=null, $search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL, FORMAT(a.HARGA_IO, 2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis_io d','d.ID_JIO=a.JIO_ID'); if ($id_barang==NULL AND $id_jio==NULL AND $jenis==NULL AND $search==NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir'"); } else if ($id_barang!=NULL AND $id_jio==NULL AND $jenis==NULL AND $search==NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang"); } else if ($id_barang==NULL AND $id_jio!=NULL AND $jenis==NULL AND $search==NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio"); } else if ($id_barang==NULL AND $id_jio==NULL AND $jenis!=NULL AND $search==NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JENIS_IO=$jenis"); } else if ($id_barang!=NULL AND $id_jio!=NULL AND $jenis==NULL AND $search==NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio"); } else if ($id_barang!=NULL AND $id_jio==NULL AND $jenis!=NULL AND $search==NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JENIS_IO=$jenis"); } else if ($id_barang==NULL AND $id_jio!=NULL AND $jenis!=NULL AND $search==NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis"); } else if ($id_barang!=NULL AND $id_jio!=NULL AND $jenis!=NULL AND $search==NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis"); } else if ($id_barang==NULL AND $id_jio==NULL AND $jenis==NULL AND $search!=NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.KODE_BUKTI LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.KET_IO LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND d.NAMA_JIO LIKE '%$search%'"); } else if ($id_barang!=NULL AND $id_jio==NULL AND $jenis==NULL AND $search!=NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir AND a.BARANG_ID=$id_barang AND a.KODE_BUKTI LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.KET_IO LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND d.NAMA_JIO LIKE '%$search%'"); } else if ($id_barang==NULL AND $id_jio!=NULL AND $jenis==NULL AND $search!=NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir AND a.JIO_ID=$id_jio AND a.KODE_BUKTI LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND a.KET_IO LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND d.NAMA_JIO LIKE '%$search%'"); } else if ($id_barang==NULL AND $id_jio==NULL AND $jenis!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir AND a.JENIS_IO=$jenis AND a.KODE_BUKTI LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JENIS_IO=$jenis AND a.KET_IO LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JENIS_IO=$jenis AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JENIS_IO=$jenis AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JENIS_IO=$jenis AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JENIS_IO=$jenis AND d.NAMA_JIO LIKE '%$search%'"); } else if ($id_barang!=NULL AND $id_jio!=NULL AND $jenis==NULL AND $search!=NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND a.KODE_BUKTI LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND a.KET_IO LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND d.NAMA_JIO LIKE '%$search%'"); } else if ($id_barang!=NULL AND $id_jio==NULL AND $jenis!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir AND a.BARANG_ID=$id_barang AND a.JENIS_IO=$jenis AND a.KODE_BUKTI LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JENIS_IO=$jenis AND a.KET_IO LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JENIS_IO=$jenis AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JENIS_IO=$jenis AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JENIS_IO=$jenis AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JENIS_IO=$jenis AND d.NAMA_JIO LIKE '%$search%'"); } else if ($id_barang==NULL AND $id_jio!=NULL AND $jenis!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND a.KODE_BUKTI LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND a.KET_IO LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND d.NAMA_JIO LIKE '%$search%'"); } else if ($id_barang!=NULL AND $id_jio!=NULL AND $jenis!=NULL AND $search!=NULL) { $this->db->where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND a.KODE_BUKTI LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND a.KET_IO LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND b.NAMA_PANGGILAN_KARYAWAN LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND c.KODE_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND c.NAMA_BARANG LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.TGL_IO>='$awal' AND a.TGL_IO<='$akhir' AND a.BARANG_ID=$id_barang AND a.JIO_ID=$id_jio AND a.JENIS_IO=$jenis AND d.NAMA_JIO LIKE '%$search%'"); } $this->db->order_by('a.ID_IO ASC'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byCABUTAN($id){ // Used $this->db->select('*'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('a.CABUTAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byCABUTAN_byBARANG_statusNull($id1, $id2) { // Used $this->db->select('*'); $this->db->from('transaksi_stock'); $this->db->where('STATUS_IO is NULL'); $this->db->where('CABUTAN_ID=', $id1); $this->db->where('BARANG_ID=', $id2); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byCABUTAN_statusNull($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL, FORMAT(a.HARGA_IO, 2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.CABUTAN_ID' => $id]); $this->db->where('a.STATUS_IO is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byID($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.ID_IO' => $id]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byID_byCABUTAN_statusNull($id1, $id2) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL, FORMAT(a.HARGA_IO, 2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.ID_IO' => $id1]); $this->db->where(['a.CABUTAN_ID' => $id2]); $this->db->where('a.STATUS_IO is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byID_byMODIFIKASI_statusNull($id1, $id2) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL, FORMAT(a.HARGA_IO, 2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.ID_IO' => $id1]); $this->db->where(['a.MODIFIKASI_ID' => $id2]); $this->db->where('a.STATUS_IO is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byID_bySTATUS($id, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.ID_IO' => $id]); $this->db->where(['a.STATUS_IO' => $status]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byID_bySTATUS_byCABUTAN($id, $status, $cabutan) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.ID_IO' => $id]); $this->db->where(['a.STATUS_IO' => $status]); $this->db->where(['a.CABUTAN_ID' => $cabutan]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byID_statusNull($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.ID_IO' => $id]); $this->db->where('a.STATUS_IO is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byJIO_groupKODE($id){ // Used $this->db->select('*, DATE_FORMAT(TGL_IO, "%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock'); $this->db->where('JIO_ID=', $id); $this->db->group_by('KODE_BUKTI'); $this->db->order_by('TGL_IO ASC, KODE_BUKTI ASC'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byKARYAWAN_bySTATUS_beforeTGL_soNull($id, $status, $tgl) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.KARYAWAN_ID' => $id]); $this->db->where(['a.STATUS_IO' => $status]); $this->db->where('a.TGL_IO<', $tgl); $this->db->where('a.SO_ID is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byKARYAWAN_bySTATUS_byTGL_soNull($id, $status, $tgl) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.KARYAWAN_ID' => $id]); $this->db->where(['a.STATUS_IO' => $status]); $this->db->where('a.TGL_IO=', $tgl); $this->db->where('a.SO_ID is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byKARYAWAN_bySTATUS_soNull($id, $status) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL,FORMAT(a.HARGA_IO,2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.KARYAWAN_ID' => $id]); $this->db->where(['a.STATUS_IO' => $status]); $this->db->where('a.SO_ID is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byKODEBUKTI($id) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL,FORMAT(a.HARGA_IO,2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis_io d','d.ID_JIO=a.JIO_ID','left'); $this->db->where(['a.KODE_BUKTI' => $id]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byKODEBUKTI_byJENIS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('transaksi_stock a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where(['a.KODE_BUKTI' => $id1]); $this->db->where(['a.JENIS_IO' => $id2]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byMODIFIKASI_byBARANG_statusNull($id1, $id2) { // Used $this->db->select('*'); $this->db->from('transaksi_stock'); $this->db->where('STATUS_IO is NULL'); $this->db->where('MODIFIKASI_ID=', $id1); $this->db->where('BARANG_ID=', $id2); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byMODIFIKASI_byJENIS_statusNull($id1, $id2) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL, FORMAT(a.HARGA_IO, 2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.MODIFIKASI_ID' => $id1]); $this->db->where(['a.JENIS_IO' => $id2]); $this->db->where('a.STATUS_IO is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byMODIFIKASI_statusNull($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL, FORMAT(a.HARGA_IO, 2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.MODIFIKASI_ID' => $id]); $this->db->where('a.STATUS_IO is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byPENJUALAN($id) { // Used $this->db->select('*'); $this->db->from('transaksi_stock a'); $this->db->join('penjualan b','b.SO_ID=a.SO_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['b.ID_PENJUALAN' => $id]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byPROYEK($id) { // Used $this->db->select('*'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.PROYEK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byRP_byJENIS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('transaksi_stock a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('so_proyek c','c.SO_ID=a.SO_ID'); $this->db->join('proyek d','d.ID_PROYEK=c.SO_ID'); $this->db->where('d.RP_ID=', $id1); $this->db->where('a.JENIS_IO=', $id2); return $this->db->get()->result_array(); } public function getData_TransaksiStock_bySEARCH_allStatus_limit20($search=null) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID','left'); if ($search!=null) { $this->db->where("a.STATUS_IO=1 AND a.KODE_BUKTI LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.PROSES_IO LIKE '%$search%'"); $this->db->or_where("a.STATUS_IO=1 AND a.SO_ID is NOT NULL AND c.KODE_SO LIKE '%$search%'"); } $this->db->group_by('a.KODE_BUKTI'); $this->db->order_by('a.TGL_IO DESC'); $this->db->limit('20'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_bySO_byBARANG_statusNull($id1, $id2) { // Used $this->db->select('*'); $this->db->from('transaksi_stock'); $this->db->where('STATUS_IO is NULL'); $this->db->where('SO_ID=', $id1); $this->db->where('BARANG_ID=', $id2); return $this->db->get()->result_array(); } public function getData_TransaksiStock_bySO_byJENIS($id1, $id2) { // Used $this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->where(['a.SO_ID' => $id1]); $this->db->where(['a.JENIS_IO' => $id2]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_bySO_byJENIS_statusNull($id, $jenis) { // Used $this->db->select('*'); $this->db->from('transaksi_stock a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.SO_ID' => $id]); $this->db->where('a.JENIS_IO=', $jenis); $this->db->where('a.STATUS_IO is NULL'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_bySO_bySTATUS($id1, $id2) { // Used $this->db->select('*, FORMAT(a.HARGA_IO, 2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where('a.SO_ID=', $id1); $this->db->where('a.STATUS_IO=', $id2); return $this->db->get()->result_array(); } public function getData_TransaksiStock_bySO_statusNull($id) { // Used $this->db->select('*, FORMAT(a.HARGA_IO, 2) as HARGA'); $this->db->from('transaksi_stock a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.SO_ID' => $id]); $this->db->where('a.STATUS_IO is NULL'); return $this->db->get()->result_array(); } public function getData_TtKosong_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_TK,"%d/%m/%Y") as TANGGAL'); $this->db->from('tt_kosong a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_TK=', $id); return $this->db->get()->result_array(); } public function getData_TtKosong_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('tt_kosong a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_TK=', $id); $this->db->where('a.STATUS_TK=', $status); return $this->db->get()->result_array(); } public function getData_TtKosong_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('tt_kosong a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_TK=', $status); return $this->db->get()->result_array(); } public function getData_TtKosong_byKARYAWAN_bySTATUS_byLIMIT_orderDESC($id1, $id2, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_TK,"%d/%m/%Y") as TANGGAL'); $this->db->from('tt_kosong a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.KARYAWAN_ID=', $id1); $this->db->where('a.STATUS_TK=', $id2); $this->db->where('a.TGL_TK>=', $limit); $this->db->order_by('a.ID_TK DESC'); return $this->db->get()->result_array(); } public function getData_TtKosong_bySTATUS_byLIMIT_orderDESC($id, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_TK,"%d/%m/%Y") as TANGGAL'); $this->db->from('tt_kosong a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->where('a.STATUS_TK=', $id); $this->db->where('a.TGL_TK>=', $limit); $this->db->order_by('a.ID_TK DESC'); return $this->db->get()->result_array(); } public function getData_TtNota_byID($id) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_TN,"%d/%m/%Y") as TANGGAL'); $this->db->from('tt_nota a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->where('a.ID_TN=', $id); return $this->db->get()->result_array(); } public function getData_TtNota_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('tt_nota a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->where('a.ID_TN=', $id); $this->db->where('a.STATUS_TN=', $status); return $this->db->get()->result_array(); } public function getData_TtNota_byKARYAWAN_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('tt_nota a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_TN=', $status); return $this->db->get()->result_array(); } public function getData_TtNota_byKARYAWAN_bySTATUS_byLIMIT_orderDESC($id1, $id2, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_TN,"%d/%m/%Y") as TANGGAL'); $this->db->from('tt_nota a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.KARYAWAN_ID=', $id1); $this->db->where('a.STATUS_TN=', $id2); $this->db->where('a.TGL_TN>=', $limit); $this->db->order_by('a.ID_TN DESC'); return $this->db->get()->result_array(); } public function getData_TtNota_bySTATUS_byLIMIT_orderDESC($id, $limit) { // Used $this->db->select('*, DATE_FORMAT(a.TGL_TN,"%d/%m/%Y") as TANGGAL'); $this->db->from('tt_nota a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.STATUS_TN=', $id); $this->db->where('a.TGL_TN>=', $limit); $this->db->order_by('a.ID_TN DESC'); return $this->db->get()->result_array(); } public function getData_UangMuka_byID($id) { // Used $this->db->select('*'); $this->db->from('uang_muka'); $this->db->where('ID_UM=', $id); return $this->db->get()->result_array(); } public function getData_UangMuka_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('uang_muka'); $this->db->where('ID_UM=', $id); $this->db->where('STATUS_UM=', $status); return $this->db->get()->result_array(); } public function getData_UangMuka_bySTATUS($id) { // Used $this->db->select('*, FORMAT(a.NILAI_UM,2) as NILAI, DATE_FORMAT(e.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('uang_muka a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PEL_ID'); $this->db->join('kota c','c.ID_KOTA=b.KOTA_ID'); $this->db->join('daftar_akuntansi d','d.UM_ID=a.ID_UM'); $this->db->join('akuntansi e','e.ID_AKUNTANSI=d.AKUNTANSI_ID'); $this->db->where('a.STATUS_UM=', $id); $this->db->group_by('a.ID_UM'); $this->db->order_by('e.TGL_AKUNTANSI DESC'); return $this->db->get()->result_array(); } public function getData_UnitProyek_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('unitproyek'); $this->db->where('ID_UNITPROYEK=', $id); $this->db->where('STATUS_UNITPROYEK=', $status); return $this->db->get()->result_array(); } public function getData_UnitProyek_byID($id) { // Used $this->db->select('*'); $this->db->from('unitproyek'); $this->db->where('ID_UNITPROYEK=', $id); return $this->db->get()->result_array(); } public function getData_UnitProyek_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('unitproyek'); $this->db->where('NAMA_UNITPROYEK=', $nama); $this->db->where('STATUS_UNITPROYEK=', $status); if ($id!=null) { $this->db->where('ID_UNITPROYEK!=', $id); } return $this->db->get()->result_array(); } public function getData_UnitProyek_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('unitproyek'); $this->db->where('STATUS_UNITPROYEK=', $id); $this->db->order_by('NAMA_UNITPROYEK ASC'); return $this->db->get()->result_array(); } public function getData_UnitService_byID($id) { // Used $this->db->select('*'); $this->db->from('unitservice a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->where('a.ID_UNITSERVICE=', $id); return $this->db->get()->result_array(); } public function getData_UnitService_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('unitservice a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->where('a.ID_UNITSERVICE=', $id); $this->db->where('a.STATUS_UNITSERVICE=', $status); return $this->db->get()->result_array(); } public function getData_UnitService_byJENIS_bySTATUS($id1, $id2) { // Used $this->db->select('*'); $this->db->from('unitservice a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); if ($id1!=null) { $this->db->where('a.JENIS_ID=', $id1); } $this->db->where('a.STATUS_UNITSERVICE=', $id2); $this->db->order_by('b.NAMA_JENIS ASC, a.NAMA_UNITSERVICE ASC'); return $this->db->get()->result_array(); } public function getData_UnitService_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('unitservice'); $this->db->where('NAMA_UNITSERVICE=', $nama); $this->db->where('STATUS_UNITSERVICE=', $status); if ($id!=null) { $this->db->where('ID_UNITSERVICE!=', $id); } return $this->db->get()->result_array(); } public function getData_UnitService_bySEARCH_status1_limit10($search=null) { // Used $this->db->select('*'); $this->db->from('unitservice a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); if ($search!=null) { $this->db->where("a.STATUS_UNITSERVICE=1 AND a.NAMA_UNITSERVICE LIKE '%$search%'"); $this->db->or_where("a.STATUS_UNITSERVICE=1 AND b.NAMA_JENIS LIKE '%$search%'"); } else { $this->db->where('a.STATUS_UNITSERVICE=1'); } $this->db->order_by('a.ID_UNITSERVICE DESC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_UnitService_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('unitservice a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->where('a.STATUS_UNITSERVICE=', $id); $this->db->order_by('a.NAMA_UNITSERVICE ASC'); return $this->db->get()->result_array(); } public function getData_WajibPajak_byID($id) { // Used $this->db->select('*'); $this->db->from('wajibpajak'); $this->db->where('ID_WAJIBPAJAK=', $id); return $this->db->get()->result_array(); } public function getData_WajibPajak_byID_bySTATUS($id, $status) { // Used $this->db->select('*'); $this->db->from('wajibpajak'); $this->db->where('ID_WAJIBPAJAK=', $id); $this->db->where('STATUS_WAJIBPAJAK=', $status); return $this->db->get()->result_array(); } public function getData_WajibPajak_byNAMA_bySTATUS($nama, $status, $id=null) { // Used $this->db->select('*'); $this->db->from('wajibpajak'); $this->db->where('NAMA_WAJIBPAJAK=', $nama); $this->db->where('STATUS_WAJIBPAJAK=', $status); if ($id!=null) { $this->db->where('ID_WAJIBPAJAK!=', $id); } return $this->db->get()->result_array(); } public function getData_WajibPajak_bySTATUS($id) { // Used $this->db->select('*'); $this->db->from('wajibpajak'); $this->db->where('STATUS_WAJIBPAJAK=', $id); $this->db->order_by('NAMA_WAJIBPAJAK ASC'); return $this->db->get()->result_array(); } // Daftar Fungsi getMax public function getMax_ID_Akuntansi() { // Used $this->db->select_max('ID_AKUNTANSI'); $this->db->from('akuntansi'); return $this->db->get()->result_array(); } public function getMax_ID_Barang() { // Used $this->db->select_max('ID_BARANG'); $this->db->from('barang'); return $this->db->get()->result_array(); } public function getMax_ID_Cabutan() { // Used $this->db->select_max('ID_CABUTAN'); $this->db->from('cabutan'); return $this->db->get()->result_array(); } public function getMax_ID_CetakDokumen() { // Used $this->db->select_max('ID_CD'); $this->db->from('cetak_dokumen'); return $this->db->get()->result_array(); } public function getMax_ID_CreditNote() { // Used $this->db->select_max('ID_CN'); $this->db->from('creditnote'); return $this->db->get()->result_array(); } public function getMax_ID_DaftarAkuntansi() { // Used $this->db->select_max('ID_DAK'); $this->db->from('daftar_akuntansi'); return $this->db->get()->result_array(); } public function getMax_ID_DaftarProyek() { // Used $this->db->select_max('ID_DPR'); $this->db->from('daftar_proyek'); return $this->db->get()->result_array(); } public function getMax_ID_DaftarReturBeli() { // Used $this->db->select_max('ID_DRB'); $this->db->from('daftar_returbeli'); return $this->db->get()->result_array(); } public function getMax_ID_DaftarReturJual() { // Used $this->db->select_max('ID_DRJ'); $this->db->from('daftar_returjual'); return $this->db->get()->result_array(); } public function getMax_ID_DaftarSjParsial() { // Used $this->db->select_max('ID_SJP'); $this->db->from('daftar_sjparsial'); return $this->db->get()->result_array(); } public function getMax_ID_DokumenTagihan() { // Used $this->db->select_max('ID_DT'); $this->db->from('dokumen_tagihan'); return $this->db->get()->result_array(); } public function getMax_ID_FormKaryawan() { // Used $this->db->select_max('ID_FK'); $this->db->from('form_karyawan'); return $this->db->get()->result_array(); } public function getMax_ID_HasilHitungNeraca() { // Used $this->db->select_max('ID_HNE'); $this->db->from('hasil_hitungneraca'); return $this->db->get()->result_array(); } public function getMax_ID_HasilHitungTb() { // Used $this->db->select_max('ID_HHTB'); $this->db->from('hasil_hitungtb'); return $this->db->get()->result_array(); } public function getMax_ID_KlaimProgram() { // Used $this->db->select_max('ID_KPR'); $this->db->from('klaim_program'); return $this->db->get()->result_array(); } public function getMax_ID_Konsinyasi() { // Used $this->db->select_max('ID_KONSINYASI'); $this->db->from('konsinyasi'); return $this->db->get()->result_array(); } public function getMax_ID_LinkKlaimProgram() { // Used $this->db->select_max('ID_LKPR'); $this->db->from('link_klaimprogram'); return $this->db->get()->result_array(); } public function getMax_ID_MutasiBarang() { // Used $this->db->select_max('ID_MB'); $this->db->from('mutasi_barang'); return $this->db->get()->result_array(); } public function getMax_ID_NotaBebas() { // Used $this->db->select_max('ID_NB'); $this->db->from('nota_bebas'); return $this->db->get()->result_array(); } public function getMax_ID_Opname() { // Used $this->db->select_max('ID_OPNAME'); $this->db->from('opname'); return $this->db->get()->result_array(); } public function getMax_ID_PajakDibayarDimuka() { // Used $this->db->select_max('ID_PDD'); $this->db->from('pajak_dibayardimuka'); return $this->db->get()->result_array(); } public function getMax_ID_Pembelian() { // Used $this->db->select_max('ID_PEMBELIAN'); $this->db->from('pembelian'); return $this->db->get()->result_array(); } public function getMax_ID_Peminjaman() { // Used $this->db->select_max('ID_PEMINJAMAN'); $this->db->from('peminjaman'); return $this->db->get()->result_array(); } public function getMax_ID_Part() { // Used $this->db->select_max('ID_PART'); $this->db->from('part'); return $this->db->get()->result_array(); } public function getMax_ID_PenarikanKonsi() { // Used $this->db->select_max('ID_PK'); $this->db->from('penarikan_konsi'); return $this->db->get()->result_array(); } public function getMax_ID_PenarikanService() { // Used $this->db->select_max('ID_PSV'); $this->db->from('penarikan_service'); return $this->db->get()->result_array(); } public function getMax_ID_PenarikanSewa() { // Used $this->db->select_max('ID_PS'); $this->db->from('penarikan_sewa'); return $this->db->get()->result_array(); } public function getMax_ID_Penawaran() { // Used $this->db->select_max('ID_PENAWARAN'); $this->db->from('penawaran'); return $this->db->get()->result_array(); } public function getMax_ID_Pengadaan() { // Used $this->db->select_max('ID_PENGADAAN'); $this->db->from('pengadaan'); return $this->db->get()->result_array(); } public function getMax_ID_Penjualan() { // Used $this->db->select_max('ID_PENJUALAN'); $this->db->from('penjualan'); return $this->db->get()->result_array(); } public function getMax_ID_PeriodeAkuntansi() { // Used $this->db->select_max('ID_PAK'); $this->db->from('periode_akuntansi'); return $this->db->get()->result_array(); } public function getMax_ID_PotonganKlaimProgram() { // Used $this->db->select_max('ID_PKPR'); $this->db->from('potongan_klaimprogram'); return $this->db->get()->result_array(); } public function getMax_ID_PeriodeKpi() { // Used $this->db->select_max('ID_PKPI'); $this->db->from('periode_kpi'); return $this->db->get()->result_array(); } public function getMax_ID_Proforma() { // Used $this->db->select_max('ID_PF'); $this->db->from('proforma'); return $this->db->get()->result_array(); } public function getMax_ID_RekapKlaimProgram() { // Used $this->db->select_max('ID_RKPR'); $this->db->from('rekap_klaimprogram'); return $this->db->get()->result_array(); } public function getMax_ID_RekapPajak() { // Used $this->db->select_max('ID_RPJ'); $this->db->from('rekap_pajak'); return $this->db->get()->result_array(); } public function getMax_ID_RekapProyek() { // Used $this->db->select_max('ID_RP'); $this->db->from('rekap_proyek'); return $this->db->get()->result_array(); } public function getMax_ID_ReturPembelian() { // Used $this->db->select_max('ID_RB'); $this->db->from('retur_pembelian'); return $this->db->get()->result_array(); } public function getMax_ID_ReturPenjualan() { // Used $this->db->select_max('ID_RJ'); $this->db->from('retur_penjualan'); return $this->db->get()->result_array(); } public function getMax_ID_Service() { // Used $this->db->select_max('ID_SERVICE'); $this->db->from('service'); return $this->db->get()->result_array(); } public function getMax_ID_Setdata() { // Used $this->db->select_max('ID_SETDATA'); $this->db->from('setdata'); return $this->db->get()->result_array(); } public function getMax_ID_Sewa() { // Used $this->db->select_max('ID_SEWA'); $this->db->from('sewa'); return $this->db->get()->result_array(); } public function getMax_ID_SjPenjualan() { // Used $this->db->select_max('ID_SJPJ'); $this->db->from('sj_penjualan'); return $this->db->get()->result_array(); } public function getMax_ID_SnStock() { // Used $this->db->select_max('ID_SNSTOCK'); $this->db->from('sn_stock'); return $this->db->get()->result_array(); } public function getMax_ID_SjService() { // Used $this->db->select_max('ID_SJS'); $this->db->from('sj_service'); return $this->db->get()->result_array(); } public function getMax_ID_SnService() { // Used $this->db->select_max('ID_SNS'); $this->db->from('sn_service'); return $this->db->get()->result_array(); } public function getMax_ID_StokAntik() { // Used $this->db->select_max('ID_SA'); $this->db->from('stok_antik'); return $this->db->get()->result_array(); } public function getMax_ID_TransaksiStock() { // Used $this->db->select_max('ID_IO'); $this->db->from('transaksi_stock'); return $this->db->get()->result_array(); } public function getMax_ID_TtKosong() { // Used $this->db->select_max('ID_TK'); $this->db->from('tt_kosong'); return $this->db->get()->result_array(); } public function getMax_ID_TtNota() { // Used $this->db->select_max('ID_TN'); $this->db->from('tt_nota'); return $this->db->get()->result_array(); } public function getMax_ID_UangMuka() { // Used $this->db->select_max('ID_UM'); $this->db->from('uang_muka'); return $this->db->get()->result_array(); } public function getMax_SJDPR_DaftarProyek_byPROYEK_CDNotNull($id) { // Used $this->db->select_max('SJ_DPR'); $this->db->from('daftar_proyek'); $this->db->where('PROYEK_ID=', $id); $this->db->where('CD_ID is NOT NULL'); return $this->db->get()->result_array(); } public function getMax_Urutan_DaftarKpi_byKARYAWAN_byPUM($id1, $id2) { // Used $this->db->select_max('URUTAN_DKPI'); $this->db->from('daftar_kpi'); $this->db->where('KARYAWAN_ID=', $id1); $this->db->where('PUM_ID=', $id2); return $this->db->get()->result_array(); } public function getMax_Urutan_DaftarPricelist($id) { // Used $this->db->select_max('URUTAN_DFPL'); $this->db->from('daftar_pricelist'); $this->db->where('SMPL_ID=', $id); return $this->db->get()->result_array(); } public function getMax_Urutan_SubmenuPricelist($id) { // Used $this->db->select_max('URUTAN_SMPL'); $this->db->from('submenu_pricelist'); $this->db->where('PRICELIST_ID=', $id); return $this->db->get()->result_array(); } // Daftar Fungsi getSum public function getSum_BiayaProyek_byPROYEK($id) { // Used $this->db->select('SUM(NILAI_BPRY) as TOTAL'); $this->db->from('biaya_proyek'); $this->db->where(['PROYEK_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_CreditNote_byRKPR($id1, $id2=null) { // Used $this->db->select('SUM(NILAI_CN) as TOTAL'); $this->db->from('creditnote'); $this->db->where(['RKPR_ID' => $id1]); if ($id2!=null) { $this->db->where('ID_CN!=', $id2); } return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byAKUNTANSI($id) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.AKUNTANSI_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byASBANK_byPERIODE($id, $awal, $akhir) { // Used $this->db->select('*,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.BANK_ID is NULL'); $this->db->where('a.AS_BANK=', $id); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byASKAS_byPERIODE($id, $awal, $akhir) { // Used $this->db->select('*,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.KAS_ID is NULL'); $this->db->where('a.AS_KAS=', $id); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull($id, $awal, $akhir) { // Used $this->db->select('*,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where("a.BANK_ID=$id AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.AS_KAS is NOT NULL"); $this->db->or_where("a.BANK_ID=$id AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.AS_BANK is NOT NULL"); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE($id1, $id2, $periode) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id2 AND a.BANK_ID=$id1 AND b.TGL_AKUNTANSI<=", $periode); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id2 AND a.AS_BANK=$id1 AND b.TGL_AKUNTANSI<=", $periode); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byKARYAWAN_byPERKIRAAN($id1, $id2) { // Used $this->db->select('SUM(DEBET_DAK) as DEBET,SUM(KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi'); $this->db->where(['KARYAWAN_ID' => $id1]); $this->db->where(['PERKIRAAN_ID' => $id2]); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byKAS_byPERKIRAAN_byPERIODE($id1, $id2, $periode) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id2 AND a.KAS_ID=$id1 AND b.TGL_AKUNTANSI<=", $periode); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id2 AND a.AS_KAS=$id1 AND b.TGL_AKUNTANSI<=", $periode); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byKAS_byPERIODE_asNotNull($id, $awal, $akhir) { // Used $this->db->select('*,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where("a.KAS_ID=$id AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.AS_KAS is NOT NULL"); $this->db->or_where("a.KAS_ID=$id AND b.TGL_AKUNTANSI>='$awal' AND b.TGL_AKUNTANSI<='$akhir' AND a.AS_BANK is NOT NULL"); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byMAINDPB($id) { // Used $this->db->select('SUM(KREDIT_DAK) as KREDIT,SUM(DEBET_DAK) as DEBET'); $this->db->from('daftar_akuntansi'); if ($id!=null) { $this->db->where(['MAIN_DPB' => $id]); } return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPELANGGAN_byPERKIRAAN($id1, $id2) { //Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PELANGGAN_ID' => $id1]); $this->db->where(['a.PERKIRAAN_ID' => $id2]); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($id1, $id2) { // Used $this->db->select('SUM(KREDIT_DAK) as KREDIT,SUM(DEBET_DAK) as DEBET'); $this->db->from('daftar_akuntansi'); $this->db->where(['PEMBELIAN_ID' => $id1]); $this->db->where(['PERKIRAAN_ID' => $id2]); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($id1, $id2) { // Used $this->db->select('SUM(DEBET_DAK) as DEBET,SUM(KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi'); $this->db->where(['PENJUALAN_ID' => $id1]); $this->db->where(['PERKIRAAN_ID' => $id2]); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN_beforeTGL($id1, $id2, $tgl) { // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PENJUALAN_ID' => $id1]); $this->db->where(['a.PERKIRAAN_ID' => $id2]); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL($id, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); $this->db->where('b.STATUS_AKUNTANSI>=1'); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byARAH_groupPELANGGAN_beforeTGL_belumLunas($id, $arah, $tgl){ // Used if ($arah=="DK") { $this->db->select('*, SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); } else if ($arah=="KD") { $this->db->select('*, SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT,SUM(a.KREDIT_DAK-a.DEBET_DAK) as TOTAL'); } $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.PERKIRAAN_ID=', $id); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); $this->db->group_by('a.PELANGGAN_ID'); $this->db->having('DEBET!=KREDIT'); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byARAH_groupSUPPLIER_beforeTGL_belumLunas($id, $arah, $tgl){ // Used if ($arah=="DK") { $this->db->select('*, SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); } else if ($arah=="KD") { $this->db->select('*, SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT,SUM(a.KREDIT_DAK-a.DEBET_DAK) as TOTAL'); } $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.PERKIRAAN_ID=', $id); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); $this->db->group_by('a.SUPPLIER_ID'); $this->db->having('DEBET!=KREDIT'); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_beforeTGL($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id1 AND a.BANK_ID=$id2 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI<=", $tgl); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id1 AND a.AS_BANK=$id2 AND b.STATUS_AKUNTANSI>=1 AND b.TGL_AKUNTANSI<=", $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id1 AND a.BANK_ID=$id2 AND b.TGL_AKUNTANSI<=", $tgl); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id1 AND a.AS_BANK=$id2 AND b.TGL_AKUNTANSI<=", $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_beforeTGL($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.KARYAWAN_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_dataNow($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.KARYAWAN_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byKAS_beforeTGL($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where("a.JENIS_DAK<=1 AND b.STATUS_AKUNTANSI>=1 AND a.PERKIRAAN_ID=$id1 AND a.KAS_ID=$id2 AND b.TGL_AKUNTANSI<=", $tgl); $this->db->or_where("a.JENIS_DAK=2 AND b.STATUS_AKUNTANSI>=1 AND a.PERKIRAAN_ID=$id1 AND a.AS_KAS=$id2 AND b.TGL_AKUNTANSI<=", $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byKAS_dataNow($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where("a.JENIS_DAK<=1 AND a.PERKIRAAN_ID=$id1 AND a.KAS_ID=$id2 AND b.TGL_AKUNTANSI<=", $tgl); $this->db->or_where("a.JENIS_DAK=2 AND a.PERKIRAAN_ID=$id1 AND a.AS_KAS=$id2 AND b.TGL_AKUNTANSI<=", $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE($id1, $id2, $awal, $akhir){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.KENDARAAN_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_beforeTGL($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.PELANGGAN_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byKOP_bySALES_forRincianPiutang($id_perkiraan, $id_pelanggan=null, $id_corp=null, $id_sales=null, $transaksi, $awal_nota, $akhir_nota, $awal_jt, $akhir_jt){ // Used $this->db->select('*, DATE_FORMAT(c.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL, SUM(a.DEBET_DAK) as DEBET, DATE_FORMAT(c.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO, SUM(a.KREDIT_DAK) as KREDIT, SUM(a.DEBET_DAK-a.KREDIT_DAK) as SUBTOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PEL_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('kop f','f.ID_KOP=c.KOP_ID'); $this->db->join('sales_order g','g.ID_SO=c.SO_ID','left'); $this->db->join('karyawan h','h.ID_KARYAWAN=g.SALES_ID','left'); $this->db->where('c.STATUS_PENJUALAN=1'); $this->db->where('a.PERKIRAAN_ID=', $id_perkiraan); if ($id_pelanggan!=null) { $this->db->where('c.PEL_ID=', $id_pelanggan); } if ($id_corp!=null) { $this->db->where('c.KOP_ID=', $id_corp); } if ($id_sales!=null) { $this->db->where('g.SALES_ID=', $id_sales); } $this->db->where('c.TGL_PENJUALAN>=', $awal_nota); $this->db->where('c.TGL_PENJUALAN<=', $akhir_nota); $this->db->where('b.TGL_AKUNTANSI<=', $akhir_nota); if ($awal_jt==$akhir_jt) { $this->db->where('c.TEMPO_PENJUALAN<=', $awal_jt); } else { $this->db->where('c.TEMPO_PENJUALAN>=', $awal_jt); $this->db->where('c.TEMPO_PENJUALAN<=', $akhir_jt); } $this->db->group_by('a.PENJUALAN_ID'); if ($transaksi==0) { $this->db->having('DEBET!=KREDIT'); } else if ($transaksi==1) { $this->db->having('DEBET=KREDIT'); } $this->db->order_by('d.NAMA_PELANGGAN ASC, h.NAMA_PANGGILAN_KARYAWAN ASC, c.KODE_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE($id1, $id2, $awal, $akhir){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.PELANGGAN_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forProyek($id1, $id2, $awal, $akhir){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('proyek c','c.ID_PROYEK=a.PROYEK_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('c.PELANGGAN_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI>=', $awal); $this->db->where('b.TGL_AKUNTANSI<=', $akhir); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_dataNow($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.PELANGGAN_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE($id, $start=null, $end=null, $spesifik=null) { // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id); if ($start!=null) { $this->db->where('b.TGL_AKUNTANSI>=', $start); } if ($end!=null) { $this->db->where('b.TGL_AKUNTANSI<=', $end); } if ($spesifik!=null) { $this->db->like('b.KODE_AKUNTANSI', $spesifik, 'after'); } return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_beforeTGL($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.PIHAKKE3_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_dataNow($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.PIHAKKE3_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_beforeTGL($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.SUPPLIER_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byKOP_forRincianHutang($id_perkiraan, $id_supplier=null, $id_corp=null, $transaksi, $awal_nota, $akhir_nota, $awal_jt, $akhir_jt){ // Used $this->db->select('*, DATE_FORMAT(c.TGL_INVBELI,"%d/%m/%Y") as TANGGAL, SUM(a.DEBET_DAK) as DEBET, DATE_FORMAT(c.TEMPO_INVBELI,"%d/%m/%Y") as TEMPO, SUM(a.KREDIT_DAK) as KREDIT, SUM(a.KREDIT_DAK-a.DEBET_DAK) as SUBTOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('pembelian c','c.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier d','d.ID_SUPPLIER=c.SUPPLIER_ID'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID'); $this->db->join('kop f','f.ID_KOP=c.CORP_ID'); $this->db->where('c.STATUS_PEMBELIAN=1'); $this->db->where('a.PERKIRAAN_ID=', $id_perkiraan); if ($id_supplier!=null) { $this->db->where('c.SUPPLIER_ID=', $id_supplier); } if ($id_corp!=null) { $this->db->where('c.CORP_ID=', $id_corp); } $this->db->where('c.TGL_INVBELI>=', $awal_nota); $this->db->where('c.TGL_INVBELI<=', $akhir_nota); $this->db->where('b.TGL_AKUNTANSI<=', $akhir_nota); if ($awal_jt==$akhir_jt) { $this->db->where('c.TEMPO_INVBELI<=', $awal_jt); } else { $this->db->where('c.TEMPO_INVBELI>=', $awal_jt); $this->db->where('c.TEMPO_INVBELI<=', $akhir_jt); } $this->db->group_by('a.PEMBELIAN_ID'); if ($transaksi==0) { $this->db->having('DEBET!=KREDIT'); } else if ($transaksi==1) { $this->db->having('DEBET=KREDIT'); } $this->db->order_by('d.NAMA_SUPPLIER ASC, c.KODE_PEMBELIAN ASC'); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_dataNow($id1, $id2, $tgl){ // Used $this->db->select('SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where('a.PERKIRAAN_ID=', $id1); $this->db->where('a.SUPPLIER_ID=', $id2); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_groupKARYAWAN($id) { // Used $this->db->select('*,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->where('a.PERKIRAAN_ID=', $id); $this->db->having('TOTAL>0'); $this->db->group_by('a.KARYAWAN_ID'); $this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_groupKARYAWAN_beforeTGL_belumLunas($id, $tgl){ // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID'); $this->db->join('jabatan d','d.ID_JABATAN=c.JABATAN_ID'); $this->db->where('a.PERKIRAAN_ID=', $id); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); $this->db->group_by('a.KARYAWAN_ID'); $this->db->having('DEBET!=KREDIT'); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_groupPIHAKKE3($id) { // Used $this->db->select('*,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL,FORMAT(SUM(a.DEBET_DAK-a.KREDIT_DAK),2) as SISA'); $this->db->from('daftar_akuntansi a'); $this->db->join('pihakke3 b','b.ID_PIHAKKE3=a.PIHAKKE3_ID'); $this->db->where('a.PERKIRAAN_ID=', $id); $this->db->having('TOTAL>0'); $this->db->group_by('a.PIHAKKE3_ID'); $this->db->order_by('b.NAMA_PIHAKKE3 ASC'); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPERKIRAAN_groupPIHAKKE3_beforeTGL_belumLunas($id, $tgl){ // Used $this->db->select('*, SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT,SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('pihakke3 c','c.ID_PIHAKKE3=a.PIHAKKE3_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('a.PERKIRAAN_ID=', $id); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); $this->db->group_by('a.PIHAKKE3_ID'); $this->db->having('DEBET!=KREDIT'); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPROYEK_byPERKIRAAN($id1, $id2) { // Used $this->db->select('*,DATE_FORMAT(b.TGL_AKUNTANSI,"%d/%m/%Y") as TANGGAL,SUM(a.DEBET_DAK) as DEBET,SUM(a.KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->where(['a.PROYEK_ID' => $id1]); $this->db->where(['a.PERKIRAAN_ID' => $id2]); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_byPIHAKKE3_byPERKIRAAN($id1, $id2) { // Used $this->db->select('SUM(DEBET_DAK) as DEBET,SUM(KREDIT_DAK) as KREDIT'); $this->db->from('daftar_akuntansi'); $this->db->where(['PIHAKKE3_ID' => $id1]); $this->db->where(['PERKIRAAN_ID' => $id2]); return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_bySALES_BelumLunasOnly($id, $awal, $akhir) { // Used $this->db->select('SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('b.STATUS_PENJUALAN=1'); $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); if ($id!=1) { $this->db->where('c.SALES_ID=', $id); } return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_bySALES_BrutoOnly($id, $awal, $akhir) { // Used $this->db->select('SUM(a.DEBET_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('a.JENIS_PDA=0'); $this->db->where('b.STATUS_PENJUALAN=1'); $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); if ($id!=1) { $this->db->where('c.SALES_ID=', $id); } return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_bySALES_ReturOnly($id, $awal, $akhir) { // Used $this->db->select('SUM(a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('akuntansi b','b.ID_AKUNTANSI=a.AKUNTANSI_ID'); $this->db->join('retur_penjualan c','c.KODE_RJ=b.KODE_AKUNTANSI'); $this->db->join('penjualan d','d.ID_PENJUALAN=c.PENJUALAN_ID'); $this->db->join('sales_order e','e.ID_SO=d.SO_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('a.JENIS_PDA=2'); $this->db->where('c.STATUS_RJ=1'); $this->db->where('c.TGL_INPUT>=', $awal); $this->db->where('c.TGL_INPUT<=', $akhir); if ($id!=1) { $this->db->where('e.SALES_ID=', $id); } return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_bySALES_TahunBeforeOnly($id) { // Used $yearNow = date('Y'); $yearBefore = $yearNow-1; $awal = date("$yearBefore-01-01"); $now = date('Y-01-01'); $akhir = $this->generate_subDay($now, 1); $this->db->select('SUM(a.DEBET_DAK-a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('b.STATUS_PENJUALAN=1'); $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); if ($id!=1) { $this->db->where('c.SALES_ID=', $id); } return $this->db->get()->result_array(); } public function getSum_DaftarAkuntansi_bySALES_TerbayarOnly($id, $awal, $akhir) { // Used $this->db->select('SUM(a.KREDIT_DAK) as TOTAL'); $this->db->from('daftar_akuntansi a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->where('a.PERKIRAAN_ID=3'); $this->db->where('a.JENIS_PDA=1'); $this->db->where('b.STATUS_PENJUALAN=1'); $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); if ($id!=1) { $this->db->where('c.SALES_ID=', $id); } return $this->db->get()->result_array(); } public function getSum_DaftarBeli_byID($id) { // Used $this->db->select('SUM(HARGA_DB*QTY_DB) as TOTAL'); $this->db->from('daftar_beli'); $this->db->where(['ID_DB' => $id]); return $this->db->get()->result_array(); } public function getSum_DaftarBeli_byPEMBELIAN($id) { // Used $this->db->select('SUM(HARGA_DB*QTY_DB) as TOTAL'); $this->db->from('daftar_beli'); $this->db->where(['PEMBELIAN_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_DaftarBeli_byPEMBELIAN_byBARANG($id1, $id2) { // Used $this->db->select('SUM(a.QTY_DB-a.RETUR_DB) as TOTAL'); $this->db->from('daftar_beli a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where(['a.PEMBELIAN_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getSum_DaftarFormKaryawan_byFK($id) { // Used $this->db->select('SUM(NILAI_DFFK) as TOTAL'); $this->db->from('daftar_formkaryawan'); $this->db->where('FK_ID=', $id); return $this->db->get()->result_array(); } public function getSum_DaftarKlaimProgram_byKPR($id) { // Used $this->db->select('SUM(QTY_DKPR) as TOTAL'); $this->db->from('daftar_klaimprogram'); $this->db->where('KPR_ID=', $id); return $this->db->get()->result_array(); } public function getSum_DaftarKonsi_byPELANGGAN_byBARANG_byJENIS($id1, $id2, $id3) { // Used $this->db->select('SUM(a.QTY_DFK-a.KEMBALI_DFK) as TOTAL'); $this->db->from('daftar_konsi a'); $this->db->join('konsinyasi b','b.ID_KONSINYASI=a.KONSINYASI_ID'); $this->db->where(['b.PELANGGAN_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); $this->db->where(['b.JENIS_KONSINYASI' => $id3]); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getSum_DaftarKpi_byKARYAWAN_byKPI_byTAHUN($id, $kpi, $pum) { // Used $this->db->select('SUM(a.TARGET_DKPI) as TARGET'); $this->db->from('daftar_kpi a'); $this->db->join('periode_umum b','b.ID_PUM=a.PUM_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.KPI_ID=', $kpi); $this->db->where('b.TAHUN_PUM=', $pum); return $this->db->get()->result_array(); } public function getSum_DaftarKpi_byKARYAWAN_byPUM($id, $pum, $specific=null) { // Used $this->db->select('SUM(BOBOT_DKPI) as TOTAL'); $this->db->from('daftar_kpi'); $this->db->where('KARYAWAN_ID=', $id); $this->db->where('PUM_ID=', $pum); if ($specific!=null) { $this->db->where('ID_DKPI!=', $specific); } return $this->db->get()->result_array(); } public function getSum_DaftarKpi_byTIM_byKPI_byTAHUN($id, $kpi, $pum) { // Used $this->db->select('SUM(a.TARGET_DKPI) as TARGET'); $this->db->from('daftar_kpi a'); $this->db->join('periode_umum b','b.ID_PUM=a.PUM_ID'); $this->db->where('a.TIM_ID=', $id); $this->db->where('a.KPI_ID=', $kpi); $this->db->where('b.TAHUN_PUM=', $pum); return $this->db->get()->result_array(); } public function getSum_DaftarNotaBebas_byNB($id) { // Used $this->db->select('SUM(HARGA_DNB*QTY_DNB) as TOTAL'); $this->db->from('daftar_notabebas'); $this->db->where(['NB_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_DaftarOrder_byBARANG_status0_2_3($id) { // Used $this->db->select('SUM(a.QTY_DO) as TOTAL'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->where('b.STATUS_SO=0 AND a.BARANG_ID=', $id); $this->db->or_where('b.STATUS_SO=2 AND a.BARANG_ID=', $id); $this->db->or_where('b.STATUS_SO=3 AND a.BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getSum_DaftarOrder_byBARANG_status0_3($id) { // Used $this->db->select('SUM(a.QTY_DO) as TOTAL'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->where('b.STATUS_SO=0 AND a.BARANG_ID=', $id); $this->db->or_where('b.STATUS_SO=3 AND a.BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getSum_DaftarOrder_byPELANGGAN_status0_2_3($id1, $id2=null) { // Used $this->db->select('SUM(((b.PPN_SO+100)/100)*(a.HARGA_DO*a.QTY_DO)) as TOTAL'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->where("b.STATUS_SO=0 AND b.PELANGGAN_ID=$id1 AND a.SO_ID!=$id2"); $this->db->or_where("b.STATUS_SO=2 AND b.PELANGGAN_ID=$id1 AND a.SO_ID!=$id2"); $this->db->or_where("b.STATUS_SO=3 AND b.PELANGGAN_ID=$id1 AND a.SO_ID!=$id2"); return $this->db->get()->result_array(); } public function getSum_DaftarOrder_byPENJUALAN($id) { // Used $this->db->select('SUM(a.HARGA_DO*a.QTY_DO) as TOTAL, SUM(a.HARGA_DO*(a.QTY_DO-a.RETUR_DO)) as ALLTOTAL'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->join('sales_order d','d.ID_SO=a.SO_ID'); $this->db->join('penjualan e','e.SO_ID=a.SO_ID'); $this->db->where(['e.ID_PENJUALAN' => $id]); return $this->db->get()->result_array(); } public function getSum_DaftarOrder_byPENJUALAN_byBARANG($id1, $id2) { // Used $this->db->select('SUM(a.QTY_DO-a.RETUR_DO) as TOTAL'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('penjualan c','c.SO_ID=b.ID_SO'); $this->db->where(['c.ID_PENJUALAN' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getSum_DaftarOrder_bySO($id1, $id2=null) { // Used $this->db->select('SUM(a.HARGA_DO*a.QTY_DO) as TOTAL'); $this->db->from('daftar_order a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID'); $this->db->where(['a.SO_ID' => $id1]); if ($id2!=null) { $this->db->where('a.ID_DO!=', $id2); } return $this->db->get()->result_array(); } public function getSum_DaftarPenawaran_byPENAWARAN_byVERSI($id, $versi) { // Used $this->db->select('SUM(HARGA_DPNE*QTY_DPNE) as TOTAL'); $this->db->from('daftar_penawaran'); $this->db->where(['PENAWARAN_ID' => $id]); $this->db->where(['VERSI_DPNE' => $versi]); return $this->db->get()->result_array(); } public function getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($id, $versi, $sales) { // Used $this->db->select('ROUND(SUM(a.HARGA_DPNE*a.QTY_DPNE)*((b.PPN_PENAWARAN+100)/100),2) as TOTAL'); $this->db->from('daftar_penawaran a'); $this->db->join('penawaran b','b.ID_PENAWARAN=a.PENAWARAN_ID'); $this->db->where(['a.PENAWARAN_ID' => $id]); $this->db->where(['a.VERSI_DPNE' => $versi]); $this->db->where(['a.SAL_ID' => $sales]); return $this->db->get()->result_array(); } public function getSum_DaftarPenawaran_byPENAWARAN_byVERSI_groupSALES($id, $versi) { // Used $this->db->select('*, ROUND(SUM(a.HARGA_DPNE*a.QTY_DPNE)*((b.PPN_PENAWARAN+100)/100),2) as TOTAL'); $this->db->from('daftar_penawaran a'); $this->db->join('penawaran b','b.ID_PENAWARAN=a.PENAWARAN_ID'); $this->db->join('karyawan c','c.ID_KARYAWAN=a.SAL_ID'); $this->db->where(['a.PENAWARAN_ID' => $id]); $this->db->where(['a.VERSI_DPNE' => $versi]); $this->db->group_by('a.SAL_ID'); return $this->db->get()->result_array(); } public function getSum_DaftarPengadaan_byPENGADAAN($id) { // Used $this->db->select('SUM(DISKON_DPG*QTY_DPG) as TOTDISKON'); $this->db->from('daftar_pengadaan'); $this->db->where(['PENGADAAN_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_DaftarProforma_byPF($id) { // Used $this->db->select('SUM(HARGA_DPF*QTY_DPF) as TOTAL'); $this->db->from('daftar_proforma'); $this->db->where(['PF_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_DaftarProyek_byPROYEK_groupBARANG($id) { // Used $this->db->select('a.BARANG_ID,SUM(a.KELUAR_DPR) as KELUAR,SUM(a.MASUK_DPR) as MASUK,SUM(a.KELUAR_DPR-a.MASUK_DPR) as SISA,c.*,d.*'); $this->db->from('daftar_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.PROYEK_ID' => $id]); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getSum_DaftarProyek_byPROYEK_groupBARANG_CDNotNull($id) { // Used $this->db->select('a.BARANG_ID, SUM(a.KELUAR_DPR) as KELUAR, SUM(a.MASUK_DPR) as MASUK, SUM(a.KELUAR_DPR-a.MASUK_DPR) as SISA, b.*, c.*'); $this->db->from('daftar_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where(['a.PROYEK_ID' => $id]); $this->db->where('a.CD_ID is NOT NULL'); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getSum_DaftarProyek_byPROYEK_groupBARANG_CDNotNull_groupRP($id) { // Used $this->db->select('a.BARANG_ID, SUM(a.KELUAR_DPR) as KELUAR, SUM(a.MASUK_DPR) as MASUK, SUM(a.KELUAR_DPR-a.MASUK_DPR) as SISA, b.*, c.*, e.*'); $this->db->from('daftar_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->join('rekap_proyek e','e.ID_RP=a.RP_ID_DPR'); $this->db->where(['a.PROYEK_ID' => $id]); $this->db->where('a.CD_ID is NOT NULL'); $this->db->group_by('a.RP_ID_DPR, a.BARANG_ID'); return $this->db->get()->result_array(); } public function getSum_DaftarReturBeli_byRB($id) { // Used $this->db->select('SUM(HARGA_DRB*QTY_DRB) as TOTAL'); $this->db->from('daftar_returbeli'); $this->db->where(['RB_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($id, $awal, $akhir) { // Used $this->db->select('SUM((a.QTY_DRJ*a.HARGA_DRJ)*((d.PPN_SO+100)/100)) as TOTAL'); $this->db->from('daftar_returjual a'); $this->db->join('retur_penjualan b','b.ID_RJ=a.RJ_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=b.PENJUALAN_ID'); $this->db->join('sales_order d','d.ID_SO=c.SO_ID'); $this->db->where(['d.SALES_ID' => $id]); $this->db->where('b.TGL_INPUT>=', $awal); $this->db->where('b.TGL_INPUT<=', $akhir); $this->db->where('b.STATUS_RJ=1'); return $this->db->get()->result_array(); } public function getSum_DaftarReturJual_byPELANGGAN_byAWAL_byAKHIR_status1($id, $awal, $akhir) { // Used $this->db->select('SUM((a.QTY_DRJ*a.HARGA_DRJ)*((d.PPN_SO+100)/100)) as TOTAL'); $this->db->from('daftar_returjual a'); $this->db->join('retur_penjualan b','b.ID_RJ=a.RJ_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=b.PENJUALAN_ID'); $this->db->join('sales_order d','d.ID_SO=c.SO_ID'); $this->db->where(['c.PEL_ID' => $id]); $this->db->where('b.TGL_INPUT>=', $awal); $this->db->where('b.TGL_INPUT<=', $akhir); $this->db->where('b.STATUS_RJ=1'); return $this->db->get()->result_array(); } public function getSum_DaftarReturJual_byRJ($id) { // Used $this->db->select('SUM(a.QTY_DRJ*a.HARGA_DRJ) as TOTAL'); $this->db->from('daftar_returjual a'); $this->db->join('retur_penjualan b','b.ID_RJ=a.RJ_ID'); $this->db->where(['a.RJ_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_DaftarSjParsial_bySO_byBARANG($id1, $id2){ // Used $this->db->select('SUM(QTY_SJP) as QTY'); $this->db->from('daftar_sjparsial'); $this->db->where('SO_ID=', $id1); $this->db->where('BARANG_ID=', $id2); return $this->db->get()->result_array(); } public function getSum_DaftarSjParsial_bySO_byDO($id1, $id2){ // Used $this->db->select('SUM(QTY_SJP) as QTY'); $this->db->from('daftar_sjparsial'); $this->db->where('SO_ID=', $id1); $this->db->where('DO_ID=', $id2); return $this->db->get()->result_array(); } public function getSum_DaftarService_byBARANG_byJENIS($id1, $id2) { // Used $this->db->select('SUM(a.QTY_DFS-a.KEMBALI_DFS) as TOTAL'); $this->db->from('daftar_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->where(['a.BARANG_ID' => $id1]); $this->db->where(['b.JENIS_SERVICE' => $id2]); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getSum_DaftarSewa_byPELANGGAN_byBARANG($id1, $id2) { // Used $this->db->select('SUM(a.QTY_DFSW-a.KEMBALI_DFSW) as TOTAL'); $this->db->from('daftar_sewa a'); $this->db->join('sewa b','b.ID_SEWA=a.SEWA_ID'); $this->db->where(['b.PELANGGAN_ID' => $id1]); $this->db->where(['a.BARANG_ID' => $id2]); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getSum_DetailPengadaanMix_byDPG($id) { // Used $this->db->select('SUM(QTY_DPMX) as TOTAL'); $this->db->from('detail_pengadaan_mix'); $this->db->where('DPG_ID=', $id); return $this->db->get()->result_array(); } public function getSum_DetailPengadaanMix_byPENGADAAN($id) { // Used $this->db->select('a.DPG_ID, b.QTY_DPG, SUM(QTY_DPMX) as TOTAL'); $this->db->from('detail_pengadaan_mix a'); $this->db->join('daftar_pengadaan b','b.ID_DPG=a.DPG_ID'); $this->db->where('b.PENGADAAN_ID=', $id); $this->db->group_by('a.DPG_ID'); return $this->db->get()->result_array(); } public function getSum_FeeSO_byRP($id) { // Used $this->db->select('SUM(c.FEE_SO) as TOTAL'); $this->db->from('so_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->where(['b.RP_ID' => $id]); $this->db->group_by('b.RP_ID'); return $this->db->get()->result_array(); } public function getSum_HasilHitungHda_bySUPPLIER_byTEMPO_forHutangDagang($id, $tempo) { // Used $this->db->select('*,SUM(a.KREDIT_HHHDA-a.DEBET_HHHDA) as TOTAL,DATE_FORMAT(b.TEMPO_INVBELI,"%d/%m/%Y") as TEMPO'); $this->db->from('hasil_hitunghda a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->where('a.SUPPLIER_ID=', $id); $this->db->where('b.TEMPO_INVBELI<=', $tempo); $this->db->group_by('b.INV_PEMBELIAN'); $this->db->having('TOTAL>0'); return $this->db->get()->result_array(); } public function getSum_HasilHitungHda_Pendapatan($bawah, $atas) { // Used $this->db->select('*,SUM(a.KREDIT_HHHDA-a.DEBET_HHHDA) as SISA'); $this->db->from('hasil_hitunghda a'); $this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID'); $this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID'); $this->db->group_by('a.PEMBELIAN_ID'); $this->db->having("SISA>$bawah AND SISA<$atas"); return $this->db->get()->result_array(); } public function getSum_HasilHitungPda_BebanSelisih($bawah, $atas) { // Used $this->db->select('*,SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA) as SISA'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->group_by('a.PENJUALAN_ID'); $this->db->having("SISA>$bawah AND SISA<$atas"); return $this->db->get()->result_array(); } public function getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($id=null, $awal, $akhir) { // Used $this->db->select('SUM(a.DEBET_HHPDA) as TOTAL'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=c.SALES_ID'); if ($id!=null) { $this->db->where('c.SALES_ID=', $id); } else { $this->db->not_like('d.NAMA_PANGGILAN_KARYAWAN', 'None'); $this->db->not_like('d.NAMA_PANGGILAN_KARYAWAN', 'Insentive'); } $this->db->where('b.TGL_PENJUALAN>=', $awal); $this->db->where('b.TGL_PENJUALAN<=', $akhir); $this->db->where('b.STATUS_PENJUALAN=1'); return $this->db->get()->result_array(); } public function getSum_HasilHitungPda_byKARYAWAN_byPERIODE_status1($id=null, $limit) { // Used $this->db->select('SUM(a.DEBET_HHPDA) as TOTAL'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->join('karyawan d','d.ID_KARYAWAN=c.SALES_ID'); if ($id!=null) { $this->db->where('c.SALES_ID=', $id); } else { $this->db->not_like('d.NAMA_PANGGILAN_KARYAWAN', 'None'); $this->db->not_like('d.NAMA_PANGGILAN_KARYAWAN', 'Insentive'); } $this->db->where('b.TGL_PENJUALAN>=', $limit); $this->db->where('b.STATUS_PENJUALAN=1'); return $this->db->get()->result_array(); } public function getSum_HasilHitungPda_byKELOMPOK_belumLunasOnly($id=null, $mode=null) { // Used $now = date('Y-m-d'); $this->db->select('SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA) as SISA'); $this->db->from('hasil_hitungpda a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID'); if ($id!=null) { if ($mode==1) { $limit = $this->generate_addDay($now, 3); $this->db->where('b.KELOMPOK_ID=', $id); $this->db->where('c.TEMPO_PENJUALAN>=', $now); $this->db->where('c.TEMPO_PENJUALAN<=', $limit); } else if ($mode==2) { $this->db->where('a.CORP_ID=0 AND b.KELOMPOK_ID=', $id); } else if ($mode==3) { $this->db->where('a.CORP_ID>0'); $this->db->where('b.KELOMPOK_ID=', $id); $this->db->where('c.TEMPO_PENJUALAN<=', $now); } else if ($mode==4) { $this->db->where('a.CORP_ID>0'); $this->db->where('b.KELOMPOK_ID=', $id); $this->db->where('c.TEMPO_PENJUALAN>', $now); } else if ($mode==5) { $this->db->where('b.KELOMPOK_ID=', $id); } } else { if ($mode==1) { $limit = $this->generate_addDay($now, 3); $this->db->where('c.TEMPO_PENJUALAN>=', $now); $this->db->where('c.TEMPO_PENJUALAN<=', $limit); } else if ($mode==2) { $this->db->where('a.CORP_ID=0'); } else if ($mode==3) { $this->db->where('a.CORP_ID>0'); $this->db->where('c.TEMPO_PENJUALAN<=', $now); } else if ($mode==4) { $this->db->where('a.CORP_ID>0'); $this->db->where('c.TEMPO_PENJUALAN>', $now); } } $this->db->having('SISA>0'); return $this->db->get()->result_array(); } public function getSum_HasilHitungPda_byPELANGGAN($id) { // Used $this->db->select('SUM(DEBET_HHPDA) as DEBET,SUM(KREDIT_HHPDA) as KREDIT'); $this->db->from('hasil_hitungpda'); $this->db->where('PELANGGAN_ID=', $id); $this->db->group_by('PELANGGAN_ID'); return $this->db->get()->result_array(); } public function getSum_HasilHitungPda_byPELANGGAN_bySALES_byTEMPO_forPiutangDagang($id, $sales, $tempo) { // Used $this->db->select('*,SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA) as TOTAL,FORMAT(SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA),2) as SELISIH,DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID','left'); $this->db->join('karyawan d','d.ID_KARYAWAN=c.SALES_ID','left'); $this->db->where('a.PELANGGAN_ID=', $id); if ($sales!=0) { $this->db->where('c.SALES_ID=', $sales); } $this->db->where('b.TEMPO_PENJUALAN<=', $tempo); $this->db->group_by('b.INV_PENJUALAN'); $this->db->order_by('b.TGL_PENJUALAN ASC'); $this->db->having('TOTAL>0'); return $this->db->get()->result_array(); } public function getSum_HasilHitungPda_byPELANGGAN_byTEMPO_forPiutangDagang($id, $tempo, $mode=null) { // Used $this->db->select('*,SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA) as TOTAL,FORMAT(SUM(a.DEBET_HHPDA-a.KREDIT_HHPDA),2) as SELISIH,DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO'); $this->db->from('hasil_hitungpda a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID','left'); $this->db->join('karyawan d','d.ID_KARYAWAN=c.SALES_ID','left'); $this->db->join('kop e','e.ID_KOP=a.CORP_ID','left'); $this->db->where('a.PELANGGAN_ID=', $id); if ($mode==1) { $limit = $this->generate_addDay($tempo, 3); $this->db->where('b.TEMPO_PENJUALAN>=', $tempo); $this->db->where('b.TEMPO_PENJUALAN<=', $limit); } else if ($mode==2 OR $mode==3 OR $mode==5) { $this->db->where('b.TEMPO_PENJUALAN<=', $tempo); } else if ($mode==4) { $this->db->where('b.TEMPO_PENJUALAN>', $tempo); } $this->db->group_by('b.INV_PENJUALAN'); $this->db->having('TOTAL>0'); return $this->db->get()->result_array(); } public function getSum_HasilHitungTb_byYEAR_notC_notD($id) { // Used $this->db->select('*, SUM(NILAI_HHTB) as NILAI'); $this->db->from('hasil_hitungtb a'); $this->db->join('periode_akuntansi b','b.ID_PAK=a.PAK_ID'); $this->db->like('b.AWAL_PAK', $id); $this->db->not_like('a.KOLOM_HHTB', 'C', 'none'); $this->db->not_like('a.KOLOM_HHTB', 'D', 'none'); $this->db->group_by('a.AKUN_HHTB, a.KOLOM_HHTB'); return $this->db->get()->result_array(); } public function getSum_HistoriKuantiti_groupBARANG_beforeTGL_morethan0($tgl, $textSearch=null) { // Used $this->db->select('a.BARANG_ID, SUM(a.MASUK_HQ-a.KELUAR_HQ) as SISA, b.KODE_BARANG, b.NAMA_BARANG, c.*'); $this->db->from('histori_kuantiti a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.BARANG_ID'); $this->db->where('a.TGL_HQ<=', $tgl); if ($textSearch!=null) { $this->db->like('b.KODE_BARANG', $textSearch); } $this->db->group_by('a.BARANG_ID'); $this->db->order_by('b.KODE_BARANG ASC'); $this->db->having('SISA>0'); return $this->db->get()->result_array(); } public function getSum_HistoriOtomasiBooster_byOB($id) { // Used $this->db->select('SUM(b.NILAI_LKPR) as TOTAL'); $this->db->from('histori_otomasibooster a'); $this->db->join('link_klaimprogram b','b.ID_LKPR=a.LKPR_ID'); $this->db->where('a.OB_ID=', $id); return $this->db->get()->result_array(); } public function getSum_Kuantiti_moreThan0() { // Used $this->db->select('SUM(PERSEDIAAN_KUANTITI) as TOTAL'); $this->db->from('kuantiti'); $this->db->where('GLOBAL_KUANTITI>0'); return $this->db->get()->result_array(); } public function getSum_LinkKlaimProgram_byBARANG_byPROGRAM($id1, $id2) { // Used $this->db->select('SUM(a.NILAI_LKPR) as TOTAL'); $this->db->from('link_klaimprogram a'); $this->db->join('sn_klaimprogram b','b.ID_SNKPR=a.SNKPR_ID'); $this->db->join('klaim_program c','c.ID_KPR=b.KPR_ID'); $this->db->where('c.BARANG_ID=', $id1); $this->db->where('a.PROGRAM_ID=', $id2); return $this->db->get()->result_array(); } public function getSum_LinkKlaimProgram_byKPR_byPROGRAM_bySTATUS($id_kpr, $id_program, $status) { // Used $this->db->select('SUM(a.NILAI_LKPR) as TOTAL'); $this->db->from('link_klaimprogram a'); $this->db->join('sn_klaimprogram b','b.ID_SNKPR=a.SNKPR_ID'); $this->db->where('b.KPR_ID=', $id_kpr); $this->db->where('a.PROGRAM_ID=', $id_program); $this->db->where('b.STATUS_SNKPR=', $status); return $this->db->get()->result_array(); } public function getSum_LinkKlaimProgram_byPKPR_byMERK_byPRODUK_RKPRNull($id1, $id2, $id3) { // Used $this->db->select('SUM(a.NILAI_LKPR) as TOTAL'); $this->db->from('link_klaimprogram a'); $this->db->join('sn_klaimprogram b','b.ID_SNKPR=a.SNKPR_ID'); $this->db->join('klaim_program c','c.ID_KPR=b.KPR_ID'); $this->db->join('barang d','d.ID_BARANG=c.BARANG_ID'); $this->db->where('a.PKPR_ID=', $id1); $this->db->where('d.MERK_ID=', $id2); $this->db->where('d.PRODUK_ID=', $id3); $this->db->where('c.STATUS_KPR!=9'); $this->db->where('a.RKPR_ID is NULL'); return $this->db->get()->result_array(); } public function getSum_LinkKlaimProgram_bySNKPR($id) { // Used $this->db->select('SUM(a.NILAI_LKPR) as TOTAL'); $this->db->from('link_klaimprogram a'); $this->db->join('potongan_klaimprogram b','b.ID_PKPR=a.PKPR_ID'); $this->db->where('a.SNKPR_ID=', $id); return $this->db->get()->result_array(); } public function getSum_Penjualan_byKOP_byPELANGGAN_bySALES_byMODE_byPERIODE_groupKOP_groupPELANGGAN($id1, $id2, $id3, $id4, $awal, $akhir, $search=null) { // Used $this->db->select('*, SUM(b.NILAI_SO) as NILAI, FORMAT(SUM(b.NILAI_SO),2) as TOTNILAI'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=a.PEL_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('karyawan e','e.ID_KARYAWAN=b.SALES_ID'); if ($search!=NULL) { if ($id1==NULL AND $id2==NULL AND $id3==NULL) { $this->db->where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id1!=NULL AND $id2==NULL AND $id3==NULL) { $this->db->where("a.KOP_ID=$id1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.KOP_ID=$id1 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id1==NULL AND $id2!=NULL AND $id3==NULL) { $this->db->where("a.PEL_ID=$id2 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PEL_ID=$id2 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id1==NULL AND $id2==NULL AND $id3!=NULL) { $this->db->where("b.SALES_ID=$id3 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("b.SALES_ID=$id3 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id1!=NULL AND $id2!=NULL AND $id3==NULL) { $this->db->where("a.KOP_ID=$id1 AND a.PEL_ID=$id2 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.KOP_ID=$id1 AND a.PEL_ID=$id2 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id1!=NULL AND $id2==NULL AND $id3!=NULL) { $this->db->where("a.KOP_ID=$id1 AND b.SALES_ID=$id3 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.KOP_ID=$id1 AND b.SALES_ID=$id3 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id1==NULL AND $id2!=NULL AND $id3!=NULL) { $this->db->where("a.PEL_ID=$id2 AND b.SALES_ID=$id3 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.PEL_ID=$id2 AND b.SALES_ID=$id3 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.NAMA_KOTA LIKE '%$search%'"); } else if ($id1!=NULL AND $id2!=NULL AND $id3!=NULL) { $this->db->where("a.KOP_ID=$id1 AND a.PEL_ID=$id2 AND b.SALES_ID=$id3 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND c.NAMA_PELANGGAN LIKE '%$search%'"); $this->db->or_where("a.KOP_ID=$id1 AND a.PEL_ID=$id2 AND b.SALES_ID=$id3 AND a.TGL_PENJUALAN>='$awal' AND a.TGL_PENJUALAN<='$akhir' AND a.STATUS_PENJUALAN=1 AND d.NAMA_KOTA LIKE '%$search%'"); } } else { $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); if ($id1!=NULL) { $this->db->where(['a.KOP_ID' => $id1]); } if ($id2!=NULL) { $this->db->where(['a.PEL_ID' => $id2]); } if ($id3!=NULL) { $this->db->where(['b.SALES_ID' => $id3]); } } if ($id4==1) { $this->db->not_like('c.NAMA_PELANGGAN','LOUIS (ANAK P. SUGENG)'); $this->db->not_like('e.NAMA_PANGGILAN_KARYAWAN','Insentive'); $this->db->not_like('e.NAMA_PANGGILAN_KARYAWAN','Louis'); $this->db->not_like('e.NAMA_PANGGILAN_KARYAWAN','None'); $this->db->not_like('e.NAMA_PANGGILAN_KARYAWAN','Service'); $this->db->not_like('e.NAMA_PANGGILAN_KARYAWAN','Sugeng'); $this->db->not_like('e.NAMA_PANGGILAN_KARYAWAN','Zaidan'); $this->db->not_like('e.NAMA_PANGGILAN_KARYAWAN','Olla'); } $this->db->group_by('a.PEL_ID'); $this->db->order_by('NILAI DESC, c.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getSum_Proyek_byRP($id) { // Used $this->db->select('SUM(BIAYA_PROYEK) as BIAYA, SUM(GP_PROYEK) as GP'); $this->db->from('proyek'); $this->db->where(['RP_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_Proyek_bySALES_byPERIODE_status12($id, $awal, $akhir) { // Used $this->db->select('SUM(GP_PROYEK) as GP'); $this->db->from('proyek'); $this->db->where('STATUS_PROYEK>=1 AND STATUS_PROYEK<=2'); $this->db->where('TGL_PROSES>=', $awal); $this->db->where('TGL_PROSES<=', $akhir); $this->db->where(['SALES_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_SoProyek_byPROYEK($id) { // Used $this->db->select('SUM(c.HARGA_DO*c.QTY_DO) as NILAI'); $this->db->from('so_proyek a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('daftar_order c','c.SO_ID=a.SO_ID'); $this->db->where(['a.PROYEK_ID' => $id]); $this->db->group_by('a.PROYEK_ID'); return $this->db->get()->result_array(); } public function getSum_SoProyek_byPROYEK_forFEE($id) { // Used $this->db->select('SUM(b.FEE_SO) as FEE'); $this->db->from('so_proyek a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->where(['a.PROYEK_ID' => $id]); $this->db->group_by('a.PROYEK_ID'); return $this->db->get()->result_array(); } public function getSum_SoProyek_byRP($id) { // Used $this->db->select('SUM(d.HARGA_DO*d.QTY_DO) as TOTAL'); $this->db->from('so_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('sales_order c','c.ID_SO=a.SO_ID'); $this->db->join('daftar_order d','d.SO_ID=a.SO_ID'); $this->db->where(['b.RP_ID' => $id]); $this->db->group_by('b.RP_ID'); return $this->db->get()->result_array(); } public function getSum_SoProyek_bySO($id) { // Used $this->db->select('(SUM(c.HARGA_DO*c.QTY_DO)-b.FEE_SO) as TOTAL, SUM(c.HARGA_DO*c.QTY_DO) as NILAI, b.FEE_SO as FEE'); $this->db->from('so_proyek a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('daftar_order c','c.SO_ID=a.SO_ID'); $this->db->where(['a.SO_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_StokAntik_byJENIS_bySTATUS_groupBARANG($id, $status) { // Used $this->db->select('*, SUM(a.QTY_SA) as TOTAL, DATE_FORMAT(a.TGL_SA,"%d/%m/%Y") as TANGGAL'); $this->db->from('stok_antik a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where('a.JENIS_SA=', $id); $this->db->where('a.STATUS_SA=', $status); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } public function getSum_StokAntik_byBARANG_byJENIS_bySTATUS_groupBARANG($id1, $id2, $status) { // Used $this->db->select('*, SUM(a.QTY_SA) as TOTAL, DATE_FORMAT(a.TGL_SA,"%d/%m/%Y") as TANGGAL'); $this->db->from('stok_antik a'); $this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID'); $this->db->where('a.BARANG_ID=', $id1); $this->db->where('a.JENIS_SA=', $id2); $this->db->where('a.STATUS_SA=', $status); $this->db->group_by('a.BARANG_ID'); return $this->db->get()->result_array(); } } ?>