표 디자인 - 모든 표를 가벼운 스타일로 통일(.data-table 경량화: 작은 회색 헤더·연한 구분선·hover) - 표/패널 바깥 테두리 둥글게(rounded-lg) 일괄 적용, 표 래퍼에 패딩 카드(p-4) 통일 - 표 헤더·데이터 정렬을 전 화면 좌측 기준으로 통일 - .data-table th/td text-align:left (전역), 흩어진 center/right 정렬 정리 - 재디자인 Tailwind 표(포장단위·단가·기본코드·담당자·업체·판매대행소·무료대상자·지정판매소)도 셀 좌측화 - 기본정보관리 등 나머지 소메뉴 표를 기본 코드 관리 스타일(가벼운 표·상태 pill)로 재디자인 워크스페이스/공통 - "이 화면 설명" → 새 탭 대신 우측 드로어 팝업(현재 화면과 동시에 보기, Esc·드래그 폭조절) - 상단바 글씨 크기 조절(A−/A+), 작업 내용에 zoom 적용 - 탭 최대치 도달 시 자동 삭제 대신 안내 토스트, "모두 닫기"(업무 현황 탭은 보존) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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>
|
|
<a href="<?= base_url('bag/inventory/inspection-select') ?>" class="no-print border border-blue-300 text-blue-700 px-3 py-1 rounded-sm text-sm hover:bg-blue-50 transition">실사 선별 조회</a>
|
|
</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">
|
|
<table class="w-full 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>
|