From 3de0eb18e1706bb8430004bc56079e8ad1c18564 Mon Sep 17 00:00:00 2001 From: velz Date: Mon, 22 Oct 2018 15:26:34 +0530 Subject: [PATCH 1/3] PD PROCESS --- api/application/config/constants.php | 2 +- api/application/models/PD_Model.php | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 1a3d6867..dbaf7f88 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto // define login route name for token verification //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'savePDQuestions'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'loadFullTemplate'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 0bb334c6..a3386572 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -271,7 +271,7 @@ class PD_Model extends SPARQ_Model { $categories = ""; //Get PD Master Details including Template id @param $pd_id $pd_master_detials = $this->getPDMasterDetails($pdid); - // print_r($pd_master_detials); + //sprint_r($pd_master_detials); $template_id = $pd_master_detials[0]['fk_pd_template_id']; if($template_id != "" || $template_id != null) @@ -302,10 +302,10 @@ class PD_Model extends SPARQ_Model { // $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATEQUESTION.fk_createdby = USERPROFILE.userid','LEFT'); // $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATEQUESTION.fk_updatedby = USERPROFILE1.userid','LEFT'); $this->db->WHERE('TEMPLATEQUESTION.fk_template_question_category_id',$category['fk_question_category_id']); - $this->db->WHERE('TEMPLATEQUESTION.fk_template_id',$template_id); + //$this->db->WHERE('TEMPLATEQUESTION.fk_template_id',$template_id); $questions = $this->db->GET()->result_array(); - + $categories[$category_key]['questions_count'] = count($questions); if(count($questions)) { @@ -318,6 +318,7 @@ class PD_Model extends SPARQ_Model { $this->db->JOIN(PDDETAIL.' as PDDETAIL',"QUESTIONANSWERS.question_answer_id = PDDETAIL.pd_answer_id AND PDDETAIL.fk_pd_id = $pdid",'LEFT'); // $this->db->WHERE('QUESTIONANSWERS.fk_question_id',$question['question_id']); $this->db->WHERE('TEMPLATEANSWERWEIGHTAGE.fk_template_question_id',$question['template_question_id']); + // $this->db->WHERE('PDDETAIL.fk_pd_id',$pdid); $answers = $this->db->GET()->result_array(); $questions[$answer_key]['answers'] = $answers; } @@ -325,10 +326,13 @@ class PD_Model extends SPARQ_Model { $categories[$category_key]['questions'] = $questions; } - } + } } - return $categories; + $result_data['question_answers'] = $categories; + $result_data['pdmaster_details'] = $pd_master_detials; + $result_data['assessed_income'] = ""; + return $result_data; } } \ No newline at end of file From 696b54f7ccba9a85ff7d22ced9cdc2bff51206c9 Mon Sep 17 00:00:00 2001 From: velz Date: Mon, 22 Oct 2018 17:15:03 +0530 Subject: [PATCH 2/3] PD ENTITY CHNAGED --- api/application/config/constants.php | 2 +- api/application/config/routes.php | 1 + .../Entity_Management_Controller.php | 29 +++++++++ .../models/Entity_Management_Model.php | 59 +++++++++++++------ api/application/models/PD_Model.php | 7 ++- 5 files changed, 77 insertions(+), 21 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index dbaf7f88..d1024601 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto // define login route name for token verification //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'loadFullTemplate'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getEntityBillingInfo'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 4d13ce6c..f0b83712 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -115,6 +115,7 @@ $route['updateAnswerStatus'] = 'Question_Management_Controller/updateAnswerStatu $route['(listAllEntites/:any)'] = 'Entity_Management_Controller/listAllEntites/'; $route['saveNewEntity'] = 'Entity_Management_Controller/saveNewEntity'; $route['saveExistEntity'] = 'Entity_Management_Controller/saveExistEntity'; +$route['getEntityBillingInfo'] = 'Entity_Management_Controller/getEntityBillingInfo'; $route['getLocationHierarchy'] = 'Entity_Management_Controller/getLocationHierarchy'; //PD RELATED diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index 275af38c..6cf19111 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -247,5 +247,34 @@ class Entity_Management_Controller extends REST_Controller { } + /****** Get All Entity Billing Info and it's contact info @param entity id******/ + public function getEntityBillingInfo_get() + { + $entity_id = ""; + if($this->get('eid')) { $entity_id = $this->get('eid'); } + + if( $entity_id != "" || $entity_id != null) + { + + $result = $this->Entity_Management_Model->getEntityBillingInfo($entity_id); + if(count($result)) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $this->response($data,REST_Controller::HTTP_OK); + } + } + + + } + + } \ No newline at end of file diff --git a/api/application/models/Entity_Management_Model.php b/api/application/models/Entity_Management_Model.php index 385446ba..629c62bd 100644 --- a/api/application/models/Entity_Management_Model.php +++ b/api/application/models/Entity_Management_Model.php @@ -14,13 +14,9 @@ class Entity_Management_Model extends SPARQ_Model { { $result_data = array(); - $this->db->SELECT('ENTITY.entity_id, ENTITY.full_name, ENTITY.short_name, ENTITY.fk_region,REGIONS.name as region_name, ENTITY.fk_state,STATE.name as state_name, ENTITY.fk_city,CITY.name as city_name, ENTITY.fk_branch,BRANCH.name as branch_name, ENTITY.addressline1, ENTITY.pincode, ENTITY.official_email, ENTITY.alt_email, ENTITY.phone_number, ENTITY.mobile_no, ENTITY.remarks, ENTITY.createdon, ENTITY.fk_createdby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby, ENTITY.updatedon, ENTITY.fk_updatedby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, ENTITY.isactive, ENTITY.pan, ENTITY.gst_no, ENTITY.gst_state_code,ENTITY.tat, ENTITY.fk_entity_type_id,ENTITYTYPE.name as entity_name'); - $this->db->FROM(ENTITY.' as ENTITY'); - $this->db->JOIN(REGIONS.' as REGIONS','ENTITY.fk_region = REGIONS.region_id'); - $this->db->JOIN(STATE.' as STATE','ENTITY.fk_state = STATE.state_id'); - $this->db->JOIN(CITY.' as CITY','ENTITY.fk_city = CITY.city_id'); - $this->db->JOIN(BRANCH.' as BRANCH','ENTITY.fk_branch = BRANCH.branch_id '); - $this->db->JOIN(USERPROFILE.' as USERPROFILE','ENTITY.fk_createdby = USERPROFILE.userid'); + $this->db->SELECT('ENTITY.entity_id, ENTITY.full_name, ENTITY.short_name,ENTITY.createdon, ENTITY.fk_createdby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby, ENTITY.updatedon, ENTITY.fk_updatedby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, ENTITY.isactive,ENTITY.fk_entity_type_id,ENTITYTYPE.name as entity_name'); + $this->db->FROM(ENTITY.' as ENTITY'); + $this->db->JOIN(USERPROFILE.' as USERPROFILE','ENTITY.fk_createdby = USERPROFILE.userid','LEFT'); $this->db->JOIN(USERPROFILE.' as USERPROFILE1','ENTITY.fk_updatedby = USERPROFILE1.userid','LEFT'); $this->db->JOIN(ENTITYTYPE.' as ENTITYTYPE','ENTITY.fk_entity_type_id = ENTITYTYPE.entity_type_id'); if($entity_type_id != null || $entity_type_id != '') @@ -33,20 +29,20 @@ class Entity_Management_Model extends SPARQ_Model { $result = $this->db->get()->result_array(); - foreach($result as $key => $r) - { - $this->db->SELECT('ENTITYCHILD.entity_child_id,ENTITYCHILD.contact_person,ENTITYCHILD.contact_email,ENTITYCHILD.contact_mobile_no,ENTITYCHILD.contact_person,ENTITYCHILD.isactive,ENTITYCHILD.createdon,ENTITYCHILD.fk_createdby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,ENTITYCHILD.updatedon,ENTITYCHILD.fk_updatedby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby'); - $this->db->FROM(ENTITYCHILD.' as ENTITYCHILD'); - $this->db->JOIN(ENTITY.' as ENTITY','ENTITYCHILD.fk_entity_id = ENTITY.entity_id'); - $this->db->JOIN(USERPROFILE.' as USERPROFILE','ENTITYCHILD.fk_createdby = USERPROFILE.userid '); - $this->db->JOIN(USERPROFILE.' as USERPROFILE1','ENTITYCHILD.fk_updatedby = USERPROFILE1.userid','LEFT'); - $this->db->where('ENTITY.entity_id',$r['entity_id']); + // foreach($result as $key => $r) + // { + // $this->db->SELECT('ENTITYCHILD.entity_child_id,ENTITYCHILD.contact_person,ENTITYCHILD.contact_email,ENTITYCHILD.contact_mobile_no,ENTITYCHILD.contact_person,ENTITYCHILD.isactive,ENTITYCHILD.createdon,ENTITYCHILD.fk_createdby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,ENTITYCHILD.updatedon,ENTITYCHILD.fk_updatedby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby'); + // $this->db->FROM(ENTITYCHILD.' as ENTITYCHILD'); + // $this->db->JOIN(ENTITY.' as ENTITY','ENTITYCHILD.fk_entity_id = ENTITY.entity_id'); + // $this->db->JOIN(USERPROFILE.' as USERPROFILE','ENTITYCHILD.fk_createdby = USERPROFILE.userid '); + // $this->db->JOIN(USERPROFILE.' as USERPROFILE1','ENTITYCHILD.fk_updatedby = USERPROFILE1.userid','LEFT'); + // $this->db->where('ENTITY.entity_id',$r['entity_id']); - $entity_child_data = $this->db->get()->result_array(); + // $entity_child_data = $this->db->get()->result_array(); - array_push($result[$key],$entity_child_data); + // array_push($result[$key],$entity_child_data); - } + // } if(count($result) > 0 ) { @@ -63,5 +59,32 @@ class Entity_Management_Model extends SPARQ_Model { } } + + /****** Get All Entity Billing Info and it's contact info******/ + + public function getEntityBillingInfo($entity_id) + { + + + $this->db->SELECT('ENTITYBILLING.entity_billing_id,ENTITYBILLING.fk_entity_id, ENTITYBILLING.billing_name,ENTITYBILLING.isactive,ENTITYBILLING.addressline1,ENTITYBILLING.addressline2,ENTITYBILLING.addressline3,ENTITYBILLING.pincode,ENTITYBILLING.email,ENTITYBILLING.mobileno,ENTITYBILLING.gstno,ENTITYBILLING.gststatecode,ENTITYBILLING.pan'); + $this->db->FROM(ENTITYBILLING.' as ENTITYBILLING'); + $this->db->WHERE('ENTITYBILLING.fk_entity_id',$entity_id); + $result = $this->db->get()->result_array(); + + if(count($result)) + { + foreach($result as $key => $res) + { + $this->db->SELECT('ENTITYBILLINGCONTACTINFO.entity_billing_contact_id,ENTITYBILLINGCONTACTINFO.fk_entity_billing_id, ENTITYBILLINGCONTACTINFO.contact_person, ENTITYBILLINGCONTACTINFO.contact_email, ENTITYBILLINGCONTACTINFO.contact_mobile_no, ENTITYBILLINGCONTACTINFO.isactive') ; + $this->db->FROM(ENTITYBILLINGCONTACTINFO.' as ENTITYBILLINGCONTACTINFO'); + $this->db->WHERE('ENTITYBILLINGCONTACTINFO.fk_entity_billing_id',$res['entity_billing_id']); + $contacts = $this->db->get()->result_array(); + $result[$key]['contacts'] = $contacts; + } + } + return $result; + } + + } \ No newline at end of file diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index a3386572..4f8789c4 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -271,6 +271,7 @@ class PD_Model extends SPARQ_Model { $categories = ""; //Get PD Master Details including Template id @param $pd_id $pd_master_detials = $this->getPDMasterDetails($pdid); + $pd_applicants_detials = $this->getApplicantsDetails($pdid); //sprint_r($pd_master_detials); $template_id = $pd_master_detials[0]['fk_pd_template_id']; @@ -294,11 +295,12 @@ class PD_Model extends SPARQ_Model { foreach($categories as $category_key => $category) { - $this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive,QUESTIONANSWERTYPE.answer_type_name'); + $this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive,QUESTIONANSWERTYPE.answer_type_name,PDDETAIL.pd_detail_id'); //$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION'); $this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION'); $this->db->JOIN(QUESTIONS.' as QUESTIONS','TEMPLATEQUESTION.fk_question_id = QUESTIONS.question_id','LEFT'); $this->db->JOIN(QUESTIONANSWERTYPE.' as QUESTIONANSWERTYPE','QUESTIONS.fk_question_answertype = QUESTIONANSWERTYPE.question_answer_type_id','LEFT'); + $this->db->JOIN(PDDETAIL.' as PDDETAIL',"QUESTIONS.question_id = PDDETAIL.fk_question_id AND PDDETAIL.fk_pd_id = $pdid",'LEFT'); // $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATEQUESTION.fk_createdby = USERPROFILE.userid','LEFT'); // $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATEQUESTION.fk_updatedby = USERPROFILE1.userid','LEFT'); $this->db->WHERE('TEMPLATEQUESTION.fk_template_question_category_id',$category['fk_question_category_id']); @@ -330,7 +332,8 @@ class PD_Model extends SPARQ_Model { } $result_data['question_answers'] = $categories; - $result_data['pdmaster_details'] = $pd_master_detials; + $result_data['pdmaster_details'] = $pd_master_detials[0]; + $result_data['pdapplicants_detials'] = $pd_applicants_detials; $result_data['assessed_income'] = ""; return $result_data; } From 3d0c3d45537349cdbe06151bc2e43d3dc01a9779 Mon Sep 17 00:00:00 2001 From: velz Date: Mon, 22 Oct 2018 17:45:02 +0530 Subject: [PATCH 3/3] PD PROCESS2 --- api/application/controllers/PD_Controller.php | 28 +++++++++++++++++++ api/application/models/PD_Model.php | 16 ++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index a49222e8..301caf16 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -1122,6 +1122,34 @@ class PD_Controller extends REST_Controller { } + /************** Get Answers for PD @params question_id, pd_id, template_id, category_id**************/ + public function getAnswersForPD_post() + { + $question_id = $this->post('question_id'); + $pd_id = $this->post('pd_id'); + $template_id = $this->post('template_id'); + $category_id = $this->post('category_id'); + + $answers = $this->PD_Model->getAnswersForPD($question_id,$pd_id,$template_id,$category_id); + + if(count($answers)) + { + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $pd_detail_id; + $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); + } + + } + } \ No newline at end of file diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 4f8789c4..e67ce6ce 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -295,7 +295,7 @@ class PD_Model extends SPARQ_Model { foreach($categories as $category_key => $category) { - $this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive,QUESTIONANSWERTYPE.answer_type_name,PDDETAIL.pd_detail_id'); + $this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive,QUESTIONS.fk_question_answertype,QUESTIONANSWERTYPE.answer_type_name,PDDETAIL.pd_detail_id'); //$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION'); $this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION'); $this->db->JOIN(QUESTIONS.' as QUESTIONS','TEMPLATEQUESTION.fk_question_id = QUESTIONS.question_id','LEFT'); @@ -337,5 +337,19 @@ class PD_Model extends SPARQ_Model { $result_data['assessed_income'] = ""; return $result_data; } + + + public function getAnswersForPD($question_id,$pd_id,$template_id,$category_id) + { + // $this->db->SELECT('QUESTIONANSWERS.question_answer_id,QUESTIONANSWERS.answer,TEMPLATEANSWERWEIGHTAGE.template_answer_weightage_id, TEMPLATEANSWERWEIGHTAGE.fk_template_question_id, TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id, TEMPLATEANSWERWEIGHTAGE.template_answer_weightage,PDDETAIL.pd_detail_id'); + // $this->db->FROM(TEMPLATEANSWERWEIGHTAGE.' as TEMPLATEANSWERWEIGHTAGE'); + // $this->db->JOIN(QUESTIONANSWERS.' as QUESTIONANSWERS','TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id = QUESTIONANSWERS.question_answer_id','LEFT'); + // $this->db->JOIN(PDDETAIL.' as PDDETAIL',"QUESTIONANSWERS.question_answer_id = PDDETAIL.pd_answer_id AND PDDETAIL.fk_pd_id = $pdid",'LEFT'); + // // $this->db->WHERE('QUESTIONANSWERS.fk_question_id',$question['question_id']); + // $this->db->WHERE('TEMPLATEANSWERWEIGHTAGE.fk_template_question_id',$question['template_question_id']); + // // $this->db->WHERE('PDDETAIL.fk_pd_id',$pdid); + // $answers = $this->db->GET()->result_array(); + // $questions[$answer_key]['answers'] = $answers; + } } \ No newline at end of file