| Line 27... |
Line 27... |
| 27 |
@Entity
|
27 |
@Entity
|
| 28 |
@Table(name = "warehouse.scanNew", schema = "warehouse")
|
28 |
@Table(name = "warehouse.scanNew", schema = "warehouse")
|
| 29 |
@NamedQueries({
|
29 |
@NamedQueries({
|
| 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 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),"
|
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 and po.warehouseId in :warehouseId where sn.scannedAt >= :dataDate group by li.brand"),
|
40 |
+ " join WarehousePurchaseOrder po on po.id = p.poId join WarehouseLineItem li on li.purchaseOrderId = po.id and po.warehouseId in :warehouseId where sn.scannedAt >= :dataDate group by li.brand"),
|
| 41 |
|
41 |
|
| 42 |
})
|
42 |
})
|