- #5/#6/#12 전화 주문 접수: 판매수량 입력 중 엔터키 → 다음 봉투 종류 수량칸으로 이동 - #7 주문접수 관리: 배달일을 접수일 이전으로 변경 불가(클라이언트 min + 서버 검증) - #9 주문접수 관리: 주문수정저장·영수증출력·주문취소 버튼을 접수품목내역 타이틀 옆으로 이동 - #10 주문접수 관리: 접수리스트 하단에 건수·금액 합계 표시(취소 제외) - #13 전화 주문 접수: 접수표 행·열 간격 축소(한 화면 표시) - #14 주문접수 관리: 포장명세 봉투종류~봉투코드 컬럼 간격 조정 - #16 판매대장: 품목 필터 순서 변경(일반용→재사용→공공용→음식물→폐기물) - #18 재고 현황: 종류~계 사이 간격 축소(표 최대폭 제한) - #20/#21 주문접수 관리: 화면명 '주문접수 관리'로 변경, 조회 기준 배달일→접수일, 기본 조회일=오늘(초기화 시 당일), 접수번호 매일 1번부터 시작 - #23 담당자 구분 라벨 '구·군' → '지자체'
123 lines
5.8 KiB
PHP
123 lines
5.8 KiB
PHP
<?= view('components/print_header', [
|
|
'printTitle' => '재고 현황',
|
|
'printDate' => (string) ($baseDate ?? date('Y-m-d')),
|
|
'printExtraLines' => [
|
|
'기준일자: ' . (string) ($baseDate ?? date('Y-m-d')),
|
|
],
|
|
]) ?>
|
|
<?php
|
|
$baseDate = (string) ($baseDate ?? date('Y-m-d'));
|
|
$agencyIdx = (int) ($agencyIdx ?? 0);
|
|
$rows = is_array($rows ?? null) ? $rows : [];
|
|
$subtotals = is_array($subtotals ?? null) ? $subtotals : [];
|
|
$grandTotals = is_array($grandTotals ?? null) ? $grandTotals : ['total' => 0, 'gugun' => 0, 'agency' => 0];
|
|
$agencyOptions = is_array($agencyOptions ?? null) ? $agencyOptions : [];
|
|
$subtotalByGroup = [];
|
|
foreach ($subtotals as $subtotal) {
|
|
$group = (string) ($subtotal['group'] ?? '');
|
|
if ($group !== '') {
|
|
$subtotalByGroup[$group] = $subtotal;
|
|
}
|
|
}
|
|
?>
|
|
|
|
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
|
<form method="get" class="flex flex-wrap items-end justify-between gap-2">
|
|
<div class="flex flex-wrap items-end gap-2 text-sm">
|
|
<label class="font-bold text-gray-700">기준일자</label>
|
|
<input type="date" name="base_date" value="<?= esc($baseDate) ?>" class="border border-gray-300 rounded px-2 py-1 min-w-[10rem]">
|
|
|
|
<label class="font-bold text-gray-700">대행소</label>
|
|
<select name="agency_idx" class="border border-gray-300 rounded px-2 py-1 min-w-[12rem]">
|
|
<option value="0">전체</option>
|
|
<?php foreach ($agencyOptions as $agency): ?>
|
|
<?php $idx = (int) ($agency->sa_idx ?? 0); ?>
|
|
<option value="<?= esc((string) $idx) ?>" <?= $agencyIdx === $idx ? 'selected' : '' ?>>
|
|
<?= esc((string) ($agency->sa_name ?? '')) ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="flex items-center gap-2">
|
|
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
|
|
<a href="<?= base_url('bag/inventory/export?' . http_build_query(['base_date' => $baseDate, 'agency_idx' => $agencyIdx])) ?>" class="no-print border border-btn-excel-border text-btn-excel-text px-3 py-1 rounded-sm text-sm hover:bg-green-50 transition">엑셀저장</a>
|
|
<button type="button" onclick="window.print()" class="no-print border border-btn-print-border text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50 transition">인쇄</button>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
|
|
<div class="mt-2 border border-gray-300 rounded-lg bg-white p-2 print:p-0 print:border-0">
|
|
<div class="overflow-auto">
|
|
<!-- 종류~계 사이 간격 축소 — 표 폭을 내용에 맞게 제한 (피드백 #18) -->
|
|
<table class="w-full max-w-4xl data-table text-sm">
|
|
<thead>
|
|
<tr>
|
|
<th class="w-36 text-center">품 목 구 분</th>
|
|
<th class="text-left">봉투/스티커 종류</th>
|
|
<th class="w-32 text-right">계</th>
|
|
<th class="w-32 text-right">시군구 재고</th>
|
|
<th class="w-32 text-right">대행소 재고</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if ($rows !== []): ?>
|
|
<?php
|
|
$groupRowCount = [];
|
|
foreach ($rows as $row) {
|
|
$group = (string) ($row['group'] ?? '');
|
|
if (! isset($groupRowCount[$group])) {
|
|
$groupRowCount[$group] = 0;
|
|
}
|
|
$groupRowCount[$group]++;
|
|
}
|
|
$printedGroupCount = [];
|
|
?>
|
|
<?php foreach ($rows as $row): ?>
|
|
<?php
|
|
$group = (string) ($row['group'] ?? '');
|
|
if (! isset($printedGroupCount[$group])) {
|
|
$printedGroupCount[$group] = 0;
|
|
}
|
|
$printedGroupCount[$group]++;
|
|
$isFirst = $printedGroupCount[$group] === 1;
|
|
$isLast = $printedGroupCount[$group] === (int) ($groupRowCount[$group] ?? 0);
|
|
?>
|
|
<tr>
|
|
<?php if ($isFirst): ?>
|
|
<td class="text-center font-semibold bg-gray-50" rowspan="<?= esc((string) ($groupRowCount[$group] ?? 1)) ?>"><?= esc($group) ?></td>
|
|
<?php endif; ?>
|
|
<td class="pl-2"><?= esc((string) ($row['name'] ?? '')) ?></td>
|
|
<td class="text-right pr-2"><?= number_format((int) ($row['total_qty'] ?? 0)) ?></td>
|
|
<td class="text-right pr-2"><?= number_format((int) ($row['gugun_qty'] ?? 0)) ?></td>
|
|
<td class="text-right pr-2"><?= number_format((int) ($row['agency_qty'] ?? 0)) ?></td>
|
|
</tr>
|
|
<?php if ($isLast && isset($subtotalByGroup[$group])): ?>
|
|
<?php $s = $subtotalByGroup[$group]; ?>
|
|
<tr class="bg-blue-50 font-semibold">
|
|
<td class="text-center">소계</td>
|
|
<td class="text-right pr-2"><?= number_format((int) ($s['total_qty'] ?? 0)) ?></td>
|
|
<td class="text-right pr-2"><?= number_format((int) ($s['gugun_qty'] ?? 0)) ?></td>
|
|
<td class="text-right pr-2"><?= number_format((int) ($s['agency_qty'] ?? 0)) ?></td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<tr><td colspan="5" class="text-center text-gray-400 py-4">조회 결과가 없습니다.</td></tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
<tfoot>
|
|
<tr class="bg-gray-100 font-bold">
|
|
<td class="text-center" colspan="2">합계</td>
|
|
<td class="text-right pr-2"><?= number_format((int) ($grandTotals['total'] ?? 0)) ?></td>
|
|
<td class="text-right pr-2"><?= number_format((int) ($grandTotals['gugun'] ?? 0)) ?></td>
|
|
<td class="text-right pr-2"><?= number_format((int) ($grandTotals['agency'] ?? 0)) ?></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
|
|
<p class="mt-2 text-xs text-gray-500">
|
|
※ 기준일자까지 갱신된 재고를 집계합니다. 대행소 재고는 별도 재고 연계 전까지 0으로 표시됩니다.
|
|
</p>
|
|
</div>
|