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

This commit is contained in:
VENKATESHWARAN 2025-01-22 12:01:16 +05:30
commit 8cfed93bd3
16 changed files with 1028 additions and 171 deletions

View File

@ -374,6 +374,7 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
$routes->get("getFileErr/(:any)", "PolicyTransactionController::getFileErr/$1"); $routes->get("getFileErr/(:any)", "PolicyTransactionController::getFileErr/$1");
$routes->get("getInsurerStatementMonth", "PolicyTransactionController::getInsurerStatementMonth"); $routes->get("getInsurerStatementMonth", "PolicyTransactionController::getInsurerStatementMonth");
$routes->get("deleteStatement/(:any)", "PolicyTransactionController::deleteStatement/$1"); $routes->get("deleteStatement/(:any)", "PolicyTransactionController::deleteStatement/$1");
//$routes->post('failedStatement',"PolicyTransactionController::failedStatementList");
}); });
}); });
@ -430,7 +431,8 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->post("logined", "RestAuthenticationController::logined"); $routes->post("logined", "RestAuthenticationController::logined");
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken"); $routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
}); });
// $routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); $routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); $routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");

View File

@ -1085,7 +1085,7 @@ class EmployeeRestController extends AdminController
$keysToRemove = ["removable_keys"]; $keysToRemove = ["removable_keys"];
// Retrieve employee policy data by passing the employee primary key // Retrieve employee policy data by passing the employee primary key
$empPolicy = $this->employeeModel->getEmployeePolicy($id); $empPolicy = $this->employeeModel->getEmployeePolicy($id);
// dd($empPolicy);
// Retrieve employee and dependents data by passing the employee code // Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$emp_code) $employeeData = $this->employeeModel->where('emp_code',$emp_code)
->where('client_id',$client_id) ->where('client_id',$client_id)
@ -1123,11 +1123,18 @@ class EmployeeRestController extends AdminController
{ {
$si_value = 0; $si_value = 0;
$si_premium_value = 0;
$si_gst_value = 0;
// Filter employee data where the family_floater_key is 'self' // Filter employee data where the family_floater_key is 'self'
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self'); $selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow(); $employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0; $si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
$si_premium_value = $si_premium_value + $employee_policy->rata_premimum;
$si_gst_value = $si_gst_value + $employee_policy->gst;
}
$self['is_value_exist'] = true; $self['is_value_exist'] = true;
$self['data']['family_floater_key'] = 'self'; $self['data']['family_floater_key'] = 'self';
@ -1142,6 +1149,8 @@ class EmployeeRestController extends AdminController
$array->mapped_family_floaters = $self; $array->mapped_family_floaters = $self;
$array->type = 'GPA'; $array->type = 'GPA';
$array->si_value = $si_value; $array->si_value = $si_value;
$array->si_premium_value = $si_premium_value;
$array->si_gst_value = $si_gst_value;
@ -1201,8 +1210,11 @@ class EmployeeRestController extends AdminController
if ($value['family_floater_key'] === $dependent) { if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow(); $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; } if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;} if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;} {
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
}
$temp['is_value_exist'] = true; $temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue; $temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1404,8 +1416,11 @@ class EmployeeRestController extends AdminController
if ($value['family_floater_key'] === $dependent) { if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow(); $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; } if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;} if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;} {
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
}
$temp['is_value_exist'] = true; $temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue; $temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1504,16 +1519,25 @@ class EmployeeRestController extends AdminController
$decodedArray = json_decode($array->Policy_Terms); $decodedArray = json_decode($array->Policy_Terms);
$array->Policy_Terms = $decodedArray; $array->Policy_Terms = $decodedArray;
$si_value = 0; $si_value = 0;
$si_premium_value = 0;
$si_gst_value = 0;
// Filter employee data where the family_floater_key is 'self' // Filter employee data where the family_floater_key is 'self'
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self'); $selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow(); $employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0; $si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
$si_premium_value = $si_premium_value + $employee_policy->rata_premimum;
$si_gst_value = $si_gst_value + $employee_policy->gst;
}
$policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow(); $policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow();
$array->type = $policyTypeData->policy_type; $array->type = $policyTypeData->policy_type;
$array->Policy_Name = $policyTypeData->long_name; $array->Policy_Name = $policyTypeData->long_name;
$array->si_value = $si_value; $array->si_value = $si_value;
$array->si_premium_value = $si_premium_value;
$array->si_gst_value = $si_gst_value;
if($employee_policy){ if($employee_policy){
@ -1808,8 +1832,11 @@ class EmployeeRestController extends AdminController
if ($value['family_floater_key'] === $dependent) { if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow(); $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; } if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;} if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;} {
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
}
$temp['is_value_exist'] = true; $temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue; $temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1929,8 +1956,11 @@ class EmployeeRestController extends AdminController
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow(); $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; } if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; }
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;} if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;} {
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
}
$temp3['is_value_exist'] = true; $temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id']; $temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship']; $temp3['data']['relationship'] = $value['relationship'];
@ -1982,8 +2012,11 @@ class EmployeeRestController extends AdminController
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow(); $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; } if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; }
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;} if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;} {
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
}
$temp3['is_value_exist'] = true; $temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id']; $temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship']; $temp3['data']['relationship'] = $value['relationship'];

View File

@ -1658,7 +1658,7 @@ class MasterController extends AdminController
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id; $email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id;
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]); $res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]);
echo "Inside the master controller"; echo "Inside the master controller";
print_r($res); print_r($res['data']['zepto_api']);
} }
@ -1669,10 +1669,11 @@ class MasterController extends AdminController
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"], ["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"] ["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
]; ];
$email_id = 'srinivas.saravanan@venbainfotech.com'; $email_id = 'hariharan@nhanceindia.in';
$common = ['mail_type'=>'test_mail_cli']; $common = ['mail_type'=>'test_mail_cli'];
$bcc = "vijayalakshmi@nhanceindia.in,vitvelz@gmail.com,velmurugan.s@venbainfotech.com,hariharan@nhanceindia.in,hariharan@jubiliant.in,srinivas.saravanan@venbainfotech.com";
// Send email and get response // Send email and get response
$result = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]); $result = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI','bcc'=>$bcc ,'message' => $message,'attachments' => $attachments,'common'=>$common]);
log_message('error',json_encode($result)); log_message('error',json_encode($result));

View File

@ -52,6 +52,7 @@ class NotificationController extends AdminController
$form_data['subject'] = $this->request->getPost('subject'); $form_data['subject'] = $this->request->getPost('subject');
$form_data['mail_content'] = $this->request->getPost('mailContent'); $form_data['mail_content'] = $this->request->getPost('mailContent');
$form_data['client_id'] = $this->request->getPost('client_id'); $form_data['client_id'] = $this->request->getPost('client_id');
$form_data['mail_content_json'] = $this->request->getPost('mailJson');
$notificationModel = new NotificationModel(); $notificationModel = new NotificationModel();
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first(); $find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();

