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

class Lapkeucabjur 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['totpenga'] = $this->lapkeu_m->gettotalpencaboffice();
		$data['bukubesarcab'] = $this->lapkeu_m->getbukubesacab();
		$data['invoice_bbcb'] = $this->lapkeu_m->invoice_bbcb();
		$this->template->load('template', 'lapkeucabjur', $data);
	}

	public function addlapbukubesarcab()
	{
		$this->form_validation->set_rules('pen_lbbc', 'pen_lbbc', 'trim');

		$this->form_validation->set_message('required', '" masih kossong "');
		$this->form_validation->set_message('is_unique', '" sudah terdaftar "');


		if ($this->form_validation->run() == false) {
			$this->template->load('template', 'lapkeucabjur/addlapbukubesarcab');
		} else {
			$post = $this->input->post(null, TRUE);
			$this->lapkeu_m->addlapbukubesarcab($post);
			if ($this->db->affected_rows() > 0) {
				$this->session->set_flashdata('success', 'Laporan Buku Besar Bulanan berhasil Ditambahkan');
			}
			redirect('lapkeucabrl');
		}
	}
}
