コード例 #1
0
 public AccountTransactionViewModel(IWorkspace workspace, AccountTransaction model, AccountTransactionDocument document)
 {
     Model = model ?? AccountTransaction.Null;
     _document = document;
     _workspace = workspace;
     _accountTransactionTemplate =
         AccountTransactionTemplates.SingleOrDefault(x => x.Id == Model.AccountTransactionTemplateId);
 }
コード例 #2
0
ファイル: Ticket.cs プロジェクト: yemreguney/SambaPOS-3
        public void AddPayment(AccountTransactionTemplate transactionTemplate, Account account, decimal amount, int userId)
        {
            var transaction = AccountTransaction.Create(transactionTemplate);
            transaction.Amount = amount;
            transaction.SetTargetAccount(account.AccountTemplateId, account.Id);
            transaction.UpdateAccounts(AccountTemplateId, AccountId);
            AccountTransactions.AccountTransactions.Add(transaction);
            var payment = new Payment { AccountTransaction = transaction, Amount = amount, Name = account.Name };
            Payments.Add(payment);

            LastPaymentDate = DateTime.Now;
            RemainingAmount = GetRemainingAmount();
            if (RemainingAmount == 0)
            {
                PaidItems.Clear();
            }
        }
コード例 #3
0
ファイル: Ticket.cs プロジェクト: yemreguney/SambaPOS-3
        public Order AddOrder(AccountTransactionTemplate template, string userName, MenuItem menuItem, MenuItemPortion portion, string priceTag)
        {
            Locked = false;
            var tif = new Order();
            tif.UpdateMenuItem(userName, menuItem, portion, priceTag, 1);
            tif.AccountTransactionTemplateId = template.Id;
            if (AccountTransactions.AccountTransactions.SingleOrDefault(x => x.AccountTransactionTemplateId == template.Id) == null)
            {
                var transaction = AccountTransaction.Create(template);
                transaction.UpdateAccounts(AccountTemplateId, AccountId);
                AccountTransactions.AccountTransactions.Add(transaction);
            }

            if (tif.AccountTransactionTaxTemplateId > 0
                && AccountTransactions.AccountTransactions
                    .SingleOrDefault(x => x.AccountTransactionTemplateId == tif.AccountTransactionTaxTemplateId) == null)
            {
                var transaction = AccountTransaction.Create(menuItem.TaxTemplate.AccountTransactionTemplate);
                transaction.UpdateAccounts(AccountTemplateId, AccountId);
                AccountTransactions.AccountTransactions.Add(transaction);
            }
            Orders.Add(tif);
            return tif;
        }
コード例 #4
0
        public static AccountTransaction Create(AccountTransactionTemplate template)
        {
            var result = new AccountTransaction
                             {
                                 Name = template.Name,
                                 AccountTransactionTemplateId = template.Id,
                                 SourceTransactionValue = new AccountTransactionValue(),
                                 TargetTransactionValue = new AccountTransactionValue()
                             };

            if (result.SourceTransactionValue != null)
            {
                result.SourceTransactionValue.AccountId = template.DefaultSourceAccountId;
                result.SourceTransactionValue.Name = template.Name;
            }

            if (result.TargetTransactionValue != null)
            {
                result.TargetTransactionValue.AccountId = template.DefaultTargetAccountId;
                result.TargetTransactionValue.Name = template.Name;
            }

            result.SourceAccountTemplateId = template.SourceAccountTemplateId;
            result.TargetAccountTemplateId = template.TargetAccountTemplateId;

            result.DynamicPart = null;
            if (template.DefaultSourceAccountId == 0) result.DynamicPart = true;
            if (template.DefaultTargetAccountId == 0) result.DynamicPart = false;

            return result;
        }
コード例 #5
0
        public static AccountTransaction Create(AccountTransactionTemplate template)
        {
            var result = new AccountTransaction
                             {
                                 Name = template.Name,
                                 AccountTransactionTemplateId = template.Id,
                                 SourceTransactionValue = new AccountTransactionValue { IsSource = true, AccountId = template.DefaultSourceAccountId, Name = template.Name },
                                 TargetTransactionValue = new AccountTransactionValue { IsSource = false, AccountId = template.DefaultTargetAccountId, Name = template.Name },
                                 SourceAccountTemplateId = template.SourceAccountTemplateId,
                                 TargetAccountTemplateId = template.TargetAccountTemplateId
                             };

            return result;
        }