Index of /students/paper/skripsi/30402223

16 

Teks penuh

(1)

LAMPIRAN LISTING PROGRAM

Form Utama :

Dim Db As ADODB.Connection Dim Rs As ADODB.Recordset Dim StatusData As Byte Dim StatusPrint As Byte

Sub AktifTombol(ByVal Aktif As Boolean)

CmdTambah.Enabled = Aktif CmdSimpan.Enabled = Not Aktif CmdHapus.Enabled = Aktif CmdEdit.Enabled = Aktif

End Sub Sub Tanggal() For x = 1 To 31

Cmbtanggal.AddItem Format(x, "0#") Next x

For Y = 1 To 12

CmbBulan.AddItem Format(Y, "0#") Next Y

For z = 2004 To 2010 CmbTahun.AddItem z Next z

End Sub

Sub KosongkanText() TxtNoUAT.Text = "" Cmbtanggal.Text = "" CmbBulan.Text = "" CmbTahun.Text = "" txtNamakantor.Text = "" txtKodeCabang.Text = "" txtAlamat.Text = ""

TxtNamaPemakai.Text = "" TxtNIP.Text = ""

(2)

TxtNoSeriMonitor.Text = "" TxtKodeAsset.Text = "" CmbMS.Text = ""

TxtStikerHotline.Text = "" CmbTipePCBaru.Text = "" CmbProcessorPCBaru.Text = "" CmbMemoryPCBaru.Text = "" CmbHDDPCBaru.Text = "" CmbMonitorBaru.Text = "" TxtNoSeriPCLama.Text = "" TxtNoSeriMonitorLama.Text = "" TxtNoAktivaCPU.Text = "" TxtMerk.Text = ""

End Sub

Sub Kuncitext(ByVal x As Boolean) TxtNoUAT.Locked = x

Cmbtanggal.Locked = x CmbBulan.Locked = x CmbTahun.Locked = x txtNamakantor.Locked = x txtKodeCabang.Locked = x txtAlamat.Locked = x

TxtNamaPemakai.Locked = x TxtNIP.Locked = x

TxtLokasi.Locked = x TxtTelepon.Locked = x TxtNoSeriPC.Locked = x TxtNoSeriMonitor.Locked = x TxtKodeAsset.Locked = x CmbMS.Locked = x

TxtStikerHotline.Locked = x CmbTipePCBaru.Locked = x CmbProcessorPCBaru.Locked = x CmbMemoryPCBaru.Locked = x CmbHDDPCBaru.Locked = x CmbMonitorBaru.Locked = x TxtNoSeriPCLama.Locked = x TxtNoSeriMonitorLama.Locked = x TxtNoAktivaCPU.Locked = x TxtMerk.Locked = x

End Sub

Private Sub CmbBulan_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

(3)

End If

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or _ KeyAscii = vbKeyBack) Then

Beep KeyAscii = 0 End If

End Sub

Private Sub CmbHDDPCBaru_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

CmbMonitorBaru.SetFocus End If

End Sub

Private Sub CmbMemoryPCBaru_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

CmbHDDPCBaru.SetFocus End If

End Sub

Private Sub CmbMonitorBaru_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

TxtNoSeriPCLama.SetFocus End If

End Sub

Private Sub CmbMS_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

TxtStikerHotline.SetFocus End If

End Sub

Private Sub CmbProcessorPCBaru_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

CmbMemoryPCBaru.SetFocus End If

End Sub

Private Sub CmbTahun_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

txtNamakantor.SetFocus End If

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or _ KeyAscii = vbKeyBack) Then

(4)

End If End Sub

Private Sub Cmbtanggal_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

CmbBulan.SetFocus End If

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or _ KeyAscii = vbKeyBack) Then

Beep KeyAscii = 0 End If

End Sub

Private Sub CmbTipePCBaru_Click()

If CmbTipePCBaru.Text = "A" Then

CmbProcessorPCBaru.Text = "Thin Client" CmbMemoryPCBaru.Text = "256"

CmbHDDPCBaru.Text = "Flash Room" CmbMonitorBaru.Text = "15"

ElseIf CmbTipePCBaru.Text = "B" Then CmbProcessorPCBaru.Text = "Celeron" CmbMemoryPCBaru.Text = "512" CmbHDDPCBaru.Text = "40" CmbMonitorBaru.Text = "17"

