ADDON IN MAIN

This commit is contained in:
velz 2019-04-10 19:34:20 +05:30
parent 9295bd6d5a
commit b58d57e8b4
9 changed files with 253 additions and 59 deletions

View File

@ -0,0 +1,58 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
This Config file has info about api routes and user access information as config array
*/
$user_auth_info = array(
'1' => array('role_name' => 'Central Manager','allowed_api_routes' => array()),
'2' => array('role_name' => 'Central PD Officer','allowed_api_routes' => array())
'3' => array('role_name' => 'PD Manager','allowed_api_routes' => array())
'4' => array('role_name' => 'PD Executive','allowed_api_routes' => array())
'5' => array('role_name' => 'PD Officer','allowed_api_routes' => array())
'6' => array('role_name' => 'QC Manager','allowed_api_routes' => array())
'7' => array('role_name' => 'QC Officer','allowed_api_routes' => array())
'8' => array('role_name' => 'Billing Manager','allowed_api_routes' => array())
'9' => array('role_name' => 'Billing Staff','allowed_api_routes' => array())
'10' => array('role_name' => 'System Admin','allowed_api_routes' => array())
'11' => array('role_name' => 'National Sales Head','allowed_api_routes' => array())
'12' => array('role_name' => 'National Credit Head','allowed_api_routes' => array())
'13' => array('role_name' => 'Zonal Sales Head','allowed_api_routes' => array())
'14' => array('role_name' => 'Zonal Credit Head','allowed_api_routes' => array())
'15' => array('role_name' => 'Area Sales Head','allowed_api_routes' => array())
'16' => array('role_name' => 'Area Credit Head','allowed_api_routes' => array())
'17' => array('role_name' => 'City Sales Head','allowed_api_routes' => array())
'18' => array('role_name' => 'City Credit Head','allowed_api_routes' => array())
'19' => array('role_name' => 'Branch Sales','allowed_api_routes' => array())
'20' => array('role_name' => 'Branch Credit','allowed_api_routes' => array())
'21' => array('role_name' => 'PD Manager Vendor','allowed_api_routes' => array())
'22' => array('role_name' => 'PD Officer Vendor','allowed_api_routes' => array())
);
$api_user_auth_info = array(
'saveNewUser' => array(10),
'updateExistUser' => array(10),//doubt
'getUsersDetails' => array(),
//PD RELATED
'triggerNewPD' = array(),
'updatePDMaster' = array(),
'(listLessPDDetails/:any)' = array(),
'updatePDDocs' = array(),
'updatePDApplicants' = array(),
'allocatePD' = array(),
'schdulePD' = array(),
'getListPDOfficers' = array(),
'loadFullTemplate' = array(),
'generatePDReport' = array(),
'savePDPhotos' = array(),
'savePDFormDetails' = array(),
//ENTITY
'saveNewEntity' = array(),
);
?>

View File