View File

@ -1779,7 +1779,7 @@ class PolicyTransactionController extends BaseController
//Actual data for the list //Actual data for the list
$data['report_list'] = $this->policyTransactionModel->getBDSReportList($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id); $data['report_list'] = $this->policyTransactionModel->getBDSReportList($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id);
// dd($data['report_list']); //!dd($data['report_list']);
$this->loadLayout('report_bds_filter', $data); $this->loadLayout('report_bds_filter', $data);
} }
@ -1828,6 +1828,7 @@ class PolicyTransactionController extends BaseController
$data['varience_list'] = $this->policyTransactionModel->getVarienceReportLIst($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id); $data['varience_list'] = $this->policyTransactionModel->getVarienceReportLIst($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id);
// !dd($data['varience_list']);
$this->loadLayout('variance_report_list', $data); $this->loadLayout('variance_report_list', $data);
} }
@ -1959,7 +1960,7 @@ class PolicyTransactionController extends BaseController
// dd($this->validateInsurerStatement(['file_id' => 30])); // dd($this->validateInsurerStatement(['file_id' => 30]));
// $data['insurers'] = $this->insurerModel->where('is_active',1)->findAll(); // $data['insurers'] = $this->insurerModel->where('is_active',1)->findAll();
$today = date('Y-m-d'); $today = date('Y-m-d');
$fromday = $from_date = date('Y-m-d', strtotime('-60 days', strtotime($today))); $fromday = $from_date = date('Y-m-d', strtotime('-180 days', strtotime($today)));
// echo $fromday;die(); // echo $fromday;die();
$data['invoice_status_array'] = $this->invoiceStatus; $data['invoice_status_array'] = $this->invoiceStatus;
$data['insurers'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames(); $data['insurers'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
@ -1986,6 +1987,7 @@ class PolicyTransactionController extends BaseController
->join('insurer_branch', 'insurer_statements.branch_id = insurer_branch.id') ->join('insurer_branch', 'insurer_statements.branch_id = insurer_branch.id')
->join('user_profiles', 'insurer_statements.created_by = user_profiles.id') ->join('user_profiles', 'insurer_statements.created_by = user_profiles.id')
->where('insurer_statements.is_active', 1) ->where('insurer_statements.is_active', 1)
// ->where('insurer_statements.file_status','success')
->where('date(insurer_statements.created_at) >= ', $from_date) ->where('date(insurer_statements.created_at) >= ', $from_date)
->where('date(insurer_statements.created_at) <= ', $today) ->where('date(insurer_statements.created_at) <= ', $today)
->orderBy('insurer_statements.id', 'DESC') ->orderBy('insurer_statements.id', 'DESC')
@ -1997,6 +1999,48 @@ class PolicyTransactionController extends BaseController
$this->loadLayout('insurer_statement_list', $data); $this->loadLayout('insurer_statement_list', $data);
} }
// public function failedStatementList(){
// $today = date('Y-m-d');
// $fromday = $from_date = date('Y-m-d', strtotime('-180 days', strtotime($today)));
// // echo $fromday;die();
// $data['invoice_status_array'] = $this->invoiceStatus;
// $data['insurers'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
// // 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,
// (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) + SUM(inv_payment_details.tds) + SUM(inv_payment_details.gst)
// 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)
// ->where('insurer_statements.file_status','failed')
// ->where('date(insurer_statements.created_at) >= ', $from_date)
// ->where('date(insurer_statements.created_at) <= ', $today)
// ->orderBy('insurer_statements.id', 'DESC')
// ->findAll();
// if($data['insurer_statement_list']){
// return $this->respond(['status' => true, 'code' => 200,'data'=>$data ], 200);
// }else{
// return $this->respond(['status'=>false,'message'=>'Data Not Fount'],404);
// }
// }
public function uploadInsurerStatement() public function uploadInsurerStatement()
{ {
@ -2067,6 +2111,12 @@ class PolicyTransactionController extends BaseController
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file not uploaded', 'error_data' => $validation_result['error_data'],'error_code' => $validation_result['error_code']], 200); return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file not uploaded', 'error_data' => $validation_result['error_data'],'error_code' => $validation_result['error_code']], 200);
} }
if (isset($file_id) || $validation_result['status']) {
$this->insurerStatements->where('id', $file_id)->set(['invoice_status' => 'pending'])->update();
}
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200); return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200);
} }

View File

