using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
using System.Data.OracleClient;
using System.Data;

public partial class Business_MonthlySettlement : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.pnl_result.Visible = false;
            ExceptionUtility.LogException(0, "", "85", "Page_Load", "");
        }
    }
    protected void btn_clear_Click(object sender, EventArgs e)
    {
        this.clearResultControls();
        this.dtp_filter_sttlDate.date = "";
        this.pnl_result.Visible = false;
        this.pnl_searchCriteria.Enabled = true;
        ExceptionUtility.LogException(0, "", "", "btn_clear_Click", "");
    }
    protected void btn_save_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            lbl_error.Text = "One or more Validation Failed";
            return;
        }
        ExceptionUtility.LogException(0, "", "85.498", "btn_save_Click", "");//chgId: " + chgId + ", columnName: " + columnName + ", oldValue: " + oldValue + " , newValue: " + newValue + ",chgType: " + chgType);
        string settlementDate;
        string errorMsg = "";
        int resCode;

        settlementDate = this.dtp_filter_sttlDate.date;
        if (ViewState["mode"].ToString() == "0")
        {
            resCode = this.addSettlementDetails(settlementDate, ref errorMsg);

            if (resCode == 0)
            {
                this.lbl_error.Text = "Monthly Settlmenet Details Added Successfully.";

                //this.disableResultControls();
                this.clearResultControls();
                this.pnl_result.Visible = false;

                this.btn_save.Enabled = false;
                this.pnl_searchCriteria.Enabled = true;

            }
            
            else
            {
                if (Helper.OracleError(errorMsg))
                {
                    lbl_error.Text = "An Error Occured!";
                    ExceptionUtility.LogException(9, "", "85.498", "btn_save_Click", errorMsg);
                }
                else
                    lbl_error.Text = errorMsg;
                
            }
        }
        else if (ViewState["mode"].ToString() == "1")
        {
            resCode = this.updateSettlementDetails(settlementDate,  ref errorMsg);

            if (resCode == 0)
            {
                this.lbl_error.Text = "Monthly Settlmenet Details Updated Successfully.";

                //this.disableResultControls();
                this.clearResultControls();
                this.pnl_result.Visible = false;

                this.btn_save.Enabled = false;
                this.pnl_searchCriteria.Enabled = true;

            }           
            else
            {
                if (Helper.OracleError(errorMsg))
                {
                    lbl_error.Text = "An Error Occured!";
                    ExceptionUtility.LogException(9, "", "85.498", "btn_save_Click", errorMsg);
                }
                else
                    lbl_error.Text = errorMsg;
            }
        }
    }
    private int addSettlementDetails(string settlementDate, ref string errorMsg)
    {
        string parameters = "";
        try
        {
            string DBConnection = Helper.dbConnection();
            OracleConnection oracon = new OracleConnection(DBConnection);
            oracon.Open();

            OracleCommand oracom = new OracleCommand();
            oracom.Connection = oracon;

            oracom.CommandType = CommandType.StoredProcedure;
            oracom.CommandText = "SAMA_MONTHLY_ACCT_EDITOR.ADD_MONTHLY_SETTLEMENT_DETAILS";

            oracom.Parameters.Add("p_current_uid", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_lang", OracleType.VarChar).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_settl_date", OracleType.VarChar).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ISSUER_BALANCE_INQUIRY", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ACQUIRER_BALANCE_INQUIRY", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ISSUER_MINI_STATEMENT", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ACQUIRER_MINI_STATEMENT", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ATM_REVENUE_WITHDRAWAL_MAG", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ATM_EXPENSE_WITHDRAWAL_MAG", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ISSUER_CASH_WITHDRAWAL", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ACQUIRER_CASH_WITHDRAWAL", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_SPAN_DEBIT_ATM_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_SPAN_DEBIT_POS_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_OBC_ACQ_ATM_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_OBC_ACQ_POS_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_AMEX_POS_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_TOTAL_NET_DUE", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ATM_DEBIT_CLAIMS_ADJUSMENTS", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ATM_CREDIT_CLAIMS_ADJUSMENS", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_POS_DEBIT_CLAIMS_ADJUSMENTS", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_POS_CREDIT_CLAIMS_ADJUSMENTS", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_res_code", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_res_type", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_res_msg", OracleType.VarChar, 250).Direction = ParameterDirection.Output;


            oracom.Parameters["p_current_uid"].Value = Session["uid"].ToString();
            oracom.Parameters["p_lang"].Value = "EN";
            oracom.Parameters["p_settl_date"].Value = settlementDate;

            oracom.Parameters["p_ISSUER_BALANCE_INQUIRY"].Value = double.Parse(txtIssuerBalanceInquiry.Text);
            oracom.Parameters["p_ACQUIRER_BALANCE_INQUIRY"].Value = double.Parse(txtAcquirerBalanceInquiry.Text);
            oracom.Parameters["p_ISSUER_MINI_STATEMENT"].Value = double.Parse(txtIssuerMiniStatement.Text);
            oracom.Parameters["p_ACQUIRER_MINI_STATEMENT"].Value = double.Parse(txtAcquirerMiniStatementCr.Text);
            oracom.Parameters["p_ATM_REVENUE_WITHDRAWAL_MAG"].Value = double.Parse(txtATMRevenueWithdrawalMag.Text);
            oracom.Parameters["p_ATM_EXPENSE_WITHDRAWAL_MAG"].Value = double.Parse(txtATMExpenseWDMag .Text);
            oracom.Parameters["p_ISSUER_CASH_WITHDRAWAL"].Value = double.Parse(txtIssuerCashWithdrawal.Text);
            oracom.Parameters["p_ACQUIRER_CASH_WITHDRAWAL"].Value = double.Parse(txtAcquirerCashWithdrawal.Text);
            oracom.Parameters["p_SPAN_DEBIT_ATM_PROC_FEES"].Value = double.Parse(txtSPANDebitATMProcessFees.Text);
            oracom.Parameters["p_SPAN_DEBIT_POS_PROC_FEES"].Value = double.Parse(txtSPANDebitPOSProcessFees.Text);
            oracom.Parameters["p_OBC_ACQ_ATM_PROC_FEES"].Value = double.Parse(txtOBCAcquirerATMProcessFee.Text);
            oracom.Parameters["p_OBC_ACQ_POS_PROC_FEES"].Value = double.Parse(txtOBCAcquirerPOSProcessFees.Text);
            oracom.Parameters["p_AMEX_POS_FEES"].Value = double.Parse(txtAmexPOSFees.Text);
            oracom.Parameters["p_TOTAL_NET_DUE"].Value = double.Parse(txtSpanMonthlyTotalNetDue.Text);
            oracom.Parameters["p_ATM_DEBIT_CLAIMS_ADJUSMENTS"].Value = double.Parse(txtATMDebitClaimsAdjustments.Text);
            oracom.Parameters["p_ATM_CREDIT_CLAIMS_ADJUSMENS"].Value = double.Parse(txtATMCreditClaimsAdjustment.Text);
            oracom.Parameters["p_POS_DEBIT_CLAIMS_ADJUSMENTS"].Value = double.Parse(POSDebitClaimsAdjustment.Text);
            oracom.Parameters["p_POS_CREDIT_CLAIMS_ADJUSMENTS"].Value = double.Parse(POSCreditClaimsAdjustment.Text);
            parameters = "p_lang-EN:p_settl_date-" + settlementDate + ":p_ISSUER_BALANCE_INQUIRY-" + double.Parse(txtIssuerBalanceInquiry.Text) + ":p_ACQUIRER_BALANCE_INQUIRY-" + double.Parse(txtAcquirerBalanceInquiry.Text) + ":p_ISSUER_MINI_STATEMENT-" + double.Parse(txtIssuerMiniStatement.Text) + ":p_ACQUIRER_MINI_STATEMENT-" + double.Parse(txtAcquirerMiniStatementCr.Text) + ":p_ATM_REVENUE_WITHDRAWAL_MAG-" + double.Parse(txtATMRevenueWithdrawalMag.Text) + ":p_ISSUER_CASH_WITHDRAWAL-" + double.Parse(txtIssuerCashWithdrawal.Text) + ":p_ACQUIRER_CASH_WITHDRAWAL-" + double.Parse(txtAcquirerCashWithdrawal.Text) + ":p_SPAN_DEBIT_ATM_PROC_FEES-" + double.Parse(txtSPANDebitATMProcessFees.Text) + ":p_SPAN_DEBIT_POS_PROC_FEES" + double.Parse(txtSPANDebitPOSProcessFees.Text) +
                ":p_OBC_ACQ_ATM_PROC_FEES-" + double.Parse(txtOBCAcquirerATMProcessFee.Text) + ":p_OBC_ACQ_POS_PROC_FEES-" + double.Parse(txtOBCAcquirerPOSProcessFees.Text) + ":p_AMEX_POS_FEES-" + double.Parse(txtAmexPOSFees.Text) + ":p_TOTAL_NET_DUE-" + double.Parse(txtSpanMonthlyTotalNetDue.Text) + ":p_ATM_DEBIT_CLAIMS_ADJUSMENTS-" + double.Parse(txtATMDebitClaimsAdjustments.Text) +
                ":p_ATM_CREDIT_CLAIMS_ADJUSMENS-" + double.Parse(txtATMCreditClaimsAdjustment.Text) + ":p_POS_DEBIT_CLAIMS_ADJUSMENTS-" + double.Parse(POSDebitClaimsAdjustment.Text) + ":p_POS_CREDIT_CLAIMS_ADJUSMENTS-" + double.Parse(POSCreditClaimsAdjustment.Text);
            oracom.ExecuteNonQuery();
            oracon.Close();

            int resCode = int.Parse(oracom.Parameters["p_res_code"].Value.ToString());
            errorMsg = oracom.Parameters["p_res_msg"].Value.ToString();
            ExceptionUtility.LogException(0, "SAMA_MONTHLY_ACCT_EDITOR.ADD_MONTHLY_SETTLEMENT_DETAILS", "498.1", "addSettlementDetails", parameters );
            return resCode;
        }
        catch (Exception ex)
        {
            ExceptionUtility.LogException(ex , "SAMA_MONTHLY_ACCT_EDITOR.ADD_MONTHLY_SETTLEMENT_DETAILS", "498.1", "addSettlementDetails", parameters );
            return 1;
        }
    }

    private int updateSettlementDetails(string settlementDate,ref string errorMsg)
    {
        string parameters = "";
        try
        {
            string DBConnection = Helper.dbConnection();
            OracleConnection oracon = new OracleConnection(DBConnection);
            oracon.Open();

            OracleCommand oracom = new OracleCommand();
            oracom.Connection = oracon;

            oracom.CommandType = CommandType.StoredProcedure;
            oracom.CommandText = "SAMA_MONTHLY_ACCT_EDITOR.UPDATE_MONTHLY_SETTL_DETAILS";

            oracom.Parameters.Add("p_current_uid", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_lang", OracleType.VarChar).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_settl_date", OracleType.VarChar).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ISSUER_BALANCE_INQUIRY", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ACQUIRER_BALANCE_INQUIRY", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ISSUER_MINI_STATEMENT", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ACQUIRER_MINI_STATEMENT", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ATM_REVENUE_WITHDRAWAL_MAG", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ATM_EXPENSE_WITHDRAWAL_MAG", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ISSUER_CASH_WITHDRAWAL", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ACQUIRER_CASH_WITHDRAWAL", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_SPAN_DEBIT_ATM_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_SPAN_DEBIT_POS_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_OBC_ACQ_ATM_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_OBC_ACQ_POS_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_AMEX_POS_FEES", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_TOTAL_NET_DUE", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ATM_DEBIT_CLAIMS_ADJUSMENTS", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_ATM_CREDIT_CLAIMS_ADJUSMENS", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_POS_DEBIT_CLAIMS_ADJUSMENTS", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_POS_CREDIT_CLAIMS_ADJUSMENTS", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_res_code", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_res_type", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_res_msg", OracleType.VarChar, 250).Direction = ParameterDirection.Output;


            oracom.Parameters["p_current_uid"].Value = Session["uid"].ToString();
            oracom.Parameters["p_lang"].Value = "EN";
            oracom.Parameters["p_settl_date"].Value = settlementDate;

            oracom.Parameters["p_ISSUER_BALANCE_INQUIRY"].Value = double.Parse(txtIssuerBalanceInquiry.Text);
            oracom.Parameters["p_ACQUIRER_BALANCE_INQUIRY"].Value = double.Parse(txtAcquirerBalanceInquiry.Text);
            oracom.Parameters["p_ISSUER_MINI_STATEMENT"].Value = double.Parse(txtIssuerMiniStatement.Text);
            oracom.Parameters["p_ACQUIRER_MINI_STATEMENT"].Value = double.Parse(txtAcquirerMiniStatementCr.Text);
            oracom.Parameters["p_ATM_REVENUE_WITHDRAWAL_MAG"].Value = double.Parse(txtATMRevenueWithdrawalMag.Text);
            oracom.Parameters["p_ATM_EXPENSE_WITHDRAWAL_MAG"].Value = double.Parse(txtATMExpenseWDMag.Text);
            oracom.Parameters["p_ISSUER_CASH_WITHDRAWAL"].Value = double.Parse(txtIssuerCashWithdrawal.Text);
            oracom.Parameters["p_ACQUIRER_CASH_WITHDRAWAL"].Value = double.Parse(txtAcquirerCashWithdrawal.Text);
            oracom.Parameters["p_SPAN_DEBIT_ATM_PROC_FEES"].Value = double.Parse(txtSPANDebitATMProcessFees.Text);
            oracom.Parameters["p_SPAN_DEBIT_POS_PROC_FEES"].Value = double.Parse(txtSPANDebitPOSProcessFees.Text);
            oracom.Parameters["p_OBC_ACQ_ATM_PROC_FEES"].Value = double.Parse(txtOBCAcquirerATMProcessFee.Text);
            oracom.Parameters["p_OBC_ACQ_POS_PROC_FEES"].Value = double.Parse(txtOBCAcquirerPOSProcessFees.Text);
            oracom.Parameters["p_AMEX_POS_FEES"].Value = double.Parse(txtAmexPOSFees.Text);
            oracom.Parameters["p_TOTAL_NET_DUE"].Value = double.Parse(txtSpanMonthlyTotalNetDue.Text);
            oracom.Parameters["p_ATM_DEBIT_CLAIMS_ADJUSMENTS"].Value = double.Parse(txtATMDebitClaimsAdjustments.Text);
            oracom.Parameters["p_ATM_CREDIT_CLAIMS_ADJUSMENS"].Value = double.Parse(txtATMCreditClaimsAdjustment.Text);
            oracom.Parameters["p_POS_DEBIT_CLAIMS_ADJUSMENTS"].Value = double.Parse(POSDebitClaimsAdjustment.Text);
            oracom.Parameters["p_POS_CREDIT_CLAIMS_ADJUSMENTS"].Value = double.Parse(POSCreditClaimsAdjustment.Text);
            parameters = "p_lang-EN:p_settl_date-"+settlementDate +":p_ISSUER_BALANCE_INQUIRY-" + double.Parse(txtIssuerBalanceInquiry.Text) + ":p_ACQUIRER_BALANCE_INQUIRY-" + double.Parse(txtAcquirerBalanceInquiry.Text) + ":p_ISSUER_MINI_STATEMENT-" + double.Parse(txtIssuerMiniStatement.Text) + ":p_ACQUIRER_MINI_STATEMENT-" + double.Parse(txtAcquirerMiniStatementCr.Text) + ":p_ATM_REVENUE_WITHDRAWAL_MAG-" + double.Parse(txtATMRevenueWithdrawalMag.Text) + ":p_ISSUER_CASH_WITHDRAWAL-" + double.Parse(txtIssuerCashWithdrawal.Text) + ":p_ACQUIRER_CASH_WITHDRAWAL-" + double.Parse(txtAcquirerCashWithdrawal.Text) + ":p_SPAN_DEBIT_ATM_PROC_FEES-" + double.Parse(txtSPANDebitATMProcessFees.Text) + ":p_SPAN_DEBIT_POS_PROC_FEES" + double.Parse(txtSPANDebitPOSProcessFees.Text) +
                ":p_OBC_ACQ_ATM_PROC_FEES-" + double.Parse(txtOBCAcquirerATMProcessFee.Text) + ":p_OBC_ACQ_POS_PROC_FEES-" + double.Parse(txtOBCAcquirerPOSProcessFees.Text) + ":p_AMEX_POS_FEES-" + double.Parse(txtAmexPOSFees.Text) + ":p_TOTAL_NET_DUE-" + double.Parse(txtSpanMonthlyTotalNetDue.Text) + ":p_ATM_DEBIT_CLAIMS_ADJUSMENTS-" + double.Parse(txtATMDebitClaimsAdjustments.Text) +
                ":p_ATM_CREDIT_CLAIMS_ADJUSMENS-" + double.Parse(txtATMCreditClaimsAdjustment.Text) + ":p_POS_DEBIT_CLAIMS_ADJUSMENTS-" + double.Parse(POSDebitClaimsAdjustment.Text) + ":p_POS_CREDIT_CLAIMS_ADJUSMENTS-" + double.Parse(POSCreditClaimsAdjustment.Text);
            oracom.ExecuteNonQuery();
            oracon.Close();

            int resCode = int.Parse(oracom.Parameters["p_res_code"].Value.ToString());
            errorMsg = oracom.Parameters["p_res_msg"].Value.ToString();
            ExceptionUtility.LogException(0, "SAMA_MONTHLY_ACCT_EDITOR.UPDATE_MONTHLY_SETTL_DETAILS", "498.2", "updateSettlementDetails", parameters );
            return resCode;
        }
        catch (Exception ex)
        {
            ExceptionUtility.LogException(ex, "SAMA_MONTHLY_ACCT_EDITOR.UPDATE_MONTHLY_SETTL_DETAILS", "498.2", "updateSettlementDetails",parameters );
            return 1;
        }
    }
    protected void btn_print_Click(object sender, EventArgs e)
    {

    }
    private void clearResultControls()
    {
        this.txtIssuerBalanceInquiry.Text = "";
        this.txtAcquirerBalanceInquiry.Text = "";
        this.txtIssuerMiniStatement.Text = "";
        this.txtAcquirerMiniStatementCr.Text = "";
        this.txtATMRevenueWithdrawalMag.Text = "";
        this.txtATMExpenseWDMag.Text = "";
        this.txtIssuerCashWithdrawal.Text = "";
        this.txtAcquirerCashWithdrawal.Text = "";
        this.txtSPANDebitATMProcessFees.Text = "";
        this.txtSPANDebitPOSProcessFees.Text = "";
        this.txtOBCAcquirerATMProcessFee.Text = "";
        this.txtOBCAcquirerPOSProcessFees.Text = "";
        this.txtAmexPOSFees.Text = "";
        this.txtSpanMonthlyTotalNetDue.Text = "";
        this.txtATMDebitClaimsAdjustments.Text = "";
        this.txtATMCreditClaimsAdjustment.Text = "";
        this.POSDebitClaimsAdjustment.Text = "";
        this.POSCreditClaimsAdjustment.Text = "";

        this.lblIssuerBalanceInquirydr.Text = "";
        this.lblAcquirerBalanceInquiryDr.Text = "";
        this.lblIssuerMiniStatementDr.Text = "";
        this.lblAcquirerMiniStatementCr.Text = "";
        this.lblATMRevenueWithdrawalMagDr.Text = "";
        this.lblATMExpenseWithdrawal.Text = "";
        this.lblIssuerCashWithdrawalDr.Text = "";
        this.lblAcquirerCashWithDrawalDr.Text = "";
        this.lblSPANDebitATMProcessFeesDr.Text = "";
        this.lblSPANDebitPOSProcessFeesDr.Text = "";
        this.lblOBCAcquirerATMProcessFees.Text = "";
        this.lblOBCAcquirerPOSProcessFeesDr.Text = "";
        this.lblAmexPOSFeesDr.Text = "";
        this.lblSpanMonthlyTotalNetDueDr.Text = "";
        this.lblATMDebitClaimsAdjustmentsDr.Text = "";
        this.lblATMCreditClaimsAdjustmentDr.Text = "";
        this.lblPOSDebitClaimsAdjustmentDr.Text = "";
        this.lblPOSCreditClaimsAdjustmentDr.Text = "";

        this.lblIssuerBalanceInquiryCr.Text = "";
        this.lblAcquirerBalanceInquiryCr.Text = "";
        this.lblIssuerMiniStatementCr.Text = "";
        this.lblAcquirerMiniStatementCr.Text = "";
        this.lblATMRevenueWithdrawalMagCr.Text = "";
        this.lblATMExpenseWithdrawalCr.Text = "";
        this.lblIssuerCashWithdrawalCr.Text = "";
        this.lblAcquirerCashWithdrawalCr.Text = "";
        this.lblSPANDebitATMProcessFeesCr.Text = "";
        this.lblSPANDebitPOSProcessFeesCr.Text = "";
        this.lblOBCAcquirerATMProcessFees.Text = "";
        this.lblOBCAcquirerPOSProcessFeesCr.Text = "";
        this.lblAmexPOSFeesCr.Text = "";
        this.lblSpanMonthlyTotalNetDueCr.Text = "";
        this.lblATMDebitClaimsAdjustmentsCr.Text = "";
        this.lblATMCreditClaimsAdjustmentCr.Text = "";
        this.lblPOSDebitClaimsAdjustmentCr.Text = "";
        this.lblPOSCreditClaimsAdjustmentCr.Text = "";
       

    }

    private void clearManualControls()
    {
        this.txtIssuerBalanceInquiry.Text = "";
        this.txtAcquirerBalanceInquiry.Text = "";
        this.txtIssuerMiniStatement.Text = "";
        this.txtAcquirerMiniStatementCr.Text = "";
        this.txtATMRevenueWithdrawalMag.Text = "";
        this.txtATMExpenseWDMag.Text = "";
        this.txtIssuerCashWithdrawal.Text = "";
        this.txtAcquirerCashWithdrawal.Text = "";
        this.txtSPANDebitATMProcessFees.Text = "";
        this.txtSPANDebitPOSProcessFees.Text = "";
        this.txtOBCAcquirerATMProcessFee.Text = "";
        this.txtOBCAcquirerPOSProcessFees.Text = "";
        this.txtAmexPOSFees.Text = "";
        this.txtSpanMonthlyTotalNetDue.Text = "";
        this.txtATMDebitClaimsAdjustments.Text = "";
        this.txtATMCreditClaimsAdjustment.Text = "";
        this.POSDebitClaimsAdjustment.Text = "";
        this.POSCreditClaimsAdjustment.Text = "";
    }

    private void disableResultControls()
    {
        this.txtIssuerBalanceInquiry.Enabled = false;
        this.txtAcquirerBalanceInquiry.Enabled = false;
        this.txtIssuerMiniStatement.Enabled = false;
        this.txtAcquirerMiniStatementCr.Enabled = false;
        this.txtATMRevenueWithdrawalMag.Enabled = false;
        this.txtATMExpenseWDMag.Enabled = false;
        this.txtIssuerCashWithdrawal.Enabled = false;
        this.txtAcquirerCashWithdrawal.Enabled = false;
        this.txtSPANDebitATMProcessFees.Enabled = false;
        this.txtSPANDebitPOSProcessFees.Enabled = false;
        this.txtOBCAcquirerATMProcessFee.Enabled = false;
        this.txtOBCAcquirerPOSProcessFees.Enabled = false;
        this.txtAmexPOSFees.Enabled = false;
        this.txtSpanMonthlyTotalNetDue.Enabled = false;
        this.txtATMDebitClaimsAdjustments.Enabled = false;
        this.txtATMCreditClaimsAdjustment.Enabled = false;
        this.POSDebitClaimsAdjustment.Enabled = false;
        this.POSCreditClaimsAdjustment.Enabled = false;
    }

    private void enableResultControls()
    {
        this.txtIssuerBalanceInquiry.Enabled = true;
        this.txtAcquirerBalanceInquiry.Enabled = true;
        this.txtIssuerMiniStatement.Enabled = true;
        this.txtAcquirerMiniStatementCr.Enabled = true;
        this.txtATMRevenueWithdrawalMag.Enabled = true;
        this.txtATMExpenseWDMag.Enabled = true;
        this.txtIssuerCashWithdrawal.Enabled = true;
        this.txtAcquirerCashWithdrawal.Enabled = true;
        this.txtSPANDebitATMProcessFees.Enabled = true;
        this.txtSPANDebitPOSProcessFees.Enabled = true;
        this.txtOBCAcquirerATMProcessFee.Enabled = true;
        this.txtOBCAcquirerPOSProcessFees.Enabled = true;
        this.txtAmexPOSFees.Enabled = true;
        this.txtSpanMonthlyTotalNetDue.Enabled = true;
        this.txtATMDebitClaimsAdjustments.Enabled = true;
        this.txtATMCreditClaimsAdjustment.Enabled = true;
        this.POSDebitClaimsAdjustment.Enabled = true;
        this.POSCreditClaimsAdjustment.Enabled = true;
    }
    protected void btn_search_Click(object sender, EventArgs e)
    {
        if (dtp_filter_sttlDate.date.Length != 0)
        {
            this.lbl_error.Text = "";

            string settmelentDate = this.dtp_filter_sttlDate.date;
            string errorMsg = "";

            double resCode = -1;
            ExceptionUtility.LogException(0, "", "85.497", "btn_search_Click", "");
            loadDebitCredit();
            Dictionary<string, double> results = this.searchSamaAmounts(settmelentDate, ref errorMsg);
            resCode = results["p_res_code"];
            if (resCode == 0)
            {
                this.pnl_result.Visible = true;
                //this.pnl_searchCriteria.Enabled = false;
                this.enableResultControls();
                this.btn_save.Enabled = true;

                if (ViewState["mode"].ToString().Equals("0"))
                {

                    this.btn_save.Text = "   Add   ";

                    this.btn_print.Enabled = false;

                    this.clearManualControls();

                    this.enableResultControls();
                }
                else if (ViewState["mode"].ToString().Equals("1"))
                {

                    this.btn_save.Text = "  Update  ";

                    this.btn_print.Enabled = true;

                    this.txtIssuerBalanceInquiry.Text = results["p_ISSUER_BALANCE_INQUIRY"].ToString();
                    this.txtAcquirerBalanceInquiry.Text = results["p_ACQUIRER_BALANCE_INQUIRY"].ToString();
                    this.txtIssuerMiniStatement.Text = results["p_ISSUER_MINI_STATEMENT"].ToString();
                    this.txtAcquirerMiniStatementCr.Text = results["p_ACQUIRER_MINI_STATEMENT"].ToString();
                    this.txtATMRevenueWithdrawalMag.Text = results["p_ATM_REVENUE_WITHDRAWAL_MAG"].ToString();
                    this.txtATMExpenseWDMag .Text = results["p_ATM_EXPENSE_WITHDRAWAL_MAG"].ToString();
                    this.txtIssuerCashWithdrawal.Text = results["p_ISSUER_CASH_WITHDRAWAL"].ToString();
                    this.txtAcquirerCashWithdrawal.Text = results["p_ACQUIRER_CASH_WITHDRAWAL"].ToString();
                    this.txtSPANDebitATMProcessFees.Text = results["p_SPAN_DEBIT_ATM_PROC_FEES"].ToString();
                    this.txtSPANDebitPOSProcessFees.Text = results["p_SPAN_DEBIT_ATM_PROC_FEES"].ToString();
                    this.txtOBCAcquirerATMProcessFee.Text = results["p_OBC_ACQ_ATM_PROC_FEES"].ToString();
                    this.txtOBCAcquirerPOSProcessFees.Text = results["p_OBC_ACQ_POS_PROC_FEES"].ToString();
                    this.txtAmexPOSFees.Text = results["p_AMEX_POS_FEES"].ToString();
                    this.txtSpanMonthlyTotalNetDue.Text = results["p_TOTAL_NET_DUE"].ToString();
                    this.txtATMDebitClaimsAdjustments.Text = results["p_ATM_DEBIT_CLAIMS_ADJUSMENTS"].ToString();
                    this.txtATMCreditClaimsAdjustment.Text = results["p_ATM_CREDIT_CLAIMS_ADJUSMENS"].ToString();
                    this.POSDebitClaimsAdjustment.Text = results["p_POS_DEBIT_CLAIMS_ADJUSMENTS"].ToString();
                    this.POSCreditClaimsAdjustment.Text = results["p_POS_CREDIT_CLAIMS_ADJUSMENTS"].ToString();

                }


            }
            else if (resCode == 9)
            {
                ExceptionUtility.LogException(9, "SAMA_MONTHLY_ACCT_EDITOR.GET_SAMA_SETTL_MONTHLY_AMOUNTS", "", "btn_search_Click", "");
                this.lbl_error.Text = "No Data Found";

                this.pnl_result.Visible = false;
            }
            else if (resCode == 132)
            {
                ExceptionUtility.LogException(9, "SAMA_MONTHLY_ACCT_EDITOR.GET_SAMA_SETTL_MONTHLY_AMOUNTS", "", "btn_search_Click", "");
                this.lbl_error.Text = errorMsg;
                this.pnl_result.Visible = false;
            }
        }
    }
    private void loadDebitCredit()
    {
        string parameters = "";
        try
        {
            string currentMethod = "";
            StackTrace stackTrace = new StackTrace();
            currentMethod = stackTrace.GetFrame(1).GetMethod().Name;
            string DBConnection = Helper.dbConnection();

            OracleConnection oracon = new OracleConnection(DBConnection);
            oracon.Open();

            OracleCommand oracom = new OracleCommand();
            oracom.Connection = oracon;

            oracom.CommandType = CommandType.StoredProcedure;
            oracom.CommandText = "SAMA_MONTHLY_ACCT_EDITOR.get_SAMA_Debit_Credit";

            oracom.Parameters.Add("p_output", OracleType.Cursor).Direction = ParameterDirection.Output;

          

            OracleDataAdapter da = new OracleDataAdapter(oracom);
            DataSet ds = new DataSet();
            da.Fill(ds);

            oracon.Close();

            ExceptionUtility.LogException(0, "SAMA_MONTHLY_ACCT_EDITOR.get_SAMA_Debit_Credit", "497.1", "loadDebitCredit", parameters);

            if(ds.Tables[0].Rows.Count >0)
            {
                lblIssuerBalanceInquirydr.Text = ds.Tables[0].Rows[0]["ISSUER_BALANCE_INQUIRY_DR"].ToString();
                lblIssuerBalanceInquiryCr.Text = ds.Tables[0].Rows[0]["ISSUER_BALANCE_INQUIRY_CR"].ToString();
                lblAcquirerBalanceInquiryDr.Text = ds.Tables[0].Rows[0]["ACQUIRER_BALANCE_INQUIRY_DR"].ToString();
                lblAcquirerBalanceInquiryCr.Text = ds.Tables[0].Rows[0]["ACQUIRER_BALANCE_INQUIRY_CR"].ToString();
                lblIssuerMiniStatementDr.Text = ds.Tables[0].Rows[0]["ISSUER_MINI_STATEMENT_DR"].ToString();
                lblIssuerMiniStatementCr.Text = ds.Tables[0].Rows[0]["ISSUER_MINI_STATEMENT_CR"].ToString();
                lblAcquirerMiniStatmentDr.Text = ds.Tables[0].Rows[0]["ACQUIRER_MINI_STATEMENT_DR"].ToString();
                lblAcquirerMiniStatementCr.Text = ds.Tables[0].Rows[0]["ACQUIRER_MINI_STATEMENT_CR"].ToString();
                lblATMRevenueWithdrawalMagDr.Text = ds.Tables[0].Rows[0]["ATM_REVENUE_WD_MAG_DR"].ToString();
                lblATMRevenueWithdrawalMagCr.Text = ds.Tables[0].Rows[0]["ATM_REVENUE_WD_MAG_CR"].ToString();
                lblATMExpenseWithdrawal .Text = ds.Tables[0].Rows[0]["ATM_EXPENSE_WD_MAG_DR"].ToString();
                lblATMExpenseWithdrawalCr.Text = ds.Tables[0].Rows[0]["ATM_EXPENSE_WD_MAG_CR"].ToString();
                lblIssuerCashWithdrawalDr.Text = ds.Tables[0].Rows[0]["ISSUER_CASH_WD_DR"].ToString();
                lblIssuerCashWithdrawalCr.Text = ds.Tables[0].Rows[0]["ISSUER_CASH_WD_CR"].ToString();
                lblAcquirerCashWithDrawalDr.Text = ds.Tables[0].Rows[0]["ACQUIRER_CASH_WD_DR"].ToString();
                lblAcquirerCashWithdrawalCr.Text = ds.Tables[0].Rows[0]["ACQUIRER_CASH_WD_CR"].ToString();
                lblSPANDebitATMProcessFeesDr.Text = ds.Tables[0].Rows[0]["SPAN_DEBIT_ATM_PROC_FEES_DR"].ToString();
                lblSPANDebitATMProcessFeesCr.Text = ds.Tables[0].Rows[0]["SPAN_DEBIT_ATM_PROC_FEES_CR"].ToString();
                lblSPANDebitPOSProcessFeesDr.Text = ds.Tables[0].Rows[0]["SPAN_DEBIT_POS_PROC_FEES_DR"].ToString();
                lblSPANDebitPOSProcessFeesCr.Text = ds.Tables[0].Rows[0]["SPAN_DEBIT_POS_PROC_FEES_CR"].ToString();
                lblOBCAcquirerATMProcessFees.Text = ds.Tables[0].Rows[0]["OBC_ACQ_ATM_PROC_FEES_DR"].ToString();
                lblOBCAcquirerATMProcessFeeCr.Text = ds.Tables[0].Rows[0]["OBC_ACQ_ATM_PROC_FEES_CR"].ToString();
                lblOBCAcquirerPOSProcessFeesDr.Text = ds.Tables[0].Rows[0]["OBC_ACQ_POS_PROC_FEES_DR"].ToString();
                lblOBCAcquirerPOSProcessFeesCr.Text = ds.Tables[0].Rows[0]["OBC_ACQ_POS_PROC_FEES_CR"].ToString();
                lblAmexPOSFeesDr.Text = ds.Tables[0].Rows[0]["AMEX_POS_FEES_DR"].ToString();
                lblAmexPOSFeesCr.Text = ds.Tables[0].Rows[0]["AMEX_POS_FEES_CR"].ToString();
                lblSpanMonthlyTotalNetDueDr.Text = ds.Tables[0].Rows[0]["TOTAL_NET_DUE_DR"].ToString();
                lblSpanMonthlyTotalNetDueCr.Text = ds.Tables[0].Rows[0]["TOTAL_NET_DUE_CR"].ToString();
                lblATMDebitClaimsAdjustmentsDr.Text = ds.Tables[0].Rows[0]["ATM_DEBIT_CLAIMS_ADJ_DR"].ToString();
                lblATMDebitClaimsAdjustmentsCr.Text = ds.Tables[0].Rows[0]["ATM_DEBIT_CLAIMS_ADJ_CR"].ToString();
                lblATMCreditClaimsAdjustmentDr.Text = ds.Tables[0].Rows[0]["ATM_CREDIT_CLAIMS_ADJ_DR"].ToString();
                lblATMCreditClaimsAdjustmentCr.Text = ds.Tables[0].Rows[0]["ATM_CREDIT_CLAIMS_ADJ_CR"].ToString();
                lblPOSDebitClaimsAdjustmentDr.Text = ds.Tables[0].Rows[0]["POS_DEBIT_CLAIMS_ADJ_DR"].ToString();
                lblPOSDebitClaimsAdjustmentCr.Text = ds.Tables[0].Rows[0]["POS_DEBIT_CLAIMS_ADJ_CR"].ToString();
                lblPOSCreditClaimsAdjustmentDr.Text = ds.Tables[0].Rows[0]["POS_CREDIT_CLAIMS_ADJ_DR"].ToString();
                lblPOSCreditClaimsAdjustmentCr.Text = ds.Tables[0].Rows[0]["POS_CREDIT_CLAIMS_ADJ_CR"].ToString();
            }
            
        }
        catch (Exception ex)
        {
            ExceptionUtility.LogException(ex, "SAMA_MONTHLY_ACCT_EDITOR.get_SAMA_monthly_GL", "497.1", "loadDebitCredit", parameters);
           
        }
    }
    private Dictionary<string, double> searchSamaAmounts(string settlementDate, ref string errorMsg)
    {

        try
        {
            string currentMethod = "";
            StackTrace stackTrace = new StackTrace();
            currentMethod = stackTrace.GetFrame(1).GetMethod().Name;
            Dictionary<string, double> resultParams = new Dictionary<string, double>();
            int resCode;

            string DBConnection = Helper.dbConnection();

            OracleConnection oracon = new OracleConnection(DBConnection);
            oracon.Open();

            OracleCommand oracom = new OracleCommand();
            oracom.Connection = oracon;

            oracom.CommandType = CommandType.StoredProcedure;
            oracom.CommandText = "SAMA_MONTHLY_ACCT_EDITOR.GET_SAMA_SETTL_MONTHLY_AMOUNTS";

            oracom.Parameters.Add("p_current_uid", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_lang", OracleType.VarChar).Direction = ParameterDirection.Input;

            oracom.Parameters.Add("p_settl_date", OracleType.VarChar).Direction = ParameterDirection.Input;

            oracom.Parameters.Add("p_ISSUER_BALANCE_INQUIRY", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_ACQUIRER_BALANCE_INQUIRY", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_ISSUER_MINI_STATEMENT", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_ACQUIRER_MINI_STATEMENT", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_ATM_REVENUE_WITHDRAWAL_MAG", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_ATM_EXPENSE_WITHDRAWAL_MAG", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_ISSUER_CASH_WITHDRAWAL", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_ACQUIRER_CASH_WITHDRAWAL", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_SPAN_DEBIT_ATM_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_SPAN_DEBIT_POS_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_OBC_ACQ_ATM_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_OBC_ACQ_POS_PROC_FEES", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_AMEX_POS_FEES", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_TOTAL_NET_DUE", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_ATM_DEBIT_CLAIMS_ADJUSMENTS", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_ATM_CREDIT_CLAIMS_ADJUSMENS", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_POS_DEBIT_CLAIMS_ADJUSMENTS", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_POS_CREDIT_CLAIMS_ADJUSMENTS", OracleType.Number).Direction = ParameterDirection.Output;          

            //oracom.Parameters.Add("p_app_status", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_status", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_res_code", OracleType.Number).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_res_type", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
            oracom.Parameters.Add("p_res_msg", OracleType.VarChar, 250).Direction = ParameterDirection.Output;

            oracom.Parameters["p_current_uid"].Value = Session["uid"].ToString(); ;
            oracom.Parameters["p_lang"].Value = "EN";
            oracom.Parameters["p_settl_date"].Value = settlementDate;

            OracleDataAdapter da = new OracleDataAdapter(oracom);
            DataSet ds = new DataSet();
            da.Fill(ds);

            oracon.Close();

            ViewState["mode"] = oracom.Parameters["p_status"].Value.ToString();
            

            errorMsg = oracom.Parameters["p_res_msg"].Value.ToString();
            resCode = int.Parse(oracom.Parameters["p_res_code"].Value.ToString());

            resultParams.Add("p_res_code", resCode);

            if (resCode == 0)
            {

                //resultParams.Add("p_sama_atm_credit", double.Parse(oracom.Parameters["p_sama_atm_credit"].Value.ToString()));
                //resultParams.Add("p_sama_atm_debit", double.Parse(oracom.Parameters["p_sama_atm_debit"].Value.ToString()));
                //resultParams.Add("p_sama_pos_credit", double.Parse(oracom.Parameters["p_sama_pos_credit"].Value.ToString()));
                //resultParams.Add("p_sama_pos_debit", double.Parse(oracom.Parameters["p_sama_pos_debit"].Value.ToString()));
                //resultParams.Add("p_sama_gcc_atm_credit", double.Parse(oracom.Parameters["p_sama_gcc_atm_credit"].Value.ToString()));
                //resultParams.Add("p_sama_gcc_atm_debit", double.Parse(oracom.Parameters["p_sama_gcc_atm_debit"].Value.ToString()));

                //resultParams.Add("p_sama_gcc_atm_credit_FEES", double.Parse(oracom.Parameters["p_sama_gcc_atm_credit_FEES"].Value.ToString()));
                //resultParams.Add("p_sama_gcc_atm_debit_FEES", double.Parse(oracom.Parameters["p_sama_gcc_atm_debit_FEES"].Value.ToString()));

                if (ViewState["mode"].ToString().Equals("1"))
                {
                    //resultParams.Add("p_app_status", int.Parse(oracom.Parameters["p_app_status"].Value.ToString()));
                    resultParams.Add("p_ISSUER_BALANCE_INQUIRY", double.Parse(oracom.Parameters["p_ISSUER_BALANCE_INQUIRY"].Value.ToString()));
                    resultParams.Add("p_ACQUIRER_BALANCE_INQUIRY", double.Parse(oracom.Parameters["p_ACQUIRER_BALANCE_INQUIRY"].Value.ToString()));
                    resultParams.Add("p_ISSUER_MINI_STATEMENT", double.Parse(oracom.Parameters["p_ISSUER_MINI_STATEMENT"].Value.ToString()));
                    resultParams.Add("p_ACQUIRER_MINI_STATEMENT", double.Parse(oracom.Parameters["p_ACQUIRER_MINI_STATEMENT"].Value.ToString()));
                    resultParams.Add("p_ATM_REVENUE_WITHDRAWAL_MAG", double.Parse(oracom.Parameters["p_ATM_REVENUE_WITHDRAWAL_MAG"].Value.ToString()));
                    resultParams.Add("p_ATM_EXPENSE_WITHDRAWAL_MAG", double.Parse(oracom.Parameters["p_ATM_EXPENSE_WITHDRAWAL_MAG"].Value.ToString()));
                    resultParams.Add("p_ISSUER_CASH_WITHDRAWAL", double.Parse(oracom.Parameters["p_ISSUER_CASH_WITHDRAWAL"].Value.ToString()));
                    resultParams.Add("p_ACQUIRER_CASH_WITHDRAWAL", double.Parse(oracom.Parameters["p_ACQUIRER_CASH_WITHDRAWAL"].Value.ToString()));
                    resultParams.Add("p_SPAN_DEBIT_ATM_PROC_FEES", double.Parse(oracom.Parameters["p_SPAN_DEBIT_ATM_PROC_FEES"].Value.ToString()));
                    resultParams.Add("p_SPAN_DEBIT_POS_PROC_FEES", double.Parse(oracom.Parameters["p_SPAN_DEBIT_POS_PROC_FEES"].Value.ToString()));
                    resultParams.Add("p_OBC_ACQ_ATM_PROC_FEES", double.Parse(oracom.Parameters["p_OBC_ACQ_ATM_PROC_FEES"].Value.ToString()));
                    resultParams.Add("p_OBC_ACQ_POS_PROC_FEES", double.Parse(oracom.Parameters["p_OBC_ACQ_POS_PROC_FEES"].Value.ToString()));
                    resultParams.Add("p_AMEX_POS_FEES", double.Parse(oracom.Parameters["p_AMEX_POS_FEES"].Value.ToString()));
                    resultParams.Add("p_TOTAL_NET_DUE", double.Parse(oracom.Parameters["p_TOTAL_NET_DUE"].Value.ToString()));
                    resultParams.Add("p_ATM_DEBIT_CLAIMS_ADJUSMENTS", double.Parse(oracom.Parameters["p_ATM_DEBIT_CLAIMS_ADJUSMENTS"].Value.ToString()));
                    resultParams.Add("p_ATM_CREDIT_CLAIMS_ADJUSMENS", double.Parse(oracom.Parameters["p_ATM_CREDIT_CLAIMS_ADJUSMENS"].Value.ToString()));
                    resultParams.Add("p_POS_DEBIT_CLAIMS_ADJUSMENTS", double.Parse(oracom.Parameters["p_POS_DEBIT_CLAIMS_ADJUSMENTS"].Value.ToString()));
                    resultParams.Add("p_POS_CREDIT_CLAIMS_ADJUSMENTS", double.Parse(oracom.Parameters["p_POS_CREDIT_CLAIMS_ADJUSMENTS"].Value.ToString()));                    
                }
            }
            if (currentMethod.Contains("btn_search_Click"))
                ExceptionUtility.LogException(0, "SAMA_MONTHLY_ACCT_EDITOR.GET_SAMA_SETTL_MONTHLY_AMOUNTS", "497.2", "searchSamaAmounts", "SettlementDate: " + settlementDate);
            return resultParams;
        }
        catch (Exception ex)
        {
            ExceptionUtility.LogException(ex, "SAMA_MONTHLY_ACCT_EDITOR.GET_SAMA_SETTL_MONTHLY_AMOUNTS", "497.2", "searchSamaAmounts", "SettlementDate: " + settlementDate);
            //Response.Redirect("../ErrorPages/ErrorPage.aspx");
            return null;
        }
    }
}