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

📄 frmin.frm

📁 vb写得进销存
💻 FRM
📖 第 1 页 / 共 3 页
字号:
            Object.Visible         =   0   'False
            Caption         =   "确定"
            ImageIndex      =   6
         EndProperty
         BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.Visible         =   0   'False
            Caption         =   "取消"
            ImageIndex      =   7
         EndProperty
      EndProperty
      BorderStyle     =   1
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "操作员"
      Height          =   180
      Index           =   13
      Left            =   4680
      TabIndex        =   27
      Top             =   2460
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "验货人"
      Height          =   180
      Index           =   12
      Left            =   660
      TabIndex        =   26
      Top             =   2385
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "发票号码"
      Height          =   180
      Index           =   11
      Left            =   4485
      TabIndex        =   25
      Top             =   2025
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "发票类型"
      Height          =   180
      Index           =   10
      Left            =   480
      TabIndex        =   23
      Top             =   1980
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "进货单编号"
      Height          =   180
      Index           =   0
      Left            =   360
      TabIndex        =   22
      Top             =   1080
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "支付方式"
      Height          =   180
      Index           =   1
      Left            =   495
      TabIndex        =   21
      Top             =   1500
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "进货时间"
      Height          =   180
      Index           =   2
      Left            =   4515
      TabIndex        =   20
      Top             =   1545
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "供货单位"
      Height          =   180
      Index           =   9
      Left            =   4500
      TabIndex        =   19
      Top             =   1095
      Width           =   720
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "合计(元)  "
      ForeColor       =   &H80000008&
      Height          =   270
      Left            =   315
      TabIndex        =   18
      Top             =   6840
      Width           =   4935
   End
End
Attribute VB_Name = "frmIn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'14
Dim t As Integer

Private Sub Form_Load()
On Error GoTo eH
    adoHP.ConnectionString = g_cnnStr
    adoCHD.ConnectionString = g_cnnStr
    adoHP.RecordSource = "select * from 进货单 where 0=9"
    adoCHD.RecordSource = "select * from 进货单 where 0=9"
    adoHP.Refresh
    adoCHD.Refresh

    Toolbar1.Buttons(3).Enabled = False
    Toolbar1.Buttons(4).Enabled = False
    Toolbar1.Buttons(5).Enabled = False
    Toolbar1.Buttons(6).Enabled = False
    Frame1.Enabled = False
    
    If g_rst.State = 1 Then g_rst.Close
    Combo1.Clear
    g_rst.Open "select * from 发票类型"
    While Not g_rst.EOF
        Combo1.AddItem g_rst!发票类型
        g_rst.MoveNext
    Wend

    If g_rst.State = 1 Then g_rst.Close
    Text9.Clear
    g_rst.Open "select distinct(客户名称) as t from 客户资料"
    While Not g_rst.EOF
        Text9.AddItem g_rst!t & ""
        g_rst.MoveNext
    Wend
    
    If g_rst.State = 1 Then g_rst.Close
    Text1.Clear
    g_rst.Open "select * from 支付方式"
    While Not g_rst.EOF
        Text1.AddItem g_rst!支付方式
        g_rst.MoveNext
    Wend
    
    If g_rst.State = 1 Then g_rst.Close
    Combo2.Clear
    g_rst.Open "select 人员姓名 from 工作人员"
    While Not g_rst.EOF
        Combo2.AddItem g_rst!人员姓名
        Combo3.AddItem g_rst!人员姓名
        g_rst.MoveNext
    Wend
Exit Sub
eH:
    MsgBox em & vbNewLine & "错误号:1401" & vbNewLine & "错误描述:" & Err.Description

End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
On Error GoTo eH
    If KeyAscii = 13 Then
        adoHP.RecordSource = "select * from 货品资料 where 货品代码='" & Text3 & "'"
        adoHP.Refresh

        If adoHP.Recordset.EOF Then
            MsgBox "您输入的货品资料不存在!", vbInformation + vbOKOnly, Me.Caption
        Else
            Text7.Text = adoHP.Recordset!厂价
            If g_rst.State = 1 Then g_rst.Close
            g_rst.Open "select 库存数量 as c from 货品库存 where 货品代码='" & Text3.Text & "'"
            Text11.Text = CStr(g_rst!c)
        
            Text6.SetFocus
        End If
    End If
Exit Sub
eH:
    MsgBox em & vbNewLine & "错误号:1402" & vbNewLine & "错误描述:" & Err.Description

End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If IsNumeric(Text6) = True Then
            Text8 = CStr(CLng(Text6) * CLng(Text7))
        Else
            MsgBox "请输入数字!", vbInformation + vbOKOnly, Me.Caption
        End If
    End If
End Sub

