3312 lines
142 KiB
PHP
3312 lines
142 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
class ModelInformasi 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_SnStock() { // Informasi = [1]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_stock a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->order_by('a.NAMA_SNSTOCK ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnStock_byNAMA($id) { // Informasi = [1]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_stock a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('kuantiti c','c.ID_KUANTITI=b.ID_BARANG');
|
|
$this->db->where(['a.NAMA_SNSTOCK' => $id]);
|
|
$this->db->order_by('a.NAMA_SNSTOCK ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnStock_byID($id) { // Informasi = [1]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_stock a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('kuantiti c','c.ID_KUANTITI=b.ID_BARANG');
|
|
$this->db->where(['a.ID_SNSTOCK' => $id]);
|
|
$this->db->order_by('a.NAMA_SNSTOCK ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnKonsi_byNAMA($id) { // Informasi = [1]
|
|
$this->db->select('*,DATE_FORMAT(c.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('sn_konsi a');
|
|
$this->db->join('daftar_konsi b','b.ID_DFK=a.DFK_ID');
|
|
$this->db->join('konsinyasi c','c.ID_KONSINYASI=b.KONSINYASI_ID');
|
|
$this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID');
|
|
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID');
|
|
$this->db->where(['a.NAMA_SNK' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnMutasiBarang_byNAMA($id) { // Informasi = [1]
|
|
$this->db->select('*,DATE_FORMAT(b.TGL_MB,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('sn_mutasibarang a');
|
|
$this->db->join('mutasi_barang b','b.ID_MB=a.MB_ID');
|
|
$this->db->join('karyawan c','c.ID_KARYAWAN=b.ADMIN_ID');
|
|
$this->db->where(['a.NAMA_SNMB' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnReturJual_byNAMA($id) { // Informasi = [1]
|
|
$this->db->select('*,DATE_FORMAT(b.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('sn_returjual a');
|
|
$this->db->join('retur_penjualan b','b.ID_RJ=a.RJ_ID');
|
|
$this->db->where(['a.NAMA_SNRJ' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnService_byNAMA($id) { // Informasi = [1]
|
|
$this->db->select('*,DATE_FORMAT(b.TGL_SERVICE,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('sn_service a');
|
|
$this->db->join('service b','b.ID_SERVICE=a.SERVICE_ID');
|
|
$this->db->join('karyawan c','c.ID_KARYAWAN=b.PEMBUAT_ID');
|
|
$this->db->where(['a.NAMA_SNS' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnIO_byNAMA_status0($id) { // Informasi = [1]
|
|
$this->db->select('*,DATE_FORMAT(b.TGL_IO,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('sn_io a');
|
|
$this->db->join('transaksi_stock b','b.ID_IO=a.IO_ID');
|
|
$this->db->join('karyawan c','c.ID_KARYAWAN=b.GUDANG_ID');
|
|
$this->db->where('a.JENIS_SNIO=0');
|
|
$this->db->where(['a.NAMA_SNIO' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriSn_bySNSTOCK_forPembelian($id) { // Informasi = [1]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_INVBELI,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('histori_sn a');
|
|
$this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('pembelian d','d.KODE_PEMBELIAN=a.KODE_BUKTI');
|
|
$this->db->where(['a.SNSTOCK_ID' => $id]);
|
|
$this->db->where('a.SUPPLIER_ID is NOT NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriSn_bySNSTOCK_forPenjualan($id) { // Informasi = [1, 7]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_HSN,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('histori_sn a');
|
|
$this->db->join('penjualan b','b.SJ_PENJUALAN=a.SJ_HSN','left');
|
|
$this->db->join('sales_order c','c.ID_SO=b.SO_ID','left');
|
|
$this->db->join('corp d','d.ID_CORP=c.CORP_ID','left');
|
|
$this->db->join('pelanggan e','e.ID_PELANGGAN=c.PELANGGAN_ID','left');
|
|
$this->db->join('kota f','f.ID_KOTA=e.KOTA_ID','left');
|
|
$this->db->where(['a.SNSTOCK_ID' => $id]);
|
|
$this->db->where('a.PELANGGAN_ID is NOT NULL');
|
|
$this->db->group_by('a.ID_HSN');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriKuantiti_byBARANG_TOTALLebih0($level, $set = null) { // Informasi = [2,3, 5]
|
|
if ($level == 0) {
|
|
$this->db->select('*,SUM(a.MASUK_HQ-a.KELUAR_HQ) as TOTAL,d.PCM_KUANTITI as QTY,d.PROSES_KUANTITI as PROSES');
|
|
} else if ($level == 1) {
|
|
$this->db->select('*,SUM(a.MASUK_HQ-a.KELUAR_HQ) as TOTAL,d.ITP_KUANTITI as QTY,d.PROSES_KUANTITI as PROSES');
|
|
}
|
|
$this->db->from('histori_kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('kuantiti d','d.ID_KUANTITI=b.ID_BARANG');
|
|
if ($set==null) {
|
|
$this->db->having('TOTAL>0 AND QTY>0');
|
|
} else if ($set==1) {
|
|
$this->db->having('TOTAL>0');
|
|
}
|
|
$this->db->group_by('a.BARANG_ID');
|
|
$this->db->order_by('c.NAMA_JENIS ASC, b.KODE_BARANG ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarOrder_byBARANG($id, $level) { // Informasi = [2, 3, 4, 5, 9, 10, 74]
|
|
$this->db->select('SUM(a.QTY_DO) as PROSES');
|
|
$this->db->from('daftar_order a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID');
|
|
if ($level == 0) {
|
|
$this->db->where('b.CORP_ID<=3 AND b.STATUS_SO!=5 AND b.STATUS_SO!=1 AND b.STATUS_SO is NOT NULL AND a.BARANG_ID=', $id);
|
|
} else if ($level == 1) {
|
|
$this->db->where('b.CORP_ID>=4 AND b.STATUS_SO!=5 AND b.STATUS_SO!=1 AND b.STATUS_SO is NOT NULL AND a.BARANG_ID=', $id);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriKuantiti_byBARANG($id=null) { // Informasi = [4, 6]
|
|
if ($id==NULL) {
|
|
$this->db->select('*,SUM(a.MASUK_HQ-a.KELUAR_HQ) as TOTAL');
|
|
$this->db->from('histori_kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('kuantiti d','d.ID_KUANTITI=b.ID_BARANG');
|
|
$this->db->group_by('a.BARANG_ID');
|
|
$this->db->order_by('c.NAMA_JENIS ASC, b.KODE_BARANG ASC');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_HQ,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('histori_kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->order_by('a.ID_HQ');
|
|
$this->db->where(['a.BARANG_ID' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Barang_byID($id) { // Informasi = [6, 8, 9, 10, 11]
|
|
$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]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kuantiti_byID($id=null) { // Informasi = [6, 9, 10]
|
|
if ($id==null) {
|
|
$this->db->select('ID_KUANTITI,GLOBAL_KUANTITI,HARGA_AVG');
|
|
$this->db->from('kuantiti');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('kuantiti');
|
|
$this->db->where('ID_KUANTITI=',$id);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnStock_byBARANG($id, $type=null, $id_corp=null) { // Informasi = [7, 8]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_INVBELI,"%d/%m/%Y") as TANGGAL,f.NAMA_KOTA as NAMA_KOTA_SUPPLIER');
|
|
$this->db->from('sn_stock a');
|
|
$this->db->join('sn_beli b','b.NAMA_SNB=a.NAMA_SNSTOCK','left');
|
|
$this->db->join('daftar_beli c','c.ID_DB=b.DB_ID','left');
|
|
$this->db->join('pembelian d','d.ID_PEMBELIAN=c.PEMBELIAN_ID','left');
|
|
$this->db->join('supplier e','e.ID_SUPPLIER=d.SUPPLIER_ID','left');
|
|
$this->db->join('kota f','f.ID_KOTA=e.KOTA_ID','left');
|
|
if ($type==NULL OR $type==0) {
|
|
$this->db->where(['a.BARANG_ID' => $id]);
|
|
} else if ($type==1) {
|
|
$this->db->where('a.STATUS_SNSTOCK is NULL AND a.BARANG_ID=', $id);
|
|
} else if ($type==2) {
|
|
$this->db->where('a.STATUS_SNSTOCK=1 AND a.BARANG_ID=', $id);
|
|
} else if ($type==3) {
|
|
$this->db->where('a.STATUS_SNSTOCK!=1 AND a.STATUS_SNSTOCK!=3 AND a.STATUS_SNSTOCK!=14 AND a.BARANG_ID=', $id);
|
|
}
|
|
if ($id_corp!=null) {
|
|
$this->db->where(['d.CORP_ID' => $id_corp]);
|
|
}
|
|
$this->db->group_by('a.ID_SNSTOCK');
|
|
$this->db->order_by('a.STATUS_SNSTOCK ASC, a.NAMA_SNSTOCK ASC, d.TGL_PEMBELIAN ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Corp_byID() { // Informasi = [7, 41]
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriSn_bySNSTOCK_limit1($id) { // Informasi = [7]
|
|
$this->db->select('*,DATE_FORMAT(TGL_HSN,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('histori_sn');
|
|
$this->db->where(['SNSTOCK_ID' => $id]);
|
|
$this->db->limit('1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarOrder_byBARANG_NotNull_Not1_Not5($id, $level=null) { // Informasi = [10]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_SO,"%d/%m/%Y") as TANGGAL,d.KODE_SO as KODE,a.QTY_DO as QTY');
|
|
$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('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID');
|
|
$this->db->join('kota f','f.ID_KOTA=e.KOTA_ID');
|
|
if ($level == 0) {
|
|
$this->db->where('d.CORP_ID<=3 AND d.STATUS_SO is NOT NULL AND d.STATUS_SO!=1 AND d.STATUS_SO!=5 AND a.BARANG_ID=', $id);
|
|
} else if ($level == 1) {
|
|
$this->db->where('d.CORP_ID>=4 AND d.STATUS_SO is NOT NULL AND d.STATUS_SO!=1 AND d.STATUS_SO!=5 AND a.BARANG_ID=', $id);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarSjParsial_byBARANG_3($id) { // Informasi = [10]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_SO,"%d/%m/%Y") as TANGGAL,d.KODE_SO as KODE,a.QTY_SJP as QTY,d.STATUS_SO as STATUS');
|
|
$this->db->from('daftar_sjparsial a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('sales_order d','d.ID_SO=a.SO_ID');
|
|
$this->db->where('a.BARANG_ID=', $id);
|
|
$this->db->where('d.STATUS_SO=3');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_TransaksiStock_byBARANG_0_Null($id) { // Informasi = [10]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL,a.KODE_BUKTI as KODE,a.QTY_IO as QTY,a.STATUS_IO as STATUS');
|
|
$this->db->from('transaksi_stock a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('sales_order d','d.ID_SO=a.SO_ID');
|
|
$this->db->where('a.BARANG_ID=', $id);
|
|
$this->db->where('a.STATUS_IO is NULL');
|
|
$this->db->where('a.JENIS_IO=0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarService_byBARANG_0($id) { // Informasi = [10]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_SERVICE,"%d/%m/%Y") as TANGGAL,d.KODE_SERVICE as KODE,a.QTY_DFS as QTY,d.STATUS_SERVICE as STATUS');
|
|
$this->db->from('daftar_service a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('service d','d.ID_SERVICE=a.SERVICE_ID');
|
|
$this->db->where('a.BARANG_ID=', $id);
|
|
$this->db->where('d.STATUS_SERVICE=0');
|
|
$this->db->where('d.PELANGGAN_ID is NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarOrder_byBARANG_0_2($id) { // Informasi = [10]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_SO,"%d/%m/%Y") as TANGGAL,d.KODE_SO as KODE,a.QTY_DO as QTY,d.STATUS_SO as STATUS');
|
|
$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->where('d.STATUS_SO=0 AND a.BARANG_ID=', $id);
|
|
$this->db->or_where('d.STATUS_SO=2 AND a.BARANG_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnSjParsial_bySJP($id) { // Informasi = [10]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_sjparsial a');
|
|
$this->db->join('daftar_sjparsial b','b.ID_SJP=a.SJP_ID');
|
|
$this->db->where('a.SJP_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnIo_byIO_0($id) { // Informasi = [10]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_io');
|
|
$this->db->where('IO_ID=', $id);
|
|
$this->db->where('JENIS_SNIO=0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnService_byDFS($id) { // Informasi = [10]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_service');
|
|
$this->db->where('DFS_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnJual_byDO($id) { // Informasi = [10]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_jual');
|
|
$this->db->where('DO_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarMutasiBarang_byBARANG_0($id) { // Informasi = [10]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_MB,"%d/%m/%Y") as TANGGAL,d.KODE_MB as KODE,a.QTY_DMB as QTY');
|
|
$this->db->from('daftar_mutasibarang a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('mutasi_barang d','d.ID_MB=a.MB_ID');
|
|
$this->db->where('a.BARANG_ID=', $id);
|
|
$this->db->where('d.STATUS_MB=0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnMutasiBarang_byDMB($id) { // Informasi = [10]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_mutasibarang a');
|
|
$this->db->join('daftar_mutasibarang b','b.ID_DMB=a.DMB_ID');
|
|
$this->db->where('a.DMB_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Pending_byBARANG_Null($id) { // Informasi = [10]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PENDING,"%d/%m/%Y") as TANGGAL,a.KODE_PENDING as KODE,a.QTY_PENDING as QTY');
|
|
$this->db->from('pending 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('karyawan d','d.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->join('pelanggan e','e.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota f','f.ID_KOTA=e.KOTA_ID');
|
|
$this->db->where('a.BARANG_ID=', $id);
|
|
$this->db->where('a.STATUS_PENDING is NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKonsi_byBARANG_groupPELANGGAN_0($id) { // Informasi = [10]
|
|
$this->db->select('*,SUM(a.QTY_DFK) as QTYDFK');
|
|
$this->db->from('daftar_konsi a');
|
|
$this->db->join('konsinyasi b','b.ID_KONSINYASI=a.KONSINYASI_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->where('b.STATUS_KONSINYASI=0 AND a.BARANG_ID=', $id);
|
|
$this->db->group_by('b.PELANGGAN_ID');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnKonsi_byBARANG_byPELANGGAN_Null($id1, $id2) { // Informasi = [10]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_konsi a');
|
|
$this->db->join('daftar_konsi b','b.ID_DFK=a.DFK_ID');
|
|
$this->db->join('konsinyasi c','c.ID_KONSINYASI=b.KONSINYASI_ID');
|
|
$this->db->where('b.BARANG_ID=', $id1);
|
|
$this->db->where('c.PELANGGAN_ID=', $id2);
|
|
$this->db->where('a.STATUS_SNK is NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarPenarikanKonsi_byBARANG_byPELANGGAN_groupPELANGGAN_0($id1, $id2) { // Informasi = [10]
|
|
$this->db->select('*,SUM(a.QTY_DPK) as QTYDPK');
|
|
$this->db->from('daftar_penarikankonsi a');
|
|
$this->db->join('penarikan_konsi b','b.ID_PK=a.PK_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->where('b.STATUS_PK=0');
|
|
$this->db->where('a.BARANG_ID=', $id1);
|
|
$this->db->where('b.PELANGGAN_ID=', $id2);
|
|
$this->db->group_by('b.PELANGGAN_ID');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarPenarikanLaku_byBARANG_byPELANGGAN_groupPELANGGAN_0($id1, $id2) { // Informasi = [10]
|
|
$this->db->select('*,SUM(a.QTY_DPL) as QTYDPL');
|
|
$this->db->from('daftar_penarikanlaku a');
|
|
$this->db->join('penarikan_laku b','b.ID_PL=a.PL_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->where('b.STATUS_PL=0');
|
|
$this->db->where('a.BARANG_ID=', $id1);
|
|
$this->db->where('b.PELANGGAN_ID=', $id2);
|
|
$this->db->group_by('b.PELANGGAN_ID');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarPinjam_byBARANG_0($id) { // Informasi = [10]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_PEMINJAMAN,"%d/%m/%Y") as TANGGAL,d.KODE_PEMINJAMAN as KODE,a.QTY_DFP as QTY');
|
|
$this->db->from('daftar_pinjam 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('peminjaman d','d.ID_PEMINJAMAN=a.PEMINJAMAN_ID');
|
|
$this->db->where('a.BARANG_ID=', $id);
|
|
$this->db->where('d.STATUS_PEMINJAMAN=0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnPinjam_byDFP($id) { // Informasi = [10, 18]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_pinjam a');
|
|
$this->db->join('daftar_pinjam b','b.ID_DFP=a.DFP_ID');
|
|
$this->db->where(['a.DFP_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarProyek_byBARANG_Null($id) { // Informasi = [10]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_PROYEK,"%d/%m/%Y") as TANGGAL,d.KODE_PROYEK as KODE,a.QTY_DPR as QTY');
|
|
$this->db->from('daftar_proyek a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('proyek d','d.ID_PROYEK=a.PROYEK_ID');
|
|
$this->db->where('a.BARANG_ID=', $id);
|
|
$this->db->where('d.STATUS_PROYEK is NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnStock_byBARANG_9($id) { // Informasi = [10]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_stock');
|
|
$this->db->where('BARANG_ID=', $id);
|
|
$this->db->where('STATUS_SNSTOCK=9');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnStock_byBARANG_5($id) { // Informasi = [10]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_stock');
|
|
$this->db->where('BARANG_ID=', $id);
|
|
$this->db->where('STATUS_SNSTOCK=5');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriKuantiti_byBARANG_MasukLebih0($id, $month=null, $year=null) { // Informasi = [11, 61]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_HQ,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('histori_kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->order_by('a.ID_HQ ASC');
|
|
$this->db->where(['a.BARANG_ID' => $id]);
|
|
if ($year!=null AND $month!=null) {
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->where('a.TGL_HQ<',$tgl_end);
|
|
}
|
|
$this->db->where('a.MASUK_HQ>0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Pembelian_byPB_forJejakHarga($kode) { // Informasi = [11]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TANGGAL,SUM(e.HARGA_DB*e.QTY_DB) as BRUTO');
|
|
$this->db->from('pembelian a');
|
|
$this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('corp d','d.ID_CORP=a.CORP_ID');
|
|
$this->db->join('daftar_beli e','e.PEMBELIAN_ID=a.ID_PEMBELIAN');
|
|
$this->db->group_by('a.ID_PEMBELIAN');
|
|
$this->db->where('a.KODE_PEMBELIAN=', $kode);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_HistoriKuantiti_byBARANG_byHQ($id_barang, $id_hq) { // Informasi = [11, 61]
|
|
$this->db->select('SUM(a.MASUK_HQ-a.KELUAR_HQ) as TOTAL, SUM(a.KELUAR_HQ) as KELUAR, SUM(a.MASUK_HQ) as MASUK');
|
|
$this->db->from('histori_kuantiti 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.BARANG_ID' => $id_barang]);
|
|
$this->db->where('a.ID_HQ<=', $id_hq);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriKuantiti_limitHQ($id_barang, $id_hq) { // Informasi = [11, 61]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_HQ,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('histori_kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->where(['a.BARANG_ID' => $id_barang]);
|
|
$this->db->where('a.ID_HQ<', $id_hq);
|
|
$this->db->where('a.MASUK_HQ>0');
|
|
$this->db->order_by('a.ID_HQ DESC');
|
|
$this->db->limit('1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_HistoriKuantiti_byBARANG_byHQ1_byHQ2($id_barang, $id_hq1, $id_hq2) { // Informasi = [11, 61]
|
|
$this->db->select('SUM(a.KELUAR_HQ) as KELUAR');
|
|
$this->db->from('histori_kuantiti 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.BARANG_ID' => $id_barang]);
|
|
$this->db->where('a.ID_HQ<=', $id_hq1);
|
|
$this->db->where('a.ID_HQ>=', $id_hq2);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_TransaksiStock_NotNull($kode=null) { // Informasi = [12]
|
|
if ($kode==null) {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('transaksi_stock a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('karyawan c','c.ID_KARYAWAN=a.GUDANG_ID','left');
|
|
$this->db->where('a.STATUS_IO is NOT NULL');
|
|
$this->db->group_by('a.KODE_BUKTI');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_IO,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('transaksi_stock a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('karyawan d','d.ID_KARYAWAN=a.GUDANG_ID','left');
|
|
$this->db->where('a.STATUS_IO is NOT NULL');
|
|
$this->db->where('a.KODE_BUKTI=', $kode);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_TransaksiStock_byKODE($kode) { // Informasi = [12, 28]
|
|
$this->db->select('*');
|
|
$this->db->from('transaksi_stock a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('karyawan d','d.ID_KARYAWAN=a.GUDANG_ID');
|
|
$this->db->where('a.STATUS_IO=1');
|
|
$this->db->where('a.KODE_BUKTI=', $kode);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnIo_byIO($id) { // Informasi = [12, 28]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_io');
|
|
$this->db->where('IO_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Konsinyasi($id=null, $level=null) { // Informasi = [13]
|
|
if ($id==null) {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('konsinyasi a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
if ($level!=null) {
|
|
$this->db->where('a.JENIS_KONSINYASI=', $level);
|
|
}
|
|
$this->db->order_by('a.KODE_KONSINYASI ASC');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_KONSINYASI,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('konsinyasi a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->where('a.ID_KONSINYASI=', $id);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKonsi_byKONSINYASI($id) { // Informasi = [13]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_konsi a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('konsinyasi d','d.ID_KONSINYASI=a.KONSINYASI_ID');
|
|
$this->db->where('a.KONSINYASI_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnKonsi_byBARANG_byID($id1, $id2) { // Informasi = [13]
|
|
$this->db->select('a.NAMA_SNK');
|
|
$this->db->from('sn_konsi a');
|
|
$this->db->join('daftar_konsi b', 'b.ID_DFK=a.DFK_ID');
|
|
$this->db->join('barang c', 'c.ID_BARANG=b.BARANG_ID');
|
|
$this->db->where('b.BARANG_ID=', $id1);
|
|
$this->db->where('b.ID_DFK=', $id2);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PenarikanKonsi($id=null) { // Informasi = [14]
|
|
if ($id==null) {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PK,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('penarikan_konsi a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->order_by('a.KODE_PK ASC');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PK,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('penarikan_konsi a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.GUDANG_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->where('a.ID_PK=', $id);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarTarikKonsi_byPK($id) { // Informasi = [14]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_penarikankonsi a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('penarikan_konsi d','d.ID_PK=a.PK_ID');
|
|
$this->db->where('a.PK_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnKonsi_byBARANG_byPK_1($id1, $id2) { // Informasi = [14]
|
|
$this->db->select('a.NAMA_SNK');
|
|
$this->db->from('sn_konsi a');
|
|
$this->db->join('daftar_konsi b', 'b.ID_DFK=a.DFK_ID');
|
|
$this->db->join('barang c', 'c.ID_BARANG=b.BARANG_ID');
|
|
$this->db->where('b.BARANG_ID=', $id1);
|
|
$this->db->where('a.PK_ID=', $id2);
|
|
$this->db->where('a.STATUS_SNK=1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Pending_bySALES($id, $level = null){ // Informasi = [15, 16]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PENDING,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('pending 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('pelanggan d','d.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID');
|
|
$this->db->join('karyawan f','f.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->order_by('a.TGL_PENDING ASC, b.KODE_BARANG ASC');
|
|
$this->db->where(['a.SALES_ID' => $id]);
|
|
if ($level!=null) {
|
|
$this->db->where(['a.JENIS_PENDING' => $level]);
|
|
}
|
|
$this->db->where('a.STATUS_PENDING is NULL');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Pending_withoutSALES($id, $level = null){ // Informasi = [15, 16]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PENDING,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('pending 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('pelanggan d','d.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID');
|
|
$this->db->join('karyawan f','f.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->order_by('a.TGL_PENDING ASC, b.KODE_BARANG ASC');
|
|
$this->db->where('a.SALES_ID!=', $id);
|
|
$this->db->where('a.STATUS_PENDING is NULL');
|
|
if ($level!=null) {
|
|
$this->db->where(['a.JENIS_PENDING' => $level]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Karyawan_byID($id=null) { // Informasi = [15, 16, 24, 27, 32, 55, 73]
|
|
if ($id==null) {
|
|
$this->db->select('*');
|
|
$this->db->from('karyawan');
|
|
$this->db->where('STATUS_KARYAWAN=1');
|
|
$this->db->where('USERNAME!="insentive"');
|
|
$this->db->where('USERNAME!="louis"');
|
|
$this->db->where('USERNAME!="service"');
|
|
$this->db->where('USERNAME!="itp"');
|
|
$this->db->where('USERNAME!="none"');
|
|
$this->db->where('USERNAME!="sugeng"');
|
|
$this->db->where('USERNAME!="hwely"');
|
|
$this->db->where('USERNAME!="admin"');
|
|
$this->db->where('USERNAME!="irwan"');
|
|
$this->db->order_by('USERNAME ASC');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('karyawan');
|
|
$this->db->where(['ID_KARYAWAN' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Peminjaman_forInformasi($level=null) { // Informasi = [17]
|
|
$this->db->select('*,b.NAMA_PANGGILAN_KARYAWAN as PEMBERI,c.NAMA_PANGGILAN_KARYAWAN as PEMINJAM,f.NAMA_PANGGILAN_KARYAWAN as PENGEMBALI,
|
|
g.NAMA_PANGGILAN_KARYAWAN as PENERIMA,DATE_FORMAT(a.TGL_PEMINJAMAN,"%d/%m/%Y") as TANGGALPIN,DATE_FORMAT(a.TGL_KEMBALI,"%d/%m/%Y") as TANGGALKEM');
|
|
$this->db->from('peminjaman a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.PEMBERI_ID');
|
|
$this->db->join('karyawan c','c.ID_KARYAWAN=a.PEMINJAM_ID','left');
|
|
$this->db->join('pelanggan d','d.ID_PELANGGAN=a.PELANGGAN_ID','left');
|
|
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID','left');
|
|
$this->db->join('karyawan f','f.ID_KARYAWAN=a.PENGEMBALI_ID','left');
|
|
$this->db->join('karyawan g','g.ID_KARYAWAN=a.PENERIMA_ID','left');
|
|
if ($level!=null) {
|
|
$this->db->where('a.JENIS_PEMINJAMAN=', $level);
|
|
$this->db->where('a.STATUS_PEMINJAMAN is NOT NULL');
|
|
}
|
|
$this->db->order_by('a.STATUS_PEMINJAMAN ASC, a.ID_PEMINJAMAN DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarPinjam_byPEMINJAMAN($id) { // Informasi = [18]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_pinjam a');
|
|
$this->db->join('peminjaman b','b.ID_PEMINJAMAN=a.PEMINJAMAN_ID');
|
|
$this->db->join('barang c','c.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis d','d.ID_JENIS=c.JENIS_ID');
|
|
$this->db->where(['a.PEMINJAMAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Jenis_Not2($id = null) { // Informasi = [19, 74]
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('jenis');
|
|
$this->db->where('TYPE_JENIS!=2');
|
|
$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_StokKuantiti($all, $jenis_gudang = null, $id_jenis = null){ // Informasi = [19, 20]
|
|
if ($jenis_gudang == null AND $all == "0") {
|
|
$this->db->select('*');
|
|
$this->db->from('kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.ID_KUANTITI');
|
|
$this->db->order_by('b.KODE_BARANG ASC');
|
|
$this->db->where('a.ID_KUANTITI is NULL');
|
|
$this->db->where('a.GLOBAL_KUANTITI>0');
|
|
} else if ($all == 1) {
|
|
$this->db->select('*');
|
|
$this->db->from('kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.ID_KUANTITI');
|
|
$this->db->order_by('b.KODE_BARANG ASC');
|
|
$this->db->where('a.GLOBAL_KUANTITI>0');
|
|
} else {
|
|
if ($jenis_gudang=="1") {
|
|
$this->db->select('a.GLOBAL_KUANTITI as QTY,CONCAT("Rp ",FORMAT(a.HARGA_AVG,2)) as AVG,b.*,c.NAMA_JENIS');
|
|
$this->db->where('a.GLOBAL_KUANTITI>0');
|
|
} else if ($jenis_gudang=="2") {
|
|
$this->db->select('a.PCM_KUANTITI as QTY,CONCAT("Rp ",FORMAT(a.HARGA_AVG,2)) as AVG,b.*,c.NAMA_JENIS');
|
|
$this->db->where('a.PCM_KUANTITI>0');
|
|
} else if ($jenis_gudang=="3") {
|
|
$this->db->select('a.KONSINYASI_KUANTITI as QTY,CONCAT("Rp ",FORMAT(a.HARGA_AVG,2)) as AVG,b.*,c.NAMA_JENIS');
|
|
$this->db->where('a.KONSINYASI_KUANTITI>0');
|
|
} else if ($jenis_gudang=="4") {
|
|
$this->db->select('a.PEMINJAMAN_KUANTITI as QTY,CONCAT("Rp ",FORMAT(a.HARGA_AVG,2)) as AVG,b.*,c.NAMA_JENIS');
|
|
$this->db->where('a.PEMINJAMAN_KUANTITI>0');
|
|
} else if ($jenis_gudang=="5") {
|
|
$this->db->select('a.PENDING_KUANTITI as QTY,CONCAT("Rp ",FORMAT(a.HARGA_AVG,2)) as AVG,b.*,c.NAMA_JENIS');
|
|
$this->db->where('a.PENDING_KUANTITI>0');
|
|
} else if ($jenis_gudang=="6") {
|
|
$this->db->select('a.ANTIK_KUANTITI as QTY,CONCAT("Rp ",FORMAT(a.HARGA_AVG,2)) as AVG,b.*,c.NAMA_JENIS');
|
|
$this->db->where('a.ANTIK_KUANTITI>0');
|
|
} else if ($jenis_gudang=="7") {
|
|
$this->db->select('a.PROYEK_KUANTITI as QTY,CONCAT("Rp ",FORMAT(a.HARGA_AVG,2)) as AVG,b.*,c.NAMA_JENIS');
|
|
$this->db->where('a.PROYEK_KUANTITI>0');
|
|
} else if ($jenis_gudang=="8") {
|
|
$this->db->select('a.SERVICE_KUANTITI as QTY,CONCAT("Rp ",FORMAT(a.HARGA_AVG,2)) as AVG,b.*,c.NAMA_JENIS');
|
|
$this->db->where('a.SERVICE_KUANTITI>0');
|
|
} else if ($jenis_gudang=="9") {
|
|
$this->db->select('a.ITP_KUANTITI as QTY,CONCAT("Rp ",FORMAT(a.HARGA_AVG,2)) as AVG,b.*,c.NAMA_JENIS');
|
|
$this->db->where('a.ITP_KUANTITI>0');
|
|
}
|
|
$this->db->from('kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.ID_KUANTITI');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->order_by('c.NAMA_JENIS ASC, b.KODE_BARANG ASC');
|
|
if ($id_jenis!=NULL) {
|
|
$this->db->where('b.JENIS_ID=', $id_jenis);
|
|
}
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Pembelian_byID($id=null) { // Informasi = [21, 22, 23, 48]
|
|
if ($id==null) {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('pembelian a');
|
|
$this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('corp d','d.ID_CORP=a.CORP_ID');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_SJBELI,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('pembelian a');
|
|
$this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('corp d','d.ID_CORP=a.CORP_ID','left');
|
|
$this->db->where(['a.ID_PEMBELIAN' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_ReturPembelian_byID($id=null) { // Informasi = [21, 22, 23, 48]
|
|
if ($id==null) {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('retur_pembelian a');
|
|
$this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('corp e','e.ID_CORP=b.CORP_ID');
|
|
$this->db->order_by('a.KODE_RB DESC');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('retur_pembelian a');
|
|
$this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('corp e','e.ID_CORP=b.CORP_ID');
|
|
$this->db->where(['a.ID_RB' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_ReturPenjualan_byID($id=null) { // Informasi = [21, 22, 23, 48]
|
|
if ($id==null) {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('retur_penjualan a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('corp e','e.ID_CORP=b.KOP_ID');
|
|
$this->db->order_by('a.KODE_RJ DESC');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('retur_penjualan a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=b.PEL_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('corp e','e.ID_CORP=b.KOP_ID');
|
|
$this->db->order_by('a.KODE_RJ DESC');
|
|
$this->db->where(['a.ID_RJ' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarBeli_bySJ($sj) { // Informasi = [21]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(a.HARGA_DB,2)) as HARGA');
|
|
$this->db->from('daftar_beli a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('pembelian d','d.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->where('d.SJ_PEMBELIAN=', $sj);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarReturBeli_byRB($rb) { // Informasi = [21]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(a.HARGA_DRB,2)) as HARGA');
|
|
$this->db->from('daftar_returbeli 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('retur_pembelian d','d.ID_RB=a.RB_ID');
|
|
$this->db->where('d.KODE_RB=', $rb);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarReturJual_byRJ($rj) { // Informasi = [21]
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(a.HARGA_DRJ,2)) as HARGA');
|
|
$this->db->from('daftar_returjual 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('retur_penjualan d','d.ID_RJ=a.RJ_ID');
|
|
$this->db->where('d.KODE_RJ=', $rj);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnBeli_byBARANG_forSJPembelian($id1, $id2) { // Informasi = [21]
|
|
$this->db->select('a.NAMA_SNB');
|
|
$this->db->from('sn_beli a');
|
|
$this->db->join('daftar_beli b', 'b.ID_DB=a.DB_ID');
|
|
$this->db->join('barang c', 'c.ID_BARANG=b.BARANG_ID');
|
|
$this->db->where('b.BARANG_ID=', $id1);
|
|
$this->db->where('b.ID_DB=', $id2);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnReturBeli_byBARANG_forKodeRB($id1, $id2) { // Informasi = [21]
|
|
$this->db->select('a.NAMA_SNRB');
|
|
$this->db->from('sn_returbeli a');
|
|
$this->db->join('daftar_returbeli b', 'b.ID_DRB=a.DRB_ID');
|
|
$this->db->join('barang c', 'c.ID_BARANG=b.BARANG_ID');
|
|
$this->db->where('b.BARANG_ID=', $id1);
|
|
$this->db->where('b.ID_DRB=', $id2);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnReturJual_byBARANG_forKodeRJ($id1, $id2) { // Informasi = [21]
|
|
$this->db->select('a.NAMA_SNRJ');
|
|
$this->db->from('sn_returjual a');
|
|
$this->db->join('daftar_returjual b', 'b.ID_DRJ=a.DRJ_ID');
|
|
$this->db->join('barang c', 'c.ID_BARANG=b.BARANG_ID');
|
|
$this->db->where('b.BARANG_ID=', $id1);
|
|
$this->db->where('b.ID_DRJ=', $id2);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnBeli_byPEMBELIAN($id_pembelian) { // Informasi = [22]
|
|
$this->db->select('*');
|
|
$this->db->from('sn_beli a');
|
|
$this->db->join('daftar_beli b', 'b.ID_DB=a.DB_ID');
|
|
$this->db->join('pembelian c', 'c.ID_PEMBELIAN=b.PEMBELIAN_ID');
|
|
$this->db->join('barang d', 'd.ID_BARANG=b.BARANG_ID');
|
|
$this->db->where('c.ID_PEMBELIAN=', $id_pembelian);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarBeli_byPEMBELIAN($id) { // Informasi = [23]
|
|
$this->db->select('SUM(HARGA_DB*QTY_DB) as TOTAL');
|
|
$this->db->from('daftar_beli');
|
|
$this->db->where('PEMBELIAN_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarBeli_byINV($inv) { // Informasi = [23]
|
|
$this->db->select('*,FORMAT(a.HARGA_DB,2) as HARGA');
|
|
$this->db->from('daftar_beli a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('pembelian d','d.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->where('d.INV_PEMBELIAN=', $inv);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_forInformasiSudahTerbayar($id) { // Informasi = [24]
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGALJUAL,DATE_FORMAT(a.TEMPO_PENJUALAN,"%d/%m/%Y") as TANGGALTEMPO,
|
|
SUM(g.DEBET_DAK) as DEBET,SUM(g.KREDIT_DAK) as KREDIT');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID');
|
|
$this->db->join('corp c','c.ID_CORP=b.CORP_ID');
|
|
$this->db->join('pelanggan d','d.ID_PELANGGAN=b.PELANGGAN_ID');
|
|
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID');
|
|
$this->db->join('karyawan f','f.ID_KARYAWAN=b.SALES_ID');
|
|
$this->db->join('daftar_akuntansi g','g.PENJUALAN_ID=a.ID_PENJUALAN');
|
|
$this->db->having('KREDIT>0');
|
|
$this->db->where('a.TGL_PENJUALAN>=', $awal);
|
|
$this->db->where('a.TGL_PENJUALAN<=', $akhir);
|
|
$this->db->where('g.PERKIRAAN_ID=3');
|
|
$this->db->where('a.STATUS_PENJUALAN=1');
|
|
$this->db->where(['b.SALES_ID' => $id]);
|
|
$this->db->group_by('a.ID_PENJUALAN');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_Penjualan_forSearch() { // Informasi = [25]
|
|
$this->db->select('a.ID_SO,a.KODE_SO,b.NAMA_PELANGGAN,c.NAMA_KOTA,d.SJ_PENJUALAN,d.INV_PENJUALAN');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('penjualan d','d.SO_ID=a.ID_SO','left');
|
|
$this->db->where('a.STATUS_SO is NOT NULL');
|
|
$this->db->group_by('a.ID_SO');
|
|
$this->db->order_by('a.KODE_SO ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_byID($id) { // Informasi = [25, 75]
|
|
$this->db->select('*,DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('penjualan d','d.SO_ID=a.ID_SO','left');
|
|
$this->db->group_by('a.ID_SO');
|
|
$this->db->where(['a.ID_SO' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarOrder_bySO_forPenjualanView($id) { // Informasi = [25]
|
|
$this->db->select('*,FORMAT((SUM(a.QTY_DO*a.HARGA_DO)),2) as DPP,FORMAT((SUM((a.QTY_DO*a.HARGA_DO)*(d.PPN_SO/100))),2) as PPN,
|
|
FORMAT((SUM(ROUND((a.QTY_DO*a.HARGA_DO)*((d.PPN_SO+100)/100)))),2) as NETTO,FORMAT(a.HARGA_DO,2) as HARGADO,FORMAT(d.FEE_SO,2) as FEE');
|
|
$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->where('a.SO_ID=', $id);
|
|
$this->db->group_by('a.ID_DO');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_byCORP($id) { // Informasi = [26]
|
|
$this->db->select('*,DATE_FORMAT(g.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT((SUM(f.QTY_DO*f.HARGA_DO)),2) as DPP,
|
|
FORMAT((SUM((f.QTY_DO*f.HARGA_DO)*(a.PPN_SO/100))),2) as PPN,FORMAT((SUM(ROUND((f.QTY_DO*f.HARGA_DO)*((a.PPN_SO+100)/100)))),2) as NETTO');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('corp d','d.ID_CORP=a.CORP_ID');
|
|
$this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->join('daftar_order f','f.SO_ID=a.ID_SO');
|
|
$this->db->join('penjualan g','g.SO_ID=a.ID_SO');
|
|
$this->db->where('a.STATUS_SO=1');
|
|
if ($id==0) {
|
|
$tgl = date('Y-m-01');
|
|
$this->db->where('g.TGL_PENJUALAN>=', $tgl);
|
|
} else {
|
|
$this->db->where('a.CORP_ID=', $id);
|
|
}
|
|
$this->db->group_by('a.ID_SO');
|
|
$this->db->order_by('a.KODE_SO DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_forInformasiReturJual($id) { // Informasi = [27]
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGALJUAL,DATE_FORMAT(a.TEMPO_PENJUALAN,"%d/%m/%Y") as TANGGALTEMPO,
|
|
SUM(g.DEBET_PDA) as DEBET,SUM(g.KREDIT_PDA) as KREDIT');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID');
|
|
$this->db->join('corp c','c.ID_CORP=b.CORP_ID');
|
|
$this->db->join('pelanggan d','d.ID_PELANGGAN=b.PELANGGAN_ID');
|
|
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID');
|
|
$this->db->join('karyawan f','f.ID_KARYAWAN=b.SALES_ID');
|
|
$this->db->join('piutang_dagang g','g.PENJUALAN_ID=a.ID_PENJUALAN');
|
|
$this->db->having('KREDIT>0');
|
|
$this->db->where('a.TGL_PENJUALAN>=', $awal);
|
|
$this->db->where('a.TGL_PENJUALAN<=', $akhir);
|
|
$this->db->where('g.TRANSAKSI_PDA!=1');
|
|
$this->db->where('a.STATUS_PENJUALAN=1');
|
|
$this->db->where(['b.SALES_ID' => $id]);
|
|
$this->db->group_by('a.ID_PENJUALAN');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangDagang_byPENJUALAN_forRetur($id) { // Informasi = [27]
|
|
$this->db->select('*');
|
|
$this->db->from('piutang_dagang');
|
|
$this->db->where(['PENJUALAN_ID' => $id]);
|
|
$this->db->where('TRANSAKSI_PDA=2');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_forSOGudang($so=null) { // Informasi = [28, 29]
|
|
if ($so==null) {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('corp d','d.ID_CORP=a.CORP_ID');
|
|
$this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->where('a.STATUS_SO is NOT NULL');
|
|
$this->db->order_by('a.TGL_SO DESC');
|
|
$this->db->group_by('a.ID_SO');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('corp d','d.ID_CORP=a.CORP_ID');
|
|
$this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->where('a.KODE_SO=', $so);
|
|
$this->db->where('a.STATUS_SO is NOT NULL');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarOrder_byKODESO($so) { // Informasi = [28]
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_order a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('sales_order d','d.ID_SO=a.SO_ID');
|
|
$this->db->where('d.KODE_SO=', $so);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnJual_byBARANG_forSJPenjualan($id1, $id2) { // Informasi = [28]
|
|
$this->db->select('a.NAMA_SNJ');
|
|
$this->db->from('sn_jual a');
|
|
$this->db->join('daftar_order b', 'b.ID_DO=a.DO_ID');
|
|
$this->db->join('barang c', 'c.ID_BARANG=b.BARANG_ID');
|
|
$this->db->where('b.BARANG_ID=', $id1);
|
|
$this->db->where('b.ID_DO=', $id2);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SnParsial_byBARANG_forSJPenjualan($id1, $id2) { // Informasi = [28]
|
|
$this->db->select('a.NAMA_SNSJ');
|
|
$this->db->from('sn_sjparsial a');
|
|
$this->db->join('daftar_sjparsial b', 'b.ID_SJP=a.SJP_ID');
|
|
$this->db->join('daftar_order c', 'c.ID_DO=b.DO_ID');
|
|
$this->db->join('barang d', 'd.ID_BARANG=c.BARANG_ID');
|
|
$this->db->where('b.BARANG_ID=', $id1);
|
|
$this->db->where('b.DO_ID=', $id2);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_viewAll($view) { // Informasi = [29]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('corp d','d.ID_CORP=a.CORP_ID');
|
|
$this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID');
|
|
if ($view==0) {
|
|
$this->db->where('a.STATUS_SO is NOT NULL AND a.STATUS_SO=0');
|
|
$this->db->or_where('a.STATUS_SO is NOT NULL AND a.STATUS_SO=8');
|
|
} else if ($view==1) {
|
|
$this->db->where('a.STATUS_SO is NOT NULL AND a.STATUS_SO=4');
|
|
} else if ($view==2) {
|
|
$this->db->where('a.STATUS_SO is NOT NULL AND a.STATUS_SO=5');
|
|
} else if ($view==3) {
|
|
$this->db->where('a.STATUS_SO is NOT NULL AND a.STATUS_SO=1 AND a.TGL_SO<="2022-12-31" AND a.TGL_SO>="2022-01-01"');
|
|
$this->db->or_where('a.STATUS_SO is NOT NULL AND a.STATUS_SO=1 AND a.STATUS_KIRIM is NOT NULL AND a.STATUS_KIRIM!=0 AND a.TGL_SO<="2022-12-31" AND a.TGL_SO>="2022-01-01"');
|
|
} else if ($view==4) {
|
|
$this->db->where('a.STATUS_SO is NOT NULL AND a.STATUS_SO=1 AND a.TGL_SO<="2023-12-31" AND a.TGL_SO>="2023-01-01"');
|
|
$this->db->or_where('a.STATUS_SO is NOT NULL AND a.STATUS_SO=1 AND a.STATUS_KIRIM is NOT NULL AND a.STATUS_KIRIM!=0 AND a.TGL_SO<="2023-12-31" AND a.TGL_SO>="2023-01-01"');
|
|
}
|
|
$this->db->order_by('a.KODE_SO DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_QualityControl_bySO($id) { // Informasi = [29, 30]
|
|
$this->db->select('b.NAMA_PANGGILAN_KARYAWAN as NAMA');
|
|
$this->db->from('quality_control a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->where(['a.SO_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_JadwalPengiriman_bySO($id) { // Informasi = [29, 30]
|
|
$this->db->select('b.NAMA_PANGGILAN_KARYAWAN');
|
|
$this->db->from('jadwal_pengiriman a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->where('a.SO_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_forInformasi_bySales($id) { // Informasi = [30]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_SO,"%d/%m/%Y") as TANGGAL,FORMAT(a.FEE_SO,2) as FEE,
|
|
FORMAT(ROUND(SUM(((100+a.PPN_SO)/100)*(e.QTY_DO*e.HARGA_DO)),0),2) as TOTAL');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b', 'b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c', 'c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('corp d', 'd.ID_CORP=a.CORP_ID');
|
|
$this->db->join('daftar_order e', 'e.SO_ID=a.ID_SO');
|
|
$this->db->where('a.TGL_SO>="2025-01-01"');
|
|
$this->db->where('a.TGL_SO<="2025-12-31"');
|
|
$this->db->where('a.STATUS_SO is NOT NULL');
|
|
$this->db->where('a.STATUS_SO!=5');
|
|
$this->db->where('a.SALES_ID=', $id);
|
|
$this->db->order_by('a.TGL_SO DESC');
|
|
$this->db->group_by('a.ID_SO');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getCount_SalesOrder_1($id) { // Informasi = [30]
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
$this->db->select('*');
|
|
$this->db->from('sales_order');
|
|
$this->db->where('SALES_ID=', $id);
|
|
$this->db->where('STATUS_SO=1');
|
|
$this->db->where('TGL_SO>=', $awal);
|
|
$this->db->where('TGL_SO<=', $akhir);
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getCount_SalesOrder_Not1_Not5_NotNull($id) { // Informasi = [30]
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
$this->db->select('*');
|
|
$this->db->from('sales_order');
|
|
$this->db->where('SALES_ID=', $id);
|
|
$this->db->where('STATUS_SO!=1');
|
|
$this->db->where('STATUS_SO!=5');
|
|
$this->db->where('STATUS_SO is NOT NULL');
|
|
$this->db->where('TGL_SO>=', $awal);
|
|
$this->db->where('TGL_SO<=', $akhir);
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getData_SalesOrder_byID_forInformasi($id) { // Informasi = [31]
|
|
$this->db->select('*');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b', 'b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c', 'c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('karyawan d', 'd.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->where('a.ID_SO=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarOrder_bySOID($id) { // Informasi = [31]
|
|
$this->db->select('*,FORMAT((SUM(a.QTY_DO*a.HARGA_DO)),2) as DPP,FORMAT((SUM((a.QTY_DO*a.HARGA_DO)*(d.PPN_SO/100))),2) as PPN,
|
|
FORMAT((SUM(ROUND((a.QTY_DO*a.HARGA_DO)*((d.PPN_SO+100)/100)))),2) as NETTO,FORMAT(a.HARGA_DO,2) as HARGADO,FORMAT(d.FEE_SO,2) as FEE');
|
|
$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('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID');
|
|
$this->db->where('a.SO_ID=', $id);
|
|
$this->db->group_by('a.ID_DO');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarOrder_bySO_forSalesOrder($id) { // Informasi = [31]
|
|
$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->join('barang c', 'c.ID_BARANG=a.BARANG_ID');
|
|
$this->db->where('b.ID_SO=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_forInformasiTagihan($id) { // Informasi = [32]
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
$this->db->select('*,DATE_FORMAT(f.TGL_PENJUALAN,"%d/%m/%Y") as TANGGALJUAL,DATE_FORMAT(f.TEMPO_PENJUALAN,"%d/%m/%Y") as TANGGALTEMPO,
|
|
SUM(g.DEBET_DAK) as DEBET,SUM(g.KREDIT_DAK) as KREDIT');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('corp b','b.ID_CORP=a.CORP_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->join('penjualan f','f.SO_ID=a.ID_SO');
|
|
$this->db->join('daftar_akuntansi g','g.PENJUALAN_ID=f.ID_PENJUALAN');
|
|
$this->db->having('DEBET>KREDIT');
|
|
$this->db->where('g.PERKIRAAN_ID=3');
|
|
$this->db->where(['a.SALES_ID' => $id]);
|
|
$this->db->where('f.TGL_PENJUALAN>=', $awal);
|
|
$this->db->where('f.TGL_PENJUALAN<=', $akhir);
|
|
$this->db->group_by('a.ID_SO');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_forInformasiTagihanBefore($id) { // Informasi = [72]
|
|
$yearNow = date('Y');
|
|
$yearLast = $yearNow-1;
|
|
$awal = date("$yearLast-01-01");
|
|
$akhir = date("$yearLast-12-31");
|
|
$this->db->select('*,DATE_FORMAT(f.TGL_PENJUALAN,"%d/%m/%Y") as TANGGALJUAL,DATE_FORMAT(f.TEMPO_PENJUALAN,"%d/%m/%Y") as TANGGALTEMPO,
|
|
SUM(g.DEBET_DAK) as DEBET,SUM(g.KREDIT_DAK) as KREDIT');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('corp b','b.ID_CORP=a.CORP_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('karyawan e','e.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->join('penjualan f','f.SO_ID=a.ID_SO');
|
|
$this->db->join('daftar_akuntansi g','g.PENJUALAN_ID=f.ID_PENJUALAN');
|
|
$this->db->having('DEBET>KREDIT');
|
|
$this->db->where('g.PERKIRAAN_ID=3');
|
|
$this->db->where(['a.SALES_ID' => $id]);
|
|
$this->db->where('f.TGL_PENJUALAN>=', $awal);
|
|
$this->db->where('f.TGL_PENJUALAN<=', $akhir);
|
|
$this->db->group_by('a.ID_SO');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Penjualan_forTarget($id) { // Informasi = [33]
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,FORMAT(SUM(b.NILAI_SO),2) as NILAI,COUNT(a.ID_PENJUALAN) as COUNT');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID');
|
|
$this->db->where(['b.SALES_ID' => $id]);
|
|
$this->db->where('a.STATUS_PENJUALAN=1');
|
|
$this->db->where('a.TGL_PENJUALAN>=', $awal);
|
|
$this->db->where('a.TGL_PENJUALAN<=', $akhir);
|
|
$this->db->group_by('a.TGL_PENJUALAN');
|
|
$this->db->order_by('a.TGL_PENJUALAN DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Penjualan_bySALES_byTGL($id_sales, $tgl) { // Informasi = [33]
|
|
$this->db->select('a.INV_PENJUALAN');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID');
|
|
$this->db->where(['b.SALES_ID' => $id_sales]);
|
|
$this->db->where(['a.TGL_PENJUALAN' => $tgl]);
|
|
$this->db->where('a.STATUS_PENJUALAN=1');
|
|
$this->db->order_by('a.TGL_PENJUALAN DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Penjualan_byTANGGAL($tanggal, $id_sales) { // Informasi = [34]
|
|
$this->db->select('*,DATE_FORMAT(a.TEMPO_PENJUALAN,"%d/%m/%Y") as TGLTEMPO,FORMAT(b.NILAI_SO,2) as NILAI');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->where(['a.TGL_PENJUALAN' => $tanggal]);
|
|
$this->db->where(['b.SALES_ID' => $id_sales]);
|
|
$this->db->where('a.STATUS_PENJUALAN=1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_BiayaBensin_forInformasi($id=null) { // Informasi = [35, 36]
|
|
if ($id==null) {
|
|
$this->db->select('*,SUM(a.BIAYA_BBE) as BBE,DATE_FORMAT(a.TGL_BBE,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('biaya_bensin a');
|
|
$this->db->join('kendaraan b','b.ID_KENDARAAN=a.KENDARAAN_ID');
|
|
$this->db->join('daftar_kasbank c','c.ID_DKB=a.DKB_ID');
|
|
$this->db->join('kasbank d','d.ID_KB=c.KB_ID');
|
|
$this->db->order_by('b.TYPE_KENDARAAN, b.NAMA_KENDARAAN');
|
|
$this->db->group_by('a.KENDARAAN_ID');
|
|
} else {
|
|
$this->db->select('*,FORMAT(a.BIAYA_BBE,2) as BBE,DATE_FORMAT(a.TGL_BBE,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('biaya_bensin a');
|
|
$this->db->join('kendaraan b','b.ID_KENDARAAN=a.KENDARAAN_ID');
|
|
$this->db->join('daftar_kasbank c','c.ID_DKB=a.DKB_ID');
|
|
$this->db->join('kasbank d','d.ID_KB=c.KB_ID');
|
|
$this->db->where('a.KENDARAAN_ID=', $id);
|
|
$this->db->order_by('a.ID_BBE');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kendaraan($id) { // Informasi = [36, 38]
|
|
$this->db->select('*');
|
|
$this->db->from('kendaraan');
|
|
$this->db->where('ID_KENDARAAN=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaBensin_forInformasi($id) { // Informasi = [36]
|
|
$this->db->select('CONCAT("Rp ",FORMAT(SUM(BIAYA_BBE),2)) as TOTAL');
|
|
$this->db->from('biaya_bensin');
|
|
$this->db->where(['KENDARAAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_BiayaServiceKendaraan_forInformasi($id=null) { // Informasi = [37, 38]
|
|
if ($id==null) {
|
|
$this->db->select('*,SUM(a.BIAYA_BSE) as BSE,DATE_FORMAT(a.TGL_BSE,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('biaya_servicekendaraan a');
|
|
$this->db->join('kendaraan b','b.ID_KENDARAAN=a.KENDARAAN_ID');
|
|
$this->db->join('daftar_kasbank c','c.ID_DKB=a.DKB_ID');
|
|
$this->db->join('kasbank d','d.ID_KB=c.KB_ID');
|
|
$this->db->order_by('b.TYPE_KENDARAAN, b.NAMA_KENDARAAN');
|
|
$this->db->group_by('a.KENDARAAN_ID');
|
|
} else {
|
|
$this->db->select('*,FORMAT(a.BIAYA_BSE,2) as BSE,DATE_FORMAT(a.TGL_BSE,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('biaya_servicekendaraan a');
|
|
$this->db->join('kendaraan b','b.ID_KENDARAAN=a.KENDARAAN_ID');
|
|
$this->db->join('daftar_kasbank c','c.ID_DKB=a.DKB_ID');
|
|
$this->db->join('kasbank d','d.ID_KB=c.KB_ID');
|
|
$this->db->where('a.KENDARAAN_ID=', $id);
|
|
$this->db->order_by('a.ID_BSE');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaServiceKendaraan_forInformasi($id) { // Informasi = [38]
|
|
$this->db->select('CONCAT("Rp ",FORMAT(SUM(BIAYA_BSE),2)) as TOTAL');
|
|
$this->db->from('biaya_servicekendaraan');
|
|
$this->db->where(['KENDARAAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_FormKaryawan_status1($id=null) { // Informasi = [39, 40]
|
|
if ($id==null) {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_FK,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_FK,2) as NILAI,b.NAMA_PANGGILAN_KARYAWAN as NAMAPANG, c.NAMA_PANGGILAN_KARYAWAN as NAMA_SALES
|
|
,DATE_FORMAT(d.TGL_DKB,"%d/%m/%Y") as TGLKB');
|
|
$this->db->from('form_karyawan a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->join('karyawan c','c.ID_KARYAWAN=a.SALES_ID');
|
|
$this->db->join('daftar_kasbank d','d.ID_DKB=a.DKB_ID','left');
|
|
$this->db->join('daftar_akuntansi e','e.ID_DAK=a.DAK_ID','left');
|
|
$this->db->where('a.STATUS_FK=1');
|
|
$this->db->order_by('a.TGL_FK DESC');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_FK,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_FK,2) as NILAI');
|
|
$this->db->from('form_karyawan a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->where('a.STATUS_FK=1');
|
|
$this->db->where('a.ID_FK=', $id);
|
|
$this->db->order_by('a.TGL_FK ASC');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarFormKaryawan_status1($id) { // Informasi = [39]
|
|
$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=1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_Fee_forInformasi($set, $id_pelanggan=null, $id_corp=null, $tanggal_awal=null, $tanggal_akhir=null) { // Informasi = [41]
|
|
$tgl_now = date('Y-m-01');
|
|
$this->db->select('*,FORMAT(a.FEE_SO,2) as FEE,DATE_FORMAT(e.TGL_BFE,"%d/%m/%Y") as TANGGAL,
|
|
e.DKB_ID as DKB,e.DJM_ID as DJM,DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TGLJUAL');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('penjualan d','d.SO_ID=a.ID_SO');
|
|
$this->db->join('biaya_fee e','e.PENJUALAN_ID=d.ID_PENJUALAN','left');
|
|
if ($set==0) {
|
|
$this->db->where('a.FEE_SO!="0.00" AND a.STATUS_SO=1 AND a.STATUS_FEE is NULL');
|
|
$this->db->or_where('a.FEE_SO!="0.00" AND a.STATUS_SO=1 AND e.TGL_BFE>=', $tgl_now);
|
|
} else if ($set==1) {
|
|
$this->db->where('a.FEE_SO!="0.00"');
|
|
$this->db->where('a.STATUS_SO=1');
|
|
$this->db->where('d.TGL_PENJUALAN>=', $tanggal_awal);
|
|
$this->db->where('d.TGL_PENJUALAN<=', $tanggal_akhir);
|
|
if ($id_pelanggan!=null) {
|
|
$this->db->where('a.PELANGGAN_ID=', $id_pelanggan);
|
|
}
|
|
if ($id_corp!=null) {
|
|
$this->db->where('a.CORP_ID=', $id_corp);
|
|
}
|
|
}
|
|
$this->db->group_by('a.ID_SO');
|
|
$this->db->order_by('e.TGL_BFE ASC, d.TGL_PENJUALAN ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_BiayaFee_byPENJUALAN($id) { // Informasi = [41]
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_BFE,"%d/%m/%Y") as TANGGAL,a.DKB_ID as DKB,a.DJM_ID as DJM,FORMAT(a.BIAYA_BFE,2) as PISAHFEE');
|
|
$this->db->from('biaya_fee a');
|
|
$this->db->join('daftar_kasbank b','b.ID_DKB=a.DKB_ID','left');
|
|
$this->db->join('kasbank c','c.ID_KB=b.KB_ID','left');
|
|
$this->db->join('daftar_jurnalmemo d','d.ID_DJM=a.DJM_ID','left');
|
|
$this->db->join('jurnal_memo e','e.ID_JM=d.JM_ID','left');
|
|
$this->db->where(['a.PENJUALAN_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DpPembelian_forInformasi($id=null) { // Informasi = [42, 43]
|
|
if ($id==null) {
|
|
$this->db->select('*,FORMAT(SUM(DEBET_DPB-KREDIT_DPB),2) as TOTAL');
|
|
$this->db->from('dp_pembelian a');
|
|
$this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->order_by('b.NAMA_SUPPLIER ASC');
|
|
$this->db->group_by('a.SUPPLIER_ID');
|
|
} else {
|
|
$this->db->select('*,b.SETDATA_ID as SETID,FORMAT(b.DEBET_DKB,2) as DEBET,DATE_FORMAT(c.TGL_SETDATA,"%d/%m/%Y") as TGLSET,
|
|
DATE_FORMAT(d.TGL_KB,"%d/%m/%Y") as TGLKB,DATE_FORMAT(f.TGL_JM,"%d/%m/%Y") as TGLJM');
|
|
$this->db->from('dp_pembelian a');
|
|
$this->db->join('daftar_kasbank b','b.ID_DKB=a.DKB_ID');
|
|
$this->db->join('setdata c','c.ID_SETDATA=b.SETDATA_ID','left');
|
|
$this->db->join('kasbank d','d.ID_KB=b.KB_ID','left');
|
|
$this->db->join('daftar_jurnalmemo e','e.DKB_ID=b.ID_DKB','left');
|
|
$this->db->join('jurnal_memo f','f.ID_JM=e.JM_ID','left');
|
|
$this->db->where(['a.SUPPLIER_ID' => $id]);
|
|
$this->db->order_by('a.TGL_DPB ASC');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Supplier_byID($id) { // Informasi = [43, 47]
|
|
$this->db->select('*');
|
|
$this->db->from('supplier a');
|
|
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
|
$this->db->where(['a.ID_SUPPLIER' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DpPenjualan_forInformasi($id=null) { // Informasi = [44, 45]
|
|
if ($id==null) {
|
|
$this->db->select('*,FORMAT(SUM(KREDIT_DPJ-DEBET_DPJ),2) as TOTAL');
|
|
$this->db->from('dp_penjualan a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->order_by('b.TYPE_PELANGGAN ASC,b.NAMA_PELANGGAN ASC');
|
|
$this->db->group_by('a.PELANGGAN_ID');
|
|
} else {
|
|
$this->db->select('*,b.SETDATA_ID as SETID,FORMAT(b.KREDIT_DKB,2) as KREDIT,DATE_FORMAT(c.TGL_SETDATA,"%d/%m/%Y") as TGLSET,
|
|
DATE_FORMAT(d.TGL_KB,"%d/%m/%Y") as TGLKB,DATE_FORMAT(f.TGL_JM,"%d/%m/%Y") as TGLJM');
|
|
$this->db->from('dp_penjualan a');
|
|
$this->db->join('daftar_kasbank b','b.ID_DKB=a.DKB_ID');
|
|
$this->db->join('setdata c','c.ID_SETDATA=b.SETDATA_ID','left');
|
|
$this->db->join('kasbank d','d.ID_KB=b.KB_ID','left');
|
|
$this->db->join('daftar_jurnalmemo e','e.DKB_ID=b.ID_DKB','left');
|
|
$this->db->join('jurnal_memo f','f.ID_JM=e.JM_ID','left');
|
|
$this->db->where(['a.PELANGGAN_ID' => $id]);
|
|
$this->db->order_by('a.TGL_DPJ ASC');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Pelanggan_byID($id=null) { // Informasi = [41, 45, 52]
|
|
if ($id==null) {
|
|
$this->db->select('*');
|
|
$this->db->from('pelanggan a');
|
|
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('pelanggan a');
|
|
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
|
$this->db->where(['a.ID_PELANGGAN' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HutangDagang_forInformasi($id=null, $level=null) { // Informasi = [46, 47]
|
|
if ($id==null) {
|
|
$this->db->select('*,FORMAT(SUM(a.KREDIT_HDA-a.DEBET_HDA),2) as TOTAL');
|
|
$this->db->from('hutang_dagang a');
|
|
$this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('pembelian d','d.ID_PEMBELIAN=a.PEMBELIAN_ID','left');
|
|
if ($level==1) {
|
|
$this->db->where('d.CORP_ID=5');
|
|
}
|
|
//$this->db->where('a.TRANSAKSI_HDA!=2');
|
|
$this->db->having('TOTAL>"0.00"');
|
|
$this->db->order_by('b.NAMA_SUPPLIER ASC');
|
|
$this->db->group_by('a.SUPPLIER_ID');
|
|
} else {
|
|
$this->db->select('*,FORMAT(a.KREDIT_HDA,2) as KREDIT,FORMAT(SUM(a.DEBET_HDA),2) as DEBET,
|
|
FORMAT(SUM(a.KREDIT_HDA-a.DEBET_HDA),2) as TOTAL,DATE_FORMAT(d.TGL_PEMBELIAN,"%d/%m/%Y") as TGLBELI,
|
|
DATE_FORMAT(d.TGL_INVBELI,"%d/%m/%Y") as TGLINV,DATE_FORMAT(d.TEMPO_INVBELI,"%d/%m/%Y") as TEMPO,DATE_FORMAT(d.TT_PEMBELIAN,"%d/%m/%Y") as TT');
|
|
$this->db->from('hutang_dagang a');
|
|
$this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('pembelian d','d.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->join('corp e','e.ID_CORP=d.CORP_ID','left');
|
|
$this->db->order_by('d.TEMPO_INVBELI ASC,a.TGL_HDA ASC,d.INV_PEMBELIAN ASC');
|
|
$this->db->where(['a.SUPPLIER_ID' => $id]);
|
|
$this->db->group_by('a.PEMBELIAN_ID');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_HutangDagang_bySUPPLIER($id, $tempo) { // Informasi = [46]
|
|
$this->db->select('*,SUM(a.KREDIT_HDA-a.DEBET_HDA) as TOTAL,DATE_FORMAT(b.TEMPO_INVBELI,"%d/%m/%Y") as TEMPO');
|
|
$this->db->from('hutang_dagang a');
|
|
$this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->where('a.SUPPLIER_ID=', $id);
|
|
$this->db->where('b.TEMPO_INVBELI<=', $tempo);
|
|
$this->db->group_by('b.INV_PEMBELIAN');
|
|
$this->db->having('TOTAL>0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HutangDagang_byPEMBELIAN_forInformasi($id) { // Informasi = [48]
|
|
$this->db->select('*,FORMAT(a.KREDIT_HDA,2) as KREDIT,FORMAT(a.DEBET_HDA,2) as DEBET,DATE_FORMAT(a.TGL_HDA,"%d/%m/%Y") as TGL');
|
|
$this->db->from('hutang_dagang a');
|
|
$this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('pembelian d','d.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->where(['a.PEMBELIAN_ID' => $id]);
|
|
$this->db->order_by('a.ID_HDA ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_JurnalMemo_byKODE($id = null) { // Informasi = [49]
|
|
if ($id==null) {
|
|
$this->db->select('*,SUM(b.DEBET_DJM) as DEBET,SUM(b.KREDIT_DJM) as KREDIT,DATE_FORMAT(a.TGL_JM,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('jurnal_memo a');
|
|
$this->db->join('daftar_jurnalmemo b','b.JM_ID=a.ID_JM');
|
|
//$this->db->not_like('a.KODE_JM', 'BSD', 'after');
|
|
$this->db->group_by('a.ID_JM');
|
|
$this->db->order_by('a.KODE_JM DESC, a.ID_JM DESC');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('jurnal_memo');
|
|
$this->db->where(['KODE_JM' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_JurnalMemo_byID($id = null) { // Informasi = [49]
|
|
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) { // Informasi = [49]
|
|
if ($id==null) {
|
|
$this->db->select('*');
|
|
$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->join('saldo_bank d','d.ID_SB=a.SB_ID','left');
|
|
$this->db->join('saldo_kas e','e.ID_SK=a.SK_ID','left');
|
|
$this->db->join('kas f','f.ID_KAS=e.KAS_ID','left');
|
|
$this->db->join('bank g','g.ID_BANK=d.BANK_ID','left');
|
|
$this->db->where(['a.JM_ID' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarJurnalMemo_byJM($id) { // Informasi = [49]
|
|
$this->db->select('*,FORMAT(SUM(DEBET_DJM),2) as DEBET,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 getData_Kasbank_byKODE($start, $end) { // Informasi = [50]
|
|
$this->db->select('*,SUM(b.DEBET_DKB) as DEBET,SUM(b.KREDIT_DKB) as KREDIT,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->where('a.TGL_INPUT>=', $start);
|
|
$this->db->where('a.TGL_INPUT<=', $end);
|
|
$this->db->group_by('a.ID_KB');
|
|
$this->db->order_by('a.TGL_INPUT ASC, a.ID_KB ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kasbank_byID($id = null) { // Informasi = [50]
|
|
if ($id==null) {
|
|
$this->db->select('*');
|
|
$this->db->from('kasbank');
|
|
} else {
|
|
$this->db->select('*');
|
|
$this->db->from('kasbank');
|
|
$this->db->where(['ID_KB' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_DaftarKasbank_byKB($id = null) { // Informasi = [50]
|
|
if ($id==null) {
|
|
$this->db->select('*');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_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.KB_ID is NULL');
|
|
} else {
|
|
$this->db->select('*,FORMAT(a.DEBET_DKB,2) as DEBET_DKB,FORMAT(a.KREDIT_DKB,2) as KREDIT_DKB,
|
|
DATE_FORMAT(b.TGL_INPUT,"%d/%m/%Y") as TANGGAL');
|
|
$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->where('a.SETDATA_ID is NULL');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DaftarKasbank_byKB($id) { // Informasi = [50]
|
|
$this->db->select('*,FORMAT(SUM(DEBET_DKB),2) as DEBET,FORMAT(SUM(KREDIT_DKB),2) as KREDIT');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where(['KB_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Kelompok($id=null) { // Informasi = [51]
|
|
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]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangDagang_forInformasi($id_pelanggan=null, $id_kelompok=null, $level=null) { // Informasi = [51, 52]
|
|
if ($id_pelanggan==null AND $id_kelompok==null) {
|
|
$this->db->select('*,FORMAT(SUM(a.DEBET_PDA-a.KREDIT_PDA),2) as TOTAL,a.PELANGGAN_ID as PID');
|
|
$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');
|
|
if ($level==1) {
|
|
$this->db->where('d.KOP_ID>=4');
|
|
} else if ($level==0) {
|
|
$this->db->where('d.KOP_ID<=3');
|
|
}
|
|
$this->db->having('TOTAL>"0.00"');
|
|
$this->db->order_by('b.TYPE_PELANGGAN ASC,b.NAMA_PELANGGAN ASC');
|
|
$this->db->group_by('a.PELANGGAN_ID');
|
|
} else if ($id_pelanggan==null AND $id_kelompok!=null) {
|
|
$this->db->select('*,FORMAT(SUM(a.DEBET_PDA-a.KREDIT_PDA),2) as TOTAL,a.PELANGGAN_ID as PID');
|
|
$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->join('karyawan f','f.ID_KARYAWAN=e.SALES_ID','left');
|
|
if ($level==1) {
|
|
$this->db->where('e.CORP_ID>=4 AND b.KELOMPOK_ID=', $id_kelompok);
|
|
} else if ($level==0) {
|
|
$this->db->where('e.CORP_ID<=3 AND b.KELOMPOK_ID=', $id_kelompok);
|
|
$this->db->or_where('d.SO_ID is NULL AND b.KELOMPOK_ID=', $id_kelompok);
|
|
}
|
|
$this->db->order_by('b.TYPE_PELANGGAN ASC,b.NAMA_PELANGGAN ASC');
|
|
$this->db->group_by('a.PELANGGAN_ID');
|
|
} else {
|
|
$this->db->select('*,FORMAT(a.DEBET_PDA,2) as DEBET,FORMAT(SUM(a.KREDIT_PDA),2) as KREDIT,
|
|
FORMAT(SUM(a.DEBET_PDA-a.KREDIT_PDA),2) as TOTAL,DATE_FORMAT(d.TGL_PENJUALAN,"%d/%m/%Y") as TGLJUAL,
|
|
DATE_FORMAT(d.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO,DATE_FORMAT(d.TT_PENJUALAN,"%d/%m/%Y") as TT,a.PELANGGAN_ID as PID');
|
|
$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->join('karyawan f','f.ID_KARYAWAN=e.SALES_ID','left');
|
|
$this->db->order_by('d.TEMPO_PENJUALAN ASC,d.INV_PENJUALAN ASC');
|
|
$this->db->group_by('d.INV_PENJUALAN');
|
|
if ($level==1) {
|
|
$this->db->where('e.CORP_ID>=4 AND a.PELANGGAN_ID=', $id_pelanggan);
|
|
} else if ($level==0) {
|
|
$this->db->where('e.CORP_ID<=3 AND a.PELANGGAN_ID=', $id_pelanggan);
|
|
$this->db->or_where('d.SO_ID is NULL AND a.PELANGGAN_ID=', $id_pelanggan);
|
|
}
|
|
$this->db->order_by('a.TGL_PDA ASC');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PiutangDagang_byPELANGGAN($id, $tempo) { // Informasi = [51]
|
|
$this->db->select('*,SUM(a.DEBET_PDA-a.KREDIT_PDA) as TOTAL,DATE_FORMAT(b.TEMPO_PENJUALAN,"%d/%m/%Y") as TEMPO');
|
|
$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','left');
|
|
$this->db->join('karyawan d','d.ID_KARYAWAN=c.SALES_ID','left');
|
|
$this->db->where('a.PELANGGAN_ID=', $id);
|
|
$this->db->where('b.TEMPO_PENJUALAN<=', $tempo);
|
|
$this->db->group_by('b.INV_PENJUALAN');
|
|
$this->db->having('TOTAL>0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangDagang_byPENJUALAN_forInformasi($id) { // Informasi = [53]
|
|
$this->db->select('*,FORMAT(a.DEBET_PDA,2) as DEBET,FORMAT(a.KREDIT_PDA,2) as KREDIT,DATE_FORMAT(a.TGL_PDA,"%d/%m/%Y") as TGL');
|
|
$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->order_by('b.NAMA_PELANGGAN ASC');
|
|
$this->db->where(['a.PENJUALAN_ID' => $id]);
|
|
$this->db->order_by('a.TGL_PDA ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangDagang_byID($id) { // Informasi = [53]
|
|
$this->db->select('*');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('piutang_dagang b','b.PENJUALAN_ID=a.ID_PENJUALAN');
|
|
$this->db->where(['a.ID_PENJUALAN' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangKaryawan_forInformasi($id=null) { // Informasi = [54, 55]
|
|
if ($id==null) {
|
|
$this->db->select('*,FORMAT(SUM(a.DEBET_PKA-a.KREDIT_PKA),2) as TOTAL');
|
|
$this->db->from('piutang_karyawan a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->order_by('b.NAMA_PANGGILAN_KARYAWAN ASC');
|
|
$this->db->group_by('a.KARYAWAN_ID');
|
|
} else {
|
|
$this->db->select('*,a.DKB_ID as DKB,a.DJM_ID as DJM,FORMAT(a.DEBET_PKA,2) as DEBET,FORMAT(a.KREDIT_PKA,2) as KREDIT,
|
|
DATE_FORMAT(a.TGL_PKA,"%d/%m/%Y") as TGL');
|
|
$this->db->from('piutang_karyawan a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->join('daftar_kasbank c','c.ID_DKB=a.DKB_ID','left');
|
|
$this->db->join('daftar_jurnalmemo d','d.ID_DJM=a.DJM_ID','left');
|
|
$this->db->join('kasbank e','e.ID_KB=c.KB_ID','left');
|
|
$this->db->join('jurnal_memo f','f.ID_JM=d.JM_ID','left');
|
|
$this->db->order_by('a.ID_PKA ASC');
|
|
$this->db->where(['a.KARYAWAN_ID' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangPihakke3_forInformasi($id=null) { // Informasi = [56, 57]
|
|
if ($id==null) {
|
|
$this->db->select('*,FORMAT(SUM(a.DEBET_PPK-a.KREDIT_PPK),2) as TOTAL');
|
|
$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->order_by('b.NAMA_PIHAKKE3 ASC');
|
|
$this->db->group_by('a.PIHAKKE3_ID');
|
|
} else {
|
|
$this->db->select('*,FORMAT(a.DEBET_DKB,2) as DEBET,FORMAT(a.KREDIT_DKB,2) as KREDIT,
|
|
DATE_FORMAT(d.TGL_KB,"%d/%m/%Y") as TGLKB');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('piutang_pihakke3 b','b.ID_PPK=a.PPK_ID');
|
|
$this->db->join('pihakke3 c','c.ID_PIHAKKE3=b.PIHAKKE3_ID');
|
|
$this->db->join('kasbank d','d.ID_KB=a.KB_ID');
|
|
$this->db->order_by('a.ID_DKB ASC');
|
|
$this->db->where(['b.PIHAKKE3_ID' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Pihakke3_byID($id) { // Informasi = [57]
|
|
$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_SaldoBank_forInformasi($id=null, $level=null) { // Informasi = [58, 59]
|
|
if ($id==null) {
|
|
$this->db->select('*,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');
|
|
if ($level==0) {
|
|
$this->db->where('a.BANK_ID<12 OR a.BANK_ID>15');
|
|
} else if ($level==1) {
|
|
$this->db->where('a.BANK_ID>=12 AND a.BANK_ID<=15');
|
|
}
|
|
$this->db->order_by('b.KODE_BANK ASC');
|
|
$this->db->group_by('a.BANK_ID');
|
|
} else {
|
|
$this->db->select('*,FORMAT(a.DEBET_SB,2) as DEBET,FORMAT(a.KREDIT_SB,2) as KREDIT,
|
|
DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGL,a.DKB_ID as DKB, a.DJM_ID as DJM');
|
|
$this->db->from('saldo_bank a');
|
|
$this->db->join('bank b','b.ID_BANK=a.BANK_ID');
|
|
$this->db->join('daftar_kasbank c','c.ID_DKB=a.DKB_ID','left');
|
|
$this->db->join('kasbank d','d.ID_KB=c.KB_ID','left');
|
|
$this->db->join('daftar_jurnalmemo e','e.ID_DJM=a.DJM_ID','left');
|
|
$this->db->join('jurnal_memo f','f.ID_JM=e.JM_ID','left');
|
|
$this->db->order_by('a.ID_SB ASC');
|
|
$this->db->group_by('a.ID_SB');
|
|
$this->db->where(['a.BANK_ID' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Bank_byID($id) { // Informasi = [59]
|
|
$this->db->select('*');
|
|
$this->db->from('bank');
|
|
$this->db->where(['ID_BANK' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SaldoKas_forInformasi($id) { // Informasi = [60]
|
|
$this->db->select('*,FORMAT(a.DEBET_SK,2) as DEBET,FORMAT(a.KREDIT_SK,2) as KREDIT,DATE_FORMAT(a.TGL_INPUT,"%d/%m/%Y") as TGL,a.DKB_ID as DKB, a.DJM_ID as DJM');
|
|
$this->db->from('saldo_kas a');
|
|
$this->db->join('kas b','b.ID_KAS=a.KAS_ID');
|
|
$this->db->join('daftar_kasbank c','c.ID_DKB=a.DKB_ID','left');
|
|
$this->db->join('kasbank d','d.ID_KB=c.KB_ID','left');
|
|
$this->db->join('daftar_jurnalmemo e','e.ID_DJM=a.DJM_ID','left');
|
|
$this->db->join('jurnal_memo f','f.ID_JM=e.JM_ID','left');
|
|
$this->db->order_by('a.ID_SK ASC');
|
|
$this->db->where(['a.KAS_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_SaldoKas_forInformasi($id) { // Informasi = [60]
|
|
$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 getID_SetdataMax() { // Informasi = [61, 62, 63, 64, 65]
|
|
$this->db->select_max('ID_SETDATA');
|
|
$this->db->from('setdata');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Setdata_byID($id) { // Informasi = [61, 62, 63, 64, 65, 66, 69, 70, 71]
|
|
$this->db->select('*,DATE_FORMAT(TGL_SETDATA,"%d/%m/%Y") as TGLSTART, DATE_FORMAT(TGL_KUNCI,"%d/%m/%Y") as TGLEND');
|
|
$this->db->from('setdata');
|
|
$this->db->where('ID_SETDATA=',$id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function addTempoMonth($date,$month) { // Informasi = [61, 63, 64] = Terpakai Untuk Fungsi Internal
|
|
$sum = strtotime(date("Y-m-d", strtotime("$date")) . " +$month month");
|
|
$dateTo=date('Y-m-d',$sum);
|
|
return $dateTo;
|
|
}
|
|
|
|
public function getSum_SaldoKas_byDKB_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=1');
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_SaldoKas_byDJM_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) AS TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=1');
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_SaldoBank_byDKB_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=2');
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_SaldoBank_byDJM_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) AS TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=2');
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PiutangDagang_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(DEBET_PDA-KREDIT_PDA) AS TOTALNERACA');
|
|
$this->db->from('piutang_dagang');
|
|
$this->db->where('TGL_PDA<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_HistoriKuantiti_groupBARANG_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('a.BARANG_ID,SUM(MASUK_HQ-KELUAR_HQ) as TOTAL,SUM(MASUK_HQ) as MASUK,SUM(KELUAR_HQ) as KELUAR,b.*,c.*');
|
|
$this->db->from('histori_kuantiti 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.TGL_HQ<', $tgl_end);
|
|
$this->db->having('TOTAL>0');
|
|
$this->db->group_by('a.BARANG_ID');
|
|
$this->db->order_by('b.KODE_BARANG ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PiutangKaryawan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(DEBET_PKA-KREDIT_PKA) AS TOTALNERACA');
|
|
$this->db->from('piutang_karyawan');
|
|
$this->db->where('TGL_PKA<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PiutangPihakke3_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(DEBET_PPK-KREDIT_PPK) AS TOTALNERACA');
|
|
$this->db->from('piutang_pihakke3');
|
|
$this->db->where('TGL_PPK<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DpPembelian_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(DEBET_DPB-KREDIT_DPB) AS TOTALNERACA');
|
|
$this->db->from('dp_pembelian');
|
|
$this->db->where('TGL_DPB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PajakDibayarDimuka_byDKB_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(a.DEBET_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_ID');
|
|
$this->db->where('a.PERKIRAAN_ID=8');
|
|
$this->db->where('a.TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PajakDibayarDimuka_byDJM_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(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('a.PERKIRAAN_ID=8');
|
|
$this->db->where('b.TGL_JM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PajakMasukanKasbank_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('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('a.PERKIRAAN_ID=82');
|
|
$this->db->where('b.TGL_KB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PajakMasukanJurnalMemo_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('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('a.PERKIRAAN_ID=82');
|
|
$this->db->where('b.TGL_JM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_InventarisKantor_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(DEBET_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=9');
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PenyusutanInventarisKantor_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(DEBET_DJM) AS TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=67');
|
|
$this->db->where('BPI_ID is NOT NULL');
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_Ruko_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(DEBET_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=11');
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PenyusutanRuko_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(DEBET_DJM) AS TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=67');
|
|
$this->db->where('BPR_ID is NOT NULL');
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_Kendaraan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(DEBET_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=13');
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PenyusutanKendaraan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(DEBET_DJM) AS TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=67');
|
|
$this->db->where('BPK_ID is NOT NULL');
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_HutangDagang_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(KREDIT_HDA-DEBET_HDA) AS TOTALNERACA');
|
|
$this->db->from('hutang_dagang');
|
|
$this->db->where('TGL_HDA<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_HutangBank_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(KREDIT_DKB-DEBET_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=17');
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_HutangAktiva_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(KREDIT_DKB-DEBET_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank ');
|
|
$this->db->where('PERKIRAAN_ID=18');
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_DpPenjualan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(KREDIT_DPJ-DEBET_DPJ) AS TOTALNERACA');
|
|
$this->db->from('dp_penjualan');
|
|
$this->db->where('TGL_DPJ<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_HutangPajak_byDKB_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(KREDIT_DKB-DEBET_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=16');
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_HutangPajak_byDJM_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(KREDIT_DJM-DEBET_DJM) AS TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=16');
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PajakKeluaranKasbank_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(a.KREDIT_DKB-a.DEBET_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank a');
|
|
$this->db->join('kasbank b','b.ID_KB=a.KB_ID');
|
|
$this->db->where('a.PERKIRAAN_ID=83');
|
|
$this->db->where('a.TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PajakKeluaranJurnalMemo_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
|
|
$this->db->select('SUM(a.KREDIT_DJM-a.DEBET_DJM) AS TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo a');
|
|
$this->db->join('jurnal_memo b','b.ID_JM=a.JM_ID');
|
|
$this->db->where('a.PERKIRAAN_ID=83');
|
|
$this->db->where('a.TGL_DJM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_Modal_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(KREDIT_DKB) AS TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('PERKIRAAN_ID=20');
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_AkumulasiLabaDitahan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_end = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_end, 1);
|
|
$this->db->select('SUM(KREDIT_DJM-DEBET_DJM) AS TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('PERKIRAAN_ID=21');
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_Penjualan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('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.STATUS_PENJUALAN=1');
|
|
$this->db->where('a.TGL_PENJUALAN>=', $tgl_start);
|
|
$this->db->where('a.TGL_PENJUALAN<', $tgl_end);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_ReturPenjualan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('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>=', $tgl_start);
|
|
$this->db->where('a.TGL_RJ<', $tgl_end);
|
|
$this->db->where('a.STATUS_RJ=1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PotonganDiskonPenjualan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=25');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PersediaanAwal_forNeraca($month, $year) { // Informasi = [61]
|
|
//$tgl_start = "$year-$month-01";
|
|
$tgl_start = "$year-$month-31";
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('TGL_DJM<', $tgl_start);
|
|
$this->db->where('PERKIRAAN_ID=4');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_Pembelian_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('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>=', $tgl_start);
|
|
$this->db->where('a.TGL_PEMBELIAN<', $tgl_end);
|
|
$this->db->where('a.STATUS_PEMBELIAN=1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_ReturPembelian_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('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>=', $tgl_start);
|
|
$this->db->where('a.TGL_RB<', $tgl_end);
|
|
$this->db->where('a.STATUS_RB=1');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PotonganDiskonPembelian_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(KREDIT_DKB-DEBET_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=29');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaOperasional_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=31');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPengiriman_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=32');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaServiceKendaraan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=33');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaBensin_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=34');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaParkirUmum_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=35');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaSparepart_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=36');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaKebutuhanService_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=37');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaGajiTHR_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=38');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPajakPPHPsl21_forNeraca_DKB($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=39');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPajakPPHPsl21_forNeraca_DJM($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('TGL_DJM>=', $tgl_start);
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=39');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaIncentive_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=40');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPLN_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=41');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaTelepon_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=42');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaInternet_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=43');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPDAM_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=44');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaServiceChargeManggaDua_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=45');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaParkirKaryawan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=46');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaKonsultanPajak_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=47');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaATK_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=48');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaMaterai_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=49');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaFotocopy_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=50');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaMajalahKomputer_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=51');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaCetak_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=52');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaSuratReferensi_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=53');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaKebutuhanKantor_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=54');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaServiceLuar_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=55');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaTol_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=56');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaServiceAC_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=57');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPajakKendaraan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=58');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaSumbangan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=59');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaEntertain_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=60');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaBPJS_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=61');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaAssKaryawan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=62');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaTraining_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=63');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaFee_byDKB_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=64');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaFee_byDJM_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('TGL_DJM>=', $tgl_start);
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=64');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaDinasLuar_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=65');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPajakPPHPsl25_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=66');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPenyusutan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('TGL_DJM>=', $tgl_start);
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=67');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaKegiatanKaryawan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=68');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaRekreasiKaryawan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=69');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPengeluaranProject_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=70');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaBungaKredit_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=71');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaKreditBank_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=72');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPerawatanPerbaikanGedung_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=73');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaLainLain_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=74');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PendapatanDiluarUsaha_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(KREDIT_DKB-DEBET_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=75');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PendapatanJasaGiro_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(KREDIT_DKB-DEBET_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=76');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_AdminBank_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=77');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PajakGiro_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=78');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPajakPenghasilan_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('TGL_DJM>=', $tgl_start);
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=79');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPengeluaranItc_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=80');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaParkirKarITC_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=81');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaListrikITC_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=84');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaSewaStand_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=85');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BiayaPajakLainnya_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DKB-KREDIT_DKB) as TOTALNERACA');
|
|
$this->db->from('daftar_kasbank');
|
|
$this->db->where('TGL_DKB>=', $tgl_start);
|
|
$this->db->where('TGL_DKB<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=86');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_BebanSelisihNilai_forNeraca($month, $year) { // Informasi = [61]
|
|
$tgl_start = "$year-$month-01";
|
|
$tgl_end = $this->addTempoMonth($tgl_start, 1);
|
|
$this->db->select('SUM(DEBET_DJM-KREDIT_DJM) as TOTALNERACA');
|
|
$this->db->from('daftar_jurnalmemo');
|
|
$this->db->where('TGL_DJM>=', $tgl_start);
|
|
$this->db->where('TGL_DJM<', $tgl_end);
|
|
$this->db->where('PERKIRAAN_ID=87');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getKode_Setdata() { // Informasi = [63]
|
|
$this->db->select('MAX(KODE_SETDATA) AS KODE');
|
|
$this->db->from('setdata');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Neraca_bySETDATA_byPERKIRAAN($id, $perkiraan) { // Informasi = [64]
|
|
$this->db->select('*');
|
|
$this->db->from('neraca');
|
|
$this->db->where('SETDATA_ID=', $id);
|
|
$this->db->where('PERKIRAAN_ID=', $perkiraan);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function subTempoDay($date,$day) { // Informasi = [64]
|
|
$sum = strtotime(date("Y-m-d", strtotime("$date")) . " -$day day");
|
|
$dateTo=date('Y-m-d',$sum);
|
|
return $dateTo;
|
|
}
|
|
|
|
public function getData_Neraca_AkumulasiLaba_forSetdata($id) { // Informasi = [64]
|
|
$this->db->select('ID_NERACA');
|
|
$this->db->from('neraca');
|
|
$this->db->where('PERKIRAAN_ID=21');
|
|
$this->db->where(['SETDATA_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Neraca_PersediaanAwal_forSetdata($id) { // Informasi = [64]
|
|
$this->db->select('ID_NERACA');
|
|
$this->db->from('neraca');
|
|
$this->db->where('PERKIRAAN_ID=26');
|
|
$this->db->where(['SETDATA_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getID_JurnalMemoMax() { // Informasi = [64]
|
|
$this->db->select_max('ID_JM');
|
|
$this->db->from('jurnal_memo');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PajakMasukan_Pembelian($tanggal_awal, $tanggal_akhir) { // Informasi = [64]
|
|
$this->db->select('a.TGL_PEMBELIAN as TGL, a.KODE_PEMBELIAN as KODEBUKTI, SUM(e.HARGA_DB*e.QTY_DB) as TOTALDPP, a.INV_PEMBELIAN as INV,b.NAMA_SUPPLIER,d.NAMA_CORP,
|
|
c.NAMA_KOTA AS NAMA_KOTA_SUPPLIER,DATE_FORMAT(a.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL,ROUND(SUM(((100+a.PPN_PEMBELIAN)/100)*(e.QTY_DB*e.HARGA_DB)),0) as TOTAL');
|
|
$this->db->from('pembelian a');
|
|
$this->db->join('supplier b','b.ID_SUPPLIER=a.SUPPLIER_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('corp d', 'd.ID_CORP=a.CORP_ID');
|
|
$this->db->join('daftar_beli e', 'e.PEMBELIAN_ID=a.ID_PEMBELIAN');
|
|
$this->db->where('a.TGL_PEMBELIAN>=', $tanggal_awal);
|
|
$this->db->where('a.TGL_PEMBELIAN<=', $tanggal_akhir);
|
|
$this->db->where('a.STATUS_PEMBELIAN=1');
|
|
$this->db->where('a.PPN_PEMBELIAN!="0.00"');
|
|
$this->db->group_by('a.ID_PEMBELIAN');
|
|
$this->db->order_by('a.KODE_PEMBELIAN ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PajakMasukan_ReturBeli($tanggal_awal, $tanggal_akhir) { // Informasi = [64]
|
|
$this->db->select('a.TGL_RB as TGL, a.KODE_RB as KODEBUKTI, SUM(f.HARGA_DRB*f.QTY_DRB) as TOTALDPP, d.NAMA_KOTA AS NAMA_KOTA_SUPPLIER,DATE_FORMAT(a.TGL_RB,"%d/%m/%Y") as TANGGAL,
|
|
ROUND(SUM(((100+b.PPN_PEMBELIAN)/100)*(f.QTY_DRB*f.HARGA_DRB)),0) as TOTAL,c.NAMA_SUPPLIER, a.INV_RB as INV,e.NAMA_CORP');
|
|
$this->db->from('retur_pembelian a');
|
|
$this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
|
$this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('corp e', 'e.ID_CORP=b.CORP_ID');
|
|
$this->db->join('daftar_returbeli f', 'f.RB_ID=a.ID_RB');
|
|
$this->db->where('a.TGL_RB>=', $tanggal_awal);
|
|
$this->db->where('a.TGL_RB<=', $tanggal_akhir);
|
|
$this->db->where('a.STATUS_RB=1');
|
|
$this->db->where('b.PPN_PEMBELIAN!="0.00"');
|
|
$this->db->group_by('a.ID_RB');
|
|
$this->db->order_by('a.KODE_RB ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PajakKeluaran_Penjualan($tanggal_awal, $tanggal_akhir) { // Informasi = [64]
|
|
$this->db->select('a.TGL_PENJUALAN as TGL, a.KODE_PENJUALAN as KODEBUKTI, SUM(f.HARGA_DO*f.QTY_DO) as TOTALDPP, a.INV_PENJUALAN as INV,c.NAMA_PELANGGAN,c.TYPE_PELANGGAN,e.NAMA_CORP,
|
|
d.NAMA_KOTA AS NAMA_KOTA_PELANGGAN,DATE_FORMAT(a.TGL_PENJUALAN,"%d/%m/%Y") as TANGGAL,ROUND(SUM(((100+b.PPN_SO)/100)*(f.QTY_DO*f.HARGA_DO)),0) as TOTAL');
|
|
$this->db->from('penjualan a');
|
|
$this->db->join('sales_order b','b.ID_SO=a.SO_ID');
|
|
$this->db->join('pelanggan c','c.ID_PELANGGAN=b.PELANGGAN_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->join('corp e', 'e.ID_CORP=b.CORP_ID');
|
|
$this->db->join('daftar_order f', 'f.SO_ID=a.SO_ID');
|
|
$this->db->where('a.TGL_PENJUALAN>=', $tanggal_awal);
|
|
$this->db->where('a.TGL_PENJUALAN<=', $tanggal_akhir);
|
|
$this->db->where('a.STATUS_PENJUALAN=1');
|
|
$this->db->where('b.PPN_SO!="0.00"');
|
|
$this->db->group_by('a.ID_PENJUALAN');
|
|
$this->db->order_by('a.KODE_PENJUALAN ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PajakKeluaran_ReturJual($tanggal_awal, $tanggal_akhir) { // Informasi = [64]
|
|
$this->db->select('a.TGL_RJ as TGL, a.KODE_RJ as KODEBUKTI, SUM(g.HARGA_DRJ*g.QTY_DRJ) as TOTALDPP, e.NAMA_KOTA AS NAMA_KOTA_PELANGGAN,DATE_FORMAT(a.TGL_RJ,"%d/%m/%Y") as TANGGAL,
|
|
ROUND(SUM(((100+c.PPN_SO)/100)*(g.QTY_DRJ*g.HARGA_DRJ)),0) as TOTAL, d.NAMA_PELANGGAN, a.INV_RJ as INV,f.NAMA_CORP,d.TYPE_PELANGGAN');
|
|
$this->db->from('retur_penjualan a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('sales_order c','c.ID_SO=b.SO_ID');
|
|
$this->db->join('pelanggan d','d.ID_PELANGGAN=c.PELANGGAN_ID');
|
|
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID');
|
|
$this->db->join('corp f', 'f.ID_CORP=c.CORP_ID');
|
|
$this->db->join('daftar_returjual g', 'g.RJ_ID=a.ID_RJ');
|
|
$this->db->where('a.TGL_RJ>=', $tanggal_awal);
|
|
$this->db->where('a.TGL_RJ<=', $tanggal_akhir);
|
|
$this->db->where('a.STATUS_RJ=1');
|
|
$this->db->where('c.PPN_SO!="0.00"');
|
|
$this->db->group_by('a.ID_RJ');
|
|
$this->db->order_by('a.KODE_RJ ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Setdata_0() { // Informasi = [66]
|
|
$this->db->select('*,DATE_FORMAT(TGL_SETDATA,"%d/%m/%Y") as TGLSTART, DATE_FORMAT(TGL_KUNCI,"%d/%m/%Y") as TGLEND');
|
|
$this->db->from('setdata');
|
|
$this->db->where('STATUS_SETDATA=0');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Neraca_bySETDATA($id) { // Informasi = [66, 69, 70]
|
|
$this->db->select('*');
|
|
$this->db->from('neraca');
|
|
$this->db->where('SETDATA_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getCount_Pembelian_Not1($tgl) { // Informasi = [64, 71]
|
|
$tgl_awal = date_format(date_create($tgl), "Y-m-01");
|
|
|
|
$tgl_akhir = $this->addTempoMonth($tgl_awal,1);
|
|
$tgl_akhir = $this->subTempoDay($tgl_akhir,1);
|
|
|
|
$this->db->select('ID_PEMBELIAN');
|
|
$this->db->from('pembelian');
|
|
$this->db->where('STATUS_PEMBELIAN=0');
|
|
$this->db->where('TGL_PEMBELIAN>=', $tgl_awal);
|
|
$this->db->where('TGL_PEMBELIAN<=', $tgl_akhir);
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getCount_Kasbank_Null($tgl) { // Informasi = [64, 71]
|
|
$tgl_awal = date_format(date_create($tgl), "Y-m-01");
|
|
|
|
$tgl_akhir = $this->addTempoMonth($tgl_awal,1);
|
|
$tgl_akhir = $this->subTempoDay($tgl_akhir,1);
|
|
|
|
$this->db->select('ID_KB');
|
|
$this->db->from('kasbank');
|
|
$this->db->where('STATUS_KB is NULL');
|
|
$this->db->where('TGL_KB>=', $tgl_awal);
|
|
$this->db->where('TGL_KB<=', $tgl_akhir);
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getData_PeriodeAbsensi_orderDESC_limit1() { // Informasi = [73]
|
|
$this->db->select('*');
|
|
$this->db->from('periode_absensi');
|
|
$this->db->order_by('ID_PAB DESC');
|
|
$this->db->limit('2');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SetHariLibur_byTGL($tgl) { // Informasi = [73]
|
|
$this->db->select('*');
|
|
$this->db->from('set_harilibur');
|
|
$this->db->where('TGL_SHL=', $tgl);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function addTempoDay($date,$day) { // Informasi = [73]
|
|
$sum = strtotime(date("Y-m-d", strtotime("$date")) . " +$day day");
|
|
$dateTo=date('Y-m-d',$sum);
|
|
return $dateTo;
|
|
}
|
|
|
|
public function getData_Absensi_byKARYAWAN_byTGL($id, $tgl) { // Informasi = [73]
|
|
$this->db->select('*');
|
|
$this->db->from('absensi');
|
|
$this->db->where('KARYAWAN_ID=', $id);
|
|
$this->db->where('TGL_ABSENSI=', $tgl);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getCount_Absensi_byKARYAWAN_status1($id, $awal, $akhir) { // Informasi = [73]
|
|
$this->db->select('ID_ABSENSI');
|
|
$this->db->from('absensi');
|
|
$this->db->where('KARYAWAN_ID=', $id);
|
|
$this->db->where('TGL_ABSENSI>=', $awal);
|
|
$this->db->where('TGL_ABSENSI<=', $akhir);
|
|
$this->db->where('TELAT=1');
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getCount_Absensi_byKARYAWAN_status2($id, $awal, $akhir) { // Informasi = [73]
|
|
$this->db->select('ID_ABSENSI');
|
|
$this->db->from('absensi');
|
|
$this->db->where('KARYAWAN_ID=', $id);
|
|
$this->db->where('TGL_ABSENSI>=', $awal);
|
|
$this->db->where('TGL_ABSENSI<=', $akhir);
|
|
$this->db->where('TELAT=2');
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getCount_Absensi_byKARYAWAN_status3($id, $awal, $akhir) { // Informasi = [73]
|
|
$this->db->select('ID_ABSENSI');
|
|
$this->db->from('absensi');
|
|
$this->db->where('KARYAWAN_ID=', $id);
|
|
$this->db->where('TGL_ABSENSI>=', $awal);
|
|
$this->db->where('TGL_ABSENSI<=', $akhir);
|
|
$this->db->where('TELAT=3');
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getCount_Absensi_byKARYAWAN_status4($id, $awal, $akhir) { // Informasi = [73]
|
|
$this->db->select('ID_ABSENSI');
|
|
$this->db->from('absensi');
|
|
$this->db->where('KARYAWAN_ID=', $id);
|
|
$this->db->where('TGL_ABSENSI>=', $awal);
|
|
$this->db->where('TGL_ABSENSI<=', $akhir);
|
|
$this->db->where('TELAT=4');
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getCount_Absensi_byKARYAWAN_status5($id, $awal, $akhir) { // Informasi = [73]
|
|
$this->db->select('ID_ABSENSI');
|
|
$this->db->from('absensi');
|
|
$this->db->where('KARYAWAN_ID=', $id);
|
|
$this->db->where('TGL_ABSENSI>=', $awal);
|
|
$this->db->where('TGL_ABSENSI<=', $akhir);
|
|
$this->db->where('TELAT=5');
|
|
return $this->db->count_all_results();
|
|
}
|
|
|
|
public function getData_Merk() { // Informasi = [74]
|
|
$this->db->select('*');
|
|
$this->db->from('merk');
|
|
$this->db->order_by('NAMA_MERK ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Model() { // Informasi = [74]
|
|
$this->db->select('*');
|
|
$this->db->from('model');
|
|
$this->db->order_by('NAMA_MODEL ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SetHistoriKuantiti_byKARYAWAN($id) { // Informasi = [74]
|
|
$this->db->select('*');
|
|
$this->db->from('set_historikuantiti');
|
|
$this->db->where('KARYAWAN_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriKuantiti_byJENIS_byMERK_byMODEL_byNAMA_allStatus($id_jenis, $id_merk, $id_model, $jenis_shk, $nama=null) { // Informasi = [74]
|
|
if ($jenis_shk == 1) {
|
|
$this->db->select('*,SUM(a.MASUK_HQ-a.KELUAR_HQ) as TOTAL,d.PCM_KUANTITI as QTY,d.PROSES_KUANTITI as PROSES');
|
|
} else if ($jenis_shk == 2) {
|
|
$this->db->select('*,SUM(a.MASUK_HQ-a.KELUAR_HQ) as TOTAL,d.ITP_KUANTITI as QTY,d.PROSES_KUANTITI as PROSES');
|
|
} else {
|
|
$this->db->select('*,SUM(a.MASUK_HQ-a.KELUAR_HQ) as TOTAL,d.PROSES_KUANTITI as PROSES');
|
|
}
|
|
$this->db->from('histori_kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->join('jenis c','c.ID_JENIS=b.JENIS_ID');
|
|
$this->db->join('kuantiti d','d.ID_KUANTITI=b.ID_BARANG');
|
|
$this->db->join('merk e','e.ID_MERK=b.MERK_ID');
|
|
$this->db->join('model f','f.ID_MODEL=b.MODEL_ID','left');
|
|
$this->db->group_by('a.BARANG_ID');
|
|
$this->db->order_by('c.NAMA_JENIS ASC, b.KODE_BARANG ASC');
|
|
if ($id_jenis!=0) {
|
|
$this->db->where('b.JENIS_ID=', $id_jenis);
|
|
}
|
|
if ($id_merk!=0) {
|
|
$this->db->where('b.MERK_ID=', $id_merk);
|
|
}
|
|
if ($id_model!=0) {
|
|
$this->db->where('b.MODEL_ID=', $id_model);
|
|
}
|
|
if ($jenis_shk==1 OR $jenis_shk==2) {
|
|
$this->db->having('TOTAL>0 AND QTY>0');
|
|
} else if ($jenis_shk==3) {
|
|
$this->db->having('TOTAL>0');
|
|
} else if ($jenis_shk==4) {
|
|
$this->db->having('TOTAL=0');
|
|
}
|
|
if ($nama != null) {
|
|
$this->db->like('b.KODE_BARANG', $nama, 'both');
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_status1_status5() { // Informasi = [75]
|
|
$this->db->select('*');
|
|
$this->db->from('sales_order a');
|
|
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
|
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
|
$this->db->join('penjualan d','d.SO_ID=a.ID_SO');
|
|
$this->db->where('a.STATUS_SO=1 OR a.STATUS_SO=5');
|
|
$this->db->order_by('a.KODE_SO DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_PiutangDagang_bySO($id) { // Informasi = [75]
|
|
$this->db->select('*,FORMAT(a.DEBET_PDA,2) as DEBET,FORMAT(a.KREDIT_PDA,2) as KREDIT,DATE_FORMAT(a.TGL_PDA,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('piutang_dagang a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->where(['b.SO_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PiutangDagang_bySO_status2($id) { // Informasi = [75]
|
|
$this->db->select('SUM(a.DEBET_PDA) as DEBET,SUM(a.KREDIT_PDA) as KREDIT,SUM(a.DEBET_PDA-a.KREDIT_PDA) as TOTAL');
|
|
$this->db->from('piutang_dagang a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->where(['b.SO_ID' => $id]);
|
|
$this->db->where('a.TRANSAKSI_PDA=2');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getSum_PiutangDagang_bySO_not2($id) { // Informasi = [75]
|
|
$this->db->select('SUM(a.DEBET_PDA) as DEBET,SUM(a.KREDIT_PDA) as KREDIT,SUM(a.DEBET_PDA-a.KREDIT_PDA) as TOTAL');
|
|
$this->db->from('piutang_dagang a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->where(['b.SO_ID' => $id]);
|
|
$this->db->where('a.TRANSAKSI_PDA!=2');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriKuantiti_PembelianOnly($awal, $akhir) { // Informasi = [76]
|
|
$this->db->select('*,DATE_FORMAT(b.TGL_PEMBELIAN,"%d/%m/%Y") as TANGGAL');
|
|
$this->db->from('histori_kuantiti a');
|
|
$this->db->join('pembelian b','b.KODE_PEMBELIAN=a.KODE_BUKTI');
|
|
$this->db->join('supplier c','c.ID_SUPPLIER=b.SUPPLIER_ID');
|
|
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
|
$this->db->where('a.TGL_HQ>=', $awal);
|
|
$this->db->where('a.TGL_HQ<=', $akhir);
|
|
$this->db->like('a.KODE_BUKTI','PB','after');
|
|
$this->db->group_by('a.KODE_BUKTI');
|
|
$this->db->order_by('a.ID_HQ DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_HistoriKuantiti_byKODEBUKTI($id) { // Informasi = [76]
|
|
$this->db->select('*');
|
|
$this->db->from('histori_kuantiti a');
|
|
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
|
$this->db->where('a.KODE_BUKTI=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_SalesOrder_allStatus() { // Informasi = [77]
|
|
$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->order_by('a.KODE_SO DESC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_CetakDokumen_bySO($id) { // Informasi = [77]
|
|
$this->db->select('*,c.NAMA_PANGGILAN_KARYAWAN as NAKAR,d.NAMA_PANGGILAN_KARYAWAN as NAAD,
|
|
DATE_FORMAT(a.TGL_CETAK,"%d/%m/%Y") as TGLCET,DATE_FORMAT(a.LP_KARYAWAN,"%d/%m/%Y %H:%i:%s") as LPKAR,
|
|
DATE_FORMAT(a.LP_ADMIN,"%d/%m/%Y %H:%i:%s") as LPADM');
|
|
$this->db->from('cetak_dokumen a');
|
|
$this->db->join('penjualan b','b.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('karyawan c','c.ID_KARYAWAN=a.KARYAWAN_ID','left');
|
|
$this->db->join('karyawan d','d.ID_KARYAWAN=a.ADMIN_ID','left');
|
|
$this->db->where('b.SO_ID=', $id);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_FormFeePelanggan_status1($id=null) { // Informasi = [78]
|
|
if ($id==null) {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_FFP,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_FFP,2) as NILAI');
|
|
$this->db->from('form_feepelanggan a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('sales_order d','d.ID_SO=c.SO_ID');
|
|
$this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID');
|
|
$this->db->where('a.STATUS_FFP=1');
|
|
$this->db->order_by('a.TGL_FFP DESC');
|
|
} else {
|
|
$this->db->select('*,DATE_FORMAT(a.TGL_FFP,"%d/%m/%Y") as TANGGAL,FORMAT(a.NILAI_FFP,2) as NILAI');
|
|
$this->db->from('form_feepelanggan a');
|
|
$this->db->join('karyawan b','b.ID_KARYAWAN=a.KARYAWAN_ID');
|
|
$this->db->join('penjualan c','c.ID_PENJUALAN=a.PENJUALAN_ID');
|
|
$this->db->join('sales_order d','d.ID_SO=c.SO_ID');
|
|
$this->db->join('pelanggan e','e.ID_PELANGGAN=d.PELANGGAN_ID');
|
|
$this->db->where('a.STATUS_FFP=1');
|
|
$this->db->where('a.ID_FFP=', $id);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
}
|
|
?>
|