2018-09-12 14:48:59 -04:00
|
|
|
--------------------------balances----------------------------------------------------
|
|
|
|
|
|
|
|
CREATE TABLE evt.bal (
|
2018-09-20 22:28:24 -04:00
|
|
|
acct ltree REFERENCES evt.acct(acct)
|
2018-09-20 23:58:34 -04:00
|
|
|
,fspr ltree REFERENCES evt.fspr(id)
|
2018-09-12 14:48:59 -04:00
|
|
|
,obal numeric(12,2)
|
|
|
|
,debits numeric(12,2)
|
|
|
|
,credits numeric(12,2)
|
|
|
|
,cbal numeric(12,2)
|
2018-09-21 00:38:49 -04:00
|
|
|
,prop jsonb
|
2018-09-12 14:48:59 -04:00
|
|
|
);
|
2018-09-20 23:58:34 -04:00
|
|
|
ALTER TABLE evt.bal ADD CONSTRAINT bal_pk PRIMARY KEY(acct,fspr);
|
2018-09-27 12:49:12 -04:00
|
|
|
COMMENT ON TABLE evt.bal IS 'account balances by fiscal period';
|
2018-09-12 14:48:59 -04:00
|
|
|
COMMENT ON COLUMN evt.bal.acct IS 'account';
|
2018-09-20 23:58:34 -04:00
|
|
|
COMMENT ON COLUMN evt.bal.fspr IS 'period';
|
2018-09-12 14:48:59 -04:00
|
|
|
COMMENT ON COLUMN evt.bal.obal IS 'opening balance';
|
|
|
|
COMMENT ON COLUMN evt.bal.debits IS 'total debits';
|
|
|
|
COMMENT ON COLUMN evt.bal.credits IS 'total credits';
|
2018-09-20 23:58:34 -04:00
|
|
|
COMMENT ON COLUMN evt.bal.cbal IS 'closing balance';
|
2018-09-21 00:38:49 -04:00
|
|
|
COMMENT ON COLUMN evt.bal.prop IS 'json of period properties';
|