home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Restaurant20246310122006.psc / frmCAddSupplier.frm < prev    next >
Text File  |  2001-12-11  |  8KB  |  267 lines

  1. VERSION 5.00
  2. Begin VB.Form frmCAddSupplier 
  3.    BackColor       =   &H00800000&
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Menambah Supplier"
  6.    ClientHeight    =   2505
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   4185
  10.    ControlBox      =   0   'False
  11.    BeginProperty Font 
  12.       Name            =   "Tahoma"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   400
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    KeyPreview      =   -1  'True
  21.    LinkTopic       =   "Form1"
  22.    MaxButton       =   0   'False
  23.    MinButton       =   0   'False
  24.    ScaleHeight     =   2505
  25.    ScaleWidth      =   4185
  26.    ShowInTaskbar   =   0   'False
  27.    StartUpPosition =   1  'CenterOwner
  28.    Begin VB.CommandButton cmdLookUp 
  29.       Caption         =   "..."
  30.       Height          =   315
  31.       Left            =   3600
  32.       TabIndex        =   8
  33.       TabStop         =   0   'False
  34.       Top             =   240
  35.       Width           =   315
  36.    End
  37.    Begin VB.TextBox txtFields 
  38.       Alignment       =   1  'Right Justify
  39.       DataField       =   "Supplier"
  40.       Height          =   315
  41.       Index           =   2
  42.       Left            =   2520
  43.       MaxLength       =   10
  44.       TabIndex        =   1
  45.       Top             =   960
  46.       Width           =   1395
  47.    End
  48.    Begin VB.CommandButton cmdClose 
  49.       Caption         =   "S&elesai"
  50.       Height          =   795
  51.       Left            =   3120
  52.       Picture         =   "frmCAddSupplier.frx":0000
  53.       Style           =   1  'Graphical
  54.       TabIndex        =   3
  55.       Top             =   1500
  56.       Width           =   795
  57.    End
  58.    Begin VB.CommandButton cmdUpdate 
  59.       Caption         =   "&Simpan"
  60.       Height          =   795
  61.       Left            =   2280
  62.       Picture         =   "frmCAddSupplier.frx":030A
  63.       Style           =   1  'Graphical
  64.       TabIndex        =   2
  65.       Top             =   1500
  66.       Width           =   795
  67.    End
  68.    Begin VB.TextBox txtFields 
  69.       DataField       =   "Supplier"
  70.       Height          =   315
  71.       Index           =   0
  72.       Left            =   2520
  73.       MaxLength       =   10
  74.       TabIndex        =   0
  75.       Top             =   240
  76.       Width           =   1035
  77.    End
  78.    Begin VB.TextBox txtFields 
  79.       BackColor       =   &H00E0E0E0&
  80.       DataField       =   "NamaSupplier"
  81.       Height          =   315
  82.       Index           =   1
  83.       Left            =   300
  84.       Locked          =   -1  'True
  85.       TabIndex        =   4
  86.       TabStop         =   0   'False
  87.       Top             =   600
  88.       Width           =   3615
  89.    End
  90.    Begin VB.Label lblInv 
  91.       AutoSize        =   -1  'True
  92.       BackStyle       =   0  'Transparent
  93.       Caption         =   "Satuan"
  94.       BeginProperty Font 
  95.          Name            =   "Tahoma"
  96.          Size            =   8.25
  97.          Charset         =   0
  98.          Weight          =   700
  99.          Underline       =   0   'False
  100.          Italic          =   0   'False
  101.          Strikethrough   =   0   'False
  102.       EndProperty
  103.       ForeColor       =   &H00FFFFFF&
  104.       Height          =   195
  105.       Index           =   3
  106.       Left            =   1200
  107.       TabIndex        =   7
  108.       Top             =   1020
  109.       Width           =   600
  110.    End
  111.    Begin VB.Label lblInv 
  112.       AutoSize        =   -1  'True
  113.       BackStyle       =   0  'Transparent
  114.       Caption         =   "Harga per"
  115.       BeginProperty Font 
  116.          Name            =   "Tahoma"
  117.          Size            =   8.25
  118.          Charset         =   0
  119.          Weight          =   700
  120.          Underline       =   0   'False
  121.          Italic          =   0   'False
  122.          Strikethrough   =   0   'False
  123.       EndProperty
  124.       ForeColor       =   &H00FFFFFF&
  125.       Height          =   195
  126.       Index           =   1
  127.       Left            =   300
  128.       TabIndex        =   6
  129.       Top             =   1020
  130.       Width           =   840
  131.    End
  132.    Begin VB.Label lblInv 
  133.       AutoSize        =   -1  'True
  134.       BackStyle       =   0  'Transparent
  135.       Caption         =   "Masukkan Kode Supplier"
  136.       BeginProperty Font 
  137.          Name            =   "Tahoma"
  138.          Size            =   8.25
  139.          Charset         =   0
  140.          Weight          =   700
  141.          Underline       =   0   'False
  142.          Italic          =   0   'False
  143.          Strikethrough   =   0   'False
  144.       EndProperty
  145.       ForeColor       =   &H00FFFFFF&
  146.       Height          =   195
  147.       Index           =   0
  148.       Left            =   300
  149.       TabIndex        =   5
  150.       Top             =   300
  151.       Width           =   2070
  152.    End
  153. End
  154. Attribute VB_Name = "frmCAddSupplier"
  155. Attribute VB_GlobalNameSpace = False
  156. Attribute VB_Creatable = False
  157. Attribute VB_PredeclaredId = True
  158. Attribute VB_Exposed = False
  159. Option Explicit
  160.  
  161. Dim rsAddSupp As New ADODB.Recordset
  162.  
  163. Private Sub Form_Load()
  164.   '
  165.   sFormAktif = Me.Name
  166.   Set rsAddSupp = New ADODB.Recordset
  167.   rsAddSupp.Open "C_Supplier_Inventory", db, adOpenStatic, adLockOptimistic
  168.   '
  169.   lblInv(3).Caption = frmCInventory.txtFields(7).Text
  170. End Sub
  171.  
  172. Private Sub Form_KeyPress(KeyAscii As Integer)
  173.   If KeyAscii = 27 Then
  174.     Unload Me
  175.   End If
  176. End Sub
  177.  
  178. Private Sub Form_Unload(Cancel As Integer)
  179.   rsAddSupp.Close
  180.   Set rsAddSupp = Nothing
  181.   sFormAktif = "FRMCINVENTORY"
  182. End Sub
  183.  
  184. Private Sub cmdUpdate_Click()
  185.   '
  186.   ' Cek Supplier
  187.   For iCounter = 0 To 2 Step 2
  188.     If txtFields(iCounter).Text = "" Then
  189.       MsgBox "Field ini dibutuhkan", vbCritical
  190.       txtFields(iCounter).SetFocus
  191.       Exit Sub
  192.     End If
  193.   Next
  194.   If IsNumeric(txtFields(2).Text) = False Then
  195.     MsgBox "Field ini bertipe numerik", vbCritical
  196.     txtFields(2).SetFocus
  197.     SendKeys "{END}+{HOME}"
  198.     Exit Sub
  199.   End If
  200.   '
  201.   iCounter = JumlahRecord("Select * From [C_Supplier_Inventory] Where Supplier = '" & txtFields(0).Text & "' And Inventory = '" & frmCInventory.txtFields(0).Text & "'", db)
  202.   If iCounter > 0 Then
  203.     MsgBox "Supplier telah ada", vbCritical
  204.     txtFields(0).Text = ""
  205.     txtFields(1).Text = ""
  206.     txtFields(2).Text = ""
  207.     txtFields(0).SetFocus
  208.     Exit Sub
  209.   End If
  210.   '
  211.   rsAddSupp.AddNew
  212.   rsAddSupp!Inventory = frmCInventory.txtFields(0).Text
  213.   rsAddSupp!NamaInventory = frmCInventory.txtFields(1).Text
  214.   rsAddSupp!Supplier = txtFields(0).Text
  215.   rsAddSupp!NamaSupplier = txtFields(1).Text
  216.   rsAddSupp!LastPrice = CCur(txtFields(2).Text)
  217.   rsAddSupp.Update
  218.   '
  219.   MsgBox "Supplier baru telah disimpan dalam database", vbInformation
  220.   txtFields(0).Text = ""
  221.   txtFields(1).Text = ""
  222.   txtFields(2).Text = ""
  223.   txtFields(0).SetFocus
  224.   '
  225. End Sub
  226.  
  227. Private Sub cmdClose_Click()
  228.   Unload Me
  229. End Sub
  230.  
  231. Private Sub txtFields_KeyPress(Index As Integer, KeyAscii As Integer)
  232.   '
  233.   If KeyAscii = 13 Then
  234.     Select Case Index
  235.       Case 0
  236.         sKontrolAktif = "AIA_1"
  237.         Dim rsSupplier As New ADODB.Recordset
  238.         rsSupplier.Open "Select Supplier, NamaSupplier from [C_Supplier] Where Supplier='" & txtFields(Index).Text & "'", db, adOpenStatic, adLockReadOnly
  239.         If rsSupplier.RecordCount <> 0 Then
  240.           txtFields(1).Text = rsSupplier!NamaSupplier
  241.           KeyAscii = 0
  242.           SendKeys "{TAB}"
  243.         Else
  244.           txtFields(1).Text = ""
  245.           frmCari.Show vbModal
  246.           txtFields(0).SetFocus
  247.         End If
  248.         rsSupplier.Close
  249.         sKontrolAktif = ""
  250.       Case 2
  251.         If Not IsNumeric(txtFields(2).Text) Then
  252.           Exit Sub
  253.         End If
  254.         SendKeys "{TAB}"
  255.       Case Else
  256.         SendKeys "{TAB}"
  257.     End Select
  258.   End If
  259. End Sub
  260.  
  261. Private Sub cmdLookUp_Click()
  262.   sKontrolAktif = "AIA_1"
  263.   frmCari.Show vbModal
  264.   txtFields(0).SetFocus
  265.   If txtFields(0).Text <> "" Then SendKeys "{ENTER}"
  266. End Sub
  267.