目录
1、 CustomersettleController
1.1、 查询结算单
1.1.1、 //结算单ID
1.1.2、 //客户编码
1.1.3、 //收款金额
1.1.4、 //单号
1.1.5、 // 审核
1.1.6、 //获取当前查询出来的数据的条数
using QXQPS.Models;
using QXQPS.Vo;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace QXQPS.Areas.ProcurementManagment.Controllers
{
public class CustomersettleController : Controller
{
QXQPEntities myModels = new QXQPEntities();
public ActionResult Selectenciphers(BsgridPage bsgriPage, string Receipt, string ToAudit)//查询结算单
{
var listSalBalance = (from tbSalBalance in myModels.PW_SalBalance
join tbSalesCustomer in myModels.SYS_SalesCustomer on tbSalBalance.SalesCustomerID equals tbSalesCustomer.SalesCustomerID
orderby tbSalBalance.SalBalanceID descending
select new SalBalanceVo
{
SalBalanceID = tbSalBalance.SalBalanceID,
SalesCustomerID = tbSalesCustomer.SalesCustomerID,//客户ID
CustomerCode = tbSalesCustomer.CustomerCode,
CustomerName = tbSalesCustomer.CustomerName,//客户名称
ToAudit = tbSalBalance.ToAudit,//审核
Receipt = tbSalBalance.Receipt,//单号
Operator = tbSalBalance.Operator,//操作人
ReceiptDates = tbSalBalance.ReceiptDate.ToString(),//单据日期
ReceiptDate = tbSalBalance.ReceiptDate,//单据日期
CurrentMany = tbSalBalance.CurrentMany
}).ToList();
#region 条件查询
-
-
- //单号
-
if (!string.IsNullOrEmpty(Receipt))
{
listSalBalance = listSalBalance.Where(m => m.Receipt.Contains(Receipt)).ToList();//模糊查询
}
-
-
- // 审核
-
if (ToAudit == "1")
{
listSalBalance = listSalBalance.Where(m => m.ToAudit == true).ToList();
}
else if (ToAudit == "2")
{
listSalBalance = listSalBalance.Where(m => m.ToAudit == false).ToList();
}
#endregion
-
-
- //获取当前查询出来的数据的条数
-
var totalCount = listSalBalance.Count();
List<SalBalanceVo> listItem = listSalBalance
.Skip(bsgriPage.GetStartIndex()) //Skip取数据的位置
.Take(bsgriPage.pageSize) //Take取数据的条数
.ToList();
Bsgrid<SalBalanceVo> bsgrid = new Bsgrid<SalBalanceVo>() //实例化对象
{
success = true,
totalRows = totalCount,
curPage = bsgriPage.curPage,
data = listItem
};
return Json(bsgrid, JsonRequestBehavior.AllowGet);
}