avg price

This commit is contained in:
venbatechnologies@gmail.com 2018-12-29 14:50:00 +05:30
parent 52d7c6d166
commit ba5e00e503

View File

@ -1376,7 +1376,7 @@ $subquery="SELECT
DISTINCT(p.MaterialCode) AS ProductID,Ref_No,Date(CreatedOn),mm.MaterialName,stock,MaterialType,Category,stockdate,mm.Category,ip.product_name,ip.product_id,
SUM(IF(p.Transaction_type='Add',p.Quantity,0)) AS Addition,
SUM(IF(p.Transaction_type='Reduce',p.Quantity,0)) AS Reduce,
SUM((IF(p.Transaction_type='Add',p.Quantity,0))-(IF(p.Transaction_type='Reduce',p.Quantity,0))) AS AvailableStock,ROUND(AVG(Rate)) as Avg_rate
SUM((IF(p.Transaction_type='Add',p.Quantity,0))-(IF(p.Transaction_type='Reduce',p.Quantity,0))) AS AvailableStock,ROUND(AVG(Rate),2) as Avg_rate
FROM
T_Material_stock_history AS p
left join T_MaterialMaster mm on mm.MaterialCode = p.MaterialCode