Perancangan Sistem Informasi Pembelian Penjualan Dan Persediaan Pada Pt Sari Makmur Tunggal Mandiri Medan Menggunakan Visual Basic 6.0

(1)

LAMPIRAN LISTING PROGRAM

1.

Main Form (frmMain.frm)

Private Sub MDIForm_Unload(Cancel As Integer) oConn.Close

Set oConn = Nothing End Sub

Private Sub mnAbout_Click() frmAbout.Show vbModal End Sub

Private Sub mnExit_Click() End

End Sub

Private Sub mnLBeliBrg_Click() frmLapBeliB1.Show

End Sub

Private Sub mnLBeliSupp_Click() frmLapBeliS1.Show

End Sub

Private Sub mnLBeliTgl_Click() frmLapBeli1.Show

End Sub

Private Sub mnLJualBrg_Click() frmLapJualB1.Show

End Sub

Private Sub mnLJualCust_Click() frmLapJualC1.Show

End Sub

Private Sub mnLJualTgl_Click() frmLapJual1.Show

End Sub

Private Sub mnLSaldoStock_Click() frmLapSaldoStock1.Show

End Sub

Private Sub mnMBarang_Click() frmBarang.Show

End Sub

Private Sub mnMCustomer_Click() frmCustomer.Show


(2)

Private Sub mnMSupplier_Click() frmSupplier.Show

End Sub

Private Sub mnTPembelian_Click() frmBeli.Show

End Sub

Private Sub mnTPenjualan_Click() frmJual.Show

End Sub

2.

Form Master Barang (frmBarang.frm)

Option Explicit

Private nLastRow As Integer Private Sub cmdCari_Click()

If Trim(txtKunci.Text) = "" Then Exit Sub

Dim I As Long Dim J As Integer

Dim nSearchCol As Integer

'Ambil kolom yang dicari

nSearchCol = cboKategori.ListIndex + 1

With MData

If nLastRow > 0 Then 'Background Putih For I = 1 To .Cols - 1 .Col = I

.Row = nLastRow

.CellBackColor = &HFFFFFF Next I

End If

'Cari Text

For I = nLastRow + 1 To .Rows - 1

If InStr(1, UCase(.TextMatrix(I, nSearchCol)), _ UCase(txtKunci.Text)) > 0 Then

nLastRow = I

'Warnai dengan background kuning .Row = I

For J = 1 To .Cols - 1 .Col = J

.CellBackColor = &H87F2F0 Next J

Exit For

End If Next I


(3)

'Reset kembali - pencarian dari awal nLastRow = 0

End If

'Set Focus

If .TopRow + 10 < nLastRow Then .TopRow = nLastRow End With

End Sub

Private Sub cmdCloseHelp_Click() picHelp.Visible = False End Sub

Private Sub cmdHelp_Click() picHelp.Visible = True picHelp.ZOrder 0

cmdCloseHelp.SetFocus End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn Then 'Untuk Enter

SendKeys "{TAB}" Else

Select Case KeyCode

Case vbKeyF1: Call Proses("HELP") Case vbKeyF2: Call Proses("BARU") Case vbKeyF3: Call Proses("SIMPAN") Case vbKeyF4: Call Proses("HAPUS") Case vbKeyF5: Call Proses("REFRESH") Case vbKeyF6: Call Proses("FIRST") Case vbKeyF7: Call Proses("PREVIOUS") Case vbKeyF8: Call Proses("NEXT") Case vbKeyF9: Call Proses("LAST") Case vbKeyF10: Call Proses("KELUAR") Case vbKeyF12: Call Proses("PRINT") End Select

End If

End Sub errDel:

oConn.RollbackTrans

MsgBox "Proses hapus data gagal !" & vbCrLf & Err.Description, vbCritical, "Error"

End Sub

3.

Form Master Supplier (frmSupplier.frm)

Option Explicit

Private nLastRow As Integer Private Sub cmdCari_Click()


(4)

Dim I As Long Dim J As Integer

Dim nSearchCol As Integer

'Ambil kolom yang dicari

nSearchCol = cboKategori.ListIndex + 1

