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

📄 frmdlstageissuegoods.frm

📁 金算盘软件代码
💻 FRM
📖 第 1 页 / 共 4 页
字号:
    Set mclsGrid.Form = Me
    Set bsdate = New Base
    blnIsCancel = False
    SetHelpID Me.hwnd, 10024
    hldate = bsdate.BaseDate
    mblnFormNoRezise = False
    mclsGrid.ColOfs = intfixl
    GetList
    mclsGrid.ListSetToGrid
    mclsGrid.SetupStyle
    Set mclsGrid.EditText = ytext
    mclsGrid.SetEditText ("结算数量")
    mclsGrid.SetEditText ("结算金额")
    Cmdall(7).Picture = Utility.GetFormResPicture(1001, 0)
    Cmdall(1).Picture = Utility.GetFormResPicture(1002, 0)
    Cmdall(4).Picture = Utility.GetFormResPicture(1010, 0)
    lbdw.Caption = Customernm
    Lbb(1).Caption = Currencynm
    If msgGrid.Rows > 1 Then
       msgGrid.col = 1               '对第一列进行排序
       msgGrid.ColSel = 1
       msgGrid.Row = 1
       msgGrid.RowSel = 1
       msgGrid.Sort = 6
    End If
    Set Me.Icon = Utility.GetFormResPicture(139, vbResIcon)
    mfrmToFormname.MousePointer = vbDefault
End Sub
Public Sub GivemeParameter(ToForm As Object, Optional dwID As Long = 0, Optional bzID As Long = 0, Optional ywID As Long = 0)
    Dim strTmp As String
    Dim intTmp As Integer
    CustomerID = dwID
    CurrencyID = bzID
    Set mfrmToFormname = ToForm
    mfrmToFormname.MousePointer = vbHourglass
    DetailID = mfrmToFormname.getID
    CustomerID = C2Lng(mfrmToFormname.lblHead(0).Tag)
    DispartString mfrmToFormname.lblHead(1).Caption, Currencynm, Customernm
    CurrencyID = mfrmToFormname.GetFID(7)
    Currencynm = mfrmToFormname.lblField(7).Caption
    DispartString Currencynm, strTmp, Currencynm
     CurRateDec CurrencyID, inthl, intTmp
    If CustomerID < 1 Then
       mfrmToFormname.MousePointer = vbDefault
       ShowMsg mfrmToFormname.hwnd, "请先输入单位", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, "分期发出商品"
       Exit Sub
    End If
    If CurrencyID < 1 Then
       mfrmToFormname.MousePointer = vbDefault
       ShowMsg mfrmToFormname.hwnd, "请先输入币种", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, "分期发出商品"
       Exit Sub
    End If
    isinit = True
    Show 1
End Sub


Private Sub Form_Unload(Cancel As Integer)
    mfrmToFormname.MousePointer = vbDefault
    If blnIsCancel = False And msgGrid.Rows > 1 Then
       If Balance.IsChange(msgGrid, 1) 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

    If msgGrid.Rows > 1 Then
      mclsGrid.GridToListSet
      mclsGrid.ListSet.SaveList
    End If
    Set mclsGrid = Nothing
    Set mfrmToFormname = Nothing
    Set mlhls = Nothing
'    Set bsdata = Nothing
    Utility.RemoveFormResPicture 1001
    Utility.RemoveFormResPicture 1002
    Utility.RemoveFormResPicture 1010
    
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 mclsGrid_BeforeSave(blnCancel As Boolean)
'离开TEXT输入框存盘前响应的动作
Dim str As String, p As Integer
    If msgGrid.TextMatrix(0, ytextCol) = "结算数量" Then
       ytext.Text = ""
       blnCancel = True
    Else
       If (msgGrid.TextMatrix(0, ytextCol) = "结算金额") Then
           ytext.Text = ""
           blnCancel = True
       End If
    End If
End Sub

