Beispiel #1
0
        //结算账号
        protected void LoadPayBankAccountData(Guid filialeId)
        {
            if (!filialeId.Equals(Guid.Empty))
            {
                var list = _bankAccounts.GetBankAccountsList(Personnel.FilialeId, Personnel.BranchId, Personnel.PositionId).Where(ent => ent.IsUse);

                //根据公司id查找该公司绑定的所有银行账号
                var bankAccountInfoList = BankAccountManager.ReadInstance.GetListByTargetId(filialeId);
                if (bankAccountInfoList.Any())
                {
                    //在当前登录人有权限的银行列表中,筛选出所有与发票抬头公司id相等的“结算账号”
                    var joinQuery = (from bankAccountInfo in bankAccountInfoList
                                     join listInfo in list
                                     on bankAccountInfo.BankAccountsId equals listInfo.BankAccountsId
                                     select new BankAccountInfo
                    {
                        BankName = listInfo.BankName,
                        AccountsName = listInfo.AccountsName,
                        BankAccountsId = listInfo.BankAccountsId
                    }).ToList();
                    list = joinQuery;
                }
                else
                {
                    list = list.Where(p => !p.IsMain);
                }

                foreach (var info in list)
                {
                    var name = info.BankName + "【" + info.AccountsName + "】";
                    rcb_PayBankAccount.Items.Add(new RadComboBoxItem(name, info.BankAccountsId.ToString()));
                }
            }
            rcb_PayBankAccount.Items.Insert(0, new RadComboBoxItem("请选择", ""));
        }
        /// <summary> 绑定付款银行列表
        /// </summary>
        /// <returns></returns>
        protected Dictionary <string, string> BindBankDataBound()
        {
            var personnel = CurrentSession.Personnel.Get();
            var newDic    = new Dictionary <string, string> {
                { Guid.Empty.ToString(), string.Empty }
            };
            var list = _bankAccounts.GetBankAccountsList(personnel.FilialeId, personnel.BranchId, personnel.PositionId);

            foreach (var item in list)
            {
                newDic.Add(item.BankAccountsId.ToString(), item.BankName + "-" + item.AccountsName);
            }
            return(newDic);
        }
Beispiel #3
0
        ///<summary>
        /// 获取银行账户列表
        ///</summary>
        ///<returns></returns>
        public IList <BankAccountInfo> GetBankAccountsList()
        {
            var selectSalePlatformInfo = CacheCollection.SalePlatform.Get(TargetId);

            if (selectSalePlatformInfo != null)
            {
                var bankAccountList = _bankAccountDaoWrite.GetListByTargetId(selectSalePlatformInfo.FilialeId);
                #region [已注释] 允许多绑
                //foreach (var bankAccountsInfo in bankAccountList)
                //{
                //    var iteminfo = new BankAccountsInfo
                //                    {
                //                        BankAccountsId = bankAccountsInfo.BankAccountsId,
                //                        Accounts =bankAccountsInfo.Accounts + " => " + bankAccountsInfo.BankName + " 【" +ERP.Enum.Attribute.EnumAttribute.GetKeyName((PaymentType) bankAccountsInfo.PaymentType) +"】"
                //                    };
                //    needBankAccountList.Add(iteminfo);
                //}
                #endregion

                #region  每个账号只对应一个公司
                var salePlatformList         = CacheCollection.SalePlatform.GetListByFilialeId(selectSalePlatformInfo.FilialeId);
                var bindingedBankAccountList = new List <BankAccountInfo>();
                foreach (var salePlatformInfo in salePlatformList)
                {
                    bindingedBankAccountList.AddRange(BankAccountManager.ReadInstance.GetListByTargetId(salePlatformInfo.ID));
                }

                #endregion
                return((from info in bankAccountList
                        where bindingedBankAccountList.All(ent => ent.BankAccountsId != info.BankAccountsId)
                        select new BankAccountInfo
                {
                    BankAccountsId = info.BankAccountsId,
                    Accounts = info.Accounts + " => " + info.BankName + "【" + EnumAttribute.GetKeyName((PaymentType)info.PaymentType) + "】"
                }).ToList());
            }
            var filiale = CacheCollection.Filiale.Get(TargetId);
            IList <BankAccountInfo> oldlist = filiale != null && filiale.FilialeTypes.Contains((int)MIS.Enum.FilialeType.SaleCompany) ?
                                              _bankAccountsWrite.GetBankAccountsNoBindingList().Where(b => b.IsUse).ToList():_bankAccountsWrite.GetBankAccountsList(new[] { PaymentType.Tradition, PaymentType.Tradition }).Where(b => b.IsUse).ToList();
            return(oldlist.Select(binfo => new BankAccountInfo
            {
                BankAccountsId = binfo.BankAccountsId,
                Accounts = binfo.Accounts + " => " + binfo.BankName + " 【" + EnumAttribute.GetKeyName((PaymentType)binfo.PaymentType) + "】"
            }).ToList());
        }