@ -21,14 +21,14 @@ class PD_Controller extends REST_Controller {
{ {
// Construct the parent class // Construct the parent class
parent::__construct(); parent::__construct();
$this->load->model('PD_Model'); $this->load->model('PD_Model');
$this->load->library('AWS_S3'); $this->load->library('AWS_S3');
$this->load->library('AWS_SNS'); $this->load->library('AWS_SNS');
$this->load->helper('GETPDFORMDETAILS'); $this->load->helper('GETPDFORMDETAILS');
$this->load->helper('GETPROCESSEDJSON'); $this->load->helper('GETPROCESSEDJSON');
$this->load->helper('MYUTIL'); $this->load->helper('MYUTIL');
$this->load->library('pdfgenerator'); $this->load->library('pdfgenerator');
$this->load->library('excel'); //$this->load->library('excel');
$this->load->library('phpmailer_library'); $this->load->library('phpmailer_library');
} }
@ -434,6 +434,7 @@ class PD_Controller extends REST_Controller {
//die(); //die();
$pd_details['parent_pd_id'] = isset($pd_details['parent_pd_id']) ? $pd_details['parent_pd_id'] : NULL;
$pd_id = $this->PD_Model->saveRecords($pd_details,PDTRIGGER); $pd_id = $this->PD_Model->saveRecords($pd_details,PDTRIGGER);
@ -546,13 +547,28 @@ class PD_Controller extends REST_Controller {
if(count($addresses)) if(count($addresses))
{ {
$temp_address_id = 0;
foreach($addresses as $address_key => $address) foreach($addresses as $address_key => $address)
{ {
$address['fk_pd_id'] = $pd_id; $address['fk_pd_id'] = $pd_id;
$address['is_primary'] = count($addresses) == 1 ? 1:0; $address['is_primary'] = count($addresses) == 1 ? 1:0;
$this->PD_Model->saveRecords($address,PDADDRESS); $address_id = $this->PD_Model->saveRecords($address,PDADDRESS);
if($address_key == 0)
{
$temp_address_id = $address_id;
}
} }
$temp = array('parent_pd_id' => $pd_id);
if(count($addresses) == 1)
{
$temp['fk_primary_address_id'] = $temp_address_id;
$temp['fk_address_id'] = $temp_address_id;
}
$where_condition_array = array('pd_id' => $pd_id);
$this->PD_Model->updateRecords($temp,PDTRIGGER,$where_condition_array);
} }
if(count($company)) if(count($company))
@ -697,11 +713,39 @@ class PD_Controller extends REST_Controller {
if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == COMPLETED) if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == COMPLETED)
{ {
//echo "completed";
if(array_key_exists('link',$pd_details)) if(array_key_exists('link',$pd_details))
{ {
$pd_details['complete_location'] = $pd_details['link']; $pd_details['complete_location'] = $pd_details['link'];
unset($pd_details['link']); unset($pd_details['link']);
} }
//If it is Addtional PD ,then update 'COMPLETE' status for primary and all other addtional PD's
if($exist_pd_details[0]['is_child'] == 1)
{
//echo "child";
$all_pd_id = array();
//get all associated PD ID's from address table
$all_associated_addresses = $this->PD_Model->getPDAddress($exist_pd_details[0]['parent_pd_id']);
//print_r($all_associated_addresses);
if(count($all_associated_addresses))
{
foreach($all_associated_addresses as $address)
{
if($address['assigned_pd'] != $pd_details['pd_id'])
{
$all_pd_id[] = array('pd_id' => $address['assigned_pd'],'pd_status' => COMPLETED, 'fk_updatedby' => $pd_details['fk_updatedby']);
}
}
}
//print_r($all_pd_id);
foreach($all_pd_id as $single_pd)
{
$this->PD_Model->updateRecords($single_pd,PDTRIGGER,array('pd_id' => $single_pd['pd_id']));
}
}
} }
@ -735,7 +779,7 @@ class PD_Controller extends REST_Controller {
// { // {
// $pd_details['parent_pd_id'] = isset($pd_details['parent_pd_id']) ? $pd_details['parent_pd_id'] : null; // $pd_details['parent_pd_id'] = isset($pd_details['parent_pd_id']) ? $pd_details['parent_pd_id'] : null;
// } // }
if( $exist_pd_details[0]['is_child'] == 0 && $exist_pd_details[0]['parent_pd_id'] == null) if( $exist_pd_details[0]['is_child'] == 0 && ($exist_pd_details[0]['parent_pd_id'] == null || $exist_pd_details[0]['parent_pd_id'] == 0))
{ {
$pd_details['parent_pd_id'] = $pd_details['pd_id']; $pd_details['parent_pd_id'] = $pd_details['pd_id'];
} }
@ -774,7 +818,7 @@ class PD_Controller extends REST_Controller {
}//end of normal PD }//end of normal PD
else//#################### Handle Addtional PD else//#################### Handle Addtional PD
{ {
//echo 'else';
if(($pd_details['parent_pd_id'] != "" || $pd_details['parent_pd_id'] != null) && if(($pd_details['parent_pd_id'] != "" || $pd_details['parent_pd_id'] != null) &&
(($pd_details['fk_customer_segment'] != "" || $pd_details['fk_customer_segment'] != null)) && (($pd_details['fk_customer_segment'] != "" || $pd_details['fk_customer_segment'] != null)) &&
(($pd_details['fk_address_id'] != "" || $pd_details['fk_address_id'] != null)) && (($pd_details['fk_address_id'] != "" || $pd_details['fk_address_id'] != null)) &&
@ -783,10 +827,11 @@ class PD_Controller extends REST_Controller {
{ {
//GET PArent PD Details //GET PArent PD Details
$parent_pd_details = $this->PD_Model->getPDMasterDetails($pd_details['parent_pd_id']); $parent_pd_details = $this->PD_Model->getPDMasterDetails($pd_details['parent_pd_id']);
//echo date_format(date_create($parent_pd_details[0]['pd_date_of_initiation']),'Y-m-d');die();
if(count($parent_pd_details)) if(count($parent_pd_details))
{ {
$newpd['fk_lender_id'] = $parent_pd_details[0]['fk_lender_id']; $newpd['fk_lender_id'] = $parent_pd_details[0]['fk_lender_id'];
$newpd['pd_date_of_initiation'] = $parent_pd_details[0]['pd_date_of_initiation']; $newpd['pd_date_of_initiation'] = date_format(date_create($parent_pd_details[0]['pd_date_of_initiation']),'Y-m-d');
$newpd['fk_entity_billing_id'] = $parent_pd_details[0]['fk_entity_billing_id']; $newpd['fk_entity_billing_id'] = $parent_pd_details[0]['fk_entity_billing_id'];
$newpd['lender_applicant_id'] = $parent_pd_details[0]['lender_applicant_id']; $newpd['lender_applicant_id'] = $parent_pd_details[0]['lender_applicant_id'];
$newpd['fk_product_id'] = $parent_pd_details[0]['fk_product_id']; $newpd['fk_product_id'] = $parent_pd_details[0]['fk_product_id'];
@ -802,7 +847,7 @@ class PD_Controller extends REST_Controller {
$newpd['parent_pd_id'] = $pd_details['parent_pd_id']; $newpd['parent_pd_id'] = $pd_details['parent_pd_id'];
//$newpd['fk_pd_allocated_to'] = $pd_details['fk_pd_allocated_to'] ? $pd_details['fk_pd_allocated_to'] : null; //$newpd['fk_pd_allocated_to'] = $pd_details['fk_pd_allocated_to'] ? $pd_details['fk_pd_allocated_to'] : null;
//$newpd['scheduled_on'] = $pd_details['scheduled_on'] ? $pd_details['scheduled_on'] : null; //$newpd['scheduled_on'] = $pd_details['scheduled_on'] ? $pd_details['scheduled_on'] : null;
//print_r($newpd);//die();
$newpd['fk_pd_template_id'] = $this->assignPDTempalate(array('lender' => $newpd['fk_lender_id'],'product' => $newpd['fk_product_id'],'customer_segment' => $newpd['fk_customer_segment'])); $newpd['fk_pd_template_id'] = $this->assignPDTempalate(array('lender' => $newpd['fk_lender_id'],'product' => $newpd['fk_product_id'],'customer_segment' => $newpd['fk_customer_segment']));
@ -982,7 +1027,11 @@ class PD_Controller extends REST_Controller {
$count = 0; $count = 0;
foreach($records as $key => $value) foreach($records as $key => $value)
{ {
$value['is_primary'] = count($records) == 1 ? 1:0; if(count($records) == 1)
{
$value['is_primary'] = 1;
}
if($value['pd_address_id'] != "" || $value['pd_address_id'] != null) if($value['pd_address_id'] != "" || $value['pd_address_id'] != null)
{ {
$where_condition_array = array('pd_address_id' => $value['pd_address_id']); $where_condition_array = array('pd_address_id' => $value['pd_address_id']);
@ -3295,21 +3344,22 @@ class PD_Controller extends REST_Controller {
if($purchases_flag != 0) if($purchases_flag != 0)
{ {
if($gross_profit_calculation_type[0]['purchase_type'] == 1) if($gross_profit_calculation_type[0]['mode'] == 1 && $gross_profit_calculation_type[0]['purchase_type'] == 1)//purchase item wise
{ {
foreach($purchase_billwise as $purchase_billwise_key => $bill) foreach($purchases as $purchase_key => $purchase)
{
$overall_purchase_total = $overall_purchase_total + $bill['annual_purchase_value'];
}
}
else
{
foreach($purchases as $purchase_key => $purchase)
{ {
$overall_purchase_total = $overall_purchase_total + $purchase['annual_purchase_value']; $overall_purchase_total = $overall_purchase_total + $purchase['annual_purchase_value'];
} }
} }
else if($gross_profit_calculation_type[0]['mode'] == 1 && $gross_profit_calculation_type[0]['purchase_type'] == 2)////purchase bill wise
{
foreach($purchase_billwise as $purchase_billwise_key => $bill)
{
$overall_purchase_total = $overall_purchase_total + ($bill['annual_purchase_value'] * (12/ count($bill['items'])) );
}
}
} }
@ -3327,7 +3377,7 @@ class PD_Controller extends REST_Controller {
} }
//calculatin part //calculatin part
if($purchases_flag != 0) if($gross_profit_calculation_type[0]['mode'] == 1)
{ {
$temp_purchases = $overall_purchase_total; $temp_purchases = $overall_purchase_total;
$temp_grossprofit = $total_sales_itemwise - $temp_purchases; $temp_grossprofit = $total_sales_itemwise - $temp_purchases;
@ -3345,7 +3395,7 @@ class PD_Controller extends REST_Controller {
} }
$overall_summary_report['sales_calculated_by_itemwise']['sales_revenue'] = round($total_sales_itemwise); $overall_summary_report['sales_calculated_by_itemwise']['sales_revenue'] = round($total_sales_itemwise);
$purchases_flag ? $overall_summary_report['sales_calculated_by_itemwise']['purchases'] = round($temp_purchases,2) : $overall_summary_report['sales_calculated_by_itemwise']['cost_of_goods_sold'] = round($temp_purchases); ($gross_profit_calculation_type[0]['mode'] == 1) ? $overall_summary_report['sales_calculated_by_itemwise']['purchases'] = round($temp_purchases,2) : $overall_summary_report['sales_calculated_by_itemwise']['cost_of_goods_sold'] = round($temp_purchases);
$overall_summary_report['sales_calculated_by_itemwise']['grossprofit'] = round($temp_grossprofit); $overall_summary_report['sales_calculated_by_itemwise']['grossprofit'] = round($temp_grossprofit);
$overall_summary_report['sales_calculated_by_itemwise']['business_expenses'] = round($overall_business_expenses_total); $overall_summary_report['sales_calculated_by_itemwise']['business_expenses'] = round($overall_business_expenses_total);
$overall_summary_report['sales_calculated_by_itemwise']['netprofit'] = round($temp_netprofit); $overall_summary_report['sales_calculated_by_itemwise']['netprofit'] = round($temp_netprofit);
@ -3398,7 +3448,7 @@ class PD_Controller extends REST_Controller {
//calculation part //calculation part
//calculatin part //calculatin part
if($purchases_flag != 0) if($gross_profit_calculation_type[0]['mode'] == 1)
{ {
$temp_purchases = $overall_purchase_total; $temp_purchases = $overall_purchase_total;
$temp_grossprofit = $total_sales_monthwise - $temp_purchases; $temp_grossprofit = $total_sales_monthwise - $temp_purchases;
@ -3414,7 +3464,7 @@ class PD_Controller extends REST_Controller {
} }
$overall_summary_report['sales_calculated_by_monthwise']['sales_revenue'] = round($total_sales_monthwise); $overall_summary_report['sales_calculated_by_monthwise']['sales_revenue'] = round($total_sales_monthwise);
$purchases_flag ? $overall_summary_report['sales_calculated_by_monthwise']['purchases'] = round($temp_purchases) : $overall_summary_report['sales_calculated_by_monthwise']['cost_of_goods_sold'] = round($temp_purchases); ($gross_profit_calculation_type[0]['mode'] == 1) ? $overall_summary_report['sales_calculated_by_monthwise']['purchases'] = round($temp_purchases) : $overall_summary_report['sales_calculated_by_monthwise']['cost_of_goods_sold'] = round($temp_purchases);
$overall_summary_report['sales_calculated_by_monthwise']['grossprofit'] = round($temp_grossprofit); $overall_summary_report['sales_calculated_by_monthwise']['grossprofit'] = round($temp_grossprofit);
$overall_summary_report['sales_calculated_by_monthwise']['business_expenses'] = round($overall_business_expenses_total); $overall_summary_report['sales_calculated_by_monthwise']['business_expenses'] = round($overall_business_expenses_total);
$overall_summary_report['sales_calculated_by_monthwise']['netprofit'] = round($temp_netprofit); $overall_summary_report['sales_calculated_by_monthwise']['netprofit'] = round($temp_netprofit);
@ -3437,7 +3487,7 @@ class PD_Controller extends REST_Controller {
$total_sales_declared_by_customer = $sales_declared_by_customer[0]['sales_declared_by_customer']; $total_sales_declared_by_customer = $sales_declared_by_customer[0]['sales_declared_by_customer'];
$temp_netprofit = $sales_declared_by_customer[0]['margin_value']; $temp_netprofit = $sales_declared_by_customer[0]['margin_value'];
if($purchases_flag != 0) if($gross_profit_calculation_type[0]['mode'] == 1)
{ {
$temp_purchases = $overall_purchase_total; $temp_purchases = $overall_purchase_total;
$temp_grossprofit = $total_sales_declared_by_customer - $temp_purchases; $temp_grossprofit = $total_sales_declared_by_customer - $temp_purchases;
@ -3453,7 +3503,7 @@ class PD_Controller extends REST_Controller {
$overall_summary_report['sales_declared_by_customer']['sales_revenue'] = round($total_sales_declared_by_customer); $overall_summary_report['sales_declared_by_customer']['sales_revenue'] = round($total_sales_declared_by_customer);
$purchases_flag ? $overall_summary_report['sales_declared_by_customer']['purchases'] = round($temp_purchases) : $overall_summary_report['sales_declared_by_customer']['cost_of_goods_sold'] = round($temp_purchases); ($gross_profit_calculation_type[0]['mode'] == 1) ? $overall_summary_report['sales_declared_by_customer']['purchases'] = round($temp_purchases) : $overall_summary_report['sales_declared_by_customer']['cost_of_goods_sold'] = round($temp_purchases);
$overall_summary_report['sales_declared_by_customer']['grossprofit'] = round($temp_grossprofit); $overall_summary_report['sales_declared_by_customer']['grossprofit'] = round($temp_grossprofit);
$overall_summary_report['sales_declared_by_customer']['business_expenses'] = round($overall_business_expenses_total); $overall_summary_report['sales_declared_by_customer']['business_expenses'] = round($overall_business_expenses_total);
$overall_summary_report['sales_declared_by_customer']['netprofit'] = round($temp_netprofit); $overall_summary_report['sales_declared_by_customer']['netprofit'] = round($temp_netprofit);
@ -4334,8 +4384,8 @@ class PD_Controller extends REST_Controller {
public function codeigniterViewTest_post() public function codeigniterViewTest_post()
{ {
echo MYUTIL::customIndianNumberFormat(4589621); // echo MYUTIL::customIndianNumberFormat(4589621);
die(); // die();
$records = $this->post('records'); $records = $this->post('records');
$pdid = $records['pd_id']; $pdid = $records['pd_id'];
$is_regenerate = 0; $is_regenerate = 0;
@ -4349,7 +4399,7 @@ class PD_Controller extends REST_Controller {
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid); $data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
$data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly(); $data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly();
$data['pd_score'] = $this->calculateScore($pdid); $data['pd_score'] = $this->calculateScore($pdid);
//print_r($data['pd_score']['business']); //print_r($data['pd_score']['business']);//die();
$score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0; $score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0;
//echo $score_for_chart; //echo $score_for_chart;
$chart = null; $chart = null;
@ -4831,7 +4881,7 @@ class PD_Controller extends REST_Controller {
if(count($general_data)) if(count($general_data))
{ {
$json = json_decode($general_data[0]['json'],true); $json = json_decode($general_data[0]['json'],true);
//print_r($json); //print_r($json);die();
if(array_key_exists('persons_with_relationships',$json)) if(array_key_exists('persons_with_relationships',$json))
{ {
@ -4839,10 +4889,16 @@ class PD_Controller extends REST_Controller {
{ {
foreach($json['individuals'] as $ind) foreach($json['individuals'] as $ind)
{ {
if($relation['pd_co_applicant_id'] == $ind['pd_co_applicant_id']) // if($relation['pd_co_applicant_id'] == $ind['pd_co_applicant_id'])
// {
// $relation['age'] = $ind['age'];
// }
//else
if($relation['applicant_name'] == $ind['applicant_name'])
{ {
$relation['age'] = $ind['age']; $relation['age'] = $ind['age'];
} }
} }
$temp_array = array_merge($temp_array,array($relation)); $temp_array = array_merge($temp_array,array($relation));
} }
@ -5553,7 +5609,7 @@ class PD_Controller extends REST_Controller {
#####Business Form Questions######## #####Business Form Questions########
$business_form = (json_decode($form_data[13][0]['processed_json'],true)); $business_form = (json_decode($form_data[13][0]['processed_json'],true));
//print_r($business_form);die(); //print_r($business_form);
// 10 - QNO(1.6) - was_the_company_name_board_sighted // 10 - QNO(1.6) - was_the_company_name_board_sighted
$score_questions['general']['was_the_company_name_board_sighted'] = isset($business_form['was_the_company_name_board_sighted']) ? $business_form['was_the_company_name_board_sighted'] : 'No'; $score_questions['general']['was_the_company_name_board_sighted'] = isset($business_form['was_the_company_name_board_sighted']) ? $business_form['was_the_company_name_board_sighted'] : 'No';

Binary file not shown.

View File

@ -103,8 +103,8 @@ public static function getOthersAssetsDetails($values){
public static function getBusinessAssetsDetails($values){ public static function getBusinessAssetsDetails($values){
$mergeResult=array(); $mergeResult=array();
foreach($values as $fetchVal){ foreach($values as $fetchVal){
echo "helper"; // echo "helper";
print_r($fetchVal); // print_r($fetchVal);
$storeValue=array(); $storeValue=array();
$storeValue['business_assets_mode'] = $fetchVal['business_assets_mode']; $storeValue['business_assets_mode'] = $fetchVal['business_assets_mode'];
// this is machinaries // this is machinaries

View File

@ -57,6 +57,10 @@ class AUTHORIZATION
public static function checkAuthorizationUser($routingName){ public static function checkAuthorizationUser($routingName){
$CI =& get_instance(); $CI =& get_instance();
$headersData = getallheaders(); $headersData = getallheaders();
//print_r($headersData);
//print_r($CI->uri->uri_string);
//die();
if (!array_key_exists("Authorization",$headersData) OR $headersData['Authorization']!=$CI->config->item('authorization_key')) if (!array_key_exists("Authorization",$headersData) OR $headersData['Authorization']!=$CI->config->item('authorization_key'))
{ {
set_status_header(REST_CONTROLLER::HTTP_UNAUTHORIZED,"Unauthorized"); set_status_header(REST_CONTROLLER::HTTP_UNAUTHORIZED,"Unauthorized");
@ -84,6 +88,9 @@ class AUTHORIZATION
else{ else{
return true; return true;
} }
} }
} }

View File

@ -330,19 +330,23 @@ class PDSCORE
//find out no of not applicable cases //find out no of not applicable cases
$business_certificates_distribution_count = 0; $business_certificates_distribution_count = 0;
foreach($score_questions['business']['cerificates'] as $value) foreach($score_questions['business']['cerificates'] as $value)
{ {
if(strcasecmp($value,'not applicable')) if(strcasecmp($value,'not applicable'))
{ {
$business_certificates_distribution_count++; $business_certificates_distribution_count++;
//echo $value;
} }
} }
$business_certificates_distribution_count;
$business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count; $business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count;
// echo $cerificates_L2.'---';echo $business_certificates_distribution_count;
// echo $business_certificates_distribution;
// echo $cerificates_L2.'---';echo $business_certificates_distribution_count;
// echo $business_certificates_distribution;die();
$certificate_actual_score = 0; $certificate_actual_score = 0;
$certificate_max_score = 0; $certificate_max_score = 0;
@ -364,14 +368,14 @@ class PDSCORE
} }
$score_questions['business']['cerificates']['l1_weightage'] = $l1_business; $score_questions['business']['cerificates']['l1_weightage'] = $l1_business;
$score_questions['business']['cerificates']['l2_weightage'] = round($business_certificates_distribution,2); $score_questions['business']['cerificates']['l2_weightage'] = round(($business_certificates_distribution * $business_certificates_distribution_count),2);
$score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage; $score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage;
$score_questions['business']['cerificates']['max_score'] = round($certificate_max_score,2); $score_questions['business']['cerificates']['max_score'] = round($certificate_max_score,2);
$score_questions['business']['cerificates']['attributed_score'] = round($certificate_actual_score,2); $score_questions['business']['cerificates']['attributed_score'] = round($certificate_actual_score,2);
$score_questions['business']['cerificates']['score_band'] = 'Derived'; $score_questions['business']['cerificates']['score_band'] = 'Derived';
$score_questions['business']['cerificates']['max_score_band'] = 'Derived'; $score_questions['business']['cerificates']['max_score_band'] = 'Derived';
//echo $business_certificates_distribution;die(); //print_r($score_questions['business']['cerificates']);die();
//######2.1 no_of_years_business_run //######2.1 no_of_years_business_run
$no_of_years_business_run_actual_score = 0; $no_of_years_business_run_actual_score = 0;

View File

@ -11,4 +11,4 @@ class Excel extends PHPExcel {
parent::__construct(); parent::__construct();
} }
} }
// END Smartie Class

View File

@ -264,6 +264,20 @@ class PD_Model extends SPARQ_Model {
*/ */
public function getApplicantsDetails($pdid) public function getApplicantsDetails($pdid)
{ {
$pdmaster_details = $this->getPDMasterDetails($pdid);
$parent_pd_id = $pdmaster_details[0]['parent_pd_id'];
//Get all AddtionalPD's ID
$addtional_pd_ids = $this->getAddtionalPDIDs($parent_pd_id);
$addtional_pd_ids_string = array();
if(count($addtional_pd_ids))
{
foreach($addtional_pd_ids as $addtional){ array_push($addtional_pd_ids_string,$addtional['pd_id']); }
}
//print_r($addtional_pd_ids_string);die();
$this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode,PDAPPLICANTSDETAILS.relation,RELATIONSHIPS.name as relation_name,PDAPPLICANTSDETAILS.landline,PDAPPLICANTSDETAILS.company_name,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name'); $this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode,PDAPPLICANTSDETAILS.relation,RELATIONSHIPS.name as relation_name,PDAPPLICANTSDETAILS.landline,PDAPPLICANTSDETAILS.company_name,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name');
$this->db->FROM(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS'); $this->db->FROM(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS');
$this->db->JOIN(STATE.' as STATE','PDAPPLICANTSDETAILS.fk_state = STATE.state_id','LEFT'); $this->db->JOIN(STATE.' as STATE','PDAPPLICANTSDETAILS.fk_state = STATE.state_id','LEFT');
@ -272,6 +286,10 @@ class PD_Model extends SPARQ_Model {
$this->db->JOIN(TITLES.' as TITLES','PDAPPLICANTSDETAILS.applicant_title_name = TITLES.title_id','LEFT'); $this->db->JOIN(TITLES.' as TITLES','PDAPPLICANTSDETAILS.applicant_title_name = TITLES.title_id','LEFT');
$this->db->WHERE('PDAPPLICANTSDETAILS.fk_pd_id ',$pdid); $this->db->WHERE('PDAPPLICANTSDETAILS.fk_pd_id ',$pdid);
if(count($addtional_pd_ids_string))
{
$this->db->OR_WHERE_IN('PDAPPLICANTSDETAILS.fk_pd_id',$addtional_pd_ids_string);
}
$this->db->ORDER_BY('PDAPPLICANTSDETAILS.pd_co_applicant_id'); $this->db->ORDER_BY('PDAPPLICANTSDETAILS.pd_co_applicant_id');
$result_child_array = $this->db->GET()->result_array(); $result_child_array = $this->db->GET()->result_array();
@ -285,7 +303,13 @@ class PD_Model extends SPARQ_Model {
} }
} }
public function getAddtionalPDIDs($pdid)
{
$data = $this->db->SELECT('pd_id')->FROM(PDTRIGGER)->WHERE('parent_pd_id',$pdid)->GET()->result_array();
//print_r($this->db->last_query());
return $data;
//
}
public function getPDAddress($temp_pdid) public function getPDAddress($temp_pdid)
{ {
@ -828,6 +852,20 @@ class PD_Model extends SPARQ_Model {
// $overall_question_count = 0; // $overall_question_count = 0;
//Get PD Master Details including Template id @param $pd_id //Get PD Master Details including Template id @param $pd_id
$pd_master_detials = $this->getPDMasterDetails($pdid); $pd_master_detials = $this->getPDMasterDetails($pdid);
// $addtional_pd_ids = $this->PD_Model->getAddtioonalPDIDs($pdid);
// $addtional_pd_ids_string = null;
// if($pd_master_detials[0]['parent_pd_id'] == $pdid)
// {
// $addtional_pd_ids_string = array();
// }
// if(count($addtional_pd_ids))
// {
// foreach($addtional_pd_ids as $addtional){ array_push($addtional_pd_ids_string,$addtional['pd_id']); }
// }
$pd_applicants_detials = $this->getApplicantsDetails($pdid); $pd_applicants_detials = $this->getApplicantsDetails($pdid);
//print_r($pd_master_detials);die(); //print_r($pd_master_detials);die();
if(count($pd_master_detials)){ if(count($pd_master_detials)){
@ -956,7 +994,8 @@ class PD_Model extends SPARQ_Model {
$this->db->WHERE('PDFORMDETAILSJSON.isactive',1); $this->db->WHERE('PDFORMDETAILSJSON.isactive',1);
$template_forms_count = 0; $template_forms_count = 0;
$template_forms_count = $this->db->GET()->result_array(); $template_forms_count = $this->db->GET()->result_array();
//print_r($template_forms_count);die(); //if($value['form_id'] == 4){print_r($template_forms_count);}
if(count($template_forms_count) && $template_forms_count[0]['count'] != 0) if(count($template_forms_count) && $template_forms_count[0]['count'] != 0)
{ {
$template_forms[$template_key]['isAnswered'] = true; $template_forms[$template_key]['isAnswered'] = true;
@ -1001,10 +1040,12 @@ class PD_Model extends SPARQ_Model {
} }
else // FOr addtional PD else // FOr addtional PD
{ {
//echo "child";
$parent_forms = $this->config->item('parent_forms'); $parent_forms = $this->config->item('parent_forms');
foreach($template_forms as $template_key => $value) foreach($template_forms as $template_key => $value)
{ {
$is_answered = 0;
$this->db->SELECT('count(*) as count'); $this->db->SELECT('count(*) as count');
$this->db->FROM(PDFORMDETAILSJSON.' as PDFORMDETAILSJSON'); $this->db->FROM(PDFORMDETAILSJSON.' as PDFORMDETAILSJSON');
$this->db->WHERE('PDFORMDETAILSJSON.fk_pd_id',$pdid); $this->db->WHERE('PDFORMDETAILSJSON.fk_pd_id',$pdid);
@ -1012,9 +1053,11 @@ class PD_Model extends SPARQ_Model {
$this->db->WHERE('PDFORMDETAILSJSON.isactive',1); $this->db->WHERE('PDFORMDETAILSJSON.isactive',1);
$template_forms_count = 0; $template_forms_count = 0;
$template_forms_count = $this->db->GET()->result_array(); $template_forms_count = $this->db->GET()->result_array();
//print_r($template_forms_count);die(); //if($value['form_id'] == 19){ print_r($template_forms_count); }//die();
if(count($template_forms_count) && $template_forms_count[0]['count'] != 0) if(count($template_forms_count) && $template_forms_count[0]['count'] != 0)
{ {
//echo $value['form_id'];
$is_answered = 1;
$template_forms[$template_key]['isAnswered'] = true; $template_forms[$template_key]['isAnswered'] = true;
if($value['pd_form_level_order'] == 1){ if($value['pd_form_level_order'] == 1){
$level_one_status++; $level_one_status++;
@ -1023,11 +1066,9 @@ class PD_Model extends SPARQ_Model {
} }
else else
{ {
$template_forms[$template_key]['isAnswered'] = false; $template_forms[$template_key]['isAnswered'] = false;
if( array_search($value['form_id'],$parent_forms) )
{
$template_forms[$template_key]['isAnswered'] = true;
}
if($value['pd_form_level_order'] == 1){ $level_one_total++;} if($value['pd_form_level_order'] == 1){ $level_one_total++;}
else if($value['pd_form_level_order'] == 2){$level_two_total++;} else if($value['pd_form_level_order'] == 2){$level_two_total++;}
} }
@ -1049,15 +1090,40 @@ class PD_Model extends SPARQ_Model {
} }
else if($value['pd_form_level_order'] == 3) else if($value['pd_form_level_order'] == 3)
{ {
if($level_two_status != $level_two_total) if($level_two_status != $level_two_total)
{ {
$template_forms[$template_key]['isAnswerable'] = false; $template_forms[$template_key]['isAnswerable'] = false;
} }
else else
{ {
$template_forms[$template_key]['isAnswerable'] = true; $template_forms[$template_key]['isAnswerable'] = true;
} }
} }
if( array_search($value['form_id'],$parent_forms) )
{
$template_forms[$template_key]['isAnswered'] = true;
$template_forms[$template_key]['isAnswerable'] = true;
}
else
{
if($is_answered == 0)
{
//echo $value['form_id'];
$template_forms[$template_key]['isAnswered'] = false;
$template_forms[$template_key]['isAnswerable'] = true;
}
else
{
//$template_forms[$template_key]['isAnswered'] = false;
$template_forms[$template_key]['isAnswerable'] = true;
}
}
} }
} }
@ -1367,9 +1433,10 @@ class PD_Model extends SPARQ_Model {
$where_condition_array = array('fk_pd_id'=>$pdid,'isactive'=>1); $where_condition_array = array('fk_pd_id'=>$pdid,'isactive'=>1);
$where_condition_array['company_id'] = $company_id ? $company_id : null; $where_condition_array['company_id'] = $company_id ? $company_id : null;
$sales_declared_by_customer = $this->selectCustomRecords($fields,$where_condition_array,SALESDECLAREDBYCUSTOMER); $sales_declared_by_customer = $this->selectCustomRecords($fields,$where_condition_array,SALESDECLAREDBYCUSTOMER);
//get Gross Profit calculatio Mode details //get Gross Profit calculatio Mode details
$fields = array('calc_type_id','mode','margin','purchase_type'); $fields = array('calc_type_id','mode','margin','purchase_type');
$where_condition_array = array('fk_pd_id'=>$pdid); $where_condition_array = array('fk_pd_id'=>$pdid,'company_id'=>$company_id);
$gross_profit_calculation_type = $this->selectCustomRecords($fields,$where_condition_array,PDASSESSEDINCOMEESTIMATIONOFGROSSPROFITTYPE); $gross_profit_calculation_type = $this->selectCustomRecords($fields,$where_condition_array,PDASSESSEDINCOMEESTIMATIONOFGROSSPROFITTYPE);
//print_r($gross_profit_calculation_type);die(); //print_r($gross_profit_calculation_type);die();
@ -1462,7 +1529,8 @@ class PD_Model extends SPARQ_Model {
array('table'=>FREQUENCY.' as FREQUENCY','condition'=>'PDPURCHASEDETAILS.fk_frequency_id = FREQUENCY.frequency_id','jointype'=>'LEFT'), array('table'=>FREQUENCY.' as FREQUENCY','condition'=>'PDPURCHASEDETAILS.fk_frequency_id = FREQUENCY.frequency_id','jointype'=>'LEFT'),
array('table'=>UOM.' as UOM','condition'=>'PDPURCHASEDETAILS.fk_uom_id = UOM.uom_id','jointype'=>'LEFT')); array('table'=>UOM.' as UOM','condition'=>'PDPURCHASEDETAILS.fk_uom_id = UOM.uom_id','jointype'=>'LEFT'));
$purchase_details = $this->getJoinRecords($fields,$table,$joins,$where_condition_array); $purchase_details = $this->getJoinRecords($fields,$table,$joins,$where_condition_array);
// print_r(); // print_r($this->db->last_query());
// print_r($purchase_details);die();
//get purchase bill details //get purchase bill details

View File

@ -218,10 +218,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '<br>'.$company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name'] . '<br>'; echo '<br>'.$company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name'] . '<br>';
} }
} }
//print_r($general_form['persons_with_relationships']);die();
foreach($general_form['persons_with_relationships'] as $persons_with_relationship) foreach($general_form['persons_with_relationships'] as $persons_with_relationship)
{ {
if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null) if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && isset($persons_with_relationship['relationship']))
{ {
//echo '<br>'. isset($persons_with_relationship['relationship_master']) ? $persons_with_relationship['relationship_master'] : " Could Not Find" .' Of '.$persons_with_relationship['relation_to_master'] . '<br>'; //echo '<br>'. isset($persons_with_relationship['relationship_master']) ? $persons_with_relationship['relationship_master'] : " Could Not Find" .' Of '.$persons_with_relationship['relation_to_master'] . '<br>';
//print_r($persons_with_relationship); //print_r($persons_with_relationship);
@ -268,7 +268,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
foreach($general_form['persons_with_relationships'] as $persons_with_relationship) foreach($general_form['persons_with_relationships'] as $persons_with_relationship)
{ {
//print_r($persons_with_relationship); //print_r($persons_with_relationship);
if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null) if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && isset($persons_with_relationship['relationship']))
{ {
echo "<br><br>"; echo "<br><br>";
$RSNA = isset($persons_with_relationship['relation_to_master']) ? $persons_with_relationship['relation_to_master'] : " Could Not Find"; $RSNA = isset($persons_with_relationship['relation_to_master']) ? $persons_with_relationship['relation_to_master'] : " Could Not Find";
@ -1244,7 +1244,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
?> ?>
<h3>Asset Details</h3> <h3>Asset Details</h3>
<?php <?php
print_r($businessAssetResult);die(); //print_r($businessAssetResult);die();
if(count($businessAssetResult)>0){ ?> if(count($businessAssetResult)>0){ ?>
<?php foreach($businessAssetResult as $iterateAsset){ ?> <?php foreach($businessAssetResult as $iterateAsset){ ?>
<p><?php echo $iterateAsset['company_name']; ?></p> <p><?php echo $iterateAsset['company_name']; ?></p>
@ -1797,6 +1797,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo "<table class='scorecard_table'>"; echo "<table class='scorecard_table'>";
echo "<tr> <th>Business Certificates</th> <th>Answer</th> <th>Score</th> <th>Attributed Score</th> <th>Max Score</th></tr>"; echo "<tr> <th>Business Certificates</th> <th>Answer</th> <th>Score</th> <th>Attributed Score</th> <th>Max Score</th></tr>";
$index = 0; $index = 0;
print_r($certificates);
foreach($certificates as $key => $cerificate) foreach($certificates as $key => $cerificate)
{ {
$index++; $index++;