COMMON FILTER FOR PD CHNAGED

This commit is contained in:
velz 2018-12-21 14:48:28 +05:30
parent 5d45de3d81
commit 86b5621593
2 changed files with 25 additions and 21 deletions

View File

@ -1267,15 +1267,15 @@ class PD_Controller extends REST_Controller {
$records = $this->post('records');
//print_r($this->post('records'));die();
$pd_type = $records['pd_type'];
//print_r($pd_type);die();
//print_r($records);die();
$pd_status = $records['pd_status'];
$pd_from_date = $records['pd_from_date'];
$pd_to_date = $records['pd_to_date'];
$pd_city = $records['pd_city'];
$pd_products = $records['pd_products'];
$pd_lender = $records['pd_lender'];
$pd_applicant_name = $records['pd_name'];
$pd_applicant_lender_ref = $records['pd_applicant_id'];
$pd_applicant_name = strtolower($records['pd_name']);
$pd_applicant_lender_ref = strtolower($records['pd_applicant_id']);
$result_data = $this->PD_Model->PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref);
if(count($result_data))
@ -2369,8 +2369,8 @@ class PD_Controller extends REST_Controller {
{
$pd_form_raw_data = $this->PD_Model->getPDFormDetailsWithScoring($pd_id,$template_form_detail['form_id']);
$pd_form_raw_data_with_score = $this->calculatePDScore($pd_form_raw_data);
$transformed_data = $this->transformKeyPairToQuestionAnswers($pd_form_raw_data_with_score,$template_form_detail['form_id']);
//$pd_form_raw_data_with_score = $this->calculatePDScore($pd_form_raw_data);
$transformed_data = $this->transformKeyPairToQuestionAnswers($pd_form_raw_data,$template_form_detail['form_id']);
$final_data_to_response['question_answers']['form_details'][] = array('name' =>[$template_form_detail['pd_form_name']],'details' => $transformed_data);

View File

@ -143,50 +143,50 @@ class PD_Model extends SPARQ_Model {
$this->db->JOIN(CITY.' as CITY','PDTRIGGER.fk_city = CITY.city_id','LEFT');
$this->db->JOIN(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS','PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id','LEFT');
$this->db->JOIN(ENTITYLENDERBRANCH.' as ENTITYLENDERBRANCH','PDTRIGGER.pd_branch_id = ENTITYLENDERBRANCH.entity_lender_branch_id','LEFT');
if(count($pd_type))
if(!empty($pd_type))
{
$this->db->WHERE_IN('fk_pd_type',$pd_type);
$this->db->WHERE_IN('PDTRIGGER.fk_pd_type',$pd_type);
}
if(count($pd_status))
if(!empty($pd_status))
{
$this->db->WHERE_IN('pd_status',$pd_status);
$this->db->WHERE_IN('PDTRIGGER.pd_status',$pd_status);
}
if(($pd_from_date != "" || $pd_from_date != null) && ($pd_to_date != "" || $pd_to_date != null))
{
$this->db->where('pd_date_of_initiation BETWEEN ' ."'$pd_from_date'". ' AND ' ."'$pd_to_date'");
$this->db->where('PDTRIGGER.pd_date_of_initiation BETWEEN ' ."'$pd_from_date'". ' AND ' ."'$pd_to_date'");
}
if(count($pd_city))
if(!empty($pd_city))
{
$this->db->WHERE_IN('fk_city',$pd_city);
$this->db->WHERE_IN('PDTRIGGER.fk_city',$pd_city);
}
if(count($pd_products))
if(!empty($pd_products))
{
$this->db->WHERE_IN('fk_product_id',$pd_products);
$this->db->WHERE_IN('PDTRIGGER.fk_product_id',$pd_products);
}
if(count($pd_lender))
if(!empty($pd_lender))
{
$this->db->WHERE_IN('fk_lender_id',$pd_lender);
$this->db->WHERE_IN('PDTRIGGER.fk_lender_id',$pd_lender);
}
if($pd_applicant_lender_ref != "" || $pd_applicant_lender_ref != null )
{
$this->db->WHERE('lender_applicant_id',$pd_applicant_lender_ref);
$this->db->LIKE('PDTRIGGER.lender_applicant_id',"$pd_applicant_lender_ref");
}
if($pd_applicant_name != "" || $pd_applicant_name != null )
{
$this->db->WHERE('PDAPPLICANTSDETAILS.applicant_name',$pd_applicant_name);
$this->db->LIKE('PDAPPLICANTSDETAILS.applicant_name',"$pd_applicant_name");
}
$this->db->ORDER_BY('PDTRIGGER.pd_id','DESC');
$result_array = $this->db->GET()->result_array();
//print_r($this->db->last_query());
// print_r($this->db->last_query());
return $result_array;
}
@ -1035,12 +1035,16 @@ class PD_Model extends SPARQ_Model {
// {
$max_score = $this->db->SELECT('max(score) as max_score')->FROM(SCORECARDANSWERS)->WHERE('fk_score_question_id',$form_detail['score_question_id'])->GET()->result_array();
$form_details[$form_details_key]['max_score'] = $max_score[0]['max_score'];
if($form_detail['category_weightage'] != "" && $form_detail['category_weightage'] != "")
if($form_detail['category_weightage'] != "" && $form_detail['question_weightage'] != "" && $form_detail['score'] != "" && $max_score[0]['max_score'] != "")
{
$form_details[$form_details_key]['actual_score'] = (($form_detail['category_weightage']/100) * ($form_detail['question_weightage']/100) * $max_score[0]['max_score']);
$form_details[$form_details_key]['exact_score'] = (($form_detail['category_weightage']/100) * ($form_detail['question_weightage']/100) * $form_detail['score']);
}
else
{
$form_details[$form_details_key]['actual_score'] = null;
$form_details[$form_details_key]['exact_score'] = null;
}
// }