BBnepal-Accounts/account/application/controllers/inventory/Paymentmodes.php

66 lines
2.6 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Paymentmodes extends CI_Controller
{
function __construct()
{
parent::__construct();
checkLogin();
}
public function _remap($alias = "", $params = array())
{
$data['dataValue'] = $this->session;
$data['pageTitle'] = "Payment Modes";
switch ($alias) {
case 'add':
if (isset($_POST['submit'])) {
$TableData = array(
'title' => filter_var($_POST['title']),
'description' => filter_var($_POST['description']),
'display_order' => filter_var($_POST['display_order']),
'status' => 1,
'remarks' => filter_var($_POST['remarks']),
'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin',
);
$this->db->insert('tbl_paymentmodes', $TableData);
redirect("inventory/paymentmodes");
}
loadView("inventory/paymentmodes/add", $data);
break;
case 'edit':
if (isset($_POST['submit'])) {
$id = $this->uri->segment(4);
$TableData = array(
'title' => filter_var($_POST['title']),
'description' => filter_var($_POST['description']),
'display_order' => filter_var($_POST['display_order']),
'status' => 1,
'remarks' => filter_var($_POST['remarks']),
'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin',
);
$this->db->where('paymentmode_id', $id);
$this->db->update('tbl_paymentmodes', $TableData);
redirect("inventory/paymentmodes");
}
$id = $this->uri->segment(4);
$this->db->where('paymentmode_id', $id);
$data['paymentmode'] = $this->db->get("tbl_paymentmodes")->row();
loadView("inventory/paymentmodes/add", $data);
break;
case 'delete':
$id = $this->uri->segment(4);
$this->db->where('paymentmode_id', $id);
$this->db->delete('tbl_paymentmodes');
redirect("inventory/paymentmodes");
break;
default:
loadView("inventory/paymentmodes/list", $data);
}
}
}