diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 7062f4f8..1a2ef931 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -256,4 +256,5 @@ $route['(getRawData/:any)'] = 'Data_Dump_Controller/getRawData'; $route['loadSalesPDTemplate'] = 'Sales_PD_Controller/loadSalesPDTemplate'; $route['saveSalesPD'] = 'Sales_PD_Controller/saveSalesPD'; $route['(downloadSalesPDReport/:any)'] = 'Sales_PD_Controller/getSalesPDReport'; +$route['(listSalesPD/:any)'] = 'Sales_PD_Controller/listSalesPD'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 0b590dea..5fbf8b2e 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -8187,7 +8187,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $incomplete_details[] = 'Business Section - Company Employees Details Not Filled'; } - if( !is_numeric($business_form['employees_temporary']) && $pd_master_details[0]['lender_short_name'] != 'CLIX') + if( ($pd_master_details[0]['lender_short_name'] != 'CLIX' && $pd_master_details[0]['lender_short_name'] != 'SMC') && !is_numeric($business_form['employees_temporary'])) { $incomplete_details[] = 'Business Section - Company Employees Details Not Filled'; } diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index d15cfadd..b91fa156 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -115,8 +115,21 @@ class Sales_PD_Controller extends REST_Controller { if(!$sales_pd_data[0]['is_pdf'] || $sales_pd_data[0]['is_edited']) { + + //echo 'FIRST'; + //Get Data from DB and process + //print_r(json_decode($sales_pd_data[0]['pd_json'],true));die(); + $json_data = (json_decode($sales_pd_data[0]['pd_json'],true)); + foreach ($json_data as $sec_key => $section) + { + $data[$section['section_name'] ] = $this->processSalesPDJSON($section); + } + //die(); + print_r($data);die(); + + //End of JSON processing $view_name = $sales_pd_data[0]['short_name'].'_'.$sales_pd_data[0]['abbr']; - $html_content = $this->load->view('sale_pd_templates/'.$view_name,$data = array(),true); + $html_content = $this->load->view('sale_pd_templates/'.$view_name,$data,true); $pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); //End of PDF Gen using DOM PDF @@ -150,6 +163,97 @@ class Sales_PD_Controller extends REST_Controller { } } + + public function listSalesPD_get() + { + $lender_id = $this->uri->segment(2);//sales_pd_id, pd_json, lender_id, product_id, createdby, updatedby, createdon, updatedon, isactive, is_pdf, is_edited, length(pd_json) + + $columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.lender_id','SALES_PD_DATA.product_id','SALES_PD_DATA.is_pdf','SALES_PD_DATA.is_edited','ENTITY.short_name','PRODUCT.abbr'); + $table = SALES_PD_DATA.' as SALES_PD_DATA'; + $joins = array( + array('table' => ENTITY. ' as ENTITY', + 'condition' =>'SALES_PD_DATA.lender_id = ENTITY.entity_id', + 'jointype' => 'INNER'), + array('table' => PRODUCTS. ' as PRODUCT', + 'condition' =>'SALES_PD_DATA.product_id = PRODUCT.product_id', + 'jointype' => 'INNER') + ); + + $where_condition_array = array(); + if(is_numeric($lender_id)) + { + $where_condition_array = array('SALES_PD_DATA.lender_id' => $lender_id); + } + $order_by = 'SALES_PD_DATA.sales_pd_id'; + $sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array); + if(count($sales_pd_data)) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $sales_pd_data; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'Something went wrong! Try Later'; + $this->response($data,REST_Controller::HTTP_OK); + } + + + } + + + function processSalesPDJSON($section_array) + { + // + echo '###'.$section_array['section_id'].'####'; + if($section_array['section_id'] == 3) + { + //print_r($section_array); + } + if($section_array['section_id'] != 8) + { + //print_r($section_array); + return $this->processSalesPDQuestions($section_array['questions']); + + } + // die(); + // $general_section_dta = array(); + // foreach ($section_array as $sec_key => $section) + // { + + //} + } + + function processSalesPDQuestions($questions) + { + $temp_array = array(); + foreach ($questions as $ques_key => $question) + { + if($question['is_repeatable'] == null && ($question['type'] == 1 || $question['type'] == 2 || $question['type'] == 3))//text,radio,SDD + { + $temp_array[ $question['question_key'] ] = $question['answer_value']; + } + else if($question['is_repeatable'] == 1) + { + //print_r($question['questions_group']);die(); + foreach ($question['questions_group'] as $group_key => $group_value) + { + //print_r($group_value['']);die(); + foreach ($group_value['questions'] as $q_key => $q_value) + { + //print_r($q_value);die(); + $temp_array[ $group_key ][ $q_value['question_key'] ] = $q_value['answer_value']; + } + + } + } + } + //print_r($temp_array);die(); + return $temp_array; + } } diff --git a/api/application/views/report_templates/JSONTOREPORT_CLIX.php b/api/application/views/report_templates/JSONTOREPORT_CLIX.php index 9822f1f2..ecdf9959 100644 --- a/api/application/views/report_templates/JSONTOREPORT_CLIX.php +++ b/api/application/views/report_templates/JSONTOREPORT_CLIX.php @@ -2496,7 +2496,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $client_sixth_row .= $main_raw_material['manufacturing_payment_mode'] ? '
Product :- tpl_vars['product']->value;?> -
- - -Business Info - Type Of Activity
-tpl_vars['type_of_activity']->value == "Manufacturing") {?> - Manufacturing Products -tpl_vars['type_of_activity']->value == "Retails") {?> - Retails - tpl_vars['type_of_activity']->value == "Service Providers") {?> - Service Providers - - Others - - -List of Co - Applicant's with Foreach
-smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['applicants']->value, 'applicant'); -if ($_from !== null) { -foreach ($_from as $_smarty_tpl->tpl_vars['applicant']->value) { -if ($_smarty_tpl->tpl_vars['applicant']->value['name'] > 50) {?> -List of Co - Applicant's With Section
-tpl_vars['applicants']->value) ? count($_loop) : max(0, (int) $_loop)); -$__section_a_0_total = $__section_a_0_loop; -$_smarty_tpl->tpl_vars['__smarty_section_a'] = new Smarty_Variable(array()); -if ($__section_a_0_total !== 0) { -for ($__section_a_0_iteration = 1, $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index'] = 0; $__section_a_0_iteration <= $__section_a_0_total; $__section_a_0_iteration++, $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index']++){ -?> - tpl_vars['applicants']->value[(isset($_smarty_tpl->tpl_vars['__smarty_section_a']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index'] : null)]['name'];?> - * - tpl_vars['applicants']->value[(isset($_smarty_tpl->tpl_vars['__smarty_section_a']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index'] : null)]['age'];?> -tpl_vars['Name']->value;?> -
- -