Merge branch 'master' of https://bitbucket.org/venbaittech/sparqapi
This commit is contained in:
commit
8b7e6c3de6
@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto
|
||||
// define login route name for token verification
|
||||
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
|
||||
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors
|
||||
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListOfLenders'); // no errors
|
||||
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getQuestionsForTemplateCreation'); // no errors
|
||||
|
||||
/*********************AWS resources Constants*************************************************/
|
||||
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');
|
||||
@ -117,6 +117,9 @@ defined('DRAFT') OR define('DRAFT','17');
|
||||
/*******************End Of Constants PD status**************************/
|
||||
|
||||
|
||||
/*******************Define Constants for Table Names and Primarykeys**************************/
|
||||
defined('PDTEAM_CTY_PRODUCT_CS_COMBINATIONS') OR define('PDTEAM_CTY_PRODUCT_CS_COMBINATIONS','PDTEAM_CTY_PRODUCT_CS_COMBINATIONS');
|
||||
|
||||
/*******************Define Constants for Table Names and Primarykeys**************************/
|
||||
|
||||
defined('INDUSTRYCLASSIFICATION') OR define('INDUSTRYCLASSIFICATION','m_industry_classification');
|
||||
@ -220,7 +223,7 @@ defined('QUESTIONANSWERS') OR define('QUESTIONANSWERS','m_question_answers');
|
||||
defined('QUESTIONANSWERSID') OR define('QUESTIONANSWERSID','question_answer_id');
|
||||
|
||||
defined('QUESTIONCATEGORY') OR define('QUESTIONCATEGORY','m_question_category');
|
||||
defined('QUESTIONCATEGORYID') OR define('QUESTIONCATEGORYID','question_categroy_id');
|
||||
defined('QUESTIONCATEGORYID') OR define('QUESTIONCATEGORYID','question_category_id');
|
||||
|
||||
defined('TEMPLATE') OR define('TEMPLATE','m_template');
|
||||
defined('TEMPLATEID') OR define('TEMPLATEID','template_id');
|
||||
@ -228,8 +231,8 @@ defined('TEMPLATEID') OR define('TEMPLATEID','template_id');
|
||||
defined('LENDERTEMPLATE') OR define('LENDERTEMPLATE','m_template_lender_map');
|
||||
defined('LENDERTEMPLATEID') OR define('LENDERTEMPLATEID','template_lender_map_id');
|
||||
|
||||
defined('TEMPLATECATAGORYWEIGHTAGE') OR define('TEMPLATECATAGORYWEIGHTAGE','m_template_catagory_weightage');
|
||||
defined('TEMPLATECATAGORYWEIGHTAGEID') OR define('TEMPLATECATAGORYWEIGHTAGEID','template_catagory_weightage_id');
|
||||
defined('TEMPLATECATEGORYWEIGHTAGE') OR define('TEMPLATECATEGORYWEIGHTAGE','m_template_category_weightage');
|
||||
defined('TEMPLATECATEGORYWEIGHTAGEID') OR define('TEMPLATECATEGORYWEIGHTAGEID','template_category_weightage_id');
|
||||
|
||||
defined('TEMPLATEQUESTION') OR define('TEMPLATEQUESTION','m_template_question');
|
||||
defined('TEMPLATEQUESTIONID') OR define('TEMPLATEQUESTIONID','template_question_id');
|
||||
@ -306,5 +309,8 @@ defined('ENTITYPDPRICEINFOID') OR define('ENTITYPDPRICEINFOID','entity_pdprice_i
|
||||
defined('VENDORCITYMAP') OR define('VENDORCITYMAP','m_vendor_city_map');
|
||||
defined('VENDORCITYMAPID') OR define('VENDORCITYMAPID','vendor_city_map_id');
|
||||
|
||||
defined('PDCATEGORYWEIGHTAGE') OR define('PDCATEGORYWEIGHTAGE','t_pd_category_weightage');
|
||||
defined('PDCATEGORYWEIGHTAGEID') OR define('PDCATEGORYWEIGHTAGEID','pd_category_weightage_id');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -70,8 +70,8 @@ $route['getPDNotificationsList'] = 'Common_Masters_Controller/getPDNotifications
|
||||
$route['getListOfPDTeam'] = 'Common_Masters_Controller/getListOfPDTeam';
|
||||
$route['getPdManage'] = 'Common_Masters_Controller/getPdManage';
|
||||
$route['savePdTeamManage'] = 'Common_Masters_Controller/savePdTeamManage';
|
||||
|
||||
$route['getListOfPDTeamMap'] = 'Common_Masters_Controller/getListOfPDTeamMap';
|
||||
$route['getListOfPDTeamCityMapping'] = 'Common_Masters_Controller/getListOfPDTeamCityMapping';
|
||||
//$route['getListOfPDTeamMap'] = 'Common_Masters_Controller/getListOfPDTeamMap';
|
||||
$route['getListOfMaster'] = 'Common_Masters_Controller/getListOfMaster';
|
||||
$route['saveMaster'] = 'Common_Masters_Controller/saveMaster';
|
||||
$route['saveBranch'] = 'Common_Masters_Controller/saveBranch';
|
||||
@ -102,6 +102,8 @@ $route['getTemplateMaster'] = 'Template_Management_Controller/getTemplateMaster'
|
||||
$route['getTemplateLenders'] = 'Template_Management_Controller/getTemplateLenders';
|
||||
$route['getTemplateCategories'] = 'Template_Management_Controller/getTemplateCategories';
|
||||
$route['getTemplateQuestionAnswers'] = 'Template_Management_Controller/getTemplateQuestionAnswers';
|
||||
$route['getListOfCategories'] = 'Template_Management_Controller/getListOfCategories';
|
||||
$route['getQuestionsForTemplateCreation'] = 'Template_Management_Controller/getQuestionsForTemplateCreation';
|
||||
|
||||
//QUESTION MANAGEMENT
|
||||
$route['(listAllQuestions/:any)'] = 'Question_Management_Controller/listAllQuestions/';
|
||||
@ -130,4 +132,6 @@ $route['updatePDApplicants'] = 'PD_Controller/updatePDApplicants';
|
||||
$route['allocatePD'] = 'PD_Controller/allocatePD';
|
||||
$route['schdulePD'] = 'PD_Controller/schdulePD';
|
||||
$route['getListPDOfficers'] = 'PD_Controller/getListPDOfficers';
|
||||
$route['loadFullTemplate'] = 'PD_Controller/loadFullTemplate';
|
||||
$route['allbase'] = 'PD_Controller/base';
|
||||
|
||||
|
||||
@ -351,7 +351,8 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
public function savePdTeamManage_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
// print_r($records);die;
|
||||
// print_r($records);
|
||||
$result = array();
|
||||
if(!empty($records))
|
||||
{
|
||||
foreach($records['teamDetails'] as $users)
|
||||
@ -362,9 +363,12 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
$record['fk_updatedby'] = $records['fk_updatedby'];
|
||||
$where_condition_array = array('fk_user_id' => $record['fk_user_id']);
|
||||
$result = $this->Common_Masters_Model->updateRecords($record,PDOFFICIERSDETAILS,$where_condition_array);
|
||||
//print_r($result);
|
||||
}
|
||||
}
|
||||
if(count($result) > 0)
|
||||
|
||||
|
||||
if(count($result))
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
@ -456,24 +460,66 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
|
||||
$where_condition_array = array(PDTEAMID => $records[PDTEAMID]);
|
||||
|
||||
$pdTeamMaster = array('team_name'=>$records['team_name'],'updatedon'=>$records['updatedon'],'fk_updatedby'=>$records['fk_updatedby']);
|
||||
//$pdTeamMaster = array('team_name'=>$records['team_name'],'updatedon'=>$records['updatedon'],'fk_updatedby'=>$records['fk_updatedby']);
|
||||
//pdteam_id, team_name, createdon, fk_createdby, updatedon, fk_updatedby, isactive
|
||||
$pdTeamMaster = array('team_name'=>$records['team_name'],
|
||||
'updatedon'=>$records['updatedon'],
|
||||
'fk_updatedby'=>$records['fk_updatedby'],
|
||||
'fk_lender_id'=>$records['fk_lender']);
|
||||
|
||||
$result = $this->Common_Masters_Model->updateRecords($pdTeamMaster,PDTEAM,$where_condition_array);
|
||||
//print_r($pdTeamMaster);
|
||||
|
||||
if($result == true){
|
||||
$root_array = $records['temp_array'];
|
||||
if(!empty($root_array)){
|
||||
foreach($root_array as $key => $value){
|
||||
|
||||
$pdTeamChild = array(
|
||||
'fk_city_id'=>$value['cityid']['city_id'],
|
||||
'fk_team_id'=>$records['pdteam_id'],
|
||||
'team_type' => 1,
|
||||
'fk_lender_id' =>$value['lenderid']['entity_id']);
|
||||
//$root_array = $records['temp_array'];
|
||||
$root_array_city = $records['fk_city'];
|
||||
$root_array_product = $records['fk_product'];
|
||||
$root_array_customersegment = $records['fk_customer_segment'];
|
||||
|
||||
$this->Common_Masters_Model->saveRecords($pdTeamChild,PDTEAMMAP);
|
||||
}}
|
||||
if(!empty($root_array_city)){
|
||||
foreach($root_array_city as $key => $value){
|
||||
|
||||
$pdTeamForCity= array(
|
||||
'fk_city_id'=>$value,
|
||||
'fk_pdteam_id'=>$result);
|
||||
$this->Common_Masters_Model->saveRecords($pdTeamForCity,PDTEAMCITY);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($root_array_product)){
|
||||
foreach($root_array_product as $key => $value){
|
||||
|
||||
$pdTeamForProduct = array(
|
||||
'fk_product_id'=>$value,
|
||||
'fk_pdteam_id'=>$result);
|
||||
|
||||
$this->Common_Masters_Model->saveRecords($pdTeamForProduct,PDTEAMPRODUCT);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($root_array_customersegment)){
|
||||
foreach($root_array_customersegment as $key => $value){
|
||||
|
||||
$pdTeamForCS = array(
|
||||
'fk_cs_id'=>$value,
|
||||
'fk_pdteam_id'=>$result);
|
||||
|
||||
$this->Common_Masters_Model->saveRecords($pdTeamForCS,PDTEAMCUSTOMERSEGMENT);
|
||||
}
|
||||
}
|
||||
|
||||
// if(!empty($root_array)){
|
||||
// foreach($root_array as $key => $value){
|
||||
|
||||
// $pdTeamChild = array(
|
||||
// 'fk_city_id'=>$value['cityid']['city_id'],
|
||||
// 'fk_team_id'=>$records['pdteam_id'],
|
||||
// 'team_type' => 1,
|
||||
// 'fk_lender_id' =>$value['lenderid']['entity_id']);
|
||||
|
||||
// $this->Common_Masters_Model->saveRecords($pdTeamChild,PDTEAMMAP);
|
||||
// }}
|
||||
|
||||
}
|
||||
|
||||
@ -496,23 +542,59 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
else // Insert Record
|
||||
{
|
||||
|
||||
$pdTeamMaster = array('team_name'=>$records['team_name'],'fk_createdby'=>$records['fk_createdby'],'createdon'=>$records['createdon']);
|
||||
//$pdTeamMaster = array('team_name'=>$records['team_name'],'fk_createdby'=>$records['fk_createdby'],'createdon'=>$records['createdon']);
|
||||
$pdTeamMaster = array('team_name'=>$records['team_name'],
|
||||
'fk_createdby'=>$records['fk_createdby'],
|
||||
'createdon'=>$records['createdon'],
|
||||
'fk_lender_id'=>$records['fk_lender'],
|
||||
'team_type' => 1
|
||||
);
|
||||
|
||||
$result = $this->Common_Masters_Model->saveRecords($pdTeamMaster,PDTEAM);
|
||||
|
||||
if(!empty($result)){
|
||||
|
||||
$root_array = $records['temp_array'];
|
||||
//$root_array = $records['temp_array'];
|
||||
$root_array_city = $records['fk_city'];
|
||||
$root_array_product = $records['fk_product'];
|
||||
$root_array_customersegment = $records['fk_customer_segment'];
|
||||
|
||||
foreach($root_array as $key => $value){
|
||||
// foreach($root_array as $key => $value){
|
||||
|
||||
$pdTeamChild = array(
|
||||
'fk_city_id'=>$value['cityid']['city_id'],
|
||||
'fk_team_id'=>$result,
|
||||
'team_type' => 1,
|
||||
'fk_lender_id' =>$value['lenderid']['entity_id']);
|
||||
// $pdTeamChild = array(
|
||||
// 'fk_city_id'=>$value['cityid']['city_id'],
|
||||
// 'fk_team_id'=>$result,
|
||||
// 'team_type' => 1,
|
||||
// 'fk_lender_id' =>$value['lenderid']['entity_id']);
|
||||
|
||||
$this->Common_Masters_Model->saveRecords($pdTeamChild,PDTEAMMAP);
|
||||
// $this->Common_Masters_Model->saveRecords($pdTeamChild,PDTEAMMAP);
|
||||
// }
|
||||
|
||||
foreach($root_array_city as $key => $value){
|
||||
|
||||
$pdTeamForCity= array(
|
||||
'fk_city_id'=>$value,
|
||||
'fk_pdteam_id'=>$result);
|
||||
$this->Common_Masters_Model->saveRecords($pdTeamForCity,PDTEAMCITY);
|
||||
|
||||
}
|
||||
|
||||
foreach($root_array_product as $key => $value){
|
||||
|
||||
$pdTeamForProduct = array(
|
||||
'fk_product_id'=>$value,
|
||||
'fk_pdteam_id'=>$result);
|
||||
|
||||
$this->Common_Masters_Model->saveRecords($pdTeamForProduct,PDTEAMPRODUCT);
|
||||
}
|
||||
|
||||
foreach($root_array_customersegment as $key => $value){
|
||||
|
||||
$pdTeamForCS = array(
|
||||
'fk_cs_id'=>$value,
|
||||
'fk_pdteam_id'=>$result);
|
||||
|
||||
$this->Common_Masters_Model->saveRecords($pdTeamForCS,PDTEAMCUSTOMERSEGMENT);
|
||||
}
|
||||
|
||||
}
|
||||
@ -611,26 +693,151 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
/* For Get PD Team Details (Master Table info)*/
|
||||
public function getListOfPDTeam_get()
|
||||
{
|
||||
$result = $this->Common_Masters_Model->pdteamlist();
|
||||
// public function getListOfPDTeam_get()
|
||||
// {
|
||||
// $result = $this->Common_Masters_Model->pdteamlist();
|
||||
|
||||
if(count($result) > 0)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
// if(count($result) > 0)
|
||||
// {
|
||||
// $data['dataStatus'] = true;
|
||||
// $data['status'] = REST_Controller::HTTP_OK;
|
||||
// $data['records'] = $result;
|
||||
// $this->response($data,REST_Controller::HTTP_OK);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $data['dataStatus'] = false;
|
||||
// $data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
// $this->response($data,REST_Controller::HTTP_OK);
|
||||
// }
|
||||
// }
|
||||
/* End Of Get PD Team Details (Master Table info)*/
|
||||
|
||||
public function getListOfPDTeam_post(){
|
||||
|
||||
if(!empty($this->post())){
|
||||
$PK = $this->post('primary_key') ;
|
||||
}
|
||||
else{
|
||||
$PK = '';
|
||||
}
|
||||
|
||||
$columns = array('m_entity.full_name as lender_name','PDTEAM.*');
|
||||
$table = PDTEAM.' as PDTEAM';
|
||||
$joins = array(
|
||||
array(
|
||||
'table' => 'm_entity',
|
||||
'condition' => 'PDTEAM.fk_lender_id = m_entity.entity_id',
|
||||
'jointype' => 'INNER'
|
||||
)
|
||||
);
|
||||
|
||||
if($PK != '')
|
||||
{
|
||||
$where_condition_array = array('PDTEAM.pdteam_id'=>$PK);
|
||||
$result = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
||||
|
||||
if(count($result) !=0){
|
||||
foreach($result as $index=>$res){
|
||||
|
||||
/**CUSTOMERSEGMENT */
|
||||
$columns = array("CUSTOMERSEGMENT.*");
|
||||
$table = PDTEAMCUSTOMERSEGMENT. ' as PDTEAMCUSTOMERSEGMENT';
|
||||
$joins = array(
|
||||
array(
|
||||
'table'=>CUSTOMERSEGMENT.' as CUSTOMERSEGMENT',
|
||||
'condition'=>'PDTEAMCUSTOMERSEGMENT.fk_cs_id = CUSTOMERSEGMENT.customer_segment_id and CUSTOMERSEGMENT.isactive =1',
|
||||
'jointype'=>'JOIN'),
|
||||
);
|
||||
$where_condition_array = array('PDTEAMCUSTOMERSEGMENT.fk_pdteam_id'=>$PK);
|
||||
$result[$index]['CUSTOMERSEGMENT'] = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
||||
|
||||
/**CITY */
|
||||
$columns = array("CITY.*");
|
||||
$table = PDTEAMCITY.' as PDTEAMCITY';
|
||||
$joins = array(
|
||||
array('table'=>CITY.' as CITY',
|
||||
'condition'=>'PDTEAMCITY.fk_city_id = CITY.city_id and CITY.isactive = 1',
|
||||
'jointype'=>'JOIN')
|
||||
);
|
||||
$where_condition_array = array('PDTEAMCITY.fk_pdteam_id'=>$PK);
|
||||
$result[$index]['CITYMAP'] = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
||||
|
||||
/**PRODUCT */
|
||||
$columns = array("PRODUCTS.*");
|
||||
$table = PDTEAMPRODUCT.' as PDTEAMPRODUCT';
|
||||
$joins = array(
|
||||
array('table'=>PRODUCTS.' as PRODUCTS',
|
||||
'condition'=>'PDTEAMPRODUCT.fk_product_id = PRODUCTS.product_id and PRODUCTS.isactive =1',
|
||||
'jointype'=>'JOIN')
|
||||
|
||||
);
|
||||
$where_condition_array = array('PDTEAMPRODUCT.fk_pdteam_id'=>$PK);
|
||||
$result[$index]['PRODUCTS'] = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
$result = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins);
|
||||
}
|
||||
|
||||
if(count($result) > 0){
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** For validation purpose To Check duplication for Team*/
|
||||
public function getListOfPDTeamCityMapping_get()
|
||||
{
|
||||
|
||||
$columns = array('m_entity.full_name as lender_name','PDTEAM.*');
|
||||
$table = PDTEAM.' as PDTEAM';
|
||||
$joins = array(
|
||||
array(
|
||||
'table' => 'm_entity',
|
||||
'condition' => 'PDTEAM.fk_lender_id = m_entity.entity_id',
|
||||
'jointype' => 'INNER'
|
||||
)
|
||||
);
|
||||
|
||||
$result = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins);
|
||||
|
||||
if(count($result) !=0){
|
||||
foreach($result as $index=>$res){
|
||||
|
||||
/**CITY */
|
||||
$columns = array("CITY.*");
|
||||
$table = PDTEAMCITY.' as PDTEAMCITY';
|
||||
$joins = array(
|
||||
array('table'=>CITY.' as CITY','condition'=>'PDTEAMCITY.fk_city_id = CITY.city_id and CITY.isactive = 1','jointype'=>'JOIN')
|
||||
);
|
||||
$where_condition_array = array('PDTEAMCITY.fk_pdteam_id'=>$res['pdteam_id']);
|
||||
$result[$index]['CITYMAP'] = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
||||
}
|
||||
|
||||
}
|
||||
if(count($result) > 0){
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
/* For Get PD Team Mapping Details (Child Table info)*/
|
||||
public function getListOfPDTeamMap_post(){
|
||||
|
||||
@ -783,4 +990,32 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
/* End of Update PD Notification Details*/
|
||||
}
|
||||
public function getListOfPdTeamCityMapping(){
|
||||
$records = $this->post('records');
|
||||
//$count = 0;
|
||||
|
||||
|
||||
foreach( $records as $record){
|
||||
$where_condition_array = array(PDNOTIFICATIONID => $record[PDNOTIFICATIONID]);
|
||||
$result = $this->Common_Masters_Model->updateRecords($record,PDNOTIFICATION,$where_condition_array);
|
||||
// if($result == 1)
|
||||
// {
|
||||
// $count++;
|
||||
// }
|
||||
}
|
||||
if($result)
|
||||
{
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,7 +22,53 @@ class PD_Controller extends REST_Controller {
|
||||
$this->load->library('AWS_SNS');
|
||||
|
||||
}
|
||||
/***********************Get get List Of Lenders Details for PD Trigger Page************************/
|
||||
|
||||
|
||||
public function base_get()
|
||||
{
|
||||
$base64_img = "data:image/gif;base64,R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wMFNGQLYmID4dGPvd3UBAQJmTkP+8vH9QUK+vr8ZWSHpzcJMmILdwcLOGcHRQUHxwcK9PT9DQ0O/v70w5MLypoG8wKOuwsP/g4P/Q0IcwKEswKMl8aJ9fX2xjdOtGRs/Pz+Dg4GImIP8gIH0sKEAwKKmTiKZ8aB/f39Wsl+LFt8dgUE9PT5x5aHBwcP+AgP+WltdgYMyZfyywz78AAAAAAAD///8AAP9mZv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAKgALAAAAAA9AEQAAAj/AFEJHEiwoMGDCBMqXMiwocAbBww4nEhxoYkUpzJGrMixogkfGUNqlNixJEIDB0SqHGmyJSojM1bKZOmyop0gM3Oe2liTISKMOoPy7GnwY9CjIYcSRYm0aVKSLmE6nfq05QycVLPuhDrxBlCtYJUqNAq2bNWEBj6ZXRuyxZyDRtqwnXvkhACDV+euTeJm1Ki7A73qNWtFiF+/gA95Gly2CJLDhwEHMOUAAuOpLYDEgBxZ4GRTlC1fDnpkM+fOqD6DDj1aZpITp0dtGCDhr+fVuCu3zlg49ijaokTZTo27uG7Gjn2P+hI8+PDPERoUB318bWbfAJ5sUNFcuGRTYUqV/3ogfXp1rWlMc6awJjiAAd2fm4ogXjz56aypOoIde4OE5u/F9x199dlXnnGiHZWEYbGpsAEA3QXYnHwEFliKAgswgJ8LPeiUXGwedCAKABACCN+EA1pYIIYaFlcDhytd51sGAJbo3onOpajiihlO92KHGaUXGwWjUBChjSPiWJuOO/LYIm4v1tXfE6J4gCSJEZ7YgRYUNrkji9P55sF/ogxw5ZkSqIDaZBV6aSGYq/lGZplndkckZ98xoICbTcIJGQAZcNmdmUc210hs35nCyJ58fgmIKX5RQGOZowxaZwYA+JaoKQwswGijBV4C6SiTUmpphMspJx9unX4KaimjDv9aaXOEBteBqmuuxgEHoLX6Kqx+yXqqBANsgCtit4FWQAEkrNbpq7HSOmtwag5w57GrmlJBASEU18ADjUYb3ADTinIttsgSB1oJFfA63bduimuqKB1keqwUhoCSK374wbujvOSu4QG6UvxBRydcpKsav++Ca6G8A6Pr1x2kVMyHwsVxUALDq/krnrhPSOzXG1lUTIoffqGR7Goi2MAxbv6O2kEG56I7CSlRsEFKFVyovDJoIRTg7sugNRDGqCJzJgcKE0ywc0ELm6KBCCJo8DIPFeCWNGcyqNFE06ToAfV0HBRgxsvLThHn1oddQMrXj5DyAQgjEHSAJMWZwS3HPxT/QMbabI/iBCliMLEJKX2EEkomBAUCxRi42VDADxyTYDVogV+wSChqmKxEKCDAYFDFj4OmwbY7bDGdBhtrnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==";
|
||||
|
||||
$output_file = APPPATH."/docs/temp_base64_image.png";
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
$temp_file_name = $randomString.date('Y-m-d-H:m:s');
|
||||
|
||||
|
||||
$ifp = fopen( $output_file, 'wb' );
|
||||
|
||||
// split the string on commas
|
||||
// $data[ 0 ] == "data:image/png;base64"
|
||||
// $data[ 1 ] == <actual base64 string>
|
||||
$data = explode( ',', $base64_img );
|
||||
print_r($data);
|
||||
// we could add validation here with ensuring count( $data ) > 1
|
||||
fwrite( $ifp, base64_decode( $data[ 1 ] ) );
|
||||
|
||||
// clean up the file resource
|
||||
fclose( $ifp );
|
||||
|
||||
print_r($output_file);
|
||||
|
||||
$tempdoc = $output_file;
|
||||
$tempdocname = $temp_file_name.'.png';
|
||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.'1';
|
||||
$key = 'pd'.'1'.'/'.$tempdocname ;
|
||||
$sourcefile = $tempdoc;
|
||||
|
||||
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
|
||||
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||
print_r($s3result);
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
// $record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>$title,'pd_document_name'=>$tempdocname);
|
||||
// $this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
|
||||
}
|
||||
}
|
||||
/***********************Get get List Of Lenders Details for PD Trigger Page************************/
|
||||
|
||||
public function getListOfLenders_get()
|
||||
{
|
||||
@ -177,12 +223,7 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
|
||||
/********For Save New PD while Trigger****/
|
||||
/*
|
||||
sample data
|
||||
{
|
||||
"pd_details":{ "fk_lender_id": "1", "lender_applicant_id":"12458","fk_product_id":"2","fk_subproduct_id":"1","fk_pd_type":"2", "pd_status":"2","pd_specific_clarification":"nothing","createdon":"2017","fk_createdby":"2","fk_pd_allocation_type":"3","fk_pd_allocated_to":"1","fk_pd_template_id":"2","fk_customer_segment":"1","pd_officier_final_judgement":"54561","pd_agency_id":"1","loan_amount":"1589655","addressline1":"1", "addressline2":"2", "addressline3":"3", "fk_city":"1", "fk_state":"2", "pincode":"966852"}
|
||||
}
|
||||
*/
|
||||
|
||||
public function triggerNewPD_post()
|
||||
{
|
||||
|
||||
@ -191,26 +232,30 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
$pd_applicant_details = json_decode($this->post('pd_applicant_details'),true);
|
||||
$pd_document_titles = "";
|
||||
$pd_document_from_mobile = "";
|
||||
if($this->post('pd_document_titles')){ $pd_document_titles = json_decode($this->post('pd_document_titles'),true); }
|
||||
|
||||
if($this->post('pd_document_from_mobile')){ $pd_document_from_mobile = json_decode($this->post('pd_document_from_mobile'),true); }
|
||||
|
||||
$pd_documents = array();
|
||||
|
||||
$count = 0;
|
||||
/***********************CHOOSE PD TEMPALATE*********************/
|
||||
|
||||
$fields = array('fk_template_id');
|
||||
|
||||
$where_condition_array = array('fk_lender_id'=>1 ,'fk_product_id'=> 1,'fk_customer_segment'=> 1,'isactive' => 1);
|
||||
|
||||
$table = LENDERTEMPLATE;
|
||||
|
||||
$choosed_template_id = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,$table);
|
||||
|
||||
if(count($choosed_template_id))
|
||||
{
|
||||
$pd_details['fk_pd_template_id'] = $choosed_template_id[0]['fk_template_id'];
|
||||
}
|
||||
|
||||
if($pd_details['pd_status'] == TRIGGERED)
|
||||
{
|
||||
$fields = array('fk_template_id');
|
||||
|
||||
$where_condition_array = array('fk_lender_id'=>1 ,'fk_product_id'=> 1,'fk_customer_segment'=> 1,'isactive' => 1);
|
||||
|
||||
$table = LENDERTEMPLATE;
|
||||
|
||||
$choosed_template_id = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,$table);
|
||||
|
||||
if(count($choosed_template_id))
|
||||
{
|
||||
$pd_details['fk_pd_template_id'] = $choosed_template_id[0]['fk_template_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/***********************PD ALLOCATION TYPE PROCESS **********/
|
||||
|
||||
@ -276,14 +321,14 @@ class PD_Controller extends REST_Controller {
|
||||
/***********************END OF PD ALLOCATION TYPE AND PROCESS***********/
|
||||
|
||||
$pd_details['pd_date_of_initiation'] = date("Y-m-d H:i:s");
|
||||
if($pd_details['pd_status'] == "" || $pd_details['pd_status'] == null)
|
||||
{
|
||||
$pd_details['pd_status'] = DRAFT;
|
||||
}
|
||||
// if($pd_details['pd_status'] == "" || $pd_details['pd_status'] == null)
|
||||
// {
|
||||
// $pd_details['pd_status'] = DRAFT;
|
||||
// }
|
||||
$pd_id = $this->PD_Model->saveRecords($pd_details,PDTRIGGER);
|
||||
|
||||
|
||||
/***********************PD DOCUMENTS UPLOAD SECTION ***********/
|
||||
/***********************PD DOCUMENTS UPLOAD SECTION FROM WEB***********/
|
||||
if($pd_id != null || $pd_id != '')
|
||||
{
|
||||
|
||||
@ -312,7 +357,7 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/***********************END OF PD DOCUMENTS UPLOAD SECTION ***********/
|
||||
/***********************END OF PD DOCUMENTS UPLOAD SECTION FROM WEB***********/
|
||||
if($pd_id != null || $pd_id != '')
|
||||
{
|
||||
|
||||
@ -327,11 +372,56 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
// update into pd officer details
|
||||
if($pd_details['fk_pd_allocated_to'] != null || $pd_details['fk_pd_allocated_to'] != '')
|
||||
/***********************PD DOCUMENTS(base64 type) UPLOAD SECTION FROM MOBILE***********/
|
||||
if($pd_id != null || $pd_id != '')
|
||||
{
|
||||
$this->PD_Model->updatePDofficersDetail($pd_details['fk_pd_allocated_to']);
|
||||
|
||||
if(!empty($pd_document_from_mobile))
|
||||
{
|
||||
|
||||
foreach($pd_document_from_mobile as $iter => $doc)
|
||||
{
|
||||
$temp_base64_string = $doc['image'];
|
||||
$title = $doc['Name'];
|
||||
$output_file = APPPATH."/docs/temp_base64_image.png";
|
||||
|
||||
//Generate Random File Name
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
$temp_file_name = $randomString.date('Y-m-d-H:m:s').'.png';
|
||||
|
||||
|
||||
$ifp = fopen( $output_file, 'wb' );
|
||||
$temp_data = explode( ',', $temp_base64_string );
|
||||
fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) );
|
||||
fclose( $ifp );
|
||||
$tempdoc = $output_file;
|
||||
$tempdocname = $temp_file_name;
|
||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details['fk_lender_id'];
|
||||
$key = 'pd'.$pd_id.'/'.$tempdocname ;
|
||||
$sourcefile = $tempdoc;
|
||||
|
||||
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
|
||||
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
$record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>$title,'pd_document_name'=>$tempdocname);
|
||||
$this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************END OF PD DOCUMENTS(base64 type) UPLOAD SECTION FROM MOBILE***********/
|
||||
|
||||
|
||||
if($pd_id != null || $pd_id != '' && $count != 0)
|
||||
{
|
||||
// CALL pdnotification Helper function to send pd alerts @ params pdid,pdstatus
|
||||
@ -363,8 +453,14 @@ class PD_Controller extends REST_Controller {
|
||||
$where_condition_array = array('pd_id' => $pd_details['pd_id']);
|
||||
$pd_id_modified = $this->PD_Model->updateRecords($pd_details,PDTRIGGER,$where_condition_array);
|
||||
|
||||
if($records['pd_status'] == TRIGGERED)
|
||||
{
|
||||
// Create entries on `t_pd_category_weightage` table from Template Category weightage
|
||||
}
|
||||
|
||||
if($pd_id_modified != null || $pd_id_modified != '' && $count != 0)
|
||||
{
|
||||
PDALERTS::pdnotification($pd_id);
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = true;
|
||||
@ -394,7 +490,7 @@ class PD_Controller extends REST_Controller {
|
||||
{
|
||||
if($pd_applicant_detail['pd_co_applicant_id'] != null || $pd_applicant_detail['pd_co_applicant_id'] != "")
|
||||
{
|
||||
$pd_id = $pd_applicant_detail['fk_pd_id'];
|
||||
//$pd_id = $pd_applicant_detail['fk_pd_id'];
|
||||
$where_condition_array = array('pd_co_applicant_id' => $pd_applicant_detail['pd_co_applicant_id']);
|
||||
$co_applicant_id = $this->PD_Model->updateRecords($pd_applicant_detail,PDAPPLICANTSDETAILS,$where_condition_array);
|
||||
if($co_applicant_id != null || $co_applicant_id != '')
|
||||
@ -404,7 +500,7 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
else
|
||||
{
|
||||
$pd_applicant_detail['fk_pd_id'] = $pd_id;
|
||||
//$pd_applicant_detail['fk_pd_id'] = $pd_id;
|
||||
$co_applicant_id = $this->PD_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS);
|
||||
if($co_applicant_id != null || $co_applicant_id != '')
|
||||
{
|
||||
@ -590,16 +686,66 @@ class PD_Controller extends REST_Controller {
|
||||
*/
|
||||
public function schdulePD_post()
|
||||
{
|
||||
|
||||
$records['fk_pd_id'] = 40;
|
||||
$fields = array('fk_pd_template_id');
|
||||
$where_condition_array = array('pd_id'=>$records['fk_pd_id']);
|
||||
$res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER);
|
||||
//print_r($res_array);
|
||||
if(count($res_array))
|
||||
{
|
||||
$template_id = $res_array[0]['fk_pd_template_id'];
|
||||
echo $template_id;
|
||||
$fields = array('fk_question_category_id','weightage');
|
||||
$where_condition_array = array('fk_template_id'=>$template_id);
|
||||
$res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATECATEGORYWEIGHTAGE);
|
||||
//print_r($res_array);
|
||||
|
||||
foreach($res_array as $key => $category)
|
||||
{
|
||||
$temp_data = array('fk_pd_id'=>$records['fk_pd_id'],'fk_category_id'=>$category['fk_question_category_id'],'pd_category_weightage'=>$category['weightage']);
|
||||
$this->PD_Model->saveRecords($temp_data,PDCATEGORYWEIGHTAGE);
|
||||
}
|
||||
}
|
||||
//die();
|
||||
$records = $this->post('records');
|
||||
if($records['schedule_time'] != "" || $records['schedule_time'] != null)
|
||||
{
|
||||
$id = $this->PD_Model->saveRecords($records,PDSCHEDULE);
|
||||
if($id != '' || $id != null)
|
||||
{
|
||||
//$id = $this->PD_Model->saveRecords($records,PDSCHEDULE);
|
||||
|
||||
$where_condition_array = array('pd_id' => $records['fk_pd_id']);
|
||||
$temp_array = array('pd_status' => SCHEDULED,'fk_updatedby'=>$records['fk_scheduled_by'],'updatedon'=>$records['createdon']);
|
||||
$temp_array = array('pd_status' => SCHEDULED,'fk_updatedby'=>$records['fk_scheduled_by'],'updatedon'=>$records['createdon'],'scheduled_on'=>$records['schedule_time']);
|
||||
$pd_id_modified = $this->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array);
|
||||
|
||||
/******* Code Snippt for Save Template Category Weightage info to PD category Info*/
|
||||
$fields = array('fk_pd_template_id');
|
||||
$where_condition_array = array('pd_id'=>$records['fk_pd_id']);
|
||||
$res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER);
|
||||
|
||||
if(count($res_array))
|
||||
{
|
||||
$fields = array('fk_pd_template_id');
|
||||
$where_condition_array = array('pd_id'=>$records['fk_pd_id']);
|
||||
$res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER);
|
||||
|
||||
if(count($res_array))
|
||||
{
|
||||
$template_id = $res_array[0]['fk_pd_template_id'];
|
||||
|
||||
$fields = array('fk_question_category_id','weightage');
|
||||
$where_condition_array = array('fk_template_id'=>$template_id);
|
||||
$template_categories = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATECATEGORYWEIGHTAGE);
|
||||
|
||||
foreach($template_categories as $key => $category)
|
||||
{
|
||||
$temp_data = array('fk_pd_id'=>$records['fk_pd_id'],'fk_category_id'=>$category['fk_question_category_id'],'pd_category_weightage'=>$category['weightage']);
|
||||
$this->PD_Model->saveRecords($temp_data,PDCATEGORYWEIGHTAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
/******* End of Code Snippt Save Template Category Weightage info to PD category Info*/
|
||||
|
||||
|
||||
if($pd_id_modified != "" || $pd_id_modified != null)
|
||||
{
|
||||
PDALERTS::pdnotification($records['fk_pd_id']);
|
||||
@ -615,7 +761,7 @@ class PD_Controller extends REST_Controller {
|
||||
$data['msg'] = 'Not Updated! Try Later';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -634,12 +780,13 @@ class PD_Controller extends REST_Controller {
|
||||
$where_condition_array = array('pd_id'=>$pdid);
|
||||
$res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER);
|
||||
|
||||
//2.Get Team Map Details based on step 1
|
||||
//2.Get Team ID based on Lender ID
|
||||
if(count($res_array))
|
||||
{
|
||||
$where_condition_array = array('fk_city_id' => $res_array[0]['fk_city'],'fk_lender_id' => $res_array[0]['fk_lender_id']);
|
||||
$temp_city_id = $this->PD_Model->selectRecords(PDTEAMMAP,$where_condition_array,$limit=0,$offset=0);
|
||||
|
||||
//$where_condition_array = array('lender_id' => $res_array[0]['fk_lender_id'],'city_id' =>$res_array[0]['fk_city'] ,'cs_id' =>$res_array[0]['fk_customer_segment'] ,'product_id' =>$res_array[0]['fk_product_id']);
|
||||
$where_condition_array = array('lender_id' => 2,'city_id' => 17 ,'cs_id' => 1 ,'product_id' => 1);
|
||||
$temp_city_id = $this->PD_Model->selectRecords(PDTEAM_CTY_PRODUCT_CS_COMBINATIONS,$where_condition_array,$limit=0,$offset=0);
|
||||
//print_r($temp_city_id);die();
|
||||
if(count($temp_city_id))
|
||||
{
|
||||
if(isset($temp_city_id[0]['team_type']))
|
||||
@ -654,9 +801,9 @@ class PD_Controller extends REST_Controller {
|
||||
{
|
||||
|
||||
//select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED
|
||||
$fields = array('fk_user_id','allocated','scheduled','inprogress');
|
||||
$fields = array('fk_user_id','fk_pd_type_id','allocated','scheduled','inprogress');
|
||||
|
||||
$where_condition_array = array('fk_pd_type_id' => $res_array[0]['fk_pd_type'],'fk_team_id' => $temp_city_id[0]['fk_team_id'],'fk_customer_segment' => $res_array[0]['fk_customer_segment'],'fk_product_id' => $res_array[0]['fk_product_id'],'isactive' => 1);
|
||||
$where_condition_array = array('fk_team_id' => $temp_city_id[0]['pdteam_id'],'isactive' => 1);
|
||||
|
||||
$list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS);
|
||||
|
||||
@ -668,9 +815,10 @@ class PD_Controller extends REST_Controller {
|
||||
$this->db->FROM(USERPROFILE.' as USERPROFILE');
|
||||
$this->db->WHERE('USERPROFILE.userid',$pdofficer['fk_user_id']);
|
||||
$names = $this->db->GET()->result_array();
|
||||
if(count($names)){
|
||||
$list_of_pd_officers[$key]['first_name'] = $names[0]['first_name'];
|
||||
$list_of_pd_officers[$key]['last_name'] = $names[0]['last_name'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
@ -720,12 +868,18 @@ class PD_Controller extends REST_Controller {
|
||||
*/
|
||||
public function listLessPDDetails_get()
|
||||
{
|
||||
$page = 0;$limit = 50;$sort = 'DESC';
|
||||
$page = 0;$limit = 50;$sort = 'DESC';$pdofficerid = "";$datetype = "";$fdate ="";$tdate ="";
|
||||
$lenderid = "";
|
||||
if($this->get('page')) { $page = $this->get('page'); }
|
||||
if($this->get('limit')){ $limit = $this->get('limit'); }
|
||||
if($this->get('sort')) { $sort = $this->get('sort'); }
|
||||
if($this->get('pdofficerid')) { $pdofficerid = $this->get('pdofficerid'); }
|
||||
if($this->get('lenderid')) { $lenderid = $this->get('lenderid'); }
|
||||
if($this->get('datetype')) { $datetype = $this->get('datetype'); }
|
||||
if($this->get('fdate')) { $fdate = $this->get('fdate'); }
|
||||
if($this->get('tdate')) { $tdate = $this->get('tdate'); }
|
||||
|
||||
$result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort);
|
||||
$result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid);
|
||||
|
||||
if($result_data['data_status'] == true)
|
||||
{
|
||||
@ -802,7 +956,36 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
}
|
||||
|
||||
/******** for Load Whole PD Template for PD Screen @param template_id***************/
|
||||
public function loadFullTemplate_get()
|
||||
{
|
||||
$template_id = "";
|
||||
if($this->get('template_id')) { $template_id = $this->get('template_id'); }
|
||||
if($template_id != "" || $template_id != null)
|
||||
{
|
||||
$template_details = $this->PD_Model->getTemplateForPD($template_id);
|
||||
if(count($template_details))
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $template_details;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******** Save Single PD qustions ********/
|
||||
public function saveActualPDQuestions_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -41,6 +41,8 @@ class Template_Management_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******** Save and Update Template Name ********/
|
||||
public function saveNewTemplateName_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
@ -87,7 +89,7 @@ class Template_Management_Controller extends REST_Controller {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/******** save and Edit Template Lender,Product, and Customer Segments ********/
|
||||
public function saveTemplateLenderDetails_post()
|
||||
{
|
||||
|
||||
@ -105,6 +107,7 @@ class Template_Management_Controller extends REST_Controller {
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
$id = $this->Template_Management_Model->saveRecords($template_lender_detail,LENDERTEMPLATE);
|
||||
if($id != "" || $id != null){ $count++; }
|
||||
}
|
||||
@ -129,6 +132,8 @@ class Template_Management_Controller extends REST_Controller {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/******** Save and Update Template Categories ********/
|
||||
public function saveTemplateCategoryDetails_post()
|
||||
{
|
||||
|
||||
@ -137,16 +142,16 @@ class Template_Management_Controller extends REST_Controller {
|
||||
//print_r($template_category_details);die();
|
||||
foreach($template_category_details as $template_category_detail)
|
||||
{
|
||||
if($template_category_detail['template_catagory_weightage_id'] != null || $template_category_detail['template_catagory_weightage_id'] != "")
|
||||
if($template_category_detail['template_category_weightage_id'] != null || $template_category_detail['template_category_weightage_id'] != "")
|
||||
{
|
||||
$where_condition_array = array('template_catagory_weightage_id'=>$template_category_detail['template_catagory_weightage_id']);
|
||||
$modified = $this->Template_Management_Model->updateRecords($template_category_detail,TEMPLATECATAGORYWEIGHTAGE,$where_condition_array);
|
||||
$where_condition_array = array('template_category_weightage_id'=>$template_category_detail['template_category_weightage_id']);
|
||||
$modified = $this->Template_Management_Model->updateRecords($template_category_detail,TEMPLATECATEGORYWEIGHTAGE,$where_condition_array);
|
||||
if($modified != "" || $modified != null){ $count++; }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$id = $this->Template_Management_Model->saveRecords($template_category_detail,TEMPLATECATAGORYWEIGHTAGE);
|
||||
$id = $this->Template_Management_Model->saveRecords($template_category_detail,TEMPLATECATEGORYWEIGHTAGE);
|
||||
if($id != "" || $id != null){ $count++; }
|
||||
}
|
||||
}
|
||||
@ -169,14 +174,16 @@ class Template_Management_Controller extends REST_Controller {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/******** Save/update Template Question and Answers ********/
|
||||
public function saveTemplateQuestionAnswers_post()
|
||||
{
|
||||
$count = 0;
|
||||
$question_count = 0;
|
||||
|
||||
$template_question_answers_details = $this->post('records');
|
||||
print_r($template_question_answers_details);
|
||||
//print_r($template_question_answers_details);
|
||||
foreach($template_question_answers_details as $key => $template_question_answers_detail)
|
||||
{
|
||||
//echo "FOr".$key;
|
||||
$answers_array = array();
|
||||
if($template_question_answers_detail['template_question_id'] != null || $template_question_answers_detail['template_question_id'] != "")
|
||||
{
|
||||
@ -187,8 +194,10 @@ class Template_Management_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
$where_condition_array = array('template_question_id' => $template_question_answers_detail['template_question_id']);
|
||||
unset($template_question_answers_detail['question_id']);
|
||||
unset($template_question_answers_detail['question']);
|
||||
$question_modified = $this->Template_Management_Model->updateRecords($template_question_answers_detail,TEMPLATEQUESTION,$where_condition_array);
|
||||
|
||||
if($question_modified){$question_count++;}
|
||||
if(count($answers_array))
|
||||
{
|
||||
foreach($answers_array as $key => $answer)
|
||||
@ -196,6 +205,8 @@ class Template_Management_Controller extends REST_Controller {
|
||||
if($answer['template_answer_weightage_id'] != "" || $answer['template_answer_weightage_id'] != null)
|
||||
{
|
||||
$where_condition_array = array('template_answer_weightage_id' => $answer['template_answer_weightage_id']);
|
||||
unset($answer['answer']);
|
||||
|
||||
$answer_modified = $this->Template_Management_Model->updateRecords($answer,TEMPLATEANSWERWEIGHTAGE,$where_condition_array);
|
||||
|
||||
if($answer_modified != "" || $answer_modified != null) {$count++;}
|
||||
@ -204,12 +215,39 @@ class Template_Management_Controller extends REST_Controller {
|
||||
{
|
||||
$answer_inserted = $this->Template_Management_Model->saveRecords($answer,TEMPLATEANSWERWEIGHTAGE);
|
||||
|
||||
if($answer_inserted != "" || $answer_inserted != null) {$count++;}
|
||||
//if($answer_inserted != "" || $answer_inserted != null) {$count++;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(($question_modified != "" || $question_modified != null) && count($answers_array) == $count)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($template_question_answers_detail['answers']))
|
||||
{
|
||||
$answers_array = $template_question_answers_detail['answers'];
|
||||
unset($template_question_answers_detail['answers']);
|
||||
}
|
||||
|
||||
unset($template_question_answers_detail['question_id']);
|
||||
unset($template_question_answers_detail['question']);
|
||||
$question_id = $this->Template_Management_Model->saveRecords($template_question_answers_detail,TEMPLATEQUESTION);
|
||||
if($question_id){$question_count++;}
|
||||
if(count($answers_array))
|
||||
{
|
||||
foreach($answers_array as $key => $answer)
|
||||
{
|
||||
$answer['fk_template_question_id'] = $question_id;
|
||||
unset($answer['answer']);
|
||||
$answer_inserted = $this->Template_Management_Model->saveRecords($answer,TEMPLATEANSWERWEIGHTAGE);
|
||||
//if($answer_inserted != "" || $answer_inserted != null) {$count++;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(($question_count != "" || $question_id != null) )
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
@ -222,48 +260,12 @@ class Template_Management_Controller extends REST_Controller {
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($template_question_answers_detail['answers']))
|
||||
{
|
||||
$answers_array = $template_question_answers_detail['answers'];
|
||||
unset($template_question_answers_detail['answers']);
|
||||
}
|
||||
|
||||
$question_id = $this->Template_Management_Model->saveRecords($template_question_answers_detail,TEMPLATEQUESTION);
|
||||
|
||||
if(count($answers_array))
|
||||
{
|
||||
foreach($answers_array as $key => $answer)
|
||||
{
|
||||
$answer['fk_template_question_id'] = $question_id;
|
||||
$answer_inserted = $this->Template_Management_Model->saveRecords($answer,TEMPLATEANSWERWEIGHTAGE);
|
||||
if($answer_inserted != "" || $answer_inserted != null) {$count++;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(($question_id != "" || $question_id != null) && count($answers_array) == $count)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $question_id;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/******** Load Existed Template Master Details for Edit page @param template id ********/
|
||||
public function getTemplateMaster_post()
|
||||
{
|
||||
$template_id = $this->post('template_id');
|
||||
@ -284,7 +286,7 @@ class Template_Management_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******** Load Existed Template Lender Mapping for Edit page @param template id ********/
|
||||
public function getTemplateLenders_post()
|
||||
{
|
||||
$template_id = $this->post('template_id');
|
||||
@ -305,7 +307,7 @@ class Template_Management_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******** Load Existed Template Categories for Edit page @param template id ********/
|
||||
public function getTemplateCategories_post()
|
||||
{
|
||||
$template_id = $this->post('template_id');
|
||||
@ -325,6 +327,8 @@ class Template_Management_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******** Load Existed Template Question and Answers for Edit page @param template id ********/
|
||||
public function getTemplateQuestionAnswers_post()
|
||||
{
|
||||
$template_id = $this->post('template_id');
|
||||
@ -344,5 +348,51 @@ class Template_Management_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/************** Get List of Categories to Template Add/Edit Page DropDown ***************/
|
||||
public function getListOfCategories_get()
|
||||
{
|
||||
$fields = array('question_category_id','category_name');
|
||||
$where_condition_array = array('isactive' => 1);
|
||||
$result_data = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,QUESTIONCATEGORY);
|
||||
if(count($result_data))
|
||||
{
|
||||
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result_data;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getQuestionsForTemplateCreation_post()
|
||||
{
|
||||
$template_id = "";$category_id = "";
|
||||
|
||||
if($this->post('template_id')){ $template_id = $this->post('template_id'); }
|
||||
if($this->post('category_id')){ $category_id = $this->post('category_id'); }
|
||||
|
||||
$questions = $this->Template_Management_Model->getListOfQuestions($template_id,$category_id);
|
||||
if(count($questions))
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $questions;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -20,6 +20,12 @@ class Welcome extends CI_Controller {
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// require_once APPPATH . '/controllers/PD_Controller.php';
|
||||
// require_once APPPATH . '/libraries/REST_Controller.php';
|
||||
$this->load->view('welcome_message');
|
||||
//$this->load->library('../controllers/PD_Controller');
|
||||
// $PD_Controller = new PD_Controller();
|
||||
//echo $PD_Controller->index();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,11 +33,11 @@ class PDALERTS
|
||||
*/
|
||||
|
||||
//1.Get Current Status and createdby , lenders info by pdid
|
||||
$CI->db->SELECT("PDTRIGGER.fk_lender_id,PDTRIGGER.lender_applicant_id,PDTRIGGER.fk_pd_status,PDSTATUS.pd_status_name,PDTRIGGER.fk_createdby,USERPROFILE.fk_entity_id as created_entity_type,USERPROFILE.email as created_mail,USERPROFILE.mobile_no as created_mobile_no,PDTRIGGER.fk_pd_allocated_to,ALLOCATED.email as allocated_email,ALLOCATED.mobile_no as allocated_mobile_no,ALLOCATED.fk_entity_id as allocated_entity_type,PDTRIGGER.pd_agency_id");
|
||||
$CI->db->SELECT("PDTRIGGER.fk_lender_id,PDTRIGGER.lender_applicant_id,PDTRIGGER.pd_status,PDSTATUS.pd_status_name,PDTRIGGER.fk_createdby,USERPROFILE.fk_entity_id as created_entity_type,USERPROFILE.email as created_mail,USERPROFILE.mobile_no as created_mobile_no,PDTRIGGER.fk_pd_allocated_to,ALLOCATED.email as allocated_email,ALLOCATED.mobile_no as allocated_mobile_no,ALLOCATED.fk_entity_id as allocated_entity_type,PDTRIGGER.pd_agency_id");
|
||||
$CI->db->FROM(PDTRIGGER." as PDTRIGGER");
|
||||
$CI->db->JOIN(USERPROFILE." as USERPROFILE","PDTRIGGER.fk_createdby = USERPROFILE.userid");
|
||||
$CI->db->JOIN(USERPROFILE." as ALLOCATED","PDTRIGGER.fk_pd_allocated_to = ALLOCATED.userid");
|
||||
$CI->db->JOIN(PDSTATUS." as PDSTATUS","PDTRIGGER.fk_pd_status = PDSTATUS.pd_status_id");
|
||||
$CI->db->JOIN(PDSTATUS." as PDSTATUS","PDTRIGGER.pd_status = PDSTATUS.pd_status_id");
|
||||
$CI->db->WHERE("PDTRIGGER.pd_id",$pdid);
|
||||
$core_details = $CI->db->GET()->result_array();
|
||||
//print_r($core_details);
|
||||
@ -50,7 +50,7 @@ class PDALERTS
|
||||
$CI->db->SELECT("PDNOTIFICATION.pdnotification_id, PDNOTIFICATION.fk_pd_status_id, PDSTATUS.pd_status_name,PDNOTIFICATION.sms_lender, PDNOTIFICATION.sms_pdofficer, PDNOTIFICATION.sms_pdincharge, PDNOTIFICATION.mail_lender, PDNOTIFICATION.mail_pdincharge, PDNOTIFICATION.mail_pdofficer");
|
||||
$CI->db->FROM(PDNOTIFICATION." as PDNOTIFICATION");
|
||||
$CI->db->JOIN(PDSTATUS." as PDSTATUS","PDNOTIFICATION.fk_pd_status_id = PDSTATUS.pd_status_id AND PDSTATUS.isactive = 1");
|
||||
$CI->db->WHERE("PDNOTIFICATION.fk_pd_status_id",$core_details[0]['fk_pd_status']);
|
||||
$CI->db->WHERE("PDNOTIFICATION.fk_pd_status_id",$core_details[0]['pd_status']);
|
||||
$pd_notification_configs = $CI->db->GET()->result_array();
|
||||
//print_r($pd_notification_configs);
|
||||
|
||||
@ -107,7 +107,7 @@ class PDALERTS
|
||||
}
|
||||
}
|
||||
|
||||
$msg = "PD for Lender Applicant ID -:". $core_details[0]['lender_applicant_id'] ." has been ". $core_details[0]['pd_status_name']; // status base configurable
|
||||
$msg = "PD for Lender Applicant ID -:". $core_details[0]['lender_applicant_id'] ." has been ". $core_details[0]['pd_status_name']; // status base configurable
|
||||
//print_r($mobile_nos_to_send_notification);
|
||||
foreach($mobile_nos_to_send_notification as $no)
|
||||
{
|
||||
|
||||
@ -33,6 +33,20 @@ class Common_Masters_Model extends SPARQ_Model {
|
||||
|
||||
// return $result;
|
||||
// }
|
||||
public function pdteamlist(){
|
||||
|
||||
$result = $this->db->get(PDTEAM)->result_array();
|
||||
|
||||
if(count($result) !=0){
|
||||
foreach($result as $key=> $r){
|
||||
|
||||
$cities = $this->db->get_where(PDTEAMCITY,array('fk_pdteam_id'=>$r['pdteam_id']))->result_array();
|
||||
array_push($result[$key],$cities);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This Function is used to Delete The Datas
|
||||
|
||||
@ -11,11 +11,12 @@ class PD_Model extends SPARQ_Model {
|
||||
}
|
||||
|
||||
|
||||
public function listLessPDDetails($page,$limit,$sort)// $page represents mysql offset
|
||||
public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid)// $page represents mysql offset
|
||||
{
|
||||
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDSTATUS.pd_status_name, PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PDTRIGGER.pincode');
|
||||
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDSTATUS.pd_status_name, PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PDTRIGGER.pincode,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y") as completed_on');
|
||||
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
|
||||
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id','LEFT');
|
||||
$this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT');
|
||||
$this->db->JOIN(PRODUCTS.' as PRODUCTS','PDTRIGGER.fk_product_id = PRODUCTS.product_id','LEFT');
|
||||
$this->db->JOIN(SUBPRODUCTS.' as SUBPRODUCTS','PDTRIGGER.fk_subproduct_id = SUBPRODUCTS.subproduct_id','LEFT');
|
||||
$this->db->JOIN(PDTYPE.' as PDTYPE','PDTRIGGER.fk_pd_type = PDTYPE.pd_type_id','LEFT');
|
||||
@ -29,18 +30,57 @@ class PD_Model extends SPARQ_Model {
|
||||
$this->db->JOIN(ENTITY.' as AGENCY','PDTRIGGER.pd_agency_id = AGENCY.entity_id','LEFT');
|
||||
$this->db->JOIN(STATE.' as STATE','PDTRIGGER.fk_state = STATE.state_id ','LEFT');
|
||||
$this->db->JOIN(CITY.' as CITY','PDTRIGGER.fk_city = CITY.city_id','LEFT');
|
||||
|
||||
if($pdofficerid != "" || $pdofficerid != null)
|
||||
{
|
||||
$this->db->WHERE('PDTRIGGER.fk_pd_allocated_to',$pdofficerid);
|
||||
}
|
||||
|
||||
if($lenderid != "" || $lenderid != null)
|
||||
{
|
||||
$this->db->WHERE('PDTRIGGER.fk_lender_id',$lenderid);
|
||||
}
|
||||
|
||||
if($datetype != "" || $datetype != null)
|
||||
{
|
||||
if($datetype == 1)
|
||||
{
|
||||
if($fdate != "" || $fdate != null)
|
||||
{
|
||||
$this->db->WHERE('PDTRIGGER.pd_date_of_initiation >=',$fdate);
|
||||
}
|
||||
if($tdate != "" || $tdate != null)
|
||||
{
|
||||
$this->db->WHERE('PDTRIGGER.pd_date_of_initiation <=',$tdate);
|
||||
}
|
||||
}
|
||||
else if($datetype == 2)
|
||||
{
|
||||
if($fdate != "" || $fdate != null)
|
||||
{
|
||||
$this->db->WHERE('PDTRIGGER.scheduled_on >=',$fdate);
|
||||
}
|
||||
if($tdate != "" || $tdate != null)
|
||||
{
|
||||
$this->db->WHERE('PDTRIGGER.scheduled_on <=',$tdate);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$this->db->ORDER_BY('PDTRIGGER.pd_id',$sort);
|
||||
$this->db->LIMIT($limit,$page);
|
||||
$result_array = $this->db->GET()->result_array();
|
||||
//print_r($this->db->last_query());
|
||||
if(count($result_array) != 0)
|
||||
{
|
||||
foreach($result_array as $key => $result)
|
||||
{
|
||||
|
||||
$this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode,PDAPPLICANTSDETAILS.relation');
|
||||
$this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode,PDAPPLICANTSDETAILS.relation,RELATIONSHIPS.name as relation_name');
|
||||
$this->db->FROM(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS');
|
||||
$this->db->JOIN(STATE.' as STATE','PDAPPLICANTSDETAILS.fk_state = STATE.state_id','LEFT');
|
||||
$this->db->JOIN(CITY.' as CITY','PDAPPLICANTSDETAILS.fk_city = CITY.city_id','LEFT');
|
||||
$this->db->JOIN(RELATIONSHIPS.' as RELATIONSHIPS','PDAPPLICANTSDETAILS.relation = RELATIONSHIPS.relationship_id','LEFT');
|
||||
$this->db->WHERE('PDAPPLICANTSDETAILS.fk_pd_id ',$result['pd_id']);
|
||||
$result_child_array = $this->db->GET()->result_array();
|
||||
if(count($result_child_array) != 0)
|
||||
@ -197,9 +237,10 @@ class PD_Model extends SPARQ_Model {
|
||||
*/
|
||||
public function getPDMasterDetails($pdid)
|
||||
{
|
||||
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDSTATUS.pd_status_name, PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PDTRIGGER.pincode');
|
||||
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDSTATUS.pd_status_name, PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PDTRIGGER.pincode,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y") as completed_on');
|
||||
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
|
||||
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT');
|
||||
$this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT');
|
||||
$this->db->JOIN(PRODUCTS.' as PRODUCTS','PDTRIGGER.fk_product_id = PRODUCTS.product_id','LEFT');
|
||||
$this->db->JOIN(SUBPRODUCTS.' as SUBPRODUCTS','PDTRIGGER.fk_subproduct_id = SUBPRODUCTS.subproduct_id','LEFT');
|
||||
$this->db->JOIN(PDTYPE.' as PDTYPE','PDTRIGGER.fk_pd_type = PDTYPE.pd_type_id','LEFT');
|
||||
@ -220,4 +261,58 @@ class PD_Model extends SPARQ_Model {
|
||||
|
||||
return $result_array;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getTemplateForPD($template_id)
|
||||
{
|
||||
|
||||
|
||||
$this->db->SELECT('QUESTIONCATEGORY.category_name,TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id, TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id, TEMPLATECATEGORYWEIGHTAGE.fk_template_id, TEMPLATECATEGORYWEIGHTAGE.weightage, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.createdon,"%d/%m/%Y") as createdon, TEMPLATECATEGORYWEIGHTAGE.fk_createdby, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.updatedon, "%d/%m/%Y") as updatedon, TEMPLATECATEGORYWEIGHTAGE.isactive, TEMPLATECATEGORYWEIGHTAGE.fk_updatedby');
|
||||
$this->db->FROM(TEMPLATECATEGORYWEIGHTAGE .' as TEMPLATECATEGORYWEIGHTAGE');
|
||||
$this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id = QUESTIONCATEGORY.question_category_id');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATECATEGORYWEIGHTAGE.fk_createdby = USERPROFILE.userid','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATECATEGORYWEIGHTAGE.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
$this->db->WHERE('TEMPLATECATEGORYWEIGHTAGE.fk_template_id',$template_id);
|
||||
$categories = $this->db->GET()->result_array();
|
||||
|
||||
if(count($categories))
|
||||
{
|
||||
/*
|
||||
DATE_FORMAT(TEMPLATEQUESTION.createdon,"%d/%m/%Y") as createdon, TEMPLATEQUESTION.fk_createdby, DATE_FORMAT(TEMPLATEQUESTION.updatedon,"%d/%m/%Y") as updatedon, TEMPLATEQUESTION.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby
|
||||
*/
|
||||
foreach($categories as $category_key => $category)
|
||||
{
|
||||
|
||||
$this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive');
|
||||
//$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION');
|
||||
$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION');
|
||||
$this->db->JOIN(QUESTIONS.' as QUESTIONS','TEMPLATEQUESTION.fk_question_id = QUESTIONS.question_id','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATEQUESTION.fk_createdby = USERPROFILE.userid','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATEQUESTION.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
$this->db->WHERE('TEMPLATEQUESTION.fk_template_question_category_id',$category['fk_question_category_id']);
|
||||
$questions = $this->db->GET()->result_array();
|
||||
|
||||
|
||||
if(count($questions))
|
||||
{
|
||||
|
||||
foreach($questions as $answer_key => $question)
|
||||
{
|
||||
$this->db->SELECT('QUESTIONANSWERS.question_answer_id,QUESTIONANSWERS.answer,TEMPLATEANSWERWEIGHTAGE.template_answer_weightage_id, TEMPLATEANSWERWEIGHTAGE.fk_template_question_id, TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id, TEMPLATEANSWERWEIGHTAGE.template_answer_weightage, TEMPLATEANSWERWEIGHTAGE.isactive');
|
||||
$this->db->FROM(TEMPLATEANSWERWEIGHTAGE.' as TEMPLATEANSWERWEIGHTAGE');
|
||||
$this->db->JOIN(QUESTIONANSWERS.' as QUESTIONANSWERS','TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id = QUESTIONANSWERS.question_answer_id','LEFT');
|
||||
$this->db->WHERE('QUESTIONANSWERS.fk_question_id',$question['question_id']);
|
||||
$answers = $this->db->GET()->result_array();
|
||||
$questions[$answer_key]['answers'] = $answers;
|
||||
}
|
||||
}
|
||||
$categories[$category_key]['questions'] = $questions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $categories;
|
||||
}
|
||||
|
||||
}
|
||||
@ -14,15 +14,15 @@ class Question_Management_Model extends SPARQ_Model {
|
||||
{
|
||||
|
||||
|
||||
$this->db->SELECT('QUESTIONS.question_id, QUESTIONS.question, QUESTIONS.description, QUESTIONS.fk_question_catagory,QUESTIONCATEGORY.categroy_name, QUESTIONS.fk_question_answertype,QUESTIONANSWERTYPE.answer_type_name,QUESTIONS.isactive, QUESTIONS.createdon, QUESTIONS.fk_createdby, QUESTIONS.updatedon, QUESTIONS.fk_updatedby,concat(USERPROFILE.first_name," " ,USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby');
|
||||
$this->db->SELECT('QUESTIONS.question_id, QUESTIONS.question, QUESTIONS.description, QUESTIONS.fk_question_category,QUESTIONCATEGORY.category_name, QUESTIONS.fk_question_answertype,QUESTIONANSWERTYPE.answer_type_name,QUESTIONS.isactive, QUESTIONS.createdon, QUESTIONS.fk_createdby, QUESTIONS.updatedon, QUESTIONS.fk_updatedby,concat(USERPROFILE.first_name," " ,USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby');
|
||||
$this->db->FROM(QUESTIONS.' as QUESTIONS');
|
||||
$this->db->JOIN(QUESTIONANSWERTYPE.' as QUESTIONANSWERTYPE','QUESTIONS.fk_question_answertype = QUESTIONANSWERTYPE.question_answer_type_id');
|
||||
$this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','QUESTIONS.fk_question_catagory = QUESTIONCATEGORY.question_categroy_id');
|
||||
$this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','QUESTIONS.fk_question_category = QUESTIONCATEGORY.question_category_id');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','QUESTIONS.fk_createdby = USERPROFILE.userid');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONS.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
if($category_id != null || $category_id != '')
|
||||
{
|
||||
$this->db->WHERE('QUESTIONS.fk_question_catagory',$category_id);
|
||||
$this->db->WHERE('QUESTIONS.fk_question_category',$category_id);
|
||||
}
|
||||
$this->db->ORDER_BY('QUESTIONS.question_id',$sort);
|
||||
$this->db->LIMIT($page,$limit);
|
||||
|
||||
@ -79,50 +79,149 @@ class Template_Management_Model extends SPARQ_Model {
|
||||
|
||||
public function getTemplateCategories($template_id)
|
||||
{
|
||||
$this->db->SELECT('TEMPLATECATAGORYWEIGHTAGE.template_catagory_weightage_id, TEMPLATECATAGORYWEIGHTAGE.fk_question_catagory_id, TEMPLATECATAGORYWEIGHTAGE.fk_template_id, TEMPLATECATAGORYWEIGHTAGE.weigthage, DATE_FORMAT(TEMPLATECATAGORYWEIGHTAGE.createdon,"%d/%m/%Y") as createdon, TEMPLATECATAGORYWEIGHTAGE.fk_createdby, DATE_FORMAT(TEMPLATECATAGORYWEIGHTAGE.updatedon, "%d/%m/%Y") as updatedon, TEMPLATECATAGORYWEIGHTAGE.isactive, TEMPLATECATAGORYWEIGHTAGE.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby');
|
||||
$this->db->FROM(TEMPLATECATAGORYWEIGHTAGE.' as TEMPLATECATAGORYWEIGHTAGE');
|
||||
$this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','TEMPLATECATAGORYWEIGHTAGE.template_catagory_weightage_id = QUESTIONCATEGORY.question_categroy_id');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATECATAGORYWEIGHTAGE.fk_createdby = USERPROFILE.userid');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATECATAGORYWEIGHTAGE.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
$this->db->WHERE('TEMPLATECATAGORYWEIGHTAGE.fk_template_id',$template_id);
|
||||
$this->db->SELECT('TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id, TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id, TEMPLATECATEGORYWEIGHTAGE.fk_template_id, TEMPLATECATEGORYWEIGHTAGE.weightage, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.createdon,"%d/%m/%Y") as createdon, TEMPLATECATEGORYWEIGHTAGE.fk_createdby, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.updatedon, "%d/%m/%Y") as updatedon, TEMPLATECATEGORYWEIGHTAGE.isactive, TEMPLATECATEGORYWEIGHTAGE.fk_updatedby');
|
||||
$this->db->FROM(TEMPLATECATEGORYWEIGHTAGE .' as TEMPLATECATEGORYWEIGHTAGE');
|
||||
// $this->db->JOIN(TEMPLATECATEGORYWEIGHTAGE.' as TEMPLATECATEGORYWEIGHTAGE',"TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id = QUESTIONCATEGORY.question_category_id AND TEMPLATECATEGORYWEIGHTAGE.fk_template_id = $template_id");
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATECATEGORYWEIGHTAGE.fk_createdby = USERPROFILE.userid','LEFT');
|
||||
//$this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATECATEGORYWEIGHTAGE.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
$this->db->WHERE('TEMPLATECATEGORYWEIGHTAGE.fk_template_id',$template_id);
|
||||
$data = $this->db->GET()->result_array();
|
||||
return $data;
|
||||
}
|
||||
|
||||
// public function getTemplateQuestionAnswers($template_id)
|
||||
// {
|
||||
|
||||
/*
|
||||
DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.createdon,"%d/%m/%Y") as createdon, TEMPLATECATEGORYWEIGHTAGE.fk_createdby, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.updatedon, "%d/%m/%Y") as updatedon,TEMPLATECATEGORYWEIGHTAGE.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby
|
||||
|
||||
*/
|
||||
public function getTemplateQuestionAnswers($template_id)
|
||||
{
|
||||
|
||||
// $this->db->SELECT('TEMPLATECATAGORYWEIGHTAGE.template_catagory_weightage_id, TEMPLATECATAGORYWEIGHTAGE.fk_question_catagory_id, TEMPLATECATAGORYWEIGHTAGE.fk_template_id, TEMPLATECATAGORYWEIGHTAGE.weigthage, DATE_FORMAT(TEMPLATECATAGORYWEIGHTAGE.createdon,"%d/%m/%Y") as createdon, TEMPLATECATAGORYWEIGHTAGE.fk_createdby, DATE_FORMAT(TEMPLATECATAGORYWEIGHTAGE.updatedon, "%d/%m/%Y") as updatedon, TEMPLATECATAGORYWEIGHTAGE.isactive, TEMPLATECATAGORYWEIGHTAGE.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby');
|
||||
// $this->db->FROM(TEMPLATECATAGORYWEIGHTAGE.' as TEMPLATECATAGORYWEIGHTAGE');
|
||||
// $this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','TEMPLATECATAGORYWEIGHTAGE.template_catagory_weightage_id = QUESTIONCATEGORY.question_categroy_id');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATECATAGORYWEIGHTAGE.fk_createdby = USERPROFILE.userid');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATECATAGORYWEIGHTAGE.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
// $this->db->WHERE('TEMPLATECATAGORYWEIGHTAGE.fk_template_id',$template_id);
|
||||
// $categories = $this->db->GET()->result_array();
|
||||
|
||||
// if(count($categories))
|
||||
// {
|
||||
|
||||
// foreach($categories as $key => $category)
|
||||
// {
|
||||
// $this->db->SELECT('TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by, DATE_FORMAT(TEMPLATEQUESTION.createdon,"%d/%m/%Y") as createdon, TEMPLATEQUESTION.fk_createdby, DATE_FORMAT(TEMPLATEQUESTION.updatedon,"%d/%m/%Y") as updatedon, TEMPLATEQUESTION.fk_updatedby, TEMPLATEQUESTION.isactive,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby');
|
||||
// $this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION');
|
||||
// $this->db->JOIN(QUESTIONS.' as QUESTIONS','TEMPLATEQUESTION.fk_question_id = QUESTIONS.question_id');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATEQUESTION.fk_createdby = USERPROFILE.userid');
|
||||
$this->db->SELECT('QUESTIONCATEGORY.category_name,TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id, TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id, TEMPLATECATEGORYWEIGHTAGE.fk_template_id, TEMPLATECATEGORYWEIGHTAGE.weightage, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.createdon,"%d/%m/%Y") as createdon, TEMPLATECATEGORYWEIGHTAGE.fk_createdby, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.updatedon, "%d/%m/%Y") as updatedon, TEMPLATECATEGORYWEIGHTAGE.isactive, TEMPLATECATEGORYWEIGHTAGE.fk_updatedby');
|
||||
$this->db->FROM(TEMPLATECATEGORYWEIGHTAGE .' as TEMPLATECATEGORYWEIGHTAGE');
|
||||
$this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id = QUESTIONCATEGORY.question_category_id');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATECATEGORYWEIGHTAGE.fk_createdby = USERPROFILE.userid','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATECATEGORYWEIGHTAGE.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
$this->db->WHERE('TEMPLATECATEGORYWEIGHTAGE.fk_template_id',$template_id);
|
||||
$categories = $this->db->GET()->result_array();
|
||||
|
||||
if(count($categories))
|
||||
{
|
||||
/*
|
||||
DATE_FORMAT(TEMPLATEQUESTION.createdon,"%d/%m/%Y") as createdon, TEMPLATEQUESTION.fk_createdby, DATE_FORMAT(TEMPLATEQUESTION.updatedon,"%d/%m/%Y") as updatedon, TEMPLATEQUESTION.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby
|
||||
*/
|
||||
foreach($categories as $category_key => $category)
|
||||
{
|
||||
|
||||
$this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive');
|
||||
//$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION');
|
||||
$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION');
|
||||
$this->db->JOIN(QUESTIONS.' as QUESTIONS','TEMPLATEQUESTION.fk_question_id = QUESTIONS.question_id','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATEQUESTION.fk_createdby = USERPROFILE.userid','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATEQUESTION.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
// $this->db->WHERE('TEMPLATEQUESTION.fk_template_id',$template_id);
|
||||
// $questions = $this->db->GET()->result_array();
|
||||
$this->db->WHERE('TEMPLATEQUESTION.fk_template_question_category_id',$category['fk_question_category_id']);
|
||||
$questions = $this->db->GET()->result_array();
|
||||
|
||||
|
||||
// if(count($questions))
|
||||
// {
|
||||
// foreach($questions as $key => $question)
|
||||
// {
|
||||
if(count($questions))
|
||||
{
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
foreach($questions as $answer_key => $question)
|
||||
{
|
||||
$this->db->SELECT('QUESTIONANSWERS.question_answer_id,QUESTIONANSWERS.answer,TEMPLATEANSWERWEIGHTAGE.template_answer_weightage_id, TEMPLATEANSWERWEIGHTAGE.fk_template_question_id, TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id, TEMPLATEANSWERWEIGHTAGE.template_answer_weightage, TEMPLATEANSWERWEIGHTAGE.isactive');
|
||||
$this->db->FROM(TEMPLATEANSWERWEIGHTAGE.' as TEMPLATEANSWERWEIGHTAGE');
|
||||
$this->db->JOIN(QUESTIONANSWERS.' as QUESTIONANSWERS','TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id = QUESTIONANSWERS.question_answer_id','LEFT');
|
||||
$this->db->WHERE('QUESTIONANSWERS.fk_question_id',$question['question_id']);
|
||||
$answers = $this->db->GET()->result_array();
|
||||
$questions[$answer_key]['answers'] = $answers;
|
||||
}
|
||||
}
|
||||
$categories[$category_key]['questions'] = $questions;
|
||||
}
|
||||
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
return $categories;
|
||||
}
|
||||
|
||||
|
||||
public function getListOfQuestions($template_id,$category_id)
|
||||
{
|
||||
$questions = array();
|
||||
if(($template_id != "" || $template_id != null) && ($category_id != "" || $category_id != null))
|
||||
{
|
||||
$fields = array('fk_question_id');
|
||||
$where_condition_array = array('fk_template_question_category_id' => $category_id,'fk_template_id' => $template_id);
|
||||
$result_data = $this->selectCustomRecords($fields,$where_condition_array,TEMPLATEQUESTION);
|
||||
|
||||
if(count($result_data))
|
||||
{
|
||||
$temp_array = array();
|
||||
foreach($result_data as $res)
|
||||
{
|
||||
array_push($temp_array,$res['fk_question_id']);
|
||||
}
|
||||
|
||||
// $this->db->SELECT('question_id,question');
|
||||
// $this->db->FROM(QUESTIONS);
|
||||
// $this->db->WHERE('fk_question_category',$category_id);
|
||||
// $this->db->WHERE_NOT_IN('question_id',$temp_array);
|
||||
// $questions = $this->db->get()->result_array();
|
||||
|
||||
$this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive');
|
||||
//$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION');
|
||||
$this->db->FROM(QUESTIONS.' as QUESTIONS');
|
||||
$this->db->JOIN(TEMPLATEQUESTION.' as TEMPLATEQUESTION','QUESTIONS.question_id = TEMPLATEQUESTION.fk_question_id','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATEQUESTION.fk_createdby = USERPROFILE.userid','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATEQUESTION.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
$this->db->WHERE('QUESTIONS.fk_question_category',$category_id);
|
||||
$this->db->WHERE_NOT_IN('QUESTIONS.question_id',$temp_array);
|
||||
$questions = $this->db->GET()->result_array();
|
||||
|
||||
|
||||
if(count($questions))
|
||||
{
|
||||
|
||||
foreach($questions as $answer_key => $question)
|
||||
{
|
||||
$this->db->SELECT('QUESTIONANSWERS.question_answer_id,QUESTIONANSWERS.answer,TEMPLATEANSWERWEIGHTAGE.template_answer_weightage_id, TEMPLATEANSWERWEIGHTAGE.fk_template_question_id, TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id, TEMPLATEANSWERWEIGHTAGE.template_answer_weightage, TEMPLATEANSWERWEIGHTAGE.isactive');
|
||||
$this->db->FROM(QUESTIONANSWERS.' as QUESTIONANSWERS');
|
||||
$this->db->JOIN(TEMPLATEANSWERWEIGHTAGE.' as TEMPLATEANSWERWEIGHTAGE','QUESTIONANSWERS.question_answer_id = TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id','LEFT');
|
||||
$this->db->WHERE('QUESTIONANSWERS.fk_question_id',$question['question_id']);
|
||||
$answers = $this->db->GET()->result_array();
|
||||
$questions[$answer_key]['answers'] = $answers;
|
||||
}
|
||||
}
|
||||
//$questions['answers'] = $questions;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive');
|
||||
//$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION');
|
||||
$this->db->FROM(QUESTIONS.' as QUESTIONS');
|
||||
$this->db->JOIN(TEMPLATEQUESTION.' as TEMPLATEQUESTION','QUESTIONS.question_id = TEMPLATEQUESTION.fk_question_id','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATEQUESTION.fk_createdby = USERPROFILE.userid','LEFT');
|
||||
// $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATEQUESTION.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
$this->db->WHERE('QUESTIONS.fk_question_category',$category_id);
|
||||
$questions = $this->db->GET()->result_array();
|
||||
if(count($questions))
|
||||
{
|
||||
|
||||
foreach($questions as $answer_key => $question)
|
||||
{
|
||||
$this->db->SELECT('QUESTIONANSWERS.question_answer_id,QUESTIONANSWERS.answer,TEMPLATEANSWERWEIGHTAGE.template_answer_weightage_id, TEMPLATEANSWERWEIGHTAGE.fk_template_question_id, TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id, TEMPLATEANSWERWEIGHTAGE.template_answer_weightage, TEMPLATEANSWERWEIGHTAGE.isactive');
|
||||
$this->db->FROM(QUESTIONANSWERS.' as QUESTIONANSWERS');
|
||||
$this->db->JOIN(TEMPLATEANSWERWEIGHTAGE.' as TEMPLATEANSWERWEIGHTAGE','QUESTIONANSWERS.question_answer_id = TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id','LEFT');
|
||||
$this->db->WHERE('QUESTIONANSWERS.fk_question_id',$question['question_id']);
|
||||
$answers = $this->db->GET()->result_array();
|
||||
$questions[$answer_key]['answers'] = $answers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $questions;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user