Beispiel #4
0
        //遍历资金帐户
        private bool RecursivelyBankAccounts(IRadTreeNodeContainer node, Guid targetId)
        {
            var flag          = true;
            var personnelInfo = CurrentSession.Personnel.Get();

            if (personnelInfo != null)
            {
                var selectSalePlatformInfo          = CacheCollection.SalePlatform.Get(targetId);
                IEnumerable <BankAccountInfo> infos = _bankAccountsDao.GetListByTargetId(targetId);
                if (infos != null && infos.Any())
                {
                    if (selectSalePlatformInfo == null)
                    {
                        IList <BankAccountInfo> bankAccountList =
                            _bankAccounts.GetBankAccountsList(personnelInfo.FilialeId, personnelInfo.BranchId, personnelInfo.PositionId)
                            .Where(b => infos.Any(ent => ent.BankAccountsId == b.BankAccountsId) && b.IsUse)
                            .OrderByDescending(b => b.IsUse)
                            .ToList();

                        var salePlatformList         = CacheCollection.SalePlatform.GetListByFilialeId(targetId);
                        var bindingedBankAccountList = new List <BankAccountInfo>();
                        foreach (var salePlatformInfo in salePlatformList.Where(act => act.IsActive))
                        {
                            bindingedBankAccountList.AddRange(_bankAccountsDao.GetListByTargetId(salePlatformInfo.ID));
                        }
                        var needBankAccountList = (from item in bankAccountList
                                                   where
                                                   bindingedBankAccountList.All(
                                                       ent => ent.BankAccountsId != item.BankAccountsId)
                                                   select new BankAccountInfo
                        {
                            BankAccountsId = item.BankAccountsId,
                            Accounts = item.Accounts,
                            AccountsKey = item.AccountsKey,
                            AccountsName = item.AccountsName,
                            BankIcon = item.BankIcon,
                            BankName = item.BankName,
                            Description = item.Description,
                            IsFinish = item.IsFinish,
                            IsUse = item.IsUse,
                            OrderIndex = item.OrderIndex,
                            PaymentInterfaceId = item.PaymentInterfaceId,
                            PaymentType = item.PaymentType,
                        }).ToList();
                        flag = needBankAccountList.Count > 0;
                        foreach (var bankAccountsInfo in needBankAccountList)
                        {
                            var childNode =
                                CreateNode(
                                    (bankAccountsInfo.IsUse ? "" : "【停用】") + bankAccountsInfo.BankName + " - " + bankAccountsInfo.AccountsName + "[" +
                                    GetBankAccountsCount(bankAccountsInfo.BankAccountsId).ToString("N") + "]", false,
                                    bankAccountsInfo.BankAccountsId.ToString(), "BankAccount");
                            node.Nodes.Add(childNode);
                        }
                    }
                    else
                    {
                        if (selectSalePlatformInfo.IsActive)
                        {
                            IList <BankAccountInfo> bankAccountsInfoList =
                                _bankAccounts.GetBankAccountsList(personnelInfo.FilialeId, personnelInfo.BranchId, personnelInfo.PositionId)
                                .Where(b => infos.Any(ent => ent.BankAccountsId == b.BankAccountsId) && b.IsUse)
                                .OrderByDescending(b => b.IsUse)
                                .ToList();
                            flag = bankAccountsInfoList.Count > 0;
                            foreach (var bankAccountsInfo in bankAccountsInfoList)
                            {
                                var childNode =
                                    CreateNode(
                                        (bankAccountsInfo.IsUse ? "" : "【停用】") + bankAccountsInfo.BankName + " - " + bankAccountsInfo.AccountsName + "[" +
                                        GetBankAccountsCount(bankAccountsInfo.BankAccountsId).ToString("N") + "]", false,
                                        bankAccountsInfo.BankAccountsId.ToString(), "BankAccount");
                                node.Nodes.Add(childNode);
                            }
                        }
                        else
                        {
                            flag = false;
                        }
                    }
                }
            }
            return(flag);
        }
Beispiel #5
0
 /// <summary>
 /// 获取资金帐号列表
 /// </summary>
 /// <returns></returns>
 public IList <BankAccountInfo> GetBankAccountsList()
 {
     return(_bankAccounts.GetBankAccountsList());
 }