![]() |
Login Window |
LOGIN FORM
Public pwd, user As String
Private Sub cmdlog_Click()
If pwd = txtpwd.Text And user = txtuser.Text Then
Me.Hide
Load FRMMENU
FRMMENU.Show
Else
MsgBox "Your User name or Password is Incorrect........!", vbInformation
txtuser.Text = ""
txtpwd.Text = ""
txtuser.SetFocus
End If
End Sub
Private Sub Form_Load()
pwd = "admin"
user = "admin"
End Sub
Public pwd, user As String
Private Sub cmdlog_Click()
If pwd = txtpwd.Text And user = txtuser.Text Then
Me.Hide
Load FRMMENU
FRMMENU.Show
Else
MsgBox "Your User name or Password is Incorrect........!", vbInformation
txtuser.Text = ""
txtpwd.Text = ""
txtuser.SetFocus
End If
End Sub
Private Sub Form_Load()
pwd = "admin"
user = "admin"
End Sub
![]() |
Main Menu |
MENU FORM
Private Sub cmdfrmadd_Click()
Me.Hide
Load cusadd
cusadd.Show
End Sub
Private Sub cmdfrmmon_Click()
Me.Hide
Load mainfrm
mainfrm.Show
End Sub
Private Sub cmdfrmsrc_Click()
Me.Hide
Load frmsrc
frmsrc.Show
End Sub
Private Sub Form_Load()
Timer1_Timer
End Sub
Private Sub Timer1_Timer()
time.Caption = Now & " " & Right(Format(Timer, "#0.00"), 2)
End Sub
Private Sub cmdfrmadd_Click()
Me.Hide
Load cusadd
cusadd.Show
End Sub
Private Sub cmdfrmmon_Click()
Me.Hide
Load mainfrm
mainfrm.Show
End Sub
Private Sub cmdfrmsrc_Click()
Me.Hide
Load frmsrc
frmsrc.Show
End Sub
Private Sub Form_Load()
Timer1_Timer
End Sub
Private Sub Timer1_Timer()
time.Caption = Now & " " & Right(Format(Timer, "#0.00"), 2)
End Sub
![]() |
Billing Window |
MONTHLY BILL
If cat = 2 Then
Set rscus = New ADODB.Recordset
id = CStr(Trim(comid.Text) & CStr(txtid.Text))
MsgBox "Customer ID = " & id
qry1 = "select *from cus_tab where cid like '" & Trim(id) & "'"
rscus.Open qry1, con, adOpenStatic, adLockOptimistic
If rscus.RecordCount > 0 Then
If Not txtpread.Text = "" And Not txtunit = "" And Not txtamt.Text = "" And Not txtcread.Text = "" Then
rscus!cname = txtname.Text
rscus!addres = txtads.Text
rscus!pread = Val(txtpread.Text) + Val(txtunit.Text)
rscus!unit = Val(txtunit.Text)
rscus!amt = Val(txtamt.Text)
rscus.Update
rscus.Close
MsgBox "Customer Record is updated123 !", vbInformation
Else
MsgBox "Please Fill up Empty box"
End If
Else
MsgBox "No Record found !"
End If
End If
End Sub
Private Sub cmdsrc_Click()
cmdclr_Click
Set rscus = New ADODB.Recordset
id = CStr(Trim(comid.Text) & CStr(txtid.Text))
MsgBox "Customer ID = " & id
qry1 = "select * from cus_tab where cid like '" & Trim(id) & "'"
rscus.Open qry1, con, adOpenStatic, adLockOptimistic
If rscus.RecordCount > 0 Then
id = rscus!cid
txtname.Text = rscus!cname
txtads.Text = rscus!addres
txtunit.Text = rscus!unit
txtpread.Text = rscus!pread
txtsi.Text = rscus!si
ch = 1
si = rscus!si
Else
MsgBox " The Record not Exist", vbInformation
ch = 0
End If
End Sub
Private Sub Form_Load()
Timer1_Timer
Set con = New ADODB.Connection
con.Open "sms"
cmdac_Click
si = 1
End Sub
Private Sub Timer1_Timer()
time.Caption = Now & " " & Right(Format(Timer, "#0.00"), 2)
End Sub
Private Sub txtcread_LostFocus()
If Not Val(txtcread.Text) > Val(txtpread.Text) Then
MsgBox " Current Reading should greater than previous Reading"
txtcread.Text = ""
txtcread.SetFocus
End If
End Sub
Private Sub txtid_GotFocus()
txtid.Text = ""
End Sub
![]() |
Add Customer |
Public uv As Double
Public id As String
Public ch As Integer
Private Sub cmdac_Click()
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
Label7.Visible = True
txtpread.Visible = True
txtcread.Visible = True
txtamt.Visible = True
txtunit.Visible = True
cmdcal.Visible = True
cmdsrc.Visible = True
cat = 2
End Sub
Private Sub cmdcal_Click()
txtunit.Text = Val(txtcread.Text) - Val(txtpread.Text)
If Val(txtunit.Text) < 100 Then
uv = Val(txtunit.Text) * 1.2
ElseIf Val(txtunit.Text) >= 100 And Val(txtunit.Text) <= 490 Then
uv = Val(txtunit.Text) * 1.5
ElseIf Val(txtunit.Text) >= 500 And Val(txtunit.Text) <= 999 Then
uv = Val(txtunit.Text) * 2
ElseIf Val(txtunit.Text) >= 1000 And Val(txtunit.Text) <= 1500 Then
uv = Val(txtunit.Text) * 2.5
ElseIf Val(txtunit.Text) > 1500 Then
uv = Val(txtunit.Text) * 3.5
End If
txtamt.Text = uv
End Sub
Private Sub cmdclr_Click()
txtname.Text = ""
txtads.Text = ""
txtunit.Text = ""
txtpread.Text = ""
txtcread.Text = ""
End Sub
Private Sub cmdcnew_Click()
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Label7.Visible = False
txtpread.Visible = False
txtcread.Visible = False
txtamt.Visible = False
txtunit.Visible = False
cmdcal.Visible = False
cat = 1
End Sub
Private Sub cmddel_Click()
cmdsrc_Click
If ch = 1 Then
End If
End Sub
Private Sub cmdend_Click()
Me.Hide
Load FRMMENU
FRMMENU.Show
End Sub
Private Sub cmdnext_Click()
comid = "----->"
Set rscus = New ADODB.Recordset
qry1 = "select * from cus_tab where si= " & si
rscus.Open qry1, con, adOpenStatic, adLockOptimistic
If rscus.RecordCount > 0 Then
txtid = rscus!cid
txtname.Text = rscus!cname
txtads.Text = rscus!addres
txtunit.Text = rscus!unit
txtpread.Text = rscus!pread
txtsi.Text = rscus!si
si = si + 1
Else
MsgBox " The Record not Exist", vbInformation
si = 1
End If
End Sub
Private Sub cmdpre_Click()
comid = "<-----"
Set rscus = New ADODB.Recordset
qry1 = "select * from cus_tab where si= " & si
rscus.Open qry1, con, adOpenStatic, adLockOptimistic
If rscus.RecordCount > 0 Then
txtid = rscus!cid
txtname.Text = rscus!cname
txtads.Text = rscus!addres
txtunit.Text = rscus!unit
txtpread.Text = rscus!pread
txtsi.Text = rscus!si
si = si - 1
Else
MsgBox " Previous Record not Exist,Pointer point to First Record ", vbInformation
si = 1
End If
End Sub
Private Sub cmdrep_Click()
Load DataReport1
DataReport1.Show
End Sub
Private Sub cmdsave_Click()
![]() |
Search Customer |
Private Sub cmdexit_Click()
Me.Hide
Load FRMMENU
FRMMENU.Show
End Sub
Private Sub cmdnext_Click()
comid = "----->"
Set rscus = New ADODB.Recordset
qry1 = "select * from cus_tab where si= " & si
rscus.Open qry1, con, adOpenStatic, adLockOptimistic
If rscus.RecordCount > 0 Then
txtid = rscus!cid
txtname.Text = rscus!cname
txtads.Text = rscus!addres
txtunit.Text = rscus!unit
txtpread.Text = rscus!pread
txtsi.Text = rscus!si
si = si + 1
Else
MsgBox " The Record not Exist", vbInformation
si = 1
End If
End Sub
Private Sub cmdpre_Click()
comid = "<-----"
Set rscus = New ADODB.Recordset
qry1 = "select * from cus_tab where si= " & si
rscus.Open qry1, con, adOpenStatic, adLockOptimistic
If rscus.RecordCount > 0 Then
txtid = rscus!cid
txtname.Text = rscus!cname
txtads.Text = rscus!addres
txtunit.Text = rscus!unit
txtpread.Text = rscus!pread
txtsi.Text = rscus!si
si = si - 1
Else
MsgBox " Previous Record not Exist,Pointer point to First Record ", vbInformation
si = 1
End If
End Sub
Private Sub cmdsrc_Click()
Set rscus = New ADODB.Recordset
id = CStr(Trim(comid.Text) & CStr(txtid.Text))
MsgBox "Customer ID = " & id
qry1 = "select * from cus_tab where cid like '" & Trim(id) & "'"
rscus.Open qry1, con, adOpenStatic, adLockOptimistic
If rscus.RecordCount > 0 Then
id = rscus!cid
txtname.Text = rscus!cname
txtads.Text = rscus!addres
txtunit.Text = rscus!unit
txtcread.Text = rscus!cread
txtamt.Text = rscus!amt
txtpread.Text = rscus!pread
txtsi.Text = rscus!si
Else
MsgBox " The Record not Exist", vbInformation
End If
End Sub
Private Sub Form_Load()
Set con = New ADODB.Connection
con.Open "sms"
si = 1
Timer1_Timer
End Sub
Private Sub Timer1_Timer()
time.Caption = Now & " " & Right(Format(Timer, "#0.00"), 2)
End Sub
No comments:
Post a Comment