Skip to content

Commit

Permalink
5906 Added poreference to select
Browse files Browse the repository at this point in the history
  • Loading branch information
cris-nct committed Dec 11, 2019
1 parent dc79597 commit ac9c252
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
Expand Up @@ -7,6 +7,7 @@ RETURNS TABLE
docstatus character(2),
printname character varying(60),
C_Currency_ID numeric,
poreference varchar(60),
displayhu text
)
AS
Expand All @@ -17,6 +18,7 @@ SELECT
o.DocStatus,
dt.PrintName,
o.C_Currency_ID,
poreference,
CASE
WHEN
EXISTS(
Expand Down
@@ -0,0 +1,43 @@
DROP FUNCTION IF EXISTS de_metas_endcustomer_fresh_reports.Docs_Sales_Order_Root(IN record_id numeric, IN ad_language Character Varying (6));

CREATE OR REPLACE FUNCTION de_metas_endcustomer_fresh_reports.Docs_Sales_Order_Root(IN record_id numeric, IN ad_language Character Varying (6))
RETURNS TABLE
(
ad_org_id numeric(10,0),
docstatus character(2),
printname character varying(60),
C_Currency_ID numeric,
poreference varchar(60),
displayhu text
)
AS
$$

SELECT
o.AD_Org_ID,
o.DocStatus,
dt.PrintName,
o.C_Currency_ID,
poreference,
CASE
WHEN
EXISTS(
SELECT 0
FROM C_OrderLine ol
INNER JOIN M_Product p ON ol.M_Product_ID = p.M_Product_ID AND p.isActive = 'Y'
INNER JOIN M_Product_Category pc ON p.M_Product_Category_ID = pc.M_Product_Category_ID AND pc.isActive = 'Y'
WHERE pc.M_Product_Category_ID = getSysConfigAsNumeric('PackingMaterialProductCategoryID', ol.AD_Client_ID, ol.AD_Org_ID)
AND ol.C_Order_ID = o.C_Order_ID AND ol.isActive = 'Y'
)
THEN 'Y'
ELSE 'N'
END as displayhu
FROM
C_Order o
INNER JOIN C_DocType dt ON o.C_DocTypeTarget_ID = dt.C_DocType_ID AND dt.isActive = 'Y'
LEFT OUTER JOIN C_DocType_Trl dtt ON o.C_DocTypeTarget_ID = dtt.C_DocType_ID AND dtt.AD_Language = $2 AND dtt.isActive = 'Y'
WHERE
o.C_Order_ID = $1 AND o.isActive = 'Y'
$$
LANGUAGE sql STABLE
;

0 comments on commit ac9c252

Please sign in to comment.