ElseIf CmbTipePCBaru.Text = "C" Then CmbProcessorPCBaru.Text = "Celeron" CmbMemoryPCBaru.Text = "512" CmbHDDPCBaru.Text = "80" CmbMonitorBaru.Text = "TFT 17" End If

End Sub

Private Sub CmbTipePCBaru_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

CmbProcessorPCBaru.SetFocus End If

End Sub

Private Sub CmdCariKodeCabang_Click() StatusPrint = 2

x = TxtCariKodeCabang.Text

(5)

SalinDataPerRecord TabelData.Row End Sub

Private Sub CmdCariNoUAT_Click() StatusPrint = 1

a = TxtCariNoUAT.Text

sqltext = "select * from bca where nouat='" & a & "'" SalinDataKetabel sqltext

SalinDataPerRecord TabelData.Row End Sub

Private Sub CmdEdit_Click() AktifTombol False

Kuncitext False StatusData = 2 End Sub

Private Sub CmdSimpan_Click() On Error GoTo error

If TxtNoUAT.Text = "" Then

MsgBox "NoUAT tidak boleh kosong..!", vbInformation, "Pemberitahuan" TxtNoUAT.SetFocus

Exit Sub End If

If Cmbtanggal.Text = "" Then

MsgBox "Tanggal tidak boleh kosong..!", vbInformation, "Pemberitahuan" Cmbtanggal.SetFocus

Exit Sub End If

If CmbBulan.Text = "" Then

MsgBox "Bulan tidak boleh kosong..!", vbInformation, "Pemberitahuan" CmbBulan.SetFocus

Exit Sub End If

If CmbTahun.Text = "" Then

MsgBox "Tahun tidak boleh kosong..!", vbInformation, "Pemberitahuan" CmbTahun.SetFocus

Exit Sub End If

(6)

Dim NoUAT, Tanggal, Namakantor, KodeCabang, Alamat, NamaPemakai, NIP, Lokasi As String

Dim Telepon, NSPcBaru, NSMBaru, KAsset, MS, SH, TipePC, ProcPcBaru, MemoryPcBaru As String

Dim HDD, Monitor, NSPcLama, NSMPcLama, NoAktiva, Merk As String

NoUAT = TxtNoUAT.Text

Tanggal = Cmbtanggal.Text & "/" & CmbBulan.Text & "/" & CmbTahun.Text Namakantor = txtNamakantor.Text

KodeCabang = txtKodeCabang.Text Alamat = txtAlamat.Text

NamaPemakai = TxtNamaPemakai.Text NIP = TxtNIP.Text

Lokasi = TxtLokasi.Text Telepon = TxtTelepon.Text NSPcBaru = TxtNoSeriPC.Text NSMBaru = TxtNoSeriMonitor.Text KAsset = TxtKodeAsset.Text

MS = CmbMS.Text

SH = TxtStikerHotline.Text TipePC = CmbTipePCBaru.Text

ProcPcBaru = CmbProcessorPCBaru.Text MemoryPcBaru = CmbMemoryPCBaru.Text HDD = CmbHDDPCBaru.Text

Monitor = CmbMonitorBaru.Text NSPcLama = TxtNoSeriPCLama.Text

NSMPcLama = TxtNoSeriMonitorLama.Text NoAktiva = TxtNoAktivaCPU.Text

Merk = TxtMerk.Text If StatusData = 1 Then

sqltext = "insert into bca values('" & NoUAT & "','" & Tanggal & "','" & Namakantor & "'," _

& "'" & KodeCabang & "','" & Alamat & "','" & NamaPemakai & "','" & NIP & "'," _ & "'" & Lokasi & "','" & Telepon & "','" & NSPcBaru & "','" & NSMBaru & "'," _ & "'" & KAsset & "','" & MS & "','" & SH & "','" & TipePC & "','" & ProcPcBaru & "'," _

& "'" & MemoryPcBaru & "','" & HDD & "','" & Monitor & "','" & NSPcLama & "'," _ & "'" & NSMPcLama & "','" & NoAktiva & "','" & Merk & "')"

Else

sqltext = "update bca set " & _ "tanggal='" & Tanggal & "'," & _

"Nama_kantor='" & Namakantor & "'," & _ "kode_cabang='" & KodeCabang & "'," & _ "alamat_kantor='" & Alamat & "'," & _

(7)

