This commit is contained in:
venbaSriram 2018-10-22 18:23:06 +05:30
commit 4696156581
6 changed files with 127 additions and 25 deletions

View File

@ -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', 'getEntityBillingInfo'); // no errors
/*********************AWS resources Constants*************************************************/
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');

View File

@ -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

View File

@ -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);
}
}
}
}

View File

@ -1162,6 +1162,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);
}
}
}

View File

@ -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;
}
}

View File

@ -271,7 +271,8 @@ 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);
$pd_applicants_detials = $this->getApplicantsDetails($pdid);
//sprint_r($pd_master_detials);
$template_id = $pd_master_detials[0]['fk_pd_template_id'];
if($template_id != "" || $template_id != null)
@ -294,18 +295,19 @@ 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,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');
$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']);
$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 +320,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 +328,28 @@ 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[0];
$result_data['pdapplicants_detials'] = $pd_applicants_detials;
$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;
}
/**