From 0fdf204aabac2063fb715e252e0be47abe33bea1 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Tue, 15 Dec 2020 16:16:08 +0530 Subject: [PATCH] MEQ REPORT --- .../controllers/Sales_PD_Controller.php | 35 +- .../views/sale_pd_templates/MEQ.php | 611 ++++++++++++++++++ 2 files changed, 629 insertions(+), 17 deletions(-) create mode 100644 api/application/views/sale_pd_templates/MEQ.php diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index ac72ea4a..59819016 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -168,7 +168,7 @@ class Sales_PD_Controller extends REST_Controller { $where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $sales_pd_id); $sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array); - //print_r($sales_pd_data);die(); + // print_r($sales_pd_data);die(); if($sales_pd_data) { @@ -187,29 +187,29 @@ class Sales_PD_Controller extends REST_Controller { mkdir($this->external_path.'/sales_pd/'.$sales_pd_id,0777); } - if(!$sales_pd_data[0]['is_pdf'] || $sales_pd_data[0]['is_edited']) + if($sales_pd_data[0]['is_pdf'] || $sales_pd_data[0]['is_edited']) { - $all_section_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $sales_pd_id,'isactive' => 1),SALESPD_SECTION_DATA); - // print_r($this->db->last_query());die(); + $all_section_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $sales_pd_id,'isactive' => 1),SALESPD_SECTION_DATA,array(),'','section_id','ASC'); + // print_r(json_decode($all_section_data[2]['section_data'],true));//die(); $view_data['master'] = $sales_pd_data; foreach ($all_section_data as $sec_key => $section) { - //print_r($section);die(); - $view_data['section'.$section['section_id'] ] = $this->processSalesPDJSON($section); + // print_r($section['section_id']);die(); + $view_data['section'.$section['section_id'] ] = $this->processSalesPDJSON($section);//die(); } - //print_r($view_data['section1']);die(); + // print_r($view_data['section6']);die(); $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(); //$view_name = $sales_pd_data[0]['short_name'].'_'.$sales_pd_data[0]['abbr']; - $view_name = $sales_pd_data[0]['short_name']; + $view_name = $sales_pd_data[0]['short_name'];if( $sales_pd_data[0]['abbr'] == 'MEQ'){ $view_name = $sales_pd_data[0]['abbr']; } $html_content = $this->load->view('sale_pd_templates/'.$view_name,$view_data,true); - //echo $html_content;die(); + // echo $html_content;die(); $pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); //End of PDF Gen using DOM PDF $output_file = $this->external_path ."/sales_pd/" . $sales_pd_id . "/temp.pdf"; @@ -353,11 +353,11 @@ class Sales_PD_Controller extends REST_Controller { { $temp_array[ $question['question_key'] ] = isset($question['answer_value']) ? $question['answer_value'] : null; - if($question['question_key'] == 'state' || $question['question_key'] == 'city' || $question['question_key'] == 'pincode' || $question['question_key'] == 'loan_purpose') + if($question['question_key'] == 'state' || $question['question_key'] == 'city' || $question['question_key'] == 'pincode' || $question['question_key'] == 'loan_purpose' || $question['question_key'] == 'constitution' || $question['question_key'] == 'about_locality' || $question['question_key'] == 'equipment_list' || $question['question_key'] == 'vendor_list') { //if($question['type'] == 4) { print_r($question['answer_value']); } $temp_array[ $question['question_key'] ] = $this->getMasterData($question['answer_value'],$question['answers']); - //if($question['type'] == 4) { print_r($temp_array[ $question['question_key'] ]); } + // if($question['type'] == 4) { print_r($temp_array[ $question['question_key'] ]); } } if(isset($question['subfield_key'])) { @@ -365,12 +365,12 @@ class Sales_PD_Controller extends REST_Controller { $temp_array[ $question['question_key'] ] .= $question['subfield_value'].','; } - +// echo 'FIRST';print_r($temp_array[ $question['question_key'] ]); if(substr_count($temp_array[ $question['question_key'] ], ',')) { $temp_array[ $question['question_key'] ] = substr_replace($temp_array[ $question['question_key'] ],'', strrpos($temp_array[ $question['question_key'] ],','),1); } - + //echo 'SECOND'; print_r($temp_array[ $question['question_key'] ]); if(substr_count($temp_array[ $question['question_key'] ], ',')) { @@ -426,14 +426,14 @@ class Sales_PD_Controller extends REST_Controller { function getMasterData($id,$array) { - //print_r($id); + // print_r($id);echo '***'; if(!is_array($id)) { foreach($array as $value) { if($id == $value['answer_id']) { - return $value['answer']; + return ($value['answer']); break; } } @@ -444,15 +444,16 @@ class Sales_PD_Controller extends REST_Controller { foreach($id as $value) { + //echo $value.'****'.strcasecmp($value,'Others').'#'; foreach($array as $mas_value) { - if( !strcasecmp($value,$mas_value['answer_id']) && (substr_count($value,'Others') == 0)) + if( !strcasecmp($value,$mas_value['answer_id']) && (!substr_count($mas_value['answer'],'Others')) ) { $final_string .= $mas_value['answer'] . ','; } } } - //print_r($final_string);die(); + // print_r($final_string);//die(); return $final_string; } diff --git a/api/application/views/sale_pd_templates/MEQ.php b/api/application/views/sale_pd_templates/MEQ.php new file mode 100644 index 00000000..b73a1b48 --- /dev/null +++ b/api/application/views/sale_pd_templates/MEQ.php @@ -0,0 +1,611 @@ +↑'; + $downarrow = ''; + $dash = ' '; + $product_name = $master[0]['abbr']; + $rupee_symbol = ""; + //print_r($master[0]['abbr']);die(); +?> + + + + + + + + + + + + + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Personal Discussion by Sales Team -
Name of Main Loan Applicant
Name of the Company/Firm
Constitution
CityStatePIN
+
+ + + + + + + + + + + + + + + + + + + + +
Fund Requirement
Loan Amount Applied for (Rs)
Loan Tenure (Months)
Loan Purpose (End-Use)
+
+ + + + + + + + + + + + + $section3_value) + { + echo ''. + ''. + ''.''; + //''. + + //''. + //''. + //''; + } + + } + echo '
Details of Key Stakeholders in the Business
NameShare HoldingYear(s) in Current Business
'.$section3_value['name'] .''.$section3_value['share_holding'].'%'.$section3_value['vintage_in_current_biz'].'
'.$section3_value['total_work_exp'].''.( isset ($section3_value['previous_experience_details']) && $section3_value['previous_experience_details'] ? $section3_value['previous_experience_details'] : 'NA' ).''.$section3_value['started_biz'].'
'; + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Institution Details
Type of institutionAbout the Locality
Institution vintageIf existing ( Since When)
Opening New BranchProperty Ownership
Area (Sq Feet)Floors
How many BeddedOccupancy ratio
Doctor's PermanentDoctor's Visited
Number of staff observedBusiness activity seen
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Product Information
Equipment List
Others Equipment
Total invoice value of the selected product
Vendor list
Other Vendor
+ +
+ + + + + + + + +
Financial Information
Name of the Company / Firm whose financials are noted
+ + + + $fy_value) + { + if(is_numeric($fy_key)) + { + $totol++; + echo ''; + } + } + ?> + + + + + + + $fy_value) + { + if(is_numeric($fy_key)) + { + echo ''; + } + } + ?> + + + + $fy_value) + { + if(is_numeric($fy_key)) + { + echo ''; + } + } + ?> + + + + $fy_value) + { + if(is_numeric($fy_key)) + { + echo ''; + } + } + ?> + + + + $fy_value) + { + if(is_numeric($fy_key)) + { + + + if($fy_key == 0) + { + echo ''; + } + else + { + //echo $pre_year_sales; + $sales_over_py = round( ((($fy_value['sales_revenue'] - $pre_year_sales) / $pre_year_sales ) * 100),2); + + + echo ''; + + } + $pre_year_sales = $fy_value['sales_revenue']; + } + } + ?> + + + + $fy_value) + { + if(is_numeric($fy_key)) + { + if($fy_key == 0) + { + echo ''; + } + else + { + $net_profit_over_py = round( ((($fy_value['net_profit'] - $pre_year_net_profit) / $pre_year_net_profit ) * 100),2); + echo ''; + + } + $pre_year_net_profit = $fy_value['net_profit']; + } + } + ?> + + + + $fy_value) + { + if(is_numeric($fy_key)) + { + if($fy_key == 0) + { + echo ''; + } + else + { + $year_net_pro_loss_per_over_py = round( ((( (($fy_value['net_profit'] / $fy_value['sales_revenue'] ) * 100 ) - $pre_year_net_pro_loss_per) / $pre_year_net_pro_loss_per ) * 100),2); + + + echo ''; + // echo ''; //(($fy_value['net_profit'] / $fy_value['sales_revenue'] ) * 100 ) + + } + $pre_year_net_pro_loss_per = (($fy_value['net_profit'] / $fy_value['sales_revenue'] ) * 100 ); + } + } + ?> + +
Particulars of Financials as per books of AccountsFY - '.($fy_value['fy']).'
Sales / Revenue (Rs) '. $rupee_symbol.' '.MYUTIL::customIndianNumberFormat(($fy_value['sales_revenue'])).'
Net Profit / (Net Loss) (Rs) '.$rupee_symbol.' '. MYUTIL::customIndianNumberFormat($fy_value['net_profit']).'
Net Profit or (Net Loss) to Sales % '.round((($fy_value['net_profit'] / $fy_value['sales_revenue'] ) * 100 ),2).'%
% in Sales over PY NA'. ((($sales_over_py == 0 ) ? $dash :( $sales_over_py > 0 ? $uparrow : $downarrow))).'' . abs($sales_over_py). ' %
% in Net Profit over PY NA'. ((($net_profit_over_py == 0 ) ? $dash :( $net_profit_over_py > 0 ? $uparrow : $downarrow))).' ' . abs($net_profit_over_py). '%
% in Net Profit % over PY NA'. ((($year_net_pro_loss_per_over_py == 0 ) ? $dash :( $year_net_pro_loss_per_over_py > 0 ? $uparrow : $downarrow))).' ' . abs($year_net_pro_loss_per_over_py). '% '. (($year_net_pro_loss_per_over_py > 0 )? '' : '').' ( ' . $year_net_pro_loss_per_over_py. ' )
+
+ + + + + + + + + + + + + +
Income to be Considered (Rs Per Annum) Income Considered (Rs Per Mth)
Income assessment Program Recommended Fixed Obligations (Rs per month)
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Final Remarks of Sales officer
Business activity seen during visit (Yes / No)Location of workplace suits the business (Yes/No)
Overall Assessment (Positive / Negative) >Recommended ROI for the case
Any Other remarks
+

+ +
+
Satellite Image of PD Location

+

GPS Coordinates of location where PD Visit was done :

+ + PD Visted Location Satellite Image + Due to location access not provided by loan applicant Geo coordinates on photographs and Satellite image of PD location is not shown

';} + ?> + 'Selfie with person met','approach_to_pd_location' => 'Approach to pd location','name_board_seen' => 'Name board seen', 'stock_image' => 'Stock image','workplace_interior_image' => 'Workplace interior image','satellite1' => 'satellite'); + if($master[0]['sales_pd_type'] == 2){ $photo_names['selfie_with_person_met'] = 'Selfie of the person contacted';} + //echo count($section9);die(); + //print_r(array_keys($section9));die(); + $tot_rows = ceil(count($section9) / 3); + + // foreach ($section9 as $key => $value) { + // print_r($value).'
'; + + // } + // die(); + if(count($section9)) + { + echo '
'; + echo '
Photograph`s

'; + + $add_factor = 0; + for($row = 0;$row < $tot_rows; $row++) + { + echo ''; + + $from = $row == 0 ? $row : ($row+$add_factor); + $to = ($from + 2); + $add_factor = $add_factor + 2; + for($i = $from ; $i <= $to; $i++) + { + + if(isset($section9[$i])) + { + + echo ''; + } + + //unset($p_key); + } + echo ''; + } + echo '
'.$section9[$i]['img_name'].'
'.$photo_names [ $section9[$i]['img_name'] ].'
'; + } + ?> +
+

+ + + + + + + + + + + + + + + + + +
Name of Sales Team Member
Designation of Sales Team Member
Date of PD Visit
+ + + + + + + + \ No newline at end of file