⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jhform.frm

📁 一套VB完整的灯具销售管理系统设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form JHForm 
   BorderStyle     =   3  'Fixed Dialog
   ClientHeight    =   3300
   ClientLeft      =   45
   ClientTop       =   45
   ClientWidth     =   6030
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3300
   ScaleWidth      =   6030
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.PictureBox Picture1 
      BackColor       =   &H00404000&
      Height          =   1035
      Left            =   3900
      ScaleHeight     =   975
      ScaleWidth      =   1935
      TabIndex        =   20
      Top             =   675
      Width           =   1995
      Begin VB.Image Image1 
         Height          =   480
         Left            =   1320
         Picture         =   "JHForm.frx":0000
         Top             =   405
         Width           =   480
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0C000&
         BackStyle       =   0  'Transparent
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   7.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FFFFFF&
         Height          =   150
         Left            =   195
         TabIndex        =   21
         Top             =   285
         Width           =   150
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   -435
      Top             =   2370
   End
   Begin VB.Data Data2 
      Caption         =   "Data2"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   285
      Left            =   -1125
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   1725
      Width           =   1140
   End
   Begin VB.TextBox Text55 
      Height          =   270
      Left            =   1605
      MaxLength       =   8
      TabIndex        =   4
      Top             =   2550
      Width           =   1230
   End
   Begin VB.TextBox Text44 
      Enabled         =   0   'False
      Height          =   270
      Left            =   1605
      MaxLength       =   16
      TabIndex        =   3
      Top             =   2145
      Width           =   1860
   End
   Begin VB.TextBox Text33 
      Height          =   270
      Left            =   1605
      MaxLength       =   6
      TabIndex        =   2
      Top             =   1725
      Width           =   1860
   End
   Begin VB.TextBox Text22 
      Enabled         =   0   'False
      Height          =   270
      Left            =   1605
      MaxLength       =   8
      TabIndex        =   1
      Top             =   1290
      Width           =   1230
   End
   Begin VB.TextBox Text11 
      Height          =   270
      Left            =   1605
      MaxLength       =   50
      TabIndex        =   0
      Top             =   825
      Width           =   1875
   End
   Begin VB.TextBox Text5 
      DataField       =   "经手人"
      DataSource      =   "Data1"
      Height          =   270
      Left            =   1605
      TabIndex        =   18
      Top             =   2550
      Visible         =   0   'False
      Width           =   1230
   End
   Begin VB.Frame Frame1 
      Height          =   990
      Left            =   4380
      TabIndex        =   17
      Top             =   1845
      Width           =   1155
      Begin VB.CommandButton CloseForm 
         Cancel          =   -1  'True
         Caption         =   "放弃(&C)"
         Height          =   420
         Left            =   30
         TabIndex        =   10
         Top             =   540
         Width           =   1095
      End
      Begin VB.CommandButton SaveButton 
         Caption         =   "保存(&S)"
         Enabled         =   0   'False
         Height          =   420
         Left            =   30
         TabIndex        =   9
         Top             =   120
         Width           =   1095
      End
   End
   Begin VB.TextBox Text4 
      DataField       =   "总金额"
      DataSource      =   "Data1"
      Enabled         =   0   'False
      ForeColor       =   &H000000C0&
      Height          =   270
      Left            =   1605
      TabIndex        =   8
      Top             =   2145
      Visible         =   0   'False
      Width           =   1860
   End
   Begin VB.TextBox Text3 
      DataField       =   "数量"
      DataSource      =   "Data1"
      Height          =   270
      Left            =   1605
      TabIndex        =   7
      Top             =   1725
      Visible         =   0   'False
      Width           =   1860
   End
   Begin VB.TextBox Text2 
      DataField       =   "单价"
      DataSource      =   "Data1"
      ForeColor       =   &H00800080&
      Height          =   270
      Left            =   1605
      TabIndex        =   6
      Top             =   1290
      Visible         =   0   'False
      Width           =   1230
   End
   Begin VB.TextBox Text1 
      DataField       =   "品名"
      DataSource      =   "Data1"
      ForeColor       =   &H00FF0000&
      Height          =   270
      Left            =   1605
      TabIndex        =   5
      Top             =   825
      Visible         =   0   'False
      Width           =   1875
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   285
      Left            =   -1140
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   15
      Width           =   1140
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "经手人:"
      Height          =   180
      Left            =   780
      TabIndex        =   19
      Top             =   2595
      Width           =   720
   End
   Begin VB.Line Line2 
      BorderColor     =   &H00FFFFFF&
      BorderWidth     =   2
      X1              =   0
      X2              =   6030
      Y1              =   3210
      Y2              =   3210
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00808080&
      BorderWidth     =   3
      X1              =   0
      X2              =   6030
      Y1              =   3150
      Y2              =   3135
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "总金额:"
      ForeColor       =   &H000000C0&
      Height          =   180
      Left            =   780
      TabIndex        =   16
      Top             =   2175
      Width           =   720
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "进货数量:"
      Height          =   180
      Left            =   600
      TabIndex        =   15
      Top             =   1755
      Width           =   900
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "单价:"
      ForeColor       =   &H00800080&
      Height          =   180
      Left            =   960
      TabIndex        =   14
      Top             =   1320
      Width           =   540
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "产品名称:"
      ForeColor       =   &H00FF0000&
      Height          =   180
      Left            =   600
      TabIndex        =   13
      Top             =   870
      Width           =   900
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "进货单"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   210
      Left            =   2565
      TabIndex        =   12
      Top             =   135
      Width           =   630
   End
   Begin VB.Label Label1 
      BackColor       =   &H00800000&
      BorderStyle     =   1  'Fixed Single
      Height          =   360
      Left            =   105
      TabIndex        =   11
      Top             =   75
      Width           =   5865
   End
