# Column Name Nullable Data Type Max Length Description
1stock_detail_idbigint0
2value_datedate0
3stock_master_idbigint0
4tran_typetransaction_type0
5store_idinteger0
6item_idinteger0Foreign key to the table core.items.
7quantityinteger0
8unit_idinteger0Foreign key to the table core.items.
9base_quantitynumeric0
10base_unit_idinteger0
11pricemoney_strict0
12cost_of_goods_soldmoney_strict20
13discountmoney_strict20
14shipping_chargemoney_strict20
15sales_tax_idinteger0
16taxmoney_strict20
17audit_user_idinteger0Contains the id of the user who last inserted or updated the corresponding row.
18audit_tstimestamp with time zone0Contains the date and timestamp of the last insert or update action.

Foreign Keys

# 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

Indices

Index Name Owner Access Method Definition Description
stock_details_pkey postgres btree stock_detail_id

Check Constraints

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)

Default Values

# 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()

Triggers

Trigger Name Targets On Event Timing Condition Order Orientation Description
transactions.restrict_delete_trigger transactions.restrict_delete_trigger DELETE BEFORE 0 ROW