CHANGE_BDS_MODULE : RV

This commit is contained in:
VENKATESHWARAN 2024-10-02 08:45:12 +05:30
parent 48fc2eab5f
commit e82e55d672
24 changed files with 1442 additions and 806 deletions

View File

@ -92,3 +92,25 @@ define('EVENT_PRIORITY_NORMAL', 100);
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead. * @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
*/ */
define('EVENT_PRIORITY_HIGH', 10); define('EVENT_PRIORITY_HIGH', 10);
/**
* @User Role Constant
*/
define('ENROLLMENT_TEAM_ID', '1');
define('CLAIMS_TEAM_ID', '2');
define('BUSINESS_TEAM_ID', '3');
define('FINANCE_TEAM_ID', '4');
define('SALES_TEAM_ID', '5');
/**
* @User Teams Constant
*/
define('ADMIN_ROLE_ID', 1);
define('MANAGER_ROLE_ID', 2);
define('ACCOUNT_MANAGER_ROLE_ID', 3);
define('STAFF_ROLE_ID', 4);
define('HEAD_ROLE_ID', 5);

View File

@ -3135,14 +3135,17 @@ class ClientController extends AdminController
// Fetch policies in a single query // Fetch policies in a single query
$policies = $this->clientPolicyModel $policies = $this->clientPolicyModel
->select(' ->select("
client_policy.*, client_policy.*,
policy_type.policy_type, policy_type.policy_type,
policy_type.ebp, policy_type.ebp,
policy_type.etp, policy_type.etp,
policy_type.iep, policy_type.iep,
policy_type.itp policy_type.itp,
') policy_type.bap,
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('policy_type', 'policy_type.id = client_policy.policy_type_id') ->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->whereIn('client_policy.client_id', $clientIds) ->whereIn('client_policy.client_id', $clientIds)
->where('client_policy.is_active', 1) ->where('client_policy.is_active', 1)
@ -3220,6 +3223,7 @@ class ClientController extends AdminController
'aadhar' => $postData['aadhar'], 'aadhar' => $postData['aadhar'],
'phone' => $postData['phone'], 'phone' => $postData['phone'],
'email' => $postData['email'], 'email' => $postData['email'],
'entity_type_id' => 7
]); ]);
} else { } else {
$client_data['entity_type_id'] = $postData['entity_type_id']; $client_data['entity_type_id'] = $postData['entity_type_id'];
@ -3397,8 +3401,4 @@ class ClientController extends AdminController
} }
} }
} }

View File

