This commit is contained in:
Phuoc Nguyen
2025-10-29 15:52:24 +07:00
parent 2905668358
commit cb4df363ab
6 changed files with 707 additions and 137 deletions

106
lib/docs/import.html Normal file
View File

@@ -0,0 +1,106 @@
<!doctype html>
<html lang="vi">
<head>
<meta charset="utf-8"/>
<title>Phiếu xuất kho</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<style>
:root { --fg:#111; --muted:#666; --border:#000; --primary:#2563eb; }
html,body { margin:0; padding:0; font:14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif; color:var(--fg); }
.wrap { max-width:720px; margin:0 auto; padding:12px; }
.actions { position: sticky; top:0; background:#fff; padding:8px 0; display:flex; gap:8px; justify-content:flex-end; border-bottom:0.1mm solid var(--border); }
.actions button { padding:6px 12px; cursor:pointer; border:0.1mm solid var(--border); background:#fff; border-radius:6px; }
h1 { font-size:20px; margin:8px 0 4px; text-align:center; }
.meta { text-align:center; color:var(--muted); margin-bottom:8px; }
.box { border:0.1mm solid var(--border); border-radius:8px; padding:8px; margin:8px 0; }
.row { display:flex; gap:8px; margin:6px 0; }
.row > div { flex:1; }
.label { color:var(--muted); font-size:12px; }
.value { font-weight:600; }
table { width:100%; border-collapse:collapse; margin-top:6px; }
th, td { border:0.1mm solid var(--border); padding:8px; text-align:left; }
th { background:#f8fafc; }
.barcode { text-align:center; margin:12px 0; }
.footer { display:flex; gap:12px; margin:8px 0 4px; }
.sign { flex:1; text-align:center; color:var(--muted); padding-top:24px; }
/* Ensure printer keeps border colors/thickness */
* { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* Print margins and padding */
@page {
size: auto;
margin: 3mm 0mm; /* outer page margin */
}
@media print {
.actions { display:none; }
.wrap { padding:0 4px ; }
th { background:#eee; } /* light gray still visible on most printers */
/* Force black borders on print */
.box, table, th, td { border-color:#000 !important; border-width:0.1mm !important; }
}
</style>
</head>
<body>
<div class="wrap">
<div class="actions">
<button onclick="printAndClose()">In</button>
<button onclick="window.close()">Đóng</button>
</div>
<h1>PHIẾU XUẤT KHO</h1>
<h3>Công ty TNHH Cơ Khí Chính Xác Minh Thư</h3>
<h4>${wareHouseText}</h4>
<div class="meta">Ngày: ${dt}</div>
<div class="box">
<div class="row">
<div><div class="label">ProductId</div><div class="value">${productId}</div></div>
<div><div class="label">Mã sản phẩm</div><div class="value">${productCode}</div></div>
</div>
<div class="row">
<div><div class="label">Tên sản phẩm</div><div class="value">${productName}</div></div>
<div><div class="label">Công đoạn</div><div class="value">${stageName || '-'}</div></div>
</div>
</div>
<div class="box">
<div class="label">Số lượng:</div>
<table>
<thead>
<tr><th>Loại</th><th>KG</th><th>PCS</th></tr>
</thead>
<tbody>
<tr>
<td>Hàng đạt</td>
<td>${Number(qty.passedKg || 0)}</td>
<td>${Number(qty.passedPcs || 0)}</td>
</tr>
<tr>
<td>Hàng lỗi</td>
<td>${Number(qty.issuedKg || 0)}</td>
<td>${Number(qty.issuedPcs || 0)}</td>
</tr>
</tbody>
</table>
</div>
<div class="box">
<div class="row">
<div><div class="label">Nhân viên kho</div><div class="value">${responsibleName || '-'}</div></div>
</div>
</div>
<div class="barcode">
${barcodeDataUrl ? `<img alt="Barcode" src="${barcodeDataUrl}" />` : ''}
</div>
<div class="footer">
<div class="sign">
.
</div>
</div>
</div>
<script>
let printed = false;
function printAndClose() { printed = true; window.print(); }
window.addEventListener('afterprint', () => setTimeout(() => window.close(), 200));
window.addEventListener('focus', () => { if (printed) setTimeout(() => window.close(), 400); });
window.onload = () => { printAndClose(); };
</script>
</body>
</html>