113 lines
2.5 KiB
PHP
113 lines
2.5 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Registrasi_model extends CI_Model {
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->database();
|
|
}
|
|
|
|
//ambil data data
|
|
public function listing()
|
|
{
|
|
|
|
$this->db->select('*');
|
|
$this->db->from('v_rpt_trans_invoice');
|
|
$this->db->order_by('tgl_bayar','desc');
|
|
$query = $this->db->get();
|
|
return $query->result();
|
|
}
|
|
|
|
//ambil detail data data
|
|
public function detail($no_trans)
|
|
{
|
|
|
|
$this->db->select('*');
|
|
$this->db->from('v_rpt_trans_invoice');
|
|
//where
|
|
$this->db->where('no_trans', $no_trans);
|
|
$this->db->order_by('no_trans','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
|
|
//hitung total data
|
|
public function total()
|
|
{
|
|
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_trans_invoice');
|
|
$this->db->order_by('no_pendaftaran','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
//fungsi edit
|
|
public function edit($data)
|
|
{
|
|
$this->db->where('no_trans', $data['no_trans']);
|
|
$this->db->update('tr_invoice', $data);
|
|
}
|
|
|
|
//fungsi delete
|
|
public function delete($data)
|
|
{
|
|
$this->db->where('no_trans', $data['no_trans']);
|
|
$this->db->delete('tr_invoice', $data);
|
|
}
|
|
|
|
//ambil data ViewUrut
|
|
public function ViewUrut()
|
|
{
|
|
|
|
$this->db->select('*');
|
|
$this->db->from('v_rpt_trans_invoice');
|
|
$this->db->order_by('no_pendaftaran','ASC');
|
|
$query = $this->db->get();
|
|
return $query->result();
|
|
}
|
|
|
|
public function regis($no_pendaftaran)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('v_rpt_data_invoice');
|
|
$this->db->where('no_pendaftaran', $no_pendaftaran);
|
|
$this->db->order_by('no_pendaftaran','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function regis2($no_pendaftaran)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('v_rpt_trans_invoice');
|
|
$this->db->where('no_pendaftaran', $no_pendaftaran);
|
|
$this->db->order_by('angsuran','Asc');
|
|
$query = $this->db->get();
|
|
return $query->result();
|
|
}
|
|
|
|
// Total formulir
|
|
public function regis3($no_pendaftaran)
|
|
{
|
|
$this->db->select('SUM(bayar) AS bayar');
|
|
$this->db->from('v_rpt_trans_invoice');
|
|
$this->db->where('no_pendaftaran', $no_pendaftaran);
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function get_sum()
|
|
{
|
|
$sql = "SELECT sum(bayar) as bayar FROM v_rpt_trans_invoice";
|
|
$result = $this->db->query($sql);
|
|
return $result->row()->bayar;
|
|
}
|
|
|
|
}
|
|
|
|
/* End of file Pendaftar_model.php */
|
|
/* Location: ./application/models/Pendaftar_model.php */ |