?
Current Path : /home1/savoy/public_html/savoyglobal.net/rms/application/controllers/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/rms/application/controllers/bm.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Bm extends MY_Controller { public function __construct() { parent::__construct(); $this->load->model('bmmodel'); $this->load->model('mastermodel'); } function viewinbmsearch($modelfunction='',$page,$pagenum) { $output=$this->bmmodel->$modelfunction($pagenum); $data['viewinfo']=$output['results']; $this->load->view('building_management/'.$page.'',$data); } function addinbm($modelfunction,$page) { $postdata=$this->get_post_values(); $data=$this->bmmodel->$modelfunction($postdata); $data['msg']=$data['msg']; if($data['res']==1) { $this->viewinbmsearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } else { $this->viewinbmsearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } } function single_page($id,$table,$field,$page,$alert_id='') { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'],0); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['id']=$id; $data['alert_id']=$alert_id; $this->load->view('building_management/'.$page,$data); } } function edit_page($id,$table,$field,$page) { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'],1); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['id']=$id; $this->load->view('building_management/'.$page,$data); } } function get_post_values() { $data = array(); foreach ($_POST as $key => $value) { if($key != "submit") { $data[$key] = $this->input->post($key); } } return $data; } function edit_extension($id,$table,$field,$page) { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'],1); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['lease']=$this->mastermodel->get_data_srow('lease_agreement',$data['viewinfo']->extension_lease_id,'lease_id'); $data['details']=$this->mastermodel->get_data('extension_appliance',$id,$field); $data['id']=$id; $this->load->view('building_management/'.$page,$data); } } function edit_termination($id,$table,$field,$page) { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'],1); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['appliance_list']=$this->mastermodel->get_data('contract_termination_appliance',$id,$field,'',$field); $data['id']=$id; $this->load->view('building_management/'.$page,$data); } } function load_building_details($id) { $building_id=$this->mastermodel->get_single_field_value('lease_agreement','lease_building_id','lease_id',$id); $data['building']=$this->mastermodel->get_data_srow('building_details',$building_id,'building_id'); $data['location']=$this->mastermodel->get_single_field_value('location','location_name','location_id',$data['building']->building_location_id); $data['flat_no']=$this->mastermodel->get_single_field_value('lease_agreement','lease_flat_no','lease_id',$id); $this->load->view('building_management/building_details',$data); } function load_termination_building_details($id) { $building_id=$this->mastermodel->get_single_field_value('lease_agreement','lease_building_id','lease_id',$id); $data['building']=$this->mastermodel->get_data_srow('building_details',$building_id,'building_id'); $data['location']=$this->mastermodel->get_single_field_value('location','location_name','location_id',$data['building']->building_location_id); $data['flat_no']=$this->mastermodel->get_single_field_value('lease_agreement','lease_flat_no','lease_id',$id); $data['start_date']=$this->mastermodel->get_single_field_value('lease_agreement','lease_start_date','lease_id',$id); $data['end_date']=$this->mastermodel->get_single_field_value('lease_agreement','lease_end_date','lease_id',$id); $this->load->view('building_management/termination_building_details',$data); } function building_details($id) { $data['facility']=$this->mastermodel->get_data_joined('building_facility_details','facility','facility_type_id','facility_id',$id,'building_id'); $data['amenity']=$this->mastermodel->get_data_joined('building_amenities_details','amenities','amenity_type_id','amenities_id',$id,'building_id'); $data['code']=$this->mastermodel->get_single_field_value('building_details','building_code','building_id',$id); $loc_id=$this->mastermodel->get_single_field_value('building_details','building_location_id','building_id',$id); $data['location']=$this->mastermodel->get_single_field_value('location','location_name','location_id',$loc_id); $data['address']=$this->mastermodel->get_single_field_value('building_details','building_address','building_id',$id); $type=$this->mastermodel->get_single_field_value('building_details','building_type_id','building_id',$id); if($type==1) { $data['detail']=$this->mastermodel->get_data('building_commercial_building_details',$id,'building_id'); $data['field']='commercial_office'; } elseif ($type==2) { $data['detail']=$this->mastermodel->get_data('building_commercial_villa_details',$id,'building_id'); $data['field']='commercial_villa_number'; } elseif ($type==3) { $data['detail']=$this->mastermodel->get_data('building_residential_villa_details',$id,'building_id'); $data['field']='residential_villa_number'; } else { $data['detail']=$this->mastermodel->get_data('building_apartment_details',$id,'building_id'); $data['field']='apartment_no'; } echo json_encode($data); } function load_amenities($id) { $data['amenity']=$this->mastermodel->get_data_joined('building_amenities_details','amenities','amenity_type_id','amenities_id',$id,'building_id'); $this->load->view('building_management/amenities_details',$data); } function load_facility($id) { $data['facility']=$this->mastermodel->get_data_joined('building_facility_details','facility','facility_type_id','facility_id',$id,'building_id'); $this->load->view('building_management/facility_details',$data); } function lease_details($id) { $lease=$this->mastermodel->get_data_srow('lease_agreement',$id,'lease_id'); $data['name']=$this->mastermodel->get_single_field_value('customer','customer_name','customer_id',$lease->lease_customer_id); $data['start_date']=$this->mastermodel->convertdatenormalformat($lease->lease_start_date); $data['end_date']=$this->mastermodel->convertdatenormalformat($lease->lease_end_date); $data['rent']=$lease->lease_rent_amount; $data['lease_appliance']=$this->mastermodel->get_data('appliance_allocation',$lease->lease_id,'lease_id'); $data['code']=$lease->lease_agreement_code; echo json_encode($data); } function load_appliance($id) { $data['lease_appliance']=$this->mastermodel->get_data('appliance_allocation',$id,'lease_id'); $data['appliance']=$this->mastermodel->getdatas('appliance','appliance_id','','appliance_id'); $this->load->view('building_management/extension_appliances',$data); } function edit_lease_agreement($id,$table,$field,$page) { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'],1); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $building_id=$data['viewinfo']->lease_building_id; $data['facility']=$this->mastermodel->get_data_joined('building_facility_details','facility','facility_type_id','facility_id',$building_id,'building_id'); $data['amenity']=$this->mastermodel->get_data_joined('building_amenities_details','amenities','amenity_type_id','amenities_id',$building_id,'building_id'); $data['current_amenity']=$this->mastermodel->get_data('lease_amenity_details',$id,$field,'',$field); $data['lease_details']=$this->mastermodel->get_data('appliance_allocation',$id,$field,'',$field); $data['payment']=$this->mastermodel->get_data('lease_payment_details',$id,$field,'',$field); $type=$this->mastermodel->get_single_field_value('building_details','building_type_id','building_id',$building_id); if($type==1) { $data['detail']=$this->mastermodel->get_data('building_commercial_building_details',$building_id,'building_id'); $data['field']='commercial_office'; } elseif ($type==2) { $data['detail']=$this->mastermodel->get_data('building_commercial_villa_details',$building_id,'building_id'); $data['field']='commercial_villa_number'; } elseif ($type==3) { $data['detail']=$this->mastermodel->get_data('building_residential_villa_details',$building_id,'building_id'); $data['field']='residential_villa_number'; } else { $data['detail']=$this->mastermodel->get_data('building_apartment_details',$building_id,'building_id'); $data['field']='apartment_no'; } $data['id']=$id; $this->load->view('building_management/'.$page,$data); } } function single_lease_agreement($id,$table,$field,$page) { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'],1); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['current_amenity']=$this->mastermodel->get_data('lease_amenity_details',$id,$field,'',$field); $data['lease_details']=$this->mastermodel->get_data('appliance_allocation',$id,$field,'',$field); $data['payment']=$this->mastermodel->get_data('lease_payment_details',$id,$field,'',$field); $data['id']=$id; $this->load->view('building_management/'.$page,$data); } } } ?>