diff options
Diffstat (limited to 'sql/dawn.sql')
| -rw-r--r-- | sql/dawn.sql | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index a9ba327a..cf651ae6 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -3797,7 +3797,7 @@ AS SELECT tranche_risk.date, end_princ_factor float8 NULL, end_face_value float8 NULL, "acq_int_(fx)" float8 NULL, - init_ticket_bs text NULL, + init_ticket_bs text NULL,2 start_tax_status text NULL, active_bond_int float8 NULL, end_last_progname text NULL, @@ -3935,4 +3935,10 @@ UNION spots.spot_rate FROM spots) a LEFT JOIN counterparties c ON cp_code=code ; -
\ No newline at end of file + + CREATE OR REPLACE function list_orphaned_cash(p_date date, p_fund fund) +RETURNS TABLE(amount float, port portfolio, strat strategy, account text, currency currency) AS $$ +BEGIN + RETURN Query SELECT sum(vr.endqty) AS amount, vr.port, vr.strat, vr.custacctname AS account, vr.invid::currency AS currency FROM valuation_reports vr + WHERE vr.periodenddate =p_date AND vr.fund=p_fund AND vr.invid IN ('USD', 'EUR') AND vr.port NOT IN ('GFS_HELPER_BUSINESS_UNIT', 'CASH') GROUP BY (vr.port, vr.strat, vr.custacctname, vr.invid) HAVING sum(vr.endqty) !=0; END; +$$ LANGUAGE plpgsql;
\ No newline at end of file |
