FIX_LIVE_ISSUES : RV
This commit is contained in:
parent
a0c4bebdc4
commit
28d31f9c7d
@ -665,7 +665,8 @@ class ClientController extends AdminController
|
||||
$data['insurerName'] = $this->insurerModel->getInsurerName($insurerId, $clientId);
|
||||
$data['depositdata'] = $this->clientPolicyModel->getdepositData($clientId, $insurerId, $cd_ac_pk);
|
||||
$data['clientData'] = $this->clientPolicyModel->getClientById($clientId);
|
||||
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId);
|
||||
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId, $cd_ac_pk);
|
||||
$data['cd_ac_pk'] = $cd_ac_pk;
|
||||
|
||||
// dd($data);
|
||||
|
||||
@ -690,9 +691,16 @@ class ClientController extends AdminController
|
||||
->where('insurer_id', $insurer_id)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
// Prepare the array with data
|
||||
$date = \DateTime::createFromFormat('d/m/Y', $record_date);
|
||||
$record_date = $date->format('Y-m-d');
|
||||
|
||||
|
||||
if(!empty($record_date)){
|
||||
// Prepare the array with data
|
||||
$date = \DateTime::createFromFormat('d/m/Y', $record_date);
|
||||
$record_date = $date->format('Y-m-d');
|
||||
}else{
|
||||
$record_date = null;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'amount' => $this->request->getPost('amount'),
|
||||
'sub_type_id' => $this->request->getPost('sub_type_id'),
|
||||
|
||||
@ -3541,20 +3541,29 @@ class EmpDataServiceController extends BaseController
|
||||
// return ['status' => 'error', 'message' => 'Employees table data is empty or null.'];
|
||||
// }
|
||||
|
||||
// Check if $employee_policy_table_data is null or empty
|
||||
if (empty($employee_policy_table_data)) {
|
||||
return ['status' => 'error', 'message' => 'Employee policy table data is empty or null.'];
|
||||
}
|
||||
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
// Check if $emp_endorsement_table_data is null or empty
|
||||
if (empty($emp_endorsement_table_data)) {
|
||||
return ['status' => 'error', 'message' => 'Employee endorsement table data is empty or null.'];
|
||||
}
|
||||
// Check if $employee_policy_table_data is null or empty
|
||||
if (empty($employee_policy_table_data)) {
|
||||
$this->batchFileModel->update($file_id, [
|
||||
'status' => "failed",
|
||||
]);
|
||||
return ['status' => 'error', 'message' => 'Employee policy table data is empty or null.'];
|
||||
}
|
||||
|
||||
// $this->employeeModel->updateBatch($employees_table_data, 'id');
|
||||
$this->employeePolicyModel->updateBatch($employee_policy_table_data, 'id');
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($emp_endorsement_table_data);
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
// Check if $emp_endorsement_table_data is null or empty
|
||||
if (empty($emp_endorsement_table_data)) {
|
||||
$this->batchFileModel->update($file_id, [
|
||||
'status' => "failed",
|
||||
]);
|
||||
return ['status' => 'error', 'message' => 'Employee endorsement table data is empty or null.'];
|
||||
}
|
||||
|
||||
// $this->employeeModel->updateBatch($employees_table_data, 'id');
|
||||
$this->employeePolicyModel->updateBatch($employee_policy_table_data, 'id');
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($emp_endorsement_table_data);
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
}
|
||||
|
||||
// Update batch file status and amount
|
||||
$this->batchFileModel->update($file_id, [
|
||||
|
||||
@ -448,7 +448,7 @@ class LeadsController extends BaseController
|
||||
|
||||
'source_policy_start_date' => $data['source_policy_start_date'] ?? null,
|
||||
'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
|
||||
'claim_history' => $data['claim_history']
|
||||
'claim_history' => $data['claim_history'] ?? 0
|
||||
];
|
||||
}
|
||||
// print_r($processedData);die();
|
||||
|
||||
@ -102,10 +102,10 @@ class DepositHelper
|
||||
// $getLastBalanceParams = [$clientId, $insurerId];
|
||||
|
||||
if(empty($cd_ac_pk)){
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY id DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$cd_ac_no];
|
||||
}else{
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_pk = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_pk = ? AND is_active = 1 ORDER BY id DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$cd_ac_pk];
|
||||
}
|
||||
|
||||
|
||||
@ -257,7 +257,7 @@ class ClientPolicyModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getDepositSummary($clientId, $insurerId)
|
||||
public function getDepositSummary($clientId, $insurerId, $cd_ac_pk)
|
||||
{
|
||||
// Fetch the sum of credit and debit transactions and calculate the balance
|
||||
return $this->db->table('cash_deposit')
|
||||
@ -267,6 +267,7 @@ class ClientPolicyModel extends Model
|
||||
->select('SUM(CASE WHEN sub_type = 3 THEN amount ELSE 0 END) AS total_refund')
|
||||
->where('client_id', $clientId)
|
||||
->where('insurer_id', $insurerId)
|
||||
->where('cd_ac_pk', $cd_ac_pk)
|
||||
->where('cash_deposit.is_active', 1)
|
||||
->get()
|
||||
->getRow();
|
||||
@ -319,11 +320,12 @@ class ClientPolicyModel extends Model
|
||||
public function getDepositlistsummary($id)
|
||||
{
|
||||
return $this->db->table('cash_deposit')
|
||||
->select('insurer_id')
|
||||
->select('insurer_id, cd_ac_pk')
|
||||
->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE -amount END) AS balance')
|
||||
->where('client_id', $id)
|
||||
->where('is_active', 1)
|
||||
->groupBy('insurer_id')
|
||||
->groupBy('cd_ac_pk')
|
||||
// ->groupBy('cd_ac_pk')
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
@ -1061,10 +1061,10 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
$status_condition = "{$insurer_or_tpa}" === 'tpa'
|
||||
? "employee_polices.status = 'active' AND employees.emp_status = 'active'"
|
||||
? "employee_polices.status = 'inactive' AND employees.emp_status = 'active'"
|
||||
: "employee_polices.status = 'active' AND employees.emp_status = 'active'";
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT DISTINCT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user