|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using DSWeb.Areas.RptMng.Comm;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 客户应收应付总账查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class MsRptCustDrCrController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET: /MvcShipping/MsRptInvTotal
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/RptMng/MsRptPcHeadQry/QryData
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult CustListData(int start, int limit, string condition,string groupfield, string sort, string printstr)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT YEAR ACCYEAR,MONTH ACCMONTH,F." + groupfield + " AS CUSTNAME,CURRENCY ");
|
|
|
|
|
strSql.Append(",SUM(UPMONTHDRBAL) UPMONTHDRBAL,SUM(MONTHDR) MONTHDR,SUM(MONTHDRSTL) MONTHDRSTL,SUM(MONTHDRBAL) MONTHDRBAL");
|
|
|
|
|
strSql.Append(",SUM(UPMONTHTTLDRBAL) UPMONTHTTLDRBAL,SUM(MONTHTTLDR) MONTHTTLDR,SUM(MONTHTTLDRSTL) MONTHTTLDRSTL,SUM(MONTHTTLDRBAL) MONTHTTLDRBAL");
|
|
|
|
|
strSql.Append(",SUM(UPMONTHCRBAL) UPMONTHCRBAL,SUM(MONTHCR) MONTHCR,SUM(MONTHCRSTL) MONTHCRSTL,SUM(MONTHCRBAL) MONTHCRBAL");
|
|
|
|
|
strSql.Append(",SUM(UPMONTHTTLCRBAL) UPMONTHTTLCRBAL,SUM(MONTHTTLCR) MONTHTTLCR,SUM(MONTHTTLCRSTL) MONTHTTLCRSTL,SUM(MONTHTTLCRBAL) MONTHTTLCRBAL");
|
|
|
|
|
strSql.Append(" FROM ch_custbalance F ");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" Where " + condition);
|
|
|
|
|
}
|
|
|
|
|
strSql.Append(" Group by YEAR,MONTH,F." + groupfield + ",CURRENCY");
|
|
|
|
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
sortstring = sortstring.Replace("CUSTNAME", groupfield);
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
strSql.Append(" order by F."+groupfield);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((!string.IsNullOrEmpty(printstr)) && (printstr == "true"))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = true,
|
|
|
|
|
Message = "完成",
|
|
|
|
|
Data = strSql.ToString()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var dbparams = new List<CustomDbParamter>();
|
|
|
|
|
|
|
|
|
|
var paramps_sSQL = new CustomDbParamter();
|
|
|
|
|
paramps_sSQL.ParameterName = "@sSQL";
|
|
|
|
|
paramps_sSQL.DbType = DbType.String;
|
|
|
|
|
paramps_sSQL.Direction = ParameterDirection.Input;
|
|
|
|
|
paramps_sSQL.Value = strSql.ToString();
|
|
|
|
|
dbparams.Add(paramps_sSQL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
|
|
|
|
|
var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true);
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult SumListData(int start, int limit, string condition, string sort)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT CURRENCY ");
|
|
|
|
|
strSql.Append(",SUM(UPMONTHDRBAL) UPMONTHDRBAL,SUM(MONTHDR) MONTHDR,SUM(MONTHDRSTL) MONTHDRSTL,SUM(MONTHDRBAL) MONTHDRBAL");
|
|
|
|
|
strSql.Append(",SUM(UPMONTHTTLDRBAL) UPMONTHTTLDRBAL,SUM(MONTHTTLDR) MONTHTTLDR,SUM(MONTHTTLDRSTL) MONTHTTLDRSTL,SUM(MONTHTTLDRBAL) MONTHTTLDRBAL");
|
|
|
|
|
strSql.Append(",SUM(UPMONTHCRBAL) UPMONTHCRBAL,SUM(MONTHCR) MONTHCR,SUM(MONTHCRSTL) MONTHCRSTL,SUM(MONTHCRBAL) MONTHCRBAL");
|
|
|
|
|
strSql.Append(",SUM(UPMONTHTTLCRBAL) UPMONTHTTLCRBAL,SUM(MONTHTTLCR) MONTHTTLCR,SUM(MONTHTTLCRSTL) MONTHTTLCRSTL,SUM(MONTHTTLCRBAL) MONTHTTLCRBAL");
|
|
|
|
|
strSql.Append(" FROM ch_custbalance F ");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" Where " + condition);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strSql.Append(" Group by F.CURRENCY ");
|
|
|
|
|
|
|
|
|
|
var dbparams = new List<CustomDbParamter>();
|
|
|
|
|
|
|
|
|
|
var paramps_sSQL = new CustomDbParamter();
|
|
|
|
|
paramps_sSQL.ParameterName = "@sSQL";
|
|
|
|
|
paramps_sSQL.DbType = DbType.String;
|
|
|
|
|
paramps_sSQL.Direction = ParameterDirection.Input;
|
|
|
|
|
paramps_sSQL.Value = strSql.ToString();
|
|
|
|
|
dbparams.Add(paramps_sSQL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
|
|
|
|
|
var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true);
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|