copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,436 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class ModelKlaim 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_Supplier($id=null) { //Klaim = [1, 5A, 9A]
|
||||
if ($id == null) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('supplier a');
|
||||
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
||||
} else {
|
||||
$this->db->select('*');
|
||||
$this->db->from('supplier a');
|
||||
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
||||
$this->db->where(['ID_SUPPLIER' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Merk($id=null) { //Klaim = [1, 3]
|
||||
if ($id == null) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('merk');
|
||||
$this->db->order_by('NAMA_MERK ASC');
|
||||
} else {
|
||||
$this->db->select('*');
|
||||
$this->db->from('merk');
|
||||
$this->db->where(['ID_MERK' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarBeli_status1($supplier_id = null, $merk_id = null, $tgl_awal = null, $tgl_akhir = null) { //Klaim = [1]
|
||||
$this->db->select('*,DATE_FORMAT(e.TGL_INVBELI,"%d/%m/%Y") as TANGGAL');
|
||||
$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('merk d','d.ID_MERK=b.MERK_ID');
|
||||
$this->db->join('pembelian e','e.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
||||
$this->db->where('e.STATUS_PEMBELIAN=1');
|
||||
$this->db->where('b.JENIS_ID<=8 AND b.JENIS_ID!=7 AND b.JENIS_ID!=6');
|
||||
$this->db->where('e.SUPPLIER_ID=',$supplier_id);
|
||||
$this->db->where('e.TGL_INVBELI>=',$tgl_awal);
|
||||
$this->db->where('e.TGL_INVBELI<=',$tgl_akhir);
|
||||
if ($merk_id!=null) {
|
||||
$this->db->where('b.MERK_ID=',$merk_id);
|
||||
}
|
||||
$this->db->group_by('a.ID_DB, a.BARANG_ID');
|
||||
$this->db->order_by('e.TGL_INVBELI ASC, e.INV_PEMBELIAN ASC, b.KODE_BARANG ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnBeli_byDB_status1($id) { //Klaim = [1, 2]
|
||||
$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('sn_stock d','d.NAMA_SNSTOCK=a.NAMA_SNB');
|
||||
$this->db->where(['b.ID_DB' => $id]);
|
||||
$this->db->where('c.STATUS_PEMBELIAN=1');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_bySNSTOCK($id) { //Klaim = [1, 2, 3, 4]
|
||||
$this->db->select('*');
|
||||
$this->db->from('sn_klaimprogram');
|
||||
$this->db->where(['SNSTOCK_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getID_SNKPRMax() { //Klaim = [2, 4]
|
||||
$this->db->select_max('ID_SNKPR');
|
||||
$this->db->from('sn_klaimprogram');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarBeli_byDB($id) { //Klaim = [2]
|
||||
$this->db->select('*');
|
||||
$this->db->from('daftar_beli a');
|
||||
$this->db->join('pembelian b','b.ID_PEMBELIAN=a.PEMBELIAN_ID');
|
||||
$this->db->where(['a.ID_DB' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarKlaimProgram_byBARANG_bySUPPLIER_byNOTA($id_barang, $id_supplier, $nota) { //Klaim = [2, 8, 10]
|
||||
$this->db->select('*');
|
||||
$this->db->from('daftar_klaimprogram');
|
||||
$this->db->where(['BARANG_ID' => $id_barang]);
|
||||
$this->db->where(['SUPPLIER_ID' => $id_supplier]);
|
||||
$this->db->where(['NOTA_DKPR' => $nota]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getID_DKPRMax() { //Klaim = [2, 4, 8, 10]
|
||||
$this->db->select_max('ID_DKPR');
|
||||
$this->db->from('daftar_klaimprogram');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_TransaksiStock_jenis1($merk_id = null) { //Klaim = [3]
|
||||
$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('merk d','d.ID_MERK=b.MERK_ID');
|
||||
$this->db->where('b.JENIS_ID=8 AND a.JENIS_IO=1 AND b.MERK_ID=', $merk_id);
|
||||
$this->db->or_where('b.JENIS_ID<=5 AND a.JENIS_IO=1 AND b.MERK_ID=', $merk_id);
|
||||
$this->db->group_by('a.ID_IO');
|
||||
$this->db->order_by('b.KODE_BARANG ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnIo_byID_jenis1($id) { //Klaim = [3, 4]
|
||||
$this->db->select('*');
|
||||
$this->db->from('sn_io a');
|
||||
$this->db->join('transaksi_stock b','b.ID_IO=a.IO_ID');
|
||||
$this->db->join('sn_stock c','c.NAMA_SNSTOCK=a.NAMA_SNIO');
|
||||
$this->db->where(['b.ID_IO' => $id]);
|
||||
$this->db->where('a.JENIS_SNIO=1');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_TransaksiStock_byID($id) { //Klaim = [4]
|
||||
$this->db->select('*');
|
||||
$this->db->from('transaksi_stock');
|
||||
$this->db->where(['ID_IO' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarKlaimProgram_byBARANG_jenis0($id) { //Klaim = [4]
|
||||
$this->db->select('*');
|
||||
$this->db->from('daftar_klaimprogram');
|
||||
$this->db->where(['BARANG_ID' => $id]);
|
||||
$this->db->where('JENIS_DKPR=0');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarKlaimProgram_AmbilPembelian() { //Klaim = [5]
|
||||
$this->db->select('*,DATE_FORMAT(a.TGL_DKPR,"%d/%m/%Y") as TANGGAL,FORMAT(a.HARGA_DKPR,2) as HARGA');
|
||||
$this->db->from('daftar_klaimprogram a');
|
||||
$this->db->join('produk b','b.ID_PRODUK=a.PRODUK_ID');
|
||||
$this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID');
|
||||
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
||||
$this->db->join('barang e','e.ID_BARANG=a.BARANG_ID');
|
||||
$this->db->where('a.JENIS_DKPR=1');
|
||||
$this->db->where('a.KUNCI_DKPR is NULL');
|
||||
$this->db->order_by('a.ID_DKPR DESC');
|
||||
$this->db->limit('500');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getCount_SnKlaimProgram_byBARANG_byDKPR($id_barang, $dkpr_id) { //Klaim = [5, 9, 12]
|
||||
$this->db->select('a.ID_SNKPR');
|
||||
$this->db->from('sn_klaimprogram a');
|
||||
$this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID');
|
||||
$this->db->where('b.BARANG_ID=', $id_barang);
|
||||
$this->db->where('a.DKPR_ID=', $dkpr_id);
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
public function getData_DaftarKlaimProgram_byID($id) { //Klaim = [6, 7, 8, 9A, 10, 11, 13, 25, 26, 27]
|
||||
$this->db->select('*,DATE_FORMAT(a.TGL_DKPR,"%d/%m/%Y") as TANGGAL');
|
||||
$this->db->from('daftar_klaimprogram a');
|
||||
$this->db->join('barang b','b.ID_BARANG=a.BARANG_ID');
|
||||
$this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID','left');
|
||||
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID','left');
|
||||
$this->db->where('a.ID_DKPR=', $id);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_byDKPR($id) { //Klaim = [5A, 7, 9A, 11, 13]
|
||||
$this->db->select('*,FORMAT(b.HARGA_DKPR,2) as HARGA');
|
||||
$this->db->from('sn_klaimprogram a');
|
||||
$this->db->join('daftar_klaimprogram b','b.ID_DKPR=a.DKPR_ID');
|
||||
$this->db->join('sn_stock c','c.ID_SNSTOCK=a.SNSTOCK_ID');
|
||||
$this->db->join('pelanggan d','d.ID_PELANGGAN=a.PEL_ID','left');
|
||||
$this->db->where('a.DKPR_ID=', $id);
|
||||
$this->db->order_by('c.NAMA_SNSTOCK ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_LinkKlaimProgram_bySNKPR($id) { //Klaim = [7, 11, 13, 17, 18]
|
||||
$this->db->select('*,FORMAT(a.NILAI_LKPR,2) as NILAI');
|
||||
$this->db->from('link_klaimprogram a');
|
||||
$this->db->join('program b','b.ID_PROGRAM=a.PROGRAM_ID');
|
||||
$this->db->join('potongan_klaimprogram c','c.ID_PKPR=a.PKPR_ID');
|
||||
$this->db->where(['a.SNKPR_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarKlaimProgram_AmbilOpname() { //Klaim = [9]
|
||||
$this->db->select('*,DATE_FORMAT(a.TGL_DKPR,"%d/%m/%Y") as TANGGAL,FORMAT(a.HARGA_DKPR,2) as HARGA');
|
||||
$this->db->from('daftar_klaimprogram a');
|
||||
$this->db->join('produk b','b.ID_PRODUK=a.PRODUK_ID');
|
||||
$this->db->join('barang c','c.ID_BARANG=a.BARANG_ID');
|
||||
$this->db->join('supplier d','d.ID_SUPPLIER=a.SUPPLIER_ID','left');
|
||||
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID','left');
|
||||
$this->db->where('a.JENIS_DKPR=0');
|
||||
$this->db->order_by('a.ID_DKPR DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_byID($id) { //Klaim = [8, 10, 14, 15, 16, 17, 21, 23, 24, 27]
|
||||
$this->db->select('*');
|
||||
$this->db->from('sn_klaimprogram');
|
||||
$this->db->where(['ID_SNKPR' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarKlaimProgram_AmbilSemua() { //Klaim = [12]
|
||||
$this->db->select('*,DATE_FORMAT(a.TGL_DKPR,"%d/%m/%Y") as TANGGAL,FORMAT(a.HARGA_DKPR,2) as HARGA');
|
||||
$this->db->from('daftar_klaimprogram a');
|
||||
$this->db->join('produk b','b.ID_PRODUK=a.PRODUK_ID');
|
||||
$this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID');
|
||||
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
||||
$this->db->join('barang e','e.ID_BARANG=a.BARANG_ID');
|
||||
$this->db->where('a.KUNCI_DKPR is NULL');
|
||||
$this->db->order_by('a.ID_DKPR DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_DaftarKlaimProgram_kunciNotNull() { //Klaim = [12]
|
||||
$this->db->select('*,DATE_FORMAT(a.TGL_DKPR,"%d/%m/%Y") as TANGGAL,FORMAT(a.HARGA_DKPR,2) as HARGA');
|
||||
$this->db->from('daftar_klaimprogram a');
|
||||
$this->db->join('produk b','b.ID_PRODUK=a.PRODUK_ID');
|
||||
$this->db->join('supplier c','c.ID_SUPPLIER=a.SUPPLIER_ID');
|
||||
$this->db->join('kota d','d.ID_KOTA=c.KOTA_ID');
|
||||
$this->db->join('barang e','e.ID_BARANG=a.BARANG_ID');
|
||||
$this->db->order_by('a.ID_DKPR DESC');
|
||||
$this->db->where('a.KUNCI_DKPR=1');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_forRedirect() { //Klaim = [12]
|
||||
$this->db->select('*');
|
||||
$this->db->from('sn_klaimprogram');
|
||||
$this->db->order_by('NAMA_SNKPR ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getCount_SnKlaimProgram_byBARANG_byDKPR_NotNull($id_barang, $dkpr_id) { //Klaim = [12]
|
||||
$this->db->select('a.ID_SNKPR');
|
||||
$this->db->from('sn_klaimprogram a');
|
||||
$this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID');
|
||||
$this->db->where('b.BARANG_ID=', $id_barang);
|
||||
$this->db->where('a.DKPR_ID=', $dkpr_id);
|
||||
$this->db->where('a.STATUS_SNKPR IS NOT NULL');
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
public function getData_Pelanggan_byID($id=null) { //Klaim = [13, 19]
|
||||
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_Program($id=null) { //Klaim = [13]
|
||||
if ($id == null) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('program');
|
||||
$this->db->order_by('KODE_PROGRAM');
|
||||
} else {
|
||||
$this->db->select('*');
|
||||
$this->db->from('program');
|
||||
$this->db->where(['ID_PROGRAM' => $id]);
|
||||
$this->db->order_by('KODE_PROGRAM');
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_HistoriSn_bySNKPR($id) { //Klaim = [13]
|
||||
$this->db->select('*');
|
||||
$this->db->from('histori_sn a');
|
||||
$this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID');
|
||||
$this->db->join('sn_klaimprogram c','c.SNSTOCK_ID=a.SNSTOCK_ID');
|
||||
$this->db->where('c.ID_SNKPR=', $id);
|
||||
$this->db->where('b.STATUS_SNSTOCK=1');
|
||||
$this->db->where('a.PELANGGAN_ID is NOT NULL');
|
||||
//$this->db->order_by('a.ID_HSN DESC');
|
||||
$this->db->limit('1');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_HistoriSn_byID($id) { //Klaim = [13]
|
||||
$this->db->select('*,DATE_FORMAT(a.TGL_HSN,"%d/%m/%Y") as TANGGAL');
|
||||
$this->db->from('histori_sn a');
|
||||
$this->db->join('pelanggan b','b.ID_PELANGGAN=a.PELANGGAN_ID');
|
||||
$this->db->join('kota c','c.ID_KOTA=b.KOTA_ID');
|
||||
$this->db->where('a.ID_HSN=', $id);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_byDKPR_NULL($id) { //Klaim = [13, 18]
|
||||
$this->db->select('*,FORMAT(b.HARGA_DKPR,2) as HARGA');
|
||||
$this->db->from('sn_klaimprogram a');
|
||||
$this->db->join('daftar_klaimprogram b','b.ID_DKPR=a.DKPR_ID');
|
||||
$this->db->join('sn_stock c','c.ID_SNSTOCK=a.SNSTOCK_ID');
|
||||
$this->db->where('a.DKPR_ID=', $id);
|
||||
$this->db->where('a.STATUS_SNKPR is NULL');
|
||||
$this->db->order_by('c.NAMA_SNSTOCK ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_byDKPR_status0($id) { //Klaim = [13, 18]
|
||||
$this->db->select('*,FORMAT(b.HARGA_DKPR,2) as HARGA');
|
||||
$this->db->from('sn_klaimprogram a');
|
||||
$this->db->join('daftar_klaimprogram b','b.ID_DKPR=a.DKPR_ID');
|
||||
$this->db->join('sn_stock c','c.ID_SNSTOCK=a.SNSTOCK_ID');
|
||||
$this->db->where('a.DKPR_ID=', $id);
|
||||
$this->db->where('a.STATUS_SNKPR=0');
|
||||
$this->db->order_by('c.NAMA_SNSTOCK ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_PotonganKlaimProgram_byDKPR_groupPKPR($id) { //Klaim = [13]
|
||||
$this->db->select('*,FORMAT(a.NILAI_LKPR,2) as NILAI');
|
||||
$this->db->from('link_klaimprogram a');
|
||||
$this->db->join('sn_klaimprogram b','b.ID_SNKPR=a.SNKPR_ID');
|
||||
$this->db->join('potongan_klaimprogram c','c.ID_PKPR=a.PKPR_ID');
|
||||
$this->db->where('b.DKPR_ID=', $id);
|
||||
$this->db->group_by('a.PKPR_ID');
|
||||
$this->db->order_by('c.NAMA_PKPR ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_PotonganKlaimProgram_byNAMA_byNILAI($id1, $id2) { //Klaim = [14]
|
||||
$this->db->select('*');
|
||||
$this->db->from('potongan_klaimprogram');
|
||||
$this->db->where('NAMA_PKPR=', $id1);
|
||||
$this->db->where('NILAI_PKPR=', $id2);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getID_PKPRMax() { //Klaim = [14]
|
||||
$this->db->select_max('ID_PKPR');
|
||||
$this->db->from('potongan_klaimprogram');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_LinkKlaimProgram_byID($id) { //Klaim = [16]
|
||||
$this->db->select('*');
|
||||
$this->db->from('link_klaimprogram a');
|
||||
$this->db->join('program b','b.ID_PROGRAM=a.PROGRAM_ID');
|
||||
$this->db->where(['a.ID_LKPR' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_status1() { //Klaim = [19]
|
||||
$this->db->select('*,DATE_FORMAT(a.TGL_SALEOUT,"%d/%m/%Y") as TANGGAL,FORMAT(a.HARGA_SNKPR,2) as HARGA');
|
||||
$this->db->from('sn_klaimprogram a');
|
||||
$this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID');
|
||||
$this->db->join('barang c','c.ID_BARANG=b.BARANG_ID');
|
||||
$this->db->join('pelanggan d','d.ID_PELANGGAN=a.PEL_ID','left');
|
||||
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID','left');
|
||||
$this->db->where('a.STATUS_SNKPR=1');
|
||||
$this->db->order_by('a.NOTA_SNKPR DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_notaNotNull() { //Klaim = [19]
|
||||
$this->db->select('*');
|
||||
$this->db->from('sn_klaimprogram');
|
||||
$this->db->where('NOTA_SNKPR is NOT NULL');
|
||||
$this->db->order_by('NOTA_SNKPR DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_kunciNotNull() { //Klaim = [19]
|
||||
$this->db->select('*');
|
||||
$this->db->from('sn_klaimprogram');
|
||||
$this->db->order_by('NOTA_SNKPR ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getKode_INVKlaim() { //Klaim = [20]
|
||||
$this->db->select('MAX(NOTA_SNKPR) AS KODE');
|
||||
$this->db->from('sn_klaimprogram');
|
||||
$this->db->like('NOTA_SNKPR','INV/ITP-K', 'after');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_SnKlaimProgram_forCetakNota($id) { //Klaim = [22]
|
||||
$this->db->select('*,DATE_FORMAT(a.TGL_SALEOUT,"%d/%m/%Y") as TANGGAL,FORMAT(a.HARGA_SNKPR,2) as HARGA');
|
||||
$this->db->from('sn_klaimprogram a');
|
||||
$this->db->join('sn_stock b','b.ID_SNSTOCK=a.SNSTOCK_ID');
|
||||
$this->db->join('barang c','c.ID_BARANG=b.BARANG_ID');
|
||||
$this->db->join('pelanggan d','d.ID_PELANGGAN=a.PEL_ID');
|
||||
$this->db->join('kota e','e.ID_KOTA=d.KOTA_ID');
|
||||
$this->db->where('a.ID_SNKPR=', $id);
|
||||
$this->db->order_by('a.NOTA_SNKPR DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_LinkKlaimProgram_byDKPR_byPKPR($id1, $id2) { //Klaim = [27]
|
||||
$this->db->select('*');
|
||||
$this->db->from('link_klaimprogram a');
|
||||
$this->db->join('sn_klaimprogram b','b.ID_SNKPR=a.SNKPR_ID');
|
||||
$this->db->where(['b.DKPR_ID' => $id1]);
|
||||
$this->db->where(['a.PKPR_ID' => $id2]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user