Esempio n. 1
0
        public async Task <ActionResult> GetListJsonStudentCode(string StudentCode)
        {
            DetailsListParam detailsListParam = new DetailsListParam();

            OperatorInfo operatorInfo = await Operator.Instance.Current();

            if (!operatorInfo.RoleIds.Contains(GlobalContext.SystemConfig.RoleId))//不是超级管理员
            {
                detailsListParam.SysDepartmentId = operatorInfo.DepartmentId;
            }
            detailsListParam.StudentCode = StudentCode;
            TData <List <DetailsEntity> > details = await detailsBLL.GetList(detailsListParam);

            if (details.Tag == 1 && details.Result.Any())
            {
                var infos = new List <SheetInfo>();
                var ids   = details.Result.Select(x => x.ChargeSheetId).Distinct().ToList();
                foreach (var id in ids)
                {
                    TData <SheetEntity> obj = await sheetBLL.GetEntity(long.Parse(id.ToString()));

                    if (obj.Tag == 1 && obj.Result != null)
                    {
                        SheetInfo info = obj.Result.MapTo <SheetEntity, SheetInfo>();
                        var       mxs  = details.Result.Where(x => x.ChargeSheetId == id).ToList();
                        info.details  = mxs;
                        info.SumMoney = mxs.Sum(x => x.Money);
                        info.YesMoney = 0;

                        //收款记录
                        RecordListParam recordListParam = new RecordListParam();
                        if (!operatorInfo.RoleIds.Contains(GlobalContext.SystemConfig.RoleId))//不是超级管理员
                        {
                            recordListParam.SysDepartmentId = operatorInfo.DepartmentId;
                        }
                        recordListParam.StudentCode   = StudentCode;
                        recordListParam.ChargeSheetId = id;
                        recordListParam.Status        = 1;
                        TData <List <RecordEntity> > record = await recordBLL.GetList(recordListParam);

                        if (record.Tag == 1 && record.Result != null)
                        {
                            info.YesMoney = record.Result.Sum(x => x.Money);
                        }

                        info.NoMoney = info.SumMoney - info.YesMoney;
                        infos.Add(info);
                    }
                }
                return(Json(infos));
            }

            return(Json(new List <SheetInfo>()));
        }
        public async Task <ActionResult> GetListJson(DetailsListParam param)
        {
            OperatorInfo operatorInfo = await Operator.Instance.Current();

            if (!operatorInfo.RoleIds.Contains(GlobalContext.SystemConfig.RoleId))//不是超级管理员
            {
                param.SysDepartmentId = operatorInfo.DepartmentId;
            }
            TData <List <DetailsEntity> > obj = await detailsBLL.GetList(param);

            return(Json(obj));
        }