Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
vadivelJ96 2025-10-25 16:53:39 +05:30
commit 564dcc642d
18 changed files with 947 additions and 481 deletions

View File

@ -48,6 +48,7 @@ $routes->get("frontend_content", "AppContentManagementController::frontend_conte
$routes->get('/test', 'Home::index'); $routes->get('/test', 'Home::index');
$routes->get('/check_gemini', 'Home::check_Gemini'); $routes->get('/check_gemini', 'Home::check_Gemini');
$routes->get('/check_gemini2', 'Home::check_gemini_2'); $routes->get('/check_gemini2', 'Home::check_gemini_2');
$routes->get('/checkPolicyDoc', 'Home::checkPolicyDoc');
$routes->get('/login', 'LoginController::index'); ///auth/google $routes->get('/login', 'LoginController::index'); ///auth/google
$routes->get('/loginPos', 'LoginController::loginPos'); //login POS team $routes->get('/loginPos', 'LoginController::loginPos'); //login POS team
$routes->post('/getVerifyPosMobileNo', 'LoginController::getVerifyPosMobileNo'); //Verify POS team mobile no $routes->post('/getVerifyPosMobileNo', 'LoginController::getVerifyPosMobileNo'); //Verify POS team mobile no
@ -398,8 +399,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->match(['get', 'post', 'delete'], 'nhanceBranchMaster', 'MasterController::nhanceBranchMaster'); $routes->match(['get', 'post', 'delete'], 'nhanceBranchMaster', 'MasterController::nhanceBranchMaster');
$routes->match(['get', 'post', 'delete'], 'vehicleTypeMaster', 'MasterController::vehicleTypeMaster'); $routes->match(['get', 'post', 'delete'], 'vehicleTypeMaster', 'MasterController::vehicleTypeMaster');
$routes->match(['get', 'post', 'delete'], 'rtoMaster', 'MasterController::rtoMaster'); $routes->match(['get', 'post', 'delete'], 'rtoMaster', 'MasterController::rtoMaster');
$routes->get('checkDuplicateCdAccount', 'MasterController::checkDuplicateCdAccount');
}); });
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail"); $routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");

View File

