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