Subversion Repositories SmartDukaan

Rev

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

Rev 28477 Rev 30160
Line 89... Line 89...
89
				+ " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  "
89
				+ " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  "
90
				+ " join FofoOrderItem foi on foi.orderId = fo.id join  TagListing tl on tl.itemId = foi.itemId "
90
				+ " join FofoOrderItem foi on foi.orderId = fo.id join  TagListing tl on tl.itemId = foi.itemId "
91
				+ " join Item i on i.id = tl.itemId"
91
				+ " join Item i on i.id = tl.itemId"
92
				+ " where fs.active = 1 and fs.internal = 0 and fo.cancelledTimestamp is null and fo.createTimestamp > :startDate and i.catalogItemId in :catalogItemId and fs.warehouseId in :warehouseId and  i.categoryId=10006 group by i.catalogItemId, fs.id"),
92
				+ " where fs.active = 1 and fs.internal = 0 and fo.cancelledTimestamp is null and fo.createTimestamp > :startDate and i.catalogItemId in :catalogItemId and fs.warehouseId in :warehouseId and  i.categoryId=10006 group by i.catalogItemId, fs.id"),
93
 
93
 
-
 
94
		
-
 
95
		@NamedQuery(name = "FofoOrder.selectFocoSaleReport", query = "select new com.spice.profitmandi.dao.model.FocoSaleReportModel(fs.code, ua.name,ua.city, ua.state, w.displayName, foi.itemId,"
-
 
96
				+ " foi.brand, foi.modelName, foi.modelNumber, foi.color, foi.quantity, cast(foi.dp As int), cast(foi.sellingPrice As int), cast(foi.mop As int), fli.serialNumber, foi.createTimestamp, ca.name, ca.phoneNumber,"
-
 
97
				+ " ca.city, ca.pinCode, fo.invoiceNumber, p.purchaseReference, fo.customerGstNumber, fo.cancelledTimestamp, p.completeTimestamp, hd.hygieneRating,hd.rating, hd.status, hd.remark,"
-
 
98
				+ " hd.createdTimestamp, hd.disposedTimestamp, hd.nextTimestamp, ai.activationTimestamp, ai.createTimestamp, c.label)"
-
 
99
				+ " from FofoStore fs join Warehouse w on w.id=fs.warehouseId join com.spice.profitmandi.dao.entity.user.User u on u.id=fs.id join Address ua on u.addressId = ua.id join FofoOrder fo on fo.fofoId=fs.id left join FofoOrderItem foi"
-
 
100
				+ " on foi.orderId=fo.id join Item i on i.id=foi.itemId join Category c on c.id=i.categoryId left join CustomerAddress ca on ca.id=fo.customerAddressId left join FofoLineItem fli on fli.fofoOrderItemId=foi.id"
-
 
101
				+ " left join InventoryItem ii on ii.id=fli.inventoryItemId left join Purchase p on ii.purchaseId=p.id left join HygieneData hd on hd.orderId=fo.id left join ActivatedImei ai on ai.serialNumber=fli.serialNumber"
-
 
102
				+ " where 1=1 and (foi.createTimestamp between :startDate and :endDate or foi.createTimestamp is null) and fs.code= :code and fs.id=:fofoId  group by fo.id "),
-
 
103
 
-
 
104
	   @NamedQuery(name = "FofoOrder.selectWalletSummaryReport", query = "select new com.spice.profitmandi.dao.model.WalletSummaryReportModel(uwh.id, fs.code, ua.name, "
-
 
105
				+ " u.emailId, ua.phoneNumber, uwh.amount, uwh.refundableAmount, uwh.reference, uwh.referenceType, uwh.timestamp, uwh.businessTimestamp, uwh.description)"
-
 
106
				+ " from FofoStore fs join com.spice.profitmandi.dao.entity.user.User u on u.id=fs.id join"
-
 
107
				+ " Address ua on u.addressId=ua.id join UserWallet uw on  uw.userId=fs.id join UserWalletHistory uwh on uwh.walletId=uw.id "
-
 
108
				+ " where 1=1 and uwh.timestamp between :startDate and :endDate and fs.id=:fofoId group by uwh.timestamp"),
-
 
109
 
-
 
110
	  
-
 
