-
Notifications
You must be signed in to change notification settings - Fork 1
/
frmEmployeePaymentReport.vb
executable file
·52 lines (46 loc) · 2.55 KB
/
frmEmployeePaymentReport.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class frmEmployeePaymentReport
Dim rdr As OleDbDataReader = Nothing
Dim dtable As DataTable
Dim con As OleDbConnection = Nothing
Dim adp As OleDbDataAdapter
Dim ds As DataSet
Dim cmd As OleDbCommand = Nothing
Dim dt As New DataTable
Dim cs As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\PayrollManagerDB.accdb;Persist Security Info=False;"
Private Sub button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button4.Click
Try
Dim rpt As New rptEmployeePayment() 'The report you created.
Dim myConnection As oledbConnection
Dim MyCommand As New oledbCommand()
Dim myDA As New oledbDataAdapter()
Dim myDS As New DataSet 'The DataSet you created.
myConnection = New OleDbConnection(cs)
MyCommand.Connection = myConnection
MyCommand.CommandText = "select Employeename,EmployeeRegistration.EmployeeID,PaymentID,Designation,Department,EmployeePayment.salary,deduction,OvertimeAmount,Paymentdate,NetPay from employeepayment,EmployeeRegistration where EmployeeRegistration.EmployeeID=EmployeePayment.EmployeeID and paymentdate between #" & DateFrom.Text & "# And #" & DateTo.Text & "#"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "EmployeePayment")
myDA.Fill(myDS, "EmployeeRegistration")
rpt.SetDataSource(myDS)
rpt.SetParameterValue("variable1", DateFrom.Value)
rpt.SetParameterValue("variable2", DateTo.Value)
CrystalReportViewer1.ReportSource = rpt
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub frmEmployeePaymentReport_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Me.Hide()
frmMainMenu.Show()
End Sub
Private Sub button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button5.Click
CrystalReportViewer1.ReportSource = Nothing
DateFrom.value = Today
DateTo.value = Today
End Sub
Private Sub frmEmployeePaymentReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class