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

📄 frmxssod.frm

📁 制造业产供销与往来系统源码,包括进销存及全部控件!
💻 FRM
📖 第 1 页 / 共 4 页
字号:
         End If
      
         If MsgBox("您真的要删除单据当前行吗?", vbYesNo + vbQuestion) = vbYes Then
            oXsSodh.XsSods.Remove CStr(oXsSod.XsSodKey)
            Flex(FlexXsSod).RemoveItem Flex(FlexXsSod).Row
            If Flex(FlexXsSod).Rows = 2 Then
               Set oXsSod = Nothing
               Set oXsSodh = Nothing
               Clearcontrol
               gPublicFunction.SetToolbarStatu Me, Tlbaction(TlbXsSod), "CAN"
            Else
               If Flex(FlexXsSod).Row = Flex(FlexXsSod).Rows - 1 Then
                  Flex(FlexXsSod).Row = Flex(FlexXsSod).Row - 1
               End If
               Set oXsSod = oXsSodh.XsSods(CStr(Flex(FlexXsSod).RowData(Flex(FlexXsSod).Row)))
            End If
         End If
      
   End Select
   
Exit Sub
Errorhandle:
   Err.Raise vbObjectError + 1, , Err.Description
End Sub

Private Sub Flex_RowColChange(Index As Integer)
On Error GoTo Errorhandle
   
   If Flex(FlexXsSod).Row <> Flex(FlexXsSod).Rows - 1 Then
      Set oXsSod = oXsSodh.XsSods(CStr(Flex(FlexXsSod).RowData(Flex(FlexXsSod).Row)))
   Else
      Set oXsSod = Nothing
   End If
   
Exit Sub
Errorhandle:
   MsgBox Err.Description
End Sub

Private Sub SetValueToControl()
On Error GoTo Errorhandle

   Text(TxtXsSodhDocno).Text = oXsSodh.XsSodhDocno
   Text(TxtXsSodhDat).Text = gPublicFunction.ConvStringToDate(oXsSodh.XsSodhDat)
   Combo(CBxXsSodh_KhCode).Text = oXsSodh.Kh.KhCode
   Combo(CBxXsSodh_CwBzCode).Text = oXsSodh.CwBz.CwBzCode
   Combo(CbxXsSodh_SalerCode).Text = oXsSodh.XsSodh_SalerCode
   LoadDataIntoGrid "XsSod"
   
Exit Sub
Errorhandle:
   Err.Raise vbObjectError + 1, , Err.Description
End Sub

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

   Set oXsSodhs = Nothing
   Set oXsSodh = Nothing
   Set oXsSod = Nothing
   
   gPublicFunction.SaveFormSet Me
    
Exit Sub
Errorhandle:
   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(TlbXsSod).Tag = "" Then
      Exit Sub
   End If

   mCurRow = Flex(FlexXsSod).Row
   mCurCol = Flex(FlexXsSod).Col
   
   Select Case Flex(FlexXsSod).ColKey(Flex(FlexXsSod).Col)
   Case "HWBMCODE"
         If oXsSod Is Nothing Then
            AddNewRecord
         Else
            oXsSod.XsSod_HwBmCode = Trim(Flex(FlexXsSod).TextMatrix(mCurRow, mCurCol))
            Flex(FlexXsSod).TextMatrix(mCurRow, Flex(FlexXsSod).ColIndex("HWBMMC")) = oXsSod.XsSod_HwBmMc
            Flex(FlexXsSod).TextMatrix(mCurRow, Flex(FlexXsSod).ColIndex("HWDWCODE")) = oXsSod.XsSod_HwDwCode
            Flex(FlexXsSod).TextMatrix(mCurRow, Flex(FlexXsSod).ColIndex("XSSOD_HWDWCONV")) = oXsSod.XsSod_HwDwConv
         End If
   
   Case "HWDWCODE"
         If Not oXsSod Is Nothing Then
            oXsSod.XsSod_HwDwCode = Trim(Flex(FlexXsSod).TextMatrix(mCurRow, mCurCol))
         End If
         
   Case "XSSOD_HWDWCONV"
         If Not oXsSod Is Nothing Then
            oXsSod.XsSod_HwDwConv = Val(Flex(FlexXsSod).TextMatrix(mCurRow, mCurCol))
         End If
   
   Case "XSSODQTY"
         If Not oXsSod Is Nothing Then
            oXsSod.XsSodQty = Val(Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, mCurCol))
            Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, Flex(FlexXsSod).ColIndex("XSSODAMT")) = oXsSod.XsSodAmt
         End If
   
   Case "XSSODPRICE"
         If Not oXsSod Is Nothing Then
            oXsSod.XsSodPrice = Val(Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, mCurCol))
            Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, Flex(FlexXsSod).ColIndex("XSSODAMT")) = oXsSod.XsSodAmt
         End If
   
   Case "XSSODAMT"
         If Not oXsSod Is Nothing Then
            oXsSod.XsSodAmt = Val(Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, mCurCol))
         End If
  
   Case "CWSMCODE"
         If Not oXsSod Is Nothing Then
            oXsSod.XsSod_CwSmCode = Trim(Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, mCurCol))
         End If
   
   Case "XSSODDDAT"
         If Not oXsSod Is Nothing Then
            Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, mCurCol) = gPublicFunction.SetDateFormat(Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, mCurCol))
            oXsSod.XsSodDDat = Trim(gPublicFunction.ConvDateToString(Trim(Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, mCurCol))))
         End If
   
   Case "XSSODBZ"
         If Not oXsSod Is Nothing Then
            oXsSod.XsSodBz = Trim(Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, mCurCol))
         End If
   
   End Select
   
   If UCase(Flex(FlexXsSod).ColKey(Flex(FlexXsSod).Col)) = "XSSODQTY" Or UCase(Flex(FlexXsSod).ColKey(Flex(FlexXsSod).Col)) = "XSSODPRICE" Or UCase(Flex(FlexXsSod).ColKey(Flex(FlexXsSod).Col)) = "XSSODAMT" Then
      gPublicFunction.SumFlexQtyAmt Flex(FlexXsSod), "XSSODQTY,XSSODAMT", Text(TxtTotalQty), Text(TxtTotalAmt)
   End If

