FEAT_BDS_DASH_VARIENCE_LIST_BUSINESS_AND_FINANCE_LIST_AND_OTHER_DEVELOPMENT_AND_LIVE_BUG_FIXING : RV

This commit is contained in:
VENKATESHWARAN 2024-09-27 17:10:11 +05:30
parent c7ac84007d
commit 83573ca0ac
27 changed files with 3620 additions and 526 deletions

View File

@ -326,6 +326,9 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
$routes->group("report", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "PolicyTransactionController::reportBDS");
$routes->get("report-varience-list", "PolicyTransactionController::reportVarience");
$routes->get("report-business-list", "PolicyTransactionController::reportBusinessList");
$routes->get("report-finance-list", "PolicyTransactionController::reportFinanceList");
});
$routes->group("statement", ["filter" => "authMVC"], function ($routes) {

View File

@ -39,6 +39,7 @@ use App\Models\PolicyTransactionStatusModel;
use App\Models\VehicleModel;
use App\Controllers\EmpDataServiceController;
use App\Controllers\GoogleDriveController;
class ClientController extends AdminController
@ -320,10 +321,10 @@ class ClientController extends AdminController
$data['subTypeOptions'] = $subTypeOptions;
$headerData['page_name'] = 'Client Deposit';
$data['insurerName']= $this->insurerModel->getInsurerName($insurerId);
$loggedInUserID = get_session_userid();
// $data['clientData']= $this->clientPolicyModel->getinsurerswithinsurenceid($insurerId);
$clientId = $this->request->getGet('client_id');
$data['insurerName']= $this->insurerModel->getInsurerName($insurerId, $clientId);
$data['depositdata']= $this->clientPolicyModel->getdepositData($clientId,$insurerId);
$data['clientData'] = $this->clientPolicyModel->getClientById($clientId);
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId);
@ -331,7 +332,7 @@ class ClientController extends AdminController
// dd($data['depositdata']);
// print_r($data['depositdata'] );die;
// Load the view for the new list page
// Load the view for the new list page;
echo view('layout/header', $headerData);
echo view('view_deposit',$data);
echo view('layout/footer');
@ -481,6 +482,8 @@ class ClientController extends AdminController
}
}
public function createClientKYCInfo()
{
$this->myLogger->logme('error','create Client kyc function called');
@ -490,7 +493,12 @@ class ClientController extends AdminController
$uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
$File = file_Upload($this->request->getFile('file_name'), $uploadFilePath);
if(!empty($File)){
$data['file_name'] = $File;
$uploadFilePath = $uploadFilePath . '/' .$File;
$GoogleDriveController = new GoogleDriveController();
$GoogleDriveController->uploadFiletoGdrive(client_id: $data['client_id'], doc_type: 'KYC', file_path: $uploadFilePath, file_name: $data['file_name']);
}
$data['created_by'] = get_session_userid();

View File

@ -13,6 +13,7 @@ use CodeIgniter\API\ResponseTrait;
use App\Models\MessageModel;
use App\Models\UserMessageModel;
use App\Models\ClientModel;
use App\Models\PolicyTransactionModel;
use App\Models\JobModel;
use App\Models\ClientPolicyModel;
@ -30,6 +31,7 @@ class DashboardController extends AdminController
protected $clientPolicyModel;
protected $notificationModel;
protected $employeePolicyModel;
protected $policyTransactionModel;
protected $myLogger;
@ -42,6 +44,7 @@ class DashboardController extends AdminController
$this->notificationModel = new NotificationModel();
$this->employeePolicyModel = new EmployeePolicyModel();
$this->clientModel = new ClientModel();
$this->policyTransactionModel = new PolicyTransactionModel();
$this->myLogger = \Config\Services::mylogger();
@ -65,8 +68,9 @@ class DashboardController extends AdminController
$pendingActionsController = new PendingActionsController;
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
$businessTeamData = $this->policyTransactionModel->getBusinessReportList();
$financeTeamData = $this->policyTransactionModel->getFinanceReportList();
$groupedData = [];
foreach ($results as $row) {
@ -157,6 +161,8 @@ class DashboardController extends AdminController
$session->set('enrollment_data', json_encode($data));
// echo "<pre>";
$data['pendingActionsData'] = $pendingActionsData;
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
$data['financeTeamCount'] = count($financeTeamData) ?? 0;
// print_r($data);die;

View File

@ -1260,6 +1260,8 @@ class MasterController extends AdminController
$insert = $this->CDMasterModel->where('id', $id)->set($data)->update();
$data = $this->CDMasterModel->where('id', $id)->first();
$cd_transaction_updated_data = [
'balance' => $data['opening_bal'],
'amount' => $data['opening_bal']

View File

@ -3,6 +3,8 @@
namespace App\Controllers;
use App\Controllers\BaseController;
use App\Controllers\GoogleDriveController;
use App\Helpers\DepositHelper;
use CodeIgniter\API\ResponseTrait;
@ -93,18 +95,10 @@ class PolicyTransactionController extends BaseController
// Policy Transaction Inception
public function viewInception()
{
{
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
$data['issuing_type'] = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
// $data['policy_status'] = [
// 'pending' => 'Pending',
// 'exported_to_insurer' => 'Exported to Insurer',
// 'imported_from_insurer' => 'Imported from Insurer',
// 'exported_to_tpa' => 'Exported to TPA',
// 'imported_from_tpa' => 'Imported from TPA',
// 'completed' => 'Completed'
// ];
$data['policy_status'] = [
'under_process' => 'Under Process',
'client_pending' => 'Client Pending',
@ -136,53 +130,57 @@ class PolicyTransactionController extends BaseController
'commercial' => 'Commercial',
'private' => 'Private',
];
$data['date_type'] = [
'policy_issue_date' => 'Policy Issue Date',
'policy_start_date' => 'Policy Start Date',
'policy_end_date' => 'Policy End Date',
];
//filter datas
$start_date = $this->request->getGet('start_date');
$end_date = $this->request->getGet('end_date');
$client_id = $this->request->getGet('client_id');
$insurer_id = $this->request->getGet('insurer_id');
$policy_type_id = $this->request->getGet('policy_type_id');
$date_type = $this->request->getGet('date_type');
$issuer = $this->request->getGet('issuer');
$status = $this->request->getGet('status');
$data['inception_data_list'] = $this->policyTransactionModel
->select('
policy_transaction.*,
clients.short_name AS client_short_name,
clients.client_code,
clients.client_type,
clients.client_name,
client_branch.branch_name AS client_branch_name,
insurers.name AS insurer_name,
insurers.short_name AS insurer_short_name,
policy_type.policy_type,
pt_co_share_details.agreed_amt AS amount,
pt_co_share_details.bp_amt AS bp,
pt_co_share_details.tp_amt AS tp
')
->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('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1)
->where('policy_transaction.action_type', 'inception')
->orderBy('policy_transaction.id', 'desc')
->findAll();
$start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
$end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
$client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
$insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
$policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
$date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
$status = (!isset($issuer) || $status === '' || $status === null) ? 0 : $status;
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
$data['client'] = $this->clientModel->where('is_active', 1)->findAll();
$data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
$data['entity'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
$data['insurer_branch'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
$data['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
$data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
$data['salse_team'] = $this->userModel
->select('user_profiles.*')
->join('user_teams', 'user_profiles.id = user_teams.user_id')
->where('user_teams.team_id', 5)
->where('user_teams.is_active', 1)
->where('user_profiles.is_active', 1)
->findAll();
->select('user_profiles.*')
->join('user_teams', 'user_profiles.id = user_teams.user_id')
->where('user_teams.team_id', 5)
->where('user_teams.is_active', 1)
->where('user_profiles.is_active', 1)
->findAll();
$data['ACM'] = $this->userModel
->where('user_profiles.role', 3)
->where('user_profiles.is_active', 1)
->findAll();
->where('user_profiles.role', 3)
->where('user_profiles.is_active', 1)
->findAll();
$this->loadLayout('policy_transaction_inception_list', $data);
}
@ -243,6 +241,9 @@ class PolicyTransactionController extends BaseController
} elseif ($data['same_as_proposer']) {
$data['same_as_proposer'] = 1;
}
$month = '01-'.$data['month'];
$data['month'] = date('Y-m-d', strtotime($month));
// Determine $is_addon value
$data['is_addon'] = in_array($data['policy_type_id'], [1, 2, 6, 7]) ? 1 :
@ -299,6 +300,10 @@ class PolicyTransactionController extends BaseController
if (isset($data['follow_insurer_id']) && !empty($data['follow_insurer_id'][0])) {
$this->insertOrUpdateCoShareDetails($data, $id);
if ($data['ct_type'] == 1) {
$this->policyTransactionModel->update($id, ['client_policy_id' => $data['client_policy_id']]);
}
if (empty($data['client_policy_id']) || $data['client_policy_id'] == 0) {
@ -322,6 +327,10 @@ class PolicyTransactionController extends BaseController
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll();
}
$client_data = $this->clientModel->where('id', $data['client_id'])->first();
$data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll();
$data['entity_type_id'] = $client_data['entity_type_id'];
return $this->respondSuccess($id, "Policy transaction updated successfully", $data);
}
@ -588,13 +597,38 @@ class PolicyTransactionController extends BaseController
->where('policy_transaction.id', $id)
->first();
$data['policy_issue_date'] = !empty($data['policy_issue_date']) ? date('d-m-Y', strtotime($data['policy_issue_date'])) : null;
$data['policy_start_date'] = !empty($data['policy_start_date']) ? date('d-m-Y', strtotime($data['policy_start_date'])) : null;
$data['policy_end_date'] = !empty($data['policy_end_date']) ? date('d-m-Y', strtotime($data['policy_end_date'])) : null;
$data['renewal_date'] = !empty($data['renewal_date']) ? date('d-m-Y', strtotime($data['renewal_date'])) : null;
$data['rollover_date'] = !empty($data['rollover_date']) ? date('d-m-Y', strtotime($data['rollover_date'])) : null;
$data['created_at'] = !empty($data['created_at']) ? date('d-m-Y h:i:s A', strtotime($data['created_at'])) : null;
$data['updated_at'] = !empty($data['updated_at']) ? date('d-m-Y h:i:s A', strtotime($data['updated_at'])) : 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;
$data['created_at'] = (isset($data['created_at']) && $data['created_at'] !== null && $data['created_at'] !== '')
? date('d-m-Y h:i:s A', strtotime($data['created_at']))
: null;
$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']))
: null;
$data['month'] = (isset($data['month']) && $data['month'] !== null && $data['month'] !== '')
? date('M-Y', strtotime($data['month']))
: null;
// print_r($data); die;
$data['renewal_policy'] = $this->clientPolicyModel
@ -614,7 +648,11 @@ class PolicyTransactionController extends BaseController
->where('client_policy.is_active', 1)
->findAll();
$data['pt_files'] = $this->PTFileModel->where('pt_id', $id)->where('is_active', 1)->findAll();
$data['pt_files'] = $this->PTFileModel
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
->where('pt_files.pt_id', $id)
->where('pt_files.is_active', 1)
->findAll();
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll();
$data['emp_data'] = $this->employeeModel
->select('employees.*, employee_polices.id as emp_policy_id')
@ -644,6 +682,7 @@ class PolicyTransactionController extends BaseController
{
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
$data['policy_status'] = [
'under_process' => 'Under Process',
'client_pending' => 'Client Pending',
@ -678,32 +717,38 @@ class PolicyTransactionController extends BaseController
'policy_cancellation' => 'Policy Cancellation',
];
$data['endorsement_data_list'] = $this->policyTransactionModel
->select('
policy_transaction.*,
clients.short_name as client_short_name,
clients.client_code,
client_branch.branch_name as client_branch_name,
insurers.name AS insurer_name,
insurers.short_name AS insurer_short_name,
policy_type.policy_type
')
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id','left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1)
->where('policy_transaction.action_type !=', 'inception')
->orderBy('policy_transaction.id', 'desc')
->findAll();
$data['date_type'] = [
'policy_issue_date' => 'Policy Issue Date',
'policy_start_date' => 'Policy Start Date',
'policy_end_date' => 'Policy End Date',
];
//filter datas
$start_date = $this->request->getGet('start_date');
$end_date = $this->request->getGet('end_date');
$client_id = $this->request->getGet('client_id');
$insurer_id = $this->request->getGet('insurer_id');
$policy_type_id = $this->request->getGet('policy_type_id');
$date_type = $this->request->getGet('date_type');
$issuer = $this->request->getGet('issuer');
$status = $this->request->getGet('status');
$start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
$end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
$client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
$insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
$policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
$date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
$status = (!isset($issuer) || $status === '' || $status === null) ? 0 : $status;
$data['endorsement_data_list'] = $this->policyTransactionModel->getEndorsementTranctionListData($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
$data['client'] = $this->clientModel->where('is_active', 1)->findAll();
$data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
// $data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
// $data['tpa'] = $this->tpaModel->where('is_active', 1)->findAll();
$data['insurer_branch'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
$data['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
@ -895,20 +940,63 @@ class PolicyTransactionController extends BaseController
//file upload function
public function uploadFile()
{
{
$GoogleDriveController = new GoogleDriveController();
$files = $this->request->getFiles();
$doc_name = $this->request->getPost('doc_name[]');
$pt_id = $this->request->getPost('pt_id');
$uploadData = uploadFilesToGoogleDrive($files['file'], $doc_name, $pt_id);
$insert = false;
if(!isset($uploadData['status'])){
$this->PTFileModel->insertBatch($uploadData);
$insert = true;
$client_policy_id = $this->request->getPost('client_policy_id');
$data = $this->request->getPost();
$uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
$uploadData = [];
foreach ($data['doc_name'] as $key => $docName) {
// Get the corresponding file for this document name
$file = $files['file'][$key];
if (!empty($docName) && $file->isValid() && !$file->hasMoved()) {
// Upload the file
$uploadedFileName = file_Upload($file, $uploadFilePath);
if ($uploadedFileName) {
// Prepare data for each document upload
$docData = [
'pt_id' => $pt_id,
'doc_name' => $docName,
'file_name' => $uploadedFileName,
'created_by' => get_session_userid(),
];
$uploadFilePath = $uploadFilePath . '/' . $uploadedFileName;
$GoogleDriveController->uploadFiletoGdrive(client_policy_id: $client_policy_id, doc_type: 'POLICY', file_path: $uploadFilePath, file_name: $uploadedFileName);
// Insert into database
$insert = $this->PTFileModel->insert($docData);
if ($insert) {
$uploadData[] = $docData;
}
}
}
}
if ($insert) {
$data['pt_files'] = $this->PTFileModel->where('pt_id', $pt_id)->where('is_active', 1)->findAll();
// print_r($uploadData); die;
// $uploadData = uploadFilesToGoogleDrive($files['file'], $doc_name, $pt_id);
if (!empty($uploadData)) {
$data['pt_files'] = $this->PTFileModel
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
->where('pt_files.pt_id', $pt_id)
->where('pt_files.is_active', 1)
->findAll();
return $this->respond(['status' => true, 'message' => 'File uploaded successfully in G-Drive', 'data' => $data]);
} else {
return $this->respond(['status' => false, 'message' => 'Failed to upload file in G-Drive']);
@ -1031,7 +1119,6 @@ class PolicyTransactionController extends BaseController
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
//filter datas
$start_date = $this->request->getGet('start_date');
$end_date = $this->request->getGet('end_date');
@ -1058,6 +1145,126 @@ class PolicyTransactionController extends BaseController
$this->loadLayout('report_bds_filter', $data);
}
public function reportVarience()
{
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
$data['date_type'] = [
'policy_issue_date' => 'Policy Issue Date',
'policy_start_date' => 'Policy Start Date',
'policy_end_date' => 'Policy End Date',
'data_received_date' => 'Data Received Date',
'closure_date' => 'Closure Date',
];
//filter datas
$start_date = $this->request->getGet('start_date');
$end_date = $this->request->getGet('end_date');
$client_id = $this->request->getGet('client_id');
$insurer_id = $this->request->getGet('insurer_id');
$policy_type_id = $this->request->getGet('policy_type_id');
$date_type = $this->request->getGet('date_type');
$issuer = $this->request->getGet('issuer');
$start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
$end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
$client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
$insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
$policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
$date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
$data['varience_list'] = $this->policyTransactionModel->getVarienceReportLIst($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer);
$this->loadLayout('variance_report_list', $data);
}
public function reportBusinessList()
{
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
$data['date_type'] = [
'policy_issue_date' => 'Policy Issue Date',
'policy_start_date' => 'Policy Start Date',
'policy_end_date' => 'Policy End Date',
'data_received_date' => 'Data Received Date',
'closure_date' => 'Closure Date',
];
//filter datas
$start_date = $this->request->getGet('start_date');
$end_date = $this->request->getGet('end_date');
$client_id = $this->request->getGet('client_id');
$insurer_id = $this->request->getGet('insurer_id');
$policy_type_id = $this->request->getGet('policy_type_id');
$date_type = $this->request->getGet('date_type');
$issuer = $this->request->getGet('issuer');
$start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
$end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
$client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
$insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
$policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
$date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
$data['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);
}
public function reportFinanceList()
{
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
$data['date_type'] = [
'policy_issue_date' => 'Policy Issue Date',
'policy_start_date' => 'Policy Start Date',
'policy_end_date' => 'Policy End Date',
'data_received_date' => 'Data Received Date',
'closure_date' => 'Closure Date',
];
//filter datas
$start_date = $this->request->getGet('start_date');
$end_date = $this->request->getGet('end_date');
$client_id = $this->request->getGet('client_id');
$insurer_id = $this->request->getGet('insurer_id');
$policy_type_id = $this->request->getGet('policy_type_id');
$date_type = $this->request->getGet('date_type');
$issuer = $this->request->getGet('issuer');
$start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
$end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
$client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
$insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
$policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
$date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
$data['finance_list'] = $this->policyTransactionModel->getFinanceReportList($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer);
$this->loadLayout('finance_team_list', $data);
}
//---------------------------------------------------------------------------------------------------
//insurer statement list page
public function statementList()
{
@ -1540,7 +1747,6 @@ class PolicyTransactionController extends BaseController
return $this->respond(['dataStatus' => true, 'code' => 200,'data' => $file['reason']], 200);
}
public function dmsSearch()
{
// echo 'scbsc';die();

View File

@ -50,13 +50,13 @@ class DepositHelper
'amount' => $data['amount'],
'sub_type' => $data['sub_type_id'],
'client_id' => $data['client_id'],
'client_policy_id' => $data['client_policy_id'],
'client_policy_id' => $data['client_policy_id'] ?? 0,
'cd_ac_no' => $data['cd_ac_no'],
'endorsement_no' => $data['endorsement_no'],
'insurer_id' => $data['insurer_id'],
'unit' => $data['unit'] ?? null,
'description' => $data['description'],
'event_name' => $data['event_name'],
'description' => $data['description'] ?? null,
'event_name' => $data['event_name'] ?? null,
'transaction_type' => $data['transaction_type'],
'is_active' => 1,
'created_by' => $loggedInUserID,
@ -99,17 +99,17 @@ class DepositHelper
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
$getLastBalanceParams = [$cd_ac_no];
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? null;
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? 0;
if(empty($lastBalance) && $lastBalance == null){
// if(empty($lastBalance) && $lastBalance == null){
$cd_model = new ClientDepositModel();
// $cd_model = new ClientDepositModel();
$getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? AND cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
$getLastBalanceParams = [$clientId, $insurerId, $cd_ac_no];
// $getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? AND cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
// $getLastBalanceParams = [$clientId, $insurerId, $cd_ac_no];
$lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
}
// $lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
// }
return $lastBalance;
}

View File

@ -139,7 +139,7 @@ class ClientPolicyModel extends Model
->select('clients.client_name as client_name')
->join('clients','clients.id=client_policy.client_id')
->join('insurers', 'insurers.id = client_policy.insurer_id')
->join('cd_master', 'cd_master.insurer_id = client_policy.insurer_id')
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
->where('client_policy.client_id', $id)
->groupBy('client_policy.insurer_id')
->groupBy('client_policy.client_id', $id) // Group by insurer_id

View File

@ -37,13 +37,16 @@ class InsurerModel extends Model
->getResult();
}
public function getInsurerName($insurerId)
public function getInsurerName($insurerId, $client_id)
{
// Fetch the insurer name based on the insurer ID
$query = $this->select('insurers.id,insurers.name, cd_master.cd_ac_no')
->join('cd_master', 'cd_master.insurer_id = insurers.id')
->where('insurers.id', $insurerId)
->get();
$query = $this->db->table('client_policy')
->select('insurers.id, insurers.name, cd_master.cd_ac_no')
->join('insurers', 'insurers.id = client_policy.insurer_id')
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
->where('client_policy.insurer_id', $insurerId)
->where('client_policy.client_id', $client_id)
->get();
if ($query->resultID->num_rows > 0) {
$result = $query->getRow();

View File

@ -75,6 +75,7 @@ class PolicyTransactionModel extends Model
'ct_type',
'ct_tran_id',
'remarks',
'month',
];
@ -119,7 +120,11 @@ class PolicyTransactionModel extends Model
->select("
policy_transaction.*,
DATE_FORMAT(policy_transaction.policy_issue_date, '%d %b %Y') AS policy_issue_date,
DATE_FORMAT(policy_transaction.policy_issue_date, '%b') AS policy_issue_month,
DATE_FORMAT(
IF(policy_transaction.month IS NULL,
policy_transaction.policy_issue_date,
policy_transaction.month),
'%b') AS policy_issue_month,
CASE
WHEN clients.client_type = 1 THEN 'Group'
WHEN clients.client_type = 2 THEN 'Retail'
@ -147,25 +152,104 @@ class PolicyTransactionModel extends Model
vehicle.vehicle_no,
tpa.name as tpa_name,
pt_co_share_details.remark as remarks,
pt_co_share_details.reward,
pt_co_share_details.bp_amt,
sales_user.first_name as salse_person_name,
service_user.first_name as service_person_name,
ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) AS premium_wo_gst,
ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) * 18 / 100), 2) AS gst_amount,
ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) + ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) * 18 / 100), 2)), 2) AS total_premium,
ROUND((pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) AS tp_or_ter,
DATEDIFF(policy_transaction.policy_end_date, CURDATE()) AS days,
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per) AS agreed_tp_or_ter_per,
pt_co_share_details.agreed_bp_per,
ROUND((pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per + (pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) * (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)), 2) AS total_irda,
ROUND((ROUND((pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per + (pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) * (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)), 2) * 18 / 100), 2) AS gst_on_revenue,
ROUND(
(ROUND((pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per + (pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) * (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)), 2) +
ROUND((ROUND((pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per + (pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) * (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)), 2) * 18 / 100), 2)),
2) AS total_amt_received
(pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per +
(pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) *
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)) / 100,
2) AS total_irda,
ROUND(
(ROUND(
(pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per +
(pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) *
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)) / 100,
2) * 18 / 100),
2) AS gst_on_revenue,
ROUND(
(ROUND(
(pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per +
(pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) *
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)) / 100,
2) +
ROUND(
(ROUND(
(pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per +
(pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) *
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)) / 100,
2) * 18 / 100),
2)),
2) AS total_amt_received,
insurer_statements.invoice_date,
insurer_statements.invoice_no,
insurer_statements.invoice_amount,
(
SELECT
(SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds)) AS realization_amount
FROM
inv_payment_details
WHERE
inv_payment_details.statement_id = insurer_statements.id
AND inv_payment_details.is_active = 1
) AS realization_amount,
ROUND(
insurer_statements.invoice_amount -
(
SELECT
(SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds))
FROM
inv_payment_details
WHERE
inv_payment_details.statement_id = insurer_statements.id
AND inv_payment_details.is_active = 1
),
2) AS outstanding_amount,
(
SELECT
GROUP_CONCAT(inv_payment_details.utr_no SEPARATOR ', ') AS utr_numbers
FROM
inv_payment_details
WHERE
inv_payment_details.statement_id = insurer_statements.id
AND inv_payment_details.is_active = 1
) AS utr_numbers,
(
SELECT
GROUP_CONCAT(inv_payment_details.received_date SEPARATOR ', ') AS payment_dates
FROM
inv_payment_details
WHERE
inv_payment_details.statement_id = insurer_statements.id
AND inv_payment_details.is_active = 1
) AS payment_dates
")
->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')
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
@ -188,6 +272,13 @@ class PolicyTransactionModel extends Model
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
->where('policy_transaction.'.$date_type.'<=', $endDate);
}else{
// $fromDate = date('Y-m-d', strtotime('-30 days'));
// $toDate = date('Y-m-d');
// $builder->where('policy_transaction.created_at >=', $fromDate)
// ->where('policy_transaction.created_at <=', $toDate);
}
if ($client_id != 0) {
@ -205,8 +296,362 @@ class PolicyTransactionModel extends Model
if ($issuer != 0) {
$builder->where('policy_transaction.issuer', $issuer);
}
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
$fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d');
$builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate);
}
return $builder->get()->getResultArray();
}
public function getInceptionTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
{
// dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
$builder = $this->db->table('policy_transaction')
->select('
policy_transaction.*,
clients.short_name AS client_short_name,
clients.client_code,
clients.client_type,
clients.client_name,
client_branch.branch_name AS client_branch_name,
insurers.name AS insurer_name,
insurers.short_name AS insurer_short_name,
policy_type.policy_type,
pt_co_share_details.agreed_amt AS amount,
pt_co_share_details.bp_amt AS bp,
pt_co_share_details.tp_amt AS tp
')
->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('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1)
->where('policy_transaction.action_type', 'inception');
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
->where('policy_transaction.'.$date_type.'<=', $endDate);
}else{
// $fromDate = date('Y-m-d', strtotime('-30 days'));
// $toDate = date('Y-m-d');
// $builder->where('policy_transaction.created_at >=', $fromDate)
// ->where('policy_transaction.created_at <=', $toDate);
}
if ($client_id != 0) {
$builder->where('policy_transaction.client_id', $client_id);
}
if ($insurer_id != 0) {
$builder->where('policy_transaction.insurer_id', $insurer_id);
}
if ($policy_type_id != 0) {
$builder->where('client_policy.policy_type_id', $policy_type_id);
}
if ($issuer != 0) {
$builder->where('policy_transaction.issuer', $issuer);
}
if ($status != 0) {
$builder->where('policy_transaction.status', $status);
}
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
$fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d');
$builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate);
}
$builder->orderBy('policy_transaction.id', 'desc');
return $builder->get()->getResultArray();
}
public function getEndorsementTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
{
// dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
$builder = $this->db->table('policy_transaction')
->select('
policy_transaction.*,
clients.short_name as client_short_name,
clients.client_code,
client_branch.branch_name as client_branch_name,
insurers.name AS insurer_name,
insurers.short_name AS insurer_short_name,
policy_type.policy_type
')
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id','left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1)
->where('policy_transaction.action_type !=', 'inception');
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
->where('policy_transaction.'.$date_type.'<=', $endDate);
}else{
// $fromDate = date('Y-m-d', strtotime('-30 days'));
// $toDate = date('Y-m-d');
// $builder->where('policy_transaction.created_at >=', $fromDate)
// ->where('policy_transaction.created_at <=', $toDate);
}
if ($client_id != 0) {
$builder->where('policy_transaction.client_id', $client_id);
}
if ($insurer_id != 0) {
$builder->where('policy_transaction.insurer_id', $insurer_id);
}
if ($policy_type_id != 0) {
$builder->where('client_policy.policy_type_id', $policy_type_id);
}
if ($issuer != 0) {
$builder->where('policy_transaction.issuer', $issuer);
}
if ($status != 0) {
$builder->where('policy_transaction.status', $status);
}
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
$fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d');
$builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate);
}
$builder->orderBy('policy_transaction.id', 'desc');
return $builder->get()->getResultArray();
}
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')
->select('
policy_transaction.id,
clients.client_name,
insurers.name AS insurer_name,
policy_type.policy_type,
policy_transaction.policy_no,
policy_transaction.endorsement_no,
pt_co_share_details.exp_amt,
pt_co_share_details.variance
')
->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('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1)
->groupStart() // Group the conditions for variance
->where('pt_co_share_details.variance IS NULL')
->orWhere('pt_co_share_details.variance', 0)
->groupEnd();
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
->where('policy_transaction.' . $date_type . '<=', $endDate);
} else {
$fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d');
$builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate);
}
if ($client_id != 0) {
$builder->where('policy_transaction.client_id', $client_id);
}
if ($insurer_id != 0) {
$builder->where('policy_transaction.insurer_id', $insurer_id);
}
if ($policy_type_id != 0) {
$builder->where('client_policy.policy_type_id', $policy_type_id);
}
if ($issuer != 0) {
$builder->where('policy_transaction.issuer', $issuer);
}
if ($status != 0) {
$builder->where('policy_transaction.status', $status);
}
$builder->orderBy('policy_transaction.id', 'desc');
return $builder->get()->getResultArray();
}
public function getBusinessReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
{
$builder = $this->db->table('policy_transaction')
->select([
'policy_transaction.id AS policy_trns_id',
'clients.client_name',
'insurers.name AS insurer_name',
'policy_type.policy_type',
'policy_transaction.policy_no',
'policy_transaction.endorsement_no',
'pt_co_share_details.bp_amt',
'pt_co_share_details.tp_amt',
'pt_co_share_details.tep_amt'
])
->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('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1)
->where('policy_transaction.status', 'completed')
->where('pt_co_share_details.bp_amt IS NULL OR pt_co_share_details.bp_amt = 0');
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
->where('policy_transaction.' . $date_type . '<=', $endDate);
} else {
$fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d');
$builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate);
}
if ($client_id != 0) {
$builder->where('policy_transaction.client_id', $client_id);
}
if ($insurer_id != 0) {
$builder->where('policy_transaction.insurer_id', $insurer_id);
}
if ($policy_type_id != 0) {
$builder->where('client_policy.policy_type_id', $policy_type_id);
}
if ($issuer != 0) {
$builder->where('policy_transaction.issuer', $issuer);
}
if ($status != 0) {
$builder->where('policy_transaction.status', $status);
}
$builder->orderBy('policy_transaction.id', 'desc');
return $builder->get()->getResultArray();
}
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')
->select('
policy_transaction.id,
clients.client_name,
insurers.name AS insurer_name,
policy_type.policy_type,
policy_transaction.policy_no,
policy_transaction.endorsement_no,
pt_co_share_details.exp_amt,
pt_co_share_details.variance
')
->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('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1)
->where('policy_transaction.status', 'completed')
->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');
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
->where('policy_transaction.' . $date_type . '<=', $endDate);
} else {
$fromDate = date('Y-m-d', strtotime('-30 days'));
$toDate = date('Y-m-d');
$builder->where('policy_transaction.created_at >=', $fromDate)
->where('policy_transaction.created_at <=', $toDate);
}
if ($client_id != 0) {
$builder->where('policy_transaction.client_id', $client_id);
}
if ($insurer_id != 0) {
$builder->where('policy_transaction.insurer_id', $insurer_id);
}
if ($policy_type_id != 0) {
$builder->where('client_policy.policy_type_id', $policy_type_id);
}
if ($issuer != 0) {
$builder->where('policy_transaction.issuer', $issuer);
}
if ($status != 0) {
$builder->where('policy_transaction.status', $status);
}
$builder->orderBy('policy_transaction.id', 'desc');
return $builder->get()->getResultArray();
}
}