@ -15,7 +15,7 @@ class ExcelSanitizeHelper
"\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", "\x12", "\x13", "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", "\x12", "\x13",
"\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D",
"\x1E", "\x1F", "\x7F", "_x000D_", "_x000A_", "_x0009_", "_x0008_", "_x0007_", "\x1E", "\x1F", "\x7F", "_x000D_", "_x000A_", "_x0009_", "_x0008_", "_x0007_",
"_x0006_", "_x0005_", "_x0004_", "_x0003_", "_x0002_", "_x0001_" "_x0006_", "_x0005_", "_x0004_", "_x0003_", "_x0002_", "_x0001_","\u200C"
]; ];
/** /**

View File

@ -325,31 +325,42 @@ class MailHelper
// Add CC recipients if provided // Add CC recipients if provided
if (!empty($cc)) { if (!empty($cc)) {
$postData['cc'] = []; $ccList = explode(',', $cc);
// Handle both string and array inputs for CC $ccList = array_map('trim', $ccList);
$ccEmails = is_array($cc) ? $cc : [$cc]; $postData['cc'] = array_map(function($email) {
foreach ($ccEmails as $ccEmail) { return [
$postData['cc'][] = [
'email_address' => [ 'email_address' => [
'address' => $ccEmail 'address' => $email
] ]
]; ];
} }, $ccList);
}
// Add BCC if present
if (!empty($bcc)) {
$bccList = explode(',', $bcc);
$bccList = array_map('trim', $bccList);
$postData['bcc'] = array_map(function($email) {
return [
'email_address' => [
'address' => $email
]
];
}, $bccList);
} }
// Add BCC recipients if provided // Add BCC recipients if provided
if (!empty($bcc)) { // if (!empty($bcc)) {
$postData['bcc'] = []; // $postData['bcc'] = [];
// Handle both string and array inputs for BCC // // Handle both string and array inputs for BCC
$bccEmails = is_array($bcc) ? $bcc : [$bcc]; // $bccEmails = is_array($bcc) ? $bcc : [$bcc];
foreach ($bccEmails as $bccEmail) { // foreach ($bccEmails as $bccEmail) {
$postData['bcc'][] = [ // $postData['bcc'][] = [
'email_address' => [ // 'email_address' => [
'address' => $bccEmail // 'address' => $bccEmail
] // ]
]; // ];
} // }
} // }
// Handle attachments // Handle attachments
if (!empty($attachments)) { if (!empty($attachments)) {

View File

@ -4,9 +4,9 @@ namespace App\Models;
use CodeIgniter\Model; use CodeIgniter\Model;
class NotificationModel extends Model class NotificationModel extends Model
{ {
protected $table = 'notifications'; protected $table = 'notifications';
protected $primaryKey = 'id'; protected $primaryKey = 'id';
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",]; protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",'mail_content_json'];
} }

View File

@ -365,7 +365,6 @@ class PolicyTransactionModel extends Model
vehicle.vehicle_no, vehicle.vehicle_no,
tpa.name as tpa_name, tpa.name as tpa_name,
pt_co_share_details.remark as remarks, pt_co_share_details.remark as remarks,
pt_co_share_details.reward,
pt_co_share_details.bp_amt, pt_co_share_details.bp_amt,
pt_co_share_details.exp_amt, pt_co_share_details.exp_amt,
pt_co_share_details.id as pt_id, pt_co_share_details.id as pt_id,
@ -385,7 +384,6 @@ class PolicyTransactionModel extends Model
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per) AS agreed_tp_or_ter_per, (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per) AS agreed_tp_or_ter_per,
pt_co_share_details.agreed_bp_per, pt_co_share_details.agreed_bp_per,
ROUND( ROUND(
( (
SELECT SELECT
@ -407,6 +405,24 @@ class PolicyTransactionModel extends Model
), ),
2 2
) AS total_irda_amt, ) AS total_irda_amt,
ROUND(
(
SELECT
(
SUM(co_share_stmt_details.reward)
) AS reward
FROM
co_share_stmt_details
JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id
WHERE
co_share_stmt_details.co_share_id = pt_co_share_details.id
AND co_share_stmt_details.is_active = 1
AND insurer_statements.is_active = 1
$date_condition
),
2
) AS reward,
ROUND( ROUND(
( (
@ -426,7 +442,7 @@ class PolicyTransactionModel extends Model
AND co_share_stmt_details.is_active = 1 AND co_share_stmt_details.is_active = 1
AND pt_table.is_active = 1 AND pt_table.is_active = 1
AND insurer_statements.is_active = 1 AND insurer_statements.is_active = 1
AND insurer_statements.invoice_no IS NOT NULL AND insurer_statements.invoice_status IS NOT NULL
$date_condition $date_condition
), ),
@ -469,7 +485,7 @@ class PolicyTransactionModel extends Model
AND co_share_stmt_details.is_active = 1 AND co_share_stmt_details.is_active = 1
AND pt_table.is_active = 1 AND pt_table.is_active = 1
AND insurer_statements.is_active = 1 AND insurer_statements.is_active = 1
AND insurer_statements.invoice_no IS NULL AND insurer_statements.invoice_status IS NULL
$date_condition $date_condition
) )
), ),
@ -737,16 +753,55 @@ class PolicyTransactionModel extends Model
pt_co_share_details.exp_amt, pt_co_share_details.exp_amt,
pt_co_share_details.variance, pt_co_share_details.variance,
ROUND ( (pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt),2) as original_premium,
ROUND(
(
SELECT
(
SUM(co_share_stmt_details.actual_bp_amt) + SUM(co_share_stmt_details.actual_tp_amt) + SUM(co_share_stmt_details.actual_bp_per)
) AS total_stmt_amt
FROM
co_share_stmt_details
JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id and insurer_statements.is_active = 1
WHERE
co_share_stmt_details.co_share_id = pt_co_share_details.id
AND co_share_stmt_details.is_active = 1
),
2
) AS statement_premium,
COALESCE(
(pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 0
) -
COALESCE(
(
SELECT
SUM(co_share_stmt_details.actual_bp_amt) +
SUM(co_share_stmt_details.actual_tp_amt) +
SUM(co_share_stmt_details.actual_bp_per)
FROM
co_share_stmt_details
JOIN
insurer_statements
ON
co_share_stmt_details.statement_id = insurer_statements.id
AND insurer_statements.is_active = 1
WHERE
co_share_stmt_details.co_share_id = pt_co_share_details.id
AND co_share_stmt_details.is_active = 1
), 0
) AS premium_variance_amt,
ROUND( ROUND(
( (
SELECT SELECT
( (
SUM(co_share_stmt_details.actual_bp_brokerage_amt) + SUM(co_share_stmt_details.actual_tp_brokerage_amt) + SUM(co_share_stmt_details.actual_tep_brokerage_amt) SUM(co_share_stmt_details.actual_bp_brokerage_amt) + SUM(co_share_stmt_details.actual_tp_brokerage_amt) + SUM(co_share_stmt_details.actual_tep_brokerage_amt) + SUM(co_share_stmt_details.reward)
) AS total_irda_amt ) AS total_irda_amt
FROM FROM
co_share_stmt_details co_share_stmt_details
JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id and insurer_statements.is_active = 1
WHERE WHERE
co_share_stmt_details.co_share_id = pt_co_share_details.id co_share_stmt_details.co_share_id = pt_co_share_details.id
AND co_share_stmt_details.is_active = 1 AND co_share_stmt_details.is_active = 1
@ -761,11 +816,11 @@ class PolicyTransactionModel extends Model
( (
SUM(co_share_stmt_details.actual_bp_brokerage_amt) + SUM(co_share_stmt_details.actual_bp_brokerage_amt) +
SUM(co_share_stmt_details.actual_tp_brokerage_amt) + SUM(co_share_stmt_details.actual_tp_brokerage_amt) +
SUM(co_share_stmt_details.actual_tep_brokerage_amt) SUM(co_share_stmt_details.actual_tep_brokerage_amt) + SUM(co_share_stmt_details.reward)
) )
FROM co_share_stmt_details FROM co_share_stmt_details
JOIN insurer_statements JOIN insurer_statements
ON co_share_stmt_details.statement_id = insurer_statements.id ON co_share_stmt_details.statement_id = insurer_statements.id and insurer_statements.is_active = 1
WHERE WHERE
co_share_stmt_details.co_share_id = pt_co_share_details.id co_share_stmt_details.co_share_id = pt_co_share_details.id
AND co_share_stmt_details.is_active = 1 AND co_share_stmt_details.is_active = 1
@ -785,7 +840,18 @@ class PolicyTransactionModel extends Model
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left') ->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.is_active', 1) ->where('policy_transaction.is_active', 1)
->where('pt_co_share_details.is_active', 1) ->where('pt_co_share_details.is_active', 1)
->having('variance_amt IS NOT NULL'); // ->where('insurer_statements.is_active',1);
// ->having('variance_amt IS NOT NULL')
// ->having('variance_amt !=',0)
// ->having('premium_variance_amt IS NOT NULL')
// ->having('premium_variance_amt !=',0);
// ->group_start()
->having('variance_amt IS NOT NULL')
->orHaving('variance_amt !=', 0)
->having('premium_variance_amt IS NOT NULL')
->orHaving('premium_variance_amt !=', 0);
// ->group_end();
// ->where('pt_co_share_details.actual_bp_brokerage_amt IS NOT NULL AND pt_co_share_details.actual_bp_brokerage_amt != 0'); // ->where('pt_co_share_details.actual_bp_brokerage_amt IS NOT NULL AND pt_co_share_details.actual_bp_brokerage_amt != 0');
// ->where('pt_co_share_details.variance IS NOT NULL') // ->where('pt_co_share_details.variance IS NOT NULL')
// ->where('pt_co_share_details.variance !=', 0); // ->where('pt_co_share_details.variance !=', 0);

View File

@ -22,6 +22,6 @@ class PolicyTypeModel extends Model
"etp", "etp",
"iep", "iep",
"itp", "itp",
"question_json", "question_json",'itep','etep'
]; ];
} }

View File

@ -141,13 +141,38 @@ table.dataTable tbody td {
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="row" style="margin-bottom:1rem;"> <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-9" style="align-self: center;">
<h4 style="position: relative;">Insurer Statement List</h4> <h4 style="position: relative;">Insurer Statement List</h4>
<!-- <div id="statusSwitchWrapper" class="dt-switch-wrapper">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="statusSwitch">
<label class="custom-control-label" for="statusSwitch">Failed Status</label>
</div>
</div> -->
</div> </div>
<!-- <div class="col-4">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="failedSwitch">
<label class="custom-control-label" for="failedSwitch">Failed</label>
</div>
</div> -->
<div class="col-6" style="text-align: right;"> <div class="col-3" style="text-align: right;">
<button type="button" id="btnAdd" onclick="showFileUploadModal()" class="btn btn-primary waves-effect waves-light">Upload</button> <div class="row align-items-center">
<div class="col-8">
<div id="statusSwitchWrapper" class="dt-switch-wrapper">
<div class="custom-control custom-switch" style="text-align: left;">
<input type="checkbox" class="custom-control-input" id="statusSwitch">
<label class="custom-control-label" for="statusSwitch">Failed Status</label>
</div>
</div>
</div>
<div class="col-4">
<button type="button" id="btnAdd" onclick="showFileUploadModal()" class="btn btn-primary waves-effect waves-light">Upload</button>
</div>
</div>
</div> </div>
</div><div class="dataTables_length d-flex align-items-center">
</div> </div>
<div> <div>
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table"> <table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
@ -356,7 +381,7 @@ table.dataTable tbody td {
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="invoice_value_modal">Invoice value<span id="base_danger" class="text-danger"></span></label> <label for="invoice_value_modal">Invoice value<span id="base_danger" class="text-danger"></span></label>
<input type="number" class="form-control" id="invoice_value_modal" name="invoice_value" placeholder="Enter Invoice Value" readonly> <input type="number" class="form-control" id="invoice_value_modal" name="invoice_value" placeholder="Enter Invoice Value" readonly step="0.01">
</div> </div>
@ -388,7 +413,7 @@ table.dataTable tbody td {
<div class="row" id="modal_received_amt_div"> <div class="row" id="modal_received_amt_div">
<div class="form-group col-md-4" > <div class="form-group col-md-4" >
<label for="addon_policy">Total Received Amount</label> <label for="addon_policy">Total Received Amount</label>
<input type="number" class="form-control" id="modal_received_amt" placeholder="" disabled> <input type="number" class="form-control" id="modal_received_amt" placeholder="" disabled step="0.01">
</div> </div>
</div> </div>
<!-- </div> --> <!-- </div> -->
@ -415,7 +440,7 @@ table.dataTable tbody td {
<tbody> <tbody>
<tr> <tr>
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td> <td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" required onchange="checkInvAmont(event)"></td> <td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" required step="0.01" onchange="checkInvAmont(event)"></td>
<td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter GST" required step="0.01" onchange="checkInvAmont(event)"></td> <td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter GST" required step="0.01" onchange="checkInvAmont(event)"></td>
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td> <td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td>
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td> <td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
@ -633,7 +658,8 @@ document.addEventListener("DOMContentLoaded", function () {
// alert($('#invoice_date_modal').val()); // alert($('#invoice_date_modal').val());
if((!form.checkValidity())) if((!form.checkValidity()))
{ {
// console.log('error2'); console.log('error2');
console.log(form.checkValidity());
return false; return false;
} }
@ -667,7 +693,7 @@ document.addEventListener("DOMContentLoaded", function () {
var jsonData = JSON.stringify(formDataJSON); var jsonData = JSON.stringify(formDataJSON);
console.log(jsonData); console.log(jsonData);
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
// Send the JSON data to the backend using AJAX // Send the JSON data to the backend using AJAX
$.ajax({ $.ajax({
url: 'saveInvoicePaymentDetails', // Replace with your backend URL url: 'saveInvoicePaymentDetails', // Replace with your backend URL
@ -705,7 +731,7 @@ document.addEventListener("DOMContentLoaded", function () {
newRow.innerHTML = ` newRow.innerHTML = `
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td> <td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" onchange="checkInvAmont(event)" required></td> <td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" onchange="checkInvAmont(event)" required step="0.01"></td>
<td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter GST" onchange="checkInvAmont(event)" required step="0.01"></td> <td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter GST" onchange="checkInvAmont(event)" required step="0.01"></td>
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td> <td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td>
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td> <td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
@ -848,7 +874,7 @@ function showInvoiceStatusModal(event)
var row = paymentTableBody.insertRow(); var row = paymentTableBody.insertRow();
row.innerHTML = ` row.innerHTML = `
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" value="${payment.id}"></td> <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></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="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="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" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required></td>
@ -1299,6 +1325,146 @@ function deleteStatement(id)
}); });
} }
// $(document).ready(function() {
// $('#failedSwitch').change(function() {
// if ($(this).prop('checked')) {
// getFailedStatementList();
// } else {
// console.log("Inside Reload Function");
// fetch(window.location.href) // Fetch the current page's content
// .then(response => response.text())
// .then(html => {
// const parser = new DOMParser();
// const doc = parser.parseFromString(html, 'text/html');
// document.body.innerHTML = doc.body.innerHTML; // Replace the body content
// $('.loader').fadeOut();
// $('.loader-mask').delay(100).fadeOut('slow');
// })
// .catch(error => console.error('Error reloading body:', error));
// }
// });
// });
// function checkSwitchStatus(){
// $('#failedSwitch').change(function() {
// if ($(this).prop('checked')) {
// getFailedStatementList();
// } else {
// console.log("Inside Reload Function");
// fetch(window.location.href) // Fetch the current page's content
// .then(response => response.text())
// .then(html => {
// const parser = new DOMParser();
// const doc = parser.parseFromString(html, 'text/html');
// document.body.innerHTML = doc.body.innerHTML; // Replace the body content
// $('.loader').fadeOut();
// $('.loader-mask').delay(250).fadeOut('slow');
// })
// .catch(error => console.error('Error reloading body:', error));
// }
// });
// }
// function getFailedStatementList(){
// $('.loader').fadeIn();
// $('.loader-mask').fadeIn();
// $.ajax({
// url:'<?= base_url("policy_tranction/statement/failedStatement")?>',
// type:'POST',
// success:function(response){
// console.log(response);
// var table = $('#tickets-table').DataTable();
// table.clear();
// $('#tickets-table').addClass('table-fixed');
// var failedList = response.data.insurer_statement_list;
// console.log('failed list'+failedList);
// failedList.forEach(function(row) {
// var newRow = [
// '<input type="hidden" class="row-select" data-id="' + row.id + '">',
// row.short_name + '-' + row.branch_code,
// formatDate(row.month),
// row.stmt_sno,
// row.file_name,
// row.line_items,
// row.file_status +
// (row.file_status == 'failed' ? ' <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>' : ''),
// (row.invoice_status ? row.invoice_status : ' - ') +
// (row.file_status == 'success' ? ' <span class="col-xl-3 col-lg-4 col-sm-6"><i class="fe-alert-circle" data-toggle="tooltip" title="Invoice Amt: ' + (row.invoice_amount || '0.00') + ' Received Amt: ' + (row.received_inv_amt || '0.00') + '"></i></span>' : ''),
// formatDate(row.created_at) + ' by <br>' + row.first_name,
// (row.file_status != 'failed' ?
// '<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 + '" 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>' +
// '<a class="dropdown-item btnEdit" data-id="' + row.id + '" onclick="deleteStatement(' + row.id + ')">' +
// '<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete' +
// '</a>' +
// '</div>' +
// '</div>' : '...')
// ];
// // Append the new row to the table body
// table.row.add(newRow);
// });
// table.draw();
// table.columns.adjust().draw(); // Ensures correct alignment
// $('.loader').fadeOut();
// $('.loader-mask').delay(250).fadeOut('slow');
// },
// error: function(xhr, status, error) {
// let message = 'Failed to load Data ';
// toastr.error(response.message, 'Failed');
// $('.loader').fadeOut();
// $('.loader-mask').delay(250).fadeOut('slow');
// }
// })
// }
// $(document).ready(function() {
// var table = $('#tickets-table').DataTable({
// // responsive: true, // Ensures table adjusts to smaller screens
// stateSave: true, // Saves the table's state
// });
// });
</script>
<script>
$(document).ready(function() {
// Add custom filter function to DataTables
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
const showFailedStatus = $('#statusSwitch').is(':checked');
const status = data[6].toLowerCase().trim(); // Index 6 is the file_status column
if (showFailedStatus) {
return status.includes('failed');
} else {
return status.includes('success');
}
});
// Initialize DataTable
const table = $('#tickets-table').DataTable({
// Your existing DataTable options here
"order": [], // Disable initial sorting if needed
"pageLength": 10,
// "dom": '<"top"lf>rt<"bottom"ip><"clear">', // This places length and filter controls at top
"language": {
"lengthMenu": "Show _MENU_ entries",
"search": "Search:"
}
});
// Add event listener for switch changes
$('#statusSwitch').on('change', function() {
table.draw(); // Redraw the table to apply the filter
});
// Trigger initial filter to show only success status
table.draw();
});
</script> </script>

View File

@ -79,7 +79,10 @@
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css" /> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<!-- srinivas -->
<script src="https://editor.unlayer.com/embed.js"></script>
<!-- <script src="<?= base_url('public/unlayer/js/embed.js').''?>"></script> -->
<!-- srinivas -->
<style> <style>
@ -668,61 +671,98 @@
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?> <?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<li> <li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect"> <a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i> <i class="mdi mdi-format-list-bulleted"></i>
<span class="badge badge-success badge-pill float-right">2</span> <span class="badge badge-success badge-pill float-right">2</span>
<span> Policy Transactions </span> <span> Policy Transactions </span>
</a> </a>
<div class="collapse" id="sidebarDashboards"> <div class="collapse" id="policyTransactions">
<ul class="nav-second-level"> <ul class="nav-second-level">
<li> <li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a> <a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
</li> <i class="mdi mdi-format-list-bulleted"></i>
<li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li>
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?> <span>Policy Transactions</span>
</a>
<div class="collapse" id="policyTransactions">
<ul>
<li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li>
<li> <?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a> <li>
</li> <a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
</li>
</ul>
</div>
</li>
<li>
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
<i class="ri-file-chart-fill"></i>
<span> Policy Reports </span>
</a>
<div class="collapse" id="policyReports">
<ul class="nav-third-level">
<li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
</li>
<?php } ?>
</ul>
</div>
</li>
<li>
<li>
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-timer-sand"></i>
<span> Policy Pending Actions </span>
</a>
<div class="collapse" id="policyReports">
<ul class="nav-third-level">
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
</li>
<?php } ?>
<li> <?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a> <li>
</li> <a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
<li> </li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a> </li></ul></div>
</li>
<li> <li>
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a> <a href="#policyMasters" data-toggle="collapse" class="waves-effect">
</li> <i class="ri-database-2-line"></i>
<li> <span> Masters </span>
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a> </a>
</li> <div class="collapse" id="policyReports">
<ul class="nav-third-level">
<li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
</li>
</ul></div>
</li>
<li>
<a href="<?= base_url('/dmsSearch') ?>"><i class="ri-book-open-line"></i><span> Documents</span></a>
</li>
</ul>
</div>
</li>
<?php } ?>
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
</li>
<?php } ?>
<li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
</li>
<li>
<a href="<?= base_url('/dmsSearch') ?>">Documents</a>
</li>
</ul>
</div>
</li>
<?php } ?> <?php } ?>

View File

@ -9,6 +9,29 @@
.scrollb { .scrollb {
overflow-y: auto !important; overflow-y: auto !important;
} }
#editor-container {
width: 100%;
min-height: 600px;
}
#account_maneger_summary_mail_modal .modal-dialog,
#member_review_and_summary_mail_modal .modal-dialog {
max-width: 90% !important;
width: 90% !important;
}
/* Also ensure the modal body has proper height */
#account_maneger_summary_mail_modal .modal-body,
#member_review_and_summary_mail_modal .modal-body {
min-height: 600px;
padding: 20px;
}
/* If you're using Bootstrap's modal, you might also want to ensure proper positioning */
.modal-dialog {
margin: 1.75rem auto;
}
</style> </style>
<div class="tab-pane fade" id="notification-tab"> <div class="tab-pane fade" id="notification-tab">
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($notification['id']) ? $notification['id'] : '' ?>"/> <input type="hidden" id="client_id_for_client_branch" value="<?= isset($notification['id']) ? $notification['id'] : '' ?>"/>
@ -526,7 +549,7 @@
</div><!-- /.modal --> </div><!-- /.modal -->
<!-- Modal content for the Large example --> <!-- Modal content for the Large example -->
<div class="modal fade" id="account_maneger_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" <!-- <div class="modal fade" id="account_maneger_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static"> aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width"> <div class="modal-dialog modal-full-width">
<div class="modal-content"> <div class="modal-content">
@ -561,7 +584,7 @@
<div class="form-group col-md-2 testmail" style="display: none;"> <div class="form-group col-md-2 testmail" style="display: none;">
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a> <a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
</div> </div>
</div> </div> -->
<!-- <div class="form-row" id="rac_rate_dropdown"> <!-- <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
@ -574,7 +597,7 @@
</select> </select>
</div> </div>
</div> --> </div> -->
<div class="form-row" id="rac_rate_dropdown"> <!-- <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<select id="account_maneger_summary_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;"> <select id="account_maneger_summary_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
<option value="">PlaceHolders</option> <option value="">PlaceHolders</option>
@ -607,11 +630,61 @@
id="btnGridSubmit_2">Submit</button> id="btnGridSubmit_2">Submit</button>
</div> </div>
</form> </form>
</div> -->
<!-- </div>/.modal-content -->
<!-- </div>/.modal-dialog -->
<!-- </div>/.modal -->
<div class="modal fade" id="account_maneger_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Member Review and summary mail <span id="nameOfThePolicy"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="text-center" id="no_data"></div>
<form role="form" class="parsley-examples" method="post" id="account_maneger_summary_mail_form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Template Name</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="template_name" name="template_name" value="Account Maneger Summary Mail" readonly class="form-control" placeholder="Template Name">
</div>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Subject</label>
</div>
<div class="form-group col-md-5">
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
</div>
<div class="form-group col-md-2 testmail" style="display: none;">
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
</div>
</div><hr>
<!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<div id="editor-container" style="height: 300px;width:max-content"></div>
</div>
</div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1 preview_button"
id="">Preview</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
</div>
</form>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
<!-- Modal content for the Large example --> <!-- Modal content for the Large example -->
<div class="modal fade" id="client_hr_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" <div class="modal fade" id="client_hr_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static"> aria-hidden="true" aria-modal="true" data-backdrop="static">
@ -794,7 +867,7 @@
const editor3 = Jodit.make("#member_review_and_summary", editorConfig); const editor3 = Jodit.make("#member_review_and_summary", editorConfig);
const editor4 = Jodit.make("#account_maneger_summary_mail_snow_editor", editorConfig); // const editor4 = Jodit.make("#account_maneger_summary_mail_snow_editor", editorConfig);
const editor5 = Jodit.make("#client_hr_summary", editorConfig); const editor5 = Jodit.make("#client_hr_summary", editorConfig);
@ -1044,49 +1117,49 @@
} }
}) })
$('#account_maneger_summary_mail_form').submit(function (event) // $('#account_maneger_summary_mail_form').submit(function (event)
{ // {
event.preventDefault(); // event.preventDefault();
var joditEditor = editor4; // var joditEditor = editor4;
if (joditEditor) // if (joditEditor)
{ // {
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html(); // var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
var formData = $(this).serializeArray(); // var formData = $(this).serializeArray();
formData.push({ name: 'mailContent', value: mailContent }); // formData.push({ name: 'mailContent', value: mailContent });
formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() }); // formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
$('.loader').fadeIn(); // $('.loader').fadeIn();
$('.loader-mask').fadeIn(); // $('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>'; // var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({ // $.ajax({
url: form_action, // url: form_action,
type: "POST", // type: "POST",
data: formData, // data: formData,
dataType: 'json', // dataType: 'json',
success: function(res) // success: function(res)
{ // {
$('#account_maneger_summary_mail_modal').find('.close').click(); // $('#account_maneger_summary_mail_modal').find('.close').click();
$('.loader').fadeOut(); // $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); // $('.loader-mask').delay(350).fadeOut('slow');
}, // },
error: function (xhr, status, error) // error: function (xhr, status, error)
{ // {
console.error(xhr.responseText); // console.error(xhr.responseText);
console.error(status, error); // console.error(status, error);
setTimeout(function() // setTimeout(function()
{ // {
$('.loader').fadeOut(); // $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); // $('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning'); // toastr.warning('Something Wrong!', 'warning');
}, 1000); // }, 1000);
} // }
}); // });
} // }
else // else
{ // {
console.error("Jodit editor instance is not defined."); // console.error("Jodit editor instance is not defined.");
} // }
}) // })
$('#client_hr_summary_mail_form').submit(function (event) $('#client_hr_summary_mail_form').submit(function (event)
{ {
@ -1207,7 +1280,7 @@
{ {
var template_name = $(element).attr('id'); var template_name = $(element).attr('id');
if (template_name == "member_welcome_mail" || template_name == "member_reminder_mail" || template_name == "member_ecard_mail" || template_name == "member_review_and_summary_mail" || template_name == "account_maneger_summary_mail" || template_name == "client_hr_summary_mail") if (template_name == "member_welcome_mail" || template_name == "member_reminder_mail" || template_name == "member_ecard_mail" || template_name == "member_review_and_summary_mail" || template_name == "client_hr_summary_mail")
{ {
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
@ -1556,6 +1629,325 @@
}); });
} }
</script> </script>
<script>
// Global editor variable
let editor = null;
// Function to check if unlayer is loaded and available
function isUnlayerLoaded() {
return typeof unlayer !== 'undefined' && unlayer !== null;
}
// Enhanced waiting function with better error handling
function waitForUnlayer(callback, maxAttempts = 20) {
let attempts = 0;
const checkUnlayer = setInterval(function() {
attempts++;
console.log("Checking for Unlayer, attempt:", attempts);
if (isUnlayerLoaded()) {
clearInterval(checkUnlayer);
console.log("Unlayer loaded successfully");
callback(true);
} else if (attempts >= maxAttempts) {
clearInterval(checkUnlayer);
console.error("Unlayer failed to load after", attempts, "attempts");
callback(false);
}
}, 1000); // Increased interval to 1 second
}
// Improved editor initialization function
function initializeEditor(callback) {
console.log("Starting editor initialization...");
const editorContainer = document.getElementById('editor-container');
if (!editorContainer) {
console.error("Editor container not found");
if (callback) callback(null);
return;
}
// Ensure the script is loaded
if (!document.querySelector('script[src*="unlayer"]')) {
console.error("Unlayer script is not included in the page");
if (callback) callback(null);
return;
}
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
waitForUnlayer(function(unlayerLoaded) {
if (!unlayerLoaded) {
console.error("Unlayer not available");
if (callback) callback(null);
return;
}
try {
// Destroy existing instance if it exists
if (editor) {
console.log("Destroying existing editor...");
editor.destroy();
editor = null;
}
// Clear the container
editorContainer.innerHTML = '';
// Create new editor instance with error handling
console.log("Creating new editor instance...");
editor = unlayer.createEditor({
id: 'editor-container',
projectId: 263979,
displayMode: "email",
features: {
textEditor: {tables: true },
preview: {enabled: true,deviceOptions: ['desktop', 'mobile']},
// preview: { enabled: true },
imageEditor: { enabled: true },
appearance: {
theme: 'light',
panels: {
tools: { dock: "right" }
}
}
},
branding:false,
tools: {
// Configure any specific tools you need
text: {
enabled: true
},
image: {
enabled: true
}
}
});
// Verify editor initialization
if (!editor || typeof editor.loadDesign !== 'function') {
throw new Error("Editor initialization failed - editor instance is invalid");
}
console.log("Editor initialization completed successfully");
$('.loader').fadeOut();
$('.loader-mask').fadeOut();
if (callback) callback(editor);
} catch (error) {
console.error("Error in editor initialization:", error);
if (callback) callback(null);
$('.loader').fadeOut();
$('.loader-mask').fadeOut();
}
});
}
// Modified template data function with better error handling
function getMailTemplateData(element) {
const template_name = element.id;
const validTemplates = [
"account_maneger_summary_mail",
];
if (!validTemplates.includes(template_name)) {
console.error("Invalid template name:", template_name);
return;
}
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
const primaryKey = $('#general_PrimaryKey').val();
const baseUrl = '<?= base_url("client/notification/getMailTemplateData/") ?>';
const form_action = `${baseUrl}${template_name}/${primaryKey}`;
$.ajax({
url: form_action,
type: "GET",
dataType: 'json',
success: function(res) {
console.log('get Mail Template Data', res);
if (res) {
// Set subject
$(`#${template_name}_form #subject`).val(res.subject || '');
// Initialize editor with retry mechanism
let retryCount = 0;
const initWithRetry = function() {
initializeEditor(function(editorInstance) {
if (!editorInstance && retryCount < 3) {
console.log(`Retrying editor initialization (${retryCount + 1}/3)...`);
retryCount++;
setTimeout(initWithRetry, 1000);
return;
}
if (!editorInstance) {
console.error("Editor initialization failed after retries");
toastr.error('Editor initialization failed. Please refresh the page.');
return;
}
if (res.mail_content_json) {
try {
const design = JSON.parse(res.mail_content_json);
editorInstance.loadDesign(design);
console.log("Design loaded successfully");
hideBranding();
} catch (error) {
console.error("Error parsing mail content JSON:", error);
toastr.error('Error loading email template');
}
}else{
hideBranding()
}
});
};
initWithRetry();
if (res.data) {
addHTMLInput(res.data);
} else {
addHTMLInput();
}
// Update UI elements
$('.testmail').toggle(!!res.id);
$('#attachment_table').toggle(!!res.id);
$('.setid').attr('data-id', res.id || '');
}else{
console.log("Inside else");
let retryCount = 0;
const initWithRetry = function() {
initializeEditor(function(editorInstance) {
if (!editorInstance && retryCount < 3) {
console.log(`Retrying editor initialization (${retryCount + 1}/3)...`);
retryCount++;
setTimeout(initWithRetry, 1000);
return;
}
if (!editorInstance) {
console.error("Editor initialization failed after retries");
toastr.error('Editor initialization failed. Please refresh the page.');
return;
}
hideBranding();
});
};
initWithRetry();
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function(xhr, status, error) {
console.error("Ajax error:", { status, error, response: xhr.responseText });
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.error('Failed to load template data');
}
});
}
$('#account_maneger_summary_mail_form').submit(function (event) {
event.preventDefault();
// Check if editor instance exists
if (!editor) {
console.error("Editor not initialized");
toastr.error("Editor not ready. Please try again.");
return;
}
// Use the editor instance instead of unlayer directly
editor.exportHtml(function (data) {
var formData = $('#account_maneger_summary_mail_form').serializeArray();
// Append Unlayer editor data
formData.push({
name: 'mailContent',
value: data.html
});
formData.push({
name: 'client_id',
value: $('#general_PrimaryKey').val()
});
formData.push({
name: 'mailJson',
value: JSON.stringify(data.design)
});
console.log(formData);
// Show loading indicators
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/notification/create") ?>';
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res) {
$('#account_maneger_summary_mail_modal').find('.close').click();
toastr.success('Template saved successfully');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
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 Went Wrong!', 'warning');
}, 1000);
}
});
});
});
function hideBranding(){
$('iframe').on('load', function() {
console.log('Iframe loaded.');
const iframe = $(this);
// Overlay the branding area
const overlay = $('<div>', {
css: {
position: 'absolute',
bottom: '0', // Adjust based on branding position
left: '0',
width: iframe.width(),
height: '30px', // Adjust height to cover branding
backgroundColor: 'white',
zIndex: '9999',
pointerEvents: 'none',
},
});
const iframeParent = iframe.parent();
if (iframeParent.css('position') === 'static') {
iframeParent.css('position', 'relative');
}
iframeParent.append(overlay);
console.log('Overlay added to hide branding.');
});
}
</script>

