コード例 #1
0
        void fpiGetPaymentType_FormClosing(object sender, FormClosedEventArgs e)
        {
            string sResult = fpiGetPaymentType.GetPaymentMethod();

            sPaymentMethod = sResult;
            if (sResult == "CHRG")
            {
                fasGetAccountToRefund              = new frmAccSel(ref tEngine);
                fasGetAccountToRefund.FormClosing += new FormClosingEventHandler(fasGetAccountToRefund_FormClosing);
                fasGetAccountToRefund.Show();
            }
            else if (sResult == "NULL")
            {
                if (sBarcodeToRefund != "$GENERAL_REFUND")
                {
                    tbRefundDetails[2].BackColor = cFrmForeColour;
                    tbRefundDetails[2].ForeColor = cFrmBackColour;
                    tbRefundDetails[2].Font      = new Font(sFontName, 16.0f);
                    tbRefundDetails[0].Enabled   = true;
                    tbRefundDetails[1].Enabled   = true;
                    tbRefundDetails[2].Enabled   = true;
                    tbRefundDetails[2].Focus();
                    tbRefundDetails[3].Text = "";
                }
                else
                {
                    tbRefundDetails[1].BackColor = cFrmForeColour;
                    tbRefundDetails[1].ForeColor = cFrmBackColour;
                    tbRefundDetails[1].Enabled   = true;
                    tbRefundDetails[1].Focus();
                    tbRefundDetails[1].Font = new Font(sFontName, 16.0f);
                }
            }
            else
            {
                if (MessageBox.Show("Complete refund with payment method " + fpiGetPaymentType.GetPaymentDescription(sResult) + "?", "Refund", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (sBarcodeToRefund != "$GENERAL_REFUND")
                    {
                        tEngine.RefundItem(sBarcodeToRefund, fAmountToRefund, nQuantityToRefund, sPaymentMethod);
                    }
                    else
                    {
                        tEngine.RefundGeneral(fAmountToRefund, sPaymentMethod);
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Refund cancelled.");
                    this.Close();
                }
            }
        }