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

📄 frmclothsuppliers.frm

📁 企业ERP系统 采用VB+SQL2000实现。 有客户合约
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Top             =   240
            Width           =   14775
            _ExtentX        =   26061
            _ExtentY        =   14314
            _Version        =   393216
            AllowUserResizing=   1
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            _NumberOfBands  =   1
            _Band(0).Cols   =   2
         End
      End
   End
End
Attribute VB_Name = "frmBasicFabricSuppliers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim lngrow As Integer
Public newItem As Boolean
Private Sub ActiveBar21_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
    Select Case Tool.Name
    Case "cmdAdd":
        NewOperatorInf
    Case "cmdEdit":
        EditOperatorInf
    Case "cmdDel":
        DelOperatorInf
    Case "cmdFind"
        fraFind.Visible = True
    Case "cmdCancel":
        Unload Me
    Case "cmdRecycle":
        frmUnSupplier.Show
    Case "cmdExport":
        Dim strFile As String
        frmMain.CDFile.ShowOpen
        strFile = frmMain.CDFile.FileName
        If strFile = "" Then Exit Sub
        ExportExcel MSHF1, strFile
    End Select
    
End Sub
Private Function FormatQuery() As String
    FormatQuery = "select * from tBasicFabricSuppliers"
    If Trim$(txtSupplierCode.Text) = "" Then
        FormatQuery = FormatQuery & " where SupplierCode<>''"
    Else
        FormatQuery = FormatQuery & " where SupplierCode='" & txtSupplierCode.Text & "'"
    End If
     If Trim$(txtProductCode) <> "" Then
        FormatQuery = FormatQuery & " and Address='" & Trim(txtProductCode.Text) & "'"
    End If
    If Trim$(txtSupplier) <> "" Then
        FormatQuery = FormatQuery & " and Supplier" & objDatabase.FormatLikeSQL(txtSupplier.Text)
    End If
    If Trim$(txtyarnCount) <> "" Then
        FormatQuery = FormatQuery & " and yarncount" & objDatabase.FormatLikeSQL(txtyarnCount.Text)
    End If
    If Trim$(txtConstruction) <> "" Then
        FormatQuery = FormatQuery & " and Construction" & objDatabase.FormatLikeSQL(txtConstruction.Text)
    End If
    If Trim$(chkWidth) <> "" Then
        FormatQuery = FormatQuery & " and width" & objDatabase.FormatLikeSQL(chkWidth.Text)
    End If
    If Trim$(txtPrice) <> "" Then
        FormatQuery = FormatQuery & " and Price" & objDatabase.FormatLikeSQL(txtPrice.Text)
    End If
    If Trim$(txtOrigin) <> "" Then
        FormatQuery = FormatQuery & " and Origin" & objDatabase.FormatLikeSQL(txtOrigin.Text)
    End If
    If Trim$(txtGreigeStock) <> "" Then
        FormatQuery = FormatQuery & " and GreigeStock" & objDatabase.FormatLikeSQL(txtGreigeStock.Text)
    End If
    If Trim$(txtRemark1) <> "" Then
        FormatQuery = FormatQuery & " and Remark1" & objDatabase.FormatLikeSQL(txtRemark1.Text)
    End If
    If Trim$(txtRemark2) <> "" Then
        FormatQuery = FormatQuery & " and Remark2" & objDatabase.FormatLikeSQL(txtRemark2.Text)
    End If
    If chkFoundDate.Value = vbChecked Then
          FormatQuery = FormatQuery & " and UpdateDate >= '" & DTFoundDate.Value & "'"
          FormatQuery = FormatQuery & " and UpdateDate <='" & DTFoundDateEnd.Value & "'"
    End If
