diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 59819016..0d350170 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -187,11 +187,9 @@ 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,array(),'','section_id','ASC'); // print_r(json_decode($all_section_data[2]['section_data'],true));//die(); $view_data['master'] = $sales_pd_data; @@ -200,7 +198,7 @@ class Sales_PD_Controller extends REST_Controller { // print_r($section['section_id']);die(); $view_data['section'.$section['section_id'] ] = $this->processSalesPDJSON($section);//die(); } - // print_r($view_data['section6']);die(); + // print_r($view_data['section3']);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']; @@ -214,8 +212,8 @@ class Sales_PD_Controller extends REST_Controller { //End of PDF Gen using DOM PDF $output_file = $this->external_path ."/sales_pd/" . $sales_pd_id . "/temp.pdf"; $bytes = file_put_contents($output_file, $pdf_doc); - // echo $bytes; - // die(); + //echo $bytes; + //die(); $bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$this->external_path.'/sales_pd/'.$sales_pd_id.'/temp.pdf'); log_message('ERROR','####SALES PD REPORT UPLOAD TO S3'.$sales_pd_id); $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); @@ -353,7 +351,7 @@ 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' || $question['question_key'] == 'constitution' || $question['question_key'] == 'about_locality' || $question['question_key'] == 'equipment_list' || $question['question_key'] == 'vendor_list') + 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' || $question['question_key'] == 'person_met_designation') { //if($question['type'] == 4) { print_r($question['answer_value']); } $temp_array[ $question['question_key'] ] = $this->getMasterData($question['answer_value'],$question['answers']); @@ -511,14 +509,14 @@ class Sales_PD_Controller extends REST_Controller { $lender_short_name = $this->Sales_PD_Model->selectCustomRecords(array('short_name'),array('entity_id' => $records['lender_id']),ENTITY); $product_short_name = $this->Sales_PD_Model->selectCustomRecords(array('abbr'),array('product_id' => $records['product_id']),PRODUCTS); - + $section_names = array('1' => 'General Section','2' => 'Fund Requirement','3' => 'stakeholders','4' => 'Brief of business','5' => 'Financial','6' => 'Property Details','7' => 'Final Remraks','8' => 'Officer Details','9' => 'Photography'); - if($product_short_name == 'MEQ') + if($product_short_name[0]['abbr'] == 'MEQ') { $section_names = array('1' => 'General Section','2' => 'Fund Requirement','3' => 'stakeholders','4' => 'Institution Details','5' => 'Product Information','6' => 'Financial Information','7' => 'Final Remraks','8' => 'Officer Details','9' => 'Photography'); } - //$count = $this->Sales_PD_Model->selectCustomRecords(array('count(*) as count'),array('lender_id' => $records['lender_id'],'product_id' => $records['product_id']),SALES_PD_DATA); + $count = $this->Sales_PD_Model->selectCustomRecords(array('count(*) as count'),array('lender_id' => $records['lender_id'],'product_id' => $records['product_id']),SALES_PD_DATA); // die(); if($records['sales_pd_id'] == '' || $records['sales_pd_id'] == null) @@ -540,6 +538,7 @@ class Sales_PD_Controller extends REST_Controller { $salepd_serial_no .= '-'.(++$count[0]['count']); $records['sales_pd_sno'] = $salepd_serial_no; + // print_r($records);die(); $id = $this->Sales_PD_Model->saveRecords($records,SALES_PD_DATA); } else @@ -586,7 +585,7 @@ class Sales_PD_Controller extends REST_Controller { if(count($gen)) { $gen = json_decode($gen[0]['section_data'],true); - echo $gen['questions'][2]['answer_value']; + //echo $gen['questions'][2]['answer_value']; if($gen['questions'][2]['answer_value'] == 9 || $gen['questions'][2]['answer_value'] == 10) { unset($dup_of_section_names[3]);// remove stake holders if MEQ Gen sectio have constitiion as socity or trust @@ -1023,7 +1022,7 @@ public function filterSalesPDList_post() { $imgs = array('selfie_with_person_met' => array('is_multiple' => 0,'img_name' => 'Selfie of the person contacted'),'name_board_seen' => array('is_multiple' => 1,'img_name' => 'Business Name Board'),'stock_image' => array('is_multiple' => 1,'img_name' => 'Stock Images'),'workplace_interior_image' => array('is_multiple' => 1,'img_name' => 'Work Place Interior')); if($product_short_name[0]['abbr'] == 'MEQ') { - $imgs = array('selfie_with_person_met' => array('is_multiple' => 0,'img_name' => 'Selfie of the person contacted'),'hospital_building' => array('is_multiple' => 1,'img_name' => 'Hospital building photo')); + $imgs = array('selfie_with_person_met' => array('is_multiple' => 0,'img_name' => 'Selfie of the person contacted'),'hospital_building' => array('is_multiple' => 1,'img_name' => 'Hospital building photo'),'name_board_seen' => array('is_multiple' => 1,'img_name' => 'Name Board'),'institute_interior' => array('is_multiple' => 1,'img_name' => 'Institute interior potographs')); } $img_data = array(); diff --git a/api/application/views/sale_pd_templates/MEQ.php b/api/application/views/sale_pd_templates/MEQ.php index b73a1b48..e84007f3 100644 --- a/api/application/views/sale_pd_templates/MEQ.php +++ b/api/application/views/sale_pd_templates/MEQ.php @@ -165,19 +165,28 @@ defined('BASEPATH') OR exit('No direct script access allowed');