no message

This commit is contained in:
AzureAD\SylvainDUVERNAY
2026-02-02 13:15:58 +01:00
parent 022f4e0a2a
commit 7f99b78c8a
16 changed files with 1031 additions and 69 deletions

View File

@@ -0,0 +1,27 @@
-- View: public.vw_utility_invoice_lines
-- DROP VIEW public.vw_utility_invoice_lines;
CREATE OR REPLACE VIEW public.vw_utility_invoice_lines AS
SELECT ail.invoice AS "intInvoiceId",
ail.id AS "intInvoiceLineId",
ail.lot AS "intLotId",
CASE
WHEN COALESCE(split_part(ail.origin::text, ','::text, 1), ''::text) = 'purchase.line'::text THEN 'Purchase'::text
WHEN COALESCE(split_part(ail.origin::text, ','::text, 1), ''::text) = 'sale.line'::text THEN 'Sale'::text
ELSE ''::text
END AS "strContractType",
COALESCE(split_part(ail.origin::text, ','::text, 2)::integer, 0) AS "intContractLineId",
ail.quantity AS "dblQuantity",
pu.name AS "strQuantityUom",
cc.name AS "strCurrencyCode",
ail.unit_price AS "dblUnitPrice",
round((ail.quantity * ail.unit_price::double precision)::numeric, get_rounding_position(cc.rounding)) AS "dblLineTotal"
FROM account_invoice_line ail
JOIN account_invoice ai ON ail.invoice = ai.id
JOIN currency_currency cc ON ai.currency = cc.id
JOIN product_uom pu ON ail.unit = pu.id
WHERE 1 = 1;
ALTER TABLE public.vw_utility_invoice_lines
OWNER TO postgres;