///// <summary> ///// 是否有CEO签名 ///// </summary> //public Account IsCEOElectricName(HRMISModel.Reimburse reimburse) //{ // for (int i = 0 ; i < reimburse.DiyProcess.DiySteps.Count;i++) // { // if (reimburse.DiyProcess.DiySteps[i].Status == "CEO电子签名") // { // Account account = GetDiyStepAccount(reimburse.ApplierID, reimburse.DiyProcess.DiySteps[i]); // List<ReimburseFlow> reimburseFlows = GetReimbursesHistory(reimburse.ReimburseID); // foreach (ReimburseFlow item in reimburseFlows) // { // if (item.Operator.Account.Id == account.Id && item.ReimburseStatusEnum == ReimburseStatusEnum.Auditing) // { // return account; // } // } // } // } // return null; //} ///// <summary> ///// 是否有财务签名 ///// </summary> //public Account IsFinanceElectricName(HRMISModel.Reimburse reimburse) //{ // for (int i = 0; i < reimburse.DiyProcess.DiySteps.Count; i++) // { // if (reimburse.DiyProcess.DiySteps[i].Status == "财务电子签名") // { // Account account = GetDiyStepAccount(reimburse.ApplierID, reimburse.DiyProcess.DiySteps[i]); // List<ReimburseFlow> reimburseFlows = GetReimbursesHistory(reimburse.ReimburseID); // foreach (ReimburseFlow item in reimburseFlows) // { // if (item.Operator.Account.Id == account.Id && item.ReimburseStatusEnum == ReimburseStatusEnum.Auditing) // { // return account; // } // } // } // } // return null; //} ///// <summary> ///// 是否有部门领导签名 ///// </summary> //public Account IsDepartmentLeaderElectricName(HRMISModel.Reimburse reimburse) //{ // for (int i = 0; i < reimburse.DiyProcess.DiySteps.Count; i++) // { // if (reimburse.DiyProcess.DiySteps[i].Status == "部门领导电子签名") // { // Account account = GetDiyStepAccount(reimburse.ApplierID, reimburse.DiyProcess.DiySteps[i]); // List<ReimburseFlow> reimburseFlows = GetReimbursesHistory(reimburse.ReimburseID); // foreach (ReimburseFlow item in reimburseFlows) // { // if (item.Operator.Account.Id == account.Id && item.ReimburseStatusEnum == ReimburseStatusEnum.Auditing) // { // return account; // } // } // } // } // return null; //} public List <ReimburseTotal> GetReiburseTotalByCondition(Account loginUser, string employeename, string place, string customerName, string projectName, DateTime?applydateFrom, DateTime?applydateTo, string remark, int ReimburseCategoriesId, DateTime?billingTimeFrom, DateTime?billingTimeTo, int departmentID, int companyID) { List <Model.Reimburse> reimburses = _DalReimburse.GetReiburseTotalByCondition(employeename, place, customerName, projectName, applydateFrom, applydateTo, remark, ReimburseCategoriesId, billingTimeFrom, billingTimeTo, companyID); List <Account> accounts = new List <Account>(); accounts = BllInstance.AccountBllInstance.GetAccountByBaseCondition(employeename, departmentID, -1, null, true, null); accounts = Tools.RemoteUnAuthAccount(accounts, AuthType.HRMIS, loginUser, HrmisPowers.A902); for (int i = reimburses.Count - 1; i >= 0; i--) { if (!IsContainsAccount(accounts, reimburses[i].ApplierID)) { reimburses.RemoveAt(i); } else { Account account = BllInstance.AccountBllInstance.GetAccountById(reimburses[i].ApplierID); reimburses[i].ApplerName = account.Name; reimburses[i].Department = account.Dept; //reimburses[i].Department.DepartmentName = account.Dept.DepartmentName; } } List <ReimburseTotal> reimburseTotals = new List <ReimburseTotal>(); if (reimburses.Count != 0) { for (int i = 0; i < reimburses.Count; i++) { ReimburseTotal reimburseTotal = new ReimburseTotal(); bool isContain = false; reimburseTotal.CustomerIds = new List <int>(); foreach (ReimburseTotal total in reimburseTotals) { if (!total.ReimburseID.Equals(reimburses[i].ReimburseID)) { continue; } reimburseTotal = total; isContain = true; break; } reimburseTotal.ReimburseID = reimburses[i].ReimburseID; // 月份 reimburseTotal.Month = Convert.ToDateTime(reimburses[i].BillingTime).Month.ToString(); // 员工姓名 reimburseTotal.Name = reimburses[i].ApplerName; // 出差地点 reimburseTotal.Place = reimburses[i].Destinations; // 出差项目 reimburseTotal.Projuct = reimburses[i].ProjectName; //出差天数 reimburseTotal.OutCityDays = reimburses[i].OutCityDays; //出差补贴 reimburseTotal.OutCityAllowance = reimburses[i].OutCityAllowance; //备注 reimburseTotal.Remark = reimburses[i].Remark; reimburseTotal.Discription = reimburses[i].Discription; //分类 reimburseTotal.ReimburseCategories = reimburses[i].ReimburseCategoriesEnum; // 出差开始时间 reimburseTotal.StartTime = reimburses[i].ConsumeDateFrom.ToShortDateString(); // 出差结束时间 reimburseTotal.EndTime = reimburses[i].ConsumeDateTo.ToShortDateString(); for (int j = 0; j < reimburses[i].ReimburseItems.Count; j++) { // 长途合计 if (reimburses[i].ReimburseItems[j].ReimburseTypeEnum == ReimburseTypeEnum.LongDistanceCost) { reimburseTotal.LongTripTotal = reimburseTotal.LongTripTotal + reimburses[i].ReimburseItems[j].ExchangeCost; } // 短途合计 if (reimburses[i].ReimburseItems[j].ReimburseTypeEnum == ReimburseTypeEnum.ShortDistanceCost) { reimburseTotal.ShortTripTotal = reimburseTotal.ShortTripTotal + reimburses[i].ReimburseItems[j].ExchangeCost; } // 住宿合计 if (reimburses[i].ReimburseItems[j].ReimburseTypeEnum == ReimburseTypeEnum.LodgingCost) { reimburseTotal.LodgingTotal = reimburseTotal.LodgingTotal + reimburses[i].ReimburseItems[j].ExchangeCost; } // 交际合计 if (reimburses[i].ReimburseItems[j].ReimburseTypeEnum == ReimburseTypeEnum.CommunicationEntertainmentCost) { reimburseTotal.EntertainmentTotal = reimburseTotal.EntertainmentTotal + reimburses[i].ReimburseItems[j].ExchangeCost; } // 其他合计 if (reimburses[i].ReimburseItems[j].ReimburseTypeEnum == ReimburseTypeEnum.OtherCost) { reimburseTotal.OtherTotal = reimburseTotal.OtherTotal + reimburses[i].ReimburseItems[j].ExchangeCost; } //餐费 if (reimburses[i].ReimburseItems[j].ReimburseTypeEnum == ReimburseTypeEnum.MealCost) { reimburseTotal.MealTotalCost = reimburseTotal.MealTotalCost + reimburses[i].ReimburseItems[j].ExchangeCost; } //市内交通费 if (reimburses[i].ReimburseItems[j].ReimburseTypeEnum == ReimburseTypeEnum.CityTrafficCost) { reimburseTotal.CityTrafficTotalCost = reimburseTotal.CityTrafficTotalCost + reimburses[i].ReimburseItems[j].ExchangeCost; } int customerId = reimburses[i].ReimburseItems[j].CustomerID; if (customerId == 0 || reimburseTotal.CustomerIds.Contains(customerId)) { continue; } reimburseTotal.CustomerIds.Add(customerId); reimburseTotal.CustomerName = reimburseTotal.CustomerName + reimburses[i].ReimburseItems[j].CustomerName + ";"; } int count = _DalReimburse.GetCustomerCountByReiburseID(reimburseTotal.ReimburseID); if (count > 1) { reimburseTotal.OutCityAllowance = decimal.Round(reimburseTotal.OutCityAllowance * reimburseTotal.CustomerIds.Count / count, 2); } // 小计 reimburseTotal.Total = decimal.Round(reimburseTotal.LongTripTotal + reimburseTotal.ShortTripTotal + reimburseTotal.LodgingTotal + reimburseTotal.EntertainmentTotal + reimburseTotal.OtherTotal + reimburseTotal.OutCityAllowance + reimburseTotal.MealTotalCost + reimburseTotal.CityTrafficTotalCost, 2); if (!isContain) { reimburseTotals.Add(reimburseTotal); } } } return(reimburseTotals); }