Subversion Repositories SmartDukaan

Rev

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

Rev 7802 Rev 7838
Line 117... Line 117...
117
        SUM((age >= 1) * unitPrice) as onePlusCost,
117
        SUM((age >= 1) * unitPrice) as onePlusCost,
118
        SUM(currentQuantity) as zeroPlusCount,
118
        SUM(currentQuantity) as zeroPlusCount,
119
        SUM(l.unitPrice) as zeroPlusCost,
119
        SUM(l.unitPrice) as zeroPlusCost,
120
        l.productGroup as category
120
        l.productGroup as category
121
    FROM  (SELECT ii.id, ii.itemId, ii.currentQuantity, ii.purchaseId,
121
    FROM  (SELECT ii.id, ii.itemId, ii.currentQuantity, ii.purchaseId,
122
                DATEDIFF(now(), MAX(s.scannedAt)) / 7 as age
122
                DATEDIFF(now(), MIN(s.scannedAt)) / 7 as age
123
           FROM inventoryItem ii 
123
           FROM inventoryItem ii 
124
           JOIN scanNew s 
124
           JOIN scanNew s 
125
                ON (s.inventoryItemId = ii.id) 
125
                ON (s.inventoryItemId = ii.id) 
126
           WHERE ii.lastScanType IN ('PURCHASE', 'SALE_RET') 
126
           WHERE ii.lastScanType IN ('PURCHASE', 'SALE_RET') 
127
           AND ii.physicalWarehouseId !=16
127
           AND ii.physicalWarehouseId !=16