📄 frmchecksale.frm
字号:
Call Select_Some
Case 3 '栏目设置
If msgGrid.Rows > 1 Then
If ShowMsg(Me.hwnd, "栏目设置后,你刚刚做的选择将取消,需要先存盘吗?", MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_SYSTEMMODAL, "选择销售") = IDYES Then
FinishGrid (False)
End If
mclsGrid1.GridToListSet
mclsGrid1.ListSet.SaveList
End If
mclsGrid1.ListSet.ShowListSet (115)
mclsGrid1.ListSet.ViewId = 115
Call RefreshGrid(False)
mintCloseCol = Balance.FindClosedCol(msgGrid)
Case 4 '关联
Case 5 '全部选择
Call Select_All("√")
Case 6
Call Select_All("") '全部取消
End Select
End Sub
'初始化统计金额
Private Sub inittext()
Dim intCount As Integer, dx As Double, dz As Double
Dim wjje As Double, yjje As Double, l As Integer, n As Integer
dx = 0
dz = 0
Set datItemData.Resultset = mlhls
mlhls.MoveFirst
For intCount = 1 To mlhls.RowCount
wjje = C2Dbl(mlhls.rdoColumns("未开票金额"))
yjje = C2Dbl(IIf(IsNull(mlhls.rdoColumns("开票金额")), 0, mlhls.rdoColumns("开票金额")))
dx = dx + wjje
dz = dz + yjje
mlhls.MoveNext
Next intCount
l = intfixl
n = l
While (msgGrid.TextMatrix(0, l) <> "开票金额")
l = l + 1
Wend
While (msgGrid.TextMatrix(0, n) <> "未开票金额")
n = n + 1
Wend
hlb(n).Caption = CStr(dx)
hlb(l).Caption = CStr(dz)
hlb(l).Refresh
hlb(n).Refresh
End Sub
Public Sub GivemeParameter(ToForm As Object)
Set ToFormName = ToForm
Me.Show 1
End Sub
Private Sub Form_Load()
Dim recresultset As rdoResultset
Dim Strsql As String
ToFormName.MousePointer = vbHourglass
SetHelpID Me.hwnd, 13009
mlngCustomerID = ToFormName.lblHead(0).Tag '取单位ID
mlngCurrencyID = ToFormName.GetFID(7) '取币种ID
mlngID = ToFormName.getID '取业务ID
mlngCol = 0
blnIsCancel = False
msgGrid.Cols = 19
Strsql = "SELECT strCurrencyName FROM Currencys WHERE lngCurrencyID=" & mlngCurrencyID
Set recresultset = gclsBase.BaseDB.OpenResultset(Strsql, dbOpenSnapshot)
If Not recresultset.EOF Then
lblProjectCost(1).Caption = "币种:" & recresultset!strCurrencyName
End If
recresultset.Close
Set recresultset = Nothing
Set mclsGrid1 = New NewGrid
Set mclsGrid1.Grid = msgGrid
Set mclsGrid1.Form = Me
mclsGrid1.ColOfs = intfixl
mclsGrid1.ListSet.ViewId = 115
Call InitListText
Call RefreshGrid(False)
Set mclsGrid1.EditText = txtEdit
mclsGrid1.SetEditText "开票金额", "###,###,###.00"
mclsGrid1.SetEditText "开票数量", "###,###,###.00"
Set cmdItemData(7).Picture = Utility.GetFormResPicture(1001, 0)
Set cmdItemData(1).Picture = Utility.GetFormResPicture(1002, 0)
Set cmdItemData(4).Picture = Utility.GetFormResPicture(1010, 0)
Set msgGrid.MouseIcon = Utility.GetFormResPicture(2001, 2)
If msgGrid.Rows > 1 Then
msgGrid.col = 6 '对第一列进行排序
msgGrid.ColSel = 6
msgGrid.Row = 1
msgGrid.RowSel = 1
msgGrid.Sort = 6
End If
mintCloseCol = Balance.FindClosedCol(msgGrid)
Set Me.Icon = Utility.GetFormResPicture(139, vbResIcon)
ToFormName.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
Dim leftx As Integer
If Me.WindowState = 1 Then
Exit Sub
End If
If Me.Width < 7368 Then
Me.Width = 7368
End If
msgGrid.Width = Me.ScaleWidth - DlListFormLeft - DlListFormRight * 2 - DlFormButtonWidth
If Me.Height < 4018 Then
Me.Height = 4018
End If
msgGrid.Height = Me.ScaleHeight - DlListUpAreaHeight - DlListDownAreaHeight - DlListFormBottom
leftx = Me.ScaleLeft + Me.ScaleWidth - DlFormButtonWidth - DlListFormRight + 18
cmdItemData(4).Left = leftx
cmdItemData(7).Left = leftx
cmdItemData(1).Left = leftx
cmdItemData(2).Left = leftx
cmdItemData(3).Left = leftx
' cmdItemData(4).Left = leftx
cmdItemData(5).Left = leftx
cmdItemData(6).Left = leftx
lblProjectCost(1).Left = msgGrid.Width - lblProjectCost(1).Width + 218
mclsGrid1.TotalRowAdjust
Me.Refresh
End Sub
'响应退出窗体动作
Private Sub Form_Unload(Cancel As Integer)
If blnIsCancel = False And msgGrid.Rows > 1 Then
If Balance.IsChange(msgGrid, 6) Then
If ShowMsg(Me.hwnd, "确定退出选择开票销售吗", MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_SYSTEMMODAL, "选择开票销售") = IDNO Then
Cancel = True
Exit Sub
End If
End If
End If
Utility.RemoveFormResPicture (1001)
Utility.RemoveFormResPicture (1002)
Utility.RemoveFormResPicture (1010)
Set mclsGrid1 = Nothing
Set ToFormName = Nothing
Set mlhls = Nothing
End Sub
''完全选择
Private Sub Select_All(ByVal strChoose As String)
Dim k As Integer, i As Integer, p As Integer
Dim xx As Double
i = intfixl + 1
k = intfixl + 1
p = k
'本循环找出本次收款及本次折扣所在的列
While (msgGrid.TextMatrix(0, i) <> "开票金额")
i = i + 1
Wend
While (msgGrid.TextMatrix(0, k) <> "开票数量")
k = k + 1
Wend
While (msgGrid.TextMatrix(0, p) <> "关闭")
p = p + 1
Wend
ytextRow = 1
With msgGrid
If strChoose = "√" Then
Do While ytextRow < .Rows
If .TextMatrix(ytextRow, p) <> "√" Then
.TextMatrix(ytextRow, 6) = "√"
xx = getnumber(ytextRow, 2) - getnumber(ytextRow, i)
msgGrid.TextMatrix(ytextRow, i) = msgGrid.TextMatrix(ytextRow, 2)
hlb(i).Caption = CStr(CDbl(IIf(Len(hlb(i).Caption) = 0, "0", hlb(i).Caption)) + xx)
' 'hLb(i).Caption = Format((CDbl(hLb(i).Caption) + xx), "###,###,##0.00")
msgGrid.TextMatrix(ytextRow, k) = msgGrid.TextMatrix(ytextRow, 5)
End If
ytextRow = ytextRow + 1
Loop
Else
Do While ytextRow < .Rows
If .TextMatrix(ytextRow, p) <> "√" Then
.TextMatrix(ytextRow, 6) = ""
xx = 0 - getnumber(ytextRow, i)
msgGrid.TextMatrix(ytextRow, i) = ""
hlb(i).Caption = CStr(CDbl(IIf(Len(hlb(i).Caption) = 0, "0", hlb(i).Caption)) + xx)
' 'hLb(i).Caption = Format((CDbl(hLb(i).Caption) + xx), "###,###,##0.00")
msgGrid.TextMatrix(ytextRow, k) = ""
End If
ytextRow = ytextRow + 1
Loop
End If
End With
End Sub
'从Flexgrid中取出数字值
Private Function getnumber(getx As Integer, gety As Integer) As Double
If (Len(Trim(msgGrid.TextMatrix(getx, gety))) = 0) Or IsNull(msgGrid.TextMatrix(getx, gety)) Then
getnumber = 0
Else
getnumber = CDbl(msgGrid.TextMatrix(getx, gety))
End If
End Function
'筛选
Private Sub Select_Some()
If msgGrid.Rows > 1 Then
If ShowMsg(Me.hwnd, "筛选后,你刚刚做的选择将被取消,需要先存盘吗?", MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_SYSTEMMODAL, "选择销售") = IDYES Then
FinishGrid (False)
End If
End If
If mclsGrid1.ListSet.ListID < 1 Then
mclsGrid1.ListSet.SaveList
End If
Filter.ShowFilter mclsGrid1.ListSet.ListID, 1
mclsGrid1.ListSet.SaveList
mclsGrid1.ListSet.ViewId = 115
Call RefreshGrid(True)
End Sub
'选中单位时响应的事件
Private Sub litEdit_Choose()
mlngCustomerID = Val(litEdit.TextMatrix(litEdit.ReferRow, 1))
Call RefreshGrid(False)
End Sub
Private Sub mclsGrid1_BeforeSave(blnCancel As Boolean)
'离开TEXT输入框存盘前响应的动作
Dim str As String, p As Integer
p = intfixl
While (msgGrid.TextMatrix(0, p) <> "关闭")
p = p + 1
Wend
If ytextRow > 0 Then
If msgGrid.TextMatrix(ytextRow, p) = "√" Then
txtEdit.Text = ""
blnCancel = True
Else
Call SumGrid(Val(txtEdit.Text))
End If
End If
End Sub
Private Sub mclsGrid1_DataValid(blnCancel As Boolean)
'离开TEXT输入框时响应的动作
Dim j As Integer, p As Integer
Dim blnIsEdit As Boolean
Dim strValue As String
Dim strSource As String
Dim dblInVoice As Double
Dim dblItran As Double
Dim str As String
blnIsEdit = False
If IsNumeric(txtEdit.Text) = False And Len(Trim(txtEdit.Text)) > 0 Then
blnCancel = True
Exit Sub
End If
ytextRow = msgGrid.Row
ytextCol = msgGrid.col
p = intfixl
While (msgGrid.TextMatrix(0, p) <> "关闭")
p = p + 1
Wend
If ytextRow > 0 Then
If msgGrid.TextMatrix(ytextRow, p) = "√" Then
txtEdit.Text = ""
ShowMsg Me.hwnd, "本记录已作上禁止开票标志,不允许开票 ", vbInformation, Me.Caption
Exit Sub
End If
End If
With msgGrid
If .TextMatrix(0, .col) = "开票数量" And (Len(Trim(txtEdit.Text)) > 0 Or (Len(Trim(txtEdit.Text)) = 0 And Len(Trim(.TextMatrix(.Row, .col))) > 0)) Then
dblInVoice = C2Dbl(.TextMatrix(.Row, 5))
strSource = txtEdit.Text
dblItran = C2Dbl(.TextMatrix(.Row, 3))
' strSource = Balance.intTodec(Val(strSource), dblItran, False)
strValue = Balance.check_modidl(strSource, dblInVoice, dblItran)
If Len(strValue) > 0 And strValue <> "A" Then
mlngCol = .col
' .TextMatrix(.Row, 4) = Balance.translate_minsl(strSource, dblItran)
' strValue = Balance.intTodec(Val(.TextMatrix(.Row, 4)), dblItran, False)
For j = 6 To .Cols - 1 Step 1
If .TextMatrix(0, j) = "开票金额" Then
Exit For
End If
Next j
'金额=数量*单价
txtEdit.Text = strValue
'strSource
.TextMatrix(.Row, j) = Format(strValue * C2Dbl(IIf(Trim(.TextMatrix(.Row, 1)) = "", "0", .TextMatrix(.Row, 1))), "###,###,###.00")
blnIsEdit = True
Else
ShowMsg Me.hwnd, "开票数量输入不正确 ", vbInformation, Me.Caption
' txtEdit.Text = ""
blnCancel = True
End If
End If
If .TextMatrix(0, .col) = "开票金额" Then
mlngCol = .col
If Val(txtEdit.Text) > Val(.TextMatrix(.Row, 2)) Then
blnCancel = True
ShowMsg Me.hwnd, "开票金额不能大于未开票金额", vbInformation, Me.Caption
txtEdit.Text = .TextMatrix(.Row, 2)
End If
blnIsEdit = True
txtEdit.Text = Format(txtEdit.Text, "###,###,###.00")
End If
' If Val(.TextMatrix(.Row, .col)) > 0 Or (Val(.TextMatrix(.Row, .col)) = 0 And Val(txtEdit.Text) > 0) And blnIsEdit Then
' .TextMatrix(.Row, 6) = ""
' End If
If CDbl(txtEdit.Text) <> 0 Then
.TextMatrix(.Row, 6) = "√"
Else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -