| Line 149... |
Line 149... |
| 149 |
+ " from FofoStore fs join Order o on fs.id = o.retailerId"
|
149 |
+ " from FofoStore fs join Order o on fs.id = o.retailerId"
|
| 150 |
+ " join LineItem li on o.id = li.orderId " + " join TagListing tl on tl.itemId = li.itemId "
|
150 |
+ " join LineItem li on o.id = li.orderId " + " join TagListing tl on tl.itemId = li.itemId "
|
| 151 |
+ " join Item i on i.id = tl.itemId where "
|
151 |
+ " join Item i on i.id = tl.itemId where "
|
| 152 |
+ " fs.active = 1 and fs.internal = 0 and o.status in (3,4)and i.catalogItemId = :catalogItemId and fs.id = :fofoId group by i.catalogItemId, fs.id"),
|
152 |
+ " fs.active = 1 and fs.internal = 0 and o.status in (3,4)and i.catalogItemId = :catalogItemId and fs.id = :fofoId group by i.catalogItemId, fs.id"),
|
| 153 |
|
153 |
|
| 154 |
@NamedQuery(name = "Order.selectTodayOrders", query = "select new com.spice.profitmandi.dao.model.BrandRegionPOModel(fs.warehouseId, li.brand, "
|
154 |
@NamedQuery(name = "Order.selectTodayOrders", query = "select new com.spice.profitmandi.dao.model.BrandRegionPOModel("
|
| - |
|
155 |
+ " case when (pr.regionId is not null) then pr.regionId else fs.warehouseId end , li.brand, "
|
| 155 |
+ " sum(case when (o.createTimestamp between :startDate and :endDate) then cast(o.totalAmount AS integer ) else 0 end),"
|
156 |
+ " sum(case when (o.createTimestamp between :startDate and :endDate) then cast(o.totalAmount AS integer ) else 0 end),"
|
| 156 |
+ " sum(case when (o.billingTimestamp is not null and (o.createTimestamp between :startDate and :endDate)) then cast(o.totalAmount AS integer) else 0 end),"
|
157 |
+ " sum(case when (o.billingTimestamp is not null and (o.createTimestamp between :startDate and :endDate)) then cast(o.totalAmount AS integer) else 0 end),"
|
| 157 |
+ " sum(case when o.billingTimestamp is not null then cast(o.totalAmount AS integer ) else 0 end))"
|
158 |
+ " sum(case when o.billingTimestamp is not null then cast(o.totalAmount AS integer ) else 0 end))"
|
| 158 |
+ " from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId "
|
159 |
+ " from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId"
|
| - |
|
160 |
+ " left join PartnerRegion pr on pr.fofoId=o.retailerId"
|
| 159 |
+ " where o.refundTimestamp is null and ((o.createTimestamp between :startDate and :endDate) or (o.billingTimestamp between :startDate and :endDate)) and fs.internal = 0 and li.brand not in ('Smartdukaan','Dummy')"
|
161 |
+ " where o.refundTimestamp is null and ((o.createTimestamp between :startDate and :endDate) or (o.billingTimestamp between :startDate and :endDate)) and fs.internal = 0 and li.brand not in ('Smartdukaan','Dummy')"
|
| - |
|
162 |
+ " and pr.regionId=18"
|
| 160 |
+ " group by fs.warehouseId , li.brand"),
|
163 |
+ " group by case when (pr.regionId is not null) then pr.regionId else fs.warehouseId end, li.brand"),
|
| 161 |
|
164 |
|
| 162 |
@NamedQuery(name = "Order.selectAllPendingIndentAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel("
|
165 |
@NamedQuery(name = "Order.selectAllPendingIndentAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel("
|
| 163 |
+ " o.retailerId, SUM(case when c.parentCategoryId = 10011 then CAST(o.totalAmount AS integer) else 0 end), SUM(case when c.parentCategoryId = 14200 then CAST(o.totalAmount AS integer) else 0 end))"
|
166 |
+ " o.retailerId, SUM(case when c.parentCategoryId = 10011 then CAST(o.totalAmount AS integer) else 0 end), SUM(case when c.parentCategoryId = 14200 then CAST(o.totalAmount AS integer) else 0 end))"
|
| 164 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join Category c on c.id = i.categoryId "
|
167 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join Category c on c.id = i.categoryId "
|
| 165 |
+ " where o.retailerId in :fofoIds and o.status in (3,4) and i.categoryId != 10006 group by o.retailerId"),
|
168 |
+ " where o.retailerId in :fofoIds and o.status in (3,4) and i.categoryId != 10006 group by o.retailerId"),
|