⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmitemdata.frm

📁 金算盘软件代码
💻 FRM
📖 第 1 页 / 共 3 页
字号:
End Sub
Private Sub cmdItemData_Click(Index As Integer)
'响应窗体按钮动作
    Dim lngID As Long
    Select Case Index
    Case 7                                    '确定存盘
        blnIsCancel = True
        If msgGrid.Rows > 1 Then
           Call FinishGrid(True)
        Else
           Unload Me
        End If
    Case 1                                    '取消
        blnIsCancel = True
        Unload Me
    Case 2                                    '筛选
        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 (110)
         mclsGrid1.ListSet.ViewId = 110
         Call RefreshGrid(False)
    Case 4                                    '关联
        With msgGrid
            If .Rows > 1 Then
                lngID = .TextMatrix(.Row, 0)
                lngID = Balance.Get_MyItemActivityID(lngID)
                If lngID > 0 Then
                    ToFormName.ShowAOldBill lngID
                Else
                    ShowMsg Me.hwnd, "该商品资料对应的采购单不存在", vbInformation, Me.Caption
                End If
            Else
                ShowMsg Me.hwnd, "无商品资料可以关联", vbInformation, Me.Caption
            End If
        End With
    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.Recordset = 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()
    msgGrid.Cols = 19
    Set mclsGrid1 = New NewGrid
    Set mclsGrid1.Grid = msgGrid
    Set mclsGrid1.Form = Me
    SetHelpID Me.hwnd, 22003
    mlngID = ToFormName.getID                               '取单据业务ID
    mlngCurrencyID = ToFormName.GetFID(7)                   '取币种ID
    mclsGrid1.ColOfs = 7
    blnIsCancel = False
    mclsGrid1.ListSet.ViewId = 110
    mlngCol = 0
    Call InitCurrency
    Call RefreshGrid(False)
    Set mclsGrid1.EditText = txtEdit
    mclsGrid1.SetEditText "销售金额"
    mclsGrid1.SetEditText "销售数量"
    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
    Set Me.Icon = Utility.GetFormResPicture(139, vbResIcon)
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
    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
Dim xx As Double
    i = intfixl + 1
    k = intfixl + 1
    '本循环找出本次收款及本次折扣所在的列
    While (msgGrid.TextMatrix(0, i) <> "销售金额")
          i = i + 1
    Wend
    While (msgGrid.TextMatrix(0, k) <> "销售数量")
          k = k + 1
    Wend
    ytextRow = 1
    With msgGrid
         If strChoose = "√" Then
            Do While ytextRow < .Rows
               .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)
                ytextRow = ytextRow + 1
            Loop
         Else
            Do While ytextRow < .Rows
              .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) = ""
                ytextRow = ytextRow + 1
            Loop
         End If
    End With
End Sub
Private Function getnumber(getx As Integer, gety As Integer) As Double
'从Flexgrid中取出数字值
    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
    mclsGrid1.ListSet.SaveList
    Filter.ShowFilter mclsGrid1.ListSet.ListID, 1
    mclsGrid1.ListSet.SaveList
    mclsGrid1.ListSet.ViewId = 110
    Call RefreshGrid(True)
End Sub

Private Sub litItemData_Choose()
'选中下拉框中币种时响应的事件
    mlngCurrencyID = Val(litItemData.TextMatrix(litItemData.ReferRow, 1))
    Call RefreshGrid(False)
End Sub
Private Sub mclsGrid1_BeforeSave(blnCancel As Boolean)
'离开TEXT输入框存盘前响应的动作
    Call SumGrid(Val(txtEdit.Text))
End Sub
Private Sub mclsGrid1_DataValid(blnCancel As Boolean)
'离开TEXT输入框时响应的事件
    Dim j 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
    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
'                .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
                mlngCol = .col
                '金额=数量*单价
                txtEdit.Text = strValue
                'strSource
               .TextMatrix(.Row, j) = Format(strValue * C2Dbl(IIf(Trim(.TextMatrix(.Row, 1)) = "", "0", .TextMatrix(.Row, 1))), "###,###,###.00")
               'Format(Val(.TextMatrix(.Row, 4)) * Val(IIf(Trim(.TextMatrix(.Row, 1)) = "", "0", .TextMatrix(.Row, 1))), "###,###,###.00")
                blnIsEdit = True
            Else
                txtEdit.Text = ""
                ShowMsg Me.hwnd, "数量金额不能大于数量金额", vbInformation, Me.Caption
                blnCancel = True
            End If
        End If
        If .TextMatrix(0, .col) = "销售金额" Then
            If Val(txtEdit.Text) > Val(.TextMatrix(.Row, 2)) Then
                blnCancel = True
                ShowMsg Me.hwnd, "销售金额不能大于销售金额", vbInformation, Me.Caption
                txtEdit.Text = .TextMatrix(.Row, 2)
            End If
            mlngCol = .col
            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 C2Dbl(txtEdit.Text) <> 0 Then
           .TextMatrix(.Row, 6) = "√"
        Else
           .TextMatrix(.Row, 6) = ""
        End If

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -