diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 5bb1627a..eee7d1e9 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -93,15 +93,19 @@ defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getPDOfficerCurrentLocat defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); if(ENVIRONMENT == 'development') { +defined('SATELLITE_IMAGE_LOCATION') OR define('SATELLITE_IMAGE_LOCATION','phantomjs_dev'); defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','lender'); defined('PHANTOMJSSCRIPT_LOCATION') OR define('PHANTOMJSSCRIPT_LOCATION','phantomjs_dev'); defined('LOGTOBOT') OR define('LOGTOBOT',0); +defined('GOOGLE_STATIC_MAP_API_KEY') OR define('GOOGLE_STATIC_MAP_API_KEY','AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg'); } else if(ENVIRONMENT == 'testing') { + defined('SATELLITE_IMAGE_LOCATION') OR define('SATELLITE_IMAGE_LOCATION','phantomjs_test'); defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','len'); defined('PHANTOMJSSCRIPT_LOCATION') OR define('PHANTOMJSSCRIPT_LOCATION','phantomjs_test'); defined('LOGTOBOT') OR define('LOGTOBOT',0); + defined('GOOGLE_STATIC_MAP_API_KEY') OR define('GOOGLE_STATIC_MAP_API_KEY','AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg'); } /*********************END of AWS resources Constants*************************************************/ diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 4bf4af4b..9c6cb5c9 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->info("NEW PD Trigged : ".$pd_id,array('ENV'=>ENVIRONMENT,'DATA' => $pd_details)); PDALERTS::pdnotification($pd_id); $data['dataStatus'] = true; @@ -708,17 +709,17 @@ class PD_Controller extends REST_Controller { $pd_details['random_string'] = $randomString; - $ch = curl_init(); + /* $ch = curl_init(); $timeout = 5; - $url = 'https://ssa.sineedge.com/officertracking/#/officertracking/'.$randomString; + $url = 'https://ssa.sineedge.com/ot/#/officertracking/'.$randomString; //echo "$url"; curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $tinyurl = curl_exec($ch); - curl_close($ch); - $pd_details['encrypted_url'] = $tinyurl; + curl_close($ch); */ + $pd_details['encrypted_url'] = $url; //echo $tinyurl; /************ASSIGN Random URL******************/ @@ -752,6 +753,9 @@ class PD_Controller extends REST_Controller { unset($pd_details['link']); } + //get satellite image blob and store it in DB + $pd_details['satellite_image_base64_blob'] = $this->getSatelliteImage($pd_details['pd_id']); + //If it is Addtional PD ,then update 'COMPLETE' status for primary and all other addtional PD's if($exist_pd_details[0]['is_child'] == 1) { @@ -776,6 +780,8 @@ class PD_Controller extends REST_Controller { $this->PD_Model->updateRecords($single_pd,PDTRIGGER,array('pd_id' => $single_pd['pd_id'])); } + + } } @@ -2294,8 +2300,8 @@ class PD_Controller extends REST_Controller { break; case 11: //In Stock UOM Only - also coming Text - right now No need to convert. - //$processed_json = GETPROCESSEDJSON::convertStockDetailsForm($records,$formid); - $processed_json = $records; + $processed_json = GETPROCESSEDJSON::convertStockDetailsForm($records,$formid); + //print_r($processed_json);die(); break; case 12: $processed_json = $records; @@ -4687,12 +4693,48 @@ class PD_Controller extends REST_Controller { } - + function getSatelliteImage($pd_id) + { + $pdid = $pd_id; + $pdmas = $this->PD_Model->getPDMasterDetails($pdid); + + //load satellite script from db + $satellite_script_from_db = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => 'phantomsatellite_local'),SCRIPTS); + $satellite_script = $satellite_script_from_db[0]['script_content']; + + //Get Address Data + $address =$pdmas[0]['addressline1'].','.$pdmas[0]['city_name'].','.$pdmas[0]['state_name']; + $geo_location = $pdmas[0]['start_location']; + $google_map_static_api_key = GOOGLE_STATIC_MAP_API_KEY; + + + + //Replacing Place holders + $satellite_script = str_replace('{{ADDRESS}}',$address,$satellite_script); + $satellite_script = str_replace('{{GEOLOCATION}}',$geo_location,$satellite_script); + $satellite_script = str_replace('{{API_KEY}}',$google_map_static_api_key,$satellite_script); + + file_put_contents(APPPATH.'/views/js/phantomsatellite.js',$satellite_script); + + //call& execute phantom script + $str = 'phantomjs '.APPPATH.'/views/js/phantomsatellite.js'; + exec($str,$ou); + exec('phantom.exit();'); + + + // //convert as base 64 image. + $satellite_image_png_path = APPPATH.'/views/report_templates/satellite.png'; + $type = pathinfo($satellite_image_png_path, PATHINFO_EXTENSION); + $satellite_img_content = file_get_contents($satellite_image_png_path); + $base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($satellite_img_content); + + return $base64_pdscore_chart_url; + + } public function codeigniterViewTest_post() { - // PDALERTS::pdnotification(600); - // die(); + $records = $this->post('records'); $pdid = $records['pd_id']; @@ -4706,10 +4748,9 @@ class PD_Controller extends REST_Controller { $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); - //print_r($data['pd_score']); - // 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; + // $data['pd_score'] = $this->calculateScore($pdid); + + // $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; if($chart) @@ -4729,7 +4770,7 @@ class PD_Controller extends REST_Controller { exec($str,$ou); exec('phantom.exit();'); - // //print_r($ou); + //print_r($ou); $chart_img_path = APPPATH.'/views/report_templates/chart.png'; $type = pathinfo($chart_img_path, PATHINFO_EXTENSION); @@ -4737,7 +4778,7 @@ class PD_Controller extends REST_Controller { $base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($chart_img_content); $data['base64_pdscore_chart_url'] = $base64_pdscore_chart_url; // echo $data['base64_pdscore_chart_url']; - //die(); + //GENERATE CHART PART } //GET ALL PROCESSED JSON diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index 051010a0..4a830f14 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/helpers/assetsform_helper.php b/api/application/helpers/assetsform_helper.php index 61763186..4842f2d7 100644 --- a/api/application/helpers/assetsform_helper.php +++ b/api/application/helpers/assetsform_helper.php @@ -5,13 +5,15 @@ class Assetsform // other asset details public static function getOthersAssetsDetails($values){ $mergeResult=array(); - foreach($values as $fetchVal){ + foreach($values as $key => $fetchVal){ $storeValue=array(); $storeValue['assets_mode'] = $fetchVal['assets_mode_master']; $storeValue['name_of_the_owner'] = $fetchVal['name_of_the_owner'][0]['id']==0 ? $fetchVal['other_owner'] : $fetchVal['name_of_the_owner'][0]['name']; + $storeValue['purchase_year'] = $fetchVal['vintage_personal']; + $storeValue['emi'] = (!strcasecmp($fetchVal['emi'],'yes')); // this is for investments type if($fetchVal['assets_mode']==7){ - $storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['details'][0]['amount_of_invest']; + $storeValue['approximate_market_value'] = $fetchVal['details'][0]['amount_of_invest']; switch($fetchVal['details'][0]['investments_type_master']) { case 1: $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['other_investments_type'].' with '.$fetchVal['details'][0]['in_which_organisation']; @@ -39,7 +41,8 @@ public static function getOthersAssetsDetails($values){ } // this is for life insurance else if($fetchVal['assets_mode']==6){ - $storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['details'][0]['sum_assured']; + $storeValue['approximate_market_value'] = $fetchVal['details'][0]['sum_assured']; + $storeValue['is_sum_assured'] = 1; switch($fetchVal['details'][0]['frequency_mode']) { case 1: @@ -70,27 +73,33 @@ public static function getOthersAssetsDetails($values){ } // this is machinaries else if($fetchVal['assets_mode']==4){ - $storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['approximate_market_value']; + $storeValue['approximate_market_value'] = $fetchVal['approximate_market_value']; $storeValue['about_assets'] = $fetchVal['details'][0]['equipment_manufacturing_description']; } // this is for vehicle else if($fetchVal['assets_mode']==3){ - $storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['approximate_market_value']; + $storeValue['approximate_market_value'] = $fetchVal['approximate_market_value']; - $storeValue['about_assets'] = $fetchVal['details'][0]['manufacturer_model_vehicle'].' purchased in '. $fetchVal['purchase_year']; + $storeValue['about_assets'] = $fetchVal['details'][0]['vehicle_type_master'].' - '.$fetchVal['details'][0]['manufacturer_model_vehicle']; } // this property else if($fetchVal['assets_mode']==2){ - $storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['approximate_market_value']; - $storeValue['about_assets'] = $fetchVal['details'][0]['property_type']==1 ? $fetchVal['details'][0]['other_property_type'].' purchased in '. $fetchVal['purchase_year'] : $fetchVal['details'][0]['property_type'].' purchased in '. $fetchVal['purchase_year']; + $storeValue['approximate_market_value'] = $fetchVal['approximate_market_value']; + $storeValue['assets_mode'] .= '
('.$fetchVal['details'][0]['property_type_master'].')'; + + $storeValue['about_assets'] = $fetchVal['details'][0]['address_of_the_property']? 'Address of Property : ' . $fetchVal['details'][0]['address_of_the_property'].'.' : ''; + + $storeValue['about_assets'] .= $fetchVal['details'][0]['describe_of_the_property_asset']? '
Description of Asset : ' . $fetchVal['details'][0]['describe_of_the_property_asset'].'.' : ''; + + $storeValue['about_assets'] .= $fetchVal['details'][0]['area_covered_by_this_property']? '
Area of Covered : ' . $fetchVal['details'][0]['area_covered_by_this_property'].'.' : ''; } //this is for other else if($fetchVal['assets_mode']==1){ - $storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['details'][0]['any_other_asset_value']; + $storeValue['approximate_market_value'] = $fetchVal['details'][0]['any_other_asset_value']; $storeValue['about_assets'] = $fetchVal['details'][0]['any_other_assets'].' purchased in '. $fetchVal['purchase_year']; } diff --git a/api/application/helpers/bankingform_helper.php b/api/application/helpers/bankingform_helper.php index 97f394e4..312e9512 100644 --- a/api/application/helpers/bankingform_helper.php +++ b/api/application/helpers/bankingform_helper.php @@ -30,14 +30,14 @@ public static function getIndividualBankingDetails($values){ if(count($values)>0){ $values = array_map(function($tag) { $count_vintage = $tag['vintage_year'] >0 ? $tag['vintage_year'] :""; - $count_vintage .= ($tag['vintage_year'] == 1) ? " Year" : (($tag['vintage_year'] > 1) ? " Years" : ""); + $count_vintage .= ($tag['vintage_year'] == 1) ? " Yr" : (($tag['vintage_year'] > 1) ? " Yrs" : ""); $count_vintage.=' '; $count_vintage .=$tag['vintage_month'] >0 ? $tag['vintage_month'] : ""; $count_vintage .=($tag['vintage_month'] == 1) ? " Month" : (($tag['vintage_month'] > 1) ? " Months" : ""); return array( 'account_name' => $tag['applicant_name']['id']==0 ? $tag['other_applicant'] : $tag['applicant_name']['name'], - 'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name'], - 'account_type' => $tag['account_type'], + 'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name_master'], + 'account_type' => $tag['account_type_master'], 'main_business' => $tag['salary'], 'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : ''), 'vintage' => $count_vintage, diff --git a/api/application/helpers/financialform_helper.php b/api/application/helpers/financialform_helper.php index 2160279e..86aebeaa 100644 --- a/api/application/helpers/financialform_helper.php +++ b/api/application/helpers/financialform_helper.php @@ -4,7 +4,21 @@ class Financialform { //other loan obligations public static function getOtherLoanDetails($values){ - $values = array_map(function($tag) { + + + $first_row = 'Loan Type'; + $second_row = 'Loan Amount (Rs)'; + // $third_row = 'Loan Amount (Rs)'; + $fourth_row = 'Availed From'; + $fifth_row = 'Borrower'; + $sixth_row = 'Instalment Amount (Rs)'; + $seventh_row = 'Instalment Frequency'; + $eigth_row = 'Original Tenure (Months)'; + $ninth_row = 'Elapsed Tenure (Months)'; + $tenth_row = 'Balance Tenure (Months)'; + + foreach($values as $key => $tag) + { $setFrequencyType=''; switch($tag['frequency']) { case 1: @@ -33,19 +47,35 @@ public static function getOtherLoanDetails($values){ } $loanTaken=$tag['loan_taken_by']; + + + + $first_row .= $tag['loan_type']==1 ? ''.$tag['others_loan_type'].'' : ''.$tag['loan_type_master'] .''; + + $second_row .= ''.MYUTIL::customIndianNumberFormat($tag['loan_amount']).''; + + //$third_row = ''.MYUTIL::customIndianNumberFormat($tag['loan_amount']).''; + + $fourth_row .= $tag['lender']==1 ? ''.$tag['others_lender'].'' : ''.$tag['lender_master'].''; + + $fifth_row .= $loanTaken['id']==0 ? ''.$tag['others_loan_taken'].'' : ''.$loanTaken['name'].''; + + $sixth_row .= ''.MYUTIL::customIndianNumberFormat($tag['emi']).''; + + $seventh_row .= $tag['frequency']==1 ? ''.$tag['other_frequency'].'' : ''.$tag['frequency_master'].''; + + $eigth_row .= ''.$tag['original_tenure'].''; + + $ninth_row .= ''.$tag['elapsed_tenure'].''; + + $tenth_row .= ''.($tag['original_tenure'] - $tag['elapsed_tenure']).''; + + } return array( - 'loan_type' => $tag['loan_type']==1 ? $tag['others_loan_type'] : $tag['loan_type_master'], - 'loan_amount' => $tag['loan_amount'], - 'frequency' => $tag['frequency']==1 ? $tag['other_frequency'] : $tag['frequency_master'], - 'lender' => $tag['lender']==1 ? $tag['others_lender'] : $tag['lender_master'], - 'original_tenure' => $tag['original_tenure'], - 'current_balance_tenure' => $tag['current_balance_tenure'], - 'elapsed_tenure' => $tag['elapsed_tenure'], - 'emi' => $tag['emi'].$setFrequencyType, - 'loan_taken_by' => $loanTaken['id']==0 ? $tag['others_loan_taken'] : $loanTaken['name'], + 'first_row' => $first_row.'','second_row' => $second_row.'','fourth_row' => $fourth_row.'','fifth_row' => $fifth_row.'','sixth_row' => $sixth_row.'','seventh_row' => $seventh_row.'','eigth_row' => $eigth_row.'', 'ninth_row' => $ninth_row.'', 'tenth_row' => $tenth_row.'' ); - }, $values); - return $values; + + //return $values; } // business financial details @@ -140,8 +170,11 @@ public static function getBusinessCustomerHeader($values){ } } -public static function getAvailableFacilities($array) +public static function getAvailableFacilities($arr) { + echo "@@@@@@@@@@@@@@"; + print_r($arr); + die(); $word_array = array('1' => 'Others', '2' => 'Bank Guarantee', '3' => 'Cash Credit Limit','4' => 'Factoring', '5' => 'Forfaiting', '6' => 'Letter of Credit'); if(is_array($array)) { diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index 731242a8..70e3fd45 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -472,56 +472,97 @@ class GETPROCESSEDJSON { if(array_key_exists('manufacturing_details',$raw_json)) { - - if($raw_json['manufacturing_details'] != "" || $raw_json['manufacturing_details'] != null) + foreach($raw_json['manufacturing_details'] as $main_key =>$manufacturing_details) { - - foreach($raw_json['manufacturing_details'] as $manufacturing_details_key => $manufacturing_details) - { - - foreach($manufacturing_details as $manufacturing_details_key => $manufacturing_detail) + if($manufacturing_details != "" || $manufacturing_details != null){ + foreach($manufacturing_details as $second_key => $details) { - //print_r($manufacturing_detail); - foreach($manufacturing_detail as $key => $value) + if(is_array($details)) { - if($value != "" || $value != null) - { - //compare with master_keys array - foreach($master_keys as $master_key => $master_value) - { - if(!strcmp($key,$master_value['key']) && $master_value['ismaster'] == 1) - { - print_r($key);echo "\n\n"; - //GET MASASTER DATA - - $table = constant($master_value['master_name']); + foreach($details as $key => $value) + { + $uom_name = null; + $uom_name = isset($value['raw_uom']) ? 'raw_uom':(isset($value['goods_uom']) ? 'goods_uom' : null); + $uom_value = isset($value['raw_uom']) ? $value['raw_uom']:(isset($value['goods_uom']) ? $value['goods_uom'] : null); - $temp_fields = array($master_tables_field_names[$master_value['master_name']].' as name'); - - $where_condition_array = array($master_tables_pkid[$master_value['master_name']] => $value); - - $result_data = $CI->PD_Model->selectCustomRecords($temp_fields,$where_condition_array,$table); - if(count($result_data)) + $CI->db->SELECT( $master_tables_field_names['UOM'] ); + $CI->db->FROM(UOM); + $CI->db->WHERE( $master_tables_pkid['UOM'],$uom_value); + $uom= $CI->db->GET()->result_array(); + + if(count($uom)) { - //print_r($result_data[0]['name']); - // $key = $key . '_master'; - // $raw_json['income_details'][$income_details_key][$key] = $result_data[0]['name']; - + $uom_master = $uom[0][ $master_tables_field_names['UOM'] ]; + $raw_json['manufacturing_details'][$main_key][$second_key][$key]['uom_master'] = $uom_master; } - } - } - } + } } } - - - // print_r($loan); + } } + } + //************* + if(array_key_exists('retail_details',$raw_json)) + { + foreach($raw_json['retail_details'] as $main_key =>$retail_details) + { + if($retail_details != "" || $retail_details != null){ + foreach($retail_details as $second_key => $details) + { + if(is_array($details)) + { + foreach($details as $key => $value) + { + $CI->db->SELECT( $master_tables_field_names['UOM'] ); + $CI->db->FROM(UOM); + $CI->db->WHERE( $master_tables_pkid['UOM'],$value['traded_goods_uom']); + $uom= $CI->db->GET()->result_array(); + + if(count($uom)) + { + $uom_master = $uom[0][ $master_tables_field_names['UOM'] ]; + $raw_json['retail_details'][$main_key][$second_key][$key]['uom_master'] = $uom_master; + } + } + } + } + } + } + } + + //************* + if(array_key_exists('trade_details',$raw_json)) + { + foreach($raw_json['trade_details'] as $main_key =>$trade_details) + { + if($retail_details != "" || $retail_details != null){ + foreach($trade_details as $second_key => $details) + { + if(is_array($details)) + { + foreach($details as $key => $value) + { + $CI->db->SELECT( $master_tables_field_names['UOM'] ); + $CI->db->FROM(UOM); + $CI->db->WHERE( $master_tables_pkid['UOM'],$value['traded_goods_uom']); + $uom= $CI->db->GET()->result_array(); + + if(count($uom)) + { + $uom_master = $uom[0][ $master_tables_field_names['UOM'] ]; + $raw_json['trade_details'][$main_key][$second_key][$key]['uom_master'] = $uom_master; + } + } + } + } + } } } } + return $raw_json; + } /*****************########## END STOCK DETAILS FORM ##########**************/ diff --git a/api/application/helpers/neighbourreferencecheckform_helper.php b/api/application/helpers/neighbourreferencecheckform_helper.php index 0c9131cc..336173ff 100644 --- a/api/application/helpers/neighbourreferencecheckform_helper.php +++ b/api/application/helpers/neighbourreferencecheckform_helper.php @@ -2,26 +2,64 @@ class Neighbourreferencecheckform { -public static function getNeighbourhoodDetails($values,$pdMasterValue){ +public static function getNeighbourhoodDetails($company_name,$values,$pdMasterValue){ $applicantName=$pdMasterValue['main_applicant']; - $values = array_map(function($tag) use ($applicantName) { - $makeSentense='Neighbour '; - $makeSentense.= $tag['neighbourhood_name']; - $makeSentense.=" was met and he/she confirmed that he/she "; - if(strtoupper($tag['do_know'])=='YES'){ + $values = array_map(function($tag) use ($applicantName,$company_name) { + $neighbourhood_name='Neighbour Check was done with '; + $neighbourhood_name.= $tag['neighbourhood_name'].'.'; + $neighbourhood_do_know = null; + $neighbourhood_business_running_yr = null; + $ownership = null; + + if(strtoupper($tag['do_know'])=='YES'){ - $makeSentense.="knows ".$applicantName.' since '; - $makeSentense.= ($tag['how_long_do_know_in_year'] == 1) ? $tag['how_long_do_know_in_year']." year" : (($tag['how_long_do_know_in_year'] > 1) ? $tag['how_long_do_know_in_year']." years" : ""); - $makeSentense.=' and he/she is '; - $makeSentense.=(strtoupper($tag['is_applicant_owner']) == 'YES') ? "owner of the business." : ((strtoupper($tag['is_applicant_owner']) == 'NO') ? "not owner of the business." : ""); - } - else if(strtoupper($tag['do_know'])=='NO'){ - $makeSentense.="does not know ".$applicantName.'.'; - } - return $makeSentense; + $neighbourhood_do_know = $tag['neighbourhood_name']." knows about applicant and their business."; + } else if(strtoupper($tag['do_know'])=='NO'){ + $neighbourhood_do_know = $tag['neighbourhood_name']." did not know about the applicant or their business."; + } + + if($tag['how_long_do_know_in_year']) + { + $neighbourhood_business_running_yr = $tag['neighbourhood_name']." confirmed that the business has been in operation for "; + $neighbourhood_business_running_yr .= ($tag['how_long_do_know_in_year'] == 1) ? $tag['neighbourhood_name'].' '.$tag['how_long_do_know_in_year']." year" : (($tag['how_long_do_know_in_year'] > 1) ? $tag['how_long_do_know_in_year']." years" : ""); + + $neighbourhood_business_running_yr .= ($tag['how_long_do_know_in_month'] == 1) ? ' and '.$tag['how_long_do_know_in_month']." month" : (($tag['how_long_do_know_in_month'] > 1) ? ' and '.$tag['how_long_do_know_in_month']." months" : ""); + $neighbourhood_business_running_yr .= '.'; + } + else + { + $neighbourhood_business_running_yr = $tag['neighbourhood_name']." was not aware of how long the business is in operation."; + } + $ownwers_list = ''; + if($tag['organisation_owner']){ + foreach($tag['organisation_owner'] as $owner) + { + if($owner['id'] != 0) + { + $ownwers_list .= $owner['name'].','; + } + else + { + $ownwers_list .= ' '.$tag['other_organisation_owner']; + } + } + $ownwers_list = substr_replace($ownwers_list, ' and', strrpos($ownwers_list, ','),1); + $grammer1 = count($tag['organisation_owner']) > 0 ? ' are': ' is'; + $grammer2 = count($tag['organisation_owner']) > 0 ? 'owners': 'owner'; + $ownership = 'As per '.$tag['neighbourhood_name'].' the '.$grammer2 .' of '.$company_name.$grammer1.$ownwers_list.'.'; + }else + { + $ownership = $tag['neighbourhood_name']." was not aware of the business ownership."; + } + //$makeSentense.=(strtoupper($tag['is_applicant_owner']) == 'YES') ? "owner of the business." : ((strtoupper($tag['is_applicant_owner']) == 'NO') ? "not owner of the business." : ""); + + return array('neighbourhood_name' => $neighbourhood_name,'neighbourhood_do_know' => $neighbourhood_do_know,'neighbourhood_business_running_yr' => $neighbourhood_business_running_yr,'ownership' => $ownership); }, $values); return $values; } + + + public static function getReferenceDetails($values,$pdMasterValue) { $applicantName=$pdMasterValue['main_applicant']; $values = array_map(function($tag) use ($applicantName) { diff --git a/api/application/helpers/otherfamilyform_helper.php b/api/application/helpers/otherfamilyform_helper.php index 51d4c36c..429edc74 100644 --- a/api/application/helpers/otherfamilyform_helper.php +++ b/api/application/helpers/otherfamilyform_helper.php @@ -8,26 +8,34 @@ public static function getFamilyDetails($values){ //print_r($fetchVal);die(); $storeValue=array(); $storeValue['selected_person']= isset($fetchVal['selected_person_master']) ? $fetchVal['selected_person_master'] : $fetchVal['selected_person']; - $storeValue['residency_address']=$fetchVal['residence_place'].','.$fetchVal['residence_city'].','.$fetchVal['residence_state'].'-'; - $storeValue['residency_address'] .=($fetchVal['residence_pin'] == 1) ? $fetchVal['residence_other_pincode'] : (($fetchVal['residence_pin'] > 1) ? $fetchVal['residence_pin'] : ""); + $storeValue['residency_address']=$fetchVal['residence_place'].' in '.$fetchVal['residence_city_master'].','.$fetchVal['residence_state_master'].'-'; + $storeValue['residency_address'] .=($fetchVal['residence_pin'] == 1) ? $fetchVal['residence_other_pincode'] : (($fetchVal['residence_pin'] > 1) ? $fetchVal['residence_pincode_master'] : ""); //$storeValue['residency_address'] .='.'; $storeValue['residence_No_of_years']=($fetchVal['residence_No_of_years'] == 1) ? $fetchVal['residence_No_of_years'].' year' :(($fetchVal['residence_No_of_years'] > 1) ? $fetchVal['residence_No_of_years'].' years' : ""); - $storeValue['residence_ownership']=($fetchVal['residence_ownership'] == 1) ? $fetchVal['ownershipOther'] :(($fetchVal['residence_ownership'] == 3) ? $fetchVal['residence_ownership_master'].' @ Rs.'.$fetchVal['rent'].' per month' : $fetchVal['residence_ownership_master']); + $storeValue['residence_ownership']=($fetchVal['residence_ownership'] == 1) ? $fetchVal['ownershipOther'] :(($fetchVal['residence_ownership'] == 3) ? $fetchVal['residence_ownership_master'] : $fetchVal['residence_ownership_master']); + $storeValue['rent'] = $fetchVal['rent']; $storeValue['no_family_members']= count($fetchVal['family_members_details']) > 0 ? count($fetchVal['family_members_details']) : '0'; $storeValue['family_members_details'] = array_map(function($tag) { $getFamilyEarning=''; if($tag['family_member_earning_status']==1){ $getFamilyEarning= 'Earning '; - $getFamilyEarning .= $tag['earning_segment_master']==1 ? $tag['earning_if_others_segment'].' with '.$tag['earning_name_of_the_employer_or_business'].' since '.$tag['earning_number_of_years_in_employment_or_business'].' years earning Rs.'.$tag['earning_gross_income_per_month'].' per month ' : $tag['earning_segment_master'].' with '.$tag['earning_name_of_the_employer_or_business'].' since '.$tag['earning_number_of_years_in_employment_or_business'].' years earning Rs.'.$tag['earning_gross_income_per_month'].' per month '; + $getFamilyOccupation = $tag['earning_segment']==1 ? $tag['earning_if_others_segment'].' Income of '.$tag['earning_gross_income_per_month'].' per month. ':' Income of '.$tag['earning_gross_income_per_month'].' per month.'; + $getFamilyOccupation .= $tag['earning_name_of_the_employer_or_business'] ? ' with '.$tag['earning_name_of_the_employer_or_business'].'.' : ''; + + $getFamilyOccupation .= 'He has been working for '.$tag['earning_number_of_years_in_employment_or_business'].' years.'; + +// ? .' years earning Rs.'. : $tag['earning_segment_master'].' with '.$tag['earning_name_of_the_employer_or_business'].' since '.$tag['earning_number_of_years_in_employment_or_business'].' years earning Rs.'.$tag['earning_gross_income_per_month'].' per month '; } else if($tag['family_member_earning_status']==2){ - $getFamilyEarning= 'Non-Earning '.$tag['non_earning_occupation_master']; + $getFamilyEarning = 'Non-Earning'; + $getFamilyOccupation = $tag['non_earning_occupation_master']; } return array( 'name' => $tag['family_member_name'], 'family_member_relationship' => $tag['family_member_relationship_master'], 'family_member_age' => $tag['family_member_age'], 'family_member_earning' => $getFamilyEarning, + 'family_member_occupation' => $getFamilyOccupation, ); }, $fetchVal['family_members_details']); array_push($mergeResult,$storeValue); diff --git a/api/application/helpers/otherincomeform_helper.php b/api/application/helpers/otherincomeform_helper.php index b144cd2f..3eb4877b 100644 --- a/api/application/helpers/otherincomeform_helper.php +++ b/api/application/helpers/otherincomeform_helper.php @@ -6,8 +6,9 @@ public static function getIncomeDetails($values){ $values = array_map(function($tag) { return array( 'source' => $tag['source']==1 ? $tag['others_source'] : $tag['source_master'], - 'amount' => 'Rs.'.$tag['amount'], + 'amount' => $tag['amount'], 'frequency' => $tag['frequency']==1 ? $tag['others_frequency'] : $tag['frequency_master'], + 'earned_by' => $tag['income_earned_by'][0]['name'] ); }, $values); return $values; diff --git a/api/application/helpers/pdscore_helper.php b/api/application/helpers/pdscore_helper.php index badec496..8240c7c1 100644 --- a/api/application/helpers/pdscore_helper.php +++ b/api/application/helpers/pdscore_helper.php @@ -81,7 +81,7 @@ class PDSCORE $business_activity_has_seen = array('yes' => 10, 'no' => 0); $vintage_of_business_account = array('100> to >=10' => 10,'7<= to <10' => 8,'5<= to <7' => 6,'3<= to <5' => 4,'3> to >0' => 2); /*-------- FINAL --------------*/ - $pd_officer_recommandations = array('Positive' => 10,'Negative' => 0,'Refer to Credit' => 5); + $pd_officer_recommandations = array('Positive' => 10,'Negative' => 0,'Refer to Credit' => 5,'Others' => 0); /*-----------CALCULATION PART -----------*/ diff --git a/api/application/helpers/stockform_helper.php b/api/application/helpers/stockform_helper.php index f88cd289..a25442da 100644 --- a/api/application/helpers/stockform_helper.php +++ b/api/application/helpers/stockform_helper.php @@ -6,11 +6,11 @@ class Stockform public static function getStockManufacturingDetails($rawMaterial,$goods){ $getRawMaterial=array(); $getGoods=array(); - //print_r($rawMaterial);die(); + //print_r($goods);die(); // raw material if(count($rawMaterial)>0){ $getRawMaterial = array_map(function($tag) { - $getUom= $tag['raw_uom']==1 ? $tag['other_uom'] : $tag['raw_uom']; + $getUom= $tag['raw_uom']==1 ? $tag['other_uom'] : (isset($tag['uom_master']) ? $tag['uom_master'] : ''); return array( @@ -26,7 +26,7 @@ public static function getStockManufacturingDetails($rawMaterial,$goods){ // goods if(count($goods)>0){ $getGoods = array_map(function($tag) { - $getGUom= $tag['goods_uom']==1 ? $tag['goods_other_uom'] : $tag['goods_uom']; + $getGUom= $tag['goods_uom']==1 ? $tag['goods_other_uom'] : (isset($tag['uom_master']) ? $tag['uom_master'] : ''); return array( 'type' => 'Finished Goods', @@ -46,7 +46,7 @@ public static function getStockRetailDetails($goods){ // goods if(count($goods)>0){ $goods = array_map(function($tag) { - $getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : $tag['traded_goods_uom']; + $getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : (isset($tag['uom_master']) ? $tag['uom_master'] : ''); $getSufficient= (strtoupper($tag['traded_goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_traded_goods']) =='YES') ? 'Yes, the stock of traded goods observed' : 'No, the stock of traded goods observed because of '.$tag['traded_goods_remarks']); return array( 'name' => $tag['traded_goods_name'], @@ -65,7 +65,7 @@ public static function getStockWholesaleDetails($goods){ // goods if(count($goods)>0){ $goods = array_map(function($tag) { - $getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : $tag['traded_goods_uom']; + $getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : (isset($tag['uom_master']) ? $tag['uom_master'] : ''); $getSufficient= (strtoupper($tag['traded_goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_traded_goods']) =='YES') ? 'Yes, the stock of traded goods observed' : 'No, the stock of traded goods observed because of '.$tag['traded_goods_remarks']); return array( 'name' => $tag['traded_goods_name'], diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 2df789cf..ac3a66af 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -744,7 +744,7 @@ 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.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,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y") as pd_report_generated_date,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, 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,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") 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.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,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,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location'); + $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,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y") as pd_report_generated_date,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, 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,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") 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.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,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,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location,PDTRIGGER.satellite_image_base64_blob'); $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'); diff --git a/api/application/views/js/phantomchart.js b/api/application/views/js/phantomchart.js index f6c04bd0..962ab575 100644 --- a/api/application/views/js/phantomchart.js +++ b/api/application/views/js/phantomchart.js @@ -1 +1 @@ -var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 78;var url = 'http://localhost:9999/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);}); \ No newline at end of file +var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 52.6;var url = 'http://localhost:9999/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);}); \ No newline at end of file diff --git a/api/application/views/js/phantomsatellite.js b/api/application/views/js/phantomsatellite.js new file mode 100644 index 00000000..cdeeebd8 --- /dev/null +++ b/api/application/views/js/phantomsatellite.js @@ -0,0 +1 @@ +var page = require('webpage').create();page.viewportSize = { width: 650, height: 250 };page.clipRect = { top: 0, left: 0, width: 500, height: 250 };var score = 78;var url = 'https://maps.googleapis.com/maps/api/staticmap?center=CORGO INDIA ENTERPRISES B 19 8 FIRST FLOOR,JOSHI COLONY PATPARGANJ,New Delhi,Delhi,IND&zoom=14&markers=color:red|28.6282898,77.3025616&size=800x300&maptype=roadmap&key=AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg';var image_url ='C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/satellite.png';page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);}); \ 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 f9c7c467..dd9a6359 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -6,13 +6,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); - + - +