155 lines
4.9 KiB
PHP
155 lines
4.9 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
class ModelCorp 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_Corp($id = null){
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
}else{
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
$this->db->where(['ID_CORP' => $id]);
|
|
}
|
|
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Corp_forPembelianPCM(){
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
$this->db->where('ID_CORP<=4');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Corp_forPembelianITP(){
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
$this->db->where('ID_CORP=5');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Corp_forPenjualanITP(){
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
$this->db->where('ID_CORP=4 OR ID_CORP=5');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_Corp_So($id = null){
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
$this->db->where('ID_CORP<4');
|
|
}else{
|
|
$this->db->select('*');
|
|
$this->db->from('corp');
|
|
$this->db->where(['ID_CORP' => $id]);
|
|
}
|
|
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataDpPajak($id=null){
|
|
if ($id === null) {
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(b.SALDO_PAJAK,2)) as SALDO,CONCAT("Rp ",FORMAT(a.NOMINAL_DPP,2)) as DP');
|
|
$this->db->from('dp_pajak a');
|
|
$this->db->join('corp b','b.ID_CORP=a.CORP_ID','left');
|
|
$this->db->group_by('a.ID_DPP');
|
|
}else{
|
|
$this->db->select('*,CONCAT("Rp ",FORMAT(b.SALDO_PAJAK,2)) as SALDO,CONCAT("Rp ",FORMAT(a.NOMINAL_DPP,2)) as DP');
|
|
$this->db->from('dp_pajak a');
|
|
$this->db->join('corp b','b.ID_CORP=a.CORP_ID','left');
|
|
$this->db->group_by('a.ID_DPP');
|
|
$this->db->where(['a.CORP_ID' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataCorpDpp(){
|
|
$this->db->select('*');
|
|
$this->db->from('corp a');
|
|
$this->db->join('dp_pajak b','b.CORP_ID=a.ID_CORP','left');
|
|
$this->db->where('b.CORP_ID is NULL');
|
|
$this->db->order_by('a.NAMA_CORP','ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataCorpHpa(){
|
|
$this->db->select('*');
|
|
$this->db->from('corp a');
|
|
$this->db->join('hutang_pajak b','b.CORP_ID=a.ID_CORP','left');
|
|
$this->db->where('b.CORP_ID is NULL');
|
|
$this->db->order_by('a.NAMA_CORP','ASC');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataDpp($id){
|
|
$this->db->select('*');
|
|
$this->db->from('dp_pajak');
|
|
$this->db->where(['ID_DPP' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getKodeDPP() {
|
|
$this->db->select('MAX(KODE_DPP) AS KODE');
|
|
$this->db->from('dp_pajak');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataHutangPajak($id=null){
|
|
if ($id === null) {
|
|
$this->db->select('*,CONCAT(DATE_FORMAT(a.TGL_HPA,"%d/%m/%Y")) AS WAKTU,CONCAT("Rp ",FORMAT(b.HUTANG_PAJAK,2)) as HUTANG,CONCAT("Rp ",FORMAT(a.NOMINAL_HPA,2)) as HPA');
|
|
$this->db->from('hutang_pajak a');
|
|
$this->db->join('corp b','b.ID_CORP=a.CORP_ID','left');
|
|
$this->db->group_by('a.ID_HPA');
|
|
}else{
|
|
$this->db->select('*,CONCAT(DATE_FORMAT(a.TGL_HPA,"%d/%m/%Y")) AS WAKTU,CONCAT("Rp ",FORMAT(b.HUTANG_PAJAK,2)) as HUTANG,CONCAT("Rp ",FORMAT(a.NOMINAL_HPA,2)) as HPA');
|
|
$this->db->from('hutang_pajak a');
|
|
$this->db->join('corp b','b.ID_CORP=a.CORP_ID','left');
|
|
$this->db->group_by('a.ID_HPA');
|
|
$this->db->where(['a.CORP_ID' => $id]);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataHpa($id){
|
|
$this->db->select('*');
|
|
$this->db->from('hutang_pajak');
|
|
$this->db->where(['ID_HPA' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getKodeHPA() {
|
|
$this->db->select('MAX(KODE_HPA) AS KODE');
|
|
$this->db->from('hutang_pajak');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
}
|
|
?>
|