| 22653 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.fofo;
|
|
|
2 |
|
| 31903 |
amit.gupta |
3 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 31008 |
amit.gupta |
4 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
|
|
5 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
|
|
6 |
|
|
|
7 |
import javax.persistence.*;
|
| 30050 |
manish |
8 |
import java.io.Serializable;
|
|
|
9 |
import java.time.LocalDateTime;
|
| 31903 |
amit.gupta |
10 |
import java.util.Objects;
|
| 30050 |
manish |
11 |
|
| 22653 |
ashik.ali |
12 |
@Entity
|
| 31860 |
tejbeer |
13 |
@Table(name = "fofo.scheme_in_out")
|
| 29578 |
tejbeer |
14 |
|
|
|
15 |
@NamedQueries({
|
| 31008 |
amit.gupta |
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"
|
|
|
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 "
|
|
|
20 |
+ " group by i.brand, DATE_FORMAT(sio.createTimestamp, '%m-%Y')"),
|
| 29578 |
tejbeer |
21 |
|
| 31008 |
amit.gupta |
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"
|
|
|
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 "
|
|
|
26 |
+ " group by i.brand"),
|
| 29578 |
tejbeer |
27 |
|
| 31008 |
amit.gupta |
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"
|
|
|
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 "
|
|
|
32 |
+ " ii.fofoId = :fofoId and i.brand = :brand and DATE_FORMAT(sio.createTimestamp, '%m-%Y') = :yearMonthValue"),
|
| 29578 |
tejbeer |
33 |
|
| 31008 |
amit.gupta |
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"
|
|
|
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 "
|
|
|
38 |
+ " ii.fofoId = :fofoId and i.brand = :brand and sio.createTimestamp <= :endDate"),
|
| 29578 |
tejbeer |
39 |
|
| 31008 |
amit.gupta |
40 |
|
| 30050 |
manish |
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 "
|
|
|
43 |
+ " ii.createTimestamp <= :endDate and ii.fofoId = :fofoId group by ii.fofoId"),
|
| 31008 |
amit.gupta |
44 |
|
| 30050 |
manish |
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 "
|
|
|
47 |
+ " 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 |
48 |
|
| 30050 |
manish |
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 "
|
|
|
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"),
|
| 31008 |
amit.gupta |
52 |
|
| 30050 |
manish |
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 "
|
| 31281 |
amit.gupta |
55 |
+ " 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 |
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 "
|
|
|
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 "
|
| 31281 |
amit.gupta |
59 |
+ "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 |
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 ))) "
|
| 30050 |
manish |
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 "
|
|
|
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"),
|
| 31008 |
amit.gupta |
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 "
|
| 30050 |
manish |
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 "
|
| 31281 |
amit.gupta |
67 |
+ " 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 |
68 |
|
| 30050 |
manish |
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 "
|
|
|
71 |
+ " ii.createTimestamp <= :endDate group by i.brand"),
|
| 31008 |
amit.gupta |
72 |
|
|
|
73 |
|
| 31286 |
amit.gupta |
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)," +
|
|
|
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)," +
|
|
|
78 |
"i.catalogItemId,i.modelName,i.modelNumber) from ScanRecord sr "
|
| 31008 |
amit.gupta |
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 "
|
|
|
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"),
|
| 29578 |
tejbeer |
81 |
|
| 30243 |
tejbeer |
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) "
|
| 31008 |
amit.gupta |
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 "
|
|
|
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"),
|
| 30050 |
manish |
85 |
|
| 31286 |
amit.gupta |
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"
|
|
|
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 "
|
|
|
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"),
|
| 30050 |
manish |
92 |
|
| 31008 |
amit.gupta |
93 |
|
| 30243 |
tejbeer |
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 "
|
| 30050 |
manish |
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 "
|
| 30243 |
tejbeer |
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 "
|
| 30050 |
manish |
97 |
+ " i.catalogItemId= :catalogItemId and sr.fofoId = :fofoId"),
|
|
|
98 |
|
| 30243 |
tejbeer |
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 "
|
| 30050 |
manish |
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 "
|
|
|
101 |
+ " i.catalogItemId= :catalogItemId and ii.createTimestamp >= :startDate and ii.createTimestamp <= :endDate"),
|
| 31008 |
amit.gupta |
102 |
|
|
|
103 |
|
| 31380 |
amit.gupta |
104 |
@NamedQuery(name = "SchemeInOut.selectLastMonthFrontEndImei", query = "select new com.spice.profitmandi.dao.model.LastMonthFrontEndImeiModel( ii.serialNumber,foi.sellingPrice, foi.dp) from InventoryItem ii "
|
| 30050 |
manish |
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 "
|
|
|
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 "
|
|
|
107 |
+ " group by ii.id"),
|
| 31008 |
amit.gupta |
108 |
|
| 30243 |
tejbeer |
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 "
|
| 30050 |
manish |
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 "
|
| 30243 |
tejbeer |
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 "
|
| 30050 |
manish |
112 |
+ " fli.serialNumber in :imeis and sr.fofoId = :fofoId"),
|
|
|
113 |
|
| 30243 |
tejbeer |
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 "
|
| 30050 |
manish |
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 "
|
|
|
116 |
+ " ii.serialNumber in :imeis"),
|
| 31008 |
amit.gupta |
117 |
|
| 31380 |
amit.gupta |
118 |
@NamedQuery(name = "SchemeInOut.selectLastMonthFrontEndByImei", query = "select new com.spice.profitmandi.dao.model.LastMonthFrontEndImeiModel( ii.serialNumber,foi.sellingPrice, foi.dp) from InventoryItem ii "
|
| 30050 |
manish |
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 "
|
|
|
120 |
+ " fo.cancelledTimestamp is null and sr.type='SALE' and ii.serialNumber in (:imeis) and sr.fofoId = :fofoId group by ii.id"),
|
| 31008 |
amit.gupta |
121 |
|
|
|
122 |
|
| 30050 |
manish |
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 "
|
| 31008 |
amit.gupta |
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 "
|
|
|
125 |
+ " and sr.type='SALE' and sr.createTimestamp >= :startDate and sr.createTimestamp <= :endDate and sr.fofoId = :fofoId group by foi.brand"),
|
|
|
126 |
|
| 30050 |
manish |
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 "
|
| 31008 |
amit.gupta |
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 "
|
|
|
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"),
|
| 30050 |
manish |
130 |
|
|
|
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 "
|
|
|
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 "
|
|
|
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 "
|
|
|
134 |
+ " i.catalogItemId= :catalogItemId and sr.fofoId = :fofoId group by fli.serialNumber"),
|
|
|
135 |
|
| 31008 |
amit.gupta |
136 |
|
|
|
137 |
@NamedQuery(name = "SchemeInOut.selectPaidMargins", query = "select new com.spice.profitmandi.service.transaction.InventoryMarginModel("
|
|
|
138 |
+ " ii.fofoId, ii.sgstRate, ii.cgstRate, ii.igstRate," +
|
|
|
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 " +
|
|
|
140 |
" when sio.creditTimestamp between :startDate and :endDate and sio.rolledBackTimestamp between :startDate and :endDate then 0" +
|
|
|
141 |
" when sio.creditTimestamp is not null and sio.rolledBackTimestamp between :startDate and :endDate then -sio.amount" +
|
|
|
142 |
" else 0 end as float), ii.serialNumber, s.name, p.purchaseReference, " +
|
|
|
143 |
" case when sio.rolledBackTimestamp between :startDate and :endDate then sio.rolledBackTimestamp else sio.creditTimestamp end) from "
|
|
|
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"
|
|
|
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))")
|
| 29578 |
tejbeer |
146 |
})
|
| 27377 |
amit.gupta |
147 |
public class SchemeInOut implements Serializable {
|
|
|
148 |
|
| 24592 |
amit.gupta |
149 |
public SchemeInOut(int schemeId, int inventoryItemId) {
|
|
|
150 |
this.schemeId = schemeId;
|
|
|
151 |
this.inventoryItemId = inventoryItemId;
|
|
|
152 |
}
|
| 22653 |
ashik.ali |
153 |
|
| 24592 |
amit.gupta |
154 |
public SchemeInOut() {
|
|
|
155 |
}
|
| 27377 |
amit.gupta |
156 |
|
| 22653 |
ashik.ali |
157 |
private static final long serialVersionUID = 1L;
|
| 24592 |
amit.gupta |
158 |
|
| 22859 |
ashik.ali |
159 |
@Id
|
| 23968 |
amit.gupta |
160 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
161 |
private int id;
|
| 24592 |
amit.gupta |
162 |
|
| 22859 |
ashik.ali |
163 |
@Column(name = "scheme_id")
|
|
|
164 |
private int schemeId;
|
| 22653 |
ashik.ali |
165 |
|
| 22859 |
ashik.ali |
166 |
@Column(name = "inventory_item_id")
|
|
|
167 |
private int inventoryItemId;
|
| 24592 |
amit.gupta |
168 |
|
| 22653 |
ashik.ali |
169 |
@Column(name = "amount")
|
|
|
170 |
private float amount;
|
| 24592 |
amit.gupta |
171 |
|
| 27377 |
amit.gupta |
172 |
@Column(name = "status")
|
|
|
173 |
@Enumerated(EnumType.STRING)
|
|
|
174 |
private SchemePayoutStatus status;
|
|
|
175 |
|
| 23345 |
ashik.ali |
176 |
@Column(name = "create_timestamp")
|
| 23339 |
ashik.ali |
177 |
private LocalDateTime createTimestamp = LocalDateTime.now();
|
| 24592 |
amit.gupta |
178 |
|
| 23509 |
amit.gupta |
179 |
@Column(name = "rolled_back_timestamp")
|
| 23527 |
ashik.ali |
180 |
private LocalDateTime rolledBackTimestamp;
|
| 27377 |
amit.gupta |
181 |
|
|
|
182 |
@Column(name = "credit_timestamp")
|
|
|
183 |
private LocalDateTime creditTimestamp;
|
|
|
184 |
|
| 27381 |
amit.gupta |
185 |
@Column(name = "description")
|
| 27377 |
amit.gupta |
186 |
private String statusDescription;
|
|
|
187 |
|
|
|
188 |
public int getId() {
|
|
|
189 |
return id;
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
public void setId(int id) {
|
|
|
193 |
this.id = id;
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
public SchemePayoutStatus getStatus() {
|
|
|
197 |
return status;
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
public void setStatus(SchemePayoutStatus status) {
|
|
|
201 |
this.status = status;
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
public LocalDateTime getCreditTimestamp() {
|
|
|
205 |
return creditTimestamp;
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
public void setCreditTimestamp(LocalDateTime creditTimestamp) {
|
|
|
209 |
this.creditTimestamp = creditTimestamp;
|
|
|
210 |
}
|
|
|
211 |
|
|
|
212 |
public String getStatusDescription() {
|
|
|
213 |
return statusDescription;
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
public void setStatusDescription(String statusDescription) {
|
|
|
217 |
this.statusDescription = statusDescription;
|
|
|
218 |
}
|
|
|
219 |
|
| 24592 |
amit.gupta |
220 |
@Transient
|
| 24671 |
amit.gupta |
221 |
private int reference;
|
| 27377 |
amit.gupta |
222 |
|
| 24671 |
amit.gupta |
223 |
public int getReference() {
|
|
|
224 |
return reference;
|
|
|
225 |
}
|
|
|
226 |
|
|
|
227 |
public void setReference(int reference) {
|
|
|
228 |
this.reference = reference;
|
|
|
229 |
}
|
|
|
230 |
|
|
|
231 |
@Transient
|
| 24592 |
amit.gupta |
232 |
private String serialNumber;
|
| 27377 |
amit.gupta |
233 |
|
| 24592 |
amit.gupta |
234 |
@Transient
|
|
|
235 |
private String storeCode;
|
| 27377 |
amit.gupta |
236 |
|
| 24592 |
amit.gupta |
237 |
@Transient
|
|
|
238 |
private SchemeType schemeType;
|
| 23509 |
amit.gupta |
239 |
|
| 31903 |
amit.gupta |
240 |
@Transient
|
|
|
241 |
private Scheme scheme;
|
|
|
242 |
|
|
|
243 |
public Scheme getScheme() {
|
|
|
244 |
return scheme;
|
|
|
245 |
}
|
|
|
246 |
|
|
|
247 |
public void setScheme(Scheme scheme) {
|
|
|
248 |
this.scheme = scheme;
|
|
|
249 |
}
|
|
|
250 |
|
|
|
251 |
@Override
|
|
|
252 |
public String toString() {
|
|
|
253 |
return "SchemeInOut{" +
|
|
|
254 |
"id=" + id +
|
|
|
255 |
", schemeId=" + schemeId +
|
|
|
256 |
", inventoryItemId=" + inventoryItemId +
|
|
|
257 |
", amount=" + amount +
|
|
|
258 |
", status=" + status +
|
|
|
259 |
", createTimestamp=" + createTimestamp +
|
|
|
260 |
", rolledBackTimestamp=" + rolledBackTimestamp +
|
|
|
261 |
", creditTimestamp=" + creditTimestamp +
|
|
|
262 |
", statusDescription='" + statusDescription + '\'' +
|
|
|
263 |
", reference=" + reference +
|
|
|
264 |
", serialNumber='" + serialNumber + '\'' +
|
|
|
265 |
", storeCode='" + storeCode + '\'' +
|
|
|
266 |
", schemeType=" + schemeType +
|
|
|
267 |
", scheme=" + scheme +
|
|
|
268 |
'}';
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
@Override
|
|
|
272 |
public boolean equals(Object o) {
|
|
|
273 |
if (this == o) return true;
|
|
|
274 |
if (o == null || getClass() != o.getClass()) return false;
|
|
|
275 |
SchemeInOut that = (SchemeInOut) o;
|
|
|
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);
|
|
|
277 |
}
|
|
|
278 |
|
|
|
279 |
@Override
|
|
|
280 |
public int hashCode() {
|
|
|
281 |
return Objects.hash(id, schemeId, inventoryItemId, amount, status, createTimestamp, rolledBackTimestamp, creditTimestamp, statusDescription, reference, serialNumber, storeCode, schemeType, scheme);
|
|
|
282 |
}
|
|
|
283 |
|
| 24592 |
amit.gupta |
284 |
public String getStoreCode() {
|
|
|
285 |
return storeCode;
|
|
|
286 |
}
|
|
|
287 |
|
|
|
288 |
public void setStoreCode(String storeCode) {
|
|
|
289 |
this.storeCode = storeCode;
|
|
|
290 |
}
|
|
|
291 |
|
|
|
292 |
public SchemeType getSchemeType() {
|
|
|
293 |
return schemeType;
|
|
|
294 |
}
|
|
|
295 |
|
|
|
296 |
public void setSchemeType(SchemeType schemeType) {
|
|
|
297 |
this.schemeType = schemeType;
|
|
|
298 |
}
|
|
|
299 |
|
|
|
300 |
public String getSerialNumber() {
|
|
|
301 |
return serialNumber;
|
|
|
302 |
}
|
|
|
303 |
|
|
|
304 |
public void setSerialNumber(String serialNumber) {
|
|
|
305 |
this.serialNumber = serialNumber;
|
|
|
306 |
}
|
|
|
307 |
|
| 22859 |
ashik.ali |
308 |
public int getSchemeId() {
|
|
|
309 |
return schemeId;
|
| 22653 |
ashik.ali |
310 |
}
|
| 24592 |
amit.gupta |
311 |
|
| 22859 |
ashik.ali |
312 |
public void setSchemeId(int schemeId) {
|
|
|
313 |
this.schemeId = schemeId;
|
| 22653 |
ashik.ali |
314 |
}
|
| 24592 |
amit.gupta |
315 |
|
| 22859 |
ashik.ali |
316 |
public int getInventoryItemId() {
|
|
|
317 |
return inventoryItemId;
|
|
|
318 |
}
|
| 24592 |
amit.gupta |
319 |
|
| 22859 |
ashik.ali |
320 |
public void setInventoryItemId(int inventoryItemId) {
|
|
|
321 |
this.inventoryItemId = inventoryItemId;
|
|
|
322 |
}
|
| 24592 |
amit.gupta |
323 |
|
| 22653 |
ashik.ali |
324 |
public float getAmount() {
|
|
|
325 |
return amount;
|
|
|
326 |
}
|
| 24592 |
amit.gupta |
327 |
|
| 22653 |
ashik.ali |
328 |
public void setAmount(float amount) {
|
|
|
329 |
this.amount = amount;
|
|
|
330 |
}
|
| 24592 |
amit.gupta |
331 |
|
| 23339 |
ashik.ali |
332 |
public LocalDateTime getCreateTimestamp() {
|
|
|
333 |
return createTimestamp;
|
|
|
334 |
}
|
| 24592 |
amit.gupta |
335 |
|
| 23339 |
ashik.ali |
336 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
337 |
this.createTimestamp = createTimestamp;
|
|
|
338 |
}
|
| 24592 |
amit.gupta |
339 |
|
| 23527 |
ashik.ali |
340 |
public LocalDateTime getRolledBackTimestamp() {
|
|
|
341 |
return rolledBackTimestamp;
|
|
|
342 |
}
|
| 24592 |
amit.gupta |
343 |
|
| 23527 |
ashik.ali |
344 |
public void setRolledBackTimestamp(LocalDateTime rolledBackTimestamp) {
|
|
|
345 |
this.rolledBackTimestamp = rolledBackTimestamp;
|
|
|
346 |
}
|
| 22859 |
ashik.ali |
347 |
|
| 22653 |
ashik.ali |
348 |
}
|