Ejemplo n.º 1
0
        private void cboChargeType_SelectedIndexChanged(object sender, EventArgs e)
        {
            Data.ChargeType        clsCharge            = new Data.ChargeType();
            Data.ChargeTypeDetails clsChargeTypeDetails = clsCharge.Details(cboChargeType.SelectedItem.ToString());
            clsCharge.CommitAndDispose();

            //if (clsChargeTypeDetails.ChargeAmount == 0)
            //{
            //    mChargeType = ChargeTypes.NotApplicable;
            //    lblHeader.Text = "Not Applicable";
            //    lblChargeType.Visible = false;
            //}
            //else
            if (clsChargeTypeDetails.InPercent)
            {
                mChargeType           = ChargeTypes.Percentage;
                lblHeader.Text        = clsChargeTypeDetails.ChargeType + ": Percentage Charge";
                lblChargeType.Visible = true;
            }
            else
            {
                mChargeType           = ChargeTypes.FixedValue;
                lblHeader.Text        = clsChargeTypeDetails.ChargeType + ": Amount Charge";
                lblChargeType.Visible = false;
            }

            txtAmount.Text = clsChargeTypeDetails.ChargeAmount.ToString("#,##0.#0");
        }
Ejemplo n.º 2
0
        private void LoadOptions()
        {
            if (mChargeType == ChargeTypes.Percentage)
            {
                lblHeader.Text        = "Percentage Charge";
                lblChargeType.Visible = true;
            }
            else
            {
                lblHeader.Text        = "Amount Charge";
                lblChargeType.Visible = false;
            }

            txtAmount.Text        = mdecChargeAmount.ToString("#,##0.#0");
            lblBalanceAmount.Text = mdecBalanceAmount.ToString("#,##0.#0");

            lblDescription.Text = "Current Balance to be paid.";

            cboChargeType.Items.Clear();
            Data.ChargeType clsCharge = new Data.ChargeType();
            foreach (System.Data.DataRow dr in clsCharge.ListAsDataTable().Rows)
            {
                cboChargeType.Items.Add(dr["ChargeTypeCode"]);
            }
            clsCharge.CommitAndDispose();

            if (mChargeCode != null & mChargeCode != "")
            {
                cboChargeType.SelectedIndex = cboChargeType.Items.IndexOf(mChargeCode);
            }
            else
            {
                cboChargeType.SelectedIndex = cboChargeType.Items.Count - 1;
            }
            txtRemarks.Text = mRemarks;
            if (mbolIsChargeEditable == true)
            {
                txtAmount.Enabled = true; txtAmount.Focus();
            }
        }
Ejemplo n.º 3
0
        private void cboChargeType_SelectedIndexChanged(object sender, EventArgs e)
        {
            Data.ChargeType clsCharge = new Data.ChargeType();
            Data.ChargeTypeDetails clsChargeTypeDetails = clsCharge.Details(cboChargeType.SelectedItem.ToString());
            clsCharge.CommitAndDispose();

            //if (clsChargeTypeDetails.ChargeAmount == 0)
            //{
            //    mChargeType = ChargeTypes.NotApplicable;
            //    lblHeader.Text = "Not Applicable";
            //    lblChargeType.Visible = false;
            //}
            //else 
            if (clsChargeTypeDetails.InPercent)
            {
                mChargeType = ChargeTypes.Percentage;
                lblHeader.Text = clsChargeTypeDetails.ChargeType + ": Percentage Charge";
                lblChargeType.Visible = true;
            }
            else
            {
                mChargeType = ChargeTypes.FixedValue;
                lblHeader.Text = clsChargeTypeDetails.ChargeType + ": Amount Charge";
                lblChargeType.Visible = false;
            }

            txtAmount.Text = clsChargeTypeDetails.ChargeAmount.ToString("#,##0.#0");
        }
