Facebook
From Gray Moth, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 125
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2.  
  3. class Pembayaran extends CI_Controller {
  4.  
  5.                 function __construct()
  6.         {
  7.                 parent::__construct();
  8.                 check_not_login();
  9.                 check_admin();
  10.                 $this->load->model('pembayaran_m');
  11.                
  12.         }
  13.                 public function index()
  14.                 {
  15.  
  16.                 $this->load->model(['customer_m','sparepart_m']);
  17.                 $customer = $this->customer_m->get()->result();
  18.                 $sparepart = $this->sparepart_m->get()->result();
  19.                 $data = array(
  20.                         'customer'=> $customer,
  21.                         'sparepart'=> $sparepart,
  22.                         'wo' => $this->pembayaran_m->wo(),
  23.                         );
  24.                 $this->template->load('template','pembayaran/pembayaran_form', $data);
  25.         }
  26.  
  27.         public function process()
  28.         {
  29.                 $data =$this->input->post(null, TRUE);
  30.                 if(isset($_POST['add'])) {
  31.                         $this->pembayaran_m->add($data);
  32.                 }
  33.                 if($this->db->affected_rows() > 0) {
  34.                         $params = array("success" => true);
  35.                 } else {
  36.                         $params = array("success" => false);
  37.                        
  38.                 }
  39.                 echo json_encode($params);
  40.         }
  41.        
  42. }
  43.  
  44.