SHARE
TWEET

M_Tiket.php

a guest Sep 17th, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class M_Tiket_dipesan extends CI_Model {
  4.  
  5.     //public $table='train_record';
  6.     var $table = 'train_record'; //nama tabel dari database
  7.     //var $column_order = array(null, 'user_nama','user_email','user_alamat'); //field yang ada di table user
  8.     //var $column_search = array('user_nama','user_email','user_alamat'); //field yang diizin untuk pencarian
  9.     var $order = array('record_code' => 'asc'); // default order
  10.  
  11.  
  12.     public function __construct()
  13.     {
  14.         parent::__construct();
  15.         $this->load->database();
  16.        
  17.     }
  18.    
  19.  
  20.     private function _get_datatables_query()
  21.     {
  22.        
  23.         $hasil=$this->db->query("SELECT
  24.             MAX(record_trans_datetime) AS record_trans_datetime,
  25.             client_name,
  26.             record_train_name,
  27.             record_code,
  28.             record_depart_code,
  29.             record_depart_datetime,
  30.             record_arrive_code,
  31.             record_arrive_datetime,
  32.             record_trans_fare,
  33.             record_trans_nta,
  34.             record_trans_fee_client,
  35.             record_trans_fee_margin,
  36.             record_timelimit,
  37.             GROUP_CONCAT(record_trans_type) AS group_type
  38.         FROM
  39.             train_record
  40.             JOIN train_record_trans
  41.                 ON record_trans_record_code = record_code
  42.             JOIN okesys_client
  43.                 ON client_id = record_client_id");
  44.  
  45.         $i = 0;
  46.         return $hasil->result();
  47.        
  48.     }
  49.  
  50.     function get_datatables()
  51.     {
  52.         $this->_get_datatables_query();
  53.         if($_POST['length'] != -1)
  54.         $this->db->limit($_POST['length'], $_POST['start']);
  55.         $query = $this->db->get();
  56.         return $query->result();
  57.     }
  58.  
  59.     function count_filtered()
  60.     {
  61.         $this->_get_datatables_query();
  62.         $query = $this->db->get();
  63.         return $query->num_rows();
  64.     }
  65.  
  66.     public function count_all()
  67.     {
  68.         $this->db->from($this->table);
  69.         return $this->db->count_all_results();
  70.     }
  71.  
  72.  
  73.    
  74.    
  75. }
  76.  
  77. /* End of file M_Tiket_dipesan.php */
  78. /* Location: ./application/models/M_Tiket_dipesan.php */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top