End Sub
Private Sub vkTextBox3_LostFocus()
If Len(vkTextBox3.Text) < 10 Or Len(vkTextBox3.Text) > 12 Then MsgBox "Please Enter a valid Mobile number"
vkTextBox3.Text = ""
vkTextBox3.SetFocus Exit Sub
End If End Sub
Sell computer system
Dim p As Double
Private Sub Form_Load() Call connectdatabase Call computersysrecordset Call systemsoldrecordset Call customerrecordset lvButtons_H8.Visible = False
80
ibldate.Caption = Date
invoice.Caption = "Sbronded" & (rs7.RecordCount + 1) invoice.FontBold = True
End Sub
Private Sub Form_Unload(cancel As Integer) con.Close
End Sub
Private Sub lvButtons_H1_Click() Unload Me
End Sub
Private Sub lvButtons_H2_Click()
b = (MsgBox("are you sure you want to sell?", vbYesNo, conformation)) If Combocompany.Text = "" And model.Text = "" And categary.Text = "" And combohard.Text = "" And comboram.Text = "" _
And Combomother.Text = "" And ComboProcessor.Text = "" And Combomonitor.Text = "" And txtsell.Text = "" Then
MsgBox "Any product is not choosen by you. Please choose any product."
Exit Sub End If
If vkTextBox1.Text = "" Then
MsgBox " Customer Name is Empty"
vkTextBox1.SetFocus Exit Sub
ElseIf vkTextBox2.Text = "" Then
MsgBox " Customer Address is Empty"
vkTextBox2.SetFocus Exit Sub
ElseIf vkTextBox3.Text = "" Then
MsgBox " Customer Pnone No is Empty"
vkTextBox3.SetFocus Exit Sub
End If
If Text1.Text = "" Then
MsgBox " Payment Amount is Empty"
Text1.SetFocus Exit Sub
End If
con.BeginTrans
81
con.Execute "Insert into Balance values('" & vkTextBox1.Text & "','" &
invoice.Caption & "','" & txtsell.Text & "','" & Text1.Text & "','" & ibldate.Caption &
"','" & Text2.Text & "')"
con.CommitTrans con.BeginTrans
con.Execute "Insert into customer values('" & vkTextBox1.Text & "','" &
vkTextBox2.Text & "','" & vkTextBox3.Text & "','" & Text2.Text & "','" &
invoice.Caption & "')"
con.CommitTrans
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "select buying_value from computersys where Serialno=" & serial.Text
& ""
p = rs1(0)
sql = "insert into
systemsold(seriel,invoice,customername,address,phone,selldate,buyingvalue,pri ce,companyname,categary,model,harddisk,ram,motherboard,processor,monitor, other,warranty) values('" & serial.Text & "','" & invoice.Caption & "','" &
vkTextBox1.Text & "','" & vkTextBox2.Text & "','" & vkTextBox3.Text & "','" &
ibldate.Caption & "','" & p & "','" & txtsell.Text & "','" & Combocompany.Text & "','"
& categary.Text & "','" & model.Text & "','" & combohard.Text & "','" &
comboram.Text & "','" & Combomother.Text & "','" & ComboProcessor.Text & "','"
& Combomonitor.Text & "','" & other.Text & "','" & txtwarranty.Text & "')"
MsgBox (sql) Call insertquery
MsgBox "Data is Saved Properly"
lvButtons_H2.Visible = False lvButtons_H8.Visible = True
End Sub
Private Sub lvButtons_H3_Click() rs1.MoveLast
serial.Text = rs1!serialno
Combocompany.Text = rs1!company model.Text = rs1!model
categary.Text = rs1!categary combohard.Text = rs1!harddisk comboram.Text = rs1!ram
Combomother.Text = rs1!motherboard ComboProcessor.Text = rs1!processor Combomonitor.Text = rs1!monitor
82
other.Text = rs1!other
txtsell.Text = rs1!selling_value txtwarranty.Text = rs1!warranty End Sub
Private Sub lvButtons_H4_Click() On Error Resume Next
If rs1.EOF = False Then rs1.MoveNext On Error GoTo l1
If rs1.BOF = False Then rs1.MovePrevious
MsgBox "You are at the first record..."
End Sub
Private Sub lvButtons_H6_Click() rs1.MoveFirst
serial.Text = rs1!serialno
Combocompany.Text = rs1!company model.Text = rs1!model
categary.Text = rs1!categary combohard.Text = rs1!harddisk comboram.Text = rs1!ram
Combomother.Text = rs1!motherboard ComboProcessor.Text = rs1!processor Combomonitor.Text = rs1!monitor other.Text = rs1!other
txtsell.Text = rs1!selling_value txtwarranty.Text = rs1!warranty End Sub
Private Sub lvButtons_H8_Click() On Error Resume Next:
Sellbrondedcom.PrintForm End Sub
Private Sub Text1_Change() If Text1.Text = "" Then Exit Sub
End If
If Not IsNumeric(Text1) Then
MsgBox " Payment Amount should be numaric"
Text1.Text = ""
Text1.SetFocus End If
Label21.Visible = True Text2.Visible = True
price = Val(txtsell) - Val(Text1) If price < 0 Then
MsgBox "Payment can not much than total price.", vbCritical Label21.Visible = False
Text2.Visible = False Text1.Text = ""
Exit Sub
84
Else
Text2 = price End If
End Sub
Private Sub vkTextBox3_Change() If vkTextBox3.Text = "" Then Exit Sub
End If
If Not IsNumeric(vkTextBox3.Text) Then
MsgBox " Customer Phone should be numaric"
vkTextBox3.Text = ""
vkTextBox3.SetFocus Exit Sub
End If End Sub
Make quotation
Dim price As Double Dim temp As String Dim bool As Boolean Dim p1, p2 As Double Dim w1, w2 As Integer
Private Sub lvButtons_H1_Click() On Error Resume Next:
quotation.PrintForm End Sub
Private Sub Combo19_Click() Combo27.Clear
temp = "RAM"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Comboram.Text & "' and Type='" & Combo19.Text & "'"
While rs3.EOF = False
Combo27.AddItem rs3(0)
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & ComboProcessor.Text & "' and Type='" & Combo20.Text & "'"
85
While rs3.EOF = False
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Combomotherboard.Text & "' and Type='" & Combo21.Text & "'"
While rs3.EOF = False
Combo29.AddItem rs3(0)
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combomouse.Text & "' and Type='" & Combo22.Text & "'"
While rs3.EOF = False Combo45.AddItem rs3(0) rs3.MoveNext
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Combospeaker.Text & "' and Type='" & Combo23.Text & "'"
While rs3.EOF = False
Combo30.AddItem rs3(0)
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Combomonitor.Text & "' and Type='" & Combo24.Text & "'"
While rs3.EOF = False
Combo31.AddItem rs3(0)
86
rs3.MoveNext Wend
End Sub
Private Sub Combo25_Click() temp = "Modem"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combomodem.Text & "' and Type='" & Combo25.Text & "'"
While rs3.EOF = False Combo49.AddItem rs3(0) rs3.MoveNext
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboram.Text & "' and Type='" & Combo19.Text & "' and Range='" & Combo27.Text & "'"
While rs3.EOF = False Combo38.AddItem rs3(0) rs3.MoveNext
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & ComboProcessor.Text & "' and Type='" & Combo20.Text & "' and Range='" & Combo28.Text & "'"
While rs3.EOF = False Combo39.AddItem rs3(0) rs3.MoveNext
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combomotherboard.Text & "' and Type='" & Combo21.Text & "' and Range='" & Combo29.Text & "'"
While rs3.EOF = False
87
Combo40.AddItem rs3(0)
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combospeaker.Text & "' and Type='" & Combo23.Text & "' and Range='" & Combo30.Text & "'"
While rs3.EOF = False Combo46.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combo31_Click() temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combomonitor.Text & "' and Type='" & Combo24.Text & "' and Range='" & Combo31.Text & "'"
While rs3.EOF = False Combo47.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combo34_Click() temp = "Printer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboprinter.Text & "' and Type='" & Combo34.Text & "'"
While rs3.EOF = False Combo51.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combo35_Click() Static i As Integer
Static hdprice As Double
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo35.Text & "'"
text4.Text = rs3(0)
88
If i = 0 Then
hdprice = Val(text4) price = price + hdprice Else
price = price - hdprice hdprice = Val(text4) price = price + hdprice End If
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22) End Sub
Private Sub Combo36_Click() Static cdrprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo36.Text & "'"
Text5.Text = rs3(0) If i = 0 Then
cdrprice = Val(Text5) price = price + cdrprice Else
price = price - cdrprice cdrprice = Val(Text5) price = price + cdrprice End If
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22) End Sub
Private Sub Combo37_Click() Static cdwprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo37.Text & "'"
Text6.Text = rs3(0) If i = 0 Then
cdwprice = Val(Text6)
89
price = price + cdwprice Text23 = price + Val(Text22) End Sub
Private Sub Combo38_Click() Static ramprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo38.Text & "'"
Text7.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo39_Click() Static proprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo39.Text & "'"
Text8.Text = rs3(0)
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22) End Sub
Private Sub Combo40_Click() Static mbprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo40.Text & "'"
Text9.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo41_Click() Static fdprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo41.Text & "'"
Text10 = rs3(0) Text23 = price + Val(Text22) End Sub
91
Private Sub Combo42_Click() Static dvdrprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo42.Text & "'"
Text11.Text = rs3(0) If i = 0 Then
dvdrprice = Val(Text11) price = price + dvdrprice Else
price = price - dvdrprice dvdrprice = Val(Text11) price = price + dvdrprice End If
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22)
End Sub
Private Sub Combo43_Click() Static dvdwprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo43.Text & "'"
Text12.Text = rs3(0) If i = 0 Then
dvdwprice = Val(Text12) price = price + dvdwprice Else
price = price - dvdwprice dvdwprice = Val(Text12) price = price + dvdwprice End If
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22)
92
End Sub
Private Sub Combo44_Click() Static kbdprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo44.Text & "'"
Text13.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo45_Click() Static msprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo45.Text & "'"
Text14.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo46_Click() Static spkprice As Double
93
Static i As Integer 'temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo46.Text & "'"
Text15.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo47_Click() Static monprice As Double Static i As Integer
'temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo47.Text & "'"
Text16.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo48_Click() Static upsprice As Double Static i As Integer
'temp = "UPS"
If rs3.State = adStateOpen Then rs3.Close
94
rs3.Open "select Price from itemdetail where Serialno='" & Combo48.Text & "'" Text23 = price + Val(Text22) End Sub
Private Sub Combo49_Click() Static modprice As Double Static i As Integer
'temp = "Modem"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo49.Text & "'"
Text18.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo50_Click() Static lcardprice As Double Static i As Integer
'temp = "LAN Card"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo50.Text & "'"
Text19.Text = rs3(0) If i = 0 Then
lcardprice = Val(Text19)
95
price = price + lcardprice Text23 = price + Val(Text22) End Sub
Private Sub Combo51_Click() Static prprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo51.Text & "'"
Text20.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo52_Click() Static scnprice As Double Static i As Integer
'temp = "Scanner"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo52.Text & "'"
Text27.Text = rs3(0)
price = price - scnprice Text23 = price + Val(Text22) End Sub
Private Sub Combo53_Click() Static cabprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo53.Text & "'"
Text28.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combocabinet_Click() temp = "Cabinet"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combocabinet.Text & "'"
While rs3.EOF = False Combo53.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combocdrom_Click() Combo36.Clear
temp = "CD ROM"
If rs3.State = adStateOpen Then rs3.Close
97
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combocdrom.Text & "'"
While rs3.EOF = False Combo36.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combocdwriter_Click() Combo37.Clear
temp = "CD Writer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combocdwriter.Text & "'"
While rs3.EOF = False Combo37.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combodvdrom_Click() temp = "DVD ROM"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combodvdrom.Text & "'"
While rs3.EOF = False Combo42.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combodvdwriter_Click() temp = "DVD Writer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combodvdwriter.Text & "'"
While rs3.EOF = False Combo43.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combofloppy_Click() Combo41.Clear
temp = "Floppy Drive"
If rs3.State = adStateOpen Then rs3.Close
98
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combofloppy.Text & "'"
While rs3.EOF = False Combo41.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Comboharddisk_Click() temp = "Hard Disk"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Comboharddisk.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Comboharddisk.Text Then bool = True
temp = "Hard Disk"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboharddisk.Text & "' and Type='" & Comboharddisktype.Text
& "' and Range='" & Comboharddiskrange.Text & "'"
While rs3.EOF = False Combo35.AddItem rs3(0) rs3.MoveNext
temp = "Hard Disk"
If rs3.State = adStateOpen Then rs3.Close
99
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Comboharddisk.Text & "' and Type='" & Comboharddisktype.Text
& "'"
While rs3.EOF = False
Comboharddiskrange.AddItem rs3(0)
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combokeyboard.Text & "'"
While rs3.EOF = False Combo44.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combolan_Click() temp = "LAN Card"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combolan.Text & "'"
While rs3.EOF = False Combo50.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combomodem_Click() temp = "Modem"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combomodem.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomodem.Text Then bool = True
End Sub
Private Sub Combomonitor_Click() temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combomonitor.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomonitor.Text Then bool = True
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combomotherboard.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomotherboard.Text Then bool = True For i = 0 To Combo21.ListCount
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combomouse.Text & "'"
While rs3.EOF = False
101
If rs3.Fields(0).Value = Combomouse.Text Then bool = True
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Comboprinter.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Comboprinter.Text Then bool = True
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & ComboProcessor.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = ComboProcessor.Text Then bool = True
rs3.MoveNext Wend
End Sub
Private Sub Comboram_Click() temp = "RAM"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Comboram.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Comboram.Text Then bool = True
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboscanner.Text & "'"
While rs3.EOF = False Combo52.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combospeaker_Click() temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combospeaker.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combospeaker.Text Then bool = True
Combo23.AddItem rs3(1)
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboups.Text & "'"
While rs3.EOF = False Combo48.AddItem rs3(0) rs3.MoveNext
Text28.Enabled = False 'Text26.Enabled = False 'Label32.Visible = False 'Text25.Visible = False ibldate.Caption = Date
'If rs2.State = 1 Then rs2.Close
'rs2.Open "Select * from setsold", cs, adOpenKeyset, adLockOptimistic 'invoice.Caption = "S" & (rs2.RecordCount + 1)
'invoice.FontBold = True
'Label38.Caption = "cust" & (rs2.RecordCount + 1) price = 0
Dim bool As Boolean While rs3.EOF = False
Dim bool As Boolean While rs3.EOF = False