📄 frmdlselectinvoicein.frm
字号:
frmdlSelectInvoiceIn.Lbb(1).Top = 120
frmdlSelectInvoiceIn.cmdall(0).Top = Me.ScaleTop + frmdlSelectInvoiceIn.Lbb(1).Height + frmdlSelectInvoiceIn.Lbb(1).Top
frmdlSelectInvoiceIn.cmdall(1).Top = frmdlSelectInvoiceIn.cmdall(0).Top + 9 + frmdlSelectInvoiceIn.cmdall(0).Height
frmdlSelectInvoiceIn.cmdall(2).Top = frmdlSelectInvoiceIn.cmdall(1).Top + 133 + frmdlSelectInvoiceIn.cmdall(1).Height
frmdlSelectInvoiceIn.cmdall(3).Top = frmdlSelectInvoiceIn.cmdall(2).Top + 9 + frmdlSelectInvoiceIn.cmdall(2).Height
frmdlSelectInvoiceIn.cmdall(4).Top = frmdlSelectInvoiceIn.cmdall(3).Top + 9 + frmdlSelectInvoiceIn.cmdall(3).Height
frmdlSelectInvoiceIn.cmdall(5).Top = frmdlSelectInvoiceIn.cmdall(4).Top + 133 + frmdlSelectInvoiceIn.cmdall(4).Height
frmdlSelectInvoiceIn.cmdall(6).Top = frmdlSelectInvoiceIn.cmdall(5).Top + 9 + frmdlSelectInvoiceIn.cmdall(5).Height
' frmdlSelectInvoiceIn.hLb(0).Top = frmdlSelectInvoiceIn.Label1(1).Top - 38
' frmdlSelectInvoiceIn.hLb(0).Left = frmdlSelectInvoiceIn.msgGrid.Left + 968
' frmdlSelectInvoiceIn.hLb(0).Width = frmdlSelectInvoiceIn.msgGrid.Width / 5.5
'
' frmdlSelectInvoiceIn.hLb(1).Left = frmdlSelectInvoiceIn.Label1(2).Left + frmdlSelectInvoiceIn.Label1(2).Width - 7
' frmdlSelectInvoiceIn.hLb(1).Top = frmdlSelectInvoiceIn.hLb(0).Top
' frmdlSelectInvoiceIn.hLb(1).Width = frmdlSelectInvoiceIn.hLb(0).Width
'
' frmdlSelectInvoiceIn.hLb(2).Width = frmdlSelectInvoiceIn.msgGrid.Width / 6.5
' frmdlSelectInvoiceIn.hLb(2).Left = frmdlSelectInvoiceIn.msgGrid.Left + frmdlSelectInvoiceIn.msgGrid.Width - frmdlSelectInvoiceIn.hLb(2).Width
' frmdlSelectInvoiceIn.hLb(2).Top = frmdlSelectInvoiceIn.hLb(0).Top
frmdlSelectInvoiceIn.Label1(0).Top = 120
frmdlSelectInvoiceIn.lbdw.Top = 120
frmdlSelectInvoiceIn.Label1(0).Left = frmdlSelectInvoiceIn.msgGrid.Left
frmdlSelectInvoiceIn.lbdw.Left = frmdlSelectInvoiceIn.msgGrid.Left + 600
frmdlSelectInvoiceIn.lbdw.Width = frmdlSelectInvoiceIn.msgGrid.Width / 2.5
'
frmdlSelectInvoiceIn.Lbb(1).Top = 120
frmdlSelectInvoiceIn.Lbb(0).Top = 120
frmdlSelectInvoiceIn.Lbb(1).Width = 618
frmdlSelectInvoiceIn.Lbb(1).Left = msgGrid.Left + msgGrid.Width - frmdlSelectInvoiceIn.Lbb(1).Width
frmdlSelectInvoiceIn.Lbb(0).Left = frmdlSelectInvoiceIn.Lbb(1).Left - frmdlSelectInvoiceIn.Lbb(1).Width - 9
frmdlSelectInvoiceIn.Refresh
End Sub
'Flexgrid显示栏目设置
Private Sub setColumn()
Dim intcount As Integer
On Error GoTo Err
mclsGrid.GridToListSet
mclsGrid.ListSet.SaveList
If mclsGrid.ListSet.ShowListSet(mclsGrid.ListSet.ViewId) Then
GetList
mclsGrid.SetupStyle
frmdlSelectInvoiceIn.msgGrid.ColWidth(0) = 0
frmdlSelectInvoiceIn.msgGrid.ColWidth(1) = 488
frmdlSelectInvoiceIn.msgGrid.ColWidth(2) = 0
frmdlSelectInvoiceIn.msgGrid.ColWidth(3) = 0
frmdlSelectInvoiceIn.msgGrid.ColWidth(4) = 0
frmdlSelectInvoiceIn.msgGrid.ColWidth(5) = 0
frmdlSelectInvoiceIn.msgGrid.ColWidth(6) = 0
End If
Exit Sub
Err:
ShowMsg Me.hWnd, "系统出错! ", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, "提示信息"
End Sub
Private Sub Form_Load()
Dim recRecordset As Recordset
Dim Customernm As String, Currencynm As String, strSQL As String
Set mclsGrid = New Grid
Set mclsGrid.Grid = msgGrid
Set bsdate = New Base
hldate = bsdate.BaseDate
isinit = True
DetailID = 10
strSQL = "SELECT Customer.strCustomerName AS 单位名称, ItemActivity.lngCustomerID AS 单位ID, ItemActivity.lngCurrencyID AS 币种ID, Currencys.strCurrencyName AS 币种名称 " _
& " FROM ((ItemActivity INNER JOIN ItemActivityDetail ON ItemActivity.lngActivityID = ItemActivityDetail.lngActivityID) LEFT JOIN Customer ON ItemActivity.lngCustomerID = Customer.lngCustomerID) LEFT JOIN Currencys ON ItemActivity.lngCurrencyID = Currencys.lngCurrencyID " _
& " WHERE (((ItemActivityDetail.lngActivityDetailID)=" & DetailID & "))"
Set recRecordset = gclsBase.BaseDB.OpenRecordset(strSQL, dbOpenSnapshot)
'列表是否为空
If (recRecordset.EOF And recRecordset.BOF) Then
ShowMsg frmdlSelectInvoiceIn.hWnd, "该ID号无对应选择开票入库资料!", 0, msgcaption
isHave = False
'frmdlSelectInvoiceIn.Hide
' Exit Sub
' Unload frmdlSelectInvoiceIn
End If
recRecordset.MoveLast
If recRecordset.RecordCount = 0 Then
ShowMsg frmdlSelectInvoiceIn.hWnd, "该ID号无对应选择开票入库资料!", 0, msgcaption
Exit Sub
isHave = False
'Unload frmdlSelectInvoiceIn
End If
recRecordset.MoveFirst
CustomerID = recRecordset!单位ID
Customernm = recRecordset!单位名称
CurrencyID = recRecordset!币种ID
Currencynm = recRecordset!币种名称
recRecordset.Close
frmdlSelectInvoiceIn.lbdw.Caption = Customernm
mblnFormNoRezise = False
mclsGrid.ColOfs = intfixl
GetList
mclsGrid.ListSetToGrid
mclsGrid.SetupStyle
Set mclsGrid.EditText = frmdlSelectInvoiceIn.ytext
mclsGrid.SetEditText ("开票金额")
'mclsGrid.ReadOnlyCol = False
cmdall(0).Picture = Utility.GetFormResPicture(1001, 0)
cmdall(1).Picture = Utility.GetFormResPicture(1002, 0)
cmdall(4).Picture = Utility.GetFormResPicture(1010, 0)
End Sub
Private Sub Form_Unload(Cancel As Integer)
If isHave = True Then
mclsGrid.GridToListSet
mclsGrid.ListSet.SaveList
Set mclsGrid = Nothing
Utility.RemoveFormResPicture 1001
Utility.RemoveFormResPicture 1002
Utility.RemoveFormResPicture 1010
End If
gclsSys.MainControls.Remove Me
End Sub
'从Flexgrid中取出数字值
Private Function getnumber(getx As Integer, gety As Integer) As Double
If (Len(msgGrid.TextMatrix(getx, gety)) = 0 Or IsNull(msgGrid.TextMatrix(getx, gety))) Then
getnumber = 0
Else
getnumber = CCur(msgGrid.TextMatrix(getx, gety))
End If
End Function
'本函数用于做结算与非结算处理
Private Sub msgGrid_Click()
Dim i As Integer, k As Integer, intcount As Integer
Dim m As Integer, n As Integer, xx As Double, temp As Double
On Error GoTo Err
ytextRow = msgGrid.Row
ytextCol = msgGrid.Col
If ytextRow > 0 And msgGrid.ColSel > 0 And msgGrid.MouseRow > 0 Then
If (msgGrid.TextMatrix(0, 1) = "√") And (msgGrid.MouseCol = 1) Then
i = intfixl
k = intfixl
'本循环找出本次收款及本次折扣所在的列
While (msgGrid.TextMatrix(0, i) <> "已开票金额")
i = i + 1
Wend
While (msgGrid.TextMatrix(0, k) <> "已开票数量")
k = k + 1
Wend
If (msgGrid.TextMatrix(ytextRow, 1) = "") Or getnumber(ytextRow, 4) <> (getnumber(ytextRow, i)) Then '打√情况
msgGrid.TextMatrix(ytextRow, 1) = "√"
xx = getnumber(ytextRow, 4) - getnumber(ytextRow, i)
msgGrid.TextMatrix(ytextRow, i) = CStr(getnumber(ytextRow, i) + xx)
'总结算金额及数量的更新
frmdlSelectInvoiceIn.hLb(2).Caption = CStr(CCur(IIf(Len(frmdlSelectInvoiceIn.hLb(2).Caption) = 0, "0", frmdlSelectInvoiceIn.hLb(2).Caption)) + xx)
xx = getnumber(ytextRow, 5) - getnumber(ytextRow, k)
'if xx<0 then xx=0
msgGrid.TextMatrix(ytextRow, k) = CStr(getnumber(ytextRow, 5))
frmdlSelectInvoiceIn.hLb(3).Caption = CStr(CCur(IIf(Len(frmdlSelectInvoiceIn.hLb(3).Caption) = 0, "0", frmdlSelectInvoiceIn.hLb(3).Caption)) + xx)
Else
msgGrid.TextMatrix(ytextRow, 1) = "" '取消打√(结算)情况
frmdlSelectInvoiceIn.hLb(2).Caption = CStr(CCur(frmdlSelectInvoiceIn.hLb(2).Caption) - getnumber(ytextRow, i))
frmdlSelectInvoiceIn.hLb(3).Caption = CStr(CCur(frmdlSelectInvoiceIn.hLb(3).Caption) - getnumber(ytextRow, k))
msgGrid.TextMatrix(ytextRow, k) = ""
msgGrid.TextMatrix(ytextRow, i) = ""
End If
frmdlSelectInvoiceIn.Refresh
Else
If (msgGrid.TextMatrix(0, 1) <> "√") Then
ShowMsg frmdlSelectInvoiceIn.hWnd, ("请将结算栏放在第一列上!!"), 0, msgcaption
End If
End If
msgGrid.Refresh
End If
Exit Sub
Err:
ShowMsg Me.hWnd, "系统出错! ", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, "提示信息"
End Sub
Private Sub msgGrid_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
With msgGrid
If .MouseCol = 1 Then
.MousePointer = vbCustom
Else
.MousePointer = vbDefault
End If
End With
End Sub
'右键菜单
Private Sub msgGrid_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbRightButton Then
PopupMenu frmdlSelectInvoiceIn.menuchk, , x + 118, y + 418
End If
End Sub
'保存yText得到焦点时的数字值
Private Sub yText_GotFocus()
oldsj = CCur(IIf(Len(frmdlSelectInvoiceIn.ytext.Text) = 0, "0", frmdlSelectInvoiceIn.ytext.Text))
End Sub
'当yText失去焦点时将响应的动作
Private Sub yText_LostFocus()
Dim i As Integer, n As Integer, xx As Double, temp As Double
On Error GoTo Err
xx = CCur(IIf(Len(frmdlSelectInvoiceIn.ytext.Text) = 0, "0", frmdlSelectInvoiceIn.ytext.Text))
If (oldsj <> xx) Then
ytextRow = msgGrid.Row
ytextCol = msgGrid.Col
i = intfixl
n = intfixl
'本循环找出本次收款及本次折扣所在的列
While (msgGrid.TextMatrix(0, i) <> "已开票金额")
i = i + 1
Wend
While (msgGrid.TextMatrix(0, n) <> "已开票数量")
n = n + 1
Wend
If frmdlSelectInvoiceIn.ytext.Left > frmdlSelectInvoiceIn.cmdall(0).Left Then
frmdlSelectInvoiceIn.ytext.Text = ""
Exit Sub
End If
If (msgGrid.TextMatrix(0, ytextCol) = "已开票金额") Then
If getnumber(ytextRow, 4) > 0 Then
If getnumber(ytextRow, 4) < xx Then
xx = getnumber(ytextRow, 4) '取可核金额
End If
Else
If getnumber(ytextRow, 4) > xx Then
xx = getnumber(ytextRow, 4) '取可核金额
End If
End If
'以上为有效性检查与处理,所得xx数据应是正确的了
If xx <> 0 Then
msgGrid.TextMatrix(ytextRow, 1) = "√"
End If
frmdlSelectInvoiceIn.hLb(2).Caption = CStr(CCur(frmdlSelectInvoiceIn.hLb(2).Caption) + xx - oldsj) '更新已开票金额
'更新数组及列表的已开票金额
msgGrid.TextMatrix(ytextRow, i) = CStr(xx) '此行也许不必
frmdlSelectInvoiceIn.ytext.Text = CStr(xx)
If getnumber(ytextRow, 4) <> 0 Then
xx = (getnumber(ytextRow, i) * getnumber(ytextRow, 5)) / getnumber(ytextRow, 4) '则更新结算数量
frmdlSelectInvoiceIn.hLb(3).Caption = CStr(CCur(frmdlSelectInvoiceIn.hLb(3).Caption) + xx - getnumber(ytextRow, n)) '更新已开票数量
msgGrid.TextMatrix(ytextRow, n) = CStr(xx)
Else
ShowMsg frmdlSelectInvoiceIn.hWnd, "商品表业务表中未开票算金额应该不等于零!系统将不计算数量。" & ytextRow, 0, msgcaption
End If
frmdlSelectInvoiceIn.hLb(2).Refresh
frmdlSelectInvoiceIn.hLb(3).Refresh
Else
'输入的是已开票数量
If (msgGrid.TextMatrix(0, ytextCol) = "已开票数量") Then
If (xx > getnumber(ytextRow, 5)) And getnumber(ytextRow, 5) > 0 Then
ShowMsg frmdlSelectInvoiceIn.hWnd, "结算数量输入无效。", 0, msgcaption '恢复原结算数量
msgGrid.TextMatrix(ytextRow, n) = oldsj
Else
If (xx < getnumber(ytextRow, 5)) And getnumber(ytextRow, 5) < 0 Then
ShowMsg frmdlSelectInvoiceIn.hWnd, "结算数量输入无效。", 0, msgcaption '恢复原结算数量
msgGrid.TextMatrix(ytextRow, n) = oldsj
Else
msgGrid.TextMatrix(ytextRow, n) = CStr(xx) '此行也许不必
frmdlSelectInvoiceIn.hLb(3).Caption = CStr(CCur(frmdlSelectInvoiceIn.hLb(3).Caption) + xx - oldsj) '更新已开票数量
End If
End If
frmdlSelectInvoiceIn.hLb(3).Refresh
End If
End If
End If
Exit Sub
Err:
ShowMsg Me.hWnd, "系统出错! ", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, "提示信息"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -