Files
web-sekolah/public/application/models/Formulir_model.php
T

118 lines
2.4 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Formulir_model extends CI_Model {
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->library('pdf');
}
//ambil data data
public function listing()
{
$this->db->select('*');
$this->db->from('v_rpt_trans_berkas');
$this->db->order_by('tgl_update','desc');
$query = $this->db->get();
return $query->result();
}
//ambil detail data data
public function detail($no_pendaftaran)
{
$this->db->select('*');
$this->db->from('v_rpt_trans_berkas');
//where
$this->db->where('no_pendaftaran', $no_pendaftaran);
$this->db->order_by('no_pendaftaran','desc');
$query = $this->db->get();
return $query->row();
}
//ambil detail data data
public function setting()
{
$this->db->select('*');
$this->db->from('setting');
$this->db->order_by('id','desc');
$query = $this->db->get();
return $query->result();
}
//hitung get siswa
public function get_siswa()
{
$this->db->select('*');
$this->db->from('data_siswa');
$this->db->order_by('no_pendaftaran','desc');
$query = $this->db->get();
return $query->result();
}
public function viewByNo($no_pendaftaran) {
$sql = "SELECT * FROM data_siswa
WHERE no_pendaftaran = ?
AND no_pendaftaran NOT IN (
SELECT no_pendaftaran FROM tr_data
)";
$query = $this->db->query($sql, array($no_pendaftaran));
$result = $query->row(); // Ambil hasil query
return $result;
}
//hitung total data
public function total()
{
$this->db->select('COUNT(*) AS total');
$this->db->from('v_rpt_trans_berkas');
$this->db->order_by('no_pendaftaran','desc');
$query = $this->db->get();
return $query->row();
}
//fungsi edit
public function edit($data)
{
$this->db->where('no_pendaftaran', $data['no_pendaftaran']);
$this->db->update('tr_data', $data);
}
//fungsi delete
public function delete($data)
{
$this->db->where('no_pendaftaran', $data['no_pendaftaran']);
$this->db->delete('tr_data', $data);
}
//tambah user
public function tambah($data)
{
$this->db->insert('tr_data', $data);
}
//ambil data ViewUrut
public function ViewUrut()
{
$this->db->select('*');
$this->db->from('v_rpt_trans_berkas');
$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 */