diff --git a/app/Config/Routes.php b/app/Config/Routes.php index b68ae6c3..82a48f37 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -218,6 +218,9 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){ $routes->get("fetch-emp-count/(:any)", "EmployeeController::getEmpCount/$1"); $routes->get("init-Emp-onboard/(:any)", "EmployeeController::initiateManualEmployeesOnboardProcess/$1"); $routes->get("full-excel-error-file/(:any)", "EmployeeController::downloadFullExcelErrorFile/$1"); + $routes->get("id-card", "EmployeeController::viewECard/$1"); + $routes->get('digital-id-card/(:segment)/(:segment)', 'EmployeeController::generateIDCardForEmployee/$1/$2'); + }); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index baca94e2..96815f94 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1104,7 +1104,7 @@ class ClientController extends AdminController try { foreach ($results as $index => $record) { - if ($self->self == 1 && $self->spouse == 0 && $self->childrens == 0 && $self->parents == 0 && $self->{'parents-in-law'} == 0 && $self->{'either-parents-pil'} == 0) { + if ($self->self == 1 && $self->spouse == 0 && $self->childrens == 0 && $self->parents == 0 && $self->{'parents-in-law'} == 0 && $self->{'either-parents-pil'} == 0 && $family_floater == 0) { if ($index == '0' || $index == '1' || $index == '2') { $resultss[$index] = $record; } diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 4a029f00..7261cec6 100644 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -29,6 +29,8 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; +use Dompdf\Dompdf; + class EmployeeController extends AdminController { @@ -247,19 +249,23 @@ class EmployeeController extends AdminController { $file_id = $this->request->uri->getSegment(3); $empServiceController = new EmployeeServiceController(); - - // Render views and capture output - $result = $empServiceController->getExcelErrorData($file_id); $result['file_id'] = $file_id; - // echo '
';
-        // print_r($result); die;
-        if($result){
+        // Render views and capture output
+        $result = $empServiceController->getExcelErrorData($file_id);
+
+        if ($result != 0) {
+
             echo view('excel_errors', $result);
-        }else{
+        } else if ($result == 0) {
+
+            $data['message'] = 'File Not Found Physically';
+            return view('errors/404', $data);
+
+        } else {
+
             echo view('errors/html/production');
         }
-    
     }
 
     /**
@@ -673,6 +679,7 @@ class EmployeeController extends AdminController
             
                 $highestRowAndColumn = $sheet->getHighestRowAndColumn();
                 $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
+                // dd($excel_data);
                 $emp_data['thead'] = $excel_data[0];
                 unset($excel_data[0]);
                 $emp_data['tbody'] = $excel_data;
@@ -684,7 +691,7 @@ class EmployeeController extends AdminController
                 $html = '
No Data Found
'; } - return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $html, 'file_data' => $file_name], 200); + return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $html, 'file_data' => $file_name, 'excel_data' => $excel_data], 200); } catch (\Exception $e) { // Handle exception @@ -826,6 +833,33 @@ class EmployeeController extends AdminController return $response; } + public function generateIDCardForEmployee($emp_code, $client_policy_id) + { + $dompdf = new Dompdf(); + + $data['data'] = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code); + // $this->loadLayout('id_card_view', $data); exit; + + $html = view('id_card_view', $data); + // $html = str_replace('', '', $html); + + $dompdf->loadHtml($html); + + // (Optional) Setup the paper size and orientation + $dompdf->setPaper('A4', 'landscape'); + + // Render the HTML as PDF + $dompdf->render(); + + // Output the generated PDF to Browser + $dompdf->stream(); + + } + + public function viewECard() + { + $this->loadLayout('id_card_view'); + } diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index cc5cafeb..c7af743f 100644 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -958,6 +958,7 @@ class EmployeeServiceController extends AdminController { $error_message = "File not found"; $this->myLogger->logme('error',($error_message . ' for file id ' . $file_id)); + return 0; } $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path); diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index b7e2f19d..105979be 100644 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -674,7 +674,8 @@ class EmployeePolicyModel extends Model } - public function getViewEmpSuccessList($file_id){ + public function getViewEmpSuccessList($file_id) + { return $this->db->table('employees emp') ->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile']) ->join('employee_polices', 'employee_polices.employee_id = emp.id') @@ -689,5 +690,55 @@ class EmployeePolicyModel extends Model ->whereIn('employee_polices.status', ['draft', 'enrolled']) ->get()->getResultArray(); } + + public function getECardDataUsingMd5($client_policy_id, $emp_code){ + + $result = $this->db->table('employees e') + ->select('e.id, + e.name, e.mobile, + e.relationship, + e.relationship_code, + e.emp_code, + e.email_personal, + e.email_corporate, + e.gender, + e.dob, + e.doj, + e.band, + TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age, + + ep.tpa_id, + ep.uhid, + ep.policy_end_date, + + clients.client_name, + clients.short_name AS client_short_name, + + policies.name AS policy_name, + + insurers.name AS insurer_name, + insurers.short_name AS insurer_short_name, + + tpa.name AS tpa_name, + tpa.short_name AS tpa_short_name' + ) + + ->join('employee_polices ep', 'ep.employee_id = e.id') + ->join('client_policy cp', 'cp.id = ep.client_policy_id') + ->join('clients', 'clients.id = cp.client_id') + ->join('policies', 'policies.id = cp.policy_id') + ->join('insurers', 'insurers.id = cp.insurer_id') + ->join('tpa', 'tpa.id = cp.tpa_id') + ->where('e.emp_status', 'active') + ->where('e.is_active', '1') + ->where('ep.status', 'active') + ->where('ep.is_active', '1') + ->where('MD5(e.emp_code)', $emp_code) + ->where('MD5(ep.client_policy_id)', $client_policy_id) + ->get() + ->getResultArray(); + + return $result; + } } \ No newline at end of file diff --git a/app/Views/id_card_view.php b/app/Views/id_card_view.php new file mode 100644 index 00000000..b646bb87 --- /dev/null +++ b/app/Views/id_card_view.php @@ -0,0 +1,80 @@ + + + + + + + Driving License ID Card + + + + + + + $value) { ?> + + + + + + +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ +
+
+
+

Terms and Conditions

+

This card is non-transferable and is valid at network hospitals only.

+
    +
  • will enable Card Holder to avail cashless hospitalization only on the basis of +
  • +
  • In the case of photoless identity cards issued to beneficiaries, acceptable + proof
  • +
  • Notify the authorities in case of any changes to your personal information.
  • +
  • The mentioned covers are add-ons by paying additional premium and available only if opted by the policyholders.
  • +
+
+
+
+
+ + + button + + + + + \ No newline at end of file diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index 372e5279..289392f5 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -27,17 +27,17 @@ -
@@ -487,6 +487,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
- + @@ -695,8 +696,10 @@ $('body').on('click', '.btnPolicyModel', function() { if(res.family_floater == 1){ $('#premium_type').show(); + $('#individual').prop('checked', true) }else{ $('#premium_type').hide(); + $('#individual').prop('checked', false) } setTimeout(function() { @@ -827,8 +830,8 @@ $('body').on('click', '.btnPolicyModel', function() { $('#grid').empty(); $('#nameOfThePolicy').html(''); $('#GridForm').hide(); - $('#no_data').html('The policy has no Policy Rac Rate'); - toastr.warning("The policy has no Policy Rac Rate", "Warning") + $('#no_data').html('The policy has no Policy Rack Rate'); + toastr.warning("The policy has no Policy Rack Rate", "Warning") } @@ -1208,7 +1211,7 @@ function appendGridtHtml(ui_type = false, data = false, ) {
-
+