SMC REPORT 2

This commit is contained in:
Velz2020 2020-11-24 20:40:27 +05:30
parent 64e4c651a5
commit ca4e080793
5 changed files with 303 additions and 62 deletions

View File

@ -463,18 +463,28 @@ class SMC_Credit_PD_Controller extends REST_Controller {
public function saveSMCCreditPDImage_post()
{
// echo 'called';die();
$records = $this->post('records');
$is_customer_app = isset($records['is_customer_app']) ? $records['is_customer_app'] : null;
unset($records['is_customer_app']);
// print_r($records);
if($records['img_name'] == 'person_met')
{
// echo 'slefie';
$location = $records['location'];
$update_fields = array('start_location' => $records['location']);
$this->SMC_Credit_PD_Model->updateRecords($update_fields,PDTRIGGER,array('pd_id' => $records['fk_smc_credit_pd_id']));
// print_r($this->db->last_query());die();
satellite_image::getSatelliteImage($records['fk_smc_credit_pd_id'],3);
}
// die();
if(!$records['is_multiple'])
{
//$location = $records['location'];
//$update_fields = array('geo_location' => $records['location']);
//$this->SMC_Credit_PD_Model->updateRecords($update_fields,SMC_CREDIT_PD,array('smc_credit_pd' => $records['fk_smc_credit_pd']));
//satellite_image::getSatelliteImage($records['fk_smc_credit_pd'],2);
//
// //disable previous selfie img
// $update_fields2 = array('isactive' => 0);
@ -1449,10 +1459,10 @@ public function filterSalesPDList_post() {
//die();
}
}
// print_r($view_data['pd_section_data'][15]);die();
// print_r($view_data['pd_section_data'][1]);die();
$view_data['smc_images'] = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $records['pd_id'],'isactive' => 1,'img_name!=' => 'satellite'),SMC_CREDIT_PD_DOCS);
$view_data['satellite'] = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $records['pd_id'],'isactive' => 1,'img_name=' => 'satellite'),SMC_CREDIT_PD_DOCS);
//print_r(count($view_data['smc_images']));die();
$html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true);
// echo $html_content;die();
$pdf_name = $view_data['pd_master_details'][0]['main_applicant'];

View File

