用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - c#代码库

交班对账

2014-10-12 作者: 云代码会员举报

[c#]代码库

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Common;

namespace Pos
{
    public partial class frmDuty : Form
    {
        public frmDuty()
        {
            InitializeComponent();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (PUser.dutyID != "0")
                {
                    MessageBox.Show("你还未交班!", "友好提示");
                    this.Close();
                    return;
                }

                if ( txtMoney.Text == "")
                {
                    MessageBox.Show("金额不能为空!", "友好提示");
                    return;
                }


                //string year = ""+DateTime.Now.Year;
                //string month = ""+DateTime.Now.Month;
                //string day = ""+DateTime.Now.Day;
                string date = DateTime.Now.ToString();
                float money = float.Parse(txtMoney.Text);

                string sql = string.Format("insert into front_duty(User_code,Duty_time,Duty_InitMoney,Com_Name,duty_id) values('{0}','{1}',{2},'{3}','{4}')", PUser.UserCode, date, money, SQLHelper.CompanyName, GetCode.getCode("db1", "front_duty", "duty_id"));
                int n = SQLHelper.ExecuteNonQuery(sql);

                string sql2 = string.Format("select * from front_duty where User_code='{0}' and Duty_endTime is null", PUser.UserCode);
                DataTable dt2 = SQLHelper.ExecuteDataSet(sql2).Tables[0];
                if (dt2.Rows.Count > 0)
                {
                    PUser.dutyID = dt2.Rows[0]["duty_id"].ToString();
                }

                MessageBox.Show("操作员" + PUser.UserCode + "当班成功!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void txtMoney_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar >= '0' && e.KeyChar <= '9' || e.KeyChar == (char)Keys.Back)
            {
                e.Handled = false;

            }
            else
            {
                e.Handled = true;
            }
        }

        private void frmDuty_Load(object sender, EventArgs e)
        {
            txtMoney.Focus();
        }
    }
}

[代码运行效果截图]


交班对账


网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...