| Line 43... |
Line 43... |
| 43 |
|
43 |
|
| 44 |
@NamedQuery(name = "Order.selectItemIdTypeQuantity", query = "select new com.spice.profitmandi.dao.model.ItemIdTypeQuantity(li.itemId, i.type, li.quantity) from Order o join LineItem li on li.orderId = o.id join Item i on i.id = li.itemId where o.invoiceNumber = :invoiceNumber and o.retailerId = :retailerId"),
|
44 |
@NamedQuery(name = "Order.selectItemIdTypeQuantity", query = "select new com.spice.profitmandi.dao.model.ItemIdTypeQuantity(li.itemId, i.type, li.quantity) from Order o join LineItem li on li.orderId = o.id join Item i on i.id = li.itemId where o.invoiceNumber = :invoiceNumber and o.retailerId = :retailerId"),
|
| 45 |
|
45 |
|
| 46 |
@NamedQuery(name = "Order.selectAllBilledOrderGroupByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderBillingModel(li.brand, "
|
46 |
@NamedQuery(name = "Order.selectAllBilledOrderGroupByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderBillingModel(li.brand, "
|
| 47 |
+ "sum(case when o.billingTimestamp >= :today then CAST(o.totalAmount AS int) else 0 end),"
|
47 |
+ "sum(case when o.billingTimestamp >= :today then CAST(o.totalAmount AS int) else 0 end),"
|
| 48 |
+ "sum(case when o.billingTimestamp >= :threedays and o.billingTimestamp <= :endDate then CAST(o.totalAmount AS int) else 0 end),"
|
48 |
+ "sum(case when o.billingTimestamp >= :threedays and o.billingTimestamp < :endDate then CAST(o.totalAmount AS int) else 0 end),"
|
| 49 |
+ "sum(case when concat(year(o.billingTimestamp ), month(o.billingTimestamp ))= :mtd then CAST(o.totalAmount AS int) else 0 end),"
|
49 |
+ "sum(case when concat(year(o.billingTimestamp ), month(o.billingTimestamp ))= :mtd then CAST(o.totalAmount AS int) else 0 end),"
|
| 50 |
+ "sum(case when o.billingTimestamp between :lmtdStartDate and :lmtdEndDate then CAST(o.totalAmount AS int) else 0 end),"
|
50 |
+ "sum(case when o.billingTimestamp between :lmtdStartDate and :lmtdEndDate then CAST(o.totalAmount AS int) else 0 end),"
|
| - |
|
51 |
+ "sum(case when o.billingTimestamp between :lmtdStartDate and :lmsEndDate then CAST(o.totalAmount AS int) else 0 end),"
|
| 51 |
+ " sum(case when o.billingTimestamp >= :today then li.quantity else 0 end),"
|
52 |
+ " sum(case when o.billingTimestamp >= :today then li.quantity else 0 end),"
|
| 52 |
+ " sum(case when o.billingTimestamp >= :threedays and o.billingTimestamp < :endDate then li.quantity else 0 end),"
|
53 |
+ " sum(case when o.billingTimestamp >= :threedays and o.billingTimestamp < :endDate then li.quantity else 0 end),"
|
| 53 |
+ " 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),"
|
| 54 |
+ " 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)"
|
| - |
|
57 |
+ " )"
|
| 55 |
+ " from Order o join LineItem li on o.id = li.orderId where o.billingTimestamp is not null and o.refundTimestamp is null"
|
58 |
+ " from Order o join LineItem li on o.id = li.orderId where o.billingTimestamp is not null and o.refundTimestamp is null"
|
| 56 |
+ " and o.billingTimestamp >= :lmtdStartDate and o.warehouseId in :warehouseId group by li.brand"),
|
59 |
+ " and o.billingTimestamp >= :lmtdStartDate and o.warehouseId in :warehouseId group by li.brand"),
|
| 57 |
|
60 |
|
| 58 |
@NamedQuery(name = "Order.selectAllBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(li.brand,i.modelName, "
|
61 |
@NamedQuery(name = "Order.selectAllBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(o.retailerName,li.brand,i.modelName, "
|
| 59 |
+ " i.modelNumber, i.color," + "o.totalAmount," + " li.quantity)"
|
62 |
+ " i.modelNumber, i.color," + "o.totalAmount," + " li.quantity)"
|
| 60 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId where o.billingTimestamp is not null and o.refundTimestamp is null"
|
63 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId where o.billingTimestamp is not null and o.refundTimestamp is null"
|
| 61 |
+ " and o.billingTimestamp >= :startDate and o.billingTimestamp < :endDate and o.warehouseId in :warehouseId and li.brand = :brand"),
|
64 |
+ " and o.billingTimestamp >= :startDate and o.billingTimestamp < :endDate and o.warehouseId in :warehouseId and li.brand in :brand order by li.itemId desc"),
|
| 62 |
|
65 |
|
| 63 |
@NamedQuery(name = "Order.selectTodayBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(li.brand,i.modelName, "
|
66 |
@NamedQuery(name = "Order.selectTodayBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(o.retailerName,li.brand,i.modelName, "
|
| 64 |
+ " i.modelNumber, i.color," + "o.totalAmount," + " li.quantity)"
|
67 |
+ " i.modelNumber, i.color," + "o.totalAmount," + " li.quantity)"
|
| 65 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId where o.billingTimestamp is not null and o.refundTimestamp is null"
|
68 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId where o.billingTimestamp is not null and o.refundTimestamp is null"
|
| 66 |
+ " and o.billingTimestamp >= :startDate and o.warehouseId in :warehouseId and li.brand = :brand")
|
69 |
+ " and o.billingTimestamp >= :startDate and o.warehouseId in :warehouseId and li.brand in :brand order by li.itemId desc")
|
| 67 |
|
70 |
|
| 68 |
})
|
71 |
})
|
| 69 |
public class Order implements Serializable {
|
72 |
public class Order implements Serializable {
|
| 70 |
|
73 |
|
| 71 |
private static final long serialVersionUID = 1L;
|
74 |
private static final long serialVersionUID = 1L;
|