Fixes : ps

This commit is contained in:
VE10-Sanjeev 2023-12-02 13:06:04 +05:30
parent 52e744b5bc
commit dbc9e7a397
4 changed files with 26 additions and 9 deletions

View File

@ -99,6 +99,7 @@ class Customer extends BaseController
'mobile_no' => $this->request->getPost('cmobile'),
'email' => $this->request->getPost('cmail'),
'date_of_birth' => $dob,
'type' => "customer",
'mode' => "Offline",
'business_id' => $this->request->getPost('business_id')
];
@ -354,6 +355,7 @@ class Customer extends BaseController
$result = $model->where($where)->findAll();
$db = \Config\Database::connect();
$sql = (string)$result[0]['group_query'];
// print_r($sql);die;
if($sql){
$query = $db->query($sql);
$results = $query->getResultArray();
@ -490,7 +492,8 @@ class Customer extends BaseController
LEFT JOIN invoice I on I.customer_id = C.customer_id and I.isactive = 1
LEFT JOIN customer_addresses CA on CA.customer_id = C.customer_id and CA.address_type = 1 and CA.isactive = 1
LEFT JOIN subscription S on S.customer_id = C.customer_id
LEFT JOIN category CM on CM.id = S.scheme_id
LEFT JOIN book_categories BC on BC.book_id = S.scheme_id
LEFT JOIN category CM on CM.id = BC.category_id
WHERE C.isactive = 1 AND ".$whereCondition." GROUP BY C.customer_id";
$this->logger->info("Customer Group: SQL = ".$sql);
// Execute the query

View File

@ -71,11 +71,12 @@ public function add_subscription() {
$SubscriptionModel = new SubscriptionModel();
$data = [
'scheme_id' =>$this->request->getPost('scheme'),
'customer_id' =>$this->request->getPost('customer'),
'from_subscription' => $this->request->getPost('from_date'),
'to_subscription' => $this->request->getPost('to_date'),
// 'type' => "subscribed customer",
'type' => "customer",
'mode' => $this->request->getPost('mode'),
'business_id'=>$session_bid
];

View File

@ -65,11 +65,12 @@ class HomeModel extends Model
->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(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.book_id,DATEDIFF(S.to_subscription, CURDATE()) as countdays')
->select('CM.name, CONCAT(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.book_id,DATEDIFF(S.to_subscription, CURDATE()) as countdays,DATE_FORMAT(S.to_subscription, "%d-%m-%Y") as to_subscription_date_format')
->where('S.to_subscription >=', $now)
->where('S.to_subscription <=', $last30days)
// ->where('BC.category_id', 5)
->where('LOWER(CM.name)', strtolower("Membership"))
->orderBy('S.to_subscription', 'ASC')
->groupBy('S.sub_id')
->get()
->getResultArray();
@ -86,6 +87,7 @@ class HomeModel extends Model
->where('B.created_on >=', $oneMonthAgo)
->where('B.created_on <=', $now)
->where('B.isactive', 1)
->orderBy('B.publication_date', 'DESC')
->groupBy('B.book_id')
->get()
->getResultArray();

View File

@ -222,15 +222,20 @@
// print "<pre>";
// print_r($expiring_membership);
// print "</pre>";
foreach ($expiring_membership as $e) : ?>
$tempinx = 0;
foreach ($expiring_membership as $e) :
$daysincount = (int)$e['countdays'] ;
$daysincountstring = ($daysincount == 0 ? 'Today' : ($daysincount == 1 ? 'Tomorrow' : $daysincount.' days'));
?>
<tr>
<td><?= $e['sub_id']; ?></td>
<!-- <td><?= $e['sub_id']; ?></td> -->
<td><?= ++$tempinx; ?></td>
<td>
<h5 class="mt-0 mb-1"><?= $e['customer_name']; ?></h5>
<span class="font-13"><?= $e['customer_mobile']; ?></span>
</td>
<td><?= $e['title']; ?></td>
<td><span class="badge badge-success badge-pill"><span data-plugin="counterup"><?= $e['countdays']; ?></span> days</span></td>
<td><span class="badge badge-success badge-pill"><?= $daysincountstring; ?></span> <span class="font-13"><br><?= $e['to_subscription_date_format']; ?></span></td>
</tr>
<?php endforeach; ?>
<!-- <tr>
@ -274,15 +279,21 @@
<?php foreach ($book_published as $b) :?>
<tr>
<td><?= $b['title']; ?>
<p class="text-muted mb-0">
<?php if (!empty($b['author'])) { ?>
<p class="text-muted mb-0" title="Author : <?= $b['author']; ?>">
<i class="mdi mdi-account mr-1"></i><?= $b['author']; ?>
</p>
<p class="text-muted mb-0">
<?php } ?>
<?php if (!empty($b['publisher'])) { ?>
<p class="text-muted mb-0" title="Publisher : <?= $b['publisher']; ?>">
<i class="mdi mdi-book-open-variant mr-1"></i><?= $b['publisher']; ?>
</p>
<p class="text-muted mb-0">
<?php } ?>
<?php if (!empty($b['publication_date_format'])) { ?>
<p class="text-muted mb-0" title="Publication Date : <?= $b['publication_date_format']; ?>">
<i class="mdi mdi-update mr-1"></i><?= $b['publication_date_format']; ?>
</p>
<?php } ?>
</td>
<td>
<?php // echo $b['categories'];