View File

@ -62,10 +62,17 @@ body {
<span class="d-none d-sm-inline-block">Enrolment</span>
</a>
</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">
<span class="mr-1"><i class="fa fa-file"></i></span>
<span class="d-none d-sm-inline-block">BDS</span>
</a>
</li>
</ul>
<div class="tab-content">
<?php include('enrollment_dash.php'); ?>
<?php include('endorsement_dash.php'); ?>
<?php include('bds_dash.php'); ?>
</div>
</div>
<!-- </div> -->

189
app/Views/bds_dash.php Normal file
View File

@ -0,0 +1,189 @@
<style>
body{
margin-top:20px;
background:#FAFAFA;
}
.order-card {
color: #fff;
}
.bg-c-blue {
background: linear-gradient(45deg,#4099ff,#73b4ff);
}
.bg-c-green {
background: linear-gradient(45deg,#2ed8b6,#59e0c5);
}
.bg-c-yellow {
background: linear-gradient(45deg,#FFB64D,#ffcb80);
}
.bg-c-pink {
background: linear-gradient(45deg,#FF5370,#ff869a);
}
.bg-c-red {
background: linear-gradient(45deg,#FF4E50,#F9D423);
}
.bg-c-purple {
background: linear-gradient(45deg,#9D50BB,#6E48AA);
}
.bg-c-orange {
background: linear-gradient(45deg,#F2994A,#F2C94C);
}
.bg-c-teal {
background: linear-gradient(45deg,#1ABC9C,#16A085);
}
.bg-c-cyan {
background: linear-gradient(45deg,#00C9FF,#92FE9D);
}
.bg-c-lime {
background: linear-gradient(45deg,#A8E063,#56AB2F);
}
.bg-c-indigo {
background: linear-gradient(45deg,#3F51B5,#5A55AE);
}
.bg-c-Pelorous {
background: linear-gradient(45deg, #00d6db, #00a8b5);
}
.bg-c-Pelorous2 {
background: linear-gradient(45deg, #02a8b5, #017f8b);
}
.bg-c-Pelorous3 {
background: linear-gradient(45deg, #098895, #046063);
}
.bg-c-Grenadier {
background: linear-gradient(45deg, #ff9d37, #ff7a10);
}
.bg-c-Grenadier2 {
background: linear-gradient(45deg, #ff8010, #ff4c00);
}
.bg-c-Grenadier3 {
background: linear-gradient(45deg, #f06306, #cc4b05);
}
.bg-c-SilverChalice {
background: linear-gradient(45deg, #a3a8a8, #8f9494);
}
.bg-c-SilverChalice2 {
background: linear-gradient(45deg, #7e8484, #686e6e);
}
.bg-c-SilverChalice3 {
background: linear-gradient(45deg, #5c6363, #434949);
}
.card {
border-radius: 5px;
-webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
border: none;
margin-bottom: 30px;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.card .card-block {
padding-top: 10px;
padding-bottom: 10px;
padding-left: 25px;
padding-right: 25px;
}
.order-card i {
font-size: 26px;
}
.f-left {
float: left;
}
.f-right {
float: right;
}
.m-b-1{
margin-top: 0;
margin-bottom: 5px;
}
.modal-right{
width: 100% !important;
justify-content: normal !important;
}
.modal-body {
max-height: 100vh;
overflow-y: auto;
padding-left: 25px !important;
padding-right: 25px !important;
padding-top: 10px !important;
padding-bottom: 35% !important;
}
</style>
<div class="tab-pane fade" id="bds-dash-tab" style="/*padding-left: 35px;*/padding-right: 35px;">
<div class="row">
<div class="col-md-4 col-xl-3">
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous order-card" onclick="linkRedirectForBDS(this, 'B')">
<div class="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 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-account-box 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>
</div>
</div>
<script>
function linkRedirectForBDS(input, team)
{
var link = "";
if(team == 'B'){
link = '<?= base_url('/policy_tranction/report/report-business-list') ?>'
}else if(team == 'F'){
link = '<?= base_url('/policy_tranction/report/report-finance-list') ?>'
}
console.log(link);
if(link){
window.location.href = link;
}
}
</script>

View File

@ -0,0 +1,423 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
</style>
<div class="row">
<div class="col-12" style="margin-top: -12px;">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger"></span></label>
<select class="form-control" id="client_id" name="client_id" >
<option value="0">Select Client</option>
<?php
if (isset($clients) && count($clients)) {
foreach ($clients as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id" >
<option value="0" selected>Select Insurer</option>
<?php if (isset($insurer) && count($insurer)) { ?>
<?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="email"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="policy_type_id" name="policy_type_id" >
<option value="0">Select Policy Type</option>
<?php
if (isset($policy_types) && count($policy_types)) {
foreach ($policy_types as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
<select class="form-control" id="issuer" name="issuer" required>
<option value="0">Select Issure</option>
<?php
if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Date Type<span class="text-danger"></span></label>
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()">
<option value="0">Select Date Type</option>
<?php
if (isset($date_type) && count($date_type)) {
foreach ($date_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3" style="display: none;" id="date_div">
<label>Date<span class="text-danger"></span></label>
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i>
</div>
<input type="hidden" id="startDate">
<input type="hidden" id="endDate">
</div>
<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"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
</div>
</div>
<!-- <div class="form-group text-right m-b-0">
<button type="button" class="btn btn-secondary" id="clear-filters">Clear</button>
<a href="<?= base_url("/policy_tranction/report/list"); ?>"
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
onclick="fetchEmpolyeeList(event);">Submit</a>
</div> -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12" id="second_page">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Business Team</h4>
</div>
</div>
<div class="table-responsive" style="overflow-x: auto;">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th>S.No</th>
<th>Client Name</th>
<th>Insurer</th>
<th>Policy</th>
<th>Policy No</th>
<th>Endorsement No</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php if (isset($business_list)) { ?>
<?php foreach($business_list as $index => $row){ ?>
<tr>
<td><?= $index + 1 ?></td>
<td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['insurer_name']; ?></td>
<td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['policy_no']; ?></td>
<td><?php echo $row['endorsement_no']; ?></td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a 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) ?>')">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<div>
</div>
</div>
</div><!-- end col -->
</div>
</div>
<script>
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'Policy-Tranction-BDS-List',
},
{
extend: 'excel',
text: 'Excel',
title: 'Policy-Tranction-BDS-List',
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var total = 0;
// Find cells in column AB (28th column in Excel)
$('row c[r^="AB"]', sheet).each(function() {
var value = parseFloat($('v', this).text()); // Get the value inside the cell
if (!isNaN(value)) {
total += value;
}
});
// Get the last row index and append the total row
var lastRow = $('row:last', sheet);
var rowIndex = parseInt(lastRow.attr('r')) + 2; // Find the next row index
var totalRow = '<row r="' + rowIndex + '">' +
'<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' + // Insert "Total" in AA
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' + // Insert sum in AB
'</row>';
// Append the new total row to the sheet
$(sheet).find('sheetData').append(totalRow);
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional)
});
} else {
console.error("Table not found.");
}
});
$(document).ready(function() {
getURLParams()
$('#client_id').select2();
$('#insurer_id').select2();
$('#policy_type_id').select2();
})
function fetchEmpolyeeList(event)
{
event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val();
var end_date = $('#endDate').val();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
var policy_type_id = $('#policy_type_id').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer').val();
console.log(start_date + '-' + end_date);
var queryParams = {
start_date: start_date,
end_date: end_date,
client_id: client_id,
insurer_id: insurer_id,
policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
function objectToQueryString(obj)
{
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function getURLParams()
{
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
// Log the values or use them as needed
console.log('Start Date:', startDate);
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function(){
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id').val(client_id).change()
$('#insurer_id').val(insurer_id).change()
$('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type)
$('#issuer').val(issuer)
},1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id').val('0').change();
$('#insurer_id').val('0').change();
$('#policy_type_id').val('0').change();
$('#date_type').val('0');
$('#issuer').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
});
});
function hideDateField(input = null)
{
let val = $('#date_type').val();
if(input){
val = input;
}
if(val != 0){
$('#date_div').show()
}else{
$('#date_div').hide()
}
}
function sendPolicyTransactionID(event, pt_id)
{
event.preventDefault(); // Prevent default action
console.log(pt_id);
var queryParams = {
pt_id: pt_id,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-policy-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
</script>

View File

@ -174,13 +174,19 @@
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
$('#form_'+item.kyc_doc_type_id).hide();
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
"?client_id=" + item.client_id +
"&file_type=kyc" +
"&file_name=" + item.file_name +
"&client_policy_id=client_policy_id";
// console.log('step 1')
if(item.file_name != null && item.file_name != ""){
// console.log('step 2')
$('#download_'+item.kyc_doc_type_id).show();
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
$('#download_' + item.kyc_doc_type_id).attr('href', url);
$('#delete_'+item.kyc_doc_type_id).show();
}
@ -227,7 +233,6 @@
})
$('#btn_other_docs').click(function(){
$('#others').toggle();
$('#other_docs_table').toggle();
@ -286,6 +291,14 @@
other_docs_count++;
}
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
"?client_id=" + item.client_id +
"&file_type=kyc" +
"&file_name=" + item.file_name +
"&client_policy_id=client_policy_id";
// console.log("Current item:", item);
if (item.kyc_doc_type_id == '0') {
// console.log("Appending item:", item);
@ -295,7 +308,7 @@
<td>${item.file_name}</td>
<td>
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" 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>
</tr>
`;
@ -430,9 +443,9 @@
function appendKycTableListData(data){
console.log('-----------------------------------------------------------')
console.log('appendKycTableListData function called')
console.log('-----------------------------------------------------------')
// console.log('-----------------------------------------------------------')
// console.log('appendKycTableListData function called')
// console.log('-----------------------------------------------------------')
var table = '';
@ -447,6 +460,13 @@
other_docs_count++;
}
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
"?client_id=" + item.client_id +
"&file_type=kyc" +
"&file_name=" + item.file_name +
"&client_policy_id=client_policy_id";
if(item.kyc_doc_type_id == '0'){
table += `
<tr id="kyc-${item.id}">
@ -454,7 +474,7 @@
<td>${item.file_name}</td>
<td>
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" 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;" target="_blank"></a>
</td>
</tr>
`;
@ -480,11 +500,17 @@
// console.log('step 1')
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
"?client_id=" + item.client_id +
"&file_type=kyc" +
"&file_name=" + item.file_name +
"&client_policy_id=client_policy_id";
if(item.file_name != null && item.file_name != ""){
// console.log('step 2')
$('#download_'+item.kyc_doc_type_id).show();
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
$('#download_' + item.kyc_doc_type_id).attr('href', url).attr('target', '_blank');;
$('#delete_'+item.kyc_doc_type_id).show();
}
else{

View File

@ -12,9 +12,10 @@
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<form class="parsley-examples" id="drive_file_upload_form" method="post"
enctype="multipart/form-data" onsubmit="return validateForm();">
enctype="multipart/form-data">
<input type="hidden" id="policy_tranction_primarykey_for_file_upload" name="pt_id">
<input type="hidden" id="client_policy_id_for_file_upload" name="client_policy_id">
<div class="form-group">

View File

@ -0,0 +1,424 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
</style>
<div class="row" id="finance_filter">
<div class="col-12" style="margin-top: -12px;">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger"></span></label>
<select class="form-control" id="client_id" name="client_id" >
<option value="0">Select Client</option>
<?php
if (isset($clients) && count($clients)) {
foreach ($clients as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id" >
<option value="0" selected>Select Insurer</option>
<?php if (isset($insurer) && count($insurer)) { ?>
<?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="email"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="policy_type_id" name="policy_type_id" >
<option value="0">Select Policy Type</option>
<?php
if (isset($policy_types) && count($policy_types)) {
foreach ($policy_types as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
<select class="form-control" id="issuer" name="issuer" required>
<option value="0">Select Issure</option>
<?php
if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Date Type<span class="text-danger"></span></label>
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()">
<option value="0">Select Date Type</option>
<?php
if (isset($date_type) && count($date_type)) {
foreach ($date_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3" style="display: none;" id="date_div">
<label>Date<span class="text-danger"></span></label>
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i>
</div>
<input type="hidden" id="startDate">
<input type="hidden" id="endDate">
</div>
<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"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
</div>
</div>
<!-- <div class="form-group text-right m-b-0">
<button type="button" class="btn btn-secondary" id="clear-filters">Clear</button>
<a href="<?= base_url("/policy_tranction/report/list"); ?>"
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
onclick="fetchEmpolyeeList(event);">Submit</a>
</div> -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12" id="finance_list">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Finance Team</h4>
</div>
</div>
<div class="table-responsive" style="overflow-x: auto;">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th>S.No</th>
<th>Client Name</th>
<th>Insurer</th>
<th>Policy</th>
<th>Policy No</th>
<th>Endorsement No</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php if (isset($finance_list)) { ?>
<?php foreach($finance_list as $index => $row){ ?>
<tr>
<td><?= $index + 1 ?></td>
<td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['insurer_name']; ?></td>
<td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['policy_no']; ?></td>
<td><?php echo $row['endorsement_no']; ?></td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="<?= base_url("/policy_tranction/inception/list"); ?>" id="get-policy-list" class="dropdown-item btnEdit" onclick="sendPolicyTransactionID(event, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<div>
</div>
</div>
</div><!-- end col -->
</div>
</div>
<script>
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'Policy-Tranction-BDS-List',
},
{
extend: 'excel',
text: 'Excel',
title: 'Policy-Tranction-BDS-List',
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var total = 0;
// Find cells in column AB (28th column in Excel)
$('row c[r^="AB"]', sheet).each(function() {
var value = parseFloat($('v', this).text()); // Get the value inside the cell
if (!isNaN(value)) {
total += value;
}
});
// Get the last row index and append the total row
var lastRow = $('row:last', sheet);
var rowIndex = parseInt(lastRow.attr('r')) + 2; // Find the next row index
var totalRow = '<row r="' + rowIndex + '">' +
'<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' + // Insert "Total" in AA
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' + // Insert sum in AB
'</row>';
// Append the new total row to the sheet
$(sheet).find('sheetData').append(totalRow);
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional)
});
} else {
console.error("Table not found.");
}
});
$(document).ready(function() {
getURLParams()
$('#client_id').select2();
$('#insurer_id').select2();
$('#policy_type_id').select2();
})
function fetchEmpolyeeList(event)
{
event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val();
var end_date = $('#endDate').val();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
var policy_type_id = $('#policy_type_id').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer').val();
console.log(start_date + '-' + end_date);
var queryParams = {
start_date: start_date,
end_date: end_date,
client_id: client_id,
insurer_id: insurer_id,
policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
function objectToQueryString(obj)
{
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function getURLParams()
{
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
// Log the values or use them as needed
console.log('Start Date:', startDate);
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function(){
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id').val(client_id).change()
$('#insurer_id').val(insurer_id).change()
$('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type)
$('#issuer').val(issuer)
},1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id').val('0').change();
$('#insurer_id').val('0').change();
$('#policy_type_id').val('0').change();
$('#date_type').val('0');
$('#issuer').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
});
});
function hideDateField(input = null)
{
let val = $('#date_type').val();
if(input){
val = input;
}
if(val != 0){
$('#date_div').show()
}else{
$('#date_div').hide()
}
}
function sendPolicyTransactionID(event, pt_id)
{
event.preventDefault(); // Prevent default action
console.log(pt_id);
var queryParams = {
pt_id: pt_id,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-policy-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
</script>

View File

@ -670,6 +670,15 @@
<li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Varience</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>

View File

@ -68,6 +68,29 @@
color: #000000;
}
.right-align-input {
text-align: right;
}
.input-with-percentage {
position: relative;
}
.input-with-percentage input {
padding-right: 20px;
text-align: right;
}
.input-with-percentage::after {
content: '%';
position: absolute;
right: 5px;
top: 50%;
transform: translateY(-50%);
font-weight: bold;
color: #000;
}
</style>
<div class="row" id="endorsement_form" style="display: none;">
@ -161,7 +184,7 @@
<div class="row">
<div class="form-group col-md-3">
<label for="tpa"> TPA <span id="tpa_danger"class="text-danger">*</span></label>
<label for="tpa"> TPA <span id="tpa_danger"class="text-danger"></span></label>
<select class="form-control readonly-select" id="tpa" name="tpa" >
<option value="" selected>Select TPA</option>
<?php foreach ($tpa as $value) { ?>
@ -173,18 +196,23 @@
</div>
<div class="form-group col-md-3">
<label for="addon_policy">Policy No<span id="base_danger"class="text-danger">*</span></label>
<input type="text" class="form-control" id="policy_no" name="policy_no"placeholder="Enter Policy No" >
<label for="addon_policy">Policy No<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no" name="policy_no"placeholder="Enter Policy No" readonly>
</div>
<div class="form-group col-md-3">
<label for="bp_cgst">D.O.C <span id="base_danger" class="text-danger">*</span></label>
<input id="policy_start_date" type="text" class="form-control" placeholder="DD/MM/YYYY" >
<label for="bp_cgst">D.O.C <span id="base_danger" class="text-danger"></span></label>
<input id="policy_start_date" type="text" class="form-control" placeholder="DD/MM/YYYY" readonly>
</div>
<div class="form-group col-md-3">
<label for="bp_igst">D.O.E <span id="base_danger" class="text-danger">*</span></label>
<input id="policy_end_date" type="text" class="form-control" placeholder="DD/MM/YYYY" >
<label for="bp_igst">D.O.E <span id="base_danger" class="text-danger"></span></label>
<input id="policy_end_date" type="text" class="form-control" placeholder="DD/MM/YYYY" readonly>
</div>
<div class="form-group col-md-3">
<label for="addon_policy">Policy Issue Month<span id="base_danger" class="text-danger">*</span></label>
<input type="text" class="form-control" id="month" name="month" placeholder="MM/YYYY" >
</div>
<div class="form-group col-md-3">
@ -222,15 +250,14 @@
</div>
<div class="form-group col-md-3">
<label for="addon_policy">No of Insured<span id="base_danger"class="text-danger">*</span></label>
<label for="addon_policy">No of Insured<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="emp_count" name="emp_count" placeholder="Enter Employeee" onkeypress="return onlyNumbers(event)">
</div>
<div class="form-group col-md-3">
<label for="addon_policy">No of Dependents<span id="base_danger" class="text-danger">*</span></label>
<label for="addon_policy">No of Dependents<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="dependent_count" name="dependent_count" placeholder="Enter Dependent" onkeypress="return onlyNumbers(event)">
</div>
count
</div>
<hr>
@ -418,7 +445,6 @@
</div>
<!-- end form row -->
<script>
$(document).ready(function(){
@ -477,7 +503,9 @@ $(document).ready(function(){
var start_date = $(this).find('option:selected').attr('data-sd');
var end_date = $(this).find('option:selected').attr('data-ed');
console.log('client_id', client_id);
console.log('client_policy_id', client_policy_id);
console.log('policy_tranction_primarykey', policy_tranction_primarykey);
console.log('policy_no', policy_no);
console.log('cd_ac_no',cd_ac_no);
console.log('tpa',tpa);
@ -771,6 +799,7 @@ $('#endorsement_no').on('change', function(){
}
})
//---------------------------------------------------------------------------------------------------------
//edit function
@ -822,6 +851,7 @@ function getPolicyTransactionDataForEndorsementEdit(input){
$('#policy_start_date').val(res.data.policy_start_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.month);
removeAllColumnsExceptFirst('insurerTable');
if(res.data.pt_co_share_details){
@ -1076,7 +1106,6 @@ function addInsurerColumn() {
</th>
`);
// Add a new column for each data row
$('#insurerTable tbody tr').each(function(index) {
let newCell = '';
@ -1104,94 +1133,94 @@ function addInsurerColumn() {
</td>`;
break;
case 2: // Co-Share %
newCell = `<td><input type="text" name="co_share_per[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="co_share_per[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 3: // Base Premium
newCell = `<td><input type="text" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 4: // TP Premium
newCell = `<td><input type="text" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 5: // Ter Premium
newCell = `<td><input type="text" id="ter_premium_${insurerCount}" name="ter_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
newCell = `<td><input type="text" class="right-align-input" id="ter_premium_${insurerCount}" name="ter_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 6: // co Premium
newCell = `<td><input type="text" 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;
case 7: // CGST
newCell = `<td><input type="text" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
newCell = `<td><input type="text" class="right-align-input" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 8: // SGST
newCell = `<td><input type="text" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
newCell = `<td><input type="text" class="right-align-input" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 9: // IGST
newCell = `<td><input type="text" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
newCell = `<td><input type="text" class="right-align-input" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 10: // GST Amount
newCell = `<td><input type="text" class="readonly-color" 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>`;
break;
case 11: // Stamp Duty
newCell = `<td><input type="text" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
newCell = `<td><input type="text" class="right-align-input" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 12: // Total
newCell = `<td><input type="text" class="readonly-color" 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;
case 13: // Agreed BP %
newCell = `<td><input type="text" 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="validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
break;
case 14: // Agreed TP %
newCell = `<td><input type="text" 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="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 15: // Agreed Ter %
newCell = `<td><input type="text" 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="validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
break;
case 16: // Agreed Amount
newCell = `<td><input type="text" 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>`;
break;
case 17: // Standard BP %
newCell = `<td><input type="text" class="readonly-color" id="standard_bp_${insurerCount}" name="standard_bp[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_bp_${insurerCount}" name="standard_bp[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
break;
case 18: // Standard TP %
newCell = `<td class="std_tp_td"><input type="text" class="readonly-color" name="standard_tp[]" onkeypress="return onlyNumbers(event)" readonly ></td>`;
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" name="standard_tp[]" onkeypress="return onlyNumbers(event)" readonly ></td>`;
break;
case 19: // Standard Ter %
newCell = `<td class="std_tp_td"><input type="text" class="readonly-color" 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;
case 20: // Actual BP Amount
newCell = `<td><input type="text" 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}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 21: // Actual TP Amount
newCell = `<td><input type="text" 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}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 22: // Actual TEP Amount
newCell = `<td><input type="text" 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}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 23: // Actual BP %
newCell = `<td><input type="text" 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}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 24: // Actual TP %
newCell = `<td><input type="text" 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}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 25: // Actual TEP %
newCell = `<td><input type="text" 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_amt[]" onchange="actualAmountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 26: // Actual BP Brokerage Amount
newCell = `<td><input type="text" 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}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 27: // Actual TP Brokerage Amount
newCell = `<td><input type="text" 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}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 28: // Actual TEP Brokerage Amount
newCell = `<td><input type="text" 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}')" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 29: // Expected Amount
newCell = `<td><input type="text" 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>`;
break;
case 30: // Variance
newCell = `<td><input type="text" class="readonly-color" id="variance_${insurerCount}" name="variance[]" onchange="actualAmountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)" readonly></td>`;
newCell = `<td><input type="text" class="readonly-color right-align-input" id="variance_${insurerCount}" name="variance[]" onchange="actualAmountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)" readonly></td>`;
break;
case 31: // Reward
newCell = `<td><input type="text" id="reward_${insurerCount}" name="reward[]" onkeypress="return onlyNumbers(event)"></td>`;
newCell = `<td><input type="text" class="right-align-input" id="reward_${insurerCount}" name="reward[]" onkeypress="return onlyNumbers(event)"></td>`;
break;
case 32: // ID For Update
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;

View File

@ -44,6 +44,131 @@ table.dataTable thead th {
}
</style>
<div class="row" id="endorsement_filter">
<div class="col-12" style="margin-top: -12px;">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger"></span></label>
<select class="form-control" id="client_id_for_search" name="client_id" >
<option value="0">Select Client</option>
<?php
if (isset($client) && count($client)) {
foreach ($client as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label>
<select class="form-control" id="insurer_id_for_search" name="insurer_id" >
<option value="0" selected>Select Insurer</option>
<?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="email"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="policy_type_for_search" name="policy_type_id" >
<option value="0">Select Policy Type</option>
<?php
if (isset($policy_types) && count($policy_types)) {
foreach ($policy_types as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
<select class="form-control" id="issuer_for_search" name="issuer" required>
<option value="0">Select Issure</option>
<?php
if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="email"> Status <span class="text-danger"></span></label>
<select class="form-control" id="policy_status_for_search" name="policy_type_id" >
<option value="0">Select Status</option>
<?php
if (isset($policy_status) && count($policy_status)) {
foreach ($policy_status as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label>Date Type<span class="text-danger"></span></label>
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()">
<option value="0">Select Date Type</option>
<?php
if (isset($date_type) && count($date_type)) {
foreach ($date_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3" style="display: none;" id="date_div">
<label>Date<span class="text-danger"></span></label>
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i>
</div>
<input type="hidden" id="startDate">
<input type="hidden" id="endDate">
</div>
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
<a href="<?= base_url("/policy_tranction/endorsement/list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a>
<a href="<?= base_url("/policy_tranction/endorsement/list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" id="endorsement_list">
<div class="col-12">
<div class="card">
@ -68,7 +193,7 @@ table.dataTable thead th {
<th>Endorsement Type</th>
<th>Endorsement No</th>
<th>Data Recived Date</th>
<th>No of Employees</th>
<th>No of Insured</th>
<th>No of Dependence</th>
<th>Closure Date</th>
<th>Status</th>
@ -193,22 +318,34 @@ table.dataTable thead th {
allowInput: false
});
var start_date = flatpickr("#policy_start_date", {
dateFormat: "d-m-Y",
allowInput: false
});
// var start_date = flatpickr("#policy_start_date", {
// dateFormat: "d-m-Y",
// allowInput: false
// });
var end_date = flatpickr("#policy_end_date", {
dateFormat: "d-m-Y",
allowInput: false
});
// var end_date = flatpickr("#policy_end_date", {
// dateFormat: "d-m-Y",
// allowInput: false
// });
var endorse_eff_date = flatpickr("#endorse_eff_date", {
dateFormat: "d-m-Y",
allowInput: false
});
})
var month = flatpickr("#month", {
dateFormat: "M-Y",
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()
{
@ -216,9 +353,10 @@ table.dataTable thead th {
$('#endorsement_form_id')[0].reset();
$('#client_id').val('').change();
$('#client_policy_id').val('').change();
$('#endorsement_form').show()
$('#endorsement_list').hide()
$('#invoice_no_div').hide()
$('#endorsement_form').show();
$('#endorsement_list').hide();
$('#endorsement_filter').hide();
$('#invoice_no_div').hide();
$('#invoice_no').attr('required', false)
}
@ -226,6 +364,7 @@ table.dataTable thead th {
{
$('#endorsement_form').hide()
$('#endorsement_list').show()
$('#endorsement_filter').show()
}
@ -429,4 +568,170 @@ table.dataTable thead th {
}
})
</script>
<script>
$(document).ready(function() {
getURLParams()
$('#client_id_for_search').select2();
$('#insurer_id_for_search').select2();
$('#policy_type_for_search').select2();
})
function fetchEmpolyeeList(event)
{
event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val();
var end_date = $('#endDate').val();
var client_id = $('#client_id_for_search').val();
var insurer_id = $('#insurer_id_for_search').val();
var policy_type_id = $('#policy_type_for_search').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer_for_search').val();
var status = $('#policy_status_for_search').val();
console.log(start_date + '-' + end_date);
var queryParams = {
start_date: start_date,
end_date: end_date,
client_id: client_id,
insurer_id: insurer_id,
policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
status: status,
};
console.log(queryParams)
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
function objectToQueryString(obj)
{
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function getURLParams()
{
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
const status = params.get('status') || 0; // Default to 0 if not found
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
console.log('status', status)
// Log the values or use them as needed
console.log('Start Date:', startDate);
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function(){
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id_for_search').val(client_id).change()
$('#insurer_id_for_search').val(insurer_id).change()
$('#policy_type_for_search').val(policy_type_id).change()
$('#date_type').val(date_type)
$('#issuer_for_search').val(issuer)
$('#policy_status_for_search').val(status)
},1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id_for_search').val('0').change();
$('#insurer_id_for_search').val('0').change();
$('#policy_type_for_search').val('0').change();
$('#date_type').val('0');
$('#issuer_for_search').val('0');
$('#policy_status_for_search').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
});
});
function hideDateField(input = null)
{
let val = $('#date_type').val();
if(input){
val = input;
}
if(val != 0){
$('#date_div').show()
}else{
$('#date_div').hide()
}
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -105,6 +105,131 @@ table.dataTable tbody td {
}
</style>
<div class="row" id="inception_filter">
<div class="col-12" style="margin-top: -12px;">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h4 class="m-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h4>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger"></span></label>
<select class="form-control" id="client_id_for_search" name="client_id" >
<option value="0">Select Client</option>
<?php
if (isset($client) && count($client)) {
foreach ($client as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label>
<select class="form-control" id="insurer_id_for_search" name="insurer_id" >
<option value="0" selected>Select Insurer</option>
<?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="email"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="policy_type_for_search" name="policy_type_id" >
<option value="0">Select Policy Type</option>
<?php
if (isset($policy_types) && count($policy_types)) {
foreach ($policy_types as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
<select class="form-control" id="issuer_for_search" name="issuer" required>
<option value="0">Select Issure</option>
<?php
if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="email"> Status <span class="text-danger"></span></label>
<select class="form-control" id="policy_status_for_search" name="policy_type_id" >
<option value="0">Select Status</option>
<?php
if (isset($policy_status) && count($policy_status)) {
foreach ($policy_status as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label>Date Type<span class="text-danger"></span></label>
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()">
<option value="0">Select Date Type</option>
<?php
if (isset($date_type) && count($date_type)) {
foreach ($date_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3" style="display: none;" id="date_div">
<label>Date<span class="text-danger"></span></label>
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i>
</div>
<input type="hidden" id="startDate">
<input type="hidden" id="endDate">
</div>
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
<a href="<?= base_url("/policy_tranction/inception/list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a>
<a href="<?= base_url("/policy_tranction/inception/list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" id="inception_list">
<div class="col-12">
<div class="card">
@ -132,7 +257,7 @@ table.dataTable tbody td {
<th><div class="column-header">Policy Issue Date</div></th>
<th><div class="column-header">D.O.C</div></th>
<th><div class="column-header">D.O.E</div></th>
<th><div class="column-header">No of Employees</div></th>
<th><div class="column-header">No of Insured</div></th>
<th><div class="column-header">No of Dependents</div></th>
<th><div class="column-header">Status</div></th>
<th><div class="column-header">Action</div></th>
@ -159,7 +284,7 @@ table.dataTable tbody td {
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit(this)">
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
</div>
@ -367,11 +492,6 @@ $(document).ready(function(){
var today = new Date();
var policy_issue_date = flatpickr("#policy_issue_date", {
dateFormat: "d-m-Y",
allowInput: false
});
var opening_date = flatpickr("#opening_date", {
dateFormat: "d-m-Y",
allowInput: false
@ -410,11 +530,34 @@ $(document).ready(function(){
allowInput: false
});
var month = flatpickr("#month", {
dateFormat: "M-Y", // Format as month and year
allowInput: false, // Disable manual input
});
var policy_issue_date = flatpickr("#policy_issue_date", {
dateFormat: "d-m-Y", // Format as day-month-year
allowInput: false, // Disable manual input
onChange: function(selectedDates, dateStr, instance) {
// Get the selected date
var selectedDate = new Date(selectedDates[0]);
// Format the selected date to "M-Y"
var formattedMonth = flatpickr.formatDate(selectedDate, "M-Y");
// Set the value of the #month input
month.setDate(formattedMonth);
}
});
})
//--------------------------------------------------------------------------------------------------------
function hide_list_show_add()
{
$('#page_title').text('Add Policy')
@ -440,6 +583,7 @@ function hide_list_show_add()
$('#pt_onboarding').show()
$('#inception_list').hide()
$('#inception_filter').hide()
$('#policyholdernamediv').hide();
$('.branchdiv').show();
}
@ -448,6 +592,7 @@ function show_list_hide_add()
{
$('#pt_onboarding').hide()
$('#inception_list').show()
$('#inception_filter').show();
$('#nav_pills').empty()
$('#tab_content').empty()
count = 0
@ -588,91 +733,91 @@ function appendRenewalPolicies(data)
});
}
function getCDAccountNumber(client_id, insurer_id)
{
console.log('getCDAccountNumber')
// function getCDAccountNumber(client_id, insurer_id)
// {
// console.log('getCDAccountNumber')
// var client_id = $('#client_id').val()
// var insurer_id = $('#insurer_id').find('option:selected').attr('data-id');
// // var client_id = $('#client_id').val()
// // var insurer_id = $('#insurer_id').find('option:selected').attr('data-id');
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
// console.log('client_id', client_id)
// console.log('insurer_id', insurer_id)
if(client_id && insurer_id){
$.ajax({
url: '<?= base_url("/util/getCDAccNoByClientAndInsurer/") ?>' + client_id + '/' + insurer_id,
type: "GET",
dataType: 'json',
success: function(res) {
// if(client_id && insurer_id){
// $.ajax({
// url: '<?= base_url("/util/getCDAccNoByClientAndInsurer/") ?>' + client_id + '/' + insurer_id,
// type: "GET",
// dataType: 'json',
// success: function(res) {
console.log('cd_res', res);
if(res.status == true){
// appendCDAccountNumber(res.data[0].cd_ac_no)
if(res.data[0].cd_ac_no){
$('#cd_ac_no').val(res.data[0].cd_ac_no)
}
}else{
toastr.warning('The insurer does not has a CD account number');
}
// console.log('cd_res', res);
// if(res.status == true){
// // appendCDAccountNumber(res.data[0].cd_ac_no)
// if(res.data[0].cd_ac_no){
// $('#cd_ac_no').val(res.data[0].cd_ac_no)
// }
// }else{
// toastr.warning('The insurer does not has a CD account number');
// }
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
}
// },
// error: function(xhr, status, error) {
// console.error(xhr.responseText);
// console.error(status, error);
// }
// });
// }
// }
function appendCDAccountNumber(data)
{
console.log('appendCDAccountNumber', data);
console.log('appendCDAccountNumber', $('#cd_ac_no'));
// function appendCDAccountNumber(data)
// {
// console.log('appendCDAccountNumber', data);
// console.log('appendCDAccountNumber', $('#cd_ac_no'));
$('#cd_ac_no').empty();
// $('#cd_ac_no').empty();
$('#cd_ac_no').append($('<option>', {
value: '',
text: 'Select Policy',
}));
// $('#cd_ac_no').append($('<option>', {
// value: '',
// text: 'Select Policy',
// }));
$('#cd_ac_no').append($('<option>', {
value: 'add_cd',
text: '+ Add CD'
}));
// $('#cd_ac_no').append($('<option>', {
// value: 'add_cd',
// text: '+ Add CD'
// }));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.cd_ac_no,
text: item.cd_ac_no,
});
$('#cd_ac_no').append(option);
});
}
// $.each(data, function(index, item) {
// var option = $('<option>', {
// value: item.cd_ac_no,
// text: item.cd_ac_no,
// });
// $('#cd_ac_no').append(option);
// });
// }
function addCDAccountNumber(input)
{
var val = $(input).val();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
// function addCDAccountNumber(input)
// {
// var val = $(input).val();
// var client_id = $('#client_id').val();
// var insurer_id = $('#insurer_id').val();
console.log('addCDAccountNumber', 'addCDAccountNumber');
console.log('client_id', client_id);
console.log('insurer_id', insurer_id);
// console.log('addCDAccountNumber', 'addCDAccountNumber');
// console.log('client_id', client_id);
// console.log('insurer_id', insurer_id);
if(client_id == '' || insurer_id == ''){
toastr.warning('Client, Insurer, or both do not exist.');
$(input).val('')
return false;
}
// if(client_id == '' || insurer_id == ''){
// toastr.warning('Client, Insurer, or both do not exist.');
// $(input).val('')
// return false;
// }
if(val == 'add_cd')
{
var myModal = new bootstrap.Modal(document.getElementById('cd_form_modal'));
myModal.show();
$(input).val('')
}
}
// if(val == 'add_cd')
// {
// var myModal = new bootstrap.Modal(document.getElementById('cd_form_modal'));
// myModal.show();
// $(input).val('')
// }
// }
function getPolicyDetailsByPolicyId(input)
{
@ -705,12 +850,12 @@ function addHTMLInput(data = null)
newRow.className = 'form-row dynamic-form-row';
newRow.innerHTML = `
<div class="form-group col-md-5">
<label for="file_name">Document Name<span class="text-danger"></span></label>
<input type="text" class="form-control" id="docs_name" name="doc_name[]" placeholder="Enter file name">
<label for="file_name">Document Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="docs_name" name="doc_name[]" placeholder="Enter file name" required>
</div>
<div class="form-group col-md-5">
<label for="file">Upload File<span class="text-danger"></span></label>
<input type="file" class="form-control" id="file_name" name="file[]">
<label for="file">Upload File<span class="text-danger">*</span></label>
<input type="file" class="form-control" id="file_name" name="file[]" required>
</div>
<div class="form-group col-md-2" style="position: relative;top: 28px;">
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
@ -815,10 +960,19 @@ function appendFileTableBody(data)
row.append($('<td>').text(item.doc_name));
row.append($('<td>').text(item.file_name));
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
"?client_id=" + item.client_id +
"&file_type=policy" +
"&file_name=" + item.file_name +
"&client_policy_id=" + item.client_policy_id;
var link = $('<a>')
.attr('href', item.url)
.attr('href', url)
.attr('target', '_blank') // Open in a new tab
.text(item.url); // Text for the link
.attr('style', 'font-size:18px;')
.attr('data-id', item.id)
.addClass('fa fa-download')
// Append the <a> tag inside the <td>
row.append($('<td>').append(link));
@ -1051,61 +1205,6 @@ $('#invoice_status_modal').change(function(){
}
})
$("#CDMasterForm").submit(function(event) {
event.preventDefault();
var isValid = $('#CDMasterForm').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return ;
}
form_action = '<?= base_url("util/createCDAccountNumberUsingAjax"); ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
// console.log('client_id', client_id);
// console.log('insurer_id', insurer_id);
var formData = new FormData($('#CDMasterForm')[0]);
formData.append('client_id', client_id);
formData.append('insurer_id', insurer_id);
$.ajax({
data:formData,
url: form_action,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if(res.status == true){
appendCDAccountNumber(res.data)
toastr.success(res.message, 'Success');
}else{
toastr.error(res.message, 'Error');
}
$('.close').click();
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
});
$("#invoiceForm").submit(function(event) {
event.preventDefault();
@ -1255,6 +1354,8 @@ $('#issue_type').change(function(){
}
});
//--------------------------------------------------------------------------------------------------------
function formatDateforpolicy(dateStr)
{
@ -1277,4 +1378,170 @@ function onlyNumbers(event)
return false;
}
</script>
<script>
$(document).ready(function() {
getURLParams()
$('#client_id_for_search').select2();
$('#insurer_id_for_search').select2();
$('#policy_type_for_search').select2();
})
function fetchEmpolyeeList(event)
{
event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val();
var end_date = $('#endDate').val();
var client_id = $('#client_id_for_search').val();
var insurer_id = $('#insurer_id_for_search').val();
var policy_type_id = $('#policy_type_for_search').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer_for_search').val();
var status = $('#policy_status_for_search').val();
console.log(start_date + '-' + end_date);
var queryParams = {
start_date: start_date,
end_date: end_date,
client_id: client_id,
insurer_id: insurer_id,
policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
status: status,
};
console.log(queryParams)
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
function objectToQueryString(obj)
{
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function getURLParams()
{
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
const status = params.get('status') || 0; // Default to 0 if not found
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
console.log('status', status)
// Log the values or use them as needed
console.log('Start Date:', startDate);
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function(){
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id_for_search').val(client_id).change()
$('#insurer_id_for_search').val(insurer_id).change()
$('#policy_type_for_search').val(policy_type_id).change()
$('#date_type').val(date_type)
$('#issuer_for_search').val(issuer)
$('#policy_status_for_search').val(status)
},1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id_for_search').val('0').change();
$('#insurer_id_for_search').val('0').change();
$('#policy_type_for_search').val('0').change();
$('#date_type').val('0');
$('#issuer_for_search').val('0');
$('#policy_status_for_search').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
});
});
function hideDateField(input = null)
{
let val = $('#date_type').val();
if(input){
val = input;
}
if(val != 0){
$('#date_div').show()
}else{
$('#date_div').hide()
}
}
</script>

View File

@ -16,6 +16,10 @@ table.dataTable tbody td {
.dataTables_filter {
position: absolute;
}
.right-align-input {
text-align: right;
}
</style>
<div class="col-12" id="second_page">
@ -68,13 +72,14 @@ table.dataTable tbody td {
<th>Total IRDA Revenue INR</th>
<th>GST on Revenue</th>
<th>Total Amount Receivable</th>
<th>Rewards %</th>
<th>Rewards</th>
<th>Total Brokerage</th>
<th>Payment Ref</th>
<th>Invoice Number</th>
<th>Invoice Date</th>
<th>Invoice Amount</th>
<th>Realization Amount</th>
<th>Outstanding Amount</th>
<th>Payment Status</th>
<th>UTR</th>
<th>Payment Date</th>
@ -111,26 +116,37 @@ table.dataTable tbody 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['bp_amt']; ?></td>
<td><?php echo $row['tp_or_ter']; ?></td>
<td><?php echo $row['premium_wo_gst']; ?></td>
<td><?php echo $row['gst_amount']; ?></td>
<td><?php echo $row['total_premium']; ?></td>
<td><?php echo $row['agreed_bp_per']; ?></td>
<td><?php echo $row['agreed_tp_or_ter_per']; ?></td>
<td><?php echo $row['total_irda']; ?></td>
<td><?php echo $row['gst_on_revenue']; ?></td>
<td><?php echo $row['total_amt_received']; ?></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></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['premium_wo_gst']; ?></td>
<td class="right-align-input"><?php echo $row['gst_amount']; ?></td>
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
<td class="right-align-input"><?php echo $row['agreed_bp_per']; ?>&nbsp;%</td>
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?>&nbsp;%</td>
<td class="right-align-input"><?php echo $row['total_irda']; ?></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['reward']; ?></td>
<td></td>
<td></td>
<td><?php echo $row['invoice_no']; ?></td>
<td><?php echo $row['invoice_date']; ?></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['outstanding_amount']; ?></td>
<td>
<?php
if($row['outstanding_amount'] == '0.00'){
echo 'Payment Received';
}else if($row['outstanding_amount'] == NULL){
echo '';
}else{
echo 'Partially Received';
}
?>
</td>
<td><?php echo $row['utr_numbers']; ?></td>
<td><?php echo $row['payment_dates']; ?></td>
</tr>
<?php } ?>
<?php } ?>
@ -143,6 +159,7 @@ table.dataTable tbody td {
</div><!-- end col -->
</div>
</div>
<script>
// Datatable document ready
$(document).ready(function() {
@ -164,7 +181,31 @@ $(document).ready(function() {
extend: 'excel',
text: 'Excel',
title: 'Policy-Tranction-BDS-List',
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var total = 0;
// Find cells in column AB (28th column in Excel)
$('row c[r^="AB"]', sheet).each(function() {
var value = parseFloat($('v', this).text()); // Get the value inside the cell
if (!isNaN(value)) {
total += value;
}
});
// Get the last row index and append the total row
var lastRow = $('row:last', sheet);
var rowIndex = parseInt(lastRow.attr('r')) + 2; // Find the next row index
var totalRow = '<row r="' + rowIndex + '">' +
'<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' + // Insert "Total" in AA
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' + // Insert sum in AB
'</row>';
// Append the new total row to the sheet
$(sheet).find('sheetData').append(totalRow);
}
}
],
language: {
search: "_INPUT_",

View File

@ -100,14 +100,19 @@
<input type="hidden" id="endDate">
</div>
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
<a href="<?= base_url("/policy_tranction/report/list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a>
<a href="<?= base_url("/policy_tranction/report/list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
</div>
</div>
<div class="form-group text-right m-b-0">
<!-- <div class="form-group text-right m-b-0">
<button type="button" class="btn btn-secondary" id="clear-filters">Clear</button>
<a href="<?= base_url("/policy_tranction/report/list"); ?>"
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
onclick="fetchEmpolyeeList(event);">Submit</a>
</div>
</div> -->
</div>
</div>
</div>
@ -126,7 +131,6 @@
<script>
$(document).ready(function() {
getURLParams()
$('#client_id').select2();
$('#insurer_id').select2();

View File

@ -0,0 +1,422 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
</style>
<div class="row" id="varience_filter">
<div class="col-12" style="margin-top: -12px;">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger"></span></label>
<select class="form-control" id="client_id" name="client_id" >
<option value="0">Select Client</option>
<?php
if (isset($clients) && count($clients)) {
foreach ($clients as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id" >
<option value="0" selected>Select Insurer</option>
<?php if(isset($insurer) && count($insurer)){ ?>
<?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="email"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="policy_type_id" name="policy_type_id" >
<option value="0">Select Policy Type</option>
<?php
if (isset($policy_types) && count($policy_types)) {
foreach ($policy_types as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
<select class="form-control" id="issuer" name="issuer" required>
<option value="0">Select Issure</option>
<?php
if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Date Type<span class="text-danger"></span></label>
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()">
<option value="0">Select Date Type</option>
<?php
if (isset($date_type) && count($date_type)) {
foreach ($date_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3" style="display: none;" id="date_div">
<label>Date<span class="text-danger"></span></label>
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i>
</div>
<input type="hidden" id="startDate">
<input type="hidden" id="endDate">
</div>
</div>
<div class="form-group text-right m-b-0">
<a href="<?= base_url("/policy_tranction/report/report-varience-list"); ?>" 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>
</div>
</div>
<div class="col-12" id="varience_list">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Varience Report</h4>
</div>
</div>
<div class="table-responsive" style="overflow-x: auto;">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th>S.No</th>
<th>Client Name</th>
<th>Insurer</th>
<th>Policy</th>
<th>Policy No</th>
<th>Endorsement No</th>
<th>Expected Amount</th>
<th>Varience</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php if (isset($varience_list)) { ?>
<?php foreach($varience_list as $index => $row){ ?>
<tr>
<td><?= $index + 1 ?></td>
<td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['insurer_name']; ?></td>
<td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['policy_no']; ?></td>
<td><?php echo $row['endorsement_no']; ?></td>
<td><?php echo $row['exp_amt']; ?></td>
<td><?php echo $row['variance']; ?></td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="<?= base_url("/policy_tranction/inception/list"); ?>" id="get-policy-list" class="dropdown-item btnEdit" onclick="sendPolicyTransactionID(event, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<div>
</div>
</div>
</div><!-- end col -->
</div>
</div>
<script>
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'Policy-Tranction-BDS-List',
},
{
extend: 'excel',
text: 'Excel',
title: 'Policy-Tranction-BDS-List',
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var total = 0;
// Find cells in column AB (28th column in Excel)
$('row c[r^="AB"]', sheet).each(function() {
var value = parseFloat($('v', this).text()); // Get the value inside the cell
if (!isNaN(value)) {
total += value;
}
});
// Get the last row index and append the total row
var lastRow = $('row:last', sheet);
var rowIndex = parseInt(lastRow.attr('r')) + 2; // Find the next row index
var totalRow = '<row r="' + rowIndex + '">' +
'<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' + // Insert "Total" in AA
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' + // Insert sum in AB
'</row>';
// Append the new total row to the sheet
$(sheet).find('sheetData').append(totalRow);
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional)
});
} else {
console.error("Table not found.");
}
});
$(document).ready(function() {
getURLParams()
$('#client_id').select2();
$('#insurer_id').select2();
$('#policy_type_id').select2();
})
function fetchEmpolyeeList(event)
{
event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val();
var end_date = $('#endDate').val();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
var policy_type_id = $('#policy_type_id').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer').val();
console.log(start_date + '-' + end_date);
var queryParams = {
start_date: start_date,
end_date: end_date,
client_id: client_id,
insurer_id: insurer_id,
policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
function objectToQueryString(obj)
{
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function getURLParams()
{
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
// Log the values or use them as needed
console.log('Start Date:', startDate);
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function(){
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id').val(client_id).change()
$('#insurer_id').val(insurer_id).change()
$('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type)
$('#issuer').val(issuer)
},1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id').val('0').change();
$('#insurer_id').val('0').change();
$('#policy_type_id').val('0').change();
$('#date_type').val('0');
$('#issuer').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
});
});
function hideDateField(input = null)
{
let val = $('#date_type').val();
if(input){
val = input;
}
if(val != 0){
$('#date_div').show()
}else{
$('#date_div').hide()
}
}
function sendPolicyTransactionID(event, pt_id)
{
event.preventDefault(); // Prevent default action
console.log(pt_id);
var queryParams = {
pt_id: pt_id,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-policy-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
</script>

BIN
writable/tmp/20240924164906 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

BIN
writable/tmp/20240924165542 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

BIN
writable/tmp/20240924171719 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

BIN
writable/tmp/20240926123034 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB