diff --git a/.gitignore b/.gitignore index 587519b3..8e20071b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ api/application/vendor/* api/application/logs/* api/application/syslogs/* api/application/request_logs/* +api/application/pd_reports/* api/application/docs/* !api/application/logs/index.html !api/application/logs/.htaccess diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 9829fcec..e380dfd0 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -730,6 +730,7 @@ class PD_Controller extends REST_Controller { { $pd_details['start_location'] = $pd_details['link']; + $pd_details['pd_visit_date'] = date('Y-m-d h:m:s'); unset($pd_details['link']); $string2 = str_shuffle('1234567890'); $OTP = substr($string2,0,6); @@ -757,7 +758,7 @@ class PD_Controller extends REST_Controller { //get satellite image blob and store it in DB $pd_details['satellite_image_base64_blob'] = $this->getSatelliteImage($pd_details['pd_id']); - + //die(); //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) { @@ -3976,7 +3977,9 @@ class PD_Controller extends REST_Controller { $temp = $this->load->view('report_templates/JSONTOREPORT',$data,true); - + //Save Report as HTML Version with timestamp + $file_name = APPPATH.'pd_reports/'.$pdid.'_'.date('Y-m-d-h-m-s').'.html'; + file_put_contents($file_name,$temp,LOCK_EX); //PDF Gen using DOM PDF $pdf_doc = $this->pdfgenerator->generate($temp, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); @@ -4712,25 +4715,25 @@ class PD_Controller extends REST_Controller { //Get Address Data - $address = preg_replace("/[\n\r]/","",$pdmas[0]['addressline1']); + // $address = preg_replace("/[\n\r]/","",$pdmas[0]['addressline1']); - $address = $address.','.$pdmas[0]['city_name'].','.$pdmas[0]['state_name']; + //$address = $address.','.$pdmas[0]['city_name'].','.$pdmas[0]['state_name']; //Replacing space with + symbol - $address =str_replace(' ','+',$address); - $address =str_replace('\n','',$address); - $address =str_replace('\r','',$address); - $address =str_replace('\n\r','',$address); - $address =str_replace(PHP_EOL,'',$address); + // $address =str_replace(' ','+',$address); + // $address =str_replace('\n','',$address); + // $address =str_replace('\r','',$address); + // $address =str_replace('\n\r','',$address); + // $address =str_replace(PHP_EOL,'',$address); $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('{{ADDRESS}}',$geo_location,$satellite_script); $satellite_script = str_replace('{{GEOLOCATION}}',$geo_location,$satellite_script); $satellite_script = str_replace('{{API_KEY}}',$google_map_static_api_key,$satellite_script); - + //echo $satellite_script;die(); file_put_contents(APPPATH.'/views/js/phantomsatellite.js',$satellite_script); @@ -4747,17 +4750,26 @@ class PD_Controller extends REST_Controller { $base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($satellite_img_content); //generate log - $logger->info("Generate Satellite Called in (".ENVIRONMENT.")",array('Address' => $address,'script' => $satellite_script,'script_output' => $ou)); + $logger->info("Generate Satellite Called in (".ENVIRONMENT.")",array('script' => $satellite_script,'script_output' => $ou)); return $base64_pdscore_chart_url; } function getDetailedScoreCardChart($score) - { - $business_score['business'] = $score['business']; - - $general_score['general'] = $score['general']; - $logger = MYLOG::logFunction(); + { + + $business_score['business'] = array_reverse($score['business']); + $general_score['general'] = array_reverse($score['general']); + $logger = MYLOG::logFunction(); + //print_r($business_score['business']);die(); + foreach($business_score['business'] as $bsk => $score) + { + if((!($bsk == 'cerificates')) && (!strcasecmp($score['answer'],'not applicable'))) + { + unset($business_score['business'][$bsk]); + } + } + $business_score['business'] = array_reverse($business_score['business']); // print_r($general_score['general']);die(); $data = array(); @@ -4807,11 +4819,12 @@ class PD_Controller extends REST_Controller { else if($i == 2){ $data['base64_dsc_general'] = $base64_dsc_url; } } + else + { + $logger->error('SCORE CARD SCRIPT NOT FOUND'); + } } - else - { - $logger->error('SCORE CARD SCRIPT NOT FOUND'); - } + // print_r($data); // die(); return $data; @@ -4844,6 +4857,7 @@ class PD_Controller extends REST_Controller { public function codeigniterViewTest_post() { + //echo MYUTIL::customIndianNumberFormat(145263.45896);die(); $records = $this->post('records'); $pdid = $records['pd_id']; $is_regenerate = 0; @@ -4853,21 +4867,22 @@ 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); - //print_r($data['pd_score']); - //die(); + // print_r($data['pd_score']); + // die(); $data['assessed_income_details'] = $this->getAssessedIncomeForPDReport($pdid); // print_r($data['assessed_income_details']); // echo "**************************"; - $data['dsc_cards'] = $this->getDetailedScoreCardChart( $data['pd_score'] ); + // $data['dsc_cards'] = $this->getDetailedScoreCardChart( $data['pd_score'] ); - $score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0; + $score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],1) : 0; //echo $score_for_chart; - $chart = 1; + $chart = null; if($chart) { //GET phantom script from DB @@ -4904,12 +4919,21 @@ class PD_Controller extends REST_Controller { $where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i); $data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC'); + + $fields2 = array('*'); + $data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i); + + + // $this->getPDImages_post($fields2,array('fk_pd_id'=>$pdid,'fk_form_id' => $i),PDDOCUMENTS,array(),'','company_id','ASC'); + // print_r($this->db->last_query()); } - + //die(); //print_r(json_decode($data['pd_processed_forms'][14][0]['processed_json'],true)); //die(); //echo "*******************************************"; $t = $this->load->view('report_templates/JSONTOREPORT',$data,true); + $file_name = APPPATH.'pd_reports/'.$pdid.'_'.date('Y-m-d-h-m-s').'.html'; + //file_put_contents($file_name,$t,LOCK_EX); //echo $t; die(); //PDF Gen using DOM PDF $pdf_doc = $this->pdfgenerator->generate($t, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); @@ -5355,19 +5379,14 @@ class PD_Controller extends REST_Controller { //print_r($json);die(); if(array_key_exists('persons_with_relationships',$json)) { - - foreach($json['persons_with_relationships'] as $key => $relation) + foreach($json['persons_with_relationships'] as $key => $relation) { foreach($json['individuals'] as $ind) { - // if($relation['pd_co_applicant_id'] == $ind['pd_co_applicant_id']) - // { - // $relation['age'] = $ind['age']; - // } - //else if($relation['applicant_name'] == $ind['applicant_name']) { $relation['age'] = $ind['age']; + $relation['applicant_title_name'] = $ind['applicant_title_name']; } } @@ -5873,6 +5892,7 @@ class PD_Controller extends REST_Controller { public function saveBase64Images($pd_id,$form_id = null,$company_id = null,$data) { + $count = 0; $result = array(); $pd_details = $this->PD_Model->getPDMasterDetails($pd_id); @@ -5923,12 +5943,14 @@ class PD_Controller extends REST_Controller { if($count == count($data)) { + //$logger->info('All Images Saved Sucessfully',array($pd_id,$form_id,$company_id)); $result['status'] = true; $result['count'] = $count; $result['msg'] = "All Images Saved Successfully"; } else { + //$logger->info('Some Images Not Saved',array($pd_id,$form_id,$company_id)); $result['status'] = true; $result['count'] = $count; $result['msg'] = "Some Images Not Saved!"; @@ -6099,7 +6121,7 @@ class PD_Controller extends REST_Controller { #####Business Form Questions######## $business_form = (json_decode($form_data[13][0]['processed_json'],true)); - //print_r($business_form); + //print_r($business_form);die(); // 10 - QNO(1.6) - was_the_company_name_board_sighted $score_questions['general']['was_the_company_name_board_sighted'] = isset($business_form['was_the_company_name_board_sighted']) ? $business_form['was_the_company_name_board_sighted'] : 'No'; @@ -6127,10 +6149,18 @@ class PD_Controller extends REST_Controller { #####Business Assets Form Questions######## $business_assest_form = (json_decode($form_data[22][0]['processed_json'],true)); //print_r($business_assest_form);die(); + + $property_count = 0; + $vechile_count = 0; + + if(array_key_exists('business_assets_for_address',$business_assest_form) && isset($business_assest_form['business_assets_for_address'][0])) + { + $property_count = (!strcasecmp($business_assest_form['business_assets_for_address'][0]['business_ownership_type'],'owned')) ? (++$property_count) : $property_count; + } + //die(); if(array_key_exists('business_assets_details',$business_assest_form)) { - $property_count = 0; - $vechile_count = 0; + foreach($business_assest_form['business_assets_details'] as $value) { if($value['business_assets_mode'] == 2) @@ -6142,7 +6172,7 @@ class PD_Controller extends REST_Controller { $vechile_count++; } } - + //echo // 14 - QNO(2.5) - owned_property $score_questions['business']['owned_property'] = $property_count ? 'yes':'no'; // 15 - QNO(2.6) - owned_vechile @@ -6155,17 +6185,19 @@ class PD_Controller extends REST_Controller { #####supplier Form Questions######## $supplier_form = isset($form_data[1][0]['processed_json'])?(json_decode($form_data[1][0]['processed_json'],true)):array(); - //print_r($supplier_form); + //print_r($supplier_form);die(); + if(!((count($business_form['select_business_activity_type']) == 1) && ($business_form['select_business_activity_type'][0]['type_of_activity_id'] == 5))) + { if(count($supplier_form)) { $supplier_count = 0; if(array_key_exists('manufacturing_details',$supplier_form)) { - if(isset($client_form['manufacturing_details'][0]['main_raw_materials'])) + if(isset($supplier_form['manufacturing_details'][0]['main_raw_materials'])) { - $supplier_count += count($client_form['manufacturing_details'][0]['main_raw_materials']) ? count($client_form['manufacturing_details'][0]['main_raw_materials']) : 0; + $supplier_count += count($supplier_form['manufacturing_details'][0]['main_raw_materials']) ? count($supplier_form['manufacturing_details'][0]['main_raw_materials']) : 0; } @@ -6175,10 +6207,10 @@ class PD_Controller extends REST_Controller { if(array_key_exists('trade_details',$supplier_form)) { - if(isset($client_form['trade_details'][0]['trading_products'])) + if(isset($supplier_form['trade_details'][0]['trading_products'])) { - $supplier_count += count($client_form['trade_details'][0]['trading_products']) ? count($client_form['trade_details'][0]['trading_products']): 0; + $supplier_count += count($supplier_form['trade_details'][0]['trading_products']) ? count($supplier_form['trade_details'][0]['trading_products']): 0; } //echo 'IN trade-'.$supplier_count; @@ -6192,6 +6224,7 @@ class PD_Controller extends REST_Controller { { $score_questions['business']['minimum_supplier_info'] = 'Not Applicable'; } + }else { $score_questions['business']['minimum_supplier_info'] = 'Not Applicable'; } //echo $score_questions['business']['minimum_supplier_info'];die(); #####End of supplier Form Questions######## @@ -6314,8 +6347,9 @@ class PD_Controller extends REST_Controller { } } - $score_questions['business']['vintage_of_business_account'] = count($vintage)? max($vintage) : 0; + //echo $vintage_of_business_account_for_display; + //$score_questions['business']['vintage_of_business_account_for_display'] = $vintage_of_business_account_for_display; ######End of Business Banking ############## return $score_questions; diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index 00761ba1..2193c779 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/helpers/assessedincome_helper.php b/api/application/helpers/assessedincome_helper.php index 947898ac..e58c8ecd 100644 --- a/api/application/helpers/assessedincome_helper.php +++ b/api/application/helpers/assessedincome_helper.php @@ -3,70 +3,104 @@ class AssessedIncome { - public static function getSummaryTable($ai_summary_details){ + public static function getSummaryTable($ai_summary_details,$ai_core_details){ //echo "getSummaryTable"; //print_r($ai_summary_details); - + $rupee_symbol = ""; $ai_table_header_row = ' Summary'; $sale_revenue_row = ' a. Sales / Revenue '; $purchase_row = ' b. Purchases '; + if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2) + { + $purchase_row = ' b. Cost of goods sold '; + } $gross_profit_loss_row = ' c. Gross Profit / Loss(a-b)'; $business_expense_row = ' d. Business Expenses '; $net_profit_loss_row = ' e. Net Profit / Loss(c-d) '; $house_hold_expense_row = ' f. Household Expenses '; $disposable_income_row = ' g. Disposable Income'; $net_margin_row = ' h. Net Margin % '; - $considered_sales_revenue_row = ' Considered Sales / Revenue '; - $considered_net_profit_row = ' Considered Net Profit '; - $considered_net_margint_row = ' Considered Net Margin %'; + $considered_sales_revenue_row = ' a) Considered Sales / Revenue ( Average) '; + $considered_net_profit_row = ' b) Considered Net Profit ( Average)'; + $considered_net_margint_row = ' c) Considered Net Margin % ((b/a) * 100 )'; + $house_hold_expense_count = 0; if(isset($ai_summary_details['sales_declared_by_customer']) && count($ai_summary_details['sales_declared_by_customer'])) { + $house_hold_expense_count = $ai_summary_details['sales_declared_by_customer']['house_hold_expenses'] != 0 ? $house_hold_expense_count : ++$house_hold_expense_count; + $ai_table_header_row .= 'Declared by Customer'; - $sale_revenue_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['sales_revenue']).''; - $purchase_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['purchases']).''; - $gross_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['grossprofit']).''; - $business_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['business_expenses']).''; - $net_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['netprofit']).''; - $house_hold_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['house_hold_expenses']).''; - $disposable_income_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['disposable_income']).''; + $sale_revenue_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['sales_revenue']).''; + if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1) + { + $purchase_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['purchases']).''; + }else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2) + { + $purchase_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['cost_of_goods_sold']).''; + } + + + $gross_profit_loss_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['grossprofit']).''; + $business_expense_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['business_expenses']).''; + $net_profit_loss_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['netprofit']).''; + $house_hold_expense_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['house_hold_expenses']).''; + $disposable_income_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['disposable_income']).''; $net_margin_row .= ''.($ai_summary_details['sales_declared_by_customer']['netmargin']).'%'; } if(isset($ai_summary_details['sales_calculated_by_itemwise']) && count($ai_summary_details['sales_calculated_by_itemwise'])) { + + $house_hold_expense_count = $ai_summary_details['sales_calculated_by_itemwise']['house_hold_expenses'] != 0 ? $house_hold_expense_count : ++$house_hold_expense_count; + $ai_table_header_row .= 'As Derived from Item Wise Sales'; - $sale_revenue_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['sales_revenue']).''; - $purchase_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['purchases']).''; - $gross_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['grossprofit']).''; - $business_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['business_expenses']).''; - $net_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['netprofit']).''; - $house_hold_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['house_hold_expenses']).''; - $disposable_income_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['disposable_income']).''; + $sale_revenue_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['sales_revenue']).''; + if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1) + { + $purchase_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['purchases']).''; + }else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2) + { + $purchase_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['cost_of_goods_sold']).''; + } + $gross_profit_loss_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['grossprofit']).''; + $business_expense_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['business_expenses']).''; + $net_profit_loss_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['netprofit']).''; + $house_hold_expense_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['house_hold_expenses']).''; + $disposable_income_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['disposable_income']).''; $net_margin_row .= ''.($ai_summary_details['sales_calculated_by_itemwise']['netmargin']).'%'; } if(isset($ai_summary_details['sales_calculated_by_monthwise']) && count($ai_summary_details['sales_calculated_by_monthwise'])) { + + $house_hold_expense_count = $ai_summary_details['sales_calculated_by_monthwise']['house_hold_expenses'] != 0 ? $house_hold_expense_count : ++$house_hold_expense_count; + $ai_table_header_row .= 'As Derived from Kuchha Sales Book/Bills'; - $sale_revenue_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['sales_revenue']).''; - $purchase_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['purchases']).''; - $gross_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['grossprofit']).''; - $business_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['business_expenses']).''; - $net_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['netprofit']).''; - $house_hold_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['house_hold_expenses']).''; - $disposable_income_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['disposable_income']).''; + $sale_revenue_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['sales_revenue']).''; + if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1) + { + $purchase_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['purchases']).''; + } + else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2) + { + $purchase_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['cost_of_goods_sold']).''; + } + $gross_profit_loss_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['grossprofit']).''; + $business_expense_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['business_expenses']).''; + $net_profit_loss_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['netprofit']).''; + $house_hold_expense_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['house_hold_expenses']).''; + $disposable_income_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['disposable_income']).''; $net_margin_row .= ''.($ai_summary_details['sales_calculated_by_monthwise']['netmargin']).'%'; } if(isset($ai_summary_details['consolidated_report']) && count($ai_summary_details['consolidated_report'])) { - $considered_sales_revenue_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['consolidated_report']['consolidated_sales_revenue']).''; - $considered_net_profit_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['consolidated_report']['consolidated_nerprofit']).''; + $considered_sales_revenue_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['consolidated_report']['consolidated_sales_revenue']).''; + $considered_net_profit_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($ai_summary_details['consolidated_report']['consolidated_nerprofit']).''; $considered_net_margint_row .= ''.$ai_summary_details['consolidated_report']['consolidated_nermagin'].'%'; } @@ -95,6 +129,8 @@ class AssessedIncome // echo $considered_sales_revenue_row; // echo $considered_net_profit_row; // echo $considered_net_margint_row; + if($house_hold_expense_count != 0){ $house_hold_expense_row = '';$disposable_income_row = ''; + $net_margin_row = substr_replace($net_margin_row,'f.',strpos($net_margin_row, 'h.'),2);} return array('ai_table_header_row' => $ai_table_header_row,'sale_revenue_row' => $sale_revenue_row,'purchase_row' => $purchase_row,'gross_profit_loss_row' => $gross_profit_loss_row,'business_expense_row' => $business_expense_row,'net_profit_loss_row' => $net_profit_loss_row,'house_hold_expense_row' => $house_hold_expense_row,'disposable_income_row'=>$disposable_income_row,'net_margin_row' => $net_margin_row,'considered_sales_revenue_row' => $considered_sales_revenue_row,'considered_net_profit_row' => $considered_net_profit_row,'considered_net_margint_row' =>$considered_net_margint_row); @@ -107,6 +143,7 @@ class AssessedIncome $sales_item_wise_to_diaplay = array(); $business_expenses_to_diaplay = array(); $household_expenses_to_diaplay = array(); + $sales_month_wise_to_display = array(); $sales_item_wise_header_row = ''; // Get Purchase Informations if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1) @@ -163,7 +200,7 @@ class AssessedIncome if(count($ai_core_details['sales_calculated_by_itemwise'])) { $sales_item_wise_to_diaplay = array(); - $sales_item_wise_header_row = " Product/Services Sale Quantitys UOM Rate/Unit or Value of Sale Frequency Annual Sales (Rs)"; + $sales_item_wise_header_row = " Product/Services Sale Qty UOM Rate/Unit or Value of Sale Frequency Annual Sales"; if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2) { $sales_item_wise_header_row .= "Gross Margin %Margin AmountGross Profit"; @@ -192,7 +229,7 @@ class AssessedIncome if(count($ai_core_details['sales_items_by_monthwise'])) { - $sales_month_wise_to_display = array(); + foreach($ai_core_details['sales_items_by_monthwise'] as $simwk => $sale_item) { diff --git a/api/application/helpers/assetsform_helper.php b/api/application/helpers/assetsform_helper.php index 4842f2d7..d3cbf1a0 100644 --- a/api/application/helpers/assetsform_helper.php +++ b/api/application/helpers/assetsform_helper.php @@ -91,11 +91,15 @@ public static function getOthersAssetsDetails($values){ $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]['property_type_master'] . ' property ( '. $fetchVal['details'][0]['describe_of_the_property_asset'] .' ) at '.$fetchVal['details'][0]['address_of_the_property'].' having area of '. $fetchVal['details'][0]['area_covered_by_this_property']; - $storeValue['about_assets'] .= $fetchVal['details'][0]['area_covered_by_this_property']? '
Area of Covered : ' . $fetchVal['details'][0]['area_covered_by_this_property'].'.' : ''; + $storeValue['about_assets'] .= $fetchVal['details'][0]['uom_of_the_property'] == 1 ? ' '.$fetchVal['details'][0]['uom_of_the_property'].'.' : ' '.$fetchVal['details'][0]['uom_master'].'.'; + + //$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){ diff --git a/api/application/helpers/bankingform_helper.php b/api/application/helpers/bankingform_helper.php index 312e9512..91a08dd7 100644 --- a/api/application/helpers/bankingform_helper.php +++ b/api/application/helpers/bankingform_helper.php @@ -16,7 +16,7 @@ public static function getBusinessBankingDetails($values){ '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_master'], 'account_type' => $tag['account_type_master'], - 'main_business' => $tag['salary'], + 'main_business' => $tag['is_main'], 'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : 'NA'), 'vintage' => $count_vintage, ); diff --git a/api/application/helpers/businessform_helper.php b/api/application/helpers/businessform_helper.php index 56340ef4..b676de07 100644 --- a/api/application/helpers/businessform_helper.php +++ b/api/application/helpers/businessform_helper.php @@ -28,18 +28,29 @@ public static function getPartnerDetails($values){ } //get family members details public static function getFamilyMemberDetails($values){ + //print_r($values);die(); $getFamilyMembers=array(); foreach($values as $parRow){ - $getFamilyMembers = array_map(function($tag) { - return array( - 'name' => $tag['family_member_salutation_master'].' '.$tag['family_member_name'], - 'individual_relation' => $tag['other_family_relationship_id_master'] .' of ', - 'relation_to' => $tag['relation_to_id_master'], - 'relation_to_company' => substr($tag['relationship_with_company_id_master'],0,-2), - 'started_business' => $tag['started_business'], + if($parRow['family_member_name'] != "" || $parRow['family_member_name'] != null) + { + $temp_family = array('name' => $parRow['family_member_salutation_master'].' '.$parRow['family_member_name'],'individual_relation' => $parRow['other_family_relationship_id_master'] .' of ','relation_to' => $parRow['relation_to_id_master'],'relation_to_company' => substr($parRow['relationship_with_company_id_master'],0,-2),'started_business' => $parRow['started_business']); + + array_push($getFamilyMembers,$temp_family); + } + + // $getFamilyMembers = array_map(function($tag) { + // if($tag['family_member_name'] != "" || $tag['family_member_name'] != null) + // { + // return array( + // 'name' => $tag['family_member_salutation_master'].' '.$tag['family_member_name'], + // 'individual_relation' => $tag['other_family_relationship_id_master'] .' of ', + // 'relation_to' => $tag['relation_to_id_master'], + // 'relation_to_company' => substr($tag['relationship_with_company_id_master'],0,-2), + // 'started_business' => $tag['started_business'], - ); - }, $values); + // ); + // } + // }, $values); } return $getFamilyMembers; } diff --git a/api/application/helpers/financialform_helper.php b/api/application/helpers/financialform_helper.php index 86aebeaa..fafa6dae 100644 --- a/api/application/helpers/financialform_helper.php +++ b/api/application/helpers/financialform_helper.php @@ -5,13 +5,13 @@ class Financialform //other loan obligations public static function getOtherLoanDetails($values){ - + $rupee_symbol = ''; $first_row = 'Loan Type'; - $second_row = 'Loan Amount (Rs)'; + $second_row = 'Loan Amount'; // $third_row = 'Loan Amount (Rs)'; $fourth_row = 'Availed From'; $fifth_row = 'Borrower'; - $sixth_row = 'Instalment Amount (Rs)'; + $sixth_row = 'Instalment Amount'; $seventh_row = 'Instalment Frequency'; $eigth_row = 'Original Tenure (Months)'; $ninth_row = 'Elapsed Tenure (Months)'; @@ -46,13 +46,13 @@ public static function getOtherLoanDetails($values){ $setFrequencyType = ' per'; } - $loanTaken=$tag['loan_taken_by']; + $loanTaken=$tag['loan_taken_by'][0]; $first_row .= $tag['loan_type']==1 ? ''.$tag['others_loan_type'].'' : ''.$tag['loan_type_master'] .''; - $second_row .= ''.MYUTIL::customIndianNumberFormat($tag['loan_amount']).''; + $second_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($tag['loan_amount']).''; //$third_row = ''.MYUTIL::customIndianNumberFormat($tag['loan_amount']).''; @@ -60,7 +60,7 @@ public static function getOtherLoanDetails($values){ $fifth_row .= $loanTaken['id']==0 ? ''.$tag['others_loan_taken'].'' : ''.$loanTaken['name'].''; - $sixth_row .= ''.MYUTIL::customIndianNumberFormat($tag['emi']).''; + $sixth_row .= ''.$rupee_symbol.MYUTIL::customIndianNumberFormat($tag['emi']).''; $seventh_row .= $tag['frequency']==1 ? ''.$tag['other_frequency'].'' : ''.$tag['frequency_master'].''; @@ -84,10 +84,10 @@ public static function getBusinessFinancialDetails($values){ return array( 'financial_year' => $tag['financial_year'], - 'financial_sales_revenue' => 'Rs.'.$tag['financial_annual_sale'], + 'financial_sales_revenue' => $tag['financial_annual_sale'], 'financial_net_profit_mode' => $tag['finanical_profit_or_loss']==1 ? 1 : 0, - 'financial_net_profit' => $tag['finanical_profit_or_loss']==1 ? 'Rs.'.$tag['financial_net_profit'] : '', - 'financial_net_loss' => $tag['finanical_profit_or_loss']!=1 ? 'Rs.'.$tag['financial_net_loss'] : '', + 'financial_net_profit' => $tag['finanical_profit_or_loss']==1 ? $tag['financial_net_profit'] : '', + 'financial_net_loss' => $tag['finanical_profit_or_loss']!=1 ? $tag['financial_net_loss'] : '', 'financial_margin_of_profit' => $tag['finanical_profit_or_loss']==1 ? $tag['financial_margin_of_profit'] : '', 'financial_margin_of_loss' => $tag['finanical_profit_or_loss']!=1 ? $tag['financial_margin_of_loss'] : '', 'profit_variation' => $tag['financial_variation'], @@ -133,7 +133,7 @@ public static function getBusinessCustomerFinancialDetails($values) { else if($tag['estimate_profit_or_loss']==2){ return array( 'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'], - 'estimate_sales_average' => 'Rs.'.$tag['estimate_sales_average'], + 'estimate_sales_average' => $tag['estimate_sales_average'], 'estimate_sales_from' =>$tag['estimate_sales_from'], 'estimate_sales_to' => $tag['estimate_sales_to'], 'estimate_net_margin_availablity' => $tag['estimate_net_margin_availablity'], diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index d239a371..467204db 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -649,7 +649,7 @@ class GETPROCESSEDJSON $where_condition_array = array('fk_form_id' => $formid,'isactive' => 1); $master_keys = $CI->PD_Model->selectCustomRecords($fields,$where_condition_array,QUESTIONKEYMAPPING); - //print_r($master_keys); + //print_r($master_keys);die(); if(!empty($raw_json) && !empty($master_keys)) { @@ -1701,6 +1701,19 @@ class GETPROCESSEDJSON { $raw_json['assets_details'][$assets_detail_key]['details'][0]['property_type_master'] = $assest_mode_name[0][$master_tables_field_names['PROPERTIES']]; } + //UOM + $CI->db->SELECT( $master_tables_field_names['UOM'] ); + $CI->db->FROM(UOM); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE( $master_tables_pkid['UOM'] ,$assets_detail['details'][0]['uom_of_the_property']); + $uom_name= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($uom_name)) + { + $raw_json['assets_details'][$assets_detail_key]['details'][0]['uom_master'] = $uom_name[0][$master_tables_field_names['UOM']]; + } + + } if($assets_detail['assets_mode'] == 3) diff --git a/api/application/helpers/myutil_helper.php b/api/application/helpers/myutil_helper.php index c389bdc7..643e8675 100644 --- a/api/application/helpers/myutil_helper.php +++ b/api/application/helpers/myutil_helper.php @@ -15,7 +15,7 @@ class MYUTIL $digits_1 = strlen($no); $i = 0; $str = array(); - $words = array('0' => 'zero', '1' => 'One', '2' => 'Two', + $words = array('0' => '', '1' => 'One', '2' => 'Two', '3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six', '7' => 'Seven', '8' => 'Eight', '9' => 'Nine', '10' => 'Ten', '11' => 'Eleven', '12' => 'Twelve', @@ -50,9 +50,9 @@ class MYUTIL $res = $result; if($points != "") { - $res.=$points . " Paise"; + $res.=$points . ""; } - return $result.' Only'; + return $result.' rupees Only'; } @@ -147,9 +147,10 @@ class MYUTIL public static function customIndianNumberFormat($value) { - $indian_num_format = numfmt_create( 'en_IN', NumberFormatter::CURRENCY ); + $indian_num_format = numfmt_create( 'en_IN', NumberFormatter::DECIMAL ); //echo numfmt_format_currency($indian_num_format,$value, "INR"); - return numfmt_format_currency($indian_num_format,$value, "INR"); + //return numfmt_format_currency($indian_num_format,$value,"INR"); + return numfmt_format($indian_num_format,$value); } public static function applicantNameCamelCaseConvertion($name) diff --git a/api/application/helpers/neighbourreferencecheckform_helper.php b/api/application/helpers/neighbourreferencecheckform_helper.php index 336173ff..c04e7c0d 100644 --- a/api/application/helpers/neighbourreferencecheckform_helper.php +++ b/api/application/helpers/neighbourreferencecheckform_helper.php @@ -13,7 +13,7 @@ public static function getNeighbourhoodDetails($company_name,$values,$pdMasterVa if(strtoupper($tag['do_know'])=='YES'){ - $neighbourhood_do_know = $tag['neighbourhood_name']." knows about applicant and their business."; + $neighbourhood_do_know = $tag['neighbourhood_name']." knows about applicants 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."; } @@ -37,16 +37,28 @@ public static function getNeighbourhoodDetails($company_name,$values,$pdMasterVa if($owner['id'] != 0) { $ownwers_list .= $owner['name'].','; + } else { - $ownwers_list .= ' '.$tag['other_organisation_owner']; + $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'; + + $ownwers_list = substr_replace($ownwers_list,'', strrpos($ownwers_list,','),1); + if(count($tag['organisation_owner']) == 1) + { + $ownwers_list = substr_replace($ownwers_list,'', strrpos($ownwers_list,','),1); + }else if($tag['organisation_owner'] > 1) + { + $ownwers_list = substr_replace($ownwers_list,' and ', strrpos($ownwers_list,','),1); + } + + + $grammer1 = count($tag['organisation_owner']) > 1 ? ' are': ' is '; + $grammer2 = count($tag['organisation_owner']) > 1 ? '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."; diff --git a/api/application/helpers/otherfamilyform_helper.php b/api/application/helpers/otherfamilyform_helper.php index 429edc74..fcc82e96 100644 --- a/api/application/helpers/otherfamilyform_helper.php +++ b/api/application/helpers/otherfamilyform_helper.php @@ -4,6 +4,7 @@ class Otherfamilyform { public static function getFamilyDetails($values){ $mergeResult=array(); + $rupee_symbol = ""; foreach($values as $fetchVal){ //print_r($fetchVal);die(); $storeValue=array(); @@ -19,8 +20,8 @@ public static function getFamilyDetails($values){ $getFamilyEarning=''; if($tag['family_member_earning_status']==1){ $getFamilyEarning= 'Earning '; - $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 = $tag['earning_segment']==1 ? $tag['earning_if_others_segment'].' Income of '.$tag['earning_gross_income_per_month'].' per month. ':' Income of '.''.MYUTIL::customIndianNumberFormat($tag['earning_gross_income_per_month']).' per month.'; + $getFamilyOccupation .= $tag['earning_name_of_the_employer_or_business'] ? ' received from '.$tag['earning_name_of_the_employer_or_business'].'.' : ''; $getFamilyOccupation .= 'He has been working for '.$tag['earning_number_of_years_in_employment_or_business'].' years.'; diff --git a/api/application/helpers/pdscore_helper.php b/api/application/helpers/pdscore_helper.php index 77bc520c..d58b3915 100644 --- a/api/application/helpers/pdscore_helper.php +++ b/api/application/helpers/pdscore_helper.php @@ -68,7 +68,7 @@ class PDSCORE /*-------- BUSNIESS --------------*/ $no_of_years_business_run = array('100> to >=10' => 10,'5<= to <10' => 8,'3<= to <5' => 6,'1<= to <3' => 4,' 1> to >0' => 2); $business_seasonality = array('yes' => 5, 'no major changes in sales' => 10); - $employees_total = array('1000> to >50' => 10,'21<= to <50' => 8, '11<= to <20' => 6, '6<= to <10' =>4,'5>= to >0' => 2) ; + $employees_total = array('1000> to >=50' => 10,'21<= to <50' => 8, '11<= to <=20' => 6, '6<= to <10' =>4,'5>= to >0' => 2) ; $cerificates = array('yes' => 10,'no' => 0, 'not applicable' => 0); $owned_property = array('yes' => 10, 'no' => 0); $owned_vechile = array('yes' => 10, 'no' => 0); @@ -77,7 +77,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 --------------*/ @@ -267,22 +267,25 @@ class PDSCORE $business_distribute_level_weightage = 0; - + //echo $score_questions['business']['minimum_supplier_info'];die(); if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable')) { $business_distribute_level_weightage += $minimum_supplier_info_L2; + $minimum_supplier_info_L2 = 0; } if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable')) { $business_distribute_level_weightage += $minimum_client_info_L2; + $minimum_client_info_L2 = 0; } if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable')) { $business_distribute_level_weightage += $stock_raw_material_enough_L2; + $stock_raw_material_enough_L2 = 0; } if(!strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable')) { - $business_distribute_level_weightage += $stock_finished_goods_enough_L2; + $business_distribute_level_weightage += $stock_finished_goods_enough_L2;$stock_finished_goods_enough_L2 = 0; } //echo $business_distribute_level_weightage; @@ -441,7 +444,8 @@ class PDSCORE } } - + // echo $score_band; + // die(); $employees_total_max_score = ($l1_business/100) * ($employees_total_L2/100) * max($employees_total); @@ -511,7 +515,11 @@ class PDSCORE $vintage_of_business_account_max_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * max($vintage_of_business_account); - $score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($business_activity_has_seen_L2),'answer' => $score_questions['business']['vintage_of_business_account'],'attributed_score' => ($vintage_of_business_account_actual_score), 'max_score' => ($vintage_of_business_account_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account)); + + $vintage_of_business_account_for_display = explode('.',($score_questions['business']['vintage_of_business_account'])); + $vintage_of_business_account_for_display = ($vintage_of_business_account_for_display[0] != 0 ? $vintage_of_business_account_for_display[0].' Yrs ' : '') . ($vintage_of_business_account_for_display[1] != 0 ? $vintage_of_business_account_for_display[1].' Mns ' : ''); + + $score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($business_activity_has_seen_L2),'answer' => $vintage_of_business_account_for_display,'attributed_score' => ($vintage_of_business_account_actual_score), 'max_score' => ($vintage_of_business_account_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account)); /*-----------END OF BUSINESS SECTION -----------*/ diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index c55c0ff1..fb2b84d5 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,PDTRIGGER.satellite_image_base64_blob'); + $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,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y %h:%i:%s %p") as pd_report_generated_date,DATE_FORMAT(PDTRIGGER.pd_visit_date,"%d/%m/%Y %h:%i:%s %p") as pd_visit_date'); $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/business_scorecard.php b/api/application/views/business_scorecard.php index aae91c18..1d1f07d7 100644 --- a/api/application/views/business_scorecard.php +++ b/api/application/views/business_scorecard.php @@ -1,3 +1,3 @@ "Business Vintage >>", "location_suited_for_busienss" => "Business Location suitability >>", "business_seasonality" => "Seasonality >>", "employees_total" => "Employee Strength >>", "cerificates" => "Business Certifications Sighted >>","owned_property" => "Business Premise Ownership >>", "owned_vechile" => "Vehicle Ownership >>", "business_activity_has_seen" => "Business Activity Observed >>", "minimum_supplier_info" => "Supplier Information Shared >>", "minimum_client_info" => "Client Information Shared >>","stock_raw_material_enough" => "Sufficiency of Raw Materials Stock Observed >>", "stock_finished_goods_enough" => "Sufficiency of Finished/Traded Stock Observed >>", "vintage_of_business_account" => "Main Business Banking Account Vintage >>");$descriptions = '';$score = '';if(isset($business) && count($business)){foreach($business as $key => $d){$descriptions .= '"'.$business_captions [$key].'",'; $score .= $d['attributed_score'] != 0 && $d['max_score'] != 0 ? (($d['attributed_score']/$d['max_score']) * 100).',' : '0'.',';}} -?>
Powered by ZingChart
\ No newline at end of file +?>
Powered by ZingChart
\ No newline at end of file diff --git a/api/application/views/general_scorecard.php b/api/application/views/general_scorecard.php index b40bb974..70b1f529 100644 --- a/api/application/views/general_scorecard.php +++ b/api/application/views/general_scorecard.php @@ -1,3 +1,3 @@ "OTP authentication done >>","person_met_is_applicant" => "Is person Met, one of the loan applicants? >>","qualification" => "Qualification of Loan Applicants >>","comment_locality" => "Comment on Locality >>","pd_location_approach" => "Approach to PD location >>","customer_behaviour" => "Customer Behaviour >>","neibourhood_check_as_per_pd_officer" => "Neighbourhood check >>","was_the_company_name_board_sighted" => "Name Board of the Business Seen >>","value_of_other_assets" => "Value of Assets as a % of Loan Amount >>");$descriptions = '';$score = '';if(isset($general) && count($general)){foreach($general as $key => $d){$descriptions .= '"'.$general_captions [$key].'",'; $score .= $d['attributed_score'] != 0 && $d['max_score'] != 0 ? (($d['attributed_score']/$d['max_score']) * 100).',' : '0'.',';}} -?>
Powered by ZingChart
\ No newline at end of file +?>
Powered by ZingChart
\ No newline at end of file diff --git a/api/application/views/js/phantomchart.js b/api/application/views/js/phantomchart.js index 9c68059e..c75ecbb5 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 = 50.94;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 = 82.3;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/phantomdsc.js b/api/application/views/js/phantomdsc.js index 8cbcab6f..1030abd0 100644 --- a/api/application/views/js/phantomdsc.js +++ b/api/application/views/js/phantomdsc.js @@ -1 +1 @@ -var wpage = require('webpage').create();var Content = '
Powered by ZingChart
';var pageurl = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/dsc.html'; wpage.viewportSize = { width: 810, height: 250 };wpage.setContent(Content, pageurl); wpage.onLoadFinished = function(status){wpage.render('C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/dsc_general.png'); phantom.exit();}; \ No newline at end of file +var wpage = require('webpage').create();var Content = '
Powered by ZingChart
';var pageurl = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/dsc.html'; wpage.viewportSize = { width: 810, height: 250 };wpage.setContent(Content, pageurl); wpage.onLoadFinished = function(status){wpage.render('C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/dsc_general.png'); phantom.exit();}; \ No newline at end of file diff --git a/api/application/views/js/phantomsatellite.js b/api/application/views/js/phantomsatellite.js index ec1a1a4d..5928e152 100644 --- a/api/application/views/js/phantomsatellite.js +++ b/api/application/views/js/phantomsatellite.js @@ -1 +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=NO.1,+NEHRU+NAGAR,+3RD+STREET,+ACHRAPAKKAM,KANCHIPURAM,Acharapakkam,Tamil+Nadu,IND&zoom=14&markers=color:red|&size=800x300&maptype=roadmap&key=AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg';var image_url ='/opt/lampp/htdocs/sparqtest/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 +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=12.4002984,79.8103515,IND&zoom=14&markers=color:red|12.4002984,79.8103515&size=800x300&maptype=roadmap&key=AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg';var image_url ='/opt/lampp/htdocs/sparqtest/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 9072e521..182cfb01 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -8,8 +8,10 @@ defined('BASEPATH') OR exit('No direct script access allowed'); - +