private void btnReturn_Button_Click(object sender, RoutedEventArgs e)
        {
            // NOTE :- if productcode is blank then no preoduct is selected so cannot be returned
            if (txtProductCode.Text == "")
            {
                // If value is not selected from data grid view then we cannot return it even when return button is clicked
                MessageBox.Show("Please select the product to be returned first.");
                return;
            }
            float updatedQty = float.Parse(txtSoldQty.Text) - float.Parse(txtReturnQty.Text);

            // return quantity constraints
            if (IsTextAllowed(txtReturnQty.Text) && (float.Parse(txtReturnQty.Text) > 0) && (updatedQty) >= 0)
            {
                // increase credit amount then update the quantity if partially returned and remove the row if completely returned
                MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure you want to return these items?", "Return Confirmation", System.Windows.MessageBoxButton.YesNo);
                if (messageBoxResult == MessageBoxResult.Yes)
                {
                    int billNo = Int32.Parse(txtSearch.Text);
                    //credit amount = unitcost * returnQty - discount % *(unitcost * returnQty) for that item
                    float discountOnReturnItem = discountPercent * (unitSellingPrice * float.Parse(txtReturnQty.Text));// ie discount % *(unitcost * returnQty) part
                    float creditAmount         = unitSellingPrice * float.Parse(txtReturnQty.Text) - discountOnReturnItem;
                    //String.Format("{0:0.00}", 123.4567);      // "123.46"

                    txtCreditAmount.Text = String.Format("{0:0.00}", creditAmount);

                    //TransactionScope: For transactions, eg all the steps in the transaction should be completed for the transaction to actually happen,
                    //so transaction scope makes sure that either all the steps are carried out or non of it are.
                    using (TransactionScope scope = new TransactionScope())
                    {
                        if (billData.Update(billNo, id, float.Parse(txtReturnQty.Text), creditAmount, discountOnReturnItem))
                        {
                            billData.histInsert(billNo, txtProductCode.Text, float.Parse(txtReturnQty.Text), creditAmount);
                            MessageBox.Show("Product Returned Successfully");
                        }

                        else
                        {
                            MessageBox.Show("Product Could Not Be Returned", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                        scope.Complete();
                    }
                }
            }

            else
            {
                MessageBox.Show("Invalid input on return quantity!");
            }
        }