Exemplo n.º 1
0
    public void BindGrid()
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        _reportBO = new Bill_Sys_ReportBO();
        try
        {
            ArrayList arrlst = new ArrayList();
            arrlst.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
            if (Session["SZ_OFFICE_ID"].ToString() != " ")
            {
                arrlst.Add(Session["SZ_OFFICE_ID"].ToString());
            }
            else
            {
                arrlst.Add("");
            }
            //Added Parameter Date , Location For Searching:- TUSHAR
            arrlst.Add(Session["sz_From_Date"].ToString());
            arrlst.Add(Session["sz_To_Date"].ToString());
            arrlst.Add(Session["SZ_LOCATION_id"].ToString());
            arrlst.Add(Session["sz_Office_Id_Text"].ToString());
            //end Of Code
            DataSet objDS = new DataSet();
            objDS = _reportBO.GetDetailBillReportBySpeciality(arrlst);

            decimal SumTotalBillAmount        = 0;
            decimal SumTotalPaidAmount        = 0;
            decimal SumTotalOutstandingAmount = 0;

            for (int i = 0; i < objDS.Tables[0].Rows.Count; i++)
            {
                SumTotalBillAmount        = SumTotalBillAmount + Convert.ToDecimal(objDS.Tables[0].Rows[i]["TOTAL_BILL_AMOUNT"].ToString().Remove(0, 1));
                SumTotalPaidAmount        = SumTotalPaidAmount + Convert.ToDecimal(objDS.Tables[0].Rows[i]["TOTAL_PAID_AMOUNT"].ToString().Remove(0, 1));
                SumTotalOutstandingAmount = SumTotalOutstandingAmount + Convert.ToDecimal(objDS.Tables[0].Rows[i]["TOTAL_OUTSTANDING_AMOUNT"].ToString().Remove(0, 1));
            }

            if (objDS.Tables[0].Rows.Count > 0)
            {
                DataRow objDR = objDS.Tables[0].NewRow();
                objDR["SZ_BILL_NUMBER"]           = "";
                objDR["SZ_CASE_NO"]               = "";
                objDR["SZ_PATIENT_NAME"]          = "";
                objDR["DT_BILL_DATE"]             = "";
                objDR["DT_FIRST_LAST_VISIT_DATE"] = "<b>Total</b>";
                objDR["SZ_CASE_TYPE"]             = "";
                objDR["TOTAL_BILL_AMOUNT"]        = "<b>$" + SumTotalBillAmount.ToString() + "</b>";
                objDR["TOTAL_PAID_AMOUNT"]        = "<b>$" + SumTotalPaidAmount.ToString() + "</b>";
                objDR["TOTAL_OUTSTANDING_AMOUNT"] = "<b>$" + SumTotalOutstandingAmount.ToString() + "</b>";
                objDR["SZ_COMMENT"]               = "";
                objDS.Tables[0].Rows.InsertAt(objDR, 0);
            }

            grdPayment.DataSource = objDS;
            grdPayment.DataBind();
        }
        catch (Exception ex)
        {
            lblMsg.Visible = true;

            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }