| # | Column Name | Nullable | Data Type | Max Length | Description |
|---|---|---|---|---|---|
| 1 | stock_detail_id | bigint | 0 | ||
| 2 | value_date | date | 0 | ||
| 3 | stock_master_id | bigint | 0 | ||
| 4 | tran_type | transaction_type | 0 | ||
| 5 | store_id | integer | 0 | ||
| 6 | item_id | integer | 0 | Foreign key to the table core.items. | |
| 7 | quantity | integer | 0 | ||
| 8 | unit_id | integer | 0 | Foreign key to the table core.items. | |
| 9 | base_quantity | numeric | 0 | ||
| 10 | base_unit_id | integer | 0 | ||
| 11 | price | money_strict | 0 | ||
| 12 | cost_of_goods_sold | money_strict2 | 0 | ||
| 13 | discount | money_strict2 | 0 | ||
| 14 | shipping_charge | money_strict2 | 0 | ||
| 15 | sales_tax_id | integer | 0 | ||
| 16 | tax | money_strict2 | 0 | ||
| 17 | audit_user_id | integer | 0 | Contains the id of the user who last inserted or updated the corresponding row. | |
| 18 | audit_ts | timestamp with time zone | 0 | Contains the date and timestamp of the last insert or update action. |
| # | Column Name | Key Name | References |
|---|---|---|---|
| 3 | stock_master_id | stock_details_stock_master_id_fkey | transactions.stock_master.stock_master_id |
| 5 | store_id | stock_details_store_id_fkey | office.stores.store_id |
| 6 | item_id | stock_details_item_id_fkey | core.items.item_id |
| 8 | unit_id | stock_details_unit_id_fkey | core.units.unit_id |
| 10 | base_unit_id | stock_details_base_unit_id_fkey | core.units.unit_id |
| 15 | sales_tax_id | stock_details_sales_tax_id_fkey | core.sales_taxes.sales_tax_id |
| 17 | audit_user_id | stock_details_audit_user_id_fkey | office.users.user_id |
| Index Name | Owner | Access Method | Definition | Description |
|---|---|---|---|---|
| stock_details_pkey | postgres | btree | stock_detail_id |
| Constraint Name | Description |
|---|---|
| stock_details_unit_chk CHECK (core.is_valid_unit(item_id, unit_id)) | |
| stock_details_tax_chk CHECK ( CASE WHEN tax::numeric > 0::numeric THEN sales_tax_id IS NOT NULL ELSE NULL::boolean END) |
| # | Column Name | Default |
|---|---|---|
| 1 | stock_detail_id | nextval('transactions.stock_details_stock_detail_id_seq'::regclass) |
| 12 | cost_of_goods_sold | 0 |
| 13 | discount | 0 |
| 14 | shipping_charge | 0 |
| 16 | tax | 0 |
| 18 | audit_ts | now() |
| Trigger Name | Targets | On Event | Timing | Condition | Order | Orientation | Description |
|---|---|---|---|---|---|---|---|
| transactions.restrict_delete_trigger | transactions.restrict_delete_trigger | DELETE | BEFORE | 0 | ROW |