Subversion Repositories SmartDukaan

Rev

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

Rev 36489 Rev 36508
Line 49... Line 49...
49
                " i.catalogItemId, i.brand, i.modelName, i.modelNumber" +
49
                " i.catalogItemId, i.brand, i.modelName, i.modelNumber" +
50
                ") from OfferPayout op join Offer o on o.id=op.offerId join InventoryItem ii on ii.serialNumber=op.serialNumber and op.fofoId=ii.fofoId" +
50
                ") from OfferPayout op join Offer o on o.id=op.offerId join InventoryItem ii on ii.serialNumber=op.serialNumber and op.fofoId=ii.fofoId" +
51
                " join Item i on i.id=ii.itemId join ScanRecord  sr on sr.inventoryItemId=ii.id " +
51
                " join Item i on i.id=ii.itemId join ScanRecord  sr on sr.inventoryItemId=ii.id " +
52
                " and ((sr.type='PURCHASE' and o.schemeType='SELLIN') or (sr.type='SALE' and o.schemeType!='SELLIN'))" +
52
                " and ((sr.type='PURCHASE' and o.schemeType='SELLIN') or (sr.type='SALE' and o.schemeType!='SELLIN'))" +
53
                " where op.rejectTimestamp is null and ii.serialNumber in :serialNumbers" +
53
                " where op.rejectTimestamp is null and ii.serialNumber in :serialNumbers" +
54
                " group by ii.id ")/*,
54
                " group by ii.id "),
-
 
55
        /*,
55
        @NamedQuery(name = "OfferPayout.selectMarginsByYearMonth", query = "select com.spice.profitmandi.common.model.MarginModel(" +
56
        @NamedQuery(name = "OfferPayout.selectMarginsByYearMonth", query = "select com.spice.profitmandi.common.model.MarginModel(" +
56
                " " +
57
                " " +
57
                ") from Order ord join    OfferPayout op join Offer on o.id=op.offerId join InventoryItem ii on ii.serialNumber=op.serialNumber and op.fofoId=ii.fofoId" +
58
                ") from Order ord join    OfferPayout op join Offer on o.id=op.offerId join InventoryItem ii on ii.serialNumber=op.serialNumber and op.fofoId=ii.fofoId" +
58
                " join Item i on i.id=ii.itemId join ScanRecord  sr on sr.inventoryItemId=ii.id " +
59
                " join Item i on i.id=ii.itemId join ScanRecord  sr on sr.inventoryItemId=ii.id " +
59
                " and ((sr.type='PURCHASE' and o.schemeType='SELLIN') or (sr.type='SALE' and o.schemeType!='SELLIN'))" +
60
                " and ((sr.type='PURCHASE' and o.schemeType='SELLIN') or (sr.type='SALE' and o.schemeType!='SELLIN'))" +
60
                " join  " +
61
                " join  " +
61
                " where op.rejectTimestamp is null and ii.serialNumber in :serialNumbers" +
62
                " where op.rejectTimestamp is null and ii.serialNumber in :serialNumbers" +
62
                " group by ii.id ")*/
63
                " group by ii.id ")*/
-
 
64
 
-
 
65
        @NamedQuery(name = "OfferPayout.selectOfferEarningsByFofoId",
-
 
66
                query = "select new com.spice.profitmandi.dao.model.OfferEarningModel("
-
 
67
                        + " op.offerId, o.name, o.offerNotes,"
-
 
68
                        + " count(distinct op.serialNumber), sum(op.amount))"
-
 
69
                        + " from OfferPayout op join Offer o on o.id=op.offerId"
-
 
70
                        + " where op.fofoId=:fofoId"
-
 
71
                        + " and op.createTimestamp >= :startDate and op.createTimestamp <= :endDate"
-
 
72
                        + " and op.rejectTimestamp is null"
-
 
73
                        + " group by op.offerId, o.name, o.offerNotes")
63
})
74
})
64
public class OfferPayout {
75
public class OfferPayout {
65
        @Id
76
        @Id
66
        @GeneratedValue(strategy = GenerationType.IDENTITY)
77
        @GeneratedValue(strategy = GenerationType.IDENTITY)
67
        private long id;
78
        private long id;