public override void SearchData(DateTime BeginDate, DateTime EndDate, int[] AccountIDs)
        {
            if (zyAccountlist != null)
            {
                List <ZY_Account> zyAccountlist1 = zyAccountlist.FindAll(x => AccountIDs.Contains(x.AccountID));
                if (zyAccountlist1.Count > 0)
                {
                    GetText(zyAccountlist1, BeginDate, EndDate);
                    GetChargeData();
                    GetCostData();

                    ChargeAllText = chargeAllText;
                    ChargeAllData = chargeAllData;
                    CostAllText   = costAllText;
                    CostAllData   = costAllData;
                }
                else
                {
                    ChargeAllData = new ChargeAllData();
                    ChargeAllText = new ChargeAllText();
                    CostAllText   = new CostAllText();
                    CostAllData   = new CostAllData();
                    CostEmps      = new CostEmp[0];
                }
            }
        }
        public override void SearchData(DateTime BeginDate, DateTime EndDate)
        {
            //第一步:得到交款表的数据
            zyAccountlist = zyAccount.GetAllData(BeginDate, EndDate);

            if (zyAccountlist.Count > 0)
            {
                GetText(zyAccountlist, BeginDate, EndDate);
                GetChargeData();
                GetCostData();

                ChargeAllText = chargeAllText;
                ChargeAllData = chargeAllData;
                CostAllText   = costAllText;
                CostAllData   = costAllData;
            }
            else
            {
                ChargeAllData = new ChargeAllData();
                ChargeAllText = new ChargeAllText();
                CostAllText   = new CostAllText();
                CostAllData   = new CostAllData();
                CostEmps      = new CostEmp[0];
            }
        }
        private void GetText(List <ZY_ChargeList> zy_chargelist, List <ZY_CostMaster> zy_costmaster)
        {
            chargeAllText = new ChargeAllText();
            chargeAllData = new ChargeAllData();
            costAllText   = new CostAllText();
            costAllData   = new CostAllData();

            //预交金
            decimal _OrderAllFee = 0;
            int     _OrderAllNum = 0;
            decimal _BackAllFee  = 0;
            int     _BackAllNum  = 0;
            decimal _AllFee      = 0;
            decimal _Menoy       = 0;
            decimal _POS         = 0;

            //结算
            decimal _receiveFee = 0;
            int     _receiveNum = 0;
            decimal _retreatFee = 0;
            int     _retreatNum = 0;

            decimal _AllFee1 = 0;
            decimal _Menoy1  = 0;
            decimal _POS1    = 0;

            decimal _costFee      = 0;
            decimal _faoverFee    = 0;
            decimal _deptosit_fee = 0;

            if (zy_chargelist != null && zy_chargelist.Count > 0)
            {
                _OrderAllFee = zy_chargelist.FindAll(x => x.Record_Flag != 2).Sum(x => x.Total_Fee);
                _OrderAllNum = zy_chargelist.FindAll(x => x.Record_Flag == 0).Count;
                _BackAllFee  = zy_chargelist.FindAll(x => x.Record_Flag == 2).Sum(x => x.Total_Fee);
                _BackAllNum  = zy_chargelist.FindAll(x => x.Record_Flag == 2).Count;
                _AllFee      = zy_chargelist.Sum(x => x.Total_Fee);
                _Menoy       = zy_chargelist.FindAll(x => x.FeeType == 0).Sum(x => x.Total_Fee);
                _POS         = zy_chargelist.FindAll(x => x.FeeType == 1).Sum(x => x.Total_Fee);
            }

            if (zy_costmaster != null && zy_costmaster.Count > 0)
            {
                _receiveFee = zy_costmaster.FindAll(x => x.Reality_Fee >= 0).Sum(x => x.Total_Fee);
                _receiveNum = zy_costmaster.FindAll(x => x.Reality_Fee >= 0 && x.Record_Flag == 0).Count;
                _retreatFee = zy_costmaster.FindAll(x => x.Reality_Fee < 0).Sum(x => x.Total_Fee);
                _retreatNum = zy_costmaster.FindAll(x => x.Reality_Fee < 0 && x.Record_Flag == 0).Count;
                _AllFee1    = zy_costmaster.Sum(x => (x.Reality_Fee + x.Village_Fee + x.Favor_Fee));//结算金额=实收金额+记账金额+优惠金额
                _Menoy1     = zy_costmaster.Sum(x => x.Money_Fee);
                _POS1       = zy_costmaster.Sum(x => x.Pos_Fee);
                _costFee    = zy_costmaster.Sum(x => x.Village_Fee);
                _faoverFee  = zy_costmaster.Sum(x => x.Favor_Fee);

                _deptosit_fee = zy_costmaster.Sum(x => x.Deptosit_Fee);
            }

            //第二步:获取预交金和结算界面的text控件的值
            chargeAllText.OrderAllFee = _OrderAllFee.ToString();
            chargeAllText.OrderAllNum = _OrderAllNum.ToString();
            chargeAllText.BackAllFee  = _BackAllFee.ToString();
            chargeAllText.BackAllNum  = _BackAllNum.ToString();
            chargeAllText.AllFee      = _AllFee.ToString();
            chargeAllText.Menoy       = _Menoy.ToString();
            chargeAllText.POS         = _POS.ToString();

            costAllText.receiveFee   = _receiveFee.ToString();
            costAllText.receiveNum   = _receiveNum.ToString();
            costAllText.retreatFee   = _retreatFee.ToString();
            costAllText.retreatNum   = _retreatNum.ToString();
            costAllText.AllFee       = _AllFee1.ToString();
            costAllText.Menoy        = _Menoy1.ToString();
            costAllText.POS          = _POS1.ToString();
            costAllText.costFee      = _costFee.ToString();
            costAllText.faoverFee    = _faoverFee.ToString();
            costAllText.lbAllFee     = (_AllFee1 + _deptosit_fee).ToString();
            costAllText.deptosit_fee = _deptosit_fee.ToString();
            costAllText.lbRoundFee   = "0";

            //得到树的结构
            List <string> accountCodes = new List <string>();

            for (int i = 0; i < zy_chargelist.Count; i++)
            {
                if (accountCodes.Contains(zy_chargelist[i].ChargeCode) == false)
                {
                    accountCodes.Add(zy_chargelist[i].ChargeCode);
                }
            }

            for (int j = 0; j < zy_costmaster.Count; j++)
            {
                if (accountCodes.Contains(zy_costmaster[j].ChargeCode) == false)
                {
                    accountCodes.Add(zy_costmaster[j].ChargeCode);
                }
            }


            CostEmps = new CostEmp[accountCodes.Count];
            for (int i = 0; i < CostEmps.Length; i++)
            {
                CostEmps[i].EmpID   = accountCodes[i];
                CostEmps[i].EmpName = BaseNameFactory.GetName(baseNameType.用户名称, accountCodes[i]);
                //预交金
                CostEmps[i].Chargedates      = new DateTime[1];
                CostEmps[i].ChargeAccountIDs = new int[1];

                CostEmps[i].Chargedates[0]      = DateTime.Now;
                CostEmps[i].ChargeAccountIDs[0] = 0;

                //结算
                CostEmps[i].Costdates      = new DateTime[1];
                CostEmps[i].CostAccountIDs = new int[1];

                CostEmps[i].Costdates[0]      = DateTime.Now;
                CostEmps[i].CostAccountIDs[0] = 0;
            }
        }
        private void GetText(List <ZY_Account> zyAccountlist, DateTime BeginDate, DateTime EndDate)
        {
            zyAccountSonlistCharge = new List <ZY_Account>();
            zyAccountSonlistCost   = new List <ZY_Account>();
            AccountIDCharge        = new List <string>();
            AccountIDCost          = new List <string>();

            chargeAllText = new ChargeAllText();
            chargeAllData = new ChargeAllData();
            costAllText   = new CostAllText();
            costAllData   = new CostAllData();

            if (zyAccountlist != null && zyAccountlist.Count > 0)
            {
                //ChargeAllText chargeAllText = new ChargeAllText();
                decimal _OrderAllFee = 0;
                int     _OrderAllNum = 0;
                decimal _BackAllFee  = 0;
                int     _BackAllNum  = 0;
                decimal _AllFee      = 0;
                decimal _Menoy       = 0;
                decimal _POS         = 0;

                //CostAllText costAllText = new CostAllText();
                decimal _receiveFee = 0;
                int     _receiveNum = 0;
                decimal _retreatFee = 0;
                int     _retreatNum = 0;

                decimal _AllFee1 = 0;
                decimal _Menoy1  = 0;
                decimal _POS1    = 0;

                decimal _costFee   = 0;
                decimal _faoverFee = 0;


                for (int i = 0; i < zyAccountlist.Count; i++)
                {
                    ZY_Account zyAS = zyAccountlist[i];
                    zyAS.AccountName = BaseNameFactory.GetName(baseNameType.用户名称, zyAS.AccountCode);
                    if (zyAccountlist[i].AccountType == 0)//预交金
                    {
                        zyAccountSonlistCharge.Add(zyAS);
                        AccountIDCharge.Add(zyAS.AccountID.ToString());
                        _OrderAllFee += zyAS.WTicketFee;
                        _OrderAllNum += zyAS.WTicketNum;
                        _BackAllFee  += zyAS.BTicketFee;
                        _BackAllNum  += zyAS.BTicketNum;
                        _AllFee      += zyAS.Total_Fee;
                        _Menoy       += zyAS.Cash_Fee;
                        _POS         += zyAS.POS_Fee;
                    }
                    else if (zyAccountlist[i].AccountType == 1)//结算
                    {
                        zyAccountSonlistCost.Add(zyAS);
                        AccountIDCost.Add(zyAS.AccountID.ToString());
                        _receiveFee += zyAS.WTicketFee;
                        _receiveNum += zyAS.WTicketNum;
                        _retreatFee += zyAS.BTicketFee;
                        _retreatNum += zyAS.BTicketNum;
                        _AllFee1    += zyAS.Total_Fee + zyAS.CostFee + zyAS.FaoverFee;
                        _Menoy1     += zyAS.Cash_Fee;
                        _POS1       += zyAS.POS_Fee;
                        _costFee    += zyAS.CostFee;
                        _faoverFee  += zyAS.FaoverFee;
                    }
                }

                //第二步:获取预交金和结算界面的text控件的值
                chargeAllText.OrderAllFee = _OrderAllFee.ToString();
                chargeAllText.OrderAllNum = _OrderAllNum.ToString();
                chargeAllText.BackAllFee  = _BackAllFee.ToString();
                chargeAllText.BackAllNum  = _BackAllNum.ToString();
                chargeAllText.AllFee      = _AllFee.ToString();
                chargeAllText.Menoy       = _Menoy.ToString();
                chargeAllText.POS         = _POS.ToString();
                costAllText.receiveFee    = _receiveFee.ToString();
                costAllText.receiveNum    = _receiveNum.ToString();
                costAllText.retreatFee    = _retreatFee.ToString();
                costAllText.retreatNum    = _retreatNum.ToString();
                costAllText.AllFee        = _AllFee1.ToString();
                costAllText.Menoy         = _Menoy1.ToString();
                costAllText.POS           = _POS1.ToString();
                costAllText.costFee       = _costFee.ToString();
                costAllText.faoverFee     = _faoverFee.ToString();
                costAllText.lbAllFee      = zyAccount.GetAllChargeFee(BeginDate, EndDate, zyAccountlist).ToString("0.00");//?

                //得到树的结构
                List <string> accountCodes = new List <string>();
                for (int i = 0; i < zyAccountlist.Count; i++)
                {
                    if (accountCodes.Contains(zyAccountlist[i].AccountCode) == false)
                    {
                        accountCodes.Add(zyAccountlist[i].AccountCode);
                    }
                }

                CostEmps = new CostEmp[accountCodes.Count];
                for (int i = 0; i < CostEmps.Length; i++)
                {
                    CostEmps[i].EmpID   = accountCodes[i];
                    CostEmps[i].EmpName = BaseNameFactory.GetName(baseNameType.用户名称, accountCodes[i]);
                    //预交金
                    List <ZY_Account> zyas = zyAccountSonlistCharge.FindAll(x => x.AccountCode == accountCodes[i]);
                    CostEmps[i].Chargedates      = new DateTime[zyas.Count];
                    CostEmps[i].ChargeAccountIDs = new int[zyas.Count];
                    for (int j = 0; j < zyas.Count; j++)
                    {
                        //CostEmps[i].EmpName = zyas[j].AccountName;
                        CostEmps[i].Chargedates[j]      = zyas[j].AccountDate;
                        CostEmps[i].ChargeAccountIDs[j] = zyas[j].AccountID;
                    }
                    //结算
                    List <ZY_Account> zyas1 = zyAccountSonlistCost.FindAll(x => x.AccountCode == accountCodes[i]);
                    CostEmps[i].Costdates      = new DateTime[zyas1.Count];
                    CostEmps[i].CostAccountIDs = new int[zyas1.Count];
                    for (int j = 0; j < zyas1.Count; j++)
                    {
                        //CostEmps[i].EmpName = zyas1[j].AccountName;
                        CostEmps[i].Costdates[j]      = zyas1[j].AccountDate;
                        CostEmps[i].CostAccountIDs[j] = zyas1[j].AccountID;
                    }
                }
            }
        }