Subversion Repositories SmartDukaan

Rev

Rev 30687 | Rev 30820 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30687 Rev 30689
Line 155... Line 155...
155
				+ " case when (pr.regionId is not null) then pr.regionId else fs.warehouseId end  , li.brand, "
155
				+ " case when (pr.regionId is not null) then pr.regionId else fs.warehouseId end  , li.brand, "
156
				+ " 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),"
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 and (o.createTimestamp between :startDate and :endDate)) 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
				+ " sum(case when o.billingTimestamp is not null then cast(o.totalAmount AS integer ) else 0 end))"
159
				+ "	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"
160
				+ " left join PartnerRegion pr on pr.fofoId=o.retailerId and pr.regionId=18"
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')"
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"
-
 
163
				+ " group by case when (pr.regionId is not null) then pr.regionId else fs.warehouseId end, li.brand"),
162
				+ " group by case when (pr.regionId is not null) then pr.regionId else fs.warehouseId end, li.brand"),
164
 
163
 
165
		@NamedQuery(name = "Order.selectAllPendingIndentAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel("
164
		@NamedQuery(name = "Order.selectAllPendingIndentAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel("
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))"
165
				+ "  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))"
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 "
166
				+ "	 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 "