Dump - ITSA views

This commit is contained in:
AzureAD\SylvainDUVERNAY
2026-06-14 11:05:54 +02:00
parent 3a3e715336
commit af63a53372
27 changed files with 708 additions and 140 deletions

View File

@@ -1,8 +1,23 @@
CREATE OR REPLACE VIEW public.vw_utility_monthly_trade_ifrs_adjustments AS
WITH books AS (
SELECT adv.id AS "intBookId",
adv.code AS "BookCode",
adv.name AS "BookName",
"right"((adv.name)::text, 4) AS "BookYear"
FROM (analytic_dimension ad
JOIN analytic_dimension_value adv ON ((ad.id = adv.dimension)))
WHERE (((ad.code)::text = 'book'::text) AND ((adv.name)::text !~~ '%Projection%'::text))
)
SELECT apti.id AS "intAdjustmentId",
apti.date AS "dtmAdjustmentDate",
apti.amount AS "dblAmount",
cur.name AS "strCurrency",
apti.comment AS "strComments"
FROM (account_physical_trade_ifrs apti
JOIN currency_currency cur ON ((cur.id = apti.currency)));;
apti.comment AS "strComments",
books."intBookId"
FROM ((account_physical_trade_ifrs apti
JOIN currency_currency cur ON ((cur.id = apti.currency)))
LEFT JOIN books ON ((books."BookYear" = (((EXTRACT(year FROM apti.date))::integer -
CASE
WHEN ((EXTRACT(month FROM apti.date))::integer < 4) THEN 1
ELSE 0
END))::text)));;