From 5991b6bff28c93ef2e010100fe89b6100804e903 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Tue, 24 Dec 2019 21:04:18 +0530 Subject: [PATCH] SALE PD WITH MAIL AND LIVE ISSUES --- api/application/config/customconfig_one.php | 2 +- api/application/controllers/PD_Controller.php | 16 ++-- .../controllers/Sales_PD_Controller.php | 59 +++++++++------ api/application/helpers/pdalerts_helper.php | 71 ++++++++++++++++++ .../helpers/satellite_image_helper.php | 1 + .../models/Common_Masters_Model.php | 3 +- api/application/models/PD_Model.php | 4 + .../report_templates/JSONTOREPORT_DI_AI.php | 33 +++++++- .../report_templates/JSONTOREPORT_RI.php | 75 ++++++++++++++----- .../views/sale_pd_templates/MWISE.php | 16 ++-- 10 files changed, 220 insertions(+), 60 deletions(-) diff --git a/api/application/config/customconfig_one.php b/api/application/config/customconfig_one.php index 0d3c1b8f..febd3895 100644 --- a/api/application/config/customconfig_one.php +++ b/api/application/config/customconfig_one.php @@ -115,7 +115,7 @@ $config['sms_api_pwd'] = 'wRfAwb&v'; $config['sms_gupshup_url'] = 'http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to={{send_to_mobile_no}}&msg={{send_msg}}&msg_type=TEXT&userid={{sms_api_user_id}}&auth_scheme=plain&password={{sms_api_pwd}}=1.1&format=text'; -$config['master_tables_field_names'] = array('INDUSTRYCLASSIFICATION' => 'name','UOM' => 'name','OCCUPATIONMEMBERS' => 'name','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'name','RELATIONSHIPS' => 'name','FREQUENCY' => 'name', 'CUSTOMERBEHAVIOUR' => 'description', 'CUSTOMERSEGMENT' => 'name','DESIGNATION' => 'short_name', 'EARNINGMEMBERSSTATUS' => 'earning_member_status','EDUQUALIFICATION' => 'qualification_name','ADDRESSTYPE' => 'address_type','LOCALITY' => 'locality_name','ASSETTYPE' => 'name','PROPERTIES' => 'name','INVESTMENTTYPE' => 'name','INSURANCETYPE' => 'name','PERSONSMET' => 'person_met_name','RESIDENCEOWNERSHIP' => 'name','PAYMENTMODE' => 'name','ACCOUNTTYPE' => 'name','SOURCEOFOTHERINCOME' => 'name','MORTAGEPROPERTYTYPE' => 'name','ENDUSEOFLOAN' => 'enduse_of_loan','SOURCEOFBALANCETRANSFER' => 'name', 'STATUSOFCONSTRUCTION' => 'name','BTLENDERLIST'=>'lender_name','MORTAGEPROPERTIES'=>'property_name','EXISTINGLOANTYPES'=>'loan_type_name','PDAPPLICANTSDETAILS'=>'applicant_name','RELATIONWITHBUSINESS'=>'relation_with_business_name','BUSINESSENTITYTYPE'=>'business_entity_type_name','COMPANYRELATIONSHIPS'=>'name','STATE'=>'name','CITY'=>'name','COUNTRY'=>'country_name','BOUNCEMASTER'=>'bounce_reason_name','BUSINESSEXPENSES'=>'expense_item','BUSINESSINCOME'=>'business_income_item','COMMENTSONLOCALITY'=>'rating','COMPANY'=>'company_id','LOCALITY'=>'locality_name','NONINDIVIDUALENTITIES'=>'non_individual_entity_name','PDFORMS'=>'pd_form_name','PDLOCATIONAPPROACH'=>'description','PDTYPE'=>'type_name','PDNOTIFICATION'=>'pd_status','QUESTIONCATEGORY'=>'category_name','ROLES'=>'role_name','SUBPRODUCTS'=>'name','TITLES'=>'name','PINCODE'=>'pincode','PRODUCTS'=>'name','ENTITYTYPE'=>'name','PDTEAM'=>'team_name','ENTITY'=>'short_name','PDSTATUS'=>'pd_status_name','LISTOFMASTERS'=>'master_name','OTPREJECTION'=>'rejection_reason','ENDUSEOFTOPUP'=>'end_use_of_topup','VEHICLETYPE'=>'vehicle_type_name','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation','REGIONS'=>'name','PRICINGINFO'=>'pricing_info_id'); +$config['master_tables_field_names'] = array('INDUSTRYCLASSIFICATION' => 'name','UOM' => 'name','OCCUPATIONMEMBERS' => 'name','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'name','RELATIONSHIPS' => 'name','FREQUENCY' => 'name', 'CUSTOMERBEHAVIOUR' => 'description', 'CUSTOMERSEGMENT' => 'name','DESIGNATION' => 'designation', 'EARNINGMEMBERSSTATUS' => 'earning_member_status','EDUQUALIFICATION' => 'qualification_name','ADDRESSTYPE' => 'address_type','LOCALITY' => 'locality_name','ASSETTYPE' => 'name','PROPERTIES' => 'name','INVESTMENTTYPE' => 'name','INSURANCETYPE' => 'name','PERSONSMET' => 'person_met_name','RESIDENCEOWNERSHIP' => 'name','PAYMENTMODE' => 'name','ACCOUNTTYPE' => 'name','SOURCEOFOTHERINCOME' => 'name','MORTAGEPROPERTYTYPE' => 'name','ENDUSEOFLOAN' => 'enduse_of_loan','SOURCEOFBALANCETRANSFER' => 'name', 'STATUSOFCONSTRUCTION' => 'name','BTLENDERLIST'=>'lender_name','MORTAGEPROPERTIES'=>'property_name','EXISTINGLOANTYPES'=>'loan_type_name','PDAPPLICANTSDETAILS'=>'applicant_name','RELATIONWITHBUSINESS'=>'relation_with_business_name','BUSINESSENTITYTYPE'=>'business_entity_type_name','COMPANYRELATIONSHIPS'=>'name','STATE'=>'name','CITY'=>'name','COUNTRY'=>'country_name','BOUNCEMASTER'=>'bounce_reason_name','BUSINESSEXPENSES'=>'expense_item','BUSINESSINCOME'=>'business_income_item','COMMENTSONLOCALITY'=>'rating','COMPANY'=>'company_id','LOCALITY'=>'locality_name','NONINDIVIDUALENTITIES'=>'non_individual_entity_name','PDFORMS'=>'pd_form_name','PDLOCATIONAPPROACH'=>'description','PDTYPE'=>'type_name','PDNOTIFICATION'=>'pd_status','QUESTIONCATEGORY'=>'category_name','ROLES'=>'role_name','SUBPRODUCTS'=>'name','TITLES'=>'name','PINCODE'=>'pincode','PRODUCTS'=>'name','ENTITYTYPE'=>'name','PDTEAM'=>'team_name','ENTITY'=>'short_name','PDSTATUS'=>'pd_status_name','LISTOFMASTERS'=>'master_name','OTPREJECTION'=>'rejection_reason','ENDUSEOFTOPUP'=>'end_use_of_topup','VEHICLETYPE'=>'vehicle_type_name','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation','REGIONS'=>'name','PRICINGINFO'=>'pricing_info_id'); $config['master_tables_pkid'] = array('INDUSTRYCLASSIFICATION' => 'industry_classification_id','UOM' => 'uom_id','OCCUPATIONMEMBERS' => 'occupation_non_earning_member_id','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'type_of_activity_id','RELATIONSHIPS' => 'relationship_id','FREQUENCY' => 'frequency_id', 'CUSTOMERBEHAVIOUR' => 'customer_behaviour_id', 'CUSTOMERSEGMENT' => 'customer_segment_id','DESIGNATION' => 'designation_id', 'EARNINGMEMBERSSTATUS' => 'earning_member_status_id','EDUQUALIFICATION' => 'qualification_id','ADDRESSTYPE' => 'address_type_id','LOCALITY' => 'locality_id','ASSETTYPE' => 'id','PROPERTIES' => 'id','INVESTMENTTYPE' => 'id','INSURANCETYPE' => 'id','PERSONSMET' => 'person_met_id','RESIDENCEOWNERSHIP' => 'id','PAYMENTMODE' => 'id','ACCOUNTTYPE' => 'id','SOURCEOFOTHERINCOME' => 'id','MORTAGEPROPERTYTYPE' => 'id','ENDUSEOFLOAN' => 'enduse_of_loan_id','SOURCEOFBALANCETRANSFER' => 'id', 'STATUSOFCONSTRUCTION' => 'id','MORTAGEPROPERTIES' => 'mortage_property_id','BTLENDERLIST'=>'bt_lender_list_id','EXISTINGLOANTYPES'=>'existing_loan_type_id','PDAPPLICANTSDETAILS'=>'pd_co_applicant_id','RELATIONWITHBUSINESS'=>'relation_with_business_id','BUSINESSENTITYTYPE'=>'business_entity_type_id','COMPANYRELATIONSHIPS'=>'company_relationship_id','STATE'=>'state_id','CITY'=>'city_id','COUNTRY'=>'country_id','BOUNCEMASTER'=>'bounce_id','BUSINESSEXPENSES'=>'expense_item_id','BUSINESSINCOME'=>'business_income_id','COMMENTSONLOCALITY'=>'comments_on_locality_id','COMPANY'=>'name','LOCALITY'=>'locality_id','NONINDIVIDUALENTITIES'=>'non_individual_entity_id','PDFORMS'=>'form_id','PDLOCATIONAPPROACH'=>'pd_location_approach_id','PDTYPE'=>'pd_type_id','PDNOTIFICATION'=>'pdnotification_id','QUESTIONCATEGORY'=>'question_category_id','ROLES'=>'role_id','SUBPRODUCTS'=>'subproduct_id','TITLES'=>'title_id','PINCODE'=>'pincode_id','PRODUCTS'=>'product_id','ENTITYTYPE'=>'entity_type_id','PDTEAM'=>'pdteam_id','ENTITY'=>'entity_id','PDSTATUS'=>'pd_status_id','LISTOFMASTERS'=>'master_id','OTPREJECTION'=>'otp_rejection_id','ENDUSEOFTOPUP'=>'end_use_of_topup_id','VEHICLETYPE'=>'vehicle_type_id','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation_id','REGIONS'=>'region_id','PRICINGINFO'=>'pricing_info_id'); diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 7686ca8c..0798673a 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -5697,10 +5697,10 @@ public function getPDFormDetailsJSON_post() public function codeigniterViewTest_post() { - + //satellite_image::getSatelliteImage(886);die(); //echo $this->assignPDTempalate(1325);die(); //$this->getSatelliteImage(342);die();//velmurugan.s@venbainfotech.com - //PDALERTS::sendMail($this,'vitvelz@gmail.com','PDGENIE TEST',array());die(); + //PDALERTS::sendSalesPDMail($this,'vitvelz@gmail.com','PDGENIE TEST');die(); //$this->load->helper('applicantname_grabber'); // print_r(APPLICANTNAME_GRABBER::getLatestApplicantsName(1390));die(); //satellite_image::getSatelliteImage(1442);die(); @@ -5820,8 +5820,9 @@ public function getPDFormDetailsJSON_post() //print_r($data['pd_master_details'][0]['is_score_card_enabled']);die(); // echo "**************************"; //$data['dsc_cards'] = $this->getDetailedScoreCardChart( $data['pd_score'] ); - if($data['pd_master_details'][0]['is_score_card_enabled'] == 1 && ($data['pd_master_details'][0]['customer_segment_abbr'] != '')) + if($data['pd_master_details'][0]['is_score_card_enabled'] == 1 && ($data['pd_master_details'][0]['customer_segment_abbr'] != "SAL-CASH" && $data['pd_master_details'][0]['customer_segment_abbr'] != "SAL-CHQ")) //&& ($data['pd_master_details'][0]['customer_segment_abbr'] != '')) { + //echo $data['pd_master_details'][0]['is_score_card_enabled'].'-'.$data['pd_master_details'][0]['customer_segment_abbr'];die(); $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'],1) : 0; @@ -5875,7 +5876,7 @@ public function getPDFormDetailsJSON_post() } //print_r(json_decode($data['pd_processed_forms'][18][0]['processed_json']));die(); $data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,'common',null,'report'); -// print_r($data['pd_images'][11]); + //print_r($data['pd_processed_forms'][12]);//die(); // $it = array_filter($data['pd_images'][11],function($d){ if($d['company_id'] == 2){ echo $d['company_id'].'TRUE';return 1;}else {echo $d['company_id'].'FALSE'; return 0;} }); // print_r($it); @@ -5927,6 +5928,10 @@ public function getPDFormDetailsJSON_post() { $t = $this->load->view('report_templates/JSONTOREPORT_DI_AI',$data,true); } + else if($data['pd_master_details'][0]['customer_segment_abbr'] == 'SAL-CASH' || $data['pd_master_details'][0]['customer_segment_abbr'] == 'SAL-CHQ' ) + { + $t = $this->load->view('report_templates/JSONTOREPORT_SAL',$data,true); + } } else { @@ -5934,7 +5939,8 @@ public function getPDFormDetailsJSON_post() } //$t = $this->load->view('temp_html.html',null,true); echo $t; - die(); + // + //die(); $total_replaces = substr_count($t,''); for($i = 0 ;$i < $total_replaces;$i++) diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index f045be66..7d3ae6f5 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -22,6 +22,7 @@ class Sales_PD_Controller extends REST_Controller { $this->load->library('AWS_S3'); $this->load->library('pdfgenerator'); $this->load->helper('satellite_image'); + $this->load->library('phpmailer_library'); } @@ -149,12 +150,9 @@ class Sales_PD_Controller extends REST_Controller { // } // } - - public function getSalesPDReport_get() + function prepareSalesPDReport($sales_pd_id,$api = true) { - $sales_pd_id = $this->uri->segment(2); - - $columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr'); + $columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr'); $table = SALES_PD_DATA.' as SALES_PD_DATA'; $joins = array( array('table' => ENTITY. ' as ENTITY', @@ -201,8 +199,8 @@ class Sales_PD_Controller extends REST_Controller { $view_data['section'.$section['section_id'] ] = $this->processSalesPDJSON($section); } //print_r($view_data['section1']);die(); - $view_data['section9'] = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name !=' => 'satellite'),SALEPD_DOCS); - $view_data['satellite_image'] = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name' => 'satellite'),SALEPD_DOCS); + $view_data['section9'] = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS); + $view_data['satellite_image'] = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name' => 'satellite','isactive' => 1),SALEPD_DOCS); $view_data['product_id'] = $sales_pd_data[0]['product_id']; $view_data['geo_location'] = $sales_pd_data[0]['geo_location']; //print_r($this->db->last_query());die(); @@ -223,23 +221,34 @@ class Sales_PD_Controller extends REST_Controller { { $this->Sales_PD_Model->updateRecords(array('is_pdf' => 1, 'is_edited' => 0),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id)); - $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes'); - $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = $singed_uri; - $this->response($data,REST_Controller::HTTP_OK); + if($api) + { + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes'); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $singed_uri; + $this->response($data,REST_Controller::HTTP_OK); + } } } else { - - $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes'); - $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = $singed_uri; - $this->response($data,REST_Controller::HTTP_OK); + if($api) + { + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes'); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $singed_uri; + $this->response($data,REST_Controller::HTTP_OK); + } } - } + } + } + public function getSalesPDReport_get() + { + $sales_pd_id = $this->uri->segment(2); + $this->prepareSalesPDReport($sales_pd_id); + } @@ -520,6 +529,9 @@ class Sales_PD_Controller extends REST_Controller { $records['completed_date'] = date('Y-m-d h:i:s'); $id = $this->Sales_PD_Model->updateRecords($records,SALES_PD_DATA,array('sales_pd_id' => $records['sales_pd_id'])); satellite_image::getSatelliteImage($records['sales_pd_id'],2); + $this->prepareSalesPDReport($records['sales_pd_id'],false); + //trigger mail function + PDALERTS::sendSalesPDMail($this,$records['sales_pd_id']); } } else @@ -591,13 +603,12 @@ class Sales_PD_Controller extends REST_Controller { $applicant_id = $g_value['answer_value'] ? $g_value['answer_value'] : 'Not Provided'; } - if($sales_pd_master_data[0]['abbr'] == 'BL') // leter WTCL - { + if($sales_pd_master_data[0]['abbr'] == 'WCTL') if($g_value['question_key'] == 'company_name') { $applicant_name = $g_value['answer_value']; } - } + else { if($g_value['question_key'] == 'main_loan_applicant') @@ -741,7 +752,7 @@ class Sales_PD_Controller extends REST_Controller { $question['is_repeatable'] = ""; $question['group_title'] = null; $question['answer_value'] = $exist_data_value['img']; - $question['answer_value'] = "IMG"; + //$question['answer_value'] = "IMG"; $question['question'] = $photo_names [ $exist_data_value['img_name'] ]; $question['question_key'] = $exist_data_value['img_name']; $question['type'] = 6; @@ -830,7 +841,7 @@ class Sales_PD_Controller extends REST_Controller { } $temp['questions'] = array_values($questions); - print_r($questions);die(); + //print_r($questions);die(); $temp['section_id'] = 9; $temp['section_name'] = 'Photography'; diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index 3ff3412e..b0e95df3 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -492,6 +492,77 @@ class PDALERTS } } + public static function sendSalesPDMail($CI,$salespd_id) + { + + + $mail = $CI->phpmailer_library->load(); + $mail_contents = SELF::salesPDMailContentGrabber($CI,$salespd_id); + //echo "$msg"; + if(count($mail_contents)) + { + $mail->IsSMTP(); // Telling the class to use SMTP + $mail->SMTPAuth = true; + $mail->SMTPDebug = 0; + $mail->SMTPSecure = "ssl"; + $mail->Host = 'bh-in-16.webhostbox.net'; // SMTP server + $mail->Username = "noreply@ssa.sineedge.com"; // "The account" + $mail->Password = "noreply@ssa"; // "The password" + $mail->Port = 465; // "The port" + $mail->addAddress('vishant@sinemanegement.com'); + $mail->addBCC("vitvelz@gmail.com", "Some BCC Name"); // Name is optional + $mail->From = 'noreply@pdgenie.com'; + $fromName = 'PD Genie'; if(ENVIRONMENT == 'testing' || ENVIRONMENT == 'development') { $fromName .= ' ( TEST ENV ) '; } + $mail->FromName = $fromName; + $mail->isHTML(true); // Set email format to HTML + $mail->Subject = $mail_contents[0]; + $mail->Body = $mail_contents[2]; + $mail->AltBody = $mail_contents[2]; + $mail->addStringAttachment(file_get_contents($mail_contents[3]), $mail_contents[1]); + + + //$logger = MYLOG::logFunction(null,$core_details[0]['pd_id']); + if(!$mail->send()) { + //$logger->error("Mailer Error:" ,array($mail->ErrorInfo)); + log_message('ERROR','SALESPD MAIL SEND'.$mail_contents[1]); + } else { + //$logger->info("Mailer Send:" ,array('mail_ID' => $lender_email,'Status' => 'SEND')); + //echo 'DONE'; + log_message('ERROR','SALESPD MAIL NOT SEND'.$mail_contents[1]); + } + } + } + + public static function salesPDMailContentGrabber($CI,$sales_pd_id) + { + $columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr'); + $table = SALES_PD_DATA.' as SALES_PD_DATA'; + $joins = array( + array('table' => ENTITY. ' as ENTITY', + 'condition' =>'SALES_PD_DATA.lender_id = ENTITY.entity_id', + 'jointype' => 'INNER'), + array('table' => PRODUCTS. ' as PRODUCT', + 'condition' =>'SALES_PD_DATA.product_id = PRODUCT.product_id', + 'jointype' => 'INNER') + ); + + $where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $sales_pd_id); + $sales_pd_data = $CI->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array); + if(count($sales_pd_data)) + { + $mail_subject = "Sales PD Report for "; + $pdf_name = strtolower(trim($sales_pd_data[0]['applicant_name'])); + $pdf_name .= '-'.$sales_pd_data[0]['abbr']; + $pdf_name .= '-'.(date('dmY',strtotime($sales_pd_data[0]['completed_date']))); + $mail_subject .=$pdf_name; + $file_name = $pdf_name.'.pdf'; + $content = "Dear Team

