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

📄 frmshipments.frm

📁 企业ERP系统 采用VB+SQL2000实现。 有客户合约
💻 FRM
📖 第 1 页 / 共 2 页
字号:
             .txtLinkman = NullValue(rs.Fields!Linkman)
             .txtCurrencyName = NullValue(rs.Fields!CurrencyName)
             .txtUnit = NullValue(rs.Fields!unit)
             '.txtOrigin = NullValue(rs.Fields!Origin)
             .txtPayment = NullValue(rs.Fields!Payment)
             .txtFabricNo = NullValue(rs.Fields!FabricNo)
             .txtFabricName = NullValue(rs.Fields!FabricName)
             .txtComposition = NullValue(rs.Fields!Composition)
             .CmdMakeNoticesNo.Enabled = True
             .cmdOk.Enabled = True
             .newItem = True
             .ReadOrderInfo "select top 1 * from vShipmentsInvoicesInfo"
             .Show vbModal
        End With
        rs.Close
        Set rs = Nothing
        Unload Me
    End If
End Sub
Private Function FormatQuery() As String
    FormatQuery = "select * from vShipmentsNotices"
    If Trim$(txtNoticesNo.Text) = "" Then
        FormatQuery = FormatQuery & " where NoticesNo <> ''"
    Else
        FormatQuery = FormatQuery & " where NoticesNo='" & txtNoticesNo & "'"
    End If
    If chkFoundDate.Value = vbChecked Then
        FormatQuery = FormatQuery & " and FoundDate >= '" & FormatDateStr(Founddate.Value, "long") & "'"
        FormatQuery = FormatQuery & " and FoundDate <= '" & FormatDateStr(EndFounddate.Value, "long") & "'"
    End If
    If Trim$(txtPortName) <> "" Then
        FormatQuery = FormatQuery & " and PortName" & objDatabase.FormatLikeSQL(txtPortName)
    End If
    If Trim$(txtFactoryName) <> "" Then
        FormatQuery = FormatQuery & " and FactoryName" & objDatabase.FormatLikeSQL(txtFactoryName)
    End If
    If Trim$(txtCustomerAllName) <> "" Then
        FormatQuery = FormatQuery & " and CustomerAllName" & objDatabase.FormatLikeSQL(txtCustomerAllName)
    End If
End Function

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 * from tCustomer where CustomerNo=" & objDatabase.FormatSQL(CustomerNo)
        If Not rs.EOF Then
            txtCustomerAllName = rs.Fields!CustomerAllName
        End If
    rs.Close

remClear:
    Set rs = Nothing
    Exit Sub
errLabel:
    objDatabase.DatabaseError
    GoTo remClear
End Sub

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

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

Private Sub Form_Load()
'设置窗口大小
    FormInit Me, True
    SetObjectWH Frame1
    SetObjectWH MSHF1
    FillMshf1 ("select * from vShipmentsNotices")
    Initcbb txtNoticesNo, "NOticesNo", "tShipmentsNotices"
    Initcbb txtPortName, "PortName", "tShipmentsNotices"
    Initcbb txtFactoryName, "FactoryName", "tShipmentsNotices"
    ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdInvoice").Enabled = False
    InitTitle
    HookWheel Me.hwnd
End Sub
Private Sub InitTitle()
    Label3.item(4).Caption = "出貨編號"
    Label5.Caption = "目的地"
    Label11.Caption = "出貨工廠"
    Label6.Caption = "客人"
    Label4.Caption = "出貨日期"
    Label13.Caption = "至"
    Label12.Caption = "模糊查詢項"
    cmdFindAll.Caption = "全部 &A"
    cmdFind.Caption = "查詢 &F"
    cmdCancel.Caption = "取消 &C"
End Sub
Private Sub EditOperatorInf()
    frmShipmentsInfo.newItem = False
    If lngrow = 1 Then
       MsgBox "請選擇記錄!", vbInformation + vbOKOnly, "提示"
       Exit Sub
    End If
    frmShipmentsInfo.InitInfo MSHF1.TextMatrix(lngrow, 15)
    frmShipmentsInfo.newItem = False
    frmShipmentsInfo.FillMshf1 ("select * from tShipmentsNoticesSub where NoticesNo='" & MSHF1.TextMatrix(lngrow, 2) & "'")
    frmShipmentsInfo.Show vbModal
    ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdInvoice").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  tShipmentsNotices where NoticesNo='" & MSHF1.TextMatrix(lngrow, 2) & "'"
