diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 4469406b..3e362d11 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -25,6 +25,7 @@ class Sales_PD_Controller extends REST_Controller { $this->load->helper('satellite_image'); $this->load->helper('camunda'); $this->load->library('phpmailer_library'); + $this->load->helper('salespd_cetapp'); } @@ -203,14 +204,31 @@ class Sales_PD_Controller extends REST_Controller { $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[0]['section_data'],true));die(); $view_data['master'] = $sales_pd_data; + $common_fields = array('pdid'=>$sales_pd_data[0]['sales_pd_id'], + 'product'=>$sales_pd_data[0]['abbr'], + 'caseno'=>$sales_pd_data[0]['sales_pd_sno']); foreach ($all_section_data as $sec_key => $section) { // print_r($section['section_id']);die(); + // log_message('ERROR','####PREPARE SALESPD REPORT CALLED'.$sales_pd_id); $view_data['section'.$section['section_id'] ] = $this->processSalesPDJSON($section);//die(); + $section_fields['section'.$section['section_id'] ] = $this->processSalesPDJSON($section); } + salespd_cetapp::pushwithcetsalespdapi($common_fields,$section_fields,1); // 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); + if(count($view_data['section9'])>0){ + for ($i = 0; $i < count($view_data['section9']); $i++){ + $img_fields[$i]['img_name'] = $view_data['section9'][$i]['img_name']; + $img_fields[$i]['img'] = $view_data['section9'][$i]['img']; + }} $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); + if(!empty($view_data['satellite_image'])){ + $count = count($view_data['section9'])+1; + $img_fields[$count]['img_name'] = $view_data['satellite_image'][0]['img_name']; + $img_fields[$count]['img'] = $view_data['satellite_image'][0]['img']; + } + salespd_cetapp::pushwithcetsalespdapi($common_fields,$img_fields,2); $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(); @@ -1353,7 +1371,15 @@ public function filterSalesPDList_post() { $data['msg'] = $statusMsg; $this->response($data,REST_Controller::HTTP_OK); } + // public function salespd_cetapp_sectionapi_get(){ + // $get = $this->get('sales_pd_id'); + // $this->prepareSalesPDReport($get); + + // } + // public function salespd_cetapp_imageapi_get(){ + // } + //test purpose public function testSaleSection_get(){ $data = $this->Sales_PD_Model->testSaleSection(527); diff --git a/api/application/helpers/salespd_cetapp_helper.php b/api/application/helpers/salespd_cetapp_helper.php new file mode 100644 index 00000000..2d4746dc --- /dev/null +++ b/api/application/helpers/salespd_cetapp_helper.php @@ -0,0 +1,33 @@ + \ No newline at end of file