Beispiel #1
0
 private decimal GetPrice(Order order, decimal serviceAmount, decimal sum, decimal exchangeRate)
 {
     var result = order.GetItemPrice();
     if (serviceAmount != 0 && sum != 0) result += (result * serviceAmount) / sum;
     if (!order.TaxIncluded) result += order.TaxAmount;
     result = result / exchangeRate;
     return result;
 }
 private void CreateMergedItem(decimal sum, Order item, decimal serviceAmount)
 {
     var price = item.GetItemPrice();
     price += (price * serviceAmount) / sum;
     if (!item.TaxIncluded) price += item.TaxAmount;
     var mitem = MergedItems.SingleOrDefault(x => x.MenuItemId == item.MenuItemId && x.Price == price);
     if (mitem == null)
     {
         mitem = new MergedItem();
         try
         {
             mitem.Description = item.MenuItemName + item.GetPortionDesc();
             mitem.Price = price;
             mitem.MenuItemId = item.MenuItemId;
             MergedItems.Add(mitem);
         }
         finally
         {
             mitem.Dispose();
         }
     }
     mitem.Quantity += item.Quantity;
 }
Beispiel #3
0
 private static string GetKey(Order order)
 {
     return string.Format(Keyformat, order.MenuItemId, order.GetItemPrice());
 }
Beispiel #4
0
        private static string ReplaceLineVars(string line, Order order)
        {
            string result = line;

            if (order != null)
            {
                result = FormatData(result, TagNames.Quantity, () => order.Quantity.ToString("#,#0.##"));
                result = FormatData(result, TagNames.Name, () => order.MenuItemName + order.GetPortionDesc());
                result = FormatData(result, TagNames.Price, () => order.Price.ToString("#,#0.00"));
                result = FormatData(result, TagNames.Total, () => order.GetItemPrice().ToString("#,#0.00"));
                result = FormatData(result, TagNames.TotalAmount, () => order.GetItemValue().ToString("#,#0.00"));
                result = FormatData(result, TagNames.Cents, () => (order.Price * 100).ToString("#,##"));
                result = FormatData(result, TagNames.LineAmount, () => order.GetTotal().ToString("#,#0.00"));
                result = FormatData(result, TagNames.OrderNo, () => order.OrderNumber.ToString());
                result = FormatData(result, TagNames.PriceTag, () => order.PriceTag);
                result = _settingReplacer.ReplaceSettingValue("{SETTING:([^}]+)}", result);

                if (result.Contains(TagNames.Properties.Substring(0, TagNames.Properties.Length - 1)))
                {
                    string lineFormat = result;
                    if (order.OrderTagValues.Count > 0)
                    {
                        string label = "";
                        foreach (var property in order.OrderTagValues)
                        {
                            var itemProperty = property;
                            var lineValue = FormatData(lineFormat, TagNames.Properties, () => itemProperty.Name);
                            lineValue = FormatData(lineValue, TagNames.PropQuantity, () => itemProperty.Quantity.ToString("#.##"));
                            lineValue = FormatData(lineValue, TagNames.PropPrice, () => itemProperty.AddTagPriceToOrderPrice ? "" : itemProperty.Price.ToString("#,#0.00"));
                            label += lineValue + "\r\n";
                        }
                        result = "\r\n" + label;
                    }
                    else result = "";
                }
                result = result.Replace("<", "\r\n<");
            }
            return result;
        }