| Line 63... |
Line 63... |
| 63 |
</select>
|
63 |
</select>
|
| 64 |
|
64 |
|
| 65 |
<select id="getInventoryAge" resultType="inventoryAge">
|
65 |
<select id="getInventoryAge" resultType="inventoryAge">
|
| 66 |
SELECT t.itemId, brand, modelName, modelNumber, color,
|
66 |
SELECT t.itemId, brand, modelName, modelNumber, color,
|
| 67 |
SUM((age < 1) * currentQuantity) AS freshCount,
|
67 |
SUM((age < 1) * currentQuantity) AS freshCount,
|
| 68 |
SUM((age between 1 and 2) * currentQuantity) AS oneToTwoCount,
|
68 |
SUM((age >= 1 and age < 2) * currentQuantity) AS oneToTwoCount,
|
| 69 |
SUM((age between 2 and 3) * currentQuantity) AS twoToThreeCount,
|
69 |
SUM((age >= 2 and age < 3) * currentQuantity) AS twoToThreeCount,
|
| 70 |
SUM((age between 3 and 4) * currentQuantity) AS threeToFourCount,
|
70 |
SUM((age >= 3 and age < 4) * currentQuantity) AS threeToFourCount,
|
| 71 |
SUM((age > 4) * currentQuantity) as fourPlusCount
|
71 |
SUM((age >= 4) * currentQuantity) as fourPlusCount,
|
| - |
|
72 |
SUM((age >= 1) * currentQuantity) as onePlusCount,
|
| - |
|
73 |
SUM((age >= 1) * unitPrice) as onePlusCost,
|
| - |
|
74 |
SUM(currentQuantity) as zeroPlusCount,
|
| - |
|
75 |
SUM(l.unitPrice) as zeroPlusCost,
|
| - |
|
76 |
l.productGroup as category
|
| 72 |
FROM (SELECT ii.id, ii.itemId, ii.currentQuantity, ii.purchaseId,
|
77 |
FROM (SELECT ii.id, ii.itemId, ii.currentQuantity, ii.purchaseId,
|
| 73 |
DATEDIFF(now(), MAX(s.scannedAt)) / 7 as age
|
78 |
DATEDIFF(now(), MAX(s.scannedAt)) / 7 as age
|
| 74 |
FROM inventoryItem ii
|
79 |
FROM inventoryItem ii
|
| 75 |
JOIN scanNew s
|
80 |
JOIN scanNew s
|
| 76 |
ON (s.inventoryItemId = ii.id)
|
81 |
ON (s.inventoryItemId = ii.id)
|