diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 07a7ce3b..62f10af2 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -2217,18 +2217,18 @@ class EmpDataServiceController extends BaseController 'file_id' => $file_id, ]]); - $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ - 'client_policy_id' => $client_policy_id ?? null, - 'endorsement_no' => $endorsement_id ?? null, - 'emp_count' => $emp_count ?? null, - 'action_type' => $file['event_type'] ?? null, - 'no_of_insured' => count($no_of_insured ?? []) ?? null, - 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, - 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, - 'gst' => $base_bremium_and_gst['gst'] ?? null, - 'policy_issue_date' => $policy_issue_date ?? null, - 'created_by' => $file['created_by'] ?? null, - ]]); + // $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ + // 'client_policy_id' => $client_policy_id ?? null, + // 'endorsement_no' => $endorsement_id ?? null, + // 'emp_count' => $emp_count ?? null, + // 'action_type' => $file['event_type'] ?? null, + // 'no_of_insured' => count($no_of_insured ?? []) ?? null, + // 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, + // 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, + // 'gst' => $base_bremium_and_gst['gst'] ?? null, + // 'policy_issue_date' => $policy_issue_date ?? null, + // 'created_by' => $file['created_by'] ?? null, + // ]]); // $this->cashDepositCalculationForInception($depositeData); // $this->sendMailForDownloadingECard($emp_policy_ids); @@ -2666,14 +2666,14 @@ class EmpDataServiceController extends BaseController $file_data = $this->getDataByFileId($file_id, 'success'); $this->setPullNotification($file_data); - $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ - 'client_policy_id' => $client_policy_id ?? null, - 'endorsement_no' => $endorsement_id[0] ?? null, - 'emp_count' => $emp_count ?? null, - 'action_type' => $file['event_type'] ?? null, - 'policy_issue_date' => $policy_issue_date ?? null, - 'created_by' => $file['created_by'] ?? null, - ]]); + // $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ + // 'client_policy_id' => $client_policy_id ?? null, + // 'endorsement_no' => $endorsement_id[0] ?? null, + // 'emp_count' => $emp_count ?? null, + // 'action_type' => $file['event_type'] ?? null, + // 'policy_issue_date' => $policy_issue_date ?? null, + // 'created_by' => $file['created_by'] ?? null, + // ]]); //import file to upload Google Drive @@ -3401,18 +3401,18 @@ class EmpDataServiceController extends BaseController 'file_id' => $file_id, ]]); - $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ - 'client_policy_id' => $client_policy_id ?? null, - 'endorsement_no' => $endorsement_id ?? null, - 'emp_count' => $emp_count ?? null, - 'action_type' => $file['event_type'] ?? null, - 'no_of_insured' => count($no_of_insured ?? []) ?? null, - 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, - 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, - 'gst' => $base_bremium_and_gst['gst'] ?? null, - 'policy_issue_date' => $policy_issue_date ?? null, - 'created_by' => $file['created_by'] ?? null, - ]]); + // $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ + // 'client_policy_id' => $client_policy_id ?? null, + // 'endorsement_no' => $endorsement_id ?? null, + // 'emp_count' => $emp_count ?? null, + // 'action_type' => $file['event_type'] ?? null, + // 'no_of_insured' => count($no_of_insured ?? []) ?? null, + // 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, + // 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, + // 'gst' => $base_bremium_and_gst['gst'] ?? null, + // 'policy_issue_date' => $policy_issue_date ?? null, + // 'created_by' => $file['created_by'] ?? null, + // ]]); } @@ -3920,18 +3920,18 @@ class EmpDataServiceController extends BaseController 'file_id' => $file_id, ]]); - $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ - 'client_policy_id' => $client_policy_id ?? null, - 'endorsement_no' => $endorsement_id ?? null, - 'emp_count' => $emp_count ?? null, - 'action_type' => $file['event_type'] ?? null, - 'no_of_insured' => count($no_of_insured ?? []) ?? null, - 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, - 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, - 'gst' => $base_bremium_and_gst['gst'] ?? null, - 'policy_issue_date' => $policy_issue_date ?? null, - 'created_by' => $file['created_by'] ?? null, - ]]); + // $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ + // 'client_policy_id' => $client_policy_id ?? null, + // 'endorsement_no' => $endorsement_id ?? null, + // 'emp_count' => $emp_count ?? null, + // 'action_type' => $file['event_type'] ?? null, + // 'no_of_insured' => count($no_of_insured ?? []) ?? null, + // 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, + // 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, + // 'gst' => $base_bremium_and_gst['gst'] ?? null, + // 'policy_issue_date' => $policy_issue_date ?? null, + // 'created_by' => $file['created_by'] ?? null, + // ]]); } $file_data = $this->getDataByFileId($file_id, 'success'); diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index ecfd8047..d6cd0df5 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -3811,8 +3811,8 @@ class LeadsController extends BaseController if (! empty($installment_data)) { foreach ($installment_data as $key => $value) { // print_r($value);die - $value['payment_date'] = ! empty($value['payment_date']) && strtotime($value['payment_date']) - ? date('Y/m/d', strtotime($value['payment_date'])) + $value['payment_date'] = ! empty($value['payment_date']) + ? change_date_format($value['payment_date']) : null; if (isset($value['id']) && ! empty($value['id'])) { $this->leadInstallmentPaymentDetails->where('id', $value['id'])->set($value)->update(); @@ -8272,8 +8272,8 @@ class LeadsController extends BaseController if (is_array($installments) && ! empty($installments)) { foreach ($installments as $installment) { - $installment['payment_date'] = ! empty($installment['payment_date']) && strtotime($installment['payment_date']) - ? date('Y-m-d', strtotime($installment['payment_date'])) + $installment['payment_date'] = ! empty($installment['payment_date']) + ? change_date_format($installment['payment_date']) : null; $installment['lead_id'] = $lead_id; @@ -8394,8 +8394,8 @@ class LeadsController extends BaseController if (is_array($installments) && ! empty($installments)) { foreach ($installments as $installment) { - $installment['payment_date'] = ! empty($installment['payment_date']) && strtotime($installment['payment_date']) - ? date('Y-m-d', strtotime($installment['payment_date'])) + $installment['payment_date'] = ! empty($installment['payment_date']) + ? change_date_format($installment['payment_date']) : null; $installment['lead_id'] = $lead_id; diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index e76d4206..a381b23f 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -5370,7 +5370,7 @@ class PolicyTransactionController extends BaseController } $this->myLogger->logme("error", "Data for BDS Installment " . json_encode($bdsInstallmentData)); - // print_r($bdsInstallmentData);die(); + // print_rr($bdsInstallmentData);die(); if (empty($bdsInstallmentData)) { $this->myLogger->logme("error", "No Client Installment is Due in the 5th Day"); @@ -5395,8 +5395,10 @@ class PolicyTransactionController extends BaseController $this->myLogger->logme('error', 'res: ' . json_encode($res)); if ($res->status == 'success') { + CLI::write("Mail sent successfully to " . count($to_mail) . " recipients"); return ['status' => true, 'message' => 'Mail sent successfully', 'response' => $res]; } else { + CLI::write("Mail sent failed to " . count($to_mail) . " recipients"); return ['status' => false, 'message' => 'Mail sent failed', 'response' => $res]; } } diff --git a/app/Models/BdsPlacementModel.php b/app/Models/BdsPlacementModel.php index 84b349a1..341e16a2 100644 --- a/app/Models/BdsPlacementModel.php +++ b/app/Models/BdsPlacementModel.php @@ -135,6 +135,7 @@ class BdsPlacementModel extends Model { /** @var BdsConfig $config */ $config = config(BdsConfig::class); + // print_r($config);die(); if (!$config->shouldFetchInstallmentRemindersToday()) { return []; @@ -161,9 +162,10 @@ class BdsPlacementModel extends Model ->join("client_branch cb", "cb.id = leads.client_branch_id", "left") ->join("client_policy cp", "cp.id = leads.source_policy_id", "left") ->where("lipd.is_active", 1) - ->where("lipd.utr_no IS NULL"); + ->where("lipd.utr_no IS NULL OR lipd.utr_no = ''"); $targetPaymentDate = $this->addBusinessDays($config->installmentReminderBusinessDays); + // print_r($targetPaymentDate);die(); if ($config->installmentReminderFetchOverduePendingUtr) { $builder->groupStart() @@ -176,6 +178,8 @@ class BdsPlacementModel extends Model $data = $builder->get()->getResultArray(); + // print_r($this->db->getLastQuery()->getQuery());die(); + foreach ($data as &$row) { $sales_person_ids = json_decode($row['salse_person_id'], true); $sales_person_id = $sales_person_ids[0] ?? null;