diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 239819f0..352aedfa 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4194,7 +4194,7 @@ class PD_Controller extends REST_Controller { // } $data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC'); } - print_r($data['pd_processed_forms']);die(); + //print_r($data['pd_processed_forms']);die(); // print_r(json_decode($data['pd_processed_forms'][13][0]['processed_json'],true)); // echo count($data['pd_processed_forms'][1]); @@ -4685,7 +4685,8 @@ class PD_Controller extends REST_Controller { $assest_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); $business_assest_data = array(); $other_assest_data = array(); - //print_r($assest_data); + $business_address_assest_data = array(); + //print_r($assest_data);die(); if(count($assest_data)) { @@ -4696,7 +4697,7 @@ class PD_Controller extends REST_Controller { foreach($assest_data as $key => $assest) { $json = json_decode($assest['json'],true); - //print_r($json); + //print_r($json);die(); if(array_key_exists('business_assets_details',$json)) { foreach($json['business_assets_details'] as $asset_key => $business_asset) @@ -4732,6 +4733,21 @@ class PD_Controller extends REST_Controller { } } + + + if(array_key_exists('business_assets_for_address',$json)) + { + foreach($json['business_assets_for_address'] as $address_key => $address_asset) + { + if(!strcasecmp($address_asset['business_emi'],'yes')) + { + //echo $address_asset['address_label']; + $business_address_assest_data[] = $address_asset; + } + } + } + + } } @@ -4784,7 +4800,7 @@ class PD_Controller extends REST_Controller { $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['record'] = array('business_assets' =>$business_assest_data, 'other_assests'=> $other_assest_data); + $data['record'] = array('business_assets' =>$business_assest_data, 'other_assests'=> $other_assest_data,'business_address_asset' => $business_address_assest_data); $this->response($data,REST_Controller::HTTP_OK); } @@ -4890,6 +4906,28 @@ class PD_Controller extends REST_Controller { } } + + if(array_key_exists('trade_details',$supplier_data)) + { + + foreach($supplier_data['trade_details'] as $trade_detail_key => $trade_detail) + { + $temp_data = $trade_detail['trading_products']; + //print_r($temp_data);die(); + // print_r(count($temp_data)); + // print_r($temp_data[0]); + // print_r($temp_data[1]); + if($temp_data != "" || $temp_data != null) + { + foreach($temp_data as $trade) + { + //print_r($raw_material); + $final_data_from_supplier[] = $trade['trade_product_name']; + } + } + } + + } } $data['dataStatus'] = true; @@ -5140,24 +5178,26 @@ class PD_Controller extends REST_Controller { //seperate PD Scorable quesitons from JSON $score_questions = $this->seperateScoreQuestions($form_data,$pd_master_details[0]['is_otp_done']); + //print_r($score_questions);die(); //Get Pesrsonal Assets Grid Masters Details $this->db->SELECT('*'); $this->db->FROM(PERSONALASSETGRID); $this->db->WHERE('isactive',1); - $this->db->WHERE('loan_amount_from<',$pd_master_details[0]['loan_amount']); - $this->db->WHERE('loan_amount_to>',$pd_master_details[0]['loan_amount']); + $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()); $this->db->SELECT('*'); $this->db->FROM(PERSONALASSETGRIDVARIANCE); $this->db->WHERE('isactive',1); $personal_asset_grid['variance_grid'] = $this->db->GET()->result_array(); - + //print_r($personal_asset_grid);die(); // Call PD score functions $combination = $pd_master_details[0]['fk_lender_id'].$pd_master_details[0]['fk_product_id'].$pd_master_details[0]['fk_customer_segment']; + switch($combination) { case 111111: @@ -5167,7 +5207,7 @@ class PD_Controller extends REST_Controller { default: switch($pd_master_details[0]['fk_customer_segment']) { - case 1: + case 5: $score_questions = PDSCORE::genericDI($score_questions,$pd_master_details,$personal_asset_grid); break; } diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index 380f67b0..c76e781d 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 13671e87..20720120 100644 --- a/api/application/helpers/assetsform_helper.php +++ b/api/application/helpers/assetsform_helper.php @@ -133,7 +133,8 @@ public static function getBusinessAssetsDetails($values){ $storeValue['business_approximate_market_value'] = ''; break; case 'OWNED': - $storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner']['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner']['name']; + //print_r($fetchVal['business_name_of_the_owner']);die(); + $storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner'][0]['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner'][0]['name']; $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['manufacturer_model_vehicle'].' purchased in '. $fetchVal['business_purchase_year']; $storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value']; break; @@ -153,7 +154,7 @@ public static function getBusinessAssetsDetails($values){ $storeValue['business_approximate_market_value'] = ''; break; case 'OWNED': - $storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner']['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner']['name']; + $storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner'][0]['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner'][0]['name']; $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['property_type']==1 ? $fetchVal['business_details'][0]['other_property_type'].' purchased in '. $fetchVal['business_purchase_year'] : $fetchVal['business_details'][0]['property_type'].' purchased in '. $fetchVal['business_purchase_year']; $storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value']; break; diff --git a/api/application/helpers/otherfamilyform_helper.php b/api/application/helpers/otherfamilyform_helper.php index 18825be2..51d4c36c 100644 --- a/api/application/helpers/otherfamilyform_helper.php +++ b/api/application/helpers/otherfamilyform_helper.php @@ -5,8 +5,9 @@ class Otherfamilyform public static function getFamilyDetails($values){ $mergeResult=array(); foreach($values as $fetchVal){ + //print_r($fetchVal);die(); $storeValue=array(); - $storeValue['selected_person']=$fetchVal['selected_person_master']; + $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'] .='.'; diff --git a/api/application/helpers/pdscore_helper.php b/api/application/helpers/pdscore_helper.php index 812e5423..f6146044 100644 --- a/api/application/helpers/pdscore_helper.php +++ b/api/application/helpers/pdscore_helper.php @@ -57,7 +57,7 @@ class PDSCORE $comment_locality = array('Excellent' => 10,'Good' => 7,'Poor' => 5,'Very Poor' => 2); $customer_behaviour = array('Rude' => 0,'Polite' => 10,'Others' => 0); $neibourhood_check_as_per_pd_officer = array( 'Positive' => 10, 'Negative' => 0); - $was_the_company_name_board_sighted = array('Yes' => 10, 'No' => 0); + $was_the_company_name_board_sighted = array('yes' => 10, 'no' => 0); $supplir_client_answer_scores = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0); $otp_done = array('Yes' => 10, 'No' => 0); @@ -76,7 +76,7 @@ class PDSCORE $stock_answer_scores = array('yes' => 10, 'no' => 0,'Not Applicable' => 0); $stock_raw_material_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0); $stock_finished_goods_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0); - $location_suited_for_busienss = array('well_suited' => 10 ,'fairly_suited' => 6,'not_suited' => 0); + $location_suited_for_busienss = array('well_suited.' => 10 ,'fairly_suited.' => 6,'not_suited.' => 0); $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 --------------*/ diff --git a/api/application/helpers/stockform_helper.php b/api/application/helpers/stockform_helper.php index 55d2f332..0d8e2d0f 100644 --- a/api/application/helpers/stockform_helper.php +++ b/api/application/helpers/stockform_helper.php @@ -6,11 +6,12 @@ class Stockform public static function getStockManufacturingDetails($rawMaterial,$goods){ $getRawMaterial=array(); $getGoods=array(); + //print_r($rawMaterial);die(); // raw material if(count($rawMaterial)>0){ $getRawMaterial = array_map(function($tag) { $getUom= $tag['raw_uom']==1 ? $tag['other_uom'] : $tag['raw_uom']; - $getSufficient= (strtoupper($tag['stock_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_raw']) =='YES') ? 'Yes, the stock of raw materials observed and sufficient considering the size of operations' : 'No, the stock of raw materials observed and sufficient considering the size of operations because of '.$tag['rawmaterial_remarks']); + return array( 'type' => 'Raw Material', @@ -18,7 +19,7 @@ public static function getStockManufacturingDetails($rawMaterial,$goods){ 'quantity' => strtoupper($tag['stock_observed'])=='YES' ? $tag['raw_quantity'] : '', 'uom' => strtoupper($tag['stock_observed'])=='YES' ? $getUom : '', 'value' => strtoupper($tag['stock_observed'])=='YES' ? 'Rs.'.$tag['raw_value'] : '', - 'is_sufficiant' => (strtoupper($tag['stock_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['stock_observed'])=='NO') ? $getSufficient : ''), + ); }, $rawMaterial); } @@ -26,14 +27,14 @@ public static function getStockManufacturingDetails($rawMaterial,$goods){ if(count($goods)>0){ $getGoods = array_map(function($tag) { $getGUom= $tag['goods_uom']==1 ? $tag['goods_other_uom'] : $tag['goods_uom']; - $getGSufficient= (strtoupper($tag['goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_goods']) =='YES') ? 'Yes, the stock of finished goods observed and sufficient considering the size of operations' : 'No, the stock of finished goods observed and sufficient considering the size of operations because of '.$tag['finishedgoods_remarks']); + return array( 'type' => 'Finished Goods', 'name' => $tag['goods_name'], 'quantity' => strtoupper($tag['goods_observed'])=='YES' ? $tag['goods_quantity'] : '', 'uom' => strtoupper($tag['goods_observed'])=='YES' ? $getGUom : '', 'value' => strtoupper($tag['goods_observed'])=='YES' ? 'Rs.'.$tag['goods_value'] : '', - 'is_sufficiant' => (strtoupper($tag['goods_observed'])=='YES') ? $getGSufficient : ((strtoupper($tag['goods_observed'])=='NO') ? $getGSufficient : ''), + ); }, $goods); } diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index c7fb7de7..24bcf4d9 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -288,10 +288,11 @@ class PD_Model extends SPARQ_Model { public function getPDAddress($pdid) { - $this->db->SELECT('PDADDRESS.pd_address_id, PDADDRESS.addressline, PDADDRESS.fk_city, PDADDRESS.fk_state,PDADDRESS.pincode,PDADDRESS.other_pincode,PDADDRESS.isactive,PDADDRESS.createdon,PDADDRESS.updatedon,PDADDRESS.is_visited'); + $this->db->SELECT('PDADDRESS.pd_address_id, PDADDRESS.addressline1, PDADDRESS.fk_city, PDADDRESS.fk_state,PDADDRESS.pincode as pincode_id,PINCODE.pincode,PDADDRESS.other_pincode,PDADDRESS.isactive,PDADDRESS.createdon,PDADDRESS.updatedon,PDADDRESS.is_visited,CITY.name as city_name,STATE.name as state_name'); $this->db->FROM(PDADDRESS.' as PDADDRESS'); $this->db->JOIN(STATE.' as STATE','PDADDRESS.fk_state = STATE.state_id','LEFT'); $this->db->JOIN(CITY.' as CITY','PDADDRESS.fk_city = CITY.city_id','LEFT'); + $this->db->JOIN(PINCODE.' as PINCODE','PDADDRESS.pincode = PINCODE.pincode_id','LEFT'); $this->db->WHERE('PDADDRESS.fk_pd_id ',$pdid); $this->db->ORDER_BY('PDADDRESS.pd_address_id'); $result_child_array = $this->db->GET()->result_array(); diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index 5959bb7f..6bd92373 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -121,10 +121,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
"; echo "Score Summary
"; - echo "General Section Score :".$pd_score['score_summary']['general']['actual_score']."