Subversion Repositories SmartDukaan

Rev

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

Rev 28461 Rev 28468
Line 56... Line 56...
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 and fs.internal = 0 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.selectAllBilledOrderGroupByBrandFofoId", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderBilledLmsModel(li.brand,"
61
		@NamedQuery(name = "Order.selectAllBilledOrderGroupByBrandFofoId", query = "select new com.spice.profitmandi.dao.model.BrandWiseModel(li.brand,"
62
				+ " sum(case when o.billingTimestamp between :lmsStartDate and :lmsEndDate then CAST(o.totalAmount  AS int) else 0 end),"
62
				+ "	DATE_FORMAT(o.billingTimestamp, '%m-%Y'),sum(cast(o.totalAmount As int)))"
63
				+ "	sum(case when o.billingTimestamp between :lmsStartDate and :lmsEndDate then li.quantity else 0 end),"
-
 
64
				+ " sum(case when o.billingTimestamp between :scdStartDate and :scdEndDate then CAST(o.totalAmount  AS int) else 0 end),"
-
 
65
				+ "	sum(case when o.billingTimestamp between :scdStartDate and :scdEndDate then li.quantity else 0 end),"
-
 
66
				+ " sum(case when o.billingTimestamp between  :thirdStartDate and :thirdEndDate  then CAST(o.totalAmount  AS int) else 0 end),"
-
 
67
				+ "	sum(case when o.billingTimestamp between  :thirdStartDate and :thirdEndDate  then li.quantity else 0 end),"
-
 
68
				+ " sum(case when o.billingTimestamp between  :fourthStartDate and :fourthEndDate  then CAST(o.totalAmount  AS int) else 0 end),"
-
 
69
				+ " sum(case when o.billingTimestamp between  :fourthStartDate and :fourthEndDate then li.quantity else 0 end),"
-
 
70
				+ " sum(case when o.billingTimestamp between  :fifthStartDate and :fifthEndDate  then CAST(o.totalAmount  AS int) else 0 end),"
-
 
71
				+ "	sum(case when o.billingTimestamp between  :fifthStartDate and :fifthEndDate then li.quantity else 0 end),"
-
 
72
				+ " sum(case when o.billingTimestamp between  :sixthStartDate and :sixthEndDate  then CAST(o.totalAmount  AS int) else 0 end),"
-
 
73
				+ "	sum(case when o.billingTimestamp between  :sixthStartDate and :sixthEndDate then li.quantity else 0 end)"
-
 
74
				+ " )"
-
 
75
				+ "	 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)"
76
				+ "	and o.billingTimestamp >= :startDate and o.retailerId =:fofoId  group by li.brand"),
64
				+ "	and o.billingTimestamp >= :startDate and o.retailerId =:fofoId  group by li.brand,DATE_FORMAT(o.billingTimestamp, '%m-%Y')"),
77
 
65
 
78
		@NamedQuery(name = "Order.selectAllBilledOrderGroupByBrandWarehouse", query = "select new com.spice.profitmandi.dao.model.SecondaryWarehouseWiseOrderBilllingModel(fs.warehouseId,date(o.billingTimestamp), li.brand, "
66
		@NamedQuery(name = "Order.selectAllBilledOrderGroupByBrandWarehouse", query = "select new com.spice.profitmandi.dao.model.SecondaryWarehouseWiseOrderBilllingModel(fs.warehouseId,date(o.billingTimestamp), li.brand, "
79
				+ "sum(CAST(o.totalAmount  AS int)),sum( li.quantity))"
67
				+ "sum(CAST(o.totalAmount  AS int)),sum( li.quantity))"
80
				+ "	 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)"
68
				+ "	 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)"
81
				+ "	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"),
69
				+ "	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"),