SMC TEMPLATE WITH PRODUCTS

This commit is contained in:
Velz2020 2020-11-09 20:21:53 +05:30
parent 3fddc6ca85
commit 03e328ae82
3 changed files with 16 additions and 8 deletions

View File

@ -842,10 +842,11 @@ class SMC_Credit_PD_Controller extends REST_Controller {
if($pd_id != "" || $pd_id != null)
{
$return_data['template_details'] = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($pd_id,$client,$random_string,$api);
$return_data['pdmaster_details'] = $this->PD_Model->getPDMasterDetails($pd_id,$random_string);
$product_id = $return_data['pdmaster_details'][0]['fk_product_id'];
$return_data['template_details'] = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($pd_id,$product_id,$client,$random_string,$api);
$return_data['pdapplicants_detials'] = $this->PD_Model->getApplicantsDetails($pd_id);
//print_r($return_data['template_details']);die();
if(count($return_data['template_details']))
{
$data['dataStatus'] = true;

View File

@ -95,6 +95,10 @@ class PD_Model extends SPARQ_Model {
}
else
{
$this->db->WHERE('PDTRIGGER.fk_lender_id != ',35);
}
if($pdagencyid != "" || $pdagencyid != null)
{

View File

@ -53,18 +53,21 @@ class SMC_Credit_PD_Model extends SPARQ_Model {
}
function getSMCTemplateForPD($pd_id,$client,$random_string,$api)
function getSMCTemplateForPD($pd_id,$product_id,$client,$random_string,$api)
{
//echo $product_id;die();
// $master_forms = $this->SMC_Credit_PD_Model->selectCustomRecords(array('*'),array('isactive' => 1),SMC_CREDIT_PD_FORMS);
// print_r($master_forms);
$table = SMC_CREDIT_PD_FORMS.' as SMC_CREDIT_PD_FORMS';
$fields = array('SMC_CREDIT_PD_FORMS.form_name','SMC_CREDIT_PD_FORMS.form_id as fk_form_id','SMC_CREDIT_PD_SECTION_DATA.fk_pd_id','if(SMC_CREDIT_PD_SECTION_DATA.json is not null,true,false) as is_answered');
$table = CREDITPDTEMPLATE.' as CREDITPDTEMPLATE';
// $table = SMC_CREDIT_PD_FORMS.' as SMC_CREDIT_PD_FORMS';
$fields = array('SMC_CREDIT_PD_FORMS.form_name','CREDITPDTEMPLATE.pd_form_id as fk_form_id','CREDITPDTEMPLATE.fk_product_id','SMC_CREDIT_PD_SECTION_DATA.fk_pd_id','if(SMC_CREDIT_PD_SECTION_DATA.json is not null,true,false) as is_answered');
$joins = array(
array('table'=>SMC_CREDIT_PD_SECTION_DATA." as SMC_CREDIT_PD_SECTION_DATA",'condition'=>"SMC_CREDIT_PD_SECTION_DATA.fk_form_id = SMC_CREDIT_PD_FORMS.form_id AND SMC_CREDIT_PD_SECTION_DATA.fk_pd_id = $pd_id and SMC_CREDIT_PD_SECTION_DATA.isactive = 1 " ,'jointype'=>'LEFT')
array('table'=>SMC_CREDIT_PD_SECTION_DATA." as SMC_CREDIT_PD_SECTION_DATA",'condition'=>"SMC_CREDIT_PD_SECTION_DATA.fk_form_id = CREDITPDTEMPLATE.pd_form_id AND CREDITPDTEMPLATE.fk_product_id = $product_id AND SMC_CREDIT_PD_SECTION_DATA.fk_pd_id = $pd_id and SMC_CREDIT_PD_SECTION_DATA.isactive = 1 " ,'jointype'=>'LEFT'),
array('table'=>SMC_CREDIT_PD_FORMS." as SMC_CREDIT_PD_FORMS",'condition'=>"CREDITPDTEMPLATE.pd_form_id = SMC_CREDIT_PD_FORMS.form_id" ,'jointype'=>'INNER JOIN')
);
$where_condition_array = array('SMC_CREDIT_PD_FORMS.isactive' => 1);
$where_condition_array = array('CREDITPDTEMPLATE.isactive' => 1,'CREDITPDTEMPLATE.fk_product_id' => $product_id);
return
$master_forms = $this->getJoinRecords($fields,$table,$joins,$where_condition_array,'SMC_CREDIT_PD_FORMS.form_id','ASC');
$master_forms = $this->getJoinRecords($fields,$table,$joins,$where_condition_array,'CREDITPDTEMPLATE.pd_form_id','ASC');
print_r($this->db->last_query());die();