End
Attribute VB_Name = "JHForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ANew As Boolean, N As Integer, AddCP As Boolean

Private Sub CloseForm_Click()
Unload Me
End Sub

Private Sub Form_Load()
'定义数据库路径
Data1.DatabaseName = appData
Data1.RecordSource = "WZK"
Data1.Refresh
Data2.DatabaseName = appData
Data2.RecordSource = "cpk"
Data2.Refresh
'初始化添加为假
ANew = False
Text55.Text = Manager
AddCP = False
End Sub

Private Sub SaveButton_Click()
If ANew = True Then
   Dim Db As Database, SjStr As String
    Set Db = OpenDatabase(appData)
     SjStr = "insert into cpk (品名,单价) values('" & Trim(Text11.Text) & "'," & Val(Text22.Text) & ")"
      Db.Execute SjStr
       Db.Close
   End If
SjStr = "品名='" & Trim(Text11.Text) & "'"
Data1.Recordset.FindFirst SjStr
'没有进过的货,第一次进,执行以下
If Data1.Recordset.NoMatch Then
  Data1.Recordset.AddNew
   Text1.Text = Text11.Text
    Text2.Text = Text22.Text
     Text3.Text = Text33.Text
      Text4.Text = Text44.Text
       Text5.Text = Text55.Text
        Data1.Refresh
         Else
         '已经进过一次货物的,执行以下
           Data1.Recordset.Edit
             If IsNull(Data1.Recordset.Fields(2)) Then
                Text3.Text = Trim(Text33.Text)
               Else
              Text3.Text = Val(Text3.Text) + Val(Text33.Text)
             End If
            If IsNull(Data1.Recordset.Fields(3)) Then
           Text4.Text = Trim(Text44.Text)
          Else
         Text4.Text = Val(Text4.Text) + Val(Text44.Text)
       End If
    Data1.Refresh
  End If
Unload Me
End Sub

Private Sub Text11_Change()
If Trim(Text11.Text) <> "" And Val(Text33.Text) > 0 And Val(Text22.Text) > 0 Then
   SaveButton.Enabled = True
   Else
   SaveButton.Enabled = False
   End If
 Text22.Text = ""
 Text33.Text = ""
 Text44.Text = ""
End Sub

