ข้ามไปยังเนื้อหา

เอกสาร

DocumentSheet

An issued document, such as a receipt, as it prints: Sarabun on white, the logo and title at the top, the stamp, its lines and the total. Colour appears only in the stamp. The first issue is the original, and every reprint is a copy.

ใช้แสดงเอกสารที่ออกแล้วตามที่พิมพ์ เช่น ใบเสร็จ ใช้ฟอนต์ Sarabun บนพื้นขาว มีสีเฉพาะตรายาง ออกครั้งแรกเป็นต้นฉบับ พิมพ์ซ้ำทุกครั้งเป็นสำเนา Stamp ใช้กับเอกสารเท่านั้น สถานะของรายการบนหน้าจอใช้ Badge

import { DocumentSheet, Stamp } from "@bsru/ui";

ตัวอย่าง

ใบเสร็จ ต้นฉบับและสำเนา

lines คือรายละเอียดตามลำดับ total แสดงใต้เส้นหนา stamp เป็น original เมื่อออกครั้งแรก และ copy เมื่อพิมพ์ซ้ำ ลองสลับครั้งที่พิมพ์

ใบเสร็จรับเงินอิเล็กทรอนิกส์

เอกสารจำลอง ใช้เพื่อการทดสอบเท่านั้น

ต้นฉบับ
เลขที่
RC-2570-0001
ผู้ชำระ
นางสาวนักศึกษา ทดสอบ
รายการ
ค่าบำรุงหอพัก ภาคเรียนที่ 1/2570
ชำระโดย
QR Code

รวมเงิน4,500.00 บาท

<DocumentSheet
  title="ใบเสร็จรับเงินอิเล็กทรอนิกส์"
  subtitle="เอกสารจำลอง ใช้เพื่อการทดสอบเท่านั้น"
  logo={{ src: logo.src, alt: "" }}
  stamp={isReprint ? "copy" : "original"}
  lines={[
    { label: "เลขที่", value: "RC-2570-0001", numeric: true },
    { label: "ผู้ชำระ", value: "นางสาวนักศึกษา ทดสอบ" },
    { label: "รายการ", value: "ค่าบำรุงหอพัก ภาคเรียนที่ 1/2570" },
    { label: "ชำระโดย", value: "QR Code" },
  ]}
  total={{ label: "รวมเงิน", value: "4,500.00 บาท" }}
/>

ตรายางอย่างเดียว

Stamp ใช้คำในภาษาของหน้าจอเมื่อไม่ส่ง label

ต้นฉบับสำเนา
<Stamp kind="original" />
<Stamp kind="copy" />

props ทั้งหมด

ตัวอย่างด้านบนใช้ props เพียงบางตัว ตารางนี้แสดงทุกตัวที่คอมโพเนนต์รับ พร้อมค่าเริ่มต้นและค่าที่ใช้ได้

DocumentSheet

An issued document, such as a receipt, as it prints: Sarabun on white, the logo and title at the top, the stamp, its lines and the total. Colour appears only in the stamp. The first issue is the original, and every reprint is a copy.

DocumentSheet props
ชื่อชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
title* จำเป็นstring—The document's name, such as ใบเสร็จรับเงินอิเล็กทรอนิกส์.
subtitlestring—A line under the title, such as the issuing unit.
stamp"original" | "copy"—original for the first issue, copy for a reprint. Leave it out for a draft.
lines* จำเป็นreadonly DocumentLine[]—The document's details, in order.
total{ label: string; value: string }—The total under a heavy rule, such as รวมเงิน and 4,500.00 บาท.
classNamestring—A width for the sheet, such as max-w-2xl.

Stamp

The stamp on an issued document: Original the first time it's issued, and Copy on every reprint. Use it only on documents, never for a record's status on screen.

Stamp props
ชื่อชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
kind* จำเป็น"original" | "copy"—original the first time a document is issued, copy for a reprint.
labelstring—The stamp's word. Defaults to ต้นฉบับ or สำเนา, in the screen language.

ชนิดข้อมูล

DocumentLine

One line of a DocumentSheet.

DocumentLine fields
ชื่อชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
label* จำเป็นstring—The line's name, such as เลขที่.
value* จำเป็นstring—Its value, formatted by the screen, such as RC-2570-0001.
numericboolean—Lines figures up in columns, for numbers and dates.

ข้อควรปฏิบัติ

  • เอกสารที่ออกแล้วแก้ไขไม่ได้ พิมพ์ซ้ำได้เป็นสำเนาเท่านั้น
  • ตราของมหาวิทยาลัยมี alt ว่างได้ เพราะชื่อเอกสารบอกแล้วว่าเป็นอะไร

ซอร์สโค้ด: ui/src/marks.tsx