private void OnMergedItemSelected(MergedItem obj) { if (obj.RemainingQuantity > 0) { decimal quantity = 1; if (GetTenderedValue() > 0) { quantity = GetTenderedValue(); } if (quantity > obj.RemainingQuantity) { quantity = obj.RemainingQuantity; } _selectedTotal += obj.Price * quantity; if (_selectedTotal > AppServices.MainDataContext.SelectedTicket.GetRemainingAmount()) { _selectedTotal = AppServices.MainDataContext.SelectedTicket.GetRemainingAmount(); } PaymentAmount = _selectedTotal.ToString("#,#0.00"); TenderedAmount = ""; _resetAmount = true; obj.IncQuantity(quantity); AppServices.MainDataContext.SelectedTicket.UpdatePaidItems(obj.MenuItemId); } ReturningAmountVisibility = Visibility.Collapsed; }
public void PrepareMergedItems() { MergedItems.Clear(); PaymentAmount = ""; _selectedTotal = 0; var serviceAmount = SelectedTicket.Model.GetTaxServicesTotal(); var sum = SelectedTicket.Model.GetSumWithoutTax(); if (sum == 0) { return; } foreach (var item in SelectedTicket.Model.TicketItems) { if (!item.Voided && !item.Gifted) { var ticketItem = item; var price = ticketItem.GetItemPrice(); price += (price * serviceAmount) / sum; if (!ticketItem.VatIncluded) { price += ticketItem.VatAmount; } var mitem = MergedItems.SingleOrDefault(x => x.MenuItemId == ticketItem.MenuItemId && x.Price == price); if (mitem == null) { mitem = new MergedItem { Description = item.MenuItemName + item.GetPortionDesc(), Price = price, MenuItemId = item.MenuItemId }; MergedItems.Add(mitem); } mitem.Quantity += item.Quantity; } } foreach (var paidItem in SelectedTicket.Model.PaidItems) { var item = paidItem; var mi = MergedItems.SingleOrDefault(x => x.MenuItemId == item.MenuItemId && x.Price == item.Price); if (mi != null) { mi.PaidItems.Add(paidItem); } } }
private void OnMergedItemSelected(MergedItem obj) { if (obj.RemainingQuantity > 0) { decimal quantity = 1; if (GetTenderedValue() > 0) quantity = GetTenderedValue(); if (quantity > obj.RemainingQuantity) quantity = obj.RemainingQuantity; _selectedTotal += obj.Price * quantity; if (_selectedTotal > AppServices.MainDataContext.SelectedTicket.GetRemainingAmount()) _selectedTotal = AppServices.MainDataContext.SelectedTicket.GetRemainingAmount(); PaymentAmount = _selectedTotal.ToString("#,#0.00"); TenderedAmount = ""; _resetAmount = true; obj.IncQuantity(quantity); AppServices.MainDataContext.SelectedTicket.UpdatePaidItems(obj.MenuItemId); } ReturningAmountVisibility = Visibility.Collapsed; }
public void PrepareMergedItems() { MergedItems.Clear(); PaymentAmount = ""; _selectedTotal = 0; var serviceAmount = SelectedTicket.Model.GetTaxServicesTotal(); var sum = SelectedTicket.Model.GetSumWithoutTax(); if (sum == 0) return; foreach (var item in SelectedTicket.Model.TicketItems) { if (!item.Voided && !item.Gifted) { var ticketItem = item; var price = ticketItem.GetItemPrice(); price += (price * serviceAmount) / sum; if (!ticketItem.VatIncluded) price += ticketItem.VatAmount; var mitem = MergedItems.SingleOrDefault(x => x.MenuItemId == ticketItem.MenuItemId && x.Price == price); if (mitem == null) { mitem = new MergedItem { Description = item.MenuItemName + item.GetPortionDesc(), Price = price, MenuItemId = item.MenuItemId }; MergedItems.Add(mitem); } mitem.Quantity += item.Quantity; } } foreach (var paidItem in SelectedTicket.Model.PaidItems) { var item = paidItem; var mi = MergedItems.SingleOrDefault(x => x.MenuItemId == item.MenuItemId && x.Price == item.Price); if (mi != null) mi.PaidItems.Add(paidItem); } }