152 lines
6.9 KiB
C#
152 lines
6.9 KiB
C#
using Ninject;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.IBLL.Soft;
|
|
using WX.CRM.WebHelper;
|
|
|
|
namespace WX.CRM.WEB.Controllers.Soft
|
|
{
|
|
public class SoftRptController : BaseController
|
|
{
|
|
[Inject]
|
|
public ISOFT_USER_Q _soft_user_Q { get; set; }
|
|
|
|
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_注册资源统计报表)]
|
|
public ActionResult Index()
|
|
{
|
|
//ToolBar
|
|
ToolBar tool = new ToolBar();
|
|
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.注册资源统计报表, userRightId);
|
|
tool.AddOtherButton("Other1", "导出", "icon-excel", "Export_Click", true);
|
|
tool.AllowButton(toolbtn);
|
|
ViewBag.ToolBar = tool;
|
|
|
|
string tableId = "tablist";
|
|
Table tab = new Table(tableId);
|
|
tab.AddHeadCol("ch", "", "渠道号", "sortTable('tablist',1,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("registernumber", "", "注册量", "sortTable('tablist',2,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("resourcenumber", "", "资源量", "sortTable('tablist',3,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("resourcerate", "", "注册资源率", "sortTable('tablist',4,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("recordcount", "", "接通量", "sortTable('tablist',5,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("recordcountrate", "", "接通率", "sortTable('tablist',6,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("recordnumber", "", "有效沟通量", "sortTable('tablist',7,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("recordrate", "", "有效沟通率", "sortTable('tablist',8,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("firstcallnumber", "", "第一次沟通量", "sortTable('tablist',9,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("secondcallnumber", "", "第二次沟通量", "sortTable('tablist',10,'int');", "cursor:pointer");
|
|
//tab.AddHeadCol("smallordernumber", "", "小单成交量", "sortTable('tablist',11,'int');", "cursor:pointer");
|
|
//tab.AddHeadCol("smallorderrate", "", "小单成交率", "sortTable('tablist',12,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("allordernumber", "", "总成交量", "sortTable('tablist',11,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("allorderrate", "", "总成交率", "sortTable('tablist',12,'int');", "cursor:pointer");
|
|
tab.AddHeadCol("allorderprice", "", "总成交金额", "sortTable('tablist',13,'int');", "cursor:pointer");
|
|
tab.AddHeadRow();
|
|
ViewBag.gridTable = tab.GetHead();
|
|
|
|
return View();
|
|
}
|
|
/// <summary>
|
|
/// 按照条件获取数据
|
|
/// </summary>
|
|
/// <param name="pager"></param>
|
|
/// <param name="queryStr"></param>
|
|
/// <returns></returns>
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_注册资源统计报表)]
|
|
|
|
public JsonResult GetHtmlList(DateTime stime, DateTime etime, string columns)
|
|
{
|
|
|
|
|
|
Table table = new Table(columns, true);
|
|
var list = _soft_user_Q.Soft_Rpt_Get(stime, etime);
|
|
foreach (var row in list)
|
|
{
|
|
table.AddCol(row.ch);
|
|
table.AddCol(row.registernumber);
|
|
table.AddCol(row.resourcenumber);
|
|
table.AddCol(row.resourcerate);
|
|
table.AddCol(row.recordcount);
|
|
table.AddCol(row.recordcountrate);
|
|
table.AddCol(row.recordnumber);
|
|
table.AddCol(row.recordrate);
|
|
table.AddCol(row.firstcallnumber);
|
|
table.AddCol(row.secondcallnumber);
|
|
//table.AddCol(row["smallordernumber"]);
|
|
//table.AddCol(row["smallorderrate"]);
|
|
table.AddCol(row.allordernumber);
|
|
table.AddCol(row.allorderrate);
|
|
table.AddCol(row.allorderprice);
|
|
table.AddRow();
|
|
}
|
|
if (list.Any())
|
|
{
|
|
var resourcenumber = list.Sum(p => p.resourcenumber);
|
|
|
|
table.AddCol("合计");
|
|
table.AddCol(list.Sum(p => p.registernumber));
|
|
table.AddCol(resourcenumber);
|
|
if (resourcenumber == 0)
|
|
{
|
|
table.AddCol("0%");
|
|
}
|
|
else
|
|
{
|
|
table.AddCol(string.Format("{0:P}", resourcenumber / list.Sum(p => p.registernumber)));
|
|
}
|
|
table.AddCol(list.Sum(p => p.recordcount));
|
|
if (resourcenumber == 0)
|
|
{
|
|
table.AddCol("0%");
|
|
}
|
|
else
|
|
{
|
|
table.AddCol(string.Format("{0:P}", list.Sum(p => p.recordcount) / resourcenumber));
|
|
}
|
|
table.AddCol(list.Sum(p => p.recordnumber));
|
|
if (resourcenumber == 0)
|
|
{
|
|
table.AddCol("0%");
|
|
}
|
|
else
|
|
{
|
|
table.AddCol(string.Format("{0:P}", list.Sum(p => p.recordnumber) / resourcenumber));
|
|
}
|
|
table.AddCol(list.Sum(p => p.firstcallnumber));
|
|
table.AddCol(list.Sum(p => p.secondcallnumber));
|
|
table.AddCol(list.Sum(p => p.allordernumber));
|
|
if (resourcenumber == 0)
|
|
{
|
|
table.AddCol("0%");
|
|
}
|
|
else
|
|
{
|
|
table.AddCol(string.Format("{0:P}", list.Sum(p => p.allordernumber) / resourcenumber));
|
|
}
|
|
table.AddCol(list.Sum(p => p.allorderprice));
|
|
|
|
table.AddFootRow();
|
|
}
|
|
var json = new
|
|
{
|
|
rowsList = table.GetRows(),
|
|
foot = table.GetFoot()
|
|
};
|
|
return Json(json, JsonRequestBehavior.AllowGet);
|
|
}
|
|
/// <summary>
|
|
/// 导出所有信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[AuthorizeToolBar(InitRights.CONST_注册资源统计报表, InitToolBar.CONST_Other1)]
|
|
public FileResult Export(DateTime stime, DateTime etime)
|
|
{
|
|
string checkedFilds = PageRequest.GetQueryString("checkedFilds");
|
|
string checkedTitles = PageRequest.GetQueryString("checkedTitles");
|
|
//DataTable list = _soft_user_Q.Soft_Rpt_Get(stime, etime);
|
|
//return File(ExcelHelper.ExportDataTableToExcel(list, "注册资源统计", checkedFilds, checkedTitles, null), "application/ms-excel", PageRequest.GetDlownLoadName("注册资源统计报表.xls"));
|
|
var list = _soft_user_Q.Soft_Rpt_Get(stime, etime);
|
|
return File(ExcelHelper.ExportListModelToExcel(list, "注册资源统计", 50000, null), "application/ms-excel", PageRequest.GetDlownLoadName("注册资源统计报表.xls"));
|
|
}
|
|
}
|
|
}
|