Example #1
0
 private void UpdateUsedCashVoucher(ACMSDAL.ConnectionProvider connProvider, ACMSLogic.POS pos)
 {
     if (Convert.ToInt16(pos.ReceiptPaymentTable.Compute("COUNT(nPaymentID)", "strPaymentCode='CASHVOUCHER'")) > 0)
     {
         foreach (DataRow dr in pos.ReceiptPaymentTable.Rows)
         {
             if (dr["strPaymentCode"].ToString() == "CASHVOUCHER")
             {
                 TblCashVoucher sqlCV = new TblCashVoucher();
                 sqlCV.MainConnectionProvider = connProvider;
                 sqlCV.StrSN = dr["strReferenceNo"].ToString();
                 DataTable table = sqlCV.SelectOne();
                 sqlCV.NStatusID = 3;
                 sqlCV.StrRedeemedByID = pos.StrMembershipID;
                 sqlCV.DtRedeemedDate = DateTime.Now;
                 sqlCV.StrRedeemedBranch = pos.StrBranchCode;
                 sqlCV.Update();
                 sqlCV.SaveData(table);
             }
         }
     }
 }
Example #2
0
        private void CashVoucherTransaction(ACMSDAL.ConnectionProvider connProvider, ACMSLogic.POS pos)
        {
            if (pos.NCategoryID == 38)
            {
                DateTime dtStartDate = DateTime.Now.Date;
                DateTime dtExpiryDate;

                foreach (DataRow r in pos.ReceiptItemsTable.Rows)
                {
                    TblCashVoucher sqlCV = new TblCashVoucher();
                    sqlCV.MainConnectionProvider = connProvider;
                    string strCVCode = r["strCode"].ToString();
                    sqlCV.StrSN = strCVCode;
                    DataTable table = sqlCV.SelectOne();
                    sqlCV.NStatusID = 1;
                    sqlCV.StrSoldToID = pos.StrMembershipID;
                    sqlCV.DtSoldDate = DateTime.Now;
                    sqlCV.StrSoldBranch = pos.StrBranchCode;

                    int iduration = Convert.ToInt32(sqlCV.NValidDuration.ToString());
                    if (sqlCV.StrDurationUnit.ToString().Trim() == "DAY")
                        dtExpiryDate = dtStartDate.AddDays(iduration - 1).AddDays(0);
                    else if (sqlCV.StrDurationUnit.ToString().Trim() == "WEEK")
                    {
                        iduration = iduration * 7;
                        dtExpiryDate = dtStartDate.AddDays(iduration - 1).AddDays(0);
                    }
                    else
                        dtExpiryDate = dtStartDate.AddMonths(iduration).AddDays(-1);

                    sqlCV.DtStartDate = dtStartDate;
                    sqlCV.DtExpiryDate = dtExpiryDate;
                    sqlCV.Update();
                    sqlCV.SaveData(table);
                }
            }
        }
Example #3
0
        private void ActionTakeWhenVoidReceiptForCategory_38(string strReceiptNo, ConnectionProvider connProvider)
        {
            TblReceiptEntries receiptEntries = new TblReceiptEntries();
            receiptEntries.MainConnectionProvider = connProvider;
            DataTable table = receiptEntries.GetQty_StrCodeBaseStrReceiptNo(strReceiptNo);

            if (table.Rows.Count > 0)
            {
                foreach (DataRow r in table.Rows)
                {
                    if (CheckIsRegistrationRow(r)) return;

                    if (r["strCode"].ToString().Length > 0)
                    {
                        string strSQL;
                        strSQL = "select * from tblReceiptPayment rp, tblReceipt r where strPaymentCode='CASHVOUCHER' and rp.strReferenceNo='" + r["strCode"].ToString() + "' and rp.strReceiptNo=r.strReceiptNo  and fVoid=0";
                        DataSet _ds1 = new DataSet();
                        SqlHelper.FillDataset(connection, CommandType.StoredProcedure, "UP_GETDATA", _ds1, new string[] { "table" }, new SqlParameter("@strSQL", strSQL));

                        //Roll back when cash voucher used
                        if (_ds1.Tables["table"].Rows.Count > 0)
                            throw new Exception("Cash Voucher(s) purchased in this receipt already used in receipt " + _ds1.Tables["table"].Rows[0]["strReceiptNo"] + " under member " + _ds1.Tables["table"].Rows[0]["strMembershipID"] + ".");

                        TblCashVoucher sqlCV = new TblCashVoucher();
                        sqlCV.MainConnectionProvider = connProvider;
                        string strCVCode = r["strCode"].ToString();
                        sqlCV.StrSN = strCVCode;
                        DataTable dtCV = sqlCV.SelectOne();
                        sqlCV.NStatusID = 0;
                        sqlCV.StrSoldToID = System.Data.SqlTypes.SqlString.Null;
                        sqlCV.DtSoldDate = System.Data.SqlTypes.SqlDateTime.Null;
                        sqlCV.StrSoldBranch = System.Data.SqlTypes.SqlString.Null;
                        sqlCV.DtStartDate = System.Data.SqlTypes.SqlDateTime.Null;
                        sqlCV.DtExpiryDate = System.Data.SqlTypes.SqlDateTime.Null;
                        sqlCV.Update();
                        sqlCV.SaveData(table);
                    }
                }
            }
        }