End Function
Public Sub FillMshf1(ByVal strSql As String)
   Dim rs As ADODB.Recordset
   Dim lngrow As Long
      Screen.MousePointer = vbHourglass
      On Error GoTo errLabel
      Set rs = New ADODB.Recordset
      With rs
        .CursorLocation = adUseClient
        .CursorType = adOpenDynamic
        .LockType = adLockOptimistic
        Set .ActiveConnection = Cn
      End With
      rs.Open strSql
      With MSHF1
          .Redraw = False
          .Rows = 2
          .Cols = 15
          .Clear
          '初始化
         .WordWrap = False
         .TextMatrix(0, 0) = "序号"
         .TextMatrix(0, 1) = ""
         .TextMatrix(0, 2) = "產品編號"
         .ColWidth(2) = 1500
         .TextMatrix(0, 3) = "供應商簡稱"
         .ColWidth(3) = 1500
         .TextMatrix(0, 4) = "供應商編號"
         .ColWidth(4) = 1200
         .TextMatrix(0, 5) = "組織"
         .ColWidth(5) = 1500
         .TextMatrix(0, 6) = "碼數"
         .ColWidth(6) = 1500
         .TextMatrix(0, 7) = "幅寬"
         .ColWidth(7) = 1500
         .TextMatrix(0, 8) = "價格"
         .ColWidth(8) = 1500
         .TextMatrix(0, 9) = "原產地"
         .ColWidth(9) = 2000
         .TextMatrix(0, 10) = "庫存數"
         .ColWidth(10) = 1500
         .TextMatrix(0, 11) = "備注1"
         .ColWidth(11) = 2500
         .TextMatrix(0, 12) = "備註2"
         .ColWidth(12) = 2500
         .TextMatrix(0, 13) = "填寫人"
         .ColWidth(13) = 1500
         .TextMatrix(0, 14) = "填入日期"
         .ColWidth(14) = 1500
         .ColWidth(0) = 600
         .ColWidth(1) = 0
         '.....................................................
         .Rows = rs.RecordCount + 2
         On Error Resume Next
         For lngrow = 2 To rs.RecordCount + 1
                .TextMatrix(lngrow, 0) = lngrow - 1
                .TextMatrix(lngrow, 1) = NullValue(rs.Fields!ID)
                .TextMatrix(lngrow, 2) = Trim$(NullValue(rs.Fields!productCode))
                .TextMatrix(lngrow, 3) = Trim$(NullValue(rs.Fields!Supplier))
                .TextMatrix(lngrow, 4) = Trim$(NullValue(rs.Fields!SupplierCode))
                .TextMatrix(lngrow, 5) = Trim$(NullValue(rs.Fields!Construction))
                .TextMatrix(lngrow, 6) = Trim$(NullValue(rs.Fields!YarnCount))
                .TextMatrix(lngrow, 7) = Trim$(NullValue(rs.Fields!Width))
                .TextMatrix(lngrow, 8) = Trim$(NullValue(rs.Fields!Price))
                .TextMatrix(lngrow, 9) = Trim$(NullValue(rs.Fields!Origin))
                .TextMatrix(lngrow, 10) = Trim$(NullValue(rs.Fields!GreigeStock))
                .TextMatrix(lngrow, 11) = Trim$(NullValue(rs.Fields!Remark1))
                .TextMatrix(lngrow, 12) = Trim$(NullValue(rs.Fields!Remark2))
                .TextMatrix(lngrow, 13) = Trim$(NullValue(rs.Fields!UpdateOperator))
                .TextMatrix(lngrow, 14) = Trim$(FormatDateStr(rs.Fields!UpdateDate, "long"))
                rs.MoveNext
          Next
          lngrow = 0
          .TextMatrix(1, 0) = "总计"
          .TextMatrix(1, 2) = .Rows - 2
           SetItemBackColor MSHF1
          .Redraw = True
      End With
      rs.Close
remClear:
    Set rs = Nothing
    Screen.MousePointer = vbDefault
    Exit Sub
errLabel:
    On Error Resume Next
    MSHF1.Redraw = True
    GoTo remClear
End Sub

Private Sub cmdCancel_Click()
     fraFind.Visible = False
End Sub

Private Sub GetFabricInfo(FabricNo As String)
        Dim rs As ADODB.Recordset
    On Error GoTo errLabel
    Set rs = New ADODB.Recordset
    With rs
      .CursorLocation = adUseClient
      .CursorType = adOpenDynamic
      .LockType = adLockOptimistic
      Set .ActiveConnection = Cn
    End With
    rs.Open "select FabricCode from tBasicProduct where FabricCode=" & objDatabase.FormatSQL(FabricNo)
        If Not rs.EOF Then
            txtProductCode = NullValue(rs.Fields!FabricCode)
            txtyarnCount = NullValue(rs.Fields!YarnCount)
            txtConstruction = NullValue(rs.Fields!Construstion)
            chkWidth = NullValue(rs.Fields!Width)
        End If
    rs.Close

remClear:
    Set rs = Nothing
    Exit Sub
errLabel:
    objDatabase.DatabaseError
    GoTo remClear
End Sub
Private Sub CmdFabric_Click()
    frmFabricSelect.Show vbModal
    GetFabricInfo frmFabricSelect.FabricCode
End Sub

Private Sub CmdFind_Click()
     FillMshf1 FormatQuery
     fraFind.Visible = False
End Sub

Private Sub cmdFindAll_Click()
   FillMshf1 ("select * from tBasicFabricSuppliers")
   fraFind.Visible = False
End Sub

