Cách tạo báo cáo tinh thể trong mvc 4 dao cạo C#.net

lập trình


CHÀO,

Tôi muốn tạo báo cáo tinh thể bằng trình xem báo cáo ở trang .chtml, pdf có thể thực hiện được nhưng
không phải với trình xem báo cáo.

gợi ý cho tôi nếu bạn có bất kỳ ý tưởng.

Tôi làm việc trên công cụ xem dao cạo, mvc 4, c#, .net

Giải pháp 3

Giải pháp 1

Tôi chưa bao giờ sử dụng báo cáo Crystal trong MVC nhưng tôi đã tìm thấy chi tiết này, hãy xem thử
Sử dụng Điều khiển Trình báo cáo, trong chế độ xem Dao cạo, trong Khung MVC3[^]

Giải pháp 2

Giải pháp 4

@page
@using System.Data.SqlClient;
@using System.Diagnostics;
@model QT2Docs.Pages.JobCostingAPIModel
@{
    string JobNumber = Request.Query["JobNumber"];
    Random rnd = new Random();
    int FileInt = rnd.Next(1, 100);
    string FileNum = FileInt.ToString();
    DateTime today = DateTime.Today;

    string CryConnect = System.Configuration.ConfigurationManager.AppSettings["CReportCon"];
    string FileName = " -F \"C:\\Reports\\JobCostDetailByJob.RPT\"";
    string RptOptions = " -A @JobNumber:" + JobNumber + " -A @StartDate:01/01/1900 -A @EndDate:" + (today.ToString("MM/dd/yyyy")) + " -A @GangRunJobs:0 -A @JobStatus:All -A @GroupBy:0 -A @DateTypeFilter:-1 -A @EstimateData:0 -A @PlantID:All ";
    string TheOutput = " -EPDF -O \"C:\\inetpub\\wwwroot\\QT2Docs\\wwwroot\\JobCostDetailByJob" + FileNum + ".pdf\"";

    string RptPareamiters = CryConnect + FileName + RptOptions + TheOutput;

    var process = Process.Start(@"c:\reports\crexport.exe", RptPareamiters);
    process.WaitForExit();

    //crexport.exe -S server -U sa -P password -D "database"                      /// server connection
    // -F "C:\Reports\InvoiceCreditNotes.rpt"                                     /// report file
    // -A @DocumentType:INVOICE -A @StartNum:%%A -A @EndNum:%%A -A @Batch:1       /// RTP paramiters format -A Paramiter:Value  the @ symbol is for SP value, do not use @ when just passing data
    // -EPDF -O "C:\Reports\InvoiceCreditNotes.pdf"                               /// FIle format and outputfile
    // crexport.exe was recompiled to .net 4.8 and code is from    https://github.com/rainforestnet/CrystalReportsNinja
    // Also *Note The application pool will need to use an identity that has rights to run and store report 
    Response.Redirect("/QT2Docs/JobCostDetailByJob" + FileNum + ".pdf");

This is the contents of JobCostingAPI.cshtml for my razor project called QT2Docs. when this page is feed the job number though http://somewebserver/QT2Docs/JobCostingAPI?Jobnumber=654321
it builds the report parameters and connection then deposits the pdf where i can link it. The FileNum (random)value is to help keep from more than one report over weighting a second concurrent run. Thank the people at rainforestnet for an old app that still kicks butt

コメント

タイトルとURLをコピーしました