View File

@ -15,10 +15,9 @@
placeholder="Enter Policy Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required> placeholder="Enter Policy Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="kyc_name">Policy Type Long Name<span <label for="kyc_name">Policy Type Long Name</label>
class="text-danger">*</span></label>
<input type="text" class="form-control" id="long_name" <input type="text" class="form-control" id="long_name"
placeholder="Enter Policy Type Long Name" value="<?= isset($policytype['long_name']) ? $policytype['long_name'] : '' ?>" name="long_name" required> placeholder="Enter Policy Type Long Name" value="<?= isset($policytype['long_name']) ? $policytype['long_name'] : '' ?>" name="long_name">
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="bap">BAP<span <label for="bap">BAP<span
@ -38,6 +37,37 @@
<input type="text" class="form-control" id="alloci" <input type="text" class="form-control" id="alloci"
placeholder="Enter Alloci" value="<?= isset($policytype['alloci']) ? $policytype['alloci'] : '' ?>" name="alloci" required> placeholder="Enter Alloci" value="<?= isset($policytype['alloci']) ? $policytype['alloci'] : '' ?>" name="alloci" required>
</div> </div>
<div class="form-group col-md-4">
<label for="ebp">Group Base Premium<span class="text-muted"> (STD %)</span></label>
<input type="number" class="form-control" id="ebp"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['ebp']) ? $policytype['ebp'] : '' ?>" name="ebp">
</div>
<div class="form-group col-md-4">
<label for="etp">Group Third Party Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="etp"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['etp']) ? $policytype['etp'] : '' ?>" name="etp">
</div>
<div class="form-group col-md-4">
<label for="etep">Group Terrorism Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="etep"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['etep']) ? $policytype['etep'] : '' ?>" name="etep">
</div>
<div class="form-group col-md-4">
<label for="iep">Individual Base Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="iep"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['iep']) ? $policytype['iep'] : '' ?>" name="iep">
</div>
<div class="form-group col-md-4">
<label for="itp">Individual Third-Party Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="itp"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['itp']) ? $policytype['itp'] : '' ?>" name="itp">
</div>
<div class="form-group col-md-4">
<label for="itep">Individual Terrorism Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="itep"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['itep']) ? $policytype['itep'] : '' ?>" name="itep">
</div>
</div> </div>
<hr> <hr>
@ -94,7 +124,7 @@ $(document).ready(function () {
}, 1000); }, 1000);
$('#policy_type_id').val(res.data.id); $('#policy_type_id').val(res.data.id);
$('#policytype_General_PrimaryKey').val(res.data.id); $('#policytype_General_PrimaryKey').val(res.data.PrimaryKey);
$('#policy_id_type').click(); $('#policy_id_type').click();
$('#btnBranchAdd').show(); $('#btnBranchAdd').show();
var message = "Policy Type General Info"; var message = "Policy Type General Info";

