Example #1
0
        void ShowAccount()
        {
            if (m_Associator != null)
            {
                //&& m_Associator.EndDate<DateTime.Now.Date.AddDays(1)
                m_ReceAccount   = m_Account * m_Associator.AgioRate;
                m_Discount      = m_Account - m_ReceAccount;
                tbDiscount.Text = m_Discount.ToString("0.00");
            }
            else
            {
                m_ReceAccount   = m_Account;
                tbDiscount.Text = "";
            }
            m_RealAccount      = m_ReceAccount;
            tbAccount.Text     = m_Account.ToString("0.00");
            tbReceAccount.Text = m_ReceAccount.ToString("0.00");
            tbRealAccount.Text = tbReceAccount.Text;

            if (CRunSetting.ClientPromptPort.IndexOf("COM") > 0)
            {
                ComPrinter Printer = new ComPrinter(CRunSetting.ClientPromptPort);
                Printer.DisplayMessage("消费总额:" + tbAccount.Text + " 应收:" + tbReceAccount.Text);
            }
        }
Example #2
0
        private void btreckoning_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbInput.Text))
            {
                if (m_Associator == null && m_OnCredit == null)
                {
                    MessageBox.Show("请输入实收现金再进行结帐!");
                    return;
                }

                if (m_OnCredit == null)
                {
                    if (m_Associator != null && m_Associator.Surplus < m_RealAccount)
                    {
                        MessageBox.Show("会员卡余额不足,请先充值!");
                        return;
                    }
                }
            }

            UpdateBill();


            //弹出钱箱
            if (CRunSetting.AutoOpenCashbox == 1)
            {
                if (CRunSetting.CashboxPort.IndexOf("LPT") > 0)
                {
                    LptPrinter Printer = new LptPrinter(CRunSetting.CashboxPort);
                    Printer.OpenCashbox();
                }
                else
                {
                    ComPrinter Printer = new ComPrinter(CRunSetting.CashboxPort);
                    Printer.OpenCashbox();
                }
            }
            //这一段需要优化完善
            if (CGlobalInstance.Instance.DbAdaHelper.UpdateBillB(m_Bill))
            {
                string Employee = "";//有待修改
                if (string.IsNullOrEmpty(tbInput.Text))
                {
                    bool bDeduct   = false;
                    bool bOnCredit = false;
                    if (m_Associator != null && m_Associator.Surplus > m_RealAccount)
                    {
                        bDeduct = CGlobalInstance.Instance.DbAdaHelper.AssociatorDeduct(m_Associator.CardID, m_Associator.Surplus, m_RealAccount, Employee, tbRemark.Text);
                        if (bDeduct == true)
                        {
                            MessageBox.Show("会员扣帐成功!");
                        }
                        else
                        {
                            MessageBox.Show("会员扣帐失败!不要关闭结帐窗口,请检查网络后再进行!");
                            return;
                        }
                    }
                    if (bDeduct == false && m_OnCredit != null)
                    {
                        if (CGlobalInstance.Instance.DbAdaHelper.OnCreditDo(m_OnCredit.OnCreditID, m_OnCredit.OnCreditSum, m_RealAccount, Employee, tbRemark.Text))
                        {
                            bOnCredit = true;
                            MessageBox.Show("挂帐成功!");
                        }
                        else
                        {
                            MessageBox.Show("挂帐失败!不要关闭结帐窗口,请检查网络再进行!");
                            return;
                        }
                    }
                    CGlobalInstance.Instance.DbAdaHelper.UpdateBillListAllState(m_Bill.BillID, 3);//已上菜
                }
                //处理会员积分
                if (m_Associator != null)
                {
                    int Integral = (int)m_RealAccount / m_Associator.IntegralRadix;
                    CGlobalInstance.Instance.DbAdaHelper.AssociatorIntegral(m_Associator.CardID, Integral);
                }

                int State = (int)YyTableCtrl.YyDiningTable.YyTableState.Reckoning;
                if (CGlobalInstance.Instance.DbAdaHelper.UpdateDiningTableState(m_Bill.TableNO, State))
                {
                    //打印帐单
                    if (MessageBox.Show("需要打印帐单吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        PrintBill();
                    }

                    //自动清台,即结帐后为空闲状态
                    if (CRunSetting.AutoClearTable == 1)
                    {
                        State = (int)YyTableCtrl.YyDiningTable.YyTableState.Idle;
                        if (CGlobalInstance.Instance.DbAdaHelper.UpdateDiningTableState(m_Bill.TableNO, State))
                        {
                        }
                    }
                    this.DialogResult = DialogResult.OK;
                }
            }
            else
            {
                MessageBox.Show("结帐异常!请检查网络!");
            }
        }