Private Sub mclsGrid_DataValid(blnCancel As Boolean)
'离开TEXT输入框时响应的动作
Dim i As Integer, n As Integer, xx As Double, temp As Double, str As String, oldsj As Double
On Error GoTo Err
    If IsNumeric(ytext.Text) = False And Len(Trim(ytext.Text)) > 0 Then
          blnCancel = True
          Exit Sub
    End If
   ytextRow = msgGrid.Row
   ytextCol = msgGrid.col
   If (msgGrid.TextMatrix(0, ytextCol) = "结算金额" Or msgGrid.TextMatrix(0, ytextCol) = "结算数量") Then
       If IsNumeric(ytext.Text) = False Then
          blnCancel = True
          Exit Sub
       End If
       If Len(Trim(ytext.Text)) = 0 Or IsEmpty(ytext.Text) Then
          xx = 0
       Else
          xx = CDbl(ytext.Text)
       End If

       oldsj = getnumber(ytextRow, ytextCol)
       If (oldsj <> xx) Then
                i = intfixl
                n = intfixl
                      
                 '本循环找出本次调拨所在的列
           While (msgGrid.TextMatrix(0, i) <> "结算金额")
                  i = i + 1
           Wend
           While (msgGrid.TextMatrix(0, n) <> "结算数量")
                  n = n + 1
           Wend
           If (msgGrid.TextMatrix(0, ytextCol) = "结算金额") Then
                    If Abs(getnumber(ytextRow, 11)) < Abs(xx) Then
                       ShowMsg frmdlInvoice.hwnd, "结算金额不能大于可结算金额!", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, msgcaption
                       blnCancel = True
                       Exit Sub
                    End If
                      '以上为有效性检查与处理,所得xx数据应是正确的了
                   If xx <> 0 Then
                      msgGrid.TextMatrix(ytextRow, 1) = "√"
                   End If
                   hLb(i).Caption = CStr(CDbl(hLb(i).Caption) + xx - oldsj)       '更新调拨金额
                               '更新数组及列表的调拨金额
                   msgGrid.TextMatrix(ytextRow, i) = CStr(xx)          '此行也许不必
                   hLb(i).Refresh
              Else
                          '输入的是调拨数量
                   If (msgGrid.TextMatrix(0, ytextCol) = "结算数量") And getnumber(ytextRow, 43) <> 0 Then
                          str = Balance.check_modidl(CStr(xx), getnumber(ytextRow, 12), getnumber(ytextRow, 28))
                          If (str <> "A") Then
                             msgGrid.TextMatrix(ytextRow, n) = str
                             str = Balance.translate_minsl(str, getnumber(ytextRow, 28))
                             xx = getnumber(ytextRow, 44) * CDbl(str) / getnumber(ytextRow, 43)
                             xx = Format(xx, FormatString(inthl))
                            oldsj = getnumber(ytextRow, i)
                            msgGrid.TextMatrix(ytextRow, i) = CStr(xx)
                            If xx <> 0 Then
                               msgGrid.TextMatrix(ytextRow, 1) = "√"
                            End If
                            xx = xx - oldsj          '变化金额
                            hLb(i).Caption = CStr(CDbl(IIf(Len(hLb(i).Caption) = 0, "0", hLb(i).Caption)) + xx)
                         Else
                             ShowMsg Me.hwnd, "结算数量输入不正确,请重试!", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, msgcaption
                             blnCancel = True
                         End If
                       End If
            End If
       End If
 End If
 Exit Sub
Err:
    ShowMsg Me.hwnd, "数据输入与合法性校验失败,请重试!", MB_SYSTEMMODAL + MB_ICONEXCLAMATION, "分期发出商品"
    blnCancel = True
End Sub

'本函数用于做核销与非核销处理
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) And msgGrid.Rows > 1 Then
               i = intfixl
               k = intfixl
               m = i
               n = i
           '本循环找出本次收款及本次折扣所在的列
           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, 11) <> getnumber(ytextRow, i) Then          '打√情况
               msgGrid.TextMatrix(ytextRow, 1) = "√"
               xx = getnumber(ytextRow, 11) - getnumber(ytextRow, i)
               msgGrid.TextMatrix(ytextRow, i) = msgGrid.TextMatrix(ytextRow, 11)
               hLb(i).Caption = CStr(CDbl(IIf(Len(hLb(i).Caption) = 0, "0", hLb(i).Caption)) + xx)
               msgGrid.TextMatrix(ytextRow, k) = msgGrid.TextMatrix(ytextRow, 12)
           Else
               msgGrid.TextMatrix(ytextRow, 1) = ""       '取消打√(核销)情况
               hLb(i).Caption = CStr(CDbl(hLb(i).Caption) - getnumber(ytextRow, i))
               msgGrid.TextMatrix(ytextRow, k) = ""
               msgGrid.TextMatrix(ytextRow, i) = ""
           End If
           Me.Refresh
        Else
            If (msgGrid.TextMatrix(0, 1) <> "结算") Then
               ShowMsg Me.hwnd, ("请将结算栏放在第一列上!!"), MB_SYSTEMMODAL + MB_ICONEXCLAMATION, 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 And msgGrid.Rows > 1 Then
        PopupMenu Me.menuchk, , x + 118, y + 418
    End If
End Sub


Private Sub msgGrid_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    Me.Refresh
End Sub

'保存yText得到焦点时的数字值
Private Sub yText_GotFocus()
End Sub
'当yText失去焦点时将响应的动作
Private Sub yText_LostFocus()

End Sub

⌨️ 快捷键说明

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