Your question, your audience. Choose who sees your identityâ€”and your questionâ€”with question security.
Private Sub PrintAppraisal()
Try
Dim iEmpId As Integer = lkEmployee.EditValue
Dim iPeriod As Integer = lkPeriods.EditValue
Dim iYear As Integer = cmbYear.EditValue
Dim dsAppraisal As DataSet = objAppraisalRatingMaster.GetCompleteAppraisal(iEmpId, iPeriod, iYear)
If dsAppraisal.Tables(0).Rows.Count > 0 Then
Dim dPart1TotScore As Decimal = 0
Decimal.TryParse(Convert.ToString(dsAppraisal.Tables(2).Compute("sum(RatingScore)", "")), dPart1TotScore)
Dim iPart1Count As Integer = 0
Integer.TryParse(Convert.ToString(dsAppraisal.Tables(2).Compute("count(RatingScore)", "RatingScore > 0")), iPart1Count)
Dim dPart1Perc As Decimal = (dPart1TotScore * (10 / iPart1Count)) * (70 / 100)
Dim dPart2TotScore As Decimal = 0
Decimal.TryParse(Convert.ToString(dsAppraisal.Tables(3).Compute("sum(RatingScore)", "")), dPart2TotScore)
Dim iPart2Count As Integer = 0
Integer.TryParse(Convert.ToString(dsAppraisal.Tables(3).Compute("count(RatingScore)", "RatingScore > 0")), iPart2Count)
Dim dPart2Perc As Decimal = (dPart2TotScore * (10 / iPart2Count)) * (30 / 100)
Dim dMeritsDemeritsTotal As Decimal = 0
Decimal.TryParse(Convert.ToString(dsAppraisal.Tables(4).Compute("sum(TotalPoints)", "")), dMeritsDemeritsTotal)
Dim dConsolidatedRating As Decimal = (dPart1Perc + dPart2Perc + dMeritsDemeritsTotal)
dConsolidatedRating = Decimal.Round(dConsolidatedRating, 0)
Dim drTmpConsRating As DataRow() = dsAppraisal.Tables(1).Select("MinRange<=" + dConsolidatedRating.ToString + " AND MaxRange>=" + dConsolidatedRating.ToString)
Dim strConsolidatedRating As String = Convert.ToString(drTmpConsRating(0)("RatingDescription"))
Dim objRepParamInfoLsit As New List(Of ReportParamInfo)
Dim objRepParam As New ReportParamInfo
objRepParam.ParamName = "P_P1"
objRepParam.Param = dPart1Perc
Dim objRepParam1 As New ReportParamInfo
objRepParam1.ParamName = "P_P2"
objRepParam1.Param = dPart2Perc
Dim objRepParam2 As New ReportParamInfo
objRepParam2.ParamName = "P_TotMeritDemrit"
objRepParam2.Param = dMeritsDemeritsTotal
Dim objRepParam3 As New ReportParamInfo
objRepParam3.ParamName = "P_ConsRating"
objRepParam3.Param = strConsolidatedRating
Dim objRepParam4 As New ReportParamInfo
objRepParam4.ParamName = "P_Qtr"
objRepParam4.Param = iPeriod.ToString
Dim objRepParam5 As New ReportParamInfo
objRepParam5.ParamName = "P_Year"
objRepParam5.Param = iYear
objRepParamInfoLsit.Add(objRepParam)
objRepParamInfoLsit.Add(objRepParam1)
objRepParamInfoLsit.Add(objRepParam2)
objRepParamInfoLsit.Add(objRepParam3)
objRepParamInfoLsit.Add(objRepParam4)
objRepParamInfoLsit.Add(objRepParam5)
Dim strSubRepList As New List(Of String)
strSubRepList.Add("H1A_AppraisalRatingMaster.rpt")
strSubRepList.Add("H1B_AppraisalKeyFactors.rpt")
strSubRepList.Add("H1C_AppraisalDuties.rpt")
strSubRepList.Add("H1D_AppraisalMemoPoints.rpt")
frmPrint.printFromSp(dsAppraisal, "H1_CompleteAppraisal.rpt", strSubRepList, objRepParamInfoLsit)
frmPrint.Show()
End If
Catch ex As Exception
Throw
End Try
End Sub
'*******************************
Public Sub printFromSP(ByVal dtSet As DataSet, ByVal strReportPath As String, ByVal strSubRepList As List(Of String), ByVal objRepParamList As List(Of ReportParamInfo))
Dim dr As New ReportDocument
dr.Load(strMainReportPath + strReportPath)
dr.SetDataSource(dtSet.Tables(0))
For i As Integer = 0 To strSubRepList.Count - 1
dr.Subreports(strSubRepList(i)).SetDataSource(dtSet.Tables(i + 1))
Next
setTableLogonForReportDoc(dr)
For i As Integer = 0 To objRepParamList.Count - 1
If (objRepParamList(i).IsSupReportParam) Then
dr.SetParameterValue(objRepParamList(i).ParamName, objRepParamList(i).Param, objRepParamList(i).strSubReport)
Else
dr.SetParameterValue(objRepParamList(i).ParamName, objRepParamList(i).Param)
End If
Next
crHRMS.ReportSource = dr
crHRMS.Show()
End Sub
'*******************************
Invalid-Report-Source-error.JPG
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
mlmcc