コード例 #1
0
    protected void btnPreview_Click(object sender, EventArgs e)
    {
        string fileName = "";

        ReportDoc  = new ReportDocument();
        ReportPath = Server.MapPath("~/CrystalReports/Payroll/rptPFLoanLedger.rpt");
        DataTable MyDataTable = objPayRptMgr.GetPFLoanLedgerData(ddlMonth.SelectedValue.ToString(), ddlFiscalYear.SelectedValue.ToString(), "");

        ReportDoc.Load(ReportPath);
        ReportDoc.SetDataSource(MyDataTable);

        ReportDoc.SetParameterValue("pMonthName", Common.ReturnFullMonthName(ddlMonth.SelectedValue.ToString()));
        fileName = Session["USERID"].ToString() + "_" + "PF Loan Ledger" + ".pdf";
        this.ExPortReport(ReportDoc, fileName);

        StringBuilder sb = new StringBuilder();

        sb.Append("<script>");
        sb.Append("window.open('~/CrystalReports/Payroll/VirtualReport/" + fileName + "', '', 'fullscreen=true,scrollbars=yes,resizable=yes');");
        //sb.Append("window.open('PayrollReportViewer.aspx', '', 'fullscreen=true,scrollbars=yes,resizable=yes');");//
        sb.Append("</script>");
        ScriptManager.RegisterStartupScript(this, this.GetType(), "ConfirmSubmit", sb.ToString(), false);
        ClientScript.RegisterStartupScript(this.GetType(), "ConfirmSubmit", sb.ToString());
        //StringBuilder sb = new StringBuilder();
        //string strURL = "../../CrystalReports/Payroll/PFLoanLedgerViewer.aspx?params=" + ddlMonth.SelectedValue.ToString() + "," + DateTime.Today.Year.ToString() + "," + ddlFiscalYear.SelectedValue.ToString();
        //sb.Append("<script>");
        ////sb.Append("window.open('" + strURL + "', '', 'fullscreen=true,scrollbars=yes,resizable=yes');");//
        //sb.Append("window.open('" + strURL + "', '', '');");
        //sb.Append("</script>");
        //ScriptManager.RegisterStartupScript(this, this.GetType(), "ConfirmSubmit",
        //                         sb.ToString(), false);
        //ClientScript.RegisterStartupScript(this.GetType(), "ConfirmSubmit", sb.ToString());
    }
コード例 #2
0
 protected void GenerateReport(string strMonth, string strYear, string strFinYear)
 {
     ReportDoc  = new ReportDocument();
     ReportPath = Server.MapPath("~/CrystalReports/Payroll/rptPFLoanLedger.rpt");
     this.PassParameter(Common.ReturnFullMonthName(strMonth));
     ReportDoc.Load(ReportPath);
     ReportDoc.SetDataSource(objPayRptMgr.GetPFLoanLedgerData(strMonth, strFinYear, "M"));
     CRV.ReportSource = ReportDoc;
 }