Ejemplo n.º 4
0
		private void LoadOptions() 
		{
			if (mChargeType == ChargeTypes.Percentage)
			{
				lblHeader.Text = "Percentage Charge";
				lblChargeType.Visible = true;
			}
			else
			{
				lblHeader.Text = "Amount Charge";
				lblChargeType.Visible = false;
			}

			txtAmount.Text = mdecChargeAmount.ToString("#,##0.#0");
			lblBalanceAmount.Text = mdecBalanceAmount.ToString("#,##0.#0");
			
			lblDescription.Text = "Current Balance to be paid.";

			cboChargeType.Items.Clear();
			Data.ChargeType clsCharge = new Data.ChargeType();
			foreach (System.Data.DataRow dr in clsCharge.ListAsDataTable().Rows)
			{
				cboChargeType.Items.Add(dr["ChargeTypeCode"]);
			}
			clsCharge.CommitAndDispose();

			if (mChargeCode != null & mChargeCode != "")
				cboChargeType.SelectedIndex = cboChargeType.Items.IndexOf(mChargeCode);
			else 
			{
				cboChargeType.SelectedIndex = cboChargeType.Items.Count - 1;
			}
			txtRemarks.Text = mRemarks;
            if (mbolIsChargeEditable == true) { txtAmount.Enabled = true; txtAmount.Focus(); }
		}
Ejemplo n.º 5
0
        private void LoadTransaction(string stTransactionNo, string pstrTerminalNo)
		{
			Cursor.Current = Cursors.WaitCursor;
			try
			{
				clsEvent.AddEvent("Loading transaction : " + stTransactionNo);

				Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

				mclsSalesTransactionDetails = clsSalesTransactions.Details(stTransactionNo, pstrTerminalNo, mclsTerminalDetails.BranchID);

                if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Open ||
                    mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Suspended)
                {
                    // Aug 6, 2011 : Lemu
                    // overwrite to change cashierid and name
                    try { mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag); }
                    catch { }
                    mclsSalesTransactionDetails.CashierName = lblCashier.Text;

                    // Jan 31, 2015 : Lemu
                    // put to SuspendedOpen so that it won't be open somewhere else
                    if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Suspended)
                    {
                        clsEvent.AddEvent("Putting transaction SuspendedOpen: " + stTransactionNo, true);
                        clsSalesTransactions.UpdateTransactionToSuspendedOpen(mclsSalesTransactionDetails.TransactionID);
                    }
                }

				Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
				Data.ContactDetails clsContactDetails = clsContact.Details(mclsSalesTransactionDetails.CustomerID);
				LoadContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER, clsContactDetails);

				//mclsSalesTransactionDetails.RewardCardNo = clsContactDetails.RewardDetails.RewardCardNo;
				//mclsSalesTransactionDetails.RewardCardExpiry = clsContactDetails.RewardDetails.ExpiryDate;
				//mclsSalesTransactionDetails.RewardPreviousPoints = clsContactDetails.RewardDetails.RewardPoints;

                if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Refund || mclsSalesTransactionDetails.TransactionType == TransactionTypes.POSRefund)
				{
					mboIsRefund = true;
					lblSubtotalName.Text = "SUBTOTAL: REFUND";
					lblOrderType.Visible = false;
				}
				lblTransNo.Text = mclsSalesTransactionDetails.TransactionNo;
				lblTransNo.Tag = mclsSalesTransactionDetails.TransactionID.ToString();
				lblCustomer.Text = mclsSalesTransactionDetails.CustomerName;
				lblCustomer.Tag = mclsSalesTransactionDetails.CustomerID.ToString();
				lblAgent.Text = mclsSalesTransactionDetails.AgentName;
				lblAgent.Tag = mclsSalesTransactionDetails.AgentID.ToString();
				lblAgentPositionDepartment.Text = mclsSalesTransactionDetails.AgentPositionName;
				lblAgentPositionDepartment.Tag = mclsSalesTransactionDetails.AgentDepartmentName;
				grpItems.Text = "Served by: " + mclsSalesTransactionDetails.WaiterName;
				grpItems.Tag = mclsSalesTransactionDetails.WaiterID;

				lblTransDate.Text = mclsSalesTransactionDetails.TransactionDate.ToString("MMM. dd, yyyy hh:mm:ss tt");
                mdteOverRidingPrintDate = mclsSalesTransactionDetails.TransactionDate;

				lblTransDiscount.Tag = mclsSalesTransactionDetails.TransDiscountType.ToString("d");
                lblConsignment.Visible = mclsSalesTransactionDetails.isConsignment;

                //mclsSalesTransactionDetails.ChargeAmount = mclsSalesTransactionDetails.ChargeAmount;
                if (mclsSalesTransactionDetails.ChargeAmount == 0)
                    lblTransCharge.Tag = ChargeTypes.NotApplicable.ToString("d"); //details.TransDiscountType.ToString("d");
                else
                {
                    //lblTransCharge.Tag = ChargeTypes.Percentage.ToString("d"); //details.TransDiscountType.ToString("d");
                    Data.ChargeType clsChargeType = new Data.ChargeType(mConnection, mTransaction);
                    bool bolInPercent = clsChargeType.Details(mclsSalesTransactionDetails.ChargeCode).InPercent;
                    clsChargeType.CommitAndDispose();

                    if (bolInPercent)
                        lblTransCharge.Tag = ChargeTypes.Percentage.ToString("d");
                    else
                        lblTransCharge.Tag = ChargeTypes.FixedValue.ToString("d");
                }

				Data.SalesTransactionItems clsItems = new Data.SalesTransactionItems(mConnection, mTransaction);
                mConnection = clsItems.Connection; mTransaction = clsItems.Transaction;

				Data.SalesTransactionItemDetails[] TransactionItems = clsItems.Details(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TransactionDate);

				clsEvent.AddEventLn("Done loading transaction : " + stTransactionNo, true);

                if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto)
					LoadResumedItems(TransactionItems, true);
				else
					LoadResumedItems(TransactionItems, false);

				mboIsInTransaction = true;

                clsSalesTransactions.CommitAndDispose();
			}
			catch (Exception ex)
			{
				InsertErrorLogToFile(ex, "ERROR!!! Loading transaction. TRACE: ");
			}
			Cursor.Current = Cursors.Default;
		}
