Beispiel #1
0
        private void ChangeZeroRated(bool isZeroRated)
        {
            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);

            if (loginresult == DialogResult.OK)
            {
                try
                {
                    clsEvent.AddEvent("[" + lblCashier.Text + "] Changing ZeroRated. " + lblTransNo.Text + " as " + isZeroRated.ToString());

                    mclsSalesTransactionDetails.isZeroRated = isZeroRated;

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

                    clsSalesTransactions.UpdateisZeroRated(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.isZeroRated);

                    ComputeSubTotal();
                    clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType);

                    InsertAuditLog(AccessTypes.ChargeType, "Change zerorated type to " + mclsSalesTransactionDetails.isZeroRated.ToString() + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                    clsEvent.AddEventLn("Done!", true);
                    clsSalesTransactions.CommitAndDispose();
                }
                catch (Exception ex)
                {
                    InsertErrorLogToFile(ex, "ERROR!!! Changing zero rated type.");
                }
                Cursor.Current = Cursors.Default;
            }
        }
Beispiel #2
0
		private void AddItem(Data.SalesTransactionItemDetails clsItemDetails)
		{
			try
			{
                clsItemDetails.ItemNo = Convert.ToString(ItemDataTable.Rows.Count + 1);
                clsItemDetails.TransactionDate = mclsSalesTransactionDetails.TransactionDate;
                clsItemDetails.PaxNo = 0;

				clsItemDetails = ApplyPromo(clsItemDetails);
                clsItemDetails = ComputeItemTotal(clsItemDetails); // set the grossales, vat, discounts, etc.

				System.Data.DataRow dr = ItemDataTable.NewRow();
				dr = setCurrentRowItemDetails(dr, clsItemDetails);

				clsItemDetails.TransactionItemsID = AddItemToDB(clsItemDetails);
				dr["TransactionItemsID"] = clsItemDetails.TransactionItemsID;

				// Added May 7, 2011 to Cater Reserved and Commit functionality    
				ReservedAndCommitItem(clsItemDetails, clsItemDetails.TransactionItemStatus);

				try { dgItems.UnSelect(dgItems.CurrentRowIndex); }
				catch { }

				ItemDataTable.Rows.Add(dr);
                mclsSalesTransactionDetails.TransactionItemsList.Add(clsItemDetails);

				dgItems.CurrentRowIndex = ItemDataTable.Rows.Count;
				try
				{
					dgItems.Select(dgItems.CurrentRowIndex);
					dgItems.CurrentRowIndex = dgItems.CurrentRowIndex;
				}
				catch { }

				SetItemDetails();
				ComputeSubTotal(); setTotalDetails();

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

                clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType);
                clsSalesTransactions.CommitAndDispose();

				try
				{
					DisplayItemToTurretDelegate DisplayItemToTurretDel = new DisplayItemToTurretDelegate(DisplayItemToTurret);
					DisplayItemToTurretDel.BeginInvoke(clsItemDetails.ProductCode, clsItemDetails.ProductUnitCode, clsItemDetails.Quantity, clsItemDetails.Price, clsItemDetails.Discount, clsItemDetails.PromoApplied, clsItemDetails.Amount, clsItemDetails.VAT, clsItemDetails.EVAT, null, null);
				}
				catch { }
				if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto)
				{
					PrintItemDelegate PrintItemDel = new PrintItemDelegate(PrintItem);
					PrintItemDel.BeginInvoke(clsItemDetails.ItemNo, clsItemDetails.ProductCode, clsItemDetails.ProductUnitCode, clsItemDetails.Quantity, clsItemDetails.Price, clsItemDetails.Discount, clsItemDetails.PromoApplied, clsItemDetails.Amount, clsItemDetails.VAT, clsItemDetails.EVAT, clsItemDetails.DiscountCode, clsItemDetails.ItemDiscountType, null, null);
				}
			}
			catch (Exception ex)
			{
				InsertErrorLogToFile(ex, "ERROR!!! Adding sales item. TRACE: ");
				throw ex;
			}
		}
