ALTER PROCEDURE PFILOGENBOMMATCONVERT
(
	@MaterialID VARCHAR(10)
	,@Quantity DECIMAL(18,2)
)	
AS

--DECLARE @MaterialID VARCHAR(10) = '00000048'
--DECLARE @Quantity DECIMAL(18,2) = 2.5

SELECT '' AS [DocNo]
      ,SeqID AS [DocItemID]
      ,'' AS [DocItemRef]
      ,MaterialItemID AS [MaterialID]
      ,'' AS [ItemNumber]
      ,'0' AS [ItemType]
      ,'ISSU' AS [ItemFlow]
      ,[Quantity] *  @Quantity AS Quantity
      ,mat1.[UnitMeasurement]
      ,'' AS [CustSoRef]
      ,'' AS [CustSoItemRef]
      ,'' AS [PORef]
      ,'' AS [POItemRef]
      ,'' AS [DeliveryRef]
      ,'' AS [DeliveryItemRef]
      ,'' AS [QualityInspectionResult]
      ,'' AS [QualityAssuranceResult]
      ,'' AS [Storage]
      ,'' AS [Bin]
      ,'' AS [Startdate]
      ,'' AS [EndDate]
      ,'' AS [Valuation]
      ,'' AS [RefDocTr]
      ,'' AS [RefDocTy]
      ,'' AS [RefDocID]
      ,'' AS [CreateBy]
      ,'' AS [CreateDate]
      ,'' AS [ChangeBy]
      ,'' AS [ChangeDate]
      ,'' AS [Warehouse]
      ,mat1.MaterialType AS [MaterialType]
      ,mat1.[MAP] * @Quantity AS MAP
      ,0 AS [NetPrice]
      ,'' AS [NoLot]
      ,'' AS [UnitConversion]
      ,'' AS [QuantityDua]
      ,mat1.Description AS [MaterialDesc]
      ,0 AS[UnitPrice]
      ,0 AS [QtyReal]
      ,0 AS [QtyAdjust]
      ,'' AS [StockStatus]
      ,'' AS [Notes]
      ,0 AS [DiscountDefect]
      ,0 AS [PriceAmount]
      ,0 AS [Discount]
      ,0 AS [DiscountPercentage]
      ,'' AS [Currency]
      ,0 AS [TotAmount]
      ,0 AS [Tax]
      ,0 AS [NetTax]
      ,0 AS [NetAmount]
      ,0 AS [BiayaJasa]
      ,0 AS [TaxPPh23]
      ,mat1.ProductGroup AS [ProductGroup] 
FROM PMDMAT0006 AS mat6
LEFT JOIN PMDMAT0001 AS mat1
	ON mat1.MaterialID = mat6.MaterialID
WHERE  mat6.MaterialID = @MaterialID