| Line 138... |
Line 138... |
| 138 |
+ " i.catalogItemId= :catalogItemId and sr.fofoId = :fofoId group by fli.serialNumber"),
|
138 |
+ " i.catalogItemId= :catalogItemId and sr.fofoId = :fofoId group by fli.serialNumber"),
|
| 139 |
|
139 |
|
| 140 |
|
140 |
|
| 141 |
@NamedQuery(name = "SchemeInOut.selectPaidMargins", query = "select new com.spice.profitmandi.service.transaction.InventoryMarginModel("
|
141 |
@NamedQuery(name = "SchemeInOut.selectPaidMargins", query = "select new com.spice.profitmandi.service.transaction.InventoryMarginModel("
|
| 142 |
+ " ii.fofoId, ii.sgstRate, ii.cgstRate, ii.igstRate," +
|
142 |
+ " ii.fofoId, ii.sgstRate, ii.cgstRate, ii.igstRate," +
|
| 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 |
" when sio.creditTimestamp between :startDate and :endDate and sio.rolledBackTimestamp between :startDate and :endDate then 0" +
|
143 |
" cast(case when sio.creditTimestamp >= :startDate and sio.creditTimestamp <= :endDate then sio.amount " +
|
| 145 |
" when sio.creditTimestamp is not null and sio.rolledBackTimestamp between :startDate and :endDate then -sio.amount" +
|
144 |
" when sio.creditTimestamp is not null and sio.rolledBackTimestamp >= :startDate and sio.rolledBackTimestamp <= :endDate then -sio.amount" +
|
| 146 |
" else 0 end as float), ii.id, ii.serialNumber, s.name, p.purchaseReference, " +
|
145 |
" else 0 end as float), ii.id, ii.serialNumber, s.name, p.purchaseReference, " +
|
| 147 |
" case when sio.rolledBackTimestamp between :startDate and :endDate then sio.rolledBackTimestamp else sio.creditTimestamp end, ii.hsnCode) from "
|
146 |
" case when sio.rolledBackTimestamp >= :startDate and sio.rolledBackTimestamp <= :endDate then sio.rolledBackTimestamp else sio.creditTimestamp end, ii.hsnCode) 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"
|
147 |
+ " 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 (:fofoId IS NULL OR ii.fofoId = :fofoId) and ((sio.creditTimestamp between :startDate and :endDate) or (sio.creditTimestamp is not null and sio.rolledBackTimestamp between :startDate and :endDate))")
|
148 |
+ " where sio.createTimestamp >= :cnDate and (:fofoId IS NULL OR ii.fofoId = :fofoId) and ((sio.creditTimestamp >= :startDate and sio.creditTimestamp <= :endDate) or (sio.creditTimestamp is not null and sio.rolledBackTimestamp >= :startDate and sio.rolledBackTimestamp <= :endDate))"
|
| - |
|
149 |
+ " and not (sio.creditTimestamp >= :startDate and sio.creditTimestamp <= :endDate and sio.rolledBackTimestamp >= :startDate and sio.rolledBackTimestamp <= :endDate)")
|
| 150 |
})
|
150 |
})
|
| 151 |
public class SchemeInOut implements Serializable {
|
151 |
public class SchemeInOut implements Serializable {
|
| 152 |
|
152 |
|
| 153 |
private static final long serialVersionUID = 1L;
|
153 |
private static final long serialVersionUID = 1L;
|
| 154 |
@Id
|
154 |
@Id
|