当前位置: 首页>>代码示例>>C#>>正文


C# Ticket.GetRemainingAmount方法代码示例

本文整理汇总了C#中Samba.Domain.Models.Tickets.Ticket.GetRemainingAmount方法的典型用法代码示例。如果您正苦于以下问题:C# Ticket.GetRemainingAmount方法的具体用法?C# Ticket.GetRemainingAmount怎么用?C# Ticket.GetRemainingAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Samba.Domain.Models.Tickets.Ticket的用法示例。


在下文中一共展示了Ticket.GetRemainingAmount方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Preauth

        private static decimal Preauth(SecureString swipeData, Ticket ticket, decimal tenderedAmount, decimal gratuity)
        {
            // preauthPayment

            if (gratuity > 0 && Settings.GratuityService != null) // add gratuity amount to ticket
                ticket.AddTaxService(Settings.GratuityService.Id, Settings.GratuityService.CalculationMethod, gratuity);

            using (var sm = new SecureStringToStringMarshaler(swipeData))
            {
                // access swipedata as demonstrated here 
                InteractionService.UserIntraction.GiveFeedback(string.Format("Amount:{0}\r\rPreauth:\r{1}", ticket.GetRemainingAmount(), sm.String));
                // *------------------------
                // Preauth Here
                // *------------------------
            }
            AddPreauthData(ticket.Id, swipeData, "SAMPLE MERCHANT AUTH CODE", tenderedAmount, gratuity);
            return tenderedAmount + gratuity;
        }
开发者ID:hpbaotho,项目名称:sambapos,代码行数:18,代码来源:ExternalCreditCardProcessor.cs

示例2: RecalculateTicket

 public void RecalculateTicket(Ticket ticket)
 {
     var total = ticket.TotalAmount;
     ticket.Calculations.Where(x => x.CalculationType == 5).ToList().ForEach(
         x => x.Amount = _expressionService.EvalCommand(FunctionNames.Calculation, "_" + x.Name, new { Ticket = ticket }, 0m));
     ticket.Recalculate();
     if (total != ticket.TotalAmount)
     {
         _applicationState.NotifyEvent(RuleEventNames.TicketTotalChanged,
             new
             {
                 Ticket = ticket,
                 PreviousTotal = total,
                 TicketTotal = ticket.GetSum(),
                 DiscountTotal = ticket.GetPreTaxServicesTotal(),
                 PaymentTotal = ticket.GetPaymentAmount(),
                 RemainingAmount = ticket.GetRemainingAmount()
             });
     }
 }
开发者ID:hperassi,项目名称:SambaPOS-3,代码行数:20,代码来源:TicketService.cs

示例3: AddPayment

 public void AddPayment(Ticket ticket, PaymentType paymentType, Account account, decimal tenderedAmount)
 {
     if (account == null) return;
     var remainingAmount = ticket.GetRemainingAmount();
     var changeAmount = tenderedAmount > remainingAmount ? tenderedAmount - remainingAmount : 0;
     ticket.AddPayment(paymentType, account, tenderedAmount, GetExchangeRate(account), _applicationState.CurrentLoggedInUser.Id);
     _applicationState.NotifyEvent(RuleEventNames.PaymentProcessed,
         new
         {
             Ticket = ticket,
             PaymentTypeName = paymentType.Name,
             TenderedAmount = tenderedAmount,
             ProcessedAmount = tenderedAmount - changeAmount,
             ChangeAmount = changeAmount,
             SelectedQuantity = ticket.PaidItems.Sum(x => x.Quantity),
             RemainingAmount = ticket.GetRemainingAmount()
         });
 }
开发者ID:hperassi,项目名称:SambaPOS-3,代码行数:18,代码来源:TicketService.cs

示例4: PayTicket

 public void PayTicket(Ticket ticket, PaymentType template)
 {
     var amount = ticket.GetRemainingAmount();
     AddPayment(ticket, template, template.Account ?? GetAccountForPayment(ticket, template), amount, amount);
 }
开发者ID:khriza,项目名称:SambaPOS-3,代码行数:5,代码来源:TicketService.cs

示例5: PayTicket

 public void PayTicket(Ticket ticket, PaymentType template)
 {
     AddPayment(ticket, template, template.Account, ticket.GetRemainingAmount());
 }
开发者ID:hperassi,项目名称:SambaPOS-3,代码行数:4,代码来源:TicketService.cs

示例6: CanSettleTicket

 public bool CanSettleTicket(Ticket ticket)
 {
     return CanCloseTicket(ticket) && (ticket.GetRemainingAmount() > 0 || ticket.Orders.Count > 0);
 }
