Exemplo n.º 1
0
        /// <summary>
        /// 各部门设备信息(包括收入、支出、服务人次)
        /// </summary>
        /// <returns>各部门设备信息</returns>
        public List <DepartPerformanceModel> IncomeExpenseByDepartment(string date)
        {
            List <DepartPerformanceModel> models = new List <DepartPerformanceModel>();
            DepartPerformanceModel        model  = null;

            int curYear = DateTime.Today.Year;

            if (!string.IsNullOrEmpty(date))
            {
                curYear = Convert.ToDateTime(date).Year;
            }
            if (WebConfig.ISDEMO)
            {
                curYear = new DateTime(2019, 11, 12).Year;
            }
            int lastYear = curYear - 1;

            DataTable dtEquipmentCount = this.equipmentDao.GetEquipmentInfoCountsByDepartment();
            List <ServiceHisCountInfo> serviceInfosThisYear      = this.serviceHisDao.GetServiceHisCountsByDepartment(curYear);
            List <ServiceHisCountInfo> accessoryExpensesThisYear = this.serviceHisDao.GetAccessoryExpenseByDepartment(curYear);
            List <ServiceHisCountInfo> serviceInfosLastYear      = this.serviceHisDao.GetServiceHisCountsByDepartment(lastYear);
            List <ServiceHisCountInfo> accessoryExpensesLastYear = this.serviceHisDao.GetAccessoryExpenseByDepartment(lastYear);
            ServiceHisCountInfo        serviceInfo = null;

            foreach (DataRow dr in dtEquipmentCount.Rows)
            {
                model                 = new DepartPerformanceModel();
                model.Department      = LookupManager.GetDepartments(SQLUtil.ConvertInt(dr["DepartmentID"]));
                model.EquipmentCount  = SQLUtil.ConvertInt(dr["Counts"]);
                model.EquipmentAmount = SQLUtil.ConvertDouble(dr["Amounts"]);

                serviceInfo = (from ServiceHisCountInfo temp in serviceInfosThisYear where temp.ObjectID == model.Department.ID select temp).FirstOrDefault();
                if (serviceInfo != null)
                {
                    model.ServiceCount = serviceInfo.ServiceCount;
                    model.Incomes      = serviceInfo.Incomes;
                }
                serviceInfo = (from ServiceHisCountInfo temp in accessoryExpensesThisYear where temp.ObjectID == model.Department.ID select temp).FirstOrDefault();
                if (serviceInfo != null)
                {
                    model.Expenses = serviceInfo.Expenses;
                }

                serviceInfo = (from ServiceHisCountInfo temp in serviceInfosLastYear where temp.ObjectID == model.Department.ID select temp).FirstOrDefault();
                if (serviceInfo != null)
                {
                    model.LastIncomes = serviceInfo.Incomes;
                }
                serviceInfo = (from ServiceHisCountInfo temp in accessoryExpensesLastYear where temp.ObjectID == model.Department.ID select temp).FirstOrDefault();
                if (serviceInfo != null)
                {
                    model.LastExpenses = serviceInfo.Expenses;
                }
                models.Add(model);
            }

            return(models);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 科室下所有设备信息(包括收入、支出)
        /// </summary>
        /// <param name="id">科室编号</param>
        /// <param name="date">日期</param>
        /// <returns>科室下所有设备信息</returns>
        public List <EquipmentInfo> EquipmentsDetailsByDepartment(int id, string date = "")
        {
            int curYear = DateTime.Today.Year;

            if (!string.IsNullOrEmpty(date))
            {
                curYear = SQLUtil.ConvertDateTime(date).Year;
            }
            int lastYear = curYear - 1;

            if (WebConfig.ISDEMO)
            {
                curYear  = 2019;
                lastYear = 2018;
            }

            List <EquipmentInfo>       equipmentInfos            = this.equipmentDao.GetEquipmentsByDepartmentID(id);
            List <ServiceHisCountInfo> serviceInfosThisYear      = this.serviceHisDao.GetServiceHisCountsByEquipment(curYear);
            List <ServiceHisCountInfo> accessoryExpensesThisYear = this.serviceHisDao.GetAccessoryExpenseByEquipment(curYear);
            List <ServiceHisCountInfo> serviceInfosLastYear      = this.serviceHisDao.GetServiceHisCountsByEquipment(lastYear);
            List <ServiceHisCountInfo> accessoryExpensesLastYear = this.serviceHisDao.GetAccessoryExpenseByEquipment(lastYear);
            ServiceHisCountInfo        serviceInfo = null;

            foreach (EquipmentInfo info in equipmentInfos)
            {
                serviceInfo = (from ServiceHisCountInfo temp in serviceInfosThisYear where temp.ObjectID == info.ID select temp).FirstOrDefault();
                if (serviceInfo != null)
                {
                    info.Incomes = serviceInfo.Incomes;
                }
                serviceInfo = (from ServiceHisCountInfo temp in accessoryExpensesThisYear where temp.ObjectID == info.ID select temp).FirstOrDefault();
                if (serviceInfo != null)
                {
                    info.Expenses = serviceInfo.Expenses;
                }

                serviceInfo = (from ServiceHisCountInfo temp in serviceInfosLastYear where temp.ObjectID == info.ID select temp).FirstOrDefault();
                if (serviceInfo != null)
                {
                    info.LastIncomes = serviceInfo.Incomes;
                }
                serviceInfo = (from ServiceHisCountInfo temp in accessoryExpensesLastYear where temp.ObjectID == info.ID select temp).FirstOrDefault();
                if (serviceInfo != null)
                {
                    info.LastExpenses = serviceInfo.Expenses;
                }
            }
            equipmentInfos.RemoveAll(t => ((t.EquipmentStatus.ID == EquipmentInfo.EquipmentStatuses.Scrap) && t.Incomes == 0 && t.Expenses == 0));

            return(equipmentInfos);
        }