Subversion Repositories SmartDukaan

Rev

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

Rev 31903 Rev 32071
Line 11... Line 11...
11
 
11
 
12
@Entity
12
@Entity
13
@Table(name = "fofo.scheme_in_out")
13
@Table(name = "fofo.scheme_in_out")
14
 
14
 
15
@NamedQueries({
15
@NamedQueries({
16
		@NamedQuery(name = "SchemeInOut.selectPendingActivationGroupByBrandYearMonth", query = "select new com.spice.profitmandi.dao.model.ActivationYearMonthModel(i.brand, "
16
        @NamedQuery(name = "SchemeInOut.selectPendingActivationGroupByBrandYearMonth", query = "select new com.spice.profitmandi.dao.model.ActivationYearMonthModel(i.brand, "
17
				+ "   DATE_FORMAT(sio.createTimestamp, '%m-%Y'),sum(cast(sio.amount As integer )) ) from Scheme sc join  SchemeInOut sio  on"
17
                + "   DATE_FORMAT(sio.createTimestamp, '%m-%Y'),sum(cast(sio.amount As integer )) ) from Scheme sc join  SchemeInOut sio  on"
18
				+ " sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
18
                + " sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
19
				+ " join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and sio.createTimestamp >= :startDate and ii.fofoId = :fofoId  "
19
                + " join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and sio.createTimestamp >= :startDate and ii.fofoId = :fofoId  "
20
				+ "  group by i.brand, DATE_FORMAT(sio.createTimestamp, '%m-%Y')"),
20
                + "  group by i.brand, DATE_FORMAT(sio.createTimestamp, '%m-%Y')"),
21
 
21
 
22
		@NamedQuery(name = "SchemeInOut.selectByYearMonthActivationGroupByBrand", query = "select new com.spice.profitmandi.dao.model.ActivationBrandModel(i.brand, "
22
        @NamedQuery(name = "SchemeInOut.selectByYearMonthActivationGroupByBrand", query = "select new com.spice.profitmandi.dao.model.ActivationBrandModel(i.brand, "
23
				+ "  sum(cast(sio.amount As integer )) ) from Scheme sc join  SchemeInOut sio  on"
23
                + "  sum(cast(sio.amount As integer )) ) from Scheme sc join  SchemeInOut sio  on"
24
				+ " sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
24
                + " sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
25
				+ " join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and sio.createTimestamp <= :endDate and ii.fofoId = :fofoId  "
25
                + " join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and sio.createTimestamp <= :endDate and ii.fofoId = :fofoId  "
26
				+ "  group by i.brand"),
26
                + "  group by i.brand"),
27
 
27
 
28
		@NamedQuery(name = "SchemeInOut.selectBrandPendingActivationItemDetails", query = "select new com.spice.profitmandi.dao.model.ActivationItemDetailModel(i.brand, "
28
        @NamedQuery(name = "SchemeInOut.selectBrandPendingActivationItemDetails", query = "select new com.spice.profitmandi.dao.model.ActivationItemDetailModel(i.brand, "
29
				+ "  i.modelName,i.modelNumber,cast(sio.amount As integer ),ii.serialNumber, ii.id) from Scheme sc join SchemeInOut sio  on"
29
                + "  i.modelName,i.modelNumber,cast(sio.amount As integer ),ii.serialNumber, ii.id) from Scheme sc join SchemeInOut sio  on"
30
				+ "	 sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
30
                + "	 sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
31
				+ "	 join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and "
31
                + "	 join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and "
32
				+ "  ii.fofoId = :fofoId and i.brand = :brand and  DATE_FORMAT(sio.createTimestamp, '%m-%Y') = :yearMonthValue"),
32
                + "  ii.fofoId = :fofoId and i.brand = :brand and  DATE_FORMAT(sio.createTimestamp, '%m-%Y') = :yearMonthValue"),
33
 
33
 
34
		@NamedQuery(name = "SchemeInOut.selectBrandPendingActivationItemDetailByYearMonth", query = "select new com.spice.profitmandi.dao.model.ActivationItemDetailModel(i.brand, "
34
        @NamedQuery(name = "SchemeInOut.selectBrandPendingActivationItemDetailByYearMonth", query = "select new com.spice.profitmandi.dao.model.ActivationItemDetailModel(i.brand, "
35
				+ "  i.modelName,i.modelNumber,cast(sio.amount As integer ),ii.serialNumber, ii.id) from Scheme sc join SchemeInOut sio  on"
35
                + "  i.modelName,i.modelNumber,cast(sio.amount As integer ),ii.serialNumber, ii.id) from Scheme sc join SchemeInOut sio  on"
36
				+ "	 sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
36
                + "	 sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
37
				+ "	 join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and "
37
                + "	 join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and "
38
				+ "  ii.fofoId = :fofoId and i.brand = :brand and sio.createTimestamp <= :endDate"),
38
                + "  ii.fofoId = :fofoId and i.brand = :brand and sio.createTimestamp <= :endDate"),
39
 
39
 
40
 
40
 
41
		@NamedQuery(name = "SchemeInOut.selectAllPurchaseInventoryByFofoId", query = "select new com.spice.profitmandi.dao.model.AllPurchaseInventoryModel(sum(cast(sio.amount As int ))) from InventoryItem ii join SchemeInOut sio on"
41
        @NamedQuery(name = "SchemeInOut.selectAllPurchaseInventoryByFofoId", query = "select new com.spice.profitmandi.dao.model.AllPurchaseInventoryModel(sum(cast(sio.amount As int ))) from InventoryItem ii join SchemeInOut sio on"
42
				+ "  sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId  where sc.type= 'IN' and ii.fofoId = :fofoId and ii.createTimestamp >= :startDate and "
42
                + "  sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId  where sc.type= 'IN' and ii.fofoId = :fofoId and ii.createTimestamp >= :startDate and "
43
				+ "  ii.createTimestamp <= :endDate and ii.fofoId = :fofoId group by ii.fofoId"),
43
                + "  ii.createTimestamp <= :endDate and ii.fofoId = :fofoId group by ii.fofoId"),
44
 
44
 
45
		@NamedQuery(name = "SchemeInOut.selectAllCreditedSaleInventoryByFofoId", query = "select new com.spice.profitmandi.dao.model.AllPurchaseInventoryModel(sum(cast(sio.amount As int ))) from "
45
        @NamedQuery(name = "SchemeInOut.selectAllCreditedSaleInventoryByFofoId", query = "select new com.spice.profitmandi.dao.model.AllPurchaseInventoryModel(sum(cast(sio.amount As int ))) from "
46
				+ "  ScanRecord sr join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on  sio.inventoryItemId=sr.inventoryItemId join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and "
46
                + "  ScanRecord sr join InventoryItem  ii on ii.id=sr.inventoryItemId join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on (sio.inventoryItemId=sr.inventoryItemId) join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and "
47
				+ "  sio.status='CREDITED' and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId group by sr.fofoId"),
47
                + "  sio.status='CREDITED' and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId group by sr.fofoId"),
48
 
48
 
49
		@NamedQuery(name = "SchemeInOut.selectFrontIncomeByFofoId", query = "select new com.spice.profitmandi.dao.model.AllPurchaseInventoryModel(sum(cast(foi.sellingPrice As int )-cast(foi.dp As int ))) "
49
        @NamedQuery(name = "SchemeInOut.selectFrontIncomeByFofoId", query = "select new com.spice.profitmandi.dao.model.AllPurchaseInventoryModel(sum(cast(foi.sellingPrice As int )-cast(foi.dp As int ))) "
50
				+ " from InventoryItem ii join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on foi.orderId=fo.id where "
50
                + " from InventoryItem ii join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on (foi.orderId=fo.id and foi.itemId=ii.itemId) where "
51
				+ " fo.cancelledTimestamp is null and sr.type='SALE' and sr.createTimestamp >=:startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId group by sr.fofoId"),
51
                + " fo.cancelledTimestamp is null and sr.type='SALE' and sr.createTimestamp >=:startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId group by sr.fofoId"),
52
 
52
 
53
		@NamedQuery(name = "SchemeInOut.selectAllPendingSaleInventoryByFofoId", query = "select new com.spice.profitmandi.dao.model.AllPurchaseInventoryModel(sum(cast(sio.amount As int ))) from "
53
        @NamedQuery(name = "SchemeInOut.selectAllPendingSaleInventoryByFofoId", query = "select new com.spice.profitmandi.dao.model.AllPurchaseInventoryModel(sum(cast(sio.amount As int ))) from "
54
				+ "  ScanRecord sr join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on  sio.inventoryItemId=sr.inventoryItemId  where  fo.cancelledTimestamp is null and "
54
                + "  ScanRecord sr join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on  sio.inventoryItemId=sr.inventoryItemId  where  fo.cancelledTimestamp is null and "
55
				+ "  sio.status='PENDING' and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp < :endDate and sr.fofoId = :fofoId group by sr.fofoId"),
55
                + "  sio.status='PENDING' and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp < :endDate and sr.fofoId = :fofoId group by sr.fofoId"),
56
 
56
 
57
		@NamedQuery(name = "SchemeInOut.selectLastMonthCreditedIncomeByFofoId", query = "select new com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel(foi.brand,sum(cast(foi.quantity As int)), sum(cast(sio.amount As int))) from ScanRecord sr "
57
        @NamedQuery(name = "SchemeInOut.selectLastMonthCreditedIncomeByFofoId", query = "select new com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel(foi.brand,sum(cast(foi.quantity As int)), sum(cast(sio.amount As int))) from ScanRecord sr "
58
				+ " join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on foi.orderId=fo.id join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and "
58
                + " join InventoryItem  ii on ii.id=sr.inventoryItemId join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on (foi.orderId=fo.id and foi.itemId=ii.itemId) join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and "
59
				+ "sio.status='CREDITED' and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp < :endDate and sr.fofoId = :fofoId group by foi.brand"),
59
                + "sio.status='CREDITED' and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp < :endDate and sr.fofoId = :fofoId group by foi.brand"),
60
 
60
 
61
		@NamedQuery(name = "SchemeInOut.selectFrontIncomeByBrand", query = "select new com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel(foi.brand,sum(cast(foi.quantity As int)), sum(cast(foi.sellingPrice As int )-cast(foi.dp As int ))) "
61
        @NamedQuery(name = "SchemeInOut.selectFrontIncomeByBrand", query = "select new com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel(foi.brand,sum(cast(foi.quantity As int)), sum(cast(foi.sellingPrice As int )-cast(foi.dp As int ))) "
62
				+ " from InventoryItem ii join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on foi.orderId=fo.id where "
62
                + " from InventoryItem ii join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on (foi.orderId=fo.id and foi.itemId = ii.itemId) where "
63
				+ " fo.cancelledTimestamp is null and sr.type='SALE' and sr.createTimestamp >=:startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId group by foi.brand"),
63
                + " fo.cancelledTimestamp is null and sr.type='SALE' and sr.createTimestamp >=:startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId group by foi.brand"),
64
 
64
 
65
		@NamedQuery(name = "SchemeInOut.selectLastMonthPendingIncomeByFofoId", query = "select new com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel(foi.brand,sum(cast(foi.quantity As int)),sum(cast(sio.amount As int ))) from "
65
        @NamedQuery(name = "SchemeInOut.selectLastMonthPendingIncomeByFofoId", query = "select new com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel(foi.brand,sum(cast(foi.quantity As int)),sum(cast(sio.amount As int ))) from "
66
				+ "  ScanRecord sr join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on  sio.inventoryItemId=sr.inventoryItemId  join FofoOrderItem foi on  foi.orderId=fo.id where  fo.cancelledTimestamp is null and "
66
                + "  ScanRecord sr join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on  sio.inventoryItemId=sr.inventoryItemId  join FofoOrderItem foi on  foi.orderId=fo.id where  fo.cancelledTimestamp is null and "
67
				+ "  sio.status='PENDING' and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp < :endDate and sr.fofoId = :fofoId group by foi.brand"),
67
                + "  sio.status='PENDING' and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp < :endDate and sr.fofoId = :fofoId group by foi.brand"),
68
 
68
 
69
		@NamedQuery(name = "SchemeInOut.selectLastMonthPurchaseInMarginByFofoId", query = "select new com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel(i.brand, count(distinct ii.id ),sum(cast(sio.amount As int ))) from InventoryItem ii join SchemeInOut sio on"
69
        @NamedQuery(name = "SchemeInOut.selectLastMonthPurchaseInMarginByFofoId", query = "select new com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel(i.brand, count(distinct ii.id ),sum(cast(sio.amount As int ))) from InventoryItem ii join SchemeInOut sio on"
70
				+ "  sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId join Item i on i.id=ii.itemId where sio.status='CREDITED' and sc.type= 'IN' and ii.fofoId = :fofoId and ii.createTimestamp >= :startDate and "
70
                + "  sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId join Item i on i.id=ii.itemId where sio.status='CREDITED' and sc.type= 'IN' and ii.fofoId = :fofoId and ii.createTimestamp >= :startDate and "
71
				+ "  ii.createTimestamp <= :endDate group by i.brand"),
71
                + "  ii.createTimestamp <= :endDate group by i.brand"),
72
 
72
 
73
 
73
 
74
		@NamedQuery(name = "SchemeInOut.selectLastMonthBrandWiseIncome", query = "select new com.spice.profitmandi.dao.model.LastMonthBrandWiseIncomeModel(" +
74
        @NamedQuery(name = "SchemeInOut.selectLastMonthBrandWiseIncome", query = "select new com.spice.profitmandi.dao.model.LastMonthBrandWiseIncomeModel(" +
75
				" i.brand,sum(case when sio.status = 'CREDITED' then cast(foi.quantity As int) else 0 end)," +
75
                " i.brand,sum(case when sio.status = 'CREDITED' then cast(foi.quantity As int) else 0 end)," +
76
				" sum(case when sio.status = 'CREDITED' then cast(sio.amount As float) else  0 end)," +
76
                " sum(case when sio.status = 'CREDITED' then cast(sio.amount As float) else  0 end)," +
77
				" sum(case when sio.status = 'PENDING' then cast(sio.amount As float) else  0 end)," +
77
                " sum(case when sio.status = 'PENDING' then cast(sio.amount As float) else  0 end)," +
78
				"i.catalogItemId,i.modelName,i.modelNumber) from ScanRecord sr "
78
                "i.catalogItemId,i.modelName,i.modelNumber) from ScanRecord sr join InventoryItem ii on ii.id=sr.inventoryItemId "
79
				+ "  join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on foi.orderId=fo.id  join FofoLineItem  fli on fli.fofoOrderItemId=foi.id  join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and "
79
                + "  join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on (foi.orderId=fo.id and ii.itemId=foi.itemId)  join FofoLineItem  fli on fli.fofoOrderItemId=foi.id  join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and "
80
				+ "  (sio.status='CREDITED' or sio.status='PENDING') and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId  and foi.brand = :brand group by i.catalogItemId,i.modelName,i.modelNumber,i.brand"),
80
                + "  (sio.status='CREDITED' or sio.status='PENDING') and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId  and foi.brand = :brand group by i.catalogItemId,i.modelName,i.modelNumber,i.brand"),
81
 
81
 
82
		@NamedQuery(name = "SchemeInOut.selectFrontIncomeBrandWise", query = "select new com.spice.profitmandi.dao.model.LastMonthFrontEndBrandWiseIncome(i.brand,sum(cast(foi.quantity As int)),sum(cast(foi.sellingPrice -foi.dp As float)),0.0,i.catalogItemId,i.modelName,i.modelNumber) "
82
        @NamedQuery(name = "SchemeInOut.selectFrontIncomeBrandWise", query = "select new com.spice.profitmandi.dao.model.LastMonthFrontEndBrandWiseIncome(i.brand,sum(cast(foi.quantity As int)),sum(cast(foi.sellingPrice -foi.dp As float)),0.0,i.catalogItemId,i.modelName,i.modelNumber) "
83
				+ " from InventoryItem ii join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on foi.orderId=fo.id join Item i on foi.itemId=i.id where "
83
                + " from InventoryItem ii join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on (foi.orderId=fo.id and foi.itemId=ii.itemId) join Item i on foi.itemId=i.id where "
84
				+ " fo.cancelledTimestamp is null and sr.type='SALE' and sr.createTimestamp >=:startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId and foi.brand = :brand group by i.catalogItemId,i.modelName,i.modelNumber,i.brand"),
84
                + " fo.cancelledTimestamp is null and sr.type='SALE' and sr.createTimestamp >=:startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId and foi.brand = :brand group by i.catalogItemId,i.modelName,i.modelNumber,i.brand"),
85
 
85
 
86
		@NamedQuery(name = "SchemeInOut.selectLastMonthPurchaseBrandWiseIncome", query = "select new com.spice.profitmandi.dao.model.LastMonthBrandWiseIncomeModel( " +
86
        @NamedQuery(name = "SchemeInOut.selectLastMonthPurchaseBrandWiseIncome", query = "select new com.spice.profitmandi.dao.model.LastMonthBrandWiseIncomeModel( " +
87
				"i.brand ,count(distinct ii.id),sum(cast(sio.amount As float)) ,0.0,i.catalogItemId,i.modelName,i.modelNumber) from"
87
                "i.brand ,count(distinct ii.id),sum(cast(sio.amount As float)) ,0.0,i.catalogItemId,i.modelName,i.modelNumber) from"
88
				+ " InventoryItem ii join SchemeInOut sio on sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId " +
88
                + " InventoryItem ii join SchemeInOut sio on sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId " +
89
				" join Item i on i.id=ii.itemId where sio.status='CREDITED' and "
89
                " join Item i on i.id=ii.itemId where sio.status='CREDITED' and "
90
				+ "  sc.type= 'IN' and ii.fofoId = :fofoId and i.brand= :brand and ii.createTimestamp >= :startDate and " +
90
                + "  sc.type= 'IN' and ii.fofoId = :fofoId and i.brand= :brand and ii.createTimestamp >= :startDate and " +
91
				" ii.createTimestamp <= :endDate group by i.catalogItemId,i.modelName,i.modelNumber,i.brand"),
91
                " ii.createTimestamp <= :endDate group by i.catalogItemId,i.modelName,i.modelNumber,i.brand"),
92
 
92
 
93
 
93
 
94
		@NamedQuery(name = "SchemeInOut.selectLastMonthCreditedImei", query = "select new com.spice.profitmandi.dao.model.LastMonthImeiModel(fli.serialNumber,(case when sio.status='CREDITED' then sio.amount else 0 end),(case when sio.status='PENDING' then sio.amount else 0 end),sc.description,sr.createTimestamp,sio.status)from ScanRecord sr "
94
        @NamedQuery(name = "SchemeInOut.selectLastMonthCreditedImei", query = "select new com.spice.profitmandi.dao.model.LastMonthImeiModel(fli.serialNumber,(case when sio.status='CREDITED' then sio.amount else 0 end),(case when sio.status='PENDING' then sio.amount else 0 end),sc.description,sr.createTimestamp,sio.status)" +
95
				+ "      join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on foi.orderId=fo.id  join FofoLineItem  fli on fli.fofoOrderItemId=foi.id "
95
                " from ScanRecord sr join InventoryItem ii on ii.id=sr.inventoryItemId "
96
				+ "      join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and (sio.status='CREDITED' or sio.status='PENDING' ) and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and "
96
                + "      join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on (foi.orderId=fo.id and foi.itemId=ii.itemId)  join FofoLineItem  fli on fli.fofoOrderItemId=foi.id "
97
				+ "      i.catalogItemId= :catalogItemId and sr.fofoId = :fofoId"),
97
                + "      join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and (sio.status='CREDITED' or sio.status='PENDING' ) and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and "
98
 
98
                + "      i.catalogItemId= :catalogItemId and sr.fofoId = :fofoId"),
99
		@NamedQuery(name = "SchemeInOut.selectLastMonthPurchaseInImei", query = "select new com.spice.profitmandi.dao.model.LastMonthImeiModel(ii.serialNumber,sio.amount,cast(0.0 As float),sc.description,ii.createTimestamp,sio.status) from InventoryItem ii "
99
 
100
				+ "     join SchemeInOut sio on sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId join Item i on i.id=ii.itemId where sio.status='CREDITED' and sc.type= 'IN' and ii.fofoId = :fofoId and "
100
        @NamedQuery(name = "SchemeInOut.selectLastMonthPurchaseInImei", query = "select new com.spice.profitmandi.dao.model.LastMonthImeiModel(ii.serialNumber,sio.amount,cast(0.0 As float),sc.description,ii.createTimestamp,sio.status) from InventoryItem ii "
101
				+ "     i.catalogItemId= :catalogItemId and ii.createTimestamp >= :startDate and ii.createTimestamp <= :endDate"),
101
                + "     join SchemeInOut sio on sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId join Item i on i.id=ii.itemId where sio.status='CREDITED' and sc.type= 'IN' and ii.fofoId = :fofoId and "
102
 
102
                + "     i.catalogItemId= :catalogItemId and ii.createTimestamp >= :startDate and ii.createTimestamp <= :endDate"),
103
 
103
 
104
		@NamedQuery(name = "SchemeInOut.selectLastMonthFrontEndImei", query = "select new com.spice.profitmandi.dao.model.LastMonthFrontEndImeiModel( ii.serialNumber,foi.sellingPrice, foi.dp) from InventoryItem ii "
104
 
105
				+ "      join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on foi.orderId=fo.id join Item i on foi.itemId=i.id where "
105
        @NamedQuery(name = "SchemeInOut.selectLastMonthFrontEndImei", query = "select new com.spice.profitmandi.dao.model.LastMonthFrontEndImeiModel( ii.serialNumber,foi.sellingPrice, foi.dp) from InventoryItem ii "
106
				+ "     fo.cancelledTimestamp is null and sr.type='SALE' and i.catalogItemId= :catalogItemId and sr.createTimestamp >=:startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId "
106
                + "      join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on (foi.orderId=fo.id and foi.itemId=ii.itemId) join Item i on foi.itemId=i.id where "
107
				+ "     group by ii.id"),
107
                + "     fo.cancelledTimestamp is null and sr.type='SALE' and i.catalogItemId= :catalogItemId and sr.createTimestamp >=:startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId "
108
 
108
                + "     group by ii.id"),
109
		@NamedQuery(name = "SchemeInOut.selectLastMonthCreditedByImei", query = "select new com.spice.profitmandi.dao.model.LastMonthImeiModel(fli.serialNumber,(case when sio.status='CREDITED' then sio.amount else 0 end),(case when sio.status='PENDING' then sio.amount else 0 end),sc.description,sr.createTimestamp,sio.status)from ScanRecord sr "
109
 
110
				+ "      join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on foi.orderId=fo.id  join FofoLineItem  fli on fli.fofoOrderItemId=foi.id "
110
        @NamedQuery(name = "SchemeInOut.selectLastMonthCreditedByImei", query = "select new com.spice.profitmandi.dao.model.LastMonthImeiModel(fli.serialNumber,(case when sio.status='CREDITED' then sio.amount else 0 end),(case when sio.status='PENDING' then sio.amount else 0 end),sc.description,sr.createTimestamp,sio.status)from ScanRecord sr "
111
				+ "      join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and (sio.status='CREDITED' or sio.status='PENDING') and sr.type='SALE' and "
111
                + "      join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on foi.orderId=fo.id  join FofoLineItem  fli on fli.fofoOrderItemId=foi.id "
112
				+ "      fli.serialNumber in :imeis and sr.fofoId = :fofoId"),
112
                + "      join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where   sc.type != 'IN' and fo.cancelledTimestamp is null and (sio.status='CREDITED' or sio.status='PENDING') and sr.type='SALE' and "
113
 
113
                + "      fli.serialNumber in :imeis and sr.fofoId = :fofoId"),
114
		@NamedQuery(name = "SchemeInOut.selectLastMonthPurchaseInByImei", query = "select new com.spice.profitmandi.dao.model.LastMonthImeiModel(ii.serialNumber,sio.amount, cast(0.0 As float) ,sc.description,ii.createTimestamp,sio.status) from InventoryItem ii "
114
 
115
				+ "     join SchemeInOut sio on sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId join Item i on i.id=ii.itemId where sio.status='CREDITED' and sc.type= 'IN' and ii.fofoId = :fofoId and "
115
        @NamedQuery(name = "SchemeInOut.selectLastMonthPurchaseInByImei", query = "select new com.spice.profitmandi.dao.model.LastMonthImeiModel(ii.serialNumber,sio.amount, cast(0.0 As float) ,sc.description,ii.createTimestamp,sio.status) from InventoryItem ii "
116
				+ "     ii.serialNumber in :imeis"),
116
                + "     join SchemeInOut sio on sio.inventoryItemId=ii.id join Scheme sc on sc.id=sio.schemeId join Item i on i.id=ii.itemId where sio.status='CREDITED' and sc.type= 'IN' and ii.fofoId = :fofoId and "
117
 
117
                + "     ii.serialNumber in :imeis"),
118
		@NamedQuery(name = "SchemeInOut.selectLastMonthFrontEndByImei", query = "select new com.spice.profitmandi.dao.model.LastMonthFrontEndImeiModel( ii.serialNumber,foi.sellingPrice, foi.dp) from InventoryItem ii "
118
 
119
				+ "      join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on foi.orderId=fo.id join Item i on foi.itemId=i.id where "
119
        @NamedQuery(name = "SchemeInOut.selectLastMonthFrontEndByImei", query = "select new com.spice.profitmandi.dao.model.LastMonthFrontEndImeiModel( ii.serialNumber,foi.sellingPrice, foi.dp) from InventoryItem ii "
120
				+ "     fo.cancelledTimestamp is null and sr.type='SALE' and ii.serialNumber in (:imeis) and sr.fofoId = :fofoId  group by ii.id"),
120
                + "      join ScanRecord sr on sr.inventoryItemId=ii.id join FofoOrder fo on fo.id=sr.orderId join FofoOrderItem foi on (foi.orderId=fo.id and ii.itemId=foi.itemId) where "
121
 
121
                + "     fo.cancelledTimestamp is null and sr.type='SALE' and ii.serialNumber in (:imeis) and sr.fofoId = :fofoId  group by ii.id"),
122
 
122
 
123
		@NamedQuery(name = "SchemeInOut.selectLastMonthCategoryUpgradeMarginByBrand", query = "select new com.spice.profitmandi.dao.model.LastMonthCategoryUpgradeMargin(foi.brand, sum(case when sio.status='REJECTED' then -sio.amount else sio.amount end) ) from ScanRecord sr "
123
 
124
				+ " join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on foi.orderId=fo.id join Scheme sc on sc.id=sio.schemeId   where   sc.type = 'CATEGORY' and fo.cancelledTimestamp is null "
124
        @NamedQuery(name = "SchemeInOut.selectLastMonthCategoryUpgradeMarginByBrand", query = "select new com.spice.profitmandi.dao.model.LastMonthCategoryUpgradeMargin(foi.brand, sum(case when sio.status='REJECTED' then -sio.amount else sio.amount end) ) " +
125
				+ "  and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId group by foi.brand"),
125
                " from ScanRecord sr join InventoryItem ii on ii.id=sr.inventoryItemId "
126
 
126
                + " join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on (foi.orderId=fo.id and foi.itemId=ii.itemId) join Scheme sc on sc.id=sio.schemeId   where   sc.type = 'CATEGORY' and fo.cancelledTimestamp is null "
127
		@NamedQuery(name = "SchemeInOut.selectLastMonthCategoryUpgradeMarginByBrandModel", query = "select new com.spice.profitmandi.dao.model.LastMonthCategoryUpgradeMargin(i.modelNumber,sum(case when sio.status='REJECTED' then -sio.amount else sio.amount end)) from ScanRecord sr "
127
                + "  and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId group by foi.brand"),
128
				+ " join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on foi.orderId=fo.id  join FofoLineItem  fli on fli.fofoOrderItemId=foi.id  join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where   sc.type = 'CATEGORY' and fo.cancelledTimestamp is null and "
128
 
129
				+ " sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId  and foi.brand = :brand group by i.catalogItemId,i.modelName,i.modelNumber,i.brand"),
129
        @NamedQuery(name = "SchemeInOut.selectLastMonthCategoryUpgradeMarginByBrandModel", query = "select new com.spice.profitmandi.dao.model.LastMonthCategoryUpgradeMargin(i.modelNumber,sum(case when sio.status='REJECTED' then -sio.amount else sio.amount end)) " +
130
 
130
                " from ScanRecord sr join InventoryItem ii on ii.id=sr.inventoryItemId "
131
		@NamedQuery(name = "SchemeInOut.selectLastMonthCategoryUpgradeMarginByImei", query = "select new com.spice.profitmandi.dao.model.LastMonthCategoryUpgradeMargin(fli.serialNumber,sum(case when sio.status='REJECTED' then -sio.amount else sio.amount end) ) from ScanRecord sr "
131
                + " join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on (foi.orderId=fo.id and foi.itemId=ii.itemId) join FofoLineItem  fli on fli.fofoOrderItemId=foi.id  join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where   sc.type = 'CATEGORY' and fo.cancelledTimestamp is null and "
132
				+ "      join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on foi.orderId=fo.id  join FofoLineItem  fli on fli.fofoOrderItemId=foi.id "
132
                + " sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId  and foi.brand = :brand group by i.catalogItemId,i.modelName,i.modelNumber,i.brand"),
133
				+ "      join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where sc.type = 'CATEGORY' and fo.cancelledTimestamp is null and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and "
133
 
134
				+ "      i.catalogItemId= :catalogItemId and sr.fofoId = :fofoId group by fli.serialNumber"),
134
        @NamedQuery(name = "SchemeInOut.selectLastMonthCategoryUpgradeMarginByImei", query = "select new com.spice.profitmandi.dao.model.LastMonthCategoryUpgradeMargin(fli.serialNumber,sum(case when sio.status='REJECTED' then -sio.amount else sio.amount end) ) from " +
135
 
135
                " ScanRecord sr join InventoryItem ii on ii.id=sr.inventoryItemId "
136
 
136
                + "      join FofoOrder fo on fo.id=sr.orderId join SchemeInOut sio on sio.inventoryItemId=sr.inventoryItemId join FofoOrderItem foi on (foi.orderId=fo.id and foi.itemId=ii.itemId)  join FofoLineItem  fli on fli.fofoOrderItemId=foi.id "
137
		@NamedQuery(name = "SchemeInOut.selectPaidMargins", query = "select new com.spice.profitmandi.service.transaction.InventoryMarginModel("
137
                + "      join  Item i on i.id=foi.itemId join Scheme sc on sc.id=sio.schemeId   where sc.type = 'CATEGORY' and fo.cancelledTimestamp is null and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and "
138
				+ " ii.fofoId, ii.sgstRate, ii.cgstRate, ii.igstRate," +
138
                + "      i.catalogItemId= :catalogItemId and sr.fofoId = :fofoId group by fli.serialNumber"),
139
				" cast(case when sio.creditTimestamp between :startDate and :endDate and sio.rolledBackTimestamp is null or sio.rolledBackTimestamp not between :startDate and :endDate then sio.amount " +
139
 
140
				" 			when sio.creditTimestamp between :startDate and :endDate and sio.rolledBackTimestamp between :startDate and :endDate then 0" +
140
 
141
				"			when sio.creditTimestamp is not null and sio.rolledBackTimestamp between :startDate and :endDate then -sio.amount" +
141
        @NamedQuery(name = "SchemeInOut.selectPaidMargins", query = "select new com.spice.profitmandi.service.transaction.InventoryMarginModel("
142
				"			else 0 end as float), ii.serialNumber, s.name, p.purchaseReference, " +
142
                + " ii.fofoId, ii.sgstRate, ii.cgstRate, ii.igstRate," +
143
				" case when sio.rolledBackTimestamp between :startDate and :endDate then sio.rolledBackTimestamp else sio.creditTimestamp end)  from "
143
                " cast(case when sio.creditTimestamp between :startDate and :endDate and sio.rolledBackTimestamp is null or sio.rolledBackTimestamp not between :startDate and :endDate then sio.amount " +
144
				+ " SchemeInOut sio join Scheme s on s.id=sio.schemeId join InventoryItem ii on sio.inventoryItemId=ii.id join com.spice.profitmandi.dao.entity.fofo.Purchase p on p.id=ii.purchaseId"
144
                " 			when sio.creditTimestamp between :startDate and :endDate and sio.rolledBackTimestamp between :startDate and :endDate then 0" +
145
				+ " where sio.createTimestamp >= :cnDate and ((sio.creditTimestamp between :startDate and :endDate) or (sio.creditTimestamp is not null and sio.rolledBackTimestamp between :startDate and :endDate))")
145
                "			when sio.creditTimestamp is not null and sio.rolledBackTimestamp between :startDate and :endDate then -sio.amount" +
-
 
146
                "			else 0 end as float), ii.serialNumber, s.name, p.purchaseReference, " +
-
 
147
                " case when sio.rolledBackTimestamp between :startDate and :endDate then sio.rolledBackTimestamp else sio.creditTimestamp end)  from "
-
 
148
                + " SchemeInOut sio join Scheme s on s.id=sio.schemeId join InventoryItem ii on sio.inventoryItemId=ii.id join com.spice.profitmandi.dao.entity.fofo.Purchase p on p.id=ii.purchaseId"
-
 
149
                + " where sio.createTimestamp >= :cnDate and ((sio.creditTimestamp between :startDate and :endDate) or (sio.creditTimestamp is not null and sio.rolledBackTimestamp between :startDate and :endDate))")
146
})
150
})
147
public class SchemeInOut implements Serializable {
151
public class SchemeInOut implements Serializable {
148
 
152
 
149
	public SchemeInOut(int schemeId, int inventoryItemId) {
153
    private static final long serialVersionUID = 1L;
150
		this.schemeId = schemeId;
154
    @Id
151
		this.inventoryItemId = inventoryItemId;
155
    @GeneratedValue(strategy = GenerationType.IDENTITY)
152
	}
156
    private int id;
153
 
157
    @Column(name = "scheme_id")
154
	public SchemeInOut() {
158
    private int schemeId;
155
	}
159
    @Column(name = "inventory_item_id")
156
 
160
    private int inventoryItemId;
157
	private static final long serialVersionUID = 1L;
161
    @Column(name = "amount")
158
 
162
    private float amount;
159
	@Id
163
    @Column(name = "status")
160
	@GeneratedValue(strategy = GenerationType.IDENTITY)
164
    @Enumerated(EnumType.STRING)
161
	private int id;
165
    private SchemePayoutStatus status;
162
 
166
    @Column(name = "create_timestamp")
163
	@Column(name = "scheme_id")
167
    private LocalDateTime createTimestamp = LocalDateTime.now();
164
	private int schemeId;
168
    @Column(name = "rolled_back_timestamp")
165
 
169
    private LocalDateTime rolledBackTimestamp;
166
	@Column(name = "inventory_item_id")
170
    @Column(name = "credit_timestamp")
167
	private int inventoryItemId;
171
    private LocalDateTime creditTimestamp;
168
 
172
    @Column(name = "description")
169
	@Column(name = "amount")
173
    private String statusDescription;
170
	private float amount;
174
    @Transient
171
 
175
    private int reference;
172
	@Column(name = "status")
176
    @Transient
173
	@Enumerated(EnumType.STRING)
177
    private String serialNumber;
174
	private SchemePayoutStatus status;
178
    @Transient
175
 
179
    private String storeCode;
176
	@Column(name = "create_timestamp")
180
    @Transient
177
	private LocalDateTime createTimestamp = LocalDateTime.now();
181
    private SchemeType schemeType;
178
 
182
    @Transient
179
	@Column(name = "rolled_back_timestamp")
183
    private Scheme scheme;
180
	private LocalDateTime rolledBackTimestamp;
184
 
181
 
185
    public SchemeInOut(int schemeId, int inventoryItemId) {
182
	@Column(name = "credit_timestamp")
186
        this.schemeId = schemeId;
183
	private LocalDateTime creditTimestamp;
187
        this.inventoryItemId = inventoryItemId;
184
 
188
    }
185
	@Column(name = "description")
189
 
186
	private String statusDescription;
190
    public SchemeInOut() {
187
 
191
    }
188
	public int getId() {
192
 
189
		return id;
193
    public int getId() {
190
	}
194
        return id;
191
 
195
    }
192
	public void setId(int id) {
196
 
193
		this.id = id;
197
    public void setId(int id) {
194
	}
198
        this.id = id;
195
 
199
    }
196
	public SchemePayoutStatus getStatus() {
200
 
197
		return status;
201
    public SchemePayoutStatus getStatus() {
198
	}
202
        return status;
199
 
203
    }
200
	public void setStatus(SchemePayoutStatus status) {
204
 
201
		this.status = status;
205
    public void setStatus(SchemePayoutStatus status) {
202
	}
206
        this.status = status;
203
 
207
    }
204
	public LocalDateTime getCreditTimestamp() {
208
 
205
		return creditTimestamp;
209
    public LocalDateTime getCreditTimestamp() {
206
	}
210
        return creditTimestamp;
207
 
211
    }
208
	public void setCreditTimestamp(LocalDateTime creditTimestamp) {
212
 
209
		this.creditTimestamp = creditTimestamp;
213
    public void setCreditTimestamp(LocalDateTime creditTimestamp) {
210
	}
214
        this.creditTimestamp = creditTimestamp;
211
 
215
    }
212
	public String getStatusDescription() {
216
 
213
		return statusDescription;
217
    public String getStatusDescription() {
214
	}
218
        return statusDescription;
215
 
219
    }
216
	public void setStatusDescription(String statusDescription) {
220
 
217
		this.statusDescription = statusDescription;
221
    public void setStatusDescription(String statusDescription) {
218
	}
222
        this.statusDescription = statusDescription;
219
 
223
    }
220
	@Transient
224
 
221
	private int reference;
225
    public int getReference() {
222
 
226
        return reference;
223
	public int getReference() {
227
    }
224
		return reference;
228
 
225
	}
229
    public void setReference(int reference) {
226
 
230
        this.reference = reference;
227
	public void setReference(int reference) {
231
    }
228
		this.reference = reference;
232
 
229
	}
233
    public Scheme getScheme() {
230
 
234
        return scheme;
231
	@Transient
235
    }
232
	private String serialNumber;
236
 
233
 
237
    public void setScheme(Scheme scheme) {
234
	@Transient
238
        this.scheme = scheme;
235
	private String storeCode;
239
    }
236
 
240
 
237
	@Transient
241
    @Override
238
	private SchemeType schemeType;
242
    public String toString() {
239
 
243
        return "SchemeInOut{" +
240
	@Transient
244
                "id=" + id +
241
	private Scheme scheme;
245
                ", schemeId=" + schemeId +
242
 
246
                ", inventoryItemId=" + inventoryItemId +
243
	public Scheme getScheme() {
247
                ", amount=" + amount +
244
		return scheme;
248
                ", status=" + status +
245
	}
249
                ", createTimestamp=" + createTimestamp +
246
 
250
                ", rolledBackTimestamp=" + rolledBackTimestamp +
247
	public void setScheme(Scheme scheme) {
251
                ", creditTimestamp=" + creditTimestamp +
248
		this.scheme = scheme;
252
                ", statusDescription='" + statusDescription + '\'' +
249
	}
253
                ", reference=" + reference +
250
 
254
                ", serialNumber='" + serialNumber + '\'' +
251
	@Override
255
                ", storeCode='" + storeCode + '\'' +
252
	public String toString() {
256
                ", schemeType=" + schemeType +
253
		return "SchemeInOut{" +
257
                ", scheme=" + scheme +
254
				"id=" + id +
258
                '}';
255
				", schemeId=" + schemeId +
259
    }
256
				", inventoryItemId=" + inventoryItemId +
260
 
257
				", amount=" + amount +
261
    @Override
258
				", status=" + status +
262
    public boolean equals(Object o) {
259
				", createTimestamp=" + createTimestamp +
263
        if (this == o) return true;
260
				", rolledBackTimestamp=" + rolledBackTimestamp +
264
        if (o == null || getClass() != o.getClass()) return false;
261
				", creditTimestamp=" + creditTimestamp +
265
        SchemeInOut that = (SchemeInOut) o;
262
				", statusDescription='" + statusDescription + '\'' +
266
        return id == that.id && schemeId == that.schemeId && inventoryItemId == that.inventoryItemId && Float.compare(that.amount, amount) == 0 && reference == that.reference && status == that.status && Objects.equals(createTimestamp, that.createTimestamp) && Objects.equals(rolledBackTimestamp, that.rolledBackTimestamp) && Objects.equals(creditTimestamp, that.creditTimestamp) && Objects.equals(statusDescription, that.statusDescription) && Objects.equals(serialNumber, that.serialNumber) && Objects.equals(storeCode, that.storeCode) && schemeType == that.schemeType && Objects.equals(scheme, that.scheme);
263
				", reference=" + reference +
267
    }
264
				", serialNumber='" + serialNumber + '\'' +
268
 
265
				", storeCode='" + storeCode + '\'' +
269
    @Override
266
				", schemeType=" + schemeType +
270
    public int hashCode() {
267
				", scheme=" + scheme +
271
        return Objects.hash(id, schemeId, inventoryItemId, amount, status, createTimestamp, rolledBackTimestamp, creditTimestamp, statusDescription, reference, serialNumber, storeCode, schemeType, scheme);
268
				'}';
272
    }
269
	}
273
 
270
 
274
    public String getStoreCode() {
271
	@Override
275
        return storeCode;
272
	public boolean equals(Object o) {
276
    }
273
		if (this == o) return true;
277
 
274
		if (o == null || getClass() != o.getClass()) return false;
278
    public void setStoreCode(String storeCode) {
275
		SchemeInOut that = (SchemeInOut) o;
279
        this.storeCode = storeCode;
276
		return id == that.id && schemeId == that.schemeId && inventoryItemId == that.inventoryItemId && Float.compare(that.amount, amount) == 0 && reference == that.reference && status == that.status && Objects.equals(createTimestamp, that.createTimestamp) && Objects.equals(rolledBackTimestamp, that.rolledBackTimestamp) && Objects.equals(creditTimestamp, that.creditTimestamp) && Objects.equals(statusDescription, that.statusDescription) && Objects.equals(serialNumber, that.serialNumber) && Objects.equals(storeCode, that.storeCode) && schemeType == that.schemeType && Objects.equals(scheme, that.scheme);
280
    }
277
	}
281
 
278
 
282
    public SchemeType getSchemeType() {
279
	@Override
283
        return schemeType;
280
	public int hashCode() {
284
    }
281
		return Objects.hash(id, schemeId, inventoryItemId, amount, status, createTimestamp, rolledBackTimestamp, creditTimestamp, statusDescription, reference, serialNumber, storeCode, schemeType, scheme);
285
 
282
	}
286
    public void setSchemeType(SchemeType schemeType) {
283
 
287
        this.schemeType = schemeType;
284
	public String getStoreCode() {
288
    }
285
		return storeCode;
289
 
286
	}
290
    public String getSerialNumber() {
287
 
291
        return serialNumber;
288
	public void setStoreCode(String storeCode) {
292
    }
289
		this.storeCode = storeCode;
293
 
290
	}
294
    public void setSerialNumber(String serialNumber) {
291
 
295
        this.serialNumber = serialNumber;
292
	public SchemeType getSchemeType() {
296
    }
293
		return schemeType;
297
 
294
	}
298
    public int getSchemeId() {
295
 
299
        return schemeId;
296
	public void setSchemeType(SchemeType schemeType) {
300
    }
297
		this.schemeType = schemeType;
301
 
298
	}
302
    public void setSchemeId(int schemeId) {
299
 
303
        this.schemeId = schemeId;
300
	public String getSerialNumber() {
304
    }
301
		return serialNumber;
305
 
302
	}
306
    public int getInventoryItemId() {
303
 
307
        return inventoryItemId;
304
	public void setSerialNumber(String serialNumber) {
308
    }
305
		this.serialNumber = serialNumber;
309
 
306
	}
310
    public void setInventoryItemId(int inventoryItemId) {
307
 
311
        this.inventoryItemId = inventoryItemId;
308
	public int getSchemeId() {
312
    }
309
		return schemeId;
313
 
310
	}
314
    public float getAmount() {
311
 
315
        return amount;
312
	public void setSchemeId(int schemeId) {
316
    }
313
		this.schemeId = schemeId;
317
 
314
	}
318
    public void setAmount(float amount) {
315
 
319
        this.amount = amount;
316
	public int getInventoryItemId() {
320
    }
317
		return inventoryItemId;
321
 
318
	}
322
    public LocalDateTime getCreateTimestamp() {
319
 
323
        return createTimestamp;
320
	public void setInventoryItemId(int inventoryItemId) {
324
    }
321
		this.inventoryItemId = inventoryItemId;
325
 
322
	}
326
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
323
 
327
        this.createTimestamp = createTimestamp;
324
	public float getAmount() {
328
    }
325
		return amount;
329
 
326
	}
330
    public LocalDateTime getRolledBackTimestamp() {
327
 
331
        return rolledBackTimestamp;
328
	public void setAmount(float amount) {
332
    }
329
		this.amount = amount;
333
 
330
	}
334
    public void setRolledBackTimestamp(LocalDateTime rolledBackTimestamp) {
331
 
335
        this.rolledBackTimestamp = rolledBackTimestamp;
332
	public LocalDateTime getCreateTimestamp() {
336
    }
333
		return createTimestamp;
-
 
334
	}
-
 
335
 
-
 
336
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
-
 
337
		this.createTimestamp = createTimestamp;
-
 
338
	}
-
 
339
 
-
 
340
	public LocalDateTime getRolledBackTimestamp() {
-
 
341
		return rolledBackTimestamp;
-
 
342
	}
-
 
343
 
-
 
344
	public void setRolledBackTimestamp(LocalDateTime rolledBackTimestamp) {
-
 
345
		this.rolledBackTimestamp = rolledBackTimestamp;
-
 
346
	}
-
 
347
 
337
 
348
}
338
}