예제 #1
0
    private void bankReport()
    {
        DataSet dsresult = new DataSet();

        dsresult = VWAImportDAL.getBOAData(ddlYrmo.SelectedItem.Text);
        DataRow[] rows;
        DataRow   rowNew;
        decimal   _fdx, _vwa, _disab, _disabT;

        _bfdxT = 0; _bvwaT = 0; _disabT = 0;
        if (dsresult.Tables[0].Rows.Count > 0)
        {
            rows = dsresult.Tables[0].Select("[WireTo] IN ('FDX','VWA','DisAb')");
            foreach (DataRow dr in rows)
            {
                _fdx   = 0; _vwa = 0; _disab = 0;
                rowNew = tbSum1.NewRow();
                rowNew["Bank Post Date"] = dr["PostDate"];
                if (dr["WireTo"].ToString().Equals("FDX"))
                {
                    _fdx = Convert.ToDecimal(dr["Amount"]);
                }
                if (dr["WireTo"].ToString().Equals("VWA"))
                {
                    _vwa = Convert.ToDecimal(dr["Amount"]);
                }
                if (dr["WireTo"].ToString().Equals("DisAb"))
                {
                    _disab = Convert.ToDecimal(dr["Amount"]);
                    _fdx   = _disab;
                }
                rowNew["Bank RefNum"]     = dr["RefNum"];
                rowNew["Bank FDX Amount"] = _fdx.ToString().Equals("0") ? "" : _fdx.ToString();
                rowNew["Bank VWA Amount"] = _vwa.ToString().Equals("0") ? "" : _vwa.ToString();
                tbSum1.Rows.Add(rowNew);
            }

            _bfdxT =
                Convert.ToDecimal(dsresult.Tables[0].Compute("SUM([Amount])", "[importType] = 'Detail' AND [WireTo] = 'FDX'").ToString());
            _bvwaT =
                Convert.ToDecimal(dsresult.Tables[0].Compute("SUM([Amount])", "[importType] = 'Detail' AND [WireTo] = 'VWA'").ToString());
            _disabT =
                Convert.ToDecimal(dsresult.Tables[0].Compute("SUM([Amount])", "[importType] = 'Detail' AND [WireTo] = 'DisAb'").ToString());

            _bfdxT = _bfdxT + _disabT;

            rowNew = tbSum1.NewRow();
            rowNew["Bank RefNum"]     = "Total:";
            rowNew["Bank FDX Amount"] = _bfdxT.ToString();
            rowNew["Bank VWA Amount"] = _bvwaT.ToString();
            tbSum1.Rows.Add(rowNew);
        }
    }
    protected void bindResults()
    {
        clearMessages();
        resultDiv.Visible = true;
        string _sb1 = "", _td1 = "", _tw1 = "", _eb1 = "";

        try
        {
            DataSet dsresult = new DataSet();
            dsresult = VWAImportDAL.getBOAData(ddlYrmo.SelectedItem.Text);
            foreach (DataRow dr in dsresult.Tables[0].Rows)
            {
                string _type = dr["Type"].ToString();
                switch (_type)
                {
                case "Start Balance":
                    _sb1 = Convert.ToDecimal(dr["Amount"]).ToString("C");
                    break;

                case "Total Deposits":
                    _td1 = Convert.ToDecimal(dr["Amount"]).ToString("C");
                    break;

                case "Total Withdrawls":
                    _tw1 = ((-1) * Convert.ToDecimal(dr["Amount"])).ToString("C");
                    break;

                case "End Balance":
                    _eb1 = Convert.ToDecimal(dr["Amount"]).ToString("C");
                    break;
                }
            }
            if (dsresult.Tables[0].Rows.Count > 0)
            {
                //Summary
                lblSBalance.Text   = _sb1;
                lblDeposits.Text   = _td1;
                lblWithdrawls.Text = _tw1;
                lblEnding.Text     = _eb1;
                decimal _tot1 = decimal.Parse(_sb1, System.Globalization.NumberStyles.Currency)
                                + decimal.Parse(_td1, System.Globalization.NumberStyles.Currency)
                                + decimal.Parse(_tw1, System.Globalization.NumberStyles.Currency);
                lblTotalV.Text = _tot1.ToString("C");
                decimal _tot2 = _tot1 - decimal.Parse(_eb1, System.Globalization.NumberStyles.Currency);
                lblFinalV.Text = _tot2.ToString("C");
                if (_tot2 != 0)
                {
                    Image3.Visible = true;
                }
                else
                {
                    Image1.Visible = true;
                }

                //Deposits
                decimal _dep1 =
                    decimal.Parse((dsresult.Tables[0].Compute("SUM([Amount])", "[importType] = 'Detail' AND ([Type] = 'DEP' OR [Type] = 'MSCC')")).ToString(), System.Globalization.NumberStyles.Currency);
                decimal _tot3 = decimal.Parse(_td1, System.Globalization.NumberStyles.Currency) - _dep1;
                lblDep11.Text    = _dep1.ToString("C");
                lblDep12.Text    = _td1;
                lblDeptotal.Text = _tot3.ToString("C");
                if (_tot2 != 0)
                {
                    Image5.Visible = true;
                }
                else
                {
                    Image4.Visible = true;
                }

                //Deposits
                decimal _withd1 =
                    decimal.Parse((dsresult.Tables[0].Compute("SUM([Amount])", "[importType] = 'Detail' AND ([Type] <> 'DEP' AND [Type] <> 'MSCC')")).ToString(), System.Globalization.NumberStyles.Currency);
                decimal _tot4 = decimal.Parse(_tw1, System.Globalization.NumberStyles.Currency) + _withd1;
                lblWithd11.Text    = _withd1.ToString("C");
                lblWithd12.Text    = ((-1) * decimal.Parse(_tw1, System.Globalization.NumberStyles.Currency)).ToString("C");
                lblWithdtotal.Text = _tot4.ToString("C");
                if (_tot4 != 0)
                {
                    Image7.Visible = true;
                }
                else
                {
                    Image6.Visible = true;
                }
            }
        }
        catch (Exception ex)
        {
            errorDiv1.Visible = true;
            lblError1.Text    = ex.Message;
        }
    }