load->library('session'); $this->load->library('rhlib'); } function retValOrNull($val){ //especially for combo & looukup with no item selected $val = ($val=='')? null : $val; return $val; } function get_tiperuangan(){ $q = "SELECT * FROM tiperuangan ORDER BY kdtiperuangan"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_tiperuangan(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('tiperuangan',$dataArray); //$this->rhlib->insertRecordPublic('tiperuangan',$dataArray); return $ret; } function update_tiperuangan(){ $fieldsAndValues = $this->getFieldsAndValues(); //UPDATE //$where['idtiperuangan'] = $_POST['idtiperuangan']; $this->db->where('idtiperuangan', $_POST['idtiperuangan']); $this->db->update('tiperuangan', $fieldsAndValues); if($this->db->affected_rows()){ $ret["success"]=true; $ret["msg"]='Update Data Berhasil'; //$this->rhlib->updateRecordPublic('jslta',$fieldsAndValues,$where); }else{ $ret["success"]=false; $ret["msg"]= 'Update Data Gagal'; } return $ret; } function delete_tiperuangan(){ $where['idtiperuangan'] = $_POST['idtiperuangan']; $ret = $this->rhlib->deleteRecord('tiperuangan',$where); //$this->rhlib->deleteRecordPublic('tiperuangan',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( //'idtiperuangan'=> $_POST['idtiperuangan'], 'kdtiperuangan'=> $_POST['kdtiperuangan'], 'nmtiperuangan'=> $_POST['nmtiperuangan'] ); return $dataArray; } } ?>