public.bills
Description
Labels
svc-smarttab
Columns
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| id | uuid | false | public.loyalty_transactions public.splits public.payments public.receipts public.invoices public.bill_operation_histories | |||
| order_id | uuid | true | public.orders | |||
| customer_id | integer | true | public.customers | |||
| coupon_id | integer | true | public.coupons | |||
| staff_code | varchar(50) | true | ||||
| bill_number | varchar(50) | false | ||||
| subtotal | numeric(12,2) | 0.00 | false | |||
| discount_amount | numeric(12,2) | 0.00 | false | |||
| tax | numeric(12,2) | 0.00 | false | |||
| total_amount | numeric(12,2) | false | ||||
| status | varchar(50) | true | ||||
| is_split | boolean | false | true | |||
| is_combined | boolean | false | true | |||
| combined_order_ids | jsonb | true | ||||
| combined_table_numbers | jsonb | true | ||||
| created_at | timestamp with time zone | now() | true | |||
| updated_at | timestamp with time zone | now() | true | |||
| paid_at | timestamp with time zone | true | ||||
| merchant_id | integer | false | public.merchants | |||
| store_id | integer | false | public.stores | |||
| table_number | varchar(50) | true | ||||
| split_count | integer | true | ||||
| is_deleted | boolean | false | false | |||
| combined_bill_ids | jsonb | true | ||||
| description | text | true | ||||
| customer_name | varchar(100) | true |
Viewpoints
| Name | Definition |
|---|---|
| Order & Billing | Order lifecycle — Orders → Bills → Payments → Settlements |
Constraints
| Name | Type | Definition |
|---|---|---|
| bills_total_check | CHECK | CHECK ((total_amount >= (0)::numeric)) |
| bills_merchant_id_fkey | FOREIGN KEY | FOREIGN KEY (merchant_id) REFERENCES merchants(id) ON DELETE RESTRICT |
| bills_coupon_id_fkey | FOREIGN KEY | FOREIGN KEY (coupon_id) REFERENCES coupons(id) ON DELETE SET NULL |
| bills_customer_id_fkey | FOREIGN KEY | FOREIGN KEY (customer_id) REFERENCES customers(id) ON DELETE SET NULL |
| bills_store_id_fkey | FOREIGN KEY | FOREIGN KEY (store_id) REFERENCES stores(id) ON DELETE RESTRICT |
| bills_order_id_fkey | FOREIGN KEY | FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE RESTRICT |
| bills_pkey | PRIMARY KEY | PRIMARY KEY (id) |
Indexes
| Name | Definition |
|---|---|
| bills_pkey | CREATE UNIQUE INDEX bills_pkey ON public.bills USING btree (id) |
| ix_bills_bill_number | CREATE UNIQUE INDEX ix_bills_bill_number ON public.bills USING btree (bill_number) |
| ix_bills_created_at | CREATE INDEX ix_bills_created_at ON public.bills USING btree (created_at) |
| ix_bills_customer_id | CREATE INDEX ix_bills_customer_id ON public.bills USING btree (customer_id) |
| ix_bills_order_id | CREATE INDEX ix_bills_order_id ON public.bills USING btree (order_id) |
| ix_bills_status | CREATE INDEX ix_bills_status ON public.bills USING btree (status) |
| ix_bills_merchant_id | CREATE INDEX ix_bills_merchant_id ON public.bills USING btree (merchant_id) |
| ix_bills_store_id | CREATE INDEX ix_bills_store_id ON public.bills USING btree (store_id) |
Relations
Generated by tbls