1514 lines
62 KiB
PHP
1514 lines
62 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
class ModelKeuangan extends CI_Model {
|
|
public function create($table, $data, $batch = false)
|
|
{
|
|
if($batch === false){
|
|
$insert = $this->db->insert($table, $data);
|
|
}else{
|
|
$insert = $this->db->insert_batch($table, $data);
|
|
}
|
|
return $insert;
|
|
}
|
|
|
|
public function update($table, $data, $pk, $id = null, $batch = false)
|
|
{
|
|
if($batch === false){
|
|
$insert = $this->db->update($table, $data, array($pk => $id));
|
|
}else{
|
|
$insert = $this->db->update_batch($table, $data, $pk);
|
|
}
|
|
return $insert;
|
|
}
|
|
|
|
public function delete($table, $data, $pk)
|
|
{
|
|
$this->db->where_in($pk, $data);
|
|
return $this->db->delete($table);
|
|
}
|
|
|
|
public function getData_Kas_byID($id=null) { //Keuangan = [1, 2, 43, 44, 71, 84]
|
|
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_Kas_byKAS($id) { //Keuangan = [1, 2]
|
|
$this->db->select('*,FORMAT(a.NILAI_KB,2) as NILAI,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('kas b','b.ID_KAS=a.KAS_ID');
|
|
$this->db->join('daftar_kasbank c','c.KB_ID=a.ID_KB','left');
|
|
$this->db->where(['a.KAS_ID' => $id]);
|
|
$this->db->where('a.STATUS_KB is NULL');
|
|
$this->db->where('a.BANK_ID is NULL');
|
|
$this->db->group_by('a.ID_KB');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SaldoKas_byKAS_byTGL($id){ //Keuangan = [1, 2, 3]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT((SUM(DEBET_SK-KREDIT_SK)),2)) as TOTAL');
|
|
$this->db->from('saldo_kas');
|
|
$this->db->where(['KAS_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kasbank_Kas_0($id1, $id2) { //Keuangan = [3]
|
|
$this->db->select('*,FORMAT(a.NILAI_KB,2) as NILAI,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('kas b','b.ID_KAS=a.KAS_ID','left');
|
|
$this->db->join('bank c','c.ID_BANK=a.BANK_ID','left');
|
|
$this->db->join('daftar_kasbank d','d.KB_ID=a.ID_KB','left');
|
|
$this->db->where('a.STATUS_KB=0');
|
|
$this->db->where('a.BANK_ID is NULL');
|
|
$this->db->order_by('a.JENIS_KB DESC, a.KODE_KB DESC');
|
|
$this->db->where('a.TGL_KB>="'.$id1.'"');
|
|
$this->db->where('a.KAS_ID=', $id2);
|
|
$this->db->group_by('a.ID_KB');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Bank_byID($id=null) { //Keuangan = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 44, 71, 72, 84]
|
|
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_Kasbank_Bank_byBANK($id) { //Keuangan = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
|
|
$this->db->select('*,FORMAT(a.NILAI_KB,2) as NILAI,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('bank b','b.ID_BANK=a.BANK_ID');
|
|
$this->db->join('daftar_kasbank c','c.KB_ID=a.ID_KB','left');
|
|
$this->db->where(['a.BANK_ID' => $id]);
|
|
$this->db->where('a.STATUS_KB is NULL');
|
|
$this->db->where('a.KAS_ID is NULL');
|
|
$this->db->group_by('a.ID_KB');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SaldoBank_byBANK_byTGL($id){ //Keuangan = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT((SUM(a.DEBET_SB-a.KREDIT_SB)),2)) as TOTAL');
|
|
$this->db->from('saldo_bank a');
|
|
$this->db->join('bank b','b.ID_BANK=a.BANK_ID');
|
|
$this->db->where(['a.BANK_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kasbank_Bank_0($id1, $id2=null, $id3=null) { //Keuangan = [20, 65, 82]
|
|
if ($id3==null) {
|
|
$this->db->select('*,FORMAT(a.NILAI_KB,2) as NILAI,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('kas b','b.ID_KAS=a.KAS_ID','left');
|
|
$this->db->join('bank c','c.ID_BANK=a.BANK_ID','left');
|
|
$this->db->join('daftar_kasbank d','d.KB_ID=a.ID_KB','left');
|
|
$this->db->where('a.STATUS_KB=0');
|
|
$this->db->where('a.KAS_ID is NULL');
|
|
$this->db->order_by('a.JENIS_KB DESC, a.KODE_KB DESC');
|
|
$this->db->where('a.TGL_KB>="'.$id1.'"');
|
|
$this->db->where('a.BANK_ID=', $id2);
|
|
$this->db->group_by('a.ID_KB');
|
|
} else {
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(a.NILAI_KB,2)) as NILAI');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('kas b','b.ID_KAS=a.KAS_ID','left');
|
|
$this->db->join('bank c','c.ID_BANK=a.BANK_ID','left');
|
|
$this->db->where('a.STATUS_KB=0');
|
|
$this->db->where('a.KAS_ID is NULL');
|
|
$this->db->order_by('a.JENIS_KB DESC');
|
|
$this->db->where('a.TGL_KB>="'.$id1.'"');
|
|
$this->db->where(['a.ID_KB' => $id3]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getKodeKasMasuk() { //Keuangan = [21]
|
|
$this->db->select('MAX(KODE_KB) AS KODE');
|
|
$this->db->from('kasbank');
|
|
$this->db->like('KODE_KB','BKM', 'after');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getKodeKasKeluar() { //Keuangan = [22]
|
|
$this->db->select('MAX(KODE_KB) AS KODE');
|
|
$this->db->from('kasbank');
|
|
$this->db->like('KODE_KB','BKK', 'after');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getKodeBankMasuk() { //Keuangan = [23]
|
|
$this->db->select('MAX(KODE_KB) AS KODE');
|
|
$this->db->from('kasbank');
|
|
$this->db->like('KODE_KB','BBM', 'after');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getKodeBankKeluar() { //Keuangan = [24]
|
|
$this->db->select('MAX(KODE_KB) AS KODE');
|
|
$this->db->from('kasbank');
|
|
$this->db->like('KODE_KB','BBK', 'after');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasbank_forCheckDuplicateBank($tgl_input, $id_bank, $jenis_kb, $nilai_kb, $ket_dkb) { //Keuangan = [25]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_ID');
|
|
$this->db->where(['b.TGL_INPUT' => $tgl_input]);
|
|
$this->db->where(['b.BANK_ID' => $id_bank]);
|
|
$this->db->where(['b.JENIS_KB' => $jenis_kb]);
|
|
$this->db->where(['b.NILAI_KB' => $nilai_kb]);
|
|
$this->db->where(['a.KET_DKB' => $ket_dkb]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasbank_forCheckDuplicateKas($tgl_input, $id_kas, $jenis_kb, $nilai_kb, $ket_dkb) { //Keuangan = [25]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_ID');
|
|
$this->db->where(['b.TGL_INPUT' => $tgl_input]);
|
|
$this->db->where(['b.KAS_ID' => $id_kas]);
|
|
$this->db->where(['b.JENIS_KB' => $jenis_kb]);
|
|
$this->db->where(['b.NILAI_KB' => $nilai_kb]);
|
|
$this->db->where(['a.KET_DKB' => $ket_dkb]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_KasbankMax() { //Keuangan = [25]
|
|
$this->db->select_max('ID_KB');
|
|
$this->db->from('kasbank');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_SaldoKasMax() { //Keuangan = [25, 43, 71, 95, 97]
|
|
$this->db->select_max('ID_SK');
|
|
$this->db->from('saldo_kas');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_DaftarKasbankMax() { //Keuangan = [25, 30, 31, 32, 33, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 58, 59, 60, 61, 68, 69, 70, 71, 72, 73, 74, 76, 77, 78, 79, 102]
|
|
$this->db->select_max('ID_DKB');
|
|
$this->db->from('daftar_kasbank');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_SaldoBankMax() { //Keuangan = [25, 44, 72, 94, 96]
|
|
$this->db->select_max('ID_SB');
|
|
$this->db->from('saldo_bank');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kasbank_byID($id) { //Keuangan = [26, 28, 29, 38, 39, 56, 57, 66, 67]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(a.NILAI_KB,2)) as NILAI');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('kas b','b.ID_KAS=a.KAS_ID','left');
|
|
$this->db->join('bank c','c.ID_BANK=a.BANK_ID','left');
|
|
$this->db->where(['a.ID_KB' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_Kasbank_byKB_0($id) { //Keuangan = [26]
|
|
$this->db->select('SUM(b.DEBET_DKB) as TOTAL');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('daftar_kasbank b','b.KB_ID=a.ID_KB');
|
|
$this->db->where(['a.ID_KB' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_Kasbank_byKB_1($id) { //Keuangan = [26]
|
|
$this->db->select('SUM(b.KREDIT_DKB) as TOTAL');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('daftar_kasbank b','b.KB_ID=a.ID_KB');
|
|
$this->db->where(['a.ID_KB' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasbank_byKB($id) { //Keuangan = [26, 103]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_ID');
|
|
$this->db->where(['a.KB_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasbank_byKB_Kasbankmasuk($id) { //Keuangan = [27, 28, 29, 56, 57]
|
|
$this->db->select('*,FORMAT(a.DEBET_DKB,2) as DEBET,FORMAT(a.KREDIT_DKB,2) as KREDIT');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_ID');
|
|
$this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID');
|
|
$this->db->join('kas d','d.ID_KAS=b.KAS_ID','left');
|
|
$this->db->join('bank e','e.ID_BANK=b.BANK_ID','left');
|
|
$this->db->where(['a.KB_ID' => $id]);
|
|
$this->db->order_by('a.DEBET_DKB DESC, c.KODE_PERKIRAAN ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasbank_byID($id) { //Keuangan = [27, 35, 53, 63, 80]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_ID');
|
|
$this->db->where(['a.ID_DKB' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangDagang_forDKB($id = null){ //Keuangan = [28, 29, 56, 57, 84, 86, 91, 93, 98]
|
|
if ($id == null) {
|
|
$this->db->select('a.*,d.INV_PENJUALAN,b.NAMA_PELANGGAN,c.NAMA_KOTA,CONCAT("Rp ",FORMAT((SUM(a.DEBET_PDA)),2)) as DEBET,CONCAT("Rp ",FORMAT((SUM(a.KREDIT_PDA)),2)) as KREDIT,CONCAT("Rp ",FORMAT((SUM(a.DEBET_PDA-a.KREDIT_PDA)),2)) as SELISIH');
|
|
$this->db->from('piutang_dagang 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('penjualan d','d.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('sales_order e','e.ID_SO=d.SO_ID','left');
|
|
$this->db->order_by('b.NAMA_PELANGGAN ASC,a.TGL_PDA ASC');
|
|
$this->db->group_by('a.PENJUALAN_ID');
|
|
$this->db->having('DEBET!=KREDIT');
|
|
}else{
|
|
$this->db->select('a.*,b.INV_PENJUALAN,c.NAMA_PELANGGAN,d.NAMA_KOTA,SUM(a.DEBET_PDA) as DEBET,SUM(a.KREDIT_PDA) as KREDIT,SUM(a.DEBET_PDA-a.KREDIT_PDA) as SELISIH');
|
|
$this->db->from('piutang_dagang a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->group_by('a.PENJUALAN_ID');
|
|
$this->db->having('DEBET!=KREDIT');
|
|
$this->db->where(['b.INV_PENJUALAN' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangPihakke3_forDKB($id = null){ //Keuangan = [28, 29, 33, 56, 57, 61]
|
|
if ($id == null) {
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT((SUM(a.DEBET_PPK)),2)) as DEBET,CONCAT("Rp ",FORMAT((SUM(a.KREDIT_PPK)),2)) as KREDIT,CONCAT("Rp ",FORMAT((SUM(a.DEBET_PPK-a.KREDIT_PPK)),2)) as SELISIH');
|
|
$this->db->from('piutang_pihakke3 a');
|
|
$this->db->join('pihakke3 b','b.ID_PIHAKKE3=a.PIHAKKE3_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->group_by('a.PIHAKKE3_ID');
|
|
$this->db->having('DEBET!=KREDIT');
|
|
}else{
|
|
$this->db->select('*,SUM(a.DEBET_PPK) as DEBET,SUM(a.KREDIT_PPK) as KREDIT,SUM(a.DEBET_PPK-a.KREDIT_PPK) as SELISIH');
|
|
$this->db->from('piutang_pihakke3 a');
|
|
$this->db->join('pihakke3 b','b.ID_PIHAKKE3=a.PIHAKKE3_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->group_by('a.PIHAKKE3_ID');
|
|
$this->db->having('DEBET!=KREDIT');
|
|
$this->db->where(['a.PIHAKKE3_ID' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Bank_forDkb($id){ //Keuangan = [28, 29, 38, 39, 56, 57, 66, 67]
|
|
$this->db->select('*');
|
|
$this->db->from('bank');
|
|
$this->db->where('ID_BANK !=', $id);
|
|
$this->db->order_by('KODE_BANK ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Pelanggan_byID($id = null){ //Keuangan = [28, 29, 56, 57]
|
|
if ($id === null) {
|
|
$this->db->select('a.*,b.NAMA_KOTA');
|
|
$this->db->from('pelanggan a');
|
|
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
|
$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->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_Supplier_byID($id = null){ //Keuangan = [28, 29, 38, 39, 56, 57, 66, 67]
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('supplier a');
|
|
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
|
$this->db->order_by('a.NAMA_SUPPLIER ASC');
|
|
}else{
|
|
$this->db->select('*');
|
|
$this->db->from('supplier a');
|
|
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID','left');
|
|
$this->db->where(['a.ID_SUPPLIER' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangKaryawan_forDKB($id = null){ //Keuangan = [28, 29, 32, 56, 57, 60]
|
|
if ($id == null) {
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT((SUM(a.DEBET_PKA)),2)) as DEBET,CONCAT("Rp ",FORMAT((SUM(a.KREDIT_PKA)),2)) as KREDIT,CONCAT("Rp ",FORMAT((SUM(a.DEBET_PKA-a.KREDIT_PKA)),2)) as SELISIH');
|
|
$this->db->from('piutang_karyawan a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->group_by('a.KARYAWAN_ID');
|
|
$this->db->having('DEBET!=KREDIT');
|
|
}else{
|
|
$this->db->select('*,SUM(a.DEBET_PKA) as DEBET,SUM(a.KREDIT_PKA) as KREDIT,SUM(a.DEBET_PKA-a.KREDIT_PKA) as SELISIH');
|
|
$this->db->from('piutang_karyawan a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->group_by('a.KARYAWAN_ID');
|
|
$this->db->having('DEBET!=KREDIT');
|
|
$this->db->where(['a.KARYAWAN_ID' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kas_forDkb($id){ //Keuangan = [28, 29, 38, 39, 56, 57, 66, 67]
|
|
$this->db->select('*');
|
|
$this->db->from('kas');
|
|
$this->db->where('ID_KAS !=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Perkiraan_Lain_Kasbankmasuk() { //Keuangan = [28, 29, 56, 57]
|
|
$this->db->select('*');
|
|
$this->db->from('perkiraan');
|
|
$this->db->like('KODE_PERKIRAAN','6', 'after');
|
|
$this->db->not_like('KODE_PERKIRAAN','6103');
|
|
$this->db->not_like('KODE_PERKIRAAN','6104');
|
|
$this->db->not_like('KODE_PERKIRAAN','6227');
|
|
$this->db->not_like('KODE_PERKIRAAN','6233');
|
|
$this->db->or_like('KODE_PERKIRAAN','7', 'after');
|
|
$this->db->not_like('KODE_PERKIRAAN','7500');
|
|
$this->db->or_like('KODE_PERKIRAAN','8', 'after');
|
|
$this->db->or_like('KODE_PERKIRAAN','9', 'after');
|
|
$this->db->or_like('KODE_PERKIRAAN','2130');
|
|
$this->db->or_like('KODE_PERKIRAAN','2140');
|
|
$this->db->or_like('KODE_PERKIRAAN','3100');
|
|
$this->db->or_like('KODE_PERKIRAAN','4130');
|
|
$this->db->or_like('KODE_PERKIRAAN','5122');
|
|
$this->db->order_by('KODE_PERKIRAAN ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PihakKe3_byID($id = null){ //Keuangan = [28, 38, 39, 66, 67]
|
|
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 getSum_DaftarKasbank_byKB($id) { //Keuangan = [28, 29, 38, 56, 57, 66, 67]
|
|
$this->db->select('SUM(DEBET_DKB) as DEBET,SUM(KREDIT_DKB) as KREDIT');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where(['KB_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kasbank_Kas_Null($id = null) { //Keuangan = [30, 31, 32, 33, 34, 35, 36, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 102]
|
|
if ($id === null) {
|
|
$this->db->select('*,FORMAT(a.NILAI_KB,2) as NILAI,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('daftar_kasbank b','b.KB_ID=a.ID_KB');
|
|
$this->db->join('kas c','c.ID_KAS=a.KAS_ID','left');
|
|
$this->db->join('bank d','d.ID_BANK=a.BANK_ID','left');
|
|
$this->db->where('a.STATUS_KB is NULL');
|
|
$this->db->where('a.BANK_ID is NULL');
|
|
$this->db->order_by('a.JENIS_KB DESC, a.KODE_KB DESC');
|
|
$this->db->group_by('a.ID_KB');
|
|
}else{
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(NILAI_KB,2)) as NILAI');
|
|
$this->db->from('kasbank');
|
|
$this->db->where(['ID_KB' => $id]);
|
|
$this->db->where('STATUS_KB is NULL');
|
|
$this->db->where('BANK_ID is NULL');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_DPPenjualanMax() { //Keuangan = [30, 58, 91, 94, 95]
|
|
$this->db->select_max('ID_DPJ');
|
|
$this->db->from('dp_penjualan');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Penjualan_Pda_byINV($id) { //Keuangan = [31, 59]
|
|
$this->db->select('*');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('piutang_dagang b','b.PENJUALAN_ID=a.ID_PENJUALAN');
|
|
$this->db->where(['a.INV_PENJUALAN' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PiutangDagang_byPENJUALAN($id) { //Keuangan = [31, 59]
|
|
$this->db->select('*,SUM(DEBET_PDA) AS DEBET,SUM(KREDIT_PDA) AS KREDIT');
|
|
$this->db->from('piutang_dagang');
|
|
$this->db->where(['PENJUALAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_PiutangDagangMax() { //Keuangan = [31, 59, 86, 91, 93, 98]
|
|
$this->db->select_max('ID_PDA');
|
|
$this->db->from('piutang_dagang');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_PiutangKaryawanMax() { //Keuangan = [32, 50, 60, 77, 93, 103]
|
|
$this->db->select_max('ID_PKA');
|
|
$this->db->from('piutang_karyawan');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Karyawan_byID($id=null) { //Keuangan = [32, 38, 39, 50, 60, 66, 67, 77]
|
|
if ($id==null) {
|
|
$this->db->select('*');
|
|
$this->db->from('karyawan');
|
|
$this->db->order_by('NAMA_PANGGILAN_KARYAWAN');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('karyawan');
|
|
$this->db->where(['ID_KARYAWAN' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_PiutangPihakke3Max() { //Keuangan = [33, 51, 61, 78]
|
|
$this->db->select_max('ID_PPK');
|
|
$this->db->from('piutang_pihakke3');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kasbank_KasPcm_0($id1, $id2=null) { //Keuangan = [37, 55]
|
|
if ($id2==null) {
|
|
$this->db->select('*,FORMAT(a.NILAI_KB,2) as NILAI,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('daftar_kasbank b','b.KB_ID=a.ID_KB');
|
|
$this->db->join('kas c','c.ID_KAS=a.KAS_ID','left');
|
|
$this->db->join('bank d','d.ID_BANK=a.BANK_ID','left');
|
|
$this->db->where('a.STATUS_KB=0');
|
|
$this->db->where('a.BANK_ID is NULL');
|
|
$this->db->where('a.KAS_ID=1');
|
|
$this->db->order_by('a.JENIS_KB DESC, a.KODE_KB DESC');
|
|
$this->db->group_by('a.ID_KB');
|
|
$this->db->where('a.TGL_KB>="'.$id1.'"');
|
|
} else {
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(a.NILAI_KB,2)) as NILAI');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('kas b','b.ID_KAS=a.KAS_ID','left');
|
|
$this->db->join('bank c','c.ID_BANK=a.BANK_ID','left');
|
|
$this->db->where('a.STATUS_KB=0');
|
|
$this->db->where('a.BANK_ID is NULL');
|
|
$this->db->where('a.KAS_ID=1');
|
|
$this->db->order_by('a.JENIS_KB DESC');
|
|
$this->db->where('a.TGL_KB>="'.$id1.'"');
|
|
$this->db->where(['a.ID_KB' => $id2]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kasbank_KasItp_0($id1, $id2=null) { //Keuangan = [37, 55]
|
|
if ($id2==null) {
|
|
$this->db->select('*,FORMAT(a.NILAI_KB,2) as NILAI,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('daftar_kasbank b','b.KB_ID=a.ID_KB');
|
|
$this->db->join('kas c','c.ID_KAS=a.KAS_ID','left');
|
|
$this->db->join('bank d','d.ID_BANK=a.BANK_ID','left');
|
|
$this->db->where('a.STATUS_KB=0');
|
|
$this->db->where('a.BANK_ID is NULL');
|
|
$this->db->where('a.KAS_ID=2');
|
|
$this->db->order_by('a.JENIS_KB DESC, a.KODE_KB DESC');
|
|
$this->db->group_by('a.ID_KB');
|
|
$this->db->where('a.TGL_KB>="'.$id1.'"');
|
|
} else {
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(a.NILAI_KB,2)) as NILAI');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('kas b','b.ID_KAS=a.KAS_ID','left');
|
|
$this->db->join('bank c','c.ID_BANK=a.BANK_ID','left');
|
|
$this->db->where('a.STATUS_KB=0');
|
|
$this->db->where('a.BANK_ID is NULL');
|
|
$this->db->where('a.KAS_ID=2');
|
|
$this->db->order_by('a.JENIS_KB DESC');
|
|
$this->db->where('a.TGL_KB>="'.$id1.'"');
|
|
$this->db->where(['a.ID_KB' => $id2]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasbank_byKB_Kasbankkeluar($id) { //Keuangan = [38, 39, 66, 67]
|
|
$this->db->select('*,FORMAT(a.DEBET_DKB,2) as DEBET,FORMAT(a.KREDIT_DKB,2) as KREDIT');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_ID');
|
|
$this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID');
|
|
$this->db->join('kas d','d.ID_KAS=b.KAS_ID','left');
|
|
$this->db->join('bank e','e.ID_BANK=b.BANK_ID','left');
|
|
$this->db->where(['a.KB_ID' => $id]);
|
|
$this->db->order_by('a.KREDIT_DKB DESC, c.KODE_PERKIRAAN ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HutangDagang_forDKB($id = null){ //Keuangan = [38, 39, 66, 67, 84, 92, 99]
|
|
if ($id == null) {
|
|
$this->db->select('a.*,b.INV_PEMBELIAN,c.NAMA_SUPPLIER,d.NAMA_KOTA,CONCAT("Rp ",FORMAT((SUM(a.DEBET_HDA)),2)) as DEBET,CONCAT("Rp ",FORMAT((SUM(a.KREDIT_HDA)),2)) as KREDIT,CONCAT("Rp ",FORMAT((SUM(a.KREDIT_HDA-a.DEBET_HDA)),2)) as SELISIH');
|
|
$this->db->from('hutang_dagang a');
|
|
$this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->order_by('c.NAMA_SUPPLIER ASC,a.TGL_HDA ASC');
|
|
$this->db->group_by('a.PEMBELIAN_ID');
|
|
$this->db->having('DEBET!=KREDIT');
|
|
}else{
|
|
$this->db->select('a.*,b.INV_PEMBELIAN,c.NAMA_SUPPLIER,d.NAMA_KOTA,SUM(a.DEBET_HDA) as DEBET,SUM(a.KREDIT_HDA) as KREDIT,SUM(a.KREDIT_HDA-a.DEBET_HDA) as SELISIH');
|
|
$this->db->from('hutang_dagang a');
|
|
$this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->group_by('a.PEMBELIAN_ID');
|
|
$this->db->having('DEBET!=KREDIT');
|
|
$this->db->where(['b.INV_PEMBELIAN' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarJurnalMemo_16() { //Keuangan = [38, 66, 67]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(a.KREDIT_DJM,2)) as KREDIT');
|
|
$this->db->from('daftar_jurnalmemo a');
|
|
$this->db->join('jurnal_memo b','b.ID_JM=a.JM_ID','left');
|
|
$this->db->join('setdata c','c.ID_SETDATA=a.SETDATA_ID','left');
|
|
$this->db->where('a.PERKIRAAN_ID=16');
|
|
$this->db->where('a.DKB_ID is NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Penjualan_forDKB(){ //Keuangan = [38, 39, 66, 67]
|
|
$this->db->select('a.PENJUALAN_ID,b.INV_PENJUALAN,d.NAMA_PELANGGAN,e.NAMA_KOTA,c.FEE_SO,CONCAT("Rp ",FORMAT((SUM(a.DEBET_PDA)),2)) as DEBET,
|
|
CONCAT("Rp ",FORMAT((SUM(a.KREDIT_PDA)),2)) as KREDIT');
|
|
$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('kota e','e.ID_KOTA=d.KOTA_ID');
|
|
$this->db->join('biaya_fee f','f.PENJUALAN_ID=a.PENJUALAN_ID','left');
|
|
$this->db->where('c.FEE_SO>0');
|
|
$this->db->where('c.STATUS_FEE is NULL');
|
|
$this->db->group_by('a.PENJUALAN_ID');
|
|
//$this->db->having('DEBET=KREDIT');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_FormKaryawan_ACC() { //Keuangan = [38]
|
|
$this->db->select('*,FORMAT(a.NILAI_FK,2) as NILAI,b.NAMA_PANGGILAN_KARYAWAN as NPKK,c.NAMA_PANGGILAN_KARYAWAN as NPKS');
|
|
$this->db->from('form_karyawan a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->where('a.STATUS_FK=0');
|
|
$this->db->where('a.CONFIRM_FK_O is NOT NULL');
|
|
$this->db->where('a.CONFIRM_FK_S is NOT NULL');
|
|
$this->db->where('a.CONFIRM_FK_P is NOT NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Proyek_Null_0($id=null) { //Keuangan = [38, 48, 66, 67, 76]
|
|
if ($id==null) {
|
|
$this->db->select('*');
|
|
$this->db->from('proyek a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->where('a.STATUS_PROYEK is NULL OR a.STATUS_PROYEK=0');
|
|
$this->db->order_by('b.TYPE_PELANGGAN ASC,b.NAMA_PELANGGAN ASC,a.PO_PROYEK ASC');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('proyek a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('karyawan d','d.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->where('a.STATUS_PROYEK is NULL AND a.ID_PROYEK=', $id);
|
|
$this->db->or_where('a.STATUS_PROYEK=0 AND a.ID_PROYEK=', $id);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kendaraan_byID($id = null){ //Keuangan = [38, 39, 66, 67]
|
|
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_Perkiraan_Lain_Kasbankkeluar() { //Keuangan = [38, 39, 66, 67]
|
|
$this->db->select('*');
|
|
$this->db->from('perkiraan');
|
|
$this->db->like('KODE_PERKIRAAN','6', 'after');
|
|
$this->db->not_like('KODE_PERKIRAAN','6103');
|
|
$this->db->not_like('KODE_PERKIRAAN','6104');
|
|
$this->db->not_like('KODE_PERKIRAAN','6227');
|
|
$this->db->not_like('KODE_PERKIRAAN','6230');
|
|
$this->db->not_like('KODE_PERKIRAAN','6233');
|
|
$this->db->or_like('KODE_PERKIRAAN','7', 'after');
|
|
$this->db->not_like('KODE_PERKIRAAN','7500');
|
|
$this->db->or_like('KODE_PERKIRAAN','8', 'after');
|
|
$this->db->or_like('KODE_PERKIRAAN','9', 'after');
|
|
$this->db->or_like('KODE_PERKIRAAN','1180');
|
|
$this->db->or_like('KODE_PERKIRAAN','1190');
|
|
$this->db->or_like('KODE_PERKIRAAN','1210');
|
|
$this->db->or_like('KODE_PERKIRAAN','1220');
|
|
$this->db->or_like('KODE_PERKIRAAN','1230');
|
|
$this->db->or_like('KODE_PERKIRAAN','2130');
|
|
$this->db->or_like('KODE_PERKIRAAN','2140');
|
|
$this->db->or_like('KODE_PERKIRAAN','4130');
|
|
$this->db->or_like('KODE_PERKIRAAN','5122');
|
|
$this->db->order_by('KODE_PERKIRAAN ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Perkiraan_FormLemburLuarKota() { //Keuangan = [38]
|
|
$this->db->select('*');
|
|
$this->db->from('perkiraan');
|
|
$this->db->like('KODE_PERKIRAAN','6203');
|
|
$this->db->or_like('KODE_PERKIRAAN','6233');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_BiayaBensinMax() { //Keuangan = [40, 68]
|
|
$this->db->select_max('ID_BBE');
|
|
$this->db->from('biaya_bensin');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Penjualan_byINV($id) { //Keuangan = [41, 69]
|
|
$this->db->select('*');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID','left');
|
|
$this->db->join('piutang_dagang c','c.PENJUALAN_ID=a.ID_PENJUALAN','left');
|
|
$this->db->where(['a.INV_PENJUALAN' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_BiayaFee_byPENJUALAN($id) { //Keuangan = [38, 41, 66, 69]
|
|
$this->db->select('*,SUM(a.BIAYA_BFE) as BIAYA');
|
|
$this->db->from('biaya_fee 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.PENJUALAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_FormFeePelanggan_byPENJUALAN_status0($id) { //Keuangan = [41, 69]
|
|
$this->db->select('*');
|
|
$this->db->from('form_feepelanggan 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.PENJUALAN_ID' => $id]);
|
|
$this->db->where('a.STATUS_FFP=0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_BiayaFeeMax() { //Keuangan = [41, 69, 86]
|
|
$this->db->select_max('ID_BFE');
|
|
$this->db->from('biaya_fee');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_BiayaServiceKendaraanMax() { //Keuangan = [42, 70]
|
|
$this->db->select_max('ID_BSE');
|
|
$this->db->from('biaya_servicekendaraan');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_DPPembelianMax() { //Keuangan = [45, 73, 92, 96, 97]
|
|
$this->db->select_max('ID_DPB');
|
|
$this->db->from('dp_pembelian');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Pembelian_byINV($id) { //Keuangan = [46, 74]
|
|
$this->db->select('*');
|
|
$this->db->from('pembelian');
|
|
$this->db->where(['INV_PEMBELIAN' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HutangDagang_byPEMBELIAN($id) { //Keuangan = [46, 74]
|
|
$this->db->select('*,SUM(DEBET_HDA) AS DEBET,SUM(KREDIT_HDA) AS KREDIT');
|
|
$this->db->from('hutang_dagang');
|
|
$this->db->where(['PEMBELIAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_HutangDagangMax() { //Keuangan = [46, 74, 92, 99]
|
|
$this->db->select_max('ID_HDA');
|
|
$this->db->from('hutang_dagang');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarJurnalMemo_byID($id) { //Keuangan = [47, 75, 100]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where(['ID_DJM' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarKasbank_byDJM_16($id) { //Keuangan = [47, 75]
|
|
$this->db->select('SUM(DEBET_DKB) AS DEBET');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where(['DJM_ID' => $id]);
|
|
$this->db->where('PERKIRAAN_ID=16');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_HppProyekMax() { //Keuangan = [48, 49, 76]
|
|
$this->db->select_max('ID_HPR');
|
|
$this->db->from('hpp_proyek');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_FormKaryawan_byID($id) { //Keuangan = [49, 53]
|
|
$this->db->select('*');
|
|
$this->db->from('form_karyawan');
|
|
$this->db->where(['ID_FK' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaFee_byPENJUALAN($id) { //Keuangan = [49]
|
|
$this->db->select('SUM(BIAYA_BFE) AS BIAYA');
|
|
$this->db->from('biaya_fee');
|
|
$this->db->where(['PENJUALAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_BiayaFee_byID($id) { //Keuangan = [53, 80, 100]
|
|
$this->db->select('*');
|
|
$this->db->from('biaya_fee 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.ID_BFE' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_FormFeePelanggan_byPENJUALAN_status1($id) { //Keuangan = [53, 80]
|
|
$this->db->select('*');
|
|
$this->db->from('form_feepelanggan 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.PENJUALAN_ID' => $id]);
|
|
$this->db->where('a.STATUS_FFP=1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kasbank_Bank_Null($id) { //Keuangan = [58, 59, 60, 61, 62, 63, 64, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(a.NILAI_KB,2)) as NILAI');
|
|
$this->db->from('kasbank a');
|
|
$this->db->join('bank b','b.ID_BANK=a.BANK_ID');
|
|
$this->db->where(['a.ID_KB' => $id]);
|
|
$this->db->where('a.STATUS_KB is NULL');
|
|
$this->db->where('a.KAS_ID is NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_JurnalMemo_byKODE($id = null) { //Keuangan = [84]
|
|
if ($id==null) {
|
|
$this->db->select('*,FORMAT(SUM(b.DEBET_DJM),2) as DEBET,FORMAT(SUM(b.KREDIT_DJM),2) as KREDIT');
|
|
$this->db->from('jurnal_memo a');
|
|
$this->db->join('daftar_jurnalmemo b','b.JM_ID=a.ID_JM');
|
|
$this->db->group_by('a.ID_JM');
|
|
$this->db->order_by('a.TGL_JM ASC, a.KODE_JM ASC');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('jurnal_memo');
|
|
$this->db->where(['KODE_JM' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Penjualan_forJM($id = null){ //Keuangan = [84, 86]
|
|
$username = $this->session->userdata('username');
|
|
if ($id == null) {
|
|
$this->db->select('b.INV_PENJUALAN,d.NAMA_PELANGGAN,e.NAMA_KOTA,CONCAT("Rp ",FORMAT(c.FEE_SO,2)) as FEE,CONCAT("Rp ",FORMAT((SUM(a.DEBET_PDA)),2)) as DEBET,CONCAT("Rp ",FORMAT((SUM(a.KREDIT_PDA)),2)) as KREDIT');
|
|
$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('kota e','e.ID_KOTA=d.KOTA_ID');
|
|
$this->db->group_by('a.PENJUALAN_ID');
|
|
if ($username!="gita") {
|
|
$this->db->where('c.FEE_SO>0');
|
|
$this->db->where('c.STATUS_FEE is NULL');
|
|
} else {
|
|
$this->db->where('c.FEE_SO>0 AND c.STATUS_FEE is NULL AND c.SALES_ID=28');
|
|
$this->db->or_where('c.FEE_SO>0 AND c.STATUS_FEE is NULL AND c.SALES_ID=30');
|
|
}
|
|
}else{
|
|
$this->db->select('b.INV_PENJUALAN,b.SO_ID,c.*,d.NAMA_PELANGGAN,e.NAMA_KOTA,CONCAT("Rp ",FORMAT(c.FEE_SO,2)) as FEE,CONCAT("Rp ",FORMAT((SUM(a.DEBET_PDA)),2)) as DEBET,CONCAT("Rp ",FORMAT((SUM(a.KREDIT_PDA)),2)) as KREDIT');
|
|
$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('kota e','e.ID_KOTA=d.KOTA_ID');
|
|
$this->db->group_by('a.PENJUALAN_ID');
|
|
$this->db->where('c.FEE_SO>0');
|
|
$this->db->where(['b.INV_PENJUALAN' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarKasBank_byPERKIRAAN_8() { //Keuangan = [84]
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALKB');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=8');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarJurnalMemo_byPERKIRAAN_8() { //Keuangan = [84]
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTALJM');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=8');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasBank_byPERKIRAAN_19() { //Keuangan = [84]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(SUM(b.KREDIT_DPJ-b.DEBET_DPJ),2)) as TOTAL,SUM(b.KREDIT_DPJ-b.DEBET_DPJ) as TOTALDPJ');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('dp_penjualan b','b.DKB_ID=a.ID_DKB');
|
|
$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('kasbank e','e.ID_KB=a.KB_ID');
|
|
$this->db->where('a.PERKIRAAN_ID=19');
|
|
$this->db->where('a.DJM_ID is NULL');
|
|
$this->db->order_by('c.NAMA_PELANGGAN ASC,a.KREDIT_DKB ASC');
|
|
$this->db->group_by('a.ID_DKB');
|
|
$this->db->having('TOTALDPJ>0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasBank_byPERKIRAAN_7() { //Keuangan = [84]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(SUM(b.DEBET_DPB-b.KREDIT_DPB),2)) as TOTAL,SUM(b.DEBET_DPB-b.KREDIT_DPB) as TOTALDPB');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('dp_pembelian b','b.DKB_ID=a.ID_DKB');
|
|
$this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('kasbank e','e.ID_KB=a.KB_ID');
|
|
$this->db->where('a.PERKIRAAN_ID=7');
|
|
$this->db->where('a.DJM_ID is NULL');
|
|
$this->db->order_by('c.NAMA_SUPPLIER ASC,a.DEBET_DKB ASC');
|
|
$this->db->group_by('a.ID_DKB');
|
|
$this->db->having('TOTALDPB>0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarKasbank_9() { //Keuangan = [84]
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTAL');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=9');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarKasbank_13() { //Keuangan = [84]
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTAL');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=13');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarKasbank_11() { //Keuangan = [84]
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTAL');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=11');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarJurnalMemo_67_Inventaris() { //Keuangan = [84, 88]
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTAL');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=67');
|
|
$this->db->where('BPI_ID is NOT NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarJurnalMemo_67_Kendaraan() { //Keuangan = [84, 89]
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTAL');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=67');
|
|
$this->db->where('BPK_ID is NOT NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarJurnalMemo_67_Ruko() { //Keuangan = [84, 90]
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTAL');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=67');
|
|
$this->db->where('BPR_ID is NOT NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Perkiraan_JurnalMemo() { //Keuangan = [84]
|
|
$this->db->select('*');
|
|
$this->db->from('perkiraan');
|
|
$this->db->like('KODE_PERKIRAAN','6', 'after');
|
|
$this->db->not_like('KODE_PERKIRAAN','6103');
|
|
$this->db->not_like('KODE_PERKIRAAN','6104');
|
|
$this->db->not_like('KODE_PERKIRAAN','6227');
|
|
$this->db->not_like('KODE_PERKIRAAN','6230');
|
|
$this->db->not_like('KODE_PERKIRAAN','6233');
|
|
$this->db->not_like('KODE_PERKIRAAN','6239');
|
|
$this->db->not_like('KODE_PERKIRAAN','6240');
|
|
$this->db->not_like('KODE_PERKIRAAN','6241');
|
|
$this->db->or_like('KODE_PERKIRAAN','7', 'after');
|
|
$this->db->not_like('KODE_PERKIRAAN','7500');
|
|
$this->db->or_like('KODE_PERKIRAAN','1190');
|
|
$this->db->or_like('KODE_PERKIRAAN','2160');
|
|
$this->db->or_like('KODE_PERKIRAAN','4130');
|
|
$this->db->or_like('KODE_PERKIRAAN','5122');
|
|
$this->db->order_by('KODE_PERKIRAAN ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_JurnalMemo_byID($id = null) { //Keuangan = [84, 100]
|
|
if ($id==null) {
|
|
$this->db->select('*');
|
|
$this->db->from('jurnal_memo');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('jurnal_memo');
|
|
$this->db->where(['ID_JM' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarJurnalMemo_byJM($id = null) { //Keuangan = [84, 100]
|
|
if ($id==null) {
|
|
$this->db->select('*,DATE_FORMAT(b.TGL_JM, "%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('daftar_jurnalmemo a');
|
|
$this->db->join('jurnal_memo b','b.ID_JM=a.JM_ID','left');
|
|
$this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID');
|
|
$this->db->where('a.SETDATA_ID is NULL');
|
|
$this->db->where('a.JM_ID is NULL');
|
|
} else {
|
|
$this->db->select('*,FORMAT(a.DEBET_DJM,2) as DEBET_DJM,FORMAT(a.KREDIT_DJM,2) as KREDIT_DJM,
|
|
DATE_FORMAT(b.TGL_JM, "%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('daftar_jurnalmemo a');
|
|
$this->db->join('jurnal_memo b','b.ID_JM=a.JM_ID');
|
|
$this->db->join('perkiraan c','c.ID_PERKIRAAN=a.PERKIRAAN_ID');
|
|
$this->db->where(['a.JM_ID' => $id]);
|
|
//$this->db->where('a.SETDATA_ID is NULL');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarJurnalMemo_byJM($id) { //Keuangan = [84]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(SUM(DEBET_DJM),2)) as DEBET,CONCAT("Rp ",FORMAT(SUM(KREDIT_DJM),2)) as KREDIT');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where(['JM_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getKodeJurnalMemo() { //Keuangan = [85]
|
|
$this->db->select('MAX(KODE_JM) AS KODE');
|
|
$this->db->from('jurnal_memo');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_JurnalMemoMax() { //Keuangan = [86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 103, 104, 105, 106]
|
|
$this->db->select_max('ID_JM');
|
|
$this->db->from('jurnal_memo');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_DaftarJurnalMemoMax() { //Keuangan = [86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 103]
|
|
$this->db->select_max('ID_DJM');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_BiayaPenyusutanInventarisMax() { //Keuangan = [88]
|
|
$this->db->select_max('ID_BPI');
|
|
$this->db->from('biaya_penyusutaninventaris');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_BiayaPenyusutanKendaraanMax() { //Keuangan = [89]
|
|
$this->db->select_max('ID_BPK');
|
|
$this->db->from('biaya_penyusutankendaraan');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_BiayaPenyusutanRukoMax() { //Keuangan = [90]
|
|
$this->db->select_max('ID_BPR');
|
|
$this->db->from('biaya_penyusutanruko');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DpPenjualan_byID($id) { //Keuangan = [91, 94, 95]
|
|
$this->db->select('*');
|
|
$this->db->from('dp_penjualan');
|
|
$this->db->where(['ID_DPJ' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DpPembelian_byID($id) { //Keuangan = [92, 96, 97]
|
|
$this->db->select('*');
|
|
$this->db->from('dp_pembelian');
|
|
$this->db->where(['ID_DPB' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SaldoBank_byBANK($id){ //Keuangan = [94, 96]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT((SUM(a.DEBET_SB)),2)) as DEBET,CONCAT("Rp ",FORMAT((SUM(a.KREDIT_SB)),2)) as KREDIT,
|
|
CONCAT("Rp ",FORMAT((SUM(a.DEBET_SB-a.KREDIT_SB)),2)) as TOTAL,SUM(a.DEBET_SB-a.KREDIT_SB) as TOTALSB');
|
|
$this->db->from('saldo_bank a');
|
|
$this->db->join('bank b','b.ID_BANK=a.BANK_ID');
|
|
$this->db->where(['a.BANK_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SaldoKas_byKAS($id){ //Keuangan = [95, 97]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT((SUM(a.DEBET_SK)),2)) as DEBET,CONCAT("Rp ",FORMAT((SUM(a.KREDIT_SK)),2)) as KREDIT,
|
|
CONCAT("Rp ",FORMAT((SUM(a.DEBET_SK-a.KREDIT_SK)),2)) as TOTAL,SUM(a.DEBET_SK-a.KREDIT_SK) as TOTALSK');
|
|
$this->db->from('saldo_kas a');
|
|
$this->db->join('kas b','b.ID_KAS=a.KAS_ID');
|
|
$this->db->where(['a.KAS_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangDagang_byINV($id) { //Keuangan = [98]
|
|
$this->db->select('*');
|
|
$this->db->from('piutang_dagang a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->where(['b.INV_PENJUALAN' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HutangDagang_byINV($id) { //Keuangan = [99]
|
|
$this->db->select('*');
|
|
$this->db->from('hutang_dagang a');
|
|
$this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->where(['b.INV_PEMBELIAN' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangDagang_byPENJUALAN($id) { //Keuangan = [100]
|
|
$this->db->select('*');
|
|
$this->db->from('piutang_dagang');
|
|
$this->db->where(['PENJUALAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarJurnalMemo_byJM_5($id) { //Keuangan = [100]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=5');
|
|
$this->db->where(['JM_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Penjualan_byID($id) { //Keuangan = [100, 102, 115]
|
|
$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->where(['a.ID_PENJUALAN' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasBank_byPERKIRAAN_16($id) { //Keuangan = [100]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_ID');
|
|
$this->db->where('a.PERKIRAAN_ID=16');
|
|
$this->db->where(['a.DJM_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangDagang_byID($id) { //Keuangan = [100]
|
|
$this->db->select('*');
|
|
$this->db->from('piutang_dagang');
|
|
$this->db->where(['ID_PDA' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PajakPenghasilan_NotNull() { //Keuangan = [102]
|
|
$this->db->select('*');
|
|
$this->db->from('pajak_penghasilan');
|
|
$this->db->where('NILAI_PPH is NOT NULL');
|
|
$this->db->order_by('KODE_PPH ASC, NILAI_PPH ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function subTempoMonth($date,$month) { // Keuangan = [102] = Terpakai Untuk Fungsi Internal
|
|
$sum = strtotime(date("Y-m-d", strtotime("$date")) . " -$month month");
|
|
$dateTo=date('Y-m-d',$sum);
|
|
return $dateTo;
|
|
}
|
|
|
|
public function getData_Penjualan_forPPH() { //Keuangan = [102]
|
|
$tgl_now = date('Y-m-01');
|
|
$tgl_limit = $this->subTempoMonth($tgl_now,6);
|
|
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID');
|
|
$this->db->join('dp_pajak d','d.PENJUALAN_ID=a.ID_PENJUALAN','left');
|
|
$this->db->where('d.PENJUALAN_ID is NULL');
|
|
//$this->db->where('b.PPN_SO!="0.00"');
|
|
$this->db->where('a.STATUS_PENJUALAN=1');
|
|
$this->db->where('a.TGL_PENJUALAN>=', $tgl_limit);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Corp_forPPH() { //Keuangan = [102, 118, 119, 120]
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
$this->db->where('ID_CORP=1');
|
|
$this->db->or_where('ID_CORP=2');
|
|
$this->db->or_where('ID_CORP=4');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PotonganKlaimProgram_groupNAMA() { //Keuangan = [102, 118, 119, 120]
|
|
$this->db->select('*');
|
|
$this->db->from('potongan_klaimprogram');
|
|
$this->db->group_by('NAMA_PKPR');
|
|
$this->db->order_by('NAMA_PKPR ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_DPPajakMax() { //Keuangan = [102]
|
|
$this->db->select_max('ID_DPP');
|
|
$this->db->from('dp_pajak');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PajakPenghasilan_byID($id) { //Keuangan = [102]
|
|
$this->db->select('*');
|
|
$this->db->from('pajak_penghasilan');
|
|
$this->db->where(['ID_PPH' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DpPajak_PPH22() { //Keuangan = [107]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TGLNOTA');
|
|
$this->db->from('dp_pajak a');
|
|
$this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID');
|
|
$this->db->join('daftar_kasbank c','c.ID_DKB=a.DKB_ID');
|
|
$this->db->join('penjualan d','d.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('sales_order e','e.ID_SO=d.SO_ID');
|
|
$this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID');
|
|
$this->db->join('kota g','g.ID_KOTA=f.KOTA_ID');
|
|
$this->db->join('daftar_rekappajak h','h.DPP_ID=a.ID_DPP','left');
|
|
$this->db->where('b.KODE_PPH=22');
|
|
$this->db->where('h.RPJ_ID is NULL');
|
|
//$this->db->where('c.TGL_DKB>"2022-12-31"');
|
|
$this->db->order_by('h.ID_DRPJ DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Customer_byID($id=null) { //Keuangan = [107, 112, 114]
|
|
if ($id==null) {
|
|
$this->db->select('*');
|
|
$this->db->from('customer');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('customer');
|
|
$this->db->where(['ID_CUSTOMER' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getCount_DpPajak_Selected22() { //Keuangan = [107]
|
|
$this->db->select('a.ID_DRPJ');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('dp_pajak b','b.ID_DPP=a.DPP_ID');
|
|
$this->db->join('pajak_penghasilan c','c.ID_PPH=b.PPH_ID');
|
|
$this->db->where('a.RPJ_ID is NULL');
|
|
$this->db->where('c.KODE_PPH=22');
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getData_DpPajak_byID($id) { //Keuangan = [108]
|
|
$this->db->select('*');
|
|
$this->db->from('dp_pajak a');
|
|
$this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID');
|
|
$this->db->where(['a.ID_DPP' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarRekapPajak_byDPP($id) { //Keuangan = [108]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('dp_pajak b','b.ID_DPP=a.DPP_ID');
|
|
$this->db->where(['a.DPP_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarRekapPajak_byID($id) { //Keuangan = [109]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('dp_pajak b','b.ID_DPP=a.DPP_ID','left');
|
|
$this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID','left');
|
|
$this->db->where(['a.ID_DRPJ' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarRekapPajak_RPJNull_PPH22() { //Keuangan = [111, 117]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('dp_pajak b','b.ID_DPP=a.DPP_ID');
|
|
$this->db->join('pajak_penghasilan c','c.ID_PPH=b.PPH_ID');
|
|
$this->db->where('a.RPJ_ID is NULL');
|
|
$this->db->where('c.KODE_PPH=22');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_RekapPajak_byNTPN($ntpn) { //Keuangan = [111, 116]
|
|
$this->db->select('*');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('NTPN_RPJ=', $ntpn);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_RekapPajak_byBILLING($billing) { //Keuangan = [111, 116]
|
|
$this->db->select('*');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('BILLING_RPJ=', $billing);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_RekapPajak_bySP2D($sp2d) { //Keuangan = [111, 116]
|
|
$this->db->select('*');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('SP2D_RPJ=', $sp2d);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_RekapPajakMax() { //Keuangan = [111, 113, 116, 117]
|
|
$this->db->select_max('ID_RPJ');
|
|
$this->db->from('rekap_pajak');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DpPajak_PPH23() { //Keuangan = [112]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TGLNOTA');
|
|
$this->db->from('dp_pajak a');
|
|
$this->db->join('pajak_penghasilan b','b.ID_PPH=a.PPH_ID');
|
|
$this->db->join('daftar_kasbank c','c.ID_DKB=a.DKB_ID');
|
|
$this->db->join('penjualan d','d.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('sales_order e','e.ID_SO=d.SO_ID');
|
|
$this->db->join('pelanggan f','f.ID_PELANGGAN=e.PELANGGAN_ID');
|
|
$this->db->join('kota g','g.ID_KOTA=f.KOTA_ID');
|
|
$this->db->join('daftar_rekappajak h','h.DPP_ID=a.ID_DPP','left');
|
|
//$this->db->where('c.TGL_DKB>"2022-12-31"');
|
|
$this->db->where('b.KODE_PPH=23');
|
|
$this->db->where('h.RPJ_ID is NULL');
|
|
$this->db->order_by('h.ID_DRPJ DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getCount_DpPajak_Selected23() { //Keuangan = [112]
|
|
$this->db->select('a.ID_DRPJ');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('dp_pajak b','b.ID_DPP=a.DPP_ID');
|
|
$this->db->join('pajak_penghasilan c','c.ID_PPH=b.PPH_ID');
|
|
$this->db->where('a.RPJ_ID is NULL');
|
|
$this->db->where('c.KODE_PPH=23');
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getData_DaftarRekapPajak_RPJNull_PPH23() { //Keuangan = [113, 117]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('dp_pajak b','b.ID_DPP=a.DPP_ID');
|
|
$this->db->join('pajak_penghasilan c','c.ID_PPH=b.PPH_ID');
|
|
$this->db->where('a.RPJ_ID is NULL');
|
|
$this->db->where('c.KODE_PPH=23');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_RekapPajak_byBUPOT($bupot) { //Keuangan = [113]
|
|
$this->db->select('*');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('BUPOT_RPJ=', $bupot);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Penjualan_PPN() { //Keuangan = [114]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TGLNOTA');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('daftar_rekappajak e','e.PENJUALAN_ID=a.ID_PENJUALAN','left');
|
|
$this->db->where('a.STATUS_PENJUALAN=1');
|
|
$this->db->where('e.RPJ_ID is NULL');
|
|
//$this->db->where('a.TGL_PENJUALAN>"2022-12-31"');
|
|
$this->db->like('a.FP_PENJUALAN','02','after');
|
|
$this->db->or_like('a.FP_PENJUALAN','03','after');
|
|
$this->db->order_by('e.ID_DRPJ DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getCount_Penjualan_SelectedPPN() { //Keuangan = [114]
|
|
$this->db->select('a.ID_DRPJ');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->where('a.RPJ_ID is NULL');
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getSum_DaftarOrder_byPENJUALAN($id) { //Keuangan = [114]
|
|
$this->db->select('SUM(a.HARGA_DO*a.QTY_DO) as TOTAL');
|
|
$this->db->from('daftar_order a');
|
|
$this->db->join('penjualan b','b.SO_ID=a.SO_ID');
|
|
$this->db->where(['b.ID_PENJUALAN' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarRekapPajak_byPENJUALAN($id) { //Keuangan = [115]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->where(['a.PENJUALAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarRekapPajak_RPJNull_PPN() { //Keuangan = [116, 117]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('sales_order c','c.ID_SO=b.SO_ID');
|
|
$this->db->where('a.RPJ_ID is NULL');
|
|
$this->db->where('b.STATUS_PENJUALAN=1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_RekapPajak_PPH22_byCORP_status1($id) { //Keuangan = [118]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_RPJ,"%d/%m/%Y") as TGLRPJ');
|
|
$this->db->from('rekap_pajak a');
|
|
$this->db->join('customer b','b.ID_CUSTOMER=a.CUSTOMER_ID');
|
|
$this->db->where('a.STATUS_RPJ=1');
|
|
$this->db->where('a.JENIS_RPJ=1');
|
|
$this->db->where('a.CORP_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Corp_byID($id) { //Keuangan = [118, 119, 120]
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
$this->db->where('ID_CORP=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getCount_RekapPajak_PPH22_byCORP_status1($id) { //Keuangan = [118]
|
|
$this->db->select('ID_RPJ');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('JENIS_RPJ=1');
|
|
$this->db->where('STATUS_RPJ=1');
|
|
$this->db->where('CORP_ID=', $id);
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getData_DaftarRekapPajak_byRPJ_DPPNotNull($id) { //Keuangan = [118, 119]
|
|
$this->db->select('*,FORMAT(a.DPP_DRPJ,2) as NILAI');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('dp_pajak b','b.ID_DPP=a.DPP_ID');
|
|
$this->db->join('penjualan c','c.ID_PENJUALAN=b.PENJUALAN_ID');
|
|
$this->db->join('pajak_penghasilan d','d.ID_PPH=b.PPH_ID');
|
|
$this->db->where(['a.RPJ_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_RekapPajak_PPH23_byCORP_status1($id) { //Keuangan = [119]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_RPJ,"%d/%m/%Y") as TGLRPJ');
|
|
$this->db->from('rekap_pajak a');
|
|
$this->db->join('customer b','b.ID_CUSTOMER=a.CUSTOMER_ID');
|
|
$this->db->where('a.STATUS_RPJ=1');
|
|
$this->db->where('a.JENIS_RPJ=2');
|
|
$this->db->where('a.CORP_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getCount_RekapPajak_PPH23_byCORP_status1($id) { //Keuangan = [119]
|
|
$this->db->select('ID_RPJ');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('JENIS_RPJ=2');
|
|
$this->db->where('STATUS_RPJ=1');
|
|
$this->db->where('CORP_ID=', $id);
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getData_RekapPajak_PPN_byCORP_status1($id) { //Keuangan = [120]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_RPJ,"%d/%m/%Y") as TGLRPJ');
|
|
$this->db->from('rekap_pajak a');
|
|
$this->db->join('customer b','b.ID_CUSTOMER=a.CUSTOMER_ID');
|
|
$this->db->where('a.STATUS_RPJ=1');
|
|
$this->db->where('a.JENIS_RPJ=3');
|
|
$this->db->where('a.CORP_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarRekapPajak_byRPJ_PenjualanNotNull($id) { //Keuangan = [120]
|
|
$this->db->select('*,FORMAT(a.DPP_DRPJ,2) as NILAI');
|
|
$this->db->from('daftar_rekappajak a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('sales_order c','c.ID_SO=b.SO_ID');
|
|
$this->db->where(['a.RPJ_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getCount_RekapPajak_PPN_byCORP_status1($id) { //Keuangan = [120]
|
|
$this->db->select('ID_RPJ');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('JENIS_RPJ=3');
|
|
$this->db->where('STATUS_RPJ=1');
|
|
$this->db->where('CORP_ID=', $id);
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getData_RekapPajak_byID($id) { //Keuangan = [121]
|
|
$this->db->select('*');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('ID_RPJ=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_RekapPajak_byJENIS_byCORP_status1($jenis_rpj, $awal, $akhir, $id_corp=null) { //Keuangan = [122]
|
|
$this->db->select('*,DATE_FORMAT(TGL_RPJ,"%d/%m/%Y") as TGLRPJ');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('STATUS_RPJ=1');
|
|
$this->db->where('JENIS_RPJ=', $jenis_rpj);
|
|
$this->db->where('TGL_RPJ>=', $awal);
|
|
$this->db->where('TGL_RPJ<=', $akhir);
|
|
if ($id_corp!=null) {
|
|
$this->db->where('CORP_ID=', $id_corp);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_RekapPajak_byJENIS_byCORP_status2($jenis_rpj, $awal, $akhir, $id_corp=null) { //Keuangan = [123]
|
|
$this->db->select('*,DATE_FORMAT(TGL_RPJ,"%d/%m/%Y") as TGLRPJ');
|
|
$this->db->from('rekap_pajak');
|
|
$this->db->where('STATUS_RPJ=2');
|
|
$this->db->where('JENIS_RPJ=', $jenis_rpj);
|
|
$this->db->where('TGL_RPJ>=', $awal);
|
|
$this->db->where('TGL_RPJ<=', $akhir);
|
|
if ($id_corp!=null) {
|
|
$this->db->where('CORP_ID=', $id_corp);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
}
|
|
?>
|