01.
Imports
System.Data.SqlClient
02.
Imports
System.Text
03.
Public
Class
Form4
04.
Dim
cn
As
SqlConnection
05.
Dim
com
As
SqlCommand
06.
Dim
CurrentRecord
As
Integer
= 0
07.
Dim
RecordCount
As
Integer
= 0
08.
Dim
ActionFlag
As
String
=
""
09.
Dim
daTrain
As
New
SqlDataAdapter
10.
Dim
dsTrain
As
New
DataSet()
11.
Dim
IsFinesTrain
As
Boolean
=
False
12.
Dim
sqlAdd
As
String
13.
Dim
comSearch2
As
New
SqlCommand
14.
Dim
comAdd
As
New
SqlCommand
15.
Private
Sub
connection()
16.
cn =
New
SqlConnection()
17.
With
cn
18.
If
.State = ConnectionState.Open
Then
.Close()
19.
.ConnectionString = strCn
20.
.Open()
21.
End
With
22.
23.
End
Sub
24.
Private
Sub
Button4_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Button4.Click
25.
26.
Dim
date1
As
String
= Format(DateTimePicker1.Visible,
"dd/MM/yyyy"
).ToString
27.
ShowData()
28.
29.
End
Sub
30.
Private
Sub
frmR_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
31.
32.
Dim
currentUser
As
CurrentUser = currentUser.Instance
33.
Label1.Text = currentUser.Name
34.
End
Sub
35.
36.
Private
Sub
Button1_Click_1(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Button1.Click
37.
frmMain.Show()
38.
Me
.Dispose()
39.
End
Sub
40.
Private
Sub
ShowData()
41.
Dim
tmpTable
As
New
DataTable()
42.
Dim
sql
As
String
=
"SELECT * FROM Purchase WHERE DateTime BETWEEN '"
& DateTimePicker1.Visible &
"' AND '"
& DateTimePicker2.Visible &
"' ORDER BY DateTime"
43.
Dim
com
As
New
System.Data.SqlClient.SqlCommand(sql, cn)
44.
45.
If
tmpTable.Rows.Count > 0
Then
46.
Dim
rpt
As
New
CrystalDecisions.CrystalReports.Engine.ReportDocument()
47.
rpt.SetDataSource(tmpTable)
48.
Summary_of_the_material_daily.Show()
49.
End
If
50.
51.
End
Sub
52.
End
Class