ria/app/Views/sales_dashboard.php
2024-10-29 17:14:53 +05:30

267 lines
13 KiB
PHP
Executable File

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
</div>
</div>
</div>
<div class="row">
<!-- Today Sales -->
<div class="col-lg-4 col-xl-4">
<div class="card">
<div class="card-body" style="height: 150px;">
<div class="d-flex justify-content-between align-items-center">
<h3 class="mb-0">Today Sales</h3>
<h4 class="mb-0 mt-0">
<span data-plugin="counterup" class="card_font_colorset_green" style="font-size: 20.7215px;">
<?php echo $today_sales->Invoices ?>
</span> Invoices
</h4>
</div>
<div class="d-flex justify-content-between align-items-center mt-3">
<div class="text-left">
<p class="text-muted mb-0">Qty in Kgs</p>
<h4 class="mb-1 mt-0">
<span data-plugin="counterup" class="card_font_colorset_green"><?php echo $today_sales->Qty ?></span>
</h4>
</div>
<div class="text-left">
<p class="text-muted mb-0">Sales in Rs.</p>
<h4 class="mb-1 mt-0">
<span class="card_font_colorset_green"><?php echo $today_sales->Sales; ?></span>
</h4>
</div>
</div>
</div>
</div>
</div>
<!-- This Month Sales -->
<div class="col-lg-4 col-xl-4">
<div class="card">
<div class="card-body" style="height: 150px;">
<div class="d-flex justify-content-between align-items-center">
<h3 class="mb-0">This Month Sales</h3>
<h4 class="mb-0 mt-0">
<span data-plugin="counterup" class="card_font_colorset_bule" style="font-size: 20.7215px;">
<?php echo $this_month_sales->Invoices ?>
</span> Invoices
</h4>
</div>
<div class="d-flex justify-content-between align-items-center mt-3">
<div class="text-left">
<p class="text-muted mb-0">Qty in Kgs</p>
<h4 class="mb-1 mt-0">
<span data-plugin="counterup" class="card_font_colorset_bule"><?php echo $this_month_sales->Qty ?></span>
</h4>
</div>
<div class="text-left">
<p class="text-muted mb-0">Sales in Rs.</p>
<h4 class="mb-1 mt-0">
<span class="card_font_colorset_bule"><?php echo $this_month_sales->Sales; ?></span>
</h4>
</div>
</div>
</div>
</div>
</div>
<!-- This Year Sales -->
<div class="col-lg-4 col-xl-4">
<div class="card">
<div class="card-body" style="height: 150px;">
<div class="d-flex justify-content-between align-items-center">
<h3 class="mb-0">This Year Sales</h3>
<h4 class="mb-0 mt-0">
<span data-plugin="counterup" class="card_font_colorset_red" style="font-size: 20.7215px;">
<?php echo $this_year_sales->Invoices ?>
</span> Invoices
</h4>
</div>
<div class="d-flex justify-content-between align-items-center mt-3">
<div class="text-left">
<p class="text-muted mb-0">Qty in Kgs</p>
<h4 class="mb-1 mt-0">
<span data-plugin="counterup" class="card_font_colorset_red"><?php echo $this_year_sales->Qty ?></span>
</h4>
</div>
<div class="text-left">
<p class="text-muted mb-0">Sales in Rs.</p>
<h4 class="mb-1 mt-0">
<span class="card_font_colorset_red"><?php echo $this_year_sales->Sales; ?></span>
</h4>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-12 col-md-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">This Year Sales Trend</h4>
<canvas id="salesComparisonChart" height="60"></canvas>
</div>
</div>
</div>
</div>
<!-- <div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Invoices Table</h4>
</div>
</div>
</div> -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body" style="overflow-x:scroll;">
<!-- <div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Invoices Table</h4>
</div>
</div>
</div> -->
<table id="datatable-buttonss" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>Invoice No.</th>
<th>Invoice Date</th>
<th>Invoice Time</th>
<th>Vehicle No.</th>
<th>Product</th>
<th>Client</th>
<th>Quantity</th>
<th>Rate</th>
<th>Value</th>
<th>CGST</th>
<th>SGST</th>
<th>IGST</th>
<th>TCS</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php foreach ($get_today_invoices as $invoice) : ?>
<tr>
<td><?php echo $invoice['Invoice No.']; ?></td>
<td><?php echo $invoice['Invoice Date']; ?></td>
<td><?php echo $invoice['Invoice Time']; ?></td>
<td><?php echo $invoice['Vehicle No.']; ?></td>
<td><?php echo $invoice['Product']; ?></td>
<td><?php echo $invoice['Client']; ?></td>
<td><?php echo $invoice['Quantity']; ?></td>
<td><?php echo $invoice['Rate']; ?></td>
<td><?php echo $invoice['Value']; ?></td>
<td><?php echo $invoice['CGST']; ?></td>
<td><?php echo $invoice['SGST']; ?></td>
<td><?php echo $invoice['IGST']; ?></td>
<td><?php echo $invoice['TCS']; ?></td>
<td><?php echo $invoice['Total']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
<!-- end row -->
<!-- end page title -->
</div> <!-- container -->
</div> <!-- content -->
</div>
<script>
$(document).ready(function() {
$('#datatable-buttonss').DataTable({
dom: 'Blfrtip',
buttons: [
'excel', 'pdf'
],
pageLength: 10,
lengthMenu: [[10, 20, 30, 50, -1],[10, 20, 30, 50, "All"] ],
responsive: false,
order:false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
});
</script>
<script>
const currentYearSales = <?php echo json_encode($currentYearSales); ?>;
const lastYearSales = <?php echo json_encode($lastYearSales); ?>;
const ctx = document.getElementById('salesComparisonChart').getContext('2d');
const salesComparisonChart = new Chart(ctx, {
type: 'bar', // Bar chart
data: {
labels: ['April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', 'January', 'February', 'March'], // Months of the year
datasets: [{
label: 'Current Year Sales',
data: currentYearSales,
backgroundColor: 'rgba(86, 166, 75, 0.6)', // Green color with opacity
borderColor: 'rgb(86, 166, 75)', // Green border color
borderWidth: 1,
},
{
label: 'Last Year Sales',
data: lastYearSales,
backgroundColor: 'rgba(173, 3, 23, 0.6)', // Red color with opacity
borderColor: 'rgb(173, 3, 23)', // Red border color
borderWidth: 1,
}
]
},
options: {
scales: {
y: {
beginAtZero: true, // Ensures the y-axis starts at zero
ticks: {
stepSize: 10000000, // Sets the interval between ticks
callback: function(value) {
return value.toLocaleString('en-IN'); // Return plain number without formatting
}
},
min: 0, // Minimum value for y-axis
max: 30000000 // Maximum value for y-axis
}
},
plugins: {
legend: {
display: true,
labels: {
color: '#495057' // Color of legend text
}
}
}
}
});
</script>