📄 frmproductionembryocontractmain.frm
字号:
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
rs.Open "select * from tBasicProduct where FabricCode=" & objDatabase.FormatSQL(FabricNo)
If Not rs.EOF Then
txtFabricCode = NullValue(rs.Fields!FabricCode)
txtFabricName = NullValue(rs.Fields!FabricName)
txtGreige = NullValue(rs.Fields!Greige)
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 tProductionEmbryoContract")
fraFind.Visible = False
End Sub
Private Sub Form_Load()
'设置窗口大小
FormInit Me, True
SetObjectWH Frame1
SetObjectWH MSHF1
FillMshf1 ("select * from tProductionEmbryoContract")
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdIn").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdOut").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdPrint").Enabled = False
Initcbb txtEmbryoContractNo, "EmbryoContractNo", "tProductionEmbryoContract"
Initcbb txtFactoryName, "FactoryName", "tBasicFactory"
Initcbb txtSuppliersName, "Supplier", "tBasicFabricSuppliers"
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 = "布號"
Label9.Caption = "加工廠簡稱"
Label10.Caption = "胚組織"
Label1.Caption = "訂胚日期"
Label8.Caption = "至"
Label4.Caption = "坯交日期"
Label13.Caption = "至"
Label2.Caption = "進坯日期"
Label14.Caption = "至"
Label12.Caption = "模糊查詢項"
cmdFindAll.Caption = "全部 &A"
cmdFind.Caption = "查詢 &F"
cmdCancel.Caption = "取消 &C"
Me.Caption = "訂坯合同匯總表"
End Sub
'編輯坯布合約
Private Sub EditOperatorInf()
frmProductionEmbryoContractInfo.newItem = False
If lngrow = 1 Then
MsgBox "請選擇合約!", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
frmProductionEmbryoContractInfo.InitInfo MSHF1.TextMatrix(lngrow, 24)
frmProductionEmbryoContractInfo.newItem = False
frmProductionEmbryoContractInfo.Show vbModal
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdIn").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdOut").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdOut").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 tProductionEmbryoContract where id=" & MSHF1.TextMatrix(lngrow, 24)
objDatabase.ExecCmd strSql
MsgBox "刪除成功!", vbInformation, "提示"
End If
FillMshf1 ("select * from tProductionEmbryoContract")
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdIn").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdOut").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdOut").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 ConsumeAmount, CurrentAmount, Amount, leftAmount 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 = 25
.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) = 1500
.TextMatrix(0, 5) = "業務聯絡人"
.ColWidth(5) = 1500
.TextMatrix(0, 6) = "業務員"
.ColWidth(6) = 1500
.TextMatrix(0, 7) = "布號"
.ColWidth(7) = 1200
.TextMatrix(0, 8) = "布名"
.ColWidth(8) = 1500
.TextMatrix(0, 9) = "胚組織"
.ColWidth(9) = 2000
.TextMatrix(0, 10) = "幅寬"
.ColWidth(10) = 1100
.TextMatrix(0, 11) = "訂胚數量"
.ColWidth(11) = 1200
.TextMatrix(0, 12) = "投坯數量"
.ColWidth(12) = 1200
.TextMatrix(0, 13) = "實收數量"
.ColWidth(13) = 1200
.TextMatrix(0, 14) = "存坯數量"
.ColWidth(14) = 1200
.TextMatrix(0, 15) = "付款情況"
.ColWidth(15) = 2000
.TextMatrix(0, 16) = "胚價"
.ColWidth(16) = 1200
.TextMatrix(0, 17) = "幣種"
.ColWidth(17) = 1000
.TextMatrix(0, 18) = "單位名稱"
.ColWidth(18) = 1000
.TextMatrix(0, 19) = "進坯交期"
.ColWidth(19) = 1000
.TextMatrix(0, 20) = "備注"
.ColWidth(20) = 2500
.TextMatrix(0, 21) = "加工廠簡稱"
.ColWidth(21) = 1500
.TextMatrix(0, 22) = "加工廠倉號"
.ColWidth(22) = 1000
.TextMatrix(0, 23) = "投胚概況"
.ColWidth(23) = 2000
.TextMatrix(0, 24) = ""
.ColWidth(24) = 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) = FormatDateStr(rs.Fields!Delivery, "long")
.TextMatrix(lngrow, 3) = Trim$(NullValue(rs.Fields!EmbryoContractNo))
.TextMatrix(lngrow, 4) = Trim$(NullValue(rs.Fields!SuppliersName))
.TextMatrix(lngrow, 5) = Trim$(NullValue(rs.Fields!Linkman))
.TextMatrix(lngrow, 6) = Trim$(NullValue(rs.Fields!Operation))
.TextMatrix(lngrow, 7) = Trim$(NullValue(rs.Fields!FabricCode))
.TextMatrix(lngrow, 8) = Trim$(NullValue(rs.Fields!FabricName))
.TextMatrix(lngrow, 9) = Trim$(NullValue(rs.Fields!Greige))
.TextMatrix(lngrow, 10) = Trim$(NullValue(rs.Fields!Width))
.TextMatrix(lngrow, 11) = Trim$(NullValue(rs.Fields!Amount))
.TextMatrix(lngrow, 12) = Trim$(NullValue(rs.Fields!ConsumeAmount))
.TextMatrix(lngrow, 13) = Trim$(NullValue(rs.Fields!CurrentAmount))
.TextMatrix(lngrow, 14) = Trim$(NullValue(rs.Fields!leftAmount))
.TextMatrix(lngrow, 15) = Trim$(NullValue(rs.Fields!Payments))
.TextMatrix(lngrow, 16) = Trim$(NullValue(rs.Fields!Price))
.TextMatrix(lngrow, 17) = Trim$(NullValue(rs.Fields!CurrencyName))
.TextMatrix(lngrow, 18) = Trim$(NullValue(rs.Fields!UnitName))
.TextMatrix(lngrow, 19) = FormatDateStr(rs.Fields!CurrentDate, "long")
.TextMatrix(lngrow, 20) = Trim$(NullValue(rs.Fields!Remark))
.TextMatrix(lngrow, 21) = Trim$(NullValue(rs.Fields!FactoryName))
.TextMatrix(lngrow, 22) = Trim$(NullValue(rs.Fields!FactoryWharf))
.TextMatrix(lngrow, 23) = Trim$(NullValue(rs.Fields!EmbryoPlan))
.TextMatrix(lngrow, 24) = NullValue(rs.Fields!ID)
ConsumeAmount = ConsumeAmount + rs.Fields!ConsumeAmount
CurrentAmount = CurrentAmount + rs.Fields!CurrentAmount
Amount = Amount + rs.Fields!Amount
leftAmount = leftAmount + rs.Fields!leftAmount
rs.MoveNext
Next
lngrow = 0
.TextMatrix(1, 0) = "总计"
.TextMatrix(1, 1) = .Rows - 2
.TextMatrix(1, 11) = Amount
.TextMatrix(1, 12) = ConsumeAmount
.TextMatrix(1, 13) = CurrentAmount
.TextMatrix(1, 14) = leftAmount
.row = 1
.col = 1
.CellBackColor = &HFFFFC0
.col = 11
.CellBackColor = &HFFFFC0
.col = 12
.CellBackColor = &HFFFFC0
.col = 13
.CellBackColor = &HFFFFC0
.col = 14
.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
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = True
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = True
End If
ActiveBar21.Bands("toolbar").Tools.item("cmdIn").Enabled = True
ActiveBar21.Bands("toolbar").Tools.item("cmdOut").Enabled = True
ActiveBar21.Bands("toolbar").Tools.item("cmdPrint").Enabled = True
' End If
End Sub
Private Sub MSHF1_DblClick()
EditOperatorInf
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -