<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Openingbalance extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->helper("accounts");
        checkLogin();
    }
    public function _remap($alias = "", $params = array())
    {

        $data['dataValue'] = $this->session;

        $data['pageTitle'] = "Opening Balance";
        switch ($alias) {
            case 'add':
                // if (isset($_POST['submit'])) {
                //     $TableData = array(
                //         'accategory_id' => filter_var($_POST['accategory_id']),
                //         'account_code' => generateAccountCode(filter_var($_POST['account_code'])),
                //         'account_name' => filter_var($_POST['account_name']),
                //         'account_type' => filter_var($_POST['account_type']),
                //         'account_plcategory' => filter_var($_POST['account_plcategory']),
                //         'account_currency' => filter_var($_POST['account_currency']),
                //         'account_partyname' => filter_var($_POST['account_partyname']),
                //         'account_partyaddress' => filter_var($_POST['account_partyaddress']),
                //         'account_partypan' => filter_var($_POST['account_partypan']),
                //         'account_partycontact' => filter_var($_POST['account_partycontact']),
                //         'account_partyemail' => filter_var($_POST['account_partyemail']),
                //         'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
                //         'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
                //         'created_on' => date('Y-m-d H:i:s'),
                //         'created_by' => 'admin',
                //         'remarks' => filter_var($_POST['remarks']),
                //         'status' => 1,
                //     );
                //     $this->db->insert('tbl_accounts', $TableData);
                //     redirect("accounts/accountheads/list");
                // }
                // loadView("accounts/accountheads/add", $data);
                break;
            case 'edit':
                // $id = $this->uri->segment(4);
                // if (isset($_POST['submit'])) {
                //     $TableData = array(
                //         'accategory_id' => filter_var($_POST['accategory_id']),
                //         //'account_code' => filter_var($_POST['account_code']),
                //         'account_name' => filter_var($_POST['account_name']),
                //         'account_type' => filter_var($_POST['account_type']),
                //         'account_plcategory' => filter_var($_POST['account_plcategory']),
                //         'account_currency' => filter_var($_POST['account_currency']),
                //         'account_partyname' => filter_var($_POST['account_partyname']),
                //         'account_partyaddress' => filter_var($_POST['account_partyaddress']),
                //         'account_partypan' => filter_var($_POST['account_partypan']),
                //         'account_partycontact' => filter_var($_POST['account_partycontact']),
                //         'account_partyemail' => filter_var($_POST['account_partyemail']),
                //         'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
                //         'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
                //         'created_on' => date('Y-m-d H:i:s'),
                //         'created_by' => 'admin',
                //         'remarks' => filter_var($_POST['remarks']),
                //         'status' => 1,
                //     );
                //     $this->db->where('account_id', $id);
                //     $this->db->update('tbl_accounts', $TableData);
                //     redirect("accounts/accountheads/list");
                // }
                // $data['Account'] = $this->db->query("select * from tbl_accounts where account_id =\"$id\" ")->row();
                // loadView("accounts/accountheads/edit", $data);
                // break;
            case 'delete':
                // $id = $this->uri->segment(4);
                // $this->db->set('status', "-1");
                // $this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
                // $this->db->where('account_id', $id);
                // $this->db->update('tbl_accounts');
                // redirect("accounts/accountheads/list");
                break;
           
            default:
                loadView("accounts/openingbalance/entry", $data);
        }
    }
}