END USE LOAN API

This commit is contained in:
velz 2019-03-09 20:15:53 +05:30
parent b81561e85b
commit 1708c92211

View File

@ -352,7 +352,7 @@ class PD_Controller extends REST_Controller {
//* SENP/SEP - (DI) //* SENP/SEP - (DI)
$pd_details['fk_pd_template_id'] = 3; $pd_details['fk_pd_template_id'] = 3;
} }
else if($res_array[0]['fk_customer_segment'] == 8) else if($pd_details['fk_customer_segment'] == 8)
{ {
//* SENP/SEP - (RI) //* SENP/SEP - (RI)
$pd_details['fk_pd_template_id'] = 4; $pd_details['fk_pd_template_id'] = 4;
@ -2315,6 +2315,11 @@ class PD_Controller extends REST_Controller {
{ {
$records = $this->saveCoApplicantsFromGeneralInfoForm($records); $records = $this->saveCoApplicantsFromGeneralInfoForm($records);
} }
if($formid == 10)
{
$this->updateSubProductFromLoanDetailsForm($records);
}
$fields = array('isactive' => 0); $fields = array('isactive' => 0);
@ -3331,8 +3336,8 @@ class PD_Controller extends REST_Controller {
} }
else else
{ {
$temp_grossprofit = $temp_netprofit - $overall_business_expenses_total; $temp_grossprofit = $temp_netprofit + $overall_business_expenses_total;
$temp_purchases = $temp_grossprofit - $total_sales_itemwise; $temp_purchases = $total_sales_itemwise - $temp_grossprofit;
$temp_netmargin = ($temp_netprofit/$total_sales_itemwise) * 100; $temp_netmargin = ($temp_netprofit/$total_sales_itemwise) * 100;
} }
@ -3390,8 +3395,8 @@ class PD_Controller extends REST_Controller {
} }
else else
{ {
$temp_grossprofit = $temp_netprofit - $overall_business_expenses_total; $temp_grossprofit = $temp_netprofit + $overall_business_expenses_total;
$temp_purchases = $temp_grossprofit - $total_sales_monthwise; $temp_purchases = $total_sales_monthwise - $temp_grossprofit;
$temp_netmargin = ($temp_netprofit/$total_sales_monthwise) * 100; $temp_netmargin = ($temp_netprofit/$total_sales_monthwise) * 100;
} }
@ -3427,8 +3432,8 @@ class PD_Controller extends REST_Controller {
} }
else else
{ {
$temp_grossprofit = $temp_netprofit - $overall_business_expenses_total; $temp_grossprofit = $temp_netprofit + $overall_business_expenses_total;
$temp_purchases = $temp_grossprofit - $total_sales_declared_by_customer; $temp_purchases = $total_sales_declared_by_customer - $temp_grossprofit;
$temp_netmargin = ($temp_netprofit/$total_sales_declared_by_customer) * 100; $temp_netmargin = ($temp_netprofit/$total_sales_declared_by_customer) * 100;
} }
@ -4274,17 +4279,19 @@ class PD_Controller extends REST_Controller {
public function codeigniterViewTest_post() public function codeigniterViewTest_post()
{ {
echo "fisrt";
// $t = $this->load->view('report_templates/SALCASH',$data = array(),true); $ch = curl_init();
// //echo $t;die(); $timeout = 5;
// //PDF Gen using DOM PDF $url = 'http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to=919791811189&msg=WelcometoMSGAPI&msg_type=TEXT&userid=2000185290&auth_scheme=plain&password=wRfAwb&v=1.1&format=text';
// $pdf_doc = $this->pdfgenerator->generate($t, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
// //End of PDF Gen using DOM PDF curl_setopt($ch,CURLOPT_URL,$url);
// $output_file2 = APPPATH."/docs/sample.pdf"; curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
// $ti = file_put_contents($output_file2, $pdf_doc); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
// echo $ti; $tinyurl = curl_exec($ch);
curl_close($ch);
// die(); echo $tinyurl;
echo 'done';
die();
$records = $this->post('records'); $records = $this->post('records');
$pdid = $records['pd_id']; $pdid = $records['pd_id'];
$fk_createdby = $records['fk_createdby']; $fk_createdby = $records['fk_createdby'];
@ -4619,43 +4626,68 @@ class PD_Controller extends REST_Controller {
{ {
$records = $this->post('records'); $records = $this->post('records');
$pdid = $records['pd_id']; $pdid = $records['pd_id'];
$sub_product_id = null;
if(isset($records['sub_product_id'])){ $sub_product_id = $records['sub_product_id']; }
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid); if($sub_product_id != null)
if($pd_master_details[0]['fk_subproduct_id'] != "" || $pd_master_details[0]['fk_subproduct_id'] != null)
{ {
$fields = array('*');
$fields = array('*'); $where_condition_array = array('isactive' => 1,'fk_subproduct_id' => $sub_product_id);
$where_condition_array = array('isactive' => 1,'fk_subproduct_id' => $pd_master_details[0]['fk_subproduct_id']); $result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENDUSEOFLOAN);
$result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENDUSEOFLOAN); if(count($result_data))
if(count($result_data)) {
{ $data['dataStatus'] = true;
$data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK;
$data['status'] = REST_Controller::HTTP_OK; $data['records'] = $result_data;
$data['records'] = $result_data; $this->response($data,REST_Controller::HTTP_OK);
$this->response($data,REST_Controller::HTTP_OK); }
} else
else {
{ $data['dataStatus'] = false;
$data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = 'No Data Found for Selected Sub Product!';
$data['msg'] = 'No Data Found for End Use Of Loan!'; $this->response($data,REST_Controller::HTTP_OK);
$this->response($data,REST_Controller::HTTP_OK); }
}
} }
else else
{ {
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
$fields = array('*'); if($pd_master_details[0]['fk_subproduct_id'] != "" || $pd_master_details[0]['fk_subproduct_id'] != null)
$where_condition_array = array('isactive' => 1,'fk_subproduct_id' => null); {
$result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENDUSEOFLOAN);
$fields = array('*');
$data['dataStatus'] = false; $where_condition_array = array('isactive' => 1,'fk_subproduct_id' => $pd_master_details[0]['fk_subproduct_id']);
$data['status'] = REST_Controller::HTTP_NO_CONTENT; $result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENDUSEOFLOAN);
$data['records'] = $result_data; if(count($result_data))
$data['msg'] = 'Sub Product Not Applicable for this PD!'; {
$this->response($data,REST_Controller::HTTP_OK); $data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $result_data;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'No Data Found for Selected Sub Product!';
$this->response($data,REST_Controller::HTTP_OK);
}
}
else
{
$fields = array('*');
$where_condition_array = array('isactive' => 1,'fk_subproduct_id' => null);
$result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENDUSEOFLOAN);
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['records'] = $result_data;
$data['msg'] = 'Sub Product Not Applicable for this PD!';
$this->response($data,REST_Controller::HTTP_OK);
}
} }
} }
@ -5613,5 +5645,22 @@ class PD_Controller extends REST_Controller {
} }
public function updateSubProductFromLoanDetailsForm($records)
{
$pd_master_details = $this->PD_Model->getPDMasterDetails($records['pdid']);
$new_sub_product = $records['sub_product'];
$old_sub_product = $pd_master_details[0]['fk_subproduct_id'];
if($new_sub_product != $old_sub_product)
{
$where_condition_array = array('pd_id' => $records['pdid']);
$temp = array('fk_subproduct_id' => $new_sub_product,'fk_updatedby' => $records['fk_createdby']);
$pk_id = $this->PD_Model->updateRecords($temp,PDTRIGGER,$where_condition_array);
}
}
} }