Raised issues fixes : ps

This commit is contained in:
VE10-Sanjeev 2023-12-27 13:20:01 +05:30
parent 482bbf1576
commit 732a76631c
5 changed files with 144 additions and 92 deletions

View File

@ -24,14 +24,15 @@ class Home extends BaseController
$model = new HomeModel();
$data['customer'] = $model->customers($where);
$data['customer']['label'] = "Customer";
$data['invoice'] = $model->invoice();
$data['invoice'] = $model->invoice_dtls();
// $data['active_category'] = $model->schemes();
$data['active_schemes'] = $model->active_schemes();
$data['expiring_membership'] = $model->expiring_membership_list();
// $data['active_category'] = array_filter($model->schemes(), function ($element) {
// return $element['count'] !== '0' ;
// });
$data['book_published'] = $model->book_published_list();
$data['financial_year'] = date('m') <= 3 ? (date('Y')-1) . '-' . date('Y') : date('Y') . '-' . (date('Y') + 1);
$data['book_published'] = $model->book_published_dtls();
$data['business_id'] = $session_bid;
$this->render_page('dashboard', $data);

View File

@ -25,7 +25,7 @@ class HomeModel extends Model
return $customer;
}
public function invoice() {
public function invoice_dtls() {
if (date('m') <= 3) {
$invoice['financial_year'] = (date('Y')-1) . '-' . date('Y');
$start_date = (date('Y')-1).'-04-01';
@ -92,20 +92,53 @@ class HomeModel extends Model
->getResultArray();
}
public function book_published_list(){
$oneMonthAgo = date('Y-m-d', strtotime(' -30 days'));
public function book_published_dtls(){
return $this->db->table('books as B')
if (date('m') <= 3) {
$start_date = (date('Y')-1).'-04-01';
$end_date = date('Y').'-03-31';
} else {
$start_date = date('Y').'-04-01';
$end_date = (date('Y')+1).'-03-31';
}
$time = strtotime(date('Y-m-d'));
$one_month_ago = date('Y-m-d', strtotime("-1 month", $time));
$one_month_ago_date = date("F d, Y", strtotime("-1 month", $time));
$this_month_today_date = date("F d, Y", $time);
$this_month_name =date('M,Y', $time);
$overall_where = ['isactive'=>1];
$overall_query = $this->db->table('books')->where($overall_where)->countAllResults();
$date_where = ['DATE(created_on)' => date('Y-m-d'),'isactive'=>1];
$date_query = $this->db->table('books')->where($date_where)->countAllResults();
$month_where = ['MONTH(created_on)' => date('m'),'isactive'=>1];
$month_query = $this->db->table('books')->where($month_where)->countAllResults();
$fin_year_where = ['DATE(created_on) >= ' => $start_date , 'DATE(created_on) <= ' => $end_date,'isactive'=>1];
$fin_year_query = $this->db->table('books')->where($fin_year_where)->countAllResults();
$last_one_month_dtls = $this->db->table('books as B')
->select("B.book_id, B.title, B.created_on, B.publisher, B.author, B.publication_date, DATE_FORMAT(B.publication_date, '%d/%m/%Y') as publication_date_format, GROUP_CONCAT(CM.name, ',') as categories")
->join('book_categories as BC', 'BC.book_id = B.book_id and BC.isactive = 1', 'left')
->join('category as CM', 'BC.category_id = CM.id', 'left')
->where('B.created_on >=', $oneMonthAgo)
->where('B.created_on >=', $one_month_ago)
->where('B.created_on <= CURDATE() + INTERVAL 1 DAY')
->where('B.isactive', 1)
->orderBy('B.publication_date', 'DESC')
->groupBy('B.book_id')
->get()
->getResultArray();
}
$book_published['overall'] = $overall_query;
$book_published['today'] = $date_query;
$book_published['today_label'] = $this_month_today_date;
$book_published['month'] = $month_query;
$book_published['month_label'] = $this_month_name;
$book_published['year'] = $fin_year_query;
$book_published['book_published_label'] = $one_month_ago_date." - ".$this_month_today_date;
$book_published['book_published'] = $last_one_month_dtls;
return $book_published;
}
}

View File

@ -188,82 +188,102 @@
<div class="col-xl-4 col-lg-6">
<div class="card">
<div class="card-body">
<h4 class="header-title mt-1">Books Published in Last One Month</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: 50%;">Book Details</th>
<th style="width: 50%;">Category</th>
</tr>
</thead>
<tbody>
<?php foreach ($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; ?>
<!-- <tr>
<td>First std English
<p class="text-muted mb-0">
<i class="mdi mdi-account mr-1"></i> தி. . வைகுண்டம்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-book-open-variant mr-1"></i> விஜயபாரதம் பிரசுரம்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-update mr-1"></i> 17/10/2023
</p>
</td>
<td><span class="badge badge-success badge-pill mr-1">History</span></td>
</tr>
<tr>
<td>First std Science
<p class="text-muted mb-0">
<i class="mdi mdi-account mr-1"></i> Dr. சரத் ஹேபால்கர்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-book-open-variant mr-1"></i> அலைகள் வெளியீட்டகம்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-update mr-1"></i> 17/10/2023
</p>
</td>
<td><span class="badge badge-success badge-pill mr-1">Paperbacks</span></td>
</tr> -->
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
<h4 class="header-title mt-1">Books Published Report</h4>
<div class="text-center">
<div class="row pt-2">
<div class="col-4">
<p class="font-15 mb-1 text-truncate text-muted"><span data-toggle="tooltip" data-placement="bottom" data-original-title="Overall Records">Overall</span></p>
<h4><?= $book_published['overall']; ?></h4>
</div>
<div class="col-4">
<p class="font-15 mb-1 text-truncate text-muted"><span data-toggle="tooltip" data-placement="bottom" data-original-title="<?= $financial_year; ?>">YTD</span></p>
<h4><?= $book_published['year']; ?></h4>
</div>
<div class="col-4">
<p class="font-15 mb-1 text-truncate text-muted"><span data-toggle="tooltip" data-placement="bottom" data-original-title="<?= $book_published['month_label']; ?>">MTD</span></p>
<h4><?= $book_published['month']; ?></h4>
</div>
</div>
</div>
<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="table-responsive">
<table class="table table-sm table-centered mb-0 font-14">
<thead class="thead-light">
<tr>
<th style="width: 50%;">Book Details</th>
<th style="width: 50%;">Category</th>
</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; ?>
<!-- <tr>
<td>First std English
<p class="text-muted mb-0">
<i class="mdi mdi-account mr-1"></i> தி. . வைகுண்டம்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-book-open-variant mr-1"></i> விஜயபாரதம் பிரசுரம்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-update mr-1"></i> 17/10/2023
</p>
</td>
<td><span class="badge badge-success badge-pill mr-1">History</span></td>
</tr>
<tr>
<td>First std Science
<p class="text-muted mb-0">
<i class="mdi mdi-account mr-1"></i> Dr. சரத் ஹேபால்கர்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-book-open-variant mr-1"></i> அலைகள் வெளியீட்டகம்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-update mr-1"></i> 17/10/2023
</p>
</td>
<td><span class="badge badge-success badge-pill mr-1">Paperbacks</span></td>
</tr> -->
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->

View File

@ -63,7 +63,7 @@
<div class="form-row">
<div class="form-group col-md-12">
<label for="site_color" class="col-form-label">Site Color</label>
<input class="form-control" type="color" id="site_color" name="site_color" value="<?= isset($details['site_short_name']) ? $details['site_short_name'] : '#3bafda' ?>">
<input class="form-control" type="color" id="site_color" name="site_color" value="<?= isset($details['site_color']) ? $details['site_color'] : '#3bafda' ?>">
</div>
</div>
<div class="form-row">

View File

@ -15,12 +15,11 @@
<thead class="thead-light">
<tr>
<th>Site Name</th>
<th>Site Title</th>
<th>Admin email</th>
<th>Site Short Name</th>
<th>Site email</th>
<th>Mobile Number</th>
<th>Copyright</th>
<th>Logo</th>
<th>Icon</th>
<th>Site Icon</th>
<th>Status</th>
<th>Action</th>
</tr>
@ -38,11 +37,10 @@
?>
<tr>
<td><?php echo $row['site_name'] ; ?></td>
<td><?php echo $row['site_title'] ; ?></td>
<td><?php echo $row['admin_email'] ; ?></td>
<td><?php echo $row['site_short_name'] ; ?></td>
<td><?php echo $row['site_email'] ; ?></td>
<td><?php echo $row['mobile'] ; ?></td>
<td><?php echo $row['copyright'] ; ?></td>
<td><?php echo $row['logo'] ; ?></td>
<td><?php echo $row['favicon'] ; ?></td>
<td>
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>