Commit all views for ITSA
This commit is contained in:
20
Database Backups/SQL Views/vw_utility_invoice_lines.sql
Normal file
20
Database Backups/SQL Views/vw_utility_invoice_lines.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
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);;
|
||||
Reference in New Issue
Block a user