public void closeVoucher(int discrepancyId, string approvedBy, string reason) { //Retrieve the record from the stock voucher with discrepancy id passed as parameter StockVoucher sv = context.StockVouchers.First(i => i.DiscrepancyID == discrepancyId); sv.ApprovedBy = approvedBy; sv.ApprovedDate = DateTime.Today; sv.Reason = reason; addStockTransaction(sv.ItemID, sv.Reason, sv.RaisedBy, sv.ActualCount - sv.OriginalCount); context.SaveChanges(); }
public StockVoucherPayload(StockVoucher sv) { DiscrepancyID = sv.DiscrepancyID; ItemID = sv.ItemID; ItemName = sv.Item.ItemName; UnitOfMeasure = sv.Item.UnitOfMeasure; QtyInStock = sv.OriginalCount; ActualCount = sv.ActualCount; UnitCost = sv.ItemCost; VoucherRaiserID = sv.RaisedBy; Reason = sv.Reason; }
public void addStockVoucher(string itemId, int actualcount, string employeeId, string reason) { StockVoucher sv = new StockVoucher(); //Setting the values received by the method to the object sv.ItemID = itemId; //Gettin goriginal count of the item according to the store records sv.OriginalCount = getStockCountOfItem(itemId); //entered by the clerk while taking stock sv.ActualCount = actualcount; //reason in case discrepancy sv.Reason = reason; sv.ItemCost = (decimal)getItemCost(itemId); sv.RaisedBy = employeeId; sv.RaisedByDate = DateTime.Today; context.StockVouchers.Add(sv); context.SaveChanges(); }