using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Reflection; using System.Text; using System.Windows.Forms; namespace POSV.Shift { public partial class WorkerImprestForm : BusinessForm { public WorkerImprestForm() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (this.DesignMode) return; this.moneyTextBox.Text = string.Format("{0}", Global.Instance.BusinessPlanLog.Imprest); this.Focus(); this.moneyTextBox.Focus(); this.moneyTextBox.SelectAll(); this.ActiveControl = this.moneyTextBox; this.inputDate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); this.controlBox1.Text = "备用金录入"; this.controlBox1.ShowApplicationVersion = false; } private void OnCloseTouchClick(object sender, EventArgs e) { //先关闭父窗体 if (this.Owner != null) { this.Owner.Close(); } //再关闭当前窗体 this.Close(); } private void OnControlBoxKeyboardClick(object sender, EventArgs e) { NumericKeyboard.ShowKeyboard(this, this.moneyTextBox); } private void btn_exit_Click(object sender, EventArgs e) { //先关闭父窗体 if (this.Owner != null) { this.Owner.Close(); } //再关闭当前窗体 this.Close(); } private void in_Money_Enter(object sender, Component.EnterEventArg e) { if (InputVerify()) { string money = this.moneyTextBox.Text; Global.Instance.BusinessPlanLog.Imprest = Convert.ToDecimal(money); //更新本地数据库 using (var db = Global.Instance.OpenDataBase) { using (var trans = db.GetTransaction()) { string sql = "update pos_business_plan_log set imprest = {0} where status = 0 and storeId = '{1}' and workerId ='{2}' and posNo = '{3}'"; sql = string.Format(sql, money, Global.Instance.Authc.StoreId, Global.Instance.Worker.Id, Global.Instance.Authc.PosNo); db.Execute(sql); trans.Complete(); } } //先关闭父窗体 if (this.Owner != null) { this.Owner.Close(); } //再关闭当前窗体 this.Close(); } } private void btn_ok_Click(object sender, EventArgs e) { if (InputVerify()) { string money = this.moneyTextBox.Text; Global.Instance.BusinessPlanLog.Imprest = Convert.ToDecimal(money); //更新本地数据库 using (var db = Global.Instance.OpenDataBase) { using (var trans = db.GetTransaction()) { string sql = "update pos_business_plan_log set imprest = {0} where status = 0 and storeId = '{1}' and workerId ='{2}' and posNo = '{3}'"; sql = string.Format(sql, money, Global.Instance.Authc.StoreId, Global.Instance.Worker.Id, Global.Instance.Authc.PosNo); db.Execute(sql); trans.Complete(); } } //先关闭父窗体 if (this.Owner != null) { this.Owner.Close(); } //再关闭当前窗体 this.Close(); } } private bool InputVerify() { if (string.IsNullOrEmpty(this.moneyTextBox.Text.Trim())) { ShowMessage(this.lblInfo, "请输入备用金额", true); return false; } return true; } } }