From 9698f7723dd7bda03ef035fdf402fe299b3e31b0 Mon Sep 17 00:00:00 2001 From: velz Date: Fri, 28 Dec 2018 13:22:29 +0530 Subject: [PATCH] GET BUSI DETAILS CHNGED --- api/application/config/constants.php | 3 + api/application/controllers/PD_Controller.php | 28 ++++++--- api/application/libraries/excel.php | 11 +--- api/application/models/PD_Model.php | 7 ++- .../views/report_templates/JSONTOREPORT.php | 62 ++++++++++++++++--- 5 files changed, 83 insertions(+), 28 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 2bc1dcef..42ea37e7 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -451,6 +451,9 @@ defined('ENTITYLENDERBRANCHID') OR define('ENTITYLENDERBRANCHID','entity_lender_ defined('PDFORMDETAILSJSON') OR define('PDFORMDETAILSJSON','t_pd_form_details_json'); defined('PDFORMDETAILSJSONID') OR define('PDFORMDETAILSJSONID','pd_form_detail_json_id'); +defined('BUSINESSENTITYTYPE') OR define('BUSINESSENTITYTYPE','m_business_entity_type'); +defined('BUSINESSENTITYTYPEID') OR define('BUSINESSENTITYTYPEID','business_entity_type_id'); + diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 6af70d24..e56bbfb5 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -2092,13 +2092,14 @@ class PD_Controller extends REST_Controller { } - public function downloadExcel_post() + public function downloadExcel_get() { $this->excel->setActiveSheetIndex(0)->mergeCells('F3:M3'); $this->excel->getActiveSheet()->setTitle('Material Master'); $this->excel->getActiveSheet()->setCellValue('F3', 'SIDDHARTH INDUSTRIES Material Master'); $filename = 'MaterialMaster'.'.xls'; //save our workbook as this file name header('Content-Type: application/vnd.ms-excel'); //mime type + header('Access-Control-Expose-Headers:Content-Disposition'); //mime type header('Content-Disposition: attachment;filename="' . $filename . '"'); //tell browser what's the file name header('Cache-Control: max-age=0'); //no cache $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); @@ -3397,10 +3398,10 @@ class PD_Controller extends REST_Controller { { $records = $this->post('records'); $pd_id = $records['pd_id']; - $pd_form_id = $records['pd_form_id']; + // $pd_form_id = $records['pd_form_id']; $final_array = array(); $fields = array('json'); - $where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id); + $where_condition_array = array('isactive' => 1,'fk_form_id'=>13,'fk_pd_id'=>$pd_id); $rec = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); //print_r($this->db->last_query()); //print_r($rec); @@ -3409,7 +3410,11 @@ class PD_Controller extends REST_Controller { $temp_data = json_decode($rec[0]['json'],true); // print_r($temp_data); $final_array['profession_name'] = $temp_data['profession_name']; - $final_array['profession_name_other'] = $temp_data['profession_name_other']; + $final_array['profession_name_other'] = ""; + if(array_key_exists('profession_name_other',$temp_data)) + { + $final_array['profession_name_other'] = $temp_data['profession_name_other']; + } $final_array['type_of_activity'] = $temp_data['select_business_activity_type']; foreach($final_array['type_of_activity'] as $f_key => $f_value) @@ -3465,16 +3470,23 @@ class PD_Controller extends REST_Controller { $final_array['type_of_activity'][$f_key]['prodcuts'] =$temp; } } + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $final_array; + $this->response($data,REST_Controller::HTTP_OK); + } else { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = "Fill Business Form First!"; + $this->response($data,REST_Controller::HTTP_OK); } - $data['dataStatus'] = false; - $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $data['msg'] = $final_array; - $this->response($data,REST_Controller::HTTP_OK); + } diff --git a/api/application/libraries/excel.php b/api/application/libraries/excel.php index 662fc5f4..62264cce 100644 --- a/api/application/libraries/excel.php +++ b/api/application/libraries/excel.php @@ -1,17 +1,8 @@ $value) { $this->db->SELECT('count(*) as count'); - $this->db->FROM(PDFORMDETAILS.' as PDFORMDETAILS'); - $this->db->WHERE('PDFORMDETAILS.fk_pd_id',$pdid); - $this->db->WHERE('PDFORMDETAILS.fk_form_id',$value['form_id']); + $this->db->FROM(PDFORMDETAILSJSON.' as PDFORMDETAILSJSON'); + $this->db->WHERE('PDFORMDETAILSJSON.fk_pd_id',$pdid); + $this->db->WHERE('PDFORMDETAILSJSON.fk_form_id',$value['form_id']); + $this->db->WHERE('PDFORMDETAILSJSON.isactive',1); $template_forms_count = 0; $template_forms_count = $this->db->GET()->result_array(); //print_r($template_forms_count);die(); diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index 9856bf87..a386efd1 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -85,13 +85,20 @@ td, th { background-color: #dddddd; } --> + + +