| Line 7... |
Line 7... |
| 7 |
@NamedQueries({
|
7 |
@NamedQueries({
|
| 8 |
@NamedQuery(name = "UserWallet.getSummary", query = "select new com.spice.profitmandi.dao.model.AccountStatementModel(uwh.referenceType, sum(case when uwh.amount>0 then amount else 0 end), sum(case when uwh.amount<0 then -amount else 0 end))\tfrom UserWalletHistory uwh where uwh.walletId=:walletId \tand uwh.timestamp between :startDate and :endDate group by uwh.referenceType"),
|
8 |
@NamedQuery(name = "UserWallet.getSummary", query = "select new com.spice.profitmandi.dao.model.AccountStatementModel(uwh.referenceType, sum(case when uwh.amount>0 then amount else 0 end), sum(case when uwh.amount<0 then -amount else 0 end))\tfrom UserWalletHistory uwh where uwh.walletId=:walletId \tand uwh.timestamp between :startDate and :endDate group by uwh.referenceType"),
|
| 9 |
@NamedQuery(name = "UserWallet.getStatewiseCollections", query = "SELECT new com.spice.profitmandi.dao.model.WarehouseWalletAmountModel(fs.warehouseId, sum(uwh.amount), uwh.referenceType) FROM FofoStore fs"
|
9 |
@NamedQuery(name = "UserWallet.getStatewiseCollections", query = "SELECT new com.spice.profitmandi.dao.model.WarehouseWalletAmountModel(fs.warehouseId, sum(uwh.amount), uwh.referenceType) FROM FofoStore fs"
|
| 10 |
+ " join UserWallet uw on uw.userId = fs.id " + "join UserWalletHistory uwh on uwh.walletId = uw.id "
|
10 |
+ " join UserWallet uw on uw.userId = fs.id " + "join UserWalletHistory uwh on uwh.walletId = uw.id "
|
| 11 |
+ "where uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY') "
|
11 |
+ "where uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY') "
|
| 12 |
+ "and uwh.timestamp between :startDate and :endDate and fs.internal=false group by fs.warehouseId"),
|
12 |
+ "and uwh.timestamp between :startDate and :endDate and fs.internal=false group by fs.warehouseId, uwh.referenceType"),
|
| 13 |
|
13 |
|
| 14 |
@NamedQuery(name = "UserWallet.getPartnerWiseTargetCollections", query = "SELECT new com.spice.profitmandi.dao.model.PartnerCollectionPlanModel(fs.id,case when pcp.collectionPlan is not null then cast(pcp.collectionPlan As long) else 0 end,"
|
14 |
@NamedQuery(name = "UserWallet.getPartnerWiseTargetCollections", query = "SELECT new com.spice.profitmandi.dao.model.PartnerCollectionPlanModel(fs.id,case when pcp.collectionPlan is not null then cast(pcp.collectionPlan As long) else 0 end,"
|
| 15 |
+ " sum(cast(uwh.amount AS int)),pcp.authId,pcp.createTimestamp, pcp.commitedTimestamp) FROM FofoStore fs"
|
15 |
+ " sum(cast(uwh.amount AS int)),pcp.authId,pcp.createTimestamp, pcp.commitedTimestamp) FROM FofoStore fs"
|
| 16 |
+ " left join UserWallet uw on uw.userId = fs.id "
|
16 |
+ " left join UserWallet uw on uw.userId = fs.id "
|
| 17 |
+ " left join UserWalletHistory uwh on (uwh.walletId = uw.id and"
|
17 |
+ " left join UserWalletHistory uwh on (uwh.walletId = uw.id and"
|