Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Null on Null Input | False |
| Schema Bound | False |
| Assembly |
Parameters
| Name | Data Type | Length | Description |
|---|---|---|---|
| @ms_memo_type_id | int | 4 |
SQL Script
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE FUNCTION dbo.vw_ms_supplier_customer_for_memo (@ms_memo_type_id int)
RETURNS TABLE
AS
RETURN
(
SELECT
ms_supplier_customer_id
, supplier_customer_code
, supplier_customer_name
, supplier_customer_address
, supplier_customer_country
, supplier_customer_country_name
, id_nomor
, skep_no
, ms_memo_header_status_id
,sum(case when ms_memo_header_status_id=1 then 1 else 0 end) as memo_ready
,sum(case when ms_memo_header_status_id=0 then 1 else 0 end) as memo_draft
FROM vw_ms_memo_header
WHERE
(used = 0)
AND (ms_memo_type_id = @ms_memo_type_id)
AND (NOT (supplier_customer_code IS NULL OR ms_supplier_customer_id = -1)) AND (NOT (ms_memo_header_status_id = - 1))
group by
ms_supplier_customer_id
, supplier_customer_code
, supplier_customer_name
, supplier_customer_address
, supplier_customer_country
, ms_memo_header_status_id
, supplier_customer_country_name
, id_nomor
, skep_no
);
GO
GO
CREATE FUNCTION dbo.vw_ms_supplier_customer_for_memo (@ms_memo_type_id int)
RETURNS TABLE
AS
RETURN
(
SELECT
ms_supplier_customer_id
, supplier_customer_code
, supplier_customer_name
, supplier_customer_address
, supplier_customer_country
, supplier_customer_country_name
, id_nomor
, skep_no
, ms_memo_header_status_id
,sum(case when ms_memo_header_status_id=1 then 1 else 0 end) as memo_ready
,sum(case when ms_memo_header_status_id=0 then 1 else 0 end) as memo_draft
FROM vw_ms_memo_header
WHERE
(used = 0)
AND (ms_memo_type_id = @ms_memo_type_id)
AND (NOT (supplier_customer_code IS NULL OR ms_supplier_customer_id = -1)) AND (NOT (ms_memo_header_status_id = - 1))
group by
ms_supplier_customer_id
, supplier_customer_code
, supplier_customer_name
, supplier_customer_address
, supplier_customer_country
, ms_memo_header_status_id
, supplier_customer_country_name
, id_nomor
, skep_no
);
GO
Depends On
1Used By
No items found