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

class Kasir extends CI_Controller
{

    // CONSTRUCT
    public function __construct()
    {
        parent::__construct();
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->load->model('M_Utama');
        $this->load->model('M_Kasir');
        $this->load->model('M_user');
        $this->load->helper('url');

        if (!$this->session->userdata('username')) {
            redirect('login');
        }
    }

    public function index()
    {
        $tgl = date('Y-m-d');
        $data['abdulradjak'] = $this->M_Utama->abdulradjak()->row_array();
        $abdulradjak = $this->M_Utama->abdulradjak()->row_array();
        $pageAbdulRadjak = $abdulradjak['NamaPerusahaan'];
        $data['judul'] = $pageAbdulRadjak;
        $data['user'] = $this->M_user->getUserSession()->row_array();

        $this->load->view('properti/header', $data);
        $this->load->view('kasir/page/index', $data);
        $this->load->view('properti/footer', $data);
    }

    public function get_cases()
    {
        $cari = $this->input->post('cari');
        if ($cari != '') {
            $query = $this->db->query("Select [Case ID] as CaseID,[Intake Date] As IntakeDate,* From Cases c inner join 
            Company co on c.CompanyCode = co.CompanyCode WHERE [Case ID] = '$cari' order by [Case ID] Desc ")->result();
        }

        echo json_encode($query);
    }
}