Ejemplo n.º 6
0
		private void ChangeOrderType()
		{
			if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto && mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot change Order Type if Auto-print is ON an item is already purchased.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}
			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.CloseTransaction, "Change Order Type");

            if (loginresult == DialogResult.OK)
			{
				try
				{
					clsEvent.AddEvent("[" + lblCashier.Text + "] Changing order type of trans. no. " + lblTransNo.Text);

                    OrderTypeWnd clsOrderTypeWnd = new OrderTypeWnd();
                    clsOrderTypeWnd.TerminalDetails = mclsTerminalDetails;
                    clsOrderTypeWnd.ShowDialog(this);
                    DialogResult result = clsOrderTypeWnd.Result;
                    OrderTypes clsOrderType = clsOrderTypeWnd.orderType;
                    clsOrderTypeWnd.Close();
                    clsOrderTypeWnd.Dispose();

					if (result == DialogResult.OK)
					{
						Cursor.Current = Cursors.WaitCursor;
						if (!mboIsInTransaction)
						{
							this.LoadOptions();
							if (!this.CreateTransaction()) return;
						}

                        mclsSalesTransactionDetails.OrderType = clsOrderType;

                        Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                        mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                        clsSalesTransactions.UpdateOrderType(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.OrderType);
                        InsertAuditLog(AccessTypes.ChargeType, "Change order type to " + mclsSalesTransactionDetails.OrderType.ToString("G") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                        clsEvent.AddEventLn("Done!", true);

                        if (clsOrderType != OrderTypes.DineIn && mclsSalesTransactionDetails.CustomerID == Constants.C_RETAILPLUS_CUSTOMERID)
                        {
                            Int64 iOldContactID = mclsSalesTransactionDetails.CustomerID;

                            SelectContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER);

                            if (iOldContactID != mclsSalesTransactionDetails.CustomerID)
                            {
                                Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction);
                                mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction;
                                clsContacts.UpdateLastCheckInDate(iOldContactID, Constants.C_DATE_MIN_VALUE);
                                clsContacts.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, mclsSalesTransactionDetails.TransactionDate);
                                clsContacts.CommitAndDispose();
                            }
                        }
                        if (mclsSalesTransactionDetails.CustomerID == Constants.C_RETAILPLUS_CUSTOMERID)
                        {
                            mclsSalesTransactionDetails.OrderType = OrderTypes.DineIn;

                            clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                            clsSalesTransactions.UpdateOrderType(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.OrderType);
                            InsertAuditLog(AccessTypes.ChargeType, "System override order type to " + mclsSalesTransactionDetails.OrderType.ToString("G") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);

                        }

                        clsSalesTransactions.CommitAndDispose();

                        lblOrderType.Text = mclsSalesTransactionDetails.OrderType.ToString("G").ToUpper();

                        // [09/24/2014] apply the default charge if changed to dine in

                        Data.ChargeType clsChargeType = new Data.ChargeType(mConnection, mTransaction);
                        mConnection = clsChargeType.Connection; mTransaction = clsChargeType.Transaction;

                        Data.ChargeTypeDetails clsChargeTypeDetails = new Data.ChargeTypeDetails();
                        if (mclsSalesTransactionDetails.OrderType == OrderTypes.DineIn && !string.IsNullOrEmpty(mclsTerminalDetails.DineInChargeCode))
                        {
                            clsChargeTypeDetails = clsChargeType.Details(mclsTerminalDetails.DineInChargeCode);
                            setTransCharge(clsChargeTypeDetails, "Change Order Type to Dine-In. Charge Code:" + mclsTerminalDetails.DineInChargeCode);
                        }
                        else if (mclsSalesTransactionDetails.OrderType == OrderTypes.TakeOut && !string.IsNullOrEmpty(mclsTerminalDetails.TakeOutChargeCode))
                        {
                            clsChargeTypeDetails = clsChargeType.Details(mclsTerminalDetails.TakeOutChargeCode);
                            setTransCharge(clsChargeTypeDetails, "Change Order Type to Take-Out. Charge Code:" + mclsTerminalDetails.TakeOutChargeCode);
                        }
                        else if (mclsSalesTransactionDetails.OrderType == OrderTypes.Delivery && !string.IsNullOrEmpty(mclsTerminalDetails.DeliveryChargeCode))
                        {
                            clsChargeTypeDetails = clsChargeType.Details(mclsTerminalDetails.DeliveryChargeCode);
                            setTransCharge(clsChargeTypeDetails, "Change Order Type to Delivery. Charge Code:" + mclsTerminalDetails.DeliveryChargeCode);
                        }
                        else
                        {
                            ApplyTransZeroCharge();
                        }

                        clsChargeType.CommitAndDispose();
                    }
                    else { clsEvent.AddEventLn("Cancelled!"); }
				}
				catch (Exception ex)
				{ 
                    InsertErrorLogToFile(ex, "ERROR!!! Changing order type."); 
                }
				Cursor.Current = Cursors.Default;
			}
		}
