AI AUTO API DONE
This commit is contained in:
parent
4b61d38a7d
commit
acc6e0beb8
@ -2327,6 +2327,17 @@ class PD_Controller extends REST_Controller {
|
|||||||
$this->updateSubProductFromLoanDetailsForm($records);
|
$this->updateSubProductFromLoanDetailsForm($records);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//From Business form save Employee Salary as Business Expenses
|
||||||
|
if($formid == 13)
|
||||||
|
{
|
||||||
|
$this->saveEmpSalaryAsBusinessExpensesFromBusinessForm($records);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($formid == 22)
|
||||||
|
{
|
||||||
|
$this->saveAssetRentAsBusinessExpensesFromBusinessAssestForm($records);
|
||||||
|
}
|
||||||
|
die();
|
||||||
|
|
||||||
$fields = array('isactive' => 0);
|
$fields = array('isactive' => 0);
|
||||||
$where_condition_array = array('fk_form_id'=>$formid,'fk_pd_id'=>$pdid);
|
$where_condition_array = array('fk_form_id'=>$formid,'fk_pd_id'=>$pdid);
|
||||||
@ -5741,5 +5752,108 @@ class PD_Controller extends REST_Controller {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveEmpSalaryAsBusinessExpensesFromBusinessForm($records)
|
||||||
|
{
|
||||||
|
//echo "FROM saveEmpSalaryAsBusinessExpensesFromBusinessForm";
|
||||||
|
if(isset($records['employees_appx_salary']) && ($records['employees_appx_salary'] != null|| $records['employees_appx_salary'] != ''))
|
||||||
|
{
|
||||||
|
//pd_expense_id, fk_pd_id, expense_item_id, expense_value, fk_frequency_id, annual_expenses_value, isactive, fk_createdby, createdon, company_id, comments
|
||||||
|
|
||||||
|
$annual_emp_salary = ($records['employees_appx_salary'] * 12);
|
||||||
|
echo $annual_emp_salary;
|
||||||
|
|
||||||
|
$temp_array = array( 'fk_pd_id' => $records['pdid'],'expense_item_id' => 3,'expense_value' => $records['employees_appx_salary'],'fk_frequency_id' => 7, 'annual_expenses_value' => $annual_emp_salary,'fk_createdby' => $records['fk_createdby'],'company_id' => $records['company_id'],'comments' => 'Derived from Business Form');
|
||||||
|
|
||||||
|
|
||||||
|
$fields = array('pd_expense_id','expense_item_id','fk_frequency_id','expense_value','annual_expenses_value','comments');
|
||||||
|
|
||||||
|
$table = PDBUSINESSEXPENSES.' as PDBUSINESSEXPENSES';
|
||||||
|
|
||||||
|
$where_condition_array = array('fk_pd_id'=>$records['pdid'],'isactive'=>1,'expense_item_id' => 3,'fk_frequency_id' => 7,'company_id' => $records['company_id'],'comments' => 'Derived from Business Form');
|
||||||
|
|
||||||
|
$business_expenses = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,$table);
|
||||||
|
|
||||||
|
//print_r($business_expenses);
|
||||||
|
|
||||||
|
if(count($business_expenses))
|
||||||
|
{
|
||||||
|
//echo "Update";
|
||||||
|
$where_condition_array = array('pd_expense_id' => $business_expenses[0]['pd_expense_id']);
|
||||||
|
$this->PD_Model->updateRecords($temp_array,$table,$where_condition_array);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//echo "insert";
|
||||||
|
$this->PD_Model->saveRecords($temp_array,PDBUSINESSEXPENSES);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function saveAssetRentAsBusinessExpensesFromBusinessAssestForm($records)
|
||||||
|
{
|
||||||
|
//echo "saveAssetRentAsBusinessExpensesFromBusinessAssestForm";
|
||||||
|
|
||||||
|
$over_all_rent_amt = 0;
|
||||||
|
if(isset($records['business_assets_for_address']) && ($records['business_assets_for_address'] != "" || $records['business_assets_for_address'] != null))
|
||||||
|
{
|
||||||
|
foreach($records['business_assets_for_address'] as $business_asset)
|
||||||
|
{
|
||||||
|
if($business_asset['business_monthly_rented_amt'] != "" || $business_asset['business_monthly_rented_amt'] != null)
|
||||||
|
{
|
||||||
|
$over_all_rent_amt+=$business_asset['business_monthly_rented_amt'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($records['business_assets_details']) && ($records['business_assets_details'] != "" || $records['business_assets_details'] != null))
|
||||||
|
{
|
||||||
|
foreach($records['business_assets_details'] as $business_asset)
|
||||||
|
{
|
||||||
|
if($business_asset['business_monthly_rented_amt'] != "" || $business_asset['business_monthly_rented_amt'] != null)
|
||||||
|
{
|
||||||
|
$over_all_rent_amt+=$business_asset['business_monthly_rented_amt'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//echo $over_all_rent_amt;
|
||||||
|
|
||||||
|
|
||||||
|
$temp_array = array( 'fk_pd_id' => $records['pdid'],'expense_item_id' => 9,'expense_value' => $over_all_rent_amt,'fk_frequency_id' => 7, 'annual_expenses_value' => ($over_all_rent_amt * 12),'fk_createdby' => $records['fk_createdby'],'company_id' => $records['company_id'],'comments' => 'Derived from Business Form');
|
||||||
|
|
||||||
|
|
||||||
|
$fields = array('pd_expense_id','expense_item_id','fk_frequency_id','expense_value','annual_expenses_value','comments');
|
||||||
|
|
||||||
|
$table = PDBUSINESSEXPENSES.' as PDBUSINESSEXPENSES';
|
||||||
|
|
||||||
|
$where_condition_array = array('fk_pd_id'=>$records['pdid'],'isactive'=>1,'expense_item_id' => 9,'fk_frequency_id' => 7,'company_id' => $records['company_id'],'comments' => 'Derived from Business Form');
|
||||||
|
|
||||||
|
$business_expenses = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,$table);
|
||||||
|
|
||||||
|
//print_r($business_expenses);
|
||||||
|
|
||||||
|
if(count($business_expenses))
|
||||||
|
{
|
||||||
|
//echo "Update";
|
||||||
|
$where_condition_array = array('pd_expense_id' => $business_expenses[0]['pd_expense_id']);
|
||||||
|
$this->PD_Model->updateRecords($temp_array,$table,$where_condition_array);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//echo "insert";
|
||||||
|
$this->PD_Model->saveRecords($temp_array,PDBUSINESSEXPENSES);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
@ -394,7 +394,7 @@ class PDSCORE
|
|||||||
|
|
||||||
$no_of_years_business_run_max_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * max($no_of_years_business_run);
|
$no_of_years_business_run_max_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * max($no_of_years_business_run);
|
||||||
|
|
||||||
$score_questions['business']['no_of_years_business_run'] = array('l1_weightage' => $l1_business,'l2_weightage' => round($no_of_years_business_run_L2),'answer' => $score_questions['business']['no_of_years_business_run'],'attributed_score' => round($no_of_years_business_run_actual_score,2), 'max_score' => round($no_of_years_business_run_max_score,2),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($no_of_years_business_run));
|
$score_questions['business']['no_of_years_business_run'] = array('l1_weightage' => $l1_business,'l2_weightage' => round($no_of_years_business_run_L2,2),'answer' => $score_questions['business']['no_of_years_business_run'],'attributed_score' => round($no_of_years_business_run_actual_score,2), 'max_score' => round($no_of_years_business_run_max_score,2),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($no_of_years_business_run));
|
||||||
|
|
||||||
|
|
||||||
//######2.2 business seasonal
|
//######2.2 business seasonal
|
||||||
@ -527,7 +527,7 @@ class PDSCORE
|
|||||||
$score_questions['score_summary']['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => round(($overall_actual_score/$overall_max_score) * 100));
|
$score_questions['score_summary']['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => round(($overall_actual_score/$overall_max_score) * 100));
|
||||||
|
|
||||||
$score_questions['score_summary']['asset_calculation_details'] = $asset_calculation_details;
|
$score_questions['score_summary']['asset_calculation_details'] = $asset_calculation_details;
|
||||||
//print_r($score_questions);die();
|
print_r($score_questions);die();
|
||||||
return ($score_questions);
|
return ($score_questions);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1300,9 +1300,10 @@ class PD_Model extends SPARQ_Model {
|
|||||||
foreach($sales_items_by_month as $month_key => $month)
|
foreach($sales_items_by_month as $month_key => $month)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->db->SELECT('simc_id,sales_date,sales_value,fk_frequency_id,frequency_value');
|
$this->db->SELECT('simc_id,sales_date,sales_value,fk_frequency_id,frequency_value,FREQUENCY.name as frequency_name');
|
||||||
$this->db->FROM(SALESITEMMONTHWISECHILD.' as SALESITEMMONTHWISECHILD');
|
$this->db->FROM(SALESITEMMONTHWISECHILD.' as SALESITEMMONTHWISECHILD');
|
||||||
$this->db->WHERE('SALESITEMMONTHWISECHILD.fk_sim_id',$item['sim_id']);
|
$this->db->WHERE('SALESITEMMONTHWISECHILD.fk_sim_id',$item['sim_id']);
|
||||||
|
$this->db->JOIN(FREQUENCY.' as FREQUENCY','SALESITEMMONTHWISECHILD.fk_frequency_id = FREQUENCY.frequency_id','LEFT');
|
||||||
$this->db->WHERE('month(SALESITEMMONTHWISECHILD.sales_date)',$month['month']);
|
$this->db->WHERE('month(SALESITEMMONTHWISECHILD.sales_date)',$month['month']);
|
||||||
$this->db->WHERE('SALESITEMMONTHWISECHILD.isactive',1);
|
$this->db->WHERE('SALESITEMMONTHWISECHILD.isactive',1);
|
||||||
//$this->db->GROUP_BY('month(SALESITEMMONTHWISECHILD.sales_date)');
|
//$this->db->GROUP_BY('month(SALESITEMMONTHWISECHILD.sales_date)');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user