With MData

If nLastRow > 0 Then 'Background Putih For I = 1 To .Cols - 1 .Col = I

.Row = nLastRow

.CellBackColor = &HFFFFFF Next I

End If

'Cari Text

For I = nLastRow + 1 To .Rows - 1

If InStr(1, UCase(.TextMatrix(I, nSearchCol)), _ UCase(txtKunci.Text)) > 0 Then

nLastRow = I

'Warnai dengan background kuning .Row = I

For J = 1 To .Cols - 1 .Col = J

.CellBackColor = &H87F2F0 Next J

Exit For

End If Next I

If I = .Rows Then

'Reset kembali - pencarian dari awal nLastRow = 0

End If

'Set Focus

If .TopRow + 10 < nLastRow Then .TopRow = nLastRow End With

End Sub

Private Sub txtNoTelp_KeyPress(KeyAscii As Integer) If KeyAscii <> vbKeyBack And (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) _

And InStr(1, "()-,", Chr(KeyAscii)) = 0 Then KeyAscii = 0

End If End Sub


(5)

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

And InStr(1, "()-,", Chr(KeyAscii)) = 0 Then KeyAscii = 0

End If End Sub

4.

Form Master Customer (frmCustomer.frm)

Option Explicit

Private nLastRow As Integer Private Sub cmdCari_Click()

If Trim(txtKunci.Text) = "" Then Exit Sub

Dim I As Long Dim J As Integer

Dim nSearchCol As Integer

'Ambil kolom yang dicari

nSearchCol = cboKategori.ListIndex + 1

With MData

If nLastRow > 0 Then 'Background Putih For I = 1 To .Cols - 1 .Col = I

.Row = nLastRow

.CellBackColor = &HFFFFFF Next I

End If

'Cari Text

For I = nLastRow + 1 To .Rows - 1

If InStr(1, UCase(.TextMatrix(I, nSearchCol)), _ UCase(txtKunci.Text)) > 0 Then

nLastRow = I

'Warnai dengan background kuning .Row = I

For J = 1 To .Cols - 1 .Col = J

.CellBackColor = &H87F2F0 Next J

Exit For

End If Next I

If I = .Rows Then

'Reset kembali - pencarian dari awal nLastRow = 0

End If


(6)

If .TopRow + 10 < nLastRow Then .TopRow = nLastRow End With

End Sub

Private Sub cmdCloseHelp_Click() picHelp.Visible = False End Sub

Private Sub cmdHelp_Click() picHelp.Visible = True picHelp.ZOrder 0

cmdCloseHelp.SetFocus End Sub

Private Sub txtNoHP_KeyPress(KeyAscii As Integer)

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

And InStr(1, "()-,", Chr(KeyAscii)) = 0 Then KeyAscii = 0

End If End Sub

5.

Form Transaksi Pembelian (frmBeli.frm)

Option Explicit

Private nRowI As Integer Private nColI As Integer Private nLastRow As Integer Private Sub cmdCari_Click()

If Trim(txtKunci.Text) = "" Then Exit Sub

Dim I As Long Dim J As Integer

Dim nSearchCol As Integer

'Ambil kolom yang dicari Select Case cboKategori.Text

Case "No Faktur": nSearchCol = 1 Case "Kode Supplier": nSearchCol = 3 Case "Nama Supplier": nSearchCol = 4 Case "Keterangan": nSearchCol = 6 End Select

With MData

If nLastRow > 0 Then 'Background Putih For I = 1 To .Cols - 1 .Col = I

.Row = nLastRow

.CellBackColor = &HFFFFFF Next I

End If


(7)

'Cari Text

For I = nLastRow + 1 To .Rows - 1

If InStr(1, UCase(.TextMatrix(I, nSearchCol)), _ UCase(txtKunci.Text)) > 0 Then

nLastRow = I

'Warnai dengan background kuning .Row = I

For J = 1 To .Cols - 1 .Col = J

.CellBackColor = &H87F2F0 Next J

Exit For

End If Next I

If I = .Rows Then

'Reset kembali - pencarian dari awal nLastRow = 0