"lokasi_pemakai='" & Lokasi & "'," & _ "tlp_pemakai='" & Telepon & "'," & _ "noseripc='" & NSPcBaru & "'," & _ "noserimonitor='" & NSMBaru & "'," & _ "kodeasset='" & KAsset & "'," & _

"mk='" & MS & "'," & _

"stikerhotline='" & SH & "'," & _ "tipepc='" & TipePC & "'," & _

"processor='" & ProcPcBaru & "'," & _ "memory='" & MemoryPcBaru & "'," & _ "hdd='" & HDD & "'," & _

"monitor='" & Monitor & "'," & _

"noseripclama='" & NSPcLama & "'," & _

"noserimonitorlama='" & NSMPcLama & "'," & _ "noaktiva='" & NoAktiva & "'," & _

"merk='" & Merk & "' where nouat='" & NoUAT & "'" End If

Db.Execute sqltext

SalinDataKetabel "select * from bca order by nouat" SalinDataPerRecord TabelData.Row

AktifTombol True Kuncitext True

TabelData.Enabled = True

Exit Sub error:

MsgBox "terjadi penduplikatan NoUAT ..!", vbInformation, "Data ada yg sama" End Sub

Private Sub CmdHapus_Click() NoUAT = TxtNoUAT.Text

hapus = MsgBox("Apakah Anda yakin akan menghapus data? " _

& vbNewLine & "dengan No. UAT '" & NoUAT & "'", vbYesNo, "" _ & "Hapus Data")

If hapus = vbYes Then

Db.Execute "delete from bca where nouat='" & NoUAT & "'" SalinDataKetabel "select * from bca order by nouat"

SalinDataPerRecord TabelData.Row End If

If TabelData.Row = 0 Then

(8)

End If End Sub

Private Sub CmdTambah_Click() SSTab1.Tab = 0

TabelData.Enabled = False KosongkanText

AktifTombol False Kuncitext False TxtNoUAT.SetFocus StatusData = 1 End Sub

Private Sub CmdRefresh_Click() StatusPrint = 0

sqltext = "select * from bca" SalinDataKetabel sqltext End Sub

Private Sub Command8_Click() StatusPrint = 3

tglawal = "#" & TxtTglAwal.Text & "#" tglakhir = "#" & TxtTglAkhir.Text & "#"

sqltext = "select * from bca where tanggal between " & tglawal & " and " & tglakhir & "" 'Syntax: SELECT * FROM tablename WHERE fieldname BETWEEN 'value1' AND 'value2'

SalinDataKetabel sqltext

End Sub

Private Sub Form_Activate() StatusPrint = 0

AktifTombol True Kuncitext True End Sub

Private Sub Form_Load()

Set Db = New ADODB.Connection Set Rs = New ADODB.Recordset

(9)

sqltext = "select * from bca" SalinDataKetabel sqltext satusdata = 0

Tanggal End Sub

Sub SalinDataKetabel(ByVal sqltext As String) With TabelData

.TextMatrix(0, 0) = "No" .ColWidth(0) = 500

.TextMatrix(0, 1) = "No.UAT" .ColWidth(1) = 1000

.TextMatrix(0, 2) = "Tanggal" .ColWidth(2) = 1200

.TextMatrix(0, 3) = "Nama Kantor" .ColWidth(3) = 2000

.TextMatrix(0, 4) = "Kode Cabang" .ColWidth(4) = 1300

.TextMatrix(0, 5) = "Alamat" .ColWidth(5) = 1500

.TextMatrix(0, 6) = "Nama Pemakai" .ColWidth(6) = 1500

.TextMatrix(0, 7) = "NIP" .ColWidth(7) = 1000

.TextMatrix(0, 8) = "Lokasi" .ColWidth(8) = 800

.TextMatrix(0, 9) = "Telepon" .ColWidth(9) = 1000

.TextMatrix(0, 10) = "NoSeriPC" .ColWidth(10) = 1500

.TextMatrix(0, 11) = "NoSeriMonitor" .ColWidth(11) = 1500

.TextMatrix(0, 12) = "KodeAsset" .ColWidth(12) = 1200

.TextMatrix(0, 13) = "Mouse/Keyboard" .ColWidth(13) = 2000

.TextMatrix(0, 14) = "Stiker Hotline" .ColWidth(14) = 1600

.TextMatrix(0, 15) = "TipePC" .ColWidth(15) = 1000

.TextMatrix(0, 16) = "Processor" .ColWidth(16) = 1000

