2026821
This commit is contained in:
@@ -0,0 +1,344 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using GThinking.N_MISPRO;
|
||||
using GThinking.N_MISPRO.Data;
|
||||
using GThinking.N_MODEL.Page;
|
||||
using GThinking.N_MISPRO.Utility;
|
||||
using GThinking.N_PUBLIC;
|
||||
using GThinking.N_MODEL.Dialog;
|
||||
using GThinking.N_CONTROL;
|
||||
|
||||
namespace GThinking.N_XLXSBJ
|
||||
{
|
||||
public partial class TZYZBJMXInfo : SingleCardBase
|
||||
{
|
||||
TZYZBJ_YZZ1 entity = new TZYZBJ_YZZ1();
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 100860019;
|
||||
this.UMName = "按付款方式调报价";
|
||||
this.CurMaster = Master;
|
||||
this.CurEntity = entity;
|
||||
this.PageHeight = 400;
|
||||
this.PageWidth = 500;
|
||||
|
||||
SetTJYZLable();
|
||||
|
||||
if (!this.IsPostBack)
|
||||
{
|
||||
InitControls();
|
||||
}
|
||||
|
||||
base.InitPage();
|
||||
}
|
||||
|
||||
#region 模板事件继承
|
||||
|
||||
protected override void ReportDataSetAdd()
|
||||
{
|
||||
TDatabase db = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sql = new TSQL(db);
|
||||
sql.Add("select XLXSTZYZ_YZID, XLXSTZYZ_YZMC from XLXSTZYZ where XLXSTZYZ_MXBH='BJD' and XLXSTZYZ_TJYS='1' order by XLXSTZYZ_XSXH,XLXSTZYZ_YZID ");
|
||||
DataSet ds = db.OpenDataSet(sql);
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
string sYZID = "TZYZ_" + ds.Tables[0].Rows[i]["XLXSTZYZ_YZID"].ToString().Trim();
|
||||
string sYZMC = ds.Tables[0].Rows[i]["XLXSTZYZ_YZMC"].ToString().Trim();
|
||||
AddUserReportField("XLXSBJDYZZ1", sYZID, sYZMC, "N");
|
||||
}
|
||||
|
||||
base.ReportDataSetAdd();
|
||||
}
|
||||
|
||||
protected override void ReportRecordSetAdd()
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
|
||||
TSQL sSQL = new TSQL(dberp);
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Clear();
|
||||
SQL.Add("select XLXSTZYZ_YZID, XLXSTZYZ_YZMC ");
|
||||
SQL.Add(" from XLXSTZYZ");
|
||||
SQL.Add(" where XLXSTZYZ_MXBH = 'BJD' and XLXSTZYZ_TJYS='1' order by XLXSTZYZ_XSXH,XLXSTZYZ_YZID ");
|
||||
DataSet ds = dberp.OpenDataSet(SQL);
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
sSQL.Add(string.Format(",sum(decode(XLXSBJDYZZ1_YZID, '{0}', XLXSBJDYZZ1_YZZ, 0)) as TZYZ_{0}", ds.Tables[0].Rows[i][0].ToString().Trim()));
|
||||
}
|
||||
sSQL.Text = "select 1" + sSQL.Text + " from XLXSBJDYZZ1 where XLXSBJDYZZ1_JGBID='" + txtJGBID.Value.Trim() + "' and XLXSBJDYZZ1_PJLX= '" + cbxPJLX.SelectedValue.Trim() + "'";
|
||||
AddUserReportSQL("XLXSBJDYZZ1", sSQL);
|
||||
base.ReportRecordSetAdd();
|
||||
}
|
||||
|
||||
|
||||
protected override void SetControlState()
|
||||
{
|
||||
base.SetControlState();
|
||||
|
||||
txtWHR.Enabled = false;
|
||||
datWHSJ.Enabled = false;
|
||||
|
||||
# region 给调价因子控件设只读性
|
||||
if (ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsCopy || ControlState == TControlState.ctsEdit)
|
||||
{
|
||||
for (int i = 1; i <= 20; i++)
|
||||
{
|
||||
gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + i);
|
||||
txtTJYZ.Enabled = false;
|
||||
}
|
||||
|
||||
string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(',');
|
||||
for (int i = 0; i < sTJYZList.Length; i++)
|
||||
{
|
||||
for (int j = 1; j <= 20; j++)
|
||||
{
|
||||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0') + "|";
|
||||
gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + j.ToString().Trim());
|
||||
if (sTJYZList[i].StartsWith(sTZYZID))
|
||||
{
|
||||
txtTJYZ.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
protected override void LoadRecord()
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
entity.Param.Add("XLXSBJDYZZ1_JGBID", PageParam.GetRTrimString("XLXSBJDYZZ1_JGBID"));
|
||||
entity.Param.Add("XLXSBJDYZZ1_PJLX", PageParam.GetRTrimString("XLXSBJDYZZ1_PJLX"));
|
||||
entity.Param.Add("XLXSBJDYZZ1_YZID", PageParam.GetRTrimString("XLXSBJDYZZ1_YZID"));
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Param.Add("XLXSBJDYZZ1_JGBID", txtJGBID.Value.Trim());
|
||||
entity.Param.Add("XLXSBJDYZZ1_PJLX", txtOLD_PJLX.Value.Trim());
|
||||
entity.Param.Add("XLXSBJDYZZ1_YZID", txtYZID.Value.Trim());
|
||||
}
|
||||
base.LoadRecord();
|
||||
txtOLD_PJLX.Value = cbxPJLX.SelectedValue.Trim();
|
||||
|
||||
|
||||
# region 给调价因子控件赋值
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sql = new TSQL(dberp);
|
||||
sql.Clear();
|
||||
sql.Add(string.Format(" select XLXSBJDYZZ{0}_YZID, XLXSBJDYZZ{0}_YZZ from XLXSBJDYZZ{0} ", 1));
|
||||
sql.Add(string.Format(" where XLXSBJDYZZ{0}_JGBID=:pJGBID and XLXSBJDYZZ{0}_PJLX=:pPJLX order by XLXSBJDYZZ{0}_YZID",1));
|
||||
sql.ParamByName("pJGBID").Value = txtJGBID.Value.Trim();
|
||||
sql.ParamByName("pPJLX").Value = cbxPJLX.SelectedValue.Trim();
|
||||
DataSet ds = dberp.OpenDataSet(sql);
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
string sYZID = ds.Tables[0].Rows[i][0].ToString().Trim();
|
||||
double dYZZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i][1].ToString().Trim());
|
||||
if (PageParam.GetRTrimString("TJYZList").Contains(sYZID + "|"))
|
||||
{
|
||||
for (int j = 1; j <= 20; j++)
|
||||
{
|
||||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0');
|
||||
gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + j.ToString().Trim());
|
||||
if (sYZID.Equals(sTZYZID))
|
||||
txtTJYZ.Value = dYZZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
protected override void OnNewRecorder()
|
||||
{
|
||||
base.OnNewRecorder();
|
||||
txtJGBID.Value = PageParam.GetRTrimString("XLXSBJDYZZ1_JGBID");
|
||||
txtWHR.Text = tSession.UserName;
|
||||
txtWHRID.Value = tSession.UserId;
|
||||
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
||||
}
|
||||
|
||||
protected override void OnCopyRecorder()
|
||||
{
|
||||
base.OnCopyRecorder();
|
||||
txtJGBID.Value = PageParam.GetRTrimString("XLXSBJDYZZ1_JGBID");
|
||||
txtWHR.Text = tSession.UserName;
|
||||
txtWHRID.Value = tSession.UserId;
|
||||
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
||||
}
|
||||
|
||||
protected override bool DataLogicValid()
|
||||
{
|
||||
if (!base.DataLogicValid()) return false;
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sql = new TSQL(dberp);
|
||||
string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(',');
|
||||
for (int i = 0; i < sTJYZList.Length; i++)
|
||||
{
|
||||
if (ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsCopy)
|
||||
{
|
||||
sql.Clear();
|
||||
sql.Add("select XLXSBJDYZZ1_PJLX ");
|
||||
sql.Add("from XLXSBJDYZZ1 ");
|
||||
sql.Add("where XLXSBJDYZZ1_JGBID=:pJGBID and XLXSBJDYZZ1_YZID=:pYZID and XLXSBJDYZZ1_PJLX =:pPJLX ");
|
||||
sql.ParamByName("pJGBID").Value = txtJGBID.Value.Trim();
|
||||
sql.ParamByName("pYZID").Value = sTJYZList[i].Split('|')[0];
|
||||
sql.ParamByName("pPJLX").Value = cbxPJLX.SelectedValue.Trim();
|
||||
DataSet ds = dberp.OpenDataSet(sql);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
string sBJSLQJ = GetFKFSIDMC(ds.Tables[0].Rows[0]["XLXSBJDYZZ1_PJLX"].ToString());
|
||||
|
||||
|
||||
ShowMessage(string.Format("因子{0}已经维护了{1}付款方式,不允许保存!", sTJYZList[i].Replace("(X)", ""), sBJSLQJ));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!txtOLD_PJLX.Value.Trim().Equals(cbxPJLX.SelectedValue.Trim()))
|
||||
{
|
||||
sql.Clear();
|
||||
sql.Add("select XLXSBJDYZZ1_PJLX ");
|
||||
sql.Add("from XLXSBJDYZZ1 ");
|
||||
sql.Add("where XLXSBJDYZZ1_JGBID=:pJGBID and XLXSBJDYZZ1_YZID=:pYZID and XLXSBJDYZZ1_PJLX =:pPJLX ");
|
||||
sql.ParamByName("pJGBID").Value = txtJGBID.Value.Trim();
|
||||
sql.ParamByName("pYZID").Value = sTJYZList[i].Split('|')[0];
|
||||
sql.ParamByName("pPJLX").Value = cbxPJLX.SelectedValue.Trim();
|
||||
DataSet ds = dberp.OpenDataSet(sql);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
string sBJSLQJ = GetFKFSIDMC(ds.Tables[0].Rows[0]["XLXSBJDYZZ1_PJLX"].ToString());
|
||||
|
||||
|
||||
ShowMessage(string.Format("因子{0}已经维护了{1}付款方式,不允许保存!", sTJYZList[i].Replace("(X)", ""), sBJSLQJ));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool Master_BeforeSaveAction(object sender, EventArgs e)
|
||||
{
|
||||
if (!base.Master_BeforeSaveAction(sender, e)) return false;
|
||||
|
||||
txtWHR.Text = tSession.UserName;
|
||||
txtWHRID.Value = tSession.UserId;
|
||||
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool Master_AfterSaveAction(object sender, EventArgs e)
|
||||
{
|
||||
txtOLD_PJLX.Value = cbxPJLX.SelectedValue.Trim();
|
||||
txtYZID.Value = PageParam.GetRTrimString("FirstYZID");
|
||||
|
||||
string sJGBID = txtJGBID.Value.Trim();
|
||||
string sPJLX = cbxPJLX.SelectedValue.Trim();
|
||||
# region 将调价因子控件值更新至数据库中
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sql = new TSQL(dberp);
|
||||
sql.Clear();
|
||||
dberp.ExecSQL(string.Format("delete from XLXSBJDYZZ{0} where XLXSBJDYZZ{0}_JGBID='{1}' and XLXSBJDYZZ{0}_PJLX='{2}' ", 1, sJGBID, sPJLX));
|
||||
string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(',');
|
||||
DateTime tNow = DateTime.Now;
|
||||
for (int i = 0; i < sTJYZList.Length; i++)
|
||||
{
|
||||
sql.Clear();
|
||||
sql.Add(string.Format("insert into XLXSBJDYZZ{0}(XLXSBJDYZZ{0}_JGBID, XLXSBJDYZZ{0}_PJLX, XLXSBJDYZZ{0}_YZID, XLXSBJDYZZ{0}_YZZ, XLXSBJDYZZ{0}_WHR, XLXSBJDYZZ{0}_WHRID, XLXSBJDYZZ{0}_WHSJ)", 1));
|
||||
sql.Add(string.Format(" values(:pJGBID,:PJLX,:pYZID,:pYZZ,:pWHR,:pWHRID,:pWHSJ)"));
|
||||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||||
sql.ParamByName("PJLX").Value = sPJLX;
|
||||
sql.ParamByName("pWHR").Value = tSession.UserName;
|
||||
sql.ParamByName("pWHRID").Value = tSession.UserId;
|
||||
sql.ParamByName("pWHSJ").Value = tNow;
|
||||
|
||||
for (int j = 1; j <= 20; j++)
|
||||
{
|
||||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0') + "|";
|
||||
gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + j.ToString().Trim());
|
||||
if (sTJYZList[i].StartsWith(sTZYZID))
|
||||
{
|
||||
sql.ParamByName("pYZID").Value = sTZYZID.TrimEnd('|');
|
||||
sql.ParamByName("pYZZ").Value = txtTJYZ.Value;
|
||||
dberp.ExecSQL(sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
return base.Master_AfterSaveAction(sender, e);
|
||||
}
|
||||
|
||||
protected override void SetComboxItems()
|
||||
{
|
||||
TComboBox.SetComboBox("DBERP", cbxPJLX, "select SFPJ_PJLX,SFPJ_PJMC from SFPJ where isnull(SFPJ_TYBZ,'N')<>'Y' order by SFPJ_PJLX", false);
|
||||
base.SetComboxItems();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义函数
|
||||
|
||||
private void InitControls()
|
||||
{
|
||||
txtYZID.Value = PageParam.GetRTrimString("FirstYZID");
|
||||
}
|
||||
|
||||
private void SetTJYZLable()
|
||||
{
|
||||
string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(',');
|
||||
for (int i = 0; i < sTJYZList.Length; i++)
|
||||
{
|
||||
|
||||
for (int j = 1; j <= 20; j++)
|
||||
{
|
||||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0') + "|";
|
||||
gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + j.ToString().Trim());
|
||||
gtLabel lblTJYZ = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "TJYZ" + j.ToString().Trim());
|
||||
if (sTJYZList[i].StartsWith(sTZYZID))
|
||||
{
|
||||
string s = sTJYZList[i].Replace(sTZYZID, "").Replace("(X)", "") + ":";
|
||||
lblTJYZ.Text = s;
|
||||
if (sTJYZList[i].EndsWith("(%)") || sTJYZList[i].EndsWith("(元)"))
|
||||
{
|
||||
txtTJYZ.DecimalPlaces = 2;
|
||||
}
|
||||
else if (sTJYZList[i].EndsWith("(X)"))
|
||||
{
|
||||
txtTJYZ.DecimalPlaces = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetFKFSIDMC(string sFKFSID)
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Add("select SFPJ_PJLX,SFPJ_PJMC from SFPJ where isnull(SFPJ_TYBZ,'N')<>'Y' and SFPJ_PJLX =:pPJLX order by SFPJ_PJLX");
|
||||
SQL.ParamByName("pPJLX").Value = sFKFSID;
|
||||
DataSet ds = dberp.OpenDataSet(SQL);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
return ds.Tables[0].Rows[0][0].ToString().Trim() + "|" + ds.Tables[0].Rows[0][1].ToString().Trim();
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user