目录
1、 CargosettlementController
1.1、 货商结算
1.1.1、 //登录用户
1.2、 结算单号
1.2.1、 //查询供应商账单
1.2.2、 //单号
1.2.3、 //单据日期
1.2.4、 //付款状态
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.AccessoriessalesManagment.Controllers
{
public class CargosettlementController : Controller
{
// GET: AccessoriessalesManagment/Cargosettlement
QXQPEntities myModels = new Models.QXQPEntities();
public ActionResult Cargosettlement()//货商结算
{
try
{
ViewBag.UserName = Session["UserName"].ToString().Trim();
return View();
}
catch (Exception)
{
return Redirect("/Home/Login");
}
}
public ActionResult MaintenanceNum()//结算单号
{
string MaintenanceNum = "";
var date = "P" + DateTime.Now.ToString("yyyyMMdd");
try
{
var list = myModels.PW_ProBalance.Where(m => m.Receipt.Contains(date)).OrderBy(m => m.Receipt).ToList();
if (list.Count != 0)
{
int num = Convert.ToInt32(list.Last().Receipt.Trim().Substring(9)) + 1;
if (num < 10)
{
MaintenanceNum = date + "000" + num;
}
else if (num > 9 && num < 100)
{
MaintenanceNum = date + "00" + num;
}
else if (num > 99 && num < 1000)
{
MaintenanceNum = date + "0" + num;
}
}
else
{
MaintenanceNum = date + "0001";
}
}
catch (Exception)
{
return Json("", JsonRequestBehavior.AllowGet);
}
return Json(MaintenanceNum, JsonRequestBehavior.AllowGet);
}
public ActionResult SelectProBalancetDetail(int SuppliersID)
{
ArrayList list = new ArrayList();
try
{
var listIncoming = (from tbIncoming in myModels.PW_Incoming
join tbSuppliers in myModels.SYS_Suppliers on tbIncoming.SuppliersID equals tbSuppliers.SuppliersID
join tbDocumentsType in myModels.SYS_DocumentsType on tbIncoming.DocumentsTypeID equals tbDocumentsType.DocumentsTypeID
join tbBalanceState in myModels.SYS_BalanceState on tbIncoming.BalanceStateID equals tbBalanceState.BalanceStateID
where tbIncoming.SuppliersID == SuppliersID && tbBalanceState.BalanceStateID == 2 && tbIncoming.ToAudit == true
select new GppVo
{
SingleNumber=tbIncoming.IncomingNumber,
DocumentsTypeID=tbDocumentsType.DocumentsTypeID,
BalanceStateID = tbBalanceState.BalanceStateID,
DocumentsDate = tbIncoming.BilDate.ToString(),
ShouldAmount = tbIncoming.Aamount.ToString(),//总金额
DocumentsType = tbDocumentsType.DocumentsType,//单据类型
BalanceState = tbBalanceState.BalanceState
}).ToList();
var listReturnForm = (from tbReturnForm in myModels.PW_ReturnForm
join tbSuppliers in myModels.SYS_Suppliers on tbReturnForm.SuppliersID equals tbSuppliers.SuppliersID
join tbDocumentsType in myModels.SYS_DocumentsType on tbReturnForm.DocumentsTypeID equals tbDocumentsType.DocumentsTypeID
join tbBalanceState in myModels.SYS_BalanceState on tbReturnForm.BalanceStateID equals tbBalanceState.BalanceStateID
where tbReturnForm.SuppliersID == SuppliersID && tbReturnForm.BalanceStateID == 2 && tbReturnForm.ToAudit == true
select new GppVo
{
SingleNumber=tbReturnForm.ReturnNumber,//单号
DocumentsTypeID = tbDocumentsType.DocumentsTypeID,
BalanceStateID = tbBalanceState.BalanceStateID,
DocumentsDate = tbReturnForm.SheetDate.ToString(),//单据日期
ShouldAmount = tbReturnForm.Amount.ToString(),//总金额
DocumentsType = tbDocumentsType.DocumentsType,//单据类型
BalanceState = tbBalanceState.BalanceState//付款状态
}).ToList();
list.AddRange(listIncoming);
list.AddRange(listReturnForm);
}
catch (Exception)
{
return Json("", JsonRequestBehavior.AllowGet);
}
return Json(list, JsonRequestBehavior.AllowGet);
}