diff --git a/api/application/config/routes.php b/api/application/config/routes.php index b3328dd9..26f0c9d4 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -71,7 +71,6 @@ $route['getListOfPDTeam'] = 'Common_Masters_Controller/getListOfPDTeam'; $route['getPdManage'] = 'Common_Masters_Controller/getPdManage'; $route['savePdTeamManage'] = 'Common_Masters_Controller/savePdTeamManage'; $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'; @@ -222,4 +221,5 @@ $route['getDashBoardDetailsOfCity'] = 'Dash_Board_Controller/getDashBoardDetails $route['getDashBoardAlertDetails'] = 'Dash_Board_Controller/getDashBoardDetailsOfAlert'; $route['PD_MIS_report'] = 'Dash_Board_Controller/PD_MIS_report'; - +//miscellanous +//$route['showBusinessScorecard'] = 'PD_Controller/'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index a2752cee..f020b744 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -618,6 +618,7 @@ class PD_Controller extends REST_Controller { if($pd_id != null || $pd_id != '' && $count != 0) { // CALL pdnotification Helper function to send pd alerts @ params pdid,pdstatus + $logger = MYLOG::logFunction(); $logger->info("NEW PD Trigged : ".$pd_id,array('ENV'=>ENVIRONMENT,'DATA' => $pd_details)); PDALERTS::pdnotification($pd_id); @@ -709,6 +710,7 @@ class PD_Controller extends REST_Controller { $pd_details['random_string'] = $randomString; + $url = 'https://ssa.sineedge.com/ot/#/officertracking/'.$randomString; /* $ch = curl_init(); $timeout = 5; $url = 'https://ssa.sineedge.com/ot/#/officertracking/'.$randomString; @@ -2523,7 +2525,7 @@ class PD_Controller extends REST_Controller { } else { - $json = json_decode($rec[0]['json']); + $json = json_decode($rec[0]['processed_json']); } $data['dataStatus'] = true; @@ -4747,10 +4749,19 @@ class PD_Controller extends REST_Controller { //print_r($records); $data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid); $data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid); - // $data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid); - // $data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly(); - // $data['pd_score'] = $this->calculateScore($pdid); + $data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid); + $data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly(); + $data['pd_score'] = $this->calculateScore($pdid); + $remp = array(); + foreach($data['pd_score']['general'] as $key => $da) + { + //$remp = array_merge($remp,array($key => (string)($da['attributed_score'] * 100))); + $remp = array_merge($remp,array($key)); + } + print_r($remp); + //die(); + print_r(json_encode($remp,true));die(); // $score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0; //echo $score_for_chart; $chart = null; @@ -5832,19 +5843,34 @@ class PD_Controller extends REST_Controller { //Get Latest Loan Amount form loan form. $loan_amt_from_loam_form = json_decode($form_data[10][0]['processed_json'],true); $loan_amt_from_loam_form = $loan_amt_from_loam_form['loan_amount']; - + //echo $loan_amt_from_loam_form; //seperate PD Scorable quesitons from JSON $score_questions = $this->seperateScoreQuestions($form_data,$pd_master_details[0]['is_otp_done']); //print_r($score_questions);die(); // echo "###################################"; //Get Pesrsonal Assets Grid Masters Details - $this->db->SELECT('*'); - $this->db->FROM(PERSONALASSETGRID); - $this->db->WHERE('isactive',1); - $this->db->WHERE('loan_amount_from<=',(int)$pd_master_details[0]['loan_amount']); - $this->db->WHERE('loan_amount_to>=',(int)$pd_master_details[0]['loan_amount']); - $personal_asset_grid['master_grid'] = $this->db->GET()->result_array(); - //print_r($this->db->last_query());die(); + if((int)$loan_amt_from_loam_form >= 100000000 ) + { + $this->db->SELECT('*'); + $this->db->FROM(PERSONALASSETGRID); + $this->db->WHERE('isactive',1); + $this->db->ORDER_BY('personal_asset_grid_id','DESC'); + $this->db->LIMIT(1) ; + $personal_asset_grid['master_grid'] = $this->db->GET()->result_array(); + } + else + { + + $this->db->SELECT('*'); + $this->db->FROM(PERSONALASSETGRID); + $this->db->WHERE('isactive',1); + $this->db->WHERE('loan_amount_from<=',(int)$loan_amt_from_loam_form); + $this->db->WHERE('loan_amount_to>=',(int)$loan_amt_from_loam_form); + $personal_asset_grid['master_grid'] = $this->db->GET()->result_array(); + } + // print_r($this->db->last_query()); + // print_r($personal_asset_grid['master_grid']); + // die(); $this->db->SELECT('*'); $this->db->FROM(PERSONALASSETGRIDVARIANCE); $this->db->WHERE('isactive',1); @@ -5866,7 +5892,10 @@ class PD_Controller extends REST_Controller { default: switch($pd_master_details[0]['fk_customer_segment']) { + case 4: case 5: + case 6: + case 7: $score_questions = PDSCORE::genericDI($score_questions,$loan_amt_from_loam_form,$personal_asset_grid); break; } @@ -6029,10 +6058,10 @@ class PD_Controller extends REST_Controller { $supplier_count = 0; if(array_key_exists('manufacturing_details',$supplier_form)) { - foreach($supplier_form['manufacturing_details'] as $manufacturing_details) + if(isset($client_form['manufacturing_details'][0]['main_raw_materials'])) { - $supplier_count = count($manufacturing_details['main_raw_materials']) ? ++$supplier_count: $supplier_count; + $supplier_count += count($client_form['manufacturing_details'][0]['main_raw_materials']) ? count($client_form['manufacturing_details'][0]['main_raw_materials']) : 0; } @@ -6041,10 +6070,11 @@ class PD_Controller extends REST_Controller { if(array_key_exists('trade_details',$supplier_form)) { - foreach($supplier_form['trade_details'] as $trade_details) + + if(isset($client_form['trade_details'][0]['trading_products'])) { - $supplier_count = count($trade_details['trading_products']) ? ++$supplier_count: $supplier_count; + $supplier_count += count($client_form['trade_details'][0]['trading_products']) ? count($client_form['trade_details'][0]['trading_products']): 0; } //echo 'IN trade-'.$supplier_count; @@ -6072,34 +6102,35 @@ class PD_Controller extends REST_Controller { $client_count = 0; if(array_key_exists('manufacturing_details',$client_form)) { - foreach($client_form['manufacturing_details'] as $manufacturing_details) + if(isset($client_form['manufacturing_details'][0]['main_raw_materials'])) { - $client_count = count($manufacturing_details['main_raw_materials']) ? ++$client_count: $client_count; + $client_count += count($client_form['manufacturing_details'][0]['main_raw_materials']) ? count($client_form['manufacturing_details'][0]['main_raw_materials']): 0; } } if(array_key_exists('trade_details',$client_form)) { - foreach($client_form['trade_details'] as $trade_details) + + if(isset($client_form['trade_details'][0]['trading_products'])) { - $client_count = count($trade_details['trading_products']) ? ++$client_count: $client_count; + $client_count += count($client_form['trade_details'][0]['trading_products']) ? count($client_form['trade_details'][0]['trading_products']): 0; } } if(array_key_exists('service_provider_details',$client_form)) { - foreach($client_form['service_provider_details'] as $service_provider_details) + if(isset($client_form['service_provider_details'][0]['service_products'])) { - - $client_count = count($service_provider_details['service_products']) ? ++$client_count: $client_count; + //print_r(count($client_form['service_provider_details'][0]['service_products'])); + $client_count += count($client_form['service_provider_details'][0]['service_products']) ? count($client_form['service_provider_details'][0]['service_products']) : 0; } } - + //echo $client_count; // 17 - QNO(2.8) - atleast one client $score_questions['business']['minimum_client_info'] = $client_count ? 'Provided':'Not Provided'; } diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index 4a830f14..5c5dbe32 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index 70e3fd45..d239a371 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -1584,6 +1584,7 @@ class GETPROCESSEDJSON { if($business_assets_detail['business_assets_mode'] != "" || $business_assets_detail['business_assets_mode'] != null) { + //echo $business_assets_detail['business_assets_mode']; $CI->db->SELECT( $master_tables_field_names['ASSETTYPE'] ); $CI->db->FROM(ASSETTYPE); $CI->db->WHERE('isactive',1); @@ -1592,6 +1593,7 @@ class GETPROCESSEDJSON //print_r($CI->db->last_query()); if(count($assest_mode_name)) { + //print_r($assest_mode_name); $raw_json['business_assets_details'][$business_assets_detail_key]['business_assets_mode_master'] = $assest_mode_name[0][$master_tables_field_names['ASSETTYPE']]; } @@ -1599,16 +1601,31 @@ class GETPROCESSEDJSON { - $CI->db->SELECT( $master_tables_field_names['PROPERTIES'] ); - $CI->db->FROM(PROPERTIES); + $CI->db->SELECT( $master_tables_field_names['ADDRESSTYPE'] ); + $CI->db->FROM(ADDRESSTYPE); $CI->db->WHERE('isactive',1); - $CI->db->WHERE( $master_tables_pkid['PROPERTIES'] ,$business_assets_detail['business_details'][0]['property_type']); + $CI->db->WHERE( $master_tables_pkid['ADDRESSTYPE'] ,$business_assets_detail['business_details'][0]['property_type']); $assest_mode_name= $CI->db->GET()->result_array(); //print_r($CI->db->last_query()); + //print_r($assest_mode_name); if(count($assest_mode_name)) { - $raw_json['business_assets_details'][$business_assets_detail_key]['business_details'][0]['property_type_master'] = $assest_mode_name[0][$master_tables_field_names['PROPERTIES']]; + $raw_json['business_assets_details'][$business_assets_detail_key]['business_details'][0]['property_type_master'] = $assest_mode_name[0][$master_tables_field_names['ADDRESSTYPE']]; } + // if($business_assets_detail['business_details'][0]['property_type']) + // { + // $CI->db->SELECT( $master_tables_field_names['ASSETTYPE'] ); + // $CI->db->FROM(ASSETTYPE); + // $CI->db->WHERE('isactive',1); + // $CI->db->WHERE( $master_tables_pkid['ASSETTYPE'] ,$business_assets_detail['business_details'][0]['property_type']); + // $assest_type= $CI->db->GET()->result_array(); + // //print_r($CI->db->last_query()); + // if(count($assest_type)) + // { + // $raw_json['business_assets_details'][$business_assets_detail_key]['business_details'][0]['business_details']['property_type_master'] = $assest_type[0][$master_tables_field_names['ASSETTYPE']]; + // } + // } + } if($business_assets_detail['business_assets_mode'] == 3) @@ -1629,7 +1646,8 @@ class GETPROCESSEDJSON } } } - return $raw_json; + return ($raw_json); + } /*****************########## END OF BUSINESS ASSETS FORM DETAILS ##########**************/ diff --git a/api/application/helpers/pdscore_helper.php b/api/application/helpers/pdscore_helper.php index 8240c7c1..77bc520c 100644 --- a/api/application/helpers/pdscore_helper.php +++ b/api/application/helpers/pdscore_helper.php @@ -201,8 +201,8 @@ class PDSCORE $actual_value_of_assets = $score_questions['general']['value_of_other_assets']; $asset_calculation_details['actual_value_of_assets'] = round($actual_value_of_assets,2); //echo 'actual_value_of_assets -'.$actual_value_of_assets;die(); - //print_r($loan_amt_from_loam_form); - $loan_amount = $loan_amt_from_loam_form; + //print_r($loan_amt_from_loam_form);die(); + $loan_amount = (int)$loan_amt_from_loam_form; $asset_calculation_details['loan_amount'] = $loan_amount; //echo 'loan_amount - '.$loan_amount; diff --git a/api/application/views/businees_scorecard.php b/api/application/views/businees_scorecard.php new file mode 100644 index 00000000..6ceead5f --- /dev/null +++ b/api/application/views/businees_scorecard.php @@ -0,0 +1,114 @@ + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index dd9a6359..f4f557be 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -998,7 +998,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $baRow = $pd_processed_forms[22][$business_count]; $businessAssetRow = json_decode($baRow['processed_json'],true); - //print_r($businessAssetRow);die(); + //print_r($businessAssetRow); $bindBusinessAsset["company_name"] ='Assets used for '; $bindBusinessAsset["company_name"] .=MYUTIL::findCompanyName($all_company_details,$businessAssetRow['company_id'],1); $bindBusinessAsset["company_name"] .=' Business :'; @@ -1008,7 +1008,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); array_push($businessAssetResult,$bindBusinessAsset); - //print_r($businessAssetResult); + // print_r($businessAssetResult);die(); ?>