End If

'Set Focus

If .TopRow + 10 < nLastRow Then .TopRow = nLastRow End With

End Sub

Private Sub cmdCloseHelp_Click() picHelp.Visible = False End Sub

Private Sub cmdHelp_Click() picHelp.Visible = True picHelp.ZOrder 0

cmdCloseHelp.SetFocus End Sub

Private Function CekSama(pcKodeStock) As Boolean Dim I As Integer

For I = 1 To MStock.Rows - 1

If UCase(pcKodeStock) = MStock.TextMatrix(I, 0) Then CekSama = True

Exit Function End If

Next I

End Function

6.

Form Transaksi Penjualan (frmJual.frm)

Option Explicit


(8)

Private nColI As Integer Private nLastRow As Integer Private Sub cmdCari_Click()

If Trim(txtKunci.Text) = "" Then Exit Sub

Dim I As Long Dim J As Integer

Dim nSearchCol As Integer

'Ambil kolom yang dicari Select Case cboKategori.Text

Case "No Faktur": nSearchCol = 1 Case "Kode Customer": nSearchCol = 3 Case "Nama Customer": nSearchCol = 4 Case "Keterangan": nSearchCol = 8 End Select

With MData

If nLastRow > 0 Then 'Background Putih For I = 1 To .Cols - 1 .Col = I

.Row = nLastRow

.CellBackColor = &HFFFFFF Next I

End If

'Cari Text

For I = nLastRow + 1 To .Rows - 1

If InStr(1, UCase(.TextMatrix(I, nSearchCol)), _ UCase(txtKunci.Text)) > 0 Then

nLastRow = I

'Warnai dengan background kuning .Row = I

For J = 1 To .Cols - 1 .Col = J

.CellBackColor = &H87F2F0 Next J

Exit For

End If Next I

If I = .Rows Then

'Reset kembali - pencarian dari awal nLastRow = 0

End If

'Set Focus

If .TopRow + 10 < nLastRow Then .TopRow = nLastRow End With

End Sub


(9)

Private Sub txtNoFaktur_Validate(Cancel As Boolean) If Trim(txtNoFaktur.Text) = "" Then

Cancel = True

txtNoFaktur.Text = "" End If

End Sub

Private Function CekSama(pcKodeStock) As Boolean Dim I As Integer

For I = 1 To MStock.Rows - 1

If UCase(pcKodeStock) = MStock.TextMatrix(I, 0) Then CekSama = True

Exit Function End If

Next I

End Function

7.

Form Cetak Faktur Jual (frmCetakFakturJual.frm)

Option Explicit

'REPORT - OBJECT

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Public cNoFaktur As String Private Sub Form_Load() Dim cF As String

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\FakturJual.rpt")

'SQL Faktur Jual

cF = "SELECT T.NoFaktur, T.TglFaktur, T.KodeCust, C.NamaCust, " & _

"C.Alamat, C.Kota, C.Negara, TD.KodeBarang, S.NamaBarang, " & _

"TD.Qty, TD.Harga, TD.SubTotal " & _

"FROM ((TJual AS T INNER JOIN TDJual AS TD ON T.NoFaktur = TD.NoFaktur) " & _

"INNER JOIN TCustomer AS C ON T.KodeCust = C.KodeCust) " & _

"INNER JOIN TBarang AS S ON TD.KodeBarang = S.KodeBarang " & _

"Where T.NoFaktur = '" & cNoFaktur & "'"

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then


(10)

CR1.ReportSource = cRep With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

8.

Form Laporan Barang (frmLapBarang.frm)

Option Explicit

'REPORT - OBJECT

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Private Sub Form_Load() Dim cF As String

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\DaftarBarang.rpt")

'SQL Laporan

cF = "Select KodeBarang, NamaBarang, Satuan, Jenis, Saldo, SaldoHrg " & _


(11)

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

9.

Form Laporan Pembelian Per Tanggal 1 (frmLapBeli1.frm)

Option Explicit

Private Sub cmdKeluar_Click() Unload Me

End Sub

Private Sub cmdOK_Click()

If dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapBeli2 frmLapBeli2.Show End Sub


