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

📄 frmcash.frm

📁 一个关于进销存的源代码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Height          =   345
         Left            =   120
         TabIndex        =   4
         Top             =   930
         Width           =   855
      End
      Begin VB.CommandButton Command2 
         Caption         =   "八五折"
         Height          =   345
         Left            =   120
         TabIndex        =   3
         Top             =   585
         Width           =   855
      End
      Begin VB.CommandButton Command1 
         Caption         =   "八折"
         Height          =   345
         Left            =   120
         TabIndex        =   2
         Top             =   240
         Width           =   855
      End
   End
End
Attribute VB_Name = "frmCash"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Mcash As Integer

Private Sub Combo1_click()
    '客户信息
    Combo2.Clear
    Dim rdst As New ADODB.Recordset
    rdst.Open "select * from customers where 客户卡号='" & Combo1.Text & "'", g_conn
        Do While Not rdst.EOF
            Combo2.AddItem rdst!客户名称, 0
            rdst.MoveNext
        Loop
            Combo2.AddItem "", 0
End Sub

Private Sub Combo2_Click()
    If Combo1.Text <> "" And Combo2.Text <> "" Then
            Dim rdst As New ADODB.Recordset
                rdst.Open "select * from customers where 客户卡号='" & Combo1.Text & "'and 客户名称='" & Combo2.Text & "'", g_conn
                      Text2.Text = rdst!消费金额
    Else
       MsgBox "请选择客户卡号和客户姓名", vbOKOnly
    End If
End Sub

Private Sub Command1_Click()
    Text1.Text = Mcash * 0.8 & "元"
End Sub
Private Sub Command2_Click()
    Text1.Text = Mcash * 0.85 & "元"
End Sub
Private Sub Command3_Click()
    Text1.Text = Mcash * 0.9 & "元"
End Sub
Private Sub Command4_Click()
    Text1.Text = Mcash * 0.95 & "元"
End Sub

Private Sub Command5_Click()
    Text1.Text = Mcash & "元"
End Sub

Private Sub Command6_Click()
    Dim rdst As New ADODB.Recordset
    Dim rdst2 As New ADODB.Recordset
    Dim KCvalue As Double '设置库存量
    Dim Oldcash As Double '原消费金额
    Dim newcash As Double '现消费金额
    Dim ts As String
        If Combo1.Text = "竹研炭坊" Then
                 ts = MsgBox("客户无卡号?积分将加给竹研炭坊?", vbOKCancel)
                         If ts = vbOK Then
                            
                                        '减库存
                                        rdst.Open "select * from temp", g_conn
                                            Do While Not rdst.EOF
                                                rdst2.Open "select * from productsList where 商品代码='" & rdst!商品代码 & "'", g_conn
                                                    KCvalue = Val(rdst2!库存量)
                                                    Set rdst2 = Nothing
                                                rdst2.Open "update productsList set 库存量='" & (KCvalue - Val(rdst!数量)) & "' where 商品代码='" & rdst!商品代码 & "'", g_conn
                                                    KCvalue = 0
                                                    Set rdst2 = Nothing
                                                rdst.MoveNext
                                            Loop
                                            Set rdst = Nothing
                                        '货物售出记录       客户购买物品为buyg
                                        rdst.Open "select * from temp", g_conn
                                            Do While Not rdst.EOF
                                                rdst2.Open "insert into sells values('" & rdst!商品代码 & "','" & rdst!商品名称 & "','" & rdst!单价 & "','" & rdst!数量 & "','" & Combo1.Text & "','" & Combo2.Text & "','" & Date & "')", g_conn
                                                     Set rdst2 = Nothing
                                                rdst.MoveNext
                                            Loop
                                            Set rdst = Nothing
                                        '客户消费记录
                                        rdst.Open "insert into SellsCustomers values('" & Combo1.Text & "','" & Combo2.Text & "','" & Text3.Text & "','" & Date & "')", g_conn
                                            Set rdst = Nothing
                                        '客户积分增加
                                        rdst.Open "select * from customers where 客户卡号='" & Combo1.Text & "'", g_conn
                                              Oldcash = Val(rdst!消费金额)
                                              newcash = Oldcash + Int(Val(Text3.Text))
                                              Set rdst = Nothing
                                        rdst.Open "update customers set 消费金额='" & newcash & "' where 客户卡号='" & Combo1.Text & "'", g_conn
                                              Set rdst = Nothing
                                        '清空temp表
                                        rdst.Open "delete * from temp", g_conn
                                        '刷新
                                        
                                        MsgBox "现金入帐", vbOKOnly
                                        Unload Me
                             Else
                                        MsgBox "重新选择客户"
                                        Exit Sub
                             End If
         Else
                            '减库存
                                        rdst.Open "select * from temp", g_conn
                                            Do While Not rdst.EOF
                                                rdst2.Open "select * from productsList where 商品代码='" & rdst!商品代码 & "'", g_conn
                                                    KCvalue = Val(rdst2!库存量)
                                                    Set rdst2 = Nothing
                                                rdst2.Open "update productsList set 库存量='" & (KCvalue - Val(rdst!数量)) & "' where 商品代码='" & rdst!商品代码 & "'", g_conn
                                                    KCvalue = 0
                                                    Set rdst2 = Nothing
                                                rdst.MoveNext
                                            Loop
                                            Set rdst = Nothing
                                        '货物售出记录       客户购买物品为buyg
                                        rdst.Open "select * from temp", g_conn
                                            Do While Not rdst.EOF
                                                rdst2.Open "insert into sells values('" & rdst!商品代码 & "','" & rdst!商品名称 & "','" & rdst!单价 & "','" & rdst!数量 & "','" & Combo1.Text & "','" & Combo2.Text & "','" & Date & "')", g_conn
                                                     Set rdst2 = Nothing
                                                rdst.MoveNext
                                            Loop
                                            Set rdst = Nothing
                                        '客户消费记录
                                        rdst.Open "insert into SellsCustomers values('" & Combo1.Text & "','" & Combo2.Text & "','" & Text3.Text & "','" & Date & "')", g_conn
                                            Set rdst = Nothing
                                        '客户积分增加
                                        rdst.Open "select * from customers where 客户卡号='" & Combo1.Text & "'", g_conn
                                              Oldcash = Val(rdst!消费金额)
                                              newcash = Oldcash + Int(Val(Text3.Text))
                                              Set rdst = Nothing
                                        rdst.Open "update customers set 消费金额='" & newcash & "' where 客户卡号='" & Combo1.Text & "'", g_conn
                                              Set rdst = Nothing
                                        '清空temp表
                                        rdst.Open "delete * from temp", g_conn
                                        '刷新
                                        
                                        MsgBox "现金入帐", vbOKOnly
                                        Unload Me
        End If
                       
End Sub

Private Sub Command7_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Mcash = 0
    Dim rdst As New ADODB.Recordset
        rdst.Open "select * from temp", g_conn
            Do While Not rdst.EOF
                Mcash = Mcash + Val(rdst!数量) * Val(rdst!单价)
                rdst.MoveNext
            Loop
    Set rdst = Nothing
    
    Text1.Text = Mcash & "元"
   
           Frame5.Visible = True
           Frame6.Visible = False
    

    '客户信息
    rdst.Open "select * from customers order by 客户卡号 desc", g_conn
        Do While Not rdst.EOF
            Combo1.AddItem rdst!客户卡号, 0
            rdst.MoveNext
        Loop
            Combo1.AddItem "竹研炭坊", 0
        Combo1.ListIndex = 0
End Sub

Private Sub List1_Click()
    Debug.Print List1.List(List1.ListIndex)
        Dim fl() As String
        fl = Split(List1.List(List1.ListIndex), " ")
         Debug.Print fl(0)
         Debug.Print fl(1)
         Combo1.Text = fl(0)
         Combo2.Text = fl(1)
End Sub

Private Sub TabStrip1_Click()
    Select Case TabStrip1.SelectedItem.Key
       Case "khxx"
           Frame5.Visible = True
           Frame6.Visible = False
       Case "czkh"
           Frame5.Visible = False
           Frame6.Visible = True
    End Select
End Sub

Private Sub Text1_Change()
   Text3.Text = Text1.Text
End Sub

Private Sub Text4_Change()
    List1.Clear
    Dim rdst As New ADODB.Recordset
    rdst.Open "select * from Customers where 客户卡号 like '%%" & Text4.Text & "%%' or 客户名称 like '%%" & Text4.Text & "%%' or 联系电话 like '%%" & Text4.Text & "%%' order by 客户卡号 asc", g_conn
    Do While Not rdst.EOF
        List1.AddItem rdst!客户卡号 & " " & rdst!客户名称 & " " & rdst!联系电话
        rdst.MoveNext
    Loop
End Sub

⌨️ 快捷键说明

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