using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; namespace Core.StlMes.Client.GlBusiness { public partial class FrmSlmGlPay : FrmBase { public FrmSlmGlPay() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "doQuery": get_SlmGlPay(); break; case "doAdd": add_SlmGlPay(); break; case "doUpdate": update_SlmGlPay(); break; case "doDelete": delete_SlmGlPay(); break; case "Close": this.Close(); break; } } private string setCreateTimeStart(Object value) { DateTime time = Convert.ToDateTime(value); DateTime endtime = new DateTime(time.Year, time.Month, time.Day, 0, 0, 0); endtime.ToLongTimeString(); return endtime.ToString(); } private string setCreateTimeEnd(Object value) { DateTime time = Convert.ToDateTime(value); DateTime endtime = new DateTime(time.Year, time.Month, time.Day, 23, 59, 59); return endtime.ToString(); } /// /// 查询 /// public void get_SlmGlPay() { this.dataTable1.Clear(); ArrayList parm = new ArrayList(); parm.Add(Invoice_No.Text.Trim()); if (QcreateTime_Begin.Value != null)//创建开始时间 { parm.Add(setCreateTimeStart(QcreateTime_Begin.Value)); } if (QcreateTime_End.Value != null)//创建结束时间 { parm.Add(setCreateTimeEnd(QcreateTime_End.Value)); } DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.SlmGlPay.query", new Object[] { parm }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true); } /// /// 增加 /// public void add_SlmGlPay() { try { if (MessageUtil.ShowYesNoAndQuestion("是否确定添加?") == DialogResult.No) { return; } if (cbxPayTypeCode.SelectedItem.ToString().Equals("")) { MessageUtil.ShowTips("付款方式不能为空,请输入!"); return; } if (cbxPayNm.Value.ToString().Equals("")) { MessageUtil.ShowTips("付款方不能为空,请输入!"); return; } if (cbxRecNm.Value.ToString().Equals("")) { MessageUtil.ShowTips("收款方不能为空,请输入!"); return; } if (txtPayValue.Text.Trim().Equals("")) { MessageUtil.ShowTips("付款金额不能为空,请输入!"); return; } if (txtInvoiceNo.Text.Trim().Equals("")) { MessageUtil.ShowTips("票据号不能为空,请输入!"); return; } ArrayList all = new ArrayList(); all.Add("BLyyyyMMdd00001"); all.Add(cbxPayTypeCode.Value.ToString()); all.Add(cbxPayTypeCode.SelectedItem.ToString()); all.Add(txtPayValue.Text.Trim()); all.Add(txtInvoiceNo.Text.Trim()); all.Add(cbxPayNm.Value.ToString()); all.Add(cbxRecNm.Value.ToString()); all.Add(txtRemark.Text.Trim()); all.Add(UserInfo.GetUserID()); all.Add(UserInfo.GetUserName()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.glbusiness.SlmGlPay"; ccp.MethodName = "insert"; ccp.ServerParams = new object[] { all }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; MessageBox.Show("增加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); get_SlmGlPay(); update_SlmGlPay(); } catch (System.Exception ex) { MessageUtil.ShowTips("操作失败:" + ex.Message); } } /// /// 修改 /// public void update_SlmGlPay() { Invoice_No.Text = ""; txtInvoiceNo.Text = ""; txtPayValue.Text = ""; txtRemark.Text = ""; cbxPayNm.Value = ""; cbxPayTypeCode.Value = ""; cbxRecNm.Value = ""; } /// /// 删除 /// public void delete_SlmGlPay() { try { ultraGrid1.Update(); if (ultraGrid1.ActiveRow == null) { MessageUtil.ShowTips("请选择需要修改的数据!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确定废除?") == DialogResult.No) { return; } ArrayList all = new ArrayList(); all.Add(UserInfo.GetUserID()); all.Add(UserInfo.GetUserName()); all.Add(ultraGrid1.ActiveRow.Cells["PAY_NO"].Value.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.glbusiness.SlmGlPay"; ccp.MethodName = "delete"; ccp.ServerParams = new object[] { all }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; MessageBox.Show("废除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); get_SlmGlPay(); } catch (System.Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } private void FrmSlmGlPay_Load(object sender, EventArgs e) { QcreateTime_Begin.Value = DateTime.Now.AddDays(-7); QcreateTime_End.Value = DateTime.Now; string parm = "1212"; DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.SlmGlPay.queryBase", new Object[] { parm }, this.ob); cbxPayTypeCode.DataSource = dt; cbxPayTypeCode.DisplayMember = "BASENAME"; cbxPayTypeCode.ValueMember = "BASECODE"; string parm2 = "1205"; DataTable dt2 = ServerHelper.GetData("com.steering.pss.glbusiness.SlmGlPay.queryBase", new Object[] { parm2 }, this.ob); cbxPayNm.DataSource = dt2; cbxPayNm.DisplayMember = "BASENAME"; cbxPayNm.ValueMember = "BASECODE"; cbxRecNm.DataSource = dt2; cbxRecNm.DisplayMember = "BASENAME"; cbxRecNm.ValueMember = "BASECODE"; GridHelper.SetAllColumnsActive(ultraGrid1); } } }