610 lines
30 KiB
C#
610 lines
30 KiB
C#
using System;
|
||
using System.Configuration;
|
||
using System.Data;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using SuperMap.RealEstate.CoreFrameWork;
|
||
using SuperMap.RealEstate.Web.UI;
|
||
using SuperMap.RealEstate.Web.UI.WebControls;
|
||
using SuperMap.RealEstate.HighWay.Storage.Business;
|
||
using Business = SuperMap.RealEstate.HighWay.SellData.Business;
|
||
|
||
namespace SuperMap.RealEstate.HighWay.Modules.EndAccountSeparate
|
||
{
|
||
/// <summary>
|
||
/// T_ENDACCOUNT_结账表 的WebUserControl
|
||
/// <summary>
|
||
public partial class ENDACCOUNT : UserControl<Business.ENDACCOUNT>
|
||
{
|
||
protected string SERVERPARTID = ConfigurationManager.AppSettings["UmiformCommodity"].ToString().Split('|')[0];
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (IsPostBack) return;
|
||
|
||
InitControls();
|
||
|
||
//初始化并加载列表
|
||
GridViewEx1.SelectingWithInit<Storage.Business.SERVERPART>(ObjectDataSource1, null);
|
||
string code = SHOPCODE.SelectedValue;
|
||
string name= SHOPNAME.Text;
|
||
}
|
||
|
||
#region 方法 -> 初始化页面信息【InitControls】
|
||
private void InitControls()
|
||
{
|
||
SERVERPART_ID.Items.Clear();
|
||
ListItemEx _ListItemEx = new ListItemEx();
|
||
foreach (SERVERPART _SERVERPART in (new SERVERPART(this.Transaction)).GetPassportServerPart(Page.PassportInfo.CityAuthority))
|
||
{
|
||
_ListItemEx = new ListItemEx();
|
||
_ListItemEx.Value = _SERVERPART.SERVERPART_ID.ToString();
|
||
_ListItemEx.Text = _SERVERPART.SERVERPART_NAME;
|
||
SERVERPART_ID.Items.Add(_ListItemEx);
|
||
}
|
||
if (CurrObject.ENDACCOUNT_ID != 0 && CurrObject.ENDACCOUNT_ID != null)
|
||
{
|
||
SERVERPART_ID.SelectedValue = CurrObject.SERVERPART_ID.ToString();
|
||
}
|
||
else if (Request["SERVERPART_ID"] != null)
|
||
SERVERPART_ID.SelectedValue = Request["SERVERPART_ID"].ToDecrypt();
|
||
|
||
if (SERVERPART_ID.SelectedIndex > -1)
|
||
{
|
||
SERVERPART _SERVERPART = new SERVERPART(this.Transaction);
|
||
_SERVERPART.SERVERPART_ID_Encrypt = SERVERPART_ID.SelectedValue.ToEncrypt();
|
||
if (_SERVERPART.Select())
|
||
{
|
||
SERVERPARTCODE.Text = _SERVERPART.SERVERPART_CODE;
|
||
SERVERPART_NAME.Text = _SERVERPART.SERVERPART_NAME;
|
||
PROVINCE_CODE.Text = _SERVERPART.PROVINCE_CODE.ToString();
|
||
}
|
||
SHOPCODE.Items.Clear();
|
||
_ListItemEx = new ListItemEx();
|
||
foreach (SERVERPARTSHOP _SERVERPARTSHOP in (new SERVERPARTSHOP(this.Transaction)).FillCollection(
|
||
"where SERVERPART_ID = " + SERVERPART_ID.SelectedValue + " AND ISVALID = 1 ORDER BY SHOPCODE"))
|
||
{
|
||
_ListItemEx = new ListItemEx();
|
||
_ListItemEx.Text = _SERVERPARTSHOP.SHOPNAME;
|
||
_ListItemEx.Value = _SERVERPARTSHOP.SHOPCODE;
|
||
SHOPCODE.Items.Add(_ListItemEx);
|
||
}
|
||
//结账人员
|
||
ENDPERSONCODE.Items.Clear();
|
||
foreach (CASHWORKER _CASHWORKER in (new CASHWORKER(this.Transaction)).FillCollection(
|
||
"where LENGTH(CASHWORKER_LOGINNAME) = 4 AND WORKER_VALID = 1 AND SERVERPART_ID = " +
|
||
SERVERPART_ID.SelectedValue + " and SUBSTR(NVL(WORKER_OTHER,'0000'),3,1) = '1' ORDER BY CASHWORKER_LOGINNAME"))
|
||
{
|
||
_ListItemEx = new ListItemEx();
|
||
_ListItemEx.Text = _CASHWORKER.CASHWORKER_NAME.ToString();
|
||
_ListItemEx.Value = _CASHWORKER.CASHWORKER_LOGINNAME.ToString();
|
||
ENDPERSONCODE.Items.Add(_ListItemEx);
|
||
}
|
||
//收银人员
|
||
CASHIER_NAME.Items.Clear();
|
||
foreach (CASHWORKER _CASHWORKER in (new CASHWORKER(this.Transaction)).FillCollection(
|
||
"where LENGTH(CASHWORKER_LOGINNAME) = 4 AND WORKER_VALID = 1 AND SERVERPART_ID = " +
|
||
SERVERPART_ID.SelectedValue + " and WORKER_OTHER LIKE '1%' ORDER BY CASHWORKER_LOGINNAME"))
|
||
{
|
||
_ListItemEx = new ListItemEx();
|
||
_ListItemEx.Text = _CASHWORKER.CASHWORKER_NAME.ToString();
|
||
_ListItemEx.Value = _CASHWORKER.CASHWORKER_NAME.ToString();
|
||
CASHIER_NAME.Items.Add(_ListItemEx);
|
||
}
|
||
if (ENDPERSONCODE.SelectedIndex > -1)
|
||
{
|
||
WORKER_NAME.Text = ENDPERSONCODE.SelectedItem.Text;
|
||
}
|
||
if (CurrObject.ENDACCOUNT_ID != 0 && CurrObject.ENDACCOUNT_ID != null)
|
||
{
|
||
SHOPCODE.SelectedValue = CurrObject.SHOPCODE;
|
||
ENDPERSONCODE.SelectedValue = CurrObject.ENDPERSONCODE;
|
||
CASHIER_NAME.SelectedValue = CurrObject.CASHIER_NAME;
|
||
}
|
||
else if (Request["SHOPCODE"] != null)
|
||
SHOPCODE.SelectedValue = Request["SHOPCODE"].ToDecrypt();
|
||
|
||
if (SHOPCODE.SelectedIndex > -1)
|
||
{
|
||
SHOPNAME.Text = SHOPCODE.SelectedItem.Text;
|
||
}
|
||
}
|
||
|
||
#region 获取交班数据
|
||
string sqlPersonsell = string.Format(@"SELECT * FROM HIGHWAY_SELLDATA.T_PERSONSELL WHERE SERVERPART_ID = {0} AND
|
||
SHOPCODE = '{1}' AND TRUNC(SELL_ENDDATE) = TO_DATE('{2}','yyyy-mm-dd')", Request["SERVERPART_ID"].ToDecrypt(),
|
||
Request["SHOPCODE"].ToDecrypt(), Request["ENDACCOUNT_DATE"].ToDecrypt().Split(' ')[0]);
|
||
Business.PERSONSELL _PERSONSELL = new Business.PERSONSELL(this.Transaction);
|
||
DataTable dtPersonsell = _PERSONSELL.ExecuteDataTable(sqlPersonsell);
|
||
if (dtPersonsell.Rows.Count > 0)
|
||
{
|
||
dtPersonsell.DefaultView.Sort = "SELL_ENDDATE DESC";
|
||
dtPersonsell = dtPersonsell.DefaultView.ToTable();
|
||
GridViewEx2.DataSource = dtPersonsell;
|
||
GridViewEx2.DataBind();
|
||
}
|
||
else
|
||
{
|
||
liPersonsell.Visible = false;
|
||
GridViewEx2.Visible = false;
|
||
}
|
||
#endregion
|
||
|
||
#region 获取稽核数据
|
||
string sqlCheckAccount = string.Format(@"SELECT * FROM HIGHWAY_SELLDATA.T_CHECKACCOUNT WHERE SERVERPART_ID = {0} AND
|
||
SHOPCODE = '{1}' AND TRUNC(CHECK_ENDDATE) = TO_DATE('{2}','yyyy-mm-dd')", Request["SERVERPART_ID"].ToDecrypt(),
|
||
Request["SHOPCODE"].ToDecrypt(), Request["ENDACCOUNT_DATE"].ToDecrypt().Split(' ')[0]);
|
||
Business.CHECKACCOUNT _CHECKACCOUNT = new Business.CHECKACCOUNT(this.Transaction);
|
||
DataTable dtCheckAccount = _CHECKACCOUNT.ExecuteDataTable(sqlCheckAccount);
|
||
if (dtCheckAccount.Rows.Count > 0)
|
||
{
|
||
dtCheckAccount.DefaultView.Sort = "CHECK_ENDDATE DESC";
|
||
dtCheckAccount = dtCheckAccount.DefaultView.ToTable();
|
||
GridViewEx3.DataSource = dtCheckAccount;
|
||
GridViewEx3.DataBind();
|
||
}
|
||
else
|
||
{
|
||
liCheckAccount.Visible = false;
|
||
GridViewEx3.Visible = false;
|
||
}
|
||
#endregion
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 绑定服务区、门店下拉框
|
||
protected void SERVERPART_ID_CallBackSetControl(object sender, ClientSetEventArgs e)
|
||
{
|
||
SERVERPART _SERVERPART = new SERVERPART(this.Transaction);
|
||
_SERVERPART.SERVERPART_ID_Encrypt = SERVERPART_ID.SelectedValue.ToEncrypt();
|
||
if (_SERVERPART.Select())
|
||
{
|
||
SERVERPARTCODE.Text = _SERVERPART.SERVERPART_CODE;
|
||
SERVERPART_NAME.Text = _SERVERPART.SERVERPART_NAME;
|
||
PROVINCE_CODE.Text = _SERVERPART.PROVINCE_CODE.ToString();
|
||
e.SetValue(SERVERPARTCODE);
|
||
e.SetValue(SERVERPART_NAME);
|
||
e.SetValue(PROVINCE_CODE);
|
||
}
|
||
ListItemEx _ListItemEx = new ListItemEx();
|
||
SHOPCODE.Items.Clear();
|
||
_ListItemEx = new ListItemEx();
|
||
foreach (SERVERPARTSHOP _SERVERPARTSHOP in (new SERVERPARTSHOP(this.Transaction)).FillCollection(
|
||
"where SERVERPART_ID = " + SERVERPART_ID.SelectedValue + " AND ISVALID = 1 ORDER BY SHOPCODE"))
|
||
{
|
||
_ListItemEx = new ListItemEx();
|
||
_ListItemEx.Text = _SERVERPARTSHOP.SHOPNAME.ToString();
|
||
_ListItemEx.Value = _SERVERPARTSHOP.SHOPCODE.ToString();
|
||
SHOPCODE.Items.Add(_ListItemEx);
|
||
}
|
||
if (SHOPCODE.SelectedIndex > -1)
|
||
{
|
||
SHOPNAME.Text = SHOPCODE.SelectedItem.Text;
|
||
e.SetValue(SHOPNAME);
|
||
}
|
||
|
||
//结账人员
|
||
ENDPERSONCODE.Items.Clear();
|
||
foreach (CASHWORKER _CASHWORKER in (new CASHWORKER(this.Transaction)).FillCollection(
|
||
"where LENGTH(CASHWORKER_LOGINNAME) = 4 AND WORKER_VALID = 1 AND SERVERPART_ID = " +
|
||
SERVERPART_ID.SelectedValue + " and SUBSTR(NVL(WORKER_OTHER,'000000'),3,1) = '1' ORDER BY CASHWORKER_LOGINNAME"))
|
||
{
|
||
_ListItemEx = new ListItemEx();
|
||
_ListItemEx.Text = _CASHWORKER.CASHWORKER_NAME.ToString();
|
||
_ListItemEx.Value = _CASHWORKER.CASHWORKER_LOGINNAME.ToString();
|
||
ENDPERSONCODE.Items.Add(_ListItemEx);
|
||
}
|
||
//收银人员
|
||
CASHIER_NAME.Items.Clear();
|
||
foreach (CASHWORKER _CASHWORKER in (new CASHWORKER(this.Transaction)).FillCollection(
|
||
"where LENGTH(CASHWORKER_LOGINNAME) = 4 AND WORKER_VALID = 1 AND SERVERPART_ID = " +
|
||
SERVERPART_ID.SelectedValue + " and WORKER_OTHER LIKE '1%' ORDER BY CASHWORKER_LOGINNAME"))
|
||
{
|
||
_ListItemEx = new ListItemEx();
|
||
_ListItemEx.Text = _CASHWORKER.CASHWORKER_NAME.ToString();
|
||
_ListItemEx.Value = _CASHWORKER.CASHWORKER_NAME.ToString();
|
||
CASHIER_NAME.Items.Add(_ListItemEx);
|
||
}
|
||
if (ENDPERSONCODE.SelectedIndex > -1)
|
||
{
|
||
WORKER_NAME.Text = ENDPERSONCODE.SelectedItem.Text;
|
||
e.SetValue(WORKER_NAME);
|
||
}
|
||
e.SetDropDownListEx(SHOPCODE);
|
||
e.SetDropDownListEx(ENDPERSONCODE);
|
||
e.SetDropDownListEx(CASHIER_NAME);
|
||
}
|
||
|
||
protected void SHOPCODE_CallBackSetControl(object sender, ClientSetEventArgs e)
|
||
{
|
||
SHOPNAME.Text = SHOPCODE.SelectedItem.Text;
|
||
//ENDACCOUNT_STARTDATE.Items.Clear();
|
||
//ListItemEx _ListItemEx = new ListItemEx();
|
||
//foreach (Business.ENDACCOUNT _ENDACCOUNT in (new Business.ENDACCOUNT(this.Transaction)).FillCollection(
|
||
// "where SERVERPART_ID = " + SERVERPART_ID.SelectedValue + " AND SHOPCODE = '" + SHOPCODE.SelectedValue +
|
||
// (MACHINECODE.Text.Trim() != "" ? "' AND MACHINECODE = '" + MACHINECODE.Text : "") +
|
||
// "' AND VALID = 1 ORDER BY ENDACCOUNT_DATE DESC"))
|
||
//{
|
||
// _ListItemEx = new ListItemEx();
|
||
// _ListItemEx.Text = _ENDACCOUNT.ENDACCOUNT_DATE.ToString();
|
||
// _ListItemEx.Value = _ENDACCOUNT.ENDACCOUNT_DATE.ToString();
|
||
// ENDACCOUNT_STARTDATE.Items.Add(_ListItemEx);
|
||
//}
|
||
e.SetValue(SHOPNAME);
|
||
//e.SetDropDownListEx(ENDACCOUNT_STARTDATE);
|
||
}
|
||
|
||
protected void ENDPERSONCODE_CallBackSetControl(object sender, ClientSetEventArgs e)
|
||
{
|
||
WORKER_NAME.Text = ENDPERSONCODE.SelectedItem.Text;
|
||
e.SetValue(WORKER_NAME);
|
||
}
|
||
|
||
protected void MACHINECODE_CallBackSetControl(object sender, ClientSetEventArgs e)
|
||
{
|
||
//if (SHOPCODE.SelectedIndex > -1)
|
||
//{
|
||
// if (MACHINECODE.Text.Trim() != "")
|
||
// {
|
||
// ENDACCOUNT_STARTDATE.Items.Clear();
|
||
// ListItemEx _ListItemEx = new ListItemEx();
|
||
// foreach (Business.ENDACCOUNT _ENDACCOUNT in (new Business.ENDACCOUNT(this.Transaction)).FillCollection(
|
||
// "where SERVERPART_ID = " + SERVERPART_ID.SelectedValue + " AND SHOPCODE = '" +
|
||
// SHOPCODE.SelectedValue + "' AND MACHINECODE = '" + MACHINECODE.Text + "' ORDER BY ENDACCOUNT_DATE DESC"))
|
||
// {
|
||
// _ListItemEx = new ListItemEx();
|
||
// _ListItemEx.Text = _ENDACCOUNT.ENDACCOUNT_DATE.ToString();
|
||
// _ListItemEx.Value = _ENDACCOUNT.ENDACCOUNT_DATE.ToString();
|
||
// ENDACCOUNT_STARTDATE.Items.Add(_ListItemEx);
|
||
// }
|
||
// e.SetDropDownListEx(ENDACCOUNT_STARTDATE);
|
||
// }
|
||
//}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 在此加入界面的数据初始化(Page_Load之前),如DropDownList的数据源绑定等
|
||
public override void InitializeWebControl()
|
||
{
|
||
//处理标记
|
||
TREATMENT_MARK.Clear();
|
||
DictionaryHelper.BindingDropDownList("TREATMENT_MARK", TREATMENT_MARK.Items, this.Transaction);
|
||
TREATMENT_MARK.SelectedValue = "1";
|
||
//处理标记
|
||
VALID.Clear();
|
||
DictionaryHelper.BindingDropDownList("ISVALID", VALID.Items, this.Transaction);
|
||
VALID.SelectedValue = "1";
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 载入数据
|
||
public override bool LoadData()
|
||
{
|
||
bool flag = false;
|
||
//如果是工作流组件请自行修改载入的逻辑,以下是功能模块的默认代码
|
||
if (!String.IsNullOrEmpty(Request["ID"]))
|
||
{
|
||
CurrObject.ENDACCOUNT_ID_Encrypt = Request["ID"];
|
||
flag = this.Select();
|
||
if (CurrObject.APPROVE_STAFF == null || CurrObject.APPROVE_DATE == null)
|
||
{
|
||
DESCRIPTION_STAFF.Text = this.Page.PassportInfo.Name + "【补】";
|
||
DESCRIPTION_DATE.Text = DateTime.Now.ToString();
|
||
}
|
||
return flag;
|
||
}
|
||
else
|
||
{
|
||
if (Request["ENDACCOUNT_DATE"] != null)
|
||
{
|
||
ENDACCOUNT_STARTDATE.Text = Request["ENDACCOUNT_DATE"].ToDecrypt();
|
||
ENDACCOUNT_DATE.Text = Request["ENDACCOUNT_DATE"].ToDecrypt();
|
||
}
|
||
DESCRIPTION_STAFF.Text = this.Page.PassportInfo.Name + "【补】";
|
||
DESCRIPTION_DATE.Text = DateTime.Now.ToString();
|
||
DOWNLOAD_DATE.Text = DateTime.Now.ToString();
|
||
}
|
||
//默认返回值,工作流组件返回True,功能模块返回False。
|
||
return (WorkFlowPage != null);
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 查询SQL设置
|
||
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
|
||
{
|
||
if (Request["SERVERPART_ID"] != null)
|
||
{
|
||
e.AddAndParams("SERVERPART_ID", Request["SERVERPART_ID"].ToDecrypt());
|
||
}
|
||
else
|
||
{
|
||
e.AddAndParams("SERVERPART_ID", "0");
|
||
}
|
||
if (Request["SHOPCODE"] != null)
|
||
{
|
||
e.AddAndParams("SHOPCODE", Request["SHOPCODE"].ToDecrypt());
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 列表行事件
|
||
protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e)
|
||
{
|
||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||
{
|
||
COMMODITY _COMMODITY = new COMMODITY(this.Transaction);
|
||
//服务区内码
|
||
string _SERVERPART_ID = GridViewEx1.DataKeys[e.Row.RowIndex].Values["SERVERPART_ID"].ToString();
|
||
string _SERVERPARTCODE = GridViewEx1.DataKeys[e.Row.RowIndex].Values["SERVERPARTCODE"].ToEncrypt();
|
||
string _SHOPCODE = GridViewEx1.DataKeys[e.Row.RowIndex].Values["SHOPCODE"].ToString();
|
||
string _MACHINECODE = GridViewEx1.DataKeys[e.Row.RowIndex].Values["MACHINECODE"].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 (" +
|
||
SERVERPARTID + "," + _SERVERPART_ID + ") AND COMMODITY_STATE = 1 AND BUSINESSTYPE IS NOT NULL";
|
||
try
|
||
{
|
||
if (new ExchangeData.Business.MACHINEPOINT(_COMMODITY).GetCount("WHERE SERVERPARTCODE = '" + _SERVERPARTCODE.ToDecrypt() +
|
||
"' AND SHOPCODE = '" + _SHOPCODE + "' AND MACHINENAME = '" + e.Row.Cells[e.Row.Cells.Count - 4].Text + "'") > 0)
|
||
{
|
||
e.Row.Attributes["onclick"] = GridViewEx1.GetOpenPopDialogClientScript(
|
||
"/ExchangeData/Modules/MachineInfo/MACHINEPOINTPage.aspx?SERVERPARTCODE=" + _SERVERPARTCODE + "&SHOPCODE=" +
|
||
_SHOPCODE.ToEncrypt() + "&MACHINENAME=" + e.Row.Cells[e.Row.Cells.Count - 4].Text.ToEncrypt(), 700, 300);
|
||
}
|
||
else
|
||
{
|
||
e.Row.Attributes["onclick"] = "";
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
e.Row.Attributes["onclick"] = "";
|
||
}
|
||
DataTable _DataTable_PassComm = _COMMODITY.ExecuteDataTable(CommCountSqlString);
|
||
//审批通过商品数量
|
||
string PassCommCount = _DataTable_PassComm.Rows[0][0].ToString();
|
||
if (e.Row.Cells[4].Text != PassCommCount)
|
||
{
|
||
e.Row.Cells[4].ForeColor = System.Drawing.Color.IndianRed;
|
||
}
|
||
e.Row.Cells[4].Text = PassCommCount + "/" + e.Row.Cells[4].Text;*/
|
||
|
||
//如果客单为0, 对客营收为0
|
||
if (e.Row.Cells[6].Text == "0")
|
||
{
|
||
e.Row.Cells[5].Text = "0";
|
||
}
|
||
//平均客单金额
|
||
try
|
||
{
|
||
if (e.Row.Cells[6].Text != "0")
|
||
{
|
||
e.Row.Cells[7].Text = (double.Parse(e.Row.Cells[5].Text) / double.Parse(e.Row.Cells[6].Text)).ToString("0.00");
|
||
}
|
||
else
|
||
{
|
||
e.Row.Cells[7].Text = "0";
|
||
}
|
||
}
|
||
catch { }
|
||
|
||
#region 最近客单信息
|
||
string AllString = e.Row.Cells[e.Row.Cells.Count - 2].Text;
|
||
/*try
|
||
{
|
||
if (AllString.Split('|').Length > 3)
|
||
{
|
||
if (AllString.Split('|').Length == 5)
|
||
{
|
||
//解析对应的商品 1.最后销售日期 + 销售时间 + 销售商品 + 销售金额 + 版本号
|
||
//商品 + 销售时间 + 金额
|
||
string SellString = "";
|
||
e.Row.Cells[e.Row.Cells.Count - 2].Text = "";
|
||
// 7 最后销售商品
|
||
string CodeString = "";
|
||
foreach (string str in AllString.Split('|')[2].Split(','))
|
||
{
|
||
CodeString += (CodeString == "" ? "" : ",") + "'" + str + "'";
|
||
}
|
||
string SqlString = "SELECT COMMODITY_NAME FROM HIGHWAY_STORAGE.T_COMMODITY WHERE COMMODITY_CODE IN(" + CodeString + ")";
|
||
foreach (DataRow _Dr in _COMMODITY.ExecuteDataTable(SqlString).Rows)
|
||
{
|
||
SellString += (SellString == "" ? "" : ",") + _Dr["COMMODITY_NAME"].ToString();
|
||
}
|
||
// 9 最后销售金额
|
||
e.Row.Cells[e.Row.Cells.Count - 2].Text = "金额:" + AllString.Split('|')[3];
|
||
// 8 最后销售时间
|
||
e.Row.Cells[e.Row.Cells.Count - 2].Text += "元," + AllString.Split('|')[1].Split(' ')[1];
|
||
e.Row.Cells[e.Row.Cells.Count - 2].Text += "," + FormatString(SellString);
|
||
if (SellString.Length > 10)
|
||
{
|
||
e.Row.Cells[e.Row.Cells.Count - 2].ToolTip = SellString;
|
||
}
|
||
// 14 收银机版本号
|
||
e.Row.Cells[e.Row.Cells.Count - 1].Text = AllString.Split('|')[4];
|
||
}
|
||
else if (AllString.Split('|').Length == 6)
|
||
{
|
||
string SellString = "";
|
||
e.Row.Cells[e.Row.Cells.Count - 2].Text = "";
|
||
// 7 最后销售商品
|
||
string CodeString = "";
|
||
foreach (string str in AllString.Split('|')[2].Split(','))
|
||
{
|
||
CodeString += (CodeString == "" ? "" : ",") + "'" + str + "'";
|
||
}
|
||
string SqlString = "SELECT COMMODITY_NAME FROM HIGHWAY_STORAGE.T_COMMODITY WHERE COMMODITY_CODE IN(" + CodeString + ")";
|
||
DataTable _DataTable = _COMMODITY.ExecuteDataTable(SqlString);
|
||
for (int i = 0; i < _DataTable.Rows.Count; i++)
|
||
{
|
||
try
|
||
{
|
||
SellString += (SellString == "" ? "" : ",") + _DataTable.Rows[i]["COMMODITY_NAME"].ToString() +
|
||
AllString.Split('|')[4].Split(',')[i];
|
||
}
|
||
catch
|
||
{ }
|
||
}
|
||
// 9 最后销售金额
|
||
e.Row.Cells[e.Row.Cells.Count - 2].Text = "金额:" + AllString.Split('|')[3];
|
||
// 8 最后销售时间
|
||
e.Row.Cells[e.Row.Cells.Count - 2].Text += "元," + AllString.Split('|')[1].Split(' ')[1];
|
||
e.Row.Cells[e.Row.Cells.Count - 2].Text += "," + FormatString(SellString);
|
||
if (SellString.Length > 10)
|
||
{
|
||
e.Row.Cells[e.Row.Cells.Count - 2].ToolTip = SellString;
|
||
}
|
||
// 14 收银机版本号
|
||
e.Row.Cells[e.Row.Cells.Count - 1].Text = AllString.Split('|')[5];
|
||
}
|
||
}
|
||
else
|
||
{
|
||
e.Row.Cells[e.Row.Cells.Count - 2].Text = "";
|
||
e.Row.Cells[e.Row.Cells.Count - 1].Text = AllString.Split('|')[2];
|
||
}
|
||
}
|
||
catch { }*/
|
||
#endregion
|
||
|
||
//状态
|
||
try
|
||
{
|
||
//回传时间
|
||
System.TimeSpan _TimeSpan_Back = System.DateTime.Now - DateTime.Parse(e.Row.Cells[3].Text);
|
||
if (_TimeSpan_Back.TotalMinutes > 10)
|
||
{
|
||
//5分钟无反馈数据 找不到日结 网络断开中。。橙色
|
||
//5分钟无反馈数据 具有日结,已经结账下班 灰色
|
||
//查询日结
|
||
e.Row.Cells[2].Text = "网络未连接";
|
||
e.Row.Cells[2].ForeColor = System.Drawing.Color.MediumVioletRed;
|
||
string EndAccountSql = "select count(*) from HIGHWAY_SELLDATA.T_ENDACCOUNT where SERVERPART_ID = '" +
|
||
_SERVERPART_ID + "' AND SHOPCODE = '" + _SHOPCODE + "' AND MACHINECODE='" + _MACHINECODE +
|
||
"' AND TO_DATE('" + e.Row.Cells[3].Text +
|
||
"','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;
|
||
try
|
||
{
|
||
if (DateTime.Parse(e.Row.Cells[3].Text) < DateTime.Now.Date)
|
||
{
|
||
e.Row.Cells[3].ForeColor = System.Drawing.Color.DimGray;
|
||
}
|
||
}
|
||
catch { }
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//5分钟之内无客单 等待上班中。。绿色
|
||
//5分钟之内有客单 收银状态正常 蓝色
|
||
try
|
||
{
|
||
System.TimeSpan _TimeSpan_Bill = System.DateTime.Now - DateTime.Parse(AllString.Split('|')[1]);
|
||
if (_TimeSpan_Bill.TotalMinutes < 10)
|
||
{
|
||
//检测到客单
|
||
e.Row.Cells[2].Text = "收银状态正常";
|
||
e.Row.Cells[2].ForeColor = System.Drawing.Color.DeepSkyBlue;
|
||
}
|
||
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;
|
||
}
|
||
}
|
||
//当前时间与最后订单
|
||
}
|
||
catch
|
||
{
|
||
e.Row.Cells[2].Text = "网络未连接";
|
||
e.Row.Cells[2].ForeColor = System.Drawing.Color.MediumVioletRed;
|
||
}
|
||
|
||
//未接入网络()
|
||
try
|
||
{
|
||
if (DateTime.Parse(e.Row.Cells[3].Text) <= DateTime.Now.Date)
|
||
{
|
||
e.Row.Cells[e.Row.Cells.Count - 6].Text = "0";
|
||
}
|
||
}
|
||
catch { }
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
//OnDataAction_XXXXX 有一个系列可用,在此加入界面的逻辑处理
|
||
//e.CancelDataAction 来处理是否取消该动作;
|
||
//失败的原因可以用Page.Alert()传递到页面
|
||
public override void OnDataAction_BeforeSave(DataActionEventArgs<Business.ENDACCOUNT> e)
|
||
{
|
||
if (e.CurrObject.DIFFERENT_PRICE == null)
|
||
{
|
||
e.CurrObject.DIFFERENT_PRICE = e.CurrObject.CASHPAY_DOWNLORD - e.CurrObject.TOTALSELLAMOUNT;
|
||
}
|
||
base.OnDataAction_BeforeSave(e);
|
||
}
|
||
|
||
#region 方法 -> 按钮保存后事件
|
||
public override void OnDataAction_AfterSave(DataActionEventArgs<Business.ENDACCOUNT> e)
|
||
{
|
||
//查询门店内码,用于云端数据同步使用
|
||
if (SHOPCODE.SelectedIndex > -1)
|
||
{
|
||
DataTable dtShop = (new SERVERPARTSHOP(this.Transaction)).ExecuteDataTable(@"
|
||
SELECT SERVERPARTSHOP_ID FROM HIGHWAY_STORAGE.T_SERVERPARTSHOP
|
||
WHERE SERVERPART_ID =" + SERVERPART_ID.SelectedValue + " AND ISVALID = 1 AND SHOPCODE='"+SHOPCODE.SelectedValue+"'");
|
||
if (dtShop.Rows.Count > 0)
|
||
{
|
||
SERVERPARTSHOP_ID.Text = dtShop.Rows[0]["SERVERPARTSHOP_ID"].ToString();
|
||
}
|
||
}
|
||
base.OnDataAction_AfterSave(e);
|
||
|
||
//调用js同步结账数据到云端
|
||
Page.ExecClientScript("SyncToCloud()");
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 计算长短款额
|
||
protected void CASHPAY_DOWNLORD_CallBackSetControl(object sender, ClientSetEventArgs e)
|
||
{
|
||
if (TOTALSELLAMOUNT.Text.Trim() != "" && CASHPAY_DOWNLORD.Text.Trim() != "")
|
||
{
|
||
DIFFERENT_PRICE.Text = (double.Parse(CASHPAY_DOWNLORD.Text) - double.Parse(TOTALSELLAMOUNT.Text)).ToString();
|
||
e.SetValue(DIFFERENT_PRICE);
|
||
}
|
||
}
|
||
|
||
protected void TOTALSELLAMOUNT_CallBackSetControl(object sender, ClientSetEventArgs e)
|
||
{
|
||
if (CASHPAY_DOWNLORD.Text.Trim() != "" && CASHPAY_DOWNLORD.Text.Trim() != "")
|
||
{
|
||
DIFFERENT_PRICE.Text = (double.Parse(CASHPAY_DOWNLORD.Text) - double.Parse(TOTALSELLAMOUNT.Text)).ToString();
|
||
e.SetValue(DIFFERENT_PRICE);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
private string FormatString(string str)
|
||
{
|
||
if (str.Length >= 10)
|
||
{
|
||
return str.Substring(0, 10) + "...";
|
||
}
|
||
return str;
|
||
}
|
||
}
|
||
}
|