Private Sub Form_Load()
    '设置窗口大小
    FormInit Me, True
    SetObjectWH Frame1
    SetObjectWH MSHF1
    FillMshf1 ("select * from tBasicFabricSuppliers")
    ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
    InitTitle
    HookWheel Me.hwnd
End Sub
Private Sub InitTitle()
    Label11.Caption = "供應商編號"
    Label16.Caption = "產品編號"
    Label3.item(2).Caption = "供應商簡稱"
    Label2.item(1).Caption = "码数"
    Label17.Caption = "組織"
    Label18.Caption = "幅寬"
    Label19.Caption = "價格"
    Label20.Caption = "原產地"
    Label21.Caption = "存胚數"
    Label22.Caption = "備註1"
    Label23.Caption = "備註2"
    Label4.Caption = "創建日期"
    Label2.item(3).Caption = "至"
    Label12.Caption = "模糊查詢項"
    cmdFindAll.Caption = "全部 &A"
    cmdFind.Caption = "查詢 &F"
    cmdCancel.Caption = "取消 &C"
    Me.Caption = "坯布供應商信息"
End Sub
'增加供应商
Private Sub NewOperatorInf()
    frmBasicFabricSuppliersInfo.newItem = True
    frmBasicFabricSuppliersInfo.InitInfo ""
    frmBasicFabricSuppliersInfo.Show
    ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
End Sub

'编辑供应商
Private Sub EditOperatorInf()
    frmBasicFabricSuppliersInfo.newItem = False
    If lngrow = 1 Then Exit Sub
    frmBasicFabricSuppliersInfo.InitInfo MSHF1.TextMatrix(lngrow, 1)
    frmBasicFabricSuppliersInfo.Show
    ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
End Sub

'删除供应商
Private Sub DelOperatorInf()
    Dim strSql As String
    Dim rs As New ADODB.Recordset
    Dim rsobj As New ADODB.Recordset
    If lngrow > MSHF1.Rows - 1 Then Exit Sub
    If lngrow <= 1 Then
        MsgBox "请选中一条要删除的记录!", vbExclamation, "提示"
        Exit Sub
    End If
        On Error GoTo errHandle
    
    If MsgBox("确定要刪除?", vbQuestion + vbYesNo, "询问") = vbNo Then
        Exit Sub
    Else
    
            rs.Open "select * from tUnBasicSupplier", Cn, 1, 3
            rsobj.Open "select * from tBasicFabricSuppliers where id=" & MSHF1.TextMatrix(lngrow, 1), Cn, 1, 3
            rs.AddNew
            rs.Fields!productCode = NullValue(rsobj.Fields!productCode)
            rs.Fields!SupplierCode = NullValue(rsobj.Fields!SupplierCode)
            rs.Fields!Supplier = NullValue(rsobj.Fields!Supplier)
            rs.Fields!YarnCount = NullValue(rsobj.Fields!YarnCount)
            rs.Fields!Construction = NullValue(rsobj.Fields!Construction)
            rs.Fields!Width = NullValue(rsobj.Fields!Width)
            rs.Fields!Price = NullValue(rsobj.Fields!Price)
            rs.Fields!Origin = NullValue(rsobj.Fields!Origin)
            rs.Fields!GreigeStock = NullValue(rsobj.Fields!GreigeStock)
            rs.Fields!Remark1 = NullValue(rsobj.Fields!Remark1)
            rs.Fields!Remark2 = NullValue(rsobj.Fields!Remark2)
            rs.Fields!UpdateOperator = NullValue(rsobj.Fields!UpdateOperator)
            rs.Fields!UpdateDate = NullValue(rsobj.Fields!UpdateDate)
            rs.Update
            rs.Close
            rsobj.Close
            Set rs = Nothing
            Set rsobj = Nothing
        strSql = "delete from  tBasicFabricSuppliers  where id=" & MSHF1.TextMatrix(lngrow, 1)
        objDatabase.ExecCmd strSql
        MsgBox "刪除成功!", vbInformation, "提示"
    End If
    FillMshf1 ("select * from tBasicFabricSuppliers")
    ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
    Exit Sub
errHandle:

   objDatabase.DatabaseError
    
End Sub
Private Sub MSHF1_Click()
    lngrow = Val(MSHF1.row)
    If lngrow = 1 Then
        MSHF1.Sort = 1
    Else
       MSHF1.row = lngrow
        MSHF1.col = 0
        MSHF1.ColSel = MSHF1.Cols - 1
        ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = True
        ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = True
    End If
End Sub

Private Sub MSHF1_DblClick()
   EditOperatorInf
End Sub

⌨️ 快捷键说明

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