PDGENIE COMPLETE CHECK FOR VENDOR FORM

This commit is contained in:
Velz2020 2020-10-01 18:16:14 +05:30
parent 965cc4d897
commit facf6c65db
3 changed files with 101 additions and 46 deletions

View File

@ -2186,7 +2186,7 @@ public function assignPDTempalate($data)
if($result_data['pd_master_details'][0]['fk_pd_type'] == 2) //smart pd get vendor forms status if($result_data['pd_master_details'][0]['fk_pd_type'] == 2) //smart pd get vendor forms status
{ {
$result_data['vendor_form_status'] = $this->PD_Model->getVendorFormStatus($pdid); $result_data['vendor_form_status'] = $this->PD_Model->getVendorFormStatus($pdid,$result_data['pd_master_details']);
} }
//Get All PD Logs //Get All PD Logs
@ -10488,52 +10488,71 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$fk_pd_id = $this->post('fk_pd_id'); $fk_pd_id = $this->post('fk_pd_id');
$fk_form_id = $this->post('fk_form_id'); $fk_form_id = $this->post('fk_form_id');
$vendor_pd_form = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $fk_pd_id, 'fk_form_id' => 25,'isactive' => 1),PDFORMDETAILSJSON); $pd_master_details = $this->PD_Model->getPDMasterDetails($fk_pd_id);
if(count($vendor_pd_form))
if(($pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] == QC_COMPLETED) || (!$pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] == COMPLETED))
{ {
$business_forms = array(1,2,13,14,11,16,21,22,23); $vendor_pd_form = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $fk_pd_id, 'fk_form_id' => 25,'isactive' => 1),PDFORMDETAILSJSON);
$vendor_pd_form = json_decode($vendor_pd_form[0]['json'],true); if(count($vendor_pd_form))
$is_business_form = in_array($fk_form_id,$business_forms); {
//print_r($vendor_pd_form['questions']);die(); $business_forms = array(1,2,13,14,11,16,21,22,23);
foreach ($vendor_pd_form['questions'] as $key => $value) $vendor_pd_form = json_decode($vendor_pd_form[0]['json'],true);
{ $is_business_form = in_array($fk_form_id,$business_forms);
if($is_business_form && is_string($value['form_id']) && !strcasecmp($value['form_id'],'BUSINESS_GROUP')) //print_r($vendor_pd_form['questions']);die();
{ foreach ($vendor_pd_form['questions'] as $key => $value)
//echo 'busienss';break; {
//print_r($value);die(); if($is_business_form && is_string($value['form_id']) && !strcasecmp($value['form_id'],'BUSINESS_GROUP'))
foreach ($value['business_group'] as $bkey => $bvalue)
{ {
//echo 'busienss';break;
if($bvalue['form_id'] == $fk_form_id) //print_r($value);die();
foreach ($value['business_group'] as $bkey => $bvalue)
{ {
//echo 'nor';break;
$data['dataStatus'] = true; if($bvalue['form_id'] == $fk_form_id)
$data['status'] = REST_Controller::HTTP_OK; {
$data['records'] = $bvalue; //echo 'nor';break;
$this->response($data,REST_Controller::HTTP_OK); $data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $bvalue;
$this->response($data,REST_Controller::HTTP_OK);
}
} }
} }
else if($value['form_id'] == $fk_form_id)
{
//echo 'nor';break;
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $value;
$this->response($data,REST_Controller::HTTP_OK);
}
}
} }
else if($value['form_id'] == $fk_form_id) else
{ {
//echo 'nor';break; $data['dataStatus'] = false;
$data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['status'] = REST_Controller::HTTP_OK; $data['msg'] = 'Vendor Form Not Found!';
$data['records'] = $value; $this->response($data,REST_Controller::HTTP_OK);
$this->response($data,REST_Controller::HTTP_OK); }
}
}
} }
else else
{ {
$data['dataStatus'] = false; if(($pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] != QC_COMPLETED))
$data['status'] = REST_Controller::HTTP_NOT_FOUND; {
$data['msg'] = 'Vendor Form Not Found!'; $data['msg'] = 'Vendor yet to QC Complete the PD';
$this->response($data,REST_Controller::HTTP_OK); }
else if((!$pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] != COMPLETED))
{
$data['msg'] = 'Vendor yet to Complete the PD';
}
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$this->response($data,REST_Controller::HTTP_OK);
} }
} }

