stocktransactions
Inventory stock movements with serial and charge tracking.
| Name | Type | Nullable | Default Value | Notes |
|---|---|---|---|---|
PKID | bigint | Stock transaction ID | ||
creator | integer | Creator user ID (defaults to authenticated user on creation) | ||
creationdate | bigint | date_part('epoch', now()) | Creation date and time as a Unix timestamp (defaults to current date and time on creation) | |
lastmodified | bigint | date_part('epoch', now()) | Last modification date and time as a Unix timestamp (auto-reset on modification) | |
item items.ID | integer | Item ID (**dependency**) | ||
storage storages.ID | integer | Storage ID | ||
transaction transactions.ID | integer | Transaction ID | ||
transfer stocktransactions.ID | bigint | Transfer stock transaction ID; must be distinct from `ID` and `null` for RESERVED | ||
flag | smallint | 0 | Flag (`0`=BOOKED, `1`=RESERVED, `2`=CANCELLED) | |
date | bigint | date_part('epoch', now()) | Designated date and time as a Unix timestamp (defaults to current date and time on creation) | |
chargenum | text | '' | Charge (lot) number | |
location | text | '' | Physical location (e.g. shelf identification) | |
reference | text | '' | Reference identification | |
amount | double precision | Amount (quantity); must not be zero (greater than zero if `transfer` is not `null`) | ||
sellingprice | double precision | 0 | Selling price per unit | |
purchaseprice | double precision | 0 | Purchase price per unit | |
serials | text[] | Array-encoded serial numbers | ||
subtransactions | bigint[] | Array-encoded sub-transaction IDs |
| Name | Unique | Nulls Distinct | Primary | Partial | Method | Keys |
|---|---|---|---|---|---|---|
| fk_stocktransactions_item | btree | item | ||||
| fk_stocktransactions_storage | gin | storage | ||||
| fk_stocktransactions_transaction | btree | transaction | ||||
| i_stocktransactions_date | btree | date | ||||
| i_stocktransactions_reservations | btree | transaction | ||||
| i_stocktransactions_serials | gin | serials | ||||
| pk_stocktransactions | btree | ID | ||||
| s_stocktransactions_chargenum | gin | chargenum | ||||
| s_stocktransactions_reference | gin | reference | ||||
| s_stocktransactions_serials | gin | f_safe_array_to_string(serials, ' ') | ||||
| u_stocktransactions_transfer | btree | transfer |
| Name | Type |
|---|---|
| c_stocktransactions_transfer | check |
| dc_stocktransactions_amount | check |
| dc_stocktransactions_chargenum | check |
| dc_stocktransactions_flag | check |
| dc_stocktransactions_location | check |
| dc_stocktransactions_reference | check |
| fk_stocktransactions_item | foreign_key |
| fk_stocktransactions_storage | foreign_key |
| fk_stocktransactions_transaction | foreign_key |
| fk_stocktransactions_transfer | foreign_key |
| pk_stocktransactions | primary_key |
| Name | Type | Events | Function | Definition |
|---|---|---|---|---|
| td_stocktransactions_serials | before | delete | ftd_stocktransactions_serials | |
| ti_stocktransactions_item | before | insert | ftiu_stocktransactions_item | |
| ti_stocktransactions_serials | before | insert | fti_stocktransactions_serials | |
| ti_stocktransactions_subtransactions | before | insert | ftiu_stocktransactions_subtransactions | |
| ti_stocktransactions_transfer | before | insert | fti_stocktransactions_transfer | |
| tu_stocktransactions_item | before | update | ftiu_stocktransactions_item | |
| tu_stocktransactions_serials | before | update | ftu_stocktransactions_serials | |
| tu_stocktransactions_subtransactions | before | update | ftiu_stocktransactions_subtransactions | |
| tu_stocktransactions_transfer | before | update | ftu_stocktransactions_transfer |
Loading...