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_cutidet(){ $q = "SELECT * FROM cutidet ORDER BY idcutidet"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_cutidet(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('cutidet',$dataArray); //$this->rhlib->insertRecordPublic('stkuitansi',$dataArray); return $ret; } function update_cutidet(){ $fieldsAndValues = $this->getFieldsAndValues(); //UPDATE $where['idcutidet'] = $_POST['idcutidet']; $this->db->where('idcutidet', $_POST['idcutidet']); $this->db->update('cutidet', $fieldsAndValues); if($this->db->affected_rows()){ $ret["success"]=true; $ret["msg"]='Update Data Berhasil'; //$this->rhlib->updateRecordPublic('stkuitansi',$fieldsAndValues,$where); }else{ $ret["success"]=false; $ret["msg"]= 'Update Data Gagal'; } return $ret; } function delete_cutidet(){ $where['idcutidet'] = $_POST['idcutidet']; $ret = $this->rhlib->deleteRecord('cutidet',$where); //$this->rhlib->deleteRecordPublic('stkuitansi',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( //'kdstkuitansi'=> $_POST['kdstkuitansi'], 'nmcutidet'=> $_POST['nmcutidet'], //'deskripsi'=> $_POST['deskripsi'] ); return $dataArray; } } ?>