Private Sub Text6_Validate(Cancel As Boolean)
        If Text6 = "" Then Exit Sub
        If IsNumeric(Text6) = True Then
            Text8 = CStr(CLng(Text6) * CLng(Text7))
        Else
            MsgBox "请输入数字!", vbInformation + vbOKOnly, Me.Caption
        End If
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
'On Error GoTo eH
    Select Case Button.Caption
        Case "新建进货单"
            t = 0
            Text1 = ""
            Text2 = ""
            Text9 = ""
            Text10 = ""
            DTPicker1.Value = Date
        
            g_SQL = "select max(进货单编号) as m from 进货单"
            If g_rst.State = 1 Then g_rst.Close
            g_rst.Open g_SQL
            If IsNull(g_rst!m) Then
                Text2 = "1"
            Else
                Text2 = CStr(CLng(g_rst!m) + 1)
            End If
            
            adoHP.RecordSource = "select * from 进货单 where 0=9"
            adoCHD.RecordSource = "select * from 进货单 where 0=9"
            adoHP.Refresh
            adoCHD.Refresh
            
            Toolbar1.Buttons(3).Enabled = True
            Toolbar1.Buttons(4).Enabled = True
            Toolbar1.Buttons(2).Enabled = False
        Case "进货完成"
            Toolbar1.Buttons(6).Enabled = True
            Toolbar1.Buttons(2).Enabled = True
            Toolbar1.Buttons(3).Enabled = False
            Toolbar1.Buttons(4).Enabled = False
            Toolbar1.Buttons(5).Enabled = False
            
            If g_rst.State = 1 Then g_rst.Close
            g_SQL = "select sum(小计) as t from 进货单 where 进货单编号=" & Val(Text2)
            g_rst.Open g_SQL
            MsgBox "进货完成!"
            Text10 = CStr(g_rst!t & "")
        Case "加入货品"
            eButton (False)
            Frame1.Enabled = True
            Toolbar1.Buttons(2).Enabled = False
            
        Case "删除货品"
            If DG.Text = "" Then Exit Sub
            adoCHD.Recordset.Delete
            adoCHD.Recordset.Update
            MsgBox "删除成功!"
            adoCHD.Refresh
            
        Case "退出"
            Unload Me
        Case "确定"
            Toolbar1.Buttons(5).Enabled = True
            Set DG.DataSource = Nothing
            Dim a As Long, b As Long, a1 As Long, b1 As Long
            Dim aa As Double, bb As Double
            If g_rst.State = 1 Then g_rst.Close
            g_rst.Open "select 库存数量 as t from 货品库存 where 货品代码='" & Text3.Text & "'"
            aa = Val(g_rst!t & "")
            If g_rst.State = 1 Then g_rst.Close
            g_rst.Open "select 现价值 as t from 货品资料 where 货品代码='" & Text3.Text & "'"
            bb = Val(g_rst!t & "")
            bb = aa * bb + Val(Text6.Text) * Val(Text7.Text)
            bb = bb / (aa + Val(Text6.Text))
            g_cmd.CommandText = "update 货品资料 set 现价值=" & bb & " where 货品代码='" & Text3.Text & "'"
            g_cmd.Execute

            adoCHD.Recordset.AddNew
            adoCHD.Recordset!进货单编号 = Val(Text2.Text)
            adoCHD.Recordset!供货单位 = CStr(Text9.Text)
            adoCHD.Recordset!支付方式 = Text1.Text
            adoCHD.Recordset!进货日期 = DTPicker1.Value
            adoCHD.Recordset!发票类型 = Combo1.Text
            adoCHD.Recordset!发票号码 = Text12.Text
            adoCHD.Recordset!验货人 = Combo2.Text
            adoCHD.Recordset!操作员 = Combo3.Text
            
            adoCHD.Recordset!进货价 = Val(Text7.Text)
            adoCHD.Recordset!小计 = Val(Text8.Text)
            adoCHD.Recordset!货品代码 = Text3.Text
            adoCHD.Recordset!进货数量 = Val(Text6.Text)
            
            g_cmd.CommandText = "update 货品库存 set 库存数量=库存数量+" & Val(Text6.Text) & " where 货品代码='" & Text3.Text & "'"
            g_cmd.Execute
            
            eButton (True)
            adoCHD.Recordset.Update
            adoCHD.Refresh
            adoCHD.RecordSource = "select * from 进货单 where 进货单编号=" & Val(Text2)
            adoCHD.Refresh
            adoHP.RecordSource = "select * from 进货单 where 0=9"
            Text8 = ""
            Text6 = ""
            Text3 = ""
            adoHP.Refresh
            Frame1.Enabled = False
            Set DG.DataSource = adoCHD
            t = t + 1
           
        Case "取消"
            eButton (True)
            Frame1.Enabled = False
        Case "打印进货单"
            If drIn.Visible = True Then Unload drIn
            If DE.rsIn_分组.State = 1 Then DE.rsIn_分组.Close
            DE.rsIn_分组.Filter = "进货单编号=" & Text2.Text
            DE.rsIn_分组.Open
            
            drIn.Show 1
    End Select
Exit Sub
eH:
    MsgBox em & vbNewLine & "错误号:1403" & vbNewLine & "错误描述:" & Err.Description

End Sub

Private Sub eButton(b As Boolean)
    'Toolbar1.Buttons(2).Enabled = b
    Toolbar1.Buttons(3).Enabled = b
    Toolbar1.Buttons(4).Enabled = b
    Toolbar1.Buttons(5).Enabled = b
    'Toolbar1.Buttons(6).Enabled = b
    Toolbar1.Buttons(8).Enabled = b
    Toolbar1.Buttons(10).Visible = Not b
    Toolbar1.Buttons(11).Visible = Not b
End Sub


⌨️ 快捷键说明

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