diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index 33a8cba4..2cdfbacc 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -1336,6 +1336,7 @@ class Template_Management_Controller extends REST_Controller { { if($arr['map_id'] != null || $arr['map_id'] != ""){ $result_array[$inx]["forms"] = $this->Template_Management_Model->getBuinessGroupForms($arr['map_id']); + array_push($result_array[$inx]["forms"],array("form_id"=> "14","form_name"=> "Financial Information","pd_form_level_order"=> "2","json"=> "","is_form_disabled"=> "0","is_business_form"=> "1","is_group_form"=> "0","pd_form_order"=>"8","is_form_status"=>null,"template_id"=>null,"map_id"=>$arr['map_id'])); }else{ $result_array[$inx]["forms"] = array(); } diff --git a/api/application/models/Template_Management_Model.php b/api/application/models/Template_Management_Model.php index a33d24fc..571e5cd6 100644 --- a/api/application/models/Template_Management_Model.php +++ b/api/application/models/Template_Management_Model.php @@ -333,13 +333,13 @@ class Template_Management_Model extends SPARQ_Model { LEFT JOIN `m_pd_forms` as `PDFORMS` ON `TEMPLATE_JSON_V2`.`form_id` = `PDFORMS`.`pd_form_id` WHERE `TEMPLATE_JSON_V2`.`isactive` = 1 AND `TEMPLATE_JSON_V2`.`map_id` = ".$value." + AND `PDFORMS`.`is_business_form` = 0 AND - (`TEMPLATE_JSON_V2`.`is_form_status` = 'COMPLETED' + `TEMPLATE_JSON_V2`.`is_form_status` = 'COMPLETED' or `TEMPLATE_JSON_V2`.`is_form_status` = 'APPROVED' or - `TEMPLATE_JSON_V2`.`is_form_status` = 'DRAFT' ) - AND `PDFORMS`.`is_business_form` =0 + `TEMPLATE_JSON_V2`.`is_form_status` = 'DRAFT' ORDER BY `PDFORMS`.`pd_form_order`"; return $this->db->query($sql_query)->result_array(); } @@ -364,22 +364,46 @@ class Template_Management_Model extends SPARQ_Model { return count($afftectedRows)>0 ? true: false; } - public function getBuinessGroupForms($map_id){ - $this->db->SELECT('TEMPLATE_JSON_V2.id as template_id,TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_level_order,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.is_form_disabled,PDFORMS.is_business_form,TEMPLATE_JSON_V2.is_group_form'); + public function getBuinessGroupForms_existing($map_id){ + $this->db->SELECT('TEMPLATE_JSON_V2.id as template_id,TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_level_order,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.is_form_disabled,PDFORMS.is_business_form,TEMPLATE_JSON_V2.is_group_form'); + if(!empty($map_id)){ + $this->db->SELECT('TEMPLATE_JSON_V2.map_id,TEMPLATE_JSON_V2.json'); + $this->db->FROM(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2'); + $this->db->JOIN(PDFORMS.' as PDFORMS','TEMPLATE_JSON_V2.form_id = PDFORMS.pd_form_id','LEFT'); + $this->db->WHERE('TEMPLATE_JSON_V2.map_id',$map_id); + }else{ + $this->db->SELECT('TEMPLATE_JSON_V2.map_id,PDFORMS.form_template as json'); + $this->db->FROM(PDFORMS.' as PDFORMS'); + $this->db->JOIN(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2','TEMPLATE_JSON_V2.form_id = PDFORMS.pd_form_id','LEFT'); + } + $this->db->WHERE('TEMPLATE_JSON_V2.isactive',1); + $this->db->WHERE('PDFORMS.is_business_form',1); + $result = $this->db->GET()->result_array(); + return $result; + } + + public function getBuinessGroupForms($map_id){ if(!empty($map_id)){ - $this->db->SELECT('TEMPLATE_JSON_V2.map_id,TEMPLATE_JSON_V2.json'); - $this->db->FROM(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2'); - $this->db->JOIN(PDFORMS.' as PDFORMS','TEMPLATE_JSON_V2.form_id = PDFORMS.pd_form_id','LEFT'); - $this->db->WHERE('TEMPLATE_JSON_V2.map_id',$map_id); - }else{ + $sql_query = "SELECT `TEMPLATE_JSON_V2`.`id` as `template_id`, `TEMPLATE_JSON_V2`.`form_id`, `PDFORMS`.`pd_form_order`, `PDFORMS`.`pd_form_level_order`, `PDFORMS`.`pd_form_name` as `form_name`, `TEMPLATE_JSON_V2`.`is_form_disabled`, `PDFORMS`.`is_business_form`, `TEMPLATE_JSON_V2`.`is_group_form`, `TEMPLATE_JSON_V2`.`is_form_status`, `TEMPLATE_JSON_V2`.`map_id`, `TEMPLATE_JSON_V2`.`json` + FROM `m_template_json_v2` as `TEMPLATE_JSON_V2` + LEFT JOIN `m_pd_forms` as `PDFORMS` ON `TEMPLATE_JSON_V2`.`form_id` = `PDFORMS`.`pd_form_id` + WHERE `TEMPLATE_JSON_V2`.`map_id` = ".$map_id." + AND `PDFORMS`.`is_business_form` = 1 + AND `TEMPLATE_JSON_V2`.`isactive` = 1 + AND `TEMPLATE_JSON_V2`.`is_form_status` = 'COMPLETED' + OR `TEMPLATE_JSON_V2`.`is_form_status` = 'APPROVED' + OR `TEMPLATE_JSON_V2`.`is_form_status` = 'DRAFT'"; + $result = $this->db->query($sql_query)->result_array(); + }else{ + $this->db->SELECT('TEMPLATE_JSON_V2.id as template_id,TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_level_order,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.is_form_disabled,PDFORMS.is_business_form,TEMPLATE_JSON_V2.is_group_form,TEMPLATE_JSON_V2.is_form_status'); $this->db->SELECT('TEMPLATE_JSON_V2.map_id,PDFORMS.form_template as json'); $this->db->FROM(PDFORMS.' as PDFORMS'); $this->db->JOIN(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2','TEMPLATE_JSON_V2.form_id = PDFORMS.pd_form_id','LEFT'); + $this->db->WHERE('TEMPLATE_JSON_V2.isactive',1); + $this->db->WHERE('PDFORMS.is_business_form',1); + $result = $this->db->GET()->result_array(); } - $this->db->WHERE('TEMPLATE_JSON_V2.isactive',1); - $this->db->WHERE('PDFORMS.is_business_form',1); - $result = $this->db->GET()->result_array(); - return $result; + return $result; } diff --git a/api/application/views/smc_creditpd_reports/MWISE.php b/api/application/views/smc_creditpd_reports/MWISE.php index 46a070a6..77327ae7 100644 --- a/api/application/views/smc_creditpd_reports/MWISE.php +++ b/api/application/views/smc_creditpd_reports/MWISE.php @@ -6,6 +6,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $dash = ' '; // $product_name = $master[0]['abbr']; $rupee_symbol = "₹"; + // echo $pd_master_details[0]['main_applicant']; + // echo $applicant_details[0]['company_name'];die(); // $pd_type = ""; // if($master[0]['sales_pd_type'] == 1){$pd_type = "Physical "; }else if($master[0]['sales_pd_type'] == 2){$pd_type = "Telephonic ";} // $company = array(); @@ -223,7 +225,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| Name of the Company/Firm | -+ | |||||||||||||||