@ -3,25 +3,27 @@
class satellite_image
{
public static function getSatelliteImage($pd_id,$pd_type = 1,$api = null)//1 - credit PD,2 - sales pd
public static function getSatelliteImage($pd_id,$pd_type = 1,$api = null)//1 - credit PD,2 - sales pd, 3- smc credit pd
{
// echo 'satellite'.$pd_type;
$pdid = $pd_id;
$api_return = null;
$CI =&get_instance();
$path_to_check = $pd_type == 1 ? $CI->external_path.'/pd_reports/'.$pdid : $CI->external_path.'/sales_pd/'.$pdid;
$path_to_check = ($pd_type == 1 || $pd_type == 3) ? $CI->external_path.'/pd_reports/'.$pdid : $CI->external_path.'/sales_pd/'.$pdid;
// echo $path_to_check;die();
$geo_location = null;
$pdmas = array();
$logger = $pd_type == 1 ? MYLOG::logFunction(null,$pdid) : MYLOG::logSalesPD($pdid);
$model_to_load = $pd_type == 1 ? 'PD_Model' : 'Sales_PD_Model';
$model_to_load = ($pd_type == 1 || $pd_type == 3) ? 'PD_Model' : 'Sales_PD_Model';
//print_r($logger);die();
if(!file_exists($path_to_check))
{
mkdir($path_to_check,0777);
}
$google_map_static_api_key = GOOGLE_STATIC_MAP_API_KEY;
if($pd_type == 1)
if($pd_type == 1 || $pd_type == 3)
{
$pdmas = $CI->PD_Model->getPDMasterDetails($pdid);
$geo_location = $pdmas[0]['start_location'];
@ -98,6 +100,13 @@ class satellite_image
$CI->Sales_PD_Model->updateRecords(array('isactive' => 0),SALEPD_DOCS,array('img_name' => 'satellite','fk_sales_pd_id' => $pd_id));
$CI->Sales_PD_Model->saveRecords(array('img' => $satellite_base64,'img_name' => 'satellite','fk_sales_pd_id' => $pdid),SALEPD_DOCS);
}
else if($pd_type == 3)
{
echo 'updae';
$satellite_base64 = base64_encode(file_get_contents($satellite_image_png_path));
$CI->PD_Model->updateRecords(array('isactive' => 0),SMC_CREDIT_PD_DOCS,array('img_name' => 'satellite','fk_smc_credit_pd_id' => $pd_id));
$CI->PD_Model->saveRecords(array('img' => $satellite_base64,'img_name' => 'satellite','fk_smc_credit_pd_id' => $pd_id),SMC_CREDIT_PD_DOCS);
}
//generate log
$logger->info("Generate Satellite Called in (".ENVIRONMENT.")",array('script' => $satellite_script,'script_output' => $ou));
//return $base64_pdscore_chart_url;

View File

@ -14,7 +14,7 @@ class smc_creditpd
case 1://borrower
$return_data = SELF::getBorrowerSectionData($section);
break;
case 3://fund
case 4://General Business
case 5://Key Stakeholders
case 6://bbusiness brief
@ -26,6 +26,9 @@ class smc_creditpd
case 19://final remarks
$return_data = json_decode($section['json'],true);
break;
case 3://fund
$return_data = SELF::getLoanSectionData($section);
break;
case 2://address
$return_data = SELF::getAddressSectionData($section);
break;
@ -84,7 +87,8 @@ class smc_creditpd
$rupee_symbol = "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>";
// $CI =&get_instance();
// $CI->load->model('PD_Model');
if(isset($json['business_assets_details']) && is_array($json['business_assets_details']) && count($json['business_assets_details']))
{
$applicant_details = applicantname_grabber::getLatestApplicantsName($section['fk_pd_id']);
$asset_type = array('2' => 'Property','3' => 'Vehicle','4' => 'Equipments and machinery','5' => 'Jewellery','6' => 'Life Insurance Policy','7' => 'Investments','1' => 'Others');
$address_type = array('2' => 'Clinic','3' => 'Factory','4' => 'Warehouse / Godown','5' => 'Shop','6' => 'Residence','7' => 'Residence cum Office','1' => 'Others','8' => 'Industrial Shed','9'=> 'Workshop','10'=> 'Business Centre','11'=> 'Shared Office','12'=> 'Office');
@ -145,6 +149,7 @@ class smc_creditpd
$siz_row .= '</tr>';
$json['display_data'] = array('header_row' => $header_row,'first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'siz_row' => $siz_row,'seven_row' => $seven_row);
}
return $json;
}
@ -196,7 +201,8 @@ class smc_creditpd
$json = json_decode($section['json'],true);
$payment_term = array('1' => 'Supply against advance payment','2' => 'Payment on Receipt of goods / service','3' => 'Payment after Credit Period provided');
// print_r($json);die();
if(isset($json['client_details']) && is_array($json['client_details']) && count($json['client_details']))
{
$header_row = '<tr>'.'<th> Particulars </th>';
$first_row = '<tr>'.'<td> Product/ Service </td>';
$second_row = '<tr>'.'<td> Contact Person </td>';
@ -205,8 +211,7 @@ class smc_creditpd
$five_row = '<tr>'.'<td> Payment Terms </td>';
$siz_row = '<tr>'.'<td> Payment Mode </td>';
$seven_row = '<tr>'.'<td> No of days credit </td>';
if(isset($json['client_details']) && is_array($json['client_details']) && count($json['client_details']))
{
foreach ($json['client_details'] as $key => $value)
{
@ -220,7 +225,7 @@ class smc_creditpd
$siz_row .= '<td style="text-align:center;"> '. (isset($value['payment_mode']) ? $value['payment_mode'] : 'NA') .' </td>';
$seven_row .= '<td style="text-align:center;"> '. (isset($value['credit_period_no']) ? $value['credit_period_no'] : 'NA') .' </td>';
}
}
$header_row .= '</tr>';
$first_row .= '</tr>';
$second_row .= '</tr>';
@ -231,6 +236,7 @@ class smc_creditpd
$seven_row .= '</tr>';
$json['display_data'] = array('header_row' => $header_row,'first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'siz_row' => $siz_row,'seven_row' => $seven_row);
}
return $json;
}
@ -405,6 +411,26 @@ class smc_creditpd
return $json;
}
static function getLoanSectionData($section)
{
$json = json_decode($section['json'],true);
$applicant_details = applicantname_grabber::getLatestApplicantsName(SELF::$current_pd_id);
// print_r($json);die();
$json['owner_name'] = applicantname_grabber::getMultipleApplicantsNameById($json['owner_name'],$applicant_details);
if(isset($json['lender']))
{
$json['lender'] = SELF::getDBvalue(BTLENDERLIST,BTLENDERLISTID,$json['lender']);
}
$json['state'] = SELF::getDBvalue(STATE,STATEID,$json['state']);
$json['city'] = SELF::getDBvalue(CITY,CITYID,$json['city']);
$pin = $json['pincode'] != 1 ? SELF::getDBvalue(PINCODE,PINCODEID,$json['pincode']) : $json['pincode_others'];
$json['pincode'] = is_array($pin) ? $pin['pincode'] : $pin;
// print_r($json);die();
return $json;
}
}
?>