Ejemplo n.º 7
0
        private void ApplyTransDefaultCharge()
        {
            // must be called only during creation of transaction
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (!string.IsNullOrEmpty(mclsTerminalDetails.DefaultTransactionChargeCode))
                {
                    clsEvent.AddEvent("[" + lblCashier.Text + "] Applying default transaction Charge for trans. no. " + lblTransNo.Text + ".");

                    Data.ChargeType clsChargeType = new Data.ChargeType(mConnection, mTransaction);
                    mConnection = clsChargeType.Connection; mTransaction = clsChargeType.Transaction;

                    Data.ChargeTypeDetails clsChargeTypeDetails = clsChargeType.Details(mclsTerminalDetails.DefaultTransactionChargeCode);

                    setTransCharge(clsChargeTypeDetails, "Default Transaction Charge Code: " + mclsTerminalDetails.DefaultTransactionChargeCode);

                    clsChargeType.CommitAndDispose();

                    InsertAuditLog(AccessTypes.ChargeType, "Apply transaction Charge for " + mclsSalesTransactionDetails.Charge.ToString("#,###.#0") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode + ". DefaultTransactionCharge:" + mclsTerminalDetails.DefaultTransactionChargeCode);

                    clsEvent.AddEventLn("Done! amount=" + mclsSalesTransactionDetails.Charge.ToString("#,###.#0"));
                }
            }
            catch (Exception ex)
            {
                InsertErrorLogToFile(ex, "ERROR!!! Applying default transaction charge.");
            }
            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 8
0
        private void ResumeClosedTransaction()
        {
            if (!SuspendTransactionAndContinue()) return;

            DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ResumeClosedTransaction);

            if (loginresult == DialogResult.OK)
            {
                try
                {
                    ResumeTransactionWnd ResumeWnd = new ResumeTransactionWnd();
                    ResumeWnd.TerminalDetails = mclsTerminalDetails;
                    ResumeWnd.CashierID = mclsSalesTransactionDetails.CashierID;
                    ResumeWnd.TransactionStatusToList = AceSoft.RetailPlus.TransactionStatus.Closed;
                    ResumeWnd.ShowDialog(this);
                    DialogResult result = ResumeWnd.Result;
                    Data.SalesTransactionDetails details = ResumeWnd.Details;
                    ResumeWnd.Close();
                    ResumeWnd.Dispose();

                    if (result == DialogResult.OK)
                    {
                        if (details.TransactionStatus != TransactionStatus.Closed)
                        {
                            MessageBox.Show("This transaction is not yet Closed, please select another transaction. {Current Status: " + details.TransactionStatus.ToString("G") + "}", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        clsEvent.AddEvent("[" + lblCashier.Text + "] Resuming closed transaction no. " + details.TransactionNo);

                        mclsSalesTransactionDetails = details;

                        if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Refund || mclsSalesTransactionDetails.TransactionType == TransactionTypes.POSRefund)
                        {
                            mboIsRefund = true;
                            lblSubtotalName.Text = "SUBTOTAL: REFUND";
                            lblOrderType.Visible = false;
                        }
                        lblOrderType.Text = mclsSalesTransactionDetails.OrderType.ToString("G").ToUpper();
                        lblTransNo.Text = mclsSalesTransactionDetails.TransactionNo;
                        lblTransNo.Tag = mclsSalesTransactionDetails.TransactionID.ToString();
                        lblCustomer.Text = mclsSalesTransactionDetails.CustomerName;
                        lblCustomer.Tag = mclsSalesTransactionDetails.CustomerID.ToString();
                        lblAgent.Text = mclsSalesTransactionDetails.AgentName;
                        lblAgent.Tag = mclsSalesTransactionDetails.AgentID.ToString();
                        lblAgentPositionDepartment.Text = mclsSalesTransactionDetails.AgentPositionName;
                        lblAgentPositionDepartment.Tag = mclsSalesTransactionDetails.AgentDepartmentName;
                        grpItems.Text = "Served by: " + details.WaiterName;
                        grpItems.Tag = mclsSalesTransactionDetails.WaiterID.ToString();

                        lblTransDate.Text = mclsSalesTransactionDetails.TransactionDate.ToString("MMM. dd, yyyy hh:mm:ss tt");
                        mdteOverRidingPrintDate = mclsSalesTransactionDetails.TransactionDate;

                        lblTransDiscount.Tag = mclsSalesTransactionDetails.TransDiscountType.ToString("d");
                        lblConsignment.Visible = mclsSalesTransactionDetails.isConsignment;

                        if (mclsSalesTransactionDetails.ChargeAmount == 0)
                            lblTransCharge.Tag = ChargeTypes.NotApplicable.ToString("d");
                        else
                        {
                            Data.ChargeType clsChargeType = new Data.ChargeType(mConnection, mTransaction);
                            bool bolInPercent = clsChargeType.Details(mclsSalesTransactionDetails.ChargeCode).InPercent;
                            clsChargeType.CommitAndDispose();

                            if (bolInPercent)
                                lblTransCharge.Tag = ChargeTypes.Percentage.ToString("d");
                            else
                                lblTransCharge.Tag = ChargeTypes.FixedValue.ToString("d");
                        }

                        // Aug 6, 2011 : Lemu
                        // Put here from CloseTransaction
                        try { mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag); }
                        catch { }
                        mclsSalesTransactionDetails.CashierName = lblCashier.Text;

                        LoadResumedItems(details.TransactionItems, false);

                        // 06Mar2015 : reload this, to use for price level
                        Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction);
                        mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction;
                        mclsContactDetails = clsContacts.Details(mclsSalesTransactionDetails.CustomerID);
                        clsContacts.CommitAndDispose();

                        mboIsInTransaction = true;

                        InsertAuditLog(AccessTypes.ResumeClosedTransaction, "Resume closed transaction #: " + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                        clsEvent.AddEventLn("[" + lblCashier.Text + "] Resuming closed transaction no. " + details.TransactionNo + " Done.", true);
                    }
                    else { clsEvent.AddEventLn("Cancelled!"); }
                }
                catch (Exception ex)
                {
                    InsertErrorLogToFile(ex, "ERROR!!! Resuming closed transaction.");
                }
            }
        }