Beispiel #3
0
        private void setTransCharge(Data.ChargeTypeDetails ChargeTypeDetails, string Remarks)
        {
            try
            {
                mclsSalesTransactionDetails.ChargeAmount = ChargeTypeDetails.ChargeAmount;
                mclsSalesTransactionDetails.ChargeCode = ChargeTypeDetails.ChargeTypeCode;
                mclsSalesTransactionDetails.ChargeRemarks = Remarks;

                if (ChargeTypeDetails.ChargeAmount == 0)
                    mclsSalesTransactionDetails.ChargeType = ChargeTypes.NotApplicable;
                else if (ChargeTypeDetails.InPercent)
                    mclsSalesTransactionDetails.ChargeType = ChargeTypes.Percentage;
                else
                    mclsSalesTransactionDetails.ChargeType = ChargeTypes.FixedValue;

                ComputeSubTotal(); setTotalDetails();

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

                clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType);
                clsSalesTransactions.CommitAndDispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #4
0
        private void ApplyTransCharge()
        {
            int iRow = dgItems.CurrentRowIndex;
            if (iRow < 0) return;

            if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto && mboIsInTransaction)
            {
                MessageBox.Show("Sorry you cannot apply a transaction Charge if Auto-print is ON an item is already purchased.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ChargeType);

            if (loginresult == DialogResult.OK)
            {
                try
                {
                    clsEvent.AddEvent("[" + lblCashier.Text + "] Applying transaction Charge for trans. no. " + lblTransNo.Text);

                BackToCharge:
                    ChargeTypes TransChargeType = mclsSalesTransactionDetails.ChargeType;
                    ChargeWnd charge = new ChargeWnd();
                    charge.TerminalDetails = mclsTerminalDetails;
                    charge.BalanceAmount = mclsSalesTransactionDetails.SubTotal;
                    charge.ChargeType = TransChargeType;
                    charge.ChargeAmount = mclsSalesTransactionDetails.ChargeAmount;
                    charge.ChargeCode = mclsSalesTransactionDetails.ChargeCode;
                    charge.Remarks = mclsSalesTransactionDetails.ChargeRemarks;
                    charge.IsChargeEditable = mclsTerminalDetails.IsChargeEditable;
                    charge.ShowDialog(this);
                    DialogResult result = charge.Result;
                    decimal ChargeAmount = charge.ChargeAmount;
                    string TransChargeCode = charge.ChargeCode;
                    string TransChargeRemarks = charge.Remarks;
                    TransChargeType = charge.ChargeType;
                    charge.Close();
                    charge.Dispose();

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

                        decimal OldCharge = mclsSalesTransactionDetails.ChargeAmount;
                        ChargeTypes OldTransChargeType = mclsSalesTransactionDetails.ChargeType;

                        mclsSalesTransactionDetails.ChargeAmount = ChargeAmount;
                        mclsSalesTransactionDetails.ChargeCode = TransChargeCode;
                        mclsSalesTransactionDetails.ChargeRemarks = TransChargeRemarks;
                        mclsSalesTransactionDetails.ChargeType = TransChargeType;

                        ComputeSubTotal(); setTotalDetails();

                        if (mclsSalesTransactionDetails.Discount <= mclsSalesTransactionDetails.DiscountableAmount)
                        {
                            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                            clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType);
                            clsSalesTransactions.CommitAndDispose();

                            InsertAuditLog(AccessTypes.ChargeType, "Apply transaction Charge for " + mclsSalesTransactionDetails.Charge.ToString("#,###.#0") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                        }
                        else
                        {
                            MessageBox.Show("Sorry the input Charge will yield a less than ZERO amount. Please type another Charge.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                            mclsSalesTransactionDetails.ChargeAmount = OldCharge;
                            mclsSalesTransactionDetails.ChargeType = OldTransChargeType;

                            ComputeSubTotal(); setTotalDetails();
                            goto BackToCharge;
                        }

                        clsEvent.AddEventLn("Done! amount=" + mclsSalesTransactionDetails.Charge.ToString("#,###.#0"));
                    }
                    else { clsEvent.AddEventLn("Cancelled!"); }
                }
                catch (Exception ex)
                {
                    InsertErrorLogToFile(ex, "ERROR!!! Applying transaction charge.");
                }
                Cursor.Current = Cursors.Default;
            }
        }
Beispiel #5
0
		private void ApplyTransDiscount()
		{
			if (ItemDataTable.Rows.Count <= 0) return;

			if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto && mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot apply a transaction discount if Auto-print is ON an item is already purchased.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}
			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ApplyTransDiscount);

			if (loginresult == DialogResult.OK)
			{
				//mboIsDiscountAuthorized = true;
				try
				{
					clsEvent.AddEvent("[" + lblCashier.Text + "] Applying transaction discount for trans. no. " + lblTransNo.Text);

				Back:
					DiscountTypes TransDiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), lblTransDiscount.Tag.ToString());
					DiscountWnd discount = new DiscountWnd();
					discount.Header = "Apply Transaction Discount"; 
					discount.BalanceAmount = mclsSalesTransactionDetails.SubTotal;
					discount.DiscountType = TransDiscountType;
					discount.DiscountAmount = mclsSalesTransactionDetails.TransDiscount;
					discount.DiscountCode = mclsSalesTransactionDetails.DiscountCode;
					discount.Remarks = mclsSalesTransactionDetails.DiscountRemarks;
					discount.IsDiscountEditable = mclsTerminalDetails.IsDiscountEditable;
                    discount.TerminalDetails = mclsTerminalDetails;
                    //discount.DisableVATExempt = false;
					discount.ShowDialog(this);
					DialogResult result = discount.Result;
					decimal DiscountAmount = discount.DiscountAmount;
					string TransDiscountCode = discount.DiscountCode;
					string TransDiscountRemarks = discount.Remarks;
					TransDiscountType = discount.DiscountType;
					discount.Close();
					discount.Dispose();

					if (result == DialogResult.OK)
					{
                        if (mclsSalesTransactionDetails.ItemsDiscount > 0)
                        {
                            MessageBox.Show("Sorry you cannot use the Senior Citizen, another discount is already applied to an item. Please separate the transaction for items with senior citizen discount.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                            return;
                        }

						int iCurrentSelectedRow = dgItems.CurrentRowIndex;

						Cursor.Current = Cursors.WaitCursor;
						if (!mboIsInTransaction) //false ito
						{
							this.LoadOptions();
							if (!this.CreateTransaction()) return;
						}

						decimal OldDiscount = mclsSalesTransactionDetails.TransDiscount;
						string OldTransDiscountType = lblTransDiscount.Tag.ToString();

						if (TransDiscountType == DiscountTypes.NotApplicable)
						{
							lblTransDiscount.Text = "Less 0% / 0.00";
						}
						lblTransDiscount.Tag = TransDiscountType.ToString("d");
						mclsSalesTransactionDetails.TransDiscountType = TransDiscountType;
						mclsSalesTransactionDetails.TransDiscount = DiscountAmount;
						mclsSalesTransactionDetails.DiscountCode = TransDiscountCode;
						mclsSalesTransactionDetails.DiscountRemarks = TransDiscountRemarks;

						ComputeSubTotal(); setTotalDetails();

						if (mclsSalesTransactionDetails.Discount <= mclsSalesTransactionDetails.DiscountableAmount)
						{
							Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                            clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType);
                            clsSalesTransactions.CommitAndDispose();

                            InsertAuditLog(AccessTypes.Discounts, "Apply transaction discount for " + mclsSalesTransactionDetails.Discount.ToString("#,###.#0") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
						}
						else
						{
							MessageBox.Show("Sorry the input discount will yield a less than ZERO amount. Please type another discount.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
							mclsSalesTransactionDetails.TransDiscount = OldDiscount;
							lblTransDiscount.Tag = OldTransDiscountType;

							ComputeSubTotal(); setTotalDetails();
							goto Back;
						}
						dgItems.Select(iCurrentSelectedRow);
						clsEvent.AddEventLn("Done! " + mclsSalesTransactionDetails.DiscountCode + " amount=" + mclsSalesTransactionDetails.Discount.ToString("#,###.#0"), true);
					}
					else { clsEvent.AddEventLn("Cancelled!"); }
				}
				catch (Exception ex)
				{ 
                    InsertErrorLogToFile(ex, "ERROR!!! Applying transaction discount."); 
                }
				Cursor.Current = Cursors.Default;
			}
		}
