Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
fa16f9f743
@ -102,6 +102,7 @@ define('CLAIMS_TEAM_ID', '2');
|
||||
define('BUSINESS_TEAM_ID', '3');
|
||||
define('FINANCE_TEAM_ID', '4');
|
||||
define('SALES_TEAM_ID', '5');
|
||||
define('MANAGEMENT_TEAM_ID', '6');
|
||||
|
||||
/**
|
||||
* @User Teams Constant
|
||||
|
||||
@ -12,7 +12,7 @@ $routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||
// Reminder Mail Notification
|
||||
|
||||
$routes->get("reminder_mail", "NotificationController::reminder_mail");
|
||||
// $routes->get("testing", "ClientController::Testing");
|
||||
$routes->get("getClientData", "ClientController::getClientData");
|
||||
$routes->get("testing_for_review_mail/(:any)", "ClientController::testingForReviewMail/$1");
|
||||
$routes->get("update-policy-terms-for-corrections", "ClientController::updatePolicyTermsForCorrections");
|
||||
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
|
||||
@ -48,7 +48,6 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("rolesandteams", "UserController::getRolesAndTeams");
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("view", "DashboardController::dashboard");
|
||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||
@ -56,33 +55,21 @@ $routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->get("list", "ClientController::index");
|
||||
$routes->get("create", "ClientController::clientOnboarding");
|
||||
$routes->get('deposit/(:num)', 'ClientController::deposit/$1');
|
||||
$routes->get('remove/(:num)', 'ClientController::removeClient/$1');
|
||||
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
||||
// application/config/routes.php
|
||||
|
||||
// Add a route for the view_Deposit method
|
||||
$routes->get('view_deposit/(:num)', 'ClientController::view_Deposit/$1');
|
||||
$routes->get('createtransaction', 'ClientController::createtransaction');
|
||||
|
||||
$routes->post('save_deposit', 'ClientController::saveDeposit');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// $routes->get('view_Deposit/(:num)/(:num)','ClientController/view_Deposit/$1/$2');
|
||||
|
||||
|
||||
|
||||
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
||||
|
||||
|
||||
$routes->group("notification", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "NotificationController::createNotification");
|
||||
$routes->post("update_enable", "NotificationController::update_enable");
|
||||
@ -141,7 +128,6 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("list", "EmployeeController::list");
|
||||
$routes->get("search", "EmployeeController::search");
|
||||
@ -156,13 +142,10 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
|
||||
$routes->group("insurer", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
|
||||
$routes->get("list", "MasterController::insurerList");
|
||||
$routes->get("remove/(:any)", "MasterController::insurerRemove/$1");
|
||||
$routes->get("create", "MasterController::insurerOnboarding");
|
||||
@ -197,6 +180,7 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
});
|
||||
|
||||
$routes->group("kyc", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->get("list", "MasterController::kycList");
|
||||
$routes->get("create", "MasterController::kycOnboarding");
|
||||
$routes->post("createpost", "MasterController::createKYCInfo");
|
||||
@ -205,7 +189,6 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("remove/(:any)", "MasterController::kycRemove/$1");
|
||||
$routes->get("delete/(:any)", "MasterController::deleteClientKycDocs/$1");
|
||||
|
||||
|
||||
$routes->group("kycdocs", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("createpost", "MasterController::createKycDocs");
|
||||
$routes->get("editget/(:any)", "MasterController::editKYCGet/$1");
|
||||
@ -217,6 +200,7 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
});
|
||||
|
||||
$routes->group("policy", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->get("list", "MasterController::policyTypeList");
|
||||
$routes->get("create", "MasterController::policyTypeOnboarding");
|
||||
$routes->post("createpost", "MasterController::createPolicyType");
|
||||
@ -224,7 +208,6 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("list/(:any)", "MasterController::editPolicyTypeOnboarding/$1");
|
||||
$routes->get("remove/(:any)", "MasterController::policyTypeRemove/$1");
|
||||
|
||||
|
||||
$routes->group("policies", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("createpost", "MasterController::createPolicies");
|
||||
$routes->get("editget/(:any)", "MasterController::editPoliciesGet/$1");
|
||||
@ -250,7 +233,6 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("clients-with-policies", "EmployeeController::getClientWithPolicies");
|
||||
$routes->get("police-by-insurer/(:any)", "ClientController::getPolicesByInsurerId/$1");
|
||||
@ -316,10 +298,10 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("sentTestMail/(:any)", "NotificationController::sentTestMail/$1");
|
||||
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
||||
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
||||
$routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
|
||||
|
||||
});
|
||||
|
||||
|
||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->group("inception", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -341,6 +323,7 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("report-varience-list", "PolicyTransactionController::reportVarience");
|
||||
$routes->get("report-business-list", "PolicyTransactionController::reportBusinessList");
|
||||
$routes->get("report-finance-list", "PolicyTransactionController::reportFinanceList");
|
||||
$routes->get("report-outstanding-list", "PolicyTransactionController::reportOutstanding");
|
||||
});
|
||||
|
||||
$routes->group("statement", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -355,6 +338,13 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
});
|
||||
|
||||
$routes->group("leads", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->get("list", "LeadsController::viewLeadsList");
|
||||
$routes->post("create", "LeadsController::createLead");
|
||||
$routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
|
||||
});
|
||||
|
||||
$routes->get("driveListFiles", "GoogleDriveController::listFiles");
|
||||
$routes->post('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
||||
$routes->get('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
||||
@ -370,7 +360,6 @@ $routes->cli('cli/app_check_list', 'MasterController::appCheckList');
|
||||
$routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken');
|
||||
|
||||
|
||||
|
||||
//Employee login api's
|
||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
|
||||
@ -207,7 +207,7 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme("info", $mail_send_return2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
$this->myLogger->logme("error", 'Client HR Mail Configuration not Enable for this client');
|
||||
}
|
||||
@ -3458,7 +3458,12 @@ class ClientController extends AdminController
|
||||
public function get_client_policy_data_using_policy_no($policy_no)
|
||||
{
|
||||
$data = $this->clientPolicyModel
|
||||
->select('client_policy.*, clients.client_type')
|
||||
->select("
|
||||
client_policy.*,
|
||||
clients.client_type,
|
||||
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')
|
||||
->where('client_policy.policy_no', $policy_no)
|
||||
->where('client_policy.is_active', 1)
|
||||
@ -3487,4 +3492,27 @@ class ClientController extends AdminController
|
||||
return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function get_client_branch_data($id = null)
|
||||
{
|
||||
if ($id) {
|
||||
$branch_data = $this->clientBranchModel
|
||||
->select('client_branch.*, clients.pan')
|
||||
->join('clients', 'client_branch.client_id = clients.id')
|
||||
->where(['client_branch.id' => $id, 'client_branch.is_active' => 1])
|
||||
->first();
|
||||
$branch_contact_data = $this->levelContactModel->where(['ref_id' => $id, 'contact_type' => 'client', 'is_active' => 1])->orderBy('id','asc')->first();
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $branch_data, 'contact' => $branch_contact_data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function getClientData()
|
||||
{
|
||||
$client_id = $this->request->getGet('client_id') ?? null;
|
||||
$result = $this->clientModel->getClientData($client_id);
|
||||
dd($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,6 +32,8 @@ class DashboardController extends AdminController
|
||||
protected $notificationModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $policyTransactionModel;
|
||||
protected $policyStatus;
|
||||
protected $colorShades;
|
||||
|
||||
protected $myLogger;
|
||||
|
||||
@ -48,6 +50,48 @@ class DashboardController extends AdminController
|
||||
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
$this->policyStatus = [
|
||||
'under_process' => 'Under Process',
|
||||
'client_pending' => 'Client Pending',
|
||||
'insurer_pending' => 'Insurer Pending',
|
||||
'co_insurer_pending' => 'Co-Insurer Pending',
|
||||
'tpa_pending' => 'TPA Pending',
|
||||
'validated' => 'Validated',
|
||||
'cancelled' => 'Cancelled',
|
||||
'instalment_pending' => 'Instalment Pending',
|
||||
'completed' => 'Completed',
|
||||
];
|
||||
|
||||
$this->colorShades = [
|
||||
|
||||
[
|
||||
'linear-gradient(45deg, #66e9eb, #5cc7d2)', // Lighter shade 1
|
||||
'linear-gradient(45deg, #4ce2e5, #45bcc9)', // Lighter shade 2
|
||||
'linear-gradient(45deg, #33dbe0, #2baebd)', // Original shade (slightly lighter)
|
||||
'linear-gradient(45deg, #00d6db, #00a8b5)', // Original
|
||||
'linear-gradient(45deg, #00bfc4, #00929f)', // Darker shade 1
|
||||
'linear-gradient(45deg, #009ea1, #00767a)' // Darker shade 2
|
||||
],
|
||||
// Shades for Grenadier
|
||||
[
|
||||
'linear-gradient(45deg, #ff9d37, #ff7a10)', // Grenadier shade 1
|
||||
'linear-gradient(45deg, #ff8b30, #ff7310)', // Grenadier shade 2
|
||||
'linear-gradient(45deg, #ff8020, #ff5a00)', // Grenadier shade 3
|
||||
'linear-gradient(45deg, #f06d15, #e05505)', // Grenadier shade 4
|
||||
'linear-gradient(45deg, #d85f10, #c04805)', // Grenadier shade 5
|
||||
'linear-gradient(45deg, #b85606, #a04605)' // Grenadier shade 6
|
||||
],
|
||||
// Shades for SilverChalice
|
||||
[
|
||||
'linear-gradient(45deg, #a3a8a8, #8f9494)', // SilverChalice shade 1
|
||||
'linear-gradient(45deg, #989d9d, #848989)', // SilverChalice shade 2
|
||||
'linear-gradient(45deg, #7e8484, #686e6e)', // SilverChalice shade 3
|
||||
'linear-gradient(45deg, #6c7676, #545e5e)', // SilverChalice shade 4
|
||||
'linear-gradient(45deg, #5c6363, #434949)', // SilverChalice shade 5
|
||||
'linear-gradient(45deg, #494f4f, #353d3d)' // SilverChalice shade 6
|
||||
]
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
@ -70,7 +114,9 @@ class DashboardController extends AdminController
|
||||
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
||||
$businessTeamData = $this->policyTransactionModel->getBusinessReportList();
|
||||
$financeTeamData = $this->policyTransactionModel->getFinanceReportList();
|
||||
|
||||
$businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
|
||||
$financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
|
||||
|
||||
$groupedData = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
@ -163,6 +209,10 @@ class DashboardController extends AdminController
|
||||
$data['pendingActionsData'] = $pendingActionsData;
|
||||
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
||||
$data['financeTeamCount'] = count($financeTeamData) ?? 0;
|
||||
$data['businessTeamStatusData'] = $businessTeamStatusData;
|
||||
$data['financeTeamStatusData'] = $financeTeamStatusData;
|
||||
$data['policyStatus'] = $this->policyStatus;
|
||||
$data['colorShades'] = $this->colorShades;
|
||||
// print_r($data);die;
|
||||
|
||||
$data['page_name'] = 'Dashboard';
|
||||
@ -494,5 +544,54 @@ class DashboardController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function data_construct_for_bds($data){
|
||||
|
||||
$groupedData = [
|
||||
'under_process' => [],
|
||||
'client_pending' => [],
|
||||
'insurer_pending' => [],
|
||||
'co_insurer_pending' => [],
|
||||
'tpa_pending' => [],
|
||||
'validated' => [],
|
||||
'cancelled' => [],
|
||||
'instalment_pending' => [],
|
||||
'completed' => [],
|
||||
];
|
||||
|
||||
// Loop through results and group them by their status
|
||||
foreach ($data as $row) {
|
||||
switch ($row['status']) {
|
||||
case 'completed':
|
||||
$groupedData['completed'][] = $row;
|
||||
break;
|
||||
case 'cancelled':
|
||||
$groupedData['cancelled'][] = $row;
|
||||
break;
|
||||
case 'client_pending':
|
||||
$groupedData['client_pending'][] = $row;
|
||||
break;
|
||||
case 'insurer_pending':
|
||||
$groupedData['insurer_pending'][] = $row;
|
||||
break;
|
||||
case 'co_insurer_pending':
|
||||
$groupedData['co_insurer_pending'][] = $row;
|
||||
break;
|
||||
case 'tpa_pending':
|
||||
$groupedData['tpa_pending'][] = $row;
|
||||
break;
|
||||
case 'validated':
|
||||
$groupedData['validated'][] = $row;
|
||||
break;
|
||||
case 'instalment_pending':
|
||||
$groupedData['instalment_pending'][] = $row;
|
||||
break;
|
||||
default:
|
||||
$groupedData['under_process'][] = $row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $groupedData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -319,6 +319,7 @@ class EmpDataServiceController extends BaseController
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||
->where('client_policy.id', $export_data['client_policy_id'])
|
||||
->where('insurer_excel_export_template.event_name', $export_data['event_type'])
|
||||
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||
->first();
|
||||
|
||||
@ -530,6 +531,7 @@ class EmpDataServiceController extends BaseController
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||
->where('client_policy.id', $export_data['client_policy_id'])
|
||||
->where('insurer_excel_export_template.event_name', $export_data['event_type'])
|
||||
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||
->first();
|
||||
|
||||
@ -665,6 +667,7 @@ class EmpDataServiceController extends BaseController
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||
->where('client_policy.id', $export_data['client_policy_id'])
|
||||
->where('insurer_excel_export_template.event_name', $export_data['event_type'])
|
||||
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||
->first();
|
||||
|
||||
@ -776,6 +779,7 @@ class EmpDataServiceController extends BaseController
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||
->where('client_policy.id', $export_data['client_policy_id'])
|
||||
->where('insurer_excel_export_template.event_name', $export_data['event_type'])
|
||||
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||
->first();
|
||||
|
||||
@ -868,7 +872,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
}else if($value == 'inception'){
|
||||
$export_data['event_type'] = 'inception';
|
||||
$dependentAdditionData = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
|
||||
$inceptionData = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data); //Live issue changes 17-10-2024
|
||||
|
||||
}else if($value == 'dependent_addition'){
|
||||
$export_data['event_type'] = 'dependent_addition';
|
||||
@ -943,12 +947,13 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
$template_json = $this->clientPolicyModel
|
||||
->select('insurer_excel_export_template.jsoncolumns')
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||
->where('client_policy.id', $export_data['client_policy_id'])
|
||||
->where('insurer_excel_export_template.event_name', 'all')
|
||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||
->first();
|
||||
->select('insurer_excel_export_template.jsoncolumns')
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||
->where('client_policy.id', $export_data['client_policy_id'])
|
||||
->where('insurer_excel_export_template.event_name', 'all')
|
||||
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||
->first();
|
||||
|
||||
|
||||
if(!empty($template_json) && $template_json != null){
|
||||
|
||||
@ -1619,9 +1619,17 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
$this->employeeModel->save($value);
|
||||
$emp_id = $this->employeeModel->getInsertID();
|
||||
if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
else{ $emp_id = $employee[0]['id']; }
|
||||
if (isset($value['id'])) {
|
||||
$emp_id = $value['id'];
|
||||
} else {
|
||||
$emp_id = $this->employeeModel->getInsertID();
|
||||
$log_message .= $emp_id;
|
||||
}
|
||||
|
||||
//commanded for last insert id is coming from buffer
|
||||
// $emp_id = $this->employeeModel->getInsertID();
|
||||
// if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
// else{ $emp_id = $employee[0]['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
@ -1647,7 +1655,14 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
$this->employeePolicyModel->save($policy_data);
|
||||
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||
if(isset($policy_data['id']))
|
||||
{
|
||||
$emp_policy_id = $policy_data['id'];
|
||||
}else
|
||||
{
|
||||
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||
}
|
||||
|
||||
if($emp_policy_id != 0)//emp policy inserted
|
||||
{
|
||||
$log_message .= ' with PK ' . $emp_policy_id;
|
||||
@ -1663,7 +1678,7 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
}
|
||||
else{ $emp_policy_id = $employee_policy[0]['id']; }
|
||||
// else{ $emp_policy_id = $employee_policy[0]['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
@ -2004,9 +2019,15 @@ public function employeesEnrollmentInsert($params)
|
||||
}
|
||||
|
||||
$this->employeeModel->save($value);
|
||||
$emp_id = $this->employeeModel->getInsertID();
|
||||
if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
else{ $emp_id = $employee['id']; }
|
||||
if (isset($value['id']))
|
||||
{ $emp_id = $value['id']; }
|
||||
else { $emp_id = $this->employeeModel->getInsertID();
|
||||
$log_message .= $emp_id;
|
||||
}
|
||||
|
||||
// $emp_id = $this->employeeModel->getInsertID();
|
||||
// if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
// else{ $emp_id = $employee['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
|
||||
299
app/Controllers/LeadsController.php
Normal file
299
app/Controllers/LeadsController.php
Normal file
@ -0,0 +1,299 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientBranchModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\LevelContactModel;
|
||||
use App\Models\LeadsModel;
|
||||
use App\Models\PolicyTypeModel;
|
||||
use App\Models\KYCEntityTypeModel;
|
||||
use App\Models\PolicyTransactionStatusModel;
|
||||
use App\Models\InsurerBranchModel;
|
||||
use App\Models\TPABranchModel;
|
||||
|
||||
class LeadsController extends BaseController
|
||||
{
|
||||
use ResponseTrait;
|
||||
|
||||
//log message
|
||||
protected $myLogger;
|
||||
|
||||
//models
|
||||
protected $clientModel;
|
||||
protected $userModel;
|
||||
protected $clientBranchModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $levelContactModel;
|
||||
protected $leadsModel;
|
||||
protected $policyTypeModel;
|
||||
protected $kycEntityTypeModel;
|
||||
protected $policyTransactionStatusModel;
|
||||
protected $insurerBranchModel;
|
||||
protected $tpaBranchModel;
|
||||
|
||||
//variables for storing array
|
||||
protected $issuer;
|
||||
protected $clientType;
|
||||
protected $leadType;
|
||||
protected $leadsStatus;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_session_context('Leads');
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->userModel = new UserModel();
|
||||
$this->clientBranchModel = new ClientBranchModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->levelContactModel = new LevelContactModel();
|
||||
$this->leadsModel = new LeadsModel();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
$this->kycEntityTypeModel = new KYCEntityTypeModel();
|
||||
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
||||
$this->insurerBranchModel = new InsurerBranchModel();
|
||||
$this->tpaBranchModel = new TPABranchModel();
|
||||
|
||||
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$this->clientType = [1 => 'Group', 2 => 'Individual'];
|
||||
$this->leadType = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
|
||||
$this->leadsStatus = [
|
||||
'queued' => 'Queued',
|
||||
'qcr_sent' => 'QCR sent',
|
||||
'lost' => 'Lost',
|
||||
'co_insurer_pending' => 'Co-Insurer Pending',
|
||||
'won' => 'Won',
|
||||
'completed_with_corrections' => 'Completed with Corrections',
|
||||
'completed_without_corrections' => 'Completed w/o Corrections',
|
||||
];
|
||||
}
|
||||
|
||||
public function viewLeadsList()
|
||||
{
|
||||
$data['page_name'] = 'Leads';
|
||||
|
||||
// Set basic data
|
||||
$data['issuer'] = $this->issuer;
|
||||
$data['client_type'] = $this->clientType;
|
||||
$data['lead_type'] = $this->leadType;
|
||||
$data['lead_status'] = $this->leadsStatus;
|
||||
|
||||
// Fetch policy types and entity data
|
||||
$data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
|
||||
$data['entity'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
|
||||
|
||||
// Fetch insurer and TPA branch data
|
||||
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
|
||||
// Fetch sales team members who are active in team 5
|
||||
$data['salse_team'] = $this->userModel
|
||||
->select('user_profiles.*')
|
||||
->join('user_teams', 'user_profiles.id = user_teams.user_id')
|
||||
->where('user_teams.team_id', 5)
|
||||
->where('user_teams.is_active', 1)
|
||||
->where('user_profiles.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
// dd($data);
|
||||
|
||||
// Fetch leads data
|
||||
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
|
||||
|
||||
// Load layout and pass data
|
||||
$this->loadLayout('leads_list', $data);
|
||||
}
|
||||
|
||||
public function createLead()
|
||||
{
|
||||
// print_r($this->request->getPost()); die;
|
||||
$id = $this->request->getPost('id');
|
||||
$data = $this->prepareLeadData();
|
||||
// print_r($this->request->getPost()); die;
|
||||
|
||||
|
||||
if (!$id) {
|
||||
return $this->insertNewLead($data);
|
||||
} else {
|
||||
return $this->updateOldLead($id, $data);
|
||||
}
|
||||
}
|
||||
|
||||
private function prepareLeadData()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
|
||||
if($data['lead_type'] == 2){
|
||||
$client_data = $this->clientModel->where('id', $data['client_id'])->where('is_active', 1)->first();
|
||||
$data['client_name'] = $client_data['client_name'];
|
||||
$data['client_short_name'] = $client_data['short_name'];
|
||||
$data['entity_type_id'] = $client_data['entity_type_id'];
|
||||
$data['client_type'] = $client_data['client_type'];
|
||||
}else{
|
||||
$data['client_id'] = 0;
|
||||
$data['client_branch_id'] = 0;
|
||||
$data['source_policy_id'] = 0;
|
||||
}
|
||||
|
||||
$data['client_code'] = generate_client_code();
|
||||
if($data['client_code'] == 2){
|
||||
$data['client_code'] = generate_client_code('IC');
|
||||
}
|
||||
|
||||
$data = $this->prepareMultipleLeadData($data);
|
||||
// print_r($data); die;
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function prepareMultipleLeadData($data)
|
||||
{
|
||||
$processedData = [];
|
||||
foreach($data['policy_type_id'] as $index => $value){
|
||||
|
||||
// Separate the insurer and insurer branch
|
||||
list($insurer_branch_id, $insurer_id) = explode('-',$data['insurer'][$index]);
|
||||
// Separate the tpa and tpa branch
|
||||
list($tpa_branch_id, $tpa_id) = explode('-',$data['tpa'][$index]);
|
||||
|
||||
// Separate the insurer and insurer branch, handle missing or invalid data
|
||||
if (isset($data['proposed_insurer'][$index]) && strpos($data['proposed_insurer'][$index], '-') !== false) {
|
||||
list($proposed_insurer_branch_id, $proposed_insurer_id) = explode('-', $data['proposed_insurer'][$index]);
|
||||
} else {
|
||||
$proposed_insurer_branch_id = 0;
|
||||
$proposed_insurer_id = 0;
|
||||
}
|
||||
|
||||
// Separate the TPA and TPA branch, handle missing or invalid data
|
||||
if (isset($data['proposed_tpa'][$index]) && strpos($data['proposed_tpa'][$index], '-') !== false) {
|
||||
list($proposed_tpa_branch_id, $proposed_tpa_id) = explode('-', $data['proposed_tpa'][$index]);
|
||||
} else {
|
||||
$proposed_tpa_branch_id = 0;
|
||||
$proposed_tpa_id = 0;
|
||||
}
|
||||
|
||||
if(!empty($data['policy_start_date'][$index])){
|
||||
$policy_start_date = change_date_format($data['policy_start_date'][$index], 'd/m/Y', 'Y-m-d');
|
||||
}else{
|
||||
$policy_start_date = null;
|
||||
}
|
||||
|
||||
if(!empty($data['policy_end_date'][$index])){
|
||||
$policy_end_date = change_date_format($data['policy_end_date'][$index], 'd/m/Y', 'Y-m-d');
|
||||
}else{
|
||||
$policy_end_date = null;
|
||||
}
|
||||
|
||||
$processedData[] = [
|
||||
'lead_type' => $data['lead_type'],
|
||||
'issuer' => $data['issuer'],
|
||||
'client_type' => $data['client_type'],
|
||||
'client_name' => $data['client_name'],
|
||||
'client_short_name' => $data['client_short_name'],
|
||||
'entity_type_id' => $data['entity_type_id'],
|
||||
'client_code' => $data['client_code'],
|
||||
'pan' => $data['pan'],
|
||||
'gst' => $data['gst'],
|
||||
'branch_name' => $data['branch_name'],
|
||||
'branch_code' => $data['branch_code'],
|
||||
'contact_person_name' => $data['contact_person_name'],
|
||||
'contact_person_mobile' => $data['contact_person_mobile'],
|
||||
'client_id' => $data['client_id'] ?? 0,
|
||||
'client_branch_id' => $data['client_branch_id'] ?? 0,
|
||||
'source_policy_id' => $data['source_policy_id'] ?? 0,
|
||||
'policy_type_id' => $value,
|
||||
'salse_person_id' => $data['salse_person_id'] ?? 0,
|
||||
|
||||
'insurer_id' => $insurer_id ?? 0,
|
||||
'insurer_branch_id' => $insurer_branch_id ?? 0,
|
||||
'tpa_id' => $tpa_id ?? 0,
|
||||
'tpa_branch_id' => $tpa_branch_id ?? 0,
|
||||
'policy_start_date' => $policy_start_date,
|
||||
'policy_end_date' => $policy_end_date,
|
||||
'no_of_lives' => $data['no_of_lives'][$index] ?? null,
|
||||
'claims' => $data['claims'][$index] ?? null,
|
||||
'location' => $data['location'][$index] ?? null,
|
||||
'proposed_insurer_id' => $proposed_insurer_id ?? 0,
|
||||
'proposed_insurer_branch_id' => $proposed_insurer_branch_id ?? 0,
|
||||
'proposed_tpa_id' => $proposed_tpa_id ?? 0,
|
||||
'proposed_tpa_branch_id' => $proposed_tpa_branch_id ?? 0,
|
||||
|
||||
'status' => $data['status'] ?? null,
|
||||
'notes' => $data['notes'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
return $processedData;
|
||||
}
|
||||
|
||||
private function insertNewLead($data)
|
||||
{
|
||||
$insertCount = [];
|
||||
foreach($data as $value){
|
||||
$insert = $this->leadsModel->insert($value);
|
||||
$insertCount[] = $insert;
|
||||
$this->insertLeadStatus($insert, $value['status'], 3);
|
||||
}
|
||||
|
||||
if (count($insertCount) > 0) {
|
||||
return $this->respond(['status' => true, 'lead_id' => $insert, 'message' => 'New Lead created successfully', 'data' =>$data], 200);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => false, 'lead_id' => $insert, 'message' => "Failed to create Lead", 'data' =>$data], 200);
|
||||
}
|
||||
|
||||
private function updateOldLead($id, $data)
|
||||
{
|
||||
if ($this->leadsModel->where('id', $id)->set($data[0])->update()) {
|
||||
$this->insertLeadStatus($id, $data[0]['status'], 3);
|
||||
return $this->respond(['status' => true, 'lead_id' => $id, 'message' => "Lead updated successfully", 'data' =>$data], 200);
|
||||
}
|
||||
return $this->respond(['status' => false, 'lead_id' => $id, 'message' => "Failed to update Lead", 'data' =>$data], 200);
|
||||
}
|
||||
|
||||
// Get the Single Lead data for edit
|
||||
public function getLeadDataForEdit($id)
|
||||
{
|
||||
|
||||
$data = $this->leadsModel
|
||||
->where('leads.id', $id)
|
||||
->where('leads.is_active', 1)
|
||||
->first();
|
||||
|
||||
if(!empty($data['policy_start_date'])){
|
||||
$data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y');
|
||||
}else{
|
||||
$data['policy_start_date'] = null;
|
||||
}
|
||||
|
||||
if(!empty($data['policy_end_date'])){
|
||||
$data['policy_end_date'] = change_date_format($data['policy_end_date'], 'Y-m-d', 'd/m/Y');
|
||||
}else{
|
||||
$data['policy_end_date'] = null;
|
||||
}
|
||||
|
||||
if($data){
|
||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function insertLeadStatus($primaryKey, $status, $statusType)
|
||||
{
|
||||
$statusData = [
|
||||
'policy_tran_id' => $primaryKey,
|
||||
'status' => $status,
|
||||
'status_type' => $statusType,
|
||||
'created_by' => get_session_userid(),
|
||||
];
|
||||
$this->policyTransactionStatusModel->insert($statusData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -101,9 +101,10 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
// Policy Transaction Inception
|
||||
public function viewInception()
|
||||
{
|
||||
{
|
||||
$data['page_name'] = 'Policy';
|
||||
|
||||
|
||||
// Static arrays for dropdowns
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
$data['issuing_type'] = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
|
||||
@ -143,8 +144,8 @@ class PolicyTransactionController extends BaseController
|
||||
'policy_start_date' => 'Policy Start Date',
|
||||
'policy_end_date' => 'Policy End Date',
|
||||
];
|
||||
|
||||
//filter datas
|
||||
|
||||
// Filter data
|
||||
$start_date = $this->request->getGet('start_date');
|
||||
$end_date = $this->request->getGet('end_date');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
@ -153,28 +154,44 @@ class PolicyTransactionController extends BaseController
|
||||
$date_type = $this->request->getGet('date_type');
|
||||
$issuer = $this->request->getGet('issuer');
|
||||
$status = $this->request->getGet('status');
|
||||
|
||||
$start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
|
||||
$end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
|
||||
|
||||
$client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
|
||||
$insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
|
||||
$policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
|
||||
$date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
|
||||
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
|
||||
$status = (!isset($issuer) || $status === '' || $status === null) ? 0 : $status;
|
||||
|
||||
|
||||
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
|
||||
|
||||
|
||||
// Handle null or empty values
|
||||
$start_date = empty($start_date) ? 0 : $start_date;
|
||||
$end_date = empty($end_date) ? 0 : $end_date;
|
||||
$client_id = empty($client_id) ? 0 : $client_id;
|
||||
$insurer_id = empty($insurer_id) ? 0 : $insurer_id;
|
||||
$policy_type_id = empty($policy_type_id) ? 0 : $policy_type_id;
|
||||
$date_type = empty($date_type) ? 0 : $date_type;
|
||||
$issuer = empty($issuer) ? 0 : $issuer;
|
||||
$status = empty($status) ? 0 : $status; // Corrected from `$issuer`
|
||||
|
||||
// Fetch inception data list
|
||||
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$client_id,
|
||||
$insurer_id,
|
||||
$policy_type_id,
|
||||
$date_type,
|
||||
$issuer,
|
||||
$status
|
||||
);
|
||||
|
||||
// Fetch additional data
|
||||
$data['client'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
$data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
|
||||
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
$data['entity'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
|
||||
$data['entity'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
|
||||
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
|
||||
$data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
$data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
|
||||
// Fetch PP Teams Data
|
||||
$data['ppTeamsData'] = $this->userModel
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
// Fetch Sales Team
|
||||
$data['salse_team'] = $this->userModel
|
||||
->select('user_profiles.*')
|
||||
->join('user_teams', 'user_profiles.id = user_teams.user_id')
|
||||
@ -182,16 +199,22 @@ class PolicyTransactionController extends BaseController
|
||||
->where('user_teams.is_active', 1)
|
||||
->where('user_profiles.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
|
||||
// Fetch ACM
|
||||
$data['ACM'] = $this->userModel
|
||||
->where('user_profiles.role', 3)
|
||||
->where('user_profiles.is_active', 1)
|
||||
->where('role', 3) // Assuming `role` is in `user_profiles`
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
|
||||
$this->loadLayout('policy_transaction_inception_list', $data);
|
||||
// echo '<pre>';
|
||||
// print_r($data['ppTeamsData']); die;
|
||||
|
||||
// dd($data);
|
||||
|
||||
// Load view
|
||||
$this->loadLayout('policy_transaction_inception_list', $data);
|
||||
}
|
||||
|
||||
|
||||
// policy Transaction Create function start
|
||||
public function createInceptionPolicy()
|
||||
{
|
||||
@ -297,8 +320,8 @@ class PolicyTransactionController extends BaseController
|
||||
$data['ct_type'] = 1;
|
||||
}
|
||||
|
||||
$month = '01-'.(string)$this->request->getPost('month');
|
||||
$data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month));
|
||||
// $month = '01-'.(string)$this->request->getPost('month');
|
||||
// $data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month));
|
||||
|
||||
// Determine $is_addon value
|
||||
$data['is_addon'] = in_array($data['policy_type_id'], [1, 2, 6, 7]) ? 1 :
|
||||
@ -729,6 +752,8 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
if(!empty($data['month'])){
|
||||
$data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y');
|
||||
}else{
|
||||
$data['month'] = null;
|
||||
}
|
||||
|
||||
|
||||
@ -744,7 +769,7 @@ class PolicyTransactionController extends BaseController
|
||||
->findAll();
|
||||
|
||||
|
||||
$data['base_policy_data'] = $this->clientPolicyModel
|
||||
$data['base_policy_data'] = $this->clientPolicyModel
|
||||
->select('client_policy.*, policy_type.policy_type')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->where('client_policy.client_id', $data['client_id'])
|
||||
@ -752,13 +777,18 @@ class PolicyTransactionController extends BaseController
|
||||
->whereIn('client_policy.policy_type_id', [2, 3])
|
||||
->where('client_policy.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
|
||||
$data['pt_files'] = $this->PTFileModel
|
||||
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
|
||||
->where('pt_files.pt_id', $id)
|
||||
->where('pt_files.is_active', 1)
|
||||
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
|
||||
->where('pt_files.pt_id', $id)
|
||||
->where('pt_files.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel
|
||||
->where('pt_id', $id)
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'asc')
|
||||
->findAll();
|
||||
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll();
|
||||
$data['emp_data'] = $this->employeeModel
|
||||
->select('employees.*, employee_polices.id as emp_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
@ -1146,9 +1176,9 @@ class PolicyTransactionController extends BaseController
|
||||
'created_by' => get_session_userid(),
|
||||
];
|
||||
|
||||
$uploadFilePath = $uploadFilePath . '/' . $uploadedFileName;
|
||||
// $uploadFilePath = $uploadFilePath . '/' . $uploadedFileName;
|
||||
|
||||
$GoogleDriveController->uploadFiletoGdrive(client_policy_id: $client_policy_id, doc_type: 'POLICY', file_path: $uploadFilePath, file_name: $uploadedFileName);
|
||||
// $GoogleDriveController->uploadFiletoGdrive(client_policy_id: $client_policy_id, doc_type: 'POLICY', file_path: $uploadFilePath, file_name: $uploadedFileName);
|
||||
|
||||
// Insert into database
|
||||
$insert = $this->PTFileModel->insert($docData);
|
||||
@ -1374,8 +1404,6 @@ class PolicyTransactionController extends BaseController
|
||||
$date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
|
||||
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
|
||||
|
||||
|
||||
|
||||
$data['varience_list'] = $this->policyTransactionModel->getVarienceReportLIst($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer);
|
||||
$this->loadLayout('variance_report_list', $data);
|
||||
|
||||
@ -1462,6 +1490,46 @@ class PolicyTransactionController extends BaseController
|
||||
$this->loadLayout('finance_team_list', $data);
|
||||
}
|
||||
|
||||
public function reportOutstanding()
|
||||
{
|
||||
$data['page_name'] = 'Outstanding Report';
|
||||
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
|
||||
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
$data['date_type'] = [
|
||||
'policy_issue_date' => 'Policy Issue Date',
|
||||
'policy_start_date' => 'Policy Start Date',
|
||||
'policy_end_date' => 'Policy End Date',
|
||||
'data_received_date' => 'Data Received Date',
|
||||
'closure_date' => 'Closure Date',
|
||||
];
|
||||
|
||||
//filter datas
|
||||
$start_date = $this->request->getGet('start_date');
|
||||
$end_date = $this->request->getGet('end_date');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$insurer_id = $this->request->getGet('insurer_id');
|
||||
$policy_type_id = $this->request->getGet('policy_type_id');
|
||||
$date_type = $this->request->getGet('date_type');
|
||||
$issuer = $this->request->getGet('issuer');
|
||||
|
||||
$start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
|
||||
$end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
|
||||
|
||||
$client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
|
||||
$insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
|
||||
$policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
|
||||
$date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
|
||||
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
|
||||
|
||||
$data['outstanting_list'] = $this->policyTransactionModel->getOutstandingReportLIst($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer);
|
||||
// dd($this->policyTransactionModel->getLastQuery());
|
||||
// dd($data);
|
||||
$this->loadLayout('outstanding_report_list', $data);
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -1133,7 +1133,10 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$insurer = ($insurer->find($policy_terms['insurer_id']));
|
||||
if($insurer['addition_add_day'] == true)
|
||||
{
|
||||
$emp_data['policy_details']['date_coverage'] = (new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d');
|
||||
// $emp_data['policy_details']['date_coverage'] = (new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d');
|
||||
|
||||
$emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) && $emp_data['policy_details']['date_coverage'] != '' && $emp_data['policy_details']['date_coverage'] != null ?
|
||||
(new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d') : null ;
|
||||
}
|
||||
}
|
||||
// dd($emp_data);
|
||||
|
||||
@ -234,13 +234,11 @@ class sendMailNotification
|
||||
$policy_name = $inner_item['policy_name'];
|
||||
|
||||
if ($inner_item['relationship'] == 'Self') {
|
||||
$emp_code = ' (' . $inner_item['emp_code'] . ')';
|
||||
$emp_code = '(' . $inner_item['emp_code'] . ')';
|
||||
$mail = $inner_item['email_corporate'];
|
||||
} else {
|
||||
$emp_code = '';
|
||||
}
|
||||
$name = $inner_item['name'];
|
||||
}
|
||||
|
||||
|
||||
$si = '';
|
||||
$premium = '';
|
||||
$gst_forself = '';
|
||||
@ -251,7 +249,7 @@ class sendMailNotification
|
||||
}
|
||||
|
||||
$temp_data .= '<tr>';
|
||||
$temp_data .= '<td>' . $inner_item['name'] . $emp_code . '</td>';
|
||||
$temp_data .= '<td>' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . '</td>';
|
||||
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
|
||||
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
|
||||
$temp_data .= '<td>' . $si . '</td>';
|
||||
|
||||
@ -466,3 +466,12 @@ function numberToWords($number)
|
||||
|
||||
return $number; // Fallback for numbers beyond the supported range
|
||||
}
|
||||
|
||||
if (!function_exists('print_rr')) {
|
||||
function print_rr($data)
|
||||
{
|
||||
echo "<pre>";
|
||||
print_r($data);
|
||||
echo "</pre>";
|
||||
}
|
||||
}
|
||||
@ -114,5 +114,96 @@ class ClientModel extends Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getClientData($client_id = null)
|
||||
{
|
||||
// Load the database if not already loaded
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
// Clients query
|
||||
$clientQuery = $db->table('clients')
|
||||
->groupStart() // Start grouping OR conditions
|
||||
->where('client_type IS NULL OR client_type = ""')
|
||||
->orWhere('entity_type_id IS NULL OR entity_type_id = ""')
|
||||
->orWhere('client_name IS NULL OR client_name = ""')
|
||||
->orWhere('short_name IS NULL OR short_name = ""')
|
||||
->orWhere('pan IS NULL OR pan = ""')
|
||||
->groupEnd(); // End grouping OR conditions
|
||||
|
||||
if ($client_id) {
|
||||
// If client_id is passed, fetch data for this particular client
|
||||
$clientQuery->where('id', $client_id);
|
||||
}
|
||||
|
||||
$clients = $clientQuery->get()->getResultArray();
|
||||
|
||||
// Client Branch query
|
||||
$branchQuery = $db->table('client_branch')
|
||||
->groupStart()
|
||||
->where('branch_name IS NULL OR branch_name = ""')
|
||||
->orWhere('branch_code IS NULL OR branch_code = ""')
|
||||
->orWhere('gst IS NULL OR gst = ""')
|
||||
->orWhere('units IS NULL OR units = ""')
|
||||
->groupEnd();
|
||||
|
||||
if ($client_id) {
|
||||
// Add filter for particular client's branches if client_id is passed
|
||||
$branchQuery->where('client_id', $client_id);
|
||||
}
|
||||
|
||||
$clientBranches = $branchQuery->get()->getResultArray();
|
||||
|
||||
// Client Policy query
|
||||
$policyQuery = $db->table('client_policy')
|
||||
->groupStart()
|
||||
->where('client_id IS NULL OR client_id = ""')
|
||||
->orWhere('client_branch_id IS NULL OR client_branch_id = ""')
|
||||
->orWhere('policy_id IS NULL OR policy_id = ""')
|
||||
->orWhere('policy_type_id IS NULL OR policy_type_id = ""')
|
||||
->orWhere('insurer_id IS NULL OR insurer_id = ""')
|
||||
->orWhere('insurer_branch_id IS NULL OR insurer_branch_id = ""')
|
||||
->orWhere('tpa_id IS NULL OR tpa_id = ""')
|
||||
->orWhere('tpa_branch_id IS NULL OR tpa_branch_id = ""')
|
||||
->orWhere('policy_start_date IS NULL OR policy_start_date = ""')
|
||||
->orWhere('policy_end_date IS NULL OR policy_end_date = ""')
|
||||
->orWhere('policy_no IS NULL OR policy_no = ""')
|
||||
->orWhere('cd_ac_no IS NULL OR cd_ac_no = ""')
|
||||
->orWhere('policy_terms IS NULL OR policy_terms = ""')
|
||||
->orWhere('gst IS NULL OR gst = ""')
|
||||
->groupEnd();
|
||||
|
||||
if ($client_id) {
|
||||
// Add filter for particular client's policies if client_id is passed
|
||||
$policyQuery->where('client_id', $client_id);
|
||||
}
|
||||
|
||||
$clientPolicies = $policyQuery->get()->getResultArray();
|
||||
|
||||
// Client RM query
|
||||
$rmQuery = $db->table('client_rm')
|
||||
->groupStart()
|
||||
->where('client_id IS NULL OR client_id = ""')
|
||||
->orWhere('user_id IS NULL OR user_id = ""')
|
||||
->orWhere('level IS NULL OR level = ""')
|
||||
->groupEnd();
|
||||
|
||||
if ($client_id) {
|
||||
// Add filter for particular client's RM if client_id is passed
|
||||
$rmQuery->where('client_id', $client_id);
|
||||
}
|
||||
|
||||
$clientRms = $rmQuery->get()->getResultArray();
|
||||
|
||||
// Combine all results into a single array
|
||||
$result = [
|
||||
'clients' => $clients,
|
||||
'client_branches' => $clientBranches,
|
||||
'client_policies' => $clientPolicies,
|
||||
'client_rms' => $clientRms
|
||||
];
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
108
app/Models/LeadsModel.php
Normal file
108
app/Models/LeadsModel.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class LeadsModel extends Model
|
||||
{
|
||||
protected $table = 'leads';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'lead_type',
|
||||
'issuer',
|
||||
'client_type',
|
||||
'client_name',
|
||||
'client_short_name',
|
||||
'entity_type_id',
|
||||
'client_code',
|
||||
'cost_center',
|
||||
'pan',
|
||||
'gst',
|
||||
'branch_name',
|
||||
'branch_code',
|
||||
'contact_person_name',
|
||||
'contact_person_mobile',
|
||||
'client_id',
|
||||
'client_branch_id',
|
||||
'source_policy_id',
|
||||
'policy_type_id',
|
||||
'salse_person_id',
|
||||
'insurer_id',
|
||||
'insurer_branch_id',
|
||||
'tpa_id',
|
||||
'tpa_branch_id',
|
||||
'policy_start_date',
|
||||
'policy_end_date',
|
||||
'no_of_lives',
|
||||
'claims',
|
||||
'location',
|
||||
'proposed_insurer_id',
|
||||
'proposed_insurer_branch_id',
|
||||
'proposed_tpa_id',
|
||||
'proposed_tpa_branch_id',
|
||||
'status',
|
||||
'notes',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
'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;
|
||||
}
|
||||
|
||||
public function getLeadDataForLising(){
|
||||
|
||||
return $this->select('
|
||||
leads.*,
|
||||
kyc_entity_type.name as entity_type,
|
||||
policy_type.policy_type,
|
||||
user_profiles.first_name as salse_person_name
|
||||
')
|
||||
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
||||
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
||||
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||
->where('leads.is_active', 1)
|
||||
->where('leads.is_active', 1)
|
||||
->where('leads.is_active', 1)
|
||||
->orderBy('id', 'desc')
|
||||
->findAll();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -565,7 +565,8 @@ class PolicyTransactionModel extends Model
|
||||
'policy_transaction.action_type as action_type_full',
|
||||
'pt_co_share_details.bp_amt',
|
||||
'pt_co_share_details.tp_amt',
|
||||
'pt_co_share_details.tep_amt'
|
||||
'pt_co_share_details.tep_amt',
|
||||
'policy_transaction.status'
|
||||
])
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
@ -573,7 +574,7 @@ class PolicyTransactionModel extends Model
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('policy_transaction.status', 'completed')
|
||||
// ->where('policy_transaction.status', 'completed')
|
||||
->where('pt_co_share_details.bp_amt IS NULL OR pt_co_share_details.bp_amt = 0');
|
||||
|
||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||
@ -633,7 +634,8 @@ class PolicyTransactionModel extends Model
|
||||
END AS action_type,
|
||||
policy_transaction.action_type AS action_type_full,
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.variance
|
||||
pt_co_share_details.variance,
|
||||
policy_transaction.status
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
@ -641,7 +643,7 @@ class PolicyTransactionModel extends Model
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('policy_transaction.status', 'completed')
|
||||
// ->where('policy_transaction.status', 'completed')
|
||||
->where('COALESCE(pt_co_share_details.agreed_bp_per, 0) + COALESCE(pt_co_share_details.agreed_tp_per, 0) + COALESCE(pt_co_share_details.agreed_tep_per, 0) = 0')
|
||||
->where('COALESCE(pt_co_share_details.actual_bp_amt, 0) + COALESCE(pt_co_share_details.actual_tp_amt, 0) + COALESCE(pt_co_share_details.actual_tep_amt, 0) = 0')
|
||||
->where('COALESCE(pt_co_share_details.actual_bp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tep_brokerage_amt, 0) = 0');
|
||||
@ -687,4 +689,103 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
public function getOutstandingReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||
{
|
||||
$builder = $this->db->table('policy_transaction')
|
||||
->select("
|
||||
policy_transaction.id,
|
||||
clients.client_name,
|
||||
insurers.name AS insurer_name,
|
||||
policy_type.policy_type,
|
||||
policy_transaction.policy_no,
|
||||
policy_transaction.endorsement_no,
|
||||
CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
ELSE 'E'
|
||||
END AS action_type,
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.variance,
|
||||
insurer_statements.invoice_amount,
|
||||
insurer_statements.invoice_status,
|
||||
|
||||
ROUND((pt_co_share_details.actual_bp_brokerage_amt + pt_co_share_details.actual_tp_brokerage_amt + pt_co_share_details.actual_tep_brokerage_amt), 2) AS realization_amount2,
|
||||
|
||||
(
|
||||
SELECT
|
||||
(SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds)) AS realization_amount
|
||||
FROM
|
||||
inv_payment_details
|
||||
WHERE
|
||||
inv_payment_details.statement_id = insurer_statements.id
|
||||
AND inv_payment_details.is_active = 1
|
||||
|
||||
) AS realization_amount,
|
||||
|
||||
ROUND(
|
||||
insurer_statements.invoice_amount -
|
||||
(
|
||||
SELECT
|
||||
(SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds))
|
||||
FROM
|
||||
inv_payment_details
|
||||
WHERE
|
||||
inv_payment_details.statement_id = insurer_statements.id
|
||||
AND inv_payment_details.is_active = 1
|
||||
),
|
||||
2) AS outstanding_amount
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
|
||||
->join('inv_payment_details', 'insurer_statements.id = inv_payment_details.statement_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1);
|
||||
|
||||
// Date range filtering
|
||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||
|
||||
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
|
||||
->where('policy_transaction.' . $date_type . '<=', $endDate);
|
||||
} else {
|
||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
->where('policy_transaction.created_at <=', $toDate);
|
||||
}
|
||||
|
||||
// Additional filters
|
||||
if ($client_id != 0) {
|
||||
$builder->where('policy_transaction.client_id', $client_id);
|
||||
}
|
||||
|
||||
if ($insurer_id != 0) {
|
||||
$builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||
}
|
||||
|
||||
if ($policy_type_id != 0) {
|
||||
$builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||
}
|
||||
|
||||
if ($issuer != 0) {
|
||||
$builder->where('policy_transaction.issuer', $issuer);
|
||||
}
|
||||
|
||||
if ($status != 0) {
|
||||
$builder->where('policy_transaction.status', $status);
|
||||
}
|
||||
|
||||
// Filter where outstanding_amount is not null
|
||||
$builder->having('outstanding_amount IS NOT NULL');
|
||||
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ body {
|
||||
<span class="d-none d-sm-inline-block">Enrolment</span>
|
||||
</a>
|
||||
</li>
|
||||
<!--
|
||||
|
||||
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
|
||||
|
||||
<li class="nav-item">
|
||||
@ -211,12 +211,12 @@ body {
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php } ?> -->
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('endorsement_dash.php'); ?>
|
||||
<!-- <?php include('bds_dash.php'); ?> -->
|
||||
<?php include('bds_dash.php'); ?>
|
||||
<?php include('enrollment_dash.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -123,29 +123,20 @@ body{
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.modal-right{
|
||||
width: 100% !important;
|
||||
justify-content: normal !important;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
max-height: 100vh;
|
||||
overflow-y: auto;
|
||||
padding-left: 25px !important;
|
||||
padding-right: 25px !important;
|
||||
padding-top: 10px !important;
|
||||
padding-bottom: 35% !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="tab-pane fade" id="bds-dash-tab" style="padding-right: 35px;">
|
||||
<div class="row">
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous order-card" onclick="linkRedirectForBDS(this, 'B')">
|
||||
<div class="StatusTileHide" style="display: none; position: relative; bottom: 15px;">
|
||||
<a href="#" onclick="hide_status_show_pending_tile()" >show all pending Tile</a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<div class="col-md-4 col-xl-3 businessPendingTile">
|
||||
<div class="card bg-c-Pelorous order-card" onclick="show_business_status_tile(this)">
|
||||
<div class="card-block">
|
||||
<h6 class="m-b-20 font-15">Business Team Pending</h6>
|
||||
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= $businessTeamCount ?></span></h2>
|
||||
@ -155,12 +146,37 @@ body{
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Array of colors with different shades (each array represents a color set)
|
||||
$colorSetCount = count($colorShades); // Number of color sets
|
||||
$shadeCount = count($colorShades[0]); // Number of shades per set
|
||||
$index = 0;
|
||||
|
||||
foreach ($businessTeamStatusData as $status => $value) {
|
||||
$colorSetIndex = floor($index / $shadeCount) % $colorSetCount; // Reset color set after each set
|
||||
$shadeIndex = $index % $shadeCount; // Cycle through shades within the set
|
||||
|
||||
// Get the background color for the current tile
|
||||
$bgColor = $colorShades[$colorSetIndex][$shadeIndex];
|
||||
?>
|
||||
<div class="col-md-2 col-xl-1 businessStatusTile" style="display: none;">
|
||||
<div class="card order-card" style="background: <?= $bgColor ?>;" onclick="linkRedirectForBDS(this, 'B')">
|
||||
<h2 class="text-center"><span><?= count($value) ?></span></h2>
|
||||
<h6 class="m-b-20 font-15 text-center"><?= $policyStatus[$status] ?></h6>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$index++; // Increment index for the next tile
|
||||
}
|
||||
?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous2 order-card" onclick="linkRedirectForBDS(this, 'F')">
|
||||
<div class="col-md-4 col-xl-3 financePendingTile">
|
||||
<div class="card bg-c-Pelorous2 order-card" onclick="show_finance_status_tile(this, 'F')">
|
||||
<div class="card-block">
|
||||
<h6 class="m-b-20 font-15">Finance Team Pending</h6>
|
||||
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= $financeTeamCount ?></span></h2>
|
||||
@ -170,8 +186,35 @@ body{
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Array of colors with different shades (each array represents a color set)
|
||||
$colorSetCount = count($colorShades); // Number of color sets
|
||||
$shadeCount = count($colorShades[0]); // Number of shades per set
|
||||
$index = 0;
|
||||
|
||||
foreach ($financeTeamStatusData as $status => $value) {
|
||||
$colorSetIndex = floor($index / $shadeCount) % $colorSetCount; // Reset color set after each set
|
||||
$shadeIndex = $index % $shadeCount; // Cycle through shades within the set
|
||||
|
||||
// Get the background color for the current tile
|
||||
$bgColor = $colorShades[$colorSetIndex][$shadeIndex];
|
||||
?>
|
||||
<div class="col-md-2 col-xl-1 financeStatusTile" style="display: none;">
|
||||
<div class="card order-card" style="background: <?= $bgColor ?>;" onclick="linkRedirectForBDS(this, 'F')">
|
||||
<h2 class="text-center"><span><?= count($value) ?></span></h2>
|
||||
<h6 class="m-b-20 font-15 text-center"><?= $policyStatus[$status] ?></h6>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$index++; // Increment index for the next tile
|
||||
}
|
||||
?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -192,4 +235,33 @@ function linkRedirectForBDS(input, team)
|
||||
}
|
||||
}
|
||||
|
||||
function show_business_status_tile(){
|
||||
|
||||
$('.businessStatusTile').show()
|
||||
$('.StatusTileHide').show()
|
||||
|
||||
$('.businessPendingTile').hide()
|
||||
$('.financePendingTile').hide()
|
||||
|
||||
}
|
||||
|
||||
function show_finance_status_tile(){
|
||||
|
||||
$('.financeStatusTile').show()
|
||||
$('.StatusTileHide').show()
|
||||
|
||||
$('.financePendingTile').hide()
|
||||
$('.businessPendingTile').hide()
|
||||
|
||||
}
|
||||
|
||||
function hide_status_show_pending_tile(){
|
||||
|
||||
$('.StatusTileHide').hide()
|
||||
$('.financeStatusTile').hide()
|
||||
$('.businessStatusTile').hide()
|
||||
$('.financePendingTile').show()
|
||||
$('.businessPendingTile').show()
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -655,7 +655,15 @@
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<!-- <?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
|
||||
<!-- leads -->
|
||||
<!-- <li>
|
||||
<a href="<?= base_url('/leads/list') ?>">
|
||||
<i class="mdi mdi-chart-bar"></i>
|
||||
<span> Leads </span>
|
||||
</a>
|
||||
</li> -->
|
||||
|
||||
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
||||
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
@ -672,7 +680,7 @@
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a>
|
||||
@ -684,13 +692,16 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||
@ -710,7 +721,7 @@
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?> -->
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
869
app/Views/leads_form.php
Normal file
869
app/Views/leads_form.php
Normal file
@ -0,0 +1,869 @@
|
||||
<style>
|
||||
.readonly-color {
|
||||
background-color: #e0e0e0;
|
||||
/* Darker background */
|
||||
color: #666;
|
||||
/* Darker text color */
|
||||
}
|
||||
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
background-color: #f0f0f0;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.select2-hidden-accessible+.select2-container .select2-dropdown {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.select2-container .select2-selection--multiple .select2-selection__choice {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.select2-selection__choice {
|
||||
background-color: #0a8794 !important;
|
||||
color: white !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.select2-selection__choice__remove {
|
||||
color: white !important;
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="leads_form" style="display:none;">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 id="page_title" style="position: relative;">Add Lead</h4>
|
||||
</div>
|
||||
<div class="col-3" style="text-align: right; position: relative; left: 211px;">
|
||||
<!-- <button class="btn btn-primary waves-effect waves-light" onclick="fileupload(this)">file upload</button> -->
|
||||
</div>
|
||||
<div class="col-1" style="text-align: right; position: relative; left: 193px;">
|
||||
<a href="<?= base_url('leads/list') ?>" type="button" id="btnAdd"
|
||||
class="btn btn-primary waves-effect waves-light">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
<form role="form" class="parsley-examples" method="post" id="leads_form_id"
|
||||
enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="id" id="leads_primarykey">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="lead_type">Lead Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="lead_type" name="lead_type" required>
|
||||
<option value="">Select Lead Type</option>
|
||||
<?php
|
||||
if (isset($lead_type) && count($lead_type)) {
|
||||
foreach ($lead_type as $key => $value) {
|
||||
if($key == 1){
|
||||
echo "<option value=" . $key . " selected>" . $value . "</option>";
|
||||
}else{
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="issuer">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="">Select Issuer</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- client row -->
|
||||
<div class="form-row" id="freshDiv">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_type" name="client_type" required>
|
||||
<option value="">Select Client type</option>
|
||||
<?php
|
||||
if (isset($client_type) && count($client_type)) {
|
||||
foreach ($client_type as $key => $value) {
|
||||
echo "<option value='" . $key . "' >" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="entity_type_id">Entity Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="entity_type_id" name="entity_type_id" required>
|
||||
<option value="" selected>Select Entity</option>
|
||||
<?php
|
||||
if (isset($entity) && count($entity)) {
|
||||
foreach ($entity as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_name">Client Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="client_name" name="client_name"
|
||||
placeholder="Enter Client Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_short_name">Client Short Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="client_short_name" name="client_short_name"
|
||||
placeholder="Enter Client Short Name" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="renewalDiv" style="display: none;">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="source_policy_id"> Source Policy <span id="base_danger"
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="source_policy_id" name="source_policy_id">
|
||||
<option value="" selected>Select Source Policy</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="pan">PAN<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="pan" placeholder="Enter PAN Number" data-parsley-error-message="Invalid PAN Number. Example: ABCDE1234F" name="pan" data-parsley-trigger="change" data-parsley-pattern="^[A-Z]{5}[0-9]{4}[A-Z]$">
|
||||
</div>
|
||||
</div>
|
||||
<!-- end client row -->
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- branch row-->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="gst">GST<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="gst" placeholder="Enter GST Number"
|
||||
data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" name="gst"
|
||||
data-parsley-trigger="change"
|
||||
data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Branch Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_name" name="branch_name"
|
||||
placeholder="Enter Branch Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="client_branch">Branch Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_code" name="branch_code"
|
||||
placeholder="Enter Branch Code" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="client_branch">Contact Person Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
|
||||
placeholder="Enter Contact Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="client_branch">Contact Person Mobile<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="contact_person_mobile" name="contact_person_mobile"
|
||||
placeholder="Enter Contact Mobile" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- policy row -->
|
||||
<div id="dynamic-form-container"></div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- other row -->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="salse_person_id" name="salse_person_id" multiple required>
|
||||
<option value="">Select Sales Person</option>
|
||||
<?php if (isset($salse_team)) { ?>
|
||||
<?php foreach ($salse_team as $value) { ?>
|
||||
<option value="<?= $value['id'];?>">
|
||||
<?= $value['first_name'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="status"> Status <span id="base_danger" class="text-danger">*</span></label>
|
||||
<select class="form-control" id="lead_status" name="status" required>
|
||||
<option value="" selected>Select Status</option>
|
||||
<?php
|
||||
if (isset($lead_status) && count($lead_status)) {
|
||||
foreach ($lead_status as $key => $value) {
|
||||
if($key == 'queued'){
|
||||
echo "<option value=" . $key . " selected>" . $value . "</option>";
|
||||
}else{
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="notes">Note</label>
|
||||
<textarea class="form-control" id="notes" name="notes" rows="4"></textarea>
|
||||
</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>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end form row -->
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
//SELECT2 document ready function
|
||||
$(document).ready(function() {
|
||||
addHTMLInput()
|
||||
setTimeout(function() {
|
||||
$("textarea.select2-search__field").attr('rows', '1');
|
||||
$("textarea.select2-search__field").css('resize', 'none');
|
||||
}, 1000)
|
||||
|
||||
$('#insurer').select2();
|
||||
$('#tpa').select2();
|
||||
$('#proposed_insurer').select2();
|
||||
$('#proposed_tpa').select2();
|
||||
|
||||
})
|
||||
|
||||
//DATE document ready function
|
||||
// $(document).ready(function(){
|
||||
|
||||
// var today = new Date();
|
||||
|
||||
// var policy_start_date = flatpickr(".policy_start_date", {
|
||||
// dateFormat: "d/m/Y",
|
||||
// // defaultDate: today,
|
||||
// allowInput: false,
|
||||
// onChange: function(selectedDates, dateStr, instance) {
|
||||
// var policy_end_date = new Date(selectedDates[0]);
|
||||
// policy_end_date.setFullYear(policy_end_date.getFullYear() + 1);
|
||||
// policy_end_date.setDate(policy_end_date.getDate() - 1); // Set end date to last day of selected year
|
||||
// policy_end_datePicker.setDate(policy_end_date);
|
||||
// }
|
||||
// });
|
||||
|
||||
// // Calculate the end date (today + 1 year)
|
||||
// // var closeDate = new Date(today);
|
||||
// // closeDate.setFullYear(closeDate.getFullYear() + 1);
|
||||
// // closeDate.setDate(closeDate.getDate() - 1); // Set end date to last day of next year
|
||||
|
||||
// var policy_end_datePicker = flatpickr(".policy_end_date", {
|
||||
// dateFormat: "d/m/Y",
|
||||
// // defaultDate: closeDate,
|
||||
// allowInput: false
|
||||
// });
|
||||
// })
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
//view and edit Lead data function
|
||||
function getLeadsDataForEdit(input) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$('#leads_form_id')[0].reset();
|
||||
|
||||
var id = input;
|
||||
console.log('Selected Leads:', id);
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("leads/list/") ?>' + id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
$('.btnDiv').hide();
|
||||
console.log('getLeadsDataForEdit', res);
|
||||
|
||||
if (res.status == true) {
|
||||
|
||||
hide_list_show_add();
|
||||
|
||||
var page_title = 'Edit Lead';
|
||||
|
||||
$('#page_title').text(page_title);
|
||||
$('#leads_primarykey').val(res.data.id);
|
||||
|
||||
$('#lead_type').val(res.data.lead_type);
|
||||
$('#issuer').val(res.data.issuer);
|
||||
$('#client_type').val(res.data.client_type);
|
||||
$('#client_name').val(res.data.client_name);
|
||||
$('#client_short_name').val(res.data.client_short_name);
|
||||
$('#entity_type_id').val(res.data.entity_type_id);
|
||||
$('#lead_status').val(res.data.status);
|
||||
$('#notes').val(res.data.notes);
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
$('#client_id').val(res.data.client_id).change();
|
||||
setTimeout(function() {
|
||||
$('#client_branch_id').val(res.data.client_branch_id).change();
|
||||
setTimeout(function() {
|
||||
$('#source_policy_id').val(res.data.source_policy_id)
|
||||
.change();
|
||||
$('#pan').val(res.data.pan);
|
||||
$('#gst').val(res.data.gst);
|
||||
$('#branch_name').val(res.data.branch_name);
|
||||
$('#branch_code').val(res.data.branch_code);
|
||||
$('#contact_person_name').val(res.data
|
||||
.contact_person_name);
|
||||
$('#contact_person_mobile').val(res.data
|
||||
.contact_person_mobile);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
|
||||
var insurer = res.data.insurer_branch_id + '-' + res.data.insurer_id;
|
||||
var tpa = res.data.tpa_branch_id + '-' + res.data.tpa_id;
|
||||
|
||||
var proposed_insurer = res.data.proposed_insurer_branch_id + '-' + res.data.proposed_insurer_id;
|
||||
var proposed_tpa = res.data.proposed_tpa_branch_id + '-' + res.data.proposed_tpa_id;
|
||||
|
||||
$('#policy_type_id_1').val(res.data.policy_type_id).change();
|
||||
$('#insurer_1').val(insurer).select2();
|
||||
$('#tpa_1').val(tpa).select2();
|
||||
$('#proposed_insurer_1').val(proposed_insurer).select2();
|
||||
$('#proposed_tpa_1').val(proposed_tpa).select2();
|
||||
$('#policy_start_date_1').val(res.data.policy_start_date);
|
||||
$('#policy_end_date_1').val(res.data.policy_end_date);
|
||||
$('#no_of_lives').val(res.data.no_of_lives);
|
||||
$('#claims').val(res.data.claims);
|
||||
$('#location').val(res.data.location);
|
||||
|
||||
|
||||
if (res.data.salse_person_id) {
|
||||
selecSalsePerson(res.data.salse_person_id);
|
||||
}
|
||||
|
||||
if (res.data.lead_type == 2) {
|
||||
$('#renewalDiv').find('select, input').attr('required', 'required');
|
||||
$('#freshDiv').find('select, input').removeAttr('required');
|
||||
$('#renewalDiv').show();
|
||||
$('#freshDiv').hide();
|
||||
$('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||
} else {
|
||||
$('#renewalDiv').find('select, input').removeAttr('required');
|
||||
$('#freshDiv').find('select, input').attr('required', 'required');
|
||||
$('#renewalDiv').hide();
|
||||
$('#freshDiv').show();
|
||||
$('.proposed_div').hide().find('select, input').removeAttr('required');
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//client branch data
|
||||
function getBranchData(input) {
|
||||
|
||||
var client_branch_id = $(input).val();
|
||||
|
||||
if (client_branch_id) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/get_client_branch_data/');?>' + client_branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getBranchData response', res);
|
||||
|
||||
if (res.status == true) {
|
||||
|
||||
$('#gst').val(res.data.gst);
|
||||
$('#pan').val(res.data.pan);
|
||||
$('#branch_name').val(res.data.branch_name);
|
||||
$('#branch_code').val(res.data.branch_code);
|
||||
$('#contact_person_name').val(res.contact.name);
|
||||
$('#contact_person_mobile').val(res.contact.mobile);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
} else {
|
||||
|
||||
$('#gst').val('');
|
||||
$('#pan').val('');
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#contact_person_name').val('');
|
||||
$('#contact_person_mobile').val('');
|
||||
|
||||
console.log(res.message, 'warning');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//Client Policy Data
|
||||
function getPolicyData(input) {
|
||||
var client_policy_id = $(input).val();
|
||||
if (client_policy_id) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('client/policy/list/');?>' + client_policy_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getPolicyData response', res);
|
||||
|
||||
if (res.status == true) {
|
||||
|
||||
$('#gst').val(res.data.gst);
|
||||
$('#pan').val(res.data.pan);
|
||||
$('#branch_name').val(res.data.branch_name);
|
||||
$('#branch_code').val(res.data.branch_code);
|
||||
$('#contact_person_name').val(res.contact.name);
|
||||
$('#contact_person_mobile').val(res.contact.mobile);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
} else {
|
||||
|
||||
$('#gst').val('');
|
||||
$('#pan').val('');
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#contact_person_name').val('');
|
||||
$('#contact_person_mobile').val('');
|
||||
|
||||
console.log(res.message, 'warning');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function selecSalsePerson(salse_person_ids) {
|
||||
|
||||
salse_person_ids = JSON.parse(salse_person_ids);
|
||||
// Loop through each insurer-branch combination
|
||||
$.each(salse_person_ids, function(index, value) {
|
||||
// Use value in the format 'branch_id-insurer_id'
|
||||
$('#salse_person_id option').each(function() {
|
||||
if ($(this).val() === value) {
|
||||
$(this).prop('selected', true); // Select the matching option
|
||||
}
|
||||
});
|
||||
});
|
||||
// Trigger change for plugins (like Select2)
|
||||
$('#salse_person_id').trigger('change');
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
var increment = 1;
|
||||
|
||||
function addHTMLInput() {
|
||||
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const newRow = document.createElement('div');
|
||||
newRow.className = 'form-row dynamic-form-row';
|
||||
|
||||
// Add an <hr> element
|
||||
const hrElement = document.createElement('hr');
|
||||
container.appendChild(hrElement);
|
||||
|
||||
// Set inner HTML with necessary input fields
|
||||
newRow.innerHTML += `
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="policy_type_id">Policy Type <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="policy_type_id_${increment}" name="policy_type_id[]" required>
|
||||
<option value="">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_type) && count($policy_type)) {
|
||||
foreach ($policy_type as $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" .
|
||||
$value['policy_type'] .
|
||||
"</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="insurer">Insurer <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer_${increment}" name="insurer[]" required>
|
||||
<option value="">Select Insurer</option>
|
||||
<?php if (isset($insurer)) { ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa">TPA <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="tpa_${increment}" name="tpa[]" required>
|
||||
<option value="">Select TPA</option>
|
||||
<?php if (isset($tpa)) { ?>
|
||||
<?php foreach ($tpa as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['tpa_id'] ?>">
|
||||
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="no_of_lives">No of Lives <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="no_of_lives" name="no_of_lives[]" placeholder="Enter Lives" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="policy_start_date_${increment}">Date of Commencement <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control policy_start_date" id="policy_start_date_${increment}" name="policy_start_date[]" placeholder="Enter DOC" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="policy_end_date_${increment}">Date of Expiry <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control policy_end_date" id="policy_end_date_${increment}" name="policy_end_date[]" placeholder="Enter DOE" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claims">Claims <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="claims" name="claims[]" placeholder="Enter Claims" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="location">Location <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="location" name="location[]" placeholder="Enter Location" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 proposed_div" style="display: none;">
|
||||
<label for="proposed_insurer">Proposed Insurer <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="proposed_insurer_${increment}" name="proposed_insurer[]" required>
|
||||
<option value="">Select Insurer</option>
|
||||
<?php if (isset($insurer)) { ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 proposed_div" style="display: none;">
|
||||
<label for="proposed_tpa">Proposed TPA <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="proposed_tpa_${increment}" name="proposed_tpa[]" required>
|
||||
<option value="">Select TPA</option>
|
||||
<?php if (isset($tpa)) { ?>
|
||||
<?php foreach ($tpa as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['tpa_id'] ?>">
|
||||
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12 btnDiv" style="position: relative;top: 28px;float: right;text-align: end;">
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput()">+</a>
|
||||
</div>
|
||||
`;
|
||||
|
||||
container.appendChild(newRow);
|
||||
|
||||
|
||||
var lead_type = $('#lead_type').val();
|
||||
|
||||
if (lead_type == 2) {
|
||||
$('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||
} else {
|
||||
$('.proposed_div').hide().find('select, input').removeAttr('required');
|
||||
}
|
||||
|
||||
// Scroll the newly added select into view and focus on it
|
||||
const newPolicyTypeSelect = document.getElementById(`policy_type_id_${increment}`);
|
||||
newPolicyTypeSelect.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
||||
newPolicyTypeSelect.focus();
|
||||
|
||||
$('#insurer_'+ increment).select2();
|
||||
$('#tpa_'+ increment).select2();
|
||||
$('#proposed_insurer_'+ increment).select2();
|
||||
$('#proposed_tpa_'+ increment).select2();
|
||||
$('#policy_type_id_'+ increment).select2();
|
||||
|
||||
// Initialize date pickers
|
||||
var policy_start_datePicker = flatpickr("#policy_start_date_" + increment, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates) {
|
||||
var policy_end_date = new Date(selectedDates[0]);
|
||||
policy_end_date.setFullYear(policy_end_date.getFullYear() + 1);
|
||||
policy_end_date.setDate(policy_end_date.getDate() - 1); // Set end date to last day of selected year
|
||||
policy_end_datePicker.setDate(policy_end_date);
|
||||
}
|
||||
});
|
||||
|
||||
var policy_end_datePicker = flatpickr("#policy_end_date_" + increment, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
increment++; // Increment after adding the input
|
||||
}
|
||||
|
||||
|
||||
function removeHTMLInput(element)
|
||||
{
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const rows = container.querySelectorAll('.dynamic-form-row');
|
||||
|
||||
if (rows.length > 1) {
|
||||
const row = element.closest('.dynamic-form-row');
|
||||
|
||||
const hrElement = row.previousElementSibling; // Get the <hr> before the row
|
||||
console.log(hrElement);
|
||||
console.log(hrElement.tagName);
|
||||
if (hrElement && hrElement.tagName === 'HR') { // Check if it's an <hr> element
|
||||
hrElement.remove(); // Remove the <hr>
|
||||
}
|
||||
|
||||
row.remove();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
$("#leads_form_id").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var isValid = $('#leads_form_id').parsley().validate();
|
||||
|
||||
if (!isValid) {
|
||||
$('#leads_form_id').find('input, select, textarea').each(function() {
|
||||
if ($(this).parsley().isValid() === false && !$(this).val()) {
|
||||
console.log('Empty field ID:', this.id);
|
||||
}
|
||||
});
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var salse_person_id = $("#salse_person_id").val();
|
||||
console.log('salse_person_id : ', salse_person_id);
|
||||
|
||||
|
||||
form_action = '<?= base_url('leads/create') ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var formData = new FormData($('#leads_form_id')[0]);
|
||||
console.log(formData);
|
||||
|
||||
const jsonString = JSON.stringify(salse_person_id);
|
||||
console.log('jsonString', jsonString);
|
||||
|
||||
// Append the JSON string to the FormData object
|
||||
formData.append('salse_person_id', jsonString);
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log('inception_form_response', res)
|
||||
|
||||
if (res.status == true) {
|
||||
|
||||
toastr.success(res.message, 'Success');
|
||||
|
||||
window.location.href = '<?= base_url('leads/list') ?>';
|
||||
|
||||
} else {
|
||||
toastr.error(res.message, 'Error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
$('#lead_type').change(function() {
|
||||
|
||||
let value = $(this).val()
|
||||
|
||||
if (value == 2) {
|
||||
|
||||
$('#renewalDiv').find('select, input').attr('required', 'required');
|
||||
$('#freshDiv').find('select, input').removeAttr('required');
|
||||
$('#renewalDiv').show();
|
||||
$('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||
$('#freshDiv').hide();
|
||||
|
||||
$('#gst').val('');
|
||||
$('#pan').val('');
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#contact_person_name').val('');
|
||||
$('#contact_person_mobile').val('');
|
||||
|
||||
} else {
|
||||
|
||||
$('#renewalDiv').find('select, input').removeAttr('required');
|
||||
$('#freshDiv').find('select, input').attr('required', 'required');
|
||||
$('#renewalDiv').hide();
|
||||
$('.proposed_div').hide().find('select, input').removeAttr('required');
|
||||
$('#freshDiv').show();
|
||||
|
||||
$('#gst').val('');
|
||||
$('#pan').val('');
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#contact_person_name').val('');
|
||||
$('#contact_person_mobile').val('');
|
||||
|
||||
$('#client_type').val('');
|
||||
$('#client_name').val('');
|
||||
$('#client_short_name').val('');
|
||||
$('#entity_type_id').val('');
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
function getURLParamsForReport() {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const pt_id = params.get('pt_id') ?? 0;
|
||||
|
||||
if (pt_id != 0) {
|
||||
hide_list_show_add();
|
||||
setTimeout(() =>
|
||||
getPolicyTransactionDataForEdit(pt_id),
|
||||
1500); // Reduced timeout
|
||||
} else {
|
||||
show_list_hide_add();
|
||||
}
|
||||
|
||||
console.log('pt_id', pt_id); // Retain the log if necessary
|
||||
}
|
||||
</script>
|
||||
333
app/Views/leads_list.php
Normal file
333
app/Views/leads_list.php
Normal file
@ -0,0 +1,333 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
border: 2px solid red;
|
||||
background-color: #ffe6e6;
|
||||
}
|
||||
|
||||
.column-header {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.form-section {
|
||||
border: 1px solid #ccc;
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.row-box {
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<div class="row" id="leads_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Leads List</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-3" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;">
|
||||
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" onclick="hide_list_show_add();">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th><div class="column-header">S.No.</div></th>
|
||||
<th><div class="column-header">Lead Type</div></th>
|
||||
<th><div class="column-header">Issuer</div></th>
|
||||
<th><div class="column-header">Client Type</div></th>
|
||||
<th><div class="column-header">Client / Branch</div></th>
|
||||
<th><div class="column-header">Entity Type</div></th>
|
||||
<th><div class="column-header">Branch Name</div></th>
|
||||
<th><div class="column-header">Branch Code</div></th>
|
||||
<th><div class="column-header">Contact Person Name</div></th>
|
||||
<th><div class="column-header">Contact Person Mobile</div></th>
|
||||
<th><div class="column-header">Policy Type</div></th>
|
||||
<th><div class="column-header">Status</div></th>
|
||||
<th><div class="column-header">Action</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if(isset($lead_data_list) && count($lead_data_list) > 0) { ?>
|
||||
<?php foreach($lead_data_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $index + 1; ?></td>
|
||||
<td><?php echo $lead_type[$row['lead_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $issuer[$row['issuer']] ?? '-'; ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $row['client_type'] == 2 ? ($row['client_name'] ?? '-') : (($row['client_short_name'] ?? '-') . ' - ' . ($row['branch_name'] ?? '-')); ?></td>
|
||||
<td><?php echo $row['entity_type'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['branch_name'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['branch_code'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['contact_person_name'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['contact_person_mobile'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['policy_type'] ?? '-'; ?></td>
|
||||
<td><?php echo $lead_status[$row['status']] ?? '-'; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="mdi mdi-dots-horizontal"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td colspan="14" class="text-center">No data available</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
|
||||
|
||||
<?php include('leads_form.php'); ?>
|
||||
|
||||
<script>
|
||||
|
||||
var client_list = ''; // local variable for storing the client branch list
|
||||
var branch_list = ''; // local variable for storing the client branch list
|
||||
var policy_list = ''; // local variable for storing the client policy list
|
||||
|
||||
|
||||
// select2 document ready
|
||||
$(document).ready(function(){
|
||||
|
||||
getClientAndBranchAndPolicy()
|
||||
|
||||
<?php if (session()->has('create_failed')) : ?>
|
||||
toastr.error('<?= session()->getFlashdata('create_failed') ?>', 'Failed');
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (session()->has('update_failed')) : ?>
|
||||
toastr.error('<?= session()->getFlashdata('update_failed') ?>', 'Failed');
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (session()->has('create_success')) : ?>
|
||||
toastr.success('<?= session()->getFlashdata('create_success') ?>', 'success');
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (session()->has('update_success')) : ?>
|
||||
toastr.success('<?= session()->getFlashdata('update_success') ?>', 'success');
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
$('#client_id').select2();
|
||||
$('#client_branch_id').select2();
|
||||
$('#source_policy_id').select2();
|
||||
$('#salse_person_id').select2({
|
||||
placeholder: "Select Salse Person",
|
||||
});
|
||||
|
||||
$('#policy_type_id').select2();
|
||||
})
|
||||
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#tickets-table');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Policy-Tranction-Inception-List',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}, ],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
// ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function hide_list_show_add()
|
||||
{
|
||||
$('#leads_list').hide()
|
||||
$('#leads_form').show()
|
||||
}
|
||||
|
||||
function show_list_hide_add()
|
||||
{
|
||||
$('#leads_list').show()
|
||||
$('#leads_form').hide()
|
||||
}
|
||||
|
||||
function getClientAndBranchAndPolicy()
|
||||
{
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
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;
|
||||
appendClients(res.client_data);
|
||||
}else{
|
||||
console.log('No data found');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function appendClients(data)
|
||||
{
|
||||
$('#client_id').empty();
|
||||
|
||||
$('#client_id').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Client'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
'data-cn': item.client_name,
|
||||
'data-ct': item.client_type,
|
||||
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
|
||||
});
|
||||
|
||||
$('#client_id').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendBranch(data)
|
||||
{
|
||||
|
||||
$('#client_branch_id').empty();
|
||||
|
||||
$('#client_branch_id').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Branch'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.branch_name
|
||||
});
|
||||
$('#client_branch_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
function appendRenewalPolicies(data)
|
||||
{
|
||||
console.log('appendRenewalPolicies', data);
|
||||
|
||||
$('#source_policy_id').empty();
|
||||
|
||||
$('#source_policy_id').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Policy',
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.policy_type + '-' + item.policy_no,
|
||||
});
|
||||
$('#source_policy_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#client_id').change(function(){
|
||||
|
||||
let client_id = $(this).val();
|
||||
let client_type = $('#client_id option:selected').data('ct');
|
||||
|
||||
if(branch_list != '' && client_id != '') {
|
||||
console.log('branch_list', branch_list[client_id]);
|
||||
let data = branch_list[client_id];
|
||||
appendBranch(data);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('#client_branch_id').change(function(){
|
||||
|
||||
let client_branch_id = $(this).val();
|
||||
|
||||
if(policy_list != '' && client_branch_id != '') {
|
||||
console.log('policy_list', policy_list[client_branch_id]);
|
||||
let data = policy_list[client_branch_id];
|
||||
appendRenewalPolicies(data);
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
</script>
|
||||
@ -249,7 +249,7 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 500);
|
||||
|
||||
$('#nameOfThePolicyOnOther').html(' - ' + res.policy_name.name);
|
||||
// $('#nameOfThePolicyOnOther').html(' - ' + res.policy_name.name);
|
||||
|
||||
|
||||
$('#emp_count').val(res.count)
|
||||
|
||||
426
app/Views/outstanding_report_list.php
Normal file
426
app/Views/outstanding_report_list.php
Normal file
@ -0,0 +1,426 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.center-align-input {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="outstanding_filter">
|
||||
<div class="col-12" style="margin-top: -12px;">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="0">Select Client</option>
|
||||
<?php
|
||||
if (isset($clients) && count($clients)) {
|
||||
foreach ($clients as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy"> Insurer <span id="base_danger"
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id">
|
||||
<option value="0" selected>Select Insurer</option>
|
||||
<?php if(isset($insurer) && count($insurer)){ ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id']?>"><?= $value['name']?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="email"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_type_id" name="policy_type_id">
|
||||
<option value="0">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_types) && count($policy_types)) {
|
||||
foreach ($policy_types as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Date Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="date_type" name="date_type"
|
||||
onchange="hideDateField()">
|
||||
<option value="0">Select Date Type</option>
|
||||
<?php
|
||||
if (isset($date_type) && count($date_type)) {
|
||||
foreach ($date_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="display: none;" id="date_div">
|
||||
<label>Date<span class="text-danger"></span></label>
|
||||
<div id="reportrange" class="form-control"
|
||||
style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span></span> <i class="fa fa-caret-down"></i>
|
||||
</div>
|
||||
<input type="hidden" id="startDate">
|
||||
<input type="hidden" id="endDate">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<a href="<?= base_url("/policy_tranction/report/report-outstanding-list"); ?>"
|
||||
class="btn btn-secondary" id="clear-filters">Clear</a>
|
||||
<a href="<?= base_url("/policy_tranction/report/report-outstanding-list"); ?>"
|
||||
class="btn btn-primary" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" id="outstanding_list">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Outstanding Report</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S.No</th>
|
||||
<th>Client Name</th>
|
||||
<th>Insurer</th>
|
||||
<th>Policy</th>
|
||||
<th>Endorsement No</th>
|
||||
<th>Invoice Status</th>
|
||||
<th>Invoice Amount</th>
|
||||
<th>Realization Amount</th>
|
||||
<th>Outstanding Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($outstanding_list)) { ?>
|
||||
<?php foreach($outstanding_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<td><?php echo $row['insurer_name']; ?></td>
|
||||
<td><?php echo $row['policy_type'] .' - '. $row['policy_no']; ?></td>
|
||||
<td><?php echo $row['endorsement_no']; ?></td>
|
||||
<td class="center-align-input"><?php echo isset($row['invoice_status']) ? $row['invoice_status'] : ' - '; ?></td>
|
||||
<td class="right-align-input"><?php echo isset($row['invoice_amount']) ? $row['invoice_amount'] : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo isset($row['realization_amount']) ? $row['realization_amount'] : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo isset($row['outstanding_amount']) ? $row['outstanding_amount'] : '0.00'; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
// Find cells in column AB (28th column in Excel)
|
||||
$('row c[r^="AB"]', sheet).each(function() {
|
||||
var value = parseFloat($('v', this)
|
||||
.text()); // Get the value inside the cell
|
||||
if (!isNaN(value)) {
|
||||
total += value;
|
||||
}
|
||||
});
|
||||
|
||||
// Get the last row index and append the total row
|
||||
var lastRow = $('row:last', sheet);
|
||||
var rowIndex = parseInt(lastRow.attr('r')) +
|
||||
2; // Find the next row index
|
||||
var totalRow = '<row r="' + rowIndex + '">' +
|
||||
'<c t="inlineStr" r="AA' + rowIndex +
|
||||
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
||||
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
|
||||
'</v></c>' + // Insert sum in AB
|
||||
'</row>';
|
||||
|
||||
// Append the new total row to the sheet
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25 // Set default number of rows per page (optional)
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
getURLParams()
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
$('#policy_type_id').select2();
|
||||
})
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var start_date = $('#startDate').val();
|
||||
var end_date = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
var policy_type_id = $('#policy_type_id').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
var queryParams = {
|
||||
start_date: start_date,
|
||||
end_date: end_date,
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
policy_type_id: policy_type_id,
|
||||
date_type: date_type,
|
||||
issuer: issuer,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function getURLParams() {
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
|
||||
hideDateField(date_type)
|
||||
|
||||
console.log('startDate', startDate)
|
||||
console.log('endDate', endDate)
|
||||
console.log('client_id', client_id)
|
||||
console.log('insurer_id', insurer_id)
|
||||
console.log('policy_type_id', policy_type_id)
|
||||
console.log('date_type', date_type)
|
||||
console.log('issuer', issuer)
|
||||
|
||||
// Log the values or use them as needed
|
||||
console.log('Start Date:', startDate);
|
||||
console.log('End Date:', endDate);
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function() {
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id').val(client_id).change()
|
||||
$('#insurer_id').val(insurer_id).change()
|
||||
$('#policy_type_id').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer').val(issuer)
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
// Get start and end dates from URL parameters, or use default values
|
||||
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
|
||||
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
|
||||
|
||||
// Parse the dates to moment objects
|
||||
var start = moment(startDateParam, 'DD-MM-YYYY');
|
||||
var end = moment(endDateParam, 'DD-MM-YYYY');
|
||||
|
||||
// var start = moment().subtract(29, 'days');
|
||||
// var end = moment();
|
||||
|
||||
function cb(start, end) {
|
||||
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
|
||||
$('#startDate').val(start.format('DD-MM-YYYY'));
|
||||
$('#endDate').val(end.format('DD-MM-YYYY'));
|
||||
}
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
|
||||
.endOf('month')
|
||||
]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
|
||||
$('#clear-filters').on('click', function() {
|
||||
// Reset all select dropdowns to the first option
|
||||
$('#client_id').val('0').change();
|
||||
$('#insurer_id').val('0').change();
|
||||
$('#policy_type_id').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer').val('0');
|
||||
$('#date_div').hide()
|
||||
|
||||
// Reset the date range picker to default
|
||||
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
|
||||
$('#reportrange').data('daterangepicker').setEndDate(moment());
|
||||
cb(start, end); // Update the displayed date range
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function hideDateField(input = null) {
|
||||
let val = $('#date_type').val();
|
||||
|
||||
if (input) {
|
||||
val = input;
|
||||
}
|
||||
|
||||
if (val != 0) {
|
||||
$('#date_div').show()
|
||||
} else {
|
||||
$('#date_div').hide()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sendPolicyTransactionID(event, pt_id) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
console.log(pt_id);
|
||||
|
||||
var queryParams = {
|
||||
pt_id: pt_id,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-policy-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
</script>
|
||||
@ -344,7 +344,6 @@ var terms_si_amount_array = [];
|
||||
var unit_length = 0;
|
||||
var branch_units = [];
|
||||
|
||||
|
||||
$('body').on('click', '.btnPolicyModel', function()
|
||||
{
|
||||
$('#tab_content .tab-pane').not('#primary_rack_rate_tab').remove();
|
||||
@ -3063,7 +3062,7 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
|
||||
`;
|
||||
|
||||
console.log(html);
|
||||
// console.log(html);
|
||||
|
||||
$relationshipElement.append(html);
|
||||
|
||||
@ -3920,7 +3919,7 @@ function appendFourthAndSixthRackRate(data = null, uniqueId = null)
|
||||
}
|
||||
|
||||
if(unit_length == 1){
|
||||
toAddUnitInManuall(unique_id, branch_units[0], 'appendFourthAndSixthRackRate')
|
||||
toAddUnitInManuall(uniqueId, branch_units[0], 'appendFourthAndSixthRackRate')
|
||||
}
|
||||
}
|
||||
|
||||
@ -4353,21 +4352,23 @@ function applyStyles(tabId) {
|
||||
function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
|
||||
console.log('toAddUnitInManuall unique_id', unique_id)
|
||||
console.log('toAddUnitInManuall unique_id', typeof unique_id)
|
||||
console.log('toAddUnitInManuall whichFunction', whichFunction)
|
||||
|
||||
var id = $('#grid')[0];
|
||||
var id = $('#grid').val();
|
||||
console.log(id);
|
||||
var container = $('#grid_content_input');
|
||||
|
||||
if (unique_id) {
|
||||
id = $('#grid_'+unique_id)[0];
|
||||
if (unique_id !== 'null' && unique_id !== null && unique_id !== false && unique_id !== 'false') {
|
||||
id = $('#grid_'+unique_id).val();
|
||||
console.log(id);
|
||||
container = $('#grid_content_input_for_additional_'+unique_id);
|
||||
}
|
||||
|
||||
console.log('checkValideUnits id', id);
|
||||
console.log('checkValideUnits container', container);
|
||||
|
||||
if (id.value === '3') {
|
||||
if (id === '3') {
|
||||
|
||||
var units = container.find('input[name="3_unit[]"]');
|
||||
var unitValues = [];
|
||||
@ -4376,7 +4377,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '4') {
|
||||
} else if (id === '4') {
|
||||
|
||||
var units = container.find('input[name="4_unit[]"]');
|
||||
var unitValues = [];
|
||||
@ -4385,7 +4386,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '2' || id.value === '9') {
|
||||
} else if (id === '2' || id === '9') {
|
||||
|
||||
var units = container.find('input[name="gpa_unit29[]"]');
|
||||
|
||||
@ -4393,7 +4394,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '5') {
|
||||
} else if (id === '5') {
|
||||
|
||||
var units = container.find('input[name="5_unit[]"]');
|
||||
|
||||
@ -4401,7 +4402,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '6') {
|
||||
} else if (id === '6') {
|
||||
|
||||
var units = container.find('input[name="6_unit[]"]');
|
||||
|
||||
@ -4409,7 +4410,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '7') {
|
||||
} else if (id === '7') {
|
||||
|
||||
var units = container.find('input[name="7_unit[]"]');
|
||||
|
||||
@ -4417,7 +4418,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '10') {
|
||||
} else if (id === '10') {
|
||||
|
||||
var units = container.find('input[name="10_unit[]"]');
|
||||
|
||||
@ -4425,7 +4426,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '8') {
|
||||
} else if (id === '8') {
|
||||
|
||||
var units = container.find('input[name="8_unit[]"]');
|
||||
|
||||
@ -4433,7 +4434,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '11') {
|
||||
} else if (id === '11') {
|
||||
|
||||
var units = container.find('input[name="11_unit[]"]');
|
||||
|
||||
@ -4441,7 +4442,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '12') {
|
||||
} else if (id === '12') {
|
||||
|
||||
var units = container.find('input[name="12_unit[]"]');
|
||||
|
||||
@ -4449,7 +4450,7 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '13') {
|
||||
} else if (id === '13') {
|
||||
|
||||
var units = container.find('input[name="13_unit[]"]');
|
||||
|
||||
@ -4457,23 +4458,27 @@ function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '1') {
|
||||
} else if (id === '1') {
|
||||
|
||||
console.log('checkValideUnits id', id);
|
||||
|
||||
var selectedValue = $('#si_or_bp').val();
|
||||
if (selectedValue == 1) {
|
||||
|
||||
console.log('checkValideUnits id 1', id);
|
||||
var units = container.find('input[name="gpa_unit_1[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
$(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (selectedValue == 3) {
|
||||
|
||||
console.log('checkValideUnits id 3', id);
|
||||
var units = container.find('input[name="gpa_unit_3[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
$(this).val(branch_unit);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -362,29 +362,36 @@
|
||||
<td>Total</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
<tr id="table_tr_14">
|
||||
<td>Agreed BP %</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_15">
|
||||
<td id="agree_tp_td">Agreed TP %</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_16" style="display: none;">
|
||||
<td id="agree_tp_td">Agreed TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<tr id="table_tr_14">
|
||||
<td>Agreed BP %</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_15">
|
||||
<td id="agree_tp_td">Agreed TP %</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_16" style="display: none;">
|
||||
<td id="agree_tp_td">Agreed TEP %</td>
|
||||
</tr>
|
||||
<tr id="table_tr_17">
|
||||
<td>Agreed Amount</td>
|
||||
</tr>
|
||||
<tr id="table_tr_18">
|
||||
<td>Standard BP %</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_19">
|
||||
<td>Standard TP %</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_20" style="display: none;">
|
||||
<td>Standard TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<tr id="table_tr_18">
|
||||
<td>Standard BP %</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_19">
|
||||
<td>Standard TP %</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_20" style="display: none;">
|
||||
<td>Standard TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<tr id="table_tr_21">
|
||||
<td>Actual BP Amount</td>
|
||||
</tr>
|
||||
@ -427,8 +434,6 @@
|
||||
<tr id="table_tr_33" style="display: none;">
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -954,6 +959,12 @@ function amountCalculation(input) {
|
||||
let standard_tp_per = parseFloat($('#standard_tp_' + input).val()) || 0;
|
||||
let standard_tep_per = parseFloat($('#standard_tep_' + input).val()) || 0;
|
||||
|
||||
let co_share_per = parseFloat($('#co_share_per_' + input).val()) || 0;
|
||||
|
||||
let co_premium_amt = ((bp + tp + tep) * co_share_per) / 100;
|
||||
$('#co_premium_' + input).val(!isNaN(co_premium_amt) && isFinite(co_premium_amt) ? co_premium_amt.toFixed(2) : '0.00');
|
||||
|
||||
|
||||
// Calculate GST percentage
|
||||
let gst_per = igst;
|
||||
if (igst === 0) {
|
||||
@ -1226,6 +1237,65 @@ function actualAmountCalculation(input, field = null){
|
||||
// console.log('variance', variance);
|
||||
}
|
||||
|
||||
function co_share_percentage_calculation(input){
|
||||
|
||||
var inputs = $('[name="co_share_per[]"]');
|
||||
|
||||
// Find the empty input(s)
|
||||
var emptyInputs = inputs.filter(function() {
|
||||
return $(this).val().trim() === ''; // Check for empty values
|
||||
});
|
||||
|
||||
// Get the number of empty inputs
|
||||
var emptyCount = emptyInputs.length;
|
||||
console.log('Number of empty inputs:', emptyCount);
|
||||
|
||||
// If there's exactly one empty input, calculate and set its value
|
||||
if (emptyCount === 1) {
|
||||
// Calculate the sum of filled values
|
||||
let sumFilled = 0;
|
||||
inputs.each(function() {
|
||||
var val = parseFloat($(this).val()) || 0;
|
||||
sumFilled += val;
|
||||
});
|
||||
|
||||
// Calculate the balance percentage
|
||||
let balance_per = 100 - sumFilled;
|
||||
console.log('Balance percentage:', balance_per);
|
||||
|
||||
// Set the balance value to the empty input
|
||||
emptyInputs.val(balance_per);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function select_leader_disable_premium_amt(input, value) {
|
||||
if ($(input).is(':checked')) {
|
||||
// Disable and add readonly-select class to all premiums except the one with the given value
|
||||
$('input[name="base_premium[]"]').addClass('readonly-select');
|
||||
$('#base_premium_' + value).removeClass('readonly-select');
|
||||
|
||||
$('input[name="tp_premium[]"]').addClass('readonly-select');
|
||||
$('#tp_premium_' + value).removeClass('readonly-select');
|
||||
|
||||
$('input[name="ter_premium[]"]').addClass('readonly-select');
|
||||
$('#ter_premium_' + value).removeClass('readonly-select');
|
||||
|
||||
$('input[name="stamp_duty[]"]').addClass('readonly-select');
|
||||
$('#stamp_duty_' + value).removeClass('readonly-select');
|
||||
|
||||
$('input[name="co_premium[]"]').addClass('readonly-select');
|
||||
$('#co_premium_' + value).removeClass('readonly-select');
|
||||
} else {
|
||||
// Enable and remove readonly-select class from all premiums except the one with the given value
|
||||
$('input[name="base_premium[]"]').removeClass('readonly-select');
|
||||
$('input[name="tp_premium[]"]').removeClass('readonly-select');
|
||||
$('input[name="ter_premium[]"]').removeClass('readonly-select');
|
||||
$('input[name="stamp_duty[]"]').removeClass('readonly-select');
|
||||
$('input[name="co_premium[]"]').removeClass('readonly-select');
|
||||
}
|
||||
}
|
||||
|
||||
function validateRange(input) {
|
||||
// if (input.value < 1) input.value = 1;
|
||||
if (input.value > 100) input.value = 100;
|
||||
@ -1386,14 +1456,206 @@ function addInsurerColumn() {
|
||||
case 1: // Is Leader?
|
||||
newCell = `<td>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]" onchange="select_leader_disable_premium_amt(this, '${insurerCount}')">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
</td>`;
|
||||
break;
|
||||
case 2: // Co-Share %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="co_share_per[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="co_share_per[]" oninput="validateRange(this)" onchange="co_share_percentage_calculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 3: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 4: // TP Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 5: // Ter Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="ter_premium_${insurerCount}" name="ter_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 6: // co Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="co_premium_${insurerCount}" name="co_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 7: // CGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 8: // SGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 9: // IGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 10: // GST Amount
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="gst_amount_${insurerCount}" name="gst_amount[]" oninput="amountCalculation('${insurerCount}')" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 11: // Stamp Duty
|
||||
newCell = `<td><input type="text" class="right-align-input" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 12: // Total
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 13: // Agreed BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_bp_${insurerCount}" name="agreed_bp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 14: // Agreed TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_tp_${insurerCount}" name="agreed_tp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 15: // Agreed Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_tep_${insurerCount}" name="agreed_ter[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 16: // Standard BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_bp_${insurerCount}" name="standard_bp[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 17: // Standard TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" name="standard_tp[]" onkeypress="return onlyNumbers(event)" readonly ></td>`;
|
||||
break;
|
||||
case 18: // Standard Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" name="standard_ter[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 19: // Actual BP Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_bp_amt_${insurerCount}" name="actual_bp_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'bp_amt_for_calc')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 20: // Actual TP Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_tp_amt_${insurerCount}" name="actual_tp_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tp_amt_for_calc')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 21: // Actual TEP Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_tep_amt_${insurerCount}" name="actual_tep_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tep_amt_for_calc')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 22: // Actual BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="actual_bp_per_${insurerCount}" name="actual_bp_per[]" onchange="actualAmountCalculation('${insurerCount}', 'bp_per')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 23: // Actual TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="actual_tp_per_${insurerCount}" name="actual_tp_per[]" onchange="actualAmountCalculation('${insurerCount}', 'tp_per')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 24: // Actual TEP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="actual_tep_per_${insurerCount}" name="actual_tep_per[]" onchange="actualAmountCalculation('${insurerCount}', 'tep_per')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 25: // Actual BP Brokerage Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_bp_brokerage_amt_${insurerCount}" name="actual_bp_brokerage_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'bp_broker_amt')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 26: // Actual TP Brokerage Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_tp_brokerage_amt_${insurerCount}" name="actual_tp_brokerage_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tp_broker_amt' )" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 27: // Actual TEP Brokerage Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_tep_brokerage_amt_${insurerCount}" name="actual_tep_brokerage_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tep_broker_amt')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 28: // Expected Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="exp_amt_${insurerCount}" name="exp_amt[]" onchange="actualAmountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 29: // Variance
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="variance_${insurerCount}" name="variance[]" onchange="actualAmountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 30: // Reward
|
||||
newCell = `<td><input type="text" class="right-align-input" id="reward_${insurerCount}" name="reward[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 31: // ID For Update
|
||||
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
}
|
||||
}else if(team_id.includes('3')){
|
||||
switch(index) {
|
||||
case 0: // Insurer selection
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer readonly-select" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
newCell = `<td>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]" onchange="select_leader_disable_premium_amt(this, '${insurerCount}')">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
</td>`;
|
||||
break;
|
||||
case 2: // Co-Share %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="co_share_per[]" oninput="validateRange(this)" onchange="co_share_percentage_calculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 3: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 4: // TP Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 5: // Ter Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="ter_premium_${insurerCount}" name="ter_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 6: // co Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="co_premium_${insurerCount}" name="co_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 7: // CGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 8: // SGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 9: // IGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 10: // GST Amount
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="gst_amount_${insurerCount}" name="gst_amount[]" oninput="amountCalculation('${insurerCount}')" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 11: // Stamp Duty
|
||||
newCell = `<td><input type="text" class="right-align-input" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 12: // Total
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 13: // Agreed BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_bp_${insurerCount}" name="agreed_bp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 14: // Agreed TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_tp_${insurerCount}" name="agreed_tp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 15: // Agreed Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_tep_${insurerCount}" name="agreed_ter[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 16: // Standard BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_bp_${insurerCount}" name="standard_bp[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 17: // Standard TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" name="standard_tp[]" onkeypress="return onlyNumbers(event)" readonly ></td>`;
|
||||
break;
|
||||
case 18: // Standard Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" name="standard_ter[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 19: // ID For Update
|
||||
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
}
|
||||
}else if(team_id.includes('6')){
|
||||
switch(index) {
|
||||
case 0: // Insurer selection
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer readonly-select" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
newCell = `<td>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]" onchange="select_leader_disable_premium_amt(this, '${insurerCount}')">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
</td>`;
|
||||
break;
|
||||
case 2: // Co-Share %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="co_share_per[]" oninput="validateRange(this)" onchange="co_share_percentage_calculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 3: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
@ -1486,69 +1748,6 @@ function addInsurerColumn() {
|
||||
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
}
|
||||
}else if(team_id.includes('3')){
|
||||
switch(index) {
|
||||
case 0: // Insurer selection
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer readonly-select" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
newCell = `<td>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
</td>`;
|
||||
break;
|
||||
case 2: // Co-Share %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="co_share_per[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 3: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 4: // TP Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 5: // Ter Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="ter_premium_${insurerCount}" name="ter_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 6: // co Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="co_premium_${insurerCount}" name="co_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 7: // CGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 8: // SGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 9: // IGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 10: // GST Amount
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="gst_amount_${insurerCount}" name="gst_amount[]" oninput="amountCalculation('${insurerCount}')" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 11: // Stamp Duty
|
||||
newCell = `<td><input type="text" class="right-align-input" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 12: // Total
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 13: // Agreed BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_bp_${insurerCount}" name="agreed_bp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 14: // ID For Update
|
||||
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// console.log(newCell);
|
||||
|
||||
@ -1668,7 +1867,154 @@ function populateTable(dataArray, status = false) {
|
||||
cell.find('select').val(insurer);
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1');
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1').change();
|
||||
break;
|
||||
case 2: // Co-Share %
|
||||
cell.find('input').val(data.co_share_per);
|
||||
break;
|
||||
case 3: // Base Premium
|
||||
cell.find('input').val(status ? data.bp_amt : '');
|
||||
break;
|
||||
case 4: // TP Premium
|
||||
cell.find('input').val(status ? data.tp_amt : '');
|
||||
break;
|
||||
case 5: // Ter Premium
|
||||
cell.find('input').val(status ? data.tep_amt : '');
|
||||
break;
|
||||
case 6: // Co Premium
|
||||
cell.find('input').val(data.cop_amt);
|
||||
break;
|
||||
case 7: // CGST
|
||||
cell.find('input').val(data.bp_cgst);
|
||||
break;
|
||||
case 8: // SGST
|
||||
cell.find('input').val(data.bp_sgst);
|
||||
break;
|
||||
case 9: // IGST
|
||||
cell.find('input').val(data.bp_igst);
|
||||
break;
|
||||
case 10: // GST Amount
|
||||
cell.find('input').val(status ? data.bp_gst_amt : '');
|
||||
break;
|
||||
case 11: // Stamp Duty
|
||||
cell.find('input').val(status ? data.stamp_duty : '');
|
||||
break;
|
||||
case 12: // Total
|
||||
cell.find('input').val(status ? data.amount : '');
|
||||
break;
|
||||
case 13: // Agreed BP %
|
||||
cell.find('input').val(data.agreed_bp_per);
|
||||
break;
|
||||
case 14: // Agreed TP %
|
||||
cell.find('input').val(data.agreed_tp_per);
|
||||
break;
|
||||
case 15: // Agreed Ter %
|
||||
cell.find('input').val(data.agreed_tep_per);
|
||||
break;
|
||||
case 16: // Standard BP %
|
||||
cell.find('input').val(data.standerd_bp_per);
|
||||
break;
|
||||
case 17: // Standard TP %
|
||||
cell.find('input').val(data.standerd_tp_per);
|
||||
break;
|
||||
case 18: // Standard Ter %
|
||||
cell.find('input').val(data.standerd_tep_per);
|
||||
break;
|
||||
case 19: // Actual BP Amount
|
||||
cell.find('input').val(status ? data.actual_bp_amt : '');
|
||||
break;
|
||||
case 20: // Actual TP Amount
|
||||
cell.find('input').val(status ? data.actual_tp_amt : '');
|
||||
break;
|
||||
case 21: // Actual Ter Amount
|
||||
cell.find('input').val(status ? data.actual_tep_amt : '');
|
||||
break;
|
||||
case 22: // Actual BP %
|
||||
cell.find('input').val(status ? data.actual_bp_per : '');
|
||||
break;
|
||||
case 23: // Actual TP %
|
||||
cell.find('input').val(status ? data.actual_tp_per : '');
|
||||
break;
|
||||
case 24: // Actual Ter %
|
||||
cell.find('input').val(status ? data.actual_tep_per : '');
|
||||
break;
|
||||
case 25: // Actual BP Brokerage Amount
|
||||
cell.find('input').val(status ? data.actual_bp_brokerage_amt : '');
|
||||
break;
|
||||
case 26: // Actual TP Brokerage Amount
|
||||
cell.find('input').val(status ? data.actual_tp_brokerage_amt : '');
|
||||
break;
|
||||
case 27: // Actual Ter Brokerage Amount
|
||||
cell.find('input').val(status ? data.actual_tep_brokerage_amt : '');
|
||||
break;
|
||||
case 28: // Expected Amount
|
||||
cell.find('input').val(status ? data.exp_amt : '');
|
||||
break;
|
||||
case 29: // Variance
|
||||
cell.find('input').val(status ? data.variance : '');
|
||||
break;
|
||||
case 30: // Reward
|
||||
cell.find('input').val(status ? data.reward : '');
|
||||
break;
|
||||
case 31: // Co-share ID (hidden field)
|
||||
cell.find('input[type="hidden"]').val(status ? data.id : '');
|
||||
break;
|
||||
}
|
||||
}else if(team_id.includes('3')){
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer);
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1').change();
|
||||
break;
|
||||
case 2: // Co-Share %
|
||||
cell.find('input').val(data.co_share_per);
|
||||
break;
|
||||
case 3: // Base Premium
|
||||
cell.find('input').val(status ? data.bp_amt : '');
|
||||
break;
|
||||
case 4: // TP Premium
|
||||
cell.find('input').val(status ? data.tp_amt : '');
|
||||
break;
|
||||
case 5: // Ter Premium
|
||||
cell.find('input').val(status ? data.tep_amt : '');
|
||||
break;
|
||||
case 6: // Co Premium
|
||||
cell.find('input').val(data.cop_amt);
|
||||
break;
|
||||
case 7: // CGST
|
||||
cell.find('input').val(data.bp_cgst);
|
||||
break;
|
||||
case 8: // SGST
|
||||
cell.find('input').val(data.bp_sgst);
|
||||
break;
|
||||
case 9: // IGST
|
||||
cell.find('input').val(data.bp_igst);
|
||||
break;
|
||||
case 10: // GST Amount
|
||||
cell.find('input').val(status ? data.bp_gst_amt : '');
|
||||
break;
|
||||
case 11: // Stamp Duty
|
||||
cell.find('input').val(status ? data.stamp_duty : '');
|
||||
break;
|
||||
case 12: // Total
|
||||
cell.find('input').val(status ? data.amount : '');
|
||||
break;
|
||||
case 13: // Agreed BP %
|
||||
cell.find('input').val(data.agreed_bp_per);
|
||||
break;
|
||||
case 14: // Co-share ID (hidden field)
|
||||
cell.find('input[type="hidden"]').val(status ? data.id : '');
|
||||
break;
|
||||
}
|
||||
}else if(team_id.includes('6')){
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer);
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1').change();
|
||||
break;
|
||||
case 2: // Co-Share %
|
||||
cell.find('input').val(data.co_share_per);
|
||||
@ -1764,54 +2110,6 @@ function populateTable(dataArray, status = false) {
|
||||
cell.find('input[type="hidden"]').val(status ? data.id : '');
|
||||
break;
|
||||
}
|
||||
}else if(team_id.includes('3')){
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer);
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1');
|
||||
break;
|
||||
case 2: // Co-Share %
|
||||
cell.find('input').val(data.co_share_per);
|
||||
break;
|
||||
case 3: // Base Premium
|
||||
cell.find('input').val(status ? data.bp_amt : '');
|
||||
break;
|
||||
case 4: // TP Premium
|
||||
cell.find('input').val(status ? data.tp_amt : '');
|
||||
break;
|
||||
case 5: // Ter Premium
|
||||
cell.find('input').val(status ? data.tep_amt : '');
|
||||
break;
|
||||
case 6: // Co Premium
|
||||
cell.find('input').val(data.cop_amt);
|
||||
break;
|
||||
case 7: // CGST
|
||||
cell.find('input').val(data.bp_cgst);
|
||||
break;
|
||||
case 8: // SGST
|
||||
cell.find('input').val(data.bp_sgst);
|
||||
break;
|
||||
case 9: // IGST
|
||||
cell.find('input').val(data.bp_igst);
|
||||
break;
|
||||
case 10: // GST Amount
|
||||
cell.find('input').val(status ? data.bp_gst_amt : '');
|
||||
break;
|
||||
case 11: // Stamp Duty
|
||||
cell.find('input').val(status ? data.stamp_duty : '');
|
||||
break;
|
||||
case 12: // Total
|
||||
cell.find('input').val(status ? data.amount : '');
|
||||
break;
|
||||
case 13: // Agreed BP %
|
||||
cell.find('input').val(data.agreed_bp_per);
|
||||
break;
|
||||
case 14: // Co-share ID (hidden field)
|
||||
cell.find('input[type="hidden"]').val(status ? data.id : '');
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -155,6 +155,7 @@
|
||||
|
||||
<!-- <input type="hidden" id="cd_ac_no_for_edit"> -->
|
||||
<input type="hidden" id="premium_details_unique_id">
|
||||
<input type="hidden" id="policy_tranction_policy_number">
|
||||
|
||||
<!-- Client Row -->
|
||||
<div class="row">
|
||||
@ -353,7 +354,18 @@
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="ppteam">PP Team</label>
|
||||
<input id="ppteam" value="" type="text" class="form-control" name="ppteam">
|
||||
<!-- <input id="ppteam" type="text" class="form-control" name="ppteam"> -->
|
||||
<select class="form-control" id="ppteam" name="ppteam">
|
||||
<option value="">Select PP Team</option>
|
||||
<?php if (isset($ppTeamsData)) { ?>
|
||||
<?php foreach ($ppTeamsData as $value) { ?>
|
||||
<option value="<?= $value['id'];?>">
|
||||
<?= $value['first_name'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
@ -573,6 +585,7 @@
|
||||
<div id="collapseFour" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_3">
|
||||
<div class="row d-none" id="add_more_row">
|
||||
<div class="col-md-2">
|
||||
<label for="setInsurerCount">Insurer Count : </label>
|
||||
<input type="number" id="setInsurerCount" class="form-control" placeholder="Enter count">
|
||||
</div>
|
||||
<!-- <div class="col-md-2">
|
||||
@ -634,29 +647,36 @@
|
||||
<td>Total</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
<tr id="table_tr_14">
|
||||
<td>Agreed BP %</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_15">
|
||||
<td id="agree_tp_td">Agreed TP %</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_16" style="display: none;">
|
||||
<td id="agree_tp_td">Agreed TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<tr id="table_tr_14">
|
||||
<td>Agreed BP %</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_15">
|
||||
<td id="agree_tp_td">Agreed TP %</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_16" style="display: none;">
|
||||
<td id="agree_tp_td">Agreed TEP %</td>
|
||||
</tr>
|
||||
<tr id="table_tr_17">
|
||||
<td>Agreed Amount</td>
|
||||
</tr>
|
||||
<tr id="table_tr_18">
|
||||
<td>Standard BP %</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_19">
|
||||
<td>Standard TP %</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_20" style="display: none;">
|
||||
<td>Standard TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<tr id="table_tr_18">
|
||||
<td>Standard BP %</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_19">
|
||||
<td>Standard TP %</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_20" style="display: none;">
|
||||
<td>Standard TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<tr id="table_tr_21">
|
||||
<td>Actual BP Amount</td>
|
||||
</tr>
|
||||
@ -1234,6 +1254,7 @@ $(document).on('input', '[name="igst[]"]', function() {
|
||||
$(document).on('click', '[name="co_share_type[]"]', function() {
|
||||
|
||||
let val = $(this).val();
|
||||
console.log(val);
|
||||
let uniqueid = $(this).data('id');
|
||||
let insurer = $('#follow_insurer_id_'+uniqueid).val()
|
||||
|
||||
@ -1249,6 +1270,7 @@ $(document).on('click', '[name="co_share_type[]"]', function() {
|
||||
toastr.warning('Please select the insurer.', 'WARNING!');
|
||||
$(this).prop('checked', false);
|
||||
}else{
|
||||
|
||||
$('#insurer_id').val(insurer)
|
||||
// if(client_id && insurer_id){
|
||||
// // $('#insurer_id').val(insurer)
|
||||
@ -1380,6 +1402,7 @@ function getPolicyTransactionDataForEdit(input) {
|
||||
$('#client_id_for_vehicle_file_upload').val(res.data.client_id);
|
||||
$('#vehicle_id_for_file_upload').val(res.data.vehicle_id);
|
||||
$('#client_policy_id_for_file_upload').val(res.data.client_policy_id);
|
||||
$('#policy_tranction_policy_number').val(res.data.policy_no);
|
||||
|
||||
// $('#cd_ac_no_for_edit').val(res.data.cd_ac_no);
|
||||
$('#cd_ac_no').val(res.data.cd_ac_no);
|
||||
@ -1459,12 +1482,8 @@ function getPolicyTransactionDataForEdit(input) {
|
||||
$('#client_branch_id').val(res.data.client_branch_id).change();
|
||||
$('#source_client_policy_id').val(res.data.source_client_policy_id).change();
|
||||
$('#base_policy').val(res.data.base_policy).select2();
|
||||
//console.log('---------------------------------------------------------------')
|
||||
//console.log('second')
|
||||
//console.log('---------------------------------------------------------------')
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 2000);
|
||||
|
||||
setTimeout(function(){
|
||||
@ -1472,9 +1491,14 @@ function getPolicyTransactionDataForEdit(input) {
|
||||
$('select[name="cd_ac_no_for_child[]"] option').each(function() {
|
||||
if ($(this).val() == res.data.cd_ac_no) {
|
||||
$(this).prop('selected', true);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}else{
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}, 3000)
|
||||
}, 4000)
|
||||
|
||||
// Set additional fields
|
||||
$('#policy_status').val(res.data.status);
|
||||
@ -1490,7 +1514,7 @@ function getPolicyTransactionDataForEdit(input) {
|
||||
$('#policy_end_date').val(res.data.policy_end_date);
|
||||
$('#emp_count').val(res.data.emp_count);
|
||||
$('#dependent_count').val(res.data.dependent_count);
|
||||
$('#ppteam').val(res.data.ppteam);
|
||||
$('#ppteam').val(res.data.ppteam).change();
|
||||
$('#fund_received').val(res.data.fund_received);
|
||||
$('#renewal_date').val(res.data.renewal_date);
|
||||
$('#rollover_date').val(res.data.rollover_date);
|
||||
@ -1661,7 +1685,14 @@ function amountCalculation(input) {
|
||||
let standard_tp_per = parseFloat($('#standard_tp_' + input).val()) || 0;
|
||||
let standard_tep_per = parseFloat($('#standard_tep_' + input).val()) || 0;
|
||||
|
||||
console.log(standard_bp_per, standard_tp_per, standard_tep_per);
|
||||
let co_share_per = parseFloat($('#co_share_per_' + input).val()) || 0;
|
||||
|
||||
// console.log(standard_bp_per, standard_tp_per, standard_tep_per);
|
||||
|
||||
let co_premium_amt = ((bp + tp + tep) * co_share_per) / 100;
|
||||
|
||||
$('#co_premium_' + input).val(!isNaN(co_premium_amt) && isFinite(co_premium_amt) ? co_premium_amt.toFixed(2) : '0.00');
|
||||
|
||||
|
||||
// Calculate GST percentage
|
||||
let gst_per = igst;
|
||||
@ -1685,25 +1716,25 @@ function amountCalculation(input) {
|
||||
|
||||
|
||||
let sum_of_agreed_premium = agreed_bp_per + agreed_tp_per + agreed_tep_per;
|
||||
console.log('sum_of_agreed_precentage : ', sum_of_agreed_premium);
|
||||
// console.log('sum_of_agreed_precentage : ', sum_of_agreed_premium);
|
||||
|
||||
var expectedAmount = 0;
|
||||
|
||||
if(agreed_amount > 0 ){
|
||||
expectedAmount = agreed_amount;
|
||||
console.log('Formula 1 AGREED AMOUNT');
|
||||
// console.log('Formula 1 AGREED AMOUNT');
|
||||
}else if(sum_of_agreed_premium > 0){
|
||||
expectedAmount = ((bp + cop) * agreed_bp_per)+ ((tp + tep)*(agreed_tp_per + agreed_tep_per));
|
||||
expectedAmount = expectedAmount / 100;
|
||||
console.log('Formula 2 AGREED BP TP/TEP %');
|
||||
// console.log('Formula 2 AGREED BP TP/TEP %');
|
||||
}else{
|
||||
expectedAmount = ((bp + cop) * standard_bp_per)+ ((tp + tep)*(standard_tp_per + standard_tep_per));
|
||||
console.log(expectedAmount)
|
||||
expectedAmount = expectedAmount / 100;
|
||||
console.log('Formula 3 STANDARD BP TP/TEP %');
|
||||
// console.log('Formula 3 STANDARD BP TP/TEP %');
|
||||
}
|
||||
|
||||
console.log('expectedAmount', expectedAmount);
|
||||
// console.log('expectedAmount', expectedAmount);
|
||||
|
||||
//Expected Amount
|
||||
// $('#exp_amt_' + input).val(expectedAmount.toFixed(2));
|
||||
@ -1714,15 +1745,15 @@ function amountCalculation(input) {
|
||||
let actual_tp_brokerage_amount = parseFloat($('#actual_tp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tep_brokerage_amount = parseFloat($('#actual_tep_brokerage_amt_' + input).val()) || 0;
|
||||
|
||||
console.log('actual_bp_brokerage_amount', actual_bp_brokerage_amount);
|
||||
console.log('actual_tp_brokerage_amount', actual_tp_brokerage_amount);
|
||||
console.log('actual_tep_brokerage_amount', actual_tep_brokerage_amount);
|
||||
// console.log('actual_bp_brokerage_amount', actual_bp_brokerage_amount);
|
||||
// console.log('actual_tp_brokerage_amount', actual_tp_brokerage_amount);
|
||||
// console.log('actual_tep_brokerage_amount', actual_tep_brokerage_amount);
|
||||
|
||||
|
||||
|
||||
// let variance = expectedAmount - (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount)
|
||||
let variance = (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount) - expectedAmount;
|
||||
console.log('variance', variance);
|
||||
// console.log('variance', variance);
|
||||
|
||||
|
||||
// $('#variance_' + input).val(variance.toFixed(2));
|
||||
@ -1944,6 +1975,66 @@ function actualAmountCalculation(input, field = null){
|
||||
console.log('variance', variance);
|
||||
}
|
||||
|
||||
function co_share_percentage_calculation(input){
|
||||
|
||||
var inputs = $('[name="co_share_per[]"]');
|
||||
|
||||
// Find the empty input(s)
|
||||
var emptyInputs = inputs.filter(function() {
|
||||
return $(this).val().trim() === ''; // Check for empty values
|
||||
});
|
||||
|
||||
// Get the number of empty inputs
|
||||
var emptyCount = emptyInputs.length;
|
||||
console.log('Number of empty inputs:', emptyCount);
|
||||
|
||||
// If there's exactly one empty input, calculate and set its value
|
||||
if (emptyCount === 1) {
|
||||
// Calculate the sum of filled values
|
||||
let sumFilled = 0;
|
||||
inputs.each(function() {
|
||||
var val = parseFloat($(this).val()) || 0;
|
||||
sumFilled += val;
|
||||
});
|
||||
|
||||
// Calculate the balance percentage
|
||||
let balance_per = 100 - sumFilled;
|
||||
console.log('Balance percentage:', balance_per);
|
||||
|
||||
// Set the balance value to the empty input
|
||||
emptyInputs.val(balance_per);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function select_leader_disable_premium_amt(input, value) {
|
||||
|
||||
if ($(input).is(':checked')) {
|
||||
// Disable and add readonly-select class to all premiums except the one with the given value
|
||||
$('input[name="base_premium[]"]').addClass('readonly-select');
|
||||
$('#base_premium_' + value).removeClass('readonly-select');
|
||||
|
||||
$('input[name="tp_premium[]"]').addClass('readonly-select');
|
||||
$('#tp_premium_' + value).removeClass('readonly-select');
|
||||
|
||||
$('input[name="ter_premium[]"]').addClass('readonly-select');
|
||||
$('#ter_premium_' + value).removeClass('readonly-select');
|
||||
|
||||
$('input[name="stamp_duty[]"]').addClass('readonly-select');
|
||||
$('#stamp_duty_' + value).removeClass('readonly-select');
|
||||
|
||||
$('input[name="co_premium[]"]').addClass('readonly-select');
|
||||
$('#co_premium_' + value).removeClass('readonly-select');
|
||||
} else {
|
||||
// Enable and remove readonly-select class from all premiums except the one with the given value
|
||||
$('input[name="base_premium[]"]').removeClass('readonly-select');
|
||||
$('input[name="tp_premium[]"]').removeClass('readonly-select');
|
||||
$('input[name="ter_premium[]"]').removeClass('readonly-select');
|
||||
$('input[name="stamp_duty[]"]').removeClass('readonly-select');
|
||||
$('input[name="co_premium[]"]').removeClass('readonly-select');
|
||||
}
|
||||
}
|
||||
|
||||
function validateRange(input) {
|
||||
// if (input.value < 1) input.value = 1;
|
||||
if (input.value > 100) input.value = 100;
|
||||
@ -2119,7 +2210,10 @@ function checkInvoiceStatusToHideSubmitBtn(id){
|
||||
|
||||
function getCDAccountNumber(input)
|
||||
{
|
||||
console.log('##########################################')
|
||||
console.log('getCDAccountNumber')
|
||||
console.log('##########################################')
|
||||
|
||||
|
||||
// var client_id = $('#client_id').val()
|
||||
// var insurer_id = $('#insurer_id').find('option:selected').attr('data-id');
|
||||
@ -2363,19 +2457,47 @@ function convertToMySQLDate(dateString) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// function convertMonthYearToMySQLDate(dateString) {
|
||||
// console.log('convertMonthYearToMySQLDate' + dateString);
|
||||
|
||||
// if(dateString !== "" && dateString !== undefined)
|
||||
// {
|
||||
// // Create a new Date object using the string with '01' as the day
|
||||
// const date = new Date(dateString + '/01');
|
||||
// console.log(date);
|
||||
// // Format the date to MySQL style: YYYY-MM-DD
|
||||
// return date.toISOString().split('T')[0];
|
||||
// }
|
||||
|
||||
// return '';
|
||||
// }
|
||||
|
||||
function convertMonthYearToMySQLDate(dateString) {
|
||||
// console.log('convertMonthYearToMySQLDate' + dateString);
|
||||
if(dateString !== "" && dateString !== undefined)
|
||||
{
|
||||
// Create a new Date object using the string with '01' as the day
|
||||
const date = new Date(dateString + '/01');
|
||||
|
||||
// Format the date to MySQL style: YYYY-MM-DD
|
||||
return date.toISOString().split('T')[0];
|
||||
console.log('convertMonthYearToMySQLDate: ' + dateString);
|
||||
|
||||
if(dateString !== "" && dateString !== undefined) {
|
||||
// Map month abbreviations to their respective numbers
|
||||
const months = {
|
||||
'jan': '01', 'feb': '02', 'mar': '03', 'apr': '04',
|
||||
'may': '05', 'jun': '06', 'jul': '07', 'aug': '08',
|
||||
'sep': '09', 'oct': '10', 'nov': '11', 'dec': '12'
|
||||
};
|
||||
|
||||
// Split the input string by '/'
|
||||
const parts = dateString.toLowerCase().split('/');
|
||||
const month = months[parts[0]]; // Convert the month abbreviation to its numeric form
|
||||
const year = parts[1]; // Year remains unchanged
|
||||
|
||||
// Format the date as YYYY-MM-DD
|
||||
if (month && year) {
|
||||
return `${year}-${month}-01`;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
$("#inception_form_id").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
@ -2942,40 +3064,49 @@ $('#policy_status').change(function(){
|
||||
$('#policy_no').change(function(){
|
||||
|
||||
var policy_no = $(this).val();
|
||||
// console.log(policy_no +'-'+policy_no.length);
|
||||
policy_no = policy_no.trim();
|
||||
// console.log(policy_no +'-'+policy_no.length);
|
||||
|
||||
$pt_id = $('#policy_tranction_policy_number').val();
|
||||
console.log('$pt_id', $pt_id);
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/get_client_policy_data_using_policy_no/');?>'+policy_no,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if($pt_id == "" && policy_no != ""){
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/get_client_policy_data_using_policy_no/');?>'+policy_no,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
console.log('get_client_policy_data_using_policy_no response', res)
|
||||
console.log('get_client_policy_data_using_policy_no response', res)
|
||||
|
||||
if(res.status == true){
|
||||
$('#ct_type').val(1);
|
||||
$('#client_policy_id').val(res.data.client_policy_id);
|
||||
$('#policy_start_date').val(res.data.policy_start_date);
|
||||
$('#policy_end_date').val(res.data.policy_end_date)
|
||||
$('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).trigger('change');
|
||||
}else{
|
||||
$('#ct_type').val(2)
|
||||
$('#client_policy_id').val();
|
||||
$('#policy_start_date').val();
|
||||
$('#policy_end_date').val();
|
||||
$('#tpa').val().trigger('change');
|
||||
console.log(res.message, 'warning');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
if(res.status == true){
|
||||
$('#ct_type').val(1);
|
||||
$('#client_policy_id').val(res.data.client_policy_id);
|
||||
$('#policy_start_date').val(res.data.policy_start_date);
|
||||
$('#policy_end_date').val(res.data.policy_end_date);
|
||||
$('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2();
|
||||
}else{
|
||||
$('#ct_type').val(2);
|
||||
$('#client_policy_id').val();
|
||||
$('#policy_start_date').val();
|
||||
$('#policy_end_date').val();
|
||||
$('#tpa').val('').select2();
|
||||
console.log(res.message, 'warning');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
|
||||
$('#ct_type').val(2)
|
||||
$('#client_policy_id').val();
|
||||
$('#policy_start_date').val();
|
||||
$('#policy_end_date').val();
|
||||
$('#tpa').val('').select2();
|
||||
console.log("Could not get policy data")
|
||||
}
|
||||
});
|
||||
|
||||
// $('.follow_insurer_cd').on('change', function(){
|
||||
@ -2999,14 +3130,16 @@ $('#policy_no').change(function(){
|
||||
var insurerCount = 0;
|
||||
|
||||
$('#setInsurerCount').on('input', function() {
|
||||
var count = $('#setInsurerCount').val();
|
||||
var count = parseInt($('#setInsurerCount').val()) || 1;
|
||||
|
||||
if (count) {
|
||||
for (var i = 0; i < count; i++) { // Corrected loop condition
|
||||
addInsurerColumn();
|
||||
count = count - 1; // Reduce the count by 1
|
||||
|
||||
if (count >= 0) { // Ensure count is valid after reduction
|
||||
for (var i = 0; i < count; i++) {
|
||||
addInsurerColumn(); // Ensure this function is defined properly
|
||||
}
|
||||
} else {
|
||||
toastr.warning('Please enter the insurer count', 'WARNING');
|
||||
toastr.warning('Please enter a valid insurer count', 'WARNING');
|
||||
}
|
||||
});
|
||||
|
||||
@ -3025,9 +3158,9 @@ function addInsurerColumn() {
|
||||
|
||||
// Add a new column for each data row
|
||||
$('#insurerTable tbody tr').each(function(index) {
|
||||
|
||||
let newCell = '';
|
||||
|
||||
|
||||
if(team_id.includes('4')){
|
||||
|
||||
switch(index) {
|
||||
@ -3046,7 +3179,7 @@ function addInsurerColumn() {
|
||||
case 1: // Is Leader?
|
||||
newCell = `<td>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]" onchange="select_leader_disable_premium_amt(this, '${insurerCount}')">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
@ -3061,7 +3194,221 @@ function addInsurerColumn() {
|
||||
</td>`;
|
||||
break;
|
||||
case 3: // Co-Share %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="co_share_per[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="co_share_per_${insurerCount}" name="co_share_per[]" oninput="validateRange(this); amountCalculation('${insurerCount}')" onchange="co_share_percentage_calculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 4: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 5: // TP Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 6: // Ter Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="ter_premium_${insurerCount}" name="ter_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 7: // co Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="co_premium_${insurerCount}" name="co_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 8: // CGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 9: // SGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 10: // IGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 11: // GST Amount
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="gst_amount_${insurerCount}" name="gst_amount[]" oninput="amountCalculation('${insurerCount}')" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 12: // Stamp Duty
|
||||
newCell = `<td><input type="text" class="right-align-input" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 13: // Total
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 14: // Agreed BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_bp_${insurerCount}" name="agreed_bp[]" oninput="validateRange(this); amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 15: // Agreed TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_tp_${insurerCount}" name="agreed_tp[]" oninput="validateRange(this); amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 16: // Agreed Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_ter_${insurerCount}" name="agreed_ter[]" oninput="validateRange(this); amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 17: // Standard BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_bp_${insurerCount}" name="standard_bp[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 18: // Standard TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_tp_${insurerCount}" name="standard_tp[]" onkeypress="return onlyNumbers(event)" readonly ></td>`;
|
||||
break;
|
||||
case 19: // Standard Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_tep_${insurerCount}" name="standard_ter[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 20: // Actual BP Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_bp_amt_${insurerCount}" name="actual_bp_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'bp_amt_for_calc')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 21: // Actual TP Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_tp_amt_${insurerCount}" name="actual_tp_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tp_amt_for_calc')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 22: // Actual TEP Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_tep_amt_${insurerCount}" name="actual_tep_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tep_amt_for_calc')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 23: // Actual BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="actual_bp_per_${insurerCount}" name="actual_bp_per[]" onchange="actualAmountCalculation('${insurerCount}', 'bp_per')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 24: // Actual TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="actual_tp_per_${insurerCount}" name="actual_tp_per[]" onchange="actualAmountCalculation('${insurerCount}', 'tp_per')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 25: // Actual TEP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="actual_tep_per_${insurerCount}" name="actual_tp_per[]" onchange="actualAmountCalculation('${insurerCount}', 'tep_per')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 26: // Actual BP Brokerage Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_bp_brokerage_amt_${insurerCount}" name="actual_bp_brokerage_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'bp_broker_amt')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 27: // Actual TP Brokerage Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_tp_brokerage_amt_${insurerCount}" name="actual_tp_brokerage_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tp_broker_amt')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 28: // Actual TEP Brokerage Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_tep_brokerage_amt_${insurerCount}" name="actual_tep_brokerage_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tep_broker_amt')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 29: // Expected Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="exp_amt_${insurerCount}" name="exp_amt[]" onchange="actualAmountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 30: // Variance
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="variance_${insurerCount}" name="variance[]" onchange="actualAmountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 31: // Reward
|
||||
newCell = `<td><input type="text" class="right-align-input" id="reward_${insurerCount}" name="reward[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 32: // ID For Update
|
||||
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}else if(team_id.includes('3')){
|
||||
|
||||
switch(index) {
|
||||
case 0: // Insurer selection
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
newCell = `<td>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]" onchange="select_leader_disable_premium_amt(this, '${insurerCount}')">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
</td>`;
|
||||
break;
|
||||
case 2: // CD Account Number selectionclass="std_tp_td"
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer_cd" data-count="${insurerCount}" id="cd_ac_no_${insurerCount}" name="cd_ac_no_for_child[]" onchange="addCDAccountNumber(this); restrictCDACNO(this)">
|
||||
<option value="" selected>Select CD No</option>
|
||||
<option value="add_cd"> + Add CD No</option>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 3: // Co-Share %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="co_share_per_${insurerCount}" name="co_share_per[]" oninput="validateRange(this); amountCalculation('${insurerCount}')" onchange="co_share_percentage_calculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 4: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 5: // TP Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 6: // Ter Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="ter_premium_${insurerCount}" name="ter_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 7: // co Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="co_premium_${insurerCount}" name="co_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 8: // CGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 9: // SGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 10: // IGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 11: // GST Amount
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="gst_amount_${insurerCount}" name="gst_amount[]" oninput="amountCalculation('${insurerCount}')" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 12: // Stamp Duty
|
||||
newCell = `<td><input type="text" class="right-align-input" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 13: // Total
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 14: // Agreed BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_bp_${insurerCount}" name="agreed_bp[]" oninput="validateRange(this); amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 15: // Agreed TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_tp_${insurerCount}" name="agreed_tp[]" oninput="validateRange(this); amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 16: // Agreed Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_ter_${insurerCount}" name="agreed_ter[]" oninput="validateRange(this); amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 17: // Standard BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_bp_${insurerCount}" name="standard_bp[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 18: // Standard TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_tp_${insurerCount}" name="standard_tp[]" onkeypress="return onlyNumbers(event)" readonly ></td>`;
|
||||
break;
|
||||
case 19: // Standard Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_tep_${insurerCount}" name="standard_ter[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
|
||||
case 20: // ID For Update
|
||||
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
}
|
||||
|
||||
}else if(team_id.includes('6')){
|
||||
|
||||
switch(index) {
|
||||
case 0: // Insurer selection
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
newCell = `<td>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]" onchange="select_leader_disable_premium_amt(this, '${insurerCount}')">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
</td>`;
|
||||
break;
|
||||
case 2: // CD Account Number selectionclass="std_tp_td"
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer_cd" data-count="${insurerCount}" id="cd_ac_no_${insurerCount}" name="cd_ac_no_for_child[]" onchange="addCDAccountNumber(this); restrictCDACNO(this)">
|
||||
<option value="" selected>Select CD No</option>
|
||||
<option value="add_cd"> + Add CD No</option>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 3: // Co-Share %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="co_share_per_${insurerCount}" name="co_share_per[]" oninput="validateRange(this); amountCalculation('${insurerCount}')" onchange="co_share_percentage_calculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 4: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
@ -3155,76 +3502,6 @@ function addInsurerColumn() {
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}else if(team_id.includes('3')){
|
||||
switch(index) {
|
||||
case 0: // Insurer selection
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
newCell = `<td>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
</td>`;
|
||||
break;
|
||||
case 2: // CD Account Number selectionclass="std_tp_td"
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer_cd" data-count="${insurerCount}" id="cd_ac_no_${insurerCount}" name="cd_ac_no_for_child[]" onchange="addCDAccountNumber(this); restrictCDACNO(this)">
|
||||
<option value="" selected>Select CD No</option>
|
||||
<option value="add_cd"> + Add CD No</option>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 3: // Co-Share %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="co_share_per[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 4: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 5: // TP Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 6: // Ter Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="ter_premium_${insurerCount}" name="ter_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 7: // co Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="co_premium_${insurerCount}" name="co_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 8: // CGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 9: // SGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 10: // IGST
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 11: // GST Amount
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="gst_amount_${insurerCount}" name="gst_amount[]" oninput="amountCalculation('${insurerCount}')" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 12: // Stamp Duty
|
||||
newCell = `<td><input type="text" class="right-align-input" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 13: // Total
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 14: // ID For Update
|
||||
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3307,12 +3584,186 @@ function populateTable(dataArray) {
|
||||
let insurer = data.insurer_branch_id + '-' + data.insurer_id;
|
||||
|
||||
if(team_id.includes('4')){
|
||||
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer).change();
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1');
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1').change();
|
||||
break;
|
||||
case 2: // CD Account Number selection
|
||||
cell.find('select').val(data.cd_ac_no);
|
||||
break;
|
||||
case 3: // Co-Share %
|
||||
cell.find('input').val(data.co_share_per);
|
||||
break;
|
||||
case 4: // Base Premium
|
||||
cell.find('input').val(data.bp_amt);
|
||||
break;
|
||||
case 5: // TP Premium
|
||||
cell.find('input').val(data.tp_amt);
|
||||
break;
|
||||
case 6: // Ter Premium
|
||||
cell.find('input').val(data.tep_amt);
|
||||
break;
|
||||
case 7: // Co Premium
|
||||
cell.find('input').val(data.cop_amt);
|
||||
break;
|
||||
case 8: // CGST
|
||||
cell.find('input').val(data.bp_cgst);
|
||||
break;
|
||||
case 9: // SGST
|
||||
cell.find('input').val(data.bp_sgst);
|
||||
break;
|
||||
case 10: // IGST
|
||||
cell.find('input').val(data.bp_igst);
|
||||
break;
|
||||
case 11: // GST Amount
|
||||
cell.find('input').val(data.bp_gst_amt);
|
||||
break;
|
||||
case 12: // Stamp Duty
|
||||
cell.find('input').val(data.stamp_duty);
|
||||
break;
|
||||
case 13: // Total
|
||||
cell.find('input').val(data.amount);
|
||||
break;
|
||||
case 14: // Agreed BP %
|
||||
cell.find('input').val(data.agreed_bp_per);
|
||||
break;
|
||||
case 15: // Agreed TP %
|
||||
cell.find('input').val(data.agreed_tp_per);
|
||||
break;
|
||||
case 16: // Agreed Ter %
|
||||
cell.find('input').val(data.agreed_tep_per);
|
||||
break;
|
||||
case 17: // Standard BP %
|
||||
cell.find('input').val(data.standerd_bp_per);
|
||||
break;
|
||||
case 18: // Standard TP %
|
||||
cell.find('input').val(data.standerd_tp_per);
|
||||
break;
|
||||
case 19: // Standard Ter %
|
||||
cell.find('input').val(data.standerd_tep_per);
|
||||
break;
|
||||
case 20: // Actual BP Amount
|
||||
cell.find('input').val(data.actual_bp_amt);
|
||||
break;
|
||||
case 21: // Actual TP Amount
|
||||
cell.find('input').val(data.actual_tp_amt);
|
||||
break;
|
||||
case 22: // Actual Ter Amount
|
||||
cell.find('input').val(data.actual_tep_amt);
|
||||
break;
|
||||
case 23: // Actual BP %
|
||||
cell.find('input').val(data.actual_bp_per);
|
||||
break;
|
||||
case 24: // Actual TP %
|
||||
cell.find('input').val(data.actual_tp_per);
|
||||
break;
|
||||
case 25: // Actual Ter %
|
||||
cell.find('input').val(data.actual_tep_per);
|
||||
break;
|
||||
case 26: // Actual BP Brokerage Amount
|
||||
cell.find('input').val(data.actual_bp_brokerage_amt);
|
||||
break;
|
||||
case 27: // Actual TP Brokerage Amount
|
||||
cell.find('input').val(data.actual_tp_brokerage_amt);
|
||||
break;
|
||||
case 28: // Actual Ter Brokerage Amount
|
||||
cell.find('input').val(data.actual_tep_brokerage_amt);
|
||||
break;
|
||||
case 29: // Expected Amount
|
||||
cell.find('input').val(data.exp_amt);
|
||||
break;
|
||||
case 30: // Variance
|
||||
cell.find('input').val(data.variance);
|
||||
break;
|
||||
case 31: // Reward
|
||||
cell.find('input').val(data.reward);
|
||||
break;
|
||||
case 32: // Co-share ID (hidden field)
|
||||
cell.find('input[type="hidden"]').val(data.id);
|
||||
break;
|
||||
}
|
||||
|
||||
}else if(team_id.includes('3')){
|
||||
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer).change();
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1').change();
|
||||
break;
|
||||
case 2: // CD Account Number selection
|
||||
cell.find('select').val(data.cd_ac_no);
|
||||
break;
|
||||
case 3: // Co-Share %
|
||||
cell.find('input').val(data.co_share_per);
|
||||
break;
|
||||
case 4: // Base Premium
|
||||
cell.find('input').val(data.bp_amt);
|
||||
break;
|
||||
case 5: // TP Premium
|
||||
cell.find('input').val(data.tp_amt);
|
||||
break;
|
||||
case 6: // Ter Premium
|
||||
cell.find('input').val(data.tep_amt);
|
||||
break;
|
||||
case 7: // Co Premium
|
||||
cell.find('input').val(data.cop_amt);
|
||||
break;
|
||||
case 8: // CGST
|
||||
cell.find('input').val(data.bp_cgst);
|
||||
break;
|
||||
case 9: // SGST
|
||||
cell.find('input').val(data.bp_sgst);
|
||||
break;
|
||||
case 10: // IGST
|
||||
cell.find('input').val(data.bp_igst);
|
||||
break;
|
||||
case 11: // GST Amount
|
||||
cell.find('input').val(data.bp_gst_amt);
|
||||
break;
|
||||
case 12: // Stamp Duty
|
||||
cell.find('input').val(data.stamp_duty);
|
||||
break;
|
||||
case 13: // Total
|
||||
cell.find('input').val(data.amount);
|
||||
break;
|
||||
case 14: // Agreed BP %
|
||||
cell.find('input').val(data.agreed_bp_per);
|
||||
break;
|
||||
case 15: // Agreed TP %
|
||||
cell.find('input').val(data.agreed_tp_per);
|
||||
break;
|
||||
case 16: // Agreed Ter %
|
||||
cell.find('input').val(data.agreed_tep_per);
|
||||
break;
|
||||
case 17: // Standard BP %
|
||||
cell.find('input').val(data.standerd_bp_per);
|
||||
break;
|
||||
case 18: // Standard TP %
|
||||
cell.find('input').val(data.standerd_tp_per);
|
||||
break;
|
||||
case 19: // Standard Ter %
|
||||
cell.find('input').val(data.standerd_tep_per);
|
||||
break;
|
||||
|
||||
case 20: // Co-share ID (hidden field)
|
||||
cell.find('input[type="hidden"]').val(data.id);
|
||||
break;
|
||||
}
|
||||
|
||||
}else if(team_id.includes('6')){
|
||||
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer).change();
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1').change();
|
||||
break;
|
||||
case 2: // CD Account Number selection
|
||||
cell.find('select').val(data.cd_ac_no);
|
||||
@ -3411,54 +3862,6 @@ function populateTable(dataArray) {
|
||||
cell.find('input[type="hidden"]').val(data.id);
|
||||
break;
|
||||
}
|
||||
}else if(team_id.includes('3')){
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer).change();
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1');
|
||||
break;
|
||||
case 2: // CD Account Number selection
|
||||
cell.find('select').val(data.cd_ac_no);
|
||||
break;
|
||||
case 3: // Co-Share %
|
||||
cell.find('input').val(data.co_share_per);
|
||||
break;
|
||||
case 4: // Base Premium
|
||||
cell.find('input').val(data.bp_amt);
|
||||
break;
|
||||
case 5: // TP Premium
|
||||
cell.find('input').val(data.tp_amt);
|
||||
break;
|
||||
case 6: // Ter Premium
|
||||
cell.find('input').val(data.tep_amt);
|
||||
break;
|
||||
case 7: // Co Premium
|
||||
cell.find('input').val(data.cop_amt);
|
||||
break;
|
||||
case 8: // CGST
|
||||
cell.find('input').val(data.bp_cgst);
|
||||
break;
|
||||
case 9: // SGST
|
||||
cell.find('input').val(data.bp_sgst);
|
||||
break;
|
||||
case 10: // IGST
|
||||
cell.find('input').val(data.bp_igst);
|
||||
break;
|
||||
case 11: // GST Amount
|
||||
cell.find('input').val(data.bp_gst_amt);
|
||||
break;
|
||||
case 12: // Stamp Duty
|
||||
cell.find('input').val(data.stamp_duty);
|
||||
break;
|
||||
case 13: // Total
|
||||
cell.find('input').val(data.amount);
|
||||
break;
|
||||
case 14: // Co-share ID (hidden field)
|
||||
cell.find('input[type="hidden"]').val(data.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -406,6 +406,7 @@ $(document).ready(function(){
|
||||
$('#sales_generated_by').select2();
|
||||
$('#serviced_by').select2();
|
||||
$('#policy_type_id').select2();
|
||||
$('#ppteam').select2();
|
||||
})
|
||||
|
||||
// Datatable document ready
|
||||
@ -462,7 +463,7 @@ $(document).ready(function(){
|
||||
|
||||
// Calculate renewal date (one month before the end date)
|
||||
var renewal_date = new Date(policy_end_date);
|
||||
renewal_date.setMonth(renewal_date.getMonth() - 1);
|
||||
// renewal_date.setMonth(renewal_date.getMonth() - 1);
|
||||
renewal_datePicker.setDate(renewal_date); // Set renewal date
|
||||
}
|
||||
});
|
||||
@ -913,11 +914,14 @@ function appendFileTableBody(data)
|
||||
row.append($('<td>').text(item.doc_name));
|
||||
row.append($('<td>').text(item.file_name));
|
||||
|
||||
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
|
||||
"?client_id=" + item.client_id +
|
||||
"&file_type=policy" +
|
||||
"&file_name=" + item.file_name +
|
||||
"&client_policy_id=" + item.client_policy_id;
|
||||
// var url = "<?= base_url('/downloadGdriveFile'); ?>" +
|
||||
// "?client_id=" + item.client_id +
|
||||
// "&file_type=policy" +
|
||||
// "&file_name=" + item.file_name +
|
||||
// "&client_policy_id=" + item.client_policy_id;
|
||||
|
||||
var url = '<?= base_url('download-kyc-docs/') ?>' + item.file_name;
|
||||
|
||||
|
||||
var link = $('<a>')
|
||||
.attr('href', url)
|
||||
|
||||
@ -153,7 +153,7 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive" style="overflow-x: auto;">
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
@ -226,6 +226,7 @@ $(document).ready(function() {
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
|
||||
Loading…
Reference in New Issue
Block a user