(12)

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

10.

Form Laporan Pembelian Per Tanggal 2 (frmLapBeli2.frm)

Option Explicit

'REPORT - OBJECT

Private rsCetak As New ADODB.Recordset 'Report Recordset Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Private Sub Form_Load() Dim cF As String

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\Beli.rpt")

'SQL Laporan

cF = "Select B.NoFaktur, B.TglFaktur, B.KodeSupp, S.NamaSupp, B.Keterangan, " & _

"B.TotalHarga, BD.KodeBarang, ST.NamaBarang, ST.Satuan, ST.Jenis, BD.Qty, BD.Harga, BD.SubTotal " & _ "From TSupplier AS S INNER JOIN (TBarang AS ST INNER JOIN (TBeli AS B INNER JOIN TDBeli AS BD ON " & _

"B.NoFaktur = BD.NoFaktur) ON ST.KodeBarang = BD.KodeBarang) ON S.KodeSupp = B.KodeSupp " & _

"Where B.TglFaktur >= #" & Format(dTgl1, "YYYY-MM-DD") & "# And B.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-"YYYY-MM-DD") & "#"

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

'Periode

cRep.FormulaFields(1).Text = "'" & Format(dTgl1, "dd/mm/yyyy") & " s/d " & _

Format(dTgl2, "dd/mm/yyyy") & "'"

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If


(13)

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

11.

Form Laporan Pembelian Per Barang 1 (frmLapBeliB1.frm)

Private Sub cmdKeluar_Click()

Unload Me End Sub

Private Sub cmdOK_Click()

If dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapBeliB2 frmLapBeliB2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

12.

Form Pembelian Per Barang 2 (frmLapBeliB2.frm)

Option Explicit

'REPORT - OBJECT

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Private Sub Form_Load() Dim cF As String


(14)

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\BeliB.rpt")

'SQL Laporan

cF = "Select B.NoFaktur, B.TglFaktur, B.KodeSupp, S.NamaSupp, B.Keterangan, " & _

"B.TotalHarga, BD.KodeBarang, ST.NamaBarang, ST.Satuan, ST.Jenis, BD.Qty, BD.Harga, BD.SubTotal " & _ "From TSupplier AS S INNER JOIN (TBarang AS ST INNER JOIN (TBeli AS B INNER JOIN TDBeli AS BD ON " & _ "B.NoFaktur = BD.NoFaktur) ON ST.KodeBarang = BD.KodeBarang) ON S.KodeSupp = B.KodeSupp " & _

