<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Invoice_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_data_invoice');
		$this->db->order_by('tgl_invoice','desc');
		$query = $this->db->get();
		return $query->result();			
	}
	public function delete($data)
	{
		$this->db->where('no_pendaftaran', $data['no_pendaftaran']);
		$this->db->delete('invoice', $data);

		
	}

	public function deletetransaksi($data)
	{
		$this->db->where('no_trans', $data['no_trans']);
		$this->db->delete('tr_invoice', $data);
	}

	//ambil detail data data
	public function detail($no_pendaftaran)
	{

		$this->db->select('*');
		$this->db->from('v_rpt_data_invoice');
		//where
		$this->db->where('no_pendaftaran', $no_pendaftaran);
		$this->db->order_by('no_pendaftaran','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_data_invoice');
		$this->db->order_by('no_pendaftaran','desc');
		$query = $this->db->get();
		return $query->row();			
	}

	//ambil data ViewUrut
	public function ViewUrut()
	{

		$this->db->select('*');
		$this->db->from('v_rpt_data_invoice');
		$this->db->order_by('no_pendaftaran','ASC');
		$query = $this->db->get();
		return $query->result();			
	}


}

/* End of file Pendaftar_model.php */
/* Location: ./application/models/Pendaftar_model.php */