| Line 54... |
Line 54... |
| 54 |
+ " sum(case when concat(year(o.billingTimestamp), month(o.billingTimestamp))= :mtd then li.quantity else 0 end),"
|
54 |
+ " sum(case when concat(year(o.billingTimestamp), month(o.billingTimestamp))= :mtd then li.quantity else 0 end),"
|
| 55 |
+ " sum(case when o.billingTimestamp between :lmtdStartDate and :lmtdEndDate then li.quantity else 0 end),"
|
55 |
+ " sum(case when o.billingTimestamp between :lmtdStartDate and :lmtdEndDate then li.quantity else 0 end),"
|
| 56 |
+ " sum(case when o.billingTimestamp between :lmtdStartDate and :lmsEndDate then li.quantity else 0 end)"
|
56 |
+ " sum(case when o.billingTimestamp between :lmtdStartDate and :lmsEndDate then li.quantity else 0 end)"
|
| 57 |
+ " )"
|
57 |
+ " )"
|
| 58 |
+ " from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
|
58 |
+ " from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
|
| 59 |
+ " and o.billingTimestamp >= :lmtdStartDate and fs.warehouseId in :warehouseId group by li.brand"),
|
59 |
+ " and o.billingTimestamp >= :lmtdStartDate and fs.warehouseId in :warehouseId and fs.internal = 0 group by li.brand"),
|
| 60 |
|
60 |
|
| 61 |
@NamedQuery(name = "Order.selectAllBilledOrderGroupByBrandWarehouse", query = "select new com.spice.profitmandi.dao.model.SecondaryWarehouseWiseOrderBilllingModel(fs.warehouseId,date(o.billingTimestamp), li.brand, "
|
61 |
@NamedQuery(name = "Order.selectAllBilledOrderGroupByBrandWarehouse", query = "select new com.spice.profitmandi.dao.model.SecondaryWarehouseWiseOrderBilllingModel(fs.warehouseId,date(o.billingTimestamp), li.brand, "
|
| 62 |
+ "sum(CAST(o.totalAmount AS int)),sum( li.quantity))"
|
62 |
+ "sum(CAST(o.totalAmount AS int)),sum( li.quantity))"
|
| 63 |
+ " from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
|
63 |
+ " from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
|
| 64 |
+ " and o.billingTimestamp >= :startDate and o.billingTimestamp < :endDate and (null is :brand or li.brand = :brand) group by fs.warehouseId, date(o.billingTimestamp), li.brand"),
|
64 |
+ " and o.billingTimestamp >= :startDate and o.billingTimestamp < :endDate and (null is :brand or li.brand = :brand) and fs.internal = 0 group by fs.warehouseId, date(o.billingTimestamp), li.brand"),
|
| 65 |
|
65 |
|
| 66 |
@NamedQuery(name = "Order.selectAllBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(o.retailerName,li.brand,i.modelName, "
|
66 |
@NamedQuery(name = "Order.selectAllBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(o.retailerName,li.brand,i.modelName, "
|
| 67 |
+ " i.modelNumber, i.color," + "o.totalAmount," + " li.quantity)"
|
67 |
+ " i.modelNumber, i.color," + "o.totalAmount," + " li.quantity)"
|
| 68 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
|
68 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
|
| 69 |
+ " and date(o.billingTimestamp) in :date and fs.warehouseId in :warehouseId and li.brand = :brand order by li.itemId desc"),
|
69 |
+ " and date(o.billingTimestamp) in :date and fs.warehouseId in :warehouseId and li.brand = :brand and fs.internal = 0 order by li.itemId desc"),
|
| 70 |
|
70 |
|
| 71 |
@NamedQuery(name = "Order.selectTodayBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(o.retailerName,li.brand,i.modelName, "
|
71 |
@NamedQuery(name = "Order.selectTodayBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(o.retailerName,li.brand,i.modelName, "
|
| 72 |
+ " i.modelNumber, i.color," + "o.totalAmount," + " li.quantity)"
|
72 |
+ " i.modelNumber, i.color," + "o.totalAmount," + " li.quantity)"
|
| 73 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
|
73 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
|
| 74 |
+ " and o.billingTimestamp >= :startDate and fs.warehouseId in :warehouseId and li.brand in :brand order by li.itemId desc"),
|
74 |
+ " and o.billingTimestamp >= :startDate and fs.warehouseId in :warehouseId and li.brand in :brand order by li.itemId desc"),
|