@ -41,13 +41,20 @@ class LoginController extends BaseController
$user = $UserModel->getUserByEmail($value->email); $user = $UserModel->getUserByEmail($value->email);
if($user){ if($user){
if($user->is_active !== '0'){ if($user->is_active !== '0'){
$user_team = $UserModel->getUserTeamsByUserID($user->id);
// dd($user_team);
$session_data = [ $session_data = [
'isLoggedIn' => True , 'isLoggedIn' => True ,
'userid' => $user->id, 'userid' => $user->id,
'userData' => $user, 'userData' => $user,
'userProfile' => $value->picture, 'userProfile' => $value->picture,
'user_team' => $user_team,
]; ];
set_session_data($session_data); set_session_data($session_data);
log_message('error', 'Set The UserId : `'. $user->id .'` in Session'); log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
log_message('error', 'User Login Sucessfully'); log_message('error', 'User Login Sucessfully');

View File

@ -1388,7 +1388,7 @@ class MasterController extends AdminController
$cd_data = $this->CDMasterModel->where('client_id', $data['client_id'])->where('insurer_id', $data['insurer_id'])->findAll(); $cd_data = $this->CDMasterModel->where('client_id', $data['client_id'])->where('insurer_id', $data['insurer_id'])->findAll();
return $this->respond(['status' => true, 'data' => $cd_data, 'message' => 'CD Account number created successfully'], 200); return $this->respond(['status' => true, 'data' => $cd_data, 'cd_ac_no'=>$data['cd_ac_no'], 'message' => 'CD Account number created successfully'], 200);
}else{ }else{
return $this->respond(['status' => false, 'message' => 'Failed to created CD Account number'], 200); return $this->respond(['status' => false, 'message' => 'Failed to created CD Account number'], 200);
} }

View File

@ -205,13 +205,35 @@ class PolicyTransactionController extends BaseController
$data = $this->request->getPost(); $data = $this->request->getPost();
// print_r($data); die; // print_r($data); die;
// var_dump($data); die;
// Format dates // Format dates
$data['policy_issue_date'] = date('Y-m-d', strtotime($data['policy_issue_date'])) ?? null; // $data['policy_issue_date'] = change_date_format($this->request->getPost('policy_issue_date'), 'd/m/Y', 'Y-m-d') ?? null;
$data['policy_start_date'] = date('Y-m-d', strtotime($data['policy_start_date'])) ?? null; // $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd/m/Y', 'Y-m-d') ?? null;
$data['policy_end_date'] = date('Y-m-d', strtotime($data['policy_end_date'])) ?? null; // $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd/m/Y', 'Y-m-d') ?? null;
$data['renewal_date'] = date('Y-m-d', strtotime($data['renewal_date'])) ?? null; // $data['renewal_date'] = change_date_format($this->request->getPost('renewal_date'), 'd/m/Y', 'Y-m-d') ?? null;
$data['rollover_date'] = date('Y-m-d', strtotime($data['rollover_date'])) ?? null; // $data['rollover_date'] = change_date_format($this->request->getPost('rollover_date'), 'd/m/Y', 'Y-m-d') ?? null;
$data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
? date('d/m/Y', strtotime($data['policy_issue_date']))
: null;
$data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '')
? date('d/m/Y', strtotime($data['policy_start_date']))
: null;
$data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '')
? date('d/m/Y', strtotime($data['policy_end_date']))
: null;
$data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '')
? date('d/m/Y', strtotime($data['renewal_date']))
: null;
$data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '')
? date('d/m/Y', strtotime($data['rollover_date']))
: null;
// Separate Insurer and TPA Branch IDs and IDs // Separate Insurer and TPA Branch IDs and IDs
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){ if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
@ -242,13 +264,19 @@ class PolicyTransactionController extends BaseController
$data['same_as_proposer'] = 1; $data['same_as_proposer'] = 1;
} }
$month = '01-'.$data['month']; if($data['ct_type'] == ""){
$data['month'] = date('Y-m-d', strtotime($month)); $data['ct_type'] = 1;
}
$month = '01-'.(string)$this->request->getPost('month');
$data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month));
// Determine $is_addon value // Determine $is_addon value
$data['is_addon'] = in_array($data['policy_type_id'], [1, 2, 6, 7]) ? 1 : $data['is_addon'] = in_array($data['policy_type_id'], [1, 2, 6, 7]) ? 1 :
(in_array($data['policy_type_id'], [4, 5]) ? 2 : ($data['policy_type_id'] == 3 && $data['base_policy'] ? 3 : 1)); (in_array($data['policy_type_id'], [4, 5]) ? 2 : ($data['policy_type_id'] == 3 && $data['base_policy'] ? 3 : 1));
// print_r($data); die;
return $data; return $data;
} }
@ -272,7 +300,7 @@ class PolicyTransactionController extends BaseController
$this->policyTransactionModel->update($insert, ['client_policy_id' => $client_policy_id]); $this->policyTransactionModel->update($insert, ['client_policy_id' => $client_policy_id]);
$emp_policy_insert = $this->InsertIndividualEmpPolicyTable($emp_data, $client_policy_id); $emp_policy_insert = $this->InsertIndividualEmpPolicyTable($emp_data, $client_policy_id);
if ($data['status'] == 'completed') { if ($data['client_type'] == 1 && $data['status'] == 'completed') {
$this->processCompletedStatus($data, $client_policy_id, $data['insurer_id']); $this->processCompletedStatus($data, $client_policy_id, $data['insurer_id']);
} }
} }
@ -321,7 +349,9 @@ class PolicyTransactionController extends BaseController
} }
if ($data['status'] == 'completed' && $data['ct_type'] == 2) { if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
$this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']); if($data['client_type'] == 1){
$this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']);
}
} }
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll(); $data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll();
@ -345,76 +375,89 @@ class PolicyTransactionController extends BaseController
// print_r($data); // print_r($data);
// die; // die;
foreach ($data['follow_insurer_id'] as $index => $insurer) { if(isset($data['follow_insurer_id'])){
// Separate the insurer and insurer branch
list($insurer_branch_id, $insurer_id) = explode('-', $insurer); foreach ($data['follow_insurer_id'] as $index => $insurer) {
// Separate the insurer and insurer branch
list($insurer_branch_id, $insurer_id) = explode('-', $insurer);
// Prepare each co-share detail entry
$coShareDetails[] = [
'pt_id' => $pt_id,
'insurer_id' => $insurer_id ?? 0,
'insurer_branch_id' => $insurer_branch_id ?? 0,
'co_share_type' => $data['co_share_type'][$index] ?? null,
'co_share_per' => $data['co_share_per'][$index] ?? 0,
'bp_amt' => $data['base_premium'][$index] ?? 0,
'bp_gst_amt' => $data['gst_amount'][$index] ?? 0,
'bp_igst' => $data['igst'][$index] ?? 0,
'bp_sgst' => $data['sgst'][$index] ?? 0,
'bp_cgst' => $data['cgst'][$index] ?? 0,
'tp_amt' => $data['tp_premium'][$index] ?? 0,
'tep_amt' => $data['ter_premium'][$index] ?? 0,
'agreed_amt' => $data['agreed_amount'][$index] ?? 0,
'agreed_bp_per' => $data['agreed_bp'][$index] ?? 0,
'agreed_tp_per' => $data['agreed_tp'][$index] ?? 0,
'agreed_tep_per' => $data['agreed_ter'][$index] ?? 0,
'standerd_bp_per' => $data['standard_bp'][$index] ?? 0,
'standerd_tp_per' => $data['standard_tp'][$index] ?? 0,
'standerd_tep_per' => $data['standard_ter'][$index] ?? 0,
'actual_bp_amt' => $data['actual_bp_amt'][$index] ?? 0,
'actual_tp_amt' => $data['actual_tp_amt'][$index] ?? 0,
'actual_tep_amt' => $data['actual_tep_amt'][$index] ?? 0,
'actual_bp_per' => $data['actual_bp_per'][$index] ?? 0,
'actual_tp_per' => $data['actual_tp_per'][$index] ?? 0,
'actual_tep_per' => $data['actual_tep_per'][$index] ?? 0,
'actual_bp_brokerage_amt' => $data['actual_bp_brokerage_amt'][$index] ?? 0,
'actual_tp_brokerage_amt' => $data['actual_tp_brokerage_amt'][$index] ?? 0,
'actual_tep_brokerage_amt' => $data['actual_tep_brokerage_amt'][$index] ?? 0,
'exp_amt' => $data['exp_amt'][$index] ?? 0,
'amount' => $data['total'][$index] ?? 0,
'stamp_duty' => $data['stamp_duty'][$index] ?? 0,
'cop_amt' => $data['co_premium'][$index] ?? 0,
'variance' => $data['variance'][$index] ?? 0,
'reward' => $data['reward'][$index] ?? null,
'created_by' => get_session_userid() ?? null,
'updated_by' => get_session_userid() ?? null,
'id' => $data['co_share_id'][$index] ?? null, // Assuming this is the ID to identify existing records
];
}
// print_r($pt_id);
// print_r($coShareDetails);
// die;
// Separate data into insert and update batches
$insertData = array_filter($coShareDetails, function($detail) {
return empty($detail['id']); // Only insert new records
});
$updateData = array_filter($coShareDetails, function($detail) {
return !empty($detail['id']); // Only update existing records
});
// Insert new records
if (!empty($insertData)) {
$this->PTCOShareDetailsModel->insertBatch($insertData);
}
// Update existing records
if (!empty($updateData)) {
$this->PTCOShareDetailsModel->updateBatch($updateData, 'id'); // Assuming 'id' is the unique identifier
}
// print_r($this->PTCOShareDetailsModel->getLastQuery()); die;
// print_r($coShareDetails);
// die;
return true;
// Prepare each co-share detail entry
$coShareDetails[] = [
'pt_id' => $pt_id,
'insurer_id' => $insurer_id ?? 0,
'insurer_branch_id' => $insurer_branch_id ?? 0,
'co_share_type' => isset($data['co_share_type'][$index]) ? 2 : 1,
'co_share_per' => $data['co_share_per'][$index] ?? 0,
'bp_amt' => $data['base_premium'][$index] ?? 0,
'bp_gst_amt' => $data['gst_amount'][$index] ?? 0,
'bp_igst' => $data['igst'][$index] ?? 0,
'bp_sgst' => $data['sgst'][$index] ?? 0,
'bp_cgst' => $data['cgst'][$index] ?? 0,
'tp_amt' => $data['tp_premium'][$index] ?? 0,
'tep_amt' => $data['ter_premium'][$index] ?? 0,
'agreed_amt' => $data['agreed_amount'][$index] ?? 0,
'agreed_bp_per' => $data['agreed_bp'][$index] ?? 0,
'agreed_tp_per' => $data['agreed_tp'][$index] ?? 0,
'agreed_tep_per' => $data['agreed_ter'][$index] ?? 0,
'standerd_bp_per' => $data['standard_bp'][$index] ?? 0,
'standerd_tp_per' => $data['standard_tp'][$index] ?? 0,
'standerd_tep_per' => $data['standard_ter'][$index] ?? 0,
'actual_bp_amt' => $data['actual_bp_amt'][$index] ?? 0,
'actual_tp_amt' => $data['actual_tp_amt'][$index] ?? 0,
'actual_tep_amt' => $data['actual_tep_amt'][$index] ?? 0,
'actual_bp_per' => $data['actual_bp_per'][$index] ?? 0,
'actual_tp_per' => $data['actual_tp_per'][$index] ?? 0,
'actual_tep_per' => $data['actual_tep_per'][$index] ?? 0,
'actual_bp_brokerage_amt' => $data['actual_bp_brokerage_amt'][$index] ?? 0,
'actual_tp_brokerage_amt' => $data['actual_tp_brokerage_amt'][$index] ?? 0,
'actual_tep_brokerage_amt' => $data['actual_tep_brokerage_amt'][$index] ?? 0,
'exp_amt' => $data['exp_amt'][$index] ?? 0,
'amount' => $data['total'][$index] ?? 0,
'stamp_duty' => $data['stamp_duty'][$index] ?? 0,
'cop_amt' => $data['co_premium'][$index] ?? 0,
'variance' => $data['variance'][$index] ?? 0,
'reward' => $data['reward'][$index] ?? null,
'created_by' => get_session_userid() ?? null,
'updated_by' => get_session_userid() ?? null,
'id' => $data['co_share_id'][$index] ?? null, // Assuming this is the ID to identify existing records
];
} }
// print_r($coShareDetails); die; // print_r($data);
// die;
// Separate data into insert and update batches
$insertData = array_filter($coShareDetails, function($detail) {
return empty($detail['id']); // Only insert new records
});
$updateData = array_filter($coShareDetails, function($detail) {
return !empty($detail['id']); // Only update existing records
});
// Insert new records
if (!empty($insertData)) {
$this->PTCOShareDetailsModel->insertBatch($insertData);
}
// Update existing records
if (!empty($updateData)) {
$this->PTCOShareDetailsModel->updateBatch($updateData, 'id'); // Assuming 'id' is the unique identifier
}
// print_r($this->PTCOShareDetailsModel->getLastQuery()); die;
return true;
} }
private function prepareClientPolicyInsertData($data) private function prepareClientPolicyInsertData($data)
@ -598,35 +641,35 @@ class PolicyTransactionController extends BaseController
->first(); ->first();
$data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '') $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
? date('d-m-Y', strtotime($data['policy_issue_date'])) ? date('d/m/Y', strtotime($data['policy_issue_date']))
: null; : null;
$data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '') $data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '')
? date('d-m-Y', strtotime($data['policy_start_date'])) ? date('d/m/Y', strtotime($data['policy_start_date']))
: null; : null;
$data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '') $data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '')
? date('d-m-Y', strtotime($data['policy_end_date'])) ? date('d/m/Y', strtotime($data['policy_end_date']))
: null; : null;
$data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '') $data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '')
? date('d-m-Y', strtotime($data['renewal_date'])) ? date('d/m/Y', strtotime($data['renewal_date']))
: null; : null;
$data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '') $data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '')
? date('d-m-Y', strtotime($data['rollover_date'])) ? date('d/m/Y', strtotime($data['rollover_date']))
: null; : null;
$data['created_at'] = (isset($data['created_at']) && $data['created_at'] !== null && $data['created_at'] !== '') $data['created_at'] = (isset($data['created_at']) && $data['created_at'] !== null && $data['created_at'] !== '')
? date('d-m-Y h:i:s A', strtotime($data['created_at'])) ? date('d/m/Y h:i:s A', strtotime($data['created_at']))
: null; : null;
$data['updated_at'] = (isset($data['updated_at']) && $data['updated_at'] !== null && $data['updated_at'] !== '') $data['updated_at'] = (isset($data['updated_at']) && $data['updated_at'] !== null && $data['updated_at'] !== '')
? date('d-m-Y h:i:s A', strtotime($data['updated_at'])) ? date('d/m/Y h:i:s A', strtotime($data['updated_at']))
: null; : null;
$data['month'] = (isset($data['month']) && $data['month'] !== null && $data['month'] !== '') $data['month'] = (isset($data['month']) && $data['month'] !== null && $data['month'] !== '')
? date('M-Y', strtotime($data['month'])) ? date('M/Y', strtotime($data['month']))
: null; : null;
@ -639,14 +682,17 @@ class PolicyTransactionController extends BaseController
->where('client_policy.is_active', 1) ->where('client_policy.is_active', 1)
->findAll(); ->findAll();
$data['base_policy_data'] = $this->clientPolicyModel
->select('client_policy.*, policy_type.policy_type') // $data['base_policy_data'] = $this->clientPolicyModel
->join('policy_type', 'policy_type.id = client_policy.policy_type_id') // ->select('client_policy.*, policy_type.policy_type')
->where('client_policy.client_id', $data['client_id']) // ->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->where('client_policy.client_branch_id', $data['client_branch_id']) // ->where('client_policy.client_id', $data['client_id'])
->where('client_policy.policy_type_id', 2) // ->where('client_policy.client_branch_id', $data['client_branch_id'])
->where('client_policy.is_active', 1) // ->where('client_policy.policy_type_id', 2)
->findAll(); // ->where('client_policy.is_active', 1)
// ->findAll();
$data['base_policy_data'] = $this->clientPolicyModel->getPolicyDetailsForRemainder($data['client_id']);
$data['pt_files'] = $this->PTFileModel $data['pt_files'] = $this->PTFileModel
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id') ->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
@ -776,8 +822,15 @@ class PolicyTransactionController extends BaseController
$data_received_date = (string)$this->request->getPost('data_received_date'); $data_received_date = (string)$this->request->getPost('data_received_date');
$closure_date = (string)$this->request->getPost('closure_date'); $closure_date = (string)$this->request->getPost('closure_date');
$data['data_received_date'] = date('Y-m-d', strtotime($data_received_date)); $endorse_eff_date = (string)$this->request->getPost('endorse_eff_date');
$data['closure_date'] = date('Y-m-d', strtotime($closure_date)); $month = (string)$this->request->getPost('month');
$data['data_received_date'] = empty($data['data_received_date']) ? null : date('Y-m-d', strtotime($data_received_date));
$data['closure_date'] = empty($data['closure_date']) ? null : date('Y-m-d', strtotime($closure_date));
$data['endorse_eff_date'] = empty($data['endorse_eff_date']) ? null : date('Y-m-d', strtotime($endorse_eff_date));
$month = '01-'.$data['month'];
$data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month));
// Separate Insurer and TPA Branch IDs and IDs // Separate Insurer and TPA Branch IDs and IDs
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){ if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
@ -881,7 +934,7 @@ class PolicyTransactionController extends BaseController
{ {
if ($data['status'] == 'completed' && $data['ct_type'] == 2) { if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
$tolamt = $data['total'][0]; $tolamt = $data['total'][0] ?? 0;
$description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' . $description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' .
($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction'; ($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction';
@ -920,10 +973,16 @@ class PolicyTransactionController extends BaseController
->where('policy_transaction.id', $id) ->where('policy_transaction.id', $id)
->first(); ->first();
$data['policy_start_date'] = date('d-m-Y', strtotime($data['s_date'])); $data['policy_start_date'] = empty($data['policy_start_date']) ? '' : date('d/m/Y', strtotime($data['s_date']));
$data['policy_end_date'] = date('d-m-Y', strtotime($data['e_date'])); $data['policy_end_date'] = empty($data['policy_end_date']) ? '' : date('d/m/Y', strtotime($data['e_date']));
$data['data_received_date'] = date('d-m-Y', strtotime($data['data_received_date'])); $data['data_received_date'] = empty($data['data_received_date']) ? '' : date('d/m/Y', strtotime($data['data_received_date']));
$data['closure_date'] = date('d-m-Y', strtotime($data['closure_date'])); $data['closure_date'] = empty($data['closure_date']) ? '' : date('d/m/Y', strtotime($data['closure_date']));
$data['endorse_eff_date'] = empty($data['endorse_eff_date']) ? '' : date('d/m/Y', strtotime($data['endorse_eff_date']));
$data['month'] = (isset($data['month']) && $data['month'] !== null && $data['month'] !== '')
? date('M/Y', strtotime($data['month']))
: null;
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll(); $data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll();
@ -1218,7 +1277,6 @@ class PolicyTransactionController extends BaseController
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer; $issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
$data['business_list'] = $this->policyTransactionModel->getBusinessReportList($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer); $data['business_list'] = $this->policyTransactionModel->getBusinessReportList($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer);
$this->loadLayout('business_team_list', $data); $this->loadLayout('business_team_list', $data);
} }
@ -1467,7 +1525,7 @@ class PolicyTransactionController extends BaseController
foreach ($source_data as $source_key => $source_row) foreach ($source_data as $source_key => $source_row)
{ {
if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_row['endorsement_no'] && change_date_format($policy_start_date,'d-m-Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d-m-Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name']) if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_row['endorsement_no'] && change_date_format($policy_start_date,'d/m/Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d/m/Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
{ {
$is_source_found = 1; $is_source_found = 1;
unset($source_data[$source_key]); unset($source_data[$source_key]);
@ -1558,8 +1616,8 @@ class PolicyTransactionController extends BaseController
foreach ($source_data as $source_key => $source_row) foreach ($source_data as $source_key => $source_row)
{ {
// Kint::dump(change_date_format($excel_row[3],'d-m-Y','Y-m-d')); // Kint::dump(change_date_format($excel_row[3],'d/m/Y','Y-m-d'));
if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_row['endorsement_no'] && change_date_format($policy_start_date,'d-m-Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d-m-Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name']) if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_row['endorsement_no'] && change_date_format($policy_start_date,'d/m/Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d/m/Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
{ {
$is_source_found = 1; $is_source_found = 1;
@ -1660,7 +1718,7 @@ class PolicyTransactionController extends BaseController
$data = [ 'invoice_status' => $inv_details['invoice_status'], $data = [ 'invoice_status' => $inv_details['invoice_status'],
'invoice_no' => $inv_details['invoice_no'], 'invoice_no' => $inv_details['invoice_no'],
'invoice_amount' => $inv_details['invoice_amount'], 'invoice_amount' => $inv_details['invoice_amount'],
'invoice_date' => isset($inv_details['invoice_date']) ? change_date_format($inv_details['invoice_date'],'Y-m-d','d-m-Y') : null ]; 'invoice_date' => isset($inv_details['invoice_date']) ? change_date_format($inv_details['invoice_date'],'Y-m-d','d/m/Y') : null ];
$data['payments'] = $inv_payment_details; $data['payments'] = $inv_payment_details;
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $data], 200); return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $data], 200);
@ -1677,7 +1735,7 @@ class PolicyTransactionController extends BaseController
$invoiceStatus = $jsonData['invoice_status']; $invoiceStatus = $jsonData['invoice_status'];
$hiddenStatementId = $jsonData['hidden_statement_id']; $hiddenStatementId = $jsonData['hidden_statement_id'];
$invoiceNo = $jsonData['invoice_no']; $invoiceNo = $jsonData['invoice_no'];
$invoiceDate = change_date_format($jsonData['invoice_date'],'d-m-Y','Y-m-d'); $invoiceDate = change_date_format($jsonData['invoice_date'],'d/m/Y','Y-m-d');
$invoice_amount = $jsonData['invoice_amount']; $invoice_amount = $jsonData['invoice_amount'];
//Update statement table //Update statement table
@ -1711,7 +1769,7 @@ class PolicyTransactionController extends BaseController
'inv_amt' => $receivedAmount, 'inv_amt' => $receivedAmount,
'utr_no' => $utrNo, 'utr_no' => $utrNo,
'tds' => $tds, 'tds' => $tds,
'received_date' => change_date_format($paymentDate,'d-m-Y','Y-m-d'), 'received_date' => change_date_format($paymentDate,'d/m/Y','Y-m-d'),
'statement_id' => $hiddenStatementId 'statement_id' => $hiddenStatementId
]; ];
if($pk){ if($pk){

View File

@ -140,6 +140,15 @@ if (!function_exists('get_session_context')) {
} }
} }
if (!function_exists('user_team')) {
function user_team()
{
// $CI =& get_instance();
$session = \Config\Services::session();
return $session->get('user_team');
}
}

View File

@ -124,7 +124,7 @@ class PolicyTransactionModel extends Model
IF(policy_transaction.month IS NULL, IF(policy_transaction.month IS NULL,
policy_transaction.policy_issue_date, policy_transaction.policy_issue_date,
policy_transaction.month), policy_transaction.month),
'%b') AS policy_issue_month, '%b %Y') AS policy_issue_month,
CASE CASE
WHEN clients.client_type = 1 THEN 'Group' WHEN clients.client_type = 1 THEN 'Group'
WHEN clients.client_type = 2 THEN 'Retail' WHEN clients.client_type = 2 THEN 'Retail'
@ -255,7 +255,7 @@ class PolicyTransactionModel extends Model
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left') ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('user_profiles', 'policy_transaction.created_by = user_profiles.id', 'left') ->join('user_profiles', 'policy_transaction.created_by = user_profiles.id', 'left')
->join('vehicle', 'policy_transaction.vehicle_id = vehicle.id', 'left') ->join('vehicle', 'policy_transaction.vehicle_id = vehicle.id', 'left')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') ->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
->join('insurers', 'policy_transaction.insurer_id = insurers.id', 'left') ->join('insurers', 'policy_transaction.insurer_id = insurers.id', 'left')
->join('insurer_branch', 'policy_transaction.insurer_branch_id = insurer_branch.id', 'left') ->join('insurer_branch', 'policy_transaction.insurer_branch_id = insurer_branch.id', 'left')
->join('tpa', 'policy_transaction.tpa_id = tpa.id', 'left') ->join('tpa', 'policy_transaction.tpa_id = tpa.id', 'left')
@ -275,7 +275,7 @@ class PolicyTransactionModel extends Model
}else{ }else{
// $fromDate = date('Y-m-d', strtotime('-30 days')); // $fromDate = date('Y-m-d', strtotime('-30 days'));
// $toDate = date('Y-m-d'); // $toDate = date('Y-m-d 23:59:59');
// $builder->where('policy_transaction.created_at >=', $fromDate) // $builder->where('policy_transaction.created_at >=', $fromDate)
// ->where('policy_transaction.created_at <=', $toDate); // ->where('policy_transaction.created_at <=', $toDate);
@ -300,13 +300,15 @@ class PolicyTransactionModel extends Model
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){ if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
$fromDate = date('Y-m-d', strtotime('-30 days')); $fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d'); $toDate = date('Y-m-d 23:59:59');
$builder->where('policy_transaction.created_at >=', $fromDate) $builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate); ->where('policy_transaction.created_at <=', $toDate);
} }
$builder->orderBy('policy_transaction.id', 'desc');
return $builder->get()->getResultArray(); return $builder->get()->getResultArray();
} }
@ -347,7 +349,7 @@ class PolicyTransactionModel extends Model
}else{ }else{
// $fromDate = date('Y-m-d', strtotime('-30 days')); // $fromDate = date('Y-m-d', strtotime('-30 days'));
// $toDate = date('Y-m-d'); // $toDate = date('Y-m-d 23:59:59');
// $builder->where('policy_transaction.created_at >=', $fromDate) // $builder->where('policy_transaction.created_at >=', $fromDate)
// ->where('policy_transaction.created_at <=', $toDate); // ->where('policy_transaction.created_at <=', $toDate);
@ -375,7 +377,7 @@ class PolicyTransactionModel extends Model
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){ if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
$fromDate = date('Y-m-d', strtotime('-30 days')); $fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d'); $toDate = date('Y-m-d 23:59:59');
$builder->where('policy_transaction.created_at >=', $fromDate) $builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate); ->where('policy_transaction.created_at <=', $toDate);
@ -420,7 +422,7 @@ class PolicyTransactionModel extends Model
}else{ }else{
// $fromDate = date('Y-m-d', strtotime('-30 days')); // $fromDate = date('Y-m-d', strtotime('-30 days'));
// $toDate = date('Y-m-d'); // $toDate = date('Y-m-d 23:59:59');
// $builder->where('policy_transaction.created_at >=', $fromDate) // $builder->where('policy_transaction.created_at >=', $fromDate)
// ->where('policy_transaction.created_at <=', $toDate); // ->where('policy_transaction.created_at <=', $toDate);
@ -448,7 +450,7 @@ class PolicyTransactionModel extends Model
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){ if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
$fromDate = date('Y-m-d', strtotime('-30 days')); $fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d'); $toDate = date('Y-m-d 23:59:59');
$builder->where('policy_transaction.created_at >=', $fromDate) $builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate); ->where('policy_transaction.created_at <=', $toDate);
@ -463,26 +465,34 @@ class PolicyTransactionModel extends Model
public function getVarienceReportLIst($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0) public function getVarienceReportLIst($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') $builder = $this->db->table('policy_transaction')
->select(' ->select("
policy_transaction.id, policy_transaction.id,
clients.client_name, clients.client_name,
insurers.name AS insurer_name, insurers.name AS insurer_name,
policy_type.policy_type, policy_type.policy_type,
policy_transaction.policy_no, policy_transaction.policy_no,
policy_transaction.endorsement_no, policy_transaction.endorsement_no,
pt_co_share_details.exp_amt, CASE
pt_co_share_details.variance 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,
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_amount
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->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('clients', 'clients.id = policy_transaction.client_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left')
->join('insurers', 'pt_co_share_details.insurer_id = insurers.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('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left') ->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1) ->where('policy_transaction.is_active', 1)
->groupStart() // Group the conditions for variance ->where('pt_co_share_details.actual_bp_brokerage_amt IS NOT NULL AND pt_co_share_details.actual_bp_brokerage_amt != 0')
->where('pt_co_share_details.variance IS NULL') ->where('pt_co_share_details.variance IS NOT NULL')
->orWhere('pt_co_share_details.variance', 0) ->where('pt_co_share_details.variance !=', 0);
->groupEnd();
if ($start_date != 0 && $end_date != 0 && $date_type != 0) { if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
@ -494,7 +504,7 @@ class PolicyTransactionModel extends Model
} else { } else {
$fromDate = date('Y-m-d', strtotime('-30 days')); $fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d'); $toDate = date('Y-m-d 23:59:59');
$builder->where('policy_transaction.created_at >=', $fromDate) $builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate); ->where('policy_transaction.created_at <=', $toDate);
@ -535,6 +545,11 @@ class PolicyTransactionModel extends Model
'policy_type.policy_type', 'policy_type.policy_type',
'policy_transaction.policy_no', 'policy_transaction.policy_no',
'policy_transaction.endorsement_no', 'policy_transaction.endorsement_no',
"CASE
WHEN policy_transaction.action_type = 'inception' THEN 'I'
ELSE 'E'
END AS action_type",
'policy_transaction.action_type as action_type_full',
'pt_co_share_details.bp_amt', 'pt_co_share_details.bp_amt',
'pt_co_share_details.tp_amt', 'pt_co_share_details.tp_amt',
'pt_co_share_details.tep_amt' 'pt_co_share_details.tep_amt'
@ -558,7 +573,7 @@ class PolicyTransactionModel extends Model
} else { } else {
$fromDate = date('Y-m-d', strtotime('-30 days')); $fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d'); $toDate = date('Y-m-d 23:59:59');
$builder->where('policy_transaction.created_at >=', $fromDate) $builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate); ->where('policy_transaction.created_at <=', $toDate);
@ -592,16 +607,21 @@ class PolicyTransactionModel extends Model
public function getFinanceReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0) public function getFinanceReportList($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') $builder = $this->db->table('policy_transaction')
->select(' ->select("
policy_transaction.id, policy_transaction.id,
clients.client_name, clients.client_name,
insurers.name AS insurer_name, insurers.name AS insurer_name,
policy_type.policy_type, policy_type.policy_type,
policy_transaction.policy_no, policy_transaction.policy_no,
policy_transaction.endorsement_no, policy_transaction.endorsement_no,
CASE
WHEN policy_transaction.action_type = 'inception' THEN 'I'
ELSE 'E'
END AS action_type,
policy_transaction.action_type as action_type_full,
pt_co_share_details.exp_amt, pt_co_share_details.exp_amt,
pt_co_share_details.variance pt_co_share_details.variance
') ")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left')
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left') ->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
@ -609,6 +629,7 @@ class PolicyTransactionModel extends Model
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left') ->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1) ->where('policy_transaction.is_active', 1)
->where('policy_transaction.status', 'completed') ->where('policy_transaction.status', 'completed')
->where('pt_co_share_details.agreed_bp_per IS NULL OR pt_co_share_details.agreed_bp_per = 0')
->where('pt_co_share_details.actual_bp_amt IS NULL OR pt_co_share_details.actual_bp_amt = 0') ->where('pt_co_share_details.actual_bp_amt IS NULL OR pt_co_share_details.actual_bp_amt = 0')
->where('pt_co_share_details.actual_bp_brokerage_amt IS NULL OR pt_co_share_details.actual_bp_brokerage_amt = 0'); ->where('pt_co_share_details.actual_bp_brokerage_amt IS NULL OR pt_co_share_details.actual_bp_brokerage_amt = 0');
@ -624,7 +645,7 @@ class PolicyTransactionModel extends Model
} else { } else {
$fromDate = date('Y-m-d', strtotime('-30 days')); $fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d'); $toDate = date('Y-m-d 23:59:59');
$builder->where('policy_transaction.created_at >=', $fromDate) $builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate); ->where('policy_transaction.created_at <=', $toDate);

View File

@ -105,5 +105,24 @@ class UserModel extends Model
->getResult(); ->getResult();
} }
public function getUserTeamsByUserID($user_id){
$user_teams = $this->db->table('user_profiles')
->select('user_teams.team_id')
->join('user_teams', 'user_profiles.id = user_teams.user_id')
->where('user_profiles.id', $user_id)
->where('user_teams.is_active', 1)
->get()
->getResultArray();
if (!empty($user_teams)) {
// Extract only the 'team_id' values
$team_ids = array_column($user_teams, 'team_id');
return $team_ids; // Return array of team IDs
} else {
return []; // Return empty array if no teams found
}
}
} }
?> ?>

