113 lines
3.7 KiB
PHP
113 lines
3.7 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
class ModelTyca 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 getDataTyca($id = null){
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('type_neraca a');
|
|
$this->db->join('neraca b','b.TYCA_ID=a.ID_TYCA','left');
|
|
$this->db->group_by('a.ID_TYCA');
|
|
}else{
|
|
$this->db->select('*');
|
|
$this->db->from('type_neraca a');
|
|
$this->db->join('neraca b','b.TYCA_ID=a.ID_TYCA','left');
|
|
$this->db->group_by('a.ID_TYCA');
|
|
$this->db->where(['ID_TYCA' => $id]);
|
|
}
|
|
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataTycaPC($id = null){
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('tyca');
|
|
$this->db->where('MODEL_TYCA="Standard" AND TYPE_TYCA="UDIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Standard" AND TYPE_TYCA="SODIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Tanam" AND TYPE_TYCA="SODIMM"');
|
|
$this->db->order_by('TYPE_TYCA','ASC');
|
|
}
|
|
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataTycaNB($id = null){
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('tyca');
|
|
$this->db->where('MODEL_TYCA="Standard" AND TYPE_TYCA="SODIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Tanam" AND TYPE_TYCA="SODIMM"');
|
|
$this->db->order_by('TYPE_TYCA','ASC');
|
|
}
|
|
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataTycaAIO($id = null){
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('tyca');
|
|
$this->db->where('MODEL_TYCA="Standard" AND TYPE_TYCA="SODIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Tanam" AND TYPE_TYCA="SODIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Standard" AND TYPE_TYCA="UDIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Tanam" AND TYPE_TYCA="UDIMM"');
|
|
$this->db->order_by('TYPE_TYCA','ASC');
|
|
}
|
|
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataTycaWS($id = null){
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('tyca');
|
|
$this->db->where('MODEL_TYCA="Standard" AND TYPE_TYCA="SODIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Tanam" AND TYPE_TYCA="SODIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Standard" AND TYPE_TYCA="UDIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Tanam" AND TYPE_TYCA="UDIMM"');
|
|
$this->db->or_where('MODEL_TYCA="Standard" AND TYPE_TYCA="ECC"');
|
|
$this->db->order_by('TYPE_TYCA','ASC');
|
|
}
|
|
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getDataTycaSRV($id = null){
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('tyca');
|
|
$this->db->where('MODEL_TYCA="Standard" AND TYPE_TYCA="ECC"');
|
|
$this->db->or_where('MODEL_TYCA="Standard" AND TYPE_TYCA="REG"');
|
|
$this->db->order_by('TYPE_TYCA','ASC');
|
|
}
|
|
|
|
return $this->db->get()->result_array();
|
|
}
|
|
}
|
|
?>
|