📄 frmproductionfolloworder.frm
字号:
Case "cmdFind"
fraFind.Visible = True
Case "cmdRefurbish":
FillMshf1 ("select * from tBusinessContract a,(select CustomerNo,CustomerName,email,tel,address,fax from tCustomer) c ,(select ContractNo,ShipmentsPatternNo,FabricNo,FabricName,Composition,LayoutColor,InvoiceQuantity,InvoicePrice,InvoiceNo,orderNo from tBusinessContractSub) b left join(select PatternNo,Founddate as FounddatePattern from tShipmentsPattern) d on (b.ShipmentsPatternNo=d.PatternNo) left join (select InvoiceNo,Founddate as FounddateInvoice from tShipmentsInvoice)e on (b.InvoiceNo=e.InvoiceNo) where a.ContractNo=b.ContractNo and a.customerNo=c.CustomerNo order by a.CustomerNo")
End Select
End Sub
Private Sub ActiveBar21_ComboSelChange(ByVal Tool As ActiveBar2LibraryCtl.Tool)
If Tool.CBListIndex = 0 Then
flag = False
FillMshf1 ("select * from vProductionFollow")
Else
flag = True
FillMshf1 ("select * from vProductionFollow")
End If
End Sub
Private Function FormatQuery() As String
FormatQuery = "select * from vProductionFollow"
If Trim$(txtCustomerNo.Text) = "" Then
FormatQuery = FormatQuery & " where CustomerNo=''"
Else
FormatQuery = FormatQuery & " where CustomerNo='" & txtCustomerNo & "'"
End If
If Trim$(txtContractNo) <> "" Then
FormatQuery = FormatQuery & " and ContractNo='" & txtContractNo & "'"
End If
If chkFounddate.Value = vbChecked Then
FormatQuery = FormatQuery & " and Expr1 >= '" & FormatDateStr(Founddate.Value, "long") & "'"
FormatQuery = FormatQuery & " and Expr1 <= '" & FormatDateStr(EndFounddate.Value, "long") & "'"
End If
If chkPatternDate.Value = vbChecked Then
FormatQuery = FormatQuery & " and Founddate >= '" & FormatDateStr(PatternDate, "long") & "'"
FormatQuery = FormatQuery & " and Founddate <= '" & FormatDateStr(endPatternDate, "long") & "'"
End If
If Trim$(txtCustomerName) <> "" Then
FormatQuery = FormatQuery & " and CustomerName" & objDatabase.FormatLikeSQL(txtCustomerName)
End If
If Trim$(txtLayoutColor) <> "" Then
FormatQuery = FormatQuery & " and LayoutColor" & objDatabase.FormatLikeSQL(txtLayoutColor)
End If
FormatQuery = FormatQuery & "order by CustomerNo"
End Function
Private Sub cmdCancel_Click()
fraFind.Visible = False
End Sub
Private Sub CmdFind_Click()
FillMshf1 FormatQuery
fraFind.Visible = False
End Sub
Private Sub cmdFindAll_Click()
FillMshf1 ("select * from vProductionFollow")
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
txtCustomerNo = rs.Fields!CustomerNo
txtCustomerName = rs.Fields!CustomerName
End If
rs.Close
remClear:
Set rs = Nothing
Exit Sub
errLabel:
objDatabase.DatabaseError
GoTo remClear
End Sub
Private Sub Form_Load()
'设置窗口大小
FormInit Me, True
SetObjectWH Frame1
SetObjectWH MSHF1
flag = False
FillMshf1 ("select * from vProductionFollow")
Initcbb txtContractNo, "ContractNo", "tBusinessContract"
Initcbb txtLayoutColor, "eLayoutColor", "tBusinessContractSub"
InitTitle
ActiveBar21.Bands("toolbar").Tools.item("cmdSelect").CBAddItem ("加工單編排")
ActiveBar21.Bands("toolbar").Tools.item("cmdSelect").CBAddItem ("客戶編排")
HookWheel Me.hwnd
End Sub
Private Sub InitTitle()
Label3.item(4).Caption = "客戶編號"
Label5.Caption = "客戶名稱"
Label11.Caption = "合約編號"
Label6.Caption = "花型顏色"
Label4.Caption = "出貨日期"
Label13.Caption = "至"
Label12.Caption = "出辦日期"
Label1.Caption = "至"
Label12.Caption = "模糊查詢項"
cmdFindAll.Caption = "全部 &A"
cmdFind.Caption = "查詢 &F"
cmdCancel.Caption = "取消 &C"
Me.Caption = "加工單跟貨表"
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 = 29
.Clear
'初始化
.WordWrap = False
.MergeCells = flexMergeRestrictColumns
.MergeCol(0) = True
.MergeCol(1) = IIf(flag, 1, 0)
.MergeCol(2) = IIf(flag, 1, 0)
.TextMatrix(0, 0) = IIf(flag, "客戶編號", "加工單編號")
.ColWidth(0) = 1500
.TextMatrix(0, 1) = IIf(flag, "客戶名稱", "成份")
.ColWidth(1) = 2000
.TextMatrix(0, 2) = IIf(flag, "客戶全稱", "幅寬")
.ColWidth(2) = 2500
.TextMatrix(0, 3) = IIf(flag, "加工單編號", "客戶編號")
.ColWidth(3) = 1500
.TextMatrix(0, 4) = IIf(flag, "成份", "客戶名稱")
.ColWidth(4) = 2000
.TextMatrix(0, 5) = IIf(flag, "幅寬", "客戶全稱")
.ColWidth(5) = 2500
.TextMatrix(0, 6) = "成品組織"
.ColWidth(6) = 2000
.TextMatrix(0, 7) = "紗數"
.ColWidth(7) = 1200
.TextMatrix(0, 8) = "工廠單號"
.ColWidth(8) = 1200
.TextMatrix(0, 9) = "工廠名稱"
.ColWidth(9) = 1500
.TextMatrix(0, 10) = "C L Q"
.ColWidth(10) = 1000
.TextMatrix(0, 11) = "M/R"
.ColWidth(11) = 1000
.TextMatrix(0, 12) = "交期"
.ColWidth(12) = 1200
.TextMatrix(0, 13) = "查貨日期"
.ColWidth(13) = 1200
.TextMatrix(0, 14) = "成品數"
.ColWidth(14) = 1200
.TextMatrix(0, 15) = "客戶地址"
.ColWidth(15) = 2500
.TextMatrix(0, 16) = "電話"
.ColWidth(16) = 1200
.TextMatrix(0, 17) = "傳真"
.ColWidth(17) = 1200
.TextMatrix(0, 18) = "花型顏色"
.ColWidth(18) = 1200
.TextMatrix(0, 19) = "出貨數量"
.ColWidth(19) = 1200
.TextMatrix(0, 20) = "合約編號"
.ColWidth(20) = 1200
.TextMatrix(0, 21) = "单价"
.ColWidth(21) = 1200
.TextMatrix(0, 22) = "颜色花型"
.ColWidth(22) = 1200
.TextMatrix(0, 23) = "币种"
.ColWidth(23) = 1200
.TextMatrix(0, 24) = "出办编号"
.ColWidth(24) = 1200
.TextMatrix(0, 25) = "付款方式"
.ColWidth(25) = 2000
.TextMatrix(0, 26) = "出货日期"
.ColWidth(26) = 1200
.TextMatrix(0, 27) = "出办日期"
.ColWidth(27) = 1200
.TextMatrix(0, 28) = "季节"
.ColWidth(28) = 1200
.Rows = rs.RecordCount + 1
On Error Resume Next
For lngrow = 1 To rs.RecordCount
.TextMatrix(lngrow, 0) = IIf(flag, NullValue(rs.Fields!CustomerNo), NullValue(rs.Fields!CustomerNo))
.TextMatrix(lngrow, 1) = IIf(flag, NullValue(rs.Fields!CustomerName), NullValue(rs.Fields!Composition))
.TextMatrix(lngrow, 2) = IIf(flag, NullValue(rs.Fields!CustomerAllName), NullValue(rs.Fields!Width))
.TextMatrix(lngrow, 3) = IIf(flag, NullValue(rs.Fields!OrderNo), NullValue(rs.Fields!CustomerNo))
.TextMatrix(lngrow, 4) = IIf(flag, NullValue(rs.Fields!Composition), NullValue(rs.Fields!CustomerName))
.TextMatrix(lngrow, 5) = IIf(flag, NullValue(rs.Fields!Width), NullValue(rs.Fields!CustomerAllName))
.TextMatrix(lngrow, 6) = Trim$(NullValue(rs.Fields!Construstion))
.TextMatrix(lngrow, 7) = Trim$(NullValue(rs.Fields!YarnCount))
.TextMatrix(lngrow, 8) = Trim$(NullValue(rs.Fields!FactoryNo))
.TextMatrix(lngrow, 9) = Trim$(NullValue(rs.Fields!FactoryName))
.TextMatrix(lngrow, 10) = IIf(NullValue(rs.Fields!Labdip), "OK", "NO")
.TextMatrix(lngrow, 11) = IIf(NullValue(rs.Fields!MtlResult), "OK", "NO")
.TextMatrix(lngrow, 12) = Trim$(NullValue(rs.Fields!Delivery))
.TextMatrix(lngrow, 13) = Trim$(NullValue(rs.Fields!ReportDate))
.TextMatrix(lngrow, 14) = Trim$(NullValue(rs.Fields!ProductionQuantity))
.TextMatrix(lngrow, 15) = Trim$(NullValue(rs.Fields!Address))
.TextMatrix(lngrow, 16) = Trim$(NullValue(rs.Fields!tel))
.TextMatrix(lngrow, 17) = Trim$(NullValue(rs.Fields!Fax))
.TextMatrix(lngrow, 18) = Trim$(NullValue(rs.Fields!eLayoutColor))
.TextMatrix(lngrow, 19) = Trim$(NullValue(rs.Fields!Quantity))
.TextMatrix(lngrow, 20) = Trim$(NullValue(rs.Fields!ContractNo))
.TextMatrix(lngrow, 21) = Trim$(NullValue(rs.Fields!Price))
.TextMatrix(lngrow, 22) = Trim$(NullValue(rs.Fields!eLayoutColor))
.TextMatrix(lngrow, 23) = Trim$(NullValue(rs.Fields!CurrencyName))
.TextMatrix(lngrow, 24) = Trim$(NullValue(rs.Fields!ShipmentsPatternNo))
.TextMatrix(lngrow, 25) = Trim$(NullValue(rs.Fields!Payment))
.TextMatrix(lngrow, 26) = Trim$(NullValue(rs.Fields!Founddate))
.TextMatrix(lngrow, 27) = Trim$(NullValue(rs.Fields!Expr1))
.TextMatrix(lngrow, 28) = Trim$(NullValue(rs.Fields!Season))
rs.MoveNext
Next
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()
If flag = False Then
With frmProductionFollowInfo
.OrderNo = MSHF1.TextMatrix(lngrow, 0)
.Composition = MSHF1.TextMatrix(lngrow, 1)
.Construstion = MSHF1.TextMatrix(lngrow, 6)
.YarnCount = MSHF1.TextMatrix(lngrow, 7)
.FactoryNo = MSHF1.TextMatrix(lngrow, 8)
.FactoryName = MSHF1.TextMatrix(lngrow, 9)
.Labdip = MSHF1.TextMatrix(lngrow, 10)
.MtlResult = MSHF1.TextMatrix(lngrow, 11)
.Delivery = MSHF1.TextMatrix(lngrow, 12)
.tWidth = MSHF1.TextMatrix(lngrow, 2)
.ReportDate = MSHF1.TextMatrix(lngrow, 13)
.ProductionQuantity = MSHF1.TextMatrix(lngrow, 14)
.FillMshf1 "select * from vProductionFollow where OrderNo ='" & MSHF1.TextMatrix(lngrow, 0) & "'"
.Show vbModal
End With
Else
With frmProductionFollowCustomer
.CustomerName = MSHF1.TextMatrix(lngrow, 2)
.Address = MSHF1.TextMatrix(lngrow, 15)
.tel = MSHF1.TextMatrix(lngrow, 16)
.Fax = MSHF1.TextMatrix(lngrow, 17)
.Price = MSHF1.TextMatrix(lngrow, 4)
.eLayoutColor = MSHF1.TextMatrix(lngrow, 18)
.CurrencyName = MSHF1.TextMatrix(lngrow, 6)
.ShipmentsPatternNo = MSHF1.TextMatrix(lngrow, 7)
.Quantity = MSHF1.TextMatrix(lngrow, 19)
.Payment = MSHF1.TextMatrix(lngrow, 9)
.Founddate2 = MSHF1.TextMatrix(lngrow, 26)
.Founddate = MSHF1.TextMatrix(lngrow, 27)
.Delivery = MSHF1.TextMatrix(lngrow, 12)
.Season = MSHF1.TextMatrix(lngrow, 28)
.FillMshf1 "select * from vProductionFollow where CustomerNo='" & MSHF1.TextMatrix(lngrow, 0) & "'"
.Show vbModal
End With
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -