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

📄 frmjinhuoadd.frm

📁 商品进销存软件
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmJinhuoAdd 
   Caption         =   "添加进货记录"
   ClientHeight    =   6210
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   11580
   LinkTopic       =   "Form1"
   ScaleHeight     =   6210
   ScaleWidth      =   11580
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame2 
      Caption         =   "进货记录"
      Height          =   4455
      Left            =   120
      TabIndex        =   4
      Top             =   120
      Width           =   11415
      Begin VB.TextBox Textjh 
         Height          =   270
         Index           =   0
         Left            =   2400
         TabIndex        =   11
         Top             =   360
         Width           =   2175
      End
      Begin VB.TextBox Textjh 
         Height          =   270
         Index           =   1
         Left            =   2400
         TabIndex        =   10
         ToolTipText     =   "输入数据需为数值"
         Top             =   1080
         Width           =   2175
      End
      Begin VB.TextBox Textjh 
         Height          =   270
         Index           =   2
         Left            =   2400
         TabIndex        =   9
         ToolTipText     =   "输入数据需为数值"
         Top             =   1440
         Width           =   2175
      End
      Begin VB.TextBox Textjh 
         Enabled         =   0   'False
         Height          =   270
         Index           =   3
         Left            =   2400
         TabIndex        =   8
         Top             =   1800
         Width           =   2175
      End
      Begin VB.TextBox Textjh 
         Height          =   1575
         Index           =   4
         Left            =   2400
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   7
         Top             =   2520
         Width           =   6375
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   2400
         TabIndex        =   5
         Text            =   "Combo2"
         Top             =   720
         Width           =   2175
      End
      Begin MSComCtl2.DTPicker DTPickerjh 
         Height          =   255
         Left            =   2400
         TabIndex        =   6
         Top             =   2160
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   450
         _Version        =   393216
         Format          =   184811521
         CurrentDate     =   38517
      End
      Begin VB.Label Labjh 
         Caption         =   "进货编号:"
         Height          =   255
         Index           =   0
         Left            =   720
         TabIndex        =   18
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Labjh 
         Caption         =   "商品名称:"
         Height          =   255
         Index           =   2
         Left            =   720
         TabIndex        =   17
         Top             =   720
         Width           =   1095
      End
      Begin VB.Label Labjh 
         Caption         =   "单价:"
         Height          =   255
         Index           =   3
         Left            =   720
         TabIndex        =   16
         Top             =   1080
         Width           =   1095
      End
      Begin VB.Label Labjh 
         Caption         =   "数量:"
         Height          =   255
         Index           =   4
         Left            =   720
         TabIndex        =   15
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Label Labjh 
         Caption         =   "数额:"
         Height          =   255
         Index           =   5
         Left            =   720
         TabIndex        =   14
         Top             =   1800
         Width           =   1095
      End
      Begin VB.Label Labjh 
         Caption         =   "日期:"
         Height          =   255
         Index           =   6
         Left            =   720
         TabIndex        =   13
         Top             =   2160
         Width           =   1095
      End
      Begin VB.Label Labjh 
         Caption         =   "备注:"
         Height          =   255
         Index           =   7
         Left            =   720
         TabIndex        =   12
         Top             =   2520
         Width           =   1095
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "操作"
      Height          =   1455
      Left            =   120
      TabIndex        =   0
      Top             =   4680
      Width           =   11415
      Begin VB.CommandButton Command1 
         Caption         =   "保存"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   1800
         TabIndex        =   3
         Top             =   480
         Width           =   2415
      End
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   7920
         TabIndex        =   2
         Top             =   480
         Width           =   2415
      End
      Begin VB.CommandButton cmdRecordChange 
         Caption         =   "修改与删除"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   5040
         TabIndex        =   1
         Top             =   480
         Width           =   2295
      End
   End
End
Attribute VB_Name = "frmJinhuoAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdRecordChange_Click()
frmCHJinHuo.Show
End Sub