开发者ID:khriza,项目名称:SambaPOS-3,代码行数:4,代码来源:TicketService.cs

示例7: RecalculateTicket

 public void RecalculateTicket(Ticket ticket)
 {
     var total = ticket.TotalAmount;
     ticket.Recalculate();
     if (total != ticket.TotalAmount)
     {
         _automationService.NotifyEvent(RuleEventNames.TicketTotalChanged,
             new
             {
                 Ticket = ticket,
                 PreviousTotal = total,
                 TicketTotal = ticket.GetSum(),
                 DiscountTotal = ticket.GetPreTaxServicesTotal(),
                 PaymentTotal = ticket.GetPaymentAmount(),
                 RemainingAmount = ticket.GetRemainingAmount()
             });
     }
 }
开发者ID:neapolis,项目名称:SambaPOS-3,代码行数:18,代码来源:TicketService.cs

示例8: Prepare

 public void Prepare(Ticket selectedTicket)
 {
     Debug.Assert(SelectedTicket == null);
     Totals.Model = selectedTicket;
     SelectedTicket = selectedTicket;
     TicketRemainingValue = selectedTicket.GetRemainingAmount();
     PrepareMergedItems();
     RefreshValues();
     LastTenderedAmount = PaymentAmount;
     CreateButtons(selectedTicket);
 }
开发者ID:betology,项目名称:SambaPOS-3,代码行数:11,代码来源:PaymentEditorViewModel.cs

