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)
$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)
$pd_details['fk_pd_template_id'] = 4;
@ -2315,6 +2315,11 @@ class PD_Controller extends REST_Controller {
{
$records = $this->saveCoApplicantsFromGeneralInfoForm($records);
}
if($formid == 10)
{
$this->updateSubProductFromLoanDetailsForm($records);
}
$fields = array('isactive' => 0);
@ -3331,8 +3336,8 @@ class PD_Controller extends REST_Controller {
}
else
{
$temp_grossprofit = $temp_netprofit - $overall_business_expenses_total;
$temp_purchases = $temp_grossprofit - $total_sales_itemwise;
$temp_grossprofit = $temp_netprofit + $overall_business_expenses_total;
$temp_purchases = $total_sales_itemwise - $temp_grossprofit;
$temp_netmargin = ($temp_netprofit/$total_sales_itemwise) * 100;
}
@ -3390,8 +3395,8 @@ class PD_Controller extends REST_Controller {
}
else
{
$temp_grossprofit = $temp_netprofit - $overall_business_expenses_total;
$temp_purchases = $temp_grossprofit - $total_sales_monthwise;
$temp_grossprofit = $temp_netprofit + $overall_business_expenses_total;
$temp_purchases = $total_sales_monthwise - $temp_grossprofit;
$temp_netmargin = ($temp_netprofit/$total_sales_monthwise) * 100;
}
@ -3427,8 +3432,8 @@ class PD_Controller extends REST_Controller {
}
else
{
$temp_grossprofit = $temp_netprofit - $overall_business_expenses_total;
$temp_purchases = $temp_grossprofit - $total_sales_declared_by_customer;
$temp_grossprofit = $temp_netprofit + $overall_business_expenses_total;
$temp_purchases = $total_sales_declared_by_customer - $temp_grossprofit;
$temp_netmargin = ($temp_netprofit/$total_sales_declared_by_customer) * 100;
}
@ -4274,17 +4279,19 @@ class PD_Controller extends REST_Controller {
public function codeigniterViewTest_post()
{
// $t = $this->load->view('report_templates/SALCASH',$data = array(),true);
// //echo $t;die();
// //PDF Gen using DOM PDF
// $pdf_doc = $this->pdfgenerator->generate($t, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
// //End of PDF Gen using DOM PDF
// $output_file2 = APPPATH."/docs/sample.pdf";
// $ti = file_put_contents($output_file2, $pdf_doc);
// echo $ti;
// die();
echo "fisrt";
$ch = curl_init();
$timeout = 5;
$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';
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$tinyurl = curl_exec($ch);
curl_close($ch);
echo $tinyurl;
echo 'done';
die();
$records = $this->post('records');
$pdid = $records['pd_id'];
$fk_createdby = $records['fk_createdby'];
@ -4619,43 +4626,68 @@ class PD_Controller extends REST_Controller {
{
$records = $this->post('records');
$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($pd_master_details[0]['fk_subproduct_id'] != "" || $pd_master_details[0]['fk_subproduct_id'] != null)
if($sub_product_id != null)
{
$fields = array('*');
$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);
if(count($result_data))
{
$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 End Use Of Loan!';
$this->response($data,REST_Controller::HTTP_OK);
}
$fields = array('*');
$where_condition_array = array('isactive' => 1,'fk_subproduct_id' => $sub_product_id);
$result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENDUSEOFLOAN);
if(count($result_data))
{
$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
{
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
$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);
if($pd_master_details[0]['fk_subproduct_id'] != "" || $pd_master_details[0]['fk_subproduct_id'] != null)
{
$fields = array('*');
$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);
if(count($result_data))
{
$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);
}
}
}