diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 123b329a..c12db26c 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -12,7 +12,8 @@ $routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']); // Reminder Mail Notification $routes->get("reminder_mail", "NotificationController::reminder_mail"); -$routes->get("testing", "ClientController::Testing"); +// $routes->get("testing", "ClientController::Testing"); +$routes->get("testing_for_review_mail/(:any)", "ClientController::testingForReviewMail/$1"); $routes->get("update-policy-terms-for-corrections", "ClientController::updatePolicyTermsForCorrections"); $routes->get("update_rack_rate_json", "ClientController::updateRackRateJson"); $routes->get("updatajson", "EmpDataServiceController::updatajson"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 79dc65c4..6bad026d 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -115,72 +115,121 @@ class ClientController extends AdminController $this->vehicleModel = new VehicleModel(); } - public function Testing() //this function for only tsesting some logics not use for business logic + public function testingForReviewMail($client_id = 77, $emp_code = 'MGL-004', $mail_active = 0) //this function for only tsesting some logics not use for business logic { - $emp_code = 'MGL-004'; - $client_id = 77; - $client_policy_id = 205; - $array_list = []; - $find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $client_policy_id, emp_code: $emp_code, client_id: $client_id, emp_status: ['draft', 'enrolled'], policy_status: ['draft', 'enrolled']); - if (count($find) > 0) { - $array_list[] = $find; - } + $client_policy_ids = $this->employeeModel + ->select('employee_polices.client_policy_id') + ->join('employee_polices', 'employees.id = employee_polices.employee_id') + ->where('employees.client_id', $client_id ) + ->where('employees.emp_code', $emp_code ) + ->where('employee_polices.is_active', 1 ) + ->where('employees.is_active', 1 ) + ->findAll(); - // dd($array_list); + $client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id'); - $notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', 'member_review_and_summary_mail')->first(); + $client_policy_id = array_unique($client_policy_ids2); - // dd($notification); + // echo '
';
+ // dd($client_policy_id);
+ // print_r($unique_policy_ids); die;
+ // sort($client_policy_id);
- if (isset($notification) && $notification['enabled'] == 1) {
+ $wholeData = '';
+ $mail_send_return = '';
+ $mail_send_return1 = '';
+ $mail_send_return2 = '';
- $params['array_list'] = $array_list;
- $params['client_policy_id'] = $client_policy_id;
- $params['emp_code'] = $emp_code;
- $params['client_id'] = $client_id;
- $params['notification'] = $notification;
-
- // print_r($params);die;
-
- $wholeData = sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
-
- // print_r($wholeData); die;
-
- $mail_send_return = MailHelper::send_email($wholeData[0]);
- $this->myLogger->logme("info", $mail_send_return);
-
- if (isset($wholeData[0])) {
-
- $account_manager_wholeData = sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
-
- // print_r($account_manager_wholeData); die;
-
- if ($account_manager_wholeData) {
-
- foreach ($account_manager_wholeData as $key => $value) {
- $mail_send_return1 = MailHelper::send_email($value);
- $this->myLogger->logme("info", $mail_send_return1);
- $this->myLogger->logme("info", $mail_send_return1);
- }
- }
-
- $client_hr_wholeData = sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
-
- // print_r($client_hr_wholeData); die;
-
- if ($client_hr_wholeData) {
-
- foreach ($client_hr_wholeData as $key => $value) {
- $mail_send_return2 = MailHelper::send_email($value);
- $this->myLogger->logme("info", $mail_send_return2);
- }
+ if (!is_null($client_policy_id) && is_array($client_policy_id))
+ {
+ $array_list = [];
+ foreach ($client_policy_id as $key => $value)
+ {
+ $find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
+ if(count($find) > 0){
+ $array_list[] = $find;
}
}
+
+ // dd($array_list);
+
+ $notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
+
+
+ if (isset($notification) && $notification['enabled'] == 1) {
+
+ $params ['array_list'] = $array_list;
+ $params ['client_policy_id'] = $client_policy_id;
+ $params ['emp_code'] = $emp_code;
+ $params ['client_id'] = $client_id;
+ $params ['notification'] = $notification;
+
+ // dd($params);
+
+ $wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
+ // print_r($wholeData); die;
+
+ if($mail_active > 0){
+ $mail_send_return = MailHelper::send_email($wholeData[0]);
+ $this->myLogger->logme("info", $mail_send_return);
+ }
+
+ if (isset($wholeData[0])) {
+
+ $account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
+ // print_r($account_manager_wholeData); die;
+
+ if($account_manager_wholeData != null && $account_manager_wholeData != '' && count($account_manager_wholeData))
+ {
+ if($mail_active > 0){
+
+ foreach ($account_manager_wholeData as $key => $value) {
+ $mail_send_return1 = MailHelper::send_email($value);
+ $this->myLogger->logme("info", $mail_send_return1);
+ }
+
+ }
+
+ }else{
+ $this->myLogger->logme("error", 'Account Manager Mail Configuration not Enable for this client');
+ }
+
+ $client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
+ // print_r($client_hr_wholeData); die;
+
+ if($client_hr_wholeData != null && $client_hr_wholeData != '' &&count($client_hr_wholeData))
+ {
+ if($mail_active > 0){
+
+ foreach ($client_hr_wholeData as $key => $value) {
+ $mail_send_return2 = MailHelper::send_email($value);
+ $this->myLogger->logme("info", $mail_send_return2);
+ }
+ }
+
+ }else{
+ $this->myLogger->logme("error", 'Client HR Mail Configuration not Enable for this client');
+ }
+ }
+
+ }else{
+ $this->myLogger->logme("error", 'Member Review Mail Configuration not Enable for this client');
+ }
+
}
+
+ print_r($wholeData);
+ echo '';
+ echo 'member_review_and_summary_mail
';
+ print_r($mail_send_return);
+ echo 'account_maneger_summary_mail
';
+ print_r($mail_send_return1);
+ echo 'client_hr_summary_mail
';
+ print_r($mail_send_return2);
- return $this->respond(['status' => 'success', 'code' => 200, 'data' => []], 200);
+ // return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
}
public function index()
diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php
index b598cf95..c8d65de8 100755
--- a/app/Helpers/sendMailNotification.php
+++ b/app/Helpers/sendMailNotification.php
@@ -180,14 +180,6 @@ class sendMailNotification
$client_data =$clientModel->where('id', $client_id)->first();
$notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first();
- $client_policy_data = $clientPolicyModel->where('id', $client_policy_id)->first();
-
- if($client_policy_data['policy_type_id'] == 1 || $client_policy_data['policy_type_id'] == 6 || $client_policy_data['policy_type_id'] == 7 ){
- $policy_premium_data = $PolicyPremium1Model->where('client_policy_id', $client_policy_id)->first();
- }else{
- $policy_premium_data = $PolicyPremium2Model->where('client_policy_id', $client_policy_id)->first();
- }
-
// dd($notification_data);
if (isset($notification_data) && $notification_data['enabled'] == 1) {
@@ -230,10 +222,20 @@ class sendMailNotification
foreach ($item as $inner_item) {
+ //getting policy premium data
+ $client_policy_data = $clientPolicyModel->where('id', $inner_item['client_policy_id'])->first();
+ if($client_policy_data['policy_type_id'] == 1 || $client_policy_data['policy_type_id'] == 6 || $client_policy_data['policy_type_id'] == 7 ){
+ $policy_premium_data = $PolicyPremium1Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
+ }else{
+ $policy_premium_data = $PolicyPremium2Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
+ }
+ //end of getting policy premium data
+
$policy_name = $inner_item['policy_name'];
if ($inner_item['relationship'] == 'Self') {
$emp_code = ' (' . $inner_item['emp_code'] . ')';
+ $mail = $inner_item['email_corporate'];
} else {
$emp_code = '';
}
@@ -385,14 +387,6 @@ class sendMailNotification
$client_data =$clientModel->where('id', $client_id)->first();
$notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first();
- $client_policy_data = $clientPolicyModel->where('id', $client_policy_id)->first();
-
- if($client_policy_data['policy_type_id'] == 1 || $client_policy_data['policy_type_id'] == 6 || $client_policy_data['policy_type_id'] == 7 ){
- $policy_premium_data = $PolicyPremium1Model->where('client_policy_id', $client_policy_id)->first();
- }else{
- $policy_premium_data = $PolicyPremium2Model->where('client_policy_id', $client_policy_id)->first();
- }
-
if (isset($notification_data) && $notification_data['enabled'] == 1) {
$client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll();
@@ -436,6 +430,15 @@ class sendMailNotification
foreach ($item as $inner_item) {
+ //getting policy premium data
+ $client_policy_data = $clientPolicyModel->where('id', $inner_item['client_policy_id'])->first();
+ if($client_policy_data['policy_type_id'] == 1 || $client_policy_data['policy_type_id'] == 6 || $client_policy_data['policy_type_id'] == 7 ){
+ $policy_premium_data = $PolicyPremium1Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
+ }else{
+ $policy_premium_data = $PolicyPremium2Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
+ }
+ //end of getting policy premium data
+
$policy_name = $inner_item['policy_name'];
if ($inner_item['relationship'] == 'Self') {
@@ -588,17 +591,8 @@ class sendMailNotification
$notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first();
$clientRMModel =new ClientRMModel();
-
- $client_policy_data = $clientPolicyModel->where('id', $client_policy_id)->first();
-
- if($client_policy_data['policy_type_id'] == 1 || $client_policy_data['policy_type_id'] == 6 || $client_policy_data['policy_type_id'] == 7 ){
- $policy_premium_data = $PolicyPremium1Model->where('client_policy_id', $client_policy_id)->first();
- }else{
- $policy_premium_data = $PolicyPremium2Model->where('client_policy_id', $client_policy_id)->first();
- }
-
-
if (isset($notification_data['enabled']) && $notification_data['enabled'] == 1) {
+
$client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll();
$user_list= [];
foreach ($client_rm_data as $key => $value) {
@@ -641,6 +635,16 @@ class sendMailNotification
$is_addon = '';
foreach ($item as $inner_item) {
+
+ //getting policy premium data
+ $client_policy_data = $clientPolicyModel->where('id', $inner_item['client_policy_id'])->first();
+ if($client_policy_data['policy_type_id'] == 1 || $client_policy_data['policy_type_id'] == 6 || $client_policy_data['policy_type_id'] == 7 ){
+ $policy_premium_data = $PolicyPremium1Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
+ }else{
+ $policy_premium_data = $PolicyPremium2Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
+ }
+ //end of getting policy premium data
+
$policy_name = $inner_item['policy_name'];
if ($inner_item['relationship'] == 'Self') {
@@ -779,7 +783,7 @@ class sendMailNotification
}
return $wholeData;
- }
+ }
}
}
diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php
index 8d2d529d..543f2863 100644
--- a/app/Views/policy_transaction_endorsement_form.php
+++ b/app/Views/policy_transaction_endorsement_form.php
@@ -361,66 +361,74 @@
Total
-
- Agreed BP %
-
-
- Agreed TP %
-
-
-
- Agreed Amount
-
-
- Standard BP %
-
-
- Standard TP %
-
-
-
- Actual BP Amount
-
-
- Actual TP Amount
-
-
-
- Actual BP %
-
-
- Actual TP %
-
-
-
- Actual BP
Remuneration Amount
-
-
- Actual TP
Remuneration Amount
-
-
-
- Expected Amount
-
-
- Variance
-
-
- Reward
-
+
+
+
+
+ Agreed BP %
+
+
+ Agreed TP %
+
+
+
+ Agreed Amount
+
+
+ Standard BP %
+
+
+ Standard TP %
+
+
+
+ Actual BP Amount
+
+
+ Actual TP Amount
+
+
+
+ Actual BP %
+
+
+ Actual TP %
+
+
+
+ Actual BP
Remuneration Amount
+
+
+ Actual TP
Remuneration Amount
+
+
+
+ Expected Amount
+
+
+ Variance
+
+
+ Reward
+
+
+
+
+
+
@@ -451,9 +459,21 @@