Beispiel #6
0
		private void ReturnItem()
		{
            if (mboIsRefund || mclsTerminalDetails.IsParkingTerminal)
				return;

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

			if (loginresult == DialogResult.OK)
			{
				TransactionNoWnd clsTransactionNoWnd = new TransactionNoWnd();
				clsTransactionNoWnd.TransactionNoLength = mclsTerminalDetails.TransactionNoLength;
				clsTransactionNoWnd.TerminalNo = mclsTerminalDetails.TerminalNo;
                clsTransactionNoWnd.TerminalDetails = mclsTerminalDetails;
				clsTransactionNoWnd.ShowDialog(this);
				DialogResult result = clsTransactionNoWnd.Result;
                string strTransactionNo = clsTransactionNoWnd.TransactionNo;
                string strTerminalNo = clsTransactionNoWnd.TerminalNo;
				clsTransactionNoWnd.Close();
				clsTransactionNoWnd.Dispose();

				if (result == DialogResult.OK)
				{
					TransactionReturnItemSelectWnd ItemWnd = new TransactionReturnItemSelectWnd();
                    ItemWnd.SysConfigDetails = mclsSysConfigDetails;
					ItemWnd.TransactionNo = strTransactionNo;
					ItemWnd.TerminalDetails = mclsTerminalDetails;
                    ItemWnd.TransactionTerminalNo = strTerminalNo;
					ItemWnd.ShowDialog(this);
					if (ItemWnd.Result == DialogResult.OK)
					{
						Cursor.Current = Cursors.WaitCursor;
						if (!mboIsInTransaction)
						{
							lblTransDate.Text = DateTime.Now.ToString("MMM. dd, yyyy hh:mm:ss tt");
							if (!this.CreateTransaction()) return;
						}

						Data.SalesTransactionItemDetails clsItemDetails = ItemWnd.Details;

                        clsItemDetails = ComputeItemTotal(clsItemDetails); // set the grossales, vat, discounts, etc.

                        clsItemDetails.TransactionItemStatus = TransactionItemStatus.Return;

						System.Data.DataRow dr = ItemDataTable.NewRow();

                        clsItemDetails.TransactionItemStatus = TransactionItemStatus.Return;
                        clsItemDetails.ItemNo = Convert.ToString(ItemDataTable.Rows.Count + 1);

                        dr = setCurrentRowItemDetails(dr, clsItemDetails);

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

                        clsItemDetails.TransactionItemsID = AddItemToDB(clsItemDetails);
                        dr["TransactionItemsID"] = clsItemDetails.TransactionItemsID.ToString();
						
                        // Sep 14, 2013: Removed if return. Return should have no effect in Reserved and Commit
						// Added May 7, 2011 to Cater Reserved and Commit functionality    
						// ReservedAndCommitItem(clsItemDetails, clsItemDetails.TransactionItemStatus);

						ItemDataTable.Rows.Add(dr);
                        mclsSalesTransactionDetails.TransactionItemsList.Add(clsItemDetails);

						dgItems.CurrentRowIndex = ItemDataTable.Rows.Count;
						dgItems.Select(dgItems.CurrentRowIndex);
						SetItemDetails();
						ComputeSubTotal(); setTotalDetails();

                        clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType);
                        clsSalesTransactions.CommitAndDispose();

                        InsertAuditLog(AccessTypes.RefundTransaction, "Return Item " + clsItemDetails.ProductCode + "." + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
						
						try
						{
							DisplayItemToTurretDelegate DisplayItemToTurretDel = new DisplayItemToTurretDelegate(DisplayItemToTurret);
							DisplayItemToTurretDel.BeginInvoke("RET-" + clsItemDetails.ProductCode, clsItemDetails.ProductUnitCode, clsItemDetails.Quantity, clsItemDetails.Price, clsItemDetails.Discount, clsItemDetails.PromoApplied, clsItemDetails.Amount, clsItemDetails.VAT, clsItemDetails.EVAT, null, null);
						}
						catch { }
						if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto)
						{
							PrintItemDelegate PrintItemDel = new PrintItemDelegate(PrintItem);
							string strProductCode = clsItemDetails.ProductCode;
							if (!string.IsNullOrEmpty(clsItemDetails.MatrixDescription)) strProductCode += "-" + clsItemDetails.MatrixDescription;
                            PrintItemDel.BeginInvoke(clsItemDetails.ItemNo, strProductCode + " - RET ", clsItemDetails.ProductUnitCode, clsItemDetails.Quantity, clsItemDetails.Price, clsItemDetails.Discount, clsItemDetails.PromoApplied, clsItemDetails.Amount, clsItemDetails.VAT, clsItemDetails.EVAT, clsItemDetails.DiscountCode, clsItemDetails.ItemDiscountType, null, null);
						}

						
						Cursor.Current = Cursors.Default;
					}

					ItemWnd.Close();
					ItemWnd.Dispose();
				}
			}
		}
