diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index e81526d0..f20747b9 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -131,6 +131,13 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
$routes->post("edit", "ClientController::editClientPolicyPremium");
$routes->post("other_terms", "ClientController::otherPolicyTermsFormSubmit");
});
+
+ $routes->group("vehicle", ["filter" => "authMVC"], function ($routes) {
+ $routes->post("create", "ClientController::uploadVehicleFile");
+ $routes->post("edit", "ClientController::editUploadVehicleFile");
+ $routes->get("list/(:any)", "ClientController::listVehicleFiles/$1");
+ $routes->get("delete/(:any)", "ClientController::deleteVehicleFiles/$1");
+ });
});
@@ -294,6 +301,10 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get("getPTCOShareCount/(:any)", "PolicyTransactionController::getPTCOShareCount/$1");
$routes->get("test_mail", "MasterController::testGmailAPI");
$routes->post("test_mail", "MasterController::testGmailAPI");
+ $routes->get("check_policy_no/(:any)", "ClientController::check_policy_no/$1");
+ $routes->get("get_client_policy_data_using_policy_no/(:any)", "ClientController::get_client_policy_data_using_policy_no/$1");
+ $routes->get("get_client_policy_data_using_policy_no_and_endo_no/(:any)", "ClientController::get_client_policy_data_using_policy_no_and_endo_no/$1");
+ $routes->get("checkInvoiceStatus/(:any)", "PolicyTransactionController::checkInvoiceStatus/$1");
});
diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index 25c8170e..17e6f11d 100755
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -38,6 +38,8 @@ use App\Models\PolicyTransactionModel;
use App\Models\PolicyTransactionStatusModel;
use App\Models\VehicleModel;
+use App\Controllers\EmpDataServiceController;
+
class ClientController extends AdminController
{
@@ -117,12 +119,8 @@ class ClientController extends AdminController
public function Testing() //this function for only tsesting some logics not use for business logic
{
- $params['mail'] = 'venkateshraman786@gmail.com';
- $params['subject'] = 'testing';
- $params['message'] = 'testing';
-
- $result = MailHelper::send_email($params);
- dd($result);
+ // $empDataServiceController = new EmpDataServiceController();
+ // $empDataServiceController->storeEndorsementNumber(23, '00000000000000000560');
}
public function index()
@@ -487,6 +485,7 @@ class ClientController extends AdminController
{
$this->myLogger->logme('error','create Client kyc function called');
$data = $this->request->getPost();
+ // print_r($data); die;
unset($data['file_name']);
$uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
$File = file_Upload($this->request->getFile('file_name'), $uploadFilePath);
@@ -646,11 +645,21 @@ class ClientController extends AdminController
$this->myLogger->logme('error','Client branch CREATE function called');
$data = $this->request->getPost();
+ // var_dump($data); die;
if (!isset($data['sez'])) {
$data['sez'] = 0;
} elseif ($data['sez']) {
$data['sez'] = 1;
}
+
+ $units = json_decode($data['units'], true) ?? [];
+
+ if (!is_array($units) || empty($units)) {
+ $client_data = $this->clientModel->where('id', $data['client_id'])->first();
+ $default_unit = trim(($client_data['short_name'] ?? '') . '-' . ($data['branch_code'] ?? ''), '-');
+ $data['units'] = json_encode([$default_unit]);
+ }
+
$data['created_by'] = get_session_userid();
$insert = $this->clientBranchModel->insert($data);
@@ -704,6 +713,12 @@ class ClientController extends AdminController
$list_of_branch_units = $this->clientBranchModel->find($id);
$units = json_decode($list_of_branch_units['units']);
+
+ if (!is_array($units) || empty($units)) {
+ $client_data = $this->clientModel->where('id', $data['client_id'])->first();
+ $default_unit = trim(($client_data['short_name'] ?? '') . '-' . ($data['branch_code'] ?? ''), '-');
+ $data['units'] = json_encode([$default_unit]);
+ }
if (!empty($units)) {
foreach ($units as $unit) {
@@ -714,6 +729,7 @@ class ClientController extends AdminController
$total_count = $emp_unit_count + $rr_unit_count + $rr_unit_count2;
}
+
$uncommonValues = [];
if ($total_count > 0) {
@@ -739,7 +755,6 @@ class ClientController extends AdminController
}
}
-
if (!isset($data['sez'])) {
$data['sez'] = 0;
} elseif ($data['sez']) {
@@ -1519,6 +1534,78 @@ class ClientController extends AdminController
+ public function uploadVehicleFile()
+ {
+ $this->myLogger->logme('error','uploadVehicleFile function called');
+ $data = $this->request->getPost();
+ $files = $this->request->getFiles();
+ // $data['client_id'] = 12;
+ // $data['vehicle_id'] = 1;
+
+ // upload path
+ $uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
+
+ $insertedDocs = [];
+
+ // Check document names and files
+ if (isset($data['other_docs_name']) && isset($files['file_name'])) {
+ foreach ($data['other_docs_name'] as $key => $docName) {
+ // Get the corresponding file for this document name
+ $file = $files['file_name'][$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 = [
+ 'client_id' => $data['client_id'],
+ 'vehicle_id' => $data['vehicle_id'],
+ 'other_docs_name' => $docName,
+ 'file_name' => $uploadedFileName,
+ 'created_by' => get_session_userid(),
+ ];
+
+ // Insert into database
+ $insert = $this->clientKYCDocsModel->insert($docData);
+
+ if ($insert) {
+ $insertedDocs[] = $docData; // Collect successfully inserted docs
+ }
+ }
+ }
+ }
+
+ if (!empty($insertedDocs)) {
+ // Fetch all documents for the client
+ $vehicleDocs = $this->clientKYCDocsModel
+ ->where('client_id', $data['client_id'])
+ ->where('vehicle_id',$data['vehicle_id'])
+ ->findAll();
+ return $this->respond(['status' => true, 'code' => 200, 'vehicle_docs' => $vehicleDocs, 'inserted_docs' => $insertedDocs], 200);
+ } else {
+ return $this->respond(['status' => false, 'code' => 400, 'message' => 'No documents uploaded or inserted'], 200);
+ }
+ } else {
+ return $this->respond(['status' => false, 'code' => 400, 'message' => 'Invalid data submission'], 200);
+ }
+ }
+
+
+ public function editUploadVehicleFile()
+ {
+
+ }
+
+ public function listVehicleFiles()
+ {
+
+ }
+
+ public function deleteVehicleFiles(){
+
+ }
@@ -3255,6 +3342,55 @@ class ClientController extends AdminController
}
}
+ public function check_policy_no($policy_no)
+ {
+ $uniqueAC = $this->clientPolicyModel
+ ->where('policy_no', $policy_no)
+ ->where('is_active', 1)
+ ->findAll();
+
+ if($uniqueAC != null){
+ return $this->respond(['status' => true, 'message' => 'The Policy Number is Already Exist', 'code' => 200], 200);
+ }else{
+ return $this->respond(['status' => false, 'code' => 404], 200);
+ }
+ }
+
+ public function get_client_policy_data_using_policy_no($policy_no)
+ {
+ $data = $this->clientPolicyModel
+ ->select('client_policy.*, clients.client_type')
+ ->join('clients', 'client_policy.client_id = clients.id')
+ ->where('client_policy.policy_no', $policy_no)
+ ->where('client_policy.is_active', 1)
+ ->first();
+
+ if($data){
+ return $this->respond(['status' => true, 'data'=> $data, 'code' => 200], 200);
+ }else{
+ return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404], 200);
+ }
+ }
+
+ public function get_client_policy_data_using_policy_no_and_endo_no($policy_no, $endorsement_no)
+ {
+ $data = $this->clientPolicyModel
+ ->select('client_policy.*, endorsement.endorsement_type')
+ ->join('endorsement', 'client_policy.id = endorsement.client_policy_id')
+ ->where('client_policy.policy_no', $policy_no)
+ ->where('endorsement.endorsement_no', $endorsement_no)
+ ->where('client_policy.is_active', 1)
+ ->first();
+
+ if($data){
+ return $this->respond(['status' => true, 'data'=> $data, 'code' => 200], 200);
+ }else{
+ return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404], 200);
+ }
+ }
+
+
+
}
\ No newline at end of file
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index fbf60d4e..3fef51e0 100755
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -27,6 +27,7 @@ use App\Models\UserMessageModel;
use App\Models\CDMasterModel;
use App\Models\InsurerExcelExportTemplateModel;
use App\Models\ClientBranchModel;
+use App\Models\EndorsementModel;
use App\Controllers\Jobs;
use App\Controllers\JobWorker;
@@ -58,6 +59,7 @@ class EmpDataServiceController extends BaseController
protected $CDMasterModel;
protected $excelExportTemplateModel;
protected $clientBranchModel;
+ protected $endorsementModel;
public function __construct()
@@ -80,6 +82,7 @@ class EmpDataServiceController extends BaseController
$this->CDMasterModel = new CDMasterModel();
$this->excelExportTemplateModel = new InsurerExcelExportTemplateModel();
$this->clientBranchModel = new ClientBranchModel();
+ $this->endorsementModel = new EndorsementModel();
}
@@ -2145,6 +2148,7 @@ class EmpDataServiceController extends BaseController
$status = $file['status'];
$batch_code = $file['batch_code'];
$user_id = $file['created_by'];
+ $event_type = $file['event_type'];
$status_val = 'success';
@@ -2206,6 +2210,8 @@ class EmpDataServiceController extends BaseController
$this->empEndorsementModel->updateBatch($endorsement_details, 'group_key');
$this->employeePolicyModel->bulkUpdateForCorrection($emp_details);
+ $this->storeEndorsementNumber($file_id, $endorsement_id[0]);
+
// Update batch file status and amount
$this->batchFileModel->update($file_id, [
@@ -2801,6 +2807,8 @@ class EmpDataServiceController extends BaseController
// }
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
+ $this->storeEndorsementNumber($file_id, $endorsement_id);
+
// Update batch file status and amount
$this->batchFileModel->update($file_id, [
@@ -3320,6 +3328,7 @@ class EmpDataServiceController extends BaseController
$this->employeeModel->updateBatch($employees_table_data, 'id');
$this->employeePolicyModel->updateBatch($employee_policy_table_data, 'id');
$this->employeePolicyModel->bulkUpdateForEndorsement($emp_endorsement_table_data);
+ $this->storeEndorsementNumber($file_id, $endorsement_id);
// Update batch file status and amount
$this->batchFileModel->update($file_id, [
@@ -4367,34 +4376,58 @@ class EmpDataServiceController extends BaseController
$this->messageModel->insert($msg_data);
}
- public function updatajson()
- {
-
- // $columns = [
- // ["column_index" => 0, "column_name" => "SR NO", "db_column_name" => 'index'],
- // ["column_index" => 1, "column_name" => "EmployeeId", "db_column_name" => "emp_code"],
- // ["column_index" => 2, "column_name" => "UHID", "db_column_name" => "uhid"],
- // ["column_index" => 3, "column_name" => "DOJ", "db_column_name" => "emp_doj"],
- // ["column_index" => 4, "column_name" => "Name OF Insured", "db_column_name" => "emp_name"],
- // ["column_index" => 5, "column_name" => "Age", "db_column_name" => "emp_age"],
- // ["column_index" => 6, "column_name" => "Gender", "db_column_name" => "emp_gender"],
- // ["column_index" => 7, "column_name" => "DOC", "db_column_name" => null],
- // ["column_index" => 8, "column_name" => "TOTALSI", "db_column_name" => "basic_cover_si"],
- // ["column_index" => 9, "column_name" => "DOS", "db_column_name" => "dateofexit"],
- // ["column_index" => 10, "column_name" => "Mobile", "db_column_name" => 'emp_mobile'],
- // ["column_index" => 11, "column_name" => "EmailID", "db_column_name" => 'emp_email_c'],
- // ["column_index" => 12, "column_name" => "REMARKS", "db_column_name" => "remarks"],
- // ["column_index" => 13, "column_name" => "FLAG STATUS", "db_column_name" => null],
- // ["column_index" => 14, "column_name" => "EXCEPTIONS", "db_column_name" => null],
- // ["column_index" => 15, "column_name" => "ABHA", "db_column_name" => null]
- // ];
-
-
-
-
- // $json = json_encode($columns);
- // $this->excelExportTemplateModel->where('id', 37)->set('jsoncolumns', $json)->update();
+ public function storeEndorsementNumber($file_id, $endorsement_no)
+ {
+ // Log the function entry with input parameters
+ $this->myLogger->logme('error', "storeEndorsementNumber --- Starting function with file_id: $file_id and endorsement_no: $endorsement_no");
+
+ // Log before querying the database
+ $this->myLogger->logme('error', "storeEndorsementNumber --- Fetching file data for file_id: $file_id");
+
+ $filedata = $this->batchFileModel
+ ->select('
+ batch_files.client_id,
+ batch_files.client_policy_id,
+ batch_files.event_type, .
+ batch_files.created_by,
+ client_policy.insurer_id,
+ client_policy.tpa_id
+ ')
+ ->join('client_policy', 'batch_files.client_policy_id = client_policy.id')
+ ->where('batch_files.id', $file_id)
+ ->first();
+ // dd($filedata);
+
+ // Log after fetching data
+ if ($filedata) {
+ $this->myLogger->logme('error', 'File data fetched successfully: ' . json_encode($filedata));
+
+ // Log before inserting data
+ $this->myLogger->logme('error', 'storeEndorsementNumber --- Inserting endorsement data into endorsementModel');
+
+ $this->endorsementModel->insert([
+ 'client_id' => $filedata['client_id'],
+ 'client_policy_id' => $filedata['client_policy_id'],
+ 'insurer_id' => $filedata['insurer_id'],
+ 'tpa_id' => $filedata['tpa_id'],
+ 'endorsement_no' => $endorsement_no,
+ 'endorsement_type' => $filedata['event_type'],
+ 'created_by' => $filedata['created_by'],
+ ]);
+
+ // Log after data insertion
+ $this->myLogger->logme('error', 'storeEndorsementNumber --- Endorsement data inserted successfully for file_id: ' . $file_id);
+ } else {
+ // Log if no file data is found
+ $this->myLogger->logme('error', "storeEndorsementNumber --- No file data found for file_id: $file_id");
+ }
+
+ // Log function exit
+ $this->myLogger->logme('error',"storeEndorsementNumber --- Function execution completed for file_id: $file_id");
}
+
+
+
}
diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php
index 3ac79b39..5412d986 100644
--- a/app/Controllers/PolicyTransactionController.php
+++ b/app/Controllers/PolicyTransactionController.php
@@ -157,7 +157,7 @@ class PolicyTransactionController extends BaseController
->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')
+ ->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')
@@ -264,18 +264,26 @@ class PolicyTransactionController extends BaseController
$pt_co_share_details = $this->insertOrUpdateCoShareDetails($data, $insert);
- $client_policy_insert_data = $this->prepareClientPolicyInsertData($data);
- $client_policy_id = $this->clientPolicyModel->insert($client_policy_insert_data);
- $this->policyTransactionModel->update($insert, ['client_policy_id' => $client_policy_id]);
- $emp_policy_insert = $this->InsertIndividualEmpPolicyTable($emp_data, $client_policy_id);
+ if ($data['ct_type'] == 2) {
- if ($data['status'] == 'completed') {
- $this->processCompletedStatus($data, $client_policy_id, $data['insurer_id']);
+ $client_policy_insert_data = $this->prepareClientPolicyInsertData($data);
+ $client_policy_id = $this->clientPolicyModel->insert($client_policy_insert_data);
+ $this->policyTransactionModel->update($insert, ['client_policy_id' => $client_policy_id]);
+ $emp_policy_insert = $this->InsertIndividualEmpPolicyTable($emp_data, $client_policy_id);
+
+ if ($data['status'] == 'completed') {
+ $this->processCompletedStatus($data, $client_policy_id, $data['insurer_id']);
+ }
}
+
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $insert)->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($insert, "Policy transaction created successfully", $data);
}
return $this->respondError("Failed to create policy transaction");
@@ -294,13 +302,12 @@ class PolicyTransactionController extends BaseController
if (empty($data['client_policy_id']) || $data['client_policy_id'] == 0) {
- $client_policy_insert_data = $this->prepareClientPolicyInsertData($data);
- // print_r($client_policy_insert_data); die;
- $client_policy_id = $this->clientPolicyModel->insert($client_policy_insert_data);
-
- $this->policyTransactionModel->update($id, ['client_policy_id' => $client_policy_id]);
-
- $this->InsertIndividualEmpPolicyTable($emp_data, $client_policy_id);
+ if ($data['ct_type'] == 2) {
+ $client_policy_insert_data = $this->prepareClientPolicyInsertData($data);
+ $client_policy_id = $this->clientPolicyModel->insert($client_policy_insert_data);
+ $this->policyTransactionModel->update($id, ['client_policy_id' => $client_policy_id]);
+ $this->InsertIndividualEmpPolicyTable($emp_data, $client_policy_id);
+ }
} else {
if (isset($data['emp_policy_id']) && !empty($data['emp_policy_id'][0])) {
@@ -308,7 +315,7 @@ class PolicyTransactionController extends BaseController
}
}
- if ($data['status'] == 'completed') {
+ if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
$this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']);
}
@@ -345,27 +352,30 @@ class PolicyTransactionController extends BaseController
'bp_igst' => $data['igst'][$index] ?? 0,
'bp_sgst' => $data['sgst'][$index] ?? 0,
'bp_cgst' => $data['cgst'][$index] ?? 0,
- 'tp_amt' => $data['tp_ter_premium'][$index] ?? 0,
- 'tep_amt' => $data['tp_ter_premium'][$index] ?? 0,
+ 'tp_amt' => $data['tp_premium'][$index] ?? 0,
+ 'tep_amt' => $data['ter_premium'][$index] ?? 0,
'agreed_amt' => $data['agreed_amount'][$index] ?? 0,
'agreed_bp_per' => $data['agreed_bp'][$index] ?? 0,
- 'agreed_tp_per' => $data['agreed_tp_ter'][$index] ?? 0,
- 'agreed_tep_per' => $data['agreed_tp_ter'][$index] ?? 0,
+ 'agreed_tp_per' => $data['agreed_tp'][$index] ?? 0,
+ 'agreed_tep_per' => $data['agreed_ter'][$index] ?? 0,
'standerd_bp_per' => $data['standard_bp'][$index] ?? 0,
'standerd_tp_per' => $data['standard_tp'][$index] ?? 0,
- 'standerd_tep_per' => $data['standard_tep'][$index] ?? 0,
+ 'standerd_tep_per' => $data['standard_ter'][$index] ?? 0,
'actual_bp_amt' => $data['actual_bp_amt'][$index] ?? 0,
'actual_tp_amt' => $data['actual_tp_amt'][$index] ?? 0,
'actual_tep_amt' => $data['actual_tep_amt'][$index] ?? 0,
'actual_bp_per' => $data['actual_bp_per'][$index] ?? 0,
'actual_tp_per' => $data['actual_tp_per'][$index] ?? 0,
'actual_tep_per' => $data['actual_tep_per'][$index] ?? 0,
+ 'actual_bp_brokerage_amt' => $data['actual_bp_brokerage_amt'][$index] ?? 0,
+ 'actual_tp_brokerage_amt' => $data['actual_tp_brokerage_amt'][$index] ?? 0,
+ 'actual_tep_brokerage_amt' => $data['actual_tep_brokerage_amt'][$index] ?? 0,
'exp_amt' => $data['exp_amt'][$index] ?? 0,
'amount' => $data['total'][$index] ?? 0,
'stamp_duty' => $data['stamp_duty'][$index] ?? 0,
'cop_amt' => $data['co_premium'][$index] ?? 0,
'variance' => $data['variance'][$index] ?? 0,
- 'remark' => $data['remark'][$index] ?? null,
+ 'reward' => $data['reward'][$index] ?? null,
'created_by' => get_session_userid() ?? null,
'updated_by' => get_session_userid() ?? null,
'id' => $data['co_share_id'][$index] ?? null, // Assuming this is the ID to identify existing records
@@ -564,6 +574,7 @@ class PolicyTransactionController extends BaseController
policy_transaction.*,
clients.short_name as client_short_name,
clients.client_type,
+ clients.entity_type_id,
policy_type.policy_type,
client_policy.tpa_id as master_tpa_id,
client_policy.tpa_branch_id as master_tpa_branch_id,
@@ -586,7 +597,6 @@ class PolicyTransactionController extends BaseController
$data['updated_at'] = !empty($data['updated_at']) ? date('d-m-Y h:i:s A', strtotime($data['updated_at'])) : null;
// print_r($data); die;
-
$data['renewal_policy'] = $this->clientPolicyModel
->select('client_policy.*, policy_type.policy_type')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
@@ -611,6 +621,11 @@ class PolicyTransactionController extends BaseController
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
->where('employees.client_id', $data['client_id'])
->where('employees.is_active', 1)->findAll();
+ $data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll();
+ $data['vehicle_docs'] = $this->clientKYCDocsModel
+ ->where('client_id', $data['client_id'])
+ ->where('vehicle_id', $data['vehicle_id'])
+ ->findAll();
// print_r( $data['pt_co_share_details']); die;
@@ -819,7 +834,7 @@ class PolicyTransactionController extends BaseController
private function handleCompletedStatus($data, $policy_tran_id)
{
- if ($data['status'] == 'completed') {
+ if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
$tolamt = $data['total'][0];
@@ -964,6 +979,23 @@ class PolicyTransactionController extends BaseController
}
+ public function checkInvoiceStatus($pt_id)
+ {
+ $data = $this->policyTransactionModel
+ ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id')
+ ->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id')
+ ->where('policy_transaction.id', $pt_id)
+ ->where('pt_co_share_details.statement_id IS NOT NULL')
+ ->where('insurer_statements.invoice_no IS NOT NULL')
+ ->countAllResults();
+
+ if($data){
+ return $this->respond(['status' => true, 'count'=> $data, 'code' => 200], 200);
+ }else{
+ return $this->respond(['status' => false, 'count'=> 0, 'message' => 'No Data Found', 'code' => 404], 200);
+ }
+ }
+
//---------------------------------------------------------------------------------------------------
//get BDS Reports data
diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php
index a764697b..ab40178e 100755
--- a/app/Helpers/utility_helper.php
+++ b/app/Helpers/utility_helper.php
@@ -1,5 +1,6 @@
select('team_id')->where('user_id', $user_id)->findAll();
+
+ // Debugging: Log or print the query result to check its structure
+ // var_dump($user_teams); // You can use this temporarily for testing
+ // log_message('info', 'User Teams: ' . json_encode($user_teams)); // Optionally log it
+
+ // Check if the result is not empty
+ if (!empty($user_teams)) {
+ // Extract only the 'team_id' values
+ $team_ids = array_column($user_teams, 'team_id');
+ return $team_ids; // Return array of team IDs
+ } else {
+ return []; // Return empty array if no teams found
+ }
+ }
+}
+
+
+
if (!function_exists('generate_client_code')) {
function generate_client_code($string = 'GC') {
diff --git a/app/Models/ClientKYCDocsModel.php b/app/Models/ClientKYCDocsModel.php
index 6c9f3c8a..55dd4d6a 100755
--- a/app/Models/ClientKYCDocsModel.php
+++ b/app/Models/ClientKYCDocsModel.php
@@ -17,6 +17,7 @@ class ClientKYCDocsModel extends Model
'is_active',
"created_by",
"updated_by",
+ "vehicle_id",
];
public function getKycDocsName($client_id){
diff --git a/app/Models/EndorsementModel.php b/app/Models/EndorsementModel.php
new file mode 100644
index 00000000..22bcec72
--- /dev/null
+++ b/app/Models/EndorsementModel.php
@@ -0,0 +1,30 @@
+
-
-
-
@@ -160,7 +157,7 @@
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
// res = JSON.parse(res)
- // console.log(res);
+ console.log(res);
if(res){
setTimeout(function() {
@@ -219,131 +216,12 @@
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
+ var entity_type_id = '= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>'
+ var client_id = '= isset($client['id']) ? $client['id'] : '' ?>'
+ getKYCEntityDocument(entity_type_id, client_id);
-
- $.ajax({
- url: '= base_url("client/kyc/list/"); ?>' + '= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
- type: "GET",
- dataType: 'json',
- processData: false,
- contentType: false,
- success: function (res) {
-
- setTimeout(function() {
- $('.loader').fadeOut();
- $('.loader-mask').delay(350).fadeOut('slow');
- }, 1000);
-
- var tbody = $('#tbody');
- tbody.empty();
-
- $.each(res.data, function(index, item) {
- var row = `
- | ${item.file_name} |
-
-
- |
- |
-
-
-
- |
-
`;
- tbody.append(row);
- });
-
- },
- error: function (xhr, status, error) {
- console.error(xhr.responseText);
- console.error(status, error);
-
- setTimeout(function() {
- $('.loader').fadeOut();
- $('.loader-mask').delay(350).fadeOut('slow');
- toastr.warning('Something Wrong!', 'warning');
- }, 1000);
- }
- });
-
-
- var table = '';
var data = = isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
-
- // console.log('other documents data', data)
-
-
- $('#other_docs tr').remove();
-
- var other_docs_count = 0;
-
- $.each(data, function(index, item) {
-
- if(item.other_docs_name != ""){
-
- other_docs_count++;
- }
-
- if(item.kyc_doc_type_id == '0'){
- table += `
-
- | ${item.other_docs_name} |
- ${item.file_name} |
-
-
-
- |
-
- `;
-
- }
- });
- $('#other_docs').append(table);
-
- if(other_docs_count > 0){
- $('#others').show()
- $('#other_docs_table').show();
- }
-
-
- $.each(data, function(index, item) {
- // console.log(item.kyc_doc_type_id);
- // console.log('name_' + item.kyc_doc_type_id);
- // console.log(document.getElementById('name_' + item.kyc_doc_type_id));
- setTimeout(function() {
- $('#name_'+item.kyc_doc_type_id).show();
- $('#name_'+item.kyc_doc_type_id).html(item.file_name);
- $('#form_'+item.kyc_doc_type_id).hide();
-
- // 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);
- $('#delete_'+item.kyc_doc_type_id).show();
- }
- else{
- // console.log('step 3')
-
- $('#download_'+item.kyc_doc_type_id).hide();
- $('#download_' + item.kyc_doc_type_id).attr('href', '#');
- $('#delete_'+item.kyc_doc_type_id).hide();
-
-
- }
- // console.log('step 4')
-
- }, 1000);
-
- });
-
+ appendKycTableListData(data)
}
@@ -355,7 +233,6 @@
$('#other_docs_table').toggle();
});
-
/*** for Others documents form submit ***/
$("#kyc_form").submit(function(event) {
event.preventDefault();
@@ -447,7 +324,6 @@
}
});
-
$('body').on('click', '.btnKycDelete', function () {
Swal.fire({
@@ -474,7 +350,6 @@
});
});
-
$('body').on('click', '.btnKycOtherDelete', function () {
Swal.fire({
@@ -499,5 +374,134 @@
});
});
-
+ function getKYCEntityDocument(entity_type_id, client_id){
+
+ $.ajax({
+ url: '= base_url("client/kyc/list/"); ?>' + entity_type_id,
+ type: "GET",
+ dataType: 'json',
+ processData: false,
+ contentType: false,
+ success: function (res) {
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
+
+ var tbody = $('#tbody');
+ tbody.empty();
+
+ $.each(res.data, function(index, item) {
+ var row = `
+ | ${item.file_name} |
+
+
+ |
+ |
+
+
+
+ |
+
`;
+ tbody.append(row);
+ });
+
+ },
+ error: function (xhr, status, error) {
+ console.error(xhr.responseText);
+ console.error(status, error);
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something Wrong!', 'warning');
+ }, 1000);
+ }
+ });
+
+ }
+
+ function appendKycTableListData(data){
+
+ console.log('-----------------------------------------------------------')
+ console.log('appendKycTableListData function called')
+ console.log('-----------------------------------------------------------')
+
+ var table = '';
+
+ $('#other_docs tr').remove();
+
+ var other_docs_count = 0;
+
+ $.each(data, function(index, item) {
+
+ if(item.other_docs_name != ""){
+
+ other_docs_count++;
+ }
+
+ if(item.kyc_doc_type_id == '0'){
+ table += `
+
+ | ${item.other_docs_name} |
+ ${item.file_name} |
+
+
+
+ |
+
+ `;
+
+ }
+ });
+
+ $('#other_docs').append(table);
+
+ if(other_docs_count > 0){
+ $('#others').show()
+ $('#other_docs_table').show();
+ }
+
+ $.each(data, function(index, item) {
+ // console.log(item.kyc_doc_type_id);
+ // console.log('name_' + item.kyc_doc_type_id);
+ // console.log(document.getElementById('name_' + item.kyc_doc_type_id));
+ setTimeout(function() {
+ $('#name_'+item.kyc_doc_type_id).show();
+ $('#name_'+item.kyc_doc_type_id).html(item.file_name);
+ $('#form_'+item.kyc_doc_type_id).hide();
+
+ // 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);
+ $('#delete_'+item.kyc_doc_type_id).show();
+ }
+ else{
+ // console.log('step 3')
+
+ $('#download_'+item.kyc_doc_type_id).hide();
+ $('#download_' + item.kyc_doc_type_id).attr('href', '#');
+ $('#delete_'+item.kyc_doc_type_id).hide();
+
+
+ }
+ // console.log('step 4')
+
+ }, 1000);
+
+ });
+
+ }
+
\ No newline at end of file
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index 347ce14a..bdf9dc8a 100755
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -1695,4 +1695,33 @@
});
}
+
+ $('#policy_no').change(function(){
+
+ var policy_no = $(this).val();
+ console.log(policy_no +'-'+policy_no.length);
+ policy_no = policy_no.trim();
+ console.log(policy_no +'-'+policy_no.length);
+
+
+ $.ajax({
+ url: ''+policy_no,
+ type: "GET",
+ dataType: 'json',
+ success: function (res) {
+
+ console.log(res)
+ if(res.status == true){
+ toastr.warning(res.message, 'warning');
+ $('#policy_no').val('');
+ }
+ },
+ error: function (xhr, status, error) {
+ console.error(xhr.responseText);
+ console.error(status, error);
+ }
+ });
+
+ })
+
\ No newline at end of file
diff --git a/app/Views/layout/footer.php b/app/Views/layout/footer.php
index 22f12861..39b2f769 100755
--- a/app/Views/layout/footer.php
+++ b/app/Views/layout/footer.php
@@ -142,6 +142,8 @@
+
+
\ No newline at end of file
diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php
index 8478f296..830f983e 100644
--- a/app/Views/policy_transaction_endorsement_form.php
+++ b/app/Views/policy_transaction_endorsement_form.php
@@ -89,6 +89,8 @@
+
+
@@ -200,8 +202,8 @@
-
-
+
+
@@ -215,12 +217,12 @@
-
-
+
+
-
+
@@ -228,7 +230,7 @@
-
+ count
@@ -267,10 +269,10 @@
-
-
+
@@ -284,64 +286,109 @@
| Premium Details |
-
-
+
| Insurer |
-
-
+
| Is Leader? |
-
+
| Co-Share % |
-
+
| Base Premium |
-
+
| TP Premium |
-
+
+ | TEP Premium |
+
+
| Co-Premium |
-
+
| CGST |
-
+
| SGST |
-
+
| IGST |
-
+
| GST Amount |
-
+
| Stamp Duty |
-
+
| Total |
-
+
| Agreed BP % |
-
+
| Agreed TP % |
-
+
+ | Agreed TEP % |
+
+
+
+
| Agreed Amount |
-
+
| Standard BP % |
-
- | Standard TP % |
+
+ | Standard TP % |
-
- | id |
+
+ | Standard TEP % |
+
+
+ | Actual BP Amount |
+
+
+ | Actual TP Amount |
+
+
+ | Actual TEP Amount |
+
+
+ | Actual BP % |
+
+
+ | Actual TP % |
+
+
+ | Actual TEP % |
+
+
+ | Actual BP Brokerage Amount |
+
+
+ | Actual TP Brokerage Amount |
+
+
+ | Actual TEP Brokerage Amount |
+
+
+ | Expected Amount |
+
+
+ | Variance |
+
+
+ | Reward |
+
+
+ |
@@ -360,7 +407,7 @@
-
+
@@ -442,6 +489,8 @@ $(document).ready(function(){
$('#policy_start_date').val(start_date);
$('#policy_end_date').val(end_date);
+ removeAllColumnsExceptFirst('insurerTable');
+
if(!policy_tranction_primarykey && client_id && client_policy_id){
form_action = '= base_url("util/getPTCOShareCount/"); ?>' + client_id + '/' + client_policy_id;
@@ -687,14 +736,49 @@ $('#client_type').on('change', function() {
$('#client_id').select2();
});
+$('#endorsement_no').on('change', function(){
+
+ var policy_no = $('#policy_no').val();
+ console.log(policy_no +'-'+policy_no.length);
+ policy_no = policy_no.trim();
+ console.log(policy_no +'-'+policy_no.length);
+
+ var endorsement_no = $(this).val();
+ console.log(endorsement_no +'-'+endorsement_no.length);
+ endorsement_no = endorsement_no.trim();
+ console.log(endorsement_no +'-'+endorsement_no.length);
+
+ if(policy_no && endorsement_no){
+ $.ajax({
+ url: ''+ policy_no + '/' + endorsement_no,
+ type: "GET",
+ dataType: 'json',
+ success: function (res) {
+
+ console.log(res)
+ if(res.status == true){
+ $('#ct_type').val(1)
+ }else{
+ $('#ct_type').val(2)
+ console.log(res.message, 'warning');
+ }
+ },
+ error: function (xhr, status, error) {
+ console.error(xhr.responseText);
+ console.error(status, error);
+ }
+ });
+ }
+
+})
//---------------------------------------------------------------------------------------------------------
//edit function
function getPolicyTransactionDataForEndorsementEdit(input){
+
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
-
$('#endorsement_form_id')[0].reset();
var id = $(input).attr('data-id');
@@ -758,21 +842,38 @@ function getPolicyTransactionDataForEndorsementEdit(input){
console.error(status, error);
}
});
+
+ checkInvoiceStatusToHideSubmitBtn(id)
+
}
//end edit function
function amountCalculation(input) {
- console.log(input);
+ // console.log(input);
+ let selectedOption = $('#policy_type_id').find('option:selected');
+ let bap = selectedOption.data('bap');
+
// Retrieve and parse the values or default to 0 if not a number
let bp = parseFloat($('#base_premium_' + input).val()) || 0;
- let tp = parseFloat($('#tp_ter_premium_' + input).val()) || 0;
+
+ var tp = 0;
+ if(bap == 'Motor'){
+ tp = parseFloat($('#tp_premium_' + input).val()) || 0;
+ }
+
+ var tep = 0;
+ if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
+ tep = parseFloat($('#ter_premium_' + input).val()) || 0;
+ }
+
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
let igst = parseFloat($('#igst_' + input).val()) || 0;
let stamp_duty_amt = parseFloat($('#stamp_duty_' + input).val()) || 0;
+ let agreed_amount = parseFloat($('#agreed_amount_' + input).val()) || 0;
// Calculate GST percentage
let gst_per = igst;
@@ -781,16 +882,137 @@ function amountCalculation(input) {
}
// Calculate the total premium (Base + TP + Co-Premium)
- let tpTotal = bp + tp + cop;
+ let tpTotal = bp + tp + tep + cop;
let gst_per_amt = (tpTotal * gst_per) / 100;
$('#gst_amount_' + input).val(gst_per_amt.toFixed(2));
let finalTotal = tpTotal + gst_per_amt + stamp_duty_amt;
- console.log('Summed Amount:', finalTotal);
+ // console.log('Summed Amount:', finalTotal);
$('#total_amt_' + input).val(finalTotal.toFixed(2));
+
+ var expectedAmount = 0;
+
+ if(agreed_amount != 0 || agreed_amount != ""){
+ expectedAmount = agreed_amount;
+ }else{
+ expectedAmount = bp + tp + tep;
+ }
+
+ //Expected Amount
+ $('#exp_amt_' + input).val(expectedAmount.toFixed(2));
+
+ let actual_bp_brokerage_amount = $('#actual_bp_brokerage_amt_' + input).val();
+ let actual_tp_brokerage_amount = $('#actual_tp_brokerage_amt_' + input).val();
+ let actual_tep_brokerage_amount = $('#actual_tep_brokerage_amt_' + input).val();
+
+ let variance = expectedAmount - (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount)
+
+ $('#variance_' + input).val(variance.toFixed(2));
+
+ console.log('expectedAmount', expectedAmount);
+ console.log('variance', variance);
+}
+
+function actualAmountCalculation(input){
+
+ let selectedOption = $('#policy_type_id').find('option:selected');
+ let bap = selectedOption.data('bap');
+
+
+ let actual_bp_amt = parseFloat($('#actual_bp_amt_' + input).val()) || 0;
+ let actual_tp_amt = parseFloat($('#actual_tp_amt_' + input).val()) || 0;
+ let actual_tep_amt = parseFloat($('#actual_tep_amt_' + input).val()) || 0;
+ let actual_bp_per = parseFloat($('#actual_bp_per_' + input).val()) || 0;
+ let actual_tp_per = parseFloat($('#actual_tp_per_' + input).val()) || 0;
+ let actual_tep_per = parseFloat($('#actual_tep_per_' + input).val()) || 0;
+ let actual_bp_brokerage_amt = parseFloat($('#actual_bp_brokerage_amt_' + input).val()) || 0;
+ let actual_tp_brokerage_amt = parseFloat($('#actual_tp_brokerage_amt_' + input).val()) || 0;
+ let actual_tep_brokerage_amt = parseFloat($('#actual_tep_brokerage_amt_' + input).val()) || 0;
+
+ //------------------------------------------------------------------------------------------
+
+ let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
+ let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
+
+ if(actual_bp_brokerage_amt == 0 || actual_bp_brokerage_amt == 0.00 || actual_bp_brokerage_amt == ""){
+ $('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
+ }
+
+ if(actual_bp_per == 0 || actual_bp_per == 0.00 || actual_bp_per == ""){
+ $('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
+ }
+
+ console.log('actual_bp_brokerage_amount', actual_bp_brokerage_amount);
+ console.log('actual_bp_percentage', actual_bp_percentage);
+
+ //-----------------------------------------------------------------------------------------
+
+ var actual_tp_brokerage_amount = 0;
+ var actual_tp_percentage = 0;
+
+ if(bap == 'Motor'){
+
+ actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
+ actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
+
+ if(actual_tp_brokerage_amt == 0 || actual_tp_brokerage_amt == ""){
+ $('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
+ }
+
+ if(actual_tp_per == 0 || actual_tp_per == ""){
+ $('#actual_tp_per_' + input).val(actual_bp_percentage.toFixed(2));
+ }
+
+ console.log('actual_tp_brokerage_amount', actual_tp_brokerage_amount);
+ console.log('actual_tp_percentage', actual_tp_percentage);
+ }else{
+
+ $('#actual_tp_brokerage_amt_' + input).val(0);
+ $('#actual_tp_per_' + input).val(0);
+ }
+
+ //-----------------------------------------------------------------------------------------
+
+ var actual_tep_brokerage_amount = 0;
+ var actual_tep_percentage = 0;
+
+ if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
+
+ actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
+ actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
+
+ if(actual_tep_brokerage_amt == 0 || actual_tep_brokerage_amt == ""){
+ $('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
+ }
+
+ if(actual_tep_per == 0 || actual_tp_per == ""){
+ $('#actual_tep_per_' + input).val(actual_bep_percentage.toFixed(2));
+ }
+
+ console.log('actual_tep_brokerage_amount', actual_tep_brokerage_amount);
+ console.log('actual_tep_percentage', actual_tep_percentage);
+
+ }else{
+
+ $('#actual_tep_brokerage_amt_' + input).val(0);
+ $('#actual_tep_per_' + input).val(0);
+ }
+
+ //-----------------------------------------------------------------------------------------
+
+ let expectedAmount = parseFloat($('#exp_amt_' + input).val()) || 0;
+ var actual_bp_brokerage_amount2 = parseFloat($('#actual_bp_brokerage_amt_' + input).val()) || 0;
+ let actual_tp_brokerage_amount2 = parseFloat($('#actual_tp_brokerage_amt_' + input).val()) || 0;
+ let actual_tep_brokerage_amount2 = parseFloat($('#actual_tep_brokerage_amt_' + input).val()) || 0;
+ let variance = expectedAmount - (actual_bp_brokerage_amount2 + actual_tp_brokerage_amount2 + actual_tep_brokerage_amount2)
+
+ $('#variance_' + input).val(variance.toFixed(2));
+
+ console.log('expectedAmount', expectedAmount);
+ console.log('variance', variance);
}
function validateRange(input) {
@@ -798,6 +1020,35 @@ function validateRange(input) {
if (input.value > 100) input.value = 100;
}
+function checkInvoiceStatusToHideSubmitBtn(id){
+
+ $.ajax({
+ url: ''+ id,
+ type: "GET",
+ dataType: 'json',
+ success: function (res) {
+
+ console.log(res)
+ if(res.status == true){
+
+ if(res.count > 0){
+ $('#submitButton').hide()
+ }else{
+ $('#submitButton').show()
+ }
+
+ }else{
+ console.log(res.message, 'warning');
+ }
+ },
+ error: function (xhr, status, error) {
+ console.error(xhr.responseText);
+ console.error(status, error);
+ }
+ });
+
+}
+
//---------------------------------------------------------------------------------------------------------
var insurerCount = 0;
@@ -816,9 +1067,6 @@ $('#setInsurerCount').on('input', function() {
function addInsurerColumn() {
insurerCount++;
-
- console.log('------------------------------------------------------------------------------')
- console.log('addInsurerColumn', insurerCount, 'time called')
// Update header
$('#insurerTable thead tr').append(`
@@ -828,6 +1076,7 @@ function addInsurerColumn() {
`);
+
// Add a new column for each data row
$('#insurerTable tbody tr').each(function(index) {
let newCell = '';
@@ -835,123 +1084,163 @@ function addInsurerColumn() {
switch(index) {
case 0: // Insurer selection
newCell = `
-
- | `;
+
+ `;
break;
case 1: // Is Leader?
newCell = `
-
-
+
+
| `;
break;
case 2: // Co-Share %
- newCell = `
| `;
+ newCell = `
| `;
break;
case 3: // Base Premium
- newCell = `
| `;
+ newCell = `
| `;
break;
- case 4: // TP / Ter Premium
- newCell = `
| `;
+ case 4: // TP Premium
+ newCell = `
| `;
break;
- case 5: // Co Premium
- newCell = `
| `;
+ case 5: // Ter Premium
+ newCell = `
| `;
break;
- case 6: // CGST
- newCell = `
| `;
+ case 6: // co Premium
+ newCell = `
| `;
break;
- case 7: // SGST
- newCell = `
| `;
+ case 7: // CGST
+ newCell = `
| `;
break;
- case 8: // IGST
- newCell = `
| `;
+ case 8: // SGST
+ newCell = `
| `;
break;
- case 9: // GST Amount
- newCell = `
| `;
+ case 9: // IGST
+ newCell = `
| `;
break;
- case 10: // Stamp Duty
- newCell = `
| `;
+ case 10: // GST Amount
+ newCell = `
| `;
break;
- case 11: // Total
- newCell = `
| `;
+ case 11: // Stamp Duty
+ newCell = `
| `;
break;
- case 12: // Agreed BP %
- newCell = `
| `;
+ case 12: // Total
+ newCell = `
| `;
break;
- case 13: // Agreed TP / Ter %
- newCell = `
| `;
+ case 13: // Agreed BP %
+ newCell = `
| `;
break;
- case 14: // Agreed Amount
- newCell = `
| `;
+ case 14: // Agreed TP %
+ newCell = `
| `;
break;
- case 15: // Standard BP %
+ case 15: // Agreed Ter %
+ newCell = `
| `;
+ break;
+ case 16: // Agreed Amount
+ newCell = `
| `;
+ break;
+ case 17: // Standard BP %
newCell = `
| `;
break;
+ case 18: // Standard TP %
+ newCell = `
| `;
+ break;
+ case 19: // Standard Ter %
+ newCell = `
| `;
+ break;
+ case 20: // Actual BP Amount
+ newCell = `
| `;
+ break;
+ case 21: // Actual TP Amount
+ newCell = `
| `;
+ break;
+ case 22: // Actual TEP Amount
+ newCell = `
| `;
+ break;
+ case 23: // Actual BP %
+ newCell = `
| `;
+ break;
+ case 24: // Actual TP %
+ newCell = `
| `;
+ break;
+ case 25: // Actual TEP %
+ newCell = `
| `;
+ break;
+ case 26: // Actual BP Brokerage Amount
+ newCell = `
| `;
+ break;
+ case 27: // Actual TP Brokerage Amount
+ newCell = `
| `;
+ break;
+ case 28: // Actual TEP Brokerage Amount
+ newCell = `
| `;
+ break;
+ case 29: // Expected Amount
+ newCell = `
| `;
+ break;
+ case 30: // Variance
+ newCell = `
| `;
+ break;
+ case 31: // Reward
+ newCell = `
| `;
+ break;
+ case 32: // ID For Update
+ newCell = `
| `;
+ break;
- case 16: // Standard TP %
- newCell = `
| `;
- newCell += `
| `;
- break;
- case 17: // id
- newCell = `
| `;
- break;
}
- // Append new cell to the current row
$(this).append(newCell);
- // Initialize select2 for newly added insurer select dropdown
- $('#follow_insurer_id_' + insurerCount).select2();
+ $('#follow_insurer_id_' + insurerCount).select2()
- // Get selected policy type data
- const selectedOption = $('#policy_type_id').find('option:selected');
- const bap = selectedOption.data('bap');
+ var selectedOption = $('#policy_type_id').find('option:selected');
- // Update column headers and visibility based on policy type
- if (bap === 'Fire' || bap === 'Marine Cargo' || bap === 'Marine Hull') {
- $('#tp_premium_td').text('Ter Premium');
- $('#agree_tp_td').text('Agreed Ter %');
- $('#std_head').text('Standard Ter %');
- $('.std_ter_td').show();
- $('.std_tp_td').hide();
- } else {
- $('#tp_premium_td').text('TP Premium');
- $('#agree_tp_td').text('Agreed TP %');
- $('#std_head').text('Standard TP %');
- $('.std_ter_td').hide();
- $('.std_tp_td').show();
+ var ebp = selectedOption.data('ebp');
+ var etp = selectedOption.data('etp');
+ var etep = selectedOption.data('etep');
+ var iep = selectedOption.data('iep');
+ var itp = selectedOption.data('itp');
+ var itep = selectedOption.data('itep');
+
+ var bap = selectedOption.data('bap');
+
+
+ if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
+ $('.hideter').show();
+ $('.hidetp').hide();
+ }else{
+ if(bap == 'Motor'){
+ $('.hidetp').show()
+ $('.hideter').hide()
+ }else{
+ $('.hideter').hide()
+ $('.hidetp').hide()
+ }
}
- // Hide TP premium row for Motor policy type
- if (bap === 'Motor') {
- $('#tp_premium_tr').hide();
- } else {
- $('#tp_premium_tr').show();
- }
- // Set standard values
- $('#standard_bp_' + insurerCount).val(selectedOption.data('ebp'));
- // $('[name="standard_bp[]"]').val(selectedOption.data('ebp'));
- $('[name="standard_tp[]"]').val(selectedOption.data('etp'));
- $('[name="standard_tep[]"]').val(selectedOption.data('etep'));
+ $('#standard_bp_').val(ebp);
+ // $('[name="standard_bp[]"]').val(ebp);
+ $('[name="standard_tp[]"]').val(etp);
+ $('[name="standard_tep[]"]').val(etep);
- // Set 'follow_insurer' to required if more than 1 column exists
- if (insurerCount > 1) {
+ if(insurerCount > 1){
$('.follow_insurer').prop('required', true);
- } else {
+ }else{
$('.follow_insurer').prop('required', false);
}
- });
+ });
// Add click event for delete button
$('.delete-insurer').off('click').on('click', function() {
@@ -996,15 +1285,14 @@ function removeAllColumnsExceptFirst(tableId) {
function populateTable(dataArray, status = false) {
dataArray.forEach((data, index) => {
// Add a new insurer column for each entry in the data array
- addInsurerColumn(); // Assuming this function adds a new column dynamically
+ addInsurerColumn(); // This will add a new column dynamically
// Populate the fields with the provided data
$('#insurerTable tbody tr').each(function(rowIndex, row) {
- const cell = $(row).find('td').eq(insurerCount); // Ensure insurerCount is correctly set or incremented
+ const cell = $(row).find('td').eq(insurerCount); // Get the newly added column by `insurerCount`
- // Split insurer id and branch id properly
let insurer = data.insurer_branch_id + '-' + data.insurer_id;
-
+
switch (rowIndex) {
case 0: // Insurer selection
cell.find('select').val(insurer).prop('disabled', true).select2();
@@ -1018,56 +1306,95 @@ function populateTable(dataArray, status = false) {
case 3: // Base Premium
cell.find('input').val(status ? data.bp_amt : '');
break;
- case 4: // TP / Ter Premium
+ case 4: // TP Premium
cell.find('input').val(status ? data.tp_amt : '');
break;
- case 5: // Co Premium
+ case 5: // Ter Premium
+ cell.find('input').val(status ? data.tep_amt : '');
+ break;
+ case 6: // Co Premium
cell.find('input').val(data.cop_amt);
break;
- case 6: // CGST
+ case 7: // CGST
cell.find('input').val(data.bp_cgst);
break;
- case 7: // SGST
+ case 8: // SGST
cell.find('input').val(data.bp_sgst);
break;
- case 8: // IGST
+ case 9: // IGST
cell.find('input').val(data.bp_igst);
break;
- case 9: // GST Amount
+ case 10: // GST Amount
cell.find('input').val(status ? data.bp_gst_amt : '');
break;
- case 10: // Stamp Duty
+ case 11: // Stamp Duty
cell.find('input').val(status ? data.stamp_duty : '');
break;
- case 11: // Total
+ case 12: // Total
cell.find('input').val(status ? data.amount : '');
break;
- case 12: // Agreed BP %
+ case 13: // Agreed BP %
cell.find('input').val(data.agreed_bp_per);
break;
- case 13: // Agreed TP / Ter %
+ case 14: // Agreed TP %
cell.find('input').val(data.agreed_tp_per);
break;
- case 14: // Agreed Amount
+ case 15: // Agreed Ter %
+ cell.find('input').val(data.agreed_tep_per);
+ break;
+ case 16: // Agreed Amount
cell.find('input').val(data.agreed_amt);
break;
- case 15: // Standard BP %
+ case 17: // Standard BP %
cell.find('input').val(data.standerd_bp_per);
break;
- case 16: // Standard TP / Ter %
- if (data.standerd_tp_per) {
- $(this).find('.std_tp_td input').val(data.standerd_tp_per);
- } else {
- $(this).find('.std_ter_td input').val(data.standerd_tp_per);
- }
+ case 18: // Standard TP %
+ cell.find('input').val(data.standerd_tp_per);
break;
- case 17: // id
- cell.find('input').val(status ? data.id : '');
+ case 19: // Standard Ter %
+ cell.find('input').val(data.standerd_tep_per);
+ break;
+ case 20: // Actual BP Amount
+ cell.find('input').val(data.actual_bp_amt);
+ break;
+ case 21: // Actual TP Amount
+ cell.find('input').val(data.actual_tp_amt);
+ break;
+ case 22: // Actual Ter Amount
+ cell.find('input').val(data.actual_tep_amt);
+ break;
+ case 23: // Actual BP %
+ cell.find('input').val(data.actual_bp_per);
+ break;
+ case 24: // Actual TP %
+ cell.find('input').val(data.actual_tp_per);
+ break;
+ case 25: // Actual Ter %
+ cell.find('input').val(data.actual_tep_per);
+ break;
+ case 26: // Actual BP Brokerage Amount
+ cell.find('input').val(data.actual_bp_brokerage_amt);
+ break;
+ case 27: // Actual TP Brokerage Amount
+ cell.find('input').val(data.actual_tp_brokerage_amt);
+ break;
+ case 28: // Actual Ter Brokerage Amount
+ cell.find('input').val(data.actual_tep_brokerage_amt);
+ break;
+ case 29: // Expected Amount
+ cell.find('input').val(data.exp_amt);
+ break;
+ case 30: // Variance
+ cell.find('input').val(data.variance);
+ break;
+ case 31: // Reward
+ cell.find('input').val(data.reward);
+ break;
+ case 32: // Co-share ID (hidden field)
+ cell.find('input[type="hidden"]').val(data.id);
break;
}
});
});
}
-
-
\ No newline at end of file
diff --git a/app/Views/policy_transaction_endorsement_list.php b/app/Views/policy_transaction_endorsement_list.php
index aea58180..5b83f818 100644
--- a/app/Views/policy_transaction_endorsement_list.php
+++ b/app/Views/policy_transaction_endorsement_list.php
@@ -52,11 +52,7 @@ table.dataTable thead th {
Endorsement List
-
-
-
-
-
@@ -64,7 +60,6 @@ table.dataTable thead th {
- |
Issuer |
Client |
Branch |
@@ -83,7 +78,6 @@ table.dataTable thead th {
- |
|
|
|
@@ -118,54 +112,6 @@ table.dataTable thead th {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php
index 84dbad89..271af57c 100644
--- a/app/Views/policy_transaction_inception_list.php
+++ b/app/Views/policy_transaction_inception_list.php
@@ -113,11 +113,8 @@ table.dataTable tbody td {
Policy List
-
-
-
-
@@ -125,7 +122,6 @@ table.dataTable tbody td {
- |
Issuer |
Issuing Type |
Client Type |
@@ -146,7 +142,6 @@ table.dataTable tbody td {
- |
|
|
|
@@ -235,55 +230,6 @@ table.dataTable tbody td {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -323,6 +269,7 @@ var count = 0
//for disable all field if client and client branch is empty
$(document).ready(function() {
+
function checkAndDisableFields() {
var clientId = $('#client_id').val();
var clientBranchId = $('#client_branch_id').val();
@@ -355,6 +302,7 @@ $(document).ready(function(){
getClientAndBranchAndPolicy()
addHTMLInput();
+ addHTMLInputForVehicleFileUpload()
has('create_failed')) : ?>
toastr.error('= session()->getFlashdata('create_failed') ?>', 'Failed');
@@ -391,7 +339,7 @@ $(document).ready(function() {
if (ticketsTable.length) {
ticketsTable.DataTable({
- dom: "<'row'<'col-sm-6'f><'col-sm-3 text-right'B>>" + // Filter left, buttons right
+ dom: "<'row'<'col-sm-6'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{
@@ -790,6 +738,9 @@ function removeHTMLInput(element)
function appendBasePolicyList(data, select = null)
{
+ console.log('---------------------------------------------------------------')
+ console.log('first')
+ console.log('---------------------------------------------------------------')
$('#base_policy').empty();
$('#base_policy').append($('