copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class ModelHutangLain 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);
|
||||
}
|
||||
|
||||
//Step One, Input Hutang Lain
|
||||
public function getDataHutangLain($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('*,CONCAT(DATE_FORMAT(a.TGL_HLA,"%d/%m/%Y")) AS WAKTU,CONCAT("Rp ",FORMAT(a.NOMINAL_HLA,2)) as DEBIT,CONCAT("Rp ",FORMAT(a.BLOCKCON,2)) as KREDIT');
|
||||
$this->db->from('hutang_lain a');
|
||||
$this->db->join('detail_hla b','b.HLA_ID=a.ID_HLA','left');
|
||||
$this->db->group_by('a.ID_HLA');
|
||||
$this->db->where('a.STATUS_HLA is NULL');
|
||||
}else{
|
||||
$this->db->select('*,CONCAT(DATE_FORMAT(a.TGL_HLA,"%d/%m/%Y")) AS WAKTU,CONCAT("Rp ",FORMAT(a.NOMINAL_HLA,2)) as DEBIT,,CONCAT("Rp ",FORMAT(a.BLOCKCON,2)) as KREDIT');
|
||||
$this->db->from('hutang_lain a');
|
||||
$this->db->join('detail_hla b','b.HLA_ID=a.ID_HLA','left');
|
||||
$this->db->group_by('a.ID_HLA');
|
||||
$this->db->where('a.STATUS_HLA is NULL');
|
||||
$this->db->where(['a.ID_HLA' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getDataHutangLainDetail($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('*,CONCAT(DATE_FORMAT(a.TGL_HLA,"%d/%m/%Y")) AS WAKTU,CONCAT("Rp ",FORMAT(a.NOMINAL_HLA,2)) as DEBIT,CONCAT("Rp ",FORMAT(a.BLOCKCON,2)) as KREDIT');
|
||||
$this->db->from('hutang_lain a');
|
||||
$this->db->join('detail_hla b','b.HLA_ID=a.ID_HLA','left');
|
||||
$this->db->group_by('a.ID_HLA');
|
||||
$this->db->where('a.NOMINAL_HLA!=a.BLOCKCON');
|
||||
}else{
|
||||
$this->db->select('*,CONCAT(DATE_FORMAT(a.TGL_HLA,"%d/%m/%Y")) AS WAKTU,CONCAT("Rp ",FORMAT(a.NOMINAL_HLA,2)) as DEBIT,CONCAT("Rp ",FORMAT(a.BLOCKCON,2)) as KREDIT');
|
||||
$this->db->from('hutang_lain a');
|
||||
$this->db->join('detail_hla b','b.HLA_ID=a.ID_HLA','left');
|
||||
$this->db->group_by('a.ID_HLA');
|
||||
$this->db->where('a.NOMINAL_HLA!=a.BLOCKCON');
|
||||
$this->db->where(['a.ID_HLA' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getDataDeskripsiHLA($id = null){
|
||||
if ($id === null) {
|
||||
$this->db->select('*,CONCAT(DATE_FORMAT(a.TGL_HLA,"%d/%m/%Y")) AS WAKTU,CONCAT("Rp ",FORMAT(a.NOMINAL_HLA,2)) as DEBIT,CONCAT("Rp ",FORMAT(b.KREDIT_DHLA,2)) as KREDIT,CONCAT("Rp ",FORMAT(a.BLOCKCON,2)) as KREDITALL');
|
||||
$this->db->from('hutang_lain a');
|
||||
$this->db->join('detail_hla b','b.HLA_ID=a.ID_HLA');
|
||||
$this->db->group_by('b.ID_DHLA');
|
||||
}else{
|
||||
$this->db->select('*,CONCAT(DATE_FORMAT(a.TGL_HLA,"%d/%m/%Y")) AS WAKTU,CONCAT("Rp ",FORMAT(a.NOMINAL_HLA,2)) as DEBIT,CONCAT("Rp ",FORMAT(b.KREDIT_DHLA,2)) as KREDIT,CONCAT("Rp ",FORMAT(a.BLOCKCON,2)) as KREDITALL');
|
||||
$this->db->from('hutang_lain a');
|
||||
$this->db->join('detail_hla b','b.HLA_ID=a.ID_HLA');
|
||||
$this->db->group_by('b.ID_DHLA');
|
||||
$this->db->where(['a.ID_HLA' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getTitleHLA($id)
|
||||
{
|
||||
$this->db->select('KODE_HLA,CONCAT("Rp ",FORMAT(NOMINAL_HLA,2)) as KREDIT,CONCAT("Rp ",FORMAT(BLOCKCON,2)) as DEBIT');
|
||||
$this->db->from('hutang_lain');
|
||||
$this->db->where(['ID_HLA' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user