Cara membuat laporan kristal di mvc 4 pisau cukur c#.net

pemrograman


Hai,

Saya ingin membuat laporan kristal dengan penampil laporan di halaman .chtml dimungkinkan dengan pdf tetapi
tidak dengan penampil laporan.

sarankan saya jika Anda punya ide.

Saya bekerja pada mesin tampilan pisau cukur, mvc 4, c#, .net

Solusi 3

Solusi 1

Saya tidak pernah menggunakan Crystal Reports di MVC tapi saya menemukan detail ini, coba lihat
Menggunakan Kontrol Reportviewer, dalam tampilan Razor, di Kerangka MVC3[^]

Solusi 2

Solusi 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をコピーしました