84 lines
4.3 KiB
PHP
84 lines
4.3 KiB
PHP
|
<?php
|
||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||
|
class Setup extends CI_Controller
|
||
|
{
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct();
|
||
|
$this->load->helper("accounts");
|
||
|
checkLogin();
|
||
|
}
|
||
|
public function _remap($alias = "", $params = array())
|
||
|
{
|
||
|
|
||
|
$data['dataValue'] = $this->session;
|
||
|
|
||
|
$data['pageTitle'] = "Account Setup";
|
||
|
switch ($alias) {
|
||
|
// case 'addsingleentryvoucher':
|
||
|
// $data['pageTitle'] = "Single Entry Voucher";
|
||
|
// if (isset($_POST['submit'])) {
|
||
|
// $TableData = array(
|
||
|
// 'voucher_type' => 'SINGLE-ENTRY',
|
||
|
// 'voucher_name' => filter_var($_POST['voucher_name']),
|
||
|
// 'voucher_alias' => createalias(filter_var($_POST['voucher_name'])),
|
||
|
// 'default_account' => filter_var($_POST['default_account']),
|
||
|
// 'default_accountside' => filter_var($_POST['default_accountside']),
|
||
|
// 'voucher_options' => filter_var($_POST['voucher_options']),
|
||
|
// 'created_on' => date('Y-m-d H:i:s'),
|
||
|
// 'created_by' => $this->session->userdata("loggedUser"),
|
||
|
// 'remarks' => filter_var($_POST['remarks']),
|
||
|
// 'status' => 1,
|
||
|
// );
|
||
|
// $this->db->insert('tbl_vouchertypes', $TableData);
|
||
|
// redirect("accounts/setup/singleentryvoucher");
|
||
|
// }
|
||
|
// loadView("accounts/setup/singleentryvoucher/create", $data);
|
||
|
// break;
|
||
|
case 'editvouchertype':
|
||
|
$data['pageTitle'] = "Voucher Types ";
|
||
|
$vouchertype_id = $this->uri->segment(4);
|
||
|
$Accountcategories = $this->db->where("status", 1)->where("parent_category_id <>","0")->order_by("accategory_name","asc")->get("tbl_accategories")->result();
|
||
|
// pre($Accountcategories);die;
|
||
|
$VoucherType = $this->db->where("vouchertype_id", $vouchertype_id)->get("tbl_vouchertypes")->row();
|
||
|
if (isset($_POST['submit'])) {
|
||
|
// pre($_POST['default_debits']);die;
|
||
|
$TableData = array(
|
||
|
'voucher_name' => filter_var($_POST['voucher_name']),
|
||
|
'voucher_color' => filter_var($_POST['voucher_color']),
|
||
|
'default_debits' => isset($_POST['default_debits']) ? implode(",", $_POST['default_debits']) : "",
|
||
|
'default_credits' => isset($_POST['default_credits']) ? implode(",", $_POST['default_credits']) : "",
|
||
|
'status' => $_POST['status']
|
||
|
);
|
||
|
// pre($TableData);die;
|
||
|
$this->db->where("vouchertype_id", $vouchertype_id)->update('tbl_vouchertypes', $TableData);
|
||
|
redirect("accounts/setup/listsingleentryvouchers");
|
||
|
}
|
||
|
$data['VoucherType'] = $VoucherType;
|
||
|
$data['Accountcategories'] = $Accountcategories;
|
||
|
loadView("accounts/setup/singleentryvoucher/edit", $data);
|
||
|
break;
|
||
|
case 'listsingleentryvouchers':
|
||
|
$data['pageTitle'] = "Voucher Types";
|
||
|
loadView("accounts/setup/singleentryvoucher/list", $data);
|
||
|
|
||
|
break;
|
||
|
// case 'deletevouchertype':
|
||
|
// $id = $this->uri->segment(4);
|
||
|
// $this->db->where('vouchertype_id', $id);
|
||
|
// $this->db->update('tbl_vouchertypes', array("status" => 0));
|
||
|
// redirect("accounts/setup/listsingleentryvouchers");
|
||
|
// break;
|
||
|
// case 'togglevouchertype':
|
||
|
// $id = $this->uri->segment(4);
|
||
|
// $q="update tbl_vouchertypes set `status`= 1 - `status` where vouchertype_id='$id'";
|
||
|
// $this->db->query($q);
|
||
|
// redirect("accounts/setup/listsingleentryvouchers");
|
||
|
// break;
|
||
|
|
||
|
default:
|
||
|
loadView("accounts/setup/singleentryvoucher/list", $data);
|
||
|
}
|
||
|
}
|
||
|
}
|