Beispiel #7
0
		private void SplitTransaction()
		{
            if (!mboIsInTransaction)
            {
                MessageBox.Show("No active transaction found.", "RetailPlus", MessageBoxButtons.OK);
                return;
            }
            if (mboIsInTransaction)
            {
                
                SplitPaymentSelectWnd payment = new SplitPaymentSelectWnd();
                payment.MainWndTop = cmd1.Location.Y;
                payment.MainWndLeft = cmd10.Location.X + 1;
                payment.ShowDialog(this);
                DialogResult result = payment.Result;
                SplitPaymentTypes SplitPaymentType = payment.SplitPaymentType;
                payment.Close();
                payment.Dispose();

                if (result == DialogResult.OK)
                {
                    decimal decRetValue = 0;
                    Int32 iNoOfDiners = mclsSalesTransactionDetails.PaxNo;

                    if (SplitPaymentType == SplitPaymentTypes.Equally || SplitPaymentType == SplitPaymentTypes.ByAmount)
                    {
                        if (ShowNoControl(this, out decRetValue, decimal.Parse(iNoOfDiners.ToString()), "Enter no. of diners to pay.") == DialogResult.Cancel)
                            return;
                        else
                        {
                            iNoOfDiners = Int32.Parse(decRetValue.ToString());

                            // just close the transaction if it's just 1 dinner
                            if (iNoOfDiners == 1) { CloseTransaction(); return; }
                        }
                    }

                    DialogResult paymentResult = DialogResult.Cancel;
                    Data.SplitPaymentDetails[] clsSplitPaymentDetails;

                    // get the item details
                    Data.SalesTransactionItems clsItems = new Data.SalesTransactionItems();
                    mConnection = clsItems.Connection; mTransaction = clsItems.Transaction;
                    Data.SalesTransactionItemDetails[] TransactionItems = clsItems.Details(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TransactionDate);
                    mclsSalesTransactionDetails.TransactionItems = TransactionItems;
                    clsItems.CommitAndDispose();

                    switch (SplitPaymentType)
                    {
                        case SplitPaymentTypes.Equally:

                            #region Equal payments

                            //insert payment details
                            SplitPaymentEqualWnd clsSplitPaymentEqualWnd = new SplitPaymentEqualWnd();
                            clsSplitPaymentEqualWnd.TerminalDetails = mclsTerminalDetails;
                            clsSplitPaymentEqualWnd.SysConfigDetails = mclsSysConfigDetails;
                            clsSplitPaymentEqualWnd.CustomerDetails = mclsContactDetails;
                            clsSplitPaymentEqualWnd.SalesTransactionDetails = mclsSalesTransactionDetails;
                            clsSplitPaymentEqualWnd.CreditCardSwiped = mboCreditCardSwiped;
                            clsSplitPaymentEqualWnd.IsRefund = mboIsRefund;
                            clsSplitPaymentEqualWnd.IsCreditChargeExcluded = false; //mTopItemDetails.IsCreditChargeExcluded;
                            clsSplitPaymentEqualWnd.NoOfDiners = iNoOfDiners;
                            clsSplitPaymentEqualWnd.ShowDialog(this);
                            paymentResult = clsSplitPaymentEqualWnd.Result;
                            clsSplitPaymentDetails = clsSplitPaymentEqualWnd.arrSplitPaymentDetails;
                            clsSplitPaymentEqualWnd.Close();
                            clsSplitPaymentEqualWnd.Dispose();

                            if (paymentResult == DialogResult.OK)
                            {
                                //save the old in a temp Details
                                Data.SalesTransactionDetails tmpSalesTransactionDetails = mclsSalesTransactionDetails;

                                LocalDB clsLocalDB = new LocalDB();
                                mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction;

                                // save all the payments made
                                foreach (Data.SplitPaymentDetails det in clsSplitPaymentDetails)
                                {
                                    mclsSalesTransactionDetails = tmpSalesTransactionDetails;
                                    mclsSalesTransactionDetails.TransactionItems = TransactionItems;

                                    decimal decSplitPercentage = mclsSalesTransactionDetails.SubTotal - mclsSalesTransactionDetails.Discount + mclsSalesTransactionDetails.Charge;
                                    decSplitPercentage = det.AmountDue / decSplitPercentage;

                                    SetGridItems();
                                    SetGridItemsWidth();

                                    #region create the transaction
                                    CreateTransaction();
                                    #endregion

                                    #region punch all the items divided by the NoOfDiner

                                    foreach (Data.SalesTransactionItemDetails item in tmpSalesTransactionDetails.TransactionItems)
                                    {
                                        Data.SalesTransactionItemDetails clsDetails = item;
                                        //clsDetails.Amount = item.Amount / iNoOfDiners;
                                        //clsDetails.Price = item.Price / iNoOfDiners;
                                        //clsDetails.PurchasePrice = item.PurchasePrice / iNoOfDiners;
                                        //clsDetails.Discount = item.Discount / iNoOfDiners;
                                        //clsDetails.Quantity = item.Quantity / iNoOfDiners;
                                        //clsDetails.Amount = item.Amount * decSplitPercentage;
                                        //clsDetails.Price = item.Price * decSplitPercentage;
                                        //clsDetails.PurchasePrice = item.PurchasePrice * decSplitPercentage;
                                        //clsDetails.Discount = item.Discount * decSplitPercentage;
                                        clsDetails.Quantity = item.Quantity * decSplitPercentage;

                                        AddItem(clsDetails);
                                    }
                                    #endregion

                                    #region Apply existing discount if required

                                    if (tmpSalesTransactionDetails.Discount != 0)
                                    {
                                        if (tmpSalesTransactionDetails.TransDiscountType == DiscountTypes.NotApplicable)
                                        {
                                            lblTransDiscount.Text = "Less 0% / 0.00";
                                        }
                                        lblTransDiscount.Tag = tmpSalesTransactionDetails.TransDiscountType.ToString("d");
                                        mclsSalesTransactionDetails.TransDiscountType = tmpSalesTransactionDetails.TransDiscountType;
                                        mclsSalesTransactionDetails.TransDiscount = tmpSalesTransactionDetails.TransDiscount;
                                        mclsSalesTransactionDetails.Discount = tmpSalesTransactionDetails.Discount / iNoOfDiners;
                                        mclsSalesTransactionDetails.DiscountableAmount = tmpSalesTransactionDetails.DiscountableAmount / iNoOfDiners;
                                        mclsSalesTransactionDetails.DiscountCode = tmpSalesTransactionDetails.DiscountCode;
                                        mclsSalesTransactionDetails.DiscountRemarks = tmpSalesTransactionDetails.DiscountRemarks;

                                        ComputeSubTotal(); setTotalDetails();

                                        if (mclsSalesTransactionDetails.Discount <= mclsSalesTransactionDetails.DiscountableAmount)
                                        {
                                            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                                            clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType);
                                            clsSalesTransactions.CommitAndDispose();

                                            InsertAuditLog(AccessTypes.Discounts, "Apply transaction discount for " + mclsSalesTransactionDetails.Discount.ToString("#,###.#0") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                                        }
                                    }

                                    #endregion

                                    Data.SalesTransactionItemDetails mTopItemDetails = getCurrentRowItemDetails();

                                    #region close the transaction

                                    // override the customerinformation if it's paid with in-house creditcard
                                    if (det.clsCreditorDetails.ContactID != 0 && det.clsCreditorDetails.ContactID != mclsSalesTransactionDetails.CustomerID)
                                    {
                                        LoadContact(Data.ContactGroupCategory.CUSTOMER, det.clsCreditorDetails);
                                    }

                                    //close then print 1 by 1
                                    CloseTransaction(mTopItemDetails,
                                    det.AmountPaid, det.ChangeAmount, det.BalanceAmount, det.CashPayment, det.ChequePayment,
                                    det.CreditCardPayment, det.CreditPayment, det.CreditChargeAmount, det.DebitPayment,
                                    det.RewardConvertedPayment, det.RewardPointsPayment, det.PaymentType,
                                    det.arrCashPaymentDetails, det.arrChequePaymentDetails, det.arrCreditCardPaymentDetails,
                                    det.arrCreditPaymentDetails, det.arrDebitPaymentDetails);

                                    #endregion

                                    clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog);
                                    this.LoadOptions();
                                }

                                #region void the old transaction

                                mclsSalesTransactionDetails = tmpSalesTransactionDetails;

                                // load the transaction
                                LoadTransaction(tmpSalesTransactionDetails.TransactionNo, tmpSalesTransactionDetails.TerminalNo);

                                clsEvent.AddEventLn("[" + lblCashier.Text + "] Voiding transaction no. " + lblTransNo.Text, true);

                                System.Data.DataTable dt = (System.Data.DataTable)dgItems.DataSource;
                                for (int x = 0; x < dt.Rows.Count; x++)
                                {
                                    dgItems.CurrentRowIndex = x;
                                    Data.SalesTransactionItemDetails Details = getCurrentRowItemDetails();

                                    if (Details.TransactionItemStatus != TransactionItemStatus.Void)
                                    {
                                        Details.TransactionItemStatus = TransactionItemStatus.Void;
                                        ReservedAndCommitItem(Details, Details.TransactionItemStatus);
                                    }
                                }

                                //UpdateTerminalReportDelegate updateterminalDel = new UpdateTerminalReportDelegate(UpdateTerminalReport);
                                UpdateTerminalReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned);

                                //UpdateCashierReportDelegate updatecashierDel = new UpdateCashierReportDelegate(UpdateCashierReport);
                                UpdateCashierReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned);

                                new Data.SalesTransactions(mConnection, mTransaction).Void(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.CashierID, mclsSalesTransactionDetails.CashierName);

                                new Data.SalesTransactions(mConnection, mTransaction).UpdateTerminalNo(mclsSalesTransactionDetails.TransactionID, lblTerminalNo.Text);

                                // Sep 24, 2014 : update back the LastCheckInDate to min date
                                Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                                mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

                                clsContact.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE);

                                InsertAuditLog(AccessTypes.VoidTransaction, "VOID transaction #:" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                                clsEvent.AddEventLn("Done transaction no. " + lblTransNo.Text + " has been void.", true);

                                #endregion

                                clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog);
                                this.LoadOptions();

                                // commit all in the database
                                clsLocalDB.CommitAndDispose();
                            }

                            #endregion
                            break;
                        case SplitPaymentTypes.ByItem:

                            #region Item Payment

                                //insert payment details
                            SplitPaymentItemWnd clsSplitPaymentItemWnd = new SplitPaymentItemWnd();
                            clsSplitPaymentItemWnd.TerminalDetails = mclsTerminalDetails;
                            clsSplitPaymentItemWnd.SysConfigDetails = mclsSysConfigDetails;
                            clsSplitPaymentItemWnd.CustomerDetails = mclsContactDetails;
                            clsSplitPaymentItemWnd.SalesTransactionDetails = mclsSalesTransactionDetails;
                            clsSplitPaymentItemWnd.CreditCardSwiped = mboCreditCardSwiped;
                            clsSplitPaymentItemWnd.IsRefund = mboIsRefund;
                            clsSplitPaymentItemWnd.IsCreditChargeExcluded = false; //mTopItemDetails.IsCreditChargeExcluded;
                            clsSplitPaymentItemWnd.NoOfDiners = iNoOfDiners;
                            clsSplitPaymentItemWnd.SalesTransactionItemDetails = mclsSalesTransactionDetails.TransactionItems;
                            clsSplitPaymentItemWnd.ShowDialog(this);
                            paymentResult = clsSplitPaymentItemWnd.Result;
                            clsSplitPaymentDetails = clsSplitPaymentItemWnd.arrSplitPaymentDetails;
                            clsSplitPaymentItemWnd.Close();
                            clsSplitPaymentItemWnd.Dispose();

                            if (paymentResult == DialogResult.OK)
                            {
                                //save the old in a temp Details
                                Data.SalesTransactionDetails tmpSalesTransactionDetails = mclsSalesTransactionDetails;

                                LocalDB clsLocalDB = new LocalDB();
                                mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction;

                                // save all the payments made
                                foreach (Data.SplitPaymentDetails det in clsSplitPaymentDetails)
                                {
                                    mclsSalesTransactionDetails = tmpSalesTransactionDetails;
                                    mclsSalesTransactionDetails.TransactionItems = TransactionItems;

                                    SetGridItems();
                                    SetGridItemsWidth();

                                    #region create the transaction
                                    CreateTransaction();
                                    #endregion

                                    #region punch all the items for the selected payee

                                    foreach (Data.SalesTransactionItemDetails item in tmpSalesTransactionDetails.TransactionItems)
                                    {
                                        if (item.PaxNo == det.PaxNo)
                                        {
                                            Data.SalesTransactionItemDetails clsDetails = item;
                                            //clsDetails.Amount = item.Amount * decSplitPercentage;
                                            //clsDetails.Price = item.Price * decSplitPercentage;
                                            //clsDetails.PurchasePrice = item.PurchasePrice * decSplitPercentage;
                                            //clsDetails.Discount = item.Discount * decSplitPercentage;
                                            //clsDetails.Quantity = item.Quantity * decSplitPercentage;

                                            AddItem(clsDetails);
                                        }
                                    }
                                    #endregion

                                    #region Apply existing discount if required

                                    if (tmpSalesTransactionDetails.Discount != 0)
                                    {
                                        if (tmpSalesTransactionDetails.TransDiscountType == DiscountTypes.NotApplicable)
                                        {
                                            lblTransDiscount.Text = "Less 0% / 0.00";
                                        }
                                        lblTransDiscount.Tag = tmpSalesTransactionDetails.TransDiscountType.ToString("d");
                                        mclsSalesTransactionDetails.TransDiscountType = tmpSalesTransactionDetails.TransDiscountType;
                                        mclsSalesTransactionDetails.TransDiscount = tmpSalesTransactionDetails.TransDiscount;
                                        mclsSalesTransactionDetails.Discount = tmpSalesTransactionDetails.Discount / iNoOfDiners;
                                        mclsSalesTransactionDetails.DiscountableAmount = tmpSalesTransactionDetails.DiscountableAmount / iNoOfDiners;
                                        mclsSalesTransactionDetails.DiscountCode = tmpSalesTransactionDetails.DiscountCode;
                                        mclsSalesTransactionDetails.DiscountRemarks = tmpSalesTransactionDetails.DiscountRemarks;

                                        ComputeSubTotal(); setTotalDetails();

                                        if (mclsSalesTransactionDetails.Discount <= mclsSalesTransactionDetails.DiscountableAmount)
                                        {
                                            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                                            clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType);
                                            clsSalesTransactions.CommitAndDispose();

                                            InsertAuditLog(AccessTypes.Discounts, "Apply transaction discount for " + mclsSalesTransactionDetails.Discount.ToString("#,###.#0") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                                        }
                                    }

                                    #endregion

                                    Data.SalesTransactionItemDetails mTopItemDetails = getCurrentRowItemDetails();

                                    #region close the transaction

                                    // override the customerinformation if it's paid with in-house creditcard
                                    if (det.clsCreditorDetails.ContactID != 0 && det.clsCreditorDetails.ContactID != mclsSalesTransactionDetails.CustomerID)
                                    {
                                        LoadContact(Data.ContactGroupCategory.CUSTOMER, det.clsCreditorDetails);
                                    }

                                    //close then print 1 by 1
                                    CloseTransaction(mTopItemDetails,
                                    det.AmountPaid, det.ChangeAmount, det.BalanceAmount, det.CashPayment, det.ChequePayment,
                                    det.CreditCardPayment, det.CreditPayment, det.CreditChargeAmount, det.DebitPayment,
                                    det.RewardConvertedPayment, det.RewardPointsPayment, det.PaymentType,
                                    det.arrCashPaymentDetails, det.arrChequePaymentDetails, det.arrCreditCardPaymentDetails,
                                    det.arrCreditPaymentDetails, det.arrDebitPaymentDetails);

                                    #endregion

                                    clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog);
                                    this.LoadOptions();
                                }

                                #region void the old transaction

                                mclsSalesTransactionDetails = tmpSalesTransactionDetails;

                                // load the transaction
                                LoadTransaction(tmpSalesTransactionDetails.TransactionNo, tmpSalesTransactionDetails.TerminalNo);

                                clsEvent.AddEventLn("[" + lblCashier.Text + "] Voiding transaction no. " + lblTransNo.Text, true);

                                System.Data.DataTable dt = (System.Data.DataTable)dgItems.DataSource;
                                for (int x = 0; x < dt.Rows.Count; x++)
                                {
                                    dgItems.CurrentRowIndex = x;
                                    Data.SalesTransactionItemDetails Details = getCurrentRowItemDetails();

                                    if (Details.TransactionItemStatus != TransactionItemStatus.Void)
                                    {
                                        Details.TransactionItemStatus = TransactionItemStatus.Void;
                                        ReservedAndCommitItem(Details, Details.TransactionItemStatus);
                                    }
                                }

                                //UpdateTerminalReportDelegate updateterminalDel = new UpdateTerminalReportDelegate(UpdateTerminalReport);
                                UpdateTerminalReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned);

                                //UpdateCashierReportDelegate updatecashierDel = new UpdateCashierReportDelegate(UpdateCashierReport);
                                UpdateCashierReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned);

                                new Data.SalesTransactions(mConnection, mTransaction).Void(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.CashierID, mclsSalesTransactionDetails.CashierName);

                                new Data.SalesTransactions(mConnection, mTransaction).UpdateTerminalNo(mclsSalesTransactionDetails.TransactionID, lblTerminalNo.Text);

                                // Sep 24, 2014 : update back the LastCheckInDate to min date
                                Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                                mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

                                clsContact.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE);

                                InsertAuditLog(AccessTypes.VoidTransaction, "VOID transaction #:" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                                clsEvent.AddEventLn("Done transaction no. " + lblTransNo.Text + " has been void.", true);

                                #endregion

                                clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog);
                                this.LoadOptions();

                                // commit all in the database
                                clsLocalDB.CommitAndDispose();
                            }

                            #endregion
                            break;
                        case SplitPaymentTypes.ByAmount:

                            #region Amount Payments

                                //insert payment details
                            SplitPaymentAmountWnd clsSplitPaymentAmountWnd = new SplitPaymentAmountWnd();
                            clsSplitPaymentAmountWnd.TerminalDetails = mclsTerminalDetails;
                            clsSplitPaymentAmountWnd.SysConfigDetails = mclsSysConfigDetails;
                            clsSplitPaymentAmountWnd.CustomerDetails = mclsContactDetails;
                            clsSplitPaymentAmountWnd.SalesTransactionDetails = mclsSalesTransactionDetails;
                            clsSplitPaymentAmountWnd.CreditCardSwiped = mboCreditCardSwiped;
                            clsSplitPaymentAmountWnd.IsRefund = mboIsRefund;
                            clsSplitPaymentAmountWnd.IsCreditChargeExcluded = false; //mTopItemDetails.IsCreditChargeExcluded;
                            clsSplitPaymentAmountWnd.NoOfDiners = iNoOfDiners;
                            clsSplitPaymentAmountWnd.ShowDialog(this);
                            paymentResult = clsSplitPaymentAmountWnd.Result;
                            clsSplitPaymentDetails = clsSplitPaymentAmountWnd.arrSplitPaymentDetails;
                            clsSplitPaymentAmountWnd.Close();
                            clsSplitPaymentAmountWnd.Dispose();

                            if (paymentResult == DialogResult.OK)
                            {
                                //save the old in a temp Details
                                Data.SalesTransactionDetails tmpSalesTransactionDetails = mclsSalesTransactionDetails;

                                LocalDB clsLocalDB = new LocalDB();
                                mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction;

                                // save all the payments made
                                foreach (Data.SplitPaymentDetails det in clsSplitPaymentDetails)
                                {
                                    mclsSalesTransactionDetails = tmpSalesTransactionDetails;
                                    mclsSalesTransactionDetails.TransactionItems = TransactionItems;

                                    decimal decSplitPercentage = mclsSalesTransactionDetails.SubTotal - mclsSalesTransactionDetails.Discount + mclsSalesTransactionDetails.Charge;
                                    decSplitPercentage = det.AmountDue / decSplitPercentage;

                                    SetGridItems();
                                    SetGridItemsWidth();

                                    #region create the transaction
                                    CreateTransaction();
                                    #endregion

                                    #region punch all the items divided by the NoOfDiner

                                    foreach (Data.SalesTransactionItemDetails item in tmpSalesTransactionDetails.TransactionItems)
                                    {
                                        Data.SalesTransactionItemDetails clsDetails = item;
                                        //clsDetails.Amount = item.Amount * decSplitPercentage;
                                        //clsDetails.Price = item.Price * decSplitPercentage;
                                        //clsDetails.PurchasePrice = item.PurchasePrice * decSplitPercentage;
                                        //clsDetails.Discount = item.Discount * decSplitPercentage;
                                        clsDetails.Quantity = item.Quantity * decSplitPercentage;

                                        AddItem(clsDetails);
                                    }
                                    #endregion

                                    #region Apply existing discount if required

                                    if (tmpSalesTransactionDetails.Discount != 0)
                                    {
                                        if (tmpSalesTransactionDetails.TransDiscountType == DiscountTypes.NotApplicable)
                                        {
                                            lblTransDiscount.Text = "Less 0% / 0.00";
                                        }
                                        lblTransDiscount.Tag = tmpSalesTransactionDetails.TransDiscountType.ToString("d");
                                        mclsSalesTransactionDetails.TransDiscountType = tmpSalesTransactionDetails.TransDiscountType;
                                        mclsSalesTransactionDetails.TransDiscount = tmpSalesTransactionDetails.TransDiscount;
                                        mclsSalesTransactionDetails.Discount = tmpSalesTransactionDetails.Discount / iNoOfDiners;
                                        mclsSalesTransactionDetails.DiscountableAmount = tmpSalesTransactionDetails.DiscountableAmount / iNoOfDiners;
                                        mclsSalesTransactionDetails.DiscountCode = tmpSalesTransactionDetails.DiscountCode;
                                        mclsSalesTransactionDetails.DiscountRemarks = tmpSalesTransactionDetails.DiscountRemarks;

                                        ComputeSubTotal(); setTotalDetails();

                                        if (mclsSalesTransactionDetails.Discount <= mclsSalesTransactionDetails.DiscountableAmount)
                                        {
                                            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                                            clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType);
                                            clsSalesTransactions.CommitAndDispose();

                                            InsertAuditLog(AccessTypes.Discounts, "Apply transaction discount for " + mclsSalesTransactionDetails.Discount.ToString("#,###.#0") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                                        }
                                    }

                                    #endregion

                                    Data.SalesTransactionItemDetails mTopItemDetails = getCurrentRowItemDetails();

                                    #region close the transaction

                                    // override the customerinformation if it's paid with in-house creditcard
                                    if (det.clsCreditorDetails.ContactID != 0 && det.clsCreditorDetails.ContactID != mclsSalesTransactionDetails.CustomerID)
                                    {
                                        LoadContact(Data.ContactGroupCategory.CUSTOMER, det.clsCreditorDetails);
                                    }

                                    //close then print 1 by 1
                                    CloseTransaction(mTopItemDetails,
                                    det.AmountPaid, det.ChangeAmount, det.BalanceAmount, det.CashPayment, det.ChequePayment,
                                    det.CreditCardPayment, det.CreditPayment, det.CreditChargeAmount, det.DebitPayment,
                                    det.RewardConvertedPayment, det.RewardPointsPayment, det.PaymentType,
                                    det.arrCashPaymentDetails, det.arrChequePaymentDetails, det.arrCreditCardPaymentDetails,
                                    det.arrCreditPaymentDetails, det.arrDebitPaymentDetails);

                                    #endregion

                                    clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog);
                                    this.LoadOptions();
                                }

                                #region void the old transaction

                                mclsSalesTransactionDetails = tmpSalesTransactionDetails;

                                // load the transaction
                                LoadTransaction(tmpSalesTransactionDetails.TransactionNo, tmpSalesTransactionDetails.TerminalNo);

                                clsEvent.AddEventLn("[" + lblCashier.Text + "] Voiding transaction no. " + lblTransNo.Text, true);

                                System.Data.DataTable dt = (System.Data.DataTable)dgItems.DataSource;
                                for (int x = 0; x < dt.Rows.Count; x++)
                                {
                                    dgItems.CurrentRowIndex = x;
                                    Data.SalesTransactionItemDetails Details = getCurrentRowItemDetails();

                                    if (Details.TransactionItemStatus != TransactionItemStatus.Void)
                                    {
                                        Details.TransactionItemStatus = TransactionItemStatus.Void;
                                        ReservedAndCommitItem(Details, Details.TransactionItemStatus);
                                    }
                                }

                                //UpdateTerminalReportDelegate updateterminalDel = new UpdateTerminalReportDelegate(UpdateTerminalReport);
                                UpdateTerminalReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned);

                                //UpdateCashierReportDelegate updatecashierDel = new UpdateCashierReportDelegate(UpdateCashierReport);
                                UpdateCashierReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned);

                                new Data.SalesTransactions(mConnection, mTransaction).Void(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.CashierID, mclsSalesTransactionDetails.CashierName);

                                new Data.SalesTransactions(mConnection, mTransaction).UpdateTerminalNo(mclsSalesTransactionDetails.TransactionID, lblTerminalNo.Text);

                                // Sep 24, 2014 : update back the LastCheckInDate to min date
                                Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                                mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

                                clsContact.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE);

                                InsertAuditLog(AccessTypes.VoidTransaction, "VOID transaction #:" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                                clsEvent.AddEventLn("Done transaction no. " + lblTransNo.Text + " has been void.", true);

                                #endregion

                                clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog);
                                this.LoadOptions();

                                // commit all in the database
                                clsLocalDB.CommitAndDispose();
                            }

                            #endregion
                            break;
                        default:
                            break;
                    }

                    
                }
            }
		}