Exemplo n.º 1
0
        protected override string ReplaceTemplateValues(string templatePart, Ticket model, PrinterTemplate template)
        {
            var result = _preCalculationValueChanger.Replace(template, templatePart, model.Calculations.Where(x => !x.IncludeTax));

            result = _postCalculationValueChanger.Replace(template, result, model.Calculations.Where(x => x.IncludeTax));
            result = _paymentValueChanger.Replace(template, result, model.Payments);
            result = _changePaymentValueChanger.Replace(template, result, model.ChangePayments);
            result = _entityValueChanger.Replace(template, result, model.TicketEntities);
            result = _taxValueChanger.Replace(template, result, GetTaxValues(model));
            result = _orderValueChanger.Replace(template, result, model.Orders);
            return(result);
        }
Exemplo n.º 2
0
        protected override string ReplaceTemplateValues(string templatePart, Ticket model, PrinterTemplate template)
        {
            var result = PreCalculationValueChanger.Replace(template, templatePart, model.Calculations.Where(x => !x.IncludeTax));

            result = PostCalculationValueChanger.Replace(template, result, model.Calculations.Where(x => x.IncludeTax));
            result = PaymentValueChanger.Replace(template, result, model.Payments);
            result = ChangePaymentValueChanger.Replace(template, result, model.ChangePayments);
            result = ResourceValueChanger.Replace(template, result, model.TicketResources);
            result = TaxValueChanger.Replace(template, result, model.Orders.GroupBy(x => x.TaxTemplateName).Select(x => new TaxValue {
                Name = x.Key, Amount = x.Average(y => y.TaxRate), OrderAmount = x.Sum(y => y.GetItemValue() + (!y.TaxIncluded ? y.GetTotalTaxAmount(model.GetPlainSum(), model.GetPreTaxServicesTotal()) : 0)), TaxAmount = x.Sum(y => y.GetTotalTaxAmount(model.GetPlainSum(), model.GetPreTaxServicesTotal()))
            }));
            result = OrderValueChanger.Replace(template, result, model.Orders);
            return(result);
        }