"Where B.TglFaktur >= #" & Format(dTgl1, DD") & "# And B.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#"

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

'Periode

cRep.FormulaFields(1).Text = "'" & Format(dTgl1, "dd/mm/yyyy") & " s/d " & _

Format(dTgl2, "dd/mm/yyyy") & "'"

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False


(15)

Unload Me End Sub

13.

Laporan Pembelian Per Supplier 1 (frmLapBeliS1.frm)

Private Sub cmdKeluar_Click()

Unload Me End Sub

Private Sub cmdOK_Click()

If dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapBeliS2 frmLapBeliS2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

14.

Form Laporan Pembelian Per Supplier 2 (frmLapBeliS2.frm)

Option Explicit

'REPORT - OBJECT

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Private Sub Form_Load() Dim cF As String

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\BeliS.rpt")

'SQL Laporan

cF = "Select B.NoFaktur, B.TglFaktur, B.KodeSupp, S.NamaSupp, B.Keterangan, " & _

"B.TotalHarga, BD.KodeBarang, ST.NamaBarang, ST.Satuan, ST.Jenis, BD.Qty, BD.Harga, BD.SubTotal " & _ "From TSupplier AS S INNER JOIN (TBarang AS ST INNER JOIN (TBeli AS B INNER JOIN TDBeli AS BD ON " & _ "B.NoFaktur = BD.NoFaktur) ON ST.KodeBarang = BD.KodeBarang) ON S.KodeSupp = B.KodeSupp " & _

"Where B.TglFaktur >= #" & Format(dTgl1, DD") & "# And B.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#"


(16)

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

'Periode

cRep.FormulaFields(1).Text = "'" & Format(dTgl1, "dd/mm/yyyy") & " s/d " & _

Format(dTgl2, "dd/mm/yyyy") & "'"

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

15.

Form Laporan Customer (frmLapCustomer.frm)

Option Explicit

'REPORT - OBJECT

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application


(17)

Dim cF As String

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\DaftarCustomer.rpt")

'SQL Laporan

cF = "Select KodeCust, NamaCust, Alamat, Negara, Kota, ContactP, NoTelp " & _

"From TCustomer Order By KodeCust"

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

16.

Form Laporan Penjualan Per Tanggal 1 (frmLapJual1.frm)

Option Explicit

Private Sub cmdKeluar_Click() Unload Me

End Sub

Private Sub cmdOK_Click()


(18)

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapJual2 frmLapJual2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

17.

Form Laporan Penjualan Pr Tanggal 2 (frmLapJual2.frm)

Option Explicit

'REPORT - OBJECT

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Private Sub Form_Load() Dim cF As String

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\Jual.rpt")

'SQL Laporan

cF = "Select B.NoFaktur, B.TglFaktur, B.KodeCust, S.NamaCust, B.Keterangan, " & _

"B.TotalHarga, BD.KodeBarang, ST.NamaBarang,

ST.Satuan, ST.Jenis, BD.Qty, BD.Harga, BD.SubTotal, B.Rate " & _

"From TCustomer AS S INNER JOIN (TBarang AS ST INNER JOIN (TJual AS B INNER JOIN TDJual AS BD ON " & _ "B.NoFaktur = BD.NoFaktur) ON ST.KodeBarang = BD.KodeBarang) ON S.KodeCust = B.KodeCust " & _

"Where B.TglFaktur >= #" & Format(dTgl1, DD") & "# And B.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#"

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport


(19)

.Visible = True End With

'Periode

cRep.FormulaFields(2).Text = "'" & Format(dTgl1, "dd/mm/yyyy") & " s/d " & _

Format(dTgl2, "dd/mm/yyyy") & "'"

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

18.

Form Laporan Penjualan Per Barang 1 (frmLapJualB1.frm)

Option Explicit

Private Sub cmdKeluar_Click() Unload Me

End Sub

Private Sub cmdOK_Click()

If dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapJualB2 frmLapJualB2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub


(20)

19.

Form Laporan Penjualan Per Barang 2 (frmLapJualB2.frm)

Option Explicit

Private Sub cmdKeluar_Click() Unload Me

End Sub

Private Sub cmdOK_Click()

If dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapJualB2 frmLapJualB2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

20.

Form Laporan Penjualan Per Customer 1 (frmLapJualC1.frm)

Option Explicit

Private Sub cmdKeluar_Click() Unload Me

End Sub

Private Sub cmdOK_Click()

If dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapJualC2 frmLapJualC2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

21.

Form Laporan Penjualan Per Customer 2 (frmLapJualC2.frm)

Option Explicit


(21)

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Private Sub Form_Load() Dim cF As String

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\JualC.rpt")

'SQL Laporan

cF = "Select B.NoFaktur, B.TglFaktur, B.KodeCust, S.NamaCust, B.Keterangan, " & _

"B.TotalHarga, BD.KodeBarang, ST.NamaBarang,

ST.Satuan, ST.Jenis, BD.Qty, BD.Harga, BD.SubTotal, B.Rate " & _

"From TCustomer AS S INNER JOIN (TBarang AS ST INNER JOIN (TJual AS B INNER JOIN TDJual AS BD ON " & _ "B.NoFaktur = BD.NoFaktur) ON ST.KodeBarang = BD.KodeBarang) ON S.KodeCust = B.KodeCust " & _

"Where B.TglFaktur >= #" & Format(dTgl1, DD") & "# And B.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#"

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

'Periode

cRep.FormulaFields(2).Text = "'" & Format(dTgl1, "dd/mm/yyyy") & " s/d " & _

Format(dTgl2, "dd/mm/yyyy") & "'"

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If


(22)

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

22.

Form Laporan Persediaan 1 (frmLapSaldoStock1.frm)

Option Explicit

Private Sub cmdKeluar_Click() Unload Me

End Sub

Private Sub cmdOK_Click()

If (dtTglFaktur1.Month <> dtTglFaktur2.Month) Or _ (dtTglFaktur1.Year <> dtTglFaktur2.Year) Then MsgBox "Periode bulan dan tahun harus sama !", vbCritical

Exit Sub

ElseIf dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapSaldoStock2 frmLapSaldoStock2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

23.

Form Laporan Persediaan 2 (frmLapSaldoStock2.frm)

Option Explicit

'REPORT - OBJECT

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Private Sub Form_Load() Dim cF As String


(23)

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\MutasiStock.rpt")

'SQL Laporan

cF = "SELECT T.KodeBarang, T.NamaBarang, " & _

"(Select Sum(TD2.Qty) From TBeli TD1 Inner Join TDBeli TD2 on " & _

"TD1.NoFaktur = TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang " & _

"And TD1.TglFaktur < #" & Format(dTgl1, "YYYY-MM-DD") & "#) As Awal1, " & _

"(Select Sum(TD2.SubTotal) From TBeli TD1 Inner Join TDBeli TD2 on " & _

"TD1.NoFaktur = TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang " & _

"And TD1.TglFaktur < #" & Format(dTgl1, "YYYY-MM-DD") & "#) As Awal1Hrg, " & _

"(Select Sum(TD2.Qty) From TJual TD1 Inner Join TDJual TD2 on " & _

"TD1.NoFaktur = TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang " & _

"And TD1.TglFaktur < #" & Format(dTgl1, "YYYY-MM-DD") & "#) As Awal2, " & _

"(Select Sum(TD2.SubTotal) From TJual TD1 Inner Join TDJual TD2 on " & _

"TD1.NoFaktur = TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang " & _

"And TD1.TglFaktur < #" & Format(dTgl1, "YYYY-MM-DD") & "#) As Awal2Hrg, " & _

"(Select Sum(TD2.Qty) From TBeli TD1 Inner Join TDBeli TD2 on TD1.NoFaktur " & _

"= TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang And " & _

"TD1.TglFaktur >= #" & Format(dTgl1, "YYYY-MM-DD") & "# And TD1.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#) As Masuk, " & _

"(Select Sum(TD2.SubTotal) From TBeli TD1 Inner Join TDBeli TD2 on TD1.NoFaktur " & _

"= TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang And " & _

"TD1.TglFaktur >= #" & Format(dTgl1, "YYYY-MM-DD") & "# And TD1.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#) As MasukHrg, " & _

"(Select Sum(TD2.Qty) From TJual TD1 Inner Join TDJual TD2 on TD1.NoFaktur " & _

"= TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang And " & _

"TD1.TglFaktur >= #" & Format(dTgl1, "YYYY-MM-DD") & "# And TD1.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#) As Keluar, "

cF = cF & _

"(Select Sum(TD2.TotalHAverage) From TJual TD1 Inner Join TDJual TD2 on TD1.NoFaktur " & _

"= TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang And " & _


(24)

"TD1.TglFaktur >= #" & Format(dTgl1, "YYYY-MM-DD") & "# And TD1.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#) As KeluarHrg " & _

"From TBarang T"

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

'Periode

cRep.FormulaFields(14).Text = "'" & Format(dTgl1, "dd/mm/yyyy") & " s/d " & _

Format(dTgl2, "dd/mm/yyyy") & "'"

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

24.

Form List (frmList.frm)

Private bCancel As Boolean Private Sub cmdBatal_Click() Unload Me

End Sub


(25)

strPilih = MData.TextMatrix(MData.Row, 0) bCancel = False

Unload Me End Sub

Private Sub Form_Load() bCancel = True End Sub

Private Sub Form_Unload(Cancel As Integer) If bCancel Then strPilih = ""

End Sub

Private Sub MData_DblClick() Call cmdOK_Click

End Sub

Private Sub MData_KeyPress(KeyAscii As Integer)

If MData.Rows > 1 And KeyAscii = vbKeyReturn Then Call cmdOK_Click

End If End Sub

25.

Form Tentang Pembuat (frmAbout.frm)

Private Sub cmdOK_Click()

Unload Me End Sub

Private Sub Image2_Click() End Sub


(1)

19.

Form Laporan Penjualan Per Barang 2 (frmLapJualB2.frm)

Option Explicit

Private Sub cmdKeluar_Click() Unload Me

End Sub

Private Sub cmdOK_Click()

If dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapJualB2 frmLapJualB2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

20.

Form Laporan Penjualan Per Customer 1 (frmLapJualC1.frm)

Option Explicit

Private Sub cmdKeluar_Click() Unload Me

End Sub

Private Sub cmdOK_Click()

If dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapJualC2 frmLapJualC2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

21.

Form Laporan Penjualan Per Customer 2 (frmLapJualC2.frm)

Option Explicit 'REPORT - OBJECT


(2)

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Private Sub Form_Load() Dim cF As String

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\JualC.rpt")

'SQL Laporan

cF = "Select B.NoFaktur, B.TglFaktur, B.KodeCust, S.NamaCust, B.Keterangan, " & _

"B.TotalHarga, BD.KodeBarang, ST.NamaBarang,

ST.Satuan, ST.Jenis, BD.Qty, BD.Harga, BD.SubTotal, B.Rate " & _

"From TCustomer AS S INNER JOIN (TBarang AS ST INNER JOIN (TJual AS B INNER JOIN TDJual AS BD ON " & _ "B.NoFaktur = BD.NoFaktur) ON ST.KodeBarang = BD.KodeBarang) ON S.KodeCust = B.KodeCust " & _

"Where B.TglFaktur >= #" & Format(dTgl1, DD") & "# And B.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#"

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

'Periode

cRep.FormulaFields(2).Text = "'" & Format(dTgl1, "dd/mm/yyyy") & " s/d " & _

Format(dTgl2, "dd/mm/yyyy") & "'"

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If


(3)

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

22.

Form Laporan Persediaan 1 (frmLapSaldoStock1.frm)

Option Explicit

Private Sub cmdKeluar_Click() Unload Me

End Sub

Private Sub cmdOK_Click()

If (dtTglFaktur1.Month <> dtTglFaktur2.Month) Or _ (dtTglFaktur1.Year <> dtTglFaktur2.Year) Then MsgBox "Periode bulan dan tahun harus sama !", vbCritical

Exit Sub

ElseIf dtTglFaktur1 > dtTglFaktur2 Then

MsgBox "Input tanggal salah !", vbCritical Exit Sub

Else

dTgl1 = dtTglFaktur1.Value dTgl2 = dtTglFaktur2.Value End If

Unload Me

Unload frmLapSaldoStock2 frmLapSaldoStock2.Show End Sub

Private Sub Form_Load()

dtTglFaktur1.Value = Date dtTglFaktur2.Value = Date End Sub

23.

Form Laporan Persediaan 2 (frmLapSaldoStock2.frm)

Option Explicit 'REPORT - OBJECT

Private rsCetak As New ADODB.Recordset 'Report Recordset

Private cRep As New CRAXDDRT.Report 'Report Object Private cApp As New CRAXDDRT.Application 'Report

Application

Private Sub Form_Load() Dim cF As String


(4)

'Sumber rpt

Set cRep = cApp.OpenReport(App.Path & "\Laporan\MutasiStock.rpt")

'SQL Laporan

cF = "SELECT T.KodeBarang, T.NamaBarang, " & _

"(Select Sum(TD2.Qty) From TBeli TD1 Inner Join TDBeli TD2 on " & _

"TD1.NoFaktur = TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang " & _

"And TD1.TglFaktur < #" & Format(dTgl1, "YYYY-MM-DD") & "#) As Awal1, " & _

"(Select Sum(TD2.SubTotal) From TBeli TD1 Inner Join TDBeli TD2 on " & _

"TD1.NoFaktur = TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang " & _

"And TD1.TglFaktur < #" & Format(dTgl1, "YYYY-MM-DD") & "#) As Awal1Hrg, " & _

"(Select Sum(TD2.Qty) From TJual TD1 Inner Join TDJual TD2 on " & _

"TD1.NoFaktur = TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang " & _

"And TD1.TglFaktur < #" & Format(dTgl1, "YYYY-MM-DD") & "#) As Awal2, " & _

"(Select Sum(TD2.SubTotal) From TJual TD1 Inner Join TDJual TD2 on " & _

"TD1.NoFaktur = TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang " & _

"And TD1.TglFaktur < #" & Format(dTgl1, "YYYY-MM-DD") & "#) As Awal2Hrg, " & _

"(Select Sum(TD2.Qty) From TBeli TD1 Inner Join TDBeli TD2 on TD1.NoFaktur " & _

"= TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang And " & _

"TD1.TglFaktur >= #" & Format(dTgl1, "YYYY-MM-DD") & "# And TD1.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#) As Masuk, " & _

"(Select Sum(TD2.SubTotal) From TBeli TD1 Inner Join TDBeli TD2 on TD1.NoFaktur " & _

"= TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang And " & _

"TD1.TglFaktur >= #" & Format(dTgl1, "YYYY-MM-DD") & "# And TD1.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#) As MasukHrg, " & _

"(Select Sum(TD2.Qty) From TJual TD1 Inner Join TDJual TD2 on TD1.NoFaktur " & _

"= TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang And " & _

"TD1.TglFaktur >= #" & Format(dTgl1, "YYYY-MM-DD") & "# And TD1.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#) As Keluar, "

cF = cF & _

"(Select Sum(TD2.TotalHAverage) From TJual TD1 Inner Join TDJual TD2 on TD1.NoFaktur " & _

"= TD2.NoFaktur Where TD2.KodeBarang = T.KodeBarang And " & _


(5)

"TD1.TglFaktur >= #" & Format(dTgl1, "YYYY-MM-DD") & "# And TD1.TglFaktur <= #" & Format(dTgl2, "YYYY-MM-DD") & "#) As KeluarHrg " & _

"From TBarang T"

rsCetak.Open cF, oConn, adOpenStatic, adLockReadOnly, adCmdText

If rsCetak.RecordCount > 0 Then

cRep.Database.SetDataSource rsCetak CR1.ReportSource = cRep

With CR1

.Left = 0: .Top = 0 .Width = Me.ScaleWidth .Height = Me.ScaleHeight .ViewReport

.Zoom 100

.Visible = True End With

'Periode

cRep.FormulaFields(14).Text = "'" & Format(dTgl1, "dd/mm/yyyy") & " s/d " & _

Format(dTgl2, "dd/mm/yyyy") & "'"

Else

MsgBox "Tidak ada data untuk dicetak !", vbCritical, "No Data"

Timer1.Enabled = True End If

End Sub

Private Sub Form_Resize() On Error Resume Next

If Me.WindowState <> vbMinimized Then

CR1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight End If

End Sub

Private Sub Form_Unload(Cancel As Integer) Set cApp = Nothing

Set cRep = Nothing Call CloseRS(rsCetak) End Sub

Private Sub Timer1_Timer() Timer1.Enabled = False Unload Me

End Sub

24.

Form List (frmList.frm)

Private bCancel As Boolean Private Sub cmdBatal_Click() Unload Me

End Sub


(6)

strPilih = MData.TextMatrix(MData.Row, 0) bCancel = False

Unload Me End Sub

Private Sub Form_Load() bCancel = True End Sub

Private Sub Form_Unload(Cancel As Integer) If bCancel Then strPilih = ""

End Sub

Private Sub MData_DblClick() Call cmdOK_Click

End Sub

Private Sub MData_KeyPress(KeyAscii As Integer)

If MData.Rows > 1 And KeyAscii = vbKeyReturn Then Call cmdOK_Click

End If End Sub

25.

Form Tentang Pembuat (frmAbout.frm)

Private Sub cmdOK_Click() Unload Me

End Sub

Private Sub Image2_Click() End Sub