| Line 30... |
Line 30... |
| 30 |
@NamedQuery(name = "warehouse.selectOurPurchase", query = "select new com.spice.profitmandi.dao.model.OurPurchaseModel(li.brand, "
|
30 |
@NamedQuery(name = "warehouse.selectOurPurchase", query = "select new com.spice.profitmandi.dao.model.OurPurchaseModel(li.brand, "
|
| 31 |
+ " sum(case when sn.scannedAt >= :today then CAST(sn.quantity * li.unitPrice AS int) else 0 end),"
|
31 |
+ " sum(case when sn.scannedAt >= :today then CAST(sn.quantity * li.unitPrice AS int) else 0 end),"
|
| 32 |
+ " sum(case when sn.scannedAt >= :threedays and sn.scannedAt < :endDate then CAST(sn.quantity * li.unitPrice AS int) else 0 end),"
|
32 |
+ " sum(case when sn.scannedAt >= :threedays and sn.scannedAt < :endDate then CAST(sn.quantity * li.unitPrice AS int) else 0 end),"
|
| 33 |
+ " sum(case when sn.scannedAt >= :fifteendays and sn.scannedAt < :endDate then CAST(sn.quantity * li.unitPrice AS int) else 0 end),"
|
33 |
+ " sum(case when sn.scannedAt >= :fifteendays and sn.scannedAt < :endDate then CAST(sn.quantity * li.unitPrice AS int) else 0 end),"
|
| 34 |
+ " sum(case when sn.scannedAt >= :startDate then CAST(sn.quantity * li.unitPrice AS int) else 0 end),"
|
34 |
+ " sum(case when sn.scannedAt >= :startDate then CAST(sn.quantity * li.unitPrice AS int) else 0 end),"
|
| 35 |
+ " sum(case when sn.scannedAt >= :today then CAST(sn.quantity AS int) else 0 end),"
|
35 |
+ " sum(case when sn.scannedAt >= :today then sn.quantity else 0 end),"
|
| 36 |
+ " sum(case when sn.scannedAt >= :threedays and sn.scannedAt < :endDate then CAST(sn.quantity AS int) else 0 end),"
|
36 |
+ " sum(case when sn.scannedAt >= :threedays and sn.scannedAt < :endDate then CAST(sn.quantity AS int) else 0 end),"
|
| 37 |
+ " sum(case when sn.scannedAt >= :fifteendays and sn.scannedAt < :endDate then CAST(sn.quantity AS int) else 0 end),"
|
37 |
+ " sum(case when sn.scannedAt >= :fifteendays and sn.scannedAt < :endDate then CAST(sn.quantity AS int) else 0 end),"
|
| 38 |
+ " sum(case when sn.scannedAt >= :startDate then CAST(sn.quantity AS int) else 0 end)" + " )"
|
38 |
+ " sum(case when sn.scannedAt >= :startDate then CAST(sn.quantity AS int) else 0 end)" + " )"
|
| 39 |
+ " from WarehouseScan sn join WarehouseInventoryItem it on sn.inventoryItemId = it.id join WarehousePurchase p on it.purchaseId = p.id "
|
39 |
+ " from WarehouseScan sn join WarehouseInventoryItem it on sn.inventoryItemId = it.id join WarehousePurchase p on it.purchaseId = p.id "
|
| 40 |
+ " join WarehousePurchaseOrder po on po.id = p.poId join WarehouseLineItem li on li.purchaseOrderId = po.id "
|
40 |
+ " join WarehousePurchaseOrder po on po.id = p.poId join WarehouseLineItem li on li.purchaseOrderId = po.id "
|