| Line 28... |
Line 28... |
| 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 >= :dataDate and sn.scannedAt < :lmsEndDate 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 >= :mtd then CAST(sn.quantity * li.unitPrice AS int) else 0 end),"
|
| 35 |
+ " sum(case when sn.scannedAt >= :today then sn.quantity 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 >= :dataDate and sn.scannedAt <= :lmsEndDate 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 >= :mtd 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,"
|
43 |
@NamedQuery(name = "warehouse.selectOurPurchaseItemByBrand", query = "select new com.spice.profitmandi.dao.model.OurPurchaseItemModel(po.warehouseId,li.brand,li.modelName, li.modelNumber, li.color,"
|
| 44 |
+ " sn.quantity * li.unitPrice , sn.quantity)"
|
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 "
|
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 "
|
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"),
|
47 |
+ " where po.warehouseId in :warehouseId and sn.scannedAt >= :startDate and sn.scannedAt < :endDate and sn.type = 'PURCHASE'and li.brand in :brand order by li.itemId desc"),
|
| 48 |
|
48 |
|
| 49 |
@NamedQuery(name = "warehouse.selectTodayOurPurchaseItemByBrand", query = "select new com.spice.profitmandi.dao.model.OurPurchaseItemModel(li.brand,li.modelName, li.modelNumber, li.color,"
|
49 |
@NamedQuery(name = "warehouse.selectTodayOurPurchaseItemByBrand", query = "select new com.spice.profitmandi.dao.model.OurPurchaseItemModel(po.warehouseId,li.brand,li.modelName, li.modelNumber, li.color,"
|
| 50 |
+ " sn.quantity * li.unitPrice , sn.quantity)"
|
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 "
|
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 "
|
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"),
|
53 |
+ " where po.warehouseId in :warehouseId and sn.scannedAt >= :startDate and sn.type = 'PURCHASE'and li.brand in :brand order by li.itemId desc"),
|
| 54 |
|
54 |
|
| 55 |
})
|
55 |
})
|
| 56 |
public class WarehouseScan {
|
56 |
public class WarehouseScan {
|
| 57 |
|
57 |
|
| 58 |
@Id
|
58 |
@Id
|