0% found this document useful (0 votes)
6 views79 pages

OOP

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views79 pages

OOP

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

!

" #
$
%
&
' ( )* + ' ( , -
' (

' ( )* $
&
& (
' (

$ ' (
' ( )*

,
' ( )*
&

' ( )*
$ (
. ' ( )*
+/ 0-
$ & , 1
$
' ( )*

!"#

!
$ !

' (
'
23 23 ' (
#
+ -

(
& , 4
23 '
( / 23
23 &

% $

0 $ & / 3
/

& '

0 $ /
$ 23 5 /
6

( )

4 & 73

* + ,

4 & $ 73 $

"
- .

0 $ $
!

"

0 &
3 3 3

0 &
23

% /

0 , 8 5
& 5
$ " &
5 ,
&

&

& $ 9
+ - + -

( 0

0 $
$
(
' ( )* ,
$
$ : ( , ,

#
$
$ , $
$
4 ( ' ( ; $

* "1

' ( , ,
" 3,
$ : ,
&
9 ,
: ,
$ ,

&
,
,

, 8
4
$
(
"

. 2 $

, 23 &
9
,

$
4

/ < 23 5 / 6
23 5
4

< , "
" = >

& '

" $

23 , ?*
&
&
#

$ 4
$

%
&

&
! " # $%
" & '&& " &
( ) "
! " #
&

* &
"!
+ ) ')
,
! -
-
-
$%& $

' ( ( ) $%& $

( .
% .
$%* $%*

!
' ( ( ) $%*
*
$% (
$% (

' ( ( ) $% (

"#
$%! $
$%! $

' ( ( ) $%! $

/ 0
0 (
(

""
' ( ( ) (

1 2
2 +
+

' ( ( ) +

"$
3

' ( ( )

4 2
2 ,( +
,( +

"%
5
,(
,(

!6 7
7 - ( %!
- ( %!

"&
!! 7
7 - ( %*(
- ( %*(

"'
!( %
% '(..

!* 8
8 / $
8

"(
")
!
! " #

! "

! #

$ ! #
! #

% &' (

!
) "# ! $
%
) * + !

! %

"
,
%

! " # (

! % &

% &

% # !
% &

"

$
! "
"

#$
- % &' (

. ) "# ! $
/ ) * +!
!

#
%

% $
' "$ 1
$ 2 3

( ( ! # " ' $
'

) 4 ' '

##
' '

( % # "# *
' $ '
$

#%
! "
#

$ % & '

( )
%
! *

!
+ ,

!
- .

, " -

/ -
&
)
0 1

* $ / * $
&

"
)
2
0 1
* ( / * (
& /
)
2
0 1
* + / * +
&
)
2
0 1

) ! 2 !$ / ) !$
) !
) ! 2 !( / ) !(
) !
) ! 2 !+ / ) !+
* )
% 2 ("3 %
) !

! /
4 . (
! & 5
! 4 . $

& $ / %
& 6
& ( / %
& 6
& + / % 2
& 62
& 7 / %
& 6
& 8 / % )
& 6

2 .

#
$
%
" # "

% -
4 9 : %

&
!
" # !
$
%

& ' & '


(
$

!
& ) & )
*
$

%
& + & +

%
& , & ,
*
$

$ - -'. $ - '.
$ -
$ - -/ $ -/
$ -
$ - -' $ -'
$ -
$ - -) $ -)
$ -
$ - -+ $ -+
" & $
0 ) 1 0
$ -

" 2 -( ' " 2 -( '


3 4 )
)
- .
- 3 4 '
" 2 -( ) (
3 4 )
)
- .
- 3 4 '

# # ' # # '

' '

) )
5
+ 0 0

, 0
6
7 0 !
6!
8 0
"
!
6
/ 0 2
62
9 0 $
6

#
!
!
$
!
%
!
&
!
'
!
:

; 0 :
3 < = * 0

(
!
! "
#
$

% & % &
'
#

$
% ( % (
) *
#

!
$
% + % +
*
#

$
% , % ,
)
#

# - -&. # - &.
# -
# - -/ # -/
# -
# - -&& # - &&
# -
# - -0 # -0
# -
# - -& # -&
# -
# - -( # -(
# -

! 1 -' & ! 1 -' &


2 3 (
(
- .
- 2 3 &
! 1 -' ( '
2 3 (
(
- .
- 2 3 &

" " & " " &

& &

( (
4
+ +

, 5 5
4
6 5
7
8 5
7
/ 5
"#
!
7
0 5 1
71
$ 5 #
7

"$
!
"%
!
"
!
""
!
"&
!
"'
!
9

: 5 9
2 ; < ) 5

"(
!
!

")
!
! "
#$ % &'$ ($$ ( ($ ) #*

& +
)

, -

!
0 $
1

2 $
$

! "

5
. % $
6 .

! 7 ( 6 .
8 8
.

0 (
79* 7 : 79* 7 :
.
2 ; #$ 79* 7 : 7 :
( : 5 < (
+ ( .

3 7 ( =

(
.
4 (
* ( 7 (
(
* (

>
(
( 5
( .
? ; 6 '

* ( ;

8 .
7 (
$ $
(
$ (
7
A *
(
* (
! ) (
! "
#
$

% & % &
'
#

$
% ( % (
)
#
$
% * % *

$
% + % +
,
#

$
% - % -

$
% . % .
,
#

$
% / % /

$
% 0 % 0
1 2
#

$
% $ % $
3
#

$
% &4 % &4
3 !
#

$
% && % &&
3 1 "
#

# 5 5&4 # 5 &4
# 5

# 5 5/ # 5/
# 5

# 5 5&& # 5 &&
# 5

# 5 50 # 50
# 5

# 5 5&( # 5 &(
# 5

# 5 5$ # 5$
# 5

# 5 5& # 5&
# 5

# 5 5( # 5(
# 5

# 5 5* # 5*
# 5

# 5 5+ # 5+
# 5

# 5 5- # 5-
# 5

# 5 5. # 5 5.
3 61444444 67! 8
61444444 67! 8

# 5 5&* # 5 &*
# 5

5& 3
# 5

! 1 5' & ! 1 5' &


" 3 " " &
9 : (
(
5 4
5 9 : &
! 1 5' ( '
9 : (
(
5 4
5 9 : &

" " & " " &


& &

( (
;

* *
;

+ +
;

- 3 3

. 3
6
/ 3
6
0 3
6
$ 3 1
61
&4 3 #
6#

! "

############ $ ###########
!
" #
$ % &

&

' (% )
) ' &* (% ) % +
" % (% ) ,

- . &* (% ) %
(% )
) / , &* + %
% (% )

0 &* % 1 (%
)
! "
! "
# $ % &'
(

) * !

* *

+ +

( (

( (
( (
( (

$ $

$ &'

$ + &
& *

% &
-
#

,
% . /

0 !
( "
1 !
. /

2 " #

3 $

4 %

5 &

#6

# 7 #
8
$

!
' 7 '
8
$ + %
#
"

# !# ! ! ! (
! # !# 7 # !#
8
(

* )
&
0 $
%

1 * !
2 %
%
&'
3 $ % &'
4 $ 9$
! " !

Dim Gen As New cGeneral


Dim rsJual As New ADODB.Recordset
Dim kolom As Integer

Private Sub cmdBersih_Click()


Unload Me
Me.Show vbModal
End Sub

Private Sub cmdCetak_Click()


CR.ReportFileName = App.Path & "\penjualanpernota.rpt"
CR.SelectionFormula = "{Penjualan2.no_nota}='" & Text1.Text & "' "
CR.Formulas(0) = "Bayar=" & Text9.Text & ""
CR.Formulas(1) = "Kembali=" & Label14.Caption & ""
CR.WindowTitle = "Laporan Penjualan Per-Nota"
CR.WindowState = crptMaximized
CR.RetrieveDataFiles
CR.Action = 1
End Sub

Private Sub cmdHapus_Click()


If Text2.Text = "" Then Exit Sub
Dim Ty As String
Dim Conn As New ADODB.Connection

Conn.Open Gen.getConnectionString
Ty = MsgBox("Hapus Data?", vbQuestion + vbOKCancel, "Hapus")
If Ty = vbOK Then
Conn.Execute "delete from penjualan2 where no_nota='" & Text1.Text
& "' and kode_barang='" & Text2.Text & "'"
End If
Conn.Close
Set Conn = Nothing
Clear
TampilGrid (Text1.Text)
End Sub

Private Sub cmdSearch_Click()


Dim lConn As New ADODB.Connection

lConn.Open Gen.getConnectionString

SQL = "select kode_barang as Kode,nama_barang as Nama from brg_barang


where kode_barang like'%" & Text2.Text & "%'"
MSHFlexGrid1.Top = Text2.Top + 200
MSHFlexGrid1.Left = Text2.Left

Adodc1.ConnectionString = lConn
Adodc1.RecordSource = SQL
Adodc1.Refresh
MSHFlexGrid1.Width = 3500
MSHFlexGrid1.Height = 1300
MSHFlexGrid1.ColWidth(0) = 1000
MSHFlexGrid1.ColWidth(1) = 2000
MSHFlexGrid1.Visible = True
Set lConn = Nothing
kolom = 1
End Sub
Private Sub cmdSimpan_Click()
Dim Conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim list As New cGetList

If Text1.Text = "" Then


MsgBox "Nota kosong"
Text1.SetFocus
Exit Sub
ElseIf Text8.Text = "" Then
MsgBox "Kode Customer kosong"
Text8.SetFocus
Exit Sub
ElseIf Text2.Text = "" Then
MsgBox "Kode Barang kosong"
Text2.SetFocus
Exit Sub
ElseIf Text3.Text = "" Then
MsgBox "Nama Barang kosong"
Text3.SetFocus
!
Exit Sub
ElseIf Text4.Text = "" Then
MsgBox "Jml kosong"
Text4.SetFocus
Exit Sub
Else
Conn.Open Gen.getConnectionString
Conn.Execute "delete from penjualan1 where no_nota='" & Text1.Text &
"'"
Conn.Execute "insert into penjualan1 values('" & Text1.Text & "','"
& Format(DTPicker1.Value, "MM/dd/yyyy") & "','" & Text8.Text & "')"
Set rs = list.getRecordsetBySQL("select * from penjualan2 where
no_nota='" & Text1.Text & "' and kode_barang='" & Text2.Text & "'")
If Not rs.EOF Then
Conn.Execute "update penjualan2 set jml_jual=jml_jual +" &
Val(Text5.Text) & " where no_nota='" & Text1.Text & "' and
kode_barang='" & Text2.Text & "'"
Else
Conn.Execute "insert into penjualan2 values('" & Text1.Text &
"','" & Text2.Text & "'," & Val(Text5.Text) & ")"
End If
Conn.Execute "update brg_barang set stock=stock-" & Val(Text5.Text)
& " where kode_barang='" & Text2.Text & "'"
Set rs = Nothing
Conn.Close
Clear
TampilGrid (Text1.Text)
MsgBox "data telah disimpan"
End If
End Sub
Sub TampilGrid(ByVal tmp As String)
On Error GoTo errx
Dim Conn As New ADODB.Connection
Dim list As New cGetList
Dim i As Integer

'''
''' With Grid
''' .Rows = 2
''' For i = 0 To .Cols - 1
''' .TextMatrix(1, i) = ""
''' Next i
''' End With
''' i = 0
total = 0
''' Set rs = list.getRecordsetBySQL("SELECT penjualan2.kode_barang,
brg_barang.nama_barang, brg_barang.harga_barang, penjualan2.jml_jual " &
_
"FROM brg_barang INNER JOIN penjualan2 ON brg_barang.kode_barang
= penjualan2.kode_barang " & _
"WHERE (((penjualan2.no_nota)='" & tmp & "'))")
Conn.Open Gen.getConnectionString

Set rsJual = New ADODB.Recordset


rsJual.ActiveConnection = Conn
rsJual.CursorLocation = adUseClient
rsJual.CursorType = adOpenKeyset
rsJual.LockType = adLockOptimistic
rsJual.Open "SELECT penjualan2.kode_barang, brg_barang.nama_barang,
brg_barang.harga_barang, penjualan2.jml_jual,(brg_barang.harga_barang *
penjualan2.jml_jual) as SubTotal " & _
"
"FROM (brg_barang INNER JOIN penjualan2 ON
brg_barang.kode_barang = penjualan2.kode_barang) " & _
"INNER JOIN penjualan1 ON penjualan2.no_nota =
penjualan1.no_nota " & _
"WHERE (((penjualan2.no_nota)='" & tmp & "')) ORDER BY
Penjualan1.tgl_jual"

Set Grid.DataSource = rsJual

With Grid
'''=================================================
.Columns(0).Width = 1000
.Columns(1).Width = 2200
.Columns(2).Width = 1000
.Columns(3).Width = 500
.Columns(4).Width = 1200
'''=================================================
.Columns(0).Caption = "Kode"
.Columns(1).Caption = "Nama"
.Columns(2).Caption = "Harga"
.Columns(3).Caption = "Jml"
.Columns(4).Caption = "Sub Total"
End With

Do While Not rsJual.EOF


total = total + ((rsJual!harga_barang) * (rsJual!jml_jual)) & ""
rsJual.MoveNext
Loop
Label8.Caption = Format(total, "###,###,###")
Set rs = Nothing

Exit Sub

errx:
MsgBox Err.Description, vbExclamation + vbOKOnly, "Error"
Exit Sub
End Sub

Private Sub cmdTutup_Click()


Unload Me
End Sub

Private Sub Command1_Click()

Dim lConn As New ADODB.Connection

lConn.Open Gen.getConnectionString

SQL = "select Kodecustomer,Nama from customer where kodecustomer


like'%" & Text8.Text & "%'"
MSHFlexGrid1.Top = Text8.Top + 200
MSHFlexGrid1.Left = Text8.Left

Adodc1.ConnectionString = lConn
Adodc1.RecordSource = SQL
Adodc1.Refresh
MSHFlexGrid1.Width = 3500
MSHFlexGrid1.Height = 1300
MSHFlexGrid1.ColWidth(0) = 1000
MSHFlexGrid1.ColWidth(1) = 2000
MSHFlexGrid1.Visible = True
#
Set lConn = Nothing
kolom = 2
End Sub

Private Sub Command2_Click()


CR.ReportFileName = App.Path & "\penjualanpernota.rpt"
CR.SelectionFormula = "{Penjualan2.no_nota}='" & Text1.Text & "' "
CR.Formulas(0) = "Bayar=" & Text9.Text & ""
CR.Formulas(1) = "Kembali=" & Label14.Caption & ""
CR.WindowTitle = "Laporan Penjualan Per-Nota"
CR.WindowState = crptMaximized
CR.RetrieveDataFiles
CR.Action = 1
End Sub

Private Sub Form_Load()


Clear
TampilGrid (Text1.Text)
geturut
End Sub
Sub Clear()
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Label14.Caption = ""
DTPicker1.Value = Format(Date, "dd-MM-yyyy")
End Sub
Sub geturut()
Dim rsx As New ADODB.Recordset
Dim listx As New cGetList
Dim nomor As Double
Set rsx = listx.getRecordsetBySQL("select mid(no_nota,3,5)as nomor
from penjualan1 order by no_nota desc")
If Not rsx.EOF Then
nomor = Val(rsx!nomor)
End If
Text1.Text = GenerateNota(nomor + 1, "PJ")
Set rsx = Nothing
Set listx = Nothing
End Sub
Private Sub Grid_Click()
If Not rsJual.EOF Then
Text2.Text = rsJual!kode_barang
Text5.Text = rsJual![jml_jual]
End If
End Sub

Private Sub MSHFlexGrid1_Click()


If kolom = 1 Then
Text2.Text = Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 0))
ElseIf kolom = 2 Then
Text8.Text = Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 0))
End If
MSHFlexGrid1.Visible = False
End Sub
Private Sub MSHFlexGrid1_GotFocus()
If Adodc1.Recordset.RecordCount <= 0 Then
MsgBox "Data yang dicari tidak ada", vbCritical, "Perhatian"
MSHFlexGrid1.Visible = False
$
End If
End Sub
Private Sub MSHFlexGrid1_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then MSHFlexGrid1.Visible = False
If KeyAscii = 13 Then MSHFlexGrid1_Click
End Sub
Private Sub MSHFlexGrid1_LostFocus()
MSHFlexGrid1.Visible = False
End Sub
Private Sub Text1_Change()
TampilGrid (Text1.Text)
End Sub
Private Sub Text2_Change()
Dim rs1 As New ADODB.Recordset
Dim List1 As New cGetList
Set rs1 = List1.getRecordsetBySQL("select * from brg_barang where
kode_barang='" & Text2.Text & "'")
If Not rs1.EOF Then
Text3.Text = rs1!nama_barang & ""
Text4.Text = rs1!harga_barang & ""
Else
Text3.Text = ""
Text4.Text = ""
End If
Set rs1 = Nothing
Set List1 = Nothing
End Sub
Private Sub Text4_Change()
Text4.Text = Format(Text4.Text, "###,###,###")
Text4.SelStart = Len(Text4.Text)
Text6.Text = FormatNil(Text4.Text) * Val(Text5.Text)
End Sub
Private Sub Text5_Change()
Text6.Text = FormatNil(Text4.Text) * Val(Text5.Text)
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
KeyAscii = Gen.CheckAngkaOnly(KeyAscii)
End Sub
Private Sub Text5_KeyUp(KeyCode As Integer, Shift As Integer)
Dim rsx As New ADODB.Recordset
Dim listx As New cGetList
Set rsx = listx.getRecordsetBySQL("select stock from brg_barang where
kode_barang='" & Text2.Text & "'")
If Not rsx.EOF Then
If Val(Text5.Text) > rsx!stock Then
MsgBox "Stock hanya tersedia " & rsx!stock & ", kurangi jumlah
anda"
Text5.Text = rsx!stock
End If
End If
Set rsx = Nothing
Set listx = Nothing
End Sub
Private Sub Text6_Change()
Text6.Text = Format(Text6.Text, "###,###,###")
Text6.SelStart = Len(Text6.Text)
End Sub

Private Sub Text8_Change()

Dim rs1 As New ADODB.Recordset


%
Dim List1 As New cGetList
Set rs1 = List1.getRecordsetBySQL("select * from customer where
kodecustomer='" & Text8.Text & "'")
If Not rs1.EOF Then
Text7.Text = rs1!nama & ""
Else
Text7.Text = ""
End If
Set rs1 = Nothing
Set List1 = Nothing
End Sub

Private Sub Text9_Change()


Label14.Caption = Val(FormatNil(Text9.Text)) -
Val(FormatNil(Label8.Caption))
End Sub

&
"

# #
$

% % %
%
% %# %
%
&' (

) *+
,
# ) )
, )
+ + ! -
Option Explicit
Dim Gen As New cGeneral

Private Sub cmdCancel_Click()


End
End Sub

Private Sub cmdOK_Click()


Dim rs As New ADODB.Recordset
Dim list As New cGetList
Set rs = list.getRecordsetBySQL("select * from login where " & _
"username='" & txtLogin.Text & "' and password='" &
txtPassword.Text & "'")
If Not rs.EOF Then
MN1 = rs!MN1 & ""
MN2 = rs!MN2 & ""
MN3 = rs!MN3 & ""
MN4 = rs!MN4 & ""
CurrentUserName = rs!UserName
If rs!UserName = "admin" Then mfrmMain.mnSUsers.Visible = True
mfrmMain.EnabelTrue
Set rs = Nothing
Set list = Nothing
Unload Me
Else
MsgBox "Login salah"
End If
Set rs = Nothing
Set list = Nothing
End Sub

Private Sub Form_Load()


Unload frmBar
End Sub

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


If KeyCode = 13 Or KeyCode = 40 Then
txtPassword.SetFocus
End If
End Sub
Private Sub txtLogin_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then End
KeyAscii = Gen.CheckKarakter(KeyAscii)
End Sub

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


If KeyCode = 38 Then
txtLogin.SetFocus
End If
If KeyCode = 13 Then
cmdOK_Click
End If
End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer)


If KeyAscii = 27 Then End
KeyAscii = Gen.CheckKarakter(KeyAscii)
End Sub

You might also like