Пример #1
0
        private void UseButton_Click(object sender, EventArgs e)
        {
            CDepositManager tempDepositManager = new CDepositManager();
            Double inputAmount = 0.000;
            Double.TryParse(g_InputTextBox.Text.Substring(1).Trim(), out inputAmount);

            if (inputAmount >= m_oDeposit.DepositBalance)
            {
                usedAmount = m_oDeposit.DepositBalance;
                //m_oDeposit.DepositBalance = 0.000;
                //tempDepositManager.UpdateDeposit(m_oDeposit);
            }
            else
            {
                usedAmount = inputAmount;
                //m_oDeposit.DepositBalance = m_oDeposit.DepositBalance - inputAmount;
                //tempDepositManager.UpdateDeposit(m_oDeposit);
            }
            this.Close();
        }
Пример #2
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                CDepositManager tempDepositManager = new CDepositManager();
                CDeposit tempDeposit = new CDeposit();

                Double tempCash = 0.000;
                Double tempEFT = 0.000;
                Double tempCheque = 0.000;
                Double tempAccount = 0.000;
                Double tempTotal = 0.000;

                Double.TryParse(g_CashLabel.Text.Substring(1), out tempCash);
                Double.TryParse(g_EFTLabel.Text.Substring(1), out tempEFT);
                Double.TryParse(g_ChequeLabel.Text.Substring(1), out tempCheque);
                Double.TryParse(g_AccountLabel.Text.Substring(1), out tempAccount);
                Double.TryParse(g_DepositTotalLabel.Text.Substring(1), out tempTotal);

                if (tempTotal == 0)
                {
                    MessageBox.Show("Zero amount given for deposit. Please recheck", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                tempDeposit.DepositBalance = tempTotal;
                tempDeposit.DepositTime = DateTime.Now.Ticks;
                tempDeposit.CustomerID=m_iCustomerID;
                tempDeposit.DepositTotalAmount = tempTotal;
                tempDeposit.DepositType = m_sDepositType;
                tempDeposit.Status = 1;

                CPcInfoManager tempPcInfoManager = new CPcInfoManager();
                IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName());
                CPcInfo tempPcInfo=new CPcInfo();
                CResult oResult= tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString());
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempPcInfo = (CPcInfo)oResult.Data;
                }
                tempDeposit.PcID = tempPcInfo.PcID;

                oResult = tempDepositManager.InsertDeposit(tempDeposit);
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempDeposit = (CDeposit)oResult.Data;
                }

                //get customer name & phone
                CCustomerManager tempCustomerManager= new CCustomerManager();
                CCustomerInfo tempCustomerInfo= new CCustomerInfo();
                oResult = tempCustomerManager.CustomerInfoGetByCustomerID(m_iCustomerID);
                if(oResult.IsSuccess && oResult.Data!=null)
                {
                    tempCustomerInfo = (CCustomerInfo)oResult.Data;
                }

                //string serialBody = "\r\n         Deposit Token\r\n";
                //serialBody += "\r\n         Customer Name: "+tempCustomerInfo.CustomerName;
                //serialBody += "\r\n         Phone: " + tempCustomerInfo.CustomerPhone+"\r\n";

                //serialBody += "\r\n         By " + tempDeposit.DepositType;
                //serialBody += "\r\n---------------------------------";
                //serialBody += "\r\n         Total: " + tempDeposit.DepositBalance.ToString("F02");
                //serialBody += "\r\n";
                //serialBody += "\r\nS/N: " + tempDeposit.DepositID.ToString();

                string serialBody = "\r\n                Deposit Token\r\n";
                DateTime tempODate = new DateTime(tempDeposit.DepositTime);
                string tempODateString = "Deposit Date: " + tempODate.ToLongDateString();
                serialBody += "".PadRight((int)((45 - tempODateString.Length) / 2), ' ') + tempODateString.Trim() + "\r\n";
                string tempDateString = "Reprint Date: " + DateTime.Now.ToLongDateString();
                serialBody += "".PadRight((int)((45 - tempDateString.Length) / 2), ' ') + tempDateString.Trim() + "\r\n\r\n";
                serialBody += "Customer Name: " + tempCustomerInfo.CustomerName + "\r\n";
                string tempAddressString = "Customer Address: " + tempCustomerInfo.CustomerAddress.Trim();
                if (tempAddressString.Length > 40)
                {
                    tempAddressString = tempAddressString.Substring(0, 40) + "\r\n".PadRight(19, ' ') + tempAddressString.Substring(40);
                }
                serialBody += tempAddressString + "\r\n";
                serialBody += "Phone: " + tempCustomerInfo.CustomerPhone + "\r\n\r\n";
                serialBody += "Deposit Type:     " + tempDeposit.DepositType + "\r\n";
                serialBody += "Deposited Amount: " + tempDeposit.DepositTotalAmount.ToString("F02") + "\r\n";
                double tempDepositUsed = (tempDeposit.DepositTotalAmount - tempDeposit.DepositBalance);
                serialBody += "Deposit Used:     " + tempDepositUsed.ToString("F02") + "\r\n";
                serialBody += "---------------------------------\r\n";
                serialBody += "Total Balance:    " + tempDeposit.DepositBalance.ToString("F02") + "\r\n\r\n";
                serialBody += "S/N: " + tempDeposit.DepositID.ToString() + "\r\n";

                CPrintMethods tempPrintMethods = new CPrintMethods();
                tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER,"",serialBody,"",tempDeposit.DepositID.ToString());
                this.Close();

            }
            catch (Exception eee)
            {
            }
        }
