首页 > 代码库 > 表格下面动态添加合计

表格下面动态添加合计

        var jqData = http://www.mamicode.com/(from s in queryResult
                              select new
                              {
                                  id = s.ContractGuid,//定义当前行数据的一个传输识别名称,一般以主键为名称,可以省略()
                                  cell = new object[]
                                                 {
                                                     s.ContractGuid,
                                                     Convert.ToDateTime(s.CreateDate).ToString("yyyy-MM-dd"),
                                                    workFlowBLL.GetWorkFlowRuleCategoryByGuid((Guid)s.WorkFlowCategoryGuid),        //业务类型  
                                                 
                                                     s.CompanyName,  //公司名称
                                                     s.ContractCode,//合同编号
                                                     workFlowBLL.getPayMoney(s.ContractGuid, 1),
                                                      workFlowBLL.getPayMoney(s.ContractGuid, 2,true),
                                                      um.GetUserName (  s.SaleManagerGuid)

                                                  }
                              }).ToList();
                var sumObj = new
                {
                    id = new Guid(),
                    cell = new object[]{
                        "",
                        "合计",
                        "",
                        "",
                        "",
                        queryResultSum.Sum(p=> workFlowBLL.getPayMoney(p.ContractGuid, 1)),
                           queryResultSum.Sum(p=> workFlowBLL.getPayMoney(p.ContractGuid, 2,true)),
                           ""

              }
                };
                jqData.Add(sumObj);

                //以json格式传输,依次以”total/page/records/rows"封装,名称固定
                var jsonData = http://www.mamicode.com/new
                {
                    total = PageCount,
                    page,
                    records = RecordCount,
                    rows = jqData
                };