731 lines
32 KiB
C#
731 lines
32 KiB
C#
#region 功能说明
|
||
/*
|
||
* 参数说明:
|
||
* 注意事项:
|
||
* 更新记录:
|
||
*/
|
||
#endregion
|
||
|
||
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 System.Text;
|
||
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_PUBLIC2;
|
||
using GThinking.N_MODEL.Dialog;
|
||
using GThinking.N_CONTROL;
|
||
using GThinking.N_MISPRO.TableCache;
|
||
|
||
namespace GThinking.N_XLXSBJ
|
||
{
|
||
public partial class WLHQInfo : SingleCardBase
|
||
{
|
||
XLXSWLHQ entity = new XLXSWLHQ();
|
||
XLXSWLHQ_HIS entity_his = new XLXSWLHQ_HIS();
|
||
|
||
#region Page类事件继承
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
this.UMID = 100860032;
|
||
this.UMName = "线缆销售报价物料行情";
|
||
this.CurMaster = Master;
|
||
this.CurEntity = entity;
|
||
this.PageHeight = 600;
|
||
this.PageWidth = 750;
|
||
this.Master.EnableInsertBtn = false;
|
||
this.Master.EnableCopyBtn = false;
|
||
this.Master.EnableDeleteBtn = false;
|
||
|
||
txtWSJG.DecimalPlaces = XLBJDUtils.BJCLPriceDecimal;
|
||
txtWSJGF.DecimalPlaces = XLBJDUtils.BJCLPriceDecimal;
|
||
txtWSCGJG.DecimalPlaces = XLBJDUtils.BJCLPriceDecimal;
|
||
txtHSJG.DecimalPlaces = XLBJDUtils.BJCLPriceDecimal;
|
||
txtHSJGF.DecimalPlaces = XLBJDUtils.BJCLPriceDecimal;
|
||
txtHSCGJG.DecimalPlaces = XLBJDUtils.BJCLPriceDecimal;
|
||
|
||
base.InitPage();
|
||
|
||
if (txtTYBZ.Value.Trim().Equals("Y"))
|
||
this.Master.EnableEditBtn = false;
|
||
|
||
InitControls();
|
||
|
||
grdHisHQ.FindColumnByFieldName("HIS_WSJGF").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal;
|
||
grdHisHQ.FindColumnByFieldName("HIS_WSCGJG").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal;
|
||
grdHisHQ.FindColumnByFieldName("HIS_WSJG").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal;
|
||
grdHisHQ.FindColumnByFieldName("HIS_HSJGF").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal;
|
||
grdHisHQ.FindColumnByFieldName("HIS_HSCGJG").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal;
|
||
grdHisHQ.FindColumnByFieldName("HIS_HSJG").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 模板事件继承
|
||
protected override void SetControlState()
|
||
{
|
||
base.SetControlState();
|
||
|
||
txtWLID.Enabled = false;
|
||
txtWLMC.Enabled = false;
|
||
txtWLGG.Enabled = false;
|
||
txtWLTZ.Enabled = false;
|
||
txtWLCL.Enabled = false;
|
||
txtZZSL.Enabled = false;
|
||
txtWHR.Enabled = false;
|
||
datWHSJ.Enabled = false;
|
||
cbxBJCL.Enabled = false;
|
||
|
||
btnGXCGJG.Enabled = false;
|
||
if (ControlState == TControlState.ctsEdit)
|
||
{
|
||
btnGXCGJG.Enabled = true;
|
||
}
|
||
if (txtWSJGF.Style["display"] == "block")
|
||
{
|
||
btnGXCGJG.Enabled = false;
|
||
}
|
||
if (!XLXSWLHQ.CheckModule("100486007", tSession.UserId))
|
||
{
|
||
btnGXCGJG.Visible = false;
|
||
}
|
||
|
||
|
||
datYXQS.Enabled = false;
|
||
datYXQZ.Enabled = false;
|
||
if (ControlState == TControlState.ctsEdit)
|
||
{
|
||
set_BeforeEdit();
|
||
DateTime dtNow = DateTime.Now.Date;
|
||
DateTime dtYXQS = CMISproConvert.StrToDateTime(datYXQS.Text.Trim());
|
||
if (dtYXQS < dtNow)
|
||
{
|
||
txtWSJG.Enabled = false;
|
||
txtHSJG.Enabled = false;
|
||
}
|
||
}
|
||
|
||
/*
|
||
当设置为0|不限时,无税材料价格、含税材料价格、无税采购价格、含税采购价格都能改。
|
||
当设置为1|材料行情时,只能修改无税材料价格、含税材料价格这两项。
|
||
当设置为2|采购行情时,只能修改无税采购价格、含税采购价格这两项。
|
||
*/
|
||
string sBJU013 = GetOption("BJU013");
|
||
if (ControlState == TControlState.ctsEdit)
|
||
{
|
||
if (sBJU013.Equals("1"))
|
||
{
|
||
if (lblWSJGF.Text == "无税采购价格")
|
||
{
|
||
txtWSCGJG.Enabled = false;
|
||
txtHSCGJG.Enabled = false;
|
||
btnGXCGJG.Enabled = false;
|
||
}
|
||
}
|
||
else if (sBJU013.Equals("2"))
|
||
{
|
||
txtWSJG.Enabled = false;
|
||
txtHSJG.Enabled = false;
|
||
}
|
||
}
|
||
}
|
||
|
||
protected override void LoadRecord()
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
if (string.IsNullOrEmpty(PageParam.GetRTrimString("XLXSWLHQ_WLID")))
|
||
{
|
||
entity.Param.Add("OLD_XLXSWLHQ_WLID", "");
|
||
}
|
||
else
|
||
{
|
||
entity.Param.Add("OLD_XLXSWLHQ_WLID", PageParam.GetRTrimString("XLXSWLHQ_WLID"));
|
||
}
|
||
if (string.IsNullOrEmpty(PageParam.GetRTrimString("XLXSWLHQ_YXQS")))
|
||
{
|
||
entity.Param.Add("OLD_XLXSWLHQ_YXQS", "");
|
||
}
|
||
else
|
||
{
|
||
entity.Param.Add("OLD_XLXSWLHQ_YXQS", PageParam.GetRTrimString("XLXSWLHQ_YXQS"));
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
entity.Param.Add("OLD_XLXSWLHQ_WLID", txtOLD_WLID.Value);
|
||
entity.Param.Add("OLD_XLXSWLHQ_YXQS", txtOLD_YXQS.Value);
|
||
}
|
||
base.LoadRecord();
|
||
txtOLD_YXQS.Value = datYXQS.Text.Trim();
|
||
txtOLD_YXQZ.Value = datYXQZ.Text.Trim();
|
||
txtOLD_WLID.Value = txtWLID.Text.Trim();
|
||
}
|
||
|
||
protected override void OnNewRecorder()
|
||
{
|
||
base.OnNewRecorder();
|
||
datYXQS.Text = CMISproConvert.ConvertDate(System.DateTime.Today);
|
||
txtWHR.Text = tSession.UserName;
|
||
txtWHRID.Value = tSession.UserId;
|
||
datWHSJ.Text = CMISproConvert.ConvertTime(DateTime.Now);
|
||
}
|
||
|
||
protected override void OnCopyRecorder()
|
||
{
|
||
datYXQS.Text = CMISproConvert.ConvertDate(System.DateTime.Today);
|
||
txtWHR.Text = tSession.UserName;
|
||
txtWHRID.Value = tSession.UserId;
|
||
datWHSJ.Text = CMISproConvert.ConvertTime(DateTime.Now);
|
||
}
|
||
|
||
protected override bool DataLogicValid()
|
||
{
|
||
if (!base.DataLogicValid()) return false;
|
||
|
||
|
||
if (txtHSJG.Value < 0)
|
||
{
|
||
ShowMessage("含税材料价格不允许小于0!");
|
||
return false;
|
||
}
|
||
if (txtWSJG.Value < 0)
|
||
{
|
||
ShowMessage("无税材料价格不允许小于0!");
|
||
return false;
|
||
}
|
||
if (txtZZSL.Value < 0)
|
||
{
|
||
ShowMessage("增值税率不允许小于0!");
|
||
return false;
|
||
}
|
||
|
||
if (!CMISproDataBase.ExistsRecord("DBERP", "select 1 from XLXSBJCL where XLXSBJCL_BJCLID='" + cbxBJCL.SelectedValue.Trim() + "' "))
|
||
{
|
||
ShowMessage("报价材料不存在,不允许保存!");
|
||
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);
|
||
if ((ControlState == TControlState.ctsInsert) || (ControlState == TControlState.ctsCopy))
|
||
{
|
||
|
||
}
|
||
return true;
|
||
}
|
||
|
||
protected override void BeforeSave(TDatabase db, ref bool ActionIsDone)
|
||
{
|
||
base.BeforeSave(db, ref ActionIsDone);
|
||
}
|
||
|
||
protected override void AfterSave(TDatabase db, ref bool ActionIsDone)
|
||
{
|
||
if (ControlState == TControlState.ctsEdit)
|
||
{
|
||
TSQL SQL = new TSQL(db);
|
||
SQL.Clear();
|
||
//查询是否存在插入记录
|
||
SQL.Add("select 1 from XLXSWLHQ where XLXSWLHQ_JGBID =' ' and XLXSWLHQ_YXQS= :pRQ and XLXSWLHQ_WLID = :pWLID ");
|
||
SQL.ParamByName("pRQ").Value = datYXQS.Text.Trim();
|
||
SQL.ParamByName("pWLID").Value = txtWLID.Text.Trim();
|
||
DataSet ds = db.OpenDataSet(SQL);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
SQL.Clear();
|
||
SQL.Add(" update XLXSWLHQ ");
|
||
SQL.Add(" set XLXSWLHQ_WSJG = :XLXSWLHQ_WSJG,XLXSWLHQ_HSJG=:XLXSWLHQ_HSJG,XLXSWLHQ_HSJGF=:XLXSWLHQ_HSJGF,XLXSWLHQ_WSJGF=:XLXSWLHQ_WSJGF, ");
|
||
SQL.Add(" XLXSWLHQ_HSCGJG=:XLXSWLHQ_HSCGJG,XLXSWLHQ_WSCGJG=:XLXSWLHQ_WSCGJG,XLXSWLHQ_WSJG1=:XLXSWLHQ_WSJG1,XLXSWLHQ_HSJG1=:XLXSWLHQ_HSJG1, ");
|
||
SQL.Add(" XLXSWLHQ_JGBL1=:XLXSWLHQ_JGBL1,XLXSWLHQ_JGYBJCLID1=:XLXSWLHQ_JGYBJCLID1, ");
|
||
SQL.Add(" XLXSWLHQ_YXQS = :XLXSWLHQ_YXQS, XLXSWLHQ_YXQZ = :XLXSWLHQ_YXQZ, XLXSWLHQ_BZ = :XLXSWLHQ_BZ, XLXSWLHQ_WHRID = :XLXSWLHQ_WHRID, XLXSWLHQ_WHR = :XLXSWLHQ_WHR, XLXSWLHQ_WHSJ = :XLXSWLHQ_WHSJ");
|
||
SQL.Add(" where XLXSWLHQ_JGBID =' ' and XLXSWLHQ_YXQS= :pRQ and XLXSWLHQ_WLID = :pWLID ");
|
||
SQL.ParamByName("XLXSWLHQ_WSJG").Value = txtWSJG.Value;
|
||
SQL.ParamByName("XLXSWLHQ_HSJG").Value = txtHSJG.Value;
|
||
SQL.ParamByName("XLXSWLHQ_WSJGF").Value = txtWSJGF.Value;
|
||
SQL.ParamByName("XLXSWLHQ_HSJGF").Value = txtHSJGF.Value;
|
||
SQL.ParamByName("XLXSWLHQ_WSCGJG").Value = txtWSCGJG.Value;
|
||
SQL.ParamByName("XLXSWLHQ_HSCGJG").Value = txtHSCGJG.Value;
|
||
SQL.ParamByName("XLXSWLHQ_WSJG1").Value = CMISproConvert.StrToFloat(txtJGYLWSJG1.Value);
|
||
SQL.ParamByName("XLXSWLHQ_HSJG1").Value = CMISproConvert.StrToFloat(txtJGYLHSJG1.Value);
|
||
SQL.ParamByName("XLXSWLHQ_JGBL1").Value = CMISproConvert.StrToFloat(txtJGBL1.Value);
|
||
SQL.ParamByName("XLXSWLHQ_JGYBJCLID1").Value = txtJGYBJCLID1.Value.Trim();
|
||
SQL.ParamByName("XLXSWLHQ_YXQS").Value = datYXQS.Text;
|
||
if (datYXQZ.Text.Equals(""))
|
||
{
|
||
SQL.ParamByName("XLXSWLHQ_YXQZ").Clear();
|
||
}
|
||
else
|
||
{
|
||
SQL.ParamByName("XLXSWLHQ_YXQZ").Value = datYXQZ.Text;
|
||
|
||
}
|
||
SQL.ParamByName("XLXSWLHQ_BZ").Value = txtBZ.Text;
|
||
SQL.ParamByName("XLXSWLHQ_WHR").Value = txtWHR.Text;
|
||
SQL.ParamByName("XLXSWLHQ_WHRID").Value = txtWHRID.Value;
|
||
SQL.ParamByName("XLXSWLHQ_WHSJ").Value = datWHSJ.Text;
|
||
SQL.ParamByName("pRQ").Value = datYXQS.Text.Trim();
|
||
SQL.ParamByName("pWLID").Value = txtWLID.Text.Trim();
|
||
db.ExecSQL(SQL);
|
||
}
|
||
else
|
||
{
|
||
SQL.Clear();
|
||
SQL.Add(" insert into XLXSWLHQ( ");
|
||
SQL.Add(" XLXSWLHQ_WLID,XLXSWLHQ_JGBID, XLXSWLHQ_WSJG,XLXSWLHQ_HSJG, XLXSWLHQ_WSJGF,XLXSWLHQ_HSJGF, XLXSWLHQ_YXQS, XLXSWLHQ_YXQZ,");
|
||
SQL.Add(" XLXSWLHQ_HSCGJG,XLXSWLHQ_WSCGJG,XLXSWLHQ_WSJG1,XLXSWLHQ_HSJG1,XLXSWLHQ_JGBL1,XLXSWLHQ_JGYBJCLID1, ");
|
||
SQL.Add(" XLXSWLHQ_BZ, XLXSWLHQ_WHRID, XLXSWLHQ_WHR, XLXSWLHQ_WHSJ )");
|
||
SQL.Add(" values(");
|
||
SQL.Add(" :XLXSWLHQ_WLID,' ', :XLXSWLHQ_WSJG,:XLXSWLHQ_HSJG, :XLXSWLHQ_WSJGF, :XLXSWLHQ_HSJGF, :XLXSWLHQ_YXQS, :XLXSWLHQ_YXQZ,");
|
||
SQL.Add(" :XLXSWLHQ_HSCGJG,:XLXSWLHQ_WSCGJG,:XLXSWLHQ_WSJG1,:XLXSWLHQ_HSJG1,:XLXSWLHQ_JGBL1,:XLXSWLHQ_JGYBJCLID1, ");
|
||
SQL.Add(" :XLXSWLHQ_BZ, :XLXSWLHQ_WHRID, :XLXSWLHQ_WHR, :XLXSWLHQ_WHSJ )");
|
||
SQL.ParamByName("XLXSWLHQ_WSJG").Value = txtWSJG.Value;
|
||
SQL.ParamByName("XLXSWLHQ_HSJG").Value = txtHSJG.Value;
|
||
SQL.ParamByName("XLXSWLHQ_WSJGF").Value = txtWSJGF.Value;
|
||
SQL.ParamByName("XLXSWLHQ_HSJGF").Value = txtHSJGF.Value;
|
||
SQL.ParamByName("XLXSWLHQ_WSCGJG").Value = txtWSCGJG.Value;
|
||
SQL.ParamByName("XLXSWLHQ_HSCGJG").Value = txtHSCGJG.Value;
|
||
SQL.ParamByName("XLXSWLHQ_WSJG1").Value = CMISproConvert.StrToFloat(txtJGYLWSJG1.Value);
|
||
SQL.ParamByName("XLXSWLHQ_HSJG1").Value = CMISproConvert.StrToFloat(txtJGYLHSJG1.Value);
|
||
SQL.ParamByName("XLXSWLHQ_JGBL1").Value = CMISproConvert.StrToFloat(txtJGBL1.Value);
|
||
SQL.ParamByName("XLXSWLHQ_JGYBJCLID1").Value = txtJGYBJCLID1.Value.Trim();
|
||
SQL.ParamByName("XLXSWLHQ_YXQS").Value = datYXQS.Text;
|
||
if (datYXQZ.Text.Equals(""))
|
||
{
|
||
SQL.ParamByName("XLXSWLHQ_YXQZ").Clear();
|
||
}
|
||
else
|
||
{
|
||
SQL.ParamByName("XLXSWLHQ_YXQZ").Value = datYXQZ.Text;
|
||
|
||
}
|
||
SQL.ParamByName("XLXSWLHQ_BZ").Value = txtBZ.Text;
|
||
SQL.ParamByName("XLXSWLHQ_WHR").Value = txtWHR.Text;
|
||
SQL.ParamByName("XLXSWLHQ_WHRID").Value = txtWHRID.Value;
|
||
SQL.ParamByName("XLXSWLHQ_WHSJ").Value = datWHSJ.Text;
|
||
SQL.ParamByName("XLXSWLHQ_WLID").Value = txtWLID.Text.Trim();
|
||
db.ExecSQL(SQL);
|
||
|
||
//并找到最近的一条记录,若其有效期止为空就将其置为所保存记录的有效期始减一天。
|
||
SQL.Clear();
|
||
SQL.Add(" update XLXSWLHQ set XLXSWLHQ_YXQZ=dateadd(day,-1,:pYXQS) ");
|
||
SQL.Add(" where XLXSWLHQ_JGBID=' '");
|
||
SQL.Add(" and XLXSWLHQ_WLID=:pWLID");
|
||
SQL.Add(" and XLXSWLHQ_YXQS=");
|
||
SQL.Add(" (");
|
||
SQL.Add(" select max(XLXSWLHQ_YXQS) as maxYXQS");
|
||
SQL.Add(" from XLXSWLHQ");
|
||
SQL.Add(" where XLXSWLHQ_JGBID=' ' ");
|
||
SQL.Add(" and XLXSWLHQ_WLID=:pWLID");
|
||
SQL.Add(" and XLXSWLHQ_YXQS<=dateadd(day,-1,:pYXQS) ");
|
||
SQL.Add(" )");
|
||
SQL.Add(" and XLXSWLHQ_YXQZ is null ");
|
||
SQL.ParamByName("pWLID").Value = txtWLID.Text.Trim();
|
||
SQL.ParamByName("pYXQS").Value = datYXQS.Text;
|
||
db.ExecSQL(SQL);
|
||
}
|
||
|
||
}
|
||
|
||
base.AfterSave(db, ref ActionIsDone);
|
||
}
|
||
|
||
protected override bool Master_AfterSaveAction(object sender, EventArgs e)
|
||
{
|
||
txtOLD_YXQS.Value = datYXQS.Text.Trim();
|
||
txtOLD_YXQZ.Value = datYXQZ.Text.Trim();
|
||
txtOLD_WLID.Value = txtWLID.Text.Trim();
|
||
|
||
InitControls();
|
||
LoadRecord();
|
||
RefreshForm();
|
||
SetControlState();
|
||
FormAreaUpdate();
|
||
MenuAreaUpdate();
|
||
return base.Master_AfterSaveAction(sender, e);
|
||
}
|
||
|
||
protected override string CodeClass(string ComponentID)
|
||
{
|
||
string sResult = base.CodeClass(ComponentID);
|
||
return sResult;
|
||
}
|
||
|
||
protected override bool Master_BeforeEditAction(object sender, EventArgs e)
|
||
{
|
||
return base.Master_BeforeEditAction(sender, e);
|
||
}
|
||
|
||
protected override void SetComboxItems()
|
||
{
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
cbxBJCL.ClearItems();
|
||
SQL.Clear();
|
||
SQL.Add(" select XLXSBJCL_BJCLID, ");
|
||
SQL.Add(" case");
|
||
SQL.Add(" when isnull(XLXSBJCL_BJCLMC,' ')=' ' then rtrim(XLXSBJCL_BJCLID)||'|'||'(尚未使用)' else rtrim(XLXSBJCL_BJCLID)||'|'||rtrim(XLXSBJCL_BJCLMC)||'|'||'Kg' end ");
|
||
SQL.Add(" from XLXSBJCL");
|
||
SQL.Add(" where isnull(XLXSBJCL_BJCLMC,' ')<>' '");
|
||
SQL.Add(" order by XLXSBJCL_BJCLID");
|
||
DataSet ds = dberp.OpenDataSet(SQL);
|
||
cbxBJCL.Items.Add(new ListItem("", ""));
|
||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||
{
|
||
cbxBJCL.Items.Add(new ListItem((ds.Tables[0].Rows[i][1].ToString().Trim()), (ds.Tables[0].Rows[i][0].ToString().Trim())));
|
||
}
|
||
cbxBJCL.ShowValue = false;
|
||
base.SetComboxItems();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 自定义函数
|
||
private void InitControls()
|
||
{
|
||
if (!txtWLID.Text.Trim().Equals(""))
|
||
{
|
||
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
SQL.Clear();
|
||
SQL.Add(" select XLXSWLHQ_YXQS as HIS_YXQS, XLXSWLHQ_YXQZ as HIS_YXQZ, isnull(XLXSWLHQ_WSJGF,0.0) as HIS_WSJGF, isnull(XLXSWLHQ_WSCGJG,0.0) as HIS_WSCGJG, isnull(XLXSWLHQ_WSJG,0.0) as HIS_WSJG,");
|
||
SQL.Add(" isnull(XLXSWLHQ_HSJGF,0.0) as HIS_HSJGF, isnull(XLXSWLHQ_HSCGJG,0.0) as HIS_HSCGJG, isnull(XLXSWLHQ_HSJG,0.0) as HIS_HSJG, isnull(XLXSWLHQ_BZ, ' ') as HIS_BZ, isnull(XLXSWLHQ_WHR, ' ') as HIS_WHR,XLXSWLHQ_WHRID as HIS_WHRID, XLXSWLHQ_WHSJ as HIS_WHSJ ");
|
||
SQL.Add(" from XLXSWLHQ");
|
||
SQL.Add(" where XLXSWLHQ_WLID =:pXLXSWLHQ_WLID and XLXSWLHQ_JGBID =' ' ");
|
||
SQL.Add(" order by XLXSWLHQ_YXQS desc");
|
||
SQL.ParamByName("pXLXSWLHQ_WLID").Value = txtWLID.Text.ToString().Trim();
|
||
DataSet da = dberp.OpenDataSet(SQL);
|
||
entity_his.EntityTable.QuerySelSql = "select 1 from system where 1<>1";
|
||
if (da != null)
|
||
{
|
||
grdHisHQ.DataSource = null;
|
||
grdHisHQ.DataBind();
|
||
grdHisHQ.InsertRows(da);
|
||
}
|
||
|
||
SQL.Clear();
|
||
SQL.Add(" select XLXSBJCL_JGYBJCLID,XLXSBJCL_BJCLID from XLXSBJCL where XLXSBJCL_BJCLID = :pBJCLID ");
|
||
SQL.ParamByName("pBJCLID").Value = cbxBJCL.SelectedValue.Trim();
|
||
DataSet dsBJCL = dberp.OpenDataSet(SQL);
|
||
if (dsBJCL.Tables[0].Rows.Count > 0)
|
||
{
|
||
//加工原料 铜
|
||
if (dsBJCL.Tables[0].Rows[0][0].ToString().Trim().Equals(""))
|
||
{
|
||
grdHisHQ.FindColumnByFieldName("HIS_WSJGF").Visible = false;
|
||
grdHisHQ.FindColumnByFieldName("HIS_HSJGF").Visible = false;
|
||
grdHisHQ.FindColumnByFieldName("HIS_WSCGJG").Visible = true;
|
||
grdHisHQ.FindColumnByFieldName("HIS_HSCGJG").Visible = true;
|
||
|
||
//lblWSJGF.Visible = false;
|
||
//txtWSJGF.Visible = false;
|
||
//lblWSJGFRMB.Visible = false;
|
||
lblWSJGF.Text = "无税采购价格";
|
||
txtWSJGF.Style["display"] = "none";
|
||
txtWSCGJG.Style["display"] = "block";
|
||
|
||
|
||
//lblHSJGF.Visible = false;
|
||
//txtHSJGF.Visible = false;
|
||
//lblHSJGFRMB.Visible = false;
|
||
lblHSJGF.Text = "含税采购价格";
|
||
txtHSJGF.Style["display"] = "none";
|
||
txtHSCGJG.Style["display"] = "block";
|
||
}
|
||
//加工料 铜丝
|
||
else
|
||
{
|
||
grdHisHQ.FindColumnByFieldName("HIS_WSJGF").Visible = true;
|
||
grdHisHQ.FindColumnByFieldName("HIS_HSJGF").Visible = true;
|
||
grdHisHQ.FindColumnByFieldName("HIS_WSCGJG").Visible = false;
|
||
grdHisHQ.FindColumnByFieldName("HIS_HSCGJG").Visible = false;
|
||
|
||
txtWSJG.Enabled = false;
|
||
txtWSJG.ReadOnly = true;
|
||
txtHSJG.Enabled = false;
|
||
txtHSJG.ReadOnly = true;
|
||
|
||
//lblWSJGF.Visible = true;
|
||
//txtWSJGF.Visible = true;
|
||
//lblWSJGFRMB.Visible = true;
|
||
lblWSJGF.Text = "无税加工费";
|
||
txtWSJGF.Style["display"] = "block";
|
||
txtWSCGJG.Style["display"] = "none";
|
||
|
||
//lblHSJGF.Visible = true;
|
||
//txtHSJGF.Visible = true;
|
||
//lblHSJGFRMB.Visible = true;
|
||
lblHSJGF.Text = "含税加工费";
|
||
txtHSJGF.Style["display"] = "block";
|
||
txtHSCGJG.Style["display"] = "none";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
grdHisHQ.FindColumnByFieldName("HIS_WSJGF").Visible = false;
|
||
grdHisHQ.FindColumnByFieldName("HIS_HSJGF").Visible = false;
|
||
grdHisHQ.FindColumnByFieldName("HIS_WSCGJG").Visible = false;
|
||
grdHisHQ.FindColumnByFieldName("HIS_HSCGJG").Visible = false;
|
||
|
||
lblWSJGF.Visible = false;
|
||
txtWSJGF.Style["display"] = "none";
|
||
txtWSCGJG.Style["display"] = "none";
|
||
lblWSJGFRMB.Visible = false;
|
||
|
||
lblHSJGF.Visible = false;
|
||
txtHSJGF.Style["display"] = "none";
|
||
txtHSCGJG.Style["display"] = "none";
|
||
lblHSJGFRMB.Visible = false;
|
||
}
|
||
/*
|
||
当设置为0|不限时,无税材料价格、含税材料价格、无税采购价格、含税采购价格都能改。
|
||
当设置为1|材料行情时,只能修改无税材料价格、含税材料价格这两项。
|
||
当设置为2|采购行情时,只能修改无税采购价格、含税采购价格这两项。
|
||
*/
|
||
string sBJU013 = GetOption("BJU013");
|
||
if (ControlState == TControlState.ctsEdit)
|
||
{
|
||
if (sBJU013.Equals("1"))
|
||
{
|
||
if (lblWSJGF.Text == "无税采购价格")
|
||
{
|
||
txtWSCGJG.Enabled = false;
|
||
txtHSCGJG.Enabled = false;
|
||
btnGXCGJG.Enabled = false;
|
||
}
|
||
}
|
||
else if (sBJU013.Equals("2"))
|
||
{
|
||
txtWSJG.Enabled = false;
|
||
txtHSJG.Enabled = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
private void set_BeforeEdit()
|
||
{
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
SQL.Clear();
|
||
SQL.Add(" select XLXSBJCL_JGYBJCLID,XLXSBJCL_BJCLID from XLXSBJCL where XLXSBJCL_BJCLID = :pBJCLID ");
|
||
SQL.ParamByName("pBJCLID").Value = cbxBJCL.SelectedValue.Trim();
|
||
DataSet dsBJCL = dberp.OpenDataSet(SQL);
|
||
if (dsBJCL.Tables[0].Rows.Count > 0)
|
||
{
|
||
txtJGYBJCLID1.Value = dsBJCL.Tables[0].Rows[0][0].ToString().Trim();
|
||
//加工原料 铜
|
||
if (txtJGYBJCLID1.Value.Trim().Equals(""))
|
||
{
|
||
SQL.Clear();
|
||
SQL.Add(" select XLXSWLHQ_WSJG,XLXSWLHQ_HSJG");
|
||
SQL.Add(" from XLXSWLHQ ");
|
||
SQL.Add(" where XLXSWLHQ_JGBID=' ' ");
|
||
SQL.Add(" and XLXSWLHQ_WLID=:pWLID ");
|
||
SQL.Add(" and XLXSWLHQ_YXQS=");
|
||
SQL.Add(" (");
|
||
SQL.Add(" select max(XLXSWLHQ_YXQS) as maxYXQS");
|
||
SQL.Add(" from XLXSWLHQ");
|
||
SQL.Add(" where XLXSWLHQ_JGBID=' '");
|
||
SQL.Add(" and XLXSWLHQ_WLID=:pWLID");
|
||
SQL.Add(" and XLXSWLHQ_YXQS<=:pYXQS");
|
||
SQL.Add(" )");
|
||
SQL.ParamByName("pWLID").Value = txtWLID.Text.Trim();
|
||
SQL.ParamByName("pYXQS").Value = DateTime.Now.ToString();
|
||
DataSet ds = dberp.OpenDataSet(SQL);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
txtHSJG.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSWLHQ_HSJG"].ToString().Trim());
|
||
txtWSJG.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSWLHQ_WSJG"].ToString().Trim());
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SQL.Clear();
|
||
SQL.Add(" select XLXSWLHQ_WSJG,XLXSWLHQ_HSJG");
|
||
SQL.Add(" from XLXSWLHQ ");
|
||
SQL.Add(" where XLXSWLHQ_JGBID=' ' ");
|
||
SQL.Add(" and XLXSWLHQ_WLID=:pWLID ");
|
||
SQL.Add(" and XLXSWLHQ_YXQS=");
|
||
SQL.Add(" (");
|
||
SQL.Add(" select max(XLXSWLHQ_YXQS) as maxYXQS");
|
||
SQL.Add(" from XLXSWLHQ");
|
||
SQL.Add(" where XLXSWLHQ_JGBID=' '");
|
||
SQL.Add(" and XLXSWLHQ_WLID=:pWLID");
|
||
SQL.Add(" and XLXSWLHQ_YXQS<=:pYXQS");
|
||
SQL.Add(" )");
|
||
SQL.ParamByName("pWLID").Value = txtWLID.Text.Trim();
|
||
SQL.ParamByName("pYXQS").Value = DateTime.Now.ToString();
|
||
DataSet ds = dberp.OpenDataSet(SQL);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
txtHSJG.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSWLHQ_HSJG"].ToString().Trim());
|
||
txtWSJG.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSWLHQ_WSJG"].ToString().Trim());
|
||
}
|
||
|
||
SQL.Clear();
|
||
SQL.Add(" select XLXSCLHQ_WSJG,XLXSCLHQ_HSJG");
|
||
SQL.Add(" from XLXSCLHQ ");
|
||
SQL.Add(" where XLXSCLHQ_JGBID='ZZZZZZZZ' ");
|
||
SQL.Add(" and XLXSCLHQ_BJCLID=:pBJCLID ");
|
||
SQL.Add(" and XLXSCLHQ_YXQS=");
|
||
SQL.Add(" (");
|
||
SQL.Add(" select max(XLXSCLHQ_YXQS) as maxYXQS");
|
||
SQL.Add(" from XLXSCLHQ");
|
||
SQL.Add(" where XLXSCLHQ_JGBID='ZZZZZZZZ'");
|
||
SQL.Add(" and XLXSCLHQ_BJCLID=:pBJCLID");
|
||
SQL.Add(" and XLXSCLHQ_YXQS<=:pYXQS");
|
||
SQL.Add(" )");
|
||
SQL.ParamByName("pBJCLID").Value = txtJGYBJCLID1.Value.Trim();
|
||
SQL.ParamByName("pYXQS").Value = DateTime.Now.ToString();
|
||
DataSet dsJGL = dberp.OpenDataSet(SQL);
|
||
if (dsJGL.Tables[0].Rows.Count > 0)
|
||
{
|
||
txtJGYLHSJG1.Value = dsJGL.Tables[0].Rows[0]["XLXSCLHQ_HSJG"].ToString().Trim();
|
||
txtJGYLWSJG1.Value = dsJGL.Tables[0].Rows[0]["XLXSCLHQ_WSJG"].ToString().Trim();
|
||
txtJGBL1.Value = "1";
|
||
}
|
||
}
|
||
}
|
||
|
||
string dt = DateTime.Now.Date.ToString().Trim();
|
||
string dt2 = CMISproConvert.StrToDateTime(datYXQS.Text.Trim()).ToString().Trim();
|
||
string sBJU013 = GetOption("BJU013");
|
||
if (datYXQS.Text.Trim().Equals("") || !dt.Equals(dt2))
|
||
{
|
||
if (txtHSCGJG.Style["display"] == "block" && XLXSWLHQ.CheckModule("100486007", tSession.UserId) && !sBJU013.Equals("1"))
|
||
{
|
||
string sWLID = txtWLID.Text.Trim();
|
||
string sCGU009 = GetOption(100486007, "CGU009");
|
||
//含税
|
||
txtHSCGJG.Value = XLXSWLHQ.GetCGPri(true, sWLID, sCGU009);
|
||
txtWSCGJG.Value = XLXSWLHQ.GetCGPri(false, sWLID, sCGU009);
|
||
FormAreaUpdate();
|
||
}
|
||
}
|
||
datYXQS.Text = DateTime.Now.ToString();
|
||
datYXQZ.Text = "";
|
||
}
|
||
#endregion
|
||
|
||
#region 控件事件
|
||
|
||
protected void cbxBJCL_OnSelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
SQL.Add("select XLXSBJCL_BJCLMC,XLXSBJCL_ZZSL from XLXSBJCL where XLXSBJCL_BJCLID = :pBJCLID");
|
||
SQL.ParamByName("pBJCLID").Value = cbxBJCL.SelectedValue.Trim() ;
|
||
DataSet ds = dberp.OpenDataSet(SQL);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
txtZZSL.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0][1].ToString().Trim());
|
||
}
|
||
else
|
||
{
|
||
txtZZSL.Value = 0.0;
|
||
}
|
||
}
|
||
|
||
protected void txtWSJG_OnTextChanged(object sender, EventArgs e)
|
||
{
|
||
txtHSJG.Value = NumberUtils.RoundX(txtWSJG.Value * (1 + txtZZSL.Value / 100.0), XLBJDUtils.BJCLPriceDecimal);
|
||
}
|
||
|
||
protected void txtHSJG_OnTextChanged(object sender, EventArgs e)
|
||
{
|
||
txtWSJG.Value = NumberUtils.RoundX(txtHSJG.Value / (1 + txtZZSL.Value / 100.0), XLBJDUtils.BJCLPriceDecimal);
|
||
}
|
||
|
||
//加工费
|
||
protected void txtWSJGF_OnTextChanged(object sender, EventArgs e)
|
||
{
|
||
txtWSJG.Value = NumberUtils.RoundX(txtWSJGF.Value + CMISproConvert.StrToFloat(txtJGYLWSJG1.Value) * CMISproConvert.StrToFloat(txtJGBL1.Value), XLBJDUtils.BJCLPriceDecimal);
|
||
txtHSJGF.Value = NumberUtils.RoundX(txtWSJGF.Value * (1 + txtZZSL.Value / 100.0), XLBJDUtils.BJCLPriceDecimal);
|
||
txtHSJG.Value = NumberUtils.RoundX(txtHSJGF.Value + CMISproConvert.StrToFloat(txtJGYLHSJG1.Value) * CMISproConvert.StrToFloat(txtJGBL1.Value), XLBJDUtils.BJCLPriceDecimal);
|
||
}
|
||
|
||
protected void txtHSJGF_OnTextChanged(object sender, EventArgs e)
|
||
{
|
||
txtHSJG.Value = NumberUtils.RoundX(txtHSJGF.Value + CMISproConvert.StrToFloat(txtJGYLHSJG1.Value) * CMISproConvert.StrToFloat(txtJGBL1.Value), XLBJDUtils.BJCLPriceDecimal);
|
||
txtWSJGF.Value = NumberUtils.RoundX(txtHSJGF.Value / (1 + txtZZSL.Value / 100.0), XLBJDUtils.BJCLPriceDecimal);
|
||
txtWSJG.Value = NumberUtils.RoundX(txtWSJGF.Value + CMISproConvert.StrToFloat(txtJGYLWSJG1.Value) * CMISproConvert.StrToFloat(txtJGBL1.Value), XLBJDUtils.BJCLPriceDecimal);
|
||
}
|
||
|
||
|
||
protected void txtWSCGJG_OnTextChanged(object sender, EventArgs e)
|
||
{
|
||
txtHSCGJG.Value = NumberUtils.RoundX(txtWSCGJG.Value * (1 + txtZZSL.Value / 100.0), XLBJDUtils.BJCLPriceDecimal);
|
||
}
|
||
|
||
protected void txtHSCGJG_OnTextChanged(object sender, EventArgs e)
|
||
{
|
||
txtWSCGJG.Value = NumberUtils.RoundX(txtHSCGJG.Value / (1 + txtZZSL.Value / 100.0), XLBJDUtils.BJCLPriceDecimal);
|
||
}
|
||
|
||
//更新采购价格
|
||
protected void btnGXCGJG_Click(object sender, EventArgs e)
|
||
{
|
||
if (txtTYBZ.Value.Trim().Equals("Y"))
|
||
{
|
||
ShowMessage("物料对应的报价材料已停用!");
|
||
return;
|
||
}
|
||
string sMsg = "将用最新进价更新采购价格,是否继续?";
|
||
|
||
Confirm.Register("IsQD", sMsg);
|
||
Confirm.ShowBtnText = TConfirm.cBtnText.Yes_No;
|
||
if (Confirm.GetValue("IsQD").Trim().Equals(""))
|
||
{
|
||
Confirm.Ask("IsQD");
|
||
return;
|
||
}
|
||
else if (Confirm.GetValue("IsQD").Trim().Equals("N"))
|
||
{
|
||
//表示进行了提示并选择了取消,直接返回或其他处理
|
||
|
||
Confirm.Clear();
|
||
return;
|
||
}
|
||
else if (Confirm.GetValue("IsQD").Trim().Equals("Y"))
|
||
{
|
||
//表示进行了提示并选择了确认
|
||
|
||
Confirm.Clear();
|
||
}
|
||
|
||
string sWLID = txtWLID.Text.Trim();
|
||
string sCGU009 = GetOption(100486007, "CGU009");
|
||
//含税
|
||
txtHSCGJG.Value = XLXSWLHQ.GetCGPri(true, sWLID, sCGU009);
|
||
|
||
txtWSCGJG.Value = XLXSWLHQ.GetCGPri(false, sWLID, sCGU009);
|
||
|
||
FormAreaUpdate();
|
||
}
|
||
#endregion
|
||
}
|
||
}
|
||
|
||
|