📄 frmbasicclientorder.frm
字号:
End
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHF1
Height = 8115
Left = 120
TabIndex = 35
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 = "frmBasicClientOrder"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim lngrow As Integer
Dim 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":
frmUnClientOrder.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 tBasicClientOrder"
If Trim$(txtProductCode.Text) = "" Then
FormatQuery = FormatQuery & " where ProductCode<>''"
Else
FormatQuery = FormatQuery & " where ProductCode='" & txtProductCode.Text & "'"
End If
If Trim$(txtClient) <> "" Then
FormatQuery = FormatQuery & " and Client" & objDatabase.FormatLikeSQL(Trim(txtClient.Text))
End If
If Trim$(txtClientCode) <> "" Then
FormatQuery = FormatQuery & " and ClientCode" & objDatabase.FormatLikeSQL(txtClientCode.Text)
End If
If Trim$(txtConfirmPrice) <> "" Then
FormatQuery = FormatQuery & " and ConfirmPrice" & objDatabase.FormatLikeSQL(txtConfirmPrice.Text)
End If
If Trim$(txtQuotationPrice) <> "" Then
FormatQuery = FormatQuery & " and QuotationPrice" & objDatabase.FormatLikeSQL(txtQuotationPrice.Text)
End If
If Trim$(txtConfirmWidth) <> "" Then
FormatQuery = FormatQuery & " and ConfirmWidth" & objDatabase.FormatLikeSQL(txtConfirmWidth.Text)
End If
If Trim$(txtQuotationWidth) <> "" Then
FormatQuery = FormatQuery & " and QuotationPrice" & objDatabase.FormatLikeSQL(txtQuotationPrice.Text)
End If
If Trim$(txtConfirmPrintPrice) <> "" Then
FormatQuery = FormatQuery & " and ConfirmPrintPrice" & objDatabase.FormatLikeSQL(txtConfirmPrintPrice.Text)
End If
If Trim$(txtQuotationPrintPrice) <> "" Then
FormatQuery = FormatQuery & " and QuotationPrintPrice" & objDatabase.FormatLikeSQL(txtQuotationPrintPrice.Text)
End If
If Trim$(txtConfirmFinish) <> "" Then
FormatQuery = FormatQuery & " and ConfirmFinish" & objDatabase.FormatLikeSQL(txtConfirmFinish.Text)
End If
If Trim$(txtQuotationFinish) <> "" Then
FormatQuery = FormatQuery & " and QuotationFinish" & objDatabase.FormatLikeSQL(txtQuotationFinish.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 = 17
.Clear
'初始化
.WordWrap = False
.TextMatrix(0, 0) = "序号"
.TextMatrix(0, 1) = ""
.TextMatrix(0, 2) = "產品編號"
.ColWidth(2) = 1200
.TextMatrix(0, 3) = "客戶簡稱"
.ColWidth(3) = 1500
.TextMatrix(0, 4) = "客戶編號"
.ColWidth(4) = 1200
.TextMatrix(0, 5) = "確認價格"
.ColWidth(5) = 1200
.TextMatrix(0, 6) = "報價"
.ColWidth(6) = 1200
.TextMatrix(0, 7) = "確認幅寬"
.ColWidth(7) = 1200
.TextMatrix(0, 8) = "報價幅寬"
.ColWidth(8) = 1200
.TextMatrix(0, 9) = "確認打印價格"
.ColWidth(9) = 1200
.TextMatrix(0, 10) = "報價打印價格"
.ColWidth(10) = 1200
.TextMatrix(0, 11) = "確認整理"
.ColWidth(11) = 2000
.TextMatrix(0, 12) = "報價整理"
.ColWidth(12) = 2000
.TextMatrix(0, 13) = "備注1"
.ColWidth(13) = 2500
.TextMatrix(0, 14) = "備註2"
.ColWidth(14) = 2500
.TextMatrix(0, 15) = "填寫人"
.ColWidth(15) = 1500
.TextMatrix(0, 16) = "填入日期"
.ColWidth(16) = 1200
.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!Client))
.TextMatrix(lngrow, 4) = Trim$(NullValue(rs.Fields!ClientCode))
.TextMatrix(lngrow, 5) = Trim$(NullValue(rs.Fields!ConfirmPrice))
.TextMatrix(lngrow, 6) = Trim$(NullValue(rs.Fields!QuotationPrice))
.TextMatrix(lngrow, 7) = Trim$(NullValue(rs.Fields!ConfirmWidth))
.TextMatrix(lngrow, 8) = Trim$(NullValue(rs.Fields!QuotationWidth))
.TextMatrix(lngrow, 9) = Trim$(NullValue(rs.Fields!ConfirmPrintPrice))
.TextMatrix(lngrow, 10) = Trim$(NullValue(rs.Fields!QuotationPrintPrice))
.TextMatrix(lngrow, 11) = Trim$(NullValue(rs.Fields!ConfirmFinish))
.TextMatrix(lngrow, 12) = Trim$(NullValue(rs.Fields!QuotationFinish))
.TextMatrix(lngrow, 13) = Trim$(NullValue(rs.Fields!Remark1))
.TextMatrix(lngrow, 14) = Trim$(NullValue(rs.Fields!Remark2))
.TextMatrix(lngrow, 15) = Trim$(NullValue(rs.Fields!UpdateOperator))
.TextMatrix(lngrow, 16) = 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 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
txtClientCode.Text = rs.Fields!CustomerNo
txtClient.Text = rs.Fields!CustomerName
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 tBasicClientOrder")
fraFind.Visible = False
End Sub
Private Sub ProductSelect_Click()
frmBasicProductionSelect.cType = "client"
frmBasicProductionSelect.Show
End Sub
Private Sub Form_Load()
'设置窗口大小
FormInit Me, True
SetObjectWH Frame1
SetObjectWH MSHF1
FillMshf1 ("select * from tBasicClientOrder")
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 = "確認幅寬"
Label19.Caption = "報價打印價格"
Label21.Caption = "報價幅寬"
Label26.Caption = "確認整理"
Label27.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()
frmBasicClientOrderInfo.newItem = True
frmBasicClientOrderInfo.InitInfo ""
frmBasicClientOrderInfo.Show
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
End Sub
Private Sub EditOperatorInf()
frmBasicClientOrderInfo.newItem = False
If lngrow = 1 Then Exit Sub
frmBasicClientOrderInfo.InitInfo MSHF1.TextMatrix(lngrow, 1)
frmBasicClientOrderInfo.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 tUnBasicClientOrder", Cn, 1, 3
rsobj.Open "select * from tBasicClientOrder where id=" & MSHF1.TextMatrix(lngrow, 1), Cn, 1, 3
rs.AddNew
rs.Fields!productCode = NullValue(rsobj.Fields!productCode)
rs.Fields!Client = NullValue(rsobj.Fields!Client)
rs.Fields!ClientCode = NullValue(rsobj.Fields!ClientCode)
rs.Fields!ConfirmPrice = NullValue(rsobj.Fields!ConfirmPrice)
rs.Fields!QuotationPrice = NullValue(rsobj.Fields!QuotationPrice)
rs.Fields!ConfirmWidth = NullValue(rsobj.Fields!ConfirmWidth)
rs.Fields!QuotationWidth = NullValue(rsobj.Fields!QuotationWidth)
rs.Fields!ConfirmPrintPrice = NullValue(rsobj.Fields!ConfirmPrintPrice)
rs.Fields!QuotationPrintPrice = NullValue(rsobj.Fields!QuotationPrintPrice)
rs.Fields!ConfirmFinish = NullValue(rsobj.Fields!ConfirmFinish)
rs.Fields!QuotationFinish = NullValue(rsobj.Fields!QuotationFinish)
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 tBasicClientOrder where id=" & MSHF1.TextMatrix(lngrow, 1)
objDatabase.ExecCmd strSql
MsgBox "刪除成功!", vbInformation, "提示"
End If
FillMshf1 ("select * from tBasicClientOrder")
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 + -