389 lines
20 KiB
C#
389 lines
20 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SuperMap.RealEstate.Web.UI.WebControls;
|
|
using Business = SuperMap.RealEstate.HighWay.Storage.Business;
|
|
using HZQR.Common;
|
|
|
|
namespace SuperMap.RealEstate.HighWay.Modules.MapShow
|
|
{
|
|
public partial class CurServerPartRevenue : BasePage
|
|
{
|
|
protected string Serverpart_ID = System.Configuration.ConfigurationManager.AppSettings["UmiformCommodity"].ToString().Split('|')[0];
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (IsPostBack) return;
|
|
|
|
Business.SERVERPART _SERVERPART = new Business.SERVERPART(Transaction);
|
|
_SERVERPART.SERVERPART_ID_Encrypt = Request["SERVERPART_ID"];
|
|
if (_SERVERPART.Select())
|
|
{
|
|
Title = _SERVERPART.SERVERPART_NAME;
|
|
}
|
|
GridViewEx1.SelectingWithInit<Business.SERVERPART>(ObjectDataSource1, GridPageEx1);
|
|
}
|
|
|
|
#region 加载下拉框
|
|
private void InitWebControlsState()
|
|
{
|
|
//ListItemEx _ListItemEx = null;
|
|
//SERVERPART_ID.Clear();
|
|
//SERVERPART_ID.Items.Add(new Web.UI.WebControls.ListItemEx() { Text = "全部", Value = "1=1" });
|
|
//List<Business.SERVERPART> _ListSERVERPART =
|
|
// (new Business.SERVERPART(this.Transaction)).GetPassportServerPart(this.PassportInfo.CityAuthority);
|
|
//foreach (Business.SERVERPART _s in _ListSERVERPART)
|
|
//{
|
|
// if (_s.SERVERPART_NAME.Contains("区域中心"))
|
|
// continue;
|
|
// _ListItemEx = new ListItemEx();
|
|
// _ListItemEx.Text = _s.SERVERPART_NAME;
|
|
// _ListItemEx.Value = _s.SERVERPART_ID_Encrypt;
|
|
// SERVERPART_ID.Items.Add(_ListItemEx);
|
|
//}
|
|
//SERVERPART_ID.SelectedIndex = 1;
|
|
}
|
|
#endregion
|
|
|
|
#region 方法 -> 查询
|
|
protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e)
|
|
{
|
|
//设置UI变化
|
|
//if (SERVERPART_ID.SelectedValue != "1=1")
|
|
//{
|
|
// e.SetVisible(GridViewEx1, true);
|
|
// //e.SetVisible(GridPageEx1, true);
|
|
// e.SetVisible(GridViewEx2, false);
|
|
// //e.SetVisible(GridPageEx2, false);
|
|
// GridViewEx1.SelectingWithInit<Business.SERVERPART>(ObjectDataSource1, GridPageEx1);
|
|
// e.SetValue(GridViewEx1);
|
|
// e.ExcuteClientScript("setData('" + LblText.Text + "')");
|
|
//}
|
|
//else
|
|
//{
|
|
// e.SetVisible(GridViewEx1, false);
|
|
// //e.SetVisible(GridPageEx1, false);
|
|
// e.SetVisible(GridViewEx2, true);
|
|
// //e.SetVisible(GridPageEx2, true);
|
|
// GridViewEx2.SelectingWithInit<Business.SERVERPART>(ObjectDataSource2, GridPageEx2);
|
|
// e.SetValue(GridViewEx2);
|
|
// e.ExcuteClientScript("setData('" + LblText.Text + "')");
|
|
//}
|
|
}
|
|
|
|
protected void ButtonStatistics_Click(object sender, EventArgs e)
|
|
{
|
|
//绑定数据
|
|
//if (SERVERPART_ID.SelectedValue != "1=1")
|
|
//{
|
|
// GridViewEx1.Visible = true;
|
|
// //GridPageEx1.Visible = true;
|
|
// GridViewEx2.Visible = false;
|
|
// //GridPageEx2.Visible = false;
|
|
// GridViewEx1.SelectingWithInit<Business.SERVERPART>(ObjectDataSource1, GridPageEx1);
|
|
// Label1.Text = SERVERPART_ID.SelectedItem.Text + "营收实时汇总表";
|
|
//}
|
|
//else
|
|
//{
|
|
// GridViewEx1.Visible = false;
|
|
// //GridPageEx1.Visible = false;
|
|
// GridViewEx2.Visible = true;
|
|
// //GridPageEx2.Visible = true;
|
|
// GridViewEx2.SelectingWithInit<Business.SERVERPART>(ObjectDataSource2, GridPageEx2);
|
|
// Label1.Text = "浙江交通投资集团实业发展有限公司营收实时汇总表";
|
|
//}
|
|
}
|
|
#endregion
|
|
|
|
#region 方法 -> 导出对应的Excel
|
|
protected void ButtonExport_Click(object sender, EventArgs e)
|
|
{
|
|
Business.SERVERPART _SERVERPART = new Business.SERVERPART(this.Transaction);
|
|
string DateString = "";
|
|
string strSql = "";
|
|
// if (SERVERPART_ID.SelectedValue != "1=1")
|
|
// {
|
|
// DateString += " and A.SERVERPART_ID=" + SERVERPART_ID.SelectedValue.ToDecrypt();
|
|
// strSql = @"SELECT SHOPNAME as 门店, CONNECT_DATE_A as 东南区心跳时间,CURRAMOUNT_A as 东南区客单数量,PRICE_A as 东南区客单均价," +
|
|
// @"CURRSELLCOUNT_A as 东南区今日营收,CONNECT_DATE_B as 西北区心跳时间,CURRAMOUNT_B as 西北区客单数量,
|
|
// PRICE_B as 西北区客单均价,CURRSELLCOUNT_B as 西北区今日营收,
|
|
// TOTALPRICE as 客均单价合计,TOTALCURRAMOUNT as 客单数量合计,TOTALCURRSELLCOUNT as 今日营收合计
|
|
// FROM HIGHWAY_STORAGE.V_SHOPCONNECTPOINTS WHERE SERVERPART_ID=" + SERVERPART_ID.SelectedValue.ToDecrypt();
|
|
|
|
// }
|
|
// else
|
|
// {
|
|
// strSql = @"SELECT SERVERPART_NAME as 服务区 , CONNECT_DATE_A as 东南区心跳时间,CURRAMOUNT_A as 东南区客单数量,PRICE_A as 东南区客单均价," +
|
|
// @"CURRSELLCOUNT_A as 东南区今日营收,CONNECT_DATE_B as 西北区心跳时间,CURRAMOUNT_B as 西北区客单数量,
|
|
// PRICE_B as 西北区客单均价,CURRSELLCOUNT_B as 西北区今日营收,
|
|
// TOTALPRICE as 客均单价合计,TOTALCURRAMOUNT as 客单数量合计,TOTALCURRSELLCOUNT as 今日营收合计
|
|
// FROM HIGHWAY_STORAGE.V_SERVERCONNECTPOINTS ";
|
|
// }
|
|
DataTable _DataTable = (new Storage.Business.COMMODITY(this.Transaction)).ExecuteDataTable(strSql);
|
|
ExcelHelper _ExcelHelper = new ExcelHelper();
|
|
_ExcelHelper.DataTableToExcel("日营收报表数据导出", _DataTable, "日营收报表数据", true);
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 方法 -> 行绑定事件
|
|
protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.Header)
|
|
{
|
|
#region 增加表头
|
|
e.Row.Cells[0].ColumnSpan = 2;
|
|
e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Center;
|
|
e.Row.Cells[0].Font.Bold = true;
|
|
string TmpTd = "门店信息</td><td colspan='4'style='FONT-WEIGHT:bold;border:solid #c0c0c0 1px;width:35%;' align='Center'>东(南)区</td>" +
|
|
"<td colspan='4'style='FONT-WEIGHT:bold;border:solid #c0c0c0 1px;width:35%;' align='Center'>西(北)区</td>" +
|
|
"<td colspan='3'style='FONT-WEIGHT:bold;border:solid #c0c0c0 1px;width:15%;' align='Center'>合计</td></tr>";
|
|
TmpTd += "<tr class='item' style='background-color:#F0F0F0;' align='Center'>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>序号</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>门店</td>";
|
|
|
|
TmpTd += "<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>收银状态</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>客单数量</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>客单均价</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>今日营收</td>";
|
|
|
|
TmpTd += "<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>收银状态</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>客单数量</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>客单均价</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>今日营收</td>";
|
|
|
|
TmpTd += //"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>收银状态</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>客单数量</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>客均单价</td>" +
|
|
"<td nowrap='nowrap' style='border:solid #c0c0c0 1px;'>今日营收</td>";
|
|
|
|
e.Row.Cells[0].Text = TmpTd;
|
|
|
|
e.Row.Cells[1].Visible = false;
|
|
e.Row.Cells[2].Visible = false;
|
|
e.Row.Cells[3].Visible = false;
|
|
e.Row.Cells[4].Visible = false;
|
|
e.Row.Cells[5].Visible = false;
|
|
e.Row.Cells[6].Visible = false;
|
|
e.Row.Cells[7].Visible = false;
|
|
e.Row.Cells[8].Visible = false;
|
|
e.Row.Cells[9].Visible = false;
|
|
e.Row.Cells[10].Visible = false;
|
|
e.Row.Cells[11].Visible = false;
|
|
e.Row.Cells[12].Visible = false;
|
|
e.Row.Cells[13].Visible = false;
|
|
GridViewEx1.Visible = true;
|
|
|
|
#endregion
|
|
}
|
|
else if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
if (e.Row.Cells[1].Text == "合计")
|
|
{
|
|
e.Row.Cells[2].Text = "";
|
|
e.Row.Cells[6].Text = "";
|
|
LblText.Text = "今日营收合计:" + e.Row.Cells[e.Row.Cells.Count - 1].Text;
|
|
LblText.Text += " 统计时间:" + DateTime.Now.Date.ToString() + "至" + DateTime.Now.ToString();
|
|
}
|
|
else
|
|
{
|
|
string Date_A = null;
|
|
string Date_B = null;
|
|
Business.COMMODITY _COMMODITY = new Business.COMMODITY(this.Transaction);
|
|
//服务区内码
|
|
string _SERVERPART_ID = Request["SERVERPART_ID"].ToDecrypt();
|
|
string _SHOPCODE = GridViewEx1.DataKeys[e.Row.RowIndex].Values["SHOPCODE"].ToString();
|
|
if (!string.IsNullOrEmpty(GridViewEx1.DataKeys[e.Row.RowIndex].Values["CONNECT_DATE_A"].ToString()))
|
|
{
|
|
Date_A = Convert.ToDateTime(GridViewEx1.DataKeys[e.Row.RowIndex].Values["CONNECT_DATE_A"]).ToString();
|
|
}
|
|
else
|
|
{
|
|
Date_A = DateTime.Now.AddDays(-1).ToString();
|
|
}
|
|
if (!string.IsNullOrEmpty(GridViewEx1.DataKeys[e.Row.RowIndex].Values["CONNECT_DATE_B"].ToString()))
|
|
{
|
|
Date_B = Convert.ToDateTime(GridViewEx1.DataKeys[e.Row.RowIndex].Values["CONNECT_DATE_B"]).ToString();
|
|
}
|
|
else
|
|
{
|
|
Date_B = DateTime.Now.AddDays(-1).ToString();
|
|
}
|
|
string CommCountSqlString = @"select count(1) from HIGHWAY_STORAGE.T_COMMODITY where EXISTS (
|
|
SELECT 1 FROM HIGHWAY_STORAGE.T_SERVERPARTSHOP WHERE SERVERPART_ID = " + _SERVERPART_ID +
|
|
" AND SHOPTRADE LIKE '%' || BUSINESSTYPE || '%' AND SHOPCODE = '" + _SHOPCODE +
|
|
"') AND SERVERPART_ID IN (" + Serverpart_ID + "," + _SERVERPART_ID +
|
|
") AND COMMODITY_STATE = 1 AND BUSINESSTYPE IS NOT NULL";
|
|
|
|
//状态
|
|
try
|
|
{
|
|
#region 收银状态
|
|
//回传时间
|
|
TimeSpan _TimeSpan_Back_A = DateTime.Now - DateTime.Parse(Date_A);
|
|
TimeSpan _TimeSpan_Back_B = DateTime.Now - DateTime.Parse(Date_B);
|
|
if (new Business.SERVERPARTSHOP(Transaction).GetCount("WHERE SHOPCODE LIKE '%" + _SHOPCODE +
|
|
"' AND SHOPREGION < 30 AND ISVALID = 1 AND SERVERPART_ID = " + _SERVERPART_ID) == 0)
|
|
{
|
|
e.Row.Cells[2].Text = "";
|
|
e.Row.Cells[3].Text = "";
|
|
e.Row.Cells[4].Text = "";
|
|
e.Row.Cells[5].Text = "";
|
|
}
|
|
else if (_TimeSpan_Back_A.TotalMinutes > 10)
|
|
{
|
|
//5分钟无反馈数据 找不到日结 网络断开中。。橙色
|
|
//5分钟无反馈数据 具有日结,已经结账下班 灰色
|
|
//查询日结
|
|
e.Row.Cells[2].Text = "网络未连接";
|
|
e.Row.Cells[2].ForeColor = System.Drawing.Color.MediumVioletRed;
|
|
try
|
|
{
|
|
string EndAccountSql = "select count(*) from HIGHWAY_SELLDATA.T_ENDACCOUNT where SERVERPART_ID = '" +
|
|
_SERVERPART_ID + "' AND SHOPCODE = '" + _SHOPCODE + "' AND TO_DATE('" + Date_A +
|
|
"','YYYY/MM/DD HH24:MI:SS') - ENDACCOUNT_DATE BETWEEN 0 AND 1/24";
|
|
if (int.Parse(_COMMODITY.ExecuteDataTable(EndAccountSql).Rows[0][0].ToString()) > 0)
|
|
{
|
|
e.Row.Cells[2].Text = "已经结账下班";
|
|
e.Row.Cells[2].ForeColor = System.Drawing.Color.DimGray;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
e.Row.Cells[2].Text = "网络未连接";
|
|
e.Row.Cells[2].ForeColor = System.Drawing.Color.MediumVioletRed;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//5分钟之内无客单 等待上班中。。绿色
|
|
//5分钟之内有客单 收银状态正常 蓝色
|
|
try
|
|
{
|
|
|
|
//if (e.Row.Cells[3].Text == "0")
|
|
//{
|
|
// e.Row.Cells[2].Text = "等待上班中";
|
|
// e.Row.Cells[2].ForeColor = System.Drawing.Color.ForestGreen;
|
|
//}
|
|
//else
|
|
//{
|
|
//检测到客单
|
|
e.Row.Cells[2].Text = "收银状态正常";
|
|
e.Row.Cells[2].ForeColor = System.Drawing.Color.DeepSkyBlue;
|
|
//}
|
|
}
|
|
catch
|
|
{
|
|
e.Row.Cells[2].Text = "收银状态正常";
|
|
e.Row.Cells[2].ForeColor = System.Drawing.Color.DeepSkyBlue;
|
|
}
|
|
}
|
|
|
|
|
|
if (new Business.SERVERPARTSHOP(Transaction).GetCount("WHERE SHOPCODE LIKE '%" + _SHOPCODE +
|
|
"' AND SHOPREGION >= 30 AND ISVALID = 1 AND SERVERPART_ID = " + _SERVERPART_ID) == 0)
|
|
{
|
|
e.Row.Cells[6].Text = "";
|
|
e.Row.Cells[7].Text = "";
|
|
e.Row.Cells[8].Text = "";
|
|
e.Row.Cells[9].Text = "";
|
|
}
|
|
else if (_TimeSpan_Back_B.TotalMinutes > 10)
|
|
{
|
|
//5分钟无反馈数据 找不到日结 网络断开中。。橙色
|
|
//5分钟无反馈数据 具有日结,已经结账下班 灰色
|
|
//查询日结
|
|
e.Row.Cells[6].Text = "网络未连接";
|
|
e.Row.Cells[6].ForeColor = System.Drawing.Color.MediumVioletRed;
|
|
try
|
|
{
|
|
string EndAccountSql = "select count(*) from HIGHWAY_SELLDATA.T_ENDACCOUNT where SERVERPART_ID = '" +
|
|
_SERVERPART_ID + "' AND SHOPCODE = '" + _SHOPCODE + "' AND TO_DATE('" + Date_B +
|
|
"','YYYY/MM/DD HH24:MI:SS') - ENDACCOUNT_DATE BETWEEN 0 AND 1/24";
|
|
if (int.Parse(_COMMODITY.ExecuteDataTable(EndAccountSql).Rows[0][0].ToString()) > 0)
|
|
{
|
|
e.Row.Cells[6].Text = "已经结账下班";
|
|
e.Row.Cells[6].ForeColor = System.Drawing.Color.DimGray;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
e.Row.Cells[6].Text = "网络未连接";
|
|
e.Row.Cells[6].ForeColor = System.Drawing.Color.MediumVioletRed;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//5分钟之内无客单 等待上班中。。绿色
|
|
//5分钟之内有客单 收银状态正常 蓝色
|
|
try
|
|
{
|
|
//if (e.Row.Cells[7].Text == "0")
|
|
//{
|
|
// e.Row.Cells[6].Text = "等待上班中";
|
|
// e.Row.Cells[6].ForeColor = System.Drawing.Color.ForestGreen;
|
|
//}
|
|
//else
|
|
//{
|
|
//检测到客单
|
|
e.Row.Cells[6].Text = "收银状态正常";
|
|
e.Row.Cells[6].ForeColor = System.Drawing.Color.DeepSkyBlue;
|
|
//}
|
|
|
|
}
|
|
catch
|
|
{
|
|
e.Row.Cells[6].Text = "收银状态正常";
|
|
e.Row.Cells[6].ForeColor = System.Drawing.Color.DeepSkyBlue;
|
|
}
|
|
}
|
|
//当前时间与最后订单
|
|
#endregion
|
|
}
|
|
catch
|
|
{
|
|
e.Row.Cells[2].Text = "网络未连接";
|
|
e.Row.Cells[2].ForeColor = System.Drawing.Color.MediumVioletRed;
|
|
e.Row.Cells[6].Text = "网络未连接";
|
|
e.Row.Cells[6].ForeColor = System.Drawing.Color.MediumVioletRed;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 翻页事件 GridPageEx_CallBackPageChanged
|
|
protected void GridPageEx1_CallBackPageChanged(object sender, ClientSetEventArgs e)
|
|
{
|
|
GridViewEx1.Pagging<Business.SERVERPART>(ObjectDataSource1, GridPageEx1);
|
|
|
|
//设置UI变化
|
|
e.SetValue(GridViewEx1);
|
|
}
|
|
#endregion
|
|
|
|
#region 条件查询事件GridViewEx_SelectMethodParameters
|
|
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
|
|
{
|
|
//且搜索条件
|
|
e.AddAndParams("1", 1);
|
|
//搜索选项的搜索条件过滤
|
|
if (Request["SERVERPART_ID"] != null)
|
|
{
|
|
e.AddAndParams("SERVERPART_ID", Request["SERVERPART_ID"].ToDecrypt());
|
|
}
|
|
//且搜索条件
|
|
//e.AddAndParams(字段名, 值);
|
|
//或搜索条件
|
|
//e.AddOrParams(字段名, 值);
|
|
//排序
|
|
e.AddOrderByParams("SHOPCODE,SHOPNAME", false);
|
|
}
|
|
#endregion
|
|
}
|
|
} |