
PK 
<?php
ob_start();
//error_reporting(E_ALL ^ E_NOTICE);
@session_start();
ini_set('allow_url_include',1);
date_default_timezone_set("Asia/Kolkata");
set_time_limit(600);
ini_set('max_execution_time',600);
require_once '../includes/settings/PDODB.php';
include '../includes/modules/functions.php';
$function = new FUNCTIONS();
if(empty($_SESSION['adminId_cheesyBites'])){
header("Location: ../index.php");
exit();
}
$today = date('Y-m-d');
$pdodb = PDODB::getInstance();
$sql ="SELECT * FROM purchase WHERE DATE(invoiceDate) ='".$today."' ";
$result = $pdodb->query($sql);
$today_totamt = 0;
foreach ($result as $key => $value) {
$today_totamt += (int)$value['total_amt'];
}
$sql2 = "SELECT id, purchaseId, inventoryId, rateperunit, qty, balStockQty, total, createDate FROM purchase_items WHERE DATE(invoiceDate) ='".$today."'";
//$sql2 = "SELECT id, purchaseId, inventoryId, rateperunit, qty, balStockQty, total, createDate FROM purchase_items";
$result2 = $pdodb->query($sql2);
// Group the results by inventoryId
$groupedResults = $function->groupByInventoryId($result2);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>INSPINIA | Basic Form</title>
<?php include_once '../layout/style.php'; ?>
</head>
<body>
<div id="wrapper">
<?php $currentPage = 'dashboard'; include_once '../layout/side-bar.php'; ?>
<!-- <nav class="navbar-default navbar-static-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav metismenu" id="side-menu">
<li class="nav-header">
<div class="dropdown profile-element"> <span>
<img alt="image" class="img-circle" src="../img/profile_small.jpg" />
</span>
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<span class="clear"> <span class="block m-t-xs"> <strong class="font-bold">Vinay</strong>
</span> <span class="text-muted text-xs block">Web Developer <b class="caret"></b></span> </span> </a>
<ul class="dropdown-menu animated fadeInRight m-t-xs">
<li><a href="#">Logout</a></li>
</ul>
</div>
<div class="logo-element">Singh World</div>
</li>
<li>
<a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">Dashboards</span> <span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../dashboard/index.php">Dashboard</a></li>
</ul>
</li>
</ul>
</div>
</nav> -->
<div id="page-wrapper" class="gray-bg">
<?php include_once '../layout/header.php'; ?>
<div class="row wrapper border-bottom white-bg page-heading">
<div class="col-lg-8">
<h2>Cheesy Bites Admin Dashboard</h2>
<ol class="breadcrumb">
<li>
<a href="#">Dashboard</a>
</li>
</ol>
</div>
</div>
<div class="row" style="background-color: #fff;">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="col-lg-4">
<div class="panel panel-primary">
<div class="panel-heading">
Today Orders
</div>
<div class="panel-body text-navy">
<h1 class="no-margins"><?=count($result);?></h1>
<!-- <div class="stat-percent font-bold text-success">98% <i class="fa fa-bolt"></i></div> -->
<p>Total number of Orders</p>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="panel panel-danger">
<div class="panel-heading">
Today Payments
</div>
<div class="panel-body text-danger">
<h1 class="no-margins"><?=$today_totamt;?> /-</h1>
<!-- <div class="stat-percent font-bold text-success">98% <i class="fa fa-bolt"></i></div> -->
<p>Total Amount</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<?php
// Define the array of class suffixes
$classOptions = ['warning', 'success', 'primary', 'danger', 'info'];
// Display the grouped data
foreach ($groupedResults as $inventoryId => $items) {
$getinventorydata = $function->getInventory($id=$inventoryId,$itemCode=NULL,$itemType=NULL,$isActive=NULL,$orderBy='ASC');
$itemname = $getinventorydata[0]['itemName'];
$totalQuantity = 0;
$totalAmount = 0;
foreach ($items as $item) {
// Accumulate the total quantity and total amount for this inventory item
$totalQuantity += (float)$item['qty'];
$totalAmount += (float)$item['total'];
}
// Randomly select a suffix for the classes
$randomSuffix = $classOptions[array_rand($classOptions)];
$panelClass = "panel-$randomSuffix"; // e.g., panel-warning
$textClass = "text-$randomSuffix"; // e.g., text-warning
?>
<div class="col-lg-4">
<div class="panel <?=$panelClass;?>">
<div class="panel-heading">
<?=$itemname;?>
</div>
<div class="panel-body <?=$textClass;?>">
<h1 class="no-margins"><?php echo "Total Amount $totalAmount\n"; ?> /-</h1>
<p><?php echo "Total Quantity $totalQuantity\n"; ?></p>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include_once '../layout/script.php'; ?>
<script>
function tossterMsgAlert(msg='Welcome',title='') {
toastr.options = {
closeButton: true,
//debug: false,
newestOnTop: false,
//progressBar: false,
positionClass: 'toast-top-center',
preventDuplicates: true,
//onclick: null,
//showDuration: 300,
//hideDuration: 1000,
timeOut: 2000,
//extendedTimeOut: 1000,
//showEasing: 'swing',
//hideEasing: 'linear',
//showMethod: 'fadeIn',
hideMethod: 'fadeOut'
};
toastr.warning(title,msg);
}
</script>
<!-- Page-Level Scripts -->
<script>
$(document).ready(function(){
$('.dataTables-example').DataTable({
dom: '<"html5buttons"B>lTfgitp',
columnDefs: [
{ type: "num-fmt", symbols:"R$" , targets: 4 }
],
buttons: [
{ extend: 'copy'},
{extend: 'csv'},
/*{extend: 'excel', title: 'ExampleFile'},
{extend: 'pdf', title: 'ExampleFile'},*/
/*{extend: 'print',
customize: function (win){
$(win.document.body).addClass('white-bg');
$(win.document.body).css('font-size', '10px');
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}*/
]
});
});
</script>
</body>
</html>


PK 99