.TextMatrix(0, 17) = "Memory" .ColWidth(17) = 1000

(10)

.ColWidth(18) = 500

.TextMatrix(0, 19) = "Monitor" .ColWidth(19) = 1000

.TextMatrix(0, 20) = "NoSeriPCLama" .ColWidth(20) = 1500

.TextMatrix(0, 21) = "NoSeriMonitorLama" .ColWidth(21) = 1500

.TextMatrix(0, 22) = "NoAktiva CPU" .ColWidth(22) = 1500

.TextMatrix(0, 23) = "Model/Merk" .ColWidth(23) = 1000

.Rows = 1

End With

Rs.Open sqltext, Db, adOpenStatic, adLockReadOnly

With Rs

If .EOF And .BOF Then .Close

Exit Sub End If

.MoveFirst n = 0 Do n = n + 1

TabelData.AddItem n & vbTab & .Fields(0).Value & vbTab & _ .Fields(1).Value & vbTab & .Fields(2).Value & vbTab & _ .Fields(3).Value & vbTab & .Fields(4).Value & vbTab & _ .Fields(5).Value & vbTab & .Fields(6).Value & vbTab & _ .Fields(7).Value & vbTab & .Fields(8).Value & vbTab & _ .Fields(9).Value & vbTab & .Fields(10).Value & vbTab & _ .Fields(11).Value & vbTab & .Fields(12).Value & vbTab & _ .Fields(13).Value & vbTab & .Fields(14).Value & vbTab & _ .Fields(15).Value & vbTab & .Fields(16).Value & vbTab & _ .Fields(17).Value & vbTab & .Fields(18).Value & vbTab & _ .Fields(19).Value & vbTab & .Fields(20).Value & vbTab & _ .Fields(21).Value & vbTab & .Fields(22).Value

.MoveNext Loop Until .EOF

End With Rs.Close

(11)

Sub SalinDataPerRecord(ByVal Baris As Integer) If Baris = 0 Or TabelData.Rows = 1 Then

Exit Sub End If

With TabelData

TxtNoUAT.Text = .TextMatrix(Baris, 1)

Cmbtanggal.Text = Left(.TextMatrix(Baris, 2), 2) CmbBulan.Text = Mid(.TextMatrix(Baris, 2), 4, 2) CmbTahun.Text = Right(.TextMatrix(Baris, 2), 4) txtNamakantor.Text = .TextMatrix(Baris, 3) txtKodeCabang.Text = .TextMatrix(Baris, 4) txtAlamat.Text = .TextMatrix(Baris, 5)

TxtNamaPemakai.Text = .TextMatrix(Baris, 6) TxtNIP.Text = .TextMatrix(Baris, 7)

TxtLokasi.Text = .TextMatrix(Baris, 8) TxtTelepon.Text = .TextMatrix(Baris, 9) TxtNoSeriPC.Text = .TextMatrix(Baris, 10) TxtNoSeriMonitor.Text = .TextMatrix(Baris, 11) TxtKodeAsset.Text = .TextMatrix(Baris, 12) CmbMS.Text = .TextMatrix(Baris, 13)

TxtStikerHotline.Text = .TextMatrix(Baris, 14) CmbTipePCBaru.Text = .TextMatrix(Baris, 15) CmbProcessorPCBaru.Text = .TextMatrix(Baris, 16) CmbMemoryPCBaru.Text = .TextMatrix(Baris, 17) CmbHDDPCBaru.Text = .TextMatrix(Baris, 18) CmbMonitorBaru.Text = .TextMatrix(Baris, 19) TxtNoSeriPCLama.Text = .TextMatrix(Baris, 20) TxtNoSeriMonitorLama.Text = .TextMatrix(Baris, 21) TxtNoAktivaCPU.Text = .TextMatrix(Baris, 22) TxtMerk.Text = .TextMatrix(Baris, 23) End With

End Sub

Private Sub SSTab1_DblClick()

End Sub

Private Sub TabelData_EnterCell() SalinDataPerRecord TabelData.Row End Sub

Private Sub Timer2_Timer() Labeljam.Caption = Time

(12)

Private Sub txtAlamat_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

TxtNamaPemakai.SetFocus End If

End Sub

Private Sub TxtKodeAsset_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

CmbMS.SetFocus End If

End Sub

Private Sub txtKodeCabang_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

txtAlamat.SetFocus End If

End Sub

Private Sub TxtLokasi_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

TxtTelepon.SetFocus End If