Ejemplo n.º 9
0
		private void ResumeTransaction()
		{
            if (!SuspendTransactionAndContinue()) return;

            // ShowOneTerminalSuspendedTransactions 
            // Only same cashier in same terminal can be resume.
            // if terminalno and cashier is not the same to not allow   
			if (mclsTerminalDetails.ShowOneTerminalSuspendedTransactions)
			{
                Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                int count = clsSalesTransactions.CountSuspended(mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierID, mclsTerminalDetails.BranchID);
                clsSalesTransactions.CommitAndDispose();

				if (count == 0)
				{
					MessageBox.Show("No suspended transaction found for this day.", "RetailPlus", MessageBoxButtons.OK);
					return;
				}
			}

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ResumeTransaction);

			if (loginresult == DialogResult.OK)
			{
				try
				{
					ResumeTransactionWnd ResumeWnd = new ResumeTransactionWnd();
                    ResumeWnd.TerminalDetails = mclsTerminalDetails;
					ResumeWnd.CashierID = mclsSalesTransactionDetails.CashierID;
                    ResumeWnd.TransactionStatusToList = AceSoft.RetailPlus.TransactionStatus.Suspended;
					ResumeWnd.ShowDialog(this);
					DialogResult result = ResumeWnd.Result;
					Data.SalesTransactionDetails details = ResumeWnd.Details;
					ResumeWnd.Close();
					ResumeWnd.Dispose();

					if (result == DialogResult.OK)
					{
                        if (details.TransactionStatus == TransactionStatus.SuspendedOpen)
                        {
                            if (MessageBox.Show("This transaction is already open in another terminal. Please suspend in the other terminal first before opening." + Environment.NewLine + "Would you like to force open this transaction?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                            {
                                return;
                            }
                            else
                            {
                                DialogResult resResumeSuspendedOpenTransaction = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ResumeSuspendedOpenTransaction);

                                if (resResumeSuspendedOpenTransaction != System.Windows.Forms.DialogResult.OK)
                                {
                                    clsEvent.AddEvent("[" + lblCashier.Text + "] Resuming transaction no. " + details.TransactionNo + " cancelled. SuspendedOpen");
                                    return;
                                }
                            }
                        }

						clsEvent.AddEvent("[" + lblCashier.Text + "] Resuming transaction no. " + details.TransactionNo);

						mclsSalesTransactionDetails = details;

						if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Refund || mclsSalesTransactionDetails.TransactionType == TransactionTypes.POSRefund)
						{
							mboIsRefund = true;
							lblSubtotalName.Text = "SUBTOTAL: REFUND";
							lblOrderType.Visible = false;
						}
						lblOrderType.Text = mclsSalesTransactionDetails.OrderType.ToString("G").ToUpper();
						lblTransNo.Text = mclsSalesTransactionDetails.TransactionNo;
						lblTransNo.Tag = mclsSalesTransactionDetails.TransactionID.ToString();
						lblCustomer.Text = mclsSalesTransactionDetails.CustomerName;
						lblCustomer.Tag = mclsSalesTransactionDetails.CustomerID.ToString();
						lblAgent.Text = mclsSalesTransactionDetails.AgentName;
						lblAgent.Tag = mclsSalesTransactionDetails.AgentID.ToString();
						lblAgentPositionDepartment.Text = mclsSalesTransactionDetails.AgentPositionName;
						lblAgentPositionDepartment.Tag = mclsSalesTransactionDetails.AgentDepartmentName;
						grpItems.Text = "Served by: " + details.WaiterName;
						grpItems.Tag = mclsSalesTransactionDetails.WaiterID.ToString();

						lblTransDate.Text = mclsSalesTransactionDetails.TransactionDate.ToString("MMM. dd, yyyy hh:mm:ss tt");
                        mdteOverRidingPrintDate = mclsSalesTransactionDetails.TransactionDate;

						lblTransDiscount.Tag = mclsSalesTransactionDetails.TransDiscountType.ToString("d");
                        lblConsignment.Visible = mclsSalesTransactionDetails.isConsignment;

                        if (mclsSalesTransactionDetails.ChargeAmount == 0)
                            lblTransCharge.Tag = ChargeTypes.NotApplicable.ToString("d");
                        else
                        {
                            Data.ChargeType clsChargeType = new Data.ChargeType(mConnection, mTransaction);
                            bool bolInPercent = clsChargeType.Details(mclsSalesTransactionDetails.ChargeCode).InPercent;
                            clsChargeType.CommitAndDispose();

                            if (bolInPercent)
                                lblTransCharge.Tag = ChargeTypes.Percentage.ToString("d");
                            else
                                lblTransCharge.Tag = ChargeTypes.FixedValue.ToString("d");
                        }

						// Aug 6, 2011 : Lemu
						// Put here from CloseTransaction
						try { mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag); }
						catch { }
						mclsSalesTransactionDetails.CashierName = lblCashier.Text;

						LoadResumedItems(details.TransactionItems, false);

                        // Jan 31, 2015 : Lemu
                        // put back to SuspendedOpen so that it won't be open somewhere else
                        if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Suspended)
                        {
                            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;
                            clsEvent.AddEvent("Putting transaction SuspendedOpen: " + mclsSalesTransactionDetails.TransactionNo, true);
                            clsSalesTransactions.UpdateTransactionToSuspendedOpen(mclsSalesTransactionDetails.TransactionID);
                            clsSalesTransactions.CommitAndDispose();
                        }

                        // 06Mar2015 : reload this, to use for price level
                        Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction);
                        mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction;
                        mclsContactDetails = clsContacts.Details(mclsSalesTransactionDetails.CustomerID);
                        clsContacts.CommitAndDispose();

						mboIsInTransaction = true;

						InsertAuditLog(AccessTypes.ResumeTransaction, "Resume transaction #: " + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
						clsEvent.AddEventLn("[" + lblCashier.Text + "] Resuming transaction no. " + details.TransactionNo + " Done.", true);
					}
					else { clsEvent.AddEventLn("Cancelled!"); }


				}
				catch (Exception ex)
				{ 
                    InsertErrorLogToFile(ex, "ERROR!!! Resuming transaction."); 
                }
			}
		}