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,6 +10488,10 @@ 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');
$pd_master_details = $this->PD_Model->getPDMasterDetails($fk_pd_id);
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))
{
$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 = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $fk_pd_id, 'fk_form_id' => 25,'isactive' => 1),PDFORMDETAILSJSON);
if(count($vendor_pd_form)) if(count($vendor_pd_form))
{ {
@ -10535,6 +10539,21 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$data['msg'] = 'Vendor Form Not Found!'; $data['msg'] = 'Vendor Form Not Found!';
$this->response($data,REST_Controller::HTTP_OK); $this->response($data,REST_Controller::HTTP_OK);
} }
}
else
{
if(($pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] != QC_COMPLETED))
{
$data['msg'] = 'Vendor yet to QC Complete the PD';
}
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,11 +1108,23 @@ 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))
{
$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) foreach ($f_arr as $key => $value)
{ {
$this->saveRecords(array('fk_pd_id' => $pdid,'fk_form_id' => $value),VENDORFORMSTATUS); $this->saveRecords(array('fk_pd_id' => $pdid,'fk_form_id' => $value),VENDORFORMSTATUS);
} }
}
return $this->getVendorFormsWithStatus($pdid); return $this->getVendorFormsWithStatus($pdid);
} }