Exemplo n.º 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            WasteBook objWasteBook = new WasteBook();

            objWasteBook.SubjectID = int.Parse(this.cboSubject.SelectedValue.ToString());
            objWasteBook.Date      = DateTime.Parse(this.dtpExpend.Value.ToShortDateString() + " " + DateTime.Now.ToLongTimeString());
            objWasteBook.Remark    = this.txtRemark.Text.Trim();
            if (this.m_strType != "")
            {
                objWasteBook.Type = this.m_strType;
                if (this.m_strType == "i")
                {
                    objWasteBook.Income = this.numMoney.Value;
                    objWasteBook.Expend = 0;
                }
                else
                {
                    objWasteBook.Income = 0;
                    objWasteBook.Expend = this.numMoney.Value;
                }
            }

            if (this.m_dWasteBookId > 0)
            {
                objWasteBook.ID = this.m_dWasteBookId;
                objWasteBook.UpdateExpend();
            }
            else
            {
                objWasteBook.InsertWasteBook();
            }
            DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 2
0
        /// <summary>会员退卡</summary>
        private void cmnuMember_Back_Click(object sender, EventArgs e)
        {
            if (this.dgvMember.CurrentRow != null)
            {
                string strMemberId = this.dgvMember.CurrentRow.Cells[0].Value.ToString();
                Member objMember   = new Member(strMemberId);
                if (MessageBox.Show("会员【" + objMember.ID + "】" + objMember.Name + "\n当前余额:¥" + objMember.Balance.ToString("f2") + "\n确实要退卡吗?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Deposit objDeposit = new Deposit();
                    objDeposit.Mode     = 4;
                    objDeposit.MemberID = objMember.ID;
                    objDeposit.Money    = 0 - objMember.Balance;
                    objDeposit.Date     = DateTime.Now;
                    if (objDeposit.BackDeposit() > 0)
                    {
                        objMember.Remark = objDeposit.Date.ToShortDateString() + "退卡";
                        objMember.UpdateStatus();              //更新会员状态
                        objMember.UpdateBalance(objMember.ID); //更新会员余额

                        //新增支出
                        Subject objSubject = new Subject();
                        objSubject.ID = objSubject.ExistsSubjectName("退卡");
                        if (objSubject.ID == 0)
                        {
                            objSubject.Name   = "退卡";
                            objSubject.Readme = "会员退卡";
                            objSubject.Type   = 0;
                            objSubject.ID     = objSubject.InsertSubject();
                        }

                        WasteBook objWasteBook = new WasteBook();
                        objWasteBook.SubjectID = objSubject.ID;
                        objWasteBook.Income    = 0;
                        objWasteBook.Expend    = objMember.Balance;
                        objWasteBook.Date      = objDeposit.Date;
                        objWasteBook.Remark    = "会员卡号【" + objMember.ID + "】" + objMember.Name;
                        objWasteBook.Type      = "e";
                        objWasteBook.InsertWasteBook();

                        this.LoadMemberList();
                        this.LoadMemberNum();
                    }
                }
            }
        }