Subversion Repositories SmartDukaan

Rev

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

Rev 10347 Rev 10348
Line 372... Line 372...
372
		where s.type in ('DOA_IN', 'SALE_RET_UNUSABLE','MARKED_BAD') and 
372
		where s.type in ('DOA_IN', 'SALE_RET_UNUSABLE','MARKED_BAD') and 
373
		s.scannedAt < #{date} group by i.itemId ) as x 
373
		s.scannedAt < #{date} group by i.itemId ) as x 
374
		LEFT JOIN 
374
		LEFT JOIN 
375
		(SELECT i.itemId, count(*) as outx FROM scanNew s JOIN inventoryItem i ON
375
		(SELECT i.itemId, count(*) as outx FROM scanNew s JOIN inventoryItem i ON
376
		i.id = s.inventoryItemId JOIN catalog.item c ON i.itemId = c.id WHERE 
376
		i.id = s.inventoryItemId JOIN catalog.item c ON i.itemId = c.id WHERE 
377
		s.type in ('DOA_OUT','MARKED_GOOD') and s.scannedAt < #{date} group by i.itemId) as y 
377
		s.type in ('DOA_OUT','MARKED_GOOD','BAD_SALE') and s.scannedAt < #{date} group by i.itemId) as y 
378
		ON x.itemId = y.itemId 
378
		ON x.itemId = y.itemId 
379
		JOIN catalog.item ci ON ci.id = x.itemId 
379
		JOIN catalog.item ci ON ci.id = x.itemId 
380
	having quantity>0;
380
	having quantity>0;
381
</select>
381
</select>
382
 
382