?
Current Path : /home1/savoy/public_html/savoyglobal.net/rms/application/models/ |
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/models/maintenancemodel.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Maintenancemodel extends CI_Model { function __construct() { // Call the Model constructor parent::__construct(); } function search_maintenance_contract($pagenum) { $data=array(); $log_in_type=$_SESSION['login_type']; $this->db->select('*'); $this->db->from('maintenance_contract'); $this->db->join('master','master_id=maintenance_contract_id'); $this->db->join('building_details','building_id=maintenance_contract_building_id'); $this->db->join('maintenance_cc','maintenance_cc_id=maintenance_contracting_company_id'); $this->db->where('master.login_type_id',$log_in_type); $this->db->order_by('maintenance_contract_id','desc'); $data['results']=$this->db->get(); return $data; } function insert_maintenance_contract($postdata) { $data=array(); $this->db->trans_begin(); $masterid = $this->mastermodel->insertmasterdata(); $code=$this->mastermodel->get_master_code('maintenance_contract','Maintenance Contract','maintenance_contract_code','maintenance_contract_id'); $tblValues=array( 'maintenance_contract_id'=>$masterid, 'maintenance_contract_code'=>$code, 'maintenance_contract_building_id'=>$postdata['maintenance_contract_building_id'], 'maintenance_contracting_company_id'=>$postdata['maintenance_contracting_company_id'], 'maintenance_contract_work_scope'=>$postdata['maintenance_contract_work_scope'], 'maintenance_contract_start_date'=>$this->mastermodel->convertdateformat($postdata['maintenance_contract_start_date']), 'maintenance_contract_end_date'=>$this->mastermodel->convertdateformat($postdata['maintenance_contract_end_date']), 'maintenance_contract_budget'=>$postdata['maintenance_contract_budget'], 'maintenance_contract_amount'=>$postdata['maintenance_contract_amount'], 'maintenance_contract_remarks'=>$postdata['maintenance_contract_remarks'], ); $this->db->insert('maintenance_contract', $tblValues); $data['resfunction']='search_maintenance_contract'; if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; $data['msg']='Error On Adding Record'; return $data; } else { $this->db->trans_commit(); $data['res']=1; $data['msg']='Record Added Successfully'; return $data; } } function update_maintenance_contract($postdata) { $data=array(); $this->db->trans_begin(); $tblValues=array( 'maintenance_contract_work_scope'=>$postdata['maintenance_contract_work_scope'], 'maintenance_contract_start_date'=>$this->mastermodel->convertdateformat($postdata['maintenance_contract_start_date']), 'maintenance_contract_end_date'=>$this->mastermodel->convertdateformat($postdata['maintenance_contract_end_date']), 'maintenance_contract_budget'=>$postdata['maintenance_contract_budget'], 'maintenance_contract_amount'=>$postdata['maintenance_contract_amount'], 'maintenance_contract_remarks'=>$postdata['maintenance_contract_remarks'], ); $this->db->where('maintenance_contract_id',$postdata['maintenance_contract_id']); $this->db->update('maintenance_contract', $tblValues); $data['resfunction']='search_maintenance_contract'; if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; $data['msg']='Error On Updating Record'; return $data; } else { $this->db->trans_commit(); $data['res']=1; $data['msg']='Record Updated Successfully'; return $data; } } function search_contracting_payment($pagenum) { $data=array(); $log_in_type=$_SESSION['login_type']; $this->db->select('*'); $this->db->from('maintenance_contract_payment'); $this->db->join('master','master_id=maintenance_contract_payment_id'); $this->db->join('maintenance_contract','maintenance_contract.maintenance_contract_id=maintenance_contract_payment.maintenance_contract_id'); $this->db->join('building_details','building_id=maintenance_contract_building_id'); $this->db->join('maintenance_cc','maintenance_cc_id=maintenance_contracting_company_id'); $this->db->where('master.login_type_id',$log_in_type); $this->db->order_by('maintenance_contract_payment_id','desc'); $data['results']=$this->db->get(); return $data; } function insert_contracting_payment($postdata) { $data=array(); $this->db->trans_begin(); $masterid = $this->mastermodel->insertmasterdata(); // $code=$this->mastermodel->get_master_code('maintenance_contract','Maintenance Contract','maintenance_contract_code','maintenance_contract_id'); $tblValues=array( 'maintenance_contract_payment_id'=>$masterid, 'maintenance_contract_id'=>$postdata['maintenance_contract_id'], 'maintenance_contract_payment_date'=>$this->mastermodel->convertdateformat($postdata['maintenance_contract_payment_date']), 'maintenance_contract_payment_mode'=>$postdata['maintenance_contract_payment_mode'], 'maintenance_contract_payment_amount'=>$postdata['maintenance_contract_payment_amount'], ); $this->db->insert('maintenance_contract_payment', $tblValues); $data['resfunction']='search_contracting_payment'; if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; $data['msg']='Error On Adding Record'; return $data; } else { $this->db->trans_commit(); $data['res']=1; $data['msg']='Record Added Successfully'; return $data; } } function update_contracting_payment($postdata) { $data=array(); $this->db->trans_begin(); $tblValues=array( 'maintenance_contract_payment_date'=>$this->mastermodel->convertdateformat($postdata['maintenance_contract_payment_date']), 'maintenance_contract_payment_mode'=>$postdata['maintenance_contract_payment_mode'], 'maintenance_contract_payment_amount'=>$postdata['maintenance_contract_payment_amount'], ); $this->db->where('maintenance_contract_payment_id',$postdata['maintenance_contract_payment_id']); $this->db->update('maintenance_contract_payment', $tblValues); $data['resfunction']='search_contracting_payment'; if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; $data['msg']='Error On Updating Record'; return $data; } else { $this->db->trans_commit(); $data['res']=1; $data['msg']='Record Updated Successfully'; return $data; } } } ?>