Files
firstgarden-web-gnu/adm/fg_admin/bakery/bakery_stock_print.php

102 lines
3.6 KiB
PHP

<?php
// 베이커리팀용 양식출력 파일
// 베이커리 재고관리
include_once "_common.php";
if(!$_SESSION['user_id']) exit;
// 검색 변수 초기화
!isset($search) ?? "";
!isset($where) ?? "";
!isset($search_count) ?? "";
$is_debug = false; // 디버깅 시 true로 변경
// 날짜로 검색한 경우 해당 날짜를 사용하고, 아닌 경우 오늘 날짜를 사용함
$searchDate = isset($_REQUEST["searchDate"]) ? $_REQUEST["searchDate"] : date("Y-m-d"); // 검색일
$prevDate = date("Y-m-d", strtotime("-1 day", strtotime($searchDate))); // 검색 전일
$edit_datetime = date('Y-m-d H:i:s'); // 최종 수정 시간 업데이트
bakeryPreUpdate($searchDate, $edit_datetime);
?>
<style>
@page {
margin-left: 2cm;
margin-right: 2cm;
}
.container { width: "100%"}
.bakery tfoot {
font-weight: 600;
}
.sort-icon {
margin-left: 5px;
font-size: 12px;
vertical-align: middle;
}
</style>
<html>
<head>
<title>베이커리 일일현황</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</head>
<body>
<h2 class="mb-3 text-center">베이커리 일일현황</h2>
<div class="d-flex justify-content-end mb-3">
<div class="col-auto">
날짜 : <?= $searchDate ?>
</div>
</div>
<table class="table table-striped align-middle table-hover bakery" id="bakeryTable">
<colgroup>
<col width="30px">
<col width="150px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
</colgroup>
<!-- 테이블 제목 -->
<thead class="table-light">
<tr class="align-middle">
<th class="text-center no-click">No.</th>
<th class="text-center">품목</th>
<th class="text-center">전일재고</th>
<th class="text-center">생산</th>
<th class="text-center">업장사용</th>
<th class="text-center">재활용</th>
<th class="text-center">폐기</th>
<th class="text-center">현재고</th>
</tr>
</thead>
<!-- 테이블 데이터 -->
<tbody class="table-group-divider" id="bakeryTableBody">
<?php
// 데이터 가져와서 뿌리기
$i = 1; // number 표시를 위한 변수
foreach (getBakeryInvenData($searchDate) as $row) {
if($is_debug) var_dump($row);
// 전일자 현재고 가져오기, 없으면 0을 반환함
$previous_stock = getPrevStock($searchDate, $row['barcode']) ;
// 현재고
$current_stock = $previous_stock + $row['production'] - $row['inhouse_use'] - $row['recycling'] - $row['disposal'] - $row['sales'];
?>
<tr id="row-<?=$row['barcode']?>">
<td class="text-center"><?=$i?></td>
<td class="text-center"><?=htmlspecialchars($row['product_name'])?></td>
<td class="text-center"><?=$previous_stock?></td>
<td class="text-end"><input class="form-control text-end" type="text" value=""></td>
<td class="text-end"><input class="form-control text-end" type="text" value=""></td>
<td class="text-end"><input class="form-control text-end" type="text" value=""></td>
<td class="text-end"><input class="form-control text-end" type="text" value=""></td>
<td class="text-center"><?=$current_stock?></td>
</tr>
<?php $i++;
}
?>
</tbody>
</table>
</body>
</html>