Syteline Material Transaction Report
做Syteline System维护,用户特多要求,今天需要为用户修改一个Material Transaction Report. 具体实现如下,可以参考:
代码
CREATE PROCEDURE [dbo].[usp_SyteLine_GetMaterialTransactionsReport]
(
@ConditionExpression nvarchar(3000)
)
AS
DECLARE @sql nvarchar(4000) = 'SELECT mt.[trans_num] AS [Trans Number] ,mt.[trans_date] AS [Trans Date],mt.[item] AS [Item],i.[description] AS [Description],mt.[qty] AS [Quantity],i.[u_m] AS [U/M],mt.[cost] AS [Cost],mt.[reason_code] AS [Reason Code]
FROM [dbo].[matltran] mt
LEFT JOIN [dbo].[item] i ON (mt.[item] = i.[item])'
IF LEN(@ConditionExpression) > 0
SELECT @sql += ' WHERE ' + @ConditionExpression
EXECUTE(@sql)
(
@ConditionExpression nvarchar(3000)
)
AS
DECLARE @sql nvarchar(4000) = 'SELECT mt.[trans_num] AS [Trans Number] ,mt.[trans_date] AS [Trans Date],mt.[item] AS [Item],i.[description] AS [Description],mt.[qty] AS [Quantity],i.[u_m] AS [U/M],mt.[cost] AS [Cost],mt.[reason_code] AS [Reason Code]
FROM [dbo].[matltran] mt
LEFT JOIN [dbo].[item] i ON (mt.[item] = i.[item])'
IF LEN(@ConditionExpression) > 0
SELECT @sql += ' WHERE ' + @ConditionExpression
EXECUTE(@sql)