Merge branch 'uat' BUG ISSUES RESOLVED
This commit is contained in:
commit
f5e64ad791
@ -27,7 +27,7 @@ class Home extends BaseController
|
|||||||
$data['invoice'] = $model->invoice_dtls();
|
$data['invoice'] = $model->invoice_dtls();
|
||||||
// $data['active_category'] = $model->schemes();
|
// $data['active_category'] = $model->schemes();
|
||||||
$data['active_schemes'] = $model->active_schemes();
|
$data['active_schemes'] = $model->active_schemes();
|
||||||
$data['expiring_membership'] = $model->expiring_membership_list();
|
$data['expiring_membership'] = $model->expiring_membership_with_notification_list();
|
||||||
$data['notifications'] = $model->expiring_membership_list();
|
$data['notifications'] = $model->expiring_membership_list();
|
||||||
// print_r( $data['expiring_membership']);die;
|
// print_r( $data['expiring_membership']);die;
|
||||||
// $data['active_category'] = array_filter($model->schemes(), function ($element) {
|
// $data['active_category'] = array_filter($model->schemes(), function ($element) {
|
||||||
|
|||||||
@ -598,12 +598,12 @@ class Notifications extends BaseController
|
|||||||
$notification = new NotificationHelper();
|
$notification = new NotificationHelper();
|
||||||
if (empty($queryResult)) {
|
if (empty($queryResult)) {
|
||||||
$this->logger->error("There is no customer expiring on date:{$newDate}");
|
$this->logger->error("There is no customer expiring on date:{$newDate}");
|
||||||
|
echo " There is no customer expiring. till dated :{$newDate}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
||||||
echo "Started.<br> Dated = ".$newDate." <br> There are ".count($queryResult)." persons <br>";
|
echo "Started.<br> Customer expiring. till dated = ".$newDate." <br> There are ".count($queryResult)." persons <br>";
|
||||||
//print_r($queryResult);die();
|
|
||||||
foreach ($queryResult as $inx => $row) {
|
foreach ($queryResult as $inx => $row) {
|
||||||
$status = $row['status'];
|
$status = $row['status'];
|
||||||
$userFirstName = $row['first_name'];
|
$userFirstName = $row['first_name'];
|
||||||
@ -621,7 +621,7 @@ class Notifications extends BaseController
|
|||||||
if ($status === 'Approved') {
|
if ($status === 'Approved') {
|
||||||
# EXPIRAY_NOTIFY_TEMPLATE_EMAIL
|
# EXPIRAY_NOTIFY_TEMPLATE_EMAIL
|
||||||
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
||||||
echo "Person Name :".$fullName." <br>";
|
echo "#".$customerId." - Person Name :".$fullName." <br>";
|
||||||
if (count($emailTemplateName) && !empty($emailTemplateName)) {
|
if (count($emailTemplateName) && !empty($emailTemplateName)) {
|
||||||
$campaign_id = 1;
|
$campaign_id = 1;
|
||||||
# Insertion on History Email Means Campaign ID 1 Hardcoded
|
# Insertion on History Email Means Campaign ID 1 Hardcoded
|
||||||
@ -637,7 +637,7 @@ class Notifications extends BaseController
|
|||||||
$emailContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
|
$emailContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
|
||||||
}
|
}
|
||||||
if (isset($expirydate)) {
|
if (isset($expirydate)) {
|
||||||
$expiryon = $expirydate ? date('d-m-Y', strtotime($expirydate)) : '';
|
$expiryon = $expirydate ? date('d-m-Y', strtotime($expirydate)) : '';
|
||||||
$emailContent = str_replace("{EXPIRY_DATE}", $expiryon, $emailContent);
|
$emailContent = str_replace("{EXPIRY_DATE}", $expiryon, $emailContent);
|
||||||
}
|
}
|
||||||
if (isset($membership_id)) {
|
if (isset($membership_id)) {
|
||||||
@ -735,7 +735,7 @@ class Notifications extends BaseController
|
|||||||
$whatsappContent = str_replace("{SCHEME_NAME}", $schemename, $whatsappContent);
|
$whatsappContent = str_replace("{SCHEME_NAME}", $schemename, $whatsappContent);
|
||||||
}
|
}
|
||||||
if (isset($expirydate)) {
|
if (isset($expirydate)) {
|
||||||
$expiryon = $expirydate ? date('d-m-Y', strtotime($expirydate)) : '';
|
$expiryon = $expirydate ? date('d-m-Y', strtotime($expirydate)) : '';
|
||||||
$whatsappContent = str_replace("{EXPIRY_DATE}", $expiryon, $whatsappContent);
|
$whatsappContent = str_replace("{EXPIRY_DATE}", $expiryon, $whatsappContent);
|
||||||
}
|
}
|
||||||
if (isset($customerId)) {
|
if (isset($customerId)) {
|
||||||
|
|||||||
@ -175,6 +175,48 @@ class HomeModel extends Model
|
|||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function expiring_membership_with_notification_list() {
|
||||||
|
$now = date('Y-m-d');
|
||||||
|
$last30days = date('Y-m-d', strtotime('+30 days'));
|
||||||
|
|
||||||
|
$membershipList = $this->db->table('subscription as S')
|
||||||
|
->join('customers as C', 'C.customer_id = S.customer_id', 'left')
|
||||||
|
->join('books as BK', 'BK.book_id = S.scheme_id', 'left')
|
||||||
|
->join('book_categories as BC', 'BC.book_id = S.scheme_id', 'left')
|
||||||
|
->join('category as CM', 'CM.id = BC.category_id', 'left')
|
||||||
|
->select('CM.name, CONCAT_WS(" ", C.first_name, C.last_name) as customer_name,
|
||||||
|
C.email as customer_email, C.mobile_no as customer_mobile,
|
||||||
|
S.sub_id, S.scheme_id, S.customer_id, S.business_id,
|
||||||
|
S.to_subscription, S.from_subscription, BK.title, BK.short_code, BK.book_id,
|
||||||
|
DATEDIFF(S.to_subscription, CURDATE()) as countdays,
|
||||||
|
DATE_FORMAT(S.to_subscription, "%d/%m/%Y") as to_subscription_date_format,
|
||||||
|
(
|
||||||
|
SELECT MAX(NHP.start_date_time)
|
||||||
|
FROM notification_campaign as NC
|
||||||
|
LEFT JOIN notification_history_parents as NHP ON NHP.campaign_id = NC.campaign_id
|
||||||
|
LEFT JOIN notification_history_children as NHC ON NHC.fkid = NHP.id
|
||||||
|
WHERE NHC.customer_id = C.customer_id AND NHC.receiving_entity LIKE "%@%" AND NHC.receiving_status = 1
|
||||||
|
) as email_last_notify_on,
|
||||||
|
(
|
||||||
|
SELECT MAX(NHP.start_date_time)
|
||||||
|
FROM notification_campaign as NC
|
||||||
|
LEFT JOIN notification_history_parents as NHP ON NHP.campaign_id = NC.campaign_id
|
||||||
|
LEFT JOIN notification_history_children as NHC ON NHC.fkid = NHP.id
|
||||||
|
WHERE NHC.customer_id = S.customer_id AND NHC.receiving_entity NOT LIKE "%@%" AND NHC.receiving_status = 1
|
||||||
|
AND NHC.receiving_status REGEXP "^[0-9]+$"
|
||||||
|
) as whatsapp_last_notify_on')
|
||||||
|
->where('S.to_subscription >=', $now)
|
||||||
|
->where('S.to_subscription <=', $last30days)
|
||||||
|
->where('S.isactive', 1)
|
||||||
|
->where('LOWER(CM.name)', strtolower("Membership"))
|
||||||
|
->orderBy('S.to_subscription', 'ASC')
|
||||||
|
->groupBy('S.sub_id')
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
return $membershipList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function book_published_dtls(){
|
public function book_published_dtls(){
|
||||||
|
|
||||||
|
|||||||
@ -133,78 +133,52 @@
|
|||||||
<h4 class="header-title mt-1">Expiring Membership List in next 30 days</h4>
|
<h4 class="header-title mt-1">Expiring Membership List in next 30 days</h4>
|
||||||
<div class="conversation-list" data-simplebar style="max-height: 255px !important">
|
<div class="conversation-list" data-simplebar style="max-height: 255px !important">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-sm table-centered mb-0 font-14">
|
<table class="table table-sm table-centered mb-0 font-14">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 5%;">#</th>
|
<th style="width: 5%;">#</th>
|
||||||
<th style="width: 20%;">Name</th>
|
<th style="width: 20%;">Name</th>
|
||||||
<th style="width: 20%;">Mobile No</th>
|
<th style="width: 20%;">Mobile No</th>
|
||||||
<th style="width: 20%;">Email</th>
|
<th style="width: 20%;">Email</th>
|
||||||
<th style="width: 50%;">Scheme Name</th>
|
<th style="width: 50%;">Scheme Name</th>
|
||||||
<th style="width: 25%;">Expiring In</th>
|
<th style="width: 25%;">Expiring In</th>
|
||||||
<th style="width: 25%;">Notification On</th>
|
<th style="width: 25%;">Notification On</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $tempinx = 0;
|
<?php
|
||||||
// echo "<pre>";
|
$tempinx = 0;
|
||||||
// print_r($expiring_membership);
|
if(!empty($expiring_membership)):
|
||||||
// echo "</pre>";
|
foreach ($expiring_membership as $e) :
|
||||||
if(!empty($expiring_membership)):
|
$daysincount = (int)$e['countdays'];
|
||||||
foreach ($expiring_membership as $e) :
|
$daysincountstring = ($daysincount == 0 ? 'Today' : ($daysincount == 1 ? 'Tomorrow' : $daysincount . ' days')); ?>
|
||||||
$daysincount = (int)$e['countdays'];
|
<tr>
|
||||||
$daysincountstring = ($daysincount == 0 ? 'Today' : ($daysincount == 1 ? 'Tomorrow' : $daysincount . ' days'));
|
<td><?= ++$tempinx; ?></td>
|
||||||
?>
|
<td><h5 class="mt-0 mb-1"><?= $e['customer_name']; ?></h5></td>
|
||||||
<tr>
|
<td><?= $e['customer_mobile'];?></td>
|
||||||
<!-- <td><?= $e['sub_id']; ?></td> -->
|
<td><?= $e['customer_email'];?></td>
|
||||||
<td><?= ++$tempinx; ?></td>
|
<td><?= $e['short_code']; ?></td>
|
||||||
<td><h5 class="mt-0 mb-1"><?= $e['customer_name']; ?></h5></td>
|
<td>
|
||||||
<td><?= $e['customer_mobile'];?></td>
|
<span class="badge badge-success badge-pill"><?= $daysincountstring; ?></span>
|
||||||
<td><?= $e['customer_email'];?></td>
|
<span class="font-13"><br><?= $e['to_subscription_date_format']; ?></span>
|
||||||
<td><?= $e['short_code']; ?></td>
|
</td>
|
||||||
<td><span class="badge badge-success badge-pill"><?= $daysincountstring; ?></span> <span class="font-13"><br><?= $e['to_subscription_date_format']; ?></span></td>
|
<td>
|
||||||
<td>
|
<?php
|
||||||
<?php
|
echo !empty($e['email_last_notify_on'])
|
||||||
$startDate = date('d/m/Y', strtotime($e['from_subscription']));
|
? date('d-m-Y h:i A', strtotime($e['email_last_notify_on']))
|
||||||
$endDate = date('d/m/Y', strtotime($e['to_subscription']));
|
: '';
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach;
|
||||||
|
else : ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="7"><center>No data found</center></td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
$notifications = $e['notifications'];
|
|
||||||
$emailNotifications = array_filter($notifications, function($notification) {
|
|
||||||
return $notification['mode'] === 'Email';
|
|
||||||
});
|
|
||||||
|
|
||||||
$lastNotification = end($emailNotifications);
|
|
||||||
$lastStartDateTime = ($lastNotification && isset($lastNotification['start_date_time'])) ? $lastNotification['start_date_time'] : '';
|
|
||||||
|
|
||||||
$startDateTime = $lastStartDateTime ? date('d/m/Y', strtotime($lastStartDateTime)) : '';
|
|
||||||
$startDate = DateTime::createFromFormat('d/m/Y', $startDate); // Assuming format 'd/m/Y'
|
|
||||||
$endDate = DateTime::createFromFormat('d/m/Y', $endDate); // Assuming format 'd/m/Y'
|
|
||||||
$startDateTime = DateTime::createFromFormat('d/m/Y', $startDateTime);
|
|
||||||
if(isset($lastNotification['receiving_status'])){
|
|
||||||
//log_message('info','start date - '.$startDate.'end date - '.$endDate.'notification date - '.$startDateTime);
|
|
||||||
if ($startDateTime >= $startDate && $startDateTime <= $endDate) {
|
|
||||||
echo $startDateTime->format('d/m/Y');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
<script>
|
|
||||||
var lastNotification = <?= empty($lastNotification) ? '' : json_encode($lastNotification) ?>;
|
|
||||||
console.log(lastNotification);
|
|
||||||
</script>
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; else : ?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="7"><center>No data found</center></td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div> <!-- end table-responsive-->
|
</div> <!-- end table-responsive-->
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- end card-body-->
|
</div> <!-- end card-body-->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user