How to print first time Main Copy
second time Customer Copy
third or more time Duplicate Copy
My requirement is as in the image below:
VB Code
At first do Import
Imports System.Web.UI.WebControls
Public Sub ShowReport(ByVal MyReport As CrystalDecisions.CrystalReports.Engine.ReportDocument, ByVal filterstring As String, ByVal CrystalReportViewer As CrystalDecisions.Windows.Forms.CrystalReportViewer)
Dim myLogonInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim myTable As Table
For Each myTable In MyReport.Database.Tables
myLogonInfo = myTable.LogOnInfo
'myLogonInfo.ConnectionInfo.ServerName = Application.StartupPath & "\" & "data.mdb"
myLogonInfo.ConnectionInfo.ServerName = My.Settings.RptserverPath.ToString
myLogonInfo.ConnectionInfo.DatabaseName = My.Settings.Database.ToString
myLogonInfo.ConnectionInfo.UserID = My.Settings.DBUser.ToString
myLogonInfo.ConnectionInfo.Password = My.Settings.DBPass.ToString
myTable.ApplyLogOnInfo(myLogonInfo)
Next myTable
End Sub
Private Sub SimpleButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton4.Click
For reportType As Integer = 1 To 3
Dim MyReport As CrystalDecisions.CrystalReports.Engine.ReportDocument = New RecipeWithOutCostingSheet
MyReport.SetParameterValue("paramReportType", reportType)
PrintReport(MyReport, filterstring, CrystalReportViewer1, PrintDialog1)
Next
End Sub
Crystal report Formula Create formula name paramReportType
Select {?paramReportType}
Case 1 :
"Main Copy"
Case 2 :
"Customer Copy"
Default :
"Duplicate Copy"
Put on your Report Location.