'        objDatabase.ExecCmd strSql
        strSql = "delete from tShipmentsNoticesSub where id='" & MSHF1.TextMatrix(lngrow, 15) & "'"
        objDatabase.ExecCmd strSql
        MsgBox "刪除成功!", vbInformation, "提示"
    End If
    FillMshf1 ("select * from vShipmentsNotices")
    ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
    ActiveBar21.Bands("toolbar").Tools.item("cmdInvoice").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
   Dim Quantity As Integer
      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 = 17
          .Clear
          '初始化
         .WordWrap = False
         .TextMatrix(0, 0) = "序號"
         .ColWidth(0) = 500
         .TextMatrix(0, 1) = "日期"
         .ColWidth(1) = 1200
         .TextMatrix(0, 2) = "裝貸編號"
         .ColWidth(2) = 1200
         .TextMatrix(0, 3) = "國家名稱"
         .ColWidth(3) = 1500
         .TextMatrix(0, 4) = "目的地"
         .ColWidth(4) = 1500
         .TextMatrix(0, 5) = "加工廠"
         .ColWidth(5) = 2000
         .TextMatrix(0, 6) = "加工單號"
         .ColWidth(6) = 1200
         .TextMatrix(0, 7) = "組織"
         .ColWidth(7) = 1500
         .TextMatrix(0, 8) = "色號"
         .ColWidth(8) = 1200
         .TextMatrix(0, 9) = "碼數"
         .ColWidth(9) = 1200
         .TextMatrix(0, 10) = "包數"
         .ColWidth(10) = 1200
         .TextMatrix(0, 11) = "裝倉期"
         .ColWidth(11) = 1200
         .TextMatrix(0, 12) = "貨到船開期"
         .ColWidth(12) = 1200
         .TextMatrix(0, 13) = "客人"
         .ColWidth(13) = 2000
         .TextMatrix(0, 14) = "備注"
         .ColWidth(14) = 2500
         .TextMatrix(0, 15) = ""
         .ColWidth(15) = 0
         .TextMatrix(0, 16) = ""
         .ColWidth(16) = 0
         '.....................................................
         .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!Founddate))
                .TextMatrix(lngrow, 2) = Trim$(NullValue(rs.Fields!NoticesNo))
                .TextMatrix(lngrow, 3) = Trim$(NullValue(rs.Fields!CountriesName))
                .TextMatrix(lngrow, 4) = Trim$(NullValue(rs.Fields!PortName))
                .TextMatrix(lngrow, 5) = Trim$(NullValue(rs.Fields!FactoryName))
                .TextMatrix(lngrow, 6) = Trim$(NullValue(rs.Fields!OrderNo))
                .TextMatrix(lngrow, 7) = Trim$(NullValue(rs.Fields!Composition))
                .TextMatrix(lngrow, 8) = Trim$(NullValue(rs.Fields!eLayoutColor))
                .TextMatrix(lngrow, 9) = NullValue(rs.Fields!Quantity)
                .TextMatrix(lngrow, 10) = Trim$(NullValue(rs.Fields!clothamount))
                .TextMatrix(lngrow, 11) = Trim$(NullValue(rs.Fields!Stockdate))
                .TextMatrix(lngrow, 12) = Trim$(NullValue(rs.Fields!Shipmentsdate))
                .TextMatrix(lngrow, 13) = Trim$(NullValue(rs.Fields!CustomerName))
                .TextMatrix(lngrow, 14) = Trim$(NullValue(rs.Fields!Remarks))
                .TextMatrix(lngrow, 15) = Trim$(NullValue(rs.Fields!ID))
                .TextMatrix(lngrow, 16) = Trim$(NullValue(rs.Fields!CustomerNo))
                Quantity = Quantity + NullValue(rs.Fields!Quantity)
                rs.MoveNext
          Next
          lngrow = 0
          .TextMatrix(1, 0) = "總計"
          .TextMatrix(1, 1) = .Rows - 2
          .TextMatrix(1, 9) = Quantity
          .col = 9
          .row = 1
          .CellBackColor = &HFFFFC0
          .col = 1
          .CellBackColor = &HFFFFC0
           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
    End If
        ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = True
        ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = True
        ActiveBar21.Bands("toolbar").Tools.item("cmdInvoice").Enabled = True
End Sub

Private Sub MSHF1_DblClick()
   EditOperatorInf
End Sub



⌨️ 快捷键说明

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