View File

@ -32,6 +32,13 @@ table.dataTable tbody td {
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<div id="totals" style="margin-bottom: 10px;">
<strong>Total Premium:</strong> <span id="total_premium">0.00</span> |
<strong>Total Rewards:</strong> <span id="total_rewards">0.00</span> |
<strong>Total IRDA Revenue INR:</strong> <span id="total_irda">0.00</span> |
<strong>Total Billed Amount:</strong> <span id="total_billed">0.00</span> |
<strong>Total Unbilled Amount:</strong> <span id="total_unbilled">0.00</span>
</div>
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
@ -61,10 +68,11 @@ table.dataTable tbody td {
<th>Total Premium</th> <th>Total Premium</th>
<th>Base <br> Revenue %</th> <th>Base <br> Revenue %</th>
<th>TP / Terrorism <br> Revenue %</th> <th>TP / Terrorism <br> Revenue %</th>
<th>Rewards</th>
<th>Total IRDA <br> Revenue INR</th> <th>Total IRDA <br> Revenue INR</th>
<th>Billed Amount</th> <th>Billed Amount</th>
<th>UnBilled Amount</th> <th>UnBilled Amount</th>
<th>Rewards</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -97,11 +105,17 @@ table.dataTable tbody td {
<td class="right-align-input"><?php echo $row['total_premium']; ?></td> <td class="right-align-input"><?php echo $row['total_premium']; ?></td>
<td class="right-align-input"><?php echo $row['agreed_bp_per']; ?>&nbsp;%</td> <td class="right-align-input"><?php echo $row['agreed_bp_per']; ?>&nbsp;%</td>
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?>&nbsp;%</td> <td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?>&nbsp;%</td>
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo empty($row['total_irda_amt']) ? $row['exp_amt'] : $row['total_irda_amt']; ?></td> <td class="right-align-input"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
<?php $total_irda_amt = empty($row['total_irda_amt']) ? $row['exp_amt'] : $row['total_irda_amt']; ?>
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo $total_irda_amt; ?></td>
<td class="right-align-input"><?php echo empty($row['billed_amt']) ? '0.00' : $row['billed_amt'] ?></td> <td class="right-align-input"><?php echo empty($row['billed_amt']) ? '0.00' : $row['billed_amt'] ?></td>
<!-- <td class="right-align-input"><?php echo empty($row['unbilled_amt']) ? '0.00' : $row['unbilled_amt']?></td> --> <!-- <td class="right-align-input"><?php echo empty($row['unbilled_amt']) ? '0.00' : $row['unbilled_amt']?></td> -->
<td class="right-align-input"><?php echo number_format((float)$row['total_irda_amt'] - $row['billed_amt'],2, '.', '')?></td> <?php
<td class="right-align-input"><?php echo $row['reward']; ?></td> $unbilled_amt = $row['total_irda_amt'] - $row['billed_amt'];
$unbilled_amt = $unbilled_amt == 0 && $row['billed_amt'] == 0 ? $total_irda_amt : $unbilled_amt ;
?>
<td class="right-align-input"><?php echo number_format((float)$unbilled_amt,2, '.', '')?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
@ -191,7 +205,21 @@ $(document).ready(function() {
// Append the new total row to the sheet // Append the new total row to the sheet
$(sheet).find('sheetData').append(totalRow); $(sheet).find('sheetData').append(totalRow);
} },
exportOptions: {
orthogonal: 'sort'
},
customizeData: function (data) {
for (var i = 0; i < data.body.length; i++) {
for (var j = 0; j < data.body[i].length; j++) {
// Check if the column is the 9th index (10th column)
if (j === 9) {
data.body[i][j] = '\u200C' + data.body[i][j];
}
}
}
}
} }
], ],
@ -201,7 +229,38 @@ $(document).ready(function() {
}, },
paging: true, // Enable pagination paging: true, // Enable pagination
pageLength: 25, // Set default number of rows per page (optional) pageLength: 25, // Set default number of rows per page (optional)
ordering: false, ordering: false,
"footerCallback": function(row, data, start, end, display) {
var api = this.api();
// Calculate column totals
var totalPremium = api.column(23).data().reduce(function(a, b) {
return parseFloat(a) + parseFloat(b) || 0;
}, 0);
var total_rewards = api.column(26).data().reduce(function(a,b){
return parseFloat(a) + parseFloat(b) || 0;
})
var totalIrda = api.column(27).data().reduce(function(a, b) {
return parseFloat(a) + parseFloat(b) || 0;
}, 0);
var totalBilled = api.column(28).data().reduce(function(a, b) {
return parseFloat(a) + parseFloat(b) || 0;
}, 0);
var totalUnbilled = api.column(29).data().reduce(function(a, b) {
return parseFloat(a) + parseFloat(b) || 0;
}, 0);
// Update the totals in the div above the table
$('#total_premium').text(totalPremium.toFixed(2));
$('#total_rewards').text(total_rewards.toFixed(2))
$('#total_irda').text(totalIrda.toFixed(2));
$('#total_billed').text(totalBilled.toFixed(2));
$('#total_unbilled').text(totalUnbilled.toFixed(2));
}
}); });
} else { } else {
console.error("Table atet found."); console.error("Table atet found.");

View File

@ -170,6 +170,9 @@ table.dataTable tbody td {
<th>Insurer Branch</th> <th>Insurer Branch</th>
<th>Policy</th> <th>Policy</th>
<th>Endorsement No</th> <th>Endorsement No</th>
<th>Premium</th>
<th>Statement Premium</th>
<th>Premium Variance</th>
<th>Expected Amount</th> <th>Expected Amount</th>
<th>Statement Amount</th> <th>Statement Amount</th>
<th>Variance</th> <th>Variance</th>
@ -186,9 +189,12 @@ table.dataTable tbody td {
<td><?php echo $row['insurer_branch_name']; ?></td> <td><?php echo $row['insurer_branch_name']; ?></td>
<td><?php echo $row['policy_type'] .' - '. $row['policy_no']; ?></td> <td><?php echo $row['policy_type'] .' - '. $row['policy_no']; ?></td>
<td><?php echo $row['endorsement_no']; ?></td> <td><?php echo $row['endorsement_no']; ?></td>
<td class="right-align-input"><?php echo $row['original_premium']; ?></td>
<td class="right-align-input"><?php echo isset($row['statement_premium']) ? $row['statement_premium'] : '0.00'; ?></td>
<td class="right-align-input"><?php echo $row['premium_variance_amt']; ?></td>
<td class="right-align-input"><?php echo $row['exp_amt']; ?></td> <td class="right-align-input"><?php echo $row['exp_amt']; ?></td>
<td class="right-align-input"><?php echo $row['statement_amount']; ?></td> <td class="right-align-input"><?php echo isset($row['statement_amount']) ? $row['statement_amount'] : '0.00'; ?></td>
<td class="right-align-input"><?php echo $row['variance_amt']; ?></td> <td class="right-align-input"><?php echo isset($row['variance_amt']) ? $row['variance_amt'] : '0.00'; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>