| Line 15... |
Line 15... |
| 15 |
+ "where ii.itemId in :itemIds and ii.fofoId = :fofoId and ii.purchaseId = :purchaseId group by ii.itemId"),
|
15 |
+ "where ii.itemId in :itemIds and ii.fofoId = :fofoId and ii.purchaseId = :purchaseId group by ii.itemId"),
|
| 16 |
//For Serialized models
|
16 |
//For Serialized models
|
| 17 |
@NamedQuery(name = "InventoryItem.selectAllLineItemIdsByInventoryIds", query = "select new com.spice.profitmandi.dao.model.InventoryItemSaleModel(ii.id, lii.id) from InventoryItem ii" +
|
17 |
@NamedQuery(name = "InventoryItem.selectAllLineItemIdsByInventoryIds", query = "select new com.spice.profitmandi.dao.model.InventoryItemSaleModel(ii.id, lii.id) from InventoryItem ii" +
|
| 18 |
" join Purchase p on p.id = ii.purchaseId join Order o on o.invoiceNumber = p.purchaseReference" +
|
18 |
" join Purchase p on p.id = ii.purchaseId join Order o on o.invoiceNumber = p.purchaseReference" +
|
| 19 |
" join LineItem li on li.orderId = o.id join LineItemImei lii on (lii.id=li.id and lii.serialNumber=ii.serialNumber)" +
|
19 |
" join LineItem li on li.orderId = o.id join LineItemImei lii on (lii.id=li.id and lii.serialNumber=ii.serialNumber)" +
|
| 20 |
"where ii.id in :inventoryItemIds"),
|
20 |
"where ii.id in :inventoryItemIds")
|
| 21 |
|
- |
|
| 22 |
//int lineItemImeiId, int fofoInventoryItemId, LocalDateTime invoiceDate, String invoiceNumber, double buyPrice, double sellPrice, int item, String itemName
|
- |
|
| 23 |
@NamedQuery(name = "InventoryItem.selectItemSaleSummary",
|
- |
|
| 24 |
query = "select new com.spice.profitmandi.dao.model.InventoryItemSaleModel(" +
|
- |
|
| 25 |
"lii.id, ii.id, o.billingTimestamp, o.invoiceNumber, cast(li.unitPrice as double) ,cast(foi.sellingPrice as double), li.item) from InventoryItem ii" +
|
- |
|
| 26 |
" join Purchase p on p.id = ii.purchaseId join Order o on o.invoiceNumber = p.purchaseReference" +
|
- |
|
| 27 |
" join LineItem li on li.orderId = o.id join LineItemImei lii on (lii.lineItemId=li.id and lii.serialNumber=ii.serialNumber)" +
|
- |
|
| 28 |
" join FofoLineItem fli on fli.inventoryItemId=ii.id join FofoOrderItem foi on foi.id=fli.fofoOrderItemId join FofoOrder fo on fo.id = foi.orderId" +
|
- |
|
| 29 |
" where ii.id in :inventoryItemIds and fo.cancelledTimestamp is null")
|
- |
|
| 30 |
})
|
21 |
})
|
| 31 |
@Entity
|
22 |
@Entity
|
| 32 |
@Table(name = "fofo.inventory_item")
|
23 |
@Table(name = "fofo.inventory_item")
|
| 33 |
public class InventoryItem implements Comparable {
|
24 |
public class InventoryItem implements Comparable {
|
| 34 |
|
25 |
|