| Line 86... |
Line 86... |
| 86 |
name = "ScanRecord.selectPurchaseByFofoId",
|
86 |
name = "ScanRecord.selectPurchaseByFofoId",
|
| 87 |
query = "select new com.spice.profitmandi.dao.model.ItemLedgerRow(ii.itemId, sum(sr.quantity), avg(ii.unitPrice - ii.priceDropAmount)) from ScanRecord sr join InventoryItem ii on ii.id = sr.inventoryItemId where sr.type='PURCHASE' and sr.createTimestamp >= :startDateTime and sr.createTimestamp <= :endDateTime and sr.fofoId = :fofoId group by ii.itemId"),
|
87 |
query = "select new com.spice.profitmandi.dao.model.ItemLedgerRow(ii.itemId, sum(sr.quantity), avg(ii.unitPrice - ii.priceDropAmount)) from ScanRecord sr join InventoryItem ii on ii.id = sr.inventoryItemId where sr.type='PURCHASE' and sr.createTimestamp >= :startDateTime and sr.createTimestamp <= :endDateTime and sr.fofoId = :fofoId group by ii.itemId"),
|
| 88 |
|
88 |
|
| 89 |
@NamedQuery(
|
89 |
@NamedQuery(
|
| 90 |
name = "ScanRecord.selectSaleByFofoId",
|
90 |
name = "ScanRecord.selectSaleByFofoId",
|
| 91 |
query = "select new com.spice.profitmandi.dao.model.ItemLedgerRow(ii.itemId, sum(sr.quantity), avg(ii.unitPrice - ii.priceDropAmount)) from ScanRecord sr join InventoryItem ii on ii.id = sr.inventoryItemId where sr.type='SALE' and sr.createTimestamp >= :startDateTime and sr.createTimestamp <= :endDateTime and sr.fofoId = :fofoId group by ii.itemId")
|
91 |
query = "select new com.spice.profitmandi.dao.model.ItemLedgerRow(ii.itemId, sum(sr.quantity), avg(ii.unitPrice - ii.priceDropAmount)) from ScanRecord sr join InventoryItem ii on ii.id = sr.inventoryItemId where sr.type in ('SALE', 'PURCHASE_RETURN') and sr.createTimestamp >= :startDateTime and sr.createTimestamp <= :endDateTime and sr.fofoId = :fofoId group by ii.itemId")
|
| 92 |
})
|
92 |
})
|
| 93 |
public class ScanRecord {
|
93 |
public class ScanRecord {
|
| 94 |
|
94 |
|
| 95 |
@Id
|
95 |
@Id
|
| 96 |
@Column(name="id", unique=true, updatable=false)
|
96 |
@Column(name="id", unique=true, updatable=false)
|