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

📄 form4.frm

📁 我用VB开发的饲料经营进销存管理程序,包含购入、售出管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1800
      TabIndex        =   6
      Top             =   3120
      Width           =   1425
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "单    号:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1800
      TabIndex        =   5
      Top             =   2640
      Width           =   1455
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "日    期:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1800
      TabIndex        =   4
      Top             =   2160
      Width           =   1455
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "月    份:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1800
      TabIndex        =   3
      Top             =   1680
      Width           =   1455
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "年    份:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1800
      TabIndex        =   2
      Top             =   1200
      Width           =   1455
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "品    种:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1800
      TabIndex        =   1
      Top             =   720
      Width           =   1455
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "售出产品输入画面"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   2100
      TabIndex        =   0
      Top             =   240
      Width           =   2520
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim f_max_number

Private Sub Combo1_LostFocus()
    If Combo1.Text = "玉米" Then
        Text11.Text = "粉"
    Else
        Text11.Text = ""
    End If
End Sub

Private Sub Command1_Click()
    Dim cnn1 As ADODB.Connection
    Dim cmd1 As ADODB.Command
    Set cnn1 = New ADODB.Connection
    If Text10.Text = "" Then
        MsgBox ("帐本号不能为空!")
        Text10.SetFocus
        GoTo exit_Command1_Click
    End If
    cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
    Set cmd1 = New ADODB.Command
        SQL = "SELECT count(*),MAX(编号) from 品种售出表"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs1 = cmd1.Execute
    rs1.MoveFirst
    If rs1.Fields(0) = 0 Then
        f_max_number = 0
    Else
        f_max_number = rs1.Fields(1) + 1
    End If
    SQL = "INSERT INTO 品种售出表(编号,品种, 年份,月份,日期,单号,售出斤数,售出单价," & _
          "售出金额,欠款金额,帐本号,备注) VALUES ( " & f_max_number & "," & "'" & Combo1.Text & "'" & "," & Text2.Text & "," & _
          Text3.Text & "," & Text4.Text & ",'" & Text5.Text & "'" & "," & Text6.Text & "," & Text7.Text & "," & _
          Text8.Text & "," & Text9.Text & "," & "'" & Text10.Text & "'" & "," & "'" & Text11.Text & "'" & ")"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
        .Execute
    End With
    cnn1.Close
    Set cnn1 = Nothing
    MsgBox ("数据保存成功")
    Text4.Text = ""
    Text5.Text = g_reckoning
    Text6.Text = 0
    Text7.Text = 0
    Text8.Text = 0
    Text9.Text = 0
    Text11.Text = ""
    Combo1.SetFocus
exit_Command1_Click:
End Sub


Private Sub Form_Load()
    Text2.Text = g_year
    Text3.Text = g_month
    Text5.Text = g_reckoning
    Text6.Text = 0
    Text7.Text = 0
    Text8.Text = 0
    Text10.Text = g_book
    If g_breed = "玉米" Then
        Text11.Text = "粉"
    End If
    Dim cnn1 As ADODB.Connection
    Dim cmd1 As ADODB.Command
    Dim rs1 As ADODB.Recordset
    Set cnn1 = New ADODB.Connection
    cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
    Set cmd1 = New ADODB.Command
    SQL = "select 品种  from 品种类型表  order by 品种"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs1 = cmd1.Execute
    rs1.MoveFirst
    i = 0
    While Not rs1.EOF
        Combo1.AddItem rs1.Fields(0), i
        rs1.MoveNext
        i = i + 1
    Wend

    Combo1.Text = g_breed
    SQL = "SELECT count(*),MAX(编号) from 品种售出表"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs1 = cmd1.Execute
    rs1.MoveFirst
    If rs1.Fields(0) = 0 Then
        f_max_number = 0
    Else
        f_max_number = rs1.Fields(1) + 1
    End If
    cnn1.Close
    Set cnn1 = Nothing
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Select Case g_form
        Case "form2"
            Form2.Show
        Case "form28"
            Form28.Show
        Case "form26"
            Form26.Show
    End Select
End Sub



Private Sub Text2_GotFocus()
    Text5.SetFocus
End Sub

Private Sub Text3_GotFocus()
    Text5.SetFocus
End Sub

Private Sub Text4_GotFocus()
    Text5.SetFocus
End Sub

Private Sub Text5_LostFocus()
    Dim cnn1 As ADODB.Connection
    Dim cmd1 As ADODB.Command
    Dim rs1 As ADODB.Recordset
    Set cnn1 = New ADODB.Connection
    cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
    Set cmd1 = New ADODB.Command
    SQL = "SELECT 帐本号,日期 from 帐单表 where 帐单号= " & "'" & Text5.Text & "'" & _
    " and 年份=" & Text2.Text & " and 月份=" & Text3.Text
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs1 = cmd1.Execute
    If rs1.EOF Then
        MsgBox ("没有查到对应的帐本号,请确认已经输入帐本号!")
        Text5.SetFocus
        cnn1.Close
        Set cnn1 = Nothing
        GoTo exit_text5_lostfocus
    End If
    rs1.MoveFirst
    Text10.Text = rs1.Fields(0)
    Text4.Text = rs1.Fields(1)
    cnn1.Close
    Set cnn1 = Nothing
exit_text5_lostfocus:
End Sub

Private Sub Text6_LostFocus()
    Text8.Text = Text6.Text * Text7.Text
End Sub

Private Sub Text7_LostFocus()
    Text8.Text = Text6.Text * Text7.Text
End Sub

Private Sub Text8_GotFocus()
    Text8.Text = Text6.Text * Text7.Text
End Sub

Private Sub Text9_GotFocus()
    Text9.Text = 0
End Sub

⌨️ 快捷键说明

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