| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/adeetie/application/models/ |
Upload File : |
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Mwillingness extends CI_Model
{
public function get_list_all($limit, $offset, $search = '')
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where(("applications.application_num LIKE '%".$search."%' OR users.company LIKE '%".$search."%'"), null, false)
->order_by('applications.created_on', 'DESC')
->limit($limit, $offset)
->get();
if ($query->num_rows() > 0) {
return $query->result_array();
}
}
public function get_total_app($state_code = null, $pmustatus= 'approved')
{
// $query = $this->db->where('pmu_approve_status', $pmustatus);
if(!empty($state_code)) {
$this->db->where('company_state', $state_code);
}
$query = $this->db->get('applications');
return $query->num_rows();
}
public function get_total_app_status($status = null)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id');
$this->db->where('applications.status', $status);
$query = $this->db->get();
return $query->num_rows();
}
public function total_list_search($search = '')
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where(("applications.application_num LIKE '%".$search."%' OR users.company LIKE '%".$search."%'"), null, false)
->order_by('applications.created_on', 'DESC')
->get();
return $query->num_rows();
}
public function get_total_appofpmu($state_code = null)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id');
$query = $this->db->get();
return $query->num_rows();
}
public function update_willingness($path = null, $id)
{
$userdata = $this->session->userdata('user_id');
$arr = [
'update_on' => date('Y-m-d H:i:s'),
'pmu_approve_datetime' => date('Y-m-d H:i:s'),
'update_by' => $userdata,
'pmu_approve_status' => $this->input->post('pmu_approve_status'),
];
if(!empty($path)) {
$arr['eval_link_static'] = $path;
}
$this->db->where('application_num', $id);
$this->db->update('applications', $arr);
if($this->db->affected_rows() > 0) {
$this->session->set_flashdata('success', 'Successfully Updated');
redirect('fc/willingness', 'refresh');
} else {
$this->session->set_flashdata('error', 'Updation failed');
redirect('fc/willingness', 'refresh');
}
}
public function get_all_category()
{
$sql = $this->db->get('app_category');
if($sql->num_rows()>0) {
return $sql->result_array();
}
}
public function get_form_byid($id)
{
$this->db->where('application_num', $id);
$sql = $this->db->get('applications');
if ($sql->num_rows() > 0) {
return $sql->row_array();
}
}
public function get_state_wise($state_code, $limit, $offset, $search="") {
echo $state_code;
$this->db->select("users.company, applications.*")->from('users');
$this->db->join('applications', 'applications.beneficiary_user_id = users.id');
$this->db->where('applications.company_state ='.$state_code);
if(!empty($search)) {
$this->db->where(("applications.application_num LIKE '%".$search."%' OR users.company LIKE '%".$search."%'"), null, false);
}
$this->db->order_by('applications.created_on', 'DESC');
$this->db->limit($limit, $offset);
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->result_array();
}
}
public function get_state_wise_total($state_code, $search="") {
echo $state_code;
$this->db->select("users.company, applications.*")->from('users');
$this->db->join('applications', 'applications.beneficiary_user_id = users.id');
$this->db->where('applications.company_state ='.$state_code);
if(!empty($search)) {
$this->db->where(("applications.application_num LIKE '%".$search."%' OR users.company LIKE '%".$search."%'"), null, false);
}
$query = $this->db->get();
return $query->num_rows();
}
public function get_pmustatus_list($limit, $offset, $pmustatus)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.pmu_approve_status', $pmustatus)
->limit($limit, $offset)
->get();
if ($query->num_rows() > 0) {
return $query->result_array();
}
}
public function get_app_status($limit, $offset, $status)
{
$query = $this->db->select("users.company, applications.*")->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.status', $status)
->limit($limit, $offset)
->get();
if ($query->num_rows() > 0) {
return $query->result_array();
}
}
public function get_wiling_count_basedon_status($pmustatus)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.pmu_approve_status', $pmustatus)
->get();
return $query->num_rows();
}
public function get_registered_company($limit, $offset)
{
$query = $this->db->select("users.*, applications.application_num")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id', 'left')
->where('users.type_industry !=', '')
->where('applications.application_num', null)
->order_by('created_on', 'DESC')
->get();
if ($query->num_rows() > 0) {
return $query->result_array();
}
}
public function get_total_company()
{
$query = $this->db->select("users.*, applications.application_num")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id', 'left')
->where('users.bank_code', '')
->where('applications.application_num', null)
->get();
return $query->num_rows();
}
public function get_by_state($statecode, $limit, $offset)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.company_state', $statecode)
->where('applications.pmu_approve_status', 'approved')
->limit($limit, $offset)
->get();
if ($query->num_rows() > 0) {
return $query->result_array();
}
}
public function getforbeeuser_by_state($statecode, $limit, $offset)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.company_state', $statecode)
->limit($limit, $offset)
->get();
if ($query->num_rows() > 0) {
return $query->result_array();
}
}
public function get_by_district($companyd, $limit, $offset)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.company_dist', $companyd)
->limit($limit, $offset)
->get();
if ($query->num_rows() > 0) {
return $query->result_array();
}
}
public function get_total_by_state($statecode)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.company_state', $statecode)
->where('applications.pmu_approve_status', 'approved')
->get();
return $query->num_rows();
}
public function getforbee_total_by_state($statecode)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.company_state', $statecode)
->get();
return $query->num_rows();
}
public function get_total_by_district($companyd)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.company_dist', $companyd)
->get();
return $query->num_rows();
}
public function state_name_bycode($statecode)
{
$this->db->where('state_code', $statecode);
$query = $this->db->get('states');
if ($query->num_rows() > 0) {
return $query->row_array();
}
}
public function total_willingness_form()
{
}
public function get_total_app_statewise($statecode)
{
$query = $this->db->select("users.company, applications.*")
->from('users')
->join('applications', 'applications.beneficiary_user_id = users.id')
->where('applications.company_state', $statecode)
->get();
return $query->num_rows();
}
public function get_total_new_fi()
{
$query = $this->db->select("users.*")
->from('users')
->where('users.bank_code', 'na')
->get();
return $query->num_rows();
}
public function get_project_byid($id){
$this->db->where('id', $id);
$sql = $this->db->get('projects');
if ($sql->num_rows() > 0) {
return $sql->row_array();
}
}
public function update_project($id, $appNumber) {
echo $appNumber;
$arr = [
'baseline_energy' => $this->input->post('baseline_energy'),
'fuel_saving' => $this->input->post('fuel_saving'),
'electricity_saving' => $this->input->post('electricity_saving'),
'project_cost' => $this->input->post('project_cost'),
'loan_amount' => $this->input->post('loan_amount'),
'cost_of_ee_measures' => $this->input->post('cost_of_ee_measures'),
'details_of_ee_measure' => $this->input->post('details_of_ee_measure')
];
$this->db->where('id', $id);
$this->db->update('projects', $arr );
if( $this->db->affected_rows() > 0 ) {
$this->session->set_flashdata( 'message','Profile updated successfully' );
redirect('fc/application/'. $appNumber, 'refresh');
} else {
$this->session->set_flashdata('error','Updation failed');
redirect('fc/application/'. $appNumber, 'refresh');
}
}
}