@ -1193,7 +1193,7 @@ class EmployeeController extends AdminController
// --------------- For E-Card Download ----------------------------------------------------------------------------------------------------- // --------------- For E-Card Download -----------------------------------------------------------------------------------------------------
//E-CARD DOWNLOAD FUNCTION USING HTML PRINT //E-CARD DOWNLOAD FUNCTION USING HTML PRINT ( Not in use ) do not delete
public function generateIDCardForEmployeeUsingHtml($rand_string, $people = 0) public function generateIDCardForEmployeeUsingHtml($rand_string, $people = 0)
{ {
// dd($rand_string, $people); // dd($rand_string, $people);
@ -1418,7 +1418,7 @@ class EmployeeController extends AdminController
echo $htmlContent; echo $htmlContent;
} }
//E-CARD DOWNLOAD FUNCTION USING DOM PDF ( CURRENTLY USING THIS ) //E-CARD DOWNLOAD FUNCTION USING DOM PDF ( CURRENTLY USING THIS ) Dompdf
public function generateIDCardForEmployee($rand_string, $people = 0, $mode = 0) public function generateIDCardForEmployee($rand_string, $people = 0, $mode = 0)
{ {
// dd($rand_string, $people); // dd($rand_string, $people);
@ -1470,8 +1470,8 @@ class EmployeeController extends AdminController
// Step 3: Prepare template path // Step 3: Prepare template path
$template_data_path = WRITEPATH . 'e_card_template/'; $template_data_path = WRITEPATH . 'e_card_template/';
// $tpa_short_name = strtolower(str_replace(' ', '_', $get_emp_code_and_client_policy_id['short_name'])) . '.html'; // $tpa_short_name = strtolower(str_replace(' ', '_', $get_emp_code_and_client_policy_id['short_name'])) . '.html';
$tpa_short_name = 'common.html'; // $tpa_short_name = 'common.html';
// $tpa_short_name = 'new_ecard.html'; $tpa_short_name = 'new_ecard.html';
$final_path = $template_data_path . $tpa_short_name; $final_path = $template_data_path . $tpa_short_name;
$this->myLogger->logme('error', 'Checking if template file exists at: ' . $final_path); $this->myLogger->logme('error', 'Checking if template file exists at: ' . $final_path);
@ -1495,6 +1495,7 @@ class EmployeeController extends AdminController
$value['back_card'] = "Nhance_Ecard_working_1_Back.png"; $value['back_card'] = "Nhance_Ecard_working_1_Back.png";
$placeholders = [ $placeholders = [
'{CLIENT_NAME}' => $value['client_name'], '{CLIENT_NAME}' => $value['client_name'],
'{TPA_ID}' => $value['tpa_id'], '{TPA_ID}' => $value['tpa_id'],
'{NAME}' => $value['name'], '{NAME}' => $value['name'],
@ -1506,9 +1507,6 @@ class EmployeeController extends AdminController
'{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])), '{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
'{POLICY_NO}' => $value['policy_no'], '{POLICY_NO}' => $value['policy_no'],
'{INSURER_NAME}' => strtoupper($value['insurer_name']), '{INSURER_NAME}' => strtoupper($value['insurer_name']),
'{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'],
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
'{EMP_ID}' => $value['emp_code'], '{EMP_ID}' => $value['emp_code'],
'{SI_AMT}' => $value['basic_cover_si'], '{SI_AMT}' => $value['basic_cover_si'],
'{CORPORATE_NAME}' => $value['client_name'], '{CORPORATE_NAME}' => $value['client_name'],
@ -1516,15 +1514,33 @@ class EmployeeController extends AdminController
'{TPA_NAME}' => $value['tpa_name'], '{TPA_NAME}' => $value['tpa_name'],
'{INSURER_BRANCH}' => $value['insurer_branch_city'], '{INSURER_BRANCH}' => $value['insurer_branch_city'],
'{RELATION}' => $value['relationship'], '{RELATION}' => $value['relationship'],
'{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $value['tpa_logo'],
'{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg', '{TPA_LOGO}' => getFileIfExists('uploads/logo/' . $value['tpa_logo']),
'{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png', '{MEDI_USER}' => getFileIfExists('e_card_imgs/medi_uesr.jpg'),
'{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg', '{MEDI_INSURER}' => getFileIfExists('e_card_imgs/Magma.png'),
'{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png', '{MEDI_BARCODE}' => getFileIfExists('e_card_imgs/borcode.jpeg'),
'{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png', '{QR_ANDROID}' => getFileIfExists('e_card_imgs/android.png'),
'{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png', '{QR_IOS}' => getFileIfExists('e_card_imgs/ios.png'),
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png', '{QR_ANDROID_2}' => getFileIfExists('e_card_imgs/play_store.png'),
'{NHANCE_N_LOGO}' => base_url() . 'public/assets/images/Nhance_Favi.png', '{QR_IOS_2}' => getFileIfExists('e_card_imgs/appstore.png'),
'{NHANCE_N_LOGO}' => getFileIfExists('assets/images/Nhance_Favi.png'),
'{INSURER_LOGO}' => getFileIfExists('uploads/logo/' . $value['insurer_logo']),
'{FRONT_CARD}' => getFileIfExists('uploads/template_bg/' . $value['front_card']),
'{BACK_CARD}' => getFileIfExists('uploads/template_bg/' . $value['back_card']),
// '{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $value['tpa_logo'],
// '{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
// '{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
// '{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
// '{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
// '{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
// '{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
// '{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
// '{NHANCE_N_LOGO}' => base_url() . 'public/assets/images/Nhance_Favi.png',
// '{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'],
// '{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
// '{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
]; ];
$placeholders['{LEVELS}'] = $this->generateAcmAndMForEcard($client_id); $placeholders['{LEVELS}'] = $this->generateAcmAndMForEcard($client_id);

View File

@ -60,6 +60,8 @@ class Home extends PublicController
//print_rr($data); //print_rr($data);
} }
//for insurer statement upload
public function check_gemini_2() public function check_gemini_2()
{ {
@ -158,6 +160,143 @@ class Home extends PublicController
// The final JSON payload
$data = [
"contents" => [
$content_parts
]
];
// Encode the data to a JSON string
$json_data = json_encode($data);
// Initialize cURL
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); // Set the Content-Type header
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data); // Set the JSON payload
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response as a string
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Optional: to bypass SSL verification if needed (not recommended for production)
// Execute the cURL request and get the response
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'cURL Error: ' . curl_error($ch);
}
// Close the cURL handle
curl_close($ch);
// Decode the JSON response
$responseData = json_decode($response, true);
echo '<pre>';
print_r($responseData);
echo '<pre>';
// Check if the response contains generated text
if (isset($responseData['candidates'][0]['content']['parts'][0]['text'])) {
$generatedText = $responseData['candidates'][0]['content']['parts'][0]['text'];
echo "Generated Text: " . $generatedText;
} else {
echo "Error or no text generated. Response: " . $response;
}
}
//for insurer policy doc upload
public function checkPolicyDoc()
{
// $this->convertToPdf();die();
// Replace with your actual Gemini API key
$apiKey = 'AIzaSyBbx-uotRBqkYhqLpmD60420E_a0G0duP8';
// The model to use and the API endpoint
$model = "gemini-pro";
$model = "gemini-2.5-flash";
// $model = "gemini-1.5-pro";
// $model = "gemini-1.5-pro";
$url = "https://generativelanguage.googleapis.com/v1beta/models/{$model}:generateContent?key={$apiKey}";
$filePath = 'C:\Users\Venba\AppData\Local\Programs\Python\pyenv\pdfreader\bike-0904023124P114268957.pdf';
$filePath = 'C:\Users\Venba\AppData\Local\Programs\Python\pyenv\pdfreader\car-insurance-0904023124P114213011.pdf';
// Check if the file exists
if (!file_exists($filePath)) {
die("Error: File not found at {$filePath}");
}
// Get the file's MIME type using the finfo extension
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimeType = finfo_file($finfo, $filePath);
finfo_close($finfo);
// print_r($mimeType);die();
// Define supported inline MIME types
$supportedInlineMimeTypes = ['application/pdf','text/csv'];
// Read the file content and encode it to Base64
$fileContent = file_get_contents($filePath);
$base64Content = base64_encode($fileContent);
// The prompt you want to send to the model
// $prompt = "give me a json with emp data like name,age,dob,mobile and email. only json not any explanations";
$prompt = "Read the following motor policy pdf document and convert into JSON format as sample specified. Give me only JSON,not any explanations.";
$prompt .= '"{\"policy\":{\"policy_number\":\"\",\"issue_date\":\"\",\"period\":{\"start\":\"\",\"end\":\"\"},\"insurer\":\"\",\"previous_policy_number\":\"\"},\"insured\":{\"name\":\"\",\"father_name\":\"\",\"address\":[\"\"],\"mobile\":\"\",\"id_proofs\":{\"aadhaar\":\"\",\"pan\":\"\"}},\"vehicle\":{\"reg_no\":\"\",\"engine_no\":\"\",\"chassis_no\":\"\",\"make\":\"\",\"model\":\"\",\"year\":\"\",\"cubic_capacity\":\"\",\"vehicle_type\":\"\"},\"rto\":\"\",\"premium\":{\"tp\":0,\"od\":0,\"pa_od\":0,\"taxes\":{},\"total\":0,\"in_words\":\"\"},\"endorsements\":[{\"code\":\"\",\"desc\":\"\"}]}"';
$payloadPart = null;
// The text part of the prompt
$text_part = [
"text" => $prompt
];
// Conditionally handle the file upload based on MIME type
if (in_array($mimeType, $supportedInlineMimeTypes)) {
echo "Detected supported format inline MIME type ({$mimeType})";
// Handle PDF as inline data
$fileContent = file_get_contents($filePath);
$base64Content = base64_encode($fileContent);
$payloadPart = [
"inlineData" => [
"mimeType" => $mimeType,
"data" => $base64Content
]
];
$content_parts = [
"parts" => [
$text_part,
$payloadPart
]
];
} else {
// Handle Excel/CSV using the Files API
echo "Detected unsupported inline MIME type ({$mimeType}). Uploading via Files API...\n";
$fileInfo = $this->uploadFileToGemini($filePath, $apiKey); // Pass apiKey
print_r($fileInfo);
// The file part, using the URI from the Files API upload
$file_part = [
"fileData" => [
"fileUri" => $fileInfo['uri'],
"mimeType" => $fileInfo['mimeType']
]
];
// The full content array, containing both parts
$content_parts = [
"parts" => [
$text_part,
$file_part
]
];
}
// The final JSON payload // The final JSON payload
$data = [ $data = [
"contents" => [ "contents" => [

View File

@ -1024,14 +1024,7 @@ class LeadsController extends BaseController
// 3. Optimize lead data query with specific field selection // 3. Optimize lead data query with specific field selection
$lead_data = $this->leadsModel $lead_data = $this->leadsModel
->select(' ->select('
leads.id, leads.*,
leads.policy_type_id,
leads.lead_type,
leads.source_policy_id,
leads.policy_end_date,
leads.lead_form_type,
leads.created_by,
leads.client_name,
lead_files.status as demography_file_status, lead_files.status as demography_file_status,
policy_type.question_json, policy_type.question_json,
policy_type.policy_type, policy_type.policy_type,
@ -1776,6 +1769,24 @@ class LeadsController extends BaseController
// dd($rfq_data, $lead_id, $type, $propsal_and_insurer); // dd($rfq_data, $lead_id, $type, $propsal_and_insurer);
// print_r($propsal_and_insurer); die; // print_r($propsal_and_insurer); die;
// print_r($is_placement); die;
$data = json_decode($rfq_data['json'], true);
$sheetName = 'Worksheet';
if ($type == 2) {
$sheetName = 'QCR';
// $propsal_and_insurer = "Proposal 1-ICICIPRU-ICICI001";
$data = $this->convertJsonForQCR($data, $type);
if ($propsal_and_insurer !== null) {
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
$is_placement = true;
$sheetName = 'Placement';
}
} else if ($type == 1) {
$sheetName = 'RFQ';
$data = $this->convertJsonForQCR($data, $type);
} // dd($data);
if ($rfq_data['lead_type'] == 1) { if ($rfq_data['lead_type'] == 1) {
@ -1808,6 +1819,7 @@ class LeadsController extends BaseController
} else { } else {
if (in_array($rfq_data['policy_type_id'], [2, 3, 4, 5])) { if (in_array($rfq_data['policy_type_id'], [2, 3, 4, 5])) {
if($is_placement == true){
$lead_data = [ $lead_data = [
'Insured' => $rfq_data['client_name'], 'Insured' => $rfq_data['client_name'],
@ -1838,6 +1850,40 @@ class LeadsController extends BaseController
// 'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'] . " %", // 'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'] . " %",
// 'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'] . " %", // 'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'] . " %",
]; ];
}else{
$lead_data = [
'Insured' => $rfq_data['client_name'],
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
'No of Employees at Inception' => $is_placement ? '-' : $rfq_data['incept_emp_count'],
'No of Dependents at Inception' => $is_placement ? '-' : $rfq_data['incept_dept_count'],
'Total Lives at Inception ' => $is_placement ? '-' : $rfq_data['incept_no_of_lives'],
'No of Employees at Expiry' => $is_placement ? '-' : $rfq_data['exp_emp_count'],
'No of Dependents at Expiry' => $is_placement ? '-' : $rfq_data['exp_dept_count'],
'Total Lives at Expiry ' => $is_placement ? '-' : $rfq_data['exp_no_of_lives'],
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date'])
? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date']))
: "To be decided",
'Insurer' => $rfq_data['insurer_name'] ?? " - ",
'TPA' => $rfq_data['tpa_name'] ?? " - ",
'Policy Run Days' => $is_placement ? '-' : $rfq_data['policy_run_days'],
'Inception Premium' => $is_placement ? '-' : formatIndianCurrency($rfq_data['premium_at_inception']),
'Premium as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => $is_placement ? '-' : formatIndianCurrency($rfq_data['premium_date']),
'Earned Premium' => $is_placement ? '-' : formatIndianCurrency(intval($rfq_data['earned_premium'])),
'Incurred Claims as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => $is_placement ? '-' : formatIndianCurrency($rfq_data['incurred_claims']),
'Annualised Claims' => $is_placement ? '-' : formatIndianCurrency(intval($rfq_data['annualised_claims'])),
'Incurred Claims Ratio' => $is_placement ? '-' : $rfq_data['incurred_claims_ratio'] . " %",
'Earned Claims Ratio' => $is_placement ? '-' : $rfq_data['earned_claims_ratio'] . " %",
];
}
} else if (in_array($rfq_data['policy_type_id'], [1, 6, 7])) { } else if (in_array($rfq_data['policy_type_id'], [1, 6, 7])) {
$lead_data = [ $lead_data = [
@ -1857,27 +1903,8 @@ class LeadsController extends BaseController
]; ];
} }
} }
// print_r($lead_data); die;
$data = json_decode($rfq_data['json'], true);
// dd($data);
$sheetName = 'Worksheet';
if ($type == 2) {
$sheetName = 'QCR';
// $propsal_and_insurer = "Proposal 1-ICICIPRU-ICICI001";
$data = $this->convertJsonForQCR($data, $type);
if ($propsal_and_insurer !== null) {
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
$is_placement = true;
$sheetName = 'Placement';
}
} else if ($type == 1) {
$sheetName = 'RFQ';
$data = $this->convertJsonForQCR($data, $type);
// dd($data);
}
// dd($data);
$spreadsheet = new Spreadsheet(); $spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();

View File

@ -1350,6 +1350,16 @@ class MasterController extends AdminController
// === INSERT === // === INSERT ===
if (empty($id)) { if (empty($id)) {
$cd_acc_count = $this->CDMasterModel->where('is_active', 1)
->where('client_id', $data['client_id'])
->where('insurer_id', $data['insurer_id'])
->where('insurer_branch_id', $data['insurer_branch_id'])
->countAllResults();
if($cd_acc_count > 0){
return $this->respond(['status' => false, 'message' => 'A CD account has already been created for this client, insurer, and insurer branch combination.'], 200);
}
$this->myLogger->logme("error", 'Performing INSERT operation.'); $this->myLogger->logme("error", 'Performing INSERT operation.');
$insert = $this->CDMasterModel->insert($data); $insert = $this->CDMasterModel->insert($data);
$this->myLogger->logme("error", 'Insert result: ' . json_encode($insert)); $this->myLogger->logme("error", 'Insert result: ' . json_encode($insert));
@ -1574,6 +1584,15 @@ class MasterController extends AdminController
$data['insurer_branch_id'] = $insurer_branch_id; $data['insurer_branch_id'] = $insurer_branch_id;
$cd_acc_count = $this->CDMasterModel->where('is_active', 1)
->where('client_id', $data['client_id'])
->where('insurer_id', $data['insurer_id'])
->where('insurer_branch_id', $data['insurer_branch_id'])
->countAllResults();
if($cd_acc_count > 0){
return $this->respond(['status' => false, 'message' => 'A CD account has already been created for this client, insurer, and insurer branch combination.'], 200);
}
// array with data for CD Traction table // array with data for CD Traction table
$cd_tranction_data = [ $cd_tranction_data = [
@ -1617,6 +1636,24 @@ class MasterController extends AdminController
} }
} }
public function checkDuplicateCdAccount()
{
$data = $this->request->getGet();
$cd_acc_count = $this->CDMasterModel
->where('is_active', 1)
->where('client_id', $data['client_id'])
->where('insurer_id', $data['insurer_id'])
->where('insurer_branch_id', $data['insurer_branch_id'])
->countAllResults();
if($cd_acc_count > 0){
return $this->respond(['status' => false, 'message' => 'A CD account has already been created for this client, insurer, and insurer branch combination.'], 200);
}else{
return $this->respond(['status' => true], 200);
}
}
//Vehicle Master data Function //Vehicle Master data Function

View File

@ -1271,9 +1271,10 @@ class PolicyTransactionController extends BaseController
$data['tsi'] = generate_tsi_code($issue_type['issue_type'] ?? 1); $data['tsi'] = generate_tsi_code($issue_type['issue_type'] ?? 1);
$client_branch_id = $data['client_branch_id']; if (!isset($data['client_branch_id']) || $data['client_branch_id'] == "") {
if ($data['client_branch_id'] == "") {
$client_branch_id = $issue_type['client_branch_id']; $client_branch_id = $issue_type['client_branch_id'];
}else{
$client_branch_id = $data['client_branch_id'];
} }
$data['is_cd_reduce_from_bds'] = (isset($issue_type['policy_type_id']) && $issue_type['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0; $data['is_cd_reduce_from_bds'] = (isset($issue_type['policy_type_id']) && $issue_type['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0;
@ -1431,7 +1432,11 @@ class PolicyTransactionController extends BaseController
$pt_id = null; $pt_id = null;
if(!empty($data)){ if(!empty($data)){
$inception_data = $this->policyTransactionModel->where('policy_no', $data['policy_no'])->where('client_id', $data['client_id'])->first(); $inception_data = $this->policyTransactionModel
->where('policy_no', $data['policy_no'])
->where('client_id', $data['client_id'])
->where('action_type', 'inception')
->first();
$pt_id = $inception_data['id']; $pt_id = $inception_data['id'];
} }
@ -2682,6 +2687,10 @@ class PolicyTransactionController extends BaseController
$gst = $gstTotal[$index]; $gst = $gstTotal[$index];
$paymentDate = $paymentDates[$index]; $paymentDate = $paymentDates[$index];
if($utrNo == "" && $tds == "" && $gst == "" && $receivedAmount == "")
{
continue;
}
// Prepare data for insert/update // Prepare data for insert/update
$childData = [ $childData = [
'inv_amt' => $receivedAmount, 'inv_amt' => $receivedAmount,

View File

@ -859,3 +859,10 @@ if (!function_exists('expected_amount_calc')) {
return round($expectedAmount, 2); // Optional: round to 2 decimal places return round($expectedAmount, 2); // Optional: round to 2 decimal places
} }
} }
if (!function_exists('getFileIfExists')) {
function getFileIfExists($path)
{
return file_exists(FCPATH . $path) ? base_url($path) : '';
}
}

View File

@ -1532,8 +1532,15 @@ class EmployeePolicyModel extends Model
e.doj, e.doj,
e.band, e.band,
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age, TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.' LIMIT 1) AS self, (
SELECT name FROM employees
WHERE relationship = "Self"
and emp_code = ' . $this->db->escape($emp_code) . '
and client_id = '.$client_id.'
and is_active = 1
and emp_status = "active"
LIMIT 1
) AS self,
ep.tpa_id, ep.tpa_id,
ep.uhid, ep.uhid,

View File

@ -46,7 +46,7 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="insurer_branch_id">Insurer Branch<span class="text-danger">*</span></label> <label for="insurer_branch_id">Insurer Branch<span class="text-danger">*</span></label>
<select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_branch_id" name="insurer_branch_id" required> <select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_branch_id" name="insurer_branch_id" onchange="checkDuplicateCdAccount(this)" required>
<option value="">Select Insurer Branch</option> <option value="">Select Insurer Branch</option>
<?php if(isset($insurer_branch) && !empty($insurer_branch)) <?php if(isset($insurer_branch) && !empty($insurer_branch))
{ foreach($insurer_branch as $branch) { ?> { foreach($insurer_branch as $branch) { ?>
@ -229,11 +229,11 @@
$('#opening_bal').prop("disabled", false); $('#opening_bal').prop("disabled", false);
if(isCdMasterPage == true){ if(isCdMasterPage == true){
$('#client_id').val('').change(); $('#cd_client_id').val('').select2();
$('#insurer_id_for_cd').val('').change(); $('#insurer_id_for_cd').val('').select2();
$('#insurer_branch_id').val('').change(); $('#insurer_branch_id').val('').select2();
$('#client_id').prop("disabled", false); $('#cd_client_id').prop("disabled", false);
$('#insurer_id_for_cd').prop("disabled", false); $('#insurer_id_for_cd').prop("disabled", false);
$('#insurer_branch_id').prop("disabled", false); $('#insurer_branch_id').prop("disabled", false);
@ -266,7 +266,7 @@
); );
}); });
$branchSelect.val('').trigger('change.select2'); $branchSelect.val('').select2();
} }
function showCdMasterAddModal(){ function showCdMasterAddModal(){
@ -301,5 +301,43 @@
$('#cd_ac_no_for_cd_master').append(option); $('#cd_ac_no_for_cd_master').append(option);
} }
function checkDuplicateCdAccount(){
let url = '<?= base_url('util/checkDuplicateCdAccount') ?>';
let client_id = $('#cd_client_id').val();
let insurer_id = $('#insurer_id_for_cd').val();
let insurer_branch_id = $('#insurer_branch_id').val();
console.log({client_id, insurer_id, insurer_branch_id});
// Data to send in the AJAX request
let requestData = {
client_id: client_id,
insurer_id: insurer_id,
insurer_branch_id: insurer_branch_id,
};
if(client_id != "" && insurer_id != "" && insurer_branch_id != ""){
// Send AJAX request
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
console.log('Data fetched successfully:', response);
if (response.status == true) {
console.log('No dublicate found');
} else {
$('#cd_client_id').val('').select2();
$('#insurer_id_for_cd').val('').select2();
$('#insurer_branch_id').val('').select2();
toastr.warning(response.message, 'WARNING');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while checking the CD amount.', 'ERROR');
});
}
}
</script> </script>

View File

@ -323,7 +323,7 @@ table.dataTable thead th {
$('#cd_client_id').prop("disabled", true); $('#cd_client_id').prop("disabled", true);
$('#insurer_id_for_cd').val(res.data.insurer_id).change(); $('#insurer_id_for_cd').val(res.data.insurer_id).change();
$('#insurer_id_for_cd').prop("disabled", true); $('#insurer_id_for_cd').prop("disabled", true);
$('#insurer_branch_id').val(res.data.insurer_id).change(); $('#insurer_branch_id').val(res.data.insurer_branch_id).select2();
$('#insurer_branch_id').prop("disabled", true); $('#insurer_branch_id').prop("disabled", true);
$('#opening_date').val(res.data.opening_date); $('#opening_date').val(res.data.opening_date);
$('#cd_ac_no_for_cd_master').val(res.data.cd_ac_no); $('#cd_ac_no_for_cd_master').val(res.data.cd_ac_no);

View File

@ -842,6 +842,17 @@ input:checked + .slider::before {
if(response.status == false && response.insurer_id != 'undefined'){ if(response.status == false && response.insurer_id != 'undefined'){
toastr.warning('The CD Account Number not found.', 'Warning'); toastr.warning('The CD Account Number not found.', 'Warning');
$('#cd_ac_no').empty();
$('#cd_ac_no').append($('<option>', {
value: '',
text: 'Select CD Account Number'
}));
$('#cd_ac_no').append($('<option>', {
value: 'add_cd',
text: '+ Add New CD'
}));
return; return;
} }
appendCDACNO(response.data) appendCDACNO(response.data)
@ -1806,15 +1817,18 @@ input:checked + .slider::before {
//console.log('appendCDACNO', select); //console.log('appendCDACNO', select);
$('#cd_ac_no').empty(); $('#cd_ac_no').empty();
$('#cd_ac_no').append($('<option>', { $('#cd_ac_no').append($('<option>', {
value: '', value: '',
text: 'Select CD Account Number' text: 'Select CD Account Number'
})); }));
if(data.length == 0){
$('#cd_ac_no').append($('<option>', { $('#cd_ac_no').append($('<option>', {
value: 'add_cd', value: 'add_cd',
text: '+ Add New CD' text: '+ Add New CD'
})); }));
}
$.each(data, function(index, item) { $.each(data, function(index, item) {
const option = $('<option>', { const option = $('<option>', {
@ -2381,10 +2395,8 @@ input:checked + .slider::before {
</script> </script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#chk-show-expired').on('change', function () { $('#chk-show-expired').on('change', function () {
const showExpired = $(this).is(':checked'); const showExpired = $(this).is(':checked');
@ -2512,9 +2524,6 @@ $(document).ready(function () {
}); });
}); });
</script> </script>

View File

@ -508,7 +508,7 @@
</table> --> </table> -->
<!-- <button type="button" id="add_row_btn" class="btn btn-secondary float-right mt-2"><i class="fa fa-plus"></i></button> --> <!-- <button type="button" id="add_row_btn" class="btn btn-secondary float-right mt-2"><i class="fa fa-plus"></i></button> -->
<div class="payment-card"> <div class="payment-card" id="default_payment_card">
<input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"> <input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
@ -959,19 +959,54 @@
return parts[2] + '/' + parts[1] + '/' + parts[0]; // Rearrange to DD-MM-YYYY return parts[2] + '/' + parts[1] + '/' + parts[0]; // Rearrange to DD-MM-YYYY
} }
function togglePaymentCardRequired(flag) {
// Select the default payment card container
const card = document.getElementById("default_payment_card");
if (!card) return;
// Select all input elements inside the card
const inputs = card.querySelectorAll("input");
inputs.forEach(input => {
if (flag) {
input.setAttribute("required", "required");
} else {
input.removeAttribute("required");
}
});
}
function showInvoiceStatusModal(event) { function showInvoiceStatusModal(event) {
console.log('############ showInvoiceStatusModal function called ##################'); console.log('############ showInvoiceStatusModal function called ##################');
var modal_received_amt_div = document.getElementById('modal_received_amt_div'); var modal_received_amt_div = document.getElementById('modal_received_amt_div');
modal_received_amt_div.style.display = 'none'; modal_received_amt_div.style.display = 'none';
// alert(); // alert();
// console.log(event.target.data) // make sure event exists
var dataId = event.target.getAttribute('data-id'); event = event || window.event;
// the element actually clicked
const clicked = event.target;
// find the nearest ancestor <a> (or element) that has data-id
const anchor = clicked.closest('a[data-id], .btnEdit');
if (!anchor) {
console.warn('Could not find element with data-id');
return;
}
const dataId = anchor.getAttribute('data-id');
const expAmt = anchor.getAttribute('data-exp-amt');
const receivedAmt = anchor.getAttribute('data-received-amt');
console.log('stmt id :', dataId, expAmt, receivedAmt);
var dataExpAmt = event.target.getAttribute('data-exp-amt'); var dataExpAmt = event.target.getAttribute('data-exp-amt');
var dataReceivedAmt = event.target.getAttribute('data-received-amt'); var dataReceivedAmt = event.target.getAttribute('data-received-amt');
// Set the value to a hidden input field in the modal // Set the value to a hidden input field in the modal
document.getElementById('hidden_statement_id').value = dataId; document.getElementById('hidden_statement_id').value = dataId;
// document.getElementById('modal_exp_amt').value = dataExpAmt; // document.getElementById('modal_exp_amt').value = dataExpAmt;
document.getElementById('modal_received_amt').value = dataReceivedAmt; document.getElementById('modal_received_amt').value = receivedAmt;
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
@ -981,10 +1016,78 @@
method: 'get', method: 'get',
// data: { id: dataId }, // data: { id: dataId },
// dataType: 'json', // dataType: 'json',
// success: function(response) {
// $('.loader').fadeOut();
// $('.loader-mask').delay(10).fadeOut('slow');
// console.log(response);
// // Assuming response contains the necessary data
// if (response.dataStatus === true && response.code === 200) {
// // Populate modal fields
// if (response.data.invoice_status !== null) {
// var inv_status_element = document.getElementById('invoice_status');
// inv_status_element.value = response.data.invoice_status;
// var event = new Event('change');
// inv_status_element.dispatchEvent(event);
// }
// document.getElementById('invoice_no_modal').value = response.data.invoice_no;
// document.getElementById('invoice_date_modal').value = response.data.invoice_date === '' ? <?php echo date('d-m-Y') ?> : response.data.invoice_date;
// document.getElementById('invoice_amount_no_modal').value = response.data.invoice_amount;
// document.getElementById('invoice_value_modal').value = response.data.invoice_value;
// document.getElementById('gst_per_modal').value = response.data.gst_per;
// document.getElementById('gst_value_modal').value = response.data.gst_value;
// console.log('response.data.gst_value - ' + response.data.gst_value);
// if (response.data.gst_value == 0 || response.data.gst_value == '' || response.data.gst_value == null) {
// calcGSTValue();
// }
// if (!$('#invoice_date_modal').val()) {
// // alert('nope');
// // Set today's date as the default date
// $('#invoice_date_modal').datepicker('setDate', new Date());
// }
// // Clear existing rows in the payment table
// var paymentTableBody = document.querySelector('#payment_table_modal tbody');
// // var paymentTableBody = document.getElementById('payment_card_container');
// console.log('response.data.payments.length', response.data.payments.length)
// // Populate payment table rows
// if (response.data.payments.length) {
// paymentTableBody.innerHTML = '';
// response.data.payments.forEach(function(payment) {
// 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="received_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required step="0.01"></td>
// <td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter Amount" value="${payment.gst}" onchange="checkInvAmont(event)" required step="0.01"></td>
// <td><input type="number" class="form-control" name="tds[]" placeholder="Enter Amount" value="${payment.tds}" 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="text" class="form-control payment_date" name="payment_date[]" value="${formatDateToDMY(payment.received_date)}" required readonly></td>
// <td><i class="mdi mdi-delete mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
// `;
// });
// }
// $('.payment_date').datepicker({
// format: 'dd/mm/yyyy',
// autoclose: true
// });
// // Show the modal
// var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
// myModal.show();
// } else {
// // Handle error if the response is not successful
// console.error('Failed to fetch data:', response);
// alert("Something went wrong! Couldn't get data");
// }
// },
success: function(response) { success: function(response) {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(10).fadeOut('slow'); $('.loader-mask').delay(10).fadeOut('slow');
console.log(response); console.log(response);
// Assuming response contains the necessary data // Assuming response contains the necessary data
if (response.dataStatus === true && response.code === 200) { if (response.dataStatus === true && response.code === 200) {
// Populate modal fields // Populate modal fields
@ -996,46 +1099,84 @@
} }
document.getElementById('invoice_no_modal').value = response.data.invoice_no; document.getElementById('invoice_no_modal').value = response.data.invoice_no;
document.getElementById('invoice_date_modal').value = response.data.invoice_date === '' ? <?php echo date('d-m-Y') ?> : response.data.invoice_date; document.getElementById('invoice_date_modal').value = response.data.invoice_date === '' ? '<?php echo date('d-m-Y') ?>' : response.data.invoice_date;
document.getElementById('invoice_amount_no_modal').value = response.data.invoice_amount; document.getElementById('invoice_amount_no_modal').value = response.data.invoice_amount;
document.getElementById('invoice_value_modal').value = response.data.invoice_value; document.getElementById('invoice_value_modal').value = response.data.invoice_value;
document.getElementById('gst_per_modal').value = response.data.gst_per; document.getElementById('gst_per_modal').value = response.data.gst_per;
document.getElementById('gst_value_modal').value = response.data.gst_value; document.getElementById('gst_value_modal').value = response.data.gst_value;
console.log('response.data.gst_value - ' + response.data.gst_value); console.log('response.data.gst_value - ' + response.data.gst_value);
if (response.data.gst_value == 0 || response.data.gst_value == '' || response.data.gst_value == null) { if (response.data.gst_value == 0 || response.data.gst_value == '' || response.data.gst_value == null) {
calcGSTValue(); calcGSTValue();
} }
if (!$('#invoice_date_modal').val()) { if (!$('#invoice_date_modal').val()) {
// alert('nope');
// Set today's date as the default date // Set today's date as the default date
$('#invoice_date_modal').datepicker('setDate', new Date()); $('#invoice_date_modal').datepicker('setDate', new Date());
} }
// Clear existing rows in the payment table
var paymentTableBody = document.querySelector('#payment_table_modal tbody');
console.log('response.data.payments.length', response.data.payments.length) // Clear existing payment cards in the container
// Populate payment table rows var defaultPaymentCardContainer = document.getElementById('default_payment_card');
defaultPaymentCardContainer.style.display = 'block';
togglePaymentCardRequired(true);
var paymentCardContainer = document.getElementById('payment_card_container');
paymentCardContainer.innerHTML = '';
console.log('response.data.payments.length', response.data.payments.length);
// Populate payment cards
if (response.data.payments.length) { if (response.data.payments.length) {
paymentTableBody.innerHTML = ''; defaultPaymentCardContainer.style.display = 'none';
response.data.payments.forEach(function(payment) { togglePaymentCardRequired(false);
var row = paymentTableBody.insertRow(); // if (defaultPaymentCardContainer) {
row.innerHTML = ` // defaultPaymentCardContainer.remove();
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" value="${payment.id}"></td> // }
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required step="0.01"></td> response.data.payments.forEach(function(payment, index) {
<td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter Amount" value="${payment.gst}" onchange="checkInvAmont(event)" required step="0.01"></td> var paymentCard = document.createElement('div');
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter Amount" value="${payment.tds}" onchange="checkInvAmont(event)" required></td> paymentCard.className = 'payment-card';
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required></td>
<td><input type="text" class="form-control payment_date" name="payment_date[]" value="${formatDateToDMY(payment.received_date)}" required readonly></td> paymentCard.innerHTML = `
<td><i class="mdi mdi-delete mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td> <input type="hidden" class="form-control" name="pk[]" value="${payment.id}">
<div class="row">
<div class="col">
<label>Invoice value</label>
<input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" required step="0.01" onchange="checkInvAmont(event)">
</div>
<div class="col">
<label>GST</label>
<input type="number" class="form-control" name="gst_amount[]" placeholder="Enter GST" value="${payment.gst}" required step="0.01" onchange="checkInvAmont(event)">
</div>
<div class="col">
<label>TDS</label>
<input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" value="${payment.tds}" onchange="checkInvAmont(event)" required>
</div>
<div class="col">
<label>UTR Number</label>
<input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required>
</div>
<div class="col">
<label>Date</label>
<input type="text" class="form-control payment_date" name="payment_date[]" value="${formatDateToDMY(payment.received_date)}" placeholder="dd/mm/yyyy" required readonly>
</div>
<div class="col-auto d-flex align-items-end">
<button type="button" class="btn btn-danger btn-sm remove-row">
<i class="mdi mdi-delete"></i>
</button>
</div>
</div>
`; `;
paymentCardContainer.appendChild(paymentCard);
}); });
} }
// Initialize datepicker for all payment date fields
$('.payment_date').datepicker({ $('.payment_date').datepicker({
format: 'dd/mm/yyyy', format: 'dd/mm/yyyy',
autoclose: true autoclose: true
}); });
// Show the modal // Show the modal
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal')); var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
myModal.show(); myModal.show();

View File

@ -300,6 +300,7 @@ table.dataTable tbody td {
<script> <script>
// New menu
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
const table = document.getElementById("tickets-table"); const table = document.getElementById("tickets-table");
@ -416,10 +417,6 @@ document.addEventListener("DOMContentLoaded", function () {
}); });
</script>
<script>
// Datatable document ready // Datatable document ready
$(document).ready(function() { $(document).ready(function() {
@ -636,9 +633,11 @@ document.addEventListener("DOMContentLoaded", function () {
console.error(error); console.error(error);
}); });
} }
</script> </script>
<script> <script>
function selectOption(element, radioId) { function selectOption(element, radioId) {
// Remove selected class from all options // Remove selected class from all options
document.querySelectorAll('.radio-option').forEach(option => { document.querySelectorAll('.radio-option').forEach(option => {

View File

@ -868,7 +868,6 @@
$('.branchdiv').show(); $('.branchdiv').show();
$('#table_tr_34').show(); $('#table_tr_34').show();
$('#table_tr_37').show(); $('#table_tr_37').show();
} }
console.log('selectedClientType', selectedClientType); console.log('selectedClientType', selectedClientType);
@ -895,10 +894,12 @@
} }
if(selectedClientType == 1){
$('#client_policy_id').empty().append($('<option>', { $('#client_policy_id').empty().append($('<option>', {
value: '', value: '',
text: 'Select Policy' text: 'Select Policy'
})) }));
}
// Initialize or refresh Select2 for both dropdowns // Initialize or refresh Select2 for both dropdowns
$('#client_id').select2(); $('#client_id').select2();
@ -975,8 +976,8 @@
} }
$('#policy_tranction_primarykey').val(res.data.id); $('#policy_tranction_primarykey').val(res.data.id);
$('#client_type').val(res.data.client_type).trigger('change');
$('#client_id').val(res.data.client_id).change(); $('#client_id').val(res.data.client_id).change();
$('#client_type').val(res.data.client_type);
$('#base_cd_amount').val(res.data.base_cd_amount); $('#base_cd_amount').val(res.data.base_cd_amount);
var tpaValue = ''; var tpaValue = '';
@ -985,13 +986,22 @@
} }
$('#tpa').val(tpaValue).change(); $('#tpa').val(tpaValue).change();
setTimeout(function(){ setTimeout(function(){
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
$('#client_branch_id').val(res.data.client_branch_id).change(); $('#client_branch_id').val(res.data.client_branch_id).select2();
$('#client_policy_id').val(res.pt_id).select2(); // $('#client_policy_id').val(res.pt_id).select2();
}, 1000) }, 1000)
if(res.data.client_type == 2){
let data1 = policyListByClient[res.data.client_id];
appendPolicies(data1, res.pt_id);
}else{
let data2 = policy_list[res.data.client_branch_id];
appendPolicies(data2, res.pt_id);
}
setTimeout(function(){ setTimeout(function(){
$('#policy_start_date').val(res.data.policy_start_date); $('#policy_start_date').val(res.data.policy_start_date);
$('#policy_end_date').val(res.data.policy_end_date); $('#policy_end_date').val(res.data.policy_end_date);
@ -1042,6 +1052,16 @@
addInsurerColumn(); addInsurerColumn();
} }
if (res.data.client_type == 2) {
$('.branchdiv').hide();
$('#table_tr_34').hide();
$('#table_tr_37').hide();
} else {
$('.branchdiv').show();
$('#table_tr_34').show();
$('#table_tr_37').show();
}
// if(res.data.policy_type_id == 1 || res.data.policy_type_id == 2 || res.data.policy_type_id == 3 || res.data.policy_type_id == 4 || res.data.policy_type_id == 5 || res.data.policy_type_id == 6 || res.data.policy_type_id == 7){ // if(res.data.policy_type_id == 1 || res.data.policy_type_id == 2 || res.data.policy_type_id == 3 || res.data.policy_type_id == 4 || res.data.policy_type_id == 5 || res.data.policy_type_id == 6 || res.data.policy_type_id == 7){
// $('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false); // $('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false);
// }else{ // }else{

View File

@ -692,7 +692,7 @@ table.dataTable thead th {
}); });
} }
function appendPolicies(data) { function appendPolicies(data, policy_id=null) {
if (!data) { if (!data) {
toastr.warning("There are no policies in Inception for the selected client and branch."); toastr.warning("There are no policies in Inception for the selected client and branch.");
@ -724,6 +724,11 @@ table.dataTable thead th {
'data-tpa': item.tpa_branch_id + '-' + item.tpa_id, 'data-tpa': item.tpa_branch_id + '-' + item.tpa_id,
'data-ptid': item.policy_type_id, 'data-ptid': item.policy_type_id,
}); });
if (policy_id == item.id) {
option.attr('selected', true);
}
$('#client_policy_id').append(option); $('#client_policy_id').append(option);
}); });
} }

