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

📄 frmqsale.frm

📁 超市的管理系统
💻 FRM
📖 第 1 页 / 共 3 页
字号:
                        intindex = intindex + 1
                        
                        rct1.MoveNext
                        
                    Else
            
                        rct1.MoveNext
                
                    End If
                        
                Case "500--999.99"
                
                    If rct1.Fields.Item(2).Value >= 500 And rct1.Fields.Item(2).Value <= 999.99 Then
                    
                        ReDim Preserve temp(intindex)
            
                        temp(intindex) = rct1.Fields.Item(0).Value
                        
                        ReDim Preserve total(intindex)
                    
                        total(intindex) = Val(rct1.Fields.Item(2).Value)
                        
                        ReDim Preserve DT(intindex)
                    
                        DT(intindex) = rct1.Fields.Item(1).Value
                        
                        intindex = intindex + 1
                        
                        rct1.MoveNext
                        
                    Else
            
                        rct1.MoveNext
                
                    End If
                        
                Case ">1000"
                
                    If rct1.Fields.Item(2).Value >= 1000 Then
                    
                        ReDim Preserve temp(intindex)
            
                        temp(intindex) = rct1.Fields.Item(0).Value
                        
                        ReDim Preserve total(intindex)
                    
                        total(intindex) = Val(rct1.Fields.Item(2).Value)
                        
                        ReDim Preserve DT(intindex)
                    
                        DT(intindex) = rct1.Fields.Item(1).Value
                        
                        intindex = intindex + 1
                        
                        rct1.MoveNext
                        
                    Else
            
                        rct1.MoveNext
                
                    End If
                    
                End Select
                    
            Loop
        
                If intindex = 0 Then
            
                    MsgBox "无符合查询条件的销售记录表,请重新查询!", vbInformation + vbOKOnly, "查询提示!"
                    
                    Call CmdINT_Click
                    
                    Exit Sub
                    
                Else
                
                    MsgBox "共有" & intindex & "张符合查询条件的销售记录表!", vbInformation + vbOKOnly, "查询提示!"
                
                End If
                
                If intindex = 1 Then
                
                        If viewRS(temp(0), total(0), DT(0)) = True Then
                   
                    End If
                   
                Else
                
                    HSC1.Enabled = True
                
                    HSC1.Min = 0
                    
                    HSC1.Max = intindex - 1
                        
                    If viewRS(temp(0), total(0), DT(0)) = True Then
                            
                    End If
                        
                End If
        
    ElseIf OpDT.Value = True Then
        
        rct1.MoveFirst
            
        Do While Not rct1.EOF
            
            If rct1.Fields.Item(1).Value >= DTP1.Value And rct1.Fields.Item(1).Value <= DTP2.Value Then
            
                ReDim Preserve temp(intindex)
            
                temp(intindex) = rct1.Fields.Item(0).Value
                
                ReDim Preserve total(intindex)
            
                total(intindex) = Val(rct1.Fields.Item(2).Value)
                
                ReDim Preserve DT(intindex)
            
                DT(intindex) = rct1.Fields.Item(1).Value
                
                intindex = intindex + 1
                
                rct1.MoveNext
                
            Else
            
                rct1.MoveNext
                
            End If
            
        Loop
        
            If intindex = 0 Then
        
                MsgBox "无符合查询条件的销售记录表,请重新查询!", vbInformation + vbOKOnly, "查询提示!"
                
                Call CmdINT_Click
                
                Exit Sub
                
            Else
            
                MsgBox "共有" & intindex & "张符合查询条件的销售记录表!", vbInformation + vbOKOnly, "查询提示!"
            
            End If
            
            If intindex = 1 Then
            
                    If viewRS(temp(0), total(0), DT(0)) = True Then
               
                End If
               
            Else
            
                HSC1.Enabled = True
            
                HSC1.Min = 0
                
                HSC1.Max = intindex - 1
                    
                If viewRS(temp(0), total(0), DT(0)) = True Then
                        
                End If
                    
            End If
        
    End If
    
    
    
    CmdModify.Enabled = True
    
    CmdAdd.Enabled = True
    
    Dim str3 As String
    
    str3 = "select * from employee "
    
    Set rct3 = QueryXFInfo(str3)
    
    rct3.MoveFirst
    
    Do While Not rct3.EOF                                                               '判断用户的权限

        If Trim(rct3.Fields.Item(1).Value) = strName Then
        
            If rct3.Fields.Item(3).Value = "User" Then                                  '普通用户不能使用修改和删除按钮
            
                CmdClear.Enabled = False
                
                CmdDel.Enabled = False
                
                Exit Do
                
            Else
            
                CmdClear.Enabled = True
        
                CmdDel.Enabled = True
            
                Exit Do
                
            End If
            
        Else
        
            rct3.MoveNext
            
        End If
        
    Loop
    
    rct.MoveFirst
    
    rct1.MoveFirst
    
    CmdQuery.Enabled = False
    
    sum = Val(total(HSC1.Value))
        
End Sub

Private Sub Form_Load()

    Dim str As String
    
    str = "select * from sales"
    
    Set rct = QueryXFInfo(str)                                      '执行查询功能,并将结果导入相应记录集
    
    Dim str1 As String
    
    str1 = "select * from salesinvoice"
    
    Set rct1 = QueryXFInfo(str1)
    
    Dim str2 As String
    
    str2 = "select * from storage"
    
    Set rct2 = QueryXFInfo(str2)
    
    Combo2.Text = Combo2.List(0)
    
    OpNUM.Value = True
    
    HSC1.Enabled = False
    
    DTP1.Value = Date
    
    DTP2.Value = Date
    
    CmdClear.Enabled = False
    
    CmdDel.Enabled = False
    
    CmdModify.Enabled = False
    
    CmdAdd.Enabled = False
    
    Call flexView

End Sub

Private Sub HSC1_Change()

    MSFlexGrid1.Clear
    
    Dim X As Integer

    Dim Y As Integer

    Y = 1

    X = MSFlexGrid1.Rows - 1

    For Y = X To 2 Step -1

        MSFlexGrid1.RemoveItem (Y)

    Next Y

    Call flexView
    
    If viewRS(temp(HSC1.Value), total(HSC1.Value), DT(HSC1.Value)) Then         '水平滚动条动作时,表格中将显示相应记录
    
    End If
    
    sum = total(HSC1.Value)
    
    rct.MoveFirst
    
    rct1.MoveFirst
    

End Sub




Private Sub OpID_Click()

    TxtID.SetFocus

End Sub

'声明查询函数

Public Function viewRS(ByVal str As String, ByVal str1 As Single, ByVal str2 As String) As Boolean

    Dim n As Integer
    
    Dim id As Integer                                       '声明表格序号变量

    rct.MoveFirst

    Do While Not rct.EOF
    
        If rct.Fields.Item(6).Value = str Then              '根据条件找到合适记录,并将它在表格中显示出来
        
            n = n + 1
                        
            MSFlexGrid1.Row = MSFlexGrid1.Rows - 1
            
            For id = 0 To 6

                MSFlexGrid1.Col = id

                MSFlexGrid1.CellAlignment = 4

            Next id
            
            MSFlexGrid1.Col = 0
        
            MSFlexGrid1.Text = n
        
            MSFlexGrid1.Col = 1
                
            MSFlexGrid1.Text = rct.Fields.Item(1).Value
                
            MSFlexGrid1.Col = 2
            
            rct2.MoveFirst
            
            Do While Not rct2.EOF
            
                If rct2.Fields.Item(0).Value = rct.Fields.Item(1).Value Then        '根据库存表的编号找到其商品名称
                
                    MSFlexGrid1.Text = rct2.Fields.Item(1).Value
                    
                    Exit Do
                    
                Else
                
                    rct2.MoveNext
                    
                End If
                
            Loop
                
            MSFlexGrid1.Col = 3
            
            If Val(rct.Fields.Item(2).Value) < 1 Then                               '如果数字类型常量的值小于1,在小数点前补0
            
                MSFlexGrid1.Text = "0" & rct.Fields.Item(2).Value
                
            Else
            
                MSFlexGrid1.Text = rct.Fields.Item(2).Value
                
            End If
        
            MSFlexGrid1.Col = 4
            
            If Val(rct.Fields.Item(3).Value) < 1 Then
            
                MSFlexGrid1.Text = "0" & rct.Fields.Item(3).Value
                
            Else
            
                MSFlexGrid1.Text = rct.Fields.Item(3).Value
                
            End If
                
            MSFlexGrid1.Col = 5
            
            If Val(rct.Fields.Item(4).Value) < 1 Then
            
                MSFlexGrid1.Text = "0" & rct.Fields.Item(4).Value
                
            Else
            
                MSFlexGrid1.Text = rct.Fields.Item(4).Value
                
            End If
            
            MSFlexGrid1.Col = 6
            
            MSFlexGrid1.Text = rct.Fields.Item(0).Value
            
            MSFlexGrid1.AddItem (Empty)
            
            rct.MoveNext
            
        Else
        
            rct.MoveNext
            
        End If
        
    Loop
    
    If str <> "" Then
        
        MSFlexGrid1.AddItem (Empty)
            
        MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 0) = " "
        
        MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 1) = " "
        
        MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 2) = " "
        
        MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 3) = " "
        
        MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 4) = " "
        
        MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 5) = " "
        
        MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 6) = " "
        
        MSFlexGrid1.MergeCells = flexMergeFree                                    '合并两行显示日期和总计金额
        
        MSFlexGrid1.MergeRow(MSFlexGrid1.Rows - 1) = True
        
        MSFlexGrid1.Row = MSFlexGrid1.Rows - 1
        
        MSFlexGrid1.RowHeight(MSFlexGrid1.Rows - 1) = 600
         
        MSFlexGrid1.Col = 0
        
        MSFlexGrid1.CellBackColor = QBColor(15)
        
        MSFlexGrid1.CellFontSize = 14
        
        MSFlexGrid1.Text = "销售日期为:" & str2 & "           金额总计为:" & str1 & "元"
        
        TxtID.Text = str
        
        
        
    Else
    
        Exit Function
        
    End If
        
            
    
End Function

Private Sub txtID_LostFocus()

    If IsChar(TxtID.Text) = False Then
    
        MsgBox "输入不合法,请重新输入!", vbInformation + vbOKOnly, "输入提示!"
        
        TxtID.Text = ""
        
        TxtID.SetFocus
        
    End If

End Sub

⌨️ 快捷键说明

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