ALTER PROCEDURE [dbo].[PROC_SELECT_SAL_ORDER_BY_LEX]
	@PurchaseOrderNumber varchar(100)
AS
BEGIN
	SELECT t0.FID,t0f.FENTRYID AS FINID,t0e.FENTRYID,t0e.FCPOITEMNO,t0.FHeadPO
		,t0.FDOCUMENTSTATUS,'Y' AS 'DoUnAudit'
	FROM T_SAL_ORDER t0
		INNER JOIN T_SAL_ORDERFIN t0f on t0f.FID = t0.FID
		INNER JOIN T_SAL_ORDERENTRY t0e on t0e.FID = t0.FID
	WHERE t0.FHeadPO = @PurchaseOrderNumber
END