Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
31820249f9
@ -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");
|
||||
});
|
||||
|
||||
|
||||
@ -322,16 +333,26 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("upload", "PolicyTransactionController::uploadInsurerStatement");
|
||||
$routes->get("getPaymentDetails/(:any)", "PolicyTransactionController::getInvoicePaymentDetails/$1");
|
||||
$routes->post("saveInvoicePaymentDetails", "PolicyTransactionController::saveInvoicePaymentDetails");
|
||||
$routes->get("deletePaymentEntry/(:any)", "PolicyTransactionController::deletePaymentEntry/$1");
|
||||
$routes->get("downloadSampleInsurerStatement", "PolicyTransactionController::downloadSampleInsurerStatement");
|
||||
$routes->get("getFileErr/(:any)", "PolicyTransactionController::getFileErr/$1");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$routes->get("driveListFiles", "GoogleDriveController::listFiles");
|
||||
$routes->post('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
||||
$routes->get('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
||||
$routes->get('downloadGdriveFile', 'GoogleDriveController::downloadGdriveFile', ['filter' => 'authMVC']);
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||
$routes->cli('cli/enrollment_status', 'JobWorker::enrollment_status');
|
||||
|
||||
$routes->get("processjob", "JobWorker::processJob");
|
||||
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
|
||||
$routes->cli('cli/send_mail_cli', 'MasterController::testGmailAPIViaCLI');
|
||||
$routes->cli('cli/send_mail_cli(/:any)?', 'MasterController::testGmailAPIViaCLI$1');
|
||||
$routes->cli('cli/app_check_list', 'MasterController::appCheckList');
|
||||
$routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ use CodeIgniter\Config\BaseService;
|
||||
use App\Libraries\Slug;
|
||||
use App\Libraries\MyLogger;
|
||||
use App\Libraries\GmailAPI;
|
||||
use App\Libraries\MyGoogleDrive;
|
||||
use App\Libraries\DataServiceSqlite;
|
||||
use App\Controllers\Home;
|
||||
|
||||
@ -70,5 +71,14 @@ class Services extends BaseService
|
||||
|
||||
return new GmailAPI();
|
||||
}
|
||||
|
||||
public static function myGoogleDrive($getShared = true)
|
||||
{
|
||||
if ($getShared) {
|
||||
return static::getSharedInstance('myGoogleDrive');
|
||||
}
|
||||
|
||||
return new MyGoogleDrive();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
355
app/Controllers/GoogleDriveController.php
Normal file
355
app/Controllers/GoogleDriveController.php
Normal file
@ -0,0 +1,355 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
|
||||
use Google_Service_Drive_DriveFile;
|
||||
use Kint;
|
||||
class GoogleDriveController extends BaseController
|
||||
{
|
||||
|
||||
protected $clientModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $googleDrive;
|
||||
protected $driveService;
|
||||
protected $cache;
|
||||
public function __construct()
|
||||
{
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->googleDrive = \Config\Services::myGoogleDrive();
|
||||
$this->driveService = $this->googleDrive->getDriveService();
|
||||
$this->cache = \Config\Services::cache(); // Load the cache service
|
||||
}
|
||||
public function listFiles()
|
||||
{
|
||||
// dd($this->getClientFolderIds(client_id : 18));
|
||||
$file_path = WRITEPATH.'uploads/client_kyc_documents/nhance_bpf.pdf';
|
||||
// dd($file_path);
|
||||
// dd($this->uploadFiletoGdrive(client_id : 18,doc_type:'KYC',file_path:$file_path,file_name:"dummy.pdf"));
|
||||
dd( $this->uploadFiletoGdrive(client_id: 12, doc_type: 'KYC', file_path: $file_path, file_name: "dummy.pdf"));
|
||||
|
||||
$session = \Config\Services::session();
|
||||
$fileName = $request->getVar('filename');
|
||||
$fileType = $request->getVar('filetype');
|
||||
$userAccess = $session->get('userEmail');
|
||||
$parentFolderID = '1M0GH3GbNUOYZLNeHXA5U7C_P2NSx7F7O';
|
||||
$searchQuery = '';//"'your-folder-id' in parents"
|
||||
|
||||
|
||||
try {
|
||||
|
||||
// $driveService = $this->googleDrive->getDriveService();
|
||||
$searchQuery = "name contains 'test' and 'vitvelz@gmail.com' in readers";
|
||||
// Query to list files
|
||||
$response = $this->driveService->files->listFiles([
|
||||
'q' => $searchQuery,
|
||||
'supportsAllDrives' => true,
|
||||
'includeItemsFromAllDrives' => true,
|
||||
'fields' => 'nextPageToken, files(id, name, mimeType, size, createdTime, modifiedTime, owners, shared, permissions, webViewLink, thumbnailLink)',
|
||||
'pageSize' => 20,
|
||||
]);
|
||||
|
||||
$files = $response->getFiles();
|
||||
if (empty($files)) {
|
||||
echo "No files found.";
|
||||
} else {
|
||||
foreach ($files as $file) {
|
||||
echo "File Name: " . $file->getName() . " | File ID: " . $file->getId() . "<br>";
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setStatusCode(500)->setBody($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//by file id
|
||||
public function downloadFile(string $fileId = '',string $fileName = '',string $mimeType = '',string $fileSize = '')
|
||||
{
|
||||
// dd($fileName);
|
||||
try {
|
||||
if($fileName == '' && $mimeType == '')
|
||||
{
|
||||
// Get file metadata
|
||||
$file = $this->driveService->files->get($fileId, ['fields' => 'name, mimeType,size']);
|
||||
$fileName = $file->getName();
|
||||
$mimeType = $file->getMimeType();
|
||||
$fileSize = $file->getSize();
|
||||
}
|
||||
|
||||
// Download the file content from Google Drive
|
||||
$response = $this->driveService->files->get($fileId, ['alt' => 'media']);
|
||||
|
||||
$fileContent = $response->getBody()->getContents();
|
||||
// dd($fileContent);
|
||||
$temp_file_name = WRITEPATH.'/tmp/'.date('YmdHis');
|
||||
$this->cache->save('temp_gdrive_file', $temp_file_name, 300);
|
||||
file_put_contents( $temp_file_name, $fileContent );
|
||||
// Use CodeIgniter helper for downloading the file
|
||||
return $this->response->download($temp_file_name, null)->setFileName($fileName);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setStatusCode(500)->setBody($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function generateNewGoogleDriveAccessToken()
|
||||
{
|
||||
$this->driveService->generateNewToken();
|
||||
}
|
||||
|
||||
public function getClientFolderIds(int $client_id = 0,int $client_policy_id = 0)
|
||||
{
|
||||
// Fetch client short name from the database
|
||||
if($client_id)
|
||||
{
|
||||
|
||||
//check folder ids in cahce,
|
||||
$cacheKey = "client_gdrive_folderids_{$client_id}";
|
||||
$folderIds = $this->cache->get($cacheKey);
|
||||
// dd($folderIds);
|
||||
if($folderIds !== NULL)//if available retrun from cache
|
||||
{
|
||||
return $folderIds;
|
||||
}
|
||||
|
||||
//if not in cache then get it from grdrive
|
||||
$client = $this->clientModel->find($client_id);
|
||||
$clientShortName = $client['short_name']; // Assuming short_name is the column for client's short name
|
||||
}
|
||||
else if($client_policy_id)
|
||||
{
|
||||
|
||||
$cacheKey = "client_policy_gdrive_folderids_{$client_policy_id}";
|
||||
$folderIds = $this->cache->get($cacheKey);
|
||||
// dd($folderIds);
|
||||
if($folderIds !== NULL)//if available retrun from cache
|
||||
{
|
||||
return $folderIds;
|
||||
}
|
||||
|
||||
$client = $this->clientPolicyModel->select('c.short_name,pt.policy_type,client_policy.policy_no')
|
||||
->join('clients c','client_policy.client_id = c.id')
|
||||
->join('policy_type pt','client_policy.policy_type_id = pt.id')
|
||||
->where('client_policy.id',$client_policy_id)
|
||||
->get()->getResultarray();
|
||||
// dd($client);
|
||||
$clientShortName = $client[0]['short_name'];
|
||||
$policyFolderName = $client[0]['policy_type'].'-'.$client[0]['policy_no'];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [];
|
||||
}
|
||||
// dd($policyFolderName);
|
||||
// Define parent folder ID where client folders are stored
|
||||
$parentFolderId = getenv('GDRIVE_ROOT_FOLDER_ID');; // Replace with your specific folder ID
|
||||
|
||||
// Check if the client folder exists in GDrive, if not create one
|
||||
$clientFolderId = $this->checkOrCreateFolder($clientShortName, $parentFolderId);
|
||||
|
||||
// Check or create KYC_DOCS folder inside the client folder
|
||||
$kycFolderId = $this->checkOrCreateFolder('KYC_DOCS', $clientFolderId);
|
||||
|
||||
// Check or create POLICY_DOCS folder inside the client folder
|
||||
$policyFolderId = $this->checkOrCreateFolder('POLICY_DOCS', $clientFolderId);
|
||||
|
||||
if($client_policy_id && (isset($policyFolderName)))
|
||||
{
|
||||
$clientPolicyFolderId = $this->checkOrCreateFolder($policyFolderName, $policyFolderId);
|
||||
$clientPolicyUploadFolderId = $this->checkOrCreateFolder('UPLOADS', $clientPolicyFolderId);
|
||||
}
|
||||
|
||||
|
||||
// Return folder IDs in the specified format
|
||||
$folderIds = [
|
||||
'client_folder_id' => $clientFolderId, // example HCL,TCS
|
||||
'kyc_doc_folder_id' => $kycFolderId, // KYC_DOCS inside HCL,TCS
|
||||
'policy_doc_folder_id' => $policyFolderId, //POLICY_DOCS inside HCL,TCS
|
||||
'client_policy_doc_folder_id' => isset($clientPolicyFolderId) ? $clientPolicyFolderId : null, //GMC-POLICY_NO inside POLICY_DOCS folder
|
||||
'client_policy_uoload_doc_folder_id' => isset($clientPolicyUploadFolderId) ? $clientPolicyUploadFolderId : null, //UPLOADS folder in side GMC-POLICY_NO folder
|
||||
];
|
||||
|
||||
// Save the folder IDs in cache for future requests
|
||||
$this->cache->save($cacheKey, $folderIds, 604800); // Cache for 7 Days (3600 seconds * 24 * 7 )
|
||||
return $folderIds;
|
||||
}
|
||||
|
||||
|
||||
// Method to check if a folder exists or create one if it doesn't
|
||||
public function checkOrCreateFolder($folderName, $parentFolderId)
|
||||
{
|
||||
// Step 1: Check if the folder exists
|
||||
$folderId = $this->getFolderId($folderName, $parentFolderId);
|
||||
|
||||
if ($folderId === null) {
|
||||
// Step 2: If folder does not exist, create it
|
||||
$folderId = $this->createFolder($folderName, $parentFolderId);
|
||||
}
|
||||
|
||||
// Step 3: Return the folder ID
|
||||
return $folderId;
|
||||
}
|
||||
|
||||
// Method to get the folder ID by searching in Google Drive
|
||||
private function getFolderId($folderName, $parentFolderId)
|
||||
{
|
||||
$query = "name = '$folderName' and mimeType = 'application/vnd.google-apps.folder' and '$parentFolderId' in parents and trashed = false";
|
||||
|
||||
$response = $this->driveService->files->listFiles([
|
||||
'q' => $query,
|
||||
'spaces' => 'drive',
|
||||
'fields' => 'files(id, name)',
|
||||
'pageSize' => 1,
|
||||
]);
|
||||
|
||||
if (count($response->files) > 0) {
|
||||
return $response->files[0]->id; // Return folder ID if found
|
||||
}
|
||||
|
||||
return null; // Return null if folder doesn't exist
|
||||
}
|
||||
|
||||
// Method to create a folder in Google Drive
|
||||
private function createFolder($folderName, $parentFolderId)
|
||||
{
|
||||
$fileMetadata = new \Google_Service_Drive_DriveFile([
|
||||
'name' => $folderName,
|
||||
'mimeType' => 'application/vnd.google-apps.folder',
|
||||
'parents' => [$parentFolderId]
|
||||
]);
|
||||
|
||||
$folder = $this->driveService->files->create($fileMetadata, [
|
||||
'fields' => 'id',
|
||||
]);
|
||||
|
||||
return $folder->id; // Return the newly created folder's ID
|
||||
}
|
||||
|
||||
// public function uploadFiletoGdrive(int $client_id = 0,int $client_policy_id = 0,string $doc_type,string
|
||||
// $file_path,string $file_name)
|
||||
public function uploadFiletoGdrive(int $client_id = 0, int $client_policy_id = 0, string $doc_type = '', string $file_path = '', string $file_name = '')
|
||||
{
|
||||
$gdriveFolderIds = $this->getClientFolderIds(client_id: $client_id,client_policy_id: $client_policy_id);
|
||||
// Kint::dump($gdriveFolderIds);//die();
|
||||
$parentFolderId = '';
|
||||
if($client_id && $doc_type == 'KYC')
|
||||
{
|
||||
$parentFolderId = $gdriveFolderIds['kyc_doc_folder_id'];
|
||||
}
|
||||
else if($client_policy_id && $doc_type == 'POLICY')
|
||||
{
|
||||
$parentFolderId = $gdriveFolderIds['client_policy_doc_folder_id'];
|
||||
}
|
||||
else if($client_policy_id && $doc_type == 'UPLOADS')
|
||||
{
|
||||
$parentFolderId = $gdriveFolderIds['client_policy_uoload_doc_folder_id'];
|
||||
}
|
||||
if($parentFolderId == '')
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// dd($parentFolderId);
|
||||
$file = new \Google_Service_Drive_DriveFile([
|
||||
'name' => $file_name,
|
||||
'parents' => [$parentFolderId] // Specify the folder ID here
|
||||
]);
|
||||
|
||||
$file_blob_data = file_get_contents($file_path);
|
||||
|
||||
$createdFile = $this->driveService->files->create($file, [
|
||||
'data' => $file_blob_data,
|
||||
'mimeType' => 'application/octet-stream',
|
||||
'uploadType' => 'multipart',
|
||||
'fields' => 'id' // Specify fields to return
|
||||
]);
|
||||
|
||||
if($createdFile->id)
|
||||
{
|
||||
unlink($file_path);
|
||||
}
|
||||
|
||||
return $createdFile->id;
|
||||
}
|
||||
|
||||
public function downloadGdriveFile()
|
||||
{
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||
$file_type = $this->request->getGet('file_type');
|
||||
$file_name = $this->request->getGet('file_name');
|
||||
if(!is_numeric($client_policy_id))
|
||||
$client_policy_id = 0;
|
||||
else
|
||||
$client_id = 0;
|
||||
|
||||
$gdriveFolderIds = $this->getClientFolderIds(client_id: $client_id,client_policy_id: $client_policy_id);
|
||||
// dd($gdriveFolderIds);
|
||||
$parentFolderId = '';
|
||||
if($file_type == 'kyc')
|
||||
{
|
||||
$parentFolderId = $gdriveFolderIds['kyc_doc_folder_id'];
|
||||
}
|
||||
else if($file_type == 'policy')
|
||||
{
|
||||
$parentFolderId = $gdriveFolderIds['client_policy_doc_folder_id'];
|
||||
}
|
||||
else if($file_type == 'uploads')
|
||||
{
|
||||
$parentFolderId = $gdriveFolderIds['client_policy_uoload_doc_folder_id'];
|
||||
}
|
||||
if($parentFolderId == '')
|
||||
{
|
||||
return $this->response->setStatusCode(500)
|
||||
->setHeader('Content-Type', 'text/html')
|
||||
->setBody('<script>alert("File not found");</script>');
|
||||
}
|
||||
|
||||
return $this->searchGdriveFileByName(parentFolderID: $parentFolderId, fileName: $file_name);
|
||||
|
||||
}
|
||||
|
||||
//search files in gdrive by parent folder id and name of the file
|
||||
public function searchGdriveFileByName(string $parentFolderID,string $fileName)
|
||||
{
|
||||
//check exisitng temp file from cache and delete it
|
||||
if($this->cache->get('temp_gdrive_file') && is_file($this->cache->get('temp_gdrive_file')))
|
||||
{
|
||||
unlink($this->cache->get('temp_gdrive_file'));
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
|
||||
$searchQuery = "'$parentFolderID' in parents and (name contains '$fileName')";
|
||||
// Query to list files
|
||||
$response = $this->driveService->files->listFiles([
|
||||
'q' => $searchQuery,
|
||||
'supportsAllDrives' => true,
|
||||
'includeItemsFromAllDrives' => true,
|
||||
'fields' => 'nextPageToken, files(id, name, mimeType, size)',
|
||||
'pageSize' => 1,
|
||||
]);
|
||||
|
||||
$files = $response->getFiles();
|
||||
|
||||
if (empty($files)) {
|
||||
return $this->response->setStatusCode(500)
|
||||
->setHeader('Content-Type', 'text/html')
|
||||
->setBody('<script>alert("File not found");window.close();</script>');
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "File Name: " . $files[0]->getName() . " | File ID: " . $file[0]->getId() . "<br>";
|
||||
// echo($files[0]->getId());
|
||||
// echo 'working';
|
||||
return $this->downloadFile(fileId:$files[0]->getId(),fileName:$files[0]->getName(),mimeType:$files[0]->getMimeType(),fileSize:$files[0]->getSize());
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setStatusCode(500)->setBody($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -31,6 +31,7 @@ use App\Models\PolicyTypeModel;
|
||||
use App\Models\CDMasterModel;
|
||||
use App\Models\ClientDepositModel;
|
||||
use App\Models\InsurerExcelExportTemplateModel;
|
||||
use App\Models\SettingsModel;
|
||||
|
||||
class MasterController extends AdminController
|
||||
{
|
||||
@ -1527,11 +1528,106 @@ class MasterController extends AdminController
|
||||
|
||||
|
||||
//testing a sample mail from cli
|
||||
public function testGmailAPIViaCLI()
|
||||
public function testGmailAPIViaCLI(string $email_id = 'velmurugan.s@venbainfotech.com')
|
||||
{
|
||||
// print_r($email_id);die();
|
||||
$gmailapi = \Config\Services::gmailapi();
|
||||
$res = MailHelper::send_email(['mail' => 'velmurugan.s@venbainfotech.com', 'subject' => 'Mail Via CLI', 'message' => 'This is sample mail sent via CLI mode']);
|
||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => 'This is sample mail sent via CLI mode']);
|
||||
print_r($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function appCheckList()
|
||||
{
|
||||
//check temprory folders in writeable and public/uploads folder
|
||||
$this->checkAndCreateDirectories();
|
||||
$this->checkGoogleOAuthCredentialsinDB();
|
||||
$this->getCronJobsList();
|
||||
|
||||
}
|
||||
|
||||
public function checkAndCreateDirectories()
|
||||
{
|
||||
echo "#################### CHECKING TEMP DIRECTORIES ############################\n";
|
||||
// Array of folder names and their respective paths
|
||||
$folders = [
|
||||
'e_card_template' => WRITEPATH . 'e_card_template/',
|
||||
'uploads' => WRITEPATH . 'uploads/',
|
||||
'excel' => WRITEPATH . 'uploads/excel/',
|
||||
'statements' => WRITEPATH . 'uploads/statements/',
|
||||
'import_excel' => WRITEPATH . 'uploads/import_excel/',
|
||||
'logs' => WRITEPATH . 'uploads/logs/',
|
||||
'client_kyc_documents' => WRITEPATH . 'uploads/client_kyc_documents/',
|
||||
'tmp' => WRITEPATH . 'tmp/',
|
||||
'e_card_imgs' => ROOTPATH . 'public/e_card_imgs',
|
||||
'uploads' => ROOTPATH . 'public/uploads',
|
||||
'add_image_upload' => ROOTPATH . 'public/uploads/add_image_upload/',//adverdisement images for enrollment app
|
||||
'logo' => ROOTPATH . 'public/uploads/logo/',
|
||||
'template_bg' => ROOTPATH . 'public/uploads/template_bg/'
|
||||
];
|
||||
|
||||
foreach ($folders as $folderName => $folderPath) {
|
||||
// Check if the folder exists
|
||||
if (!is_dir($folderPath)) {
|
||||
// Try to create the folder
|
||||
if (mkdir($folderPath, 0777, true)) {
|
||||
// Set permissions to 0777
|
||||
chmod($folderPath, 0777);
|
||||
echo "\nDirectory '$folderPath' created successfully with 0777 permissions.\n";
|
||||
} else {
|
||||
// Handle error in directory creation
|
||||
echo "Failed to create directory '$folderPath'.\n";
|
||||
}
|
||||
} else {
|
||||
echo "Directory '$folderPath' already exists.\n";
|
||||
}
|
||||
}
|
||||
echo "################################################################\n\n";
|
||||
}
|
||||
|
||||
public function checkGoogleOAuthCredentialsinDB()
|
||||
{
|
||||
$settingsModel = new SettingsModel();
|
||||
$token = $settingsModel->where('id', 1)->first();
|
||||
|
||||
echo "################ CHECKING GMAIL OAUTH FOR EMAIL ###################\n";
|
||||
if (is_array($token) && !is_null($token['gmail_api_oauth_credentials'])) {
|
||||
|
||||
echo "Email OAuth credentials not found in database.\n";
|
||||
echo "Check the following..!\n";
|
||||
echo "1. Update Gmail Oauth credentials in 'gmail_api_oauth_credentials' field in 'settings' table in JSON format.\n";
|
||||
echo "2. Call this cli route to generate new access token: 'php public/index.php cli/new_gmail_token' from root of the project.\n";
|
||||
echo "3. Call this cli route : 'php public/index.php cli/send_mail_cli someone@gmail.com' to send test mail to testGmailAPIViaCLI ( replace someone@gmail.com with real time mail).\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Gmail OAuth for sending email is set in DB\n";
|
||||
}
|
||||
echo "################################################################\n\n";
|
||||
}
|
||||
|
||||
|
||||
function getCronJobsList()
|
||||
{
|
||||
// Execute the shell command to get cron jobs
|
||||
$output = null;
|
||||
$resultCode = null;
|
||||
echo "#################### CHECKING CRONJOBS ############################\n";
|
||||
// Use shell_exec to get cron jobs from the current user's crontab
|
||||
$output = shell_exec('crontab -l 2>&1');
|
||||
|
||||
// Check if the command was successful
|
||||
if (strpos($output, 'no crontab') !== false) {
|
||||
echo "No cron jobs are set for this user.\n";
|
||||
} elseif ($output) {
|
||||
// Return the cron job list
|
||||
echo nl2br($output);
|
||||
echo "\n" ;// Convert newlines to <br> for easier HTML rendering
|
||||
} else {
|
||||
echo "Error retrieving cron jobs or no cron jobs set.\n";
|
||||
}
|
||||
echo "################################################################\n\n";
|
||||
}
|
||||
|
||||
}
|
||||
@ -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
|
||||
@ -1036,14 +1068,29 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
// dd( $data['insurers']);
|
||||
$data['insurer_statement_list'] = $this->insurerStatements
|
||||
->select('insurer_statements.*,
|
||||
insurers.name AS insurer_name,insurers.short_name,user_profiles.first_name,insurer_branch.branch_code
|
||||
')
|
||||
->join('insurers', 'insurer_statements.insurer_id = insurers.id')
|
||||
->join('insurer_branch', 'insurer_statements.branch_id = insurer_branch.id')
|
||||
->join('user_profiles', 'insurer_statements.created_by = user_profiles.id')
|
||||
->orderBy('insurer_statements.id', 'desc')
|
||||
->findAll();
|
||||
->select('insurer_statements.*,
|
||||
insurers.name AS insurer_name,
|
||||
insurers.short_name,
|
||||
user_profiles.first_name,
|
||||
insurer_branch.branch_code,
|
||||
(SELECT SUM(pt_co_share_details.exp_amt)
|
||||
FROM pt_co_share_details
|
||||
WHERE pt_co_share_details.is_active = 1
|
||||
AND pt_co_share_details.statement_id = insurer_statements.id
|
||||
) AS exp_inv_amt,
|
||||
(SELECT SUM(inv_payment_details.inv_amt)
|
||||
FROM inv_payment_details
|
||||
WHERE inv_payment_details.is_active = 1
|
||||
AND inv_payment_details.statement_id = insurer_statements.id
|
||||
) AS received_inv_amt'
|
||||
)
|
||||
->join('insurers', 'insurer_statements.insurer_id = insurers.id')
|
||||
->join('insurer_branch', 'insurer_statements.branch_id = insurer_branch.id')
|
||||
->join('user_profiles', 'insurer_statements.created_by = user_profiles.id')
|
||||
->where('insurer_statements.is_active', 1)
|
||||
->orderBy('insurer_statements.id', 'DESC')
|
||||
->findAll();
|
||||
|
||||
// dd( $data['insurer_statement_list']);
|
||||
$this->loadLayout('insurer_statement_list', $data);
|
||||
}
|
||||
@ -1190,7 +1237,7 @@ class PolicyTransactionController extends BaseController
|
||||
$line_items = count($excel_data);
|
||||
// get uploaded month transactions data
|
||||
$source_data = $this->PTCOShareDetailsModel->getNonReconcileredPolicyTransactions(month:$month,year:$year,insurer_id:$file['insurer_id'],insurer_branch_id:$file['branch_id']);
|
||||
// Kint::dump($source_data);
|
||||
// var_dump($source_data);die();
|
||||
// Kint::dump($excel_data);
|
||||
|
||||
// check policy no,insurer and etc in DB for this month
|
||||
@ -1378,7 +1425,7 @@ class PolicyTransactionController extends BaseController
|
||||
// $ret_status = false;
|
||||
// }
|
||||
//update in DB
|
||||
//$this->insurerStatements->where('id', $file_id)->set(['file_status' => $status,'reason' => json_encode($error_data)])->update();
|
||||
$this->insurerStatements->where('id', $file_id)->set(['file_status' => $status,'reason' => json_encode($error_data),'invoice_status' =>'pending'])->update();
|
||||
return array('status' => $ret_status, 'error_code' => $error_data['error_code'],'error_data' => $error_data['error_data']);
|
||||
}
|
||||
|
||||
@ -1424,7 +1471,7 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
|
||||
|
||||
// $this->insurerStatements->update($hiddenStatementId, $parentData);
|
||||
$this->insurerStatements->update($hiddenStatementId, $parentData);
|
||||
|
||||
// Process child data
|
||||
$invoiceAmounts = $jsonData['invoice_amount'];
|
||||
@ -1442,21 +1489,99 @@ class PolicyTransactionController extends BaseController
|
||||
'inv_amt' => $invoiceAmount,
|
||||
'utr_no' => $utrNo,
|
||||
'received_date' => $paymentDate,
|
||||
'statement_id' => $hiddenStatementId,
|
||||
'id' => is_numeric($pk) ? (int)$pk : '',
|
||||
'statement_id' => $hiddenStatementId
|
||||
];
|
||||
if($pk){ $childData['updated_by'] = get_session_userid(); }
|
||||
if($pk){
|
||||
$childData['updated_by'] = get_session_userid();
|
||||
$childData['id'] = (int)$pk;
|
||||
}
|
||||
else { $childData['created_by'] = get_session_userid(); }
|
||||
// print_r($childData);
|
||||
// Insert or update
|
||||
$this->invPaymentDetailsModel->save($childData);
|
||||
print_r($this->invPaymentDetailsModel->errors());
|
||||
// print_r($this->invPaymentDetailsModel->errors());
|
||||
|
||||
}
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200], 200);
|
||||
//return $this->response->setJSON(['dataStatus' => 'true']);
|
||||
}
|
||||
|
||||
public function deletePaymentEntry()
|
||||
{
|
||||
$payment_id = $this->request->getUri()->getSegment(4);
|
||||
//echo $payment_id;
|
||||
$this->invPaymentDetailsModel->update($payment_id, ['is_active' => 0]);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200], 200);
|
||||
}
|
||||
|
||||
public function downloadSampleInsurerStatement()
|
||||
{
|
||||
|
||||
$filePath = ROOTPATH . 'public/sample_excel/insurer_stament_sample.xlsx';
|
||||
// Check if the file exists
|
||||
if (file_exists($filePath)) {
|
||||
|
||||
// Set the appropriate MIME type
|
||||
$mimeType = mime_content_type($filePath);
|
||||
|
||||
// Send the file to the client for download
|
||||
return $this->response->download($filePath, null, $mimeType);
|
||||
} else {
|
||||
// File not found, show an error message or redirect
|
||||
echo view('errors/html/production');
|
||||
}
|
||||
}
|
||||
|
||||
public function getFileErr()
|
||||
{
|
||||
$file_id = $this->request->getUri()->getSegment(4);
|
||||
$file = $this->insurerStatements->find($file_id);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200,'data' => $file['reason']], 200);
|
||||
}
|
||||
|
||||
|
||||
public function dmsSearch()
|
||||
{
|
||||
// echo 'scbsc';die();
|
||||
if ($this->request->getMethod() == 'post')
|
||||
{
|
||||
// $jsonData = (array)$this->request->getJSON();
|
||||
$customer_id = $this->request->getPost('customer_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
$cus_doc_name = $this->request->getPost('cus_doc_name');
|
||||
$policy_doc_name = $this->request->getPost('policy_doc_name');
|
||||
$pt_files = [];
|
||||
$kyc_files = [];
|
||||
// print_r($jsonData);die();
|
||||
if($policy_id != "")
|
||||
{
|
||||
//get policy docs from policy transation related tables
|
||||
$pt_files = $this->PTFileModel->getPolicyDriveFilesIndex($policy_id,$policy_doc_name);
|
||||
// ~dd($this->PTFileModel->getLastQuery());
|
||||
// ~dd($d);
|
||||
}
|
||||
if($customer_id != "")
|
||||
{
|
||||
$kyc_files = $this->clientKYCDocsModel->getClientKYCDriveFilesIndex($customer_id,$cus_doc_name);
|
||||
// dd($this->clientKYCDocsModel->getLastQuery());
|
||||
// !dd($kyc_files);
|
||||
}
|
||||
|
||||
$data['files'] = array_merge($pt_files,$kyc_files);
|
||||
// dd($data['files']);
|
||||
}
|
||||
|
||||
|
||||
$data['customers'] = $this->clientModel->select('id,client_name,short_name as display_value')->where('is_active',1)->get()->getResultarray();
|
||||
$data['policies'] = $this->clientPolicyModel->select("client_policy.id,client_policy.policy_no,policy_type.policy_type,concat(policy_type.policy_type,' - ',client_policy.policy_no) as display_value")
|
||||
->join('policy_type','client_policy.policy_type_id = policy_type.id')
|
||||
->where('client_policy.is_active',1)->get()->getResultarray();
|
||||
// dd($data);
|
||||
$this->loadLayout('dms_search', $data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\UserTeamsModel;
|
||||
|
||||
|
||||
// File: app/Helpers/Uuid_helper.php
|
||||
@ -236,6 +237,33 @@ if (!function_exists('get_role_id')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('teams')) {
|
||||
function teams() {
|
||||
// Load the UserTeamsModel
|
||||
$teamModel = new \App\Models\UserTeamsModel();
|
||||
// Get the user ID from the session
|
||||
$user_id = get_session_userid();
|
||||
|
||||
// Fetch the team IDs associated with the user
|
||||
$user_teams = $teamModel->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') {
|
||||
|
||||
|
||||
@ -175,6 +175,6 @@ class GmailAPI
|
||||
|
||||
$this->storeTokenToDB($accessToken);
|
||||
$this->myLogger->logme('error', 'New token generated and stored in the database.');
|
||||
print 'New token generated and stored in the database.';
|
||||
print 'New token generated and stored in the database.';
|
||||
}
|
||||
}
|
||||
|
||||
131
app/Libraries/MyGoogleDrive.php
Normal file
131
app/Libraries/MyGoogleDrive.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries;
|
||||
|
||||
use CodeIgniter\CLI\CLI;
|
||||
use Google_Client;
|
||||
use Google_Service_Drive;
|
||||
|
||||
class MyGoogleDrive
|
||||
{
|
||||
|
||||
private $client;
|
||||
private $myLogger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->client = new Google_Client();
|
||||
$this->client->setAuthConfig(ROOTPATH . 'nhance-app-google-drive.json'); // App credentials
|
||||
// putenv('GOOGLE_APPLICATION_CREDENTIALS=' . ROOTPATH . 'nhance-app-google-drive.json');
|
||||
$this->client->useApplicationDefaultCredentials();
|
||||
|
||||
$this->client->addScope(Google_Service_Drive::DRIVE); // Full access to Google Drive
|
||||
}
|
||||
|
||||
public function getDriveService()
|
||||
{
|
||||
return new Google_Service_Drive($this->client);
|
||||
}
|
||||
|
||||
// this function serve no purpose on anywhere, just for test purpose
|
||||
public function listFiles(string $searchQuery = '')
|
||||
{
|
||||
$service = $this->getDriveService();
|
||||
// $searchQuery = "name contains 'test' and 'vitvelz@gmail.com' in readers";
|
||||
$searchQuery = "name contains 'test' or name contains 'new'";
|
||||
// $searchQuery = "name contains 'test' and mimeType = 'application/vnd.google-apps.folder' or name contains 'new' and mimeType = 'application/vnd.ms-excel'";
|
||||
// List the files
|
||||
$files = $service->files->listFiles([
|
||||
'q' => $searchQuery,
|
||||
// 'supportsAllDrives' => true,
|
||||
// 'includeItemsFromAllDrives' => true,
|
||||
'fields' => 'nextPageToken, files(id, name, mimeType, size, createdTime, modifiedTime, owners, shared, permissions, webViewLink, thumbnailLink)',
|
||||
'pageSize' => 20,
|
||||
]);
|
||||
// print_r($files);
|
||||
echo "\n**************\n";
|
||||
foreach ($files->getFiles() as $file) {
|
||||
echo 'File ID: ' . $file->getID() . "\n";
|
||||
echo 'File Name: ' . $file->getName() . "\n";
|
||||
// echo 'MIME Type: ' . $file->getMimeType() . "\n";
|
||||
// echo 'Size: ' . $file->getSize() . " bytes\n";
|
||||
// echo 'Created Time: ' . $file->getCreatedTime() . "\n";
|
||||
// echo 'Modified Time: ' . $file->getModifiedTime() . "\n";
|
||||
// echo 'Owner: ' . $file->getOwners()[0]->getEmailAddress() . "\n";
|
||||
// echo 'Shared: ' . ($file->getShared() ? 'Yes' : 'No') . "\n";
|
||||
// echo 'Permissions: ' . json_encode($file->getPermissions()) . "\n";
|
||||
// echo 'Web View Link: ' . $file->getWebViewLink() . "\n";
|
||||
// echo 'Thumbnail Link: ' . $file->getThumbnailLink() . "\n";
|
||||
echo 'parents: ' .$file->getParents()."\n";
|
||||
echo "-----\n";
|
||||
}
|
||||
}
|
||||
|
||||
// this fucntion is not generating any new token, just for testing purpose
|
||||
public function generateNewToken()
|
||||
{
|
||||
// $this->uploadFile();die();
|
||||
$this->listFiles();die();
|
||||
// dd('called');
|
||||
if (!is_cli()) {
|
||||
throw new \RuntimeException('This method can only be accessed via the command line.');
|
||||
}
|
||||
|
||||
if (php_sapi_name() != 'cli') {
|
||||
throw new Exception('This application must be run on the command line.');
|
||||
}
|
||||
|
||||
$authUrl = $this->client->createAuthUrl();
|
||||
CLI::write('Open the following link in your browser');
|
||||
CLI::write("\n");
|
||||
CLI::write($authUrl);
|
||||
// printf ("Open the following link in your browser:\n%s\n", $authUrl);
|
||||
CLI::write('Enter verification code: ');
|
||||
// print 'Enter verification code: ';
|
||||
$authCode = trim(fgets(STDIN));
|
||||
|
||||
$accessToken = $this->client->fetchAccessTokenWithAuthCode($authCode);
|
||||
if (array_key_exists('error', $accessToken)) {
|
||||
$this->myLogger->logme('error', 'Error in getting access token from authCode' . join(', ', $accessToken));
|
||||
throw new \Exception(join(', ', $accessToken));
|
||||
}
|
||||
|
||||
$this->storeToken($accessToken);
|
||||
$this->myLogger->logme('error', 'New token generated and stored in the writepath for google drive.');
|
||||
print 'New token generated and stored in the writepath for google drive.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a file to Google Drive
|
||||
* this function not used in anywhere
|
||||
*/
|
||||
public function uploadFile($filePath = '', $fileName= '')
|
||||
{
|
||||
$service = $this->getDriveService();
|
||||
|
||||
// $file = new \Google_Service_Drive_DriveFile();
|
||||
// $file->setName('tata.xlsx');
|
||||
// $file->setParents('TEST');
|
||||
|
||||
// Create a new file metadata object
|
||||
$file = new \Google_Service_Drive_DriveFile([
|
||||
'name' => 'mypdf.pdf',
|
||||
'parents' => ['1M0GH3GbNUOYZLNeHXA5U7C_P2NSx7F7O'] // Specify the folder ID here
|
||||
]);
|
||||
|
||||
$data = file_get_contents('C:\Users\Venba\Desktop\nhance_bpf.pdf');
|
||||
|
||||
$createdFile = $service->files->create($file, [
|
||||
'data' => $data,
|
||||
'mimeType' => 'application/octet-stream',
|
||||
'uploadType' => 'multipart',
|
||||
'fields' => 'id' // Specify fields to return
|
||||
]);
|
||||
|
||||
echo $createdFile->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -17,6 +17,7 @@ class ClientKYCDocsModel extends Model
|
||||
'is_active',
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"vehicle_id",
|
||||
];
|
||||
|
||||
public function getKycDocsName($client_id){
|
||||
@ -27,4 +28,17 @@ class ClientKYCDocsModel extends Model
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getClientKYCDriveFilesIndex($client_id,$client_doc_name = '')
|
||||
{
|
||||
$query = $this->select('client_kyc_documents.client_id,client_kyc_documents.file_name, kyc_docs.file_name as doc_name,"url","client_policy_id","kyc" as file_type')
|
||||
->join('kyc_docs', 'kyc_docs.id = client_kyc_documents.kyc_doc_type_id')
|
||||
->where(['client_kyc_documents.client_id' => $client_id, 'client_kyc_documents.is_active' => 1])
|
||||
->when($client_doc_name, function($query) use ($client_doc_name){
|
||||
return $query->where("kyc_docs.file_name like '%$client_doc_name%'");
|
||||
})
|
||||
->get()
|
||||
->getResultArray();
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
30
app/Models/EndorsementModel.php
Normal file
30
app/Models/EndorsementModel.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class EndorsementModel extends Model
|
||||
{
|
||||
protected $table = 'endorsement';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'client_id',
|
||||
'client_policy_id',
|
||||
'insurer_id',
|
||||
'tpa_id',
|
||||
'endorsement_no',
|
||||
'endorsement_type',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_by',
|
||||
'updated_at',
|
||||
'is_active'
|
||||
];
|
||||
|
||||
}
|
||||
@ -96,6 +96,7 @@ class PTCOShareDetailsModel extends Model
|
||||
->where('YEAR(pt.created_at)', $year)
|
||||
->where('pt_co.insurer_id', $insurer_id)
|
||||
->where('pt_co.insurer_branch_id', $insurer_branch_id)
|
||||
->where('pt_co.statement_id is null')
|
||||
// ->where('pt_co.exp_amt', 0.00)
|
||||
// ->orWhere('pt_co.exp_amt is null')
|
||||
->get()
|
||||
|
||||
@ -25,5 +25,18 @@ class PTFileModel extends Model
|
||||
|
||||
];
|
||||
|
||||
public function getPolicyDriveFilesIndex($policy_id,$policy_doc_name)
|
||||
{
|
||||
|
||||
$clients = $this->select('pt_files.doc_name,pt_files.file_name,pt_files.url,pt.client_id,pt.client_policy_id,"policy" as file_type')
|
||||
->join('policy_transaction pt', 'pt_files.pt_id = pt.id')
|
||||
->where('pt.client_policy_id', $policy_id)
|
||||
->where('pt.is_active',1)
|
||||
->when($policy_doc_name, function($query) use ($policy_doc_name){
|
||||
return $query->where("pt_files.doc_name like '%$policy_doc_name%'");
|
||||
})
|
||||
->get()
|
||||
->getResultArray();
|
||||
return $clients;
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,6 +72,9 @@ class PolicyTransactionModel extends Model
|
||||
'endorse_eff_date',
|
||||
'sales_generated_by',
|
||||
'serviced_by',
|
||||
'ct_type',
|
||||
'ct_tran_id',
|
||||
'remarks',
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -30,43 +30,42 @@
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col -->
|
||||
|
||||
|
||||
<div class="row" id="others">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="kyc_form"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="kyc_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="client_id" id="client_id_kyc" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="kyc_doc_type_id" value="0" />
|
||||
<div class="form-group">
|
||||
<div class="card" style="margin-left: 12px;margin-right: -12px;">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="kyc_form"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="kyc_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="client_id" id="client_id_kyc" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="kyc_doc_type_id" value="0" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_code">Other Documents<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="other_docs_name" placeholder="Document Name" name="other_docs_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="kyc_docs">File<span
|
||||
class="text-danger">*</span></label>
|
||||
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png">
|
||||
</div>
|
||||
<!-- <div class="form-group col-md-4 align-self-end"> -->
|
||||
<div class="form-group col-md-4" style="margin-top: 42px;">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"id="btnSubmit">Upload</button>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_code">Other Documents<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="other_docs_name" placeholder="Document Name" name="other_docs_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="kyc_docs">File<span
|
||||
class="text-danger">*</span></label>
|
||||
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png">
|
||||
</div>
|
||||
<!-- <div class="form-group col-md-4 align-self-end"> -->
|
||||
<div class="form-group col-md-4" style="<?= isset($client['id']) ? 'margin-top: 41px;' : 'margin-top: 30px;' ?>">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"id="btnSubmit">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div> <!-- end row -->
|
||||
|
||||
|
||||
<div class="col-lg-12" id="other_docs_table">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@ -88,8 +87,6 @@
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
@ -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 = `<tr>
|
||||
<td>${item.file_name}</td>
|
||||
<td id="form_${item.id}">
|
||||
<form class="ajax">
|
||||
<input class="file-input__input" type="file" name="file_name">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
|
||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id">
|
||||
<input type="hidden" name="client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>">
|
||||
<button class="btn btn-sm btn-primary submit" style="position: relative; right: 80px;">Submit</button>
|
||||
</form>
|
||||
</td>
|
||||
<td id="name_${item.id}" style="display:none;"></td>
|
||||
<td>
|
||||
<i id="delete_${item.id}" data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px; display: none"></i>
|
||||
<a id="download_${item.id}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a>
|
||||
</td>
|
||||
</tr>`;
|
||||
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 += `
|
||||
<tr id="kyc-${item.id}">
|
||||
<td>${item.other_docs_name}</td>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
}
|
||||
});
|
||||
$('#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 = `<tr>
|
||||
<td>${item.file_name}</td>
|
||||
<td id="form_${item.id}">
|
||||
<form class="ajax">
|
||||
<input class="file-input__input" type="file" name="file_name">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
|
||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id">
|
||||
<input type="hidden" name="client_id" value="${client_id}">
|
||||
<button class="btn btn-sm btn-primary submit" style="position: relative; right: 80px;">Submit</button>
|
||||
</form>
|
||||
</td>
|
||||
<td id="name_${item.id}" style="display:none;"></td>
|
||||
<td>
|
||||
<i id="delete_${item.id}" data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px; display: none"></i>
|
||||
<a id="download_${item.id}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a>
|
||||
</td>
|
||||
</tr>`;
|
||||
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 += `
|
||||
<tr id="kyc-${item.id}">
|
||||
<td>${item.other_docs_name}</td>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#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);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -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: '<?php echo base_url('util/check_policy_no/');?>'+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);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
225
app/Views/dms_search.php
Normal file
225
app/Views/dms_search.php
Normal file
@ -0,0 +1,225 @@
|
||||
<style>
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.autocomplete-suggestions {
|
||||
border: 1px solid #d4d4d4;
|
||||
max-height: 150px;
|
||||
overflow-y: auto;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
width: inherit;
|
||||
z-index: 1;
|
||||
}
|
||||
.autocomplete-suggestion {
|
||||
padding: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.autocomplete-suggestion:hover {
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
|
||||
</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">
|
||||
<form method="post" action="<?= base_url("/dmsSearch");?>" id='dms_search_form'>
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="customer">Customer</label>
|
||||
<!-- <div style="position:relative;"> -->
|
||||
<input type="text" class="form-control" id="customer" placeholder="Enter customer name">
|
||||
<input type="hidden" name="customer_id" class="form-control" id="customer_id" placeholder="Enter customer name">
|
||||
<div id="customer_suggestions" class="autocomplete-suggestions" style="display:none;"></div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="customer">Customer document name</label>
|
||||
<!-- <div style="position:relative;"> -->
|
||||
<input type="text" name="cus_doc_name" class="form-control" id="cus_doc_name" placeholder="Enter customer doc name ">
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
<div class="form-group col-md-1" style="text-align: center;">
|
||||
OR
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="customer">Policy</label>
|
||||
<!-- <div style="position:relative;"> -->
|
||||
<input type="text" class="form-control" id="policy" placeholder="Enter policy no">
|
||||
<input type="hidden" name="policy_id" class="form-control" id="policy_id" placeholder="Enter policy no">
|
||||
<div id="policy_suggestions" class="autocomplete-suggestions" style="display:none;"></div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="customer">Policy document name</label>
|
||||
<!-- <div style="position:relative;"> -->
|
||||
<input type="text" name="policy_doc_name" class="form-control" id="policy_doc_name" placeholder="Enter policy doc name ">
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="button" class="btn btn-secondary" id="clear-filters">Clear</button>
|
||||
<input type="submit" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchFileList(event);" value="submit">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end page title -->
|
||||
<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;">File search result</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>Doc name</th>
|
||||
<th>File name</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($files)) { ?>
|
||||
<?php foreach($files as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['doc_name']; ?></td>
|
||||
<td><?php echo $row['file_name']; ?></td>
|
||||
<td>
|
||||
<a id="download_1"
|
||||
data-id="1"
|
||||
class="fa fa-download"
|
||||
style="font-size: 18px;"
|
||||
target="_blank"
|
||||
href="<?= base_url("/downloadGdriveFile?client_id=" . $row['client_id'] . "&file_type=" . $row['file_type'] . "&file_name=" . $row['file_name']."&client_policy_id=".$row['client_policy_id']); ?>">
|
||||
</a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
// $('#client_id').select2();
|
||||
// $('#insurer_id').select2();
|
||||
// $('#policy_type_id').select2();
|
||||
const customer_suggestions = <?php echo json_encode($customers); ?>;
|
||||
const policy_suggestions = <?php echo json_encode($policies); ?>;
|
||||
showSuggestions('customer','customer_suggestions','customer_id',customer_suggestions);
|
||||
showSuggestions('policy','policy_suggestions','policy_id',policy_suggestions);
|
||||
|
||||
})
|
||||
|
||||
function showSuggestions(inputID, suggestionBoxID,hiddenInputID,suggestions) {
|
||||
|
||||
// console.log('showSuggestions');
|
||||
// console.log(suggestions);return;
|
||||
const input = document.getElementById(inputID);
|
||||
const suggestionBox = document.getElementById(suggestionBoxID);
|
||||
const hiddenInput = document.getElementById(hiddenInputID);
|
||||
|
||||
input.addEventListener('input', function() {
|
||||
const value = this.value.toLowerCase();
|
||||
suggestionBox.innerHTML = ''; // Clear previous suggestions
|
||||
|
||||
if (value) {
|
||||
const filteredSuggestions = suggestions.filter(item =>
|
||||
item.display_value.toLowerCase().includes(value)
|
||||
);
|
||||
// console.log(filteredSuggestions);
|
||||
filteredSuggestions.forEach(suggestion => {
|
||||
const suggestionItem = document.createElement('div');
|
||||
suggestionItem.textContent = suggestion.display_value;
|
||||
suggestionItem.classList.add('autocomplete-suggestion');
|
||||
|
||||
suggestionItem.addEventListener('click', function() {
|
||||
input.value = suggestion.display_value; // Display value in input
|
||||
hiddenInput.value = suggestion.id; // Store id in hidden input
|
||||
suggestionBox.innerHTML = ''; // Clear suggestions after selecting
|
||||
suggestionBox.style.display = 'none';
|
||||
});
|
||||
|
||||
suggestionBox.appendChild(suggestionItem);
|
||||
suggestionBox.style.display = 'block';
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function fetchFileList(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
|
||||
var customer = document.getElementById('customer').value;
|
||||
var customer_id = document.getElementById('customer_id').value;
|
||||
var policy = document.getElementById('policy').value;
|
||||
var policy_id = document.getElementById('policy_id').value;
|
||||
var cus_doc_name = document.getElementById('cus_doc_name').value;
|
||||
var policy_doc_name = document.getElementById('policy_doc_name').value;
|
||||
|
||||
if(customer == '' && cus_doc_name != '')
|
||||
{
|
||||
alert('choose customer');return false;
|
||||
}
|
||||
|
||||
if(policy == '' && policy_doc_name != '')
|
||||
{
|
||||
alert('choose policy');return false;
|
||||
}
|
||||
|
||||
if(policy == '' && customer == '')
|
||||
{
|
||||
alert('choose customer or policy');return false;
|
||||
}
|
||||
console.log('called');
|
||||
let customEvent = new CustomEvent('fetchFileListCustomEvent');
|
||||
$('#dms_search_form').submit();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -128,8 +128,10 @@ table.dataTable tbody td {
|
||||
<th></th>
|
||||
<th><div class="column-header">Insurer</div></th>
|
||||
<th><div class="column-header">Month</div></th>
|
||||
<th><div class="column-header">Statement</div></th>
|
||||
<th><div class="column-header">Line Items</div></th>
|
||||
<th><div class="column-header">Filename</div></th>
|
||||
<th><div class="column-header">Line<br>items</div></th>
|
||||
<th><div class="column-header">File<br>status</div></th>
|
||||
<th><div class="column-header">Invoice<br>status</div></th>
|
||||
<th><div class="column-header">User/Time</div></th>
|
||||
<th><div class="column-header">Action</div></th>
|
||||
</tr>
|
||||
@ -143,13 +145,32 @@ table.dataTable tbody td {
|
||||
<td><?php echo change_date_format($row['month'],'Y-m-d','M-Y'); ?></td>
|
||||
<td><?php echo $row['file_name'] ?> </td>
|
||||
<td><?php echo $row['line_items'] ?></td>
|
||||
<td><?php echo $row['file_status'];
|
||||
if($row['file_status'] == 'failed')
|
||||
{
|
||||
echo " <span class='col-xl-3 col-lg-4 col-sm-6'> <i class='fe-alert-circle' data-toggle='modal' data-target='#file-err-modal' data-err=" . $row['id'] . "></i></span>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td><?php echo (isset($invoice_status_array[ $row['invoice_status'] ]) ? $invoice_status_array[ $row['invoice_status'] ] : ' - ') ?>
|
||||
<span class="col-xl-3 col-lg-4 col-sm-6">
|
||||
<i class="fe-alert-circle"
|
||||
data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="<?php echo 'Exp Invoice Amt: ' . (isset($row['exp_inv_amt']) ? $row['exp_inv_amt'] : '0.00' ) . ' Received Invoice Amt: ' . (isset($row['received_inv_amt']) ? $row['received_inv_amt'] : '0.00') ; ?>"
|
||||
data-original-title="Tooltip on right">
|
||||
</i>
|
||||
</span>
|
||||
|
||||
</td>
|
||||
<td><?php echo change_date_format($row['created_at'],'Y-m-d H:i:s','d M Y h:i a').' by <br>'.$row['first_name'] ?></td>
|
||||
<td>
|
||||
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="showInvoiceStatusModal(event)">
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" data-exp-amt="<?= $row['exp_inv_amt'];?>" data-received-amt="<?= $row['received_inv_amt'];?>" onclick="showInvoiceStatusModal(event)">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Invoice status
|
||||
</a>
|
||||
</div>
|
||||
@ -167,57 +188,6 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
<!-- end table row -->
|
||||
|
||||
<!-- CD No form content modal-->
|
||||
<div class="modal fade" id="cd_form_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="title">Add CD Account Number</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body p-4">
|
||||
<div class="">
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="CDMasterForm" enctype="multipart/form-data">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="email">Opening Date<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="opening_date" id="opening_date" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">CD Account Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="cd_ac_no_data" name="cd_ac_no" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">Opening Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="opening_bal" name="opening_bal" onkeypress="return onlyNumbers(event)" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="file_upload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
@ -251,7 +221,7 @@ table.dataTable tbody td {
|
||||
<input type="date" class="form-control" id="statement_month" name="statement_month" placeholder="Enter Invoice Number" required>
|
||||
</div>
|
||||
<div class="form-group col-md-12" >
|
||||
<label for="statment">Statement </label>
|
||||
<label for="statment">Statement </label> <span><a href="downloadSampleInsurerStatement" id="download_sample_file" style="font-size: small;">Download sample file</a></span>
|
||||
<input type="file" class="form-control" name="statement" required accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
|
||||
</div>
|
||||
|
||||
@ -268,6 +238,21 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">File Rejected Reason</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- Invoice status content modal-->
|
||||
<div class="modal fade" id="invoice_modal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
@ -283,7 +268,7 @@ table.dataTable tbody td {
|
||||
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="addon_policy">Invoice Status <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="invoice_status" name="invoice_status" required>
|
||||
<option value="" selected>Select Invoice Status</option>
|
||||
@ -296,6 +281,14 @@ table.dataTable tbody td {
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" id="hidden_statement_id" name="hidden_statement_id">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="addon_policy">Exp Amount</label>
|
||||
<input type="text" class="form-control" id="modal_exp_amt" placeholder="Enter Invoice Number" disabled>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="addon_policy">Received Amount</label>
|
||||
<input type="text" class="form-control" id="modal_received_amt" placeholder="Enter Invoice Number" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -331,7 +324,7 @@ table.dataTable tbody td {
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
|
||||
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" required></td>
|
||||
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" required onchange="checkInvAmont(event)"></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
|
||||
<td><input type="date" class="form-control" name="payment_date[]" value="<?php echo date('Y-m-d'); ?>" required></td>
|
||||
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
|
||||
@ -344,7 +337,7 @@ table.dataTable tbody td {
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<!-- <button type="button" id="add_row_btn" class="btn btn-primary waves-effect waves-light mr-1">Add payment</button> -->
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -406,6 +399,21 @@ table.dataTable tbody td {
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#file-err-modal').on('show.bs.modal', function(event) {
|
||||
// console.log(event.relatedTarget);
|
||||
var myVal = $(event.relatedTarget).data('err');
|
||||
// console.log(myVal);
|
||||
var loader =
|
||||
'<div style="text-align: center;"><img src="<?php echo base_url()?>public/assets/images/simple_loader.gif" height="50px" width="50px" ></div>';
|
||||
$('#file-err-modal').find(".modal-body").html(loader);
|
||||
var model_data = fetchFileError(myVal);
|
||||
// console.log('data received.');
|
||||
// console.log(model_data);
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#invoiceForm').on('submit', function (e) {
|
||||
e.preventDefault(); // Prevent default form submission
|
||||
var form = document.getElementById('invoiceForm');
|
||||
@ -448,8 +456,8 @@ table.dataTable tbody td {
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
// Close the modal
|
||||
// var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
// myModal.hide();
|
||||
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
myModal.hide();
|
||||
|
||||
// Reset the form data
|
||||
$('#invoiceForm')[0].reset();
|
||||
@ -476,7 +484,7 @@ table.dataTable tbody td {
|
||||
|
||||
newRow.innerHTML = `
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
|
||||
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" required></td>
|
||||
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
|
||||
<td><input type="date" class="form-control" value="<?php echo date('Y-m-d'); ?>" name="payment_date[]" placeholder="Enter UTR No" required></td>
|
||||
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
|
||||
@ -498,13 +506,15 @@ table.dataTable tbody td {
|
||||
} else {
|
||||
// If pk is non-empty, send AJAX request to remove it from the backend
|
||||
$.ajax({
|
||||
url: '/delete-entry', // Your backend URL here
|
||||
type: 'POST',
|
||||
data: { pk: pk }, // Send the pk value to delete on server-side
|
||||
url: 'deletePaymentEntry/'+pk, // Your backend URL here
|
||||
type: 'GET',
|
||||
// data: { pk: pk }, // Send the pk value to delete on server-side
|
||||
success: function (response) {
|
||||
// On success, remove the row
|
||||
if (response.success) {
|
||||
console.log(response);
|
||||
if (response.dataStatus) {
|
||||
row.remove();
|
||||
alert('Payment deleted successfully.');
|
||||
} else {
|
||||
alert('Failed to delete the entry.');
|
||||
}
|
||||
@ -562,8 +572,12 @@ function showInvoiceStatusModal(event)
|
||||
{
|
||||
// console.log(event.target.data)
|
||||
var dataId = event.target.getAttribute('data-id');
|
||||
var dataExpAmt = event.target.getAttribute('data-exp-amt');
|
||||
var dataReceivedAmt = event.target.getAttribute('data-received-amt');
|
||||
// Set the value to a hidden input field in the modal
|
||||
document.getElementById('hidden_statement_id').value = dataId;
|
||||
document.getElementById('modal_exp_amt').value = dataExpAmt;
|
||||
document.getElementById('modal_received_amt').value = dataReceivedAmt;
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
// AJAX call to get the invoice details based on data-id
|
||||
@ -602,7 +616,7 @@ function showInvoiceStatusModal(event)
|
||||
var row = paymentTableBody.insertRow();
|
||||
row.innerHTML = `
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" value="${payment.id}"></td>
|
||||
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" required></td>
|
||||
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required></td>
|
||||
<td><input type="date" class="form-control" name="payment_date[]" value="${payment.received_date}" required></td>
|
||||
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
|
||||
@ -705,4 +719,65 @@ $(document).ready(function(){
|
||||
$('.loader-mask').delay(10).fadeOut('slow');
|
||||
});
|
||||
|
||||
function fetchFileError(file_id) {
|
||||
$('#loader').show();
|
||||
var apiURL = 'getFileErr/' + file_id;
|
||||
// console.log('fetchFileError');
|
||||
// console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$(this).find(".modal-body").html("");
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
// console.log((JSON.parse(response.data)));
|
||||
var file_error_data = (JSON.parse(response.data));
|
||||
var file_error_html = "";
|
||||
|
||||
if (file_error_data['error_code'] == 1) {
|
||||
file_error_html += 'The following row no(s) from excel are <span style="font-weight:bold">either already mapped / not found with policy transactions / duplicates.</span>';
|
||||
file_error_html += ' : ' + '<span style="font-weight:bolder">' + file_error_data['error_data'].join(',') + '</span>';
|
||||
}
|
||||
|
||||
// console.log(file_error_html);
|
||||
$('#file-err-modal').find(".modal-body").html(file_error_html);
|
||||
return file_error_html;
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
|
||||
function checkInvAmont(event)
|
||||
{
|
||||
var total = 0;
|
||||
document.querySelectorAll('input[name="invoice_amount[]"]').forEach(function(el) {
|
||||
let val = parseFloat(el.value) || 0;
|
||||
total += val;
|
||||
});
|
||||
var exp_amt = document.getElementById('modal_exp_amt').value;
|
||||
if(exp_amt < total)
|
||||
{
|
||||
alert('Exceeds expected amt');
|
||||
event.target.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -142,6 +142,8 @@
|
||||
|
||||
|
||||
<script src="https://cdn.datatables.net/plug-ins/2.0.8/sorting/scientific.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
toastr.options = {
|
||||
|
||||
@ -673,6 +673,9 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>">DMS Search</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@ -1341,7 +1341,6 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
}
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
}else{
|
||||
@ -1349,6 +1348,10 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
}
|
||||
|
||||
if(unit_length == 1){
|
||||
toAddUnitInManuall(unique_id, branch_units[0], 'addGridHTML')
|
||||
}
|
||||
|
||||
$('#gpa_sum_insured').hide();
|
||||
$('#btnGridSubmit').show();
|
||||
|
||||
@ -1837,13 +1840,18 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
// Count++
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
}
|
||||
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
}
|
||||
if(unit_length == 1){
|
||||
console.log(typeof secondary);
|
||||
let unique_id = secondary == 'false' ? null : secondary;
|
||||
toAddUnitInManuall(unique_id, branch_units[0], 'appendGridtHtml')
|
||||
}
|
||||
|
||||
|
||||
// Number to word
|
||||
@ -3031,12 +3039,6 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
|
||||
$relationshipElement.append(html);
|
||||
|
||||
if(policy_type == 1 || policy_type == 6 || policy_type == 7)
|
||||
{
|
||||
$('.radio-group .form-check').css('margin-right', '-50px');
|
||||
}
|
||||
|
||||
|
||||
if (obj['self'] > 0 && obj['spouse'] == 0 && obj['childrens'] == 0 && obj['parents'] == 0 && obj['parents-in-law'] == 0) {
|
||||
$('.radio-group .form-check').css('margin-right', '-60px');
|
||||
} else if (obj['self'] == 0 && obj['spouse'] > 0 && obj['childrens'] > 0 && obj['parents'] == 0 && obj['parents-in-law'] == 0) {
|
||||
@ -3054,15 +3056,12 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
} else if (obj['self'] > 0 && obj['spouse'] == 0 && obj['childrens'] == 0 && obj['parents'] > 0 && obj['parents-in-law'] > 0){
|
||||
$('.radio-group .form-check').css('margin-right', '-60px');
|
||||
} else {
|
||||
$('.radio-group .form-check').css('margin-right', '-110px');
|
||||
$('.radio-group .form-check').css('margin-right', '-60px');
|
||||
}
|
||||
|
||||
|
||||
// if (obj['self'] > 0 && obj['spouse'] > 0 && obj['childrens'] == 0 && obj['parents'] > 0 && obj['parents-in-law'] > 0)
|
||||
// {
|
||||
// $('.radio-group .form-check').css('margin-right', '-60px');
|
||||
// }
|
||||
|
||||
if(policy_type == 1 || policy_type == 6 || policy_type == 7){
|
||||
$('.radio-group .form-check').css('margin-right', '-50px');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3891,6 +3890,10 @@ function appendFourthAndSixthRackRate(data = null, uniqueId = null)
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
}
|
||||
|
||||
if(unit_length == 1){
|
||||
toAddUnitInManuall(unique_id, branch_units[0], 'appendFourthAndSixthRackRate')
|
||||
}
|
||||
}
|
||||
|
||||
function checkValideUnits(unique_id = null)
|
||||
@ -4319,6 +4322,134 @@ function applyStyles(tabId) {
|
||||
}
|
||||
}
|
||||
|
||||
function toAddUnitInManuall(unique_id = null, branch_unit = '', whichFunction) {
|
||||
|
||||
console.log('toAddUnitInManuall unique_id', unique_id)
|
||||
console.log('toAddUnitInManuall whichFunction', whichFunction)
|
||||
|
||||
var id = $('#grid')[0];
|
||||
console.log(id);
|
||||
var container = $('#grid_content_input');
|
||||
|
||||
if (unique_id) {
|
||||
id = $('#grid_'+unique_id)[0];
|
||||
container = $('#grid_content_input_for_additional_'+unique_id);
|
||||
}
|
||||
|
||||
console.log('checkValideUnits id', id);
|
||||
console.log('checkValideUnits container', container);
|
||||
|
||||
if (id.value === '3') {
|
||||
|
||||
var units = container.find('input[name="3_unit[]"]');
|
||||
var unitValues = [];
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '4') {
|
||||
|
||||
var units = container.find('input[name="4_unit[]"]');
|
||||
var unitValues = [];
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '2' || id.value === '9') {
|
||||
|
||||
var units = container.find('input[name="gpa_unit29[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '5') {
|
||||
|
||||
var units = container.find('input[name="5_unit[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '6') {
|
||||
|
||||
var units = container.find('input[name="6_unit[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '7') {
|
||||
|
||||
var units = container.find('input[name="7_unit[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '10') {
|
||||
|
||||
var units = container.find('input[name="10_unit[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '8') {
|
||||
|
||||
var units = container.find('input[name="8_unit[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '11') {
|
||||
|
||||
var units = container.find('input[name="11_unit[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '12') {
|
||||
|
||||
var units = container.find('input[name="12_unit[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '13') {
|
||||
|
||||
var units = container.find('input[name="13_unit[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (id.value === '1') {
|
||||
|
||||
var selectedValue = $('#si_or_bp').val();
|
||||
if (selectedValue == 1) {
|
||||
|
||||
var units = container.find('input[name="gpa_unit_1[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
} else if (selectedValue == 3) {
|
||||
|
||||
var units = container.find('input[name="gpa_unit_3[]"]');
|
||||
|
||||
units.each(function() {
|
||||
var value = $(this).val(branch_unit);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -89,6 +89,8 @@
|
||||
<input type="hidden" name="client_id" id="client_id_for_edit">
|
||||
<input type="hidden" name="insurer_id" id="insurer_id">
|
||||
<input type="hidden" name="cd_ac_no" id="cd_ac_no">
|
||||
<input type="hidden" name="ct_type" id="ct_type">
|
||||
|
||||
|
||||
<!-- Client Row -->
|
||||
<div class="row">
|
||||
@ -200,8 +202,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" required>
|
||||
<label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
@ -215,12 +217,12 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="endorse_eff_date">Endorsement Effective Date<span id="base_danger" class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="endorse_eff_date" name="endorse_eff_date" placeholder="DD/MM/YYYY" required>
|
||||
<label for="endorse_eff_date">Endorsement Effective Date<span id="base_danger" class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="endorse_eff_date" name="endorse_eff_date" placeholder="DD/MM/YYYY" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy">No of Employee<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>
|
||||
|
||||
@ -228,7 +230,7 @@
|
||||
<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>
|
||||
@ -267,10 +269,10 @@
|
||||
</a>
|
||||
</h4>
|
||||
<div id="collapseFour" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_3">
|
||||
<div class="row" id="add_more_row">
|
||||
<!-- <div class="col-md-2">
|
||||
<div class="row d-none" id="add_more_row">
|
||||
<div class="col-md-2">
|
||||
<input type="number" id="setInsurerCount" class="form-control" placeholder="Enter count">
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- <div class="col-md-2">
|
||||
<a id="addInsurer" class="btn btn-primary mb-3">Add Insurer</a>
|
||||
</div> -->
|
||||
@ -284,64 +286,109 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Premium Details</th>
|
||||
<!-- Add additional header columns if needed for insurers -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<tr id="table_tr_1">
|
||||
<td>Insurer</td>
|
||||
<!-- Columns for dynamic insurers will be added here -->
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_2" style="display: none;">
|
||||
<td>Is Leader?</td>
|
||||
</tr>
|
||||
<tr id="co_share_per_tr" style="display: none;">
|
||||
<tr id="table_tr_3" style="display: none;">
|
||||
<td>Co-Share %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_4">
|
||||
<td>Base Premium</td>
|
||||
</tr>
|
||||
<tr id="tp_premium_tr">
|
||||
<tr class="hidetp" id="table_tr_5">
|
||||
<td id="tp_premium_td">TP Premium</td>
|
||||
</tr>
|
||||
<tr id="co_premium_tr" style="display: none;">
|
||||
<tr class="hideter" id="table_tr_6" style="display: none;">
|
||||
<td>TEP Premium</td>
|
||||
</tr>
|
||||
<tr id="table_tr_7" style="display: none;">
|
||||
<td>Co-Premium</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_8">
|
||||
<td>CGST</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_9">
|
||||
<td>SGST</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_10">
|
||||
<td>IGST</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_11">
|
||||
<td>GST Amount</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_12">
|
||||
<td>Stamp Duty</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_13">
|
||||
<td>Total</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_14">
|
||||
<td>Agreed BP %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="hidetp" id="table_tr_15">
|
||||
<td id="agree_tp_td">Agreed TP %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="hideter" id="table_tr_16" style="display: none;">
|
||||
<td id="agree_tp_td">Agreed TEP %</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr id="table_tr_17">
|
||||
<td>Agreed Amount</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="table_tr_18">
|
||||
<td>Standard BP %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="std_head">Standard TP %</td>
|
||||
<tr class="hidetp" id="table_tr_19">
|
||||
<td>Standard TP %</td>
|
||||
</tr>
|
||||
<tr style="display: none;">
|
||||
<td>id</td>
|
||||
<tr class="hideter" id="table_tr_20" style="display: none;">
|
||||
<td>Standard TEP %</td>
|
||||
</tr>
|
||||
<tr id="table_tr_21">
|
||||
<td>Actual BP Amount</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_22">
|
||||
<td>Actual TP Amount</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_23" style="display: none;">
|
||||
<td>Actual TEP Amount</td>
|
||||
</tr>
|
||||
<tr id="table_tr_24">
|
||||
<td>Actual BP %</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_25">
|
||||
<td>Actual TP %</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_26" style="display: none;">
|
||||
<td>Actual TEP %</td>
|
||||
</tr>
|
||||
<tr id="table_tr_27">
|
||||
<td>Actual BP Brokerage Amount</td>
|
||||
</tr>
|
||||
<tr class="hidetp" id="table_tr_28">
|
||||
<td>Actual TP Brokerage Amount</td>
|
||||
</tr>
|
||||
<tr class="hideter" id="table_tr_29" style="display: none;">
|
||||
<td>Actual TEP Brokerage Amount</td>
|
||||
</tr>
|
||||
<tr id="table_tr_30">
|
||||
<td>Expected Amount</td>
|
||||
</tr>
|
||||
<tr id="table_tr_31">
|
||||
<td>Variance</td>
|
||||
</tr>
|
||||
<tr id="table_tr_32">
|
||||
<td>Reward</td>
|
||||
</tr>
|
||||
<tr id="table_tr_33" style="display: none;">
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -360,7 +407,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<div class="form-group text-right m-b-0" id="submitButton">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
|
||||
</div>
|
||||
|
||||
@ -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: '<?php echo base_url('util/get_client_policy_data_using_policy_no_and_endo_no/');?>'+ 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: '<?php echo base_url('util/checkInvoiceStatus/');?>'+ 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() {
|
||||
</th>
|
||||
`);
|
||||
|
||||
|
||||
// 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 = `<td>
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>`;
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>`;
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
newCell = `<td>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]" disabled>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
<label class="switch" style="position: relative; top: 5px; left: 35px;">
|
||||
<input data-id="${insurerCount}" id="co_share_type_${insurerCount}" type="checkbox" name="co_share_type[]">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="inception_type" style="position: relative; top: 5px; left: 40px;">Leader Yes</label>
|
||||
</td>`;
|
||||
break;
|
||||
case 2: // Co-Share %
|
||||
newCell = `<td><input type="text" name="co_share_per[]" oninput="validateRange(this)"></td>`;
|
||||
newCell = `<td><input type="text" 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}')"></td>`;
|
||||
newCell = `<td><input type="text" id="base_premium_${insurerCount}" name="base_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 4: // TP / Ter Premium
|
||||
newCell = `<td><input type="text" id="tp_ter_premium_${insurerCount}" name="tp_ter_premium[]" oninput="amountCalculation('${insurerCount}')"></td>`;
|
||||
case 4: // TP Premium
|
||||
newCell = `<td><input type="text" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 5: // Co Premium
|
||||
newCell = `<td><input type="text" id="co_premium_${insurerCount}" name="co_premium[]" oninput="amountCalculation('${insurerCount}')"></td>`;
|
||||
case 5: // Ter Premium
|
||||
newCell = `<td><input type="text" id="ter_premium_${insurerCount}" name="ter_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 6: // CGST
|
||||
newCell = `<td><input type="text" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')"></td>`;
|
||||
case 6: // co Premium
|
||||
newCell = `<td><input type="text" id="co_premium_${insurerCount}" name="co_premium[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 7: // SGST
|
||||
newCell = `<td><input type="text" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')"></td>`;
|
||||
case 7: // CGST
|
||||
newCell = `<td><input type="text" id="cgst_${insurerCount}" name="cgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 8: // IGST
|
||||
newCell = `<td><input type="text" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')"></td>`;
|
||||
case 8: // SGST
|
||||
newCell = `<td><input type="text" id="sgst_${insurerCount}" name="sgst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 9: // GST Amount
|
||||
newCell = `<td><input type="text" class="readonly-color" id="gst_amount_${insurerCount}" name="gst_amount[]" readonly></td>`;
|
||||
case 9: // IGST
|
||||
newCell = `<td><input type="text" id="igst_${insurerCount}" name="igst[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 10: // Stamp Duty
|
||||
newCell = `<td><input type="text" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')"></td>`;
|
||||
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>`;
|
||||
break;
|
||||
case 11: // Total
|
||||
newCell = `<td><input type="text" class="readonly-color" id="total_amt_${insurerCount}" name="total[]" readonly></td>`;
|
||||
case 11: // Stamp Duty
|
||||
newCell = `<td><input type="text" id="stamp_duty_${insurerCount}" name="stamp_duty[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 12: // Agreed BP %
|
||||
newCell = `<td><input type="text" name="agreed_bp[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
case 12: // Total
|
||||
newCell = `<td><input type="text" class="readonly-color" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 13: // Agreed TP / Ter %
|
||||
newCell = `<td><input type="text" name="agreed_tp_ter[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
case 13: // Agreed BP %
|
||||
newCell = `<td><input type="text" name="agreed_bp[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 14: // Agreed Amount
|
||||
newCell = `<td><input type="text" name="agreed_amount[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
case 14: // Agreed TP %
|
||||
newCell = `<td><input type="text" name="agreed_tp[]" oninput="validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 15: // Standard BP %
|
||||
case 15: // Agreed Ter %
|
||||
newCell = `<td><input type="text" 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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
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>`;
|
||||
break;
|
||||
case 31: // Reward
|
||||
newCell = `<td><input type="text" id="reward_${insurerCount}" name="reward[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 32: // ID For Update
|
||||
newCell = `<td><input type="hidden" name="co_share_id[]" id="co_share_id[]" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
|
||||
case 16: // Standard TP %
|
||||
newCell = `<td class="std_tp_td"><input type="text" class="readonly-color" name="standard_tp[]" readonly></td>`;
|
||||
newCell += `<td class="std_ter_td" style="display: none;"><input type="text" class="readonly-color" name="standard_tep[]" readonly></td>`;
|
||||
break;
|
||||
case 17: // id
|
||||
newCell = `<td><input type="hidden" name="co_share_id[]"></td>`;
|
||||
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;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -52,11 +52,7 @@ table.dataTable thead th {
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Endorsement List</h4>
|
||||
</div>
|
||||
<div class="col-2" id="add_div" style="text-align: right; position: relative;top: 56px; left: 314px;">
|
||||
<button type="button" id="change_status" class="btn btn-primary waves-effect waves-light" onclick="changeInvoiceStatus(this)">Invoice Status</button>
|
||||
</div>
|
||||
|
||||
<div class="col-1" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;">
|
||||
<div class="col-3" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;">
|
||||
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" onclick="hide_list_show_add()">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -64,7 +60,6 @@ table.dataTable thead th {
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Issuer</th>
|
||||
<th>Client</th>
|
||||
<th>Branch</th>
|
||||
@ -83,7 +78,6 @@ table.dataTable thead th {
|
||||
<tbody>
|
||||
<?php foreach($endorsement_data_list as $row){ ?>
|
||||
<tr>
|
||||
<td><input type="checkbox" class="row-select" data-id="<?= $row['id']; ?>"></td>
|
||||
<td><?php echo $issuer[$row['issuer']] ?? ''; ?></td>
|
||||
<td><?php echo $row['client_short_name']; ?></td>
|
||||
<td><?php echo $row['client_branch_name']; ?></td>
|
||||
@ -118,54 +112,6 @@ table.dataTable thead th {
|
||||
|
||||
<?php include('policy_transaction_endorsement_form.php'); ?>
|
||||
|
||||
<!-- Invoice status content modal-->
|
||||
<div class="modal fade" id="invoice_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="title">Update Invoice Status</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body p-4">
|
||||
<div class="">
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="invoiceForm" enctype="multipart/form-data">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="addon_policy"> Invoice Status <spanclass="text-danger">*</spanclass=></label>
|
||||
<select class="form-control" id="invoice_status_modal" name="invoice_status" required>
|
||||
<option value="" selected>Select Invoice Status</option>
|
||||
<?php
|
||||
if (isset($invoice_status) && count($invoice_status)) {
|
||||
foreach ($invoice_status as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12" style="display: none;" id="invoice_no_div_modal">
|
||||
<label for="invoice_no">Invoice Number<span id="base_danger" class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="invoice_no_modal" name="invoice_no" placeholder="Enter Invoice Number" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var client_list = ''; // local variable for storing the client branch list
|
||||
@ -209,7 +155,7 @@ table.dataTable thead th {
|
||||
|
||||
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: [{
|
||||
@ -390,22 +336,6 @@ table.dataTable thead th {
|
||||
});
|
||||
}
|
||||
|
||||
function changeInvoiceStatus()
|
||||
{
|
||||
var ids = logSelectedIds();
|
||||
|
||||
console.log('changeInvoiceStatus Selected IDs:', ids);
|
||||
|
||||
if(ids.length > 0){
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
myModal.show();
|
||||
|
||||
} else {
|
||||
toastr.warning('Please select the transaction', 'Warning')
|
||||
}
|
||||
}
|
||||
|
||||
function logSelectedIds()
|
||||
{
|
||||
var selectedIds = [];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -113,11 +113,8 @@ table.dataTable tbody td {
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Policy List</h4>
|
||||
</div>
|
||||
<div class="col-2" id="add_div" style="text-align: right; position: relative;top: 56px; left: 314px;">
|
||||
<button type="button" id="change_status" class="btn btn-primary waves-effect waves-light" onclick="changeInvoiceStatus(this)">Invoice Status</button>
|
||||
</div>
|
||||
|
||||
<div class="col-1" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;">
|
||||
<div class="col-3" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;">
|
||||
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" onclick="hide_list_show_add();">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -125,7 +122,6 @@ table.dataTable tbody td {
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><div class="column-header">Issuer</div></th>
|
||||
<th><div class="column-header">Issuing Type</div></th>
|
||||
<th><div class="column-header">Client Type</div></th>
|
||||
@ -146,7 +142,6 @@ table.dataTable tbody td {
|
||||
<tbody>
|
||||
<?php foreach($inception_data_list as $row){ ?>
|
||||
<tr>
|
||||
<td><input type="checkbox" class="row-select" data-id="<?= $row['id']; ?>"></td>
|
||||
<td><?php echo $issuer[$row['issuer']]; ?></td>
|
||||
<td><?php echo $issuing_type[$row['issue_type']]; ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
@ -235,55 +230,6 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Invoice status content modal-->
|
||||
<div class="modal fade" id="invoice_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="title">Update Invoice Status</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body p-4">
|
||||
<div class="">
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="invoiceForm" enctype="multipart/form-data">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="addon_policy"> Invoice Status <spanclass="text-danger">*</spanclass=></label>
|
||||
<select class="form-control" id="invoice_status_modal" name="invoice_status" required>
|
||||
<option value="" selected>Select Invoice Status</option>
|
||||
<?php
|
||||
if (isset($invoice_status_array) && count($invoice_status_array)) {
|
||||
foreach ($invoice_status_array as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12" style="display: none;" id="invoice_no_div_modal">
|
||||
<label for="invoice_no">Invoice Number<span id="base_danger" class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="invoice_no_modal" name="invoice_no" placeholder="Enter Invoice Number" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="file_upload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
@ -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()
|
||||
|
||||
<?php if (session()->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($('<option>', {
|
||||
@ -840,22 +791,6 @@ function fileupload(input)
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function changeInvoiceStatus()
|
||||
{
|
||||
var ids = logSelectedIds();
|
||||
|
||||
console.log('changeInvoiceStatus Selected IDs:', ids);
|
||||
|
||||
if(ids.length > 0){
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
myModal.show();
|
||||
|
||||
} else {
|
||||
toastr.warning('Please select the transaction', 'Warning')
|
||||
}
|
||||
}
|
||||
|
||||
function logSelectedIds()
|
||||
{
|
||||
var selectedIds = [];
|
||||
@ -930,6 +865,82 @@ function validateForm()
|
||||
return checkInputs(); // Call checkInputs before form submission
|
||||
}
|
||||
|
||||
function addHTMLInputForVehicleFileUpload(data = null)
|
||||
{
|
||||
const container = document.getElementById('dynamic-form-container-for-vehicle-file-upload');
|
||||
const newRow = document.createElement('div');
|
||||
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="other_docs_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_name[]" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInputForVehicleFileUpload(this)">x</a>
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInputForVehicleFileUpload(this)">+</a>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(newRow);
|
||||
|
||||
if (data !== null && data.db_column_name !== undefined) {
|
||||
const selectElement = newRow.querySelector('.db-column-name-select');
|
||||
selectElement.value = data.db_column_name;
|
||||
}
|
||||
}
|
||||
|
||||
function appendVehicleFileTableBody(data)
|
||||
{
|
||||
console.log(data);
|
||||
|
||||
// Clear the table body
|
||||
$('#vehicle_table_bd').empty();
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var row = $('<tr>');
|
||||
|
||||
// Add row number, document name, and file name
|
||||
row.append($('<td>').text(index + 1));
|
||||
row.append($('<td>').text(item.other_docs_name));
|
||||
row.append($('<td>').text(item.file_name));
|
||||
|
||||
// Create the download link
|
||||
var downloadLink = $('<a>')
|
||||
.attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name)
|
||||
.attr('style', 'font-size:18px;')
|
||||
.attr('data-id', item.id)
|
||||
.addClass('fa fa-download')
|
||||
.text(' '); // Space after the icon
|
||||
|
||||
// Create the delete link
|
||||
var deleteLink = $('<a>')
|
||||
.attr('style', 'font-size:18px;')
|
||||
.attr('data-id', item.id)
|
||||
.addClass('fa fa-trash')
|
||||
.text(' '); // Space after the icon
|
||||
|
||||
// Append the download and delete icons inside the same <td>
|
||||
row.append($('<td>').append(downloadLink));
|
||||
|
||||
// Append the row to the table body
|
||||
$('#vehicle_table_bd').append(row);
|
||||
});
|
||||
}
|
||||
|
||||
function removeHTMLInputForVehicleFileUpload(element)
|
||||
{
|
||||
const container = document.getElementById('dynamic-form-container-for-vehicle-file-upload');
|
||||
const rows = container.querySelectorAll('.dynamic-form-row');
|
||||
|
||||
if (rows.length > 1) {
|
||||
const row = element.closest('.dynamic-form-row');
|
||||
row.remove();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -995,11 +1006,11 @@ $('#issue_type').change(function(){
|
||||
if(value == 2){
|
||||
$('#revenue_type').val('EA')
|
||||
$('#renewal').show()
|
||||
$('.sded_dates').show()
|
||||
// $('.sded_dates').show()
|
||||
$('#source_client_policy_id').attr('required', true)
|
||||
}else{
|
||||
$('#renewal').hide()
|
||||
$('.sded_dates').hide()
|
||||
// $('.sded_dates').hide()
|
||||
$('#source_client_policy_id').attr('required', false)
|
||||
$('#policy_start_date').val('');
|
||||
$('#policy_end_date').val('');
|
||||
@ -1239,7 +1250,7 @@ $('#issue_type').change(function(){
|
||||
let data = policy_list[branch_id];
|
||||
if(issue_type == 2)
|
||||
{
|
||||
appendRenewalPolicies(data)
|
||||
appendRenewalPolicies(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -14,10 +14,24 @@
|
||||
<span class="d-none d-sm-inline-block">File Upload</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab2">
|
||||
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">KYC Docs</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item" id="hide_vehicle_tab" style="display: none;">
|
||||
<a href="#vehicle-docs-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="vehicle_tab">
|
||||
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Vehicle Docs</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('policy_transaction_inception_form.php'); ?>
|
||||
<?php include('drive_file_upload.php'); ?>
|
||||
<?php include('client_kyc.php'); ?>
|
||||
<?php include('vehicle_docs.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -27,6 +41,7 @@
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#kyc_tab').on('click', function(e) {
|
||||
var ptId = $('#policy_tranction_primarykey').val();
|
||||
|
||||
@ -38,6 +53,30 @@ $(document).ready(function() {
|
||||
$('#g_drive_file_upload_sbt_btn').show()
|
||||
}
|
||||
});
|
||||
|
||||
$('#kyc_tab2').on('click', function(e) {
|
||||
var ptId = $('#policy_tranction_primarykey').val();
|
||||
|
||||
if (!ptId) { // Check if ptId is empty or null
|
||||
e.preventDefault(); // Prevent the tab from opening
|
||||
$('#btn_other_docs').hide()
|
||||
toastr.warning('Please create Policy before proceeding to File Upload.');
|
||||
}else{
|
||||
$('#btn_other_docs').show()
|
||||
}
|
||||
});
|
||||
|
||||
$('#vehicle_tab').on('click', function(e) {
|
||||
var ptId = $('#policy_tranction_primarykey').val();
|
||||
|
||||
if (!ptId) { // Check if ptId is empty or null
|
||||
e.preventDefault(); // Prevent the tab from opening
|
||||
$('#vehicle_file_upload_sbt_btn').hide()
|
||||
toastr.warning('Please create Policy before proceeding to File Upload.');
|
||||
}else{
|
||||
$('#vehicle_file_upload_sbt_btn').show()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -16,7 +16,6 @@ table.dataTable tbody td {
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
@ -29,60 +28,60 @@ table.dataTable tbody td {
|
||||
|
||||
</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>User Name</th>
|
||||
<th>Month</th>
|
||||
<th>Business Type</th>
|
||||
<th>Date</th>
|
||||
<th>Sales Generated By (Name)</th>
|
||||
<th>Branch (JIBS)</th>
|
||||
<th>Serviced By (Name)</th>
|
||||
<th>Client Name</th>
|
||||
<th>Client Address</th>
|
||||
<th>Client Type</th>
|
||||
<th>Payment From</th>
|
||||
<th>Reference</th>
|
||||
<th>Remarks</th>
|
||||
<th>Policy/Endorsement</th>
|
||||
<th>Policy No</th>
|
||||
<th>Endorsement No</th>
|
||||
<th>Insurer Name</th>
|
||||
<th>Insurer Branch</th>
|
||||
<th>TPA</th>
|
||||
<th>Days Until Expiry</th>
|
||||
<th>Endorsement Effective Date</th>
|
||||
<th>Policy Effective Date</th>
|
||||
<th>Policy Expiry Date</th>
|
||||
<th>Policy Type</th>
|
||||
<th>BAP Group</th>
|
||||
<th>Vehicle Number</th>
|
||||
<th>Base Premium</th>
|
||||
<th>Terrorism/TP</th>
|
||||
<th>Premium (without GST)</th>
|
||||
<th>GST @ 18%</th>
|
||||
<th>Total Premium</th>
|
||||
<th>Base Revenue %</th>
|
||||
<th>TP / Terrorism Revenue %</th>
|
||||
<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>Payment Status</th>
|
||||
<th>UTR</th>
|
||||
<th>Payment Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($report_list)) { ?>
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S. No</th>
|
||||
<th>User Name</th>
|
||||
<th>Month</th>
|
||||
<th>Business Type</th>
|
||||
<th>Date</th>
|
||||
<th>Sales Generated By (Name)</th>
|
||||
<th>Branch (JIBS)</th>
|
||||
<th>Serviced By (Name)</th>
|
||||
<th>Client Name</th>
|
||||
<th>Client Address</th>
|
||||
<th>Client Type</th>
|
||||
<th>Payment From</th>
|
||||
<th>Reference</th>
|
||||
<th>Remarks</th>
|
||||
<th>Policy/Endorsement</th>
|
||||
<th>Policy No</th>
|
||||
<th>Endorsement No</th>
|
||||
<th>Insurer Name</th>
|
||||
<th>Insurer Branch</th>
|
||||
<th>TPA</th>
|
||||
<th>Days Until Expiry</th>
|
||||
<th>Endorsement Effective Date</th>
|
||||
<th>Policy Effective Date</th>
|
||||
<th>Policy Expiry Date</th>
|
||||
<th>Policy Type</th>
|
||||
<th>BAP Group</th>
|
||||
<th>Vehicle Number</th>
|
||||
<th>Base Premium</th>
|
||||
<th>Terrorism/TP</th>
|
||||
<th>Premium (without GST)</th>
|
||||
<th>GST @ 18%</th>
|
||||
<th>Total Premium</th>
|
||||
<th>Base Revenue %</th>
|
||||
<th>TP / Terrorism Revenue %</th>
|
||||
<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>Payment Status</th>
|
||||
<th>UTR</th>
|
||||
<th>Payment Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($report_list)) { ?>
|
||||
<?php foreach($report_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
@ -90,7 +89,7 @@ table.dataTable tbody td {
|
||||
<td><?php echo $row['policy_issue_month']; ?></td>
|
||||
<td><?php echo $row['revenue_type']; ?></td>
|
||||
<td><?php echo $row['policy_issue_date']; ?></td>
|
||||
<td><?php echo $row['salse_person_name']; ?></td> <!-- Sales Generated By (Name) -->
|
||||
<td><?php echo $row['salse_person_name']; ?></td> <!-- Sales Generated By (Name) -->
|
||||
<td><?php echo 'Chennai'; ?></td>
|
||||
<td><?php echo $row['service_person_name']; ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
@ -134,9 +133,9 @@ table.dataTable tbody td {
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
@ -155,11 +154,18 @@ $(document).ready(function() {
|
||||
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',
|
||||
}, ],
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
@ -171,4 +177,5 @@ $(document).ready(function() {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
119
app/Views/vehicle_docs.php
Normal file
119
app/Views/vehicle_docs.php
Normal file
@ -0,0 +1,119 @@
|
||||
<div class="tab-pane fade" id="vehicle-docs-tab">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<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">
|
||||
<form class="parsley-examples" id="vehicle_file_upload_form" method="post"
|
||||
enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" id="client_id_for_vehicle_file_upload" name="client_id">
|
||||
<input type="hidden" id="vehicle_id_for_file_upload" name="vehicle_id">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div id="dynamic-form-container-for-vehicle-file-upload"></div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="vehicle_file_upload_sbt_btn">Submit</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="vehicle_file_table" 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;">Vehicle File List</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>Docs Name</th>
|
||||
<th>File Name</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="vehicle_table_bd">
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$("#vehicle_file_upload_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var isValid = $('#vehicle_file_upload_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
|
||||
form_action = '<?= base_url("client/vehicle/create"); ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var formData = new FormData($('#vehicle_file_upload_form')[0]);
|
||||
|
||||
$.ajax({
|
||||
data:formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log(res);
|
||||
|
||||
if(res.status == true){
|
||||
toastr.success(res.message, 'Success');
|
||||
appendVehicleFileTableBody(res.vehicle_docs);
|
||||
}else{
|
||||
toastr.error(res.message, 'Error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
13
nhance-app-google-drive.json
Normal file
13
nhance-app-google-drive.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"type": "service_account",
|
||||
"project_id": "nhance-app-4fedb",
|
||||
"private_key_id": "e764472bb4a0c9226d172f7aebdd2eb785c5fca8",
|
||||
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCzyKk6yQqLZHnL\n8+qRwMHtIhV3kR6bYuCol7LTU/aRyTZpFafewJ/6y5bMvvHaRSaohuuTjDhp5H+w\nf7DAiWO06C/YdgZ/tv3dPM8FnkOEnwxUXVgJskK+srJ4g6zsYkT+0DNI0qMJRW5m\n0jv+HKPJ0axCAPcUZUVtraV/HFHF7pJp4oWMFD5X7Jhv7kbW3TetJofSN3SvRvr8\nyfCiVGzqgF0Gx0Tgd25GTMOuRXTGoTlQeDHFMm19g8YY1de0Ol9WqFey6E8e6a/h\nw8KHGdywgsI+q5yF0EIUdxKc6U9Bea25k0YnKHSCsJjJTVlKW+xlxR6wA1yuBb66\n2dAhEzldAgMBAAECggEACEssKpb5dadVPdt+PJ2r58CueD1JfRL8i/p98hhjY9bo\niJEXSFDfI6aYFp22ZYKfWNK3wMimr5SuPIB5F6C4gn3b+y95ERPQtg/AkyDgB39M\nBjZNW4EnabAWFWlc2FJknjnd+JcmLnhoy+h/gpnKoOkbYISDFKQWJfJtRvLE/1on\nhKvnhEkO++93HZp6KPYA21BQIWt6q6gYjjjwxQIHE0Vg30bZC8ciNVaVlmOnpoKW\nlsQ3+TL+b6vDsSxez4hSqWlua7wWL6JgKvyGw6FGiDLGjvTEvVQ0cvfykCDmO5td\nWvVihTMOMXEMx+iVAUOXJLrSPOFGXxSHL9jilqCn0QKBgQDu4P64sE5T15rA+83B\neRMyQUfLru/oxyQ7pAbgRk4nwQj1mXcdD3/RpHF6jg0rt0msRjkzkqyWiJN0qsZ9\nlQY7h0I8pu8dxFhbd7LLcPaNV+OpNAokG06dBK8qhuMcZBlRfvJ3ye5L/Dk0Z7A4\nPw6/OxySns+kzfxtPdpJTNeqFQKBgQDAq2BXm+MsjqjZm2Z1LFMgZcjRLUu4ylMC\n9W3jqd35dBypcafAJ3TqhPLsx+HyWuC+GLMWohx3XGU7oZabGg1zuWAS8A4hnogZ\nk47OT3OYHDaT65HFmSAGJy1UFVvESUdiVzPqO3Xn9dYvRIw6By2b09w+kD1oxmE0\nvAh5UFAMKQKBgHg06plfxxqzzWE9lS290qYgaZOaxYla5OXKRdeIKX4hynNktab/\nDLAfUyd74i7UfhNeBxznu0fJFILKCTZazpcYGoHQ81UEX/4vPt7XSoqX5q1XzZ6b\nyzSCje8Vj6XSzVbQTg1vpSXBl7vCTdAQE0ix40/48L6bFWKXlIf8Ti59AoGAd8UR\nKuT5H6W/SSbVVlmrgyRC5eWmgMUlPV2cZj4egwevGZZRlZ3xjCgBazgGOUZNF177\nVUKJN5n0RFF68ggL/LhsBNm9ryCBsoSL7axuS0yekO2LvK4nvit0fiSY2zhCa9uR\npjY4YW3tK40NLrVvoMLe0vWPdyZ7HvEUw3UtjaECgYAMoonkNACD7EyWesAQzjpD\ntAL5ByXtFkMqMMr8ELLoDU2D5+qzb6gu0+GuYzGvxtYQHz2L+cP7yonn8IRBrAO1\njZCi2Mn1qOYecSGBnv6rotcagMALXwExkymjjVxPLiOae7A01sxSFDpqtRBww2JA\ngFsHNMpkQ1KmZu7LW0q1fg==\n-----END PRIVATE KEY-----\n",
|
||||
"client_email": "only-drive-access@nhance-app-4fedb.iam.gserviceaccount.com",
|
||||
"client_id": "116214376249781337850",
|
||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||
"token_uri": "https://oauth2.googleapis.com/token",
|
||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/only-drive-access%40nhance-app-4fedb.iam.gserviceaccount.com",
|
||||
"universe_domain": "googleapis.com"
|
||||
}
|
||||
13
public/oauth-412703-c47b73db19c0.json
Normal file
13
public/oauth-412703-c47b73db19c0.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"type": "service_account",
|
||||
"project_id": "oauth-412703",
|
||||
"private_key_id": "c47b73db19c095378abf2560503ea131d962087d",
|
||||
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDlASZZ/3WHCpXQ\nSf3N5VfduTnR6d2HGlsntICO1HFZLratHK3Vl3qWu0IFsX300GlpW+vh3ksgx2d5\nqmk+gXSO6CzfdhPfA1O6+ldyESaeM7wN3CYLIBKwk2krD6y4EXwnX4HkUE0c1Zcx\njMX1nl5SXkViwd2BcP8SGksofR2HfZFkAxQ8bbJRZtVKjXYgJs/JMReR5YoCwEv5\nHAwwvdZBOiOJbW+90Z+Ao3YjnMkjhCdJLa8b5hH1HnPgu2La/5JEPHo7i62ygpVy\nuUJzMsAXvsN/3ZLUvpYIbHnqTkiES5SL4+UcBqjHfUfKt0IXafnIzJzKXIEiDHyj\nzxLlJVB/AgMBAAECggEAFNd0cpdlzlr/xHufbjgztXmwkfKrVyrmZegvFRCvmjK+\nrGWiSoClRweW3CbJtFitZ0nW33EYPEz5lWCVgHtOrNzjjJjV+SN34Nn80GRQM/C4\najiBe9y45robxbABA6WPu5OdIjbOtdOYlYle0NpPckajIPhM3QV4KWEcOvycDeML\nIFY711YzAhGbEaXufGDBGdgSGaqhgiuEUw7nuOXu21rMgsnRNEDV13vpqVJSym6I\niw6F8gOTtQCD1W00XWltnQgtSHiewTyh9dNw2bMaNNQb6WiEw3v+oYxGtWr+ocJX\naZOJSwwdpQaq9JXvC179GNalHGoCySBIMfFKYWIRjQKBgQDyt2ME4cXmQyq5QihS\nlu2KiP5fwETDCCTU2MZkn34uZkjpeXpRawT7IxM8b3e4S+gtbenL/dZiDb3SQlD2\nriL6CqA8zhQfhQbFUCoPeKBVqMnBgdJw9ElKxAo1rgrksx8eby0E1nIocS2v2Ibe\nOx68gID6qLA/+4JMFmzK7kVUawKBgQDxiaakAbNkbwmQh6eYez4klX7XE4tPN66m\nrdr/MsCUCPfMp2cGoNPOQ4VnNgBzHpYIVp29y94KOhNyFjSb61+sUEgJozUwvuHO\nLxMxpGksTw2ywpn2+j4M29VN4lt3W0WbAYa/BrSOBdJEIfbkcAZ14XKAB1B7TVZO\nalcAJpVZPQKBgQDoBjuYXSRMHQVomD/nw/RMrO1PJ4QUVWKwPpJZesarIIiu+Lvf\nvUjDsyIecgimm5nWY+5OXdhlX/GIYHD5gDpbgXDw76f5AbgZQ6sRoyTS/knwvGQq\nKr0txf5kln4/ZqRm+ay1pTL4Skl8gqdbJnUZilbCSCRE5fAHQKC71c9dBQKBgAmr\nuUBX0Rb0Wy2uQMeaJ6LPWYTDA5DoadXCoEIXhh5nPYS0LyvUxKY9jdnUD7CMSPWM\ngkRXJUzDhoPK39BeXDZKAJhiMH8DJYdb2yjhrFRZ1fKSWBfLbTCWnLPBnGfq/551\nMS/01MXa9dBEi94ZniiaHjuCD3bgYdRB7bnT0acBAoGAa1zFSvu1RLHctgSJneUG\n90Oslkz2TpS613B11ELRQaOfKwFigAA2oTZwMZrEU2XW1fTwQRSMVMBKLWLbgrbF\nLuEjdKxSU2k3k0VY3lLF4nNnTpBnG+M96clH5eKBzyTvlkdOxe1uvbb/y2CXNTkv\nwH1okHrkR5JXqZhAXzgXRMI=\n-----END PRIVATE KEY-----\n",
|
||||
"client_email": "venkatesh-drive@oauth-412703.iam.gserviceaccount.com",
|
||||
"client_id": "106762356572936299320",
|
||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||
"token_uri": "https://oauth2.googleapis.com/token",
|
||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/venkatesh-drive%40oauth-412703.iam.gserviceaccount.com",
|
||||
"universe_domain": "googleapis.com"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user