PDGENIE COMPLETE CHECK FOR VENDOR FORM
This commit is contained in:
parent
965cc4d897
commit
facf6c65db
@ -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
|
||||
{
|
||||
$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
|
||||
@ -10488,52 +10488,71 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
$fk_pd_id = $this->post('fk_pd_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);
|
||||
if(count($vendor_pd_form))
|
||||
$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))
|
||||
{
|
||||
$business_forms = array(1,2,13,14,11,16,21,22,23);
|
||||
$vendor_pd_form = json_decode($vendor_pd_form[0]['json'],true);
|
||||
$is_business_form = in_array($fk_form_id,$business_forms);
|
||||
//print_r($vendor_pd_form['questions']);die();
|
||||
foreach ($vendor_pd_form['questions'] as $key => $value)
|
||||
{
|
||||
if($is_business_form && is_string($value['form_id']) && !strcasecmp($value['form_id'],'BUSINESS_GROUP'))
|
||||
{
|
||||
//echo 'busienss';break;
|
||||
//print_r($value);die();
|
||||
foreach ($value['business_group'] as $bkey => $bvalue)
|
||||
$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))
|
||||
{
|
||||
$business_forms = array(1,2,13,14,11,16,21,22,23);
|
||||
$vendor_pd_form = json_decode($vendor_pd_form[0]['json'],true);
|
||||
$is_business_form = in_array($fk_form_id,$business_forms);
|
||||
//print_r($vendor_pd_form['questions']);die();
|
||||
foreach ($vendor_pd_form['questions'] as $key => $value)
|
||||
{
|
||||
if($is_business_form && is_string($value['form_id']) && !strcasecmp($value['form_id'],'BUSINESS_GROUP'))
|
||||
{
|
||||
|
||||
if($bvalue['form_id'] == $fk_form_id)
|
||||
//echo 'busienss';break;
|
||||
//print_r($value);die();
|
||||
foreach ($value['business_group'] as $bkey => $bvalue)
|
||||
{
|
||||
//echo 'nor';break;
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($bvalue['form_id'] == $fk_form_id)
|
||||
{
|
||||
//echo 'nor';break;
|
||||
$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
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'Vendor Form Not Found!';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'Vendor Form Not Found!';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -80,14 +80,38 @@ class pdcompletenesscheck
|
||||
|
||||
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))
|
||||
{
|
||||
$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))
|
||||
{
|
||||
$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
|
||||
|
||||
@ -1096,7 +1096,7 @@ class PD_Model extends SPARQ_Model {
|
||||
return $this->db->GET()->result_array();
|
||||
}
|
||||
|
||||
public function getVendorFormStatus($pdid)
|
||||
public function getVendorFormStatus($pdid,$pd_master_details = array())
|
||||
{
|
||||
|
||||
$res = $this->getVendorFormsWithStatus($pdid);
|
||||
@ -1108,10 +1108,22 @@ class PD_Model extends SPARQ_Model {
|
||||
else//18,5,13,11,19,20
|
||||
{
|
||||
//echo 'insert';
|
||||
$f_arr = array(18,5,13,19,20,24,22,12,11);
|
||||
foreach ($f_arr as $key => $value)
|
||||
if(count($pd_master_details))
|
||||
{
|
||||
$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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user