scheme members list with overll,renew,and not renewed : ps

This commit is contained in:
VE10-Sanjeev 2024-01-04 19:47:45 +05:30
parent 96cea2ac3d
commit ae98fd368c
2 changed files with 164 additions and 105 deletions

View File

@ -61,6 +61,7 @@ class HomeModel extends Model
{
$query = $this->db->table('subscription AS S')
->select('S.business_id,BK.title as name,BK.book_id as id,S.scheme_id,LEFT(BK.title, 1) AS first_letter,COUNT(S.customer_id) AS count,BI.wp_img_url')
->select('COUNT(S.customer_id) AS overall,COUNT(IF(S.isactive = 0, S.customer_id, NULL)) AS nonrenewal,COUNT(IF(S.isactive = 1, S.customer_id, NULL)) AS renewal')
->join('customers AS C', 'C.customer_id = S.customer_id AND C.isactive = 1', 'left')
->join('books AS BK', 'BK.book_id = S.scheme_id', 'left')
->join('book_categories AS BC', 'BC.book_id = S.scheme_id AND BC.isactive = 1', 'left')

View File

@ -48,19 +48,19 @@
<div class="col-xl-3 col-lg-4">
<div class="card">
<div class="card-body">
<div style="min-height: 200px !important">
<div class="text-primary float-right">
<span data-toggle="tooltip" data-placement="bottom" data-original-title="Current Financial Year"> <?= $invoice['financial_year']; ?></span>
</div>
<div style="padding: 80px 0;">
<h3 class="text-center">Today : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Today Invoice Raised" data-plugin="counterup"><?= $invoice['today']; ?></span>
</h3>
</div>
<div class="text-success">
<span> MTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Monthly Invoice Raised" data-plugin="counterup"><?= $invoice['month']; ?></span></span>
<span class="float-right" > YTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Yearly Invoice Raised" data-plugin="counterup"><?= $invoice['year']; ?></span></span>
</div>
</div><!-- end min-height-->
<div style="min-height: 200px !important">
<div class="text-primary float-right">
<span data-toggle="tooltip" data-placement="bottom" data-original-title="Current Financial Year"> <?= $invoice['financial_year']; ?></span>
</div>
<div style="padding: 80px 0;">
<h3 class="text-center">Today : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Today Invoice Raised" data-plugin="counterup"><?= $invoice['today']; ?></span>
</h3>
</div>
<div class="text-success">
<span> MTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Monthly Invoice Raised" data-plugin="counterup"><?= $invoice['month']; ?></span></span>
<span class="float-right"> YTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Yearly Invoice Raised" data-plugin="counterup"><?= $invoice['year']; ?></span></span>
</div>
</div><!-- end min-height-->
</div> <!-- end card-body-->
</div><!--end card-->
</div> <!-- end col -->
@ -70,27 +70,26 @@
<div class="card-body">
<h4 class="header-title mb-2">Schemes</h4>
<div class="conversation-list" data-simplebar style="max-height: 200px !important"> <!-- default 460px -->
<?php foreach ($active_schemes as $i => $a) : ?>
<div class="media">
<?php if (!empty($a['wp_img_url'])) { ?>
<img src="<?= $a['wp_img_url']; ?>" alt="table-user"
class="mr-3 rounded avatar-md">
<?php } else { ?>
<div class="avatar-md mr-3">
<div class="avatar-title bg-light rounded text-body font-20 font-weight-semibold">
<?= $a['first_letter']; ?>
<?php foreach ($active_schemes as $i => $a) : ?>
<div class="media">
<?php if (!empty($a['wp_img_url'])) { ?>
<img src="<?= $a['wp_img_url']; ?>" alt="table-user" class="mr-3 rounded avatar-md">
<?php } else { ?>
<div class="avatar-md mr-3">
<div class="avatar-title bg-light rounded text-body font-20 font-weight-semibold">
<?= $a['first_letter']; ?>
</div>
</div>
<?php } ?>
<div class="media-body">
<h5 class="my-1"><?= $a['name']; ?></h5>
<p class="text-muted mb-0">
<span class="badge badge-soft-success"><i class="mdi mdi-account mr-1"></i> <span data-plugin="counterup"><?= $a['count']; ?></span> Subscribers </span>
</p>
</div>
</div>
<?php } ?>
<div class="media-body">
<h5 class="my-1"><?= $a['name']; ?></h5>
<p class="text-muted mb-0">
<span class="badge badge-soft-success"><i class="mdi mdi-account mr-1"></i> <span data-plugin="counterup"><?= $a['count']; ?></span> Subscribers </span>
</p>
</div>
</div>
<hr>
<?php endforeach; ?>
<hr>
<?php endforeach; ?>
<!-- <div class="media">
<div class="avatar-md mr-3">
<div class="avatar-title bg-light rounded text-body font-20 font-weight-semibold">
@ -105,7 +104,7 @@
</div>
</div>
<hr> -->
<!-- <div class="media">
<div class="mr-3">
<img src="<?= base_url() . "public/assets/images/users/avatar-1.jpg" ?>" alt="user-image" class="rounded avatar-md">
@ -123,45 +122,103 @@
</div><!--end card-->
</div><!-- end col -->
</div>
<?php
$class = ['card bg-info border-info', 'card bg-success border-success', 'card bg-warning border-warning', 'card bg-pink border-pink'];
foreach ($active_schemes as $i => $a) :
$color = $class[$i % 4];
?>
<div class="<?= $color; ?>">
<div class="card-body">
<div class="row">
<div class="col-md-4" style="margin-left: 58px;">
<div class="row align-items-center text-center">
<!-- <div class="col-6 ">
<h1 class="display-1"><i class="fe-layers text-white"></i></h1>
wi wi-barometer
</div> -->
<!-- <div class="col-6">
<div class="text-white">
<p><?= $a['name']; ?></p>
</div>
</div> -->
<div class="text-white">
<h3 class="my-3"><i class="fe-layers text-white"></i></h3>
<p><?= $a['name']; ?></p>
</div>
</div><!-- End row -->
</div>
<div class="col-md-6">
<div class="row">
<div class="col-4 text-center">
<h4 class="text-white mt-0">Members - OverAll </h4>
<h3 class="my-3"><i class="fe-user-check text-white"></i></h3>
<!-- fe-layers -->
<h4 class="text-white mb-0"><?= $a['overall']; ?></h4>
</div>
<div class="col-4 text-center">
<h4 class="text-white mt-0">Members - Renewal </h4>
<h3 class="my-3"><i class="fe-user-plus text-white"></i></h3>
<!-- fe-check -->
<h4 class="text-white mb-0"><?= $a['renewal']; ?></h4>
</div>
<div class="col-4 text-center">
<h4 class="text-white mt-0">Members - NonRenewal </h4>
<h3 class="my-3"><i class="fe-user-minus text-white"></i></h3>
<!-- fe-x -->
<h4 class="text-white mb-0"><?= $a['nonrenewal']; ?></h4>
</div>
</div><!-- end row -->
</div>
</div><!-- end row -->
</div>
</div><!-- cardbox -->
<?php endforeach; ?>
<!-- END Weather WIDGET 1 -->
<div class="row">
<div class="col-xl-4 col-lg-6">
<div class="card">
<div class="card-body">
<h4 class="header-title mt-1">Expiring Membership List</h4>
<div class="conversation-list" data-simplebar style="max-height: 255px !important">
<div class="table-responsive">
<table class="table table-sm table-centered mb-0 font-14">
<thead class="thead-light">
<tr>
<th style="width: 5%;">#</th>
<th style="width: 20%;">Name</th>
<th style="width: 50%;">Scheme Name</th>
<th style="width: 25%;">Expiring In</th>
</tr>
</thead>
<tbody>
<?php
// print "<pre>";
// print_r($expiring_membership);
// print "</pre>";
$tempinx = 0;
foreach ($expiring_membership as $e) :
$daysincount = (int)$e['countdays'] ;
$daysincountstring = ($daysincount == 0 ? 'Today' : ($daysincount == 1 ? 'Tomorrow' : $daysincount.' days'));
<h4 class="header-title mt-1">Expiring Membership List</h4>
<div class="conversation-list" data-simplebar style="max-height: 255px !important">
<div class="table-responsive">
<table class="table table-sm table-centered mb-0 font-14">
<thead class="thead-light">
<tr>
<th style="width: 5%;">#</th>
<th style="width: 20%;">Name</th>
<th style="width: 50%;">Scheme Name</th>
<th style="width: 25%;">Expiring In</th>
</tr>
</thead>
<tbody>
<?php
// print "<pre>";
// print_r($expiring_membership);
// print "</pre>";
$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><?= ++$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"><?= $daysincountstring; ?></span> <span class="font-13"><br><?= $e['to_subscription_date_format']; ?></span></td>
</tr>
<?php endforeach; ?>
<!-- <tr>
<tr>
<!-- <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"><?= $daysincountstring; ?></span> <span class="font-13"><br><?= $e['to_subscription_date_format']; ?></span></td>
</tr>
<?php endforeach; ?>
<!-- <tr>
<td>
<h5 class="mt-0 mb-1">Sangavi</h5>
<span class="font-13">9092279559</span>
@ -177,10 +234,10 @@
<td>Samarth Scheme (5years)</td>
<td><span class="badge badge-success badge-pill">5 days</span></td>
</tr> -->
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
@ -188,7 +245,7 @@
<div class="col-xl-4 col-lg-6">
<div class="card">
<div class="card-body">
<h4 class="header-title mt-1">Books Published Report</h4>
<h4 class="header-title mt-1">Books Published Report</h4>
<div class="text-center">
<div class="row pt-2">
<div class="col-4">
@ -208,7 +265,7 @@
<hr>
<div dir="ltr">
<h4 class="header-title text-muted mt-1"><span data-toggle="tooltip" data-placement="bottom" data-original-title="<?= $book_published['book_published_label']; ?>">Last One Month</span></h4>
<div class="row pt-2 conversation-list" data-simplebar style="max-height: 255px !important">
<div class="row pt-2 conversation-list" data-simplebar style="max-height: 255px !important">
<div class="table-responsive">
<table class="table table-sm table-centered mb-0 font-14">
<thead class="thead-light">
@ -218,39 +275,40 @@
</tr>
</thead>
<tbody>
<?php if (count($book_published['book_published']) > 0) : foreach ($book_published['book_published'] as $b) :?>
<tr>
<td><?= $b['title']; ?>
<?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>
<?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>
<?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'];
$splitted = explode(', ', $b['categories']);
if(!empty($splitted)){
// print_r($splitted);
for ($i = 0; $i < count($splitted); $i++) {
if($splitted[$i] !== ''){ ?>
<span class="badge badge-success badge-pill mr-1"><?= str_replace(',', '', $splitted[$i]); ?></span>
<?php }
}
} ?>
</td>
</tr>
<?php endforeach;endif; ?>
<?php if (count($book_published['book_published']) > 0) : foreach ($book_published['book_published'] as $b) : ?>
<tr>
<td><?= $b['title']; ?>
<?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>
<?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>
<?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'];
$splitted = explode(', ', $b['categories']);
if (!empty($splitted)) {
// print_r($splitted);
for ($i = 0; $i < count($splitted); $i++) {
if ($splitted[$i] !== '') { ?>
<span class="badge badge-success badge-pill mr-1"><?= str_replace(',', '', $splitted[$i]); ?></span>
<?php }
}
} ?>
</td>
</tr>
<?php endforeach;
endif; ?>
<!-- <tr>
<td>First std English
<p class="text-muted mb-0">