Please find enclosed the sales PD report." ; + $key = 'sales_pd/'.$sales_pd_id.'/'.$pdf_name.'.pdf'; + $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI((LENDER_BUCKET_NAME_PREFIX.$sales_pd_data[0]['lender_id']),$key,'+5 minutes'); + //echo $singed_uri; + return array($mail_subject,$file_name,$content,$singed_uri); + } + } public static function subGenerator($core_details) { diff --git a/api/application/helpers/satellite_image_helper.php b/api/application/helpers/satellite_image_helper.php index 2db607ec..b338882d 100644 --- a/api/application/helpers/satellite_image_helper.php +++ b/api/application/helpers/satellite_image_helper.php @@ -83,6 +83,7 @@ class satellite_image else if($pd_type == 2) //save satellite img as base64 in sale pd doc table { $satellite_base64 = base64_encode(file_get_contents($satellite_image_png_path)); + $CI->Sales_PD_Model->updateRecords(array('isactive' => 0),SALEPD_DOCS,array('img_name' => 'satellite')); $CI->Sales_PD_Model->saveRecords(array('img' => $satellite_base64,'img_name' => 'satellite','fk_sales_pd_id' => $pdid),SALEPD_DOCS); } //generate log diff --git a/api/application/models/Common_Masters_Model.php b/api/application/models/Common_Masters_Model.php index efa6f74d..224babe4 100644 --- a/api/application/models/Common_Masters_Model.php +++ b/api/application/models/Common_Masters_Model.php @@ -28,7 +28,8 @@ class Common_Masters_Model extends SPARQ_Model { return $master_data; } else - { + { + $order = $master_tables_field_names[$table_constant]; $master_data = $this->db->SELECT('*')->FROM(constant($table_constant))->ORDER_BY('is_others')->ORDER_BY($order)->GET()->result_array(); return $master_data; diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 761e52f8..74464048 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -352,6 +352,10 @@ class PD_Model extends SPARQ_Model { ); return $this->getJoinRecords($fields,$table,$joins,$where_condition_array); } + else + { + return array(); + } } /* diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php index 0451b38f..7b257893 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php @@ -805,7 +805,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); 'well suited','fairly_suited' => 'fairly suited','not_suited' => 'not suited'); //die(); if( isset($pd_score) && count($pd_score)) @@ -3793,7 +3794,7 @@ if($total_no_of_business > 0) { - +
@@ -4029,18 +4030,31 @@ if($total_no_of_business > 0) { foreach($pd_processed_forms[8] as $rowKey=> $elRow) { $otherLoanRow = json_decode($elRow['processed_json'],true); $existing_loan_form_common_remarks = $otherLoanRow['currentloan_remarks']; + $is_all_loan_details_availble = 'yes'; + $out_standing_loan_info = array(); + if(array_key_exists('loan_info_available',$otherLoanRow)) + { + $is_all_loan_details_availble = $otherLoanRow['loan_info_available']; + + } $total_no_of_data = 0; - if(strtoupper($otherLoanRow['existing_loan'])=='YES' && count($otherLoanRow['loan_details'])>0){ + if(strtoupper($otherLoanRow['existing_loan'])=='YES' && (!strcasecmp($is_all_loan_details_availble,'yes') && count($otherLoanRow['loan_details'])>0)){ $is_existing_loans_available = 1; $total_no_of_data = count($otherLoanRow['loan_details']); $existLoanResult=FINANCIALFORM::getOtherLoanDetails($otherLoanRow['loan_details'],$pd_master_details[0]['pd_id']); } + else if(!strcasecmp($is_all_loan_details_availble,'no')) + { + $out_standing_loan_info['tot_running_loans'] = $otherLoanRow['tot_running_loans']; + $out_standing_loan_info['tot_emi_paid'] = $otherLoanRow['tot_emi_paid']; + $out_standing_loan_info['tot_outstanding_loans'] = $otherLoanRow['tot_outstanding_loans']; + } } ?>

Existing loan obligation

- @@ -4082,6 +4096,17 @@ if($total_no_of_business > 0) {
+ The table below lists the details of Existing Loan Obligations of the Loan Applicants. +
Sr.No
+ + +
Total No of Running LoansTotal Outstanding AmountTotal EMI being Paid (Monthly)
+ +

As per loan applicant he does not have any existing loan obligations.

diff --git a/api/application/views/report_templates/JSONTOREPORT_RI.php b/api/application/views/report_templates/JSONTOREPORT_RI.php index 0ca55c83..4b92fe9d 100644 --- a/api/application/views/report_templates/JSONTOREPORT_RI.php +++ b/api/application/views/report_templates/JSONTOREPORT_RI.php @@ -73,6 +73,37 @@ defined('BASEPATH') OR exit('No direct script access allowed'); border: 1px solid black; border-collapse: collapse; } +/* #########Score Card for personal assest section table getting overlapped ######### */ + + .scorecard_table_resonal_assest { + /* font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;*/ + /*font-family: Merriweather;*/ + border-collapse: collapse; + width: 100%; + +} + +.scorecard_table_resonal_assest td, .scorecard_table_resonal_assest th { + border: 1px solid #000; + padding: 8px; + + + +} + +.scorecard_table_resonal_assest tr:nth-child(even){background-color: #f2f2f2; } + +.scorecard_table_resonal_assest tr:hover {background-color: #ddd;} + +.scorecard_table_resonal_assest th { + padding-top: 8px; + padding-bottom: 8px; + text-align: center; + background-color: #0191ed; + color: white; + +} +/* #########End of Score Card Table Styles######### */ /* ######### Mini Score Card Table Styles######### */ @@ -1452,6 +1483,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $is_existing_loans_available = null; foreach($pd_processed_forms[8] as $rowKey=> $elRow) { $otherLoanRow = json_decode($elRow['processed_json'],true); + //print_r($otherLoanRow);die(); $existing_loan_form_common_remarks = $otherLoanRow['currentloan_remarks']; $total_no_of_data = 0; if(strtoupper($otherLoanRow['existing_loan'])=='YES' && count($otherLoanRow['loan_details'])>0){ @@ -1464,41 +1496,50 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ?>

Existing loan obligation

- The table below lists the details of Existing Loan Obligations of the Loan Applicants. - - +

+ $single_table){ + //print_r($single_table);die(); + ?> +
+ - Loan $header";}?> + Loan $pre_loan_no"; } ?> - +
Particulars
+

As per loan applicant he does not have any existing loan obligations.

diff --git a/api/application/views/sale_pd_templates/MWISE.php b/api/application/views/sale_pd_templates/MWISE.php index 342cb16e..4005230c 100644 --- a/api/application/views/sale_pd_templates/MWISE.php +++ b/api/application/views/sale_pd_templates/MWISE.php @@ -61,6 +61,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); border-collapse: collapse; width: 100%; page-break-inside: inline; + } .scorecard_table td, .scorecard_table th { @@ -164,7 +165,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
- +
@@ -200,7 +201,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); - +
Details of Key Stakeholders in the BusinessBrief of the Business / Service
@@ -380,8 +381,7 @@ if(isset($section6)) - - + $property_value) { echo ''; @@ -398,10 +398,10 @@ if(isset($section6)) - + - + @@ -414,7 +414,7 @@ if(isset($section6)) '; + //echo '
'; }?>
Property Information
Property Information
Property '.($property_key + 1).'
Permitted Property UsagePermitted Property Usage Actual Property Usage
Built-Up Area
@@ -436,7 +436,7 @@ if(isset($section6)) Overall Assessment (Positive / Negative) > Recommended ROI for the case - + Any Other remarks