Пример #3
0
        private void UpdateCalculation(int paymentMethodIndex)
        {
            try
                {
                Double tempTotalPaid = 0.0;

                Debug.WriteLine("UpdateCalc 1");
                tempTotalPaid += Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length))
                     + Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length)) + Double.Parse(complementorylabel.Text.Substring(Program.currency.Length));

                Debug.WriteLine("UpdateCalc 2");
                Double tempBillTotal = m_dTotalAmount + Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length));
                Debug.WriteLine("UpdateCalc 3");
                Double tempDifference = tempBillTotal - tempTotalPaid;
                Debug.WriteLine("UpdateCalc 4");
                if (tempDifference > 0)
                {
                    m_dBalance = tempDifference;
                    g_BalaceLabel.Text = String.Format("Balance Due {0}" + m_dBalance.ToString("F02"), Program.currency);
                    Debug.WriteLine("UpdateCalc 5");
                }
                else
                {
                    if (CurrentPaymentMethod.Equals("Cash"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_CashLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("EFT"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_EFTLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("Due"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_ChequeLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("Voucher"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_VoucherLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("Account"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_AccountLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("Discount"))
                    {
                        g_DiscountLabel.Text = Program.currency + m_dBalance.ToString("F02");
                    }
                    else if (CurrentPaymentMethod.Equals("Deposit"))
                    {
                        g_DepositUsedLabel.Text = Program.currency + m_dBalance.ToString("F02");
                    }

                    else if (CurrentPaymentMethod.Equals("Complementory"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            complementorylabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }

                    Debug.WriteLine("UpdateCalc 6");
                    m_dBalance = -tempDifference;

                    g_BalaceLabel.Text = "Pay Back " + Program.currency + (m_dBalance-tipsamount).ToString("F02");

                    Debug.WriteLine("UpdateCalc 7");
                    CPaymentManager tempPaymentManager = new CPaymentManager();

                    /***********************/
                    /********New Print******/
                    /***********************/

                    if (isCheatManuallyhandled())
                    {
                        DialogResult dresult = MessageBox.Show("Make It Open?", "Message", MessageBoxButtons.YesNo);

                        if (dresult == DialogResult.Yes)
                        {
                            makeOpen = true;
                        }
                        if (dresult == DialogResult.No)
                        {
                            makeOpen = false;
                        }
                    }

                    DataSet tempDataSet = new DataSet();
                    tempDataSet.ReadXml("Config/Print_Config.xml");
                    if (tempDataSet.Tables[0].Rows[0]["PrintPaymentBill"].ToString().ToLower().Equals("true"))
                    {
                        Debug.WriteLine("UpdateCalc 17");
                        PrintPaymentBill(paymentMethodIndex);//Payment method index .Cash=1,EFT=2,Cheque=3
                    }

                    COrderManager temmpOrderManager = new COrderManager();
              COrderDiscount tempOrderDiscount = new COrderDiscount();
              CResult ooResult = temmpOrderManager.OrderDiscountGetByOrderID(m_iOrderID);
                    double itemDiscount = 0;
              if (ooResult.IsSuccess && ooResult.Data != null)
              {

              tempOrderDiscount = (COrderDiscount) ooResult.Data;
              itemDiscount = tempOrderDiscount.TotalItemDiscount;
              }

                    //Check whether payment data exists
                    if (m_cPayment == null)
                    {
                        Debug.WriteLine("UpdateCalc 8");
                        ///insert into payment table
                        CPayment tempPayment = new CPayment();
                        tempPayment.OrderID = m_iOrderID;

                        //get pc id from pc ip
                        CPcInfoManager tempPcInfoManager = new CPcInfoManager();
                        IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName());

                        CPcInfo tempPcInfo = (CPcInfo)tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()).Data;

                        tempPayment.PcID = tempPcInfo.PcID;
                        Debug.WriteLine("UpdateCalc 9");
                        tempPayment.TotalAmount = m_dTotalAmount;
                        tempPayment.CashAmount = Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length));
                        tempPayment.EFTAmount = Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length));
                        tempPayment.ChequeAmount = Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length));
                        tempPayment.ServiceAmount = m_serviceCharge_cash + m_serviceCharge_voucher + m_serviceCharge_eft + m_serviceCharge_cheque + m_serviceCharge_accounts - tipsamount;  //Double.Parse(g_ServiceChargeLabel.Text.Substring(Program.currency.Length));
                        tempPayment.VoucherAmount = Double.Parse(complementorylabel.Text.Substring(Program.currency.Length));
                        tempPayment.Discount = Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length));
                        tempPayment.AccountPay = Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length));
                        tempPayment.DepositID = m_oDeposit.DepositID;
                        tempPayment.DepositAmount = Double.Parse(g_DepositUsedLabel.Text.Substring(Program.currency.Length));
                        tempPayment.PaymentTime = System.DateTime.Now;

                        tempPayment.ServiceChargeCash = m_serviceCharge_cash;
                        tempPayment.ServiceChargeCheque = m_serviceCharge_cheque;
                        tempPayment.ServiceChargeEft = m_serviceCharge_eft;
                        tempPayment.ServiceChargeVoucher = m_serviceCharge_voucher;
                        tempPayment.ServiceChargeAcc = m_serviceCharge_accounts;

                        tempPayment.DueMessage = dueMessage;
                        tempPayment.ComplementoryMessage = complementoryMessage;

                        double totalCost = GetTotalCost(m_iOrderID);
                        tempPayment.TotalCost = totalCost;
                        tempPayment.TipsAmount = tipsamount;

                        tempPayment.VatImposed = Program.vat.ToString();

                        tempPayment.membershipDiscount = (double)membershipdiscount;
                        tempPayment.ItemDiscount = itemDiscount;

                        //tempPayment.VatImposed = Program.vat.ToString();
                        tempPayment.GuestBill = gusetBillStr;
                        COrderWaiterDao orderWaiterDao = new COrderWaiterDao(); // Change by Mithu
                        COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(m_iOrderID); // Change by Mithu

                        try
                        {
                            tempPayment.Waiter = orderWaiter.WaiterName;
                        }
                        catch (Exception)
                        {

                        }

                        if (makeOpen)
                            tempPayment.Vat_stat = true;
                        else
                            tempPayment.Vat_stat = false;

                        tempPayment.PaymentPerson = RMSGlobal.LoginUserName;

                        DataSet tempStockDataSet = new DataSet();
                        tempStockDataSet.ReadXml("Config/StockSetting.xml");
                        bool isAllowedToOrder = Convert.ToBoolean(tempStockDataSet.Tables[0].Rows[0]["AllowedtoOrder"].ToString());
                        if (!isAllowedToOrder)
                        {
                            COrderDetailsDAO aDao = new COrderDetailsDAO();
                            List<COrderDetails> aList = new List<COrderDetails>();
                            double cost = 0.0;
                            try
                            {
                                aList = aDao.OrderDetailsGetAll();
                                var check = from list in aList where list.OrderID == tempPayment.OrderID select list;
                                SaleReportDAO aSaleReportDao = new SaleReportDAO();
                                aSaleReportDao.InsertOrUpdateSaleRawmaterialsReport(check);
                            }
                            catch
                            {
                            }

                        }

                        CResult oResult = tempPaymentManager.InsertPayment(tempPayment);
                        if (oResult.IsSuccess && oResult.Data != null)
                        {
                            tempPayment = (CPayment)oResult.Data;
                            m_cPayment = tempPayment;
                            Debug.WriteLine("UpdateCalc 10");
                        }
                    }
                    else
                    {
                        Debug.WriteLine("UpdateCalc 11");
                        //update payment table
                        CPayment tempPayment = new CPayment();
                        tempPayment.PaymentID = m_cPayment.PaymentID;
                        tempPayment.OrderID = m_iOrderID;

                        tempPayment.TotalAmount = m_dTotalAmount;
                        tempPayment.CashAmount = Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length));
                        tempPayment.EFTAmount = Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length));
                        tempPayment.ChequeAmount = Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length));
                        tempPayment.ServiceAmount = m_serviceCharge_cash + m_serviceCharge_voucher + m_serviceCharge_eft + m_serviceCharge_cheque + m_serviceCharge_accounts - tipsamount;  //Double.Parse(g_ServiceChargeLabel.Text.Substring(Program.currency.Length));
                        tempPayment.VoucherAmount = Double.Parse(complementorylabel.Text.Substring(Program.currency.Length));
                        tempPayment.Discount = Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length));
                        tempPayment.AccountPay = Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length));
                        tempPayment.DepositID = m_oDeposit.DepositID;
                        tempPayment.DepositAmount = Double.Parse(g_DepositUsedLabel.Text.Substring(Program.currency.Length));
                        tempPayment.PaymentTime = System.DateTime.Now;

                        tempPayment.ServiceChargeCash = m_serviceCharge_cash;
                        tempPayment.ServiceChargeCheque = m_serviceCharge_cheque;
                        tempPayment.ServiceChargeEft = m_serviceCharge_eft;
                        tempPayment.ServiceChargeVoucher = m_serviceCharge_voucher;
                        tempPayment.ServiceChargeAcc = m_serviceCharge_accounts;
                        tempPayment.VatImposed = Program.vat.ToString();
                        tempPayment.TipsAmount = tipsamount;
                        tempPayment.GuestBill = gusetBillStr;
                        tempPayment.membershipDiscount = (double)membershipdiscount;
                        tempPayment.ItemDiscount = itemDiscount;
                        //tempPayment.DueMessage = dueMessage;
                        //tempPayment.ComplementoryMessage = complementoryMessage;

                        if (isCheatManuallyhandled())
                        {
                            DialogResult dresult = MessageBox.Show("Make It Open?", "Message", MessageBoxButtons.YesNo);

                            if (dresult == DialogResult.Yes)
                            {
                                makeOpen = true;
                            }
                            if (dresult == DialogResult.No)
                            {
                                makeOpen = false;
                            }
                        }

                        if (makeOpen)
                            tempPayment.Vat_stat = true;
                        else
                            tempPayment.Vat_stat = false;
                        tempPayment.PaymentPerson = RMSGlobal.LoginUserName;

                        tempPaymentManager.UpdatePayment(tempPayment);
                        m_cPayment = tempPayment;
                        Debug.WriteLine("UpdateCalc 12");
                    }

                    //Update Deposit
                    CDepositManager tempDepositManager = new CDepositManager();
                    tempDepositManager.UpdateDeposit(m_oDeposit);

                    //opening cash drawer
                    try
                    {
                        CPrintMethods tempPrintMethods = new CPrintMethods();
                        tempPrintMethods.OpenDrawer();

                        #region "Tracking Area"
                        CCommonConstants m_oCommonConstants;
                        //Drawer Opening log
                        DateTime dtPayment = DateTime.Now;
                        dtPayment = new DateTime(dtPayment.Year, dtPayment.Month, dtPayment.Day, dtPayment.Hour, dtPayment.Minute, dtPayment.Second);
                        Int64 dateTime = dtPayment.Ticks;
                        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                        CUserInfo objUserInfo = m_oCommonConstants.UserInfo;
                        tempPaymentManager.SaveDrawerLogs(RMSGlobal.Terminal_Id, objUserInfo.UserName, dateTime);
                        #endregion

                        Debug.WriteLine("UpdateCalc 18");
                    }
                    catch (Exception eee)
                    {
                        Debug.WriteLine("UpdateCalc 19");
                        Debug.WriteLine(eee.ToString());
                    }

                    ///Print Payment Bill
                    ///
                    /*  DataSet tempDataSet = new DataSet();
                      tempDataSet.ReadXml("Config/Print_Config.xml");
                      if (tempDataSet.Tables[0].Rows[0]["PrintPaymentBill"].ToString().ToLower().Equals("true"))
                      {
                          Debug.WriteLine("UpdateCalc 17");
                          PrintPaymentBill(paymentMethodIndex);//Payment method index .Cash=1,EFT=2,Cheque=3
                      }
              */

                    COrderManager tempOrderManager = new COrderManager();
                    COrderInfo tempOrderInfo = null;

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper()) //If local orders are processed
                    {
                        tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(m_iOrderID).Data;
                        tempOrderManager.UpdateOrderInfo(tempOrderInfo);
                        Debug.WriteLine("UpdateCalc 13");
                        tempOrderManager.InsertOrderArchive(tempOrderInfo);
                        Debug.WriteLine("UpdateCalc 14");
                        tempOrderManager.InsertOrderDetailsArchive(tempOrderInfo);
                        Debug.WriteLine("UpdateCalc 15");
                    }
                    else //If online orders are processed
                    {
                        tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(m_iOrderID).Data;
                        tempOrderManager.InsertOnlineOrderArchive(tempOrderInfo);
                        Debug.WriteLine("Online orders archiving");
                    }

                    tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, m_sTableType);
                    Debug.WriteLine("UpdateCalc 16");

                    //insert voucher
                    tempOrderManager.InsertOrderVoucher(m_oOrderVoucher);

                    ///back to main screen
                    ///

                    CFormManager.Forms.Pop();
                    Form tempForm = CFormManager.Forms.Pop();
                    tempForm.Show();
                    this.Close();
                }
                g_BalaceLabel.ForeColor = Color.Red;
            }
            catch (Exception eee)
            {
                //MessageBox.Show(eee.ToString());
                Debug.WriteLine("UpdateCalc catch");
                Debug.WriteLine(eee.ToString());
            }
        }
