Subversion Repositories SmartDukaan

Rev

Rev 13529 | Rev 15045 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13529 Rev 14691
Line 391... Line 391...
391
	group by i.itemId,i.purchaseId) as x 
391
	group by i.itemId,i.purchaseId) as x 
392
	LEFT OUTER JOIN (SELECT it.id, ct.label, it.product_group,it.brand, it.model_name,it.model_number,
392
	LEFT OUTER JOIN (SELECT it.id, ct.label, it.product_group,it.brand, it.model_name,it.model_number,
393
	it.color, sum(s.quantity) as quantity, i.physicalWarehouseId, i.purchaseId 
393
	it.color, sum(s.quantity) as quantity, i.physicalWarehouseId, i.purchaseId 
394
	FROM scanNew s JOIN inventoryItem i on s.inventoryItemId = i.id JOIN purchase p on i.purchaseId= p.id 
394
	FROM scanNew s JOIN inventoryItem i on s.inventoryItemId = i.id JOIN purchase p on i.purchaseId= p.id 
395
	JOIN catalog.item it on i.itemId= it.id JOIN catalog.category ct on it.category = ct.id 
395
	JOIN catalog.item it on i.itemId= it.id JOIN catalog.category ct on it.category = ct.id 
396
	WHERE s.type in ('DOA_OUT','BAD_SALE','MARKED_GOOD','BAD_PURCHASE_RETURN') 
396
	WHERE s.type in ('DOA_OUT','BAD_SALE','MARKED_GOOD','BAD_PURCHASE_RETURN','LOST_IN_WAREHOUSE_BAD') 
397
	AND s.scannedAt > '2013-01-01' AND s.scannedAt < #{date} 
397
	AND s.scannedAt > '2013-01-01' AND s.scannedAt < #{date} 
398
	AND i.physicalWarehouseId NOT IN (select id from inventory.warehouse where vendor_id= 40 and inventoryType = 'GOOD' and warehouseType ='OURS_THIRDPARTY' and source in (3,7,8)) 
398
	AND i.physicalWarehouseId NOT IN (select id from inventory.warehouse where vendor_id= 40 and inventoryType = 'GOOD' and warehouseType ='OURS_THIRDPARTY' and source in (3,7,8)) 
399
	group by i.itemId,i.purchaseId) as y 
399
	group by i.itemId,i.purchaseId) as y 
400
	on x.id=y.id AND x.purchaseId=y.purchaseId 
400
	on x.id=y.id AND x.purchaseId=y.purchaseId 
401
	group by x.id,x.purchaseId having Bad_quantity>0) 
401
	group by x.id,x.purchaseId having Bad_quantity>0)