Example #1
0
    public override void Start()
    {
        DoneFlag = false;
        Report.Init(this, 1, wsReportName);
        Report.PrintBlock(reportLvlStart);

        DataTable dt  = new DataTable();
        string    FDT = "";

        if (string.IsNullOrEmpty(wsFromDate))
        {
            FDT = "01/01/1990";
        }
        else
        {
            FDT = wsFromDate;
        }

        ClsProfitAndLoss PandL = new ClsProfitAndLoss();

        dt = PandL.ProfitAndLoss(wsBRCD, FDT, wsUserName);

        if (dt != null)
        {
            if (dt.Rows.Count != 0)
            {
                for (i = 0; i < dt.Rows.Count; i++)
                {
                    wsOpBal = 0;
                    wsCrBal = 0;
                    wsDrBal = 0;
                    wsClBal = 0;

                    wsGlCode    = dt.Rows[i]["GlCode"].ToString();
                    wsSubGlCode = dt.Rows[i]["SubGlCode"].ToString();
                    wsGlName    = dt.Rows[i]["GlName"].ToString();
                    wsOpBal     = Math.Round(Convert.ToDouble(dt.Rows[i]["OpBal"].ToString()), 2);
                    wsCrBal     = Math.Round(Convert.ToDouble(dt.Rows[i]["CrBal"].ToString()), 2);
                    wsDrBal     = Math.Round(Convert.ToDouble(dt.Rows[i]["DrBal"].ToString()), 2);
                    wsClBal     = Math.Round(Convert.ToDouble(dt.Rows[i]["ClBal"].ToString()), 2);

                    wsRptOpTotal = wsRptOpTotal + wsOpBal;
                    wsRptCrTotal = wsRptCrTotal + wsCrBal;
                    wsRptDrTotal = wsRptDrTotal + wsDrBal;
                    wsRptClTotal = wsRptClTotal + wsClBal;
                    Report.PrintBlock(details);
                }
            }
        }
        Report.PrintBlock(reportLvlEnd);
        Report.Finalize();
        DoneFlag = true;
    }
    public void BindGrid()
    {
        try
        {
            DataTable dt = new DataTable();
            dt = PL.ProfitAndLoss(TxtBrID.Text, TxtFDT.Text, Session["UserName"].ToString());

            if (dt.Rows.Count > 0)
            {
                GrdProfitLoss.DataSource = dt;
                GrdProfitLoss.DataBind();
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
            //Response.Redirect("FrmLogin.aspx", true);
        }
    }