Subversion Repositories SmartDukaan

Rev

Rev 32234 | Rev 34256 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32234 Rev 33459
Line 12... Line 12...
12
        @NamedQuery(name = "OfferPayout.selectPaidOffers", query = "select new com.spice.profitmandi.service.transaction.InventoryMarginModel("
12
        @NamedQuery(name = "OfferPayout.selectPaidOffers", query = "select new com.spice.profitmandi.service.transaction.InventoryMarginModel("
13
                + " o.retailerId, li.sgstRate, li.cgstRate, li.igstRate," +
13
                + " o.retailerId, li.sgstRate, li.cgstRate, li.igstRate," +
14
                " cast(case when op.createTimestamp between :startDate and :endDate and op.rejectTimestamp is null then op.amount " +
14
                " cast(case when op.createTimestamp between :startDate and :endDate and op.rejectTimestamp is null then op.amount " +
15
                " 			when op.createTimestamp between :startDate and :endDate and op.rejectTimestamp between :startDate and :endDate then 0" +
15
                " 			when op.createTimestamp between :startDate and :endDate and op.rejectTimestamp between :startDate and :endDate then 0" +
16
                "			when op.rejectTimestamp between :startDate and :endDate then -op.amount" +
16
                "			when op.rejectTimestamp between :startDate and :endDate then -op.amount" +
17
                "			else 0 end as float), lii.serialNumber, op.description, o.invoiceNumber, " +
17
                "			else 0 end as float),  op.inventoryItemId,  lii.serialNumber, op.description, o.invoiceNumber, " +
18
                " case when op.rejectTimestamp between :startDate and :endDate then op.rejectTimestamp else op.createTimestamp end)  from "
18
                " case when op.rejectTimestamp between :startDate and :endDate then op.rejectTimestamp else op.createTimestamp end)  from "
19
                + " OfferPayout op join LineItemImei lii on (op.serialNumber=lii.serialNumber) join LineItem li on li.id=lii.lineItemId "
19
                + " OfferPayout op join LineItemImei lii on (op.serialNumber=lii.serialNumber) join LineItem li on li.id=lii.lineItemId "
20
                + " join Order o on (o.retailerId=op.fofoId and o.billingTimestamp is not null and o.id=li.orderId) "
20
                + " join Order o on (o.retailerId=op.fofoId and o.billingTimestamp is not null and o.id=li.orderId) "
21
                + " where op.createTimestamp >= :cnDate and ((op.createTimestamp between :startDate and :endDate) or (op.rejectTimestamp between :startDate and :endDate))"
21
                + " where op.createTimestamp >= :cnDate and ((op.createTimestamp between :startDate and :endDate) or (op.rejectTimestamp between :startDate and :endDate))"
22
                + " and lii.id=(select max(lii2.id) from LineItemImei lii2 join LineItem li2 on li2.id=lii2.lineItemId join Order o2 on o2.id=li2.orderId where lii2.serialNumber=lii.serialNumber and o2.retailerId=op.fofoId)"),
22
                + " and lii.id=(select max(lii2.id) from LineItemImei lii2 join LineItem li2 on li2.id=lii2.lineItemId join Order o2 on o2.id=li2.orderId where lii2.serialNumber=lii.serialNumber and o2.retailerId=op.fofoId)"),