Example #4
0
        private void simpleButtonOK_Click(object sender, System.EventArgs e)
        {
            decimal paymentAmt = 0;

            if (lkpEdtPayment.EditValue.ToString() == "")
            {
                MessageBox.Show(this, "Please select the payment mode.");
                this.DialogResult = DialogResult.None;
                return;
            }
            else if (txtEdtPaymentAmt.Text.Length == 0)
            {
                MessageBox.Show(this, "Please enter payment amount.");
                this.DialogResult = DialogResult.None;
                return;
            }
            else if (lkpEdtPaymentGroup.EditValue.ToString() == ACMSPOS2.PaymentGroupCode.IPP &&
                lkpEdtIPP.EditValue.ToString().Trim() == "")
            {
                MessageBox.Show(this, "Please select an IPP ID.");
                this.DialogResult = DialogResult.None;
                return;
            }
            else if (lkpEdtPaymentGroup.EditValue.ToString() == ACMSPOS2.PaymentGroupCode.IPP &&
                txtEdtRefNo.Text.Trim()== "")
            {
                MessageBox.Show(this, "Please Enter Reference No.");
                this.DialogResult = DialogResult.None;
                return;
            }
            else if ((lkpEdtPaymentGroup.EditValue.ToString() == ACMSPOS2.PaymentGroupCode.CHEQUE ||
                lkpEdtPaymentGroup.EditValue.ToString()== ACMSPOS2.PaymentGroupCode.VOUCHER ) &&
                txtEdtRefNo.Text == "")
            {
                MessageBox.Show(this, "Please enter reference code.");
                this.DialogResult = DialogResult.None;
                return;
            }
            else if ((lkpEdtPaymentGroup.EditValue.ToString() == ACMSPOS2.PaymentGroupCode.VOUCHER) &&
                txtEdtRefNo.Text == "" && lkpEdtPayment.Text == "CASHVOUCHER")
            {
                MessageBox.Show(this, "Please enter reference code.");
                this.DialogResult = DialogResult.None;
                return;
            }
            else if (txtEdtPaymentAmt.Text.Length > 0)
            {
                ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();
                TblCashVoucher sqlCV = new TblCashVoucher();
                sqlCV.MainConnectionProvider = connProvider;

                try
                {
                    if (lkpEdtPayment.Text == "CASHVOUCHER")
                    {
                        string strCVCode = txtEdtRefNo.Text.Trim();
                        sqlCV.StrSN = strCVCode;
                        DataTable table = sqlCV.SelectOne();
                        if (table.Rows.Count > 0)
                        {
                            if (Array.IndexOf(sqlCV.StrCategoryIDs.ToString().Split(','), myPOS.NCategoryID.ToString()) < 0)
                            {
                                MessageBox.Show(this, "Cannot redeem this voucher because it belongs to different category!");
                                this.DialogResult = DialogResult.None;
                                return;
                            }
                            if (sqlCV.StrSoldToID.IsNull)
                            {
                                MessageBox.Show(this, "Cannot redeem this voucher because it haven't sold out!");
                                this.DialogResult = DialogResult.None;
                                return;
                            }
                            if (!sqlCV.StrRedeemedByID.IsNull)
                            {
                                MessageBox.Show(this, "Cannot redeem this voucher because it already redeemed!");
                                this.DialogResult = DialogResult.None;
                                return;
                            }
                            if (sqlCV.StrDurationUnit.ToString() == "MONTH" && Convert.ToDateTime(sqlCV.DtSoldDate.ToString()).AddMonths(Convert.ToInt32(sqlCV.NValidDuration.ToString())) < DateTime.Now)
                            {
                                MessageBox.Show(this, "Cannot redeem this voucher because it already expired! Expired Date: " + Convert.ToDateTime(sqlCV.DtSoldDate.ToString()).AddMonths(Convert.ToInt32(sqlCV.NValidDuration.ToString())).ToShortDateString());
                                this.DialogResult = DialogResult.None;
                                return;
                            }
                            if (sqlCV.StrDurationUnit.ToString() == "WEEK" && Convert.ToDateTime(sqlCV.DtSoldDate.ToString()).AddDays(Convert.ToInt32(sqlCV.NValidDuration.ToString()) * 7) < DateTime.Now)
                            {
                                MessageBox.Show(this, "Cannot redeem this voucher because it already expired! Expired Date: " + Convert.ToDateTime(sqlCV.DtSoldDate.ToString()).AddDays(Convert.ToInt32(sqlCV.NValidDuration.ToString()) * 7).ToShortDateString());
                                this.DialogResult = DialogResult.None;
                                return;
                            }
                            if (sqlCV.StrDurationUnit.ToString() == "DAY" && Convert.ToDateTime(sqlCV.DtSoldDate.ToString()).AddDays(Convert.ToInt32(sqlCV.NValidDuration.ToString())) < DateTime.Now)
                            {
                                MessageBox.Show(this, "Cannot redeem this voucher because it already expired! Expired Date: " + Convert.ToDateTime(sqlCV.DtSoldDate.ToString()).AddDays(Convert.ToInt32(sqlCV.NValidDuration.ToString())).ToShortDateString());
                                this.DialogResult = DialogResult.None;
                                return;
                            }
                            txtEdtPaymentAmt.EditValue = ACMS.Convert.ToDecimal(table.Rows[0]["mValue"]);
                            paymentAmt = ACMS.Convert.ToDecimal(table.Rows[0]["mValue"]);
                        }
                        else
                        {
                            MessageBox.Show(this, "Invalid Serial No! Please enter again!");
                            this.DialogResult = DialogResult.None;
                            return;
                        }
                    }
                    else
                    {
                        decimal paymentAmt_temp;
                        decimal remainder;

                        if (txtEdtPaymentAmt.EditValue.ToString() == "")
                        {
                            paymentAmt = ACMS.Convert.ToDecimal(0);
                        }
                        else
                        {
                            if (lkpEdtPayment.Text == "CASH")
                            {
                                paymentAmt_temp = ACMS.Convert.ToDecimal(txtEdtPaymentAmt.EditValue);
                                remainder = paymentAmt_temp % ACMS.Convert.ToDecimal(0.05);
                                //myPOS.MTotalAmount = myPOS.MTotalAmount - remainder;
                                //txtEdtPaymentAmt.EditValue = myPOS.MTotalAmount.ToString();
                                txtEdtPaymentAmt.EditValue = (paymentAmt_temp - remainder).ToString();
                            }
                            paymentAmt = ACMS.Convert.ToDecimal(txtEdtPaymentAmt.EditValue);
                        }
                        /*
                        if (txtEdtPaymentAmt.EditValue == "")
                            paymentAmt = ACMS.Convert.ToDecimal(0);
                        else
                            paymentAmt = ACMS.Convert.ToDecimal(txtEdtPaymentAmt.EditValue);*/
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Invalid payment amount.");
                    this.DialogResult = DialogResult.None;
                    return;
                }
                finally
                {
                    if (connProvider.CurrentTransaction != null)
                    {
                        connProvider.CurrentTransaction.Dispose();
                    }

                    if (connProvider.DBConnection != null)
                    {
                        if (connProvider.DBConnection.State == ConnectionState.Open)
                        {
                            connProvider.DBConnection.Close();
                        }
                    }
                    sqlCV.MainConnactionIsCreatedLocal = true;
                }
            }

            int ipp = 0;
            if (lkpEdtIPP.EditValue.ToString().Length > 0)
                ipp = ACMS.Convert.ToInt32(lkpEdtIPP.EditValue);

            myPOS.NewReceiptPayment(lkpEdtPayment.EditValue.ToString(), paymentAmt, ipp, txtEdtRefNo.Text);
        }
Example #5
0
        //Derek Instalment Plan - Void Pay OS - Update Payment Plan
        public void VoidReceipt(string strReceiptNo, bool VoidPre)
        {
            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();

            try
            {
                // Check Access Right here
                TblReceipt receipt = new TblReceipt();
                TblReceiptFreebie sqlReceiptFreebie = new TblReceiptFreebie();
                TblRewardsTransaction mRewardTransaction = new TblRewardsTransaction();
                TblReceiptPayment sqlReceiptPayment = new TblReceiptPayment();
                TblPaymentPlan myPaymentPlan = new TblPaymentPlan();

                myPaymentPlan.MainConnectionProvider = connProvider;
                mRewardTransaction.MainConnectionProvider = connProvider;
                receipt.MainConnectionProvider = connProvider;
                sqlReceiptFreebie.MainConnectionProvider = connProvider;
                sqlReceiptPayment.MainConnectionProvider = connProvider;

                connProvider.OpenConnection();
                connProvider.BeginTransaction("VoidReceipt");

                receipt.StrReceiptNo = strReceiptNo;
                receipt.SelectOne();

                int nCategoryID = receipt.NCategoryID.Value;
                string strBranchCode = receipt.StrBranchCode.Value;

                if (receipt.DtDate.Value != System.DateTime.Today && VoidPre == false)
                    throw new Exception("Not allow to void previous data receipt. ");

                if (strBranchCode != User.BranchCode)
                    throw new Exception("Not allow to void other's branches' receipt. ");

                receipt.FVoid = System.Data.SqlTypes.SqlBoolean.True;
                receipt.Update();

                string strSQL;
                if (receipt.NCategoryID == 7 || receipt.NCategoryID == 36 || receipt.NCategoryID == 37)
                    strSQL = "select top 1 * from tblMemberCreditPackage where strReceiptNo ='" + receipt.StrReceiptNo.ToString() + "' AND fFree=0";
                else
                    strSQL = "select top 1 * from tblMemberPackage where strReceiptNo ='" + receipt.StrReceiptNo.ToString() + "' AND fFree=0";
                DataSet _ds1 = new DataSet();
                SqlHelper.FillDataset(connection, CommandType.StoredProcedure, "UP_GETDATA", _ds1, new string[] { "table" }, new SqlParameter("@strSQL", strSQL));

                //Roll back when package conversion
                if (_ds1.Tables["table"].Rows.Count > 0)
                {
                    string strPkgRemark = _ds1.Tables["table"].Rows[0]["strUpgradeFrom"].ToString();
                    string[] rollbackPackages = strPkgRemark.ToString().Split(',');

                    foreach (string rollbackPackage in rollbackPackages)
                    {
                        if (rollbackPackage.Trim() != "" && rollbackPackage.Trim() != "Null")
                        {
                            if (rollbackPackage.Contains("(C)"))
                            {
                                int nPackageID = Convert.ToInt32(rollbackPackage.Trim().Replace("(C)", ""));
                                TblMemberCreditPackage mp2 = new TblMemberCreditPackage();
                                mp2.NCreditPackageID = nPackageID;
                                mp2.SelectOne();
                                mp2.StrUpgradeTo = "";
                                mp2.StrRemarks = "";
                                mp2.NStatusID = 0;
                                mp2.Update();
                            }
                            else if (rollbackPackage.Contains("(B)"))
                            {
                                string strSQL2 = "select * from tblMemberPackage where strUpgradeTo='" + receipt.StrReceiptNo.ToString() + "' ";
                                DataSet _ds2 = new DataSet();
                                SqlHelper.FillDataset(connection, CommandType.StoredProcedure, "UP_GETDATA", _ds2, new string[] { "table" }, new SqlParameter("@strSQL", strSQL2));
                                foreach (DataRow drComboPkg in _ds2.Tables["table"].Rows)
                                {
                                    TblMemberPackage mp = new TblMemberPackage();
                                    DataTable convertedPkgTable = mp.LoadData("select * from tblMemberPackage where nPackageID=" + drComboPkg["nPackageID"].ToString());
                                    if (convertedPkgTable.Rows.Count > 0)
                                    {
                                        convertedPkgTable.Rows[0]["nStatusID"] = 0;
                                        convertedPkgTable.Rows[0]["strUpgradeTo"] = "";
                                        convertedPkgTable.Rows[0]["strRemarks"] = "";
                                        mp.SaveData(convertedPkgTable);
                                    }
                                }
                            }
                            else
                            {
                                int nPackageID = Convert.ToInt32(rollbackPackage.Trim());
                                TblMemberPackage mp2 = new TblMemberPackage();
                                mp2.NPackageID = nPackageID;
                                mp2.SelectOne();
                                mp2.StrUpgradeTo = "";
                                mp2.StrRemarks = "";
                                mp2.NStatusID = 0;
                                mp2.Update();

                                //rollback free package if have any
                                TblMemberPackage mp3 = new TblMemberPackage();
                                string strFreePackageCode = "";
                                string strSQL3 = "select strFreePkgCode from tblPackage where strPackageCode='" + Convert.ToString(mp2.StrPackageCode) + "' ";
                                DataSet _ds = new DataSet();
                                SqlHelper.FillDataset(connection, CommandType.StoredProcedure, "UP_GETDATA", _ds, new string[] { "table" }, new SqlParameter("@strSQL", strSQL3));
                                if (_ds.Tables["table"].Rows.Count > 0)
                                {
                                    strFreePackageCode = _ds.Tables["table"].Rows[0]["strFreePkgCode"].ToString();
                                }
                                DataTable freePkgTable = mp3.LoadData("select * from tblMemberPackage where strReceiptNo=@strReceiptNo and strPackageCode =@strFreePackageCode ",
                                    new string[] { "@strReceiptNo", "@strFreePackageCode" }, new object[] { mp2.StrReceiptNo.ToString(), strFreePackageCode });

                                if (freePkgTable.Rows.Count > 0)
                                {
                                    freePkgTable.Rows[0]["nStatusID"] = 0;
                                    freePkgTable.Rows[0]["strUpgradeTo"] = "";
                                    freePkgTable.Rows[0]["strRemarks"] = "";
                                    mp3.SaveData(freePkgTable);
                                }
                            }
                        }
                    }
                }

                receipt.MUpgradeAmount = System.Data.SqlTypes.SqlMoney.Null;
                receipt.StrRemarks = "";
                receipt.Update();

                #region ====== Added By Albert ======
                /*
                 * To remove reward transaction.
                 */
                mRewardTransaction.StrReferenceNo = strReceiptNo;
                mRewardTransaction.SelectAllWReferenceNo();
                mRewardTransaction.NTypeID = 3;
                mRewardTransaction.Update();
                #endregion

                //rollback used cash voucher
                TblReceiptPayment tblReceiptPayment = new ACMSDAL.TblReceiptPayment();
                tblReceiptPayment.StrReceiptNo = strReceiptNo;
                DataTable tblPayment = tblReceiptPayment.SelectAllWstrReceiptNoLogic();

                foreach (DataRow dr in tblPayment.Rows)
                {
                    if (dr["strPaymentCode"].ToString() == "CASHVOUCHER")
                    {
                        TblCashVoucher sqlCV = new TblCashVoucher();
                        sqlCV.MainConnectionProvider = connProvider;
                        sqlCV.StrSN = dr["strReferenceNo"].ToString();
                        DataTable table = sqlCV.SelectOne();
                        sqlCV.NStatusID = 1;
                        sqlCV.StrRedeemedByID = System.Data.SqlTypes.SqlString.Null;
                        sqlCV.DtRedeemedDate = System.Data.SqlTypes.SqlDateTime.Null;
                        sqlCV.StrRedeemedBranch = System.Data.SqlTypes.SqlString.Null;
                        sqlCV.Update();
                        sqlCV.SaveData(table);
                    }
                }

                if (!receipt.StrChildReceiptNo.IsNull)
                {
                    int IsVoid = 0;

                    IsVoid = receipt.CheckIfChildReceiptVoid(receipt.StrChildReceiptNo.Value);

                    if (IsVoid == 0)
                    {
                        throw new Exception("The receipt given has child receipt, please void child receipt first before void this receipt");
                    }
                }

                string strDepositReceiptNo = "";

                if (!receipt.StrParentReceiptNo.IsNull)
                {
                    TblReceiptEntries pReceipt = new TblReceiptEntries();
                    pReceipt.StrReceiptNo = receipt.StrParentReceiptNo.Value;
                    pReceipt.SelectAllWstrReceiptNoLogic();
                    if (pReceipt.StrCode.Value != "Deposit")
                    {
                        nCategoryID = 0; //Check if pay outstanding receipt, reset category to 0
                    }
                    else if (pReceipt.StrCode.Value == "Deposit")
                    {
                        strDepositReceiptNo = receipt.StrParentReceiptNo.Value;
                    }
                    pReceipt.Dispose();
                }

                if (strDepositReceiptNo != "")
                {
                    try
                    {
                        receipt.ReviveDepositForVoidMasterReceipt(strReceiptNo, strDepositReceiptNo);
                    }
                    catch { }
                }

                if (nCategoryID == 1 || nCategoryID == 3 || nCategoryID == 4 || nCategoryID == 5 ||
                    nCategoryID == 6 || nCategoryID == 8 || nCategoryID == 9 || nCategoryID == 14 || nCategoryID == 23)
                {
                    ActionTakeWhenVoidReceiptForCategory_1_3_4_5_6_8_9_14_23(strReceiptNo, connProvider);
                }
                else if (nCategoryID == 2)
                {
                    //Fitness GIRO
                    ActionTakeWhenVoidReceiptForCategory_2(strReceiptNo, connProvider);
                }
                else if (nCategoryID == 7)
                {
                    // Spa Credit Account
                    ActionTakeWhenVoidReceiptForCategory_7(strReceiptNo, connProvider);
                }
                else if (nCategoryID == 36 || nCategoryID == 37)
                {
                    // Holistic Credit Account
                    ActionTakeWhenVoidReceiptForCategory_7(strReceiptNo, connProvider);
                }
                else if (nCategoryID == 38)
                {
                    // Cash Voucher
                    ActionTakeWhenVoidReceiptForCategory_38(strReceiptNo, connProvider);
                }
                else
                {
                    DeleteFreeMemberPackage(strReceiptNo, connProvider);

                    if (nCategoryID == 11 || nCategoryID == 12)
                    {
                        //ActionTakeWhenVoidReceiptForCategory_11_12(strReceiptNo, connProvider);
                    }
                    else if (nCategoryID == 21)
                    {
                        // mineral water
                    }
                    else if (nCategoryID == 15)
                    {
                        //Locker Rental
                    }
                    else if (nCategoryID == 0)
                    {
                        // Pay Outstanding
                        ActionTakeWhenVoidReceiptForCategory_0(receipt, connProvider);

                        //Get New Payment Plan
                        //If Table Row Count > 0 Then Update Payment Plan

                        //Derek Instalment Plan - Update tblPaymentPlan (if any)
                        //Reset Payment Plan's Receipt by payment receipt No - Bool 1 Updated 0 Not Found
                        //Get Bool If 1
                        //Find the Master Receipt No if 1

                        string strMasterReceiptNo = "";

                        strMasterReceiptNo = myPaymentPlan.GetInhouseIPPMasterOSReceiptSimple(strReceiptNo);

                        if (strMasterReceiptNo != "")
                        {
                            if (myPaymentPlan.GetInhouseResetIPP_VoidPayOS(strReceiptNo) == 1)
                            {
                                DataTable paymentPlanTable = myPaymentPlan.GetInhouseAdjustedIPP_VoidPayOS(strMasterReceiptNo);

                                if (paymentPlanTable != null && paymentPlanTable.Rows.Count > 0)
                                {
                                    foreach (DataRow r in paymentPlanTable.Rows)
                                    {
                                        if (r["lastestUpdate"].ToString() == "1")
                                        {
                                            myPaymentPlan.IPPSubsequentUpdate(Convert.ToInt32(r["nPaymentPlanID"]), r["strReceiptNo"].ToString(),
                                                                                Convert.ToInt32(r["nInstalmentNo"]), Convert.ToDecimal(r["mPaidAmount"]),
                                                                                Convert.ToDecimal(r["mAdjustedPaymentPlanAmt"]), Convert.ToDecimal(r["mOutstandingAmt"]));
                                        }
                                    }
                                    //paymentPlanTable.AcceptChanges();
                                }
                            }
                        }
                    }
                    else if (nCategoryID == 18)
                    {
                        ActionTakeWhenVoidReceiptForCategory_18(strReceiptNo, connProvider);
                    }
                    else if (nCategoryID == 19)
                    {
                        ActionTakeWhenVoidReceiptForCategory_19(strReceiptNo, connProvider);
                    }
                    #region Un-support voiding
                    /*
                    else if (nCategoryID == 17)
                    {
                        //throw new Exception("Forget card's receipt is not allow to void.");
                        //do notthing. Just void the receipt
                    }
                    else if (nCategoryID == 10)
                    {
                        //throw new Exception("Upgrade Package's receipt is not allow to void.");
                        // do notthing. Just void the receipt.
                    }
                    else if (nCategoryID == 20)
                    {
                        //Replace Membership Card
                        //throw new Exception("Replace member card's receipt is not allow to void.");
                        //do notthing, just void the receipt
                    }
                    */
                    #endregion

                }

                connProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                connProvider.RollbackTransaction("VoidReceipt");
                throw ex;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();

                }
            }
        }