Advertisement
Guest User

Model

a guest
Oct 22nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. function infaq ($p=array(),$count=FALSE){
  2.         $total = 0;
  3.         $month = date('m');
  4.         $year = date('Y');
  5.         $tanggal= date('Y-m-d');
  6.  
  7.         // $this->db->select('transaksi.*');
  8.         // $this->db->where('trxDesc', 'DONASI');
  9.         // $this->db->where('(date(dateTransaction) >= '.$p['date_from'].' and date(dateTransaction) <= '.$p['date_to'].')');
  10.         // $this->db->where('produk', 'DONASI');
  11.         // $this->db->where('jenisProduk', 'INFAQ');
  12.         // $this->db->join('agent','agent.noreg=transaksi.noregAdminBmt','LEFT');
  13.  
  14.         $query = "SELECT *,t.namaLoket as username, a.namaLengkap as Baitull
  15.             FROM transaksi t
  16.             JOIN agent a on a.noregAdminBmt = t.noregAdminBmt
  17.             LEFT JOIN agent b ON b.namaLoket = t.namaLoket
  18.             where (date(dateTransaction) >= '".$p['date_from']."' and date(dateTransaction) <= '".$p['date_to']."')
  19.             AND jenisProduk = 'INFAQ'
  20.             AND produk = 'donasi'
  21.             AND a.namaLengkap LIKE '%Baitul Maal%'";
  22.  
  23.             if ($query) {
  24.                 # code...
  25.                 $result['query'] = $this->db->query($query);
  26.             }
  27.  
  28.         $query = $this->db->query($query);
  29.  
  30.         if ($query) {
  31.             $result['jumlah_data'] = $query->num_rows();
  32.             $result['data'] = $query->result();
  33.             $result['query'] = $this->db->last_query();
  34.  
  35.             return $result;
  36.         }else {
  37.             return $this->db->_error_message();
  38.         }
  39.  
  40.  
  41.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement