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

📄 frmdcailist.frm

📁 餐饮经销系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
        End If
    End If


End Sub

Private Sub cmdJZ_Click()
    Dim i As Integer
    Dim MsgString As String
    Dim Resmsg
    Dim MoneyCount As Double
    
    If Trim(msgList.TextMatrix(1, 1)) <> "" Then
        MsgString = Trim(txtItem(4)) & Trim(txtItem(1)) & "日" & "在" & Trim(txtItem(3)) & "消费:"
        MoneyCount = 0
        For i = 1 To msgList.Rows - 1
            MsgString = MsgString & Trim(msgList.TextMatrix(i, 3)) & Trim(msgList.TextMatrix(i, 5)) & "份" & Trim(msgList.TextMatrix(i, 8)) & "元,"
            MoneyCount = MoneyCount + msgList.TextMatrix(i, 8)
        Next i
        
        MsgString = MsgString & ",一共" & Trim(MoneyCount) & "元。"
        
        
        Resmsg = MsgBox(MsgString, vbOKCancel, "结账信息")
        If Resmsg = vbOK Then
            txtSQL = "select * from outh where outh_no = '" & Trim(txtItem(0)) & "'"
            Set mrc = ExecuteSQL(txtSQL, MsgText)
            
            If Not mrc.EOF Then
                Do While Not mrc.EOF
                    mrc.Fields(13) = "Y"
                    mrc.Update
                    mrc.MoveNext
                Loop
    
                mrc.Close
                
                For i = 1 To msgList.Rows - 1
                    If Trim(msgList.TextMatrix(i, 4)) = "吧台" Then
                        txtSQL = "select update_date,sl,total_je from kucun  where "
                        txtSQL = txtSQL & " wzdm = '" & Trim(msgList.TextMatrix(i, 2)) & "'"
    
                        
                        Set mrc = ExecuteSQL(txtSQL, MsgText)
                        
                        If Not mrc.EOF Then
                            If mrc.Fields(1) >= CDbl(msgList.TextMatrix(i, 5)) Then
                                mrc.Fields(0) = txtItem(1)
                                mrc.Fields(1) = mrc.Fields(1) - msgList.TextMatrix(i, 5)
                                mrc.Fields(2) = mrc.Fields(2) * (mrc.Fields(1)) / (mrc.Fields(1) + msgList.TextMatrix(i, 5))
                                mrc.Update
                                mrc.Close
                            End If
                        End If
                    End If
                Next i

                
                                
                MsgBox Trim(txtItem(1)) & Trim(txtItem(3)) & Trim(txtItem(4)) & "结算完毕!", vbOKOnly, "结账信息"
                Unload Me
                
                txtSQL = "select * into newouth1 from outh where outh.bz1 is null or outh.bz1 = 'N'"
                Set mrc = ExecuteSQL(txtSQL, MsgText)
            
                Unload frmDCAI
                frmDCAI.txtSQL = "select distinct dm_room.dm,dm_room.mc,dm_room.bmmc,dm_room.lbmc,dm_room.r_sl,newouth1.khmc,newouth1.lxdh from dm_room left join newouth1 on dm_room.dm = newouth1.roomdm where dm_room.dm <> 'b' and dm_room.dm <> 'l'"
                'frmDCAI.txtSQL = "select distinct dm_room.dm,dm_room.mc,dm_room.bmmc,dm_room.lbmc,dm_room.r_sl,outh.khmc,outh.lxdh from dm_room left join outh on dm_room.dm = outh.roomdm where dm_room.dm <> 'b' and dm_room.dm <> 'l'"
        
                frmDCAI.Show 0

            End If
        ElseIf Resmsg = vbCancel Then
            Unload Me
        End If
    Else
        MsgBox "请点菜!", vbOKOnly + vbExclamation, "警告"
        cmdAdd.SetFocus
        Exit Sub
    End If

End Sub

Private Sub cmdModify_Click()
    Dim intCount As Integer
    
    If msgList.Rows > 1 Then
        gintPLmode = 2
        intCount = msgList.Row
        If intCount > 0 Then
             frmDCAILIST1.txtSQL = "select dm_wz.dm,dm_wz.mc,outh.ckdm,outh.out_danj,outh.sl,outh.o_zke from outh inner join  dm_wz on outh.wzdm = dm_wz.dm  where outh.outh_no ='" & Trim(msgList.TextMatrix(intCount, 1)) & "' and outh.wzdm = '" & Trim(msgList.TextMatrix(intCount, 2)) & "'"
           
                frmDCAILIST1.txtM_NO = Trim(txtItem(0))
                frmDCAILIST1.txtM_DATE = Trim(txtItem(1))
                frmDCAILIST1.txtROOM = Trim(txtItem(2))
                frmDCAILIST1.txtKHMC = Trim(txtItem(4))
                frmDCAILIST1.txtLXDH = Trim(txtItem(5))
                frmDCAILIST1.txtREB = Trim(txtItem(6))
                frmDCAILIST1.txtCKDM = Trim(msgList.TextMatrix(msgList.Row, 4))
                frmDCAILIST1.txtYWDM = Trim(Combo1(0).ItemData(Combo1(0).ListIndex))
                gintPLmode = 2
                frmDCAILIST1.Show 1
           
        Else
            MsgBox "警告", vbOKOnly + vbExclamation, "请首先选择需要修改的纪录!"
        End If
    End If

End Sub

Private Sub cmdOK_Click()
    Dim i As Integer
    
    Unload Me
    Unload frmDCAI
    txtSQL = "select * into newouth1 from outh where outh.bz1 is null or outh.bz1 = 'N'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    
    frmDCAI.txtSQL = "select distinct dm_room.dm,dm_room.mc,dm_room.bmmc,dm_room.lbmc,dm_room.r_sl,newouth1.khmc,newouth1.lxdh from dm_room left join newouth1 on dm_room.dm = newouth1.roomdm where dm_room.dm <> 'b' and dm_room.dm <> 'l'"
    'frmDCAI.txtSQL = "select distinct dm_room.dm,dm_room.mc,dm_room.bmmc,dm_room.lbmc,dm_room.r_sl,outh.khmc,outh.lxdh from dm_room left join outh on dm_room.dm = outh.roomdm where dm_room.dm <> 'b' and dm_room.dm <> 'l'"

    frmDCAI.Show 0
    
End Sub

Private Sub Combo1_Click(Index As Integer)
    
    If Index = 1 Then
        If gintPLLISTmode = 1 Then
            txtSQL = "select mc,ywman,lbdm,mb_reb from dm_kh where dm = '" & Trim(Combo1(1)) & "'"
            Set mrc = ExecuteSQL(txtSQL, MsgText)
            If mrc.EOF = False Then
                txtItem(2) = mrc.Fields(0)
                txtItem(3) = mrc.Fields(1)
                txtItem(4) = mrc.Fields(2)
                txtItem(5) = mrc.Fields(3)
    
            End If
            mrc.Close
        End If
    ElseIf Index = 2 Then
        If Combo1(2).ListIndex = 0 Or Combo1(2).ListIndex = 1 Then
            txtItem(6).Visible = False
            Label2(13).Visible = False
        Else
            txtItem(6).Visible = True
            Label2(13).Visible = True

        End If
    End If
        
End Sub

Private Sub Form_Load()
    Dim i As Integer

    If gintPLLISTmode = 1 Then
        ShowTitle
        
        txtItem(0) = GetRkno()
        
        txtSQL = "select dm,mc from dm_ywy"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        If mrc.EOF = False Then
            Do While Not mrc.EOF
                Combo1(0).AddItem mrc.Fields(1)
                Combo1(0).ItemData(Combo1(0).NewIndex) = mrc.Fields(0)
                mrc.MoveNext
            Loop
        End If
        mrc.Close
        
        
    ElseIf gintPLLISTmode = 2 Then
        ShowTitle
        ShowData
        
        For i = 0 To 6
            txtItem(i).Locked = True
        Next i
        
        txtSQL = "select outh.outh_no,outh.out_date,dm_ywy.mc,dm_room.dm,dm_room.mc,outh.khmc,outh.lxdh,outh.o_zk from outh inner join dm_ywy on outh.ywman = dm_ywy.dm inner join dm_room on outh.roomdm = dm_room.dm  where outh.outh_no = '" & Trim(msgList.TextMatrix(1, 1)) & "'"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        
        If Not mrc.EOF Then
            txtItem(0) = mrc.Fields(0)
            txtItem(1) = mrc.Fields(1)
            
            Combo1(0).AddItem mrc.Fields(2)
            Combo1(0).ListIndex = 0
            
            txtItem(2) = mrc.Fields(3)
            txtItem(3) = mrc.Fields(4)

            
            For i = 4 To 6
                txtItem(i) = mrc.Fields(i + 1)
            Next i
            
            mrc.Close
        End If
    ElseIf gintPLLISTmode = 3 Then
        ShowTitle
        ShowData
        
        For i = 0 To 6
            txtItem(i).Locked = True
        Next i
        
        cmdJZ.Visible = True
        cmdOK.Enabled = False
        cmdCANCEL.Enabled = False
        cmdAdd.Enabled = False
        cmdModify.Enabled = False
        cmdDelete.Enabled = False
        
        txtSQL = "select outh.outh_no,outh.out_date,dm_ywy.mc,dm_room.dm,dm_room.mc,outh.khmc,outh.lxdh,outh.o_zk from outh inner join dm_ywy on outh.ywman = dm_ywy.dm inner join dm_room on outh.roomdm = dm_room.dm  where outh.outh_no = '" & Trim(msgList.TextMatrix(1, 1)) & "'"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        
        If Not mrc.EOF Then
            txtItem(0) = mrc.Fields(0)
            txtItem(1) = mrc.Fields(1)
            
            Combo1(0).AddItem mrc.Fields(2)
            Combo1(0).ListIndex = 0
            
            txtItem(2) = mrc.Fields(3)
            txtItem(3) = mrc.Fields(4)

            
            For i = 4 To 6
                txtItem(i) = mrc.Fields(i + 1)
            Next i
            
            mrc.Close
        End If
    End If
    
    txtItem(1) = Format(Now, "yyyy-mm-dd")
    
End Sub

Private Sub Form_Resize()
    If Me.WindowState <> vbMinimized And fMainForm.WindowState <> vbMinimized Then
        '边界处理
        If Me.ScaleHeight < 10 * lblTitle.Height Then
            
            Exit Sub
        End If
        If Me.ScaleWidth < lblTitle.Width + lblTitle.Width / 2 Then
            
            Exit Sub
        End If
        '控制控件的位置
                
        lblTitle.Top = lblTitle.Height
        lblTitle.Left = (Me.Width - lblTitle.Width) / 2
        
        Frame1(0).Left = (Me.Width - Frame1(0).Width) / 2
        
        Frame1(1).Top = 1920
        Frame1(1).Width = Me.ScaleWidth - 200
        Frame1(1).Left = Me.ScaleLeft + 100
        Frame1(1).Height = Me.ScaleHeight - 3500
        
        msgList.Top = 240
        msgList.Width = Me.ScaleWidth - 500
        msgList.Left = Frame1(1).Left + 10
        msgList.Height = Me.ScaleHeight - 4000
        
        
        Frame2.Top = Frame1(1).Top + Frame1(1).Height + 50
        Frame2.Left = Me.ScaleWidth / 2 - 3000
    End If
End Sub



Public Sub FormClose()
    Unload Me
End Sub
Public Sub ShowData()
    
    Dim j As Integer
    Dim i As Integer
    Dim MsgText As String

  
    Set mrc = ExecuteSQL(txtSQL, MsgText)
        With msgList
        .Rows = 1
        
        Do While Not mrc.EOF
            .Rows = .Rows + 1
            For i = 1 To mrc.Fields.Count
                If Not IsNull(Trim(mrc.Fields(i - 1))) Then
                Select Case mrc.Fields(i - 1).Type
                    Case adDBDate
                        .TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
                    Case Else
                        .TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
                End Select
                End If
            Next i
            mrc.MoveNext
        Loop
        
          
    End With
    mrc.Close
    
    
End Sub


'显示Grid表头
Private Sub ShowTitle()
    Dim i As Integer
    
    With msgList
        .Cols = 9
        .TextMatrix(0, 1) = "点菜单编号"
        .TextMatrix(0, 2) = "酒菜编号"
        .TextMatrix(0, 3) = "酒菜名称"
        .TextMatrix(0, 4) = "出品地点"
        .TextMatrix(0, 5) = "数    量"
        .TextMatrix(0, 6) = "单    价"
        .TextMatrix(0, 7) = "折扣比例"
        .TextMatrix(0, 8) = "总 金 额"
        
       
        
        '固定表头
        .FixedRows = 1
                
        '设置各列的对齐方式
        For i = 0 To 8
            .ColAlignment(i) = 0
        Next i
        
        
        '表头项居中
        .FillStyle = flexFillRepeat
        .Col = 0
        .Row = 0
        .RowSel = 1
        .ColSel = .Cols - 1
        .CellAlignment = 4
        
        '设置单元大小
        .ColWidth(0) = 1000
        .ColWidth(1) = 1000
        .ColWidth(2) = 2000
        .ColWidth(3) = 1000
        .ColWidth(4) = 1000
        .ColWidth(5) = 1000
        .ColWidth(6) = 1000
        .ColWidth(7) = 1000
        .ColWidth(8) = 1000
        .Row = 1
        
    End With
End Sub




Private Sub msgList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    '右键弹出
    If Button = 2 And Shift = 0 Then
       
    End If
    
End Sub



⌨️ 快捷键说明

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