水晶报告无法正常工作

时间:2016-05-04 01:33:03

标签: c# asp.net crystal-reports report

尝试使用水晶报告生成收据。创建了代码和报告。该功能是单击超链接以创建收据,将下载pdf版本...应显示在窗口底部。

但是,代码似乎正在运行,但没有水晶报告已下载。

使用3层实体框架。

这是我的代码。请帮忙:(

linkreceipt_click

>  List<CheckStatuscs> checkstatus =
> cl.PrintReceipt(Convert.ToInt32(ViewState["AppID"]));
>                 DataTable datatable = ConvertToDatatable(checkstatus);
>                 ReportDocument rpt = new ReportDocument();
>                 rpt.Load(Server.MapPath("~/Receipt/PaymentReceipt.rpt"));
>                 rpt.SetDataSource(datatable);
>                 rpt.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat,
> Response, true, "Receipt");

控制层

 public List<CheckStatuscs> PrintReceipt(int AppID)
        {

            var dt = dl.PrintReceipt(AppID);
            return dt;

        }

数据层

 public List<CheckStatuscs> PrintReceipt(int AppID)
    {
        var dt = (from pa in ctx.MS_Payment
                  join pu in ctx.MS_Applications_Public on ((Int32)pa.iApp_ID)             equals ((Int32)pu.iApp_ID)
                  join em in ctx.MS_Emp_Details on pu.iEmp_ID equals em.iEmp_ID
                  where pa.iApp_ID == AppID
                  select new CheckStatuscs
                  {
                      Submissionno = pu.vSubmission_No,
                      Employeename = em.vEmp_Name,
                      Workername = pu.vWorker_Name,
                      Nricfin = pu.vFIN_NRIC,
                      Namount = pa.nAmount,
                      Createdon = pa.CreatedOn,
                      Gst = pa.nGST,
                      Totalamount = pa.nTotalAmount,
                      Receiptnumber = pa.vReceipt_No,
                      Paymenttype = pa.iPayment_Type,
                      Contactperson1 = em.vContact_Person
                  }).ToList();
        return dt;
    }

CheckStatuscs.cs

using System; using System.Collections.Generic; using System.Linq; using System.Web;

namespace MultiSkill {
    public class CheckStatuscs
    {
        String submissionno;

        public String Submissionno
        {
            get { return submissionno; }
            set { submissionno = value; }
        }
        String employeename;

        public String Employeename
        {
            get { return employeename; }
            set { employeename = value; }
        }
        String workername;

        public String Workername
        {
            get { return workername; }
            set { workername = value; }
        }
        String nricfin;

        public String Nricfin
        {
            get { return nricfin; }
            set { nricfin = value; }
        }
        Double namount;

        public Double Namount
        {
            get { return namount; }
            set { namount = value; }
        }

        DateTime createdon;

        public DateTime Createdon
        {
            get { return createdon; }
            set { createdon = value; }
        }
        Double gst;

        public Double Gst
        {
            get { return gst; }
            set { gst = value; }
        }
        Double totalamount;

        public Double Totalamount
        {
            get { return totalamount; }
            set { totalamount = value; }
        }
        String receiptnumber;

        public String Receiptnumber
        {
            get { return receiptnumber; }
            set { receiptnumber = value; }
        }
        String paymenttype;

        public String Paymenttype
        {
            get { return paymenttype; }
            set { paymenttype = value; }
        }
        String Contactperson;

        public String Contactperson1
        {
            get { return Contactperson; }
            set { Contactperson = value; }
        }
    } }

非常感谢。

0 个答案:

没有答案