19 lines
686 B
SQL
19 lines
686 B
SQL
CREATE OR REPLACE VIEW public.vw_utility_premium_composition AS
|
|
SELECT pc.line AS "intContractLineId",
|
|
'Purchase'::text AS "strContractType",
|
|
pf.name AS "strPremiumType",
|
|
pc.premium AS "dblPremiumAmount",
|
|
pc.reference AS "strReference"
|
|
FROM (premium_composition pc
|
|
JOIN price_fixtype pf ON ((pc.type = pf.id)))
|
|
WHERE (pc.line IS NOT NULL)
|
|
UNION ALL
|
|
SELECT pc.sale_line AS "intContractLineId",
|
|
'Sale'::text AS "strContractType",
|
|
pf.name AS "strPremiumType",
|
|
pc.premium AS "dblPremiumAmount",
|
|
pc.reference AS "strReference"
|
|
FROM (premium_composition pc
|
|
JOIN price_fixtype pf ON ((pc.type = pf.id)))
|
|
WHERE (pc.sale_line IS NOT NULL);;
|