View File

@ -62,12 +62,18 @@ body {
<span class="d-none d-sm-inline-block">Enrolment</span> <span class="d-none d-sm-inline-block">Enrolment</span>
</a> </a>
</li> </li>
<li class="nav-item">
<a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="bds_tab"> <?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
<span class="mr-1"><i class="fa fa-file"></i></span>
<span class="d-none d-sm-inline-block">BDS</span> <li class="nav-item">
</a> <a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="bds_tab">
</li> <span class="mr-1"><i class="fa fa-file"></i></span>
<span class="d-none d-sm-inline-block">BDS</span>
</a>
</li>
<?php } ?>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<?php include('enrollment_dash.php'); ?> <?php include('enrollment_dash.php'); ?>

View File

@ -141,31 +141,37 @@ body{
</style> </style>
<div class="tab-pane fade" id="bds-dash-tab" style="/*padding-left: 35px;*/padding-right: 35px;"> <div class="tab-pane fade" id="bds-dash-tab" style="/*padding-left: 35px;*/padding-right: 35px;">
<div class="row"> <div class="row">
<div class="col-md-4 col-xl-3"> <?php if (in_array(BUSINESS_TEAM_ID, user_team())) { ?>
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous order-card" onclick="linkRedirectForBDS(this, 'B')">
<div class="card-block">
<h6 class="m-b-20 font-15">Business Team Pending</h6>
<h2 class="text-right"><i class="mdi mdi-account-multiple-plus f-left"></i><span><?= $businessTeamCount ?></span></h2>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p>
</div>
</div>
</div>
<div class="col-md-4 col-xl-3"> <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 data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous order-card" onclick="linkRedirectForBDS(this, 'B')">
<div class="card-block"> <div class="card-block">
<h6 class="m-b-20 font-15">Finance Team Pending</h6> <h6 class="m-b-20 font-15">Business Team Pending</h6>
<h2 class="text-right"><i class="mdi mdi-account-box f-left"></i><span><?= $financeTeamCount ?></span></h2> <h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= $businessTeamCount ?></span></h2>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p> <p class="m-b-1">&nbsp;<span class="f-right"></span></p>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p> <p class="m-b-1">&nbsp;<span class="f-right"></span></p>
</div>
</div> </div>
</div> </div>
</div>
<?php } ?>
<?php if (in_array(FINANCE_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="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>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p>
</div>
</div>
</div>
<?php } ?>
</div> </div>
</div> </div>
<script> <script>

View File

@ -35,7 +35,7 @@ table.dataTable tbody td {
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger"></span></label> <label for="client_branch">Client<span class="text-danger"></span></label>
<select class="form-control" id="client_id" name="client_id" > <select class="form-control" id="client_id" name="client_id">
<option value="0">Select Client</option> <option value="0">Select Client</option>
<?php <?php
if (isset($clients) && count($clients)) { if (isset($clients) && count($clients)) {
@ -48,20 +48,21 @@ table.dataTable tbody td {
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label> <label for="addon_policy"> Insurer <span id="base_danger"
<select class="form-control" id="insurer_id" name="insurer_id" > class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id">
<option value="0" selected>Select Insurer</option> <option value="0" selected>Select Insurer</option>
<?php if (isset($insurer) && count($insurer)) { ?> <?php if (isset($insurer) && count($insurer)) { ?>
<?php foreach ($insurer as $value) { ?> <?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option> <option value="<?= $value['id']?>"><?= $value['name']?></option>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="email"> Policy Type <span class="text-danger"></span></label> <label for="email"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="policy_type_id" name="policy_type_id" > <select class="form-control" id="policy_type_id" name="policy_type_id">
<option value="0">Select Policy Type</option> <option value="0">Select Policy Type</option>
<?php <?php
if (isset($policy_types) && count($policy_types)) { if (isset($policy_types) && count($policy_types)) {
@ -93,7 +94,8 @@ table.dataTable tbody td {
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label>Date Type<span class="text-danger"></span></label> <label>Date Type<span class="text-danger"></span></label>
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()"> <select class="form-control" id="date_type" name="date_type"
onchange="hideDateField()">
<option value="0">Select Date Type</option> <option value="0">Select Date Type</option>
<?php <?php
if (isset($date_type) && count($date_type)) { if (isset($date_type) && count($date_type)) {
@ -107,7 +109,8 @@ table.dataTable tbody td {
<div class="form-group col-md-3" style="display: none;" id="date_div"> <div class="form-group col-md-3" style="display: none;" id="date_div">
<label>Date<span class="text-danger"></span></label> <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%"> <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>&nbsp; <i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i> <span></span> <i class="fa fa-caret-down"></i>
</div> </div>
@ -116,8 +119,11 @@ table.dataTable tbody td {
</div> </div>
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;"> <div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
<a href="<?= base_url("/policy_tranction/report/report-business-list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a> <a href="<?= base_url("/policy_tranction/report/report-business-list"); ?>"
<a href="<?= base_url("/policy_tranction/report/report-business-list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a> class="btn btn-secondary" id="clear-filters">Clear</a>
<a href="<?= base_url("/policy_tranction/report/report-business-list"); ?>"
class="btn btn-primary" id="get-emp-list"
onclick="fetchEmpolyeeList(event);">Submit</a>
</div> </div>
</div> </div>
@ -156,6 +162,7 @@ table.dataTable tbody td {
<th>Policy</th> <th>Policy</th>
<th>Policy No</th> <th>Policy No</th>
<th>Endorsement No</th> <th>Endorsement No</th>
<th>Event Type</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
@ -169,11 +176,21 @@ table.dataTable tbody td {
<td><?php echo $row['policy_type']; ?></td> <td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['policy_no']; ?></td> <td><?php echo $row['policy_no']; ?></td>
<td><?php echo $row['endorsement_no']; ?></td> <td><?php echo $row['endorsement_no']; ?></td>
<td><?php echo $row['action_type_full']; ?></td>
<td> <td>
<div class="btn-group dropdown"> <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> <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"> <div class="dropdown-menu dropdown-menu-right">
<a href="<?= base_url("/policy_tranction/inception/list"); ?>" id="get-policy-list" class="dropdown-item btnEdit" onclick="sendPolicyTransactionID(event, '<?= htmlspecialchars($row['policy_trns_id'], ENT_QUOTES) ?>')"> <a href="
<?php
if ($row['action_type'] == 'I') {
echo base_url("/policy_tranction/inception/list") . '?pt_id=' . $row['policy_trns_id'];
} else {
echo base_url("/policy_tranction/endorsement/list") . '?pt_id=' . $row['policy_trns_id'];
}
?>" id="get-policy-list" class="dropdown-item btnEdit">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a> </a>
</div> </div>
@ -193,7 +210,6 @@ table.dataTable tbody td {
</div> </div>
<script> <script>
// Datatable document ready // Datatable document ready
$(document).ready(function() { $(document).ready(function() {
@ -204,8 +220,7 @@ $(document).ready(function() {
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [ buttons: [{
{
extend: 'csv', extend: 'csv',
text: 'CSV', text: 'CSV',
title: 'Policy-Tranction-BDS-List', title: 'Policy-Tranction-BDS-List',
@ -220,7 +235,8 @@ $(document).ready(function() {
// Find cells in column AB (28th column in Excel) // Find cells in column AB (28th column in Excel)
$('row c[r^="AB"]', sheet).each(function() { $('row c[r^="AB"]', sheet).each(function() {
var value = parseFloat($('v', this).text()); // Get the value inside the cell var value = parseFloat($('v', this)
.text()); // Get the value inside the cell
if (!isNaN(value)) { if (!isNaN(value)) {
total += value; total += value;
} }
@ -228,10 +244,13 @@ $(document).ready(function() {
// Get the last row index and append the total row // Get the last row index and append the total row
var lastRow = $('row:last', sheet); var lastRow = $('row:last', sheet);
var rowIndex = parseInt(lastRow.attr('r')) + 2; // Find the next row index var rowIndex = parseInt(lastRow.attr('r')) +
2; // Find the next row index
var totalRow = '<row r="' + rowIndex + '">' + var totalRow = '<row r="' + rowIndex + '">' +
'<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' + // Insert "Total" in AA '<c t="inlineStr" r="AA' + rowIndex +
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' + // Insert sum in AB '"><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>'; '</row>';
// Append the new total row to the sheet // Append the new total row to the sheet
@ -245,7 +264,8 @@ $(document).ready(function() {
searchPlaceholder: "Search..." searchPlaceholder: "Search..."
}, },
paging: true, // Enable pagination paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional) pageLength: 25, // Set default number of rows per page (optional)
ordering: false,
}); });
} else { } else {
console.error("Table not found."); console.error("Table not found.");
@ -259,8 +279,7 @@ $(document).ready(function() {
$('#policy_type_id').select2(); $('#policy_type_id').select2();
}) })
function fetchEmpolyeeList(event) function fetchEmpolyeeList(event) {
{
event.preventDefault(); // Prevent default action event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val(); var start_date = $('#startDate').val();
@ -289,13 +308,11 @@ function fetchEmpolyeeList(event)
window.location.href = apiURL; window.location.href = apiURL;
} }
function objectToQueryString(obj) function objectToQueryString(obj) {
{
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&'); return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
} }
function getURLParams() function getURLParams() {
{
const url = new URL(window.location.href); const url = new URL(window.location.href);
const params = new URLSearchParams(url.search); const params = new URLSearchParams(url.search);
@ -322,7 +339,7 @@ function getURLParams()
console.log('End Date:', endDate); console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) { if (startDate != 0 && endDate != 0) {
setTimeout(function(){ setTimeout(function() {
$('#start_date').val(startDate) $('#start_date').val(startDate)
$('#end_date').val(endDate) $('#end_date').val(endDate)
$('#client_id').val(client_id).change() $('#client_id').val(client_id).change()
@ -330,7 +347,7 @@ function getURLParams()
$('#policy_type_id').val(policy_type_id).change() $('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type) $('#date_type').val(date_type)
$('#issuer').val(issuer) $('#issuer').val(issuer)
},1000) }, 1000)
} }
@ -362,12 +379,14 @@ $(function() {
startDate: start, startDate: start,
endDate: end, endDate: end,
ranges: { ranges: {
'Today': [moment(), moment()], 'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')], 'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
.endOf('month')
]
} }
}, cb); }, cb);
@ -390,23 +409,21 @@ $(function() {
}); });
function hideDateField(input = null) function hideDateField(input = null) {
{
let val = $('#date_type').val(); let val = $('#date_type').val();
if(input){ if (input) {
val = input; val = input;
} }
if(val != 0){ if (val != 0) {
$('#date_div').show() $('#date_div').show()
}else{ } else {
$('#date_div').hide() $('#date_div').hide()
} }
} }
function sendPolicyTransactionID(event, pt_id) function sendPolicyTransactionID(event, pt_id) {
{
event.preventDefault(); // Prevent default action event.preventDefault(); // Prevent default action
console.log(pt_id); console.log(pt_id);

View File

@ -11,6 +11,20 @@
.select2-container .select2-selection--multiple .select2-selection__choice { .select2-container .select2-selection--multiple .select2-selection__choice {
color: #000000; color: #000000;
} }
/* .select2-search__field{
height: 2px !important;
} */
.select2-selection__choice {
background-color: #0a8794 !important;
color: white !important;
font-weight: bold;
}
.select2-selection__choice__remove {
color: white !important;
margin-right: 5px;
}
</style> </style>
<style> <style>
@ -760,6 +774,7 @@ $(document).ready(function() {
$("#selected").select2({ $("#selected").select2({
tags: true, tags: true,
placeholder: "Enter Units",
tokenSeparators: [], // Disable default token separators tokenSeparators: [], // Disable default token separators
createTag: function (params) { createTag: function (params) {
var term = $.trim(params.term); var term = $.trim(params.term);
@ -772,7 +787,11 @@ $(document).ready(function() {
newTag: true newTag: true
}; };
} }
}); })
$("textarea.select2-search__field").attr('rows', '1');
$("textarea.select2-search__field").css('resize', 'none');
// Intercept keydown event // Intercept keydown event
$("#selected").on('select2:select', function (e) { $("#selected").on('select2:select', function (e) {
@ -802,13 +821,13 @@ $(document).ready(function() {
// Get the Select2 container element // Get the Select2 container element
var select2Container = $('#selected').next('.select2-container'); var select2Container = $('#selected').next('.select2-container');
// Find the dropdown within the Select2 container // Find the dropdown within the Select2 container
var select2Dropdown = select2Container.find('.select2-dropdown'); var select2Dropdown = select2Container.find('.select2-dropdown');
// Set the display style to none // Set the display style to none
select2Dropdown.css('display', 'none'); select2Dropdown.css('display', 'none');
}); });
$(document).ready(function() { $(document).ready(function() {

View File

@ -51,7 +51,7 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="kyc_docs">File<span <label for="kyc_docs">File<span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png"> <input class="form-control" type="file" name="file_name" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png">
</div> </div>
<!-- <div class="form-group col-md-4 align-self-end"> --> <!-- <div class="form-group col-md-4 align-self-end"> -->
<div class="form-group col-md-4" style="<?= isset($client['id']) ? 'margin-top: 41px;' : 'margin-top: 30px;' ?>"> <div class="form-group col-md-4" style="<?= isset($client['id']) ? 'margin-top: 41px;' : 'margin-top: 30px;' ?>">
@ -307,7 +307,6 @@
<td>${item.other_docs_name}</td> <td>${item.other_docs_name}</td>
<td>${item.file_name}</td> <td>${item.file_name}</td>
<td> <td>
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
<a href = "${url}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a> <a href = "${url}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a>
</td> </td>
</tr> </tr>
@ -315,6 +314,9 @@
} }
$('#other_docs').append(rowHtml); $('#other_docs').append(rowHtml);
//<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
if(other_docs_count > 0){ if(other_docs_count > 0){
$('#others').show() $('#others').show()
$('#other_docs_table').show(); $('#other_docs_table').show();
@ -419,13 +421,12 @@
</td> </td>
<td id="name_${item.id}" style="display:none;"></td> <td id="name_${item.id}" style="display:none;"></td>
<td> <td>
<i id="delete_${item.id}" data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px; display: none"></i>
<a id="download_${item.id}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a> <a id="download_${item.id}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a>
</td> </td>
</tr>`; </tr>`;
tbody.append(row); tbody.append(row);
}); });
//<i id="delete_${item.id}" data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px; display: none"></i>
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
@ -473,13 +474,14 @@
<td>${item.other_docs_name}</td> <td>${item.other_docs_name}</td>
<td>${item.file_name}</td> <td>${item.file_name}</td>
<td> <td>
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
<a href = "${url}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" target="_blank"></a> <a href = "${url}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" target="_blank"></a>
</td> </td>
</tr> </tr>
`; `;
} }
// <i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
}); });
$('#other_docs').append(table); $('#other_docs').append(table);

View File

@ -51,7 +51,7 @@
<th>S.No</th> <th>S.No</th>
<th>Docs Name</th> <th>Docs Name</th>
<th>File Name</th> <th>File Name</th>
<th>Drive File Location</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody id="table_bd"> <tbody id="table_bd">

View File

@ -35,7 +35,7 @@ table.dataTable tbody td {
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger"></span></label> <label for="client_branch">Client<span class="text-danger"></span></label>
<select class="form-control" id="client_id" name="client_id" > <select class="form-control" id="client_id" name="client_id">
<option value="0">Select Client</option> <option value="0">Select Client</option>
<?php <?php
if (isset($clients) && count($clients)) { if (isset($clients) && count($clients)) {
@ -48,20 +48,21 @@ table.dataTable tbody td {
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label> <label for="addon_policy"> Insurer <span id="base_danger"
<select class="form-control" id="insurer_id" name="insurer_id" > class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id">
<option value="0" selected>Select Insurer</option> <option value="0" selected>Select Insurer</option>
<?php if (isset($insurer) && count($insurer)) { ?> <?php if (isset($insurer) && count($insurer)) { ?>
<?php foreach ($insurer as $value) { ?> <?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option> <option value="<?= $value['id']?>"><?= $value['name']?></option>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="email"> Policy Type <span class="text-danger"></span></label> <label for="email"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="policy_type_id" name="policy_type_id" > <select class="form-control" id="policy_type_id" name="policy_type_id">
<option value="0">Select Policy Type</option> <option value="0">Select Policy Type</option>
<?php <?php
if (isset($policy_types) && count($policy_types)) { if (isset($policy_types) && count($policy_types)) {
@ -93,7 +94,8 @@ table.dataTable tbody td {
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label>Date Type<span class="text-danger"></span></label> <label>Date Type<span class="text-danger"></span></label>
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()"> <select class="form-control" id="date_type" name="date_type"
onchange="hideDateField()">
<option value="0">Select Date Type</option> <option value="0">Select Date Type</option>
<?php <?php
if (isset($date_type) && count($date_type)) { if (isset($date_type) && count($date_type)) {
@ -107,7 +109,8 @@ table.dataTable tbody td {
<div class="form-group col-md-3" style="display: none;" id="date_div"> <div class="form-group col-md-3" style="display: none;" id="date_div">
<label>Date<span class="text-danger"></span></label> <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%"> <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>&nbsp; <i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i> <span></span> <i class="fa fa-caret-down"></i>
</div> </div>
@ -116,8 +119,11 @@ table.dataTable tbody td {
</div> </div>
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;"> <div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
<a href="<?= base_url("/policy_tranction/report/report-finance-list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a> <a href="<?= base_url("/policy_tranction/report/report-finance-list"); ?>"
<a href="<?= base_url("/policy_tranction/report/report-finance-list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a> class="btn btn-secondary" id="clear-filters">Clear</a>
<a href="<?= base_url("/policy_tranction/report/report-finance-list"); ?>"
class="btn btn-primary" id="get-emp-list"
onclick="fetchEmpolyeeList(event);">Submit</a>
</div> </div>
</div> </div>
@ -156,6 +162,7 @@ table.dataTable tbody td {
<th>Policy</th> <th>Policy</th>
<th>Policy No</th> <th>Policy No</th>
<th>Endorsement No</th> <th>Endorsement No</th>
<th>Event Type</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
@ -169,11 +176,21 @@ table.dataTable tbody td {
<td><?php echo $row['policy_type']; ?></td> <td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['policy_no']; ?></td> <td><?php echo $row['policy_no']; ?></td>
<td><?php echo $row['endorsement_no']; ?></td> <td><?php echo $row['endorsement_no']; ?></td>
<td><?php echo $row['action_type_full']; ?></td>
<td> <td>
<div class="btn-group dropdown"> <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> <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"> <div class="dropdown-menu dropdown-menu-right">
<a href="<?= base_url("/policy_tranction/inception/list"); ?>" id="get-policy-list" class="dropdown-item btnEdit" onclick="sendPolicyTransactionID(event, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')"> <a href="
<?php
if ($row['action_type'] == 'I') {
echo base_url("/policy_tranction/inception/list") . '?pt_id=' . $row['id'];
} else {
echo base_url("/policy_tranction/endorsement/list") . '?pt_id=' . $row['id'];
}
?>" id="get-policy-list" class="dropdown-item btnEdit">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a> </a>
</div> </div>
@ -193,7 +210,6 @@ table.dataTable tbody td {
</div> </div>
<script> <script>
// Datatable document ready // Datatable document ready
$(document).ready(function() { $(document).ready(function() {
@ -204,8 +220,7 @@ $(document).ready(function() {
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [ buttons: [{
{
extend: 'csv', extend: 'csv',
text: 'CSV', text: 'CSV',
title: 'Policy-Tranction-BDS-List', title: 'Policy-Tranction-BDS-List',
@ -220,7 +235,8 @@ $(document).ready(function() {
// Find cells in column AB (28th column in Excel) // Find cells in column AB (28th column in Excel)
$('row c[r^="AB"]', sheet).each(function() { $('row c[r^="AB"]', sheet).each(function() {
var value = parseFloat($('v', this).text()); // Get the value inside the cell var value = parseFloat($('v', this)
.text()); // Get the value inside the cell
if (!isNaN(value)) { if (!isNaN(value)) {
total += value; total += value;
} }
@ -228,10 +244,13 @@ $(document).ready(function() {
// Get the last row index and append the total row // Get the last row index and append the total row
var lastRow = $('row:last', sheet); var lastRow = $('row:last', sheet);
var rowIndex = parseInt(lastRow.attr('r')) + 2; // Find the next row index var rowIndex = parseInt(lastRow.attr('r')) +
2; // Find the next row index
var totalRow = '<row r="' + rowIndex + '">' + var totalRow = '<row r="' + rowIndex + '">' +
'<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' + // Insert "Total" in AA '<c t="inlineStr" r="AA' + rowIndex +
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' + // Insert sum in AB '"><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>'; '</row>';
// Append the new total row to the sheet // Append the new total row to the sheet
@ -245,7 +264,8 @@ $(document).ready(function() {
searchPlaceholder: "Search..." searchPlaceholder: "Search..."
}, },
paging: true, // Enable pagination paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional) pageLength: 25, // Set default number of rows per page (optional)
ordering: false,
}); });
} else { } else {
console.error("Table not found."); console.error("Table not found.");
@ -259,8 +279,7 @@ $(document).ready(function() {
$('#policy_type_id').select2(); $('#policy_type_id').select2();
}) })
function fetchEmpolyeeList(event) function fetchEmpolyeeList(event) {
{
event.preventDefault(); // Prevent default action event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val(); var start_date = $('#startDate').val();
@ -289,13 +308,11 @@ function fetchEmpolyeeList(event)
window.location.href = apiURL; window.location.href = apiURL;
} }
function objectToQueryString(obj) function objectToQueryString(obj) {
{
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&'); return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
} }
function getURLParams() function getURLParams() {
{
const url = new URL(window.location.href); const url = new URL(window.location.href);
const params = new URLSearchParams(url.search); const params = new URLSearchParams(url.search);
@ -322,7 +339,7 @@ function getURLParams()
console.log('End Date:', endDate); console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) { if (startDate != 0 && endDate != 0) {
setTimeout(function(){ setTimeout(function() {
$('#start_date').val(startDate) $('#start_date').val(startDate)
$('#end_date').val(endDate) $('#end_date').val(endDate)
$('#client_id').val(client_id).change() $('#client_id').val(client_id).change()
@ -330,7 +347,7 @@ function getURLParams()
$('#policy_type_id').val(policy_type_id).change() $('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type) $('#date_type').val(date_type)
$('#issuer').val(issuer) $('#issuer').val(issuer)
},1000) }, 1000)
} }
@ -362,12 +379,14 @@ $(function() {
startDate: start, startDate: start,
endDate: end, endDate: end,
ranges: { ranges: {
'Today': [moment(), moment()], 'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')], 'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
.endOf('month')
]
} }
}, cb); }, cb);
@ -390,23 +409,21 @@ $(function() {
}); });
function hideDateField(input = null) function hideDateField(input = null) {
{
let val = $('#date_type').val(); let val = $('#date_type').val();
if(input){ if (input) {
val = input; val = input;
} }
if(val != 0){ if (val != 0) {
$('#date_div').show() $('#date_div').show()
}else{ } else {
$('#date_div').hide() $('#date_div').hide()
} }
} }
function sendPolicyTransactionID(event, pt_id) function sendPolicyTransactionID(event, pt_id) {
{
event.preventDefault(); // Prevent default action event.preventDefault(); // Prevent default action
console.log(pt_id); console.log(pt_id);
@ -420,5 +437,4 @@ function sendPolicyTransactionID(event, pt_id)
console.log(apiURL); console.log(apiURL);
window.location.href = apiURL; window.location.href = apiURL;
} }
</script> </script>

View File

@ -652,6 +652,7 @@
</div> </div>
</li> </li>
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
<li> <li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect"> <a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
@ -667,27 +668,44 @@
<li> <li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a> <a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li> </li>
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</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())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
</li>
<?php } ?>
<li> <li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a> <a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li> </li>
<li> <li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Varience</a> <a href="<?= base_url('/dmsSearch') ?>">Documents</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a>
</li>
<li>
<a href="<?= base_url('/dmsSearch') ?>">DMS Search</a>
</li> </li>
</ul> </ul>
</div> </div>
</li> </li>
<?php } ?>
</ul> </ul>
</div> </div>
<!-- End Sidebar --> <!-- End Sidebar -->

View File

@ -60,6 +60,12 @@
color: #666; /* Darker text color */ color: #666; /* Darker text color */
} }
.readonly-select {
pointer-events: none;
background-color: #f0f0f0;
color: #666;
}
.select2-hidden-accessible + .select2-container .select2-dropdown { .select2-hidden-accessible + .select2-container .select2-dropdown {
display: none !important; display: none !important;
} }
@ -102,8 +108,8 @@
<h4 style="position: relative;">Add Endorsement</h4> <h4 style="position: relative;">Add Endorsement</h4>
</div> </div>
<div class="col-6" style="text-align: right;"> <div class="col-6" style="text-align: right;">
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" <a href="<?= base_url('policy_tranction/endorsement/list') ?>" id="btnAdd" class="btn btn-primary waves-effect waves-light"
onclick="show_list_hide_add()">Back</button> onclick="//show_list_hide_add()">Back</a>
</div> </div>
</div> </div>
<form role="form" class="parsley-examples" method="post" id="endorsement_form_id" enctype="multipart/form-data"> <form role="form" class="parsley-examples" method="post" id="endorsement_form_id" enctype="multipart/form-data">
@ -364,8 +370,6 @@
<tr class="hideter" id="table_tr_16" style="display: none;"> <tr class="hideter" id="table_tr_16" style="display: none;">
<td id="agree_tp_td">Agreed TEP %</td> <td id="agree_tp_td">Agreed TEP %</td>
</tr> </tr>
<tr id="table_tr_17"> <tr id="table_tr_17">
<td>Agreed Amount</td> <td>Agreed Amount</td>
</tr> </tr>
@ -397,13 +401,13 @@
<td>Actual TEP %</td> <td>Actual TEP %</td>
</tr> </tr>
<tr id="table_tr_27"> <tr id="table_tr_27">
<td>Actual BP Brokerage Amount</td> <td>Actual BP <br> Remuneration Amount</td>
</tr> </tr>
<tr class="hidetp" id="table_tr_28"> <tr class="hidetp" id="table_tr_28">
<td>Actual TP Brokerage Amount</td> <td>Actual TP <br> Remuneration Amount</td>
</tr> </tr>
<tr class="hideter" id="table_tr_29" style="display: none;"> <tr class="hideter" id="table_tr_29" style="display: none;">
<td>Actual TEP Brokerage Amount</td> <td>Actual TEP <br> Remuneration Amount</td>
</tr> </tr>
<tr id="table_tr_30"> <tr id="table_tr_30">
<td>Expected Amount</td> <td>Expected Amount</td>
@ -447,14 +451,19 @@
<script> <script>
$(document).ready(function(){
getURLParamsForReport()
hidePermiumDetailsBasedOnTheTeam()
})
$(document).ready(function(){ $(document).ready(function(){
$('#client_id').change(function(){ $('#client_id').change(function(){
let client_id = $(this).val(); let client_id = $(this).val();
console.log('client_id', client_id); // console.log('client_id', client_id);
console.log('branch_list', branch_list); // console.log('branch_list', branch_list);
if(client_id == 'add_client') { if(client_id == 'add_client') {
$('#client_id').val('').change(); $('#client_id').val('').change();
@ -479,8 +488,8 @@ $(document).ready(function(){
$('#client_branch_id').change(function(){ $('#client_branch_id').change(function(){
let branch_id = $(this).val(); let branch_id = $(this).val();
console.log(policy_list) // console.log(policy_list)
console.log(branch_id) // console.log(branch_id)
if(policy_list != '') { if(policy_list != '') {
console.log(policy_list[branch_id]); console.log(policy_list[branch_id]);
@ -493,6 +502,10 @@ $(document).ready(function(){
$('#client_policy_id').change(function(){ $('#client_policy_id').change(function(){
console.log('######################################')
console.log('client_policy_id onchange called')
console.log('######################################')
let client_id = $('#client_id').val(); let client_id = $('#client_id').val();
let policy_tranction_primarykey = $('#policy_tranction_primarykey').val(); let policy_tranction_primarykey = $('#policy_tranction_primarykey').val();
let client_policy_id = $(this).val(); let client_policy_id = $(this).val();
@ -503,12 +516,12 @@ $(document).ready(function(){
var start_date = $(this).find('option:selected').attr('data-sd'); var start_date = $(this).find('option:selected').attr('data-sd');
var end_date = $(this).find('option:selected').attr('data-ed'); var end_date = $(this).find('option:selected').attr('data-ed');
console.log('client_id', client_id); // console.log('client_id', client_id);
console.log('client_policy_id', client_policy_id); // console.log('client_policy_id', client_policy_id);
console.log('policy_tranction_primarykey', policy_tranction_primarykey); // console.log('policy_tranction_primarykey', policy_tranction_primarykey);
console.log('policy_no', policy_no); // console.log('policy_no', policy_no);
console.log('cd_ac_no',cd_ac_no); // console.log('cd_ac_no',cd_ac_no);
console.log('tpa',tpa); // console.log('tpa',tpa);
$('#policy_no').val(policy_no); $('#policy_no').val(policy_no);
$('#insurer_id').val(insurer); $('#insurer_id').val(insurer);
@ -517,10 +530,10 @@ $(document).ready(function(){
$('#policy_start_date').val(start_date); $('#policy_start_date').val(start_date);
$('#policy_end_date').val(end_date); $('#policy_end_date').val(end_date);
removeAllColumnsExceptFirst('insurerTable');
if(!policy_tranction_primarykey && client_id && client_policy_id){ if(!policy_tranction_primarykey && client_id && client_policy_id){
removeAllColumnsExceptFirst('insurerTable');
form_action = '<?= base_url("util/getPTCOShareCount/"); ?>' + client_id + '/' + client_policy_id; form_action = '<?= base_url("util/getPTCOShareCount/"); ?>' + client_id + '/' + client_policy_id;
$.ajax({ $.ajax({
@ -709,7 +722,7 @@ $("#endorsement_form_id").submit(function(event) {
if (res.status == true) { if (res.status == true) {
toastr.success(res.message, 'Success'); toastr.success(res.message, 'Success');
$('#policy_tranction_primarykey').val(res.pt_id); $('#policy_tranction_primarykey').val(res.pt_id);
window.location.reload(true); window.location.href = '<?= base_url('policy_tranction/endorsement/list') ?>';
} else { } else {
toastr.error(res.message, 'Error'); toastr.error(res.message, 'Error');
} }
@ -809,7 +822,8 @@ function getPolicyTransactionDataForEndorsementEdit(input){
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
$('#endorsement_form_id')[0].reset(); $('#endorsement_form_id')[0].reset();
var id = $(input).attr('data-id'); // var id = $(input).attr('data-id');
var id = input;
$.ajax({ $.ajax({
url: '<?= base_url("/policy_tranction/endorsement/list/") ?>' + id, url: '<?= base_url("/policy_tranction/endorsement/list/") ?>' + id,
@ -851,11 +865,14 @@ function getPolicyTransactionDataForEndorsementEdit(input){
$('#policy_start_date').val(res.data.policy_start_date); $('#policy_start_date').val(res.data.policy_start_date);
$('#policy_end_date').val(res.data.policy_end_date); $('#policy_end_date').val(res.data.policy_end_date);
$('#endorse_eff_date').val(res.data.endorse_eff_date); $('#endorse_eff_date').val(res.data.endorse_eff_date);
$('#endorse_eff_date').val(res.data.month); $('#month').val(res.data.month);
removeAllColumnsExceptFirst('insurerTable'); removeAllColumnsExceptFirst('insurerTable');
if(res.data.pt_co_share_details){
populateTable(res.data.pt_co_share_details, true); if(res.data.pt_co_share_details.length > 0){
setTimeout(function(){
populateTable(res.data.pt_co_share_details, true);
}, 2000);
}else{ }else{
addInsurerColumn(); addInsurerColumn();
} }
@ -881,7 +898,7 @@ function getPolicyTransactionDataForEndorsementEdit(input){
function amountCalculation(input) { function amountCalculation(input) {
// console.log(input); // console.log(input);
let selectedOption = $('#policy_type_id').find('option:selected'); let selectedOption = $('#client_policy_id').find('option:selected');
let bap = selectedOption.data('bap'); let bap = selectedOption.data('bap');
@ -905,6 +922,14 @@ function amountCalculation(input) {
let stamp_duty_amt = parseFloat($('#stamp_duty_' + input).val()) || 0; let stamp_duty_amt = parseFloat($('#stamp_duty_' + input).val()) || 0;
let agreed_amount = parseFloat($('#agreed_amount_' + input).val()) || 0; let agreed_amount = parseFloat($('#agreed_amount_' + input).val()) || 0;
let agreed_bp_per = parseFloat($('#agreed_bp_' + input).val()) || 0;
let agreed_tp_per = parseFloat($('#agreed_tp_' + input).val()) || 0;
let agreed_tep_per = parseFloat($('#agreed_ter_' + input).val()) || 0;
let standard_bp_per = parseFloat($('#standard_bp_' + input).val()) || 0;
let standard_tp_per = parseFloat($('#standard_tp_' + input).val()) || 0;
let standard_tep_per = parseFloat($('#standard_tep_' + input).val()) || 0;
// Calculate GST percentage // Calculate GST percentage
let gst_per = igst; let gst_per = igst;
if (igst === 0) { if (igst === 0) {
@ -923,14 +948,21 @@ function amountCalculation(input) {
$('#total_amt_' + input).val(finalTotal.toFixed(2)); $('#total_amt_' + input).val(finalTotal.toFixed(2));
var expectedAmount = 0; let sum_of_agreed_premium = agreed_bp_per + agreed_tp_per + agreed_tep_per;
if(agreed_amount != 0 || agreed_amount != ""){ var expectedAmount = 0;
if(agreed_amount > 0 ){
expectedAmount = agreed_amount; expectedAmount = 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;
}else{ }else{
expectedAmount = bp + tp + tep; expectedAmount = ((bp + cop) * standard_bp_per)+ ((tp + tep)*(standard_tp_per + standard_tep_per));
expectedAmount = expectedAmount / 100;
} }
// console.log('expectedAmount', expectedAmount);
//Expected Amount //Expected Amount
$('#exp_amt_' + input).val(expectedAmount.toFixed(2)); $('#exp_amt_' + input).val(expectedAmount.toFixed(2));
@ -941,16 +973,19 @@ function amountCalculation(input) {
let variance = expectedAmount - (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount) let variance = expectedAmount - (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount)
$('#variance_' + input).val(variance.toFixed(2)); $('#variance_' + input).val(variance.toFixed(2));
// console.log('variance', variance);
console.log('expectedAmount', expectedAmount);
console.log('variance', variance);
} }
function actualAmountCalculation(input){ function actualAmountCalculation(input, field = null){
let selectedOption = $('#policy_type_id').find('option:selected'); console.log('actualAmountCalculation function called')
console.log('actualAmountCalculation function input', input)
console.log('actualAmountCalculation function field', field)
let selectedOption = $('#client_policy_id').find('option:selected');
let bap = selectedOption.data('bap'); let bap = selectedOption.data('bap');
console.log('actualAmountCalculation function bap', bap)
let actual_bp_amt = parseFloat($('#actual_bp_amt_' + input).val()) || 0; let actual_bp_amt = parseFloat($('#actual_bp_amt_' + input).val()) || 0;
let actual_tp_amt = parseFloat($('#actual_tp_amt_' + input).val()) || 0; let actual_tp_amt = parseFloat($('#actual_tp_amt_' + input).val()) || 0;
@ -964,40 +999,59 @@ function actualAmountCalculation(input){
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100; if (field === 'bp_per') {
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100; console.log()
if (actual_bp_amt > 0 && actual_bp_per >= 0) {
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
$('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
}
} else if (field === 'bp_broker_amt') {
// If brokerage amount is changed, update percentage
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
$('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
}
} else if (field === 'bp_amt_for_calc') {
if(actual_bp_brokerage_amt == 0 || actual_bp_brokerage_amt == 0.00 || actual_bp_brokerage_amt == ""){ if (actual_bp_amt > 0 && actual_bp_per >= 0) {
$('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2)); let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
$('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
}
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
$('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
}
} }
if(actual_bp_per == 0 || actual_bp_per == 0.00 || actual_bp_per == ""){
$('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
}
console.log('actual_bp_brokerage_amount', actual_bp_brokerage_amount);
console.log('actual_bp_percentage', actual_bp_percentage);
//----------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------
var actual_tp_brokerage_amount = 0;
var actual_tp_percentage = 0;
if(bap == 'Motor'){ if(bap == 'Motor'){
actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100; if (field === 'tp_per') {
actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100; if (actual_tp_amt > 0 && actual_tp_per >= 0) {
let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
$('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
}
} else if (field === 'tp_broker_amt') {
// If brokerage amount is changed, update percentage
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
$('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
}
} else if (field === 'tp_amt_for_calc') {
if(actual_tp_brokerage_amt == 0 || actual_tp_brokerage_amt == ""){ if (actual_tp_amt > 0 && actual_tp_per >= 0) {
$('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2)); let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
$('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
}
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
$('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
}
} }
if(actual_tp_per == 0 || actual_tp_per == ""){
$('#actual_tp_per_' + input).val(actual_bp_percentage.toFixed(2));
}
console.log('actual_tp_brokerage_amount', actual_tp_brokerage_amount);
console.log('actual_tp_percentage', actual_tp_percentage);
}else{ }else{
$('#actual_tp_brokerage_amt_' + input).val(0); $('#actual_tp_brokerage_amt_' + input).val(0);
@ -1006,25 +1060,33 @@ function actualAmountCalculation(input){
//----------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------
var actual_tep_brokerage_amount = 0;
var actual_tep_percentage = 0;
if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){ if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100; if (field === 'tep_per') {
actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100; if (actual_tep_amt > 0 && actual_tep_per >= 0) {
let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
$('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
}
} else if (field === 'tep_broker_amt') {
// If brokerage amount is changed, update percentage
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
$('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
}
} else if (field === 'tep_amt_for_calc') {
if(actual_tep_brokerage_amt == 0 || actual_tep_brokerage_amt == ""){ if (actual_tep_amt > 0 && actual_tep_per >= 0) {
$('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2)); let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
$('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
}
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
$('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
}
} }
if(actual_tep_per == 0 || actual_tp_per == ""){
$('#actual_tep_per_' + input).val(actual_bep_percentage.toFixed(2));
}
console.log('actual_tep_brokerage_amount', actual_tep_brokerage_amount);
console.log('actual_tep_percentage', actual_tep_percentage);
}else{ }else{
$('#actual_tep_brokerage_amt_' + input).val(0); $('#actual_tep_brokerage_amt_' + input).val(0);
@ -1041,8 +1103,8 @@ function actualAmountCalculation(input){
$('#variance_' + input).val(variance.toFixed(2)); $('#variance_' + input).val(variance.toFixed(2));
console.log('expectedAmount', expectedAmount); // console.log('expectedAmount', expectedAmount);
console.log('variance', variance); // console.log('variance', variance);
} }
function validateRange(input) { function validateRange(input) {
@ -1079,6 +1141,82 @@ function checkInvoiceStatusToHideSubmitBtn(id){
} }
function hidePermiumDetailsBasedOnTheTeam(){
var teams = <?php echo json_encode(user_team()); ?>;
console.log('teams', teams);
// var teams = <?php echo json_encode(teams()); ?>;
// console.log('teams', teams);
var ids = [
'table_tr_14',
'table_tr_15',
'table_tr_16',
'table_tr_17',
'table_tr_18',
'table_tr_19',
'table_tr_20',
'table_tr_21',
'table_tr_22',
'table_tr_23',
'table_tr_24',
'table_tr_25',
'table_tr_26',
'table_tr_27',
'table_tr_28',
'table_tr_29',
'table_tr_30',
'table_tr_31',
'table_tr_32'
];
if (teams.includes('4')) {
console.log('Finance Team Logged in.');
ids.forEach(function(id) {
$('#' + id).show();
// $('#' + id + ' input, #' + id + ' select, #' + id + ' textarea').prop('disabled', false); // Enable inputs
});
} else {
console.log('Business Team Logged in.');
ids.forEach(function(id) {
$('#' + id).hide(); // Hide the row
// $('#' + id + ' input, #' + id + ' select, #' + id + ' textarea').prop('disabled', true); // Disable inputs
});
$('.hideter').hide()
$('.hidetp').hide()
}
}
function getpolicyDataForEndorsement(input){
var client_policy_id = $(input).val();
console.log(client_policy_id);
if(client_policy_id){
$.ajax({
url: '<?php echo base_url('util/get_client_policy_data_using_client_policy_id/');?>'+ client_policy_id,
type: "GET",
dataType: 'json',
success: function (res) {
console.log(res)
if(res.status == true){
$('#ct_type').val(1)
}else{
$('#ct_type').val(2)
console.log(res.message, 'warning');
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
}
//--------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------
var insurerCount = 0; var insurerCount = 0;
@ -1098,6 +1236,8 @@ $('#setInsurerCount').on('input', function() {
function addInsurerColumn() { function addInsurerColumn() {
insurerCount++; insurerCount++;
hidePermiumDetailsBasedOnTheTeam()
// Update header // Update header
$('#insurerTable thead tr').append(` $('#insurerTable thead tr').append(`
<th> <th>
@ -1113,7 +1253,7 @@ function addInsurerColumn() {
switch(index) { switch(index) {
case 0: // Insurer selection case 0: // Insurer selection
newCell = `<td> newCell = `<td>
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]"> <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> <option value="" selected>Select Insurer</option>
<?php foreach ($insurer_branch as $value) { ?> <?php foreach ($insurer_branch as $value) { ?>
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>"> <option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
@ -1148,13 +1288,13 @@ function addInsurerColumn() {
newCell = `<td><input type="text" class="right-align-input" id="co_premium_${insurerCount}" name="co_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 7: // CGST case 7: // CGST
newCell = `<td><input type="text" class="right-align-input" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 8: // SGST case 8: // SGST
newCell = `<td><input type="text" class="right-align-input" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 9: // IGST case 9: // IGST
newCell = `<td><input type="text" class="right-align-input" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 10: // GST Amount 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>`; 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>`;
@ -1166,13 +1306,13 @@ function addInsurerColumn() {
newCell = `<td><input type="text" class="readonly-color right-align-input" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`; newCell = `<td><input type="text" class="readonly-color right-align-input" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`;
break; break;
case 13: // Agreed BP % case 13: // Agreed BP %
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="agreed_bp[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`; newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="agreed_bp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
break; break;
case 14: // Agreed TP % case 14: // Agreed TP %
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="agreed_tp[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`; newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="agreed_tp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
break; break;
case 15: // Agreed Ter % case 15: // Agreed Ter %
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="agreed_ter[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`; newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="agreed_ter[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
break; break;
case 16: // Agreed Amount case 16: // Agreed Amount
newCell = `<td><input type="text" class="right-align-input" id="agreed_amount_${insurerCount}" name="agreed_amount[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`; newCell = `<td><input type="text" class="right-align-input" id="agreed_amount_${insurerCount}" name="agreed_amount[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
@ -1187,31 +1327,31 @@ function addInsurerColumn() {
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" name="standard_ter[]" onkeypress="return onlyNumbers(event)" readonly></td>`; 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; break;
case 20: // Actual BP Amount 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}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 21: // Actual TP Amount 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}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 22: // Actual TEP Amount 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}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 23: // Actual BP % 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}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 24: // Actual TP % 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}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 25: // Actual TEP % case 25: // Actual TEP %
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="actual_tep_per_${insurerCount}" name="actual_tep_amt[]" onchange="actualAmountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 26: // Actual BP Brokerage Amount 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}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 27: // Actual TP Brokerage Amount 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}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 28: // Actual TEP Brokerage Amount 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}')" onkeypress="return onlyNumbers(event)"></td>`; 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; break;
case 29: // Expected Amount 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>`; newCell = `<td><input type="text" class="right-align-input" id="exp_amt_${insurerCount}" name="exp_amt[]" onchange="actualAmountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
@ -1225,14 +1365,17 @@ function addInsurerColumn() {
case 32: // ID For Update case 32: // ID For Update
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`; newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;
break; break;
} }
// console.log(newCell);
$(this).append(newCell); $(this).append(newCell);
$('#follow_insurer_id_' + insurerCount).select2() // $('#follow_insurer_id_' + insurerCount).select2()
var selectedOption = $('#policy_type_id').find('option:selected'); var selectedOption = $('#client_policy_id').find('option:selected');
console.log('selcted client policy selectedOption', selectedOption);
var ebp = selectedOption.data('ebp'); var ebp = selectedOption.data('ebp');
var etp = selectedOption.data('etp'); var etp = selectedOption.data('etp');
@ -1242,23 +1385,25 @@ function addInsurerColumn() {
var itep = selectedOption.data('itep'); var itep = selectedOption.data('itep');
var bap = selectedOption.data('bap'); var bap = selectedOption.data('bap');
console.log('selcted client policy BAP', bap);
if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){ if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
console.log('Fire, Marine Cargo, Marine Hull');
$('.hideter').show(); $('.hideter').show();
$('.hidetp').hide(); $('.hidetp').hide();
}else{ }else{
if(bap == 'Motor'){ if(bap == 'Motor'){
console.log('Motor');
$('.hidetp').show() $('.hidetp').show()
$('.hideter').hide() $('.hideter').hide()
}else{ }else{
console.log('Not any thing');
$('.hideter').hide() $('.hideter').hide()
$('.hidetp').hide() $('.hidetp').hide()
} }
} }
$('#standard_bp_'+insurerCount).val(ebp);
$('#standard_bp_').val(ebp);
// $('[name="standard_bp[]"]').val(ebp); // $('[name="standard_bp[]"]').val(ebp);
$('[name="standard_tp[]"]').val(etp); $('[name="standard_tp[]"]').val(etp);
$('[name="standard_tep[]"]').val(etep); $('[name="standard_tep[]"]').val(etep);
@ -1292,6 +1437,11 @@ function removeInsurerColumn(index) {
} }
function removeAllColumnsExceptFirst(tableId) { function removeAllColumnsExceptFirst(tableId) {
console.log('######################################')
console.log('removeAllColumnsExceptFirst function called');
console.log('######################################');
// Remove all headers except the first one // Remove all headers except the first one
$('#' + tableId + ' thead tr th').each(function(index) { $('#' + tableId + ' thead tr th').each(function(index) {
if (index > 0) { // Keep the first column (index 0) if (index > 0) { // Keep the first column (index 0)
@ -1312,6 +1462,13 @@ function removeAllColumnsExceptFirst(tableId) {
} }
function populateTable(dataArray, status = false) { function populateTable(dataArray, status = false) {
console.log('####################################')
console.log('populateTable function called')
console.log('####################################')
console.log(dataArray);
dataArray.forEach((data, index) => { dataArray.forEach((data, index) => {
// Add a new insurer column for each entry in the data array // Add a new insurer column for each entry in the data array
addInsurerColumn(); // This will add a new column dynamically addInsurerColumn(); // This will add a new column dynamically
@ -1324,7 +1481,7 @@ function populateTable(dataArray, status = false) {
switch (rowIndex) { switch (rowIndex) {
case 0: // Insurer selection case 0: // Insurer selection
cell.find('select').val(insurer).prop('disabled', true).select2(); cell.find('select').val(insurer);
break; break;
case 1: // Is Leader? 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');
@ -1420,10 +1577,43 @@ function populateTable(dataArray, status = false) {
cell.find('input').val(data.reward); cell.find('input').val(data.reward);
break; break;
case 32: // Co-share ID (hidden field) case 32: // Co-share ID (hidden field)
cell.find('input[type="hidden"]').val(data.id); cell.find('input[type="hidden"]').val(status ? data.id : '');
break; break;
} }
}); });
}); });
} }
//-----------------------------------------------------------------------------------------------------------
function getURLParamsForReport()
{
console.log('getURLParamsForReport() function called')
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const pt_id = params.get('pt_id') ?? 0
console.log('policy tranction id ', pt_id);
if(pt_id != 0){
setTimeout(function(){
hide_list_show_add()
getPolicyTransactionDataForEndorsementEdit(pt_id)
}, 2000)
}else{
show_list_hide_add()
}
console.log('pt_id', pt_id)
}
function onlyNumbers(event)
{
var charcode;
charcode = event.which || event.keyCode;
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
return false;
}
</script> </script>

View File

@ -21,12 +21,6 @@ table.dataTable thead th {
position: absolute; position: absolute;
} }
.readonly-select {
pointer-events: none;
background-color: #f0f0f0;
color: #666;
}
.column-header { .column-header {
margin-right: 10px; /* Adjust this value as needed */ margin-right: 10px; /* Adjust this value as needed */
} }
@ -201,8 +195,9 @@ table.dataTable thead th {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach($endorsement_data_list as $row){ ?> <?php foreach($endorsement_data_list as $index => $row){ ?>
<tr> <tr>
<td><?php echo $index+1; ?></td>
<td><?php echo $issuer[$row['issuer']] ?? ''; ?></td> <td><?php echo $issuer[$row['issuer']] ?? ''; ?></td>
<td><?php echo $row['client_short_name']; ?></td> <td><?php echo $row['client_short_name']; ?></td>
<td><?php echo $row['client_branch_name']; ?></td> <td><?php echo $row['client_branch_name']; ?></td>
@ -210,17 +205,17 @@ table.dataTable thead th {
<td><?php echo $row['policy_type']; ?></td> <td><?php echo $row['policy_type']; ?></td>
<td><?php echo $action_type[$row['action_type']]; ?></td> <td><?php echo $action_type[$row['action_type']]; ?></td>
<td><?php echo $row['endorsement_no']; ?></td> <td><?php echo $row['endorsement_no']; ?></td>
<td><?php echo date('d-m-Y', strtotime($row['data_received_date'])); ?></td> <td><?php echo empty($row['data_received_date']) ? '' : date('d/m/Y', strtotime($row['data_received_date'])); ?></td>
<td><?php echo $row['emp_count']; ?></td> <td class="right-align-input"><?php echo $row['emp_count']; ?></td>
<td><?php echo $row['dependent_count']; ?></td> <td class="right-align-input"><?php echo $row['dependent_count']; ?></td>
<td><?php echo date('d-m-Y', strtotime($row['closure_date'])); ?></td> <td><?php echo empty($row['closure_date']) ? '' : date('d/m/Y', strtotime($row['closure_date'])); ?></td>
<td><?php echo $policy_status[$row['status']]; ?></td> <td><?php echo $policy_status[$row['status']]; ?></td>
<td> <td>
<div class="btn-group dropdown"> <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> <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"> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEndorsementEdit(this)"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a> <a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEndorsementEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
</div> </div>
</div> </div>
</td> </td>
@ -296,7 +291,8 @@ table.dataTable thead th {
searchPlaceholder: "Search..." searchPlaceholder: "Search..."
}, },
paging: true, // Enable pagination paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional) pageLength: 25, // Set default number of rows per page (optional)
ordering: false,
}); });
} else { } else {
console.error("Table not found."); console.error("Table not found.");
@ -309,47 +305,42 @@ table.dataTable thead th {
var today = new Date(); var today = new Date();
var data_received_date = flatpickr("#data_received_date", { var data_received_date = flatpickr("#data_received_date", {
dateFormat: "d-m-Y", dateFormat: "d/m/Y",
allowInput: false allowInput: false
}); });
var closure_date = flatpickr("#closure_date", { var closure_date = flatpickr("#closure_date", {
dateFormat: "d-m-Y", dateFormat: "d/m/Y",
allowInput: false allowInput: false
}); });
// var start_date = flatpickr("#policy_start_date", { // var start_date = flatpickr("#policy_start_date", {
// dateFormat: "d-m-Y", // dateFormat: "d/m/Y",
// allowInput: false // allowInput: false
// }); // });
// var end_date = flatpickr("#policy_end_date", { // var end_date = flatpickr("#policy_end_date", {
// dateFormat: "d-m-Y", // dateFormat: "d/m/Y",
// allowInput: false // allowInput: false
// }); // });
var endorse_eff_date = flatpickr("#endorse_eff_date", { var endorse_eff_date = flatpickr("#endorse_eff_date", {
dateFormat: "d-m-Y", dateFormat: "d/m/Y",
allowInput: false allowInput: false
}); });
var month = flatpickr("#month", { var month = flatpickr("#month", {
dateFormat: "M-Y", dateFormat: "M/Y",
allowInput: false, allowInput: false,
}); });
// $('#month').val('<?= date('M-Y') ?>');
// console.log('month', $('#month'));
// console.log('month', '<?= date('M-Y') ?>');
// console.log('month', new Date('<?= date('M-Y') ?>'));
// console.log('month', <?= date('M-Y') ?>);
}); });
function hide_list_show_add() function hide_list_show_add()
{ {
removeAllColumnsExceptFirst('insurerTable'); removeAllColumnsExceptFirst('insurerTable');
$('.hideter').hide()
$('.hidetp').hide()
$('#endorsement_form_id')[0].reset(); $('#endorsement_form_id')[0].reset();
$('#client_id').val('').change(); $('#client_id').val('').change();
$('#client_policy_id').val('').change(); $('#client_policy_id').val('').change();
@ -469,6 +460,7 @@ table.dataTable thead th {
'data-etp' : item.etp, 'data-etp' : item.etp,
'data-iep' : item.iep, 'data-iep' : item.iep,
'data-itp' : item.itp, 'data-itp' : item.itp,
'data-bap' : item.bap,
'data-tpa' : item.tpa_branch_id + '-' + item.tpa_id, 'data-tpa' : item.tpa_branch_id + '-' + item.tpa_id,
}); });
$('#client_policy_id').append(option); $('#client_policy_id').append(option);
@ -635,18 +627,18 @@ function getURLParams()
hideDateField(date_type) hideDateField(date_type)
console.log('startDate', startDate) // console.log('startDate', startDate)
console.log('endDate', endDate) // console.log('endDate', endDate)
console.log('client_id', client_id) // console.log('client_id', client_id)
console.log('insurer_id', insurer_id) // console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id) // console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type) // console.log('date_type', date_type)
console.log('issuer', issuer) // console.log('issuer', issuer)
console.log('status', status) // console.log('status', status)
// Log the values or use them as needed // Log the values or use them as needed
console.log('Start Date:', startDate); // console.log('Start Date:', startDate);
console.log('End Date:', endDate); // console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) { if (startDate != 0 && endDate != 0) {
setTimeout(function(){ setTimeout(function(){
@ -670,20 +662,20 @@ $(function() {
const params = new URLSearchParams(url.search); const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values // 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 startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD/MM/YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY'); const endDateParam = params.get('end_date') || moment().format('DD/MM/YYYY');
// Parse the dates to moment objects // Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY'); var start = moment(startDateParam, 'DD/MM/YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY'); var end = moment(endDateParam, 'DD/MM/YYYY');
// var start = moment().subtract(29, 'days'); // var start = moment().subtract(29, 'days');
// var end = moment(); // var end = moment();
function cb(start, end) { function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY')); $('#reportrange span').html(start.format('D/MM/YYYY') + ' - ' + end.format('D/MM/YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY')); $('#startDate').val(start.format('DD/MM/YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY')); $('#endDate').val(end.format('DD/MM/YYYY'));
} }
$('#reportrange').daterangepicker({ $('#reportrange').daterangepicker({

File diff suppressed because it is too large Load Diff

View File

@ -247,6 +247,7 @@ table.dataTable tbody td {
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table"> <table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th><div class="column-header">S.No.</div></th>
<th><div class="column-header">Issuer</div></th> <th><div class="column-header">Issuer</div></th>
<th><div class="column-header">Issuing Type</div></th> <th><div class="column-header">Issuing Type</div></th>
<th><div class="column-header">Client Type</div></th> <th><div class="column-header">Client Type</div></th>
@ -265,8 +266,9 @@ table.dataTable tbody td {
</thead> </thead>
<tbody> <tbody>
<?php foreach($inception_data_list as $row){ ?> <?php foreach($inception_data_list as $index => $row){ ?>
<tr> <tr>
<td><?php echo $index+1; ?></td>
<td><?php echo $issuer[$row['issuer']]; ?></td> <td><?php echo $issuer[$row['issuer']]; ?></td>
<td><?php echo $issuing_type[$row['issue_type']]; ?></td> <td><?php echo $issuing_type[$row['issue_type']]; ?></td>
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td> <td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
@ -274,11 +276,11 @@ table.dataTable tbody td {
<td><?php echo $row['insurer_short_name']; ?></td> <td><?php echo $row['insurer_short_name']; ?></td>
<td><?php echo $row['policy_type']; ?></td> <td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['policy_no']; ?></td> <td><?php echo $row['policy_no']; ?></td>
<td><?php echo date('d-m-Y', strtotime($row['policy_issue_date'])); ?></td> <td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_issue_date'])); ?></td>
<td><?php echo date('d-m-Y', strtotime($row['policy_start_date'])); ?></td> <td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_start_date'])); ?></td>
<td><?php echo date('d-m-Y', strtotime($row['policy_end_date'])); ?></td> <td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
<td><?php echo $row['emp_count']; ?></td> <td class="right-align-input"><?php echo $row['emp_count']; ?></td>
<td><?php echo $row['dependent_count']; ?></td> <td class="right-align-input"><?php echo $row['dependent_count']; ?></td>
<td><?php echo $policy_status[$row['status']]; ?></td> <td><?php echo $policy_status[$row['status']]; ?></td>
<td> <td>
<div class="btn-group dropdown"> <div class="btn-group dropdown">
@ -304,57 +306,6 @@ table.dataTable tbody td {
<?php include('pt_form_file_upload_tab.php'); ?> <?php include('pt_form_file_upload_tab.php'); ?>
<!-- CD No form content modal-->
<div class="modal fade" id="cd_form_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="title">Add CD Account Number</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<div class="">
<form role="form" class="parsley-examples" method="post" id="CDMasterForm" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-12">
<label for="email">Opening Date<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="opening_date" id="opening_date" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="mobile">CD Account Number<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="cd_ac_no_data" name="cd_ac_no" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="mobile">Opening Amount<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="opening_bal" name="opening_bal" onkeypress="return onlyNumbers(event)" required>
</div>
</div>
</div>
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnSubmit">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="file_upload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal fade" id="file_upload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-full-width"> <div class="modal-dialog modal-full-width">
<div class="modal-content"> <div class="modal-content">
@ -480,7 +431,8 @@ $(document).ready(function() {
searchPlaceholder: "Search..." searchPlaceholder: "Search..."
}, },
paging: true, // Enable pagination paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional) pageLength: 25, // Set default number of rows per page (optional)
// ordering: false,
}); });
} else { } else {
console.error("Table not found."); console.error("Table not found.");
@ -493,12 +445,12 @@ $(document).ready(function(){
var today = new Date(); var today = new Date();
var opening_date = flatpickr("#opening_date", { var opening_date = flatpickr("#opening_date", {
dateFormat: "d-m-Y", dateFormat: "d/m/Y",
allowInput: false allowInput: false
}); });
var policy_start_date = flatpickr("#policy_start_date", { var policy_start_date = flatpickr("#policy_start_date", {
dateFormat: "d-m-Y", dateFormat: "d/m/Y",
defaultDate: today, defaultDate: today,
allowInput: false, allowInput: false,
onChange: function(selectedDates, dateStr, instance) { onChange: function(selectedDates, dateStr, instance) {
@ -520,30 +472,30 @@ $(document).ready(function(){
closeDate.setDate(closeDate.getDate() - 1); // Set end date to last day of next year closeDate.setDate(closeDate.getDate() - 1); // Set end date to last day of next year
var policy_end_datePicker = flatpickr("#policy_end_date", { var policy_end_datePicker = flatpickr("#policy_end_date", {
dateFormat: "d-m-Y", dateFormat: "d/m/Y",
defaultDate: closeDate, defaultDate: closeDate,
allowInput: false allowInput: false
}); });
var renewal_datePicker = flatpickr("#renewal_date", { var renewal_datePicker = flatpickr("#renewal_date", {
dateFormat: "d-m-Y", dateFormat: "d/m/Y",
allowInput: false allowInput: false
}); });
var month = flatpickr("#month", { var month = flatpickr("#month", {
dateFormat: "M-Y", // Format as month and year dateFormat: "M/Y", // Format as month and year
allowInput: false, // Disable manual input allowInput: false, // Disable manual input
}); });
var policy_issue_date = flatpickr("#policy_issue_date", { var policy_issue_date = flatpickr("#policy_issue_date", {
dateFormat: "d-m-Y", // Format as day-month-year dateFormat: "d/m/Y", // Format as day-month-year
allowInput: false, // Disable manual input allowInput: false, // Disable manual input
onChange: function(selectedDates, dateStr, instance) { onChange: function(selectedDates, dateStr, instance) {
// Get the selected date // Get the selected date
var selectedDate = new Date(selectedDates[0]); var selectedDate = new Date(selectedDates[0]);
// Format the selected date to "M-Y" // Format the selected date to "M-Y"
var formattedMonth = flatpickr.formatDate(selectedDate, "M-Y"); var formattedMonth = flatpickr.formatDate(selectedDate, "M/Y");
// Set the value of the #month input // Set the value of the #month input
month.setDate(formattedMonth); month.setDate(formattedMonth);
@ -1445,18 +1397,18 @@ function getURLParams()
hideDateField(date_type) hideDateField(date_type)
console.log('startDate', startDate) // console.log('startDate', startDate)
console.log('endDate', endDate) // console.log('endDate', endDate)
console.log('client_id', client_id) // console.log('client_id', client_id)
console.log('insurer_id', insurer_id) // console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id) // console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type) // console.log('date_type', date_type)
console.log('issuer', issuer) // console.log('issuer', issuer)
console.log('status', status) // console.log('status', status)
// Log the values or use them as needed // Log the values or use them as needed
console.log('Start Date:', startDate); // console.log('Start Date:', startDate);
console.log('End Date:', endDate); // console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) { if (startDate != 0 && endDate != 0) {
setTimeout(function(){ setTimeout(function(){
@ -1480,20 +1432,20 @@ $(function() {
const params = new URLSearchParams(url.search); const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values // 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 startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD/MM/YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY'); const endDateParam = params.get('end_date') || moment().format('DD/MM/YYYY');
// Parse the dates to moment objects // Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY'); var start = moment(startDateParam, 'DD/MM/YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY'); var end = moment(endDateParam, 'DD/MM/YYYY');
// var start = moment().subtract(29, 'days'); // var start = moment().subtract(29, 'days');
// var end = moment(); // var end = moment();
function cb(start, end) { function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY')); $('#reportrange span').html(start.format('D/MM/YYYY') + ' - ' + end.format('D/MM/YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY')); $('#startDate').val(start.format('DD/MM/YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY')); $('#endDate').val(end.format('DD/MM/YYYY'));
} }
$('#reportrange').daterangepicker({ $('#reportrange').daterangepicker({

View File

@ -8,18 +8,18 @@
<span class="d-none d-sm-inline-block">Policy</span> <span class="d-none d-sm-inline-block">Policy</span>
</a> </a>
</li> </li>
<li class="nav-item">
<a href="#fileupload" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
<span class="mr-1"><i class="fa fa-file"></i></span>
<span class="d-none d-sm-inline-block">File Upload</span>
</a>
</li>
<li class="nav-item"> <li class="nav-item">
<a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab2"> <a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab2">
<span class="mr-1"><i class="fa fa-file"></i></span> <span class="mr-1"><i class="fa fa-file"></i></span>
<span class="d-none d-sm-inline-block">KYC Docs</span> <span class="d-none d-sm-inline-block">KYC Docs</span>
</a> </a>
</li> </li>
<li class="nav-item" id="hide_file_upload" style="display: none;">
<a href="#fileupload" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
<span class="mr-1"><i class="fa fa-file"></i></span>
<span class="d-none d-sm-inline-block">File Upload</span>
</a>
</li>
<li class="nav-item" id="hide_vehicle_tab" style="display: none;"> <li class="nav-item" id="hide_vehicle_tab" style="display: none;">
<a href="#vehicle-docs-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="vehicle_tab"> <a href="#vehicle-docs-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="vehicle_tab">
<span class="mr-1"><i class="fa fa-file"></i></span> <span class="mr-1"><i class="fa fa-file"></i></span>

View File

@ -36,45 +36,35 @@ table.dataTable tbody td {
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>S. No</th> <th>S. No</th>
<th>User Name</th>
<th>Month</th> <th>Month</th>
<th>Business Type</th> <th>Business Type</th>
<th>Date</th>
<th>Sales Generated By (Name)</th>
<th>Branch (JIBS)</th>
<th>Serviced By (Name)</th>
<th>Client Name</th>
<th>Client Address</th>
<th>Client Type</th> <th>Client Type</th>
<th>Payment From</th> <th>Insured Name</th>
<th>Reference</th> <th>Policy/<br>Endorsement</th>
<th>Remarks</th> <th>Policy Type</th>
<th>Policy/Endorsement</th> <th>BAP Group</th>
<th>Vehicle Number</th>
<th>Policy No</th> <th>Policy No</th>
<th>Endorsement No</th> <th>Endorsement No</th>
<th>Insurer Name</th> <th>Insurer Name</th>
<th>Insurer Branch</th> <th>Insurer Branch</th>
<th>TPA</th> <th>TPA</th>
<th>Days Until Expiry</th> <th>Endorsement <br> Effective Date</th>
<th>Endorsement Effective Date</th> <th>Policy <br> Effective Date</th>
<th>Policy Effective Date</th> <th>Policy <br> Expiry Date</th>
<th>Policy Expiry Date</th> <th>Reference</th>
<th>Policy Type</th> <th>Remarks</th>
<th>BAP Group</th>
<th>Vehicle Number</th>
<th>Base Premium</th> <th>Base Premium</th>
<th>Terrorism/TP</th> <th>Terrorism/TP</th>
<th>Premium (without GST)</th> <th>Premium <br> (without GST)</th>
<th>GST @ 18%</th> <th>GST @ 18%</th>
<th>Total Premium</th> <th>Total Premium</th>
<th>Base Revenue %</th> <th>Base <br> Revenue %</th>
<th>TP / Terrorism Revenue %</th> <th>TP / Terrorism <br> Revenue %</th>
<th>Total IRDA Revenue INR</th> <th>Total IRDA <br> Revenue INR</th>
<th>GST on Revenue</th> <th>GST on Revenue</th>
<th>Total Amount Receivable</th> <th>Total Amount <br> Receivable</th>
<th>Rewards</th> <th>Rewards</th>
<th>Total Brokerage</th>
<th>Payment Ref</th>
<th>Invoice Number</th> <th>Invoice Number</th>
<th>Invoice Date</th> <th>Invoice Date</th>
<th>Invoice Amount</th> <th>Invoice Amount</th>
@ -90,32 +80,24 @@ table.dataTable tbody td {
<?php foreach($report_list as $index => $row){ ?> <?php foreach($report_list as $index => $row){ ?>
<tr> <tr>
<td><?= $index + 1 ?></td> <td><?= $index + 1 ?></td>
<td><?php echo $row['user_name']; ?></td>
<td><?php echo $row['policy_issue_month']; ?></td> <td><?php echo $row['policy_issue_month']; ?></td>
<td><?php echo $row['revenue_type']; ?></td> <td><?php echo $row['revenue_type']; ?></td>
<td><?php echo $row['policy_issue_date']; ?></td>
<td><?php echo $row['salse_person_name']; ?></td> <!-- Sales Generated By (Name) -->
<td><?php echo 'Chennai'; ?></td>
<td><?php echo $row['service_person_name']; ?></td>
<td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['client_address']; ?></td>
<td><?php echo $row['client_type']; ?></td> <td><?php echo $row['client_type']; ?></td>
<td></td> <!-- Payment From --> <td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['ref']; ?></td>
<td><?php echo $row['remarks']; ?></td>
<td><?php echo $row['action_type']; ?></td> <td><?php echo $row['action_type']; ?></td>
<td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['bap']; ?></td>
<td><?php echo $row['vehicle_no'] ?? 'N.A'; ?></td>
<td><?php echo $row['policy_no']; ?></td> <td><?php echo $row['policy_no']; ?></td>
<td><?php echo $row['endorsement_no']; ?></td> <td><?php echo $row['endorsement_no']; ?></td>
<td><?php echo $row['insurer_name']; ?> </td> <td><?php echo $row['insurer_name']; ?> </td>
<td><?php echo $row['insurer_branch_name']; ?></td> <td><?php echo $row['insurer_branch_name']; ?></td>
<td><?php echo $row['tpa_name']; ?></td> <td><?php echo $row['tpa_name']; ?></td>
<td><?php echo $row['days']; ?></td> <td><?php echo empty($row['endorse_eff_date']) ? '' : date('d/m/Y', strtotime($row['endorse_eff_date'])) ?></td>
<td><?php echo $row['endorse_eff_date']; ?></td> <td><?php echo empty($row['policy_start_date']) ? '' : date('d/m/Y', strtotime($row['policy_start_date'])); ?></td>
<td><?php echo date('d-m-Y', strtotime($row['policy_start_date'])); ?></td> <td><?php echo empty($row['policy_end_date']) ? '' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
<td><?php echo date('d-m-Y', strtotime($row['policy_end_date'])); ?></td> <td><?php echo $row['ref']; ?></td>
<td><?php echo $row['policy_type']; ?></td> <td><?php echo $row['remarks']; ?></td>
<td><?php echo $row['bap']; ?></td>
<td><?php echo $row['vehicle_no'] ?? 'N.A'; ?></td>
<td class="right-align-input"><?php echo $row['bp_amt']; ?></td> <td class="right-align-input"><?php echo $row['bp_amt']; ?></td>
<td class="right-align-input"><?php echo $row['tp_or_ter']; ?></td> <td class="right-align-input"><?php echo $row['tp_or_ter']; ?></td>
<td class="right-align-input"><?php echo $row['premium_wo_gst']; ?></td> <td class="right-align-input"><?php echo $row['premium_wo_gst']; ?></td>
@ -127,10 +109,8 @@ table.dataTable tbody td {
<td class="right-align-input"><?php echo $row['gst_on_revenue']; ?></td> <td class="right-align-input"><?php echo $row['gst_on_revenue']; ?></td>
<td class="right-align-input"><?php echo $row['total_amt_received']; ?></td> <td class="right-align-input"><?php echo $row['total_amt_received']; ?></td>
<td class="right-align-input"><?php echo $row['reward']; ?></td> <td class="right-align-input"><?php echo $row['reward']; ?></td>
<td></td>
<td></td>
<td><?php echo $row['invoice_no']; ?></td> <td><?php echo $row['invoice_no']; ?></td>
<td><?php echo $row['invoice_date']; ?></td> <td><?php echo empty($row['invoice_date']) ? '' : date('d/m/Y', strtotime($row['invoice_date'])); ?></td>
<td class="right-align-input"><?php echo $row['invoice_amount']; ?></td> <td class="right-align-input"><?php echo $row['invoice_amount']; ?></td>
<td class="right-align-input"><?php echo $row['realization_amount']; ?></td> <td class="right-align-input"><?php echo $row['realization_amount']; ?></td>
<td class="right-align-input"><?php echo $row['outstanding_amount']; ?></td> <td class="right-align-input"><?php echo $row['outstanding_amount']; ?></td>
@ -212,7 +192,8 @@ $(document).ready(function() {
searchPlaceholder: "Search..." searchPlaceholder: "Search..."
}, },
paging: true, // Enable pagination paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional) pageLength: 25, // Set default number of rows per page (optional)
ordering: false,
}); });
} else { } else {
console.error("Table not found."); console.error("Table not found.");

View File

@ -35,7 +35,7 @@ table.dataTable tbody td {
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger"></span></label> <label for="client_branch">Client<span class="text-danger"></span></label>
<select class="form-control" id="client_id" name="client_id" > <select class="form-control" id="client_id" name="client_id">
<option value="0">Select Client</option> <option value="0">Select Client</option>
<?php <?php
if (isset($clients) && count($clients)) { if (isset($clients) && count($clients)) {
@ -48,20 +48,21 @@ table.dataTable tbody td {
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label> <label for="addon_policy"> Insurer <span id="base_danger"
<select class="form-control" id="insurer_id" name="insurer_id" > class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id">
<option value="0" selected>Select Insurer</option> <option value="0" selected>Select Insurer</option>
<?php if(isset($insurer) && count($insurer)){ ?> <?php if(isset($insurer) && count($insurer)){ ?>
<?php foreach ($insurer as $value) { ?> <?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option> <option value="<?= $value['id']?>"><?= $value['name']?></option>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="email"> Policy Type <span class="text-danger"></span></label> <label for="email"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="policy_type_id" name="policy_type_id" > <select class="form-control" id="policy_type_id" name="policy_type_id">
<option value="0">Select Policy Type</option> <option value="0">Select Policy Type</option>
<?php <?php
if (isset($policy_types) && count($policy_types)) { if (isset($policy_types) && count($policy_types)) {
@ -93,7 +94,8 @@ table.dataTable tbody td {
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label>Date Type<span class="text-danger"></span></label> <label>Date Type<span class="text-danger"></span></label>
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()"> <select class="form-control" id="date_type" name="date_type"
onchange="hideDateField()">
<option value="0">Select Date Type</option> <option value="0">Select Date Type</option>
<?php <?php
if (isset($date_type) && count($date_type)) { if (isset($date_type) && count($date_type)) {
@ -107,7 +109,8 @@ table.dataTable tbody td {
<div class="form-group col-md-3" style="display: none;" id="date_div"> <div class="form-group col-md-3" style="display: none;" id="date_div">
<label>Date<span class="text-danger"></span></label> <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%"> <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>&nbsp; <i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i> <span></span> <i class="fa fa-caret-down"></i>
</div> </div>
@ -118,8 +121,11 @@ table.dataTable tbody td {
</div> </div>
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
<a href="<?= base_url("/policy_tranction/report/report-varience-list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a> <a href="<?= base_url("/policy_tranction/report/report-varience-list"); ?>"
<a href="<?= base_url("/policy_tranction/report/report-varience-list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a> class="btn btn-secondary" id="clear-filters">Clear</a>
<a href="<?= base_url("/policy_tranction/report/report-varience-list"); ?>"
class="btn btn-primary" id="get-emp-list"
onclick="fetchEmpolyeeList(event);">Submit</a>
</div> </div>
</div> </div>
</div> </div>
@ -135,7 +141,7 @@ table.dataTable tbody td {
<div class="card-body"> <div class="card-body">
<div class="row" style="padding-bottom: 10px;"> <div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Varience Report</h4> <h4 style="position: relative;">Variance Report</h4>
</div> </div>
</div> </div>
@ -150,34 +156,45 @@ table.dataTable tbody td {
<th>Policy No</th> <th>Policy No</th>
<th>Endorsement No</th> <th>Endorsement No</th>
<th>Expected Amount</th> <th>Expected Amount</th>
<th>Varience</th> <th>Realization Amount</th>
<th>Action</th> <th>Variance</th>
<!-- <th>Action</th> -->
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if (isset($varience_list)) { ?> <?php if (isset($varience_list)) { ?>
<?php foreach($varience_list as $index => $row){ ?> <?php foreach($varience_list as $index => $row){ ?>
<tr> <tr>
<td><?= $index + 1 ?></td> <td><?= $index + 1 ?></td>
<td><?php echo $row['client_name']; ?></td> <td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['insurer_name']; ?></td> <td><?php echo $row['insurer_name']; ?></td>
<td><?php echo $row['policy_type']; ?></td> <td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['policy_no']; ?></td> <td><?php echo $row['policy_no']; ?></td>
<td><?php echo $row['endorsement_no']; ?></td> <td><?php echo $row['endorsement_no']; ?></td>
<td><?php echo $row['exp_amt']; ?></td> <td class="right-align-input"><?php echo $row['exp_amt']; ?></td>
<td><?php echo $row['variance']; ?></td> <td class="right-align-input"><?php echo $row['realization_amount']; ?></td>
<td> <td class="right-align-input"><?php echo $row['variance']; ?></td>
<div class="btn-group dropdown"> <!-- <td>
<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="btn-group dropdown">
<div class="dropdown-menu dropdown-menu-right"> <a href="javascript: void(0);"
<a href="<?= base_url("/policy_tranction/inception/list"); ?>" id="get-policy-list" class="dropdown-item btnEdit" onclick="sendPolicyTransactionID(event, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')"> class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
</a> <div class="dropdown-menu dropdown-menu-right">
</div> <a href="
</div> <?php
</td> if ($row['action_type'] == 'I') {
</tr> echo base_url("/policy_tranction/inception/list") . '?pt_id=' . $row['id'];
<?php } ?> } else {
echo base_url("/policy_tranction/endorsement/list") . '?pt_id=' . $row['id'];
}
?>" id="get-policy-list" class="dropdown-item btnEdit">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
</div>
</div>
</td> -->
</tr>
<?php } ?>
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
@ -190,7 +207,6 @@ table.dataTable tbody td {
</div> </div>
<script> <script>
// Datatable document ready // Datatable document ready
$(document).ready(function() { $(document).ready(function() {
@ -201,8 +217,7 @@ $(document).ready(function() {
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [ buttons: [{
{
extend: 'csv', extend: 'csv',
text: 'CSV', text: 'CSV',
title: 'Policy-Tranction-BDS-List', title: 'Policy-Tranction-BDS-List',
@ -217,7 +232,8 @@ $(document).ready(function() {
// Find cells in column AB (28th column in Excel) // Find cells in column AB (28th column in Excel)
$('row c[r^="AB"]', sheet).each(function() { $('row c[r^="AB"]', sheet).each(function() {
var value = parseFloat($('v', this).text()); // Get the value inside the cell var value = parseFloat($('v', this)
.text()); // Get the value inside the cell
if (!isNaN(value)) { if (!isNaN(value)) {
total += value; total += value;
} }
@ -225,10 +241,13 @@ $(document).ready(function() {
// Get the last row index and append the total row // Get the last row index and append the total row
var lastRow = $('row:last', sheet); var lastRow = $('row:last', sheet);
var rowIndex = parseInt(lastRow.attr('r')) + 2; // Find the next row index var rowIndex = parseInt(lastRow.attr('r')) +
2; // Find the next row index
var totalRow = '<row r="' + rowIndex + '">' + var totalRow = '<row r="' + rowIndex + '">' +
'<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' + // Insert "Total" in AA '<c t="inlineStr" r="AA' + rowIndex +
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' + // Insert sum in AB '"><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>'; '</row>';
// Append the new total row to the sheet // Append the new total row to the sheet
@ -256,8 +275,7 @@ $(document).ready(function() {
$('#policy_type_id').select2(); $('#policy_type_id').select2();
}) })
function fetchEmpolyeeList(event) function fetchEmpolyeeList(event) {
{
event.preventDefault(); // Prevent default action event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val(); var start_date = $('#startDate').val();
@ -286,13 +304,11 @@ function fetchEmpolyeeList(event)
window.location.href = apiURL; window.location.href = apiURL;
} }
function objectToQueryString(obj) function objectToQueryString(obj) {
{
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&'); return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
} }
function getURLParams() function getURLParams() {
{
const url = new URL(window.location.href); const url = new URL(window.location.href);
const params = new URLSearchParams(url.search); const params = new URLSearchParams(url.search);
@ -319,7 +335,7 @@ function getURLParams()
console.log('End Date:', endDate); console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) { if (startDate != 0 && endDate != 0) {
setTimeout(function(){ setTimeout(function() {
$('#start_date').val(startDate) $('#start_date').val(startDate)
$('#end_date').val(endDate) $('#end_date').val(endDate)
$('#client_id').val(client_id).change() $('#client_id').val(client_id).change()
@ -327,7 +343,7 @@ function getURLParams()
$('#policy_type_id').val(policy_type_id).change() $('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type) $('#date_type').val(date_type)
$('#issuer').val(issuer) $('#issuer').val(issuer)
},1000) }, 1000)
} }
@ -359,12 +375,14 @@ $(function() {
startDate: start, startDate: start,
endDate: end, endDate: end,
ranges: { ranges: {
'Today': [moment(), moment()], 'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')], 'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
.endOf('month')
]
} }
}, cb); }, cb);
@ -387,24 +405,22 @@ $(function() {
}); });
function hideDateField(input = null) function hideDateField(input = null) {
{
let val = $('#date_type').val(); let val = $('#date_type').val();
if(input){ if (input) {
val = input; val = input;
} }
if(val != 0){ if (val != 0) {
$('#date_div').show() $('#date_div').show()
}else{ } else {
$('#date_div').hide() $('#date_div').hide()
} }
} }
function sendPolicyTransactionID(event, pt_id) function sendPolicyTransactionID(event, pt_id) {
{
event.preventDefault(); // Prevent default action event.preventDefault(); // Prevent default action
console.log(pt_id); console.log(pt_id);
@ -418,5 +434,4 @@ function sendPolicyTransactionID(event, pt_id)
console.log(apiURL); console.log(apiURL);
window.location.href = apiURL; window.location.href = apiURL;
} }
</script> </script>

BIN
writable/tmp/20241001102246 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB