MEQ ROLE ADDED

This commit is contained in:
Velz2020 2020-12-30 16:01:23 +05:30
parent 90efee3cc7
commit 2d06c4c735
7 changed files with 86 additions and 25 deletions

View File

@ -288,6 +288,7 @@ $route['saveSalesPD'] = 'Sales_PD_Controller/saveSalesPD';
$route['(downloadSalesPDReport/:any)'] = 'Sales_PD_Controller/getSalesPDReport';
$route['listSalesPD/(:any)'] = 'Sales_PD_Controller/listSalesPD';
$route['listSalesPD/(:any)/(:any)'] = 'Sales_PD_Controller/listSalesPD';
$route['listSalesPD/(:any)/(:any)/(:any)'] = 'Sales_PD_Controller/listSalesPD';
$route['saveSalesPDImage'] = 'Sales_PD_Controller/saveSalesPDImage';
$route['saveSalesPDsection'] = 'Sales_PD_Controller/saveSalesPDsection';
$route['getSalesPDSectionData'] = 'Sales_PD_Controller/getSalesPDSectionData';

View File

@ -257,6 +257,7 @@ class Sales_PD_Controller extends REST_Controller {
{
$lender_id = $this->uri->segment(2);
$user_id = $this->uri->segment(3);
$role = $this->uri->segment(4);
$columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.sales_pd_sno','SALES_PD_DATA.applicant_name','concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name','SALES_PD_DATA.applicant_id','SALES_PD_DATA.lender_id','SALES_PD_DATA.product_id','SALES_PD_DATA.is_pdf','SALES_PD_DATA.is_edited','ENTITY.short_name','PRODUCT.abbr','SALES_PD_DATA.createdon','SALES_PD_DATA.status','SALES_PD_DATA.sales_pd_type','SALES_PD_DATA.rand_string','SALES_PD_DATA.isactive'
// ,"DATE_FORMAT(SALES_PD_DATA.createdon,'%Y-%m-%d') as modify","DATE_ADD(CURDATE(),INTERVAL '-10' DAY) as currd",
// "(CURDATE()) as daye10"
@ -274,6 +275,7 @@ class Sales_PD_Controller extends REST_Controller {
'jointype' => 'LEFT')
);
$or_where = array();
$where_condition_array['SALES_PD_DATA.isactive'] = 1;
if(is_numeric($lender_id))
{
@ -288,14 +290,21 @@ class Sales_PD_Controller extends REST_Controller {
// ----END OF FILTERING THE LAST 10 DAYS RECORDS---
if($user_id && is_numeric($user_id))
if($role && is_numeric($role) && $role == 15) //if role area sales head the pull all meq cases
{
$where_condition_array['SALES_PD_DATA.product_id'] = (ENVIRONMENT == 'production' ? 23 : 22);
$or_where['SALES_PD_DATA.createdby'] = $user_id;
}
else if($user_id && is_numeric($user_id))
{
$where_condition_array['SALES_PD_DATA.createdby'] = $user_id;
}
$order_by = 'SALES_PD_DATA.sales_pd_id';
$sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array,$order_by,'DESC');
$sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array,$order_by,'DESC','',$or_where);
//print_r($this->db->last_query());die();
// print_r($this->db->last_query());die();
// print_r(count($sales_pd_data));die();
if(count($sales_pd_data))
{
$data['dataStatus'] = true;

View File

@ -52,11 +52,11 @@ class User_Management_Controller extends REST_Controller {
$roles = "";
$lender_hierarchy = "";
$pdofficer = "";
$user_config = "";
if($this->post('roles')){ $roles = json_decode($this->post('roles'),true); }
if($this->post('pdofficer')){ $pdofficer = json_decode($this->post('pdofficer'),true); }
if($this->post('user_config')){ $user_config = json_decode($this->post('user_config'),true); }
$records = json_decode($this->post('records'),true);
@ -152,8 +152,22 @@ class User_Management_Controller extends REST_Controller {
//print_r($pdofficer);
$this->User_Management_Model->saveRecords($pdofficer,PDOFFICIERSDETAILS);
}
}
}
}
//save user configs
if($user_config)
{
if(array_key_exists('salespd_products', $user_config))
{
$salespd_products = (implode(',',$user_config['salespd_products']));
$arr = array('fk_user_id' => $user_id,'config_type' => 1,'data' => $salespd_products);
$this->db->set($arr);
$res = $this->db->insert(USERCONFIG);
//print_r($res);
}
}
if($user_id != '' || $user_id != null)
{
@ -180,15 +194,21 @@ class User_Management_Controller extends REST_Controller {
$roles = "";
$lender_hierarchy = "";
$pdofficer = "";
$user_config = "";
if($this->post('pdofficer')){ $pdofficer = json_decode($this->post('pdofficer'),true);}
if($this->post('lender_hierarchy')){ $lender_hierarchy = json_decode($this->post('lender_hierarchy'),true); }
if($this->post('user_config')){ $user_config = json_decode($this->post('user_config'),true); }
$records = json_decode($this->post('records'),true);
// $records = array_filter($recordsData);
$roles = json_decode($this->post('roles'),true);
// $lender_hierarchy = json_decode($this->post('lender_hierarchy'),true);
if(!empty($_FILES['profilepic']['tmp_name']))
@ -280,6 +300,22 @@ class User_Management_Controller extends REST_Controller {
$this->User_Management_Model->updateRecords($pdofficer,PDOFFICIERSDETAILS,$arr);
}
}
//update user configs
if($user_config)
{
if(array_key_exists('salespd_products', $user_config))
{
$salespd_products = (implode(',',$user_config['salespd_products']));
$arr = array('fk_user_id' => $records['userid'],'config_type' => 1,'data' => $salespd_products);
$this->db->set($arr);
$this->db->where('fk_user_id', $records['userid']);
$res = $this->db->update(USERCONFIG);
//print_r($res);
}
}
if($modified != '' || $modified != null || $modified != 0)
{

View File

@ -93,7 +93,7 @@ class SPARQ_Model extends CI_Model {
}
public function getJoinRecords($columns,$table,$joins,$where_condition_array = array(),$order_by_cloumn = '',$order_by = 'ASC',$print_query = '')
public function getJoinRecords($columns,$table,$joins,$where_condition_array = array(),$order_by_cloumn = '',$order_by = 'ASC',$print_query = '',$or_where)
{
@ -112,6 +112,15 @@ class SPARQ_Model extends CI_Model {
$this->db->WHERE($key,$condition);
}
}
if(count($or_where))
{
$this->db->or_group_start();
foreach($or_where as $key => $condition)
{
$this->db->WHERE($key,$condition);
}
$this->db->group_end();
}
if($order_by != '')
{

View File

@ -45,6 +45,11 @@ class User_Management_Model extends SPARQ_Model {
// print_r($result);die;
if(count($result) > 0 )
{
foreach ($result as $key => $value)
{
$result[$key]['user_config'] = $this->getUserConfigDetails($value['userid']);
}
$result_data['data_status'] = true;
$result_data['data'] = $result;
return $result_data;

View File

@ -259,6 +259,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '</tbody></table>';
?>
<br>
<table class="scorecard_table"><tbody>
<tr>
<th class="thlargefont" colspan="10" >Institution Details</th>
@ -290,9 +291,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</tr>
<tr>
<td colspan="3">Number of beds</td>
<td class = "tdcenteralign" colspan="2" ><?php echo ($section4['how_many_beds'])?></td>
<td class = "tdcenteralign" colspan="2" ><?php echo (isset($section4['how_many_beds']) && $section4['how_many_beds'] != '' ? $section4['how_many_beds'] : '-') ?></td>
<td colspan="2">Occupancy ratio </td>
<td class = "tdcenteralign" colspan="3"> <?php echo ($section4['occupancy_ratio'])?></td>
<td class = "tdcenteralign" colspan="3"> <?php echo (isset($section4['occupancy_ratio']) && $section4['occupancy_ratio'] != '' ? $section4['occupancy_ratio'] : '-')?></td>
</tr>
<?php if( (!strcasecmp($section4['instituion_vitage'], 'Hospital')) || (!strcasecmp($section4['instituion_vitage'], 'Nursing Home'))){ ?>
<tr>

View File

@ -256,7 +256,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '<tr> <td colspan="3">Address Type / Ownership</td> <td colspan="7" class = "tdcenteralign">'.$pd_section_data[2]['address_type']['address_type'].$ownership_type.'</td></tr>';
if(isset($pd_section_data[8]['is_business_address']) && strtolower($pd_section_data[8]['is_business_address']) == 'yes')
{
echo '<tr> <td colspan="3">Business operating duration<br> from this address </td> <td class = "tdcenteralign" colspan="7">'.($pd_section_data[8]['business_years'].' Year(s)'.(isset($pd_section_data[8]['business_months']) && $pd_section_data[8]['business_months'] != '' ? ' & ' . $pd_section_data[8]['business_months'] .' Month(s)': '')).'</td> </tr>';
echo '<tr> <td colspan="3">Period for which business has been <br>in operation from this address </td> <td class = "tdcenteralign" colspan="7">'.($pd_section_data[8]['business_years'].' Year(s)'.(isset($pd_section_data[8]['business_months']) && $pd_section_data[8]['business_months'] != '' ? ' & ' . $pd_section_data[8]['business_months'] .' Month(s)': '')).'</td> </tr>';
}
echo '<tr> <td colspan="3">PD locality</td> <td colspan="7" class = "tdcenteralign">'.$pd_section_data[2]['pd_locality']['locality_name'].'</td></tr>';
echo '<tr> <td colspan="3">Location Approach</td> <td colspan="7" class = "tdcenteralign">'.$pd_section_data[2]['pd_location']['description'].'</td></tr>';
@ -1288,28 +1288,28 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
<div id="page_break"> </div>
<table class="scorecard_table">
<!-- <table class="scorecard_table">
<tr><th class="thlargefont">Neighbourhood Check Details</th></tr>
</table>
<table class="scorecard_table">
<table class="scorecard_table"> -->
<!-- <thead>
<?php echo $pd_section_data[12]['display_data']['header_row']?>
<?php //echo $pd_section_data[12]['display_data']['header_row']?>
</thead> -->
<tbody>
<?php echo $pd_section_data[17]['display_data']['first_row']?>
<?php echo $pd_section_data[17]['display_data']['second_row']?>
<?php echo $pd_section_data[17]['display_data']['third_row']?>
<?php echo $pd_section_data[17]['display_data']['owner_row']?>
<?php echo $pd_section_data[17]['display_data']['five_row']?>
<?php if($pd_section_data[17]['neighbourhood_remarks']) { echo $pd_section_data[17]['display_data']['fourth_row']; }?>
<!-- <?php echo $pd_section_data[17]['display_data']['siz_row']?>
<?php echo $pd_section_data[17]['display_data']['seven_row']?> -->
</tbody>
<!-- <tbody> -->
<?php //echo $pd_section_data[17]['display_data']['first_row']?>
<?php //echo $pd_section_data[17]['display_data']['second_row']?>
<?php //echo $pd_section_data[17]['display_data']['third_row']?>
<?php //echo $pd_section_data[17]['display_data']['owner_row']?>
<?php //echo $pd_section_data[17]['display_data']['five_row']?>
<?php //if($pd_section_data[17]['neighbourhood_remarks']) { echo $pd_section_data[17]['display_data']['fourth_row']; }?>
<!-- <?php //echo $pd_section_data[17]['display_data']['siz_row']?>
<?php //echo $pd_section_data[17]['display_data']['seven_row']?> -->
<!-- </tbody> -->
</table>
<!-- </table> -->
<br>