db->insert($table, $data); }else{ $insert = $this->db->insert_batch($table, $data); } return $insert; } public function update($table, $data, $pk, $id = null, $batch = false) { if($batch === false){ $insert = $this->db->update($table, $data, array($pk => $id)); }else{ $insert = $this->db->update_batch($table, $data, $pk); } return $insert; } public function delete($table, $data, $pk) { $this->db->where_in($pk, $data); return $this->db->delete($table); } public function ceklogin() { $username = $this->session->userdata('username'); if ($username == null) { redirect("login"); } } public function getData_Karyawan_status1_syncNULL_orderPANGGILAN(){ $this->db->select('*'); $this->db->from('karyawan'); $this->db->where('STATUS_KARYAWAN=1'); $this->db->where('SYNC is NULL'); $this->db->order_by('NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_byUSERNAME($id){ $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where(['a.USERNAME' => $id]); return $this->db->get()->result_array(); } public function getData_SetHakMaster_byKARYAWAN($id){ $this->db->select('*'); $this->db->from('set_hakmaster'); $this->db->where(['KARYAWAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Akun($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('akun'); $this->db->order_by('NAMA_AKUN ASC'); }else{ $this->db->select('*'); $this->db->from('akun'); $this->db->where(['ID_AKUN' => $id]); $this->db->order_by('NAMA_AKUN ASC'); } return $this->db->get()->result_array(); } public function getData_Kontak_byAKUN($id){ $this->db->select('*'); $this->db->from('kontak a'); $this->db->join('akun b','b.ID_AKUN=a.AKUN_ID'); $this->db->where(['a.AKUN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SalesVisit_byAKUN($id){ $this->db->select('*'); $this->db->from('sales_visit a'); $this->db->join('akun b','b.ID_AKUN=a.AKUN_ID'); $this->db->where(['a.AKUN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Bank($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('bank'); } else { $this->db->select('*'); $this->db->from('bank'); $this->db->where(['ID_BANK' => $id]); } return $this->db->get()->result_array(); } public function getData_SaldoBank_byBANK($id){ $this->db->select('*'); $this->db->from('saldo_bank'); $this->db->where(['BANK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Kasbank_byBANK($id){ $this->db->select('*'); $this->db->from('kasbank'); $this->db->where(['BANK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Customer($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('customer'); $this->db->order_by('NAMA_CUSTOMER ASC'); } else { $this->db->select('*'); $this->db->from('customer'); $this->db->where(['ID_CUSTOMER' => $id]); } return $this->db->get()->result_array(); } public function getData_Customer_byALAMAT($alamat, $id=null){ $this->db->select('*'); $this->db->from('customer'); $this->db->where(['ALAMAT_CUSTOMER' => $alamat]); if ($id!=null) { $this->db->where('ID_CUSTOMER!=', $id); } return $this->db->get()->result_array(); } public function getData_RekapPajak_byCUSTOMER($id){ $this->db->select('*'); $this->db->from('rekap_pajak'); $this->db->where(['CUSTOMER_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Jabatan($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('jabatan'); $this->db->order_by('NAMA_JABATAN ASC'); }else{ $this->db->select('*'); $this->db->from('jabatan'); $this->db->where(['ID_JABATAN' => $id]); } return $this->db->get()->result_array(); } public function getData_Karyawan_byJABATAN($id){ $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b','b.ID_JABATAN=a.JABATAN_ID'); $this->db->where(['a.JABATAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Jenis($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('jenis'); $this->db->order_by('NAMA_JENIS ASC'); } else { $this->db->select('*'); $this->db->from('jenis'); $this->db->where(['ID_JENIS' => $id]); } return $this->db->get()->result_array(); } public function getData_Jenis_0_1_2(){ $this->db->select('*'); $this->db->from('jenis'); $this->db->order_by('NAMA_JENIS ASC'); return $this->db->get()->result_array(); } public function getData_Jenis_2(){ $this->db->select('*'); $this->db->from('jenis'); $this->db->where('TYPE_JENIS=2'); $this->db->order_by('NAMA_JENIS ASC'); return $this->db->get()->result_array(); } public function getData_Barang_byJENIS($id){ $this->db->select('*'); $this->db->from('barang'); $this->db->where(['JENIS_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Karyawan($id = null) { if ($id === null) { $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->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); } else { $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(['ID_KARYAWAN' => $id]); } return $this->db->get()->result_array(); } public function getData_Absensi_byKARYAWAN($id) { $this->db->select('*'); $this->db->from('absensi 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_AdministratorAll() { $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('b.NAMA_JABATAN="ADMINISTRATOR"'); return $this->db->get()->result_array(); } public function getData_SalesOrder_byKARYAWAN($id) { $this->db->select('*'); $this->db->from('sales_order a'); $this->db->join('karyawan b', 'b.ID_KARYAWAN=a.SALES_ID'); $this->db->where(['a.SALES_ID' => $id]); return $this->db->get()->result_array(); } public function getData_PiutangKaryawan_byKARYAWAN($id) { $this->db->select('*'); $this->db->from('piutang_karyawan 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_QualityControl_byKARYAWAN($id) { $this->db->select('*'); $this->db->from('quality_control 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_Kas($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('kas'); } else { $this->db->select('*'); $this->db->from('kas'); $this->db->where(['ID_KAS' => $id]); } return $this->db->get()->result_array(); } public function getData_Kasbank_byKAS($id){ $this->db->select('*'); $this->db->from('kasbank'); $this->db->where(['KAS_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SaldoKas_byKAS($id){ $this->db->select('*'); $this->db->from('saldo_kas'); $this->db->where(['KAS_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Kelompok($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('kelompok'); $this->db->order_by('NAMA_KELOMPOK ASC'); } else { $this->db->select('*'); $this->db->from('kelompok'); $this->db->where(['ID_KELOMPOK' => $id]); $this->db->order_by('NAMA_KELOMPOK ASC'); } return $this->db->get()->result_array(); } public function getData_Pelanggan_byKELOMPOK($id){ $this->db->select('*'); $this->db->from('pelanggan a'); $this->db->join('kelompok b','b.ID_KELOMPOK=a.KELOMPOK_ID'); $this->db->where(['a.KELOMPOK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Kendaraan($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('kendaraan'); $this->db->order_by('TYPE_KENDARAAN ASC'); } else { $this->db->select('*'); $this->db->from('kendaraan'); $this->db->where(['ID_KENDARAAN' => $id]); } return $this->db->get()->result_array(); } public function getData_BiayaBensin_byKENDARAAN($id){ $this->db->select('*'); $this->db->from('biaya_bensin'); $this->db->where(['KENDARAAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_BiayaServiceKendaraan_byKENDARAAN($id){ $this->db->select('*'); $this->db->from('biaya_servicekendaraan'); $this->db->where(['KENDARAAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Kota($id = null) { if ($id === null) { $this->db->select('*'); $this->db->from('kota'); $this->db->order_by('NAMA_KOTA ASC'); } else { $this->db->select('*'); $this->db->from('kota '); $this->db->order_by('NAMA_KOTA ASC'); $this->db->where(['ID_KOTA' => $id]); } return $this->db->get()->result_array(); } public function getData_Supplier_byKOTA($id) { $this->db->select('*'); $this->db->from('supplier a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->where(['a.KOTA_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Pelanggan_byKOTA($id) { $this->db->select('*'); $this->db->from('pelanggan a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->where(['a.KOTA_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Pihakke3_byKOTA($id) { $this->db->select('*'); $this->db->from('pihakke3 a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->where(['a.KOTA_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Merk($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('merk'); $this->db->order_by('NAMA_MERK ASC'); } else { $this->db->select('*'); $this->db->from('merk'); $this->db->where(['ID_MERK' => $id]); $this->db->order_by('NAMA_MERK ASC'); } return $this->db->get()->result_array(); } public function getData_Menu($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('menu'); $this->db->order_by('KODE_MENU ASC, NAMA_MENU ASC'); } else { $this->db->select('*'); $this->db->from('menu'); $this->db->where(['ID_MENU' => $id]); } return $this->db->get()->result_array(); } public function getData_Barang_byMERK($id){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('merk b','b.ID_MERK=a.MERK_ID'); $this->db->where(['a.MERK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SetHakMenu_byMENU($id){ $this->db->select('*'); $this->db->from('set_hakmenu a'); $this->db->join('menu b','b.ID_MENU=a.MENU_ID'); $this->db->where(['a.MENU_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Merk_byNAMA($id1, $id2=null){ if ($id2 == null) { $this->db->select('*'); $this->db->from('merk'); $this->db->where(['NAMA_MERK' => $id1]); } else { $this->db->select('*'); $this->db->from('merk'); $this->db->where(['NAMA_MERK' => $id1]); $this->db->where('ID_MERK!=', $id2); } return $this->db->get()->result_array(); } public function getData_Menu_byNAMA($id1, $id2=null){ if ($id2 == null) { $this->db->select('*'); $this->db->from('menu'); $this->db->where(['NAMA_MENU' => $id1]); } else { $this->db->select('*'); $this->db->from('menu'); $this->db->where(['NAMA_MENU' => $id1]); $this->db->where('ID_MENU!=', $id2); } return $this->db->get()->result_array(); } public function getData_Menu_byKODE_byNAMA($id1, $id2, $id3=null){ if ($id3 == null) { $this->db->select('*'); $this->db->from('menu'); $this->db->where(['KODE_MENU' => $id1]); $this->db->where(['NAMA_MENU' => $id2]); } else { $this->db->select('*'); $this->db->from('menu'); $this->db->where(['KODE_MENU' => $id1]); $this->db->where(['NAMA_MENU' => $id2]); $this->db->where('ID_MENU!=', $id3); } return $this->db->get()->result_array(); } public function getData_Model($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('model'); $this->db->order_by('NAMA_MODEL ASC'); } else { $this->db->select('*'); $this->db->from('model'); $this->db->where(['ID_MODEL' => $id]); $this->db->order_by('NAMA_MODEL ASC'); } return $this->db->get()->result_array(); } public function getData_Barang_byMODEL($id){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('model b','b.ID_MODEL=a.MODEL_ID'); $this->db->where(['a.MODEL_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Model_byNAMA($id1, $id2=null){ if ($id2 == null) { $this->db->select('*'); $this->db->from('model'); $this->db->where(['NAMA_MODEL' => $id1]); } else { $this->db->select('*'); $this->db->from('model'); $this->db->where(['NAMA_MODEL' => $id1]); $this->db->where('ID_MODEL!=', $id2); } return $this->db->get()->result_array(); } public function getData_Part($id = null){ if ($id === null) { $this->db->select('*,FORMAT(b.HPP_HPAR,2) as HPP,DATE_FORMAT(b.TGL_HPAR,"%d/%m/%Y") as TANGGAL'); $this->db->from('part a'); $this->db->join('harga_part b','b.PART_ID=a.ID_PART','left'); $this->db->order_by('a.NAMA_PART ASC, b.ID_HPAR DESC'); } else { $this->db->select('*,FORMAT(b.HPP_HPAR,2) as HPP'); $this->db->from('part a'); $this->db->join('harga_part b','b.PART_ID=a.ID_PART','left'); $this->db->order_by('a.NAMA_PART ASC, b.ID_HPAR DESC'); $this->db->where(['b.PART_ID' => $id]); } return $this->db->get()->result_array(); } public function getID_PartMax() { $this->db->select_max('ID_PART'); $this->db->from('part'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byPART($id){ $this->db->select('*'); $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->get()->result_array(); } public function getData_Perkiraan($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('perkiraan'); $this->db->group_by('ID_PERKIRAAN'); $this->db->order_by('KODE_PERKIRAAN'); } else { $this->db->select('*'); $this->db->from('perkiraan'); $this->db->group_by('ID_PERKIRAAN'); $this->db->order_by('KODE_PERKIRAAN'); $this->db->where(['ID_PERKIRAAN' => $id]); } return $this->db->get()->result_array(); } public function getData_DaftarKasbank_byPERKIRAAN($id){ $this->db->select('*'); $this->db->from('daftar_kasbank a'); $this->db->join('perkiraan b','b.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->limit('25'); return $this->db->get()->result_array(); } public function getData_DaftarJurnalMemo_byPERKIRAAN($id){ $this->db->select('*'); $this->db->from('daftar_jurnalmemo a'); $this->db->join('perkiraan b','b.ID_PERKIRAAN=a.PERKIRAAN_ID'); $this->db->where(['a.PERKIRAAN_ID' => $id]); $this->db->limit('25'); return $this->db->get()->result_array(); } public function getData_Corp($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('corp'); } else { $this->db->select('*'); $this->db->from('corp'); $this->db->where(['ID_CORP' => $id]); } return $this->db->get()->result_array(); } public function getData_SalesOrder_byCORP($id){ $this->db->select('*'); $this->db->from('sales_order a'); $this->db->join('corp b','b.ID_CORP=a.CORP_ID'); $this->db->where(['a.CORP_ID' => $id]); $this->db->limit('25'); return $this->db->get()->result_array(); } public function getData_DpPajak_byCORP($id){ $this->db->select('*'); $this->db->from('dp_pajak a'); $this->db->join('corp b','b.ID_CORP=a.CORP_ID'); $this->db->where(['a.CORP_ID' => $id]); $this->db->limit('25'); return $this->db->get()->result_array(); } public function getData_RekapPajak_byCORP($id){ $this->db->select('*'); $this->db->from('rekap_pajak a'); $this->db->join('corp b','b.ID_CORP=a.CORP_ID'); $this->db->where(['a.CORP_ID' => $id]); $this->db->limit('25'); return $this->db->get()->result_array(); } public function getData_PihakKe3($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('pihakke3 a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); } else { $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_PiutangPihakKe3_byPIHAKKE3($id){ $this->db->select('*'); $this->db->from('piutang_pihakke3 a'); $this->db->join('pihakke3 b','b.ID_PIHAKKE3=a.PIHAKKE3_ID'); $this->db->where(['a.PIHAKKE3_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Posisi($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('posisi'); $this->db->order_by('NAMA_POSISI ASC'); } else { $this->db->select('*'); $this->db->from('posisi'); $this->db->where(['ID_POSISI' => $id]); $this->db->order_by('NAMA_POSISI ASC'); } return $this->db->get()->result_array(); } public function getData_Kontak_byPOSISI($id){ $this->db->select('*'); $this->db->from('kontak a'); $this->db->join('posisi b','b.ID_POSISI=a.POSISI_ID'); $this->db->where(['a.POSISI_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Program($id = null) { if ($id === null) { $this->db->select('*'); $this->db->from('program'); $this->db->order_by('NAMA_PROGRAM ASC'); } else { $this->db->select('*'); $this->db->from('program'); $this->db->where(['ID_PROGRAM' => $id]); $this->db->order_by('NAMA_PROGRAM ASC'); } return $this->db->get()->result_array(); } public function getData_LinkKlaimProgram_byPROGRAM($id) { $this->db->select('*'); $this->db->from('link_klaimprogram a'); $this->db->join('program b','b.ID_PROGRAM=a.PROGRAM_ID'); $this->db->where(['a.PROGRAM_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Program_byNAMA($id1, $id2=null){ if ($id2 == null) { $this->db->select('*'); $this->db->from('program'); $this->db->where(['NAMA_PROGRAM' => $id1]); } else { $this->db->select('*'); $this->db->from('program'); $this->db->where(['NAMA_PROGRAM' => $id1]); $this->db->where('ID_PROGRAM!=', $id2); } return $this->db->get()->result_array(); } public function getData_ServiceCenter($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('servicecenter'); $this->db->order_by('NAMA_SERVICECENTER'); } else { $this->db->select('*'); $this->db->from('servicecenter'); $this->db->where(['ID_SERVICECENTER' => $id]); } return $this->db->get()->result_array(); } public function getData_ServiceCenter_byNAMA($nama, $id=null){ $this->db->select('*'); $this->db->from('servicecenter'); $this->db->where(['NAMA_SERVICECENTER' => $nama]); if ($id!=null) { $this->db->where('ID_SERVICECENTER!=', $id); } return $this->db->get()->result_array(); } public function getData_KlaimService_bySERVICECENTER($id){ $this->db->select('*'); $this->db->from('klaim_service'); $this->db->where(['SERVICECENTER_ID' => $id]); return $this->db->get()->result_array(); } public function getData_UnitService($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('unitservice a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->order_by('a.NAMA_UNITSERVICE'); } else { $this->db->select('*'); $this->db->from('unitservice'); $this->db->where(['ID_UNITSERVICE' => $id]); } return $this->db->get()->result_array(); } public function getData_UnitProyek($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('unitproyek'); $this->db->order_by('NAMA_UNITPROYEK'); } else { $this->db->select('*'); $this->db->from('unitproyek'); $this->db->where(['ID_UNITPROYEK' => $id]); } return $this->db->get()->result_array(); } public function getData_Produk($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('produk'); $this->db->order_by('NAMA_PRODUK'); } else { $this->db->select('*'); $this->db->from('produk'); $this->db->where(['ID_PRODUK' => $id]); } return $this->db->get()->result_array(); } public function getData_UnitService_byNAMA($nama, $id=null){ $this->db->select('*'); $this->db->from('unitservice'); $this->db->where(['NAMA_UNITSERVICE' => $nama]); if ($id!=null) { $this->db->where('ID_UNITSERVICE!=', $id); } return $this->db->get()->result_array(); } public function getData_UnitProyek_byNAMA($nama, $id=null){ $this->db->select('*'); $this->db->from('unitproyek'); $this->db->where(['NAMA_UNITPROYEK' => $nama]); if ($id!=null) { $this->db->where('ID_UNITPROYEK!=', $id); } return $this->db->get()->result_array(); } public function getData_Produk_byNAMA($nama, $id=null){ $this->db->select('*'); $this->db->from('produk'); $this->db->where(['NAMA_PRODUK' => $nama]); if ($id!=null) { $this->db->where('ID_PRODUK!=', $id); } return $this->db->get()->result_array(); } public function getData_SnService_byUNITSERVICE($id){ $this->db->select('*'); $this->db->from('sn_service'); $this->db->where(['UNITSERVICE_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byUNITPROYEK($id){ $this->db->select('*'); $this->db->from('daftar_akuntansi'); $this->db->where(['UNITPROYEK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarAkuntansi_byPELANGGAN($id){ $this->db->select('*'); $this->db->from('daftar_akuntansi'); $this->db->where(['PELANGGAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_CreditNote_byPRODUK($id){ $this->db->select('*'); $this->db->from('creditnote'); $this->db->where(['PRODUK_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarSjService_byUNITSERVICE_byFSS($id1, $id2){ $this->db->select('*'); $this->db->from('daftar_sjservice a'); $this->db->join('sn_service b','b.ID_SNS=a.SNS_ID'); $this->db->where(['a.UNITSERVICE_ID' => $id1]); $this->db->where(['a.FSS_ID' => $id2]); return $this->db->get()->result_array(); } public function getData_DaftarSjService_byID($id){ $this->db->select('*'); $this->db->from('daftar_sjservice'); $this->db->where(['ID_DFSS' => $id]); return $this->db->get()->result_array(); } public function getData_SnService_byPELANGGAN($id){ $this->db->select('*'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->join('unitservice c','c.ID_UNITSERVICE=a.UNITSERVICE_ID'); $this->db->where(['b.PELANGGAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnService_byID($id){ $this->db->select('*'); $this->db->from('sn_service'); $this->db->where(['ID_SNS' => $id]); return $this->db->get()->result_array(); } public function getData_Jenis_BIAYANot0(){ $this->db->select('*'); $this->db->from('jenis'); $this->db->where('BIAYA_SERVICE!="0.00"'); return $this->db->get()->result_array(); } public function getData_SetSupplier_byKARYAWAN($id) { $this->db->select('*'); $this->db->from('set_supplier'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_Supplier_byNAMA_byKOTA($nama = null, $kota = null) { $this->db->select('*'); $this->db->from('supplier a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); if ($nama != null) { $this->db->like('a.NAMA_SUPPLIER', $nama, 'both'); } if ($kota != 0) { $this->db->where('a.KOTA_ID=', $kota); } $this->db->order_by('a.NAMA_SUPPLIER ASC, b.NAMA_KOTA ASC'); return $this->db->get()->result_array(); } public function getData_Supplier_orderDESC_limit10(){ $this->db->select('*'); $this->db->from('supplier a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->order_by('a.ID_SUPPLIER DESC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_DaftarKlaimProgram_bySUPPLIER($id){ $this->db->select('*'); $this->db->from('daftar_klaimprogram a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID','left'); $this->db->where(['a.SUPPLIER_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DpPembelian_bySUPPLIER($id){ $this->db->select('*'); $this->db->from('dp_pembelian'); $this->db->where(['SUPPLIER_ID' => $id]); return $this->db->get()->result_array(); } public function getData_HutangDagang_bySUPPLIER($id){ $this->db->select('*'); $this->db->from('hutang_dagang a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID','left'); $this->db->where(['a.SUPPLIER_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Pembelian_bySUPPLIER($id){ $this->db->select('*'); $this->db->from('pembelian a'); $this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID','left'); $this->db->where(['a.SUPPLIER_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Pelanggan_orderDESC_limit10(){ $this->db->select('*'); $this->db->from('pelanggan a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID'); $this->db->order_by('a.ID_PELANGGAN DESC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_SetPelanggan_byKARYAWAN($id) { $this->db->select('*'); $this->db->from('set_pelanggan'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_Pelanggan_byNAMA_byTYPE_byKOTA_byKELOMPOK($nama = null, $type = null, $kota = null, $kelompok = null) { $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','left'); if ($nama != null) { $this->db->like('a.NAMA_PELANGGAN', $nama, 'both'); } if ($type != 9) { $this->db->where('a.TYPE_PELANGGAN=', $type); } if ($kota != 0) { $this->db->where('a.KOTA_ID=', $kota); } if ($kelompok != 0) { $this->db->where('a.KELOMPOK_ID=', $kelompok); } $this->db->order_by('a.TYPE_PELANGGAN ASC, a.NAMA_PELANGGAN ASC, b.NAMA_KOTA ASC'); $this->db->limit('100'); return $this->db->get()->result_array(); } public function getData_Pelanggan_byNAMA_byTYPE_byKOTA_byKELOMPOK_forExcel($nama = null, $type = null, $kota = null, $kelompok = null) { $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','left'); if ($nama != null) { $this->db->like('a.NAMA_PELANGGAN', $nama, 'both'); } if ($type != 9) { $this->db->where('a.TYPE_PELANGGAN=', $type); } if ($kota != 0) { $this->db->where('a.KOTA_ID=', $kota); } if ($kelompok != 0) { $this->db->where('a.KELOMPOK_ID=', $kelompok); } $this->db->order_by('a.TYPE_PELANGGAN ASC, a.NAMA_PELANGGAN ASC, b.NAMA_KOTA ASC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_byPELANGGAN($id) { $this->db->select('*'); $this->db->from('sales_order'); $this->db->where(['PELANGGAN_ID' => $id]); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_HistoriSn_byPELANGGAN($id) { $this->db->select('*'); $this->db->from('histori_sn'); $this->db->where(['PELANGGAN_ID' => $id]); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_PiutangDagang_byPELANGGAN($id) { $this->db->select('*'); $this->db->from('piutang_dagang'); $this->db->where(['PELANGGAN_ID' => $id]); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_DpPenjualan_byPELANGGAN($id) { $this->db->select('*'); $this->db->from('dp_penjualan'); $this->db->where(['PELANGGAN_ID' => $id]); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_Service_byPELANGGAN($id){ $this->db->select('*'); $this->db->from('service'); $this->db->where('PELANGGAN_ID=', $id); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_Pelanggan_byNAMA($id){ $this->db->select('*'); $this->db->from('pelanggan'); $this->db->where(['NAMA_PELANGGAN' => $id]); return $this->db->get()->result_array(); } public function getData_Pelanggan_byID($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('pelanggan a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID','left'); $this->db->join('kelompok c','c.ID_KELOMPOK=a.KELOMPOK_ID','left'); $this->db->order_by('a.NAMA_PELANGGAN ASC'); } else { $this->db->select('*'); $this->db->from('pelanggan a'); $this->db->join('kota b','b.ID_KOTA=a.KOTA_ID','left'); $this->db->join('kelompok c','c.ID_KELOMPOK=a.KELOMPOK_ID','left'); $this->db->join('sales_order d','d.PELANGGAN_ID=a.ID_PELANGGAN','left'); $this->db->join('penjualan e','e.SO_ID=d.ID_SO','left'); $this->db->order_by('a.TYPE_PELANGGAN ASC'); $this->db->group_by('a.ID_PELANGGAN'); $this->db->where(['a.ID_PELANGGAN' => $id]); } return $this->db->get()->result_array(); } public function getData_Barang_orderDESC_limit10(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->order_by('a.ID_BARANG DESC'); $this->db->limit('10'); return $this->db->get()->result_array(); } public function getData_SetBarang_byKARYAWAN($id) { $this->db->select('*'); $this->db->from('set_barang'); $this->db->where('KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_Barang_byKODE_byJENIS_byMERK_byMODEL_byPRODUK($kode = null, $jenis = null, $merk = null, $model = null, $produk = null) { $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','left'); $this->db->join('produk e','e.ID_PRODUK=a.PRODUK_ID','left'); if ($kode != null) { $this->db->like('a.KODE_BARANG', $kode, 'both'); } if ($jenis != 0) { $this->db->where('a.JENIS_ID=', $jenis); } if ($merk != 0) { $this->db->where('a.MERK_ID=', $merk); } if ($model != 0) { $this->db->where('a.MODEL_ID=', $model); } if ($produk != 0) { $this->db->where('a.PRODUK_ID=', $produk); } $this->db->order_by('b.NAMA_JENIS ASC, a.KODE_BARANG ASC, a.NAMA_BARANG ASC'); $this->db->limit('100'); return $this->db->get()->result_array(); } public function getData_Barang_byKODE($kode, $id=null){ $this->db->select('*'); $this->db->from('barang'); $this->db->where(['KODE_BARANG' => $kode]); if ($id!=null) { $this->db->where('ID_BARANG!=', $id); } return $this->db->get()->result_array(); } public function getData_Barang_byNAMA($nama, $id=null){ $this->db->select('*'); $this->db->from('barang'); $this->db->where(['NAMA_BARANG' => $nama]); if ($id!=null) { $this->db->where('ID_BARANG!=', $id); } return $this->db->get()->result_array(); } public function getID_BarangMax() { $this->db->select_max('ID_BARANG'); $this->db->from('barang'); return $this->db->get()->result_array(); } public function getData_Barang($id = null){ if ($id === null) { $this->db->select('a.ID_BARANG,a.KODE_BARANG,a.NAMA_BARANG,a.JENIS_ID,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->order_by('a.KODE_BARANG ASC'); }else{ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->where(['a.ID_BARANG' => $id]); $this->db->group_by('a.ID_BARANG'); $this->db->order_by('b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); } return $this->db->get()->result_array(); } public function getData_Jenis_byID($id){ $this->db->select('*'); $this->db->from('jenis'); $this->db->where(['ID_JENIS' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byBARANG($id){ $this->db->select('*'); $this->db->from('daftar_beli'); $this->db->where(['BARANG_ID' => $id]); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byBARANG($id){ $this->db->select('*'); $this->db->from('daftar_order'); $this->db->where(['BARANG_ID' => $id]); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_SnStock_byBARANG($id){ $this->db->select('*'); $this->db->from('sn_stock'); $this->db->where(['BARANG_ID' => $id]); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byBARANG($id){ $this->db->select('*'); $this->db->from('transaksi_stock'); $this->db->where(['BARANG_ID' => $id]); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_Kontak($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('kontak a'); $this->db->join('posisi b','b.ID_POSISI=a.POSISI_ID'); $this->db->join('akun c','c.ID_AKUN=a.AKUN_ID'); $this->db->order_by('c.NAMA_AKUN ASC, a.NAMA_KONTAK ASC'); } else { $this->db->select('*'); $this->db->from('kontak a'); $this->db->join('posisi b','b.ID_POSISI=a.POSISI_ID'); $this->db->join('akun c','c.ID_AKUN=a.AKUN_ID'); $this->db->order_by('c.NAMA_AKUN ASC, a.NAMA_KONTAK ASC'); $this->db->where(['a.AKUN_ID' => $id]); } return $this->db->get()->result_array(); } public function getData_SalesVisit_byKONTAK($id){ $this->db->select('*'); $this->db->from('sales_visit'); $this->db->where(['KONTAK_ID' => $id]); $this->db->limit('5'); return $this->db->get()->result_array(); } public function getData_Kontak_byNAMA($id1, $id2=null){ if ($id2 == null) { $this->db->select('*'); $this->db->from('kontak'); $this->db->where(['NAMA_KONTAK' => $id1]); } else { $this->db->select('*'); $this->db->from('kontak'); $this->db->where(['NAMA_KONTAK' => $id1]); $this->db->where('ID_KONTAK!=', $id2); } return $this->db->get()->result_array(); } public function getData_LogNotifikasi_byKARYAWAN_status0($id) { $this->db->select('*,DATE_FORMAT(b.TGL_NOTIFIKASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('log_notifikasi a'); $this->db->join('notifikasi b','b.ID_NOTIFIKASI=a.NOTIFIKASI_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS=0'); $this->db->order_by('b.TGL_NOTIFIKASI'); return $this->db->get()->result_array(); } public function addTempoDay($date, $day) { $sum = strtotime(date("Y-m-d", strtotime("$date")) . " +$day days"); $dateTo=date('Y-m-d',$sum); return $dateTo; } public function subTempoDay($date, $day) { $sum = strtotime(date("Y-m-d", strtotime("$date")) . " -$day days"); $dateTo=date('Y-m-d',$sum); return $dateTo; } public function getData_LogNotifikasi_byID($id) { $this->db->select('*,DATE_FORMAT(b.TGL_NOTIFIKASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('log_notifikasi a'); $this->db->join('notifikasi b','b.ID_NOTIFIKASI=a.NOTIFIKASI_ID'); $this->db->where('a.ID_LOG_NOTIFIKASI=', $id); return $this->db->get()->result_array(); } public function getData_LogNotifikasi_byKARYAWAN_allStatus($id) { $this->db->select('*,DATE_FORMAT(b.TGL_NOTIFIKASI,"%d/%m/%Y") as TANGGAL'); $this->db->from('log_notifikasi a'); $this->db->join('notifikasi b','b.ID_NOTIFIKASI=a.NOTIFIKASI_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->order_by('b.TGL_NOTIFIKASI'); return $this->db->get()->result_array(); } public function getData_FormTandaTerima_byKARYAWAN_status0($id) { $this->db->select('*'); $this->db->from('form_tandaterima a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID','left'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID','left'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID','left'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_FTT=0'); return $this->db->get()->result_array(); } public function getData_FormTTKosong_byKARYAWAN_status0($id) { $this->db->select('*'); $this->db->from('form_ttkosong a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_FTTK=0'); return $this->db->get()->result_array(); } public function getData_FormSjService_byKARYAWAN_status0($id) { $this->db->select('*'); $this->db->from('form_sjservice 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->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_FSS=0'); return $this->db->get()->result_array(); } public function getData_FormNotaPembayaran_byKARYAWAN_status0($id) { $this->db->select('*'); $this->db->from('form_notapembayaran 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->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_FNP=0'); return $this->db->get()->result_array(); } public function getData_DpPenjualan_limit3Month_DKBNotNull() { $tgl = date('Y-m-d'); $tgl_down = $this->subTempoDay($tgl, 90); $this->db->select('*,FORMAT(a.KREDIT_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('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->where('b.TGL_AKUNTANSI>=', $tgl_down); $this->db->where('b.TGL_AKUNTANSI<=', $tgl); $this->db->where('a.PERKIRAAN_ID=19'); $this->db->group_by('a.MAIN_DPJ'); $this->db->order_by('b.TGL_AKUNTANSI DESC, b.KODE_AKUNTANSI ASC'); return $this->db->get()->result_array(); } public function getData_FormProforma_byKARYAWAN_status0($id) { $this->db->select('*'); $this->db->from('form_proforma 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->where('a.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_FPF=0'); return $this->db->get()->result_array(); } public function getData_FormNotaDp_byKARYAWAN_status0($id) { $this->db->select('*'); $this->db->from('nota_bebas a'); //$this->db->join('daftar_akuntansi b','b.ID_DAK=a.DPJ_ID','left'); $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.KARYAWAN_ID=', $id); $this->db->where('a.STATUS_NB=0'); return $this->db->get()->result_array(); } public function getData_FormProforma_byID($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL'); $this->db->from('form_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_FPF=', $id); return $this->db->get()->result_array(); } public function getData_FormNotaDp_byID($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL'); $this->db->from('form_notadp a'); $this->db->join('daftar_akuntansi b','b.ID_DAK=a.DPJ_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('a.ID_FND=', $id); return $this->db->get()->result_array(); } public function getKode_ProformaTMP() { $this->db->select('MAX(KODE_FPF) AS KODE'); $this->db->from('form_proforma'); $this->db->like('KODE_FPF','PF/TMP', 'after'); return $this->db->get()->result_array(); } public function getKode_ProformaDMT() { $this->db->select('MAX(KODE_FPF) AS KODE'); $this->db->from('form_proforma'); $this->db->like('KODE_FPF','PF/DMT', 'after'); return $this->db->get()->result_array(); } public function getKode_ProformaPCM() { $this->db->select('MAX(KODE_FPF) AS KODE'); $this->db->from('form_proforma'); $this->db->like('KODE_FPF','PF/PCM', 'after'); return $this->db->get()->result_array(); } public function getKode_ProformaSFT() { $this->db->select('MAX(KODE_FPF) AS KODE'); $this->db->from('form_proforma'); $this->db->like('KODE_FPF','PF/SFT', 'after'); return $this->db->get()->result_array(); } public function getKode_ProformaITP() { $this->db->select('MAX(KODE_FPF) AS KODE'); $this->db->from('form_proforma'); $this->db->like('KODE_FPF','PF/ITP', 'after'); return $this->db->get()->result_array(); } public function getKode_DPNotaTMP() { $this->db->select('MAX(KODE_FND) AS KODE'); $this->db->from('form_notadp'); $this->db->like('KODE_FND','DP/TMP', 'after'); return $this->db->get()->result_array(); } public function getKode_DPNotaDMT() { $this->db->select('MAX(KODE_FND) AS KODE'); $this->db->from('form_notadp'); $this->db->like('KODE_FND','DP/DMT', 'after'); return $this->db->get()->result_array(); } public function getKode_DPNotaPCM() { $this->db->select('MAX(KODE_FND) AS KODE'); $this->db->from('form_notadp'); $this->db->like('KODE_FND','DP/PCM', 'after'); return $this->db->get()->result_array(); } public function getKode_DPNotaSFT() { $this->db->select('MAX(KODE_FND) AS KODE'); $this->db->from('form_notadp'); $this->db->like('KODE_FND','DP/SFT', 'after'); return $this->db->get()->result_array(); } public function getKode_DPNotaITP() { $this->db->select('MAX(KODE_FND) AS KODE'); $this->db->from('form_notadp'); $this->db->like('KODE_FND','DP/ITP', 'after'); return $this->db->get()->result_array(); } public function getData_DaftarProforma_byFPF($id) { $this->db->select('*,FORMAT(a.HARGA_DFPF,2) as HARGA,FORMAT((a.HARGA_DFPF*a.QTY_DFPF),2) as SUBTOTAL'); $this->db->from('daftar_proforma a'); $this->db->join('form_proforma b','b.ID_FPF=a.FPF_ID'); $this->db->where('a.FPF_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarNotaDp_byFND($id) { $this->db->select('*,FORMAT(a.HARGA_DFND,2) as HARGA,FORMAT((a.HARGA_DFND*a.QTY_DFND),2) as SUBTOTAL'); $this->db->from('daftar_notadp a'); $this->db->join('form_notadp b','b.ID_FND=a.FND_ID'); $this->db->where('a.FND_ID=', $id); return $this->db->get()->result_array(); } public function getData_Proyek_byID($id) { $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); return $this->db->get()->result_array(); } public function getData_Proyek_byKARYAWAN_statusNull($id) { $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); $this->db->where('a.STATUS_PROYEK is NULL'); return $this->db->get()->result_array(); } public function getData_Proyek_byPELANGGAN($id) { $this->db->select('*'); $this->db->from('proyek a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.PELANGGAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_FormTandaTerima_status1_limit2Month_orderDESC() { $tgl = date('Y-m-d'); $tgl_down = $this->subTempoDay($tgl, 60); $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_tandaterima a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID','left'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID','left'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID','left'); $this->db->join('kota e','e.ID_KOTA=d.KOTA_ID','left'); $this->db->join('karyawan f','f.ID_KARYAWAN=a.KARYAWAN_ID','left'); $this->db->where('a.STATUS_FTT=1'); $this->db->where('a.TGL_INPUT>=', $tgl_down); $this->db->where('a.TGL_INPUT<=', $tgl); $this->db->order_by('a.ID_FTT DESC'); return $this->db->get()->result_array(); } public function getData_FormTTKosong_status1_limit2Month_orderDESC() { $tgl = date('Y-m-d'); $tgl_down = $this->subTempoDay($tgl, 60); $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_ttkosong 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.KARYAWAN_ID'); $this->db->where('a.STATUS_FTTK=1'); $this->db->where('a.TGL_INPUT>=', $tgl_down); $this->db->where('a.TGL_INPUT<=', $tgl); $this->db->order_by('a.ID_FTTK DESC'); return $this->db->get()->result_array(); } public function getData_FormNotaPembayaran_status1_limit2Month_orderDESC() { $tgl = date('Y-m-d'); $tgl_down = $this->subTempoDay($tgl, 60); $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_notapembayaran 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.KARYAWAN_ID','left'); $this->db->where('a.STATUS_FNP=1'); $this->db->where('a.TGL_INPUT>=', $tgl_down); $this->db->where('a.TGL_INPUT<=', $tgl); $this->db->order_by('a.ID_FNP DESC'); return $this->db->get()->result_array(); } public function getData_FormProforma_status1_limit2Month_orderDESC() { $tgl = date('Y-m-d'); $tgl_down = $this->subTempoDay($tgl, 60); $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT,d.NAMA_PANGGILAN_KARYAWAN as PEMBUAT,e.NAMA_PANGGILAN_KARYAWAN as PENGEDIT'); $this->db->from('form_proforma 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.KARYAWAN_ID','left'); $this->db->join('karyawan e','e.ID_KARYAWAN=a.EDIT_ID','left'); $this->db->where('a.STATUS_FPF=1'); $this->db->where('a.TGL_INPUT>=', $tgl_down); $this->db->where('a.TGL_INPUT<=', $tgl); $this->db->order_by('a.ID_FPF DESC'); return $this->db->get()->result_array(); } public function getData_FormNotaDp_status1_limit2Month_orderDESC() { $tgl = date('Y-m-d'); $tgl_down = $this->subTempoDay($tgl, 60); $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT,e.NAMA_PANGGILAN_KARYAWAN as PEMBUAT,f.NAMA_PANGGILAN_KARYAWAN as PENGEDIT'); $this->db->from('form_notadp a'); $this->db->join('daftar_akuntansi b','b.ID_DAK=a.DPJ_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=a.KARYAWAN_ID','left'); $this->db->join('karyawan f','f.ID_KARYAWAN=a.EDIT_ID','left'); $this->db->where('a.STATUS_FND=1'); $this->db->where('a.TGL_INPUT>=', $tgl_down); $this->db->where('a.TGL_INPUT<=', $tgl); $this->db->order_by('a.ID_FND DESC'); return $this->db->get()->result_array(); } public function getData_FormSjService_status1_limit3Month_orderDESC($id) { $tgl_now = date('Y-m-d'); $tgl_down = $this->subTempoDay($tgl_now, 90); $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_sjservice 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->where('a.STATUS_FSS=1'); $this->db->where('a.TGL_INPUT<=', $tgl_now); $this->db->where('a.TGL_INPUT>=', $tgl_down); $this->db->order_by('a.ID_FSS DESC'); return $this->db->get()->result_array(); } public function getData_FormTandaTerima_byID_status0($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_tandaterima a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID','left'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID','left'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID','left'); $this->db->where('a.ID_FTT=', $id); $this->db->where('a.STATUS_FTT=0'); return $this->db->get()->result_array(); } public function getData_FormTTKosong_byID_status0($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_ttkosong a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_FTTK=', $id); $this->db->where('a.STATUS_FTTK=0'); return $this->db->get()->result_array(); } public function getData_FormTTKosong_byID_status1($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_ttkosong a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_FTTK=', $id); $this->db->where('a.STATUS_FTTK=1'); return $this->db->get()->result_array(); } public function getData_FormNotaPembayaran_byID_status0($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_notapembayaran a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_FNP=', $id); $this->db->where('a.STATUS_FNP=0'); return $this->db->get()->result_array(); } public function getData_FormProforma_byID_status0($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_proforma a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_FPF=', $id); $this->db->where('a.STATUS_FPF=0'); return $this->db->get()->result_array(); } public function getData_FormProforma_byID_status1($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_proforma a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_FPF=', $id); $this->db->where('a.STATUS_FPF=1'); return $this->db->get()->result_array(); } public function getData_FormNotaDp_byID_status0($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_notadp a'); $this->db->join('daftar_akuntansi b','b.ID_DAK=a.DPJ_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->where('a.ID_FND=', $id); $this->db->where('a.STATUS_FND=0'); return $this->db->get()->result_array(); } public function getData_FormNotaDp_byID_status1($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_notadp a'); $this->db->join('daftar_akuntansi b','b.ID_DAK=a.DPJ_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->where('a.ID_FND=', $id); $this->db->where('a.STATUS_FND=1'); return $this->db->get()->result_array(); } public function getData_FormNotaDp_byID_status3($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_notadp a'); $this->db->join('daftar_akuntansi b','b.ID_DAK=a.DPJ_ID'); $this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID'); $this->db->where('a.ID_FND=', $id); $this->db->where('a.STATUS_FND=3'); return $this->db->get()->result_array(); } public function getData_FormNotaPembayaran_byID_status1($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_notapembayaran a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID'); $this->db->where('a.ID_FNP=', $id); $this->db->where('a.STATUS_FNP=1'); return $this->db->get()->result_array(); } public function getData_FormSjService_byID_status0($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_sjservice a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID','left'); $this->db->where('a.ID_FSS=', $id); $this->db->where('a.STATUS_FSS=0'); return $this->db->get()->result_array(); } public function getData_FormSjService_byID_status1($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_sjservice a'); $this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID','left'); $this->db->where('a.ID_FSS=', $id); $this->db->where('a.STATUS_FSS=1'); return $this->db->get()->result_array(); } public function getData_FormTandaTerima_byID_status1($id) { $this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGLINPUT'); $this->db->from('form_tandaterima a'); $this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID','left'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID','left'); $this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID','left'); $this->db->where('a.ID_FTT=', $id); $this->db->where('a.STATUS_FTT=1'); return $this->db->get()->result_array(); } public function getData_DaftarTandaTerima_byFTT($id) { $this->db->select('*'); $this->db->from('daftar_tandaterima a'); $this->db->join('form_tandaterima b','b.ID_FTT=a.FTT_ID'); $this->db->where('a.FTT_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarTTKosong_byFTTK($id) { $this->db->select('*'); $this->db->from('daftar_ttkosong a'); $this->db->join('form_ttkosong b','b.ID_FTTK=a.FTTK_ID'); $this->db->where('a.FTTK_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarTTKosong_byID($id) { $this->db->select('*'); $this->db->from('daftar_ttkosong a'); $this->db->join('form_ttkosong b','b.ID_FTTK=a.FTTK_ID'); $this->db->where('a.ID_DFTTK=', $id); return $this->db->get()->result_array(); } public function getData_DaftarSjService_byFSS_groupUNITSERVICE($id) { $this->db->select('*,COUNT(a.ID_DFSS) as COT'); $this->db->from('daftar_sjservice a'); $this->db->join('form_sjservice b','b.ID_FSS=a.FSS_ID'); $this->db->join('unitservice c','c.ID_UNITSERVICE=a.UNITSERVICE_ID'); $this->db->where('a.FSS_ID=', $id); $this->db->group_by('a.UNITSERVICE_ID'); return $this->db->get()->result_array(); } public function getData_DaftarTandaTerima_byFTT_status1($id) { $this->db->select('*'); $this->db->from('daftar_tandaterima a'); $this->db->join('form_tandaterima b','b.ID_FTT=a.FTT_ID'); $this->db->where('a.FTT_ID=', $id); $this->db->where('a.STATUS_DFTT=1'); return $this->db->get()->result_array(); } public function getData_DaftarTandaTerima_byID($id) { $this->db->select('*'); $this->db->from('daftar_tandaterima a'); $this->db->join('form_tandaterima b','b.ID_FTT=a.FTT_ID'); $this->db->where('a.ID_DFTT=', $id); return $this->db->get()->result_array(); } public function getData_KolomTt() { $this->db->select('*'); $this->db->from('kolom_tt'); return $this->db->get()->result_array(); } public function getData_KolomTt_byFTT_jenis0($id) { $this->db->select('*'); $this->db->from('kolom_tt a'); $this->db->join('daftar_tandaterima b','b.KTT_ID=a.ID_KTT'); $this->db->where('b.FTT_ID=', $id); $this->db->where('a.JENIS_KTT=0'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_byKARYAWAN_statusNull($id) { $this->db->select('*'); $this->db->from('form_karyawan'); $this->db->where('STATUS_FK is NULL AND KARYAWAN_ID=', $id); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_tungguACC($id) { $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('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID'); $this->db->join('kota f','f.ID_KOTA=e.KOTA_ID'); if ($id==1 OR $id==5 OR $id==8 OR $id==15 OR $id==18 OR $id==34 OR $id==42 OR $id==50 OR $id==55) { $this->db->where('a.STATUS_FFP=0'); } else if ($id==21) { $this->db->where('a.STATUS_FFP=0 AND a.KARYAWAN_ID=28'); $this->db->or_where('a.STATUS_FFP=0 AND a.KARYAWAN_ID=30'); } else { $this->db->where('a.STATUS_FFP=0 AND a.KARYAWAN_ID=', $id); } return $this->db->get()->result_array(); } public function getData_FormKaryawan_tungguACC($id) { $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'); $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'); if ($id==1 OR $id==2 OR $id==4 OR $id==6 OR $id==15 OR $id==42 OR $id==50 OR $id==55) { $this->db->where('a.STATUS_FK=0'); } else { $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.STATUS_FK DESC, a.TGL_FK ASC'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_jenis3_status0_allCheck() { $this->db->select('*,FORMAT(a.NILAI_FK,2) as NILAI,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.SALES_ID'); $this->db->where('a.STATUS_FK=0'); $this->db->where('a.JENIS_FK=3'); $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->get()->result_array(); } public function getData_FormTTKosong_byID($id) { $this->db->select('*'); $this->db->from('form_ttkosong'); $this->db->where('ID_FTTK=', $id); return $this->db->get()->result_array(); } public function getData_DaftarFormKaryawan_jenis4() { $this->db->select('*'); $this->db->from('daftar_formkaryawan'); $this->db->where('JENIS_DFFK=4'); return $this->db->get()->result_array(); } public function getData_DaftarFormKaryawan_statusNull($id) { $this->db->select('*,DATE_FORMAT(a.TGL_DFFK,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_DFFK,2) as NILAI'); $this->db->from('daftar_formkaryawan a'); $this->db->join('form_karyawan b','b.ID_FK=a.FK_ID'); $this->db->where('a.FK_ID=', $id); $this->db->where('b.STATUS_FK is NULL'); return $this->db->get()->result_array(); } public function getData_DaftarFormKaryawan_status0($id) { $this->db->select('*,DATE_FORMAT(a.TGL_DFFK,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_DFFK,2) as NILAI'); $this->db->from('daftar_formkaryawan a'); $this->db->join('form_karyawan b','b.ID_FK=a.FK_ID'); $this->db->where('a.FK_ID=', $id); $this->db->where('b.STATUS_FK=0'); return $this->db->get()->result_array(); } public function getKode_FormSjService() { $this->db->select('MAX(KODE_FSS) AS KODE'); $this->db->from('form_sjservice'); return $this->db->get()->result_array(); } public function getData_DaftarSjService_byFSS_bySNS($id1, $id2) { $this->db->select('*'); $this->db->from('daftar_sjservice a'); $this->db->join('sn_service b','b.ID_SNS=a.SNS_ID'); $this->db->where('a.FSS_ID=', $id1); $this->db->where('a.SNS_ID=', $id2); return $this->db->get()->result_array(); } public function getData_Karyawan_allSales() { $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','insentive'); $this->db->not_like('a.USERNAME','itp'); $this->db->not_like('a.USERNAME','none'); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_allACC() { $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="ADMIN SALES"'); $this->db->or_where('b.NAMA_JABATAN="SALES"'); $this->db->or_where('b.NAMA_JABATAN="ADMINISTRATOR"'); $this->db->or_where('a.USERNAME="sugeng"'); $this->db->or_where('a.USERNAME="arifin"'); $this->db->or_where('a.USERNAME="lovita"'); $this->db->or_where('a.USERNAME="ayu"'); $this->db->or_where('a.USERNAME="venny"'); $this->db->or_where('a.USERNAME="ridwan"'); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_ACCFormFee() { $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="ADMIN SALES"'); $this->db->or_where('b.NAMA_JABATAN="SALES"'); $this->db->or_where('b.NAMA_JABATAN="ADMINISTRATOR"'); $this->db->or_where('b.NAMA_JABATAN="ADMIN ITP"'); $this->db->or_where('b.NAMA_JABATAN="KEUANGAN"'); $this->db->or_where('b.NAMA_JABATAN="ADMIN KEUANGAN"'); $this->db->order_by('a.NAMA_PANGGILAN_KARYAWAN ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_byID($id) { //Penjualan = [25, 67, 92] $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_allKaryawanOperasional() { $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 getKode_FormKaryawan() { $this->db->select('MAX(KODE_FK) AS KODE'); $this->db->from('form_karyawan'); $this->db->like('KODE_FK','FK/', 'after'); return $this->db->get()->result_array(); } public function getKode_FormFeePelanggan() { $this->db->select('MAX(KODE_FFP) AS KODE'); $this->db->from('form_feepelanggan'); $this->db->like('KODE_FFP','FFP/', 'after'); return $this->db->get()->result_array(); } public function getData_FormKaryawan_byID($id) { $this->db->select('*'); $this->db->from('form_karyawan 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.ID_FK=', $id); return $this->db->get()->result_array(); } public function getData_FormKaryawan_jenis3_allData() { $this->db->select('*'); $this->db->from('form_karyawan'); $this->db->where('JENIS_FK=3'); return $this->db->get()->result_array(); } public function getData_FormFeePelanggan_byID($id) { $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); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byPENJUALAN($id) { $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('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('penjualan c','c.SO_ID=b.ID_SO'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID'); $this->db->where('c.ID_PENJUALAN=', $id); return $this->db->get()->result_array(); } public function getSum_DaftarOrder_byPENJUALAN($id) { $this->db->select('ROUND((SUM(a.HARGA_DO*a.QTY_DO)*((b.PPN_SO+100)/100)),0) as NETTO,(SUM(a.HARGA_DO*a.QTY_DO)*((b.PPN_SO)/100)) as PPN, (SUM(a.HARGA_DO*a.QTY_DO)) as BRUTO'); $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->join('barang d','d.ID_BARANG=a.BARANG_ID'); $this->db->where('c.ID_PENJUALAN=', $id); return $this->db->get()->result_array(); } public function getSum_PiutangDagang_byPENJUALAN($id) { $this->db->select('SUM(DEBET_PDA) as DEBET, SUM(KREDIT_PDA) as KREDIT, SUM(DEBET_PDA-KREDIT_PDA) as SISA'); $this->db->from('piutang_dagang'); $this->db->where('TRANSAKSI_PDA!=2'); $this->db->where('PENJUALAN_ID=', $id); return $this->db->get()->result_array(); } public function getSum_DaftarNotaDp_byFND($id) { $this->db->select('SUM(QTY_DFND*HARGA_DFND) as TOTAL'); $this->db->from('daftar_notadp'); $this->db->where('FND_ID=', $id); return $this->db->get()->result_array(); } public function getSum_DaftarProforma_byFPF($id) { $this->db->select('SUM(QTY_DFPF*HARGA_DFPF) as TOTAL'); $this->db->from('daftar_proforma'); $this->db->where('FPF_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarFormKaryawan_byFK($id) { $this->db->select('*,DATE_FORMAT(a.TGL_DFFK,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_DFFK,2) 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); return $this->db->get()->result_array(); } public function getData_DaftarFormKaryawan_byID($id) { $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_byFK_byTGL($id, $tgl, $notid = null) { 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_JejakHarga_groupBARANG() { $this->db->select('*'); $this->db->from('jejak_hargakatalog a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('a.BARANG_ID ASC'); return $this->db->get()->result_array(); } public function getData_JejakHarga_byBARANG_orderDESC_limit1($id) { $this->db->select('*,FORMAT(a.HPP_JHK,2) as HPP,FORMAT(a.DEALER_JHK,2) as DEALER,FORMAT(a.USER_JHK,2) as USER,DATE_FORMAT(a.TGL_JHK,"%d/%m/%Y") as TANGGAL'); $this->db->from('jejak_hargakatalog a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('a.BARANG_ID=', $id); $this->db->order_by('a.ID_JHK DESC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_JejakHarga_byBARANG_orderDESC($id) { $this->db->select('*,FORMAT(a.HPP_JHK,2) as HPP,FORMAT(a.DEALER_JHK,2) as DEALER,FORMAT(a.USER_JHK,2) as USER,DATE_FORMAT(a.TGL_JHK,"%d/%m/%Y") as TANGGAL'); $this->db->from('jejak_hargakatalog a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where('a.BARANG_ID=', $id); $this->db->order_by('a.ID_JHK DESC'); return $this->db->get()->result_array(); } public function getData_Katalog_status0() { $this->db->select('*,DATE_FORMAT(TGLAWAL_KATALOG,"%d/%m/%Y") as AWAL,DATE_FORMAT(TGLAKHIR_KATALOG,"%d/%m/%Y") as AKHIR'); $this->db->from('katalog_harga'); $this->db->where('STATUS_KATALOG=0'); $this->db->order_by('TGLAWAL_KATALOG DESC, ID_KATALOG DESC'); return $this->db->get()->result_array(); } public function getData_Katalog_status1() { $this->db->select('*,DATE_FORMAT(TGLAWAL_KATALOG,"%d/%m/%Y") as AWAL,DATE_FORMAT(TGLAKHIR_KATALOG,"%d/%m/%Y") as AKHIR'); $this->db->from('katalog_harga'); $this->db->where('STATUS_KATALOG=1'); $this->db->order_by('TGLAWAL_KATALOG DESC, ID_KATALOG DESC'); return $this->db->get()->result_array(); } public function getData_Katalog_statusNULL_0() { $this->db->select('*,DATE_FORMAT(TGLAWAL_KATALOG,"%d/%m/%Y") as AWAL,DATE_FORMAT(TGLAKHIR_KATALOG,"%d/%m/%Y") as AKHIR'); $this->db->from('katalog_harga'); $this->db->where('STATUS_KATALOG is NULL'); $this->db->or_where('STATUS_KATALOG=0'); $this->db->order_by('TGLAWAL_KATALOG DESC, ID_KATALOG DESC'); return $this->db->get()->result_array(); } public function getData_DaftarKatalogHarga_byBARANG($id) { $this->db->select('*,FORMAT(a.NILAI_DKH,2) as NILAI'); $this->db->from('daftar_katalogharga a'); $this->db->join('katalog_harga b','b.ID_KATALOG=a.KATALOG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where('b.STATUS_KATALOG=0'); $this->db->where('a.BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getSum_DaftarKatalogHarga_byBARANG($id) { $this->db->select('SUM(a.NILAI_DKH) as TOTAL'); $this->db->from('daftar_katalogharga a'); $this->db->join('katalog_harga b','b.ID_KATALOG=a.KATALOG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where('b.STATUS_KATALOG=0'); $this->db->where('a.BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarKatalogHarga_byKATALOG_status0($id) { $this->db->select('*,FORMAT(a.NILAI_DKH,0) as NILAI'); $this->db->from('daftar_katalogharga a'); $this->db->join('katalog_harga b','b.ID_KATALOG=a.KATALOG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where('b.STATUS_KATALOG=0'); $this->db->where('a.KATALOG_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarKatalogHarga_byKATALOG($id) { $this->db->select('*,FORMAT(a.NILAI_DKH,2) as NILAI'); $this->db->from('daftar_katalogharga a'); $this->db->join('katalog_harga b','b.ID_KATALOG=a.KATALOG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where('a.KATALOG_ID=', $id); return $this->db->get()->result_array(); } public function getData_DaftarKatalogHarga_byKATALOG_byBARANG($id1, $id2) { $this->db->select('*,FORMAT(a.NILAI_DKH,2) as NILAI'); $this->db->from('daftar_katalogharga a'); $this->db->join('katalog_harga b','b.ID_KATALOG=a.KATALOG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where('a.KATALOG_ID=', $id1); $this->db->where('a.BARANG_ID=', $id2); return $this->db->get()->result_array(); } public function getData_DaftarKatalogHarga_byID($id) { $this->db->select('*,FORMAT(a.NILAI_DKH,2) as NILAI'); $this->db->from('daftar_katalogharga a'); $this->db->join('katalog_harga b','b.ID_KATALOG=a.KATALOG_ID'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID'); $this->db->where('a.ID_DKH=', $id); return $this->db->get()->result_array(); } public function getData_Katalog_byID($id) { $this->db->select('*,DATE_FORMAT(TGLAWAL_KATALOG,"%d/%m/%Y") as AWAL,DATE_FORMAT(TGLAKHIR_KATALOG,"%d/%m/%Y") as AKHIR'); $this->db->from('katalog_harga'); $this->db->where('ID_KATALOG=', $id); return $this->db->get()->result_array(); } public function getData_SnKlaimProgram_forHPP($id) { $this->db->select('*'); $this->db->from('sn_klaimprogram a'); $this->db->join('daftar_klaimprogram b','b.ID_DKPR=a.DKPR_ID'); $this->db->where('a.STATUS_SNKPR is NULL'); $this->db->where('b.JENIS_DKPR=1'); $this->db->where('b.BARANG_ID=', $id); return $this->db->get()->result_array(); } public function getSum_LinkKlaimProgram_bySNKPR($id) { $this->db->select('SUM(b.NILAI_PKPR) 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); $this->db->where('a.PROGRAM_ID!=1'); $this->db->group_by('a.SNKPR_ID'); return $this->db->get()->result_array(); } public function getMin_DaftarKlaimProgram_byBARANG($id) { $this->db->select('MIN(HARGA_DKPR) as MINIMUM'); $this->db->from('daftar_klaimprogram'); $this->db->where('BARANG_ID=', $id); $this->db->where('JENIS_DKPR=1'); return $this->db->get()->result_array(); } public function getData_JejakHarga_byID($id) { $this->db->select('*'); $this->db->from('jejak_hargakatalog'); $this->db->where('ID_JHK=', $id); return $this->db->get()->result_array(); } public function getData_Barang_fromKlaimProgram() { $this->db->select('*'); $this->db->from('daftar_klaimprogram a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->group_by('a.BARANG_ID'); $this->db->order_by('b.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getSum_DaftarFormKaryawan_byFK($id) { $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 getHasil_Lembur($jabatan, $awal ,$akhir, $jenis, $tgl = null) { 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" OR $day=="Sun") { $setawal = date('13:00'); } //Eliminasi Jam yang tidak sesuai if (strtotime($awal)>strtotime("07:00") AND strtotime($akhir)=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; } } return $lembur; } //Model Count public function getCount_UjicobaSO_80(){ $this->db2->select('ID_SO'); $this->db2->from('sales_order'); return $this->db2->count_all_results(); } public function getCount_Pembelian_0($level){ $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('STATUS_PEMBELIAN=0'); if ($level == 0) { $this->db->where('CORP_ID<=4'); } else if ($level == 1) { $this->db->where('CORP_ID=5'); } return $this->db->count_all_results(); } public function getCount_Pembelian_1($level){ $tgl_now = date('Y-m-01'); $range = $this->subTempoMonth($tgl_now,2); $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('STATUS_PEMBELIAN=1'); $this->db->where('TGL_INVBELI is NOT NULL'); $this->db->where('TGL_PEMBELIAN>=', $range); if ($level == 0) { $this->db->where('CORP_ID<=4'); } else if ($level == 1) { $this->db->where('CORP_ID=5'); } return $this->db->count_all_results(); } public function getCount_Pembelian_1_MonthNow($level){ $range = date('Y-m-01'); $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('STATUS_PEMBELIAN=1'); $this->db->where('TGL_INVBELI is NOT NULL'); $this->db->where('TGL_PEMBELIAN>=', $range); if ($level == 0) { $this->db->where('CORP_ID<=4'); } else if ($level == 1) { $this->db->where('CORP_ID=5'); } return $this->db->count_all_results(); } public function getCount_Pembelian_Null($level){ $this->db->select('ID_PEMBELIAN'); $this->db->from('pembelian'); $this->db->where('STATUS_PEMBELIAN is NULL'); if ($level == 0) { $this->db->where('CORP_ID<=4'); } else if ($level == 1) { $this->db->where('CORP_ID=5'); } return $this->db->count_all_results(); } public function getCount_SalesVisit_0($id_karyawan){ $this->db->select('ID_SAV'); $this->db->from('sales_visit'); $this->db->where('STATUS_SAV=0'); if ($id_karyawan == 1 OR $id_karyawan == 2 OR $id_karyawan == 50) { } else { $this->db->where('SALES_ID=', $id_karyawan); } return $this->db->count_all_results(); } public function getCount_ReturPembelian_Null($id){ $this->db->select('ID_RB'); $this->db->from('retur_pembelian'); $this->db->where('STATUS_RB is NULL'); $this->db->where('ADMIN_ID=', $id); return $this->db->count_all_results(); } public function getCount_ReturPembelian_0(){ $this->db->select('ID_RB'); $this->db->from('retur_pembelian'); $this->db->where('STATUS_RB=0'); return $this->db->count_all_results(); } public function getCount_Proyek_bySALES_statusNull($id=null){ $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('STATUS_PROYEK is NULL'); if ($id!=null) { $this->db->where('SALES_ID=', $id); } return $this->db->count_all_results(); } public function getCount_Proyek_bySALES_statusNull_Rifka(){ $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('SALES_ID=12 AND STATUS_PROYEK is NULL'); $this->db->or_where('SALES_ID=16 AND STATUS_PROYEK is NULL'); $this->db->or_where('SALES_ID=20 AND STATUS_PROYEK is NULL'); return $this->db->count_all_results(); } public function getCount_RekapKuartal_bySALES_statusNULL0($id=null){ $this->db->select('ID_RQ'); $this->db->from('rekap_kuartal'); if ($id!=null) { $this->db->where('STATUS_RQ is NULL AND SALES_ID=', $id); $this->db->or_where('STATUS_RQ=0 AND SALES_ID=', $id); } else { $this->db->where('STATUS_RQ is NULL'); $this->db->or_where('STATUS_RQ=0'); } return $this->db->count_all_results(); } public function getCount_RekapKuartal_bySALES_status0(){ $this->db->select('ID_RQ'); $this->db->from('rekap_kuartal'); $this->db->where('STATUS_RQ=0'); return $this->db->count_all_results(); } public function getCount_Kasbank_KasPcm_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID is NULL'); $this->db->where('KAS_ID=1'); return $this->db->count_all_results(); } public function getCount_Kasbank_KasItp_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID is NULL'); $this->db->where('KAS_ID=2'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('KAS_ID is NULL'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_1_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=1'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_2_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=2'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_3_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=3'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_4_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=4'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_5_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=5'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_6_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=6'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_7_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=7'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_8_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=8'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_9_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=9'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_10_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=10'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_11_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=11'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_12_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=12'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_13_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=13'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_14_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=14'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_15_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=15'); return $this->db->count_all_results(); } public function getCount_Kasbank_Bank_16_Null(){ $this->db->select('ID_KB'); $this->db->from('kasbank'); $this->db->where('STATUS_KB is NULL'); $this->db->where('BANK_ID=16'); return $this->db->count_all_results(); } public function getCount_JurnalMemo(){ $this->db->select('ID_JM'); $this->db->from('jurnal_memo'); return $this->db->count_all_results(); } public function getCount_DpPajak_PPH22() { $this->db->select('a.ID_DPP'); $this->db->from('dp_pajak a'); $this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID'); $this->db->join('daftar_rekappajak c','c.DPP_ID=a.ID_DPP','left'); $this->db->where('b.KODE_PPH=22'); $this->db->where('c.RPJ_ID is NULL'); return $this->db->count_all_results(); } public function getCount_RekapPajak_PPH22_status1() { $this->db->select('ID_RPJ'); $this->db->from('rekap_pajak'); $this->db->where('JENIS_RPJ=1'); $this->db->where('STATUS_RPJ=1'); return $this->db->count_all_results(); } public function getCount_RekapPajak_PPH23_status1() { $this->db->select('ID_RPJ'); $this->db->from('rekap_pajak'); $this->db->where('JENIS_RPJ=2'); $this->db->where('STATUS_RPJ=1'); return $this->db->count_all_results(); } public function getCount_RekapPajak_PPN_status1() { $this->db->select('ID_RPJ'); $this->db->from('rekap_pajak'); $this->db->where('JENIS_RPJ=3'); $this->db->where('STATUS_RPJ=1'); return $this->db->count_all_results(); } public function getCount_DpPajak_PPH23() { $this->db->select('a.ID_DPP'); $this->db->from('dp_pajak a'); $this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID'); $this->db->join('daftar_rekappajak c','c.DPP_ID=a.ID_DPP','left'); $this->db->where('b.KODE_PPH=23'); $this->db->where('c.RPJ_ID is NULL'); return $this->db->count_all_results(); } public function getCount_Penjualan_PPN() { $this->db->select('a.ID_PENJUALAN'); $this->db->from('penjualan a'); $this->db->join('daftar_rekappajak b','b.PENJUALAN_ID=a.ID_PENJUALAN','left'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('b.RPJ_ID is NULL'); $this->db->like('a.FP_PENJUALAN','02','after'); $this->db->or_like('a.FP_PENJUALAN','03','after'); return $this->db->count_all_results(); } public function getCount_CetakDokumen_SJPenjualan($level) { $tgl_now = date('Y-m-01'); $this->db->select('a.ID_CD'); $this->db->from('cetak_dokumen 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.TGL_CD>=', $tgl_now); $this->db->where('a.SJ_INV=0'); $this->db->where('a.PENJUALAN_ID is NOT NULL'); $this->db->not_like('a.KODE_BUKTI', '.'); if ($level == 0) { $this->db->where('c.CORP_ID<=3'); } else if ($level == 1) { $this->db->where('c.CORP_ID>=4'); } return $this->db->count_all_results(); } public function getCount_CetakDokumen_SJKonsinyasi($level) { $tgl_now = date('Y-m-01'); $this->db->select('a.ID_CD'); $this->db->from('cetak_dokumen a'); $this->db->join('konsinyasi b','b.ID_KONSINYASI=a.KONSINYASI_ID'); $this->db->where('b.JENIS_KONSINYASI=', $level); $this->db->where('a.TGL_CD>=', $tgl_now); $this->db->where('a.SJ_INV=0'); $this->db->where('a.KONSINYASI_ID is NOT NULL'); return $this->db->count_all_results(); } public function getCount_CetakDokumen_SJTarikKonsi($level) { $tgl_now = date('Y-m-01'); $this->db->select('a.ID_CD'); $this->db->from('cetak_dokumen a'); $this->db->join('penarikan_konsi b','b.ID_PK=a.PK_ID'); $this->db->where('b.JENIS_PK=', $level); $this->db->where('a.TGL_CD>=', $tgl_now); $this->db->where('a.SJ_INV=0'); $this->db->where('a.PK_ID is NOT NULL'); return $this->db->count_all_results(); } public function getCount_CetakDokumen_SJMutasiBarang() { $this->db->select('ID_CD'); $this->db->from('cetak_dokumen'); $this->db->where('SJ_INV=0'); $this->db->where('MB_ID is NOT NULL'); return $this->db->count_all_results(); } public function getCount_CetakDokumen_SJPeminjaman() { $this->db->select('ID_CD'); $this->db->from('cetak_dokumen'); $this->db->where('SJ_INV=0'); $this->db->where('PEMINJAMAN_ID is NOT NULL'); return $this->db->count_all_results(); } public function getCount_CetakDokumen_SJPenarikanSewa() { $this->db->select('ID_CD'); $this->db->from('cetak_dokumen'); $this->db->where('SJ_INV=0'); $this->db->where('PS_ID is NOT NULL'); $this->db->where('STATUS_CD is NULL'); return $this->db->count_all_results(); } public function getCount_CetakDokumen_NotaPenjualan($level) { $tgl_now = date('Y-m-01'); $this->db->select('a.ID_CD'); $this->db->from('cetak_dokumen 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.TGL_CD>=', $tgl_now); $this->db->where('a.SJ_INV=1'); $this->db->where('a.PENJUALAN_ID is NOT NULL'); $this->db->not_like('a.KODE_BUKTI', '.'); if ($level == 0) { $this->db->where('c.CORP_ID<=3'); } else if ($level == 1) { $this->db->where('c.CORP_ID>=4'); } return $this->db->count_all_results(); } public function getCount_CetakDokumen_ReturBeli($level) { $tgl_now = date('Y-m-01'); $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('pembelian c','c.ID_PEMBELIAN=b.PEMBELIAN_ID'); $this->db->where('a.TGL_CD>=', $tgl_now); $this->db->where('a.SJ_INV=1'); $this->db->where('a.RB_ID is NOT NULL'); if ($level == 0) { $this->db->where('c.CORP_ID<=4'); } else if ($level == 1) { $this->db->where('c.CORP_ID=5'); } return $this->db->count_all_results(); } public function getCount_CetakDokumen_Proforma($level, $id_karyawan, $jabatan) { $tgl_now = date('Y-m-01'); $this->db->select('a.ID_CD'); $this->db->from('cetak_dokumen a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->where('a.TGL_CD>=', $tgl_now); $this->db->where('a.SJ_INV=1'); $this->db->where('a.SO_ID is NOT NULL'); if ($level == 0) { $this->db->where('b.CORP_ID<=3'); } else if ($level == 1) { $this->db->where('b.CORP_ID>=4'); } if ($id_karyawan==1 OR $jabatan=="KEUANGAN" OR $jabatan=="ADMIN KEUANGAN" OR $jabatan=="ADMIN ITP") { } else { $this->db->where('b.SALES_ID=', $id_karyawan); } return $this->db->count_all_results(); } public function getCount_CetakDokumen_SJParsial($level) { $tgl_now = date('Y-m-01'); $this->db->select('a.ID_CD'); $this->db->from('cetak_dokumen 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.TGL_CD>=', $tgl_now); $this->db->where('a.SJ_INV=0'); $this->db->where('a.PENJUALAN_ID is NOT NULL'); $this->db->like('a.KODE_BUKTI', '.'); if ($level == 0) { $this->db->where('c.CORP_ID<=3'); } else if ($level == 1) { $this->db->where('c.CORP_ID>=4'); } return $this->db->count_all_results(); } public function getCount_Penjualan_1($level){ $tgl_now = date('Y-m-01'); $range = $this->subTempoMonth($tgl_now,2); $this->db->select('a.ID_PENJUALAN'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); if ($level == 0) { $this->db->where('b.CORP_ID<=3'); } else if ($level == 1) { $this->db->where('b.CORP_ID>=4'); } $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('a.SJ_PENJUALAN is NOT NULL'); $this->db->where('a.TGL_PENJUALAN>=', $range); return $this->db->count_all_results(); } public function getCount_KomisiPenjualan_1(){ $tgl_now = date('Y-m-01'); $range = $this->subTempoMonth($tgl_now,2); $this->db->select('a.ID_DO'); $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.STATUS_PENJUALAN=1'); $this->db->where('c.SJ_PENJUALAN is NOT NULL'); $this->db->where('c.TGL_PENJUALAN>=', $range); return $this->db->count_all_results(); } public function getCount_ReturPenjualan_0($level){ $this->db->select('a.ID_RJ'); $this->db->from('retur_penjualan a'); $this->db->join('daftar_returjual b','b.RJ_ID=a.ID_RJ','left'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID','left'); $this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID','left'); $this->db->join('penjualan e','e.ID_PENJUALAN=a.PENJUALAN_ID','left'); $this->db->join('sales_order f','f.ID_SO=e.SO_ID','left'); $this->db->join('pelanggan g','g.ID_PELANGGAN=f.PELANGGAN_ID','left'); $this->db->join('kota h','h.ID_KOTA=g.KOTA_ID','left'); $this->db->where('a.STATUS_RJ=0'); if ($level == 0) { $this->db->where('f.CORP_ID<=3'); } else if ($level == 1) { $this->db->where('f.CORP_ID>=4'); } $this->db->group_by('a.ID_RJ'); return $this->db->count_all_results(); } public function getCount_SalesOrder_Not1_Not5($id){ $tgl_now = date('Y-m-01'); $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('KONSINYASI_ID is NULL'); $this->db->where('STATUS_SO!=1'); $this->db->where('STATUS_SO!=5'); $this->db->where('SALES_ID=', $id); $this->db->where('TGL_SO>=', $tgl_now); return $this->db->count_all_results(); } public function getCount_SalesOrder_NotNull_Not1_Not2_Not3_Not5($level, $jabatan=null){ $this->db->select('ID_SO'); $this->db->from('sales_order'); if ($jabatan=="SUPPORT") { $this->db->where('STATUS_SO is NOT NULL AND STATUS_SO!=1 AND STATUS_SO!=2 AND STATUS_SO!=3 AND STATUS_SO!=4 AND STATUS_SO!=5 AND STATUS_SO!=6'); } else { $this->db->where('STATUS_SO is NOT NULL AND STATUS_SO!=1 AND STATUS_SO!=2 AND STATUS_SO!=3 AND STATUS_SO!=5'); } if ($level == 0) { $this->db->where('CORP_ID<=3'); } else if ($level == 1) { $this->db->where('CORP_ID>=4'); } return $this->db->count_all_results(); } public function getCount_SalesOrder_Not5_KirimNull(){ $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO is NOT NULL'); $this->db->where('STATUS_SO!=5'); return $this->db->count_all_results(); } public function getCount_SalesOrder_KirimNotNull(){ $tgl = date('Y-m-d'); $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('TGL_KIRIM=', $tgl); return $this->db->count_all_results(); } public function getCount_SalesOrder_1_KirimNull($id=null){ if ($id==null) { $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=1'); } else { $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=1'); $this->db->where('SALES_ID=', $id); } return $this->db->count_all_results(); } public function getCount_SalesOrder_1($id_karyawan) { $limit = date('Y-01-01'); $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=1'); $this->db->where('SALES_ID=', $id_karyawan); $this->db->where('TGL_SO>=', $limit); return $this->db->count_all_results(); } public function getCount_SalesOrder_4(){ $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO=4'); return $this->db->count_all_results(); } public function getCount_SalesOrder_Null($id){ $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO is NULL'); $this->db->where('CORP_ID<=3'); if ($id==1) { } else { $this->db->where(['SALES_ID' => $id]); } return $this->db->count_all_results(); } public function getCount_SalesOrder_Null_0_2_3_4_6_7(){ $this->db->select('ID_SO'); $this->db->from('sales_order'); $this->db->where('STATUS_SO is NULL'); $this->db->or_where('STATUS_SO=0'); $this->db->or_where('STATUS_SO=2'); $this->db->or_where('STATUS_SO=3'); $this->db->or_where('STATUS_SO=4'); $this->db->or_where('STATUS_SO=6'); $this->db->or_where('STATUS_SO=7'); return $this->db->count_all_results(); } public function getCount_SnStock_byBARANG($id) { $this->db->select('a.ID_SNSTOCK'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.BARANG_ID' => $id]); $this->db->where('a.STATUS_SNSTOCK is NULL'); return $this->db->count_all_results(); } public function getCount_Konsinyasi_Null_0(){ $this->db->select('ID_KONSINYASI'); $this->db->from('konsinyasi'); $this->db->where('STATUS_KONSINYASI is NULL'); $this->db->or_where('STATUS_KONSINYASI=0'); return $this->db->count_all_results(); } public function getCount_Konsinyasi_0(){ $this->db->select('ID_KONSINYASI'); $this->db->from('konsinyasi'); $this->db->where('STATUS_KONSINYASI=0'); return $this->db->count_all_results(); } public function getCount_Konsinyasi_statusNull($level){ $this->db->select('ID_KONSINYASI'); $this->db->from('konsinyasi'); $this->db->where('STATUS_KONSINYASI is NULL'); $this->db->where('JENIS_KONSINYASI=', $level); return $this->db->count_all_results(); } public function getCount_Operasional_Null_0(){ $this->db->select('ID_OPERASIONAL'); $this->db->from('operasional'); $this->db->where('STATUS_OPERASIONAL is NULL'); $this->db->or_where('STATUS_OPERASIONAL=0'); return $this->db->count_all_results(); } public function getCount_Peminjaman_Null_0($level){ $this->db->select('ID_PEMINJAMAN'); $this->db->from('peminjaman'); $this->db->where('STATUS_PEMINJAMAN is NULL AND JENIS_PEMINJAMAN=', $level); $this->db->or_where('STATUS_PEMINJAMAN=0 AND JENIS_PEMINJAMAN=', $level); return $this->db->count_all_results(); } public function getCount_Pending_Null($level){ $this->db->select('ID_PENDING'); $this->db->from('pending'); $this->db->where('STATUS_PENDING is NULL'); $this->db->where('JENIS_PENDING=', $level); return $this->db->count_all_results(); } public function getCount_Proyek_Null($id = null){ if ($id==null) { $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('STATUS_PROYEK is NULL'); } else { $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('SALES_ID=', $id); $this->db->where('STATUS_PROYEK is NULL'); } return $this->db->count_all_results(); } public function getCount_ProyekPra_Null($id = null){ if ($id==null) { $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('STATUS_PROYEK is NULL'); $this->db->like('KODE_PROYEK','PRA'); } else { $this->db->select('ID_PROYEK'); $this->db->from('proyek'); $this->db->where('SALES_ID=', $id); $this->db->where('STATUS_PROYEK is NULL'); $this->db->like('KODE_PROYEK','PRA'); } return $this->db->count_all_results(); } public function getCount_Service_Null($id, $level){ $this->db->select('ID_SERVICE'); $this->db->from('service'); $this->db->where('STATUS_SERVICE is NULL'); $this->db->where('PEMBUAT_ID=', $id); $this->db->where('JENIS_SERVICE=', $level); return $this->db->count_all_results(); } public function getCount_Service_0() { $this->db->select('ID_SERVICE'); $this->db->from('service'); $this->db->where('STATUS_SERVICE=0'); return $this->db->count_all_results(); } public function getCount_SnService_Null() { $this->db->select('ID_SNS'); $this->db->from('sn_service'); $this->db->where('STATUS_SNS is NULL'); return $this->db->count_all_results(); } public function getCount_SnService_2_TGLNull() { $this->db->select('ID_SNS'); $this->db->from('sn_service'); $this->db->where('STATUS_SNS=2'); $this->db->where('TGL_SNS is NULL'); return $this->db->count_all_results(); } public function getCount_SnService_allStatusPEL() { $this->db->select('a.ID_SNS'); $this->db->from('sn_service a'); $this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID'); $this->db->where('b.PELANGGAN_ID is NOT NULL'); $this->db->where('b.STATUS_SERVICE=1'); return $this->db->count_all_results(); } public function getCount_KlaimService_statusNull() { $this->db->select('ID_KSV'); $this->db->from('klaim_service'); $this->db->where('STATUS_KSV is NULL'); return $this->db->count_all_results(); } public function getCount_MutasiBarang_0_byLEVEL($id){ $this->db->select('ID_MB'); $this->db->from('mutasi_barang'); $this->db->where('STATUS_MB=0'); if ($id == 0) { $this->db->where('JENIS_MB=1'); } else if ($id == 1) { $this->db->where('JENIS_MB=0'); } return $this->db->count_all_results(); } public function getCount_Sewa_Null_0(){ $this->db->select('ID_SEWA'); $this->db->from('sewa'); $this->db->where('STATUS_SEWA is NULL'); $this->db->or_where('STATUS_SEWA=0'); return $this->db->count_all_results(); } public function getCount_SnKonsi_byPK_byBARANG($id1,$id2) { $this->db->select('*'); $this->db->from('sn_konsi a'); $this->db->join('daftar_konsi b','b.ID_DFK=a.DFK_ID'); $this->db->where(['a.PK_ID' => $id1]); $this->db->where(['b.BARANG_ID' => $id2]); return $this->db->count_all_results(); } public function getCount_SnSewa_byBARANG_Null_3($id) { $this->db->select('a.ID_SNSW'); $this->db->from('sn_sewa a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.BARANG_ID' => $id]); $this->db->where('a.STATUS_SNSW is NULL'); $this->db->or_where('a.STATUS_SNSW=3'); return $this->db->count_all_results(); } public function getCount_SnSewa_byPS_byBARANG($id1,$id2) { $this->db->select('*'); $this->db->from('sn_sewa a'); $this->db->join('daftar_sewa b','b.ID_DFSW=a.DFSW_ID'); $this->db->where(['a.PS_ID' => $id1]); $this->db->where(['b.BARANG_ID' => $id2]); return $this->db->count_all_results(); } public function getCount_SnStock_byBARANG_Null($id) { $this->db->select('a.ID_SNSTOCK'); $this->db->from('sn_stock a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID'); $this->db->where(['a.BARANG_ID' => $id]); $this->db->where('a.STATUS_SNSTOCK is NULL'); return $this->db->count_all_results(); } //Model getData public function getData_DaftarKatalogHarga_byAWAL_byAKHIR($awal, $akhir) { $this->db->select('*,DATE_FORMAT(b.TGLAWAL_KATALOG,"%d/%m/%Y") as AWAL,DATE_FORMAT(b.TGLAKHIR_KATALOG,"%d/%m/%Y") as AKHIR,FORMAT(a.NILAI_DKH,2) as NILAI'); $this->db->from('daftar_katalogharga a'); $this->db->join('katalog_harga b', 'b.ID_KATALOG=a.KATALOG_ID'); $this->db->join('barang c', 'c.ID_BARANG=a.BARANG_ID'); $this->db->where('b.TGLAWAL_KATALOG>=', $awal); $this->db->where('b.TGLAKHIR_KATALOG<=', $akhir); $this->db->order_by('b.ID_KATALOG ASC, c.NAMA_BARANG ASC'); return $this->db->get()->result_array(); } public function getData_Absensi_byKARYAWAN_byTGL($id, $tgl, $username=null) { $this->db->select('*,DATE_FORMAT(TGL_ABSENSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('absensi'); $this->db->where(['TGL_ABSENSI' => $tgl]); if ($username=="service") { $this->db->where('KARYAWAN_ID=22'); } else { $this->db->where(['KARYAWAN_ID' => $id]); } return $this->db->get()->result_array(); } public function getData_Absensi_byKARYAWAN_byTGL_statusCuti($id, $tgl) { $weekBefore = $this->addTempoDay($tgl, 7); $this->db->select('*,DATE_FORMAT(TGL_ABSENSI,"%d/%m/%Y") as TANGGAL'); $this->db->from('absensi'); $this->db->where('TELAT=3'); $this->db->where('KARYAWAN_ID=', $id); $this->db->where('TGL_ABSENSI>', $tgl); $this->db->where('TGL_ABSENSI<=', $weekBefore); $this->db->order_by('TGL_ABSENSI ASC'); $this->db->limit('1'); return $this->db->get()->result_array(); } public function getData_Absensi_Didalam($id) { $this->db->select('*,b.NAMA_PANGGILAN_KARYAWAN'); $this->db->from('absensi 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('b.STATUS_KARYAWAN=1'); $this->db->where('a.STATUS_ABSENSI<=2'); $this->db->where(['a.TGL_ABSENSI' => $id]); $this->db->order_by('a.MASUK_ABSENSI ASC'); return $this->db->get()->result_array(); } public function getData_Absensi_Diluar($id) { $this->db->select('*,b.NAMA_PANGGILAN_KARYAWAN'); $this->db->from('absensi 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('b.STATUS_KARYAWAN=1'); $this->db->where('a.STATUS_ABSENSI>2'); $this->db->where(['a.TGL_ABSENSI' => $id]); $this->db->order_by('a.MASUK_ABSENSI ASC'); return $this->db->get()->result_array(); } public function getData_Karyawan_forLogin($username, $password) { //Pembelian = [2, 18] $this->db->select('*'); $this->db->from('karyawan a'); $this->db->join('jabatan b', 'b.ID_JABATAN=a.JABATAN_ID'); $this->db->where('a.USERNAME=', $username); $this->db->where('a.PASSWORD=', $password); return $this->db->get()->result_array(); } public function getData_SurveyKaryawan_byNAMA($nama) { $this->db->select('*'); $this->db->from('survey_karyawan'); $this->db->where('NAMA_SVK=', $nama); $this->db->where('STATUS_SVK is NULL'); return $this->db->get()->result_array(); } public function getData_SurveyKaryawan_NULL() { $this->db->select('*'); $this->db->from('survey_karyawan'); $this->db->where('STATUS_SVK is NULL'); return $this->db->get()->result_array(); } public function getData_DaftarSurveyKaryawan_bySVK_byKARYAWAN($id, $karyawan) { $this->db->select('*'); $this->db->from('daftar_surveykaryawan'); $this->db->where('SVK_ID=', $id); $this->db->where('KARYAWAN_ID=', $karyawan); return $this->db->get()->result_array(); } //Model getID public function getID_KaryawanMax() { $this->db->select_max('ID_KARYAWAN'); $this->db->from('karyawan'); return $this->db->get()->result_array(); } public function getID_NotifikasiMax() { $this->db->select_max('ID_NOTIFIKASI'); $this->db->from('notifikasi'); return $this->db->get()->result_array(); } public function getID_FormTandaTerimaMax() { $this->db->select_max('ID_FTT'); $this->db->from('form_tandaterima'); return $this->db->get()->result_array(); } public function getID_FormTTKosongMax() { $this->db->select_max('ID_FTTK'); $this->db->from('form_ttkosong'); return $this->db->get()->result_array(); } public function getID_FormSjServiceMax() { $this->db->select_max('ID_FSS'); $this->db->from('form_sjservice'); return $this->db->get()->result_array(); } public function getID_SetdataMax() { $this->db->select_max('ID_SETDATA'); $this->db->from('setdata'); return $this->db->get()->result_array(); } //Model getSum public function getSum_SalesOrder_bySales_Bruto($id_karyawan) { $awal = date('Y-01-01'); $akhir = date('Y-12-31'); $this->db->select('CONCAT("Rp ",FORMAT(SUM(c.DEBET_PDA),2)) as TOTAL'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('piutang_dagang c','c.PENJUALAN_ID=a.ID_PENJUALAN'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); $this->db->where('b.SALES_ID=', $id_karyawan); return $this->db->get()->result_array(); } public function getSum_SalesOrder_bySales_Komisi($id_karyawan, $tgl_awal, $tgl_akhir) { $this->db->select('SUM(c.DEBET_PDA) as DEBET,SUM(c.KREDIT_PDA) as KREDIT,CONCAT("Rp ",FORMAT(SUM(c.KREDIT_PDA),2)) as TOTAL'); $this->db->from('sales_order a'); $this->db->join('penjualan b','b.SO_ID=a.ID_SO'); $this->db->join('piutang_dagang c','c.PENJUALAN_ID=b.ID_PENJUALAN'); $this->db->where('b.STATUS_PENJUALAN=1'); $this->db->where('b.TGL_PENJUALAN>=', $tgl_awal); $this->db->where('b.TGL_PENJUALAN<=', $tgl_akhir); $this->db->where('a.SALES_ID=', $id_karyawan); $this->db->having('DEBET=KREDIT'); return $this->db->get()->result_array(); } public function getSum_SalesOrder_bySales_Terbayar($id_karyawan) { $awal = date('Y-01-01'); $akhir = date('Y-12-31'); $this->db->select('CONCAT("Rp ",FORMAT(SUM(c.KREDIT_PDA),2)) as TOTAL'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('piutang_dagang c','c.PENJUALAN_ID=a.ID_PENJUALAN'); $this->db->where('c.TRANSAKSI_PDA=1'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); $this->db->where('b.SALES_ID=', $id_karyawan); return $this->db->get()->result_array(); } public function getSum_SalesOrder_bySales_BelumLunas($id_karyawan) { $awal = date('Y-01-01'); $akhir = date('Y-12-31'); $this->db->select('CONCAT("Rp ",FORMAT(SUM(c.DEBET_PDA-c.KREDIT_PDA),2)) as TOTAL'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('piutang_dagang c','c.PENJUALAN_ID=a.ID_PENJUALAN'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); $this->db->where('b.SALES_ID=', $id_karyawan); return $this->db->get()->result_array(); } public function getSum_SalesOrder_bySales_BelumLunasBefore($id_karyawan) { $yearNow = date('Y'); $yearLast = $yearNow-1; $awal = date("$yearLast-01-01"); $akhir = date("$yearLast-12-31"); $this->db->select('CONCAT("Rp ",FORMAT(SUM(c.DEBET_PDA-c.KREDIT_PDA),2)) as TOTAL'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('piutang_dagang c','c.PENJUALAN_ID=a.ID_PENJUALAN'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); $this->db->where('b.SALES_ID=', $id_karyawan); return $this->db->get()->result_array(); } public function getSum_SalesOrder_bySales_Retur($id_karyawan) { $awal = date('Y-01-01'); $akhir = date('Y-12-31'); $this->db->select('CONCAT("Rp ",FORMAT(SUM(c.KREDIT_PDA),2)) as TOTAL'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('piutang_dagang c','c.PENJUALAN_ID=a.ID_PENJUALAN'); $this->db->where('c.TRANSAKSI_PDA=2'); $this->db->where('a.STATUS_PENJUALAN=1'); $this->db->where('a.TGL_PENJUALAN>=', $awal); $this->db->where('a.TGL_PENJUALAN<=', $akhir); $this->db->where('b.SALES_ID=', $id_karyawan); return $this->db->get()->result_array(); } ///////////////////////////////////////////////////////////////////////////////// public function getSum_Penjualan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(c.QTY_DO*c.HARGA_DO),2)) as TOTAL,SUM(c.QTY_DO*c.HARGA_DO) as TOTALNERACA'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID'); $this->db->join('daftar_order c','c.SO_ID=b.ID_SO'); $this->db->where('a.SO_ID is NOT NULL'); $this->db->where('a.TGL_PENJUALAN>="2022-07-01"'); $this->db->where('a.TGL_PENJUALAN<"2022-08-01"'); $this->db->where('a.STATUS_PENJUALAN=1'); return $this->db->get()->result_array(); } public function getSum_ReturPenjualan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(b.QTY_DRJ*b.HARGA_DRJ),2)) as TOTAL,SUM(b.QTY_DRJ*b.HARGA_DRJ) as TOTALNERACA'); $this->db->from('retur_penjualan a'); $this->db->join('daftar_returjual b','b.RJ_ID=a.ID_RJ'); $this->db->where('a.TGL_RJ>="2022-07-01"'); $this->db->where('a.TGL_RJ<"2022-08-01"'); $this->db->where('a.STATUS_RJ=1'); return $this->db->get()->result_array(); } public function getSum_PotonganDiskonPenjualan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=25'); return $this->db->get()->result_array(); } public function getSum_PersediaanAwal_forNeraca($id) { $this->db->select('*,CONCAT("Rp ",FORMAT(NILAI_NERACA,2)) as TOTAL'); $this->db->from('neraca'); $this->db->where('PERKIRAAN_ID=26'); $this->db->where(['SETDATA_ID' => $id]); return $this->db->get()->result_array(); } public function getSum_Pembelian_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(b.QTY_DB*b.HARGA_DB),2)) as TOTAL,SUM(b.QTY_DB*b.HARGA_DB) as TOTALNERACA'); $this->db->from('pembelian a'); $this->db->join('daftar_beli b','b.PEMBELIAN_ID=a.ID_PEMBELIAN'); $this->db->where('a.TGL_PEMBELIAN>="2022-07-01"'); $this->db->where('a.TGL_PEMBELIAN<"2022-08-01"'); $this->db->where('a.STATUS_PEMBELIAN=1'); return $this->db->get()->result_array(); } public function getSum_ReturPembelian_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(b.QTY_DRB*b.HARGA_DRB),2)) as TOTAL,SUM(b.QTY_DRB*b.HARGA_DRB) as TOTALNERACA'); $this->db->from('retur_pembelian a'); $this->db->join('daftar_returbeli b','b.RB_ID=a.ID_RB'); $this->db->where('a.TGL_RB>="2022-07-01"'); $this->db->where('a.TGL_RB<"2022-08-01"'); $this->db->where('a.STATUS_RB=1'); return $this->db->get()->result_array(); } public function getSum_PotonganDiskonPembelian_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=29'); return $this->db->get()->result_array(); } public function getData_HargaAvg_groupBARANG_forNeraca() { $tgl_now = date('m/01/Y'); $tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('*'); $this->db->from('harga_avg'); $this->db->where('TGL_HAVG<"'.$tgl_next.'"'); $this->db->group_by('BARANG_ID'); return $this->db->get()->result_array(); } public function getData_HargaAvg_byBARANG_forNeraca($id) { $this->db->select('*'); $this->db->from('harga_avg'); $this->db->where(['BARANG_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Kuantiti_byID($id=null) { if ($id==null) { $this->db->select('ID_KUANTITI,GLOBAL_KUANTITI,HARGA_AVG'); $this->db->from('kuantiti'); $this->db->where('GLOBAL_KUANTITI>0'); } else { $this->db->select('*'); $this->db->from('kuantiti'); $this->db->where('ID_KUANTITI=',$id); } return $this->db->get()->result_array(); } public function getData_Kuantiti_forNeraca() { $this->db->select('SUM(GLOBAL_KUANTITI*HARGA_AVG) as TOTAL'); $this->db->from('kuantiti'); return $this->db->get()->result_array(); } public function getData_Setdata_byID($id) { $this->db->select('*'); $this->db->from('setdata'); $this->db->where('ID_SETDATA=',$id); return $this->db->get()->result_array(); } public function getSum_BiayaOperasional_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=31'); return $this->db->get()->result_array(); } public function getSum_BiayaPengiriman_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=32'); return $this->db->get()->result_array(); } public function getSum_BiayaServiceKendaraan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=33'); return $this->db->get()->result_array(); } public function getSum_BiayaBensin_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=34'); return $this->db->get()->result_array(); } public function getSum_BiayaParkirUmum_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=35'); return $this->db->get()->result_array(); } public function getSum_BiayaSparepart_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=36'); return $this->db->get()->result_array(); } public function getSum_BiayaKebutuhanService_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=37'); return $this->db->get()->result_array(); } public function getSum_BiayaGajiTHR_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=38'); return $this->db->get()->result_array(); } public function getSum_BiayaPajakPPHPsl21_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=39'); return $this->db->get()->result_array(); } public function getSum_BiayaIncentive_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=40'); return $this->db->get()->result_array(); } public function getSum_BiayaPLN_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=41'); return $this->db->get()->result_array(); } public function getSum_BiayaTelepon_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=42'); return $this->db->get()->result_array(); } public function getSum_BiayaInternet_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=43'); return $this->db->get()->result_array(); } public function getSum_BiayaPDAM_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=44'); return $this->db->get()->result_array(); } public function getSum_BiayaServiceChargeManggaDua_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=45'); return $this->db->get()->result_array(); } public function getSum_BiayaParkirKaryawan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=46'); return $this->db->get()->result_array(); } public function getSum_BiayaKonsultanPajak_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=47'); return $this->db->get()->result_array(); } public function getSum_BiayaATK_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=48'); return $this->db->get()->result_array(); } public function getSum_BiayaMaterai_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=49'); return $this->db->get()->result_array(); } public function getSum_BiayaFotocopy_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=50'); return $this->db->get()->result_array(); } public function getSum_BiayaMajalahKomputer_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=51'); return $this->db->get()->result_array(); } public function getSum_BiayaCetak_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=52'); return $this->db->get()->result_array(); } public function getSum_BiayaSuratReferensi_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=53'); return $this->db->get()->result_array(); } public function getSum_BiayaKebutuhanKantor_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=54'); return $this->db->get()->result_array(); } public function getSum_BiayaServiceLuar_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=55'); return $this->db->get()->result_array(); } public function getSum_BiayaTol_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=56'); return $this->db->get()->result_array(); } public function getSum_BiayaServiceAC_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=57'); return $this->db->get()->result_array(); } public function getSum_BiayaPajakKendaraan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=58'); return $this->db->get()->result_array(); } public function getSum_BiayaSumbangan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=59'); return $this->db->get()->result_array(); } public function getSum_BiayaEntertain_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=60'); return $this->db->get()->result_array(); } public function getSum_BiayaBPJS_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=61'); return $this->db->get()->result_array(); } public function getSum_BiayaAssKaryawan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=62'); return $this->db->get()->result_array(); } public function getSum_BiayaTraining_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=63'); return $this->db->get()->result_array(); } public function getSum_BiayaFee_byDKB_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=64'); return $this->db->get()->result_array(); } public function getSum_BiayaFee_byDJM_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DJM-a.KREDIT_DJM),2)) as TOTAL,SUM(a.DEBET_DJM-a.KREDIT_DJM) as TOTALNERACA'); $this->db->from('daftar_jurnalmemo a'); $this->db->join('jurnal_memo b','b.ID_JM=a.JM_ID'); $this->db->where('b.TGL_JM>="2022-07-01"'); $this->db->where('b.TGL_JM<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=64'); return $this->db->get()->result_array(); } public function getSum_BiayaDinasLuar_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=65'); return $this->db->get()->result_array(); } public function getSum_BiayaPajakPPHPsl25_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=66'); return $this->db->get()->result_array(); } public function getSum_BiayaPenyusutan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DJM-a.KREDIT_DJM),2)) as TOTAL,SUM(a.DEBET_DJM-a.KREDIT_DJM) as TOTALNERACA'); $this->db->from('daftar_jurnalmemo a'); $this->db->join('jurnal_memo b','b.ID_JM=a.JM_ID'); $this->db->where('b.TGL_JM>="2022-07-01"'); $this->db->where('b.TGL_JM<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=67'); return $this->db->get()->result_array(); } public function getSum_BiayaKegiatanKaryawan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=68'); return $this->db->get()->result_array(); } public function getSum_BiayaRekreasiKaryawan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=69'); return $this->db->get()->result_array(); } public function getSum_BiayaPengeluaranProject_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=70'); return $this->db->get()->result_array(); } public function getSum_BiayaBungaKredit_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=71'); return $this->db->get()->result_array(); } public function getSum_BiayaKreditBank_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=72'); return $this->db->get()->result_array(); } public function getSum_BiayaPerawatanPerbaikanGedung_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=73'); return $this->db->get()->result_array(); } public function getSum_BiayaLainLain_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=74'); return $this->db->get()->result_array(); } public function getSum_PendapatanDiluarUsaha_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=75'); return $this->db->get()->result_array(); } public function getSum_PendapatanJasaGiro_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=76'); return $this->db->get()->result_array(); } public function getSum_AdminBank_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=77'); return $this->db->get()->result_array(); } public function getSum_PajakGiro_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DKB-a.KREDIT_DKB),2)) as TOTAL,SUM(a.DEBET_DKB-a.KREDIT_DKB) as TOTALNERACA'); $this->db->from('daftar_kasbank a'); $this->db->join('kasbank b','b.ID_KB=a.KB_ID'); $this->db->where('b.TGL_KB>="2022-07-01"'); $this->db->where('b.TGL_KB<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=78'); return $this->db->get()->result_array(); } public function getSum_BiayaPajakPenghasilan_forNeraca() { //$tgl_now = date('m/01/Y'); //$tgl_next = $this->addTempoMonth($tgl_now,1); $this->db->select('CONCAT("Rp ",FORMAT(SUM(a.DEBET_DJM-a.KREDIT_DJM),2)) as TOTAL,SUM(a.DEBET_DJM-a.KREDIT_DJM) as TOTALNERACA'); $this->db->from('daftar_jurnalmemo a'); $this->db->join('jurnal_memo b','b.ID_JM=a.JM_ID'); $this->db->where('b.TGL_JM>="2022-07-01"'); $this->db->where('b.TGL_JM<"2022-08-01"'); $this->db->where('a.PERKIRAAN_ID=79'); return $this->db->get()->result_array(); } public function subTempoMonth($date,$month) { $sum = strtotime(date("Y-m-d", strtotime("$date")) . " -$month month"); $dateTo=date('Y-m-d',$sum); return $dateTo; } //Manajemen Kuartal public function getData_Kuartal_forManajemenKuartal($id_karyawan=null, $id_kuartal=null) { if ($id_kuartal == null) { $this->db->select('*'); $this->db->from('kuartal'); $this->db->order_by('STATUS_KUARTAL ASC'); } else { $this->db->select('*,a.SO_ID as SOID, FORMAT(c.FEE_SO, 2) as FEE, DATE_FORMAT(c.TGL_SO,"%d/%m/%Y") as TANGGAL, g.ID_PROYEK as PRID'); $this->db->from('manajemen_kuartal a'); $this->db->join('kuartal b','b.ID_KUARTAL=a.KUARTAL_ID'); $this->db->join('sales_order c','c.ID_SO=a.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('proyek g','g.SO_ID=c.ID_SO','left'); $this->db->order_by('c.TGL_SO ASC'); $this->db->where('a.KUARTAL_ID=', $id_kuartal); $this->db->where('a.KARYAWAN_ID=', $id_karyawan); } return $this->db->get()->result_array(); } public function getData_Kuartal_byID($id) { $this->db->select('*'); $this->db->from('kuartal'); $this->db->where(['ID_KUARTAL' => $id]); return $this->db->get()->result_array(); } public function getData_SalesOrder_forManajemenKuartal($id_karyawan) { $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('penjualan c','c.SO_ID=a.ID_SO'); $this->db->join('manajemen_kuartal d','d.SO_ID=a.ID_SO','left'); $this->db->where('a.SALES_ID=', $id_karyawan); $this->db->where('a.GP_SO=1'); $this->db->where('a.STATUS_SO=1'); $this->db->where('d.SO_ID IS NULL'); $this->db->group_by('a.ID_SO'); $this->db->order_by('a.TGL_SO ASC, a.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getData_ManajemenKuartal_byKuartal00($id_kuartal, $id_karyawan) { $this->db->select('*,DATE_FORMAT(b.TGL_SO,"%d/%m/%Y") as TANGGAL'); $this->db->from('manajemen_kuartal 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=a.KARYAWAN_ID'); $this->db->join('penjualan f','f.SO_ID=b.ID_SO'); $this->db->where(['a.KUARTAL_ID' => $id_kuartal]); $this->db->where(['a.KARYAWAN_ID' => $id_karyawan]); $this->db->order_by('b.TGL_SO ASC, b.KODE_SO ASC'); return $this->db->get()->result_array(); } public function getSum_DaftarOrder_bySO($id) { //Penjualan = [1] $this->db->select('SUM(a.QTY_DO*a.HARGA_DO) as TOTAL'); $this->db->from('daftar_order 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_HargaAvg_byBARANG_forManajemenKuartal($id, $tanggal) { $this->db->select('*'); $this->db->from('harga_avg'); $this->db->where(['BARANG_ID' => $id]); $this->db->where('TGL_HAVG<=', $tanggal); $this->db->order_by('ID_HAVG DESC'); return $this->db->get()->result_array(); } public function getSum_HppProyek_bySO($id) { $this->db->select('SUM(a.HARGA_HPR) as TOTAL'); $this->db->from('hpp_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_ID'); $this->db->join('sales_order c','c.ID_SO=b.SO_ID'); $this->db->where(['b.SO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarOrder_bySO_forTotalA2($id) { $this->db->select('*,CONCAT("Rp ",FORMAT(a.HARGA_DO,2)) as HARGA,CONCAT("Rp ",FORMAT(e.NILAI_HAVG,2)) as AVG, CONCAT("Rp ",FORMAT(f.DEALER_HSRP,2)) as DEALER,CONCAT("Rp ",FORMAT(f.USER_HSRP,2)) as USER,a.BARANG_ID as AID'); $this->db->from('daftar_order a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID','left'); $this->db->join('barang c','c.ID_BARANG=a.BARANG_ID','left'); $this->db->join('kuantiti d','d.ID_KUANTITI=a.BARANG_ID','left'); $this->db->join('harga_avg e','e.BARANG_ID=a.BARANG_ID','left'); $this->db->join('harga_srp f','f.BARANG_ID=a.BARANG_ID','left'); $this->db->join('pelanggan g','g.ID_PELANGGAN=b.PELANGGAN_ID','left'); $this->db->join('jenis h','h.ID_JENIS=c.JENIS_ID','left'); $this->db->where(['a.SO_ID' => $id]); $this->db->group_by('a.ID_DO'); return $this->db->get()->result_array(); } public function getSum_DaftarOrder_byID($id) { $this->db->select('SUM(a.QTY_DO*a.HARGA_DO) as TOTAL,c.TYPE_JENIS'); $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.ID_DO' => $id]); return $this->db->get()->result_array(); } public function getData_Penjualan_bySO($id) { $this->db->select('*'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID','left'); $this->db->where(['a.SO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Penjualan_byID($id) { $this->db->select('*'); $this->db->from('penjualan a'); $this->db->join('sales_order b','b.ID_SO=a.SO_ID','left'); $this->db->where(['a.ID_PENJUALAN' => $id]); return $this->db->get()->result_array(); } public function getData_Penjualan() { $this->db->select('*'); $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->order_by('a.INV_PENJUALAN ASC'); return $this->db->get()->result_array(); } public function getData_Pelanggan_dataSERVICE() { $this->db->select('*'); $this->db->from('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->group_by('a.PELANGGAN_ID'); $this->db->order_by('b.NAMA_PELANGGAN ASC'); return $this->db->get()->result_array(); } public function getSum_PiutangDagang_byPENJUALAN_forManajemenKuartal($id) { $this->db->select('SUM(DEBET_PDA-KREDIT_PDA) as TOTAL'); $this->db->from('piutang_dagang'); $this->db->where('TRANSAKSI_PDA!=2'); $this->db->where(['PENJUALAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_PiutangDagang_byPENJUALAN_forManajemenKuartal($id) { $this->db->select('*'); $this->db->from('piutang_dagang'); $this->db->where('TRANSAKSI_PDA!=2'); $this->db->where(['PENJUALAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_PiutangDagang_byPENJUALAN($id) { $this->db->select('*,DATE_FORMAT(TGL_PDA,"%d/%m/%Y") as TANGGAL,FORMAT(DEBET_PDA,2) as DEBET,FORMAT(KREDIT_PDA,2) as KREDIT'); $this->db->from('piutang_dagang'); $this->db->where(['PENJUALAN_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Kasbank_byKODE($id) { $this->db->select('*'); $this->db->from('kasbank'); $this->db->where(['KODE_KB' => $id]); return $this->db->get()->result_array(); } public function getData_JurnalMemo_byKODE($id) { $this->db->select('*'); $this->db->from('jurnal_memo'); $this->db->where(['KODE_JM' => $id]); return $this->db->get()->result_array(); } public function getData_Kuartal_byID_StatusKunci($id) { $this->db->select('*,DATE_FORMAT(KUNCI_KUARTAL,"%d/%m/%Y") as TANGGAL'); $this->db->from('kuartal'); $this->db->where(['ID_KUARTAL' => $id]); return $this->db->get()->result_array(); } public function getData_ManajemenKuartal_bySO($id) { $this->db->select('*'); $this->db->from('manajemen_kuartal'); $this->db->where(['SO_ID' => $id]); return $this->db->get()->result_array(); } public function getData_ManajemenKuartal_byID($id) { $this->db->select('*'); $this->db->from('manajemen_kuartal'); $this->db->where(['ID_MK' => $id]); return $this->db->get()->result_array(); } public function getData_PiutangDagang_bySALES_forFormFee($id) { $this->db->select('*,(SUM(a.DEBET_PDA-a.KREDIT_PDA)-c.FEE_SO) as TOTAL,DATE_FORMAT(c.TGL_SO,"%d/%m/%Y") as TANGGAL,FORMAT(c.FEE_SO,2) as FEE, d.NAMA_PELANGGAN as NAMPEL,a.PENJUALAN_ID as PID'); $this->db->from('piutang_dagang 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('form_karyawan e','e.PENJUALAN_ID=a.PENJUALAN_ID','left'); $this->db->where(['c.SALES_ID' => $id]); $this->db->where('a.TRANSAKSI_PDA!=2'); $this->db->where('c.FEE_SO>0'); $this->db->where('e.ID_FK is NULL'); $this->db->where('b.TGL_PENJUALAN>"2022-12-31"'); $this->db->group_by('a.PENJUALAN_ID'); $this->db->order_by('c.KODE_SO DESC'); return $this->db->get()->result_array(); } public function getData_PiutangDagang_bySALES_forFormFeePelanggan($id) { $this->db->select('*,(SUM(a.DEBET_PDA-a.KREDIT_PDA)-c.FEE_SO) as TOTAL,DATE_FORMAT(c.TGL_SO,"%d/%m/%Y") as TANGGAL,FORMAT(c.FEE_SO,2) as FEE, d.NAMA_PELANGGAN as NAMPEL,a.PENJUALAN_ID as PID'); $this->db->from('piutang_dagang 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('form_feepelanggan e','e.PENJUALAN_ID=a.PENJUALAN_ID','left'); $this->db->where(['c.SALES_ID' => $id]); $this->db->where('a.TRANSAKSI_PDA!=2'); $this->db->where('c.FEE_SO>0'); $this->db->where('e.ID_FFP is NULL'); $this->db->where('b.TGL_PENJUALAN>"2022-12-31"'); $this->db->group_by('a.PENJUALAN_ID'); $this->db->order_by('c.KODE_SO DESC'); return $this->db->get()->result_array(); } public function getData_SalesOrder_forManajemenKuartal_khususBarang($id_kuartal, $id_karyawan) { $this->db->select('a.KODE_SO, a.PPN_SO, b.INV_PENJUALAN, DATE_FORMAT(b.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(SUM(h.QTY_DO*h.HARGA_DO),2) as DPP, FORMAT(SUM((a.PPN_SO/100)*(h.QTY_DO*h.HARGA_DO)),2) as PPN,FORMAT(ROUND(SUM(((a.PPN_SO+100)/100)*(h.QTY_DO*h.HARGA_DO))),2) as TOTAL, c.NAMA_PELANGGAN, d.NAMA_KOTA, FORMAT(a.FEE_SO,2) as FEESO'); $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->join('kota d','d.ID_KOTA=c.KOTA_ID'); $this->db->join('manajemen_kuartal e','e.SO_ID=a.ID_SO'); $this->db->join('kuartal f','f.ID_KUARTAL=e.KUARTAL_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=e.KARYAWAN_ID'); $this->db->join('daftar_order h','h.SO_ID=a.ID_SO'); $this->db->where(['e.KARYAWAN_ID' => $id_karyawan]); $this->db->where(['e.KUARTAL_ID' => $id_kuartal]); $this->db->where('a.STATUS_SO=1'); $this->db->group_by('a.ID_SO'); return $this->db->get()->result_array(); } public function getData_DaftarOrder_forManajemenKuartal($id_kuartal, $id_karyawan) { $this->db->select('d.TGL_SO as TGL, b.KODE_BARANG, a.BARANG_ID, DATE_FORMAT(d.TGL_SO,"%d/%m/%Y") as TANGGAL, a.QTY_DO as QTY, d.KODE_SO as KODEBUKTI, d.TGL_SO'); $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('manajemen_kuartal e','e.SO_ID=d.ID_SO'); $this->db->join('kuartal f','f.ID_KUARTAL=e.KUARTAL_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=e.KARYAWAN_ID'); $this->db->where(['e.KARYAWAN_ID' => $id_karyawan]); $this->db->where(['e.KUARTAL_ID' => $id_kuartal]); $this->db->where('c.TYPE_JENIS!=2'); return $this->db->get()->result_array(); } public function getData_TransaksiStock_forManajemenKuartal($id_kuartal, $id_karyawan) { $this->db->select('a.TGL_IO as TGL, b.KODE_BARANG, a.BARANG_ID, DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL, a.QTY_IO as QTY, a.KODE_BUKTI as KODEBUKTI,d.TGL_SO'); $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->join('manajemen_kuartal e','e.SO_ID=d.ID_SO'); $this->db->join('kuartal f','f.ID_KUARTAL=e.KUARTAL_ID'); $this->db->join('karyawan g','g.ID_KARYAWAN=e.KARYAWAN_ID'); $this->db->where(['e.KARYAWAN_ID' => $id_karyawan]); $this->db->where(['e.KUARTAL_ID' => $id_kuartal]); $this->db->where('a.JENIS_IO=0'); return $this->db->get()->result_array(); } public function getData_HppProyek_forManajemenKuartal($id_kuartal, $id_karyawan) { $this->db->select('*,FORMAT(a.HARGA_HPR,2) as HARGAHPR,DATE_FORMAT(c.TGL_SO,"%d/%m/%Y") as TANGGAL'); $this->db->from('hpp_proyek a'); $this->db->join('proyek b','b.ID_PROYEK=a.PROYEK_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('daftar_kasbank f','f.ID_DKB=a.DKB_ID'); $this->db->join('manajemen_kuartal g','g.SO_ID=c.ID_SO'); $this->db->join('kuartal h','h.ID_KUARTAL=g.KUARTAL_ID'); $this->db->join('karyawan i','i.ID_KARYAWAN=g.KARYAWAN_ID'); $this->db->join('kasbank j','j.ID_KB=f.KB_ID'); $this->db->where(['g.KARYAWAN_ID' => $id_karyawan]); $this->db->where(['g.KUARTAL_ID' => $id_kuartal]); return $this->db->get()->result_array(); } } ?>