Private Sub Text11_DblClick()
AddCP = True
JHForm.MousePointer = 11
Load JHcpselect
JHForm.MousePointer = 0
JHcpselect.Show 1
Text11.Text = CpStr
AddCP = False
End Sub

Private Sub Text11_KeyPress(KeyAscii As Integer)
  '产品为空时,返回!
If Trim(Text11.Text) = "" Then
   Text11.SetFocus
   Exit Sub
   End If
If KeyAscii = 13 And Trim(Text11.Text) <> "" Then
   Text33.SetFocus
End If
  End Sub

Private Sub Text11_LostFocus()
  
If AddCP = True Then
   Exit Sub
   End If
     '产品为空时,返回!
If Trim(Text11.Text) = "" Then
    Text11.SetFocus
    Exit Sub
    End If
Dim Fs As String, Fn As Integer
Fs = "品名='" & Trim(Text11.Text) & "'"
Data2.Recordset.FindFirst Fs
If Data2.Recordset.NoMatch Then
  Fn = MsgBox("此产品不存在,请检查是否输错了?" & Chr(10) & Chr(13) _
       & "如果要将此产品录入为新产品,请按(Y)!" & Chr(10) & Chr(13) _
       & "否则请按(N)!", vbYesNo + 48, "产品不存在")
        If Fn = 6 Then
          ANew = True
           Text22.Enabled = True
            Text22.SetFocus
             Else
            Text22.Enabled = True
           Text22.SetFocus
         ANew = False
       End If
     Exit Sub
   End If
  Text22.Enabled = False
ANew = False
If IsNull(Data2.Recordset.Fields(1)) Then
    Text22.Text = "0"
      Else
    Text22.Text = Data2.Recordset.Fields(1)
 End If
End Sub

Private Sub Text22_Change()
If Trim(Text11.Text) <> "" And Val(Text33.Text) > 0 And Val(Text22.Text) > 0 Then
   SaveButton.Enabled = True
   Else
   SaveButton.Enabled = False
   End If
 Text44.Text = Val(Text22.Text) * Val(Text33.Text)
End Sub

Private Sub Text22_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Val(Text22.Text) > 0 Then
   Text33.SetFocus
    Exit Sub
   End If
If KeyAscii = 8 Then
   If Val(Trim(Text22.Text)) = 0 Then
        KeyAscii = 0
      Else
        Text22.Text = Left(Text22.Text, (Len(Text22.Text) - 1))
        Text22.SelStart = Len(Text22.Text)
          End If
             End If
If KeyAscii = 47 Or KeyAscii < 46 Or KeyAscii > 58 Then
      KeyAscii = 0
      End If
End Sub



Private Sub Text33_Change()
If Trim(Text11.Text) <> "" And Val(Text33.Text) > 0 And Val(Text22.Text) > 0 Then
   SaveButton.Enabled = True
   Else
   SaveButton.Enabled = False
   End If
Text44.Text = Val(Text22.Text) * Val(Text33.Text)
End Sub

Private Sub Text33_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  Text55.Enabled = True
  Text55.SetFocus
  Exit Sub
  End If
If KeyAscii = 8 Then
   If Val(Trim(Text33.Text)) = 0 Then
        KeyAscii = 0
      Else
        Text33.Text = Left(Text33.Text, (Len(Text33.Text) - 1))
        Text33.SelStart = Len(Text33.Text)
        
      End If
      End If
If KeyAscii < 47 Or KeyAscii > 58 Then
      KeyAscii = 0
      End If
End Sub


Private Sub Text55_DblClick()
If Trim(Text11.Text) = "" Then
   AddCP = True
   Else
   AddCP = False
   End If
JhJsr = True
JHForm.MousePointer = 11
Load jsrselect
JHForm.MousePointer = 0
jsrselect.Show 1
JhJsr = False
End Sub

Private Sub Text55_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And SaveButton.Enabled = True Then
    SaveButton.SetFocus
    End If
End Sub

Private Sub Timer1_Timer()
N = N + 1: If N = 9 Then N = 1
Label8.Caption = Left("正在进货中>>>", N)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -