예제 #1
0
 private void LoadCapex()
 {
     if (SelectedYear != 0)
     {
         CapexList.Clear();
         CapexAccountsList.Clear();
         StatusSumList.Clear();
         foreach (var capex in FullCapexList.Where(f => f.CapexYear == SelectedYear))
         {
             var capexWithRest = new CapexWithRest();
             capexWithRest.Capex = capex;
             var sum = AccountsList.Where(a => a.AccountsStatusDetailsSets.LastOrDefault().AccountStatus != Statuses.InCancel).Sum(a => a.AccountsCapexInfoSets.Where(c => c.CapexId == capex.Id).Sum(c => c.AccountCapexAmount));
             if (capex.CapexAmount == 0)
             {
                 capexWithRest.Rest = sum;
                 capexWithRest.Pay  = 100;
             }
             else
             {
                 capexWithRest.Rest = capex.CapexAmount - sum;
                 capexWithRest.Pay  = sum == 0 ? 0 : Convert.ToInt32(sum * 100 / capex.CapexAmount);
             }
             capexWithRest.PaySum = sum;
             CapexList.Add(capexWithRest);
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Deletes the currently selected row from ObservableCollection<AccountList>
 /// </summary>
 public void DeleteSelectedRow()
 {
     if (AccountsList.Count(s => s.isSelected) > 0)
     {
         List <AccountModel> selectedAccounts = AccountsList.Where(s => s.isSelected).ToList();
         foreach (AccountModel acct in selectedAccounts)
         {
             AccountsList.Remove(acct);
         }
     }
 }
예제 #3
0
 private void SearchAccount()
 {
     if (!string.IsNullOrWhiteSpace(SearchAccountText))
     {
         SearchAccountList = new ObservableCollection <AccountsMainSet>(AccountsList.Where(a => a.AccountNumber.Contains(SearchAccountText)));
     }
     else
     {
         SearchAccountList.Clear();
     }
 }
예제 #4
0
        private void LoadAccountsForStore()
        {
            if (ResultStore == null || AccountsList == null)
            {
                return;
            }
            StoreAccountsList.Clear();
            foreach (var account in AccountsList.Where(a => a.AccountsStoreDetailsSets.Any(s => s.AccountStore == ResultStore.StoreNumber)))
            {
                var storeAccount = new StoreAccount();
                var status       = account.AccountsStatusDetailsSets.LastOrDefault();
                var capexes      = account.AccountsCapexInfoSets;

                storeAccount.AccountAmount = account.AccountAmount.Value;
                if (capexes != null)
                {
                    var i = 1;
                    foreach (var capex in capexes)
                    {
                        if (i == capexes.Count)
                        {
                            storeAccount.AccountCapex += capex.AccountCapexName;
                        }
                        else
                        {
                            storeAccount.AccountCapex += capex.AccountCapexName + ";";
                        }
                        i++;
                    }
                }
                storeAccount.AccountCompany     = account.AccountCompany;
                storeAccount.AccountDate        = account.AccountDate;
                storeAccount.AccountDescription = account.AccountDescription;
                storeAccount.AccountNumber      = account.AccountNumber;
                storeAccount.AccountStatus      = status.AccountStatus;
                storeAccount.AccountStatusDate  = status.AccountStatusDate;
                StoreAccountsList.Add(storeAccount);
            }
        }