View File

@ -39,6 +39,8 @@ class PD_Model extends SPARQ_Model {
$this->db->JOIN(ENTITYLENDERBRANCH.' as ENTITYLENDERBRANCH','PDTRIGGER.pd_branch_id = ENTITYLENDERBRANCH.entity_lender_branch_id','LEFT');
$this->db->JOIN(ENTITYFININSTITUTION.' as ENTITYFININSTITUTION','PDTRIGGER.imgc_fin_institute = ENTITYFININSTITUTION.entity_fin_institution_id','LEFT');
$this->db->JOIN(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS','PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id AND PDAPPLICANTSDETAILS.applicant_type = 1','LEFT');
// $this->db->JOIN(COMMONMASTER.' as COMMONMASTER','PDTRIGGER.pd_id = COMMONMASTER.primary_key && COMMONMASTER.field_name = pd_status ','LEFT');
$this->db->WHERE('PDTRIGGER.pd_status !=',ARCHIVED);
$this->db->WHERE('PDTRIGGER.pd_status !=',TRUNCATED);
@ -985,7 +987,7 @@ class PD_Model extends SPARQ_Model {
*/
public function getPDMasterDetails($pdid,$random_string = null)
{
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, 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,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, PRODUCTS.prod_catagory,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:%s %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.is_qc_enabled,AGENCY.full_name as agency_name,AGENCY.short_name as agency_short_name,PDTRIGGER.vendor_pdofficer,concat(VENDORPDOFFICER.first_name," ",VENDORPDOFFICER.last_name) as vendor_pdofficer_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.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,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,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,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,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,AGENCY.is_vendor_visit_disabled,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status,PDTRIGGER.vendor_scheduled_on as vendor_scheduled_on_validation,DATE_FORMAT(PDTRIGGER.vendor_scheduled_on,"%d/%m/%Y %h:%i %p") as vendor_scheduled_on,PDTRIGGER.complete_override_data,PDTRIGGER.excel_file_id,SMC_EXCEL_FILELIST.file_name,SMC_EXCEL_FILELIST.modified_fname');
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, 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,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, PRODUCTS.prod_catagory,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:%s %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,DESIGNATION.designation as updatedby_designation,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.is_qc_enabled,AGENCY.full_name as agency_name,AGENCY.short_name as agency_short_name,PDTRIGGER.vendor_pdofficer,concat(VENDORPDOFFICER.first_name," ",VENDORPDOFFICER.last_name) as vendor_pdofficer_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.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,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,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,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,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,AGENCY.is_vendor_visit_disabled,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status,PDTRIGGER.vendor_scheduled_on as vendor_scheduled_on_validation,DATE_FORMAT(PDTRIGGER.vendor_scheduled_on,"%d/%m/%Y %h:%i %p") as vendor_scheduled_on,PDTRIGGER.complete_override_data,PDTRIGGER.excel_file_id,SMC_EXCEL_FILELIST.file_name,SMC_EXCEL_FILELIST.modified_fname');
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT');
$this->db->JOIN(ENTITY.' as SUBENTITY','PDTRIGGER.sub_entity_id = SUBENTITY.entity_id ','LEFT');
@ -1017,6 +1019,7 @@ class PD_Model extends SPARQ_Model {
$this->db->JOIN(TITLES.' as TITLES','PDAPPLICANTSDETAILS.applicant_title_name = TITLES.title_id','LEFT');
$this->db->JOIN(OTPREJECTION.' as OTPREJECTION','PDTRIGGER.otp_reject_reason = OTPREJECTION.otp_rejection_id','LEFT');
$this->db->JOIN(SMC_EXCEL_FILELIST.' as SMC_EXCEL_FILELIST','SMC_EXCEL_FILELIST.id = PDTRIGGER.excel_file_id','LEFT');
$this->db->JOIN(DESIGNATION.' as DESIGNATION','USERPROFILE1.designation = DESIGNATION.designation_id','LEFT');
$this->db->WHERE('PDTRIGGER.pd_id',$pdid);
if($random_string != null)
{

View File

@ -197,6 +197,24 @@ defined('BASEPATH') OR exit('No direct script access allowed');
?>
</tbody>
</table>
<br>
<table class="scorecard_table">
<tr>
<th class="thlargefont" colspan="8">Applicant`s Details</th>
</tr>
<tr>
<th colspan="1">Borrower<br> Type</th><th colspan="1">Name</th><th colspan="1">Entity Type</th><th colspan="1">Designation</th><th colspan="1">Relation</th><th colspan="1">Realtion to</th><th colspan="1">Age</th><th colspan="1">No of Year(s)<br> Business runing</th>
</tr>
<?php
foreach ($pd_section_data[1]['borrower_details'] as $key1 => $value1)
{
echo '<tr><td colspan="1" class = "tdcenteralign">'.$value1['borrower_type'].'</td> <td colspan="1" class = "tdcenteralign">'.$value1['borrower_name'].'</td> <td colspan="1" class = "tdcenteralign">'.$value1['entity_type'].'</td> <td colspan="1" class = "tdcenteralign">'.$value1['designation'].'</td> <td colspan="1" class = "tdcenteralign">'.$value1['relationship'].'</td> <td colspan="1" class = "tdcenteralign">'.$value1['relationship_to'].'</td> <td colspan="1" class = "tdcenteralign">'.(isset($value1['borrower_age']) ? : 'NA').'</td> <td colspan="1" class = "tdcenteralign">'.(isset($value1['numbers_of_years_business_running']) ? $value1['numbers_of_years_business_running'] : 'NA').'</td></tr>';
}
?>
<tbody>
</tbody>
</table>
<br>
<table class="scorecard_table">
@ -208,13 +226,56 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<td colspan="3" >Loan Amount Applied for (Rs)</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($pd_section_data[3]['loan_amount'])?></td>
<td colspan="2">Total Fund Requirement (Rs)</td>
<td class = "tdcenteralign" colspan="2"> <?php echo $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['end_use_fund_requirement'])?></td>
<td class = "tdcenteralign" colspan="2"> <?php echo $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['total_fund_requirement'])?></td>
</tr>
<?php if(isset($pd_section_data[3]['remarks_fund_source_balance'])){?>
<tr>
<td colspan="3" >Remarks of funds for balance Amount required</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['remarks_fund_source_balance']?></td>
</tr>
<?php } ?>
<tr>
<td colspan="3" >Is There any Balance Transfer</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['is_transfer']?></td>
</tr>
<?php if(isset($pd_section_data[3]['is_transfer']) && strtolower($pd_section_data[3]['is_transfer']) == 'yes'){?>
<tr>
<td colspan="3" >Balance Transfer Amount</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['balance_transfer_amount'])?></td>
<td colspan="2" >Top up amount</td>
<td class = "tdcenteralign" colspan="2" ><?php echo $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['topup_amount'])?></td>
</tr>
<tr>
<td colspan="3" >Lender from where BT done</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['lender']['lender_name']?></td>
</tr>
<?php } ?>
<tr>
<td colspan="3" >Type of Property being Mortaged</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['property_type']?></td>
</tr>
<tr>
<td colspan="3" >Name of The Owner</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['owner_name']?></td>
</tr>
<tr>
<td colspan="3" >Loan Tenure (Months)</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $pd_section_data[3]['loan_tenure']?></td>
<td colspan="2" >Loan Purpose (End-Use)</td>
<td class = "tdcenteralign" colspan="2" ><?php echo $pd_section_data[3]['end_use']?></td>
<td colspan="3" >Estimated Market Value as per Customer</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['emv_per_customer'])?></td>
<td colspan="2" >Market Value considered for LTV</td>
<td class = "tdcenteralign" colspan="2" ><?php echo $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['ltv_market_value_calculation'])?></td>
</tr>
<tr>
<td colspan="3" >Addess of property</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $pd_section_data[3]['address'].', '.$pd_section_data[3]['city']['name'].', '.$pd_section_data[3]['state']['name'].', '.$pd_section_data[3]['pincode']?></td>
<td colspan="2" >Stage of construction</td>
<td class = "tdcenteralign" colspan="2" ><?php echo $pd_section_data[3]['construction_stage']?></td>
</tr>
<tr>
<td colspan="3" >Property usage</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $pd_section_data[3]['property_usage']?></td>
<td colspan="2" >Structure type</td>
<td class = "tdcenteralign" colspan="2" ><?php echo $pd_section_data[3]['structure_type']?></td>
</tr>
</tbody>
</table>
@ -253,9 +314,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
?>
</tbody></table>
<table class="scorecard_table" style="table-layout: fixed">
<br>
<table class="scorecard_table" style="table-layout: fixed">
<tbody>
<tr>
<th class="thlargefont" colspan="15">Other Family Members involved in the business</th>
@ -375,10 +435,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</tr>
</tbody>
</table>
<table class="scorecard_table">
<tbody>
<tr>
<th class="thlargefont" colspan="16">General Business Information</th>
<th class="thlargefont" colspan="8">General Business Information</th>
</tr>
<tr>
<td colspan="4" >Business Entity Type</td>
@ -415,13 +476,14 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</tr>
<?php }?>
</tbody></table>
<br>
<br>
<table class="scorecard_table">
<tr><th class="thlargefont">Business Assets</th></tr>
</table>
<table class="scorecard_table">
<?php if(isset($pd_section_data[8]['display_data']) && is_array($pd_section_data[8]['display_data']) && count($pd_section_data[8]['display_data'])){?>
<thead>
<?php echo $pd_section_data[8]['display_data']['header_row']?>
@ -435,14 +497,24 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<?php echo $pd_section_data[8]['display_data']['siz_row']?>
<?php echo $pd_section_data[8]['display_data']['seven_row']?>
</tbody>
<?php }else
{
echo '<tr> <td class = "tdcenteralign">There is no Business asset</td> </tr>';
}
?>
</table>
<?php if(isset($pd_section_data[8]['common_remarks']))
{
echo '<br><br><table class="scorecard_table"><tr> <td class = "tdcenteralign" colspan="1">Business Assets Remarks - '.$pd_section_data[8]['common_remarks'].' </td></tr></table>';
}?>
<div id="page_break"></div>
<!-- <div id="page_break"></div> -->
<table class="scorecard_table">
<tbody>
<tr>
<th class="thlargefont" colspan="10" >Financial Information</th>
</tr>
@ -599,24 +671,74 @@ defined('BASEPATH') OR exit('No direct script access allowed');
}
?>
</tr>
</tbody></table>
<tr>
<td colspan="7">Debtor days </td>
<?php
foreach ($pd_section_data[10]['financial_info'] as $fy_key => $fy_value)
{
if(is_numeric($fy_key))
{
echo '<td colspan="1" class="tdcenteralign">'.number_format($fy_value['debtor_days_cet'],2,'.','') .'</td>';
}
}
?>
</tr>
<tr>
<td colspan="7">Debtor days </td>
<?php
foreach ($pd_section_data[10]['financial_info'] as $fy_key => $fy_value)
{
if(is_numeric($fy_key))
{
echo '<td colspan="1" class="tdcenteralign">'.number_format($fy_value['creditor_days_cet'],2,'.','') .'</td>';
}
}
?>
</tr>
<tr>
<td colspan="7">Inventory days </td>
<?php
foreach ($pd_section_data[10]['financial_info'] as $fy_key => $fy_value)
{
if(is_numeric($fy_key))
{
echo '<td colspan="1" class="tdcenteralign">'.number_format($fy_value['inventory_days_cet'],2,'.','') .'</td>';
}
}
?>
</tr>
</tbody></table>
<!-- <table class="scorecard_table">
<tr>
<td colspan="3">Income to be Considered (Rs Per Annum) </td>
<td class="tdcenteralign" colspan="2"><?php echo $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($section5['income_considered'] )?></td>
<td colspan="3" >Income Considered (Rs Per Mth) </td>
<td class="tdcenteralign" colspan="2"><?php echo MYUTIL::customIndianNumberFormat( round(($section5['income_considered'] / 12 ),2) );?></td>
</tr>
<tr>
<td colspan="3">Income assessment Program Recommended </td>
<td class="tdcenteralign" colspan="2"><?php echo $section5['income_assessment_program_recommended']?></td>
<td colspan="3" >Fixed Obligations (Rs per month) </td>
<td class="tdcenteralign" colspan="2"><?php echo $rupee_symbol.' '.MYUTIL::customIndianNumberFormat( $section5['fixed_obligations'] )?></td>
</tr>
</tbody></table> -->
<br>
<br>
<table class="scorecard_table">
<tr><th>Particulars of Financials for Latest Year as per person met during PD visit</th></tr>
</table>
<table class="scorecard_table">
<tbody>
<?php echo '<tr> <td>Sales / Revenue (Rs) </td><td class="tdcenteralign">'.$rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[10]['sales_amount']) .'</td> </tr>'?>
<?php echo '<tr> <td>Net Profit or (Net Loss) to Sales % </td><td class="tdcenteralign">'. $pd_section_data[10]['net_profit_to_sales_percent'] .'</td> </tr>'?>
<?php echo '<tr> <td>Net Profit / (Net Loss) (Rs) </td><td class="tdcenteralign">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($pd_section_data[10]['net_profit_rs']) .'</td> </tr>'?>
</tbody>
</table><br>
<table class="scorecard_table">
<tr><th>Working Capital Cycle (As per Person Met during PD)</th></tr>
</table>
<table class="scorecard_table">
<tbody>
<?php echo '<tr> <td class="tdcenteralign" colspan="2">Debtor Days</td> <td colspan="2" class="tdcenteralign"</td>'.$pd_section_data[10]['debtor_days_cm'].'<td colspan="2" class="tdcenteralign">Creditor Days</td> <td colspan="2" class="tdcenteralign">'.$pd_section_data[10]['creditor_days_cm'].'</td> <td colspan="2" class="tdcenteralign">Stock Days</td> <td colspan="2" class="tdcenteralign">'.$pd_section_data[10]['inventory_days_cm'].'</td> </tr>'?>
<?php echo '<tr> <td colspan="4" class="tdcenteralign">Does the business have any working capital facility from any lender other than Moneywise? (Yes / No)</td> <td colspan="2" class="tdcenteralign">'.$pd_section_data[10]['is_any_other_working_captial_facility'].'</td> <td colspan="4" class="tdcenteralign">If Yes, then details of the same to be captured</td> <td colspan="2" class="tdcenteralign">'.$pd_section_data[10]['facility_details_specify'].'<br>('.(isset($pd_section_data[10]['facility_details_other']) ? $pd_section_data[10]['facility_details_other'] : $pd_section_data[10]['facility_details_other_lender']).')'.'</td> </tr>'?>
<?php echo '<tr> <td class="tdcenteralign" colspan="2">Remarks on Financials >></td> <td colspan="10" class="tdcenteralign">'.$pd_section_data[10]['common_remarks'].'</td> </tr>'?>
</tbody>
</table>
<br>
<table class="scorecard_table">
<tr><th class="thlargefont">Supplier Details</th></tr>
</table>
@ -649,6 +771,7 @@ if(isset($pd_section_data[11]['common_remarks'])){
<br>
<table class="scorecard_table">
<tr><th class="thlargefont">Client Details</th></tr>
@ -724,8 +847,6 @@ if(isset($pd_section_data[12]['common_remarks'])){
?>
</tbody></table>
<?php //print_r($pd_section_data[2]);
// die();?>
<br>
<br>
<table class="scorecard_table" style="table-layout: fixed">
@ -740,7 +861,9 @@ if(isset($pd_section_data[12]['common_remarks'])){
<tr><td colspan="4">Brief of other group concerns/
Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[14]['other_group_business_applicants'];?></td></tr>
</tbody></table>
<br>
<br>
<table class="scorecard_table" style="table-layout: fixed">
<tbody>
<tr>
@ -783,6 +906,9 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
?>
</tbody></table>
<br>
<!-- <table class="scorecard_table">
<tr><th class="thlargefont" colspan="<?php echo (count($pd_section_data[15]['existing_loan_details']) + 1 )?>">Existing Loan Obligations</th></tr>
</table>
@ -821,7 +947,7 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
<tr>
<th colspan="">Sr. No.</th>
<th colspan="">Loan Type</th>
<th colspan="">Loan<br>Type</th>
<th colspan="">Loan Amount </th>
<th colspan="">Availed From </th>
<th colspan="">Borrower`s Name </th>
@ -837,7 +963,7 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
<?php
foreach ($pd_section_data[15]['existing_loan_details'] as $key15 => $value15)
{
echo '<tr><td class="tdcenteralign">'. ($key15 + 1) .'</td><td>'. $value15['loan_type'] .'</td><td>'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($value15['loan_amount']).'</td><td>'.$value15['lender_name'].'</td><td>'.$value15['loan_taken_by'].'</td><td class="tdcenteralign">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($value15['instalment_amount']).'</td><td class="tdcenteralign">'.$value15['instalment_frequency'].'</td><td class="tdcenteralign">'.$value15['original_tenure_months'].'</td><td class="tdcenteralign">'.$value15['current_tenure_months'].'</td><td class="tdcenteralign">'.$value15['elapsed_tenure_months'].'</td></tr>';
echo '<tr><td class="tdcenteralign">'. ($key15 + 1) .'</td><td>'. $value15['loan_type'] .'</td><td>'.$rupee_symbol.MYUTIL::customIndianNumberFormat($value15['loan_amount']).'</td><td>'.$value15['lender_name'].'</td><td>'.$value15['loan_taken_by'].'</td><td class="tdcenteralign">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($value15['instalment_amount']).'</td><td class="tdcenteralign">'.$value15['instalment_frequency'].'</td><td class="tdcenteralign">'.$value15['original_tenure_months'].'</td><td class="tdcenteralign">'.$value15['current_tenure_months'].'</td><td class="tdcenteralign">'.$value15['elapsed_tenure_months'].'</td></tr>';
}
@ -847,6 +973,8 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
</table>
<br>
<table class="scorecard_table">
<tr><th class="thlargefont">Neighbour Details</th></tr>
</table>
@ -869,6 +997,8 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
</table>
<br>
<table class="scorecard_table" style="table-layout: fixed">
<tbody>
<tr>
@ -892,18 +1022,15 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
}
// if(isset($pd_section_data[13]['estimated_uom']))
// {
// echo '<tr><td class="tdcenteralign" colspan="4">Does stock sighted justify the business operations ? (Yes / No)</td>';
// echo '<td class="tdcenteralign" colspan="4">'.( ucfirst($pd_section_data[13]['estimated_uom']) ) .'</td></tr>';
// }
}
?>
</tbody></table>
<br>
<table class="scorecard_table" style="table-layout: fixed">
<table class="scorecard_table" style="table-layout: fixed">
<tbody>
<tr>
<th class="thlargefont" colspan="8">Final Remarks of PD officer</th>
@ -931,7 +1058,73 @@ $over_all = array('2' => 'Positive','3' => 'Negative');
aforementioned status</td><td colspan="4"><?php echo $reason;?></td></tr>
</tbody></table>
<div id="page_break"></div>
<br><table class="scorecard_table"><tr><th class="thlargefont" colspan="10">Satellite Image of PD Location</th></tr></table><br>
<p><b>GPS Coordinates of location where PD Visit was done : <?php echo $pd_master_details[0]['start_location'] ? $pd_master_details[0]['start_location'] : '-'; ?></b></p>
<?php if($pd_master_details[0]['start_location']) { ?>
<img style="border:3px solid #0191ed;" src = "<?php echo 'data:image/gif;base64,'.$satellite[0]['img']; ?>" alt = "PD Visted Location Satellite Image " height="300px" width="630px">
<?php
}else{ echo '<p>Due to location access not provided by loan applicant Geo coordinates on photographs and Satellite image of PD location is not shown</p>';}
?>
<?php
$iter = 0;
$photo_names = array('person_met' => 'Selfie with person met','person_met_id_proof' => 'Person met ID Proof','approach_to_pd_location' => 'Approach to pd location','name_board_seen' => 'Name board seen', 'stock_image' => 'Stock image','supplier_image' => 'Supplier Bills','client_image' => 'Client Bills','machinary_image' => 'Machinary Image');
// if($master[0]['sales_pd_type'] == 2){ $photo_names['selfie_with_person_met'] = 'Selfie of the person contacted';}
// echo count($smc_images);die();
//print_r(array_keys($section9));die();
$tot_rows = ceil(count($smc_images) / 3);
if(count($smc_images))
{
echo '<div id="page_break"></div>';
echo '<table class="scorecard_table"><tr><th class="thlargefont" colspan="10">Photograph`s</th></tr></table><br><table ><tbody>';
$add_factor = 0;
for($row = 0;$row < $tot_rows; $row++)
{
echo '<tr>';
$from = $row == 0 ? $row : ($row+$add_factor);
$to = ($from + 2);
$add_factor = $add_factor + 2;
for($i = $from ; $i <= $to; $i++)
{
if(isset($smc_images[$i]))
{
echo '<td style="text-align:center;border:1px solid;"> <img src="'.$smc_images[$i]['img'].'" height = "200" width="200" alt="'.$smc_images[$i]['img_name'].'"/><br>'.$photo_names [ $smc_images[$i]['img_name'] ].'</td>';
}
//unset($p_key);
}
echo '</tr>';
}
echo '</tbody></table>';
}?>
<br><br>
<table class="scorecard_table">
<tbody>
<tr>
<td colspan="3" >Name of PD Offier </td>
<td class="tdcenteralign" colspan="7" ><?php echo $pd_master_details[0]['updatedby']?></td>
</tr>
<tr>
<td colspan="3" >Designation of Sales Team Member </td>
<td class="tdcenteralign" colspan="7" ><?php echo $pd_master_details[0]['updatedby_designation']?></td>
</tr>
<tr>
<td colspan="3" >Date of PD Visit </td>
<td class="tdcenteralign" colspan="7" ><?php echo $pd_master_details[0]['pd_visit_date']?></td>
</tr>
</tbody>
</table>
</body>
</html>