<?php

Class Receipt extends MY_BackendController{
    public function __construct(){
        parent::__construct();
    }

    public function index()
    {
        $data['action'] = "insert";
        $this->load->model("Receipt_management_model");
        $result = $this->Receipt_management_model->get();
        if ($result == null) {
            $data['action'] = 'insert';
            $data['content']['toc'] = "";
        } else {
            $data['action'] = "update";
            $data['content'] = $result;
        }
        $data['_inactive_loading'] = true;
        $this->view('backend/setting/receipt_management', $data);
    }

    public function insert()
    {
        $post = $this->input->post();
        $this->load->model("Receipt_management_model");
        $this->Receipt_management_model->insert($post);
        redirect("backend/receipt/index");
    }

    public function update()
    {
        $post = $this->input->post();
        $toc = $post['toc'];
        $id = $post['id'];
        $this->load->model("Receipt_management_model");
        $this->Receipt_management_model->update($toc, $id);
        redirect("backend/receipt/index");
    }

    /*
    public function invoicing()
    {
        $data['_inactive_loading'] = true;
        $this->view("backend/receipt/index", $data);
    }
    */
}