csrtechnew.ohctech.in/home_hariyali.php
2025-04-14 13:28:09 +05:30

622 lines
28 KiB
PHP

<?php
include('techsyn_header.php');
include('log_entry.php');
error_log($_SESSION['RoleCode']."dipak mali");
// if (!isset($_SESSION['RoleCode']) || ($_SESSION['RoleCode'] != "STR" && $_SESSION['RoleCode'] != "DISC" && $_SESSION['RoleCode'] != "TRAC")) {
// echo "<script>location.href='accessDenied.php'</script>";
// }
?>
<link rel="stylesheet" href="css/wizard.css">
<script src="js/Chart.min.js"></script>
<script type="text/javascript"
src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@0.4.0/dist/chartjs-plugin-datalabels.min.js"></script>
<style type="text/css">
.hidden-radio {
position: absolute;
top: 11px;
left: 27px;
width: 60px;
height: 60px;
border-radius: 100%;
background: #fff;
opacity: 0;
cursor: pointer;
}
button:focus {
outline-color: black;
}
</style>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try {
ace.settings.loadState('main-container')
} catch (e) {}
</script>
<?php include('techsyn_sidebar.php'); ?>
<!--breadcrumb-->
<?php
$sql_procure_items = "select * from procurement_items where isExpired='0' and expiry < (CURRENT_DATE + INTERVAL 30 DAY) and ohc_type_id='" . $_SESSION['current_ohcttype'] . "' order by expiry asc";
error_log('query: 19: ' . $sql_procure_items);
$results_procure_items = mysqli_query($conn, $sql_procure_items);
$total_proc = mysqli_num_rows($results_procure_items);
//added on 04-12-2021 - start
$ohc_type = $_SESSION['current_ohcttype'];
$sql_count_stock_in = "select ifNull(count(*),0) from stock_issue where status='Y' and stock_issue_id not in (SELECT issue_id FROM `received_master`) and ohc_location_id in ($ohc_type)";
error_log('query:va: ' . $sql_count_stock_in);
$results_stock_in_items = mysqli_query($conn, $sql_count_stock_in);
$total_stock_in_row = mysqli_fetch_array($results_stock_in_items);
$total_stock_in = $total_stock_in_row[0];
error_log("total_stock_in: " . $total_stock_in);
// end
$sql_reorder_items = "select i.item_id,item_name,reorder_store_level,min_store_level,itm_stk.item_stock_qty from tbl_items i, (SELECT item_id, sum(stock_qty) item_stock_qty FROM `item_stock` group by item_id) itm_stk where itm_stk.item_id=i.item_id and item_stock_qty<=reorder_store_level";
error_log('query: 262626262 ' . $sql_reorder_items);
$results_reorder_items = mysqli_query($conn, $sql_reorder_items);
$total = mysqli_num_rows($results_reorder_items);
$expiryAlertAdvance = getConfigKey("ITEM_EXPIRY_ALERT_DAYS");
if ($expiryAlertAdvance == null) {
$expiryAlertAdvance = 90;
}
$sql_expiry_items = "
SELECT
i.item_id,
item_name,
itm_stk.item_batch_no,
itm_stk.expiry_date,
itm_stk.stock_qty
FROM
tbl_items i,
(SELECT *
FROM item_stock
WHERE
stock_qty > 0
AND ohc_type_id = '" . $_SESSION['current_ohcttype'] . "'
AND item_stock_id NOT IN (SELECT item_stock_id FROM cleanup_item_stock)
AND DATE(expiry_date) <= (CURDATE() + INTERVAL $expiryAlertAdvance DAY)
AND expiry_date != '0000-00-00'
) itm_stk
WHERE
itm_stk.item_id = i.item_id
";
$results_expiry_items = mysqli_query($conn, $sql_expiry_items);
$total_item = mysqli_num_rows($results_expiry_items);
?>
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li><i class="ace-icon fa fa-home home-icon"></i> <a href="#">Home</a>
</li>
<li class="active">Dashboard</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="content">
<!-- Start new dashboard view -->
<div class="container-fluid">
<form id="store_form">
<div class="row" style="margin-top: 10px;">
<div class="col-12 col-sm-6 col-md-4">
<div class="info-box choice mb-3">
<span class="info-box-icon bg-green "><input type="radio" name="task"
class="hidden-radio" value="Design"><i
class="ace-icon fa fa-plus-square"></i></span>
<div class="info-box-content"><br>
<span class="info-box-text">Items Stock</span>
<span class="info-box-number"><?php echo getTotalStockCount() ?>
<small>Items</small>
</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<!-- /.col -->
<!-- fix for small devices only -->
<!-- <div class="clearfix hidden-md-up"></div> -->
<!-- <div class="col-12 col-sm-6 col-md-3">
<div class="info-box choice mb-3">
<span class="info-box-icon bg-green "><input type="radio" name="task"
class="hidden-radio" value="Code"><i
class="ace-icon fa fa-opencart"></i></span>
<div class="info-box-content"><br>
<span class="info-box-text">Items Inward In Stock</span> <span
class="info-box-number"><?php echo getTodayProcurementCount() ?>
<small>Items</small></span>
</span>
</div>
</div>
</div> -->
<div class="col-12 col-sm-6 col-md-4">
<div class="info-box mb-3 choice">
<span class="info-box-icon bg-red"><input type="radio" name="task"
class="hidden-radio" value="stock"><i class="fa fa-clock-o"></i></span>
<div class="info-box-content"><br>
<span class="info-box-text">Sale / Issued Items</span>
<span class="info-box-number"><?php echo getTodayIssueCount() ?>
<small>Items</small></span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<div class="col-12 col-sm-6 col-md-4">
<div class="info-box mb-3 choice">
<span class="info-box-icon bg-green"><input type="radio" name="task"
class="hidden-radio" value="exp"><i class="fa fa-clock-o"></i></span>
<div class="info-box-content"><br>
<span class="info-box-text">Near Expiring Item</span>
<span class="info-box-number"><?php echo $total_item ?>
<small>Items</small></span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row" style="margin-top: 10px;">
<div class="col-12 col-sm-6 col-md-4">
<div class="info-box mb-3 choice">
<span class="info-box-icon bg-red"><input type="radio" name="task"
class="hidden-radio" value="expiry"><i class="fa fa-clock-o"></i></span>
<div class="info-box-content"><br>
<span class="info-box-text">Expiry Items</span>
<span class="info-box-number"><?php echo getExpiredMedCount() ?>
<small>Items</small></span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<div class="col-12 col-sm-6 col-md-4">
<div class="info-box mb-3 choice">
<span class="info-box-icon bg-green"><input type="radio" name="task"
class="hidden-radio" value="indent"><i
class="fa fa-shopping-cart"></i></span>
<div class="info-box-content"><br>
<span class="info-box-text">Indents</span>
<span class="info-box-number"><?php echo getIndentCount() ?>
<small>Indent</small></span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<div class="col-12 col-sm-6 col-md-4">
<div class="info-box mb-3 choice">
<span class="info-box-icon bg-red"><input type="radio" name="task"
class="hidden-radio" value="grn"><i
class="fa fa-shopping-cart"></i></span>
<div class="info-box-content"><br>
<span class="info-box-text">Delivery's</span>
<span class="info-box-number"><?php echo getDeliveryCount('DISPATCHE') ?>/<?php echo getDeliveryCount('') ?>
<small>Indent</small></span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
</div>
</form>
</div>
<div class="row">
<div class="col-sm-6 " style="padding-top: 30px;margin-left: 10px">
<div class="box box-success ">
<div class="box-header box-header-flat">
<h5 class="box-title lighter">
<a role="button" data-toggle="collapse" href="#collapse_check" aria-expanded="false"
aria-controls="collapseOne">
Low Stock Qty - (Total :<?php echo $total; ?>)
</a>
</h5>
</div>
<div id="collapse_check" class="panel-collapse collapse">
<div id="collapse_check">
<table class="table table-bordered table-hover">
<thead class="thin-border-bottom">
<tr>
<th><i class="ace-icon fa fa-caret-right blue"></i>Item</th>
<th><i class="ace-icon fa fa-caret-right blue"></i>Available
Qty</th>
<th><i class="ace-icon fa fa-caret-right blue"></i>Min. Qty
</th>
<th><i class="ace-icon fa fa-caret-right blue"></i>Reorder. Qty
</th>
</tr>
</thead>
<tbody id="loaddata">
</tbody>
</table>
</div>
<script>
$(document).ready(function() {
var limit = 5;
if (limit == 5) {
$("#load").attr('value', 'Show Data');
}
});
</script>
<center>
<input name="load" id="load" class="form-control btn btn-primary" type="submit"
value="Load More" onClick="loadmore()">
</center>
<script>
var limit = 0;
var starting = 0;
// var limit = 5;
// // $("#load").inner('Loading.....');
// const myTimeout = setTimeout(loadmore, 2000);
function loadmore() {
// limit = 0;
// var starting = 0;
$("#load").attr('value', 'Loading.....');
// starting= 0;
limit += 10;
starting = limit - 10;
console.log(starting);
console.log("starting " + starting);
$.ajax({
url: 'item_list_table_store.php',
data: {
limit: limit,
start: starting
},
success: function(data) {
if (data == 0) {
console.log("btn");
$("#load").attr('value', 'Data Over');
} else {
var d = JSON.parse(data);
var html = '';
jQuery.each(d, function(index, item) {
console.log(item.item_name);
html += '<tr><td style="color:#FF4233">' + item
.item_name +
'</td><td style="color:#FF4233">' + item
.item_stock_qty +
'</td><td style="color:#FF4233">' + item
.min_store_level +
'</td><td style="color:#FF4233">' + item
.reorder_store_level + '</td></tr>';
});
$("#loaddata").append(html);
}
}
});
// $("#load").inner('LOAD MORE');
$("#load").attr('value', 'LOAD MORE');
}
</script>
<!-- /.box-main -->
</div>
<!-- /.box-body -->
<!-- /.box-box -->
</div>
</div>
<div class="col-sm-5" style="padding-top: 30px; ">
<div class="box box-success ">
<div class="box-header box-header-flat">
<h5 class="box-title lighter">
<a role="button" data-toggle="collapse" href="#collapse_check3"
aria-expanded="false" aria-controls="collapseOne">
Near Expiring Item (Total :<?php echo $total_item; ?>)
</a>
</h5>
</div>
<div id="collapse_check3" class="panel-collapse collapse">
<div id="collapse_check3">
<table class="table table-bordered table-hover">
<thead class="thin-border-bottom">
<tr>
<th><i class="ace-icon fa fa-caret-right blue"></i>Item</th>
<th><i class="ace-icon fa fa-caret-right blue"></i>Available
Qty</th>
<th><i class="ace-icon fa fa-caret-right blue"></i>Batch</th>
<th><i class="ace-icon fa fa-caret-right blue"></i>Expiry date</th>
</tr>
</thead>
<tbody>
<?php
while ($row_reorder_items = mysqli_fetch_assoc($results_expiry_items)) {
$item_qty = $row_reorder_items['stock_qty'];
$item_id = $row_reorder_items['item_id'];
$item_desc = $row_reorder_items['item_name'];
$batch = $row_reorder_items['item_batch_no'];
$expiry = date_format(date_create($row_reorder_items['expiry_date']), 'm-Y');
if ($row_reorder_items['expiry_date'] &&$row_reorder_items['expiry_date'] !== '0000-00-00') {
$expiry = date_format(date_create($row_reorder_items['expiry_date']), "d-m-Y");
} else {
$expiry = 'NA';
}
?><tr>
<td><?php echo $item_desc ?></td>
<td><?php echo $item_qty ?></td>
<td><?php echo $batch ?></td>
<td><?php echo $expiry ?></td>
</tr><?php
}
?>
</tbody>
</table>
</div>
<!-- /.box-main -->
</div>
<!-- /.box-body -->
<!-- /.box-box -->
</div>
</div>
</div>
<!-- /.page-content -->
<!-- <div class="row">
<div class="col-sm-6 " style="padding-top: 30px;margin-left: 10px">
<div class="box box-success ">
<div class="box-header box-header-flat">
<h5 class="box-title lighter">
<a role="button" data-toggle="collapse" href="#collapse_check2"
aria-expanded="false" aria-controls="collapseOne">
Top 10 Items
</a>
</h5>
</div>
<div id="collapse_check2" class="panel-collapse collapse">
<canvas id="piechart" width="900" height="600"></canvas>
<?php include 'item_details_chart.php'; ?>
</div>
</div>
</div>
</div> -->
</div>
</div>
</div>
<!-- /.main-content -->
</div>
<?php include('techsyn_footer.php'); ?>
<script>
$(document).ready(function() {
$(".choice").on("click", function() {
var v = $(this).closest("div").find("input[name='task']").attr("checked", "checked");
task = $(this).closest("div").find("input[name='task']").val()
$("#store_form").attr('method', 'POST');
if (task == 'Design' || task == 'injury') {
$("#store_form").attr('action', 'store_stock_list.php');
} else if (task == 'visitor_opd') {
$("#store_form").attr('action', 'visitor_pending_medical_disbursement_list.php');
} else if (task == 'Code') {
$("#store_form").attr('action', 'procurement_list.php');
} else if (task == 'stock') {
$("#store_form").attr('action', 'hariyali_item_issue_list.php');
} else if (task == 'direct') {
$("#store_form").attr('action', 'direct_item_issue.php');
} else if (task == 'expiry') {
$("#store_form").attr('action', 'expiry_list.php');
} else if (task == 'indent') {
$("#store_form").attr('action', 'indent_form.php');
} else if (task == 'exp') {
$("#store_form").attr('action', 'pending_expiry_list.php');
} else if (task == 'grn') {
$("#store_form").attr('action', 'grn_master.php');
}else if (task == 'other_activity') {
$("#store_form").attr('action', 'training_camp_exposure_list.php');
}
$("#store_form").submit();
});
});
</script>
<script>
// const dipak ='<?php echo isset($dipak);?>';
const planned_jun = 300;
const actual_jun = 165;
const variance_jun = 135;
const planned_ytd = 488;
const actual_ytd = 472;
const variance_ytd = 16;
const initChart = () => {
const ctx = document.getElementById('financialChart').getContext('2d');
const financialChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Planned Jun-24', 'Actual Jun-24', 'Variance Jun-24', 'Planned YTD', 'Actual YTD', 'Variance YTD'],
datasets: [{
label: 'Financials (in Lakh)',
data: [planned_jun, actual_jun, variance_jun, planned_ytd, actual_ytd, variance_ytd],
backgroundColor: ['#1ED70D', 'orange', '#E94E4E', '#1ED70D', 'orange', '#E94E4E'],
borderColor: ['#1ED70D', 'orange', '#E94E4E', '#1ED70D', 'orange', '#E94E4E'],
borderWidth: 1
}]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'In Lakh'
}
}
},
plugins: {
title: {
display: true,
text: 'Overall Financial (YTD)',
font: {
size: 16
}
},
legend: {
display: true,
position: 'bottom'
}
}
}
});
};
// Attach event to initialize the chart only when the collapsible section is fully shown
$('#show_budget').on('shown.bs.collapse', function() {
initChart();
});
</script>
<script>
// Define your chart data
const planned_jun_bene = 166;
const actual_jun_bene = 165;
const variance_jun_bene = 1;
const planned_ytd_bene = 488.34;
const actual_ytd_bene = 472.21;
const variance_ytd_bene = 16.13;
// Function to initialize the chart
const initChartBene = () => {
const ctx = document.getElementById('financialChart_beneficiary').getContext('2d');
const financialChart_beneficiary = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Planned Jun-24', 'Actual Jun-24', 'Variance Jun-24', 'Planned YTD', 'Actual YTD', 'Variance YTD'],
datasets: [{
label: 'Beneficiarys',
data: [planned_jun_bene, actual_jun_bene, variance_jun_bene, planned_ytd_bene, actual_ytd_bene, variance_ytd_bene],
backgroundColor: ['#1ED70D', 'orange', '#E94E4E', '#1ED70D', 'orange', '#E94E4E'],
borderColor: ['#1ED70D', 'orange', '#E94E4E', '#1ED70D', 'orange', '#E94E4E'],
borderWidth: 1
}]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'In Lakh'
}
}
},
plugins: {
title: {
display: true,
text: 'Overall Financial (YTD)',
font: {
size: 16
}
},
legend: {
display: true,
position: 'bottom'
}
}
}
});
};
// Attach event to initialize the chart only when the collapsible section is fully shown
$('#show_budget_beneficiary').on('shown.bs.collapse', function() {
initChartBene();
});
</script>