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

📄 frmxsthd.frm

📁 制造业产供销与往来系统源码,包括进销存及全部控件!
💻 FRM
📖 第 1 页 / 共 4 页
字号:
   Case FlexXsFhdh
   
         If Flex(FlexXsFhdh).Rows > 1 Then
            Set oXsFhdh = oXsFhdhs(CStr(Flex(FlexXsFhdh).RowData(Flex(FlexXsFhdh).Row)))
            SetValueToControl
         Else
            Set oXsFhdh = Nothing
            Clearcontrol
         End If
   
   Case FlexXsFhd
   
         If Flex(FlexXsFhd).Row <> Flex(FlexXsFhd).Rows - 1 Then
            Set oXsFhd = oXsFhdh.XsFhds(CStr(Flex(FlexXsFhd).RowData(Flex(FlexXsFhd).Row)))
         Else
            Set oXsFhd = Nothing
         End If
   
   End Select
   
Exit Sub
Errorhandle:
   MsgBox Err.Description
End Sub

Private Sub SetValueToControl()
On Error GoTo Errorhandle

   Text(TxtXsFhdhDocno).Text = oXsFhdh.XsFhdhDocno
   Text(TxtXsFhdhDat).Text = gPublicFunction.ConvStringToDate(oXsFhdh.XsFhdhDat)
   Text(TxtXsFhdh_CwqjCode).Text = oXsFhdh.XsFhdh_CwQjCode
   Combo(CBxXsFhdh_KhCode).Text = oXsFhdh.Kh.KhCode
   Combo(CBxXsFhdh_CwBzCode).Text = oXsFhdh.CwBz.CwBzCode
   LoadDataIntoGrid
   
Exit Sub
Errorhandle:
   Err.Raise vbObjectError + 1, , Err.Description
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error GoTo Errorhandle

   Set oXsFhdhs = Nothing
   Set oXsFhdh = Nothing
   Set oXsFhd = Nothing
   
   gPublicFunction.SaveFormSet Me
    
Exit Sub
Errorhandle:
   MsgBox Err.Description
End Sub

Private Sub muEdit_Click(Index As Integer)
   Dim mFrmXsFhdGen As frmXsFhdGen
On Error GoTo Errorhandle

   Select Case muEdit(Index).Tag
   Case "XSFHDGEN"
         If Tlbaction(TlbXsFhd).Tag <> "" Then
            SetValueToObject
            Set mFrmXsFhdGen = New frmXsFhdGen
            Set mFrmXsFhdGen.XsFhdh = oXsFhdh
            mFrmXsFhdGen.Show vbModal
            Set mFrmXsFhdGen = Nothing
            LoadDataIntoGrid
         End If
   End Select

Exit Sub
Errorhandle:
   Set mFrmXsFhdGen = Nothing
   MsgBox Err.Description
End Sub

Private Sub Text_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error GoTo Errorhandle

gPublicFunction.FormKeyDown Me, KeyCode, Shift, Text(Index)

Exit Sub
Errorhandle:
   MsgBox Err.Description
End Sub

Private Sub Text_KeyPress(Index As Integer, KeyAscii As Integer)
On Error GoTo Errorhandle

   gPublicFunction.InputCheck Me, Text(Index), KeyAscii

Exit Sub
Errorhandle:
   MsgBox Err.Description
End Sub

Private Sub SetControlToFlex()
   Dim mCurCol As Integer
   Dim mCurRow As Integer
On Error GoTo Errorhandle
   
   If Tlbaction(TlbXsFhd).Tag = "" Then
      Exit Sub
   End If

   mCurRow = Flex(FlexXsFhd).Row
   mCurCol = Flex(FlexXsFhd).Col
   
   Select Case Flex(FlexXsFhd).ColKey(Flex(FlexXsFhd).Col)
   Case "HWBMCODE"
         If oXsFhd Is Nothing Then
            AddNewRecord
         Else
            oXsFhd.XsFhd_HwBmCode = Trim(Flex(FlexXsFhd).TextMatrix(mCurRow, mCurCol))
            Flex(FlexXsFhd).TextMatrix(mCurRow, Flex(FlexXsFhd).ColIndex("HWBMMC")) = oXsFhd.XsFhd_HwBmMc
            Flex(FlexXsFhd).TextMatrix(mCurRow, Flex(FlexXsFhd).ColIndex("HWDWCODE")) = oXsFhd.XsFhd_HwDwCode
            Flex(FlexXsFhd).TextMatrix(mCurRow, Flex(FlexXsFhd).ColIndex("XsFhD_HWDWCONV")) = oXsFhd.XsFhd_HwDwConv
         End If
   
   Case "HWDWCODE"
         If Not oXsFhd Is Nothing Then
            oXsFhd.XsFhd_HwDwCode = Trim(Flex(FlexXsFhd).TextMatrix(mCurRow, mCurCol))
         End If
         
   Case "XSFHD_HWDWCONV"
         If Not oXsFhd Is Nothing Then
            oXsFhd.XsFhd_HwDwConv = Val(Flex(FlexXsFhd).TextMatrix(mCurRow, mCurCol))
         End If
         
   Case "HWCKMC"
         If Not oXsFhd Is Nothing Then
            oXsFhd.XsFhd_HwCkMc = Trim(Flex(FlexXsFhd).TextMatrix(mCurRow, mCurCol))
         End If
   
   Case "XSFHDQTY"
         If Not oXsFhd Is Nothing Then
            oXsFhd.XsFhdQty = Val(Flex(FlexXsFhd).TextMatrix(Flex(FlexXsFhd).Row, mCurCol))
            Flex(FlexXsFhd).TextMatrix(Flex(FlexXsFhd).Row, Flex(FlexXsFhd).ColIndex("XsFhDAMT")) = oXsFhd.XsFhdAmt
         End If
   
   Case "XSFHDPRICE"
         If Not oXsFhd Is Nothing Then
            oXsFhd.XsFhdPrice = Val(Flex(FlexXsFhd).TextMatrix(Flex(FlexXsFhd).Row, mCurCol))
            Flex(FlexXsFhd).TextMatrix(Flex(FlexXsFhd).Row, Flex(FlexXsFhd).ColIndex("XsFhDAMT")) = oXsFhd.XsFhdAmt
         End If
   
   Case "XSFHDAMT"
         If Not oXsFhd Is Nothing Then
            oXsFhd.XsFhdAmt = Val(Flex(FlexXsFhd).TextMatrix(Flex(FlexXsFhd).Row, mCurCol))
         End If
   
   Case "CWSMCODE"
         If Not oXsFhd Is Nothing Then
            oXsFhd.XsFhd_CwSmCode = Trim(Flex(FlexXsFhd).TextMatrix(Flex(FlexXsFhd).Row, mCurCol))
         End If
   
   Case "XSFHDBZ"
         If Not oXsFhd Is Nothing Then
            oXsFhd.XsFhdBz = Trim(Flex(FlexXsFhd).TextMatrix(Flex(FlexXsFhd).Row, mCurCol))
         End If
   
   End Select
   
   If UCase(Flex(FlexXsFhd).ColKey(Flex(FlexXsFhd).Col)) = "XSFHDQTY" Or UCase(Flex(FlexXsFhd).ColKey(Flex(FlexXsFhd).Col)) = "XSFHDPRICE" Or UCase(Flex(FlexXsFhd).ColKey(Flex(FlexXsFhd).Col)) = "XSFHDAMT" Then
      gPublicFunction.SumFlexQtyAmt Flex(FlexXsFhd), "XsFhDQTY,XsFhDAMT", Text(TxtTotalQty), Text(TxtTotalAmt)
   End If

Exit Sub
Errorhandle:
   Flex(FlexXsFhd).TextMatrix(mCurRow, mCurCol) = mCurColOldValue
   Err.Raise vbObjectError + 1, , Err.Description
End Sub

Private Sub AddNewRecord()
   Dim mCurRow As Integer
On Error GoTo Errorhandle

   mCurRow = Flex(FlexXsFhd).Row

   If Trim(Flex(FlexXsFhd).TextMatrix(mCurRow, Flex(FlexXsFhd).Col)) <> "" Then
      Set oXsFhd = New XsFhd
      Set oXsFhd.XsFhdh = oXsFhdh
      oXsFhd.XsFhd_HwBmCode = Trim(Flex(FlexXsFhd).TextMatrix(mCurRow, Flex(FlexXsFhd).Col))
      Flex(FlexXsFhd).TextMatrix(mCurRow, Flex(FlexXsFhd).ColIndex("HWBMMC")) = oXsFhd.XsFhd_HwBmMc
      Flex(FlexXsFhd).TextMatrix(mCurRow, Flex(FlexXsFhd).ColIndex("HWDWCODE")) = oXsFhd.XsFhd_HwDwCode
      Flex(FlexXsFhd).TextMatrix(mCurRow, Flex(FlexXsFhd).ColIndex("XSFHD_HWDWCONV")) = oXsFhd.XsFhd_HwDwConv
      Flex(FlexXsFhd).TextMatrix(mCurRow, Flex(FlexXsFhd).ColIndex("CWSMCODE")) = oXsFhdh.Kh.Kh_CwSmCode
      oXsFhdh.XsFhds.Add oXsFhd, 0
      Flex(FlexXsFhd).RowData(Flex(FlexXsFhd).Rows - 1) = oXsFhd.XsFhdKey
      Flex(FlexXsFhd).AddItem ""
   End If

Exit Sub
Errorhandle:
   Set oXsFhd = Nothing
   Err.Raise vbObjectError + 1, , Err.Description
End Sub

Private Sub Form_Resize()
On Error GoTo Errorhandle
   gPublicFunction.ResizeForm Me
Exit Sub
Errorhandle:
   MsgBox Err.Description
End Sub

Private Sub Text_LostFocus(Index As Integer)
On Error GoTo Errorhandle

   Select Case Index
   Case TxtXsFhdhDat
         
         If Tlbaction(TlbXsFhd).Tag <> "" And Trim(Text(TxtXsFhdhDat).Text) <> "" Then
            Text(TxtXsFhdhDat).Text = gPublicFunction.SetDateFormat(Text(TxtXsFhdhDat).Text)
            oXsFhdh.XsFhdhDat = gPublicFunction.ConvDateToString(Text(TxtXsFhdhDat).Text)
            Text(TxtXsFhdh_CwqjCode).Text = oXsFhdh.XsFhdh_CwQjCode
         End If
         
   Case TxtXsFhdhDocno
   
           If Tlbaction(TlbXsFhd).Tag = "" Then
               If Trim(Text(Index).Text) = "" Then
                  Exit Sub
               End If
               
               If Not oXsFhdh Is Nothing Then
                  If oXsFhdh.XsFhdhDocno = Text(TxtXsFhdhDocno).Text Then
                     Exit Sub
                  End If
               End If
   
               Set oXsFhdh = New XsFhdh
               If oXsFhdh.Requery(Text(TxtXsFhdhDocno).Text) = 1 Then
                   SetValueToControl
               Else
                   Set oXsFhdh = Nothing
                   Dim vXsFhddocno As String
                   vXsFhddocno = Text(TxtXsFhdhDocno).Text
                   AddRecord "ADD"
                   Text(TxtXsFhdhDocno).Text = vXsFhddocno
               End If
        End If

   End Select

Exit Sub
Errorhandle:
   MsgBox Err.Description
End Sub

Private Sub Tlbaction_ButtonClick(Index As Integer, ByVal Button As MSComctlLib.Button)
    Dim Action, RecordName As String
On Error GoTo Errorhandle

    Action = (Mid(Button.Key, 1, 3))
    RecordName = Button.Key
    
   If Trim(Flex(FlexXsFhd).EditText) <> "" Then
      Flex(FlexXsFhd).TextMatrix(Flex(FlexXsFhd).Row, Flex(FlexXsFhd).Col) = Trim(Flex(FlexXsFhd).EditText)
   End If
   
    Select Case Action
        Case "ADD"
             AddRecord RecordName
        Case "CHG"
             ChgRecord RecordName
        Case "CAN"
             CancelRecord RecordName
        Case "SAV"
             SaveRecord RecordName
        Case "DEL", "DEF"
             DelRecord RecordName
        Case "EXI"
             Unload Me
        Case "FIN"
             ShowBmQuery
        Case Else
            
    End Select
    Exit Sub
Errorhandle:
    MsgBox Err.Description
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
   Dim mButton As Button
On Error GoTo Errorhandle

   Set mButton = gPublicFunction.GetToolBarButton(Me, KeyCode)
   
   If Not mButton Is Nothing Then
      Tlbaction_ButtonClick TlbXsFhd, mButton
   End If
  
Exit Sub
Errorhandle:
   MsgBox Err.Description
End Sub

Private Sub ShowBmQuery()
   Dim mCodeType As String
   Dim mQueryValue As String
On Error GoTo Errorhandle

   If Tlbaction(TlbXsFhd).Tag = "" Then
      Exit Sub
   End If
   
   If Me.ActiveControl Is Nothing Then
      Exit Sub
   End If
   
   
   If Me.ActiveControl Is Flex(FlexXsFhd) Then
      
      Select Case UCase(Flex(FlexXsFhd).ColKey(Flex(FlexXsFhd).Col))
      Case "HWBMCODE", "HWDWCODE", "HWCKMC", "CWSMCODE"
            mCodeType = UCase(Flex(FlexXsFhd).ColKey(Flex(FlexXsFhd).Col))
      End Select
      
      If mCodeType <> "" Then
         mQueryValue = gPublicFunction.GetBmQueryValue(Me, mCodeType)
         If mQueryValue <> "" Then
            Flex(FlexXsFhd).TextMatrix(Flex(FlexXsFhd).Row, Flex(FlexXsFhd).Col) = mQueryValue
            Flex(FlexXsFhd).EditCell
            SetControlToFlex
         End If
      End If
   
   Else
   
      Select Case Mid(UCase(Me.ActiveControl.Tag), 4)
      Case "CWQJCODE", "KHCODE", "CWBZCODE"
            mCodeType = Mid(UCase(Me.ActiveControl.Tag), 4)
      End Select
   
      If mCodeType <> "" Then
         mQueryValue = gPublicFunction.GetBmQueryValue(Me, mCodeType)
         If mQueryValue <> "" Then
            Me.ActiveControl.Text = mQueryValue
         End If
      End If
   
   End If
  
Exit Sub
Errorhandle:
   Err.Raise vbObjectError + 1, , Err.Description
End Sub


⌨️ 快捷键说明

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