示例#1
0
        public static Ticket Create(Department department, Account account, decimal exchangeRate, IEnumerable <CalculationType> calculationTypes)
        {
            var ticket = new Ticket
            {
                DepartmentId        = department.Id,
                AccountTypeId       = department.TicketTemplate.SaleTransactionType.TargetAccountTypeId,
                TransactionDocument = new AccountTransactionDocument()
            };

            ticket.UpdateAccount(account, exchangeRate);

            foreach (var calculationType in calculationTypes.OrderBy(x => x.Order))
            {
                ticket.AddCalculation(calculationType, calculationType.Amount);
            }
            return(ticket);
        }
示例#2
0
        public static Ticket Create(Department department, Account account, decimal exchangeRate, IEnumerable<CalculationType> calculationTypes)
        {
            var ticket = new Ticket
                             {
                                 DepartmentId = department.Id,
                                 AccountTypeId = department.TicketTemplate.SaleTransactionType.TargetAccountTypeId,
                                 TransactionDocument = new AccountTransactionDocument()
                             };

            ticket.UpdateAccount(account, exchangeRate);

            foreach (var calculationType in calculationTypes.OrderBy(x => x.Order))
            {
                ticket.AddCalculation(calculationType, calculationType.Amount);
            }
            return ticket;
        }
示例#3
0
        public static Ticket Create(Department department, Account account, IEnumerable<CalculationTemplate> calculationTemplates)
        {
            var ticket = new Ticket { DepartmentId = department.Id };

            ticket.AccountTemplateId = department.TicketTemplate.SaleTransactionTemplate.TargetAccountTemplateId;
            ticket.AccountTransactions = new AccountTransactionDocument();
            ticket.UpdateAccount(account);
            foreach (var calculationTemplate in calculationTemplates.OrderBy(x => x.Order))
            {
                ticket.AddCalculation(calculationTemplate, calculationTemplate.Amount);
            }
            return ticket;
        }
示例#4
0
        public static Ticket Create(Department department, Account account)
        {
            var ticket = new Ticket { DepartmentId = department.Id };

            foreach (var calulationTemplate in department.TicketTemplate.CalulationTemplates.OrderBy(x => x.Order)
                .Where(x => string.IsNullOrEmpty(x.ButtonHeader)))
            {
                ticket.AddCalculation(calulationTemplate, calulationTemplate.Amount);
            }

            ticket.AccountTemplateId = department.TicketTemplate.SaleTransactionTemplate.TargetAccountTemplateId;
            ticket.AccountTransactions = new AccountTransactionDocument();
            ticket.UpdateAccount(account);
            return ticket;
        }
示例#5
0
        public static Ticket Create(Department department, TicketType ticketType, Account account, decimal exchangeRate, IEnumerable<CalculationType> calculationTypes)
        {
            var ticket = new Ticket
                             {
                                 TicketTypeId = ticketType.Id,
                                 DepartmentId = department.Id,
                                 AccountTypeId = ticketType.SaleTransactionType.TargetAccountTypeId,
                                 TaxIncluded = ticketType.TaxIncluded,
                                 TransactionDocument = new AccountTransactionDocument()
                             };

            ticket.UpdateAccount(account, exchangeRate);
            if (calculationTypes != null)
            {
                foreach (var calculationType in calculationTypes.OrderBy(x => x.SortOrder))
                {
                    ticket.AddCalculation(calculationType, calculationType.Amount);
                }
            }
            return ticket;
        }