| Line 38... |
Line 38... |
| 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 li.itemId = it.itemId "
|
40 |
+ " join WarehousePurchaseOrder po on po.id = p.poId join WarehouseLineItem li on li.purchaseOrderId = po.id and li.itemId = it.itemId "
|
| 41 |
+ " where po.warehouseId in :warehouseId and sn.scannedAt >= :dataDate and sn.type = 'PURCHASE' group by li.brand"),
|
41 |
+ " where po.warehouseId in :warehouseId and sn.scannedAt >= :dataDate and sn.type = 'PURCHASE' group by li.brand"),
|
| 42 |
|
42 |
|
| - |
|
43 |
@NamedQuery(name = "warehouse.selectOurPurchaseItemByBrand", query = "select new com.spice.profitmandi.dao.model.OurPurchaseItemModel(li.brand,li.modelName, li.modelNumber, li.color,"
|
| - |
|
44 |
+ " sn.quantity * li.unitPrice , sn.quantity)"
|
| - |
|
45 |
+ " from WarehouseScan sn join WarehouseInventoryItem it on sn.inventoryItemId = it.id join WarehousePurchase p on it.purchaseId = p.id "
|
| - |
|
46 |
+ " join WarehousePurchaseOrder po on po.id = p.poId join WarehouseLineItem li on li.purchaseOrderId = po.id and li.itemId = it.itemId "
|
| - |
|
47 |
+ " where po.warehouseId in :warehouseId and sn.scannedAt >= :startDate and sn.scannedAt < :endDate and sn.type = 'PURCHASE'and li.brand = :brand"),
|
| - |
|
48 |
|
| - |
|
49 |
@NamedQuery(name = "warehouse.selectTodayOurPurchaseItemByBrand", query = "select new com.spice.profitmandi.dao.model.OurPurchaseItemModel(li.brand,li.modelName, li.modelNumber, li.color,"
|
| - |
|
50 |
+ " sn.quantity * li.unitPrice , sn.quantity)"
|
| - |
|
51 |
+ " from WarehouseScan sn join WarehouseInventoryItem it on sn.inventoryItemId = it.id join WarehousePurchase p on it.purchaseId = p.id "
|
| - |
|
52 |
+ " join WarehousePurchaseOrder po on po.id = p.poId join WarehouseLineItem li on li.purchaseOrderId = po.id and li.itemId = it.itemId "
|
| - |
|
53 |
+ " where po.warehouseId in :warehouseId and sn.scannedAt >= :startDate and sn.type = 'PURCHASE'and li.brand = :brand"),
|
| - |
|
54 |
|
| 43 |
})
|
55 |
})
|
| 44 |
public class WarehouseScan {
|
56 |
public class WarehouseScan {
|
| 45 |
|
57 |
|
| 46 |
@Id
|
58 |
@Id
|
| 47 |
@Column(name = "id", unique = true, updatable = false)
|
59 |
@Column(name = "id", unique = true, updatable = false)
|