Exit Sub
Errorhandle:
   Flex(FlexXsSod).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(FlexXsSod).Row

   If Trim(Flex(FlexXsSod).TextMatrix(mCurRow, Flex(FlexXsSod).Col)) <> "" Then
      Set oXsSod = New XsSod
      Set oXsSod.XsSodh = oXsSodh
      oXsSod.XsSod_HwBmCode = Trim(Flex(FlexXsSod).TextMatrix(mCurRow, Flex(FlexXsSod).Col))
      Flex(FlexXsSod).TextMatrix(mCurRow, Flex(FlexXsSod).ColIndex("HWBMMC")) = oXsSod.XsSod_HwBmMc
      Flex(FlexXsSod).TextMatrix(mCurRow, Flex(FlexXsSod).ColIndex("HWDWCODE")) = oXsSod.XsSod_HwDwCode
      Flex(FlexXsSod).TextMatrix(mCurRow, Flex(FlexXsSod).ColIndex("XSSOD_HWDWCONV")) = oXsSod.XsSod_HwDwConv
      Flex(FlexXsSod).TextMatrix(mCurRow, Flex(FlexXsSod).ColIndex("CWSMCODE")) = oXsSodh.Kh.Kh_CwSmCode
      oXsSodh.XsSods.Add oXsSod, 0
      Flex(FlexXsSod).RowData(Flex(FlexXsSod).Rows - 1) = oXsSod.XsSodKey
      Flex(FlexXsSod).AddItem ""
   End If

Exit Sub
Errorhandle:
   Set oXsSod = 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 TxtXsSodhDat
         If Tlbaction(TlbXsSod).Tag <> "" And Trim(Text(TxtXsSodhDat).Text) <> "" Then
            Text(TxtXsSodhDat).Text = gPublicFunction.SetDateFormat(Text(TxtXsSodhDat).Text)
            oXsSodh.XsSodhDat = gPublicFunction.ConvDateToString(Text(TxtXsSodhDat).Text)
         End If
         
   Case TxtXsSodhDocno
   
           If Tlbaction(TlbXsSod).Tag = "" Then
               If Trim(Text(Index).Text) = "" Then
                  Exit Sub
               End If
               
               If Not oXsSodh Is Nothing Then
                  If oXsSodh.XsSodhDocno = Text(TxtXsSodhDocno).Text Then
                     Exit Sub
                  End If
               End If
   
               Set oXsSodh = New XsSodh
               If oXsSodh.Requery(Text(TxtXsSodhDocno).Text) = 1 Then
                   SetValueToControl
               Else
                   Set oXsSodh = Nothing
                   Dim vXsSoddocno As String
                   vXsSoddocno = Text(TxtXsSodhDocno).Text
                   AddRecord "ADD"
                   Text(TxtXsSodhDocno).Text = vXsSoddocno
               End If
        End If

   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 TlbXsSod, mButton
   End If
  
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(FlexXsSod).EditText) <> "" Then
      Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, Flex(FlexXsSod).Col) = Trim(Flex(FlexXsSod).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 ShowBmQuery()
   Dim mCodeType As String
   Dim mQueryValue As String
On Error GoTo Errorhandle

   If Tlbaction(TlbXsSod).Tag = "" Then
      Exit Sub
   End If
   
   If Me.ActiveControl Is Nothing Then
      Exit Sub
   End If
   
   
   If Me.ActiveControl Is Flex(FlexXsSod) Then
      
      Select Case UCase(Flex(FlexXsSod).ColKey(Flex(FlexXsSod).Col))
      Case "HWBMCODE", "HWDWCODE", "CWSMCODE"
            mCodeType = UCase(Flex(FlexXsSod).ColKey(Flex(FlexXsSod).Col))
      End Select
      
      If mCodeType <> "" Then
         mQueryValue = gPublicFunction.GetBmQueryValue(Me, mCodeType)
         If mQueryValue <> "" Then
            Flex(FlexXsSod).TextMatrix(Flex(FlexXsSod).Row, Flex(FlexXsSod).Col) = mQueryValue
            Flex(FlexXsSod).EditCell
            SetControlToFlex
         End If
      End If
   
   Else
   
      Select Case Mid(UCase(Me.ActiveControl.Tag), 4)
      Case "KHCODE", "CWBZCODE", "SALERCODE"
            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 + -