Пример #4
0
        private void DepositSearchButton_Click(object sender, EventArgs e)
        {
            try
            {
                Int64 tempDepositSerial = Int64.Parse(DepositSerialTextBox.Text.Trim());
                DepositDataGridView.Rows.Clear();
                CDepositManager tempDepositManager = new CDepositManager();
                CDeposit tempDeposit = new CDeposit();
                CResult oResult = tempDepositManager.DepositGetByDepositID(tempDepositSerial);
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempDeposit = (CDeposit)oResult.Data;
                }
                if (tempDeposit.DepositBalance != 0)
                {

                    string[] newRow ={
                tempDeposit.DepositID.ToString(),
                new DateTime(tempDeposit.DepositTime).ToShortDateString(),
                tempDeposit.DepositTotalAmount.ToString("F02"),
                tempDeposit.DepositBalance.ToString("F02"),
                tempDeposit.DepositType
                };

                    CCustomerManager tempCustomerManager = new CCustomerManager();
                    CCustomerInfo tempCustomerInfo = new CCustomerInfo();
                    oResult = tempCustomerManager.CustomerInfoGetByCustomerID(tempDeposit.CustomerID);
                    if (oResult.IsSuccess && oResult.Data != null)
                    {
                        tempCustomerInfo = (CCustomerInfo)oResult.Data;
                    }
                    CustomerLabel.Text = tempCustomerInfo.CustomerName;
                    PhoneLabel.Text = tempCustomerInfo.CustomerPhone;

                    DepositDataGridView.Rows.Add(newRow);
                }
                else
                {
                    MessageBox.Show("No deposit information found. This deposit may be already used or never existed.", "Info",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                DepositDataGridView.RowCount = 13;

            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Пример #5
0
        private void g_UseDepositButton_Click(object sender, EventArgs e)
        {
            CCalculatorForm tempCalculatorForm = new CCalculatorForm("Use Deposit", "Enter Deposit Serial Number");
            tempCalculatorForm.ShowDialog();

            if (CCalculatorForm.inputResult.Equals("Cancel") || CCalculatorForm.inputResult.Equals(""))
            {
                return;
            }
            Int64 tempDepositSerial = Int64.Parse(CCalculatorForm.inputResult);
            CDepositManager tempDepositManager = new CDepositManager();
            CDeposit tempDeposit = new CDeposit();
            CResult oResult = tempDepositManager.DepositGetByDepositID(tempDepositSerial);
            if (oResult.IsSuccess && oResult.Data != null)
            {
                tempDeposit = (CDeposit)oResult.Data;

                if (tempDeposit.DepositID != 0)
                {

                    CUseDepositForm tempUseDepositForm = new CUseDepositForm(tempDeposit);
                    DialogResult dResult = tempUseDepositForm.ShowDialog();
                    if (dResult.Equals(DialogResult.Cancel))
                        return;
                    else if (dResult.Equals(DialogResult.OK))
                    {
                        if (CUseDepositForm.usedAmount > m_dBalance)
                        {
                            tempDeposit.DepositBalance = tempDeposit.DepositBalance - m_dBalance;
                        }
                        else
                        {
                            tempDeposit.DepositBalance = tempDeposit.DepositBalance - CUseDepositForm.usedAmount;
                        }
                        m_oDeposit = tempDeposit;

                        if (CUseDepositForm.usedAmount > m_dBalance)
                        {
                            m_dTotalAmount = m_dTotalAmount - m_dBalance;
                        }
                        else
                        {
                            m_dTotalAmount = m_dTotalAmount - CUseDepositForm.usedAmount;
                        }
                        g_BillTotalLabel.Text = "£" + m_dTotalAmount.ToString("F02");

                        g_DepositUsedLabel.Text = "£" + CUseDepositForm.usedAmount.ToString("F02");
                        CurrentPaymentMethod = "Deposit";
                        UpdateCalculation(0);
                        g_UseDepositButton.Enabled = false;
                    }
                }
                else
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error", "Deposit Information not found!");
                    tempMessageBox.ShowDialog();
                }
            }
        }