View File

@ -3398,10 +3398,12 @@
text: 'Select CD No', text: 'Select CD No',
})); }));
if(data.length == 0){
$('#cd_ac_no_'+unique_id).append($('<option>', { $('#cd_ac_no_'+unique_id).append($('<option>', {
value: 'add_cd', value: 'add_cd',
text: '+ Add CD' text: '+ Add CD'
})); }));
}
$.each(data, function(index, item) { $.each(data, function(index, item) {
var option = $('<option>', { var option = $('<option>', {
@ -5634,7 +5636,6 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="modal_vehicle_no"> <label for="modal_vehicle_no">
Vehicle No Vehicle No
<span class="text-danger">*</span>
<small style="font-size: x-small;">( Normal: AA##AA#### | Bharat: ##BH####AA )</small> <small style="font-size: x-small;">( Normal: AA##AA#### | Bharat: ##BH####AA )</small>
</label> </label>
<div class="vehicle-input-wrapper"> <div class="vehicle-input-wrapper">

View File

@ -807,9 +807,11 @@ function appendVehicles(data, vehicle_id = null)
})); }));
$.each(data, function(index, item) { $.each(data, function(index, item) {
var displayValue = item.vehicle_no ? item.vehicle_no : item.rc;
var dbValue = item.id
var option = $('<option>', { var option = $('<option>', {
value: item.id, value: dbValue,
text: item.vehicle_no ?? item.rc, text: displayValue,
'data-cid': item.owner, 'data-cid': item.owner,
'data-bid': item.branch_id, 'data-bid': item.branch_id,
'data-cty': item.client_type, 'data-cty': item.client_type,

View File

@ -24,6 +24,7 @@
margin: 0 auto; margin: 0 auto;
table-layout: fixed; table-layout: fixed;
border-spacing: 5px 0; border-spacing: 5px 0;
margin-bottom: 5px;
} }
.card { .card {
@ -49,7 +50,7 @@
} }
.logo-left img { .logo-left img {
width: 32px; width: 48px;
height: 32px; height: 32px;
} }
@ -61,7 +62,7 @@
.logo-right img { .logo-right img {
width: 65px; width: 65px;
height: auto; height: 32px;
} }
.card-body { .card-body {
@ -159,6 +160,14 @@
font-size: 8px; font-size: 8px;
color: #666; color: #666;
} }
.card-header img[src=""],
.card-header img:not([src]) {
opacity: 0;
visibility: hidden;
display: none;
}
</style> </style>
</head> </head>
<body> <body>
@ -167,16 +176,16 @@
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="logo-left"> <div class="logo-left">
<img src="{INSURER_LOGO}" alt="Insurer logo"> <img src="{INSURER_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
</div> </div>
<div class="logo-right"> <div class="logo-right">
<img src="{TPA_LOGO}" alt="TPA logo"> <img src="{TPA_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="n-logo"> <div class="n-logo">
<img src="{NHANCE_N_LOGO}" alt="N Logo"> <img src="{NHANCE_N_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
</div> </div>
<div class="details"> <div class="details">
@ -185,47 +194,47 @@
<tr> <tr>
<td class="detail-label">Policy Holder</td> <td class="detail-label">Policy Holder</td>
<td class="detail-separator">:</td> <td class="detail-separator">:</td>
<td class="detail-value">AMERICAN MEGATRENDS INTERNATIONAL INDIA PVT LTD</td> <td class="detail-value">{CLIENT_NAME}</td>
</tr> </tr>
<tr> <tr>
<td class="detail-label">Insurer</td> <td class="detail-label">Insurer</td>
<td class="detail-separator">:</td> <td class="detail-separator">:</td>
<td class="detail-value">The New India Assurance</td> <td class="detail-value">{INSURER_NAME}</td>
</tr> </tr>
<tr> <tr>
<td class="detail-label">TPA</td> <td class="detail-label">TPA</td>
<td class="detail-separator">:</td> <td class="detail-separator">:</td>
<td class="detail-value">Mediassit</td> <td class="detail-value">{TPA_NAME}</td>
</tr> </tr>
<tr> <tr>
<td class="detail-label">Primary Insured</td> <td class="detail-label">Primary Insured</td>
<td class="detail-separator">:</td> <td class="detail-separator">:</td>
<td class="detail-value">Suganya A</td> <td class="detail-value">{SELF_NAME}</td>
</tr> </tr>
<tr> <tr>
<td class="detail-label">Beneficiary Name</td> <td class="detail-label">Beneficiary Name</td>
<td class="detail-separator">:</td> <td class="detail-separator">:</td>
<td class="detail-value">Suganya A</td> <td class="detail-value">{NAME}</td>
</tr> </tr>
<tr> <tr>
<td class="detail-label">Member ID</td> <td class="detail-label">Member ID</td>
<td class="detail-separator">:</td> <td class="detail-separator">:</td>
<td class="detail-value">4060881280</td> <td class="detail-value">{TPA_ID}</td>
</tr> </tr>
<tr> <tr>
<td class="detail-label">Employee Code</td> <td class="detail-label">Employee Code</td>
<td class="detail-separator">:</td> <td class="detail-separator">:</td>
<td class="detail-value">9332</td> <td class="detail-value">{EMP_ID}</td>
</tr> </tr>
<tr> <tr>
<td class="detail-label">Relation</td> <td class="detail-label">Relation</td>
<td class="detail-separator">:</td> <td class="detail-separator">:</td>
<td class="detail-value">Self</td> <td class="detail-value">{RELATION}</td>
</tr> </tr>
<tr> <tr>
<td class="detail-label">Policy Period</td> <td class="detail-label">Policy Period</td>
<td class="detail-separator">:</td> <td class="detail-separator">:</td>
<td class="detail-value">1-Apr-2025 to 31-Mar-2026</td> <td class="detail-value">{POLICY_START_DATE} to {POLICY_DATE}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -237,16 +246,16 @@
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="logo-left"> <div class="logo-left">
<img src="{INSURER_LOGO}" alt="Insurer logo"> <img src="{INSURER_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
</div> </div>
<div class="logo-right"> <div class="logo-right">
<img src="{TPA_LOGO}" alt="TPA logo"> <img src="{TPA_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="n-logo"> <div class="n-logo">
<img src="{NHANCE_N_LOGO}" alt="N Logo"> <img src="{NHANCE_N_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
</div> </div>
<div class="details"> <div class="details">