Subversion Repositories SmartDukaan

Rev

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

Rev 27556 Rev 27574
Line 26... Line 26...
26
@Table(name = "fofo.fofo_store", schema = "fofo")
26
@Table(name = "fofo.fofo_store", schema = "fofo")
27
 
27
 
28
@NamedQueries({
28
@NamedQueries({
29
 
29
 
30
		@NamedQuery(name = "FofoStore.selectGroupByWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWisePartnerSaleModel(fs.warehouseId,"
30
		@NamedQuery(name = "FofoStore.selectGroupByWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWisePartnerSaleModel(fs.warehouseId,"
31
				+ "sum(case when month(foi.createTimestamp) = month(now())-1 then CAST(foi.mop  AS int) else 0 end),"
31
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :lms then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
32
				+ "sum(case when month(foi.createTimestamp) = month(now())-1 then foi.quantity  else 0 end),"
32
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :lms then foi.quantity  else 0 end),"
33
				+ "sum(case when month(foi.createTimestamp) = month(now()) then CAST(foi.mop  AS int) else 0 end),"
33
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
34
				+ "sum(case when month(foi.createTimestamp) = month(now()) then foi.quantity  else 0 end))"
34
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then foi.quantity else 0 end), "
-
 
35
				+ "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate  then CAST(foi.quantity*foi.mop  AS int) else 0 end), "
-
 
36
				+ "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate then foi.quantity else 0 end))"
35
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId  where fo.cancelledTimestamp is null and fs.active = true"
37
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId  where fo.cancelledTimestamp is null and fs.active = true"
36
				+ " group by fs.warehouseId"),
38
				+ " and foi.createTimestamp >= :lmtdStartDate" + " group by fs.warehouseId"),
37
 
39
 
38
		@NamedQuery(name = "FofoStore.selectGroupByBrandWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel(i.brand, "
40
		@NamedQuery(name = "FofoStore.selectGroupByBrandWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel(i.brand, "
39
				+ "sum(case when month(foi.createTimestamp) = month(now())-1 then CAST(foi.mop  AS int) else 0 end),"
41
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :lms then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
40
				+ "sum(case when month(foi.createTimestamp) = month(now())-1 then foi.quantity  else 0 end),"
42
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :lms then foi.quantity  else 0 end),"
41
				+ "sum(case when month(foi.createTimestamp) = month(now()) then CAST(foi.mop  AS int) else 0 end),"
43
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
42
				+ "sum(case when month(foi.createTimestamp) = month(now()) then foi.quantity  else 0 end))"
44
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then foi.quantity else 0 end), "
-
 
45
				+ "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate  then CAST(foi.quantity*foi.mop  AS int) else 0 end), "
-
 
46
				+ "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate then foi.quantity else 0 end))"
43
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId  where fo.cancelledTimestamp is null and fs.active = true and "
47
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId  where fo.cancelledTimestamp is null and fs.active = true "
-
 
48
				+ "and foi.createTimestamp >= :lmtdStartDate and "
44
				+ " :warehouseId IS NULL OR fs.warehouseId = :warehouseId" + " group by i.brand"),
49
				+ " :warehouseId IS NULL OR fs.warehouseId = :warehouseId" + " group by i.brand"),
45
 
50
 
46
		@NamedQuery(name = "FofoStore.selectWarehouseBrandItemSale", query = "select new com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel(fs.warehouseId, i.brand, i.modelName, i.modelNumber,i.color,"
51
		@NamedQuery(name = "FofoStore.selectWarehouseBrandItemSale", query = "select new com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel(fs.warehouseId, i.brand, i.modelName, i.modelNumber,i.color,"
47
				+ "case when month(foi.createTimestamp) = month(now())-1 then foi.mop else 0 end,"
52
				+ "case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :lms then  CAST(foi.quantity * foi.mop  AS int) else 0 end, "
48
				+ "case when month(foi.createTimestamp) = month(now())-1 then foi.quantity  else 0 end,"
53
				+ "case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :lms then foi.quantity  else 0 end, "
-
 
54
				+ "case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then CAST(foi.quantity * foi.mop  AS int)  else 0 end, "
49
				+ "case when month(foi.createTimestamp) = month(now()) then foi.mop   else 0 end,"
55
				+ "case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then foi.quantity else 0 end, "
-
 
56
				+ "case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate  then CAST(foi.quantity * foi.mop  AS int) else 0 end, "
50
				+ "case when month(foi.createTimestamp) = month(now()) then foi.quantity  else 0 end)"
57
				+ "case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate then foi.quantity else 0 end)"
51
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId  where fo.cancelledTimestamp is null and fs.active = true"
58
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId  where fo.cancelledTimestamp is null and fs.active = true"
52
				+ " and fs.warehouseId in :warehouseId and i.brand = :brand"),
59
				+ " and  foi.createTimestamp >= :lmtdStartDate and fs.warehouseId in :warehouseId and i.brand = :brand"),
53
 
60
 
54
})
61
})
55
public class FofoStore implements Serializable {
62
public class FofoStore implements Serializable {
56
 
63
 
57
	private static final long serialVersionUID = 1L;
64
	private static final long serialVersionUID = 1L;