Private Sub Command1_Click()
Dim sqljh As String
Dim i As Integer
For i = 1 To 3
    If Textjh(i).Text = "" Then
       ' Textjh(i).SetFocus
        MsgBox "数据输入不完整,请补充完整", vbExclamation, "系统提示"
        Exit Sub
    End If
Next
If Trim(Textjh(0).Text) <> "" Then
 sqljh = "Select * from 进货表 where 进货编号='" & Trim(Textjh(0).Text) & "'"
 Dim rs As ADODB.Recordset
 Set rs = ExeSQL(sqljh)
 If Not rs.EOF Then
     MsgBox "进货编号" & Me.Textjh(0).Text & "已经存在请查证", vbInformation, "系统提示"
 Else
        If Textjh(4).Text <> "" Then
        sqljh = "insert into 进货表(进货编号,商品编号,结账方式,单价,数量,总额,日期,备注) "
        sqljh = sqljh & "values('" & Trim(Textjh(0).Text) & "','" & spid(Combo2.Text) & "','现金'," & Val(Trim(Textjh(1).Text)) & "," & Val(Trim(Textjh(2).Text)) & "," & Val(Trim(Textjh(3).Text)) & ",'" & DTPickerjh.Value & "','" & Trim(Textjh(4).Text) & "')"
        Else
        sqljh = "insert into 进货表(进货编号,商品编号,结账方式,单价,数量,总额,日期) "
        sqljh = sqljh & "values('" & Trim(Textjh(0).Text) & "','" & spid(Combo2.Text) & "','现金'," & Val(Trim(Textjh(1).Text)) & "," & Val(Trim(Textjh(2).Text)) & "," & Val(Trim(Textjh(3).Text)) & ",'" & DTPickerjh.Value & "')"
        End If
        ExeSQL (sqljh)
        Call addkc '同步更新库存
        MsgBox "进货资料输入成功", vbInformation, "系统提示"
 End If
 rs.Close
 Set rs = Nothing
Else
    MsgBox "进货编号不能为空", vbInformation, "系统提示"
End If

End Sub
Public Sub addkc() '添加进货信息到库存中
Dim rskc As ADODB.Recordset
Dim sqlkc As String
Dim sqlinkc As String
Dim spbianhao As String
spbianhao = spid(Trim(Combo2.Text))
sqlkc = "select * from 库存表 where 商品编号='" & spbianhao & "'"
Set rskc = ExeSQL(sqlkc)
If rskc.EOF Then
    sqlinkc = "insert into 库存表(商品编号,商品名称,数量) values('" & spbianhao & "','" & Trim(Combo2.Text) & "'," & Val(Trim(Textjh(2).Text)) & ")"
    ExeSQL (sqlinkc)
Else
    rskc.Fields("数量") = Val(rskc.Fields("数量")) + Val(Trim(Textjh(2).Text))
    rskc.Update
    rskc.Close
    Set rskc = Nothing
End If
End Sub
Private Sub loadSP(combo As ComboBox) '加载商品名称的过程
On Error GoTo ErrorHandler
Dim rssp As ADODB.Recordset
Dim sqlsp As String
sqlsp = "select 商品名称 from 商品表"
Set rssp = ExeSQL(sqlsp)
combo.Clear
Do While Not rssp.EOF
    combo.AddItem (rssp.Fields(0))
    rssp.MoveNext
Loop
combo.ListIndex = 0
rssp.Close
Set rssp = Nothing
Exit Sub
ErrorHandler:
MsgBox "错误号:" & Err.Number & vbCrLf & "错误内容:系统基本信息设置不完整,请添加商品名称", vbExclamation + vbOKOnly, "其他错误!"

End Sub



Private Sub Form_Load()
Call loadSP(Me.Combo2)
Me.DTPickerjh.Value = Now()
End Sub

Private Sub Textjh_Change(Index As Integer) '自动计算总额
If Index = 1 Or Index = 2 Then
Textjh(3).Text = Val(Textjh(1).Text) * Val(Textjh(2).Text)
End If
End Sub

⌨️ 快捷键说明

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