Exemple #1
0
        /// <summary>
        /// 手工滚费
        /// </summary>
        public void m_mthHandBuild()
        {
            frmAutoChargeDate f = new frmAutoChargeDate();

            if (f.ShowDialog() == DialogResult.OK)
            {
                string date = f.FeeDate;

                if (MessageBox.Show("是否手工生成日期为:" + date + "的费用?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                try
                {
                    clsDcl_Charge objCharge = new clsDcl_Charge();

                    this.Cursor = Cursors.WaitCursor;

                    clsPublic.PlayAvi("findFILE.avi", "正在生成费用信息,请稍候...");

                    CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                    long l = objCharge.AutoCharge(CreateTime, date + " 23:59:59", this.LoginInfo.m_strEmpID, null, 1);
                    clsPublic.CloseAvi();

                    if (l > 0)
                    {
                        this.m_mthRefresh();
                        this.Cursor = Cursors.Default;
                        MessageBox.Show("滚费成功。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                        MessageBox.Show("滚费失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
                catch
                {
                    clsPublic.CloseAvi();
                    this.Cursor = Cursors.Default;
                    MessageBox.Show("滚费失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 自动滚费
        /// </summary>
        /// <param name="Flag">1 定时任务 2 手工自动滚费</param>
        public void m_mthAutoBuild(int Flag)
        {
            if (Flag != 1)
            {
                if (MessageBox.Show("请确认是否开始手工滚费?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }

            try
            {
                long     l       = 0;
                string   status  = "";
                string   date    = "";
                TimeSpan ts      = new TimeSpan(1, 0, 0, 0);
                bool     bstatus = false;

                if (this.lvHistory.Items.Count == 0)
                {
                    MessageBox.Show("请手工生成初始第一天的费用。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                clsDcl_Charge objCharge = new clsDcl_Charge();

                this.Cursor = Cursors.WaitCursor;
                clsPublic.PlayAvi("findFILE.avi", "正在生成费用信息,请稍候...");

                CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                if (this.lvHistory.Items.Count > 0)
                {
                    for (int i = 0; i < this.lvHistory.Items.Count; i++)
                    {
                        status = this.lvHistory.Items[i].Tag.ToString();
                        date   = this.lvHistory.Items[i].SubItems[4].Text.Trim();
                        date   = date.Substring(0, 4) + "-" + date.Substring(4, 2) + "-" + date.Substring(6, 2);

                        if (status.ToLower() == "success")
                        {
                            continue;
                        }

                        l = objCharge.AutoCharge(CreateTime, date + " 23:59:59", this.LoginInfo.m_strEmpID, null, 1);
                        if (l <= 0)
                        {
                            clsPublic.CloseAvi();
                            this.Cursor = Cursors.Default;
                            this.m_mthRefresh();
                            MessageBox.Show("滚费失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            return;
                        }

                        bstatus = true;
                    }
                }

                DateTime dte = DateTime.Now.Subtract(ts);

                if (Convert.ToDateTime(dte.ToString("yyyy-MM-dd")) > Convert.ToDateTime(date))
                {
                    DateTime dte1 = Convert.ToDateTime(date);
                    TimeSpan ts1  = dte.Subtract(dte1);
                    for (int j = 0; j < ts1.Days; j++)
                    {
                        dte1 = dte1.Add(ts);

                        l = objCharge.AutoCharge(CreateTime, dte1.ToString("yyyy-MM-dd") + " 23:59:59", this.LoginInfo.m_strEmpID, null, 1);
                        if (l <= 0)
                        {
                            clsPublic.CloseAvi();
                            this.Cursor = Cursors.Default;
                            this.m_mthRefresh();
                            MessageBox.Show("滚费失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            return;
                        }

                        bstatus = true;
                    }
                }

                clsPublic.CloseAvi();
                this.Cursor = Cursors.Default;
                if (bstatus)
                {
                    this.m_mthRefresh();
                    if (Flag != 1)
                    {
                        MessageBox.Show("滚费成功。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    if (Flag != 1)
                    {
                        MessageBox.Show("没有新费用数据。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch
            {
                clsPublic.CloseAvi();
                this.Cursor = Cursors.Default;
                this.m_mthRefresh();
                MessageBox.Show("滚费失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }