using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.TruckMng.DAL.RPT_ly;
using DSWeb.Areas.TruckMng.Models.RPT_ly;
using DSWeb.TruckMng.Helper;
using HcUtility.Comm;
using HcUtility.Core;
namespace DSWeb.Areas.TruckMng.Controllers
{
///
/// 集运对账_陆运+杂费
/// 以路单中的委托单位为基准,总结陆运和杂费两块
/// 不计算路单自己的费用,只记录路单下的派车单内的费用
///
[JsonRequestBehavior]
public class RPT_lyController : Controller
{
//
// GET: /TruckMng/RPT_ly
public ActionResult Index()
{
return View();
}
//
// GET:/TruckMng/RPT_ly/GetDataList
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = RPT_lyDAL.GetDataList(condition);
var list = dataList.Skip(start).Take(limit);
//decimal ysTotal = 0;
//decimal yfTotal = 0;
//foreach (var acc in list)
//{
// if (acc.FeeType == 1)
// {
// ysTotal = ysTotal + acc.Freight + acc.ExtrasFee;
// }
// else
// {
// yfTotal = yfTotal + acc.Freight + acc.ExtrasFee;
// }
//}
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
//
// GET:/TruckMng/MsWlCheckAcc/GetData/
public ContentResult GetData(string handle, string condition)
{
RPT_lymb head = null;
if (handle == "edit")
{
var list = RPT_lyDAL.GetDataList(condition);
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new RPT_lymb();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head});
return new ContentResult() { Content = json };
}
//
// GET:/TruckMng/MsWlCheckAcc/Save
//public ContentResult Save(string opstatus, string data)
//{
// MsWlCheckAcc head = JsonConvert.Deserialize(data);
// if (opstatus == "add")
// {
// head.DbOperationType = DbOperationType.DbotIns;
// }
// else if (opstatus == "edit")
// {
// head.DbOperationType = DbOperationType.DbotUpd;
// }
// else
// {
// head.DbOperationType = DbOperationType.DbotDel;
// }
// var modb = new ModelObjectDB();
// DBResult result = modb.Save(head);
// var jsonRespose = new JsonResponse
// {
// Success = result.Success,
// Message = result.Message,
// Data = MsWlCheckAccDAL.GetData("GId='" + head.GId + "'")
// };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
//}
public ContentResult Delete(string data)
{
var head = JsonConvert.Deserialize(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 参照部分
#endregion
}
}