| Line 226... |
Line 226... |
| 226 |
ci.model_number as modelNumber, ci.color as color, (x.inx-if(y.outx is null,0,y.outx)) as quantity
|
226 |
ci.model_number as modelNumber, ci.color as color, (x.inx-if(y.outx is null,0,y.outx)) as quantity
|
| 227 |
from
|
227 |
from
|
| 228 |
(select i.itemId, sum(quantity) as inx from scanNew s
|
228 |
(select i.itemId, sum(quantity) as inx from scanNew s
|
| 229 |
JOIN inventoryItem i ON (i.id = s.inventoryItemId)
|
229 |
JOIN inventoryItem i ON (i.id = s.inventoryItemId)
|
| 230 |
JOIN catalog.item c ON i.itemId = c.id
|
230 |
JOIN catalog.item c ON i.itemId = c.id
|
| - |
|
231 |
JOIN inventory.warehouse w ON w.id = s.warehouseId
|
| 231 |
where s.type in ('PURCHASE','SALE_RET', 'MARKED_GOOD','WAREHOUSE_TRANSFER_IN') and c.type = 'NON_SERIALIZED'
|
232 |
where s.type in ('PURCHASE','SALE_RET', 'MARKED_GOOD','WAREHOUSE_TRANSFER_IN') and c.type = 'NON_SERIALIZED'
|
| 232 |
and i.physicalWarehouseId = #{physicalWarehouseId}
|
233 |
and w.billingWarehouseId = #{physicalWarehouseId}
|
| 233 |
group by i.itemId ) as x
|
234 |
group by i.itemId ) as x
|
| 234 |
LEFT JOIN
|
235 |
LEFT JOIN
|
| 235 |
(select i.itemId, sum(quantity) as outx from scanNew s
|
236 |
(select i.itemId, sum(quantity) as outx from scanNew s
|
| 236 |
JOIN inventoryItem i on i.id = s.inventoryItemId
|
237 |
JOIN inventoryItem i on i.id = s.inventoryItemId
|
| 237 |
JOIN catalog.item c ON i.itemId = c.id
|
238 |
JOIN catalog.item c ON i.itemId = c.id
|
| - |
|
239 |
JOIN inventory.warehouse w ON w.id = s.warehouseId
|
| 238 |
where s.type in ('SALE','LOST_IN_WAREHOUSE','PURCHASE_RETURN','MARKED_USED','MARKED_BAD','WAREHOUSE_TRANSFER_OUT') and c.type = 'NON_SERIALIZED'
|
240 |
where s.type in ('SALE','LOST_IN_WAREHOUSE','PURCHASE_RETURN','MARKED_USED','MARKED_BAD','WAREHOUSE_TRANSFER_OUT') and c.type = 'NON_SERIALIZED'
|
| 239 |
and i.physicalWarehouseId = #{physicalWarehouseId}
|
241 |
and w.billingWarehouseId = #{physicalWarehouseId}
|
| 240 |
group by i.itemId) as y
|
242 |
group by i.itemId) as y
|
| 241 |
ON x.itemId = y.itemId
|
243 |
ON x.itemId = y.itemId
|
| 242 |
JOIN catalog.item ci ON ci.id = x.itemId
|
244 |
JOIN catalog.item ci ON ci.id = x.itemId
|
| 243 |
where ci.type = 'NON_SERIALIZED' having quantity>0
|
245 |
where ci.type = 'NON_SERIALIZED' having quantity>0
|
| 244 |
</select>
|
246 |
</select>
|