View File

@ -80,15 +80,39 @@ class pdcompletenesscheck
if($pd_master_details[0]['fk_pd_type'] == 2) if($pd_master_details[0]['fk_pd_type'] == 2)
{ {
$vendor_done_status = 1;
if(($pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] != QC_COMPLETED)) if(($pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] != QC_COMPLETED))
{ {
$incomplete_details[] = 'Vendor yet to be qc complete the PD'; $incomplete_details[] = 'Vendor yet to QC Complete the PD';
$vendor_done_status = 0;
} }
else if((!$pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] != COMPLETED)) else if((!$pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] != COMPLETED))
{ {
$incomplete_details[] = 'Vendor yet to be complete the PD'; $incomplete_details[] = 'Vendor yet to Complete the PD';
$vendor_done_status = 0;
} }
//check that all pd genie forms get fetched with vendor answers
// if($vendor_done_status == 0)
// {
// $smart_pd_forms = array('18' => 'General Information','5' => 'Address Details','13' => 'Business Information' ,'19' => 'Neighbourhood / Reference','20' => 'Final Remarks Form','24' => 'Credit Manager Queries','22' => 'Business Assets','12' => 'Employment Information','11' => 'Stock Details');
// $unfetched_forms = '';
// $vendor_form_status = $CI->PD_Model->getVendorFormStatus($pdid);
// //print_r($vendor_form_status);die();
// foreach ($vendor_form_status as $key => $value)
// {
// if(!$value['form_status']){ $unfetched_forms .= $smart_pd_forms [ $value['fk_form_id'] ].', ' ; }
// }
// if($unfetched_forms)
// {
// $unfetched_forms = substr_replace($unfetched_forms,'', -2) ;
// $incomplete_details[] = 'The following vendor section answers not fetched with PG Genie Form - '.$unfetched_forms;
// };
// //echo $unfetched_forms;
// }
//die();
} }
//kyc //kyc
if(array_key_exists('is_kyc', $general_form) && $general_form['is_kyc'] == "") if(array_key_exists('is_kyc', $general_form) && $general_form['is_kyc'] == "")

View File

@ -1096,7 +1096,7 @@ class PD_Model extends SPARQ_Model {
return $this->db->GET()->result_array(); return $this->db->GET()->result_array();
} }
public function getVendorFormStatus($pdid) public function getVendorFormStatus($pdid,$pd_master_details = array())
{ {
$res = $this->getVendorFormsWithStatus($pdid); $res = $this->getVendorFormsWithStatus($pdid);
@ -1108,10 +1108,22 @@ class PD_Model extends SPARQ_Model {
else//18,5,13,11,19,20 else//18,5,13,11,19,20
{ {
//echo 'insert'; //echo 'insert';
$f_arr = array(18,5,13,19,20,24,22,12,11); if(count($pd_master_details))
foreach ($f_arr as $key => $value)
{ {
$this->saveRecords(array('fk_pd_id' => $pdid,'fk_form_id' => $value),VENDORFORMSTATUS); $f_arr = array();
if($pd_master_details[0]['customer_segment_abbr'] == 'SE-DI' || $pd_master_details[0]['customer_segment_abbr'] == 'SE-AI')
{
$f_arr = array(18,5,13,19,20,24,22,11);
}
else if($pd_master_details[0]['customer_segment_abbr'] == 'SAL')
{
$f_arr = array(18,5,20,24,12);
}
foreach ($f_arr as $key => $value)
{
$this->saveRecords(array('fk_pd_id' => $pdid,'fk_form_id' => $value),VENDORFORMSTATUS);
}
} }
return $this->getVendorFormsWithStatus($pdid); return $this->getVendorFormsWithStatus($pdid);