diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 2def6663..a89106df 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -860,7 +860,7 @@ class SMC_Credit_PD_Controller extends REST_Controller { $photo_count = $this->SMC_Credit_PD_Model->selectCustomRecords(array('*'),array('isactive' => 1,'fk_smc_credit_pd_id' => $pd_id),SMC_CREDIT_PD_DOCS); if(is_array($photo_count) && count($photo_count)) { - $return_data['template_details'][ (count($return_data['template_details'])-1) ]['is_answered'] = 1; + $return_data['template_details'][ (count($return_data['template_details'])-1) ]['is_answered'] = "1"; } // print_r($return_data['template_details']);die(); @@ -1511,7 +1511,7 @@ public function filterSalesPDList_post() { // die(); //score card part $html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true); - echo $html_content;die(); + // echo $html_content;die(); $pdf_name = $view_data['pd_master_details'][0]['main_applicant']; $pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); //End of PDF Gen using DOM PDF diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 63df0ee8..ac72ea4a 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -505,18 +505,21 @@ class Sales_PD_Controller extends REST_Controller { $records = $this->post('records'); $is_entry_done = null; $id = null; - //print_r($records);die(); - - + // print_r($records);//die(); log_message('ERROR','####SALESPD SAVE CALLED'); - - $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'); + $lender_short_name = $this->Sales_PD_Model->selectCustomRecords(array('short_name'),array('entity_id' => $records['lender_id']),ENTITY); - $count = $this->Sales_PD_Model->selectCustomRecords(array('count(*) as count'),array('lender_id' => $records['lender_id'],'product_id' => $records['product_id']),SALES_PD_DATA); + $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') + { + $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'); + } - $lender_short_name = $this->Sales_PD_Model->selectCustomRecords(array('short_name'),array('entity_id' => $records['lender_id']),ENTITY); + //$count = $this->Sales_PD_Model->selectCustomRecords(array('count(*) as count'),array('lender_id' => $records['lender_id'],'product_id' => $records['product_id']),SALES_PD_DATA); - $product_short_name = $this->Sales_PD_Model->selectCustomRecords(array('abbr'),array('product_id' => $records['product_id']),PRODUCTS); + // die(); if($records['sales_pd_id'] == '' || $records['sales_pd_id'] == null) { @@ -547,7 +550,7 @@ class Sales_PD_Controller extends REST_Controller { $drafted_sections = $this->Sales_PD_Model->selectCustomRecords(array('section_id'),array('status' => 0,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA); $completed_sections = $this->Sales_PD_Model->selectCustomRecords(array('section_id'),array('status' => 1,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA); - //print_r($completed_sections); + // print_r($completed_sections);die(); if($records['sales_pd_type'] == 1) { @@ -564,7 +567,7 @@ class Sales_PD_Controller extends REST_Controller { $dup_of_section_names = $section_names; - //print_r($dup_of_section_names); + // print_r($dup_of_section_names); foreach ($completed_sections as $completed_section_key => $completed_section_value) { if($dup_of_section_names [ $completed_section_value['section_id'] ] ) @@ -573,9 +576,25 @@ class Sales_PD_Controller extends REST_Controller { } } + // print_r($dup_of_section_names); unset($dup_of_section_names[9]);//unset photograph always if($product_short_name[0]['abbr'] == "WCTL"){ unset($dup_of_section_names[6]);} - //print_r($dup_of_section_names);die(); + if($product_short_name[0]['abbr'] == "MEQ") + { + $gen = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('status' => 1,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1,'section_id' => 1),SALESPD_SECTION_DATA); + if(count($gen)) + { + $gen = json_decode($gen[0]['section_data'],true); + 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 + } + } + + + } + // print_r($dup_of_section_names);die(); if(count($dup_of_section_names)) { $res_data = array(); @@ -995,12 +1014,16 @@ public function filterSalesPDList_post() { $rand_string = $this->post('rand_string'); $sales_pd_master_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('rand_string' => $rand_string),SALES_PD_DATA); - + $product_short_name = $this->Sales_PD_Model->selectCustomRecords(array('abbr'),array('product_id' => $sales_pd_master_data[0]['product_id']),PRODUCTS); $sales_pd_img_data = $this->Sales_PD_Model->selectCustomRecords(array('doc_id', 'fk_sales_pd_id','img','img_name','isactive'),array('fk_sales_pd_id' => $sales_pd_master_data[0]['sales_pd_id'],'isactive' => 1,'img_name!=' => 'satellite'),SALEPD_DOCS); - //print_r($sales_pd_img_data);die(); + // print_r($product_short_name);die(); //sales tele pd img structure array $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')); + } $img_data = array(); if(count($sales_pd_img_data))