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); }
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; }
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; }
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; }
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; }