示例9: ReplaceDocumentVars

        private static string ReplaceDocumentVars(string document, Ticket ticket, int orderNo, string userName)
        {
            string result = document;
            if (string.IsNullOrEmpty(document)) return "";

            result = FormatData(result, TagNames.TicketDate, () => ticket.Date.ToShortDateString());
            result = FormatData(result, TagNames.TicketTime, () => ticket.Date.ToShortTimeString());
            result = FormatData(result, TagNames.Date, () => DateTime.Now.ToShortDateString());
            result = FormatData(result, TagNames.Time, () => DateTime.Now.ToShortTimeString());
            result = FormatData(result, TagNames.TicketId, () => ticket.Id.ToString());
            result = FormatData(result, TagNames.TicketNo, () => ticket.TicketNumber);
            result = FormatData(result, TagNames.OrderNo, orderNo.ToString);
            result = FormatData(result, TagNames.TicketTag, ticket.GetTagData);
            result = FormatDataIf(true, result, TagNames.Department, () => GetDepartmentName(ticket.DepartmentId));

            const string ticketTagPattern = TagNames.TicketTag2 + "[^}]+}";

            while (Regex.IsMatch(result, ticketTagPattern))
            {
                var value = Regex.Match(result, ticketTagPattern).Groups[0].Value;
                var tags = "";
                try
                {
                    var tag = value.Trim('{', '}').Split(':')[1];
                    tags = tag.Split(',').Aggregate(tags, (current, t) => current +
                        (!string.IsNullOrEmpty(ticket.GetTagValue(t.Trim()))
                        ? (t + ": " + ticket.GetTagValue(t.Trim()) + "\r")
                        : ""));
                    result = FormatData(result.Trim('\r'), value, () => tags);
                }
                catch (Exception)
                {
                    result = FormatData(result, value, () => "");
                }
            }

            const string ticketTag2Pattern = TagNames.TicketTag3 + "[^}]+}";

            while (Regex.IsMatch(result, ticketTag2Pattern))
            {
                var value = Regex.Match(result, ticketTag2Pattern).Groups[0].Value;
                var tag = value.Trim('{', '}').Split(':')[1];
                var tagValue = ticket.GetTagValue(tag);
                try
                {
                    result = FormatData(result, value, () => tagValue);
                }
                catch (Exception)
                {
                    result = FormatData(result, value, () => "");
                }
            }

            var title = userName;

            result = FormatData(result, TagNames.LocationUser, () => title);
            result = FormatData(result, TagNames.UserName, () => userName);
            result = FormatData(result, TagNames.Note, () => ticket.Note);
            result = FormatData(result, TagNames.AccName, () => ticket.AccountName);

            if (ticket.AccountId > 0 && (result.Contains(TagNames.AccAddress) || result.Contains(TagNames.AccPhone)))
            {
                var account = Dao.SingleWithCache<Resource>(x => x.Id == ticket.AccountId);
                result = FormatData(result, TagNames.AccPhone, () => account.SearchString);
            }

            result = RemoveTag(result, TagNames.AccAddress);
            result = RemoveTag(result, TagNames.AccPhone);

            var payment = ticket.GetPaymentAmount();
            var remaining = ticket.GetRemainingAmount();
            var plainTotal = ticket.GetPlainSum();
            var preTaxServices = ticket.GetPreTaxServicesTotal();
            var taxAmount = ticket.CalculateTax(plainTotal, preTaxServices);  //GetTaxTotal(ticket.Orders, plainTotal, ticket.GetDiscountTotal());
            var servicesTotal = ticket.GetPostTaxServicesTotal();
            //ticket.CalculateTax(plainTotal, preTaxServices);

            result = FormatDataIf(taxAmount > 0 || preTaxServices > 0 || servicesTotal > 0, result, TagNames.PlainTotal, () => plainTotal.ToString("#,#0.00"));
            result = FormatDataIf(preTaxServices > 0, result, TagNames.DiscountTotal, () => preTaxServices.ToString("#,#0.00"));
            result = FormatDataIf(taxAmount > 0, result, TagNames.TaxTotal, () => taxAmount.ToString("#,#0.00"));
            result = FormatDataIf(taxAmount > 0, result, TagNames.TaxDetails, () => GetTaxDetails(ticket.Orders, plainTotal, preTaxServices));
            result = FormatDataIf(servicesTotal > 0, result, TagNames.CalculationDetails, () => GetServiceDetails(ticket));

            result = FormatDataIf(payment > 0, result, TagNames.IfPaid,
                () => string.Format(Resources.RemainingAmountIfPaidValue_f, payment.ToString("#,#0.00"), remaining.ToString("#,#0.00")));

            result = FormatDataIf(preTaxServices > 0, result, TagNames.IfDiscount,
                () => string.Format(Resources.DiscountTotalAndTicketTotalValue_f, (plainTotal).ToString("#,#0.00"), preTaxServices.ToString("#,#0.00")));

            result = FormatDataIf(preTaxServices < 0, result, TagNames.IfFlatten, () => string.Format(Resources.IfNegativeDiscountValue_f, preTaxServices.ToString("#,#0.00")));

            result = FormatData(result, TagNames.TicketTotal, () => ticket.GetSum().ToString("#,#0.00"));
            result = FormatData(result, TagNames.PaymentTotal, () => ticket.GetPaymentAmount().ToString("#,#0.00"));
            result = FormatData(result, TagNames.Balance, () => ticket.GetRemainingAmount().ToString("#,#0.00"));

            result = FormatData(result, TagNames.TotalText, () => HumanFriendlyInteger.CurrencyToWritten(ticket.GetSum()));
            result = FormatData(result, TagNames.Totaltext, () => HumanFriendlyInteger.CurrencyToWritten(ticket.GetSum(), true));

            result = _settingReplacer.ReplaceSettingValue("{SETTING:([^}]+)}", result);

//.........这里部分代码省略.........
开发者ID:betology,项目名称:SambaPOS-3,代码行数:101,代码来源:TicketFormatter.cs

示例10: ReplaceDocumentVars

        private static string ReplaceDocumentVars(string document, Ticket ticket, int orderNo, int userNo, int departmentNo)
        {
            string result = document;
            if (string.IsNullOrEmpty(document)) return "";

            result = FormatData(result, Resources.TF_TicketDate, () => ticket.Date.ToShortDateString());
            result = FormatData(result, Resources.TF_TicketTime, () => ticket.Date.ToShortTimeString());
            result = FormatData(result, Resources.TF_DayDate, () => DateTime.Now.ToShortDateString());
            result = FormatData(result, Resources.TF_DayTime, () => DateTime.Now.ToShortTimeString());
            result = FormatData(result, Resources.TF_UniqueTicketId, () => ticket.Id.ToString());
            result = FormatData(result, Resources.TF_TicketNumber, () => ticket.TicketNumber);
            result = FormatData(result, Resources.TF_LineOrderNumber, orderNo.ToString);
            result = FormatData(result, Resources.TF_TicketTag, ticket.GetTagData);
            result = FormatDataIf(true, result, "{DEPARTMENT}", () => GetDepartmentName(departmentNo));

            var ticketTagPattern = Resources.TF_OptionalTicketTag + "[^}]+}";

            while (Regex.IsMatch(result, ticketTagPattern))
            {
                var value = Regex.Match(result, ticketTagPattern).Groups[0].Value;
                var tags = "";
                try
                {
                    var tag = value.Trim('{', '}').Split(':')[1];
                    tags = tag.Split(',').Aggregate(tags, (current, t) => current +
                        (!string.IsNullOrEmpty(ticket.GetTagValue(t.Trim()))
                        ? (t + ": " + ticket.GetTagValue(t.Trim()) + "\r")
                        : ""));
                    result = FormatData(result.Trim('\r'), value, () => tags);
                }
                catch (Exception)
                {
                    result = FormatData(result, value, () => "");
                }
            }

            const string ticketTag2Pattern = "{TICKETTAG:[^}]+}";

            while (Regex.IsMatch(result, ticketTag2Pattern))
            {
                var value = Regex.Match(result, ticketTag2Pattern).Groups[0].Value;
                var tag = value.Trim('{', '}').Split(':')[1];
                var tagValue = ticket.GetTagValue(tag);
                try
                {
                    result = FormatData(result, value, () => tagValue);
                }
                catch (Exception)
                {
                    result = FormatData(result, value, () => "");
                }
            }

            var userName = AppServices.MainDataContext.GetUserName(userNo);

            var title = ticket.LocationName;
            if (string.IsNullOrEmpty(ticket.LocationName))
                title = userName;

            result = FormatData(result, Resources.TF_TableOrUserName, () => title);
            result = FormatData(result, Resources.TF_UserName, () => userName);
            result = FormatData(result, Resources.TF_TableName, () => ticket.LocationName);
            result = FormatData(result, Resources.TF_TicketNote, () => ticket.Note ?? "");
            result = FormatData(result, Resources.TF_AccountName, () => ticket.CustomerName);
            result = FormatData(result, "{ACC GROUPCODE}", () => ticket.CustomerGroupCode);

            if (ticket.CustomerId > 0 && (result.Contains(Resources.TF_AccountAddress) || result.Contains(Resources.TF_AccountPhone) || result.Contains("{ACC NOTE}")))
            {
                var customer = Dao.SingleWithCache<Customer>(x => x.Id == ticket.CustomerId);
                result = FormatData(result, Resources.TF_AccountAddress, () => customer.Address);
                result = FormatData(result, Resources.TF_AccountPhone, () => customer.PhoneNumber);
                result = FormatData(result, "{ACC NOTE}", () => customer.Note);
            }

            if (ticket.CustomerId > 0 && result.Contains("{ACC BALANCE}"))
            {
                var accBalance = CashService.GetAccountBalance(ticket.CustomerId);
                result = FormatDataIf(accBalance != 0, result, "{ACC BALANCE}", () => accBalance.ToString("#,#0.00"));
            }

            result = RemoveTag(result, Resources.TF_AccountAddress);
            result = RemoveTag(result, Resources.TF_AccountPhone);

            var payment = ticket.GetPaymentAmount();
            var remaining = ticket.GetRemainingAmount();
            var discount = ticket.GetDiscountAndRoundingTotal();
            var plainTotal = ticket.GetPlainSum();
            var giftAmount = ticket.GetTotalGiftAmount();
            var vatAmount = GetTaxTotal(ticket.TicketItems, plainTotal, ticket.GetDiscountTotal());
            var taxServicesTotal = ticket.GetTaxServicesTotal();
            var ticketPaymentAmount = ticket.GetPaymentAmount();

            result = FormatDataIf(vatAmount > 0 || discount > 0 || taxServicesTotal > 0, result, "{PLAIN TOTAL}", () => plainTotal.ToString("#,#0.00"));
            result = FormatDataIf(discount > 0, result, "{DISCOUNT TOTAL}", () => discount.ToString("#,#0.00"));
            result = FormatDataIf(vatAmount > 0, result, "{TAX TOTAL}", () => vatAmount.ToString("#,#0.00"));
            result = FormatDataIf(taxServicesTotal > 0, result, "{SERVICE TOTAL}", () => taxServicesTotal.ToString("#,#0.00"));
            result = FormatDataIf(vatAmount > 0, result, "{TAX DETAILS}", () => GetTaxDetails(ticket.TicketItems, plainTotal, discount));
            result = FormatDataIf(taxServicesTotal > 0, result, "{SERVICE DETAILS}", () => GetServiceDetails(ticket));

            result = FormatDataIf(payment > 0, result, Resources.TF_RemainingAmountIfPaid,
//.........这里部分代码省略.........
开发者ID:basio,项目名称:veropos,代码行数:101,代码来源:TicketFormatter.cs


注:本文中的Samba.Domain.Models.Tickets.Ticket.GetRemainingAmount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。