?? form_incomeadd.frm
字號:
AllowUserResizing= 3
End
Begin MSDBGrid.DBGrid gridCustomer
Bindings = "form_incomeAdd.frx":802E
Height = 1500
Left = 855
OleObjectBlob = "form_incomeAdd.frx":8042
TabIndex = 4
Top = 1680
Visible = 0 'False
Width = 3840
End
Begin MSDBGrid.DBGrid grid1
Bindings = "form_incomeAdd.frx":8D7A
Height = 2985
Left = 3915
OleObjectBlob = "form_incomeAdd.frx":8D8E
TabIndex = 15
Top = 1980
Visible = 0 'False
Width = 6285
End
Begin MSFlexGridLib.MSFlexGrid mf1
Height = 4575
Left = 120
TabIndex = 16
Top = 1680
Width = 11130
_ExtentX = 19632
_ExtentY = 8070
_Version = 393216
BackColorFixed = -2147483636
BackColorBkg = -2147483644
AllowUserResizing= 3
End
Begin VB.Label lblTtlQtyCaption
BackColor = &H00C0FFFF&
Caption = "總件數:"
ForeColor = &H00FF0000&
Height = 255
Left = 1200
TabIndex = 22
Top = 8160
Width = 735
End
Begin VB.Label lblTtlQty
BackColor = &H00C0FFFF&
Caption = "0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 255
Left = 2040
TabIndex = 21
Top = 8160
Width = 735
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "入 庫 單"
BeginProperty Font
Name = "宋體"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 5115
TabIndex = 18
Top = 0
Width = 1395
End
Begin VB.Label Label6
BackColor = &H80000018&
Caption = "累計凈重毛重"
BeginProperty Font
Name = "宋體"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 1200
Left = 615
TabIndex = 17
Top = 6480
Width = 255
End
End
Attribute VB_Name = "form_incomeAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim s, y, i '定義變量
Dim mydb As Database '定義數據庫
Dim rs1 As Recordset '定義字段
Dim rs2 As Recordset
Dim rsMaster As Recordset
Dim lsph As Integer '定義一個整型變量
Dim isAdd As Boolean '是否新增
Dim grid1IsVisible As Boolean
Dim m_billType As Integer
' 續單的最大箱號
Dim m_prevBillNo As Integer
Private Sub cmdCHeck_Click()
Dim strMsg As String
strMsg = checkbarcodesRepeated(mf1)
If strMsg <> "" Then
MsgBox "紅色顯示部分條碼重復!", vbCritical, "警告"
End If
End Sub
Private Sub cmdDeleteLine_Click()
For i = mf1.FixedCols To mf1.cols - mf1.FixedCols
mf1.TextMatrix(mf1.row, i) = ""
Next i
text1.Text = ""
Call fillTotalDataFromDtlData
If mf1.row > 1 Then
mf1.row = mf1.row - 1
End If
Exit Sub
End Sub
Private Sub cmdImport_Click()
Dim filePath As String
filePath = ""
filePath = "C:\盤點機目錄\rk.txt"
If Dir(filePath) = "" Then
MsgBox "對不起,找不到文件【" + filePath + "】", vbInformation, "提示"
Exit Sub
End If
If MsgBox("真的要導入文件" + vbCrLf + "【" + filePath + "】的數據嘛?", vbYesNo + vbQuestion + vbDefaultButton1, "提示") = vbNo Then
Exit Sub
End If
' 將文本文件中的數據導入到數據庫中
If importDataFromFile(filePath, "RK") = True Then
MsgBox "導入成功,請修改供應商等信息!", vbInformation, "提示"
Unload Me
Load form_incomeBill
form_incomeBill.Show
frm_main.Enabled = False
Else
MsgBox "對不起,導入失敗!", vbInformation, "提示"
End If
End Sub
Private Sub cmdPrevNo_Click()
Load dlg_incomeBill
dlg_incomeBill.Show vbModal, Me
m_prevBillNo = getPrevBillMaxBoxNo(Me.txtPrevBillNo.Text, True)
setGridSequence Me.mf1, m_prevBillNo + 1, 0
End Sub
Private Sub Form_Load()
' Me.cmdImport.Visible = False
' 隱藏沒有用的孔件
Me.Label5.Visible = False
Me.txtPrevBillNo.Visible = False
Me.cmdPrevNo.Visible = False
Me.chkAutoOut.Visible = False
m_prevBillNo = 0
grid1IsVisible = False
isAdd = True
enableControls (False)
'自動識別數據庫路徑
Data1.DatabaseName = g_dbPath
Data2.DatabaseName = g_dbPath
m_billType = 0
mf1.rows = 2: mf1.cols = 14 '定義mf1表的總行數、總列數
'定義mf1表的列寬和表頭信息
s = Array("500", "1300", "1200", "1300", "1100", "450", "1000", "0", "0", "1000", "500", "1000", "1300", 0)
y = Array("序號", "條 碼 號", "物料名稱", "型號||規格", " 標 準", "單位", "凈重", "價格", "金額", "總皮重", "件/箱", "毛重", "工號", "productId")
For i = 0 To mf1.cols - 1
mf1.ColWidth(i) = s(i): mf1.TextMatrix(0, i) = y(i)
Next i
mf1.FixedRows = 1: mf1.FixedCols = 1 '定義mf1表的固定行數、固定列數
'定義mf1表的列序號
For i = mf1.FixedRows To mf1.rows - mf1.FixedRows
mf1.TextMatrix(i, 0) = i
Next i
mf1.AllowUserResizing = flexResizeColumns
'定義msfgTtl表的列寬和表頭信息
msfgTtl.rows = 2: msfgTtl.cols = 11 '定義msfgTtl表的總行數、總列數
msfgTtl.FixedRows = 1: msfgTtl.FixedCols = 1 '定義mf1表的固定行數、固定列數
s = Array("500", "900", "1400", "1300", "1100", "700", "1000", "0", "600", "1000", 0)
y = Array("序號", "物料編號", "物料名稱", "型號||規格", " 標 準", "單位", "總凈重", "金額", "總件數", "總毛重", "productId")
For i = 0 To msfgTtl.cols - 1
msfgTtl.ColWidth(i) = s(i): msfgTtl.TextMatrix(0, i) = y(i)
Next i
msfgTtl.rows = 101
For i = msfgTtl.FixedRows To msfgTtl.rows - msfgTtl.FixedRows
msfgTtl.TextMatrix(i, 0) = i
Next i
billDate.Text = CStr(Now) '設置出庫日期
Data1.RecordSource = "select * from hpos_products"
Data2.RecordSource = "select fullName,orgId,orgCode,shortenedform from hpos_organization where orgType=1 order by fullName"
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub gridCustomer_DblClick()
selectCustomer
End Sub
Private Sub gridCustomer_GotFocus()
text1.Visible = False
End Sub
Private Sub gridCustomer_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then '當按回車鍵時
selectCustomer
End If
If KeyCode = vbKeyEscape Then '按ESC鍵
gridCustomer.Visible = False 'gridCustomer不可見
End If
End Sub
Private Sub selectCustomer()
With Data2.Recordset
If Data2.Recordset.RecordCount > 0 Then
If Data2.Recordset.Fields("orgId") <> "" Then
'賦值給mf1表格
If .Fields("OrgId") <> "" Then txtSupplier.Text = .Fields("OrgId")
If .Fields("fullName") <> "" Then supplierName.Text = .Fields("fullName")
gridCustomer.Visible = False
Else
MsgBox "沒有數據可選擇!", vbCritical, "提示"
gridCustomer.Visible = False 'gridCustomer不可見
End If
End If
End With
' supplierName.SetFocus: supplierName.SelStart = 0: supplierName.SelLength = Len(supplierName.Text)
mf1GetFocus
End Sub
Private Sub grid1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then '當按回車鍵時
With Data1.Recordset
If Data1.Recordset.RecordCount > 0 Then
If Data1.Recordset.Fields("barcode") <> "" Then
text1.Text = mf1.Text '賦值給text1
text1.SetFocus
If (mf1.row = mf1.rows - mf1.FixedRows) Then
mf1.rows = mf1.rows + 1
mf1.TextMatrix(mf1.rows - mf1.FixedRows, 0) = mf1.rows - mf1.FixedRows + m_prevBillNo
End If
mf1.row = mf1.row + 1: mf1.col = 1 '到達第5列
grid1.Visible = False
Else
MsgBox "沒有數據供選擇!", vbCritical, "提示"
grid1.Visible = False 'grid1不可見
text1.SetFocus
End If
End If
End With
text1.SetFocus 'text1獲得焦點
End If
If KeyCode = vbKeyEscape Then '按ESC鍵
grid1.Visible = False 'grid1不可見
text1.SetFocus 'text1獲得焦點
End If
End Sub
Private Sub gridCustomer_LostFocus()
gridCustomer.Visible = False
End Sub
Private Sub mf1_GotFocus()
If mf1.row >= mf1.FixedRows And (mf1.col = 1) Then
On Error Resume Next
text1.Width = mf1.CellWidth
text1.Height = mf1.CellHeight
text1.Left = mf1.CellLeft + mf1.Left
text1.Top = mf1.CellTop + mf1.Top
text1.Text = mf1.Text
text1.Visible = True 'text1可見
text1.SetFocus
text1.Locked = False
End If
End Sub
Private Sub supplierName_Change()
'查詢供應商信息
Data2.RecordSource = "select fullName,orgId,orgCode,shortenedform from hpos_organization where orgType=1 and ((hpos_organization.fullName like " + Chr(34) + supplierName.Text + "*" + Chr(34) + ")or (hpos_organization.shortenedform like " + Chr(34) + supplierName.Text + "*" + Chr(34) + "))order by fullName"
Data2.Refresh
Dim rsMaster As Recordset
Set rsMaster = Data2.Recordset
If rsMaster.EOF Or supplierName.Text = "" Or IsNull(rsMaster) Then
gridCustomer.Visible = False
Else
gridCustomer.Visible = True
End If
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -