Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
9fc0e213b7
@ -329,6 +329,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("getCDAccNoByClientAndInsurer/(:any)", "ClientController::getCDAccNoByClientAndInsurer/$1");
|
||||
$routes->post("createClientWithMinimalData", "ClientController::createClientWithMinimalData");
|
||||
$routes->post("createVehicleWithMinimalData", "ClientController::createVehicleWithMinimalData");
|
||||
$routes->post("createVehicleWithMinimalDataForBDS", "ClientController::createVehicleWithMinimalDataForBDS");
|
||||
$routes->post("createClientBranchWithMinamalData", "ClientController::createClientBranchWithMinamalData");
|
||||
$routes->post("createClientPolicyWithMinimalData", "ClientController::createClientPolicyWithMinimalData");
|
||||
$routes->post("createCDAccountNumberUsingAjax", "MasterController::createCDAccountNumberUsingAjax");
|
||||
@ -690,6 +691,7 @@ $routes->group('test', function($routes) {
|
||||
$routes->get('generatePDF', 'TestingController::generatePDF');
|
||||
$routes->get('viewPDF', 'TestingController::viewPDF');
|
||||
$routes->get('generate-pdf-view', 'TestingController::generatePDFWithView');
|
||||
$routes->get('param/(:any)', 'TestingController::ptedfitdata/$1');
|
||||
});
|
||||
$routes->cli('cli/testcli', 'TestingController::testcli');
|
||||
|
||||
|
||||
@ -999,31 +999,52 @@ class ClientController extends AdminController
|
||||
$data['client_id'] = $this->request->getPost('client_id');
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$inserted = false;
|
||||
// print_r($this->request->getPost()); die;
|
||||
|
||||
if ($this->request->getPost('head')) {
|
||||
|
||||
$data['user_id'] = $this->request->getPost('head');
|
||||
$checkHead = $this->clientRMModel->checkExistenceOfClientRelation($id, $this->request->getPost('head'), 1);
|
||||
if ($checkHead) {
|
||||
$inserted = $this->clientRMModel->where('client_id', $id)->where('level', 1)->set($data)->update();
|
||||
} else {
|
||||
$data['level'] = "1";
|
||||
$data['user_id'] = $this->request->getPost('head');
|
||||
$inserted = $this->clientRMModel->insert($data);
|
||||
}
|
||||
$this->clientRMModel->where('client_id', $id)->where('level', 1)->delete();
|
||||
|
||||
$data['level'] = "1";
|
||||
$data['user_id'] = $this->request->getPost('head');
|
||||
$inserted = $this->clientRMModel->insert($data);
|
||||
}
|
||||
|
||||
if ($this->request->getPost('manager')) {
|
||||
|
||||
$data['user_id'] = $this->request->getPost('manager');
|
||||
$checkHead = $this->clientRMModel->checkExistenceOfClientRelation($id, $this->request->getPost('manager'), 2);
|
||||
if ($checkHead) {
|
||||
$inserted = $this->clientRMModel->where('client_id', $id)->where('level', 2)->set($data)->update();
|
||||
} else {
|
||||
$data['level'] = "2";
|
||||
$data['user_id'] = $this->request->getPost('manager');
|
||||
$inserted = $this->clientRMModel->insert($data);
|
||||
}
|
||||
$this->clientRMModel->where('client_id', $id)->where('level', 2)->delete();
|
||||
|
||||
$data['level'] = "2";
|
||||
$data['user_id'] = $this->request->getPost('manager');
|
||||
$inserted = $this->clientRMModel->insert($data);
|
||||
}
|
||||
|
||||
// if ($this->request->getPost('head')) {
|
||||
// $data['user_id'] = $this->request->getPost('head');
|
||||
// $checkHead = $this->clientRMModel->checkExistenceOfClientRelation($id, $this->request->getPost('head'), 1);
|
||||
// if ($checkHead) {
|
||||
// $inserted = $this->clientRMModel->where('client_id', $id)->where('level', 1)->set($data)->update();
|
||||
// } else {
|
||||
// $data['level'] = "1";
|
||||
// $data['user_id'] = $this->request->getPost('head');
|
||||
// $inserted = $this->clientRMModel->insert($data);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if ($this->request->getPost('manager')) {
|
||||
// $data['user_id'] = $this->request->getPost('manager');
|
||||
// $checkHead = $this->clientRMModel->checkExistenceOfClientRelation($id, $this->request->getPost('manager'), 2);
|
||||
// if ($checkHead) {
|
||||
// $inserted = $this->clientRMModel->where('client_id', $id)->where('level', 2)->set($data)->update();
|
||||
// } else {
|
||||
// $data['level'] = "2";
|
||||
// $data['user_id'] = $this->request->getPost('manager');
|
||||
// $inserted = $this->clientRMModel->insert($data);
|
||||
// }
|
||||
// }
|
||||
|
||||
if ($this->request->getPost('account_manager')) {
|
||||
|
||||
$this->clientRMModel->where('client_id', $id)->where('level', 3)->delete();
|
||||
@ -4422,7 +4443,9 @@ class ClientController extends AdminController
|
||||
// }
|
||||
// }
|
||||
|
||||
public function createClientWithMinimalData()
|
||||
// ------------- CLIENT AND VEHICLE ------------------------------------------------------------------------------------------------
|
||||
|
||||
public function createClientWithMinimalData2()
|
||||
{
|
||||
$postData = $this->request->getPost();
|
||||
// print_r($postData); die;
|
||||
@ -4474,7 +4497,6 @@ class ClientController extends AdminController
|
||||
'name' => $postData['name'],
|
||||
'mobile' => $postData['mobile'],
|
||||
'email' => $postData['email'],
|
||||
|
||||
];
|
||||
$this->levelContactModel->insert($contact_data);
|
||||
}
|
||||
@ -4489,6 +4511,89 @@ class ClientController extends AdminController
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function createClientWithMinimalData()
|
||||
{
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
// print_r($postData); die;
|
||||
$client_type = $postData['client_type'] ?? null;
|
||||
|
||||
$client_insert = null;
|
||||
if($client_type == 2){
|
||||
|
||||
$client_data = [
|
||||
'client_type' => $postData['client_type'],
|
||||
'client_name' => $postData['client_name'],
|
||||
'email' => $postData['short_name'] ?? $postData['client_name'],
|
||||
'phone' => $postData['mobile'],
|
||||
'client_code' => generate_client_code()
|
||||
];
|
||||
|
||||
$client_insert = $this->clientModel->insert($client_data);
|
||||
|
||||
}else if($client_type == 1){
|
||||
|
||||
$client_data = [
|
||||
'client_type' => $postData['client_type'],
|
||||
'client_name' => $postData['client_name'],
|
||||
'short_name' => $postData['short_name'] ?? $postData['client_name'],
|
||||
'client_code' => generate_client_code(),
|
||||
'entity_type_id' => 2
|
||||
];
|
||||
|
||||
$client_insert = $this->clientModel->insert($client_data);
|
||||
}
|
||||
|
||||
if (!$client_insert) {
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to create client'], 200);
|
||||
}
|
||||
|
||||
// Additional logic for non-individual clients (client_type != 2)
|
||||
$branch_insert = null;
|
||||
if ($client_type != 2) {
|
||||
$unit[] = $postData['short_name'] . '-' . 001;
|
||||
$branch_data = [
|
||||
'client_id' => $client_insert,
|
||||
'branch_name' => $postData['branch_name'],
|
||||
'branch_code' => 001,
|
||||
'gst' => $postData['gst'],
|
||||
'units' => json_encode($unit) ?? null,
|
||||
];
|
||||
|
||||
$branch_insert = $this->clientBranchModel->insert($branch_data);
|
||||
if ($branch_insert) {
|
||||
$contact_data = [
|
||||
'ref_id' => $branch_insert,
|
||||
'contact_type' => 'client',
|
||||
'name' => $postData['name'],
|
||||
'email' => $postData['email'],
|
||||
];
|
||||
$this->levelContactModel->insert($contact_data);
|
||||
}
|
||||
}
|
||||
|
||||
$clients = $this->clientModel
|
||||
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
// Fetch branches in a single query
|
||||
$branches = $this->clientBranchModel
|
||||
->where('client_id', $client_insert)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'data' => $postData,
|
||||
'client_id' => $client_insert,
|
||||
'branch_id' => $branch_insert ?? null,
|
||||
'clients' => $clients,
|
||||
'branches' => $branches,
|
||||
'message' => 'Client created successfully'
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function createVehicleWithMinimalData()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
@ -4508,7 +4613,13 @@ class ClientController extends AdminController
|
||||
$vehicle_insert = $this->vehicleModel->insert($data);
|
||||
|
||||
if ($vehicle_insert) {
|
||||
$vehicles = $this->vehicleModel->where('is_active', 1)->findAll();
|
||||
|
||||
// $vehicles = $this->vehicleModel->where('is_active', 1)->findAll();
|
||||
$vehicles = $this->vehicleModel->select('vehicle.*, clients.client_type')
|
||||
->join('clients', 'clients.id=vehicle.owner')
|
||||
->where('vehicle.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'vehicle_id' => $vehicle_insert,
|
||||
@ -4525,6 +4636,160 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function createVehicleWithMinimalDataForBDS()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
// print_r($data); die;
|
||||
if (isset($data['client_name']) && !empty($data['client_name'])) {
|
||||
|
||||
$client_type = $data['client_type'] ?? null;
|
||||
|
||||
$client_insert = null;
|
||||
if ($client_type == 2) {
|
||||
|
||||
$client_data = [
|
||||
'client_type' => $data['client_type'],
|
||||
'client_name' => $data['client_name'],
|
||||
'email' => $data['short_name'] ?? $data['client_name'],
|
||||
'phone' => $data['mobile'],
|
||||
'client_code' => generate_client_code()
|
||||
];
|
||||
|
||||
$client_insert = $this->clientModel->insert($client_data);
|
||||
|
||||
} else if ($client_type == 1) {
|
||||
|
||||
$client_data = [
|
||||
'client_type' => $data['client_type'],
|
||||
'client_name' => $data['client_name'],
|
||||
'short_name' => $data['short_name'] ?? $data['client_name'],
|
||||
'client_code' => generate_client_code(),
|
||||
'entity_type_id' => 2
|
||||
];
|
||||
|
||||
$client_insert = $this->clientModel->insert($client_data);
|
||||
}
|
||||
|
||||
// Additional logic for non-individual clients (client_type != 2)
|
||||
$branch_insert = null;
|
||||
if ($client_type != 2) {
|
||||
$unit[] = $data['short_name'] . '-' . 001;
|
||||
$branch_data = [
|
||||
'client_id' => $client_insert,
|
||||
'branch_name' => $data['branch_name'],
|
||||
'branch_code' => 001,
|
||||
'gst' => $data['gst'],
|
||||
'units' => json_encode($unit) ?? null,
|
||||
];
|
||||
|
||||
$branch_insert = $this->clientBranchModel->insert($branch_data);
|
||||
if ($branch_insert) {
|
||||
$contact_data = [
|
||||
'ref_id' => $branch_insert,
|
||||
'contact_type' => 'client',
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
];
|
||||
$this->levelContactModel->insert($contact_data);
|
||||
}
|
||||
}
|
||||
|
||||
$vehicle_data = [
|
||||
'vehicle_no' => $data['vehicle_no'],
|
||||
'type' => $data['type'],
|
||||
'rc' => $data['rc'],
|
||||
'branch_id' => $branch_insert,
|
||||
'owner' => $client_insert,
|
||||
];
|
||||
|
||||
$vehicle_insert = $this->vehicleModel->insert($vehicle_data);
|
||||
|
||||
if ($vehicle_insert) {
|
||||
|
||||
// $vehicles = $this->vehicleModel->where('is_active', 1)->findAll();
|
||||
$vehicles = $this->vehicleModel->select('vehicle.*, clients.client_type')
|
||||
->join('clients', 'clients.id = vehicle.owner')
|
||||
->where('vehicle.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$clients = $this->clientModel
|
||||
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
// Fetch branches in a single query
|
||||
$branches = $this->clientBranchModel
|
||||
->where('client_id', $client_insert)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'vehicle_id' => $vehicle_insert,
|
||||
'client_id' => $client_insert,
|
||||
'branch_id' => $branch_insert,
|
||||
'data' => $data,
|
||||
'clients' => $clients,
|
||||
'branches' => $branches,
|
||||
'vehicles' => $vehicles,
|
||||
'message' => 'Vehicle created successfully'
|
||||
], 200);
|
||||
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
||||
}
|
||||
|
||||
} else if (isset($data['owner']) && !empty($data['owner'])) {
|
||||
|
||||
$vehicle_data = [
|
||||
'vehicle_no' => $data['vehicle_no'],
|
||||
'type' => $data['type'],
|
||||
'rc' => $data['rc'],
|
||||
'branch_id' => $data['branch_id'] ?? null,
|
||||
'owner' => $data['owner'],
|
||||
];
|
||||
|
||||
$vehicle_insert = $this->vehicleModel->insert($vehicle_data);
|
||||
|
||||
$vehicles = $this->vehicleModel->select('vehicle.*, clients.client_type')
|
||||
->join('clients', 'clients.id = vehicle.owner')
|
||||
->where('vehicle.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$clients = $this->clientModel
|
||||
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
// Fetch branches in a single query
|
||||
$branches = $this->clientBranchModel
|
||||
->where('client_id', $data['owner'])
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
if ($vehicle_insert) {
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'vehicle_id' => $vehicle_insert,
|
||||
'client_id' => $data['owner'],
|
||||
'branch_id' => $data['branch_id'],
|
||||
'data' => $data,
|
||||
'clients' => $clients,
|
||||
'branches' => $branches,
|
||||
'vehicles' => $vehicles,
|
||||
'message' => 'Vehicle created successfully'
|
||||
], 200);
|
||||
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function createClientPolicyWithMinimalData()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
@ -4560,6 +4825,9 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// ------------- CLIENT AND VEHICLE ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
public function getPolicyDetailsByPolicyId($id)
|
||||
{
|
||||
$policies = $this->clientPolicyModel
|
||||
@ -4604,6 +4872,68 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// public function get_client_policy_data_using_policy_no()
|
||||
// {
|
||||
// $received_data = $this->request->getGet();
|
||||
// $policy_no = $this->request->getGet('policy_no');
|
||||
// $client_id = $this->request->getGet('client_id');
|
||||
// $client_branch_id = $this->request->getGet('client_branch_id');
|
||||
// $policy_type_id = $this->request->getGet('policy_type_id');
|
||||
// $client_type = $this->request->getGet('client_type');
|
||||
|
||||
// $data = $this->clientPolicyModel
|
||||
// ->select("
|
||||
// client_policy.*,
|
||||
// policy_type.policy_type,
|
||||
// clients.client_type,
|
||||
// clients.client_name,
|
||||
// DATE_FORMAT(client_policy.policy_start_date, '%d/%m/%Y') as policy_start_date,
|
||||
// DATE_FORMAT(client_policy.policy_end_date, '%d/%m/%Y') as policy_end_date
|
||||
// ")
|
||||
// ->join('clients', 'client_policy.client_id = clients.id')
|
||||
// ->join('policy_type', 'client_policy.policy_type_id = policy_type.id')
|
||||
// ->where('client_policy.policy_no', $policy_no)
|
||||
// ->where('client_policy.is_active', 1)
|
||||
// ->where('client_policy.policy_status', 1)
|
||||
// ->first();
|
||||
|
||||
// if ($data) {
|
||||
|
||||
// if ($client_type == 1) {
|
||||
// if ($data['client_id'] == $client_id && $data['client_branch_id'] == $client_branch_id) {
|
||||
|
||||
// if ($data['policy_type_id'] == $policy_type_id) {
|
||||
// return $this->respond(['status' => true, 'data' => $data, 'code' => 200, 'received_data' => $received_data], 200);
|
||||
// } else {
|
||||
// $policy_type = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||
// $message = 'This policy number is mapped to the selected client with policy type: ' . (!empty($data['policy_type']) ? $data['policy_type'] : 'N/A') . '. You selected: ' . (!empty($policy_type['policy_type']) ? $policy_type['policy_type'] : 'N/A') . '. Please check.';
|
||||
// return $this->respond(['status' => true, 'data' => $data, 'code' => 409, "message" => $message, 'received_data' => $received_data], 200);
|
||||
// }
|
||||
// } else {
|
||||
// $message = 'This policy number is already linked to another client' . (!empty($data['client_name']) ? '. Client name : ' . $data['client_name'] : '') . '. Please check';
|
||||
// return $this->respond(['status' => true, 'code' => 409, "message" => $message, 'received_data' => $received_data, 'db_data' => $data], 200);
|
||||
// }
|
||||
// } else {
|
||||
// if ($data['client_id'] == $client_id) {
|
||||
|
||||
// if ($data['policy_type_id'] == $policy_type_id) {
|
||||
// return $this->respond(['status' => true, 'data' => $data, 'code' => 200, 'received_data' => $received_data], 200);
|
||||
// } else {
|
||||
// $policy_type = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||
// $message = 'This policy number is mapped to the selected client with policy type: ' . (!empty($data['policy_type']) ? $data['policy_type'] : 'N/A') . '. You selected: ' . (!empty($policy_type['policy_type']) ? $policy_type['policy_type'] : 'N/A') . '. Please check.';
|
||||
// return $this->respond(['status' => true, 'data' => $data, 'code' => 409, "message" => $message, 'received_data' => $received_data], 200);
|
||||
// }
|
||||
// } else {
|
||||
// $message = 'This policy number is already linked to another client' . (!empty($data['client_name']) ? '. Client name : ' . $data['client_name'] : '') . '. Please check';
|
||||
// return $this->respond(['status' => true, 'code' => 409, "message" => $message, 'received_data' => $received_data, 'db_data' => $data], 200);
|
||||
// }
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404, 'received_data' => $received_data], 200);
|
||||
// }
|
||||
// }
|
||||
|
||||
public function get_client_policy_data_using_policy_no()
|
||||
{
|
||||
$received_data = $this->request->getGet();
|
||||
@ -4613,54 +4943,14 @@ class ClientController extends AdminController
|
||||
$policy_type_id = $this->request->getGet('policy_type_id');
|
||||
$client_type = $this->request->getGet('client_type');
|
||||
|
||||
$data = $this->clientPolicyModel
|
||||
->select("
|
||||
client_policy.*,
|
||||
policy_type.policy_type,
|
||||
clients.client_type,
|
||||
clients.client_name,
|
||||
DATE_FORMAT(client_policy.policy_start_date, '%d/%m/%Y') as policy_start_date,
|
||||
DATE_FORMAT(client_policy.policy_end_date, '%d/%m/%Y') as policy_end_date
|
||||
")
|
||||
->join('clients', 'client_policy.client_id = clients.id')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id')
|
||||
->where('client_policy.policy_no', $policy_no)
|
||||
->where('client_policy.is_active', 1)
|
||||
->where('client_policy.policy_status', 1)
|
||||
->first();
|
||||
$data = $this->policyTransactionModel
|
||||
->where('is_active', 1)
|
||||
->where('action_type', 'inception')
|
||||
->where('policy_no', $policy_no)
|
||||
->countAllResults();
|
||||
|
||||
if ($data) {
|
||||
|
||||
if ($client_type == 1) {
|
||||
if ($data['client_id'] == $client_id && $data['client_branch_id'] == $client_branch_id) {
|
||||
|
||||
if ($data['policy_type_id'] == $policy_type_id) {
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 200, 'received_data' => $received_data], 200);
|
||||
} else {
|
||||
$policy_type = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||
$message = 'This policy number is mapped to the selected client with policy type: ' . (!empty($data['policy_type']) ? $data['policy_type'] : 'N/A') . '. You selected: ' . (!empty($policy_type['policy_type']) ? $policy_type['policy_type'] : 'N/A') . '. Please check.';
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 409, "message" => $message, 'received_data' => $received_data], 200);
|
||||
}
|
||||
} else {
|
||||
$message = 'This policy number is already linked to another client' . (!empty($data['client_name']) ? '. Client name : ' . $data['client_name'] : '') . '. Please check';
|
||||
return $this->respond(['status' => true, 'code' => 409, "message" => $message, 'received_data' => $received_data, 'db_data' => $data], 200);
|
||||
}
|
||||
} else {
|
||||
if ($data['client_id'] == $client_id) {
|
||||
|
||||
if ($data['policy_type_id'] == $policy_type_id) {
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 200, 'received_data' => $received_data], 200);
|
||||
} else {
|
||||
$policy_type = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||
$message = 'This policy number is mapped to the selected client with policy type: ' . (!empty($data['policy_type']) ? $data['policy_type'] : 'N/A') . '. You selected: ' . (!empty($policy_type['policy_type']) ? $policy_type['policy_type'] : 'N/A') . '. Please check.';
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 409, "message" => $message, 'received_data' => $received_data], 200);
|
||||
}
|
||||
} else {
|
||||
$message = 'This policy number is already linked to another client' . (!empty($data['client_name']) ? '. Client name : ' . $data['client_name'] : '') . '. Please check';
|
||||
return $this->respond(['status' => true, 'code' => 409, "message" => $message, 'received_data' => $received_data, 'db_data' => $data], 200);
|
||||
}
|
||||
}
|
||||
|
||||
if ($data > 0) {
|
||||
return $this->respond(['status' => true, 'message' => 'This policy number is already linked to another client', 'data' => $data, 'code' => 409, 'received_data' => $received_data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404, 'received_data' => $received_data], 200);
|
||||
}
|
||||
@ -5259,7 +5549,7 @@ class ClientController extends AdminController
|
||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
$empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '865']);
|
||||
$res = $empServiceController->excelFileFormatValidation(['file_id' => '2055']);
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
|
||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 726]);
|
||||
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
|
||||
@ -5267,7 +5557,7 @@ class ClientController extends AdminController
|
||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '978']);
|
||||
// $res = $empServiceController->employeeDisembark(['file_id' => '1681']);
|
||||
// $res = $empServiceController->employeesCorrectionProcess(['file_id' => '2033']);
|
||||
// dd( $res);
|
||||
dd( $res);
|
||||
|
||||
$EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController();
|
||||
// $res = $EmployeeMultiEventServiceController->constructMultiEventData(['file_id' => '1069']);
|
||||
|
||||
@ -2020,7 +2020,16 @@ class EmpDataServiceController extends BaseController
|
||||
// dd($emp_endorsement_table_data, $enrollment_file_id, $no_of_insured, $no_of_dependent);
|
||||
|
||||
//update the employee policy data (TPAID or UHID)
|
||||
$return = $this->employeePolicyModel->bulkUpdate($emp_details);
|
||||
if(!empty($emp_details)){
|
||||
$return = $this->employeePolicyModel->bulkUpdate($emp_details);
|
||||
}else{
|
||||
$this->batchFileModel->update($file_id, [
|
||||
'count' => 0,
|
||||
'status' => "failed-6",
|
||||
'amount' => 0,
|
||||
]);
|
||||
return ['status' => 'error', 'message' => 'There is no data to update']; // Return error code
|
||||
}
|
||||
|
||||
if(in_array($file['event_type'], ['addition', 'dependent_addition']) && !empty($emp_endorsement_table_data)){
|
||||
$this->employeePolicyModel->updateEmpEndorsementAddition($emp_endorsement_table_data);
|
||||
@ -2048,7 +2057,6 @@ class EmpDataServiceController extends BaseController
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
}
|
||||
|
||||
|
||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- set cashDepositCalculationForInception and sendMailForDownloadingECard in JOB QUEUE');
|
||||
|
||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||
|
||||
@ -134,12 +134,25 @@ class EmployeeRestController extends AdminController
|
||||
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||
if ($emp_code) {
|
||||
$relationship = 'self';
|
||||
$employee = $this->employeeModel->where('emp_code', $emp_code)
|
||||
->where('client_id', $client_id)
|
||||
->where('client_branch_id', $client_branch_id)
|
||||
->where('is_active', 1 )
|
||||
->where('relationship', $relationship)
|
||||
->first();
|
||||
// $employee = $this->employeeModel->where('emp_code', $emp_code)
|
||||
// ->where('client_id', $client_id)
|
||||
// ->where('client_branch_id', $client_branch_id)
|
||||
// ->where('is_active', 1 )
|
||||
// ->where('relationship', $relationship)
|
||||
// ->first();
|
||||
$employee = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.client_branch_id', $client_branch_id)
|
||||
->where('employees.is_active', 1 )
|
||||
->where('employees.relationship', $relationship)
|
||||
->where('employee_polices.status', ['active'])
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.emp_status', ['active'])
|
||||
->first();
|
||||
|
||||
if (null !== $this->request->getGet('client_policy_id'))
|
||||
{
|
||||
$date_coverage = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$this->request->getGet('client_policy_id'))->get()->getRow()->date_coverage;
|
||||
|
||||
@ -1550,6 +1550,14 @@ class MasterController extends AdminController
|
||||
$date = (string) $this->request->getPost('opening_date');
|
||||
$data['opening_date'] = date('Y-m-d', strtotime($date));
|
||||
|
||||
$insurer_id = null;
|
||||
$insurer_branch_id = null;
|
||||
if(isset($data['insurer_and_insurer_branch']) && !empty($data['insurer_and_insurer_branch'])){
|
||||
list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer_and_insurer_branch']);
|
||||
}
|
||||
|
||||
$data['insurer_branch_id'] = $insurer_branch_id;
|
||||
|
||||
|
||||
// array with data for CD Traction table
|
||||
$cd_tranction_data = [
|
||||
@ -1578,7 +1586,16 @@ class MasterController extends AdminController
|
||||
|
||||
$cd_data = $this->CDMasterModel->where('client_id', $data['client_id'])->where('insurer_id', $data['insurer_id'])->findAll();
|
||||
|
||||
return $this->respond(['status' => true, 'data' => $cd_data, 'cd_ac_no'=>$data['cd_ac_no'], 'message' => 'CD Account number created successfully', "FOR BDS PURPOSE"], 200);
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'cd_ac_pk' => $insert,
|
||||
'data' => $cd_data,
|
||||
'received_data' => $data,
|
||||
'cd_ac_no'=>$data['cd_ac_no'],
|
||||
'message' => 'CD Account number created successfully',
|
||||
"FOR BDS PURPOSE"
|
||||
], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to created CD Account number'], 200);
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ use App\Models\BdsPlacementModel;
|
||||
use Kint\Kint;
|
||||
use App\Helpers\MailHelper;
|
||||
use App\Helpers\ExcelSanitizeHelper;
|
||||
use App\Models\NhanceBranchModel;
|
||||
use Exception;
|
||||
|
||||
class PolicyTransactionController extends BaseController
|
||||
@ -69,6 +70,7 @@ class PolicyTransactionController extends BaseController
|
||||
protected $filesModel;
|
||||
protected $coShareStmtDetailsModel;
|
||||
protected $BdsPlacementModel;
|
||||
protected $nhanceBranchModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -100,6 +102,7 @@ class PolicyTransactionController extends BaseController
|
||||
$this->filesModel = new FileModel();
|
||||
$this->coShareStmtDetailsModel = new COShareStmtDetailsModel();
|
||||
$this->BdsPlacementModel = new BdsPlacementModel();
|
||||
$this->nhanceBranchModel = new NhanceBranchModel();
|
||||
$this->invoiceStatus = [
|
||||
'pending' => 'Pending',
|
||||
'generated' => 'Generated',
|
||||
@ -115,6 +118,7 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
// Static arrays for dropdowns
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
$data['issuing_type'] = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
|
||||
$data['policy_status'] = [
|
||||
@ -255,6 +259,7 @@ class PolicyTransactionController extends BaseController
|
||||
$id = $this->request->getPost('id');
|
||||
$data = $this->preparePolicyData();
|
||||
$data['cd_ac_pk'] = $this->request->getPost('cd_ac_no');
|
||||
$data['issuer'] = 2;
|
||||
$this->myLogger->logme('error', 'Policy Trancaction modified form data ( insert data ) : '. json_encode($data));
|
||||
|
||||
|
||||
@ -334,11 +339,8 @@ class PolicyTransactionController extends BaseController
|
||||
$data['policy_with_corr'] = 1;
|
||||
}
|
||||
|
||||
if (!isset($data['is_cd_reduce_from_bds'])) {
|
||||
$data['is_cd_reduce_from_bds'] = 0;
|
||||
} elseif ($data['is_cd_reduce_from_bds']) {
|
||||
$data['is_cd_reduce_from_bds'] = 1;
|
||||
}
|
||||
$data['is_cd_reduce_from_bds'] = ($data['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0;
|
||||
|
||||
|
||||
if ($data['ct_type'] == "") {
|
||||
$data['ct_type'] = 1;
|
||||
@ -400,6 +402,8 @@ class PolicyTransactionController extends BaseController
|
||||
private function updateInceptionPolicy($id, $data)
|
||||
{
|
||||
// print_r($data); die;
|
||||
$old_pt_data = $this->policyTransactionModel->where('is_active', 1)->where("id", $id)->first();
|
||||
$old_pt_co_share_data = $this->PTCOShareDetailsModel->where('is_active', 1)->where("id", $id)->first();
|
||||
if ($this->policyTransactionModel->update($id, $data)) {
|
||||
|
||||
$this->insertTransactionStatus($id, $data, 1);
|
||||
@ -427,15 +431,22 @@ class PolicyTransactionController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
|
||||
if ($data['client_type'] == 1 && $data['is_cd_reduce_from_bds'] == 1) {
|
||||
$this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']);
|
||||
if($old_pt_data['status'] != "completed"){
|
||||
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
|
||||
if ($data['client_type'] == 1 && $data['is_cd_reduce_from_bds'] == 1) {
|
||||
$this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll();
|
||||
}
|
||||
|
||||
if(isset($data['cd_amt_changed']) && !empty($data['cd_amt_changed'])){
|
||||
$policy_data = $this->policyTransactionModel->where('is_active', 1)->where('id', $id)->first();
|
||||
$this->cdCorrection($policy_data, $data['cd_amt_changed']);
|
||||
}
|
||||
|
||||
$client_data = $this->clientModel->where('id', $data['client_id'])->first();
|
||||
$data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll();
|
||||
|
||||
@ -621,6 +632,30 @@ class PolicyTransactionController extends BaseController
|
||||
DepositHelper::saveDeposit($cdTransactionData, get_session_userid());
|
||||
}
|
||||
|
||||
private function cdCorrection($data, $amt)
|
||||
{
|
||||
$totalAmount = (int)($amt ?? 0);
|
||||
$description = 'The following amount of Rs. ' . $totalAmount . '/- has been debited towards the difference arising from the change in the BDS base premium.';
|
||||
|
||||
$cdTransactionData = [
|
||||
'amount' => abs($totalAmount),
|
||||
'sub_type_id' => 4,
|
||||
'client_id' => $data['client_id'],
|
||||
'client_policy_id' => $data['client_policy_id'] ?? 0,
|
||||
'endorsement_no' => null,
|
||||
'cd_ac_no' => $data['cd_ac_no'] ?? null,
|
||||
'insurer_id' => $data['insurer_id'],
|
||||
'description' => $description,
|
||||
'transaction_type' => $totalAmount < 0 ? 'Credit' : 'Debit',
|
||||
'updated_by' => get_session_userid(),
|
||||
'event_name' => 'inception',
|
||||
'is_active' => 1,
|
||||
'cd_ac_pk' => $data['cd_ac_pk']
|
||||
];
|
||||
|
||||
DepositHelper::saveDeposit($cdTransactionData, get_session_userid());
|
||||
}
|
||||
|
||||
private function processInsertIndividualMemberInEmpTable($data)
|
||||
{
|
||||
// print_r($data);
|
||||
@ -753,31 +788,6 @@ class PolicyTransactionController extends BaseController
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->first();
|
||||
|
||||
// $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_issue_date']))
|
||||
// : null;
|
||||
|
||||
// $data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_start_date']))
|
||||
// : null;
|
||||
|
||||
// $data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_end_date']))
|
||||
// : null;
|
||||
|
||||
// $data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['renewal_date']))
|
||||
// : null;
|
||||
|
||||
// $data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['rollover_date']))
|
||||
// : null;
|
||||
|
||||
// $data['month'] = (isset($data['month']) && $data['month'] !== null && $data['month'] !== '')
|
||||
// ? date('M/Y', strtotime($data['month']))
|
||||
// : null;
|
||||
|
||||
|
||||
$data['created_at'] = (isset($data['created_at']) && $data['created_at'] !== null && $data['created_at'] !== '')
|
||||
? date('d/m/Y h:i:s A', strtotime($data['created_at']))
|
||||
: null;
|
||||
@ -821,8 +831,6 @@ class PolicyTransactionController extends BaseController
|
||||
$data['month'] = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// print_r($data); die;
|
||||
|
||||
$data['renewal_policy'] = $this->clientPolicyModel
|
||||
@ -833,7 +841,6 @@ class PolicyTransactionController extends BaseController
|
||||
->where('client_policy.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
|
||||
$data['base_policy_data'] = $this->clientPolicyModel
|
||||
->select('client_policy.*, policy_type.policy_type')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
@ -843,6 +850,16 @@ class PolicyTransactionController extends BaseController
|
||||
->where('client_policy.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$pt_bp_amt = $this->PTCOShareDetailsModel
|
||||
->select('bp_amt, amount')
|
||||
->where('pt_id', $id)
|
||||
->where('co_share_type', 1)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
// dd(db_connect()->getLastQuery() ,$pt_bp_amt);
|
||||
$data['base_cd_amount'] = $pt_bp_amt['amount'] ?? null;
|
||||
|
||||
|
||||
$ptFileQuery = $this->PTFileModel
|
||||
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
|
||||
@ -999,7 +1016,7 @@ class PolicyTransactionController extends BaseController
|
||||
->findAll();
|
||||
|
||||
// print_r( $data['pt_co_share_details']); die;
|
||||
|
||||
// return $data;
|
||||
if ($data) {
|
||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||
} else {
|
||||
@ -1059,8 +1076,8 @@ class PolicyTransactionController extends BaseController
|
||||
// !dd($this->getEndorsementDataForEdit(17));
|
||||
|
||||
$data['page_name'] = 'Endorsement';
|
||||
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
|
||||
$data['policy_status'] = [
|
||||
@ -1170,11 +1187,14 @@ class PolicyTransactionController extends BaseController
|
||||
$data['policy_with_corr'] = 1;
|
||||
}
|
||||
|
||||
if (!isset($data['is_cd_reduce_from_bds'])) {
|
||||
$data['is_cd_reduce_from_bds'] = 0;
|
||||
} elseif ($data['is_cd_reduce_from_bds']) {
|
||||
$data['is_cd_reduce_from_bds'] = 1;
|
||||
}
|
||||
// if (!isset($data['is_cd_reduce_from_bds'])) {
|
||||
// $data['is_cd_reduce_from_bds'] = 0;
|
||||
// } elseif ($data['is_cd_reduce_from_bds']) {
|
||||
// $data['is_cd_reduce_from_bds'] = 1;
|
||||
// }
|
||||
|
||||
$data['is_cd_reduce_from_bds'] = ($data['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0;
|
||||
|
||||
|
||||
if (empty($data['data_received_date'])) {
|
||||
$data['data_received_date'] = null;
|
||||
@ -1242,7 +1262,8 @@ class PolicyTransactionController extends BaseController
|
||||
if (!$data['id']) {
|
||||
|
||||
$data += [
|
||||
'issuer' => $issue_type['issuer'] ?? null,
|
||||
'issuer' => 2,
|
||||
'issuer_branch' => $data['issuer_branch'] ?? 1,
|
||||
'client_type' => $data['client_type'] ?? $issue_type['client_type'] ?? null,
|
||||
'policy_type_id' => $issue_type['policy_type_id'] ?? null,
|
||||
'issue_type' => $issue_type['issue_type'] ?? null,
|
||||
|
||||
@ -4,6 +4,7 @@ namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\InsurerBranchModel;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
use Dompdf\Dompdf;
|
||||
@ -236,4 +237,80 @@ class TestingController extends BaseController
|
||||
->findAll();
|
||||
|
||||
}
|
||||
|
||||
public function ptedfitdata($id){
|
||||
$policy_transaction = new PolicyTransactionController();
|
||||
$data = $policy_transaction->getInceptionDataForEdit($id);
|
||||
// dd($data);
|
||||
$insurerBranchModel = new InsurerBranchModel();
|
||||
$insurer_branch = $insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
|
||||
$dataArray = $data['pt_co_share_details']; // Example
|
||||
$cd_ac_pk = 'CD12345';
|
||||
$role_id = 1;
|
||||
$team_id = ['6'];
|
||||
$insurer_branch = $insurer_branch;
|
||||
|
||||
return view('pt_calc_table', [
|
||||
'dataArray' => $dataArray,
|
||||
'cd_ac_pk' => $cd_ac_pk,
|
||||
'role_id' => $role_id,
|
||||
'team_id' => $team_id,
|
||||
'insurer_branch' => $insurer_branch
|
||||
]);
|
||||
}
|
||||
|
||||
function generateInsurerTable($dataArray, $cd_ac_pk, $role_id, $team_id, $insurer_branch)
|
||||
{
|
||||
$html = '<table id="insurerTable" class="table table-bordered"><tbody>';
|
||||
|
||||
foreach ($dataArray as $index => $data) {
|
||||
$disable_td = ($data['record_count'] > 0) ? 'readonly-select' : '';
|
||||
$insurer = $data['insurer_branch_id'] . '-' . $data['insurer_id'];
|
||||
|
||||
$html .= '<tr id="table_tr_' . ($index + 1) . '">';
|
||||
|
||||
// Insurer selection
|
||||
$html .= '<td><select class="form-control follow_insurer ' . $disable_td . '" name="follow_insurer_id[]">';
|
||||
$html .= '<option value="">Select Insurer</option>';
|
||||
foreach ($insurer_branch as $value) {
|
||||
$selected = ($insurer == ($value['id'] . '-' . $value['insurer_id'])) ? 'selected' : '';
|
||||
$html .= '<option value="' . $value['id'] . '-' . $value['insurer_id'] . '" ' . $selected . '>'
|
||||
. $value['insurer_name'] . '-' . $value['branch_code'] . '</option>';
|
||||
}
|
||||
$html .= '</select></td>';
|
||||
|
||||
// Leader toggle
|
||||
$checked = ($data['co_share_type'] == 1) ? 'checked' : '';
|
||||
$html .= '<td><input type="checkbox" class="' . $disable_td . '" name="co_share_type[]" ' . $checked . '></td>';
|
||||
|
||||
// CD Account
|
||||
$html .= '<td><select class="form-control follow_insurer_cd ' . $disable_td . '" name="cd_ac_no_for_child[]">';
|
||||
$html .= '<option value="">Select CD No</option>';
|
||||
$html .= '<option value="add_cd">+ Add CD No</option>';
|
||||
if ($cd_ac_pk) {
|
||||
$html .= '<option value="' . $cd_ac_pk . '" selected>' . $cd_ac_pk . '</option>';
|
||||
}
|
||||
$html .= '</select></td>';
|
||||
|
||||
// CD Amount
|
||||
$html .= '<td><input type="text" readonly value="' . htmlspecialchars($data['cd_amount'] ?? '') . '"></td>';
|
||||
|
||||
// Example of follower policy no
|
||||
$html .= '<td><input type="text" class="' . $disable_td . '" value="' . htmlspecialchars($data['follower_policy_no']) . '"></td>';
|
||||
|
||||
// Add other fields (bp_amt, tp_amt, gst, etc.)
|
||||
$html .= '<td><input type="text" class="' . $disable_td . '" value="' . htmlspecialchars($data['bp_amt']) . '"></td>';
|
||||
$html .= '<td><input type="text" class="' . $disable_td . '" value="' . htmlspecialchars($data['tp_amt']) . '"></td>';
|
||||
$html .= '<td><input type="text" class="' . $disable_td . '" value="' . htmlspecialchars($data['tep_amt']) . '"></td>';
|
||||
$html .= '<td><input type="hidden" name="co_share_id[]" value="' . htmlspecialchars($data['id']) . '"></td>';
|
||||
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
$html .= '</tbody></table>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -305,10 +305,12 @@ if (!function_exists('check_si')) {
|
||||
|
||||
if (!function_exists('check_basic_pay')) {
|
||||
function check_basic_pay($row, $policy_terms, $slab_details)
|
||||
{
|
||||
{
|
||||
// dd($row, $policy_terms, $slab_details);
|
||||
if ($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I', 'A', 'DA', 'MI'])) // check rule only of action column data available
|
||||
{
|
||||
$is_basic_pay_needed = $slab_details['grid_master']['basicpay'];
|
||||
// $is_basic_pay_needed = $slab_details['grid_master']['basicpay'];
|
||||
$is_basic_pay_needed = ($slab_details['grid_master']['basicpay'] == 1 && $slab_details['slab_rates'][0]['si_or_bp'] == 2 && $slab_details['slab_rates'][0]['basic_pay'] != null) ? 1 : 0;
|
||||
// $is_basic_pay_needed = true;
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
|
||||
51
app/Models/NhanceBranchModel.php
Normal file
51
app/Models/NhanceBranchModel.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class NhanceBranchModel extends Model
|
||||
{
|
||||
protected $table = 'nhance_branch';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"branch_name",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -15,6 +15,7 @@ class PolicyTransactionModel extends Model
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'issuer',
|
||||
'issuer_branch',
|
||||
'client_id',
|
||||
'client_branch_id',
|
||||
'insurer_id',
|
||||
|
||||
@ -128,7 +128,12 @@
|
||||
<?php } else if ($file['status'] == 'failed-5') { ?>
|
||||
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="Wrong File Uploaded"></a>
|
||||
data-placement="top" title="Wrong File Uploaded"></a>
|
||||
|
||||
<?php } else if ($file['status'] == 'failed-6') { ?>
|
||||
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="There is no data to update"></a>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
|
||||
@ -302,23 +302,23 @@
|
||||
<input id="install_due_date" type="text" class="form-control" name="install_due_date" placeholder="DD/MM/YYYY">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label class="switch" style="position: relative;top: 32px;left: 20px;">
|
||||
<input id="policy_with_corr" type="checkbox" name="policy_with_corr">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="policy_with_corr" style="position: relative;top: 33px;left: 25px;"> Policy with Correction</label>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label class="switch" style="position: relative;top: 32px;left: 20px;">
|
||||
<input id="is_cd_reduce_from_bds" type="checkbox" name="is_cd_reduce_from_bds">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;">Make Entry in CD <i class="mdi mdi-information-outline" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i></label>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
@ -370,6 +370,7 @@
|
||||
<tr id="table_tr_34">
|
||||
<td>CD Amount</td>
|
||||
</tr>
|
||||
|
||||
<tr id="table_tr_35">
|
||||
<td>Follower Policy No</td>
|
||||
</tr>
|
||||
@ -505,7 +506,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group text-right m-b-0" id="submitButton">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -701,7 +701,7 @@ function show_list_hide_add()
|
||||
count = 0
|
||||
}
|
||||
|
||||
function getClientAndBranchAndPolicy()
|
||||
function getClientAndBranchAndPolicy(appendStatus = true)
|
||||
{
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||
@ -710,15 +710,21 @@ function getClientAndBranchAndPolicy()
|
||||
success: function(res) {
|
||||
|
||||
console.log('getClientAndBranchAndPolicy', res);
|
||||
|
||||
if(res.status == true){
|
||||
|
||||
client_list = res.client_data;
|
||||
branch_list = res.branch_data;
|
||||
policy_list = res.policy_data;
|
||||
vehicle_list = res.vehicle_data;
|
||||
unit_list = res.unit_data;
|
||||
appendClients(res.client_data);
|
||||
appendVehicles(res.vehicle_data);
|
||||
appendOwner(client_list)
|
||||
|
||||
if(appendStatus == true){
|
||||
appendClients(res.client_data);
|
||||
appendVehicles(res.vehicle_data);
|
||||
// appendOwner(client_list)
|
||||
}
|
||||
|
||||
}else{
|
||||
console.log('No data found');
|
||||
}
|
||||
@ -731,7 +737,7 @@ function getClientAndBranchAndPolicy()
|
||||
});
|
||||
}
|
||||
|
||||
function appendClients(data)
|
||||
function appendClients(data, client_id = null)
|
||||
{
|
||||
$('#client_id').empty();
|
||||
|
||||
@ -761,11 +767,15 @@ function appendClients(data)
|
||||
class: item.client_type == 1 ? 'group' : item.client_type == 2 ? 'individual' : ''
|
||||
});
|
||||
|
||||
if (client_id == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
|
||||
$('#client_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
function appendVehicles(data, vehicle_id)
|
||||
function appendVehicles(data, vehicle_id = null)
|
||||
{
|
||||
$('#vehicle_no').empty();
|
||||
|
||||
@ -794,7 +804,7 @@ function appendVehicles(data, vehicle_id)
|
||||
});
|
||||
}
|
||||
|
||||
function appendBranch(data)
|
||||
function appendBranch(data, branch_id = null)
|
||||
{
|
||||
|
||||
$('#client_branch_id').empty();
|
||||
@ -810,6 +820,11 @@ function appendBranch(data)
|
||||
value: item.id,
|
||||
text: item.branch_name
|
||||
});
|
||||
|
||||
if (branch_id == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
|
||||
$('#client_branch_id').append(option);
|
||||
});
|
||||
}
|
||||
@ -1225,24 +1240,39 @@ $(document).ready(function(){
|
||||
|
||||
$('#policy_holder_name').val(client_name);
|
||||
|
||||
let status = $('#policy_status').val();
|
||||
|
||||
if(client_id == 'add_client') {
|
||||
|
||||
if($('#client_type').val()){
|
||||
$('#client_id').val('').change();
|
||||
// if($('#client_type').val()){
|
||||
// $('#client_id').val('').change();
|
||||
|
||||
if($('#client_type').val() == 2){
|
||||
$('#short_name').closest('.form-group').hide();
|
||||
$('#short_name').removeAttr('required');
|
||||
} else {
|
||||
$('#short_name').closest('.form-group').show();
|
||||
$('#short_name').attr('required', 'required');
|
||||
}
|
||||
// if($('#client_type').val() == 2){
|
||||
// $('#short_name').closest('.form-group').hide();
|
||||
// $('#short_name').removeAttr('required');
|
||||
// } else {
|
||||
// $('#short_name').closest('.form-group').show();
|
||||
// $('#short_name').attr('required', 'required');
|
||||
// }
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||||
myModal.show();
|
||||
}else{
|
||||
$('#client_id').val('').change();
|
||||
toastr.warning('Please select the client type', 'WARNING')
|
||||
// var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||||
// myModal.show();
|
||||
// }else{
|
||||
// $('#client_id').val('').change();
|
||||
// toastr.warning('Please select the client type', 'WARNING')
|
||||
// }
|
||||
appendClientForm();
|
||||
|
||||
$(this).val('').select2();
|
||||
$('#pre_sales_row').hide();
|
||||
$('#sales_row').hide();
|
||||
$('#submitButton').hide();
|
||||
|
||||
}else{
|
||||
$('#pre_sales_row').show();
|
||||
$('#submitButton').show();
|
||||
if(status == "completed"){
|
||||
$('#sales_row').show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user