111
	    @NamedQuery(name = "FofoOrder.selectPendingIndentReport", query = "select new com.spice.profitmandi.dao.model.PendingIndentReportModel(o.transactionId , o.id, o.createTimestamp,"
-
 
112
				+ "  l.itemId, l.brand, l.modelName, l.modelNumber, l.color, l.quantity, l.unitPrice, o.walletAmount,case o.status when 3 then  'In Process' when 4  then 'Accepted' "
-
 
113
		        + "  when 7  then 'Billed' when 9   then 'Shipped' when 12  then 'Delivered' when 13  then 'Cancellation in process' when 15 then 'Cancelled,amount refunded to wallet' "
-
 
114
		        + "  when 31  then 'Returned to Origin, refunded' when 34 then 'Low inventory cancellation, refunded' "
-
 
115
		        + "  else o.statusDescription end as Description, o.invoiceNumber, o.billingTimestamp ) from Order o join LineItem l on l.orderId=o.id "
-
 
116
		        + "  where o.partnerGrnTimestamp is null and o.retailerId= :fofoId and o.status != 1 and o.createTimestamp between :startDate and :endDate group by o.status,o.createTimestamp "),
-
 
117
 
-
 
118
	    @NamedQuery(name = "FofoOrder.selectSchemePayoutReport", query = "select new com.spice.profitmandi.dao.model.SchemePayoutReportModel(i.id, i.brand, i.modelName, i.modelNumber,"
-
 
119
	   		   + " i.color,ii.unitPrice-ii.priceDropAmount,foi.dp, s.id, s.name, s.type, s.amountType, s.amount,p.purchaseReference, fo.invoiceNumber,(case when sio.rolledBackTimestamp is null "
-
 
120
	   		   + " then sio.amount when sio.rolledBackTimestamp  is not null then -sio.amount end),sio.status, sio.statusDescription, sio.createTimestamp, sio.rolledBackTimestamp, ii.serialNumber ) from "
-
 
121
	   		   + " SchemeInOut sio join InventoryItem ii on sio.inventoryItemId=ii.id join com.spice.profitmandi.dao.entity.catalog.Item i on i.id=ii.itemId join FofoStore fs on fs.id=ii.fofoId join com.spice.profitmandi.dao.entity.user.User u on u.id = fs.id join"
-
 
122
	   	       + " Address ua on u.addressId = ua.id join Scheme s on sio.schemeId=s.id join Purchase p on p.id=ii.purchaseId left join FofoLineItem fli on fli.inventoryItemId=ii.id left join FofoOrderItem foi "
-
 
123
	   		   + " on foi.id=fli.fofoOrderItemId left join FofoOrder fo on fo.id=foi.orderId where  foi.createTimestamp between :startDate and :endDate and ii.fofoId= :fofoId "),
-
 
124
	
-
 
125
	    
-
 
126
	    @NamedQuery(name = "FofoOrder.selectInvoiceSchemeOutSummaryReport", query = "select new com.spice.profitmandi.dao.model.FocoSchemeOutReportModel(fo.invoiceNumber, foi.quantity, foi.brand,"
-
 
127
	    		+ " foi.modelName, foi.modelNumber, foi.color,  sum(cast(sio.amount As float)) ) FROM FofoOrderItem foi join FofoOrder fo on fo.id=foi.orderId join FofoLineItem fli on "
-
 
128
	    		+ " fli.fofoOrderItemId=foi.id join SchemeInOut sio on sio.inventoryItemId=fli.inventoryItemId join Scheme s on s.id=sio.schemeId where s.type ='IN' and fo.fofoId= :fofoId and"
-
 
129
	    		+ " fo.createTimestamp between :startDate and :endDate and sio.rolledBackTimestamp is null group by fo.id, foi.id "),
-
 
130
	    
-
 
131
	    
-
 
132
	    @NamedQuery(name = "FofoOrder.selectPartnerBillingSummaryReport", query = "select new com.spice.profitmandi.dao.model.PartnerBillingSummaryModel(o.id,  o.createTimestamp, o.billingTimestamp,"
-
 
133
	    		+ " o.deliveryTimestamp, o.partnerGrnTimestamp, o.transactionId, case when o.logisticsTransactionId is null then 'NA' else o.logisticsTransactionId end,o.airwayBillNumber,  "
-
 
134
	    		+ " os.statusSubGroup, os.statusName, o.retailerId, o.retailerName, i.id, i.brand, i.modelName, i.modelNumber, i.color, l.unitPrice, l.quantity, l.totalPrice,  o.invoiceNumber,"
-
 
135
	    		+ " l.igstRate, l.cgstRate, l.sgstRate ) From Order o join LineItem l on l.orderId = o.id join Item i on l.itemId = i.id join Category c on i.categoryId = c.id join OrderStatus os on os.status=o.status"
-
 
136
	    		+ " join FofoStore fs on fs.id=o.retailerId where 1=1 and  o.billingTimestamp between :startDate and :endDate and o.retailerId = :fofoId "),
-
 
137
	    
94
})
138
})
95
public class FofoOrder implements Serializable {
139
public class FofoOrder implements Serializable {
96
 
140
 
97
	private static final long serialVersionUID = 1L;
141
	private static final long serialVersionUID = 1L;
98
 
142