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

📄 frmbeforemain.frm

📁 企业ERP系统 采用VB+SQL2000实现。 有客户合约
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            _Version        =   393216
            AllowUserResizing=   1
            _NumberOfBands  =   1
            _Band(0).Cols   =   2
         End
      End
   End
End
Attribute VB_Name = "frmBeforeMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim lngrow As Long
Private Sub ActiveBar21_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
     Select Case Tool.Name
        Case "cmdAdd":
            frmBeforeInfo.newItem = True
            frmBeforeInfo.Show vbModal
        Case "cmdDel":
            DelOperatorInf
        Case "cmdCancel":
            Unload Me
        Case "cmdEdit":
            EditOperatorInf
        Case "cmdFind"
            fraFind.Visible = True
        Case "cmdRefurbish":
            FillMshf1 ("select * from tBeforeLabdip left join tBeforeLabdipReference on tBeforeLabdip.Reference=tBeforeLabdipReference.Reference")
        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 Sub cmdCancel_Click()
     fraFind.Visible = False
End Sub

Private Sub CmdCustomer_Click()
    frmCustomerSelect.Show vbModal
    GetCustomerInfo frmCustomerSelect.CustomerNo
End Sub
Private Sub GetCustomerInfo(CustomerNo 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 customerNo,CustomerName from tCustomer where customerno=" & objDatabase.FormatSQL(CustomerNo)
        If Not rs.EOF Then
            txtClientNo.Text = rs.Fields!CustomerNo
            txtClientName.Text = rs.Fields!CustomerName

        End If
    rs.Close

remClear:
    Set rs = Nothing
    Exit Sub
errLabel:
    objDatabase.DatabaseError
    GoTo remClear
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
            txtFabricCode = rs.Fields!FabricCode

        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 tBeforeLabdip left join tBeforeLabdipReference on tBeforeLabdip.Reference=tBeforeLabdipReference.Reference")
   fraFind.Visible = False
End Sub
Private Function FormatQuery() As String
    FormatQuery = "select * from tBeforeLabdip left join tBeforeLabdipReference on tBeforeLabdip.Reference=tBeforeLabdipReference.Reference"
    If Trim$(txtLabdipNo.Text) = "" Then
        FormatQuery = FormatQuery & " where tBeforeLabdip.LabdipNo<>''"
    Else
        FormatQuery = FormatQuery & " where tBeforeLabdip.LabdipNo='" & txtLabdipNo.Text & "'"
    End If
    If Trim$(txtOrderNo) <> "" Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.OrderNo='" & txtOrderNo & "'"
    End If
    If Trim$(txtClientNo) <> "" Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.ClientNo='" & txtClientNo & "'"
    End If
    If Trim$(txtFabricCode) <> "" Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.FabricCode='" & txtFabricCode & "'"
    End If
    If Trim$(txtReference) <> "" Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.Reference='" & txtReference & "'"
    End If
    If Trim$(txtUpdateOperator) <> "" Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.UpdateOperator='" & txtUpdateOperator & "'"
    End If
    If chkdelivery.Value = vbChecked Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.Delivery >= '" & FormatDateStr(Delivery.Value, "long") & "'"
        FormatQuery = FormatQuery & " and tBeforeLabdip.Delivery <= '" & FormatDateStr(EndDelivery.Value, "long") & "'"
    End If
    If chkLateAddDate.Value = vbChecked Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.LateAddDate >= '" & FormatDateStr(LateAddDate.Value, "long") & "'"
        FormatQuery = FormatQuery & " and tBeforeLabdip.LateAddDate <= '" & FormatDateStr(EndLateAddDate.Value, "long") & "'"
    End If
    If Trim$(txtClientName) <> "" Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.ClientName" & objDatabase.FormatLikeSQL(txtClientName)
    End If
    If Trim$(txtProcessing) <> "" Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.Processing" & objDatabase.FormatLikeSQL(txtProcessing)
    End If
    If Trim$(txtFactoryName) <> "" Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.txtFactoryName" & objDatabase.FormatLikeSQL(txtFactoryName)
    End If
    If Trim$(txtDye) <> "" Then
        FormatQuery = FormatQuery & " and tBeforeLabdip.Dye" & objDatabase.FormatLikeSQL(txtDye)
    End If
End Function
Private Sub Form_Load()
'设置窗口大小
    FormInit Me, True
    SetObjectWH Frame1
    SetObjectWH MSHF1
    FillMshf1 ("select * from tBeforeLabdip left join tBeforeLabdipReference on tBeforeLabdip.Reference=tBeforeLabdipReference.Reference")
    ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
    Initcbb txtOrderNo, "OrderNo", "tBeforeLabdip"
    Initcbb txtFactoryName, "FactoryName", "tBeforeLabdip"
    InitTitle
    HookWheel Me.hwnd
End Sub
Private Sub InitTitle()
    Label3.item(4).Caption = "上批單號"
    Label5.Caption = "款號"
    Label11.Caption = "訂單號"
    Label6.Caption = "品種"
    Label3.item(1).Caption = "客戶編號"
    Label7.Caption = "加工廠"
    Label1.Caption = "客戶名稱"
    Label10.Caption = "顏料"
    Label4.Caption = "布號"
    Label8.Caption = "填寫人"
    Label2.Caption = "交貨日期"
    Label13.Caption = "至"
    Label9.Caption = "後加工日期"
    Label14.Caption = "至"
    Label12.Caption = "模糊查詢項"
    cmdFindAll.Caption = "全部 &A"
    cmdFind.Caption = "查詢 &F"
    cmdCancel.Caption = "取消 &C"
    Me.Caption = "預備工序"
End Sub
'編輯工序
Private Sub EditOperatorInf()
    frmBeforeInfo.newItem = False
    If lngrow = 1 Then Exit Sub
    frmBeforeInfo.InitInfo MSHF1.TextMatrix(lngrow, 1)
    frmBeforeInfo.FillMshf1 ("select * from tBeforeLabdipQuality where FabricCode='" & MSHF1.TextMatrix(lngrow, 8) & "'")
    frmBeforeInfo.FillMshf2 ("select * from tBeforeLabdipColor where LabdipNo='" & MSHF1.TextMatrix(lngrow, 1) & "'")
    frmBeforeInfo.FillMshf3 ("select * from tBeforeLabdipColorSub where LabdipNo='" & MSHF1.TextMatrix(lngrow, 1) & "'")
    frmBeforeInfo.FillMshf6 ("select * from tBeforeLabdipLayoutSub where LabdipNo='" & MSHF1.TextMatrix(lngrow, 1) & "'")
    frmBeforeInfo.FillMshf5 ("select * from tBeforeLabdipReference where LabdipNo='" & MSHF1.TextMatrix(lngrow, 1) & "'")
    frmBeforeInfo.newItem = False
    frmBeforeInfo.Show vbModal
    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
    
    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
        strSql = "delete from  tBeforeLabdip  where labdipNo='" & MSHF1.TextMatrix(lngrow, 1) & "'"
        objDatabase.ExecCmd strSql
        strSql = "delete from tBeforeLabdipReference where LabdipNo='" & MSHF1.TextMatrix(lngrow, 1) & "'"
        objDatabase.ExecCmd strSql
        strSql = "delete from tBeforeLabdipColor where LabdipNo='" & MSHF1.TextMatrix(lngrow, 1) & "'"
        objDatabase.ExecCmd strSql
        strSql = "delete from tBeforeLabdipColorSub where LabdipNo='" & MSHF1.TextMatrix(lngrow, 1) & "'"
        objDatabase.ExecCmd strSql
        strSql = "delete from tBeforeLabdipLayoutSub where LabdipNo='" & MSHF1.TextMatrix(lngrow, 1) & "'"
        objDatabase.ExecCmd strSql
        MsgBox "刪除成功!", vbInformation, "提示"
    End If
    FillMshf1 ("select * from tBeforeLabdip left join tBeforeLabdipReference on tBeforeLabdip.Reference=tBeforeLabdipReference.Reference")
    ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
    Exit Sub
errHandle:

   objDatabase.DatabaseError
    
End Sub
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 = 28
          .Clear
          '初始化
         .WordWrap = False
         .TextMatrix(0, 0) = "序號"
         .ColWidth(0) = 600
         .TextMatrix(0, 1) = "上批單號"
         .ColWidth(1) = 1000
         .TextMatrix(0, 2) = "訂單號"
         .ColWidth(2) = 1000
         .TextMatrix(0, 3) = "客戶編號"
         .ColWidth(3) = 1000
         .TextMatrix(0, 4) = "客戶名稱"
         .ColWidth(4) = 2000
         .TextMatrix(0, 5) = "季節"
         .ColWidth(5) = 1000
         .TextMatrix(0, 6) = "交貨期"
         .ColWidth(6) = 1000
         .TextMatrix(0, 7) = "交貨日期"
         .ColWidth(7) = 1000
         .TextMatrix(0, 8) = "布號"
         .ColWidth(8) = 1000
         .TextMatrix(0, 9) = "花型顏色"
         .ColWidth(9) = 1200
         .TextMatrix(0, 10) = ""
         .ColWidth(10) = 0
         .TextMatrix(0, 11) = "款號"
         .ColWidth(11) = 1000
         .TextMatrix(0, 12) = "用途"
         .ColWidth(12) = 1500
         .TextMatrix(0, 13) = "洗水"
         .ColWidth(13) = 1500
         .TextMatrix(0, 14) = "顏料"
         .ColWidth(14) = 1000
         .TextMatrix(0, 15) = "整理"
         .ColWidth(15) = 1500
         .TextMatrix(0, 16) = "品種"
         .ColWidth(16) = 1000
         .TextMatrix(0, 17) = "質量結果"
         .ColWidth(17) = 600
         .TextMatrix(0, 18) = "顏色結果"
         .ColWidth(18) = 600
         .TextMatrix(0, 19) = "花型結果"
         .ColWidth(19) = 600
         .TextMatrix(0, 20) = "加工廠"
         .ColWidth(20) = 1200
         .TextMatrix(0, 21) = "顏色/花型標準"
         .ColWidth(21) = 1500
         .TextMatrix(0, 22) = "後加工日期"
         .ColWidth(22) = 1000
         .TextMatrix(0, 23) = "取消日期"
         .ColWidth(23) = 1000
         .TextMatrix(0, 24) = "價格"
         .ColWidth(24) = 1200
         .TextMatrix(0, 25) = "備註"
         .ColWidth(25) = 2500
         .TextMatrix(0, 26) = "填寫人"
         .ColWidth(26) = 1000
         .TextMatrix(0, 27) = "填寫日期"
         .ColWidth(27) = 1000
         '.....................................................
         .Rows = rs.RecordCount + 2
         On Error Resume Next
         For lngrow = 2 To rs.RecordCount + 1
                .TextMatrix(lngrow, 0) = lngrow - 1
                .TextMatrix(lngrow, 1) = Trim$(NullValue(rs.Fields!LabdipNo))
                .TextMatrix(lngrow, 2) = Trim$(NullValue(rs.Fields!OrderNo))
                .TextMatrix(lngrow, 3) = Trim$(NullValue(rs.Fields!ClientNo))
                .TextMatrix(lngrow, 4) = Trim$(NullValue(rs.Fields!ClientName))
                .TextMatrix(lngrow, 5) = Trim$(NullValue(rs.Fields!Season))
                .TextMatrix(lngrow, 6) = Trim$(NullValue(rs.Fields!SeasonLine))
                .TextMatrix(lngrow, 7) = Trim$(NullValue(rs.Fields!Delivery))
                .TextMatrix(lngrow, 8) = Trim$(NullValue(rs.Fields!FabricCode))
                .TextMatrix(lngrow, 9) = Trim$(NullValue(rs.Fields!Pattern))
               ' .TextMatrix(lngRow, 10) = NullValue(rs.Fields!ePattern)
                .TextMatrix(lngrow, 11) = Trim$(NullValue(rs.Fields("tBeforeLabdip.Reference")))
                .TextMatrix(lngrow, 12) = Trim$(NullValue(rs.Fields!Placement))
                .TextMatrix(lngrow, 13) = Trim$(NullValue(rs.Fields!Washing))
                .TextMatrix(lngrow, 14) = Trim$(NullValue(rs.Fields!Dye))
                .TextMatrix(lngrow, 15) = Trim$(NullValue(rs.Fields!Finish))
                .TextMatrix(lngrow, 16) = Trim$(NullValue(rs.Fields!Processing))
                .TextMatrix(lngrow, 17) = IIf(rs.Fields!Quality, "OK", "NO")
                .TextMatrix(lngrow, 18) = IIf(rs.Fields!Color, "OK", "NO")
                .TextMatrix(lngrow, 19) = IIf(rs.Fields!Layout, "OK", "NO")
                .TextMatrix(lngrow, 20) = Trim$(NullValue(rs.Fields!FactoryName))
                .TextMatrix(lngrow, 21) = Trim$(NullValue(rs.Fields!Standard))
                .TextMatrix(lngrow, 22) = FormatDateStr(rs.Fields!LateAddDate, "long")
                .TextMatrix(lngrow, 23) = FormatDateStr(rs.Fields!DropDate, "long")
                .TextMatrix(lngrow, 24) = Trim$(NullValue(rs.Fields!Price))
                .TextMatrix(lngrow, 25) = Trim$(NullValue(rs.Fields!Remarks))
                .TextMatrix(lngrow, 26) = Trim$(NullValue(rs.Fields("tBeforeLabdip.UpdateOperator")))
                .TextMatrix(lngrow, 27) = FormatDateStr(rs.Fields("BeforeLabdip.UpdateDate"), "long")
                rs.MoveNext
          Next
          lngrow = 0
          .TextMatrix(1, 0) = "总计"
          .TextMatrix(1, 1) = .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 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 + -