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

class Lapkeucabpart extends CI_Controller
{

	function __construct()
	{
		parent::__construct();
		check_not_login(); // kode akses login diambil dari helper
		check_admin();
		$this->load->model('lapkeu_m');

		$this->load->library('form_validation');
	}

	public function index()
	{
		$data['rowx'] = $this->lapkeu_m->getofficeadmin();
		$data['totpesbrg'] = $this->lapkeu_m->gettotalpesbrgcaboffice();
		$data['totpesbrgup'] = $this->lapkeu_m->gettotalpesbrgcabofficeup();

		$this->template->load('template', 'lapkeucabpart', $data);
	}

	public function updateharbrgoffice()
	{
		$post = $this->input->post(null, TRUE);
		$this->pesanbrg_m->updateharbrgoffice($post);
		if ($this->db->affected_rows() > 0) {
			$this->session->set_flashdata('success', 'Harga Barang Berhasil Di Update');
		}
		redirect($_SERVER['HTTP_REFERER']);
	}

	public function delpart($id)
	{
		$this->pesanbrg_m->delpart($id);
		if ($this->db->affected_rows() > 0) {
			$this->session->set_flashdata('success', 'Data Item Sparepart berhasil Dihapus');
		}
		redirect($_SERVER['HTTP_REFERER']);
	}
}
