📄 frmclaim.frm
字号:
Case "cmdDel":
DelOperatorInf
Case "cmdCancel":
Unload Me
Case "cmdEdit":
EditOperatorInf
Case "cmdFind"
fraFind.Visible = True
Case "cmdRefurbish":
FillMshf1 ("select * from tEricClaimList")
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 tEricClaimList"
If Trim$(txtContractNo.Text) = "" Then
FormatQuery = FormatQuery & " where ContractNo<>''"
Else
FormatQuery = FormatQuery & " and ContractNo='" & txtContractNo & "'"
End If
If Trim$(txtOrderNo) <> "" Then
FormatQuery = FormatQuery & " and OrderNo='" & txtOrderNo & "'"
End If
If Trim$(txtFabricNo) <> "" Then
FormatQuery = FormatQuery & " and FabricNo='" & txtFabricNo & "'"
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$(txtFabricName) <> "" Then
FormatQuery = FormatQuery & " and FabricName" & objDatabase.FormatLikeSQL(txtFabricName)
End If
If Trim$(txtFabricInfo) <> "" Then
FormatQuery = FormatQuery & " and Composition" & objDatabase.FormatLikeSQL(txtFabricInfo)
End If
If Trim$(txtLayoutColor) <> "" Then
FormatQuery = FormatQuery & " and LayoutColor" & objDatabase.FormatLikeSQL(txtLayoutColor)
End If
End Function
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 * from tBasicProduct where FabricCode=" & objDatabase.FormatSQL(FabricNo)
If Not rs.EOF Then
txtFabricNo = rs.Fields!FabricCode
txtFabricName = rs.Fields!FabricName
txtFabricInfo = rs.Fields!Composition
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 tEricClaimList")
fraFind.Visible = False
End Sub
Private Sub Form_Load()
'设置窗口大小
FormInit Me, True
SetObjectWH Frame1
SetObjectWH MSHF1
FillMshf1 ("select * from tEricClaimList")
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
Initcbb txtContractNo, "ContractNo", "tEricClaimList"
Initcbb txtOrderNo, "OrderNo", "tEricClaimList"
Initcbb txtLayoutColor, "LayoutColor", "tEricClaimList"
InitTitle
HookWheel Me.hwnd
End Sub
Private Sub InitTitle()
Label3.item(4).Caption = "合同編號"
Label5.Caption = "加工單號"
Label11.Caption = "布名"
Label6.Caption = "布信息"
Label1.Caption = "顏色花型"
Label2.Caption = "布號"
Label4.Caption = "輸入日期"
Label13.Caption = "至"
Me.Caption = "索賠表"
End Sub
Private Sub EditOperatorInf()
frmClaimInfo.newItem = False
If lngrow = 1 Then
MsgBox "請選擇記錄!", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
frmClaimInfo.InitInfo MSHF1.TextMatrix(lngrow, 21)
frmClaimInfo.newItem = False
frmClaimInfo.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 tEricClaimList where id=" & MSHF1.TextMatrix(lngrow, 21)
objDatabase.ExecCmd strSql
MsgBox "刪除成功!", vbInformation, "提示"
End If
FillMshf1 ("select * from tEricClaimList")
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 = 22
.Clear
'初始化
.WordWrap = False
.TextMatrix(0, 0) = "序號"
.ColWidth(0) = 500
.TextMatrix(0, 1) = "日期"
.ColWidth(1) = 1000
.TextMatrix(0, 2) = "合同編號"
.ColWidth(2) = 1000
.TextMatrix(0, 3) = "加工單號"
.ColWidth(3) = 1000
.TextMatrix(0, 4) = "布號"
.ColWidth(4) = 1000
.TextMatrix(0, 5) = "布名"
.ColWidth(5) = 1000
.TextMatrix(0, 6) = "布信息"
.ColWidth(6) = 2000
.TextMatrix(0, 7) = "顏色花型"
.ColWidth(7) = 1500
.TextMatrix(0, 8) = ""
.ColWidth(8) = 0
.TextMatrix(0, 9) = "交期"
.ColWidth(9) = 1000
.TextMatrix(0, 10) = "索賠描述"
.ColWidth(10) = 2500
.TextMatrix(0, 11) = "數量"
.ColWidth(11) = 1200
.TextMatrix(0, 12) = "幣種"
.ColWidth(12) = 1000
.TextMatrix(0, 13) = "對應匯率"
.ColWidth(13) = 1200
.TextMatrix(0, 14) = "單價"
.ColWidth(14) = 1200
.TextMatrix(0, 15) = "單位"
.ColWidth(15) = 800
.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) = 2000
.TextMatrix(0, 21) = ""
.ColWidth(21) = 0
'.....................................................
.Rows = rs.RecordCount + 2
On Error Resume Next
For lngrow = 2 To rs.RecordCount + 1
.TextMatrix(lngrow, 0) = lngrow - 1
.TextMatrix(lngrow, 1) = FormatDateStr(rs.Fields!Founddate, "long")
.TextMatrix(lngrow, 2) = Trim$(NullValue(rs.Fields!ContractNo))
.TextMatrix(lngrow, 3) = Trim$(NullValue(rs.Fields!OrderNo))
.TextMatrix(lngrow, 4) = Trim$(NullValue(rs.Fields!FabricNo))
.TextMatrix(lngrow, 5) = Trim$(NullValue(rs.Fields!FabricName))
.TextMatrix(lngrow, 6) = Trim$(NullValue(rs.Fields!Composition))
.TextMatrix(lngrow, 7) = Trim$(NullValue(rs.Fields!LayoutColor))
' .TextMatrix(lngRow, 8) = NullValue(rs.Fields!elayoutcolor)
.TextMatrix(lngrow, 9) = FormatDateStr(rs.Fields!Delivery, "long")
.TextMatrix(lngrow, 10) = Trim$(NullValue(rs.Fields!ClaimReason))
.TextMatrix(lngrow, 11) = Trim$(NullValue(rs.Fields!Quantity))
.TextMatrix(lngrow, 12) = Trim$(NullValue(rs.Fields!CurrencyName))
.TextMatrix(lngrow, 13) = Trim$(NullValue(rs.Fields!Rate))
.TextMatrix(lngrow, 14) = Trim$(NullValue(rs.Fields!Price))
.TextMatrix(lngrow, 15) = Trim$(NullValue(rs.Fields!unit))
.TextMatrix(lngrow, 16) = Trim$(NullValue(rs.Fields!Amount))
.TextMatrix(lngrow, 17) = Trim$(NullValue(rs.Fields!InvoiceQuantity))
.TextMatrix(lngrow, 18) = Trim$(NullValue(rs.Fields!InvoicePrice))
.TextMatrix(lngrow, 19) = Trim$(NullValue(rs.Fields!ClaimAmount))
.TextMatrix(lngrow, 20) = Trim$(NullValue(rs.Fields!FactoryName))
.TextMatrix(lngrow, 21) = NullValue(rs.Fields!ID)
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 + -