| Line 37... |
Line 37... |
| 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 :types 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 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 "
|
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 :types 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 and foi.itemId=ii.itemId) 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"),
|