Skip to content

payment / voucher ​

Trang sinh tự động

Sinh từ ad83b0aea — chạy 820 migration lên PostgreSQL 17 rồi đọc pg_catalog. Mô tả bảng và cột lấy từ COMMENT ON. Không sửa tay: lần chạy docgen sau sẽ ghi đè.

2 bảng. Quay lại payment.

vouchers ​

P3-09. Manual RECEIPT/PAYMENT/REVERSAL vouchers (maker/checker, G-FIN). APPROVED/CANCELLED are immutable; the approval snapshot (payload hash, policy version, roles) is frozen at submit. No number (GAP-99), no balance.

public.vouchers · 29 cột · 12 check · 1 unique · 6 index · 1 policy · 4 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
kindtextNOT NULL
statustextNOT NULL
fund_codetextNOT NULL
amount_vndbigintNOT NULL
currencytextNOT NULL
reasontextNOT NULL
order_iduuidFK → orders
transaction_iduuidFK → provider_transactions
original_voucher_iduuidFK → vouchers
evidence_media_idsuuid[]NOT NULL
created_byuuidNOT NULLFK → accounts
created_attimestamptzNOT NULL
updated_byuuidNOT NULLFK → accounts
updated_attimestamptzNOT NULL
submitted_byuuidFK → accounts
submitted_attimestamptz
payload_hashbytea
policy_version_iduuidFK → finance_policy_versions
policy_version_nointeger
maker_rolestext[]
checker_rolestext[]
approved_byuuidFK → accounts
approved_attimestamptz
cashbook_entry_iduuidFK → cashbook_entries
cancelled_byuuidFK → accounts
cancelled_attimestamptz
versionintegerNOT NULL
correlation_idcorrelation_refNOT NULL

Khoá chính: id

Trỏ ra (10):

  • approved_by → accounts · ON DELETE RESTRICT
  • cancelled_by → accounts · ON DELETE RESTRICT
  • created_by → accounts · ON DELETE RESTRICT
  • cashbook_entry_id → cashbook_entries · ON DELETE RESTRICT DEFERRABLE
  • order_id → orders · ON DELETE RESTRICT
  • original_voucher_id → vouchers · ON DELETE RESTRICT
  • policy_version_id → finance_policy_versions · ON DELETE RESTRICT
  • submitted_by → accounts · ON DELETE RESTRICT
  • transaction_id → provider_transactions · ON DELETE RESTRICT
  • updated_by → accounts · ON DELETE RESTRICT

Được trỏ tới (2): voucher_rejections, vouchers

voucher_rejections ​

FU-713. Append-only: a checker sent a SUBMITTED voucher back to its maker, with the reason. Never changed or deleted.

public.voucher_rejections · 7 cột · 1 check · 1 unique · 3 index · 1 policy · 2 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
voucher_iduuidNOT NULLFK → vouchers
at_versionintegerNOT NULL
rejected_byuuidNOT NULLFK → accounts
rejected_attimestamptzNOT NULL
reasontextNOT NULL
correlation_idcorrelation_refNOT NULL

Khoá chính: id

Trỏ ra (2):

  • rejected_by → accounts · ON DELETE RESTRICT
  • voucher_id → vouchers · ON DELETE RESTRICT

Được trỏ tới: không có

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17