BBnepal-Accounts/account/application/controllers/Setup.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

820 lines
26 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Setup extends CI_Controller {
function __construct()
{
parent::__construct();
checkLogin();
}
public function index()
{
$data['dataValue']=$this->session;
loadView('setup/tables',$data);
}
public function officecalendar()
{
/* Setup - Initialize a calendar
$startDate=new DateTime('2010-01-01');
$endDate=new DateTime('2040-12-31');
//$t=array();
for($i=$startDate;$i<=$endDate;$i->modify('+1 day'))
{
$day_ad=$i->format("Y-m-d");
$day_bs=NepaliDate($day_ad);
$day_weekday=$i->format("l");
$day_work=($day_weekday=="Saturday")?0:1;
$day_holiday=($day_weekday=="Saturday")?"Saturday":"";
$remarks="";
$status=1;
$t="insert into tbl_officecalendar (day_ad, day_bs, day_weekday, day_work, day_holiday, remarks, status) values ('".$day_ad."', '".$day_bs."', '".$day_weekday."', '".$day_work."', '".$day_holiday."', '".$remarks."', '".$status."')";
$this->db->query($t);
}
*/
$data['dataValue']=$this->session;
$data['pageTitle']="Setup Official Calendar";
loadView("setup/officecalendar",$data);
}
public function factorycalendar()
{
/* Setup - Initialize a calendar
$startDate=new DateTime('2010-01-01');
$endDate=new DateTime('2040-12-31');
//$t=array();
for($i=$startDate;$i<=$endDate;$i->modify('+1 day'))
{
$day_ad=$i->format("Y-m-d");
$day_bs=NepaliDate($day_ad);
$day_weekday=$i->format("l");
$day_work=($day_weekday=="Saturday")?0:1;
$day_holiday=($day_weekday=="Saturday")?"Saturday":"";
$remarks="";
$status=1;
$t="insert into tbl_officecalendar (day_ad, day_bs, day_weekday, day_work, day_holiday, remarks, status) values ('".$day_ad."', '".$day_bs."', '".$day_weekday."', '".$day_work."', '".$day_holiday."', '".$remarks."', '".$status."')";
$this->db->query($t);
}
*/
$data['dataValue']=$this->session;
$data['pageTitle']="Setup Factory Work Calendar";
loadView("setup/factorycalendar",$data);
}
public function itemcategories($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Item Categories";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'category_name'=>filter_var($_POST['category_name'],FILTER_SANITIZE_STRING),
'category_desc'=>filter_var($_POST['category_desc'],FILTER_SANITIZE_STRING),
'created_by'=>'admin',
'created_on'=>date('Y-m-d H:i:s'),
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
'parent_category'=>filter_var($_POST['parent_category'],FILTER_SANITIZE_STRING),
);
$this->db->insert('tbl_itemcategories',$TableData);
redirect("setup/itemcategories");
} loadView("setup/additemcategories",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'category_name'=>filter_var($_POST['category_name'],FILTER_SANITIZE_STRING),
'category_alias'=>filter_var($_POST['category_alias'],FILTER_SANITIZE_STRING),
'category_desc'=>filter_var($_POST['category_desc'],FILTER_SANITIZE_STRING),
'created_by'=>'admin',
'created_on'=>date('Y-m-d H:i:s'),
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
'parent_category'=>filter_var($_POST['parent_category'],FILTER_SANITIZE_STRING),
);
$this->db->where('category_id',$id);
$this->db->update('tbl_itemcategories',$TableData);
redirect("setup/itemcategories");
} loadView("setup/edititemcategories",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('category_id',$id);
$this->db->delete('tbl_itemcategories');
redirect("setup/itemcategories");
break;
default:
loadView("setup/listitemcategories",$data);
}
}
public function items($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Items";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'category_id'=>filter_var($_POST['category_id'],FILTER_SANITIZE_STRING),
'item_name'=>filter_var($_POST['item_name'],FILTER_SANITIZE_STRING),
'item_alias'=>getalias($_POST['item_name'], 'item_alias', 'tbl_items'),
'item_desc'=>filter_var($_POST['item_desc'],FILTER_SANITIZE_STRING),
'item_units'=>filter_var($_POST['item_units'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_items',$TableData);
redirect("setup/items");
} loadView("setup/additems",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'category_id'=>filter_var($_POST['category_id'],FILTER_SANITIZE_STRING),
'item_name'=>filter_var($_POST['item_name'],FILTER_SANITIZE_STRING),
'item_alias'=>getalias($_POST['item_name'], 'item_alias', 'tbl_items'),
'item_desc'=>filter_var($_POST['item_desc'],FILTER_SANITIZE_STRING),
'item_units'=>filter_var($_POST['item_units'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('item_id',$id);
$this->db->update('tbl_items',$TableData);
redirect("setup/items");
} loadView("setup/edititems",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('item_id',$id);
$this->db->delete('tbl_items');
redirect("setup/items");
break;
default:
if(isset($_GET['item_category']))
{
if($_GET['item_category']!="")
$data['TableData']=$this->MItems->getItemsByAlias($_GET['item_category']);
else
$data['TableData']=$this->MItems->getItems();
}
else
{
$data['TableData']=$this->MItems->getItems();
}
loadView("setup/listitems",$data);
}
}
public function vendors($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Vendor";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'vendor_type'=>filter_var($_POST['vendor_type'],FILTER_SANITIZE_STRING),
'vendor_name'=>filter_var($_POST['vendor_name'],FILTER_SANITIZE_STRING),
'vendor_country'=>filter_var($_POST['vendor_country'],FILTER_SANITIZE_STRING),
'vendor_contact'=>filter_var($_POST['vendor_contact'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_vendors',$TableData);
redirect("setup/vendors");
} loadView("setup/addvendors",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'vendor_type'=>filter_var($_POST['vendor_type'],FILTER_SANITIZE_STRING),
'vendor_name'=>filter_var($_POST['vendor_name'],FILTER_SANITIZE_STRING),
'vendor_country'=>filter_var($_POST['vendor_country'],FILTER_SANITIZE_STRING),
'vendor_contact'=>filter_var($_POST['vendor_contact'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('vendor_id',$id);
$this->db->update('tbl_vendors',$TableData);
redirect("setup/vendors");
} loadView("setup/editvendors",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('vendor_id',$id);
$this->db->delete('tbl_vendors');
redirect("setup/vendors");
break;
default:
loadView("setup/listvendors",$data);
}
}
public function branches($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Company Branches";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'branch_name'=>filter_var($_POST['branch_name'],FILTER_SANITIZE_STRING),
'branch_alias'=>getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
'branch_address'=>filter_var($_POST['branch_address'],FILTER_SANITIZE_STRING),
'created_by'=>'admin',
'created_on'=>date('Y-m-d H:i:s'),
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_branches',$TableData);
redirect("setup/branches");
} loadView("setup/addbranches",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'branch_name'=>filter_var($_POST['branch_name'],FILTER_SANITIZE_STRING),
'branch_alias'=>getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
'branch_address'=>filter_var($_POST['branch_address'],FILTER_SANITIZE_STRING),
'created_by'=>'admin',
'created_on'=>date('Y-m-d H:i:s'),
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('branch_id',$id);
$this->db->update('tbl_branches',$TableData);
redirect("setup/branches");
} loadView("setup/editbranches",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('branch_id',$id);
$this->db->delete('tbl_branches');
redirect("setup/branches");
break;
default:
loadView("setup/listbranches",$data);
}
}
public function departments($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Work Department";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'department_name'=>filter_var($_POST['department_name'],FILTER_SANITIZE_STRING),
'department_alias'=>getalias($_POST['department_name'], 'department_alias', 'tbl_departments'),
'branch_id'=>filter_var($_POST['branch_id'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_departments',$TableData);
redirect("setup/departments");
} loadView("setup/adddepartments",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'department_name'=>filter_var($_POST['department_name'],FILTER_SANITIZE_STRING),
'department_alias'=>getalias($_POST['department_name'], 'department_alias', 'tbl_departments'),
'branch_id'=>filter_var($_POST['branch_id'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('department_id',$id);
$this->db->update('tbl_departments',$TableData);
redirect("setup/departments");
} loadView("setup/editdepartments",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('department_id',$id);
$this->db->delete('tbl_departments');
redirect("setup/departments");
break;
default:
loadView("setup/listdepartments",$data);
}
}
public function employeetype($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Employee Types";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'employeetype_name'=>filter_var($_POST['employeetype_name'],FILTER_SANITIZE_STRING),
'employeetype_alias'=>getalias($_POST['employeetype_name'], 'employeetype_alias', 'tbl_employeetype'),
'created_by'=>'admin',
'created_on'=>date('Y-m-d H:i:s'),
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_employeetype',$TableData);
redirect("setup/employeetype");
} loadView("setup/addemployeetype",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'employeetype_name'=>filter_var($_POST['employeetype_name'],FILTER_SANITIZE_STRING),
'employeetype_alias'=>getalias($_POST['employeetype_name'], 'employeetype_alias', 'tbl_employeetype'),
'created_by'=>'admin',
'created_on'=>date('Y-m-d H:i:s'),
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('employeetype_id',$id);
$this->db->update('tbl_employeetype',$TableData);
redirect("setup/employeetype");
} loadView("setup/editemployeetype",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('employeetype_id',$id);
$this->db->delete('tbl_employeetype');
redirect("setup/employeetype");
break;
default:
loadView("setup/listemployeetype",$data);
}
}
public function salarytypes($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Salary Types";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'salarytype_name'=>filter_var($_POST['salarytype_name'],FILTER_SANITIZE_STRING),
'salarytype_alias'=>getalias($_POST['salarytype_name'], 'salarytype_alias', 'tbl_salarytypes'),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_salarytypes',$TableData);
redirect("setup/salarytypes");
} loadView("setup/addsalarytypes",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'salarytype_name'=>filter_var($_POST['salarytype_name'],FILTER_SANITIZE_STRING),
'salarytype_alias'=>getalias($_POST['salarytype_name'], 'salarytype_alias', 'tbl_salarytypes'),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('salarytype_id',$id);
$this->db->update('tbl_salarytypes',$TableData);
redirect("setup/salarytypes");
} loadView("setup/editsalarytypes",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('salarytype_id',$id);
$this->db->delete('tbl_salarytypes');
redirect("setup/salarytypes");
break;
default:
loadView("setup/listsalarytypes",$data);
}
}
public function workshifts($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Work Shift";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'workshift_name'=>filter_var($_POST['workshift_name'],FILTER_SANITIZE_STRING),
'workshift_alias'=>getalias($_POST['workshift_name'], 'workshift_alias', 'tbl_workshifts'),
'workshift_desc'=>filter_var($_POST['workshift_desc'],FILTER_SANITIZE_STRING),
'created_by'=>'admin',
'created_on'=>date('Y-m-d H:i:s'),
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_workshifts',$TableData);
redirect("setup/workshifts");
} loadView("setup/addworkshifts",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'workshift_name'=>filter_var($_POST['workshift_name'],FILTER_SANITIZE_STRING),
'workshift_alias'=>getalias($_POST['workshift_name'], 'workshift_alias', 'tbl_workshifts'),
'workshift_desc'=>filter_var($_POST['workshift_desc'],FILTER_SANITIZE_STRING),
'created_by'=>'admin',
'created_on'=>date('Y-m-d H:i:s'),
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('workshift_id',$id);
$this->db->update('tbl_workshifts',$TableData);
redirect("setup/workshifts");
} loadView("setup/editworkshifts",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('workshift_id',$id);
$this->db->delete('tbl_workshifts');
redirect("setup/workshifts");
break;
default:
loadView("setup/listworkshifts",$data);
}
}
public function propertytype($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Property Types";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'propertytype_name'=>filter_var($_POST['propertytype_name'],FILTER_SANITIZE_STRING),
'propertytype_alias'=>getalias($_POST['propertytype_name'], 'propertytype_alias', 'tbl_propertytypes'),
'propertytype_desc'=>filter_var($_POST['propertytype_desc'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_propertytypes',$TableData);
redirect('setup/propertytype');
}
loadView('setup/addpropertytypes',$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$params[0];
$TableData=array(
'propertytype_name'=>filter_var($_POST['propertytype_name'],FILTER_SANITIZE_STRING),
'propertytype_alias'=>getalias($_POST['propertytype_name'], 'propertytype_alias', 'tbl_propertytypes'),
'propertytype_desc'=>filter_var($_POST['propertytype_desc'],FILTER_SANITIZE_STRING),
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
);
$this->db->where('propertytype_id',$id);
$this->db->update('tbl_propertytypes',$TableData);
redirect('setup/propertytype');
}
loadView('setup/editpropertytypes',$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('propertytype_id',$id);
$this->db->delete('tbl_propertytypes');
redirect('setup/propertytype');
break;
default:
loadView('setup/propertytypes',$data);
}
}
public function rentingproperty($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Rentable Properties";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'propertyType_id'=>filter_var($_POST['propertyType_id'],FILTER_SANITIZE_STRING),
'property_name'=>filter_var($_POST['property_name'],FILTER_SANITIZE_STRING),
'property_desc'=>filter_var($_POST['property_desc'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_properties',$TableData);
redirect("setup/rentingproperty");
} loadView("setup/addproperties",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'propertyType_id'=>filter_var($_POST['propertyType_id'],FILTER_SANITIZE_STRING),
'property_name'=>filter_var($_POST['property_name'],FILTER_SANITIZE_STRING),
'property_desc'=>filter_var($_POST['property_desc'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('property_id',$id);
$this->db->update('tbl_properties',$TableData);
redirect("setup/rentingproperty");
} loadView("setup/editproperties",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('property_id',$id);
$this->db->delete('tbl_properties');
redirect("setup/rentingproperty");
break;
default:
loadView("setup/listproperties",$data);
}
}
public function submeters($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Setup Sub-Meters";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'submeter_name'=>filter_var($_POST['submeter_name'],FILTER_SANITIZE_STRING),
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
'installed_date'=>filter_var($_POST['installed_date'],FILTER_SANITIZE_STRING),
'installed_location'=>filter_var($_POST['installed_location'],FILTER_SANITIZE_STRING),
'initial_reading'=>filter_var($_POST['initial_reading'],FILTER_SANITIZE_STRING),
'identification_mark'=>filter_var($_POST['identification_mark'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_submeters',$TableData);
redirect("setup/submeters");
} loadView("setup/addsubmeters",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'submeter_name'=>filter_var($_POST['submeter_name'],FILTER_SANITIZE_STRING),
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
'installed_date'=>filter_var($_POST['installed_date'],FILTER_SANITIZE_STRING),
'installed_location'=>filter_var($_POST['installed_location'],FILTER_SANITIZE_STRING),
'initial_reading'=>filter_var($_POST['initial_reading'],FILTER_SANITIZE_STRING),
'identification_mark'=>filter_var($_POST['identification_mark'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('submeter_id',$id);
$this->db->update('tbl_submeters',$TableData);
redirect("setup/submeters");
} loadView("setup/editsubmeters",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('submeter_id',$id);
$this->db->delete('tbl_submeters');
redirect("setup/submeters");
break;
default:
loadView("setup/listsubmeters",$data);
}
}
public function utilities($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Utilities for Renting";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'utility_name'=>filter_var($_POST['utility_name'],FILTER_SANITIZE_STRING),
'utility_desc'=>filter_var($_POST['utility_desc'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_utilities',$TableData);
redirect("setup/utilities");
} loadView("setup/addutilities",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'utility_name'=>filter_var($_POST['utility_name'],FILTER_SANITIZE_STRING),
'utility_desc'=>filter_var($_POST['utility_desc'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('utility_id',$id);
$this->db->update('tbl_utilities',$TableData);
redirect("setup/utilities");
} loadView("setup/editutilities",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('utility_id',$id);
$this->db->delete('tbl_utilities');
redirect("setup/utilities");
break;
default:
loadView("setup/listutilities",$data);
}
}
public function utilityrates($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Utility Rates";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'utility_id'=>filter_var($_POST['utility_id'],FILTER_SANITIZE_STRING),
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
'rentalperiod_id'=>filter_var($_POST['rentalperiod_id'],FILTER_SANITIZE_STRING),
'utility_rate'=>filter_var($_POST['utility_rate'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_utilityrates',$TableData);
redirect("setup/utilityrates");
} loadView("setup/addutilityrates",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'utility_id'=>filter_var($_POST['utility_id'],FILTER_SANITIZE_STRING),
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
'rentalperiod_id'=>filter_var($_POST['rentalperiod_id'],FILTER_SANITIZE_STRING),
'utility_rate'=>filter_var($_POST['utility_rate'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('utilityrate_id',$id);
$this->db->update('tbl_utilityrates',$TableData);
redirect("setup/utilityrates");
} loadView("setup/editutilityrates",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('utilityrate_id',$id);
$this->db->delete('tbl_utilityrates');
redirect("setup/utilityrates");
break;
default:
loadView("setup/listutilityrates",$data);
}
}
public function rentalperiods($alias="",$params=array())
{
$data['dataValue']=$this->session;
$data['pageTitle']="Rental Periods";
switch($alias)
{
case 'add':
if(isset($_POST['submit'])){
$TableData=array(
'rentalperiod_name'=>filter_var($_POST['rentalperiod_name'],FILTER_SANITIZE_STRING),
'rentalperiod_alias'=>getalias($_POST['rentalperiod_name'], 'rentalperiod_alias', 'tbl_rentalperiods'),
'rentalperiod_desc'=>filter_var($_POST['rentalperiod_desc'],FILTER_SANITIZE_STRING),
'rentalperiod_duration'=>filter_var($_POST['rentalperiod_duration'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->insert('tbl_rentalperiods',$TableData);
redirect("setup/rentalperiods");
} loadView("setup/addrentalperiods",$data);
break;
case 'edit':
if(isset($_POST['submit'])){
$id=$this->uri->segment(4);
$TableData=array(
'rentalperiod_name'=>filter_var($_POST['rentalperiod_name'],FILTER_SANITIZE_STRING),
'rentalperiod_alias'=>getalias($_POST['rentalperiod_name'], 'rentalperiod_alias', 'tbl_rentalperiods'),
'rentalperiod_desc'=>filter_var($_POST['rentalperiod_desc'],FILTER_SANITIZE_STRING),
'rentalperiod_duration'=>filter_var($_POST['rentalperiod_duration'],FILTER_SANITIZE_STRING),
'created_on'=>date('Y-m-d H:i:s'),
'created_by'=>'admin',
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
'status'=>1,
);
$this->db->where('rentalperiod_id',$id);
$this->db->update('tbl_rentalperiods',$TableData);
redirect("setup/rentalperiods");
} loadView("setup/editrentalperiods",$data);
break;
case 'delete':
$id=$this->uri->segment(4);
$this->db->where('rentalperiod_id',$id);
$this->db->delete('tbl_rentalperiods');
redirect("setup/rentalperiods");
break;
default:
loadView("setup/listrentalperiods",$data);
}
}
public function tables()
{
$data['dataValue']=$this->session;
loadView('setup/tables',$data);
}
}