End Sub

Private Sub txtNamakantor_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

txtKodeCabang.SetFocus End If

End Sub

Private Sub TxtNamaPemakai_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii)))

If KeyAscii = 13 Then TxtNIP.SetFocus End If

End Sub

Private Sub TxtNIP_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

(13)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or _ KeyAscii = vbKeyBack) Then

Beep KeyAscii = 0 End If

End Sub

Private Sub TxtNoAktivaCPU_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

TxtMerk.SetFocus End If

End Sub

Private Sub TxtNoSeriMonitor_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

TxtKodeAsset.SetFocus End If

End Sub

Private Sub TxtNoSeriMonitorLama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

TxtNoAktivaCPU.SetFocus End If

End Sub

Private Sub TxtNoSeriPC_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

TxtNoSeriMonitor.SetFocus End If

End Sub

Private Sub TxtNoSeriPCLama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

TxtNoSeriMonitorLama.SetFocus End If

End Sub

Private Sub TxtNoUAT_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

Cmbtanggal.SetFocus End If

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or _ KeyAscii = vbKeyBack) Then

(14)

End If End Sub 'cetak data

Private Sub CmdPrint_Click() no = 1

Sw = 1 Cetak

Printer.EndDoc Rs.Close End Sub

Sub Cetak()

Dim Grs As String Dim sqltext As String

Set Rs = New ADODB.Recordset If StatusPrint = 1 Then

sqltext = "select * from BCA where nouat='" & TxtCariNoUAT.Text & "'" ElseIf StatusPrint = 2 Then

sqltext = "select * from BCA where kode_cabang='" & TxtCariKodeCabang.Text & "'" ElseIf StatusPrint = 3 Then

tglawal = "#" & TxtTglAwal.Text & "#" tglakhir = "#" & TxtTglAkhir.Text & "#"

sqltext = "select * from bca where tanggal between " & tglawal & " and " & tglakhir & ""

Else

sqltext = "select * from BCA" End If

Rs.Open sqltext, Db, adOpenDynamic, adLockOptimistic, adCmdText With Rs

If .EOF And .BOF Then

MsgBox "data tidak ada..!", vbInformation, "ISTIDATA" Exit Sub

End If

.MoveFirst

Printer.CurrentX = 0 Printer.CurrentY = 0

Printer.FontName = "Lucida Console" 'If Sw = 1 Then

(15)

'Printer.FontBold = True Printer.FontSize = 14 Printer.Orientation = 2 Printer.Print

Printer.Print Tab(10); "LAPORAN DEPLOYMENT PC SEAT MANAGEMENT BCA";

Grs = String(120, "=") Printer.FontBold = False Printer.FontSize = 8 Printer.Print

Printer.Print Tab(0); Grs; Printer.Print Tab(2); "No"; Printer.Print Tab(8); "NoUat"; Printer.Print Tab(15); "Tanggal"; Printer.Print Tab(27); "Nama Kantor"; Printer.Print Tab(47); "K. Cabang"; Printer.Print Tab(57); "Alamat";

Printer.Print Tab(77); "Nama Pemakai"; Printer.Print Tab(93); "NIP";

Printer.Print Tab(103); "Lokasi"; Printer.Print Tab(111); "Telepon"; ' Printer.Print ; "NoSeriPC"; ' Printer.Print ; "NoSeriMonitor"; ' Printer.Print ; "KodeAsset"; ' Printer.Print ; "Mouse/Keyboard"; ' Printer.Print ; "Stiker Hotline"; ' Printer.Print ; "TipePC"; ' Printer.Print ; "Processor"; ' Printer.Print ; "Memory"; ' Printer.Print ; "HDD"; ' Printer.Print ; "Monitor";

' Printer.Print ; "NoSeriPCLama"; ' Printer.Print ; "NoSeriMonitorLama"; ' Printer.Print ; "NoAktiva CPU"; ' Printer.Print ; "Model/Merk"; Printer.Print Tab(0); Grs; Do

n = n + 1

Printer.Print Tab(3); n;

(16)

Printer.Print Tab(93); .Fields(6).Value; Printer.Print Tab(103); .Fields(7).Value; Printer.Print Tab(111); .Fields(8).Value; .MoveNext

Loop Until .EOF

Printer.Print Tab(0); Grs; End With

Printer.NewPage

Figur

Memperbarui...

Referensi

Memperbarui...

Related subjects :