FIX_CRM_TO_BDS_SYNC_DELETION_MINUS_SYMBOLE_ADD
This commit is contained in:
parent
1ba46847f8
commit
8496357df4
@ -5424,7 +5424,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->myLogger->logme("error", "Policy transaction inserted successfully: " . json_encode(['insert_id' => $insert_id]));
|
$this->myLogger->logme("error", "Policy transaction inserted successfully: " . json_encode(['insert_id' => $insert_id]));
|
||||||
|
|
||||||
//do not remove this commented item
|
//do not remove this commented item
|
||||||
$coShareDetails = $this->ConstructPTShareData($policy_data, $insert_id, $params, $lead_data);
|
$coShareDetails = $this->ConstructPTShareData($policy_data, $insert_id, $params, $lead_data, $params['action_type']);
|
||||||
$pt_co_share_id = $this->PTCOShareDetailsModel->insert($coShareDetails);
|
$pt_co_share_id = $this->PTCOShareDetailsModel->insert($coShareDetails);
|
||||||
$this->myLogger->logme("error", "PT Co share data inserted successfully: " . json_encode(['pt_co_share_id' => $pt_co_share_id]));
|
$this->myLogger->logme("error", "PT Co share data inserted successfully: " . json_encode(['pt_co_share_id' => $pt_co_share_id]));
|
||||||
|
|
||||||
@ -5556,7 +5556,46 @@ class EmpDataServiceController extends BaseController
|
|||||||
return $policyTransactionData;
|
return $policyTransactionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function ConstructPTShareData($policy_data, $pt_id, $params, $lead_data)
|
private function ConstructPTShareData($policy_data, $pt_id, $params, $lead_data, $action_type)
|
||||||
|
{
|
||||||
|
$policyTypeModel = new PolicyTypeModel();
|
||||||
|
$policy_type_data = $policyTypeModel->where('is_active', 1)->where('id', $policy_data['policy_type_id'])->first();
|
||||||
|
|
||||||
|
// Determine if we should negate the values
|
||||||
|
$multiplier = (strtolower($action_type) === 'deletion') ? -1 : 1;
|
||||||
|
|
||||||
|
$coShareData = [
|
||||||
|
'pt_id' => $pt_id,
|
||||||
|
'insurer_id' => $policy_data['insurer_id'],
|
||||||
|
'insurer_branch_id' => $policy_data['insurer_branch_id'],
|
||||||
|
'bp_amt' => ($params['base_premium'] ?? 0) * $multiplier,
|
||||||
|
'cop_amt' => ($params['base_premium'] ?? 0) * $multiplier,
|
||||||
|
'bp_gst_amt' => ($params['gst'] ?? 0) * $multiplier,
|
||||||
|
'bp_sgst' => 9, // Usually tax percentages remain positive, but multiply if this is an amount
|
||||||
|
'bp_cgst' => 9,
|
||||||
|
'co_share_type' => 1,
|
||||||
|
'co_share_per' => 100,
|
||||||
|
'standerd_bp_per' => $policy_type_data['ebp'],
|
||||||
|
'pt_policy_issue_date' => $params['policy_issue_date'] ?? null,
|
||||||
|
'amount' => (($params['base_premium'] ?? 0) + ($params['gst'] ?? 0)) * $multiplier,
|
||||||
|
];
|
||||||
|
|
||||||
|
if(isset($policy_data['gst']) && $policy_data['gst'] != null){
|
||||||
|
$coShareData['bp_igst'] = $policy_data['gst'] ?? 0;
|
||||||
|
$coShareData['bp_sgst'] = 0;
|
||||||
|
$coShareData['bp_cgst'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate exp_amt logic
|
||||||
|
$agreed_per = $lead_data['agreed_percentage'] ?? $policy_type_data['ebp'] ?? 0;
|
||||||
|
$coShareData['exp_amt'] = ((($params['base_premium'] ?? 0) * $agreed_per) / 100) * $multiplier;
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "Constructed PT co-share data: " . json_encode($coShareData));
|
||||||
|
|
||||||
|
return $coShareData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function ConstructPTShareDataOld($policy_data, $pt_id, $params, $lead_data, $action_type = null)
|
||||||
{
|
{
|
||||||
$policyTypeModel = new PolicyTypeModel();
|
$policyTypeModel = new PolicyTypeModel();
|
||||||
$policy_type_data = $policyTypeModel->where('is_active', 1)->where('id', $policy_data['policy_type_id'])->first();
|
$policy_type_data = $policyTypeModel->where('is_active', 1)->where('id', $policy_data['policy_type_id'])->first();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user