九色国产,午夜在线视频,新黄色网址,九九色综合,天天做夜夜做久久做狠狠,天天躁夜夜躁狠狠躁2021a,久久不卡一区二区三区

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
VBA自定義用友報(bào)表函數(shù)
'取科目的期末值,支持未記賬取數(shù)和輔助核算,熟悉VBA設(shè)計(jì)和用友數(shù)據(jù)庫(kù)結(jié)構(gòu)的網(wǎng)友可據(jù)此開(kāi)發(fā)出更多實(shí)用的報(bào)表函數(shù)。我將其命名為UfoInExcel程序,意思是在Excel中可以像UFO一樣取數(shù),而實(shí)用性更勝于UFO,因?yàn)镋xcel的優(yōu)越性地球人都知道。
Function qm(科目代碼, 月份, Optional 年度 As String, Optional 帳套號(hào) As String, Optional 包含未記帳 As String = "Y", Optional 輔助核算方式 As String, Optional 輔助核算編碼 As String)
If 年度 > Year(Date) Then Exit Function
If 年度 = Year(Date) And 月份 >= Month(Date) Then Exit Function
Dim csqlstr As String
    qm = 0
    If Trim(科目代碼) = "" Then Exit Function
    If Trim(月份) = "" Then Exit Function
    If Trim(年度) = "" Then Exit Function
    If Trim(帳套號(hào)) = ""  Then Exit Function
    Set conn = New ADODB.Connection
    With conn
        .ConnectionString = "driver={SQL Server};server=U8SERVER;uid=sa;pwd=123456;database=UFDATA" & "_" & 帳套號(hào) & "_" & Trim(年度)
        .Open  'strConn
    End With
    If Trim(輔助核算方式) <> "" And Trim(輔助核算編碼) = "" Then
    qm = "缺少核算編碼"
    conn.Close
        Set conn = Nothing
        Exit Function
    End If
   
If UCase(Trim(包含未記帳)) = "Y" Then ''如果包含未記賬
   
    ''年初
    csqlstr = "SELECT sum((CASE WHEN cbegind_c<>'貸' THEN mb ELSE -mb End)) FROM "
    If Trim(輔助核算方式) = "" And Trim(輔助核算編碼) = "" Then
    csqlstr = csqlstr & "gl_accsum "
    Else  ''如果要取輔助核算的數(shù),要換一個(gè)數(shù)據(jù)庫(kù)
    csqlstr = csqlstr & "gl_accass "
    End If
    csqlstr = csqlstr & " WHERE iperiod = 1 and ccode = " & SqlStr(科目代碼)
    '注意輔助編碼若以0開(kāi)頭,必須加上引號(hào)
    If Trim(輔助核算方式) = "" And Trim(輔助核算編碼) = "" Then
    csqlstr = csqlstr
    ElseIf Trim(輔助核算方式) = "客戶" Then
    csqlstr = csqlstr & "and ccus_id=" & "'" & Trim(輔助核算編碼) & "'"
    ElseIf Trim(輔助核算方式) = "供應(yīng)商" Then
    csqlstr = csqlstr & "and csup_id=" & "'" & Trim(輔助核算編碼) & "'"
    ElseIf Trim(輔助核算方式) = "個(gè)人" Then
    csqlstr = csqlstr & "and cperson_id=" & "'" & Trim(輔助核算編碼) & "'"
    ElseIf Trim(輔助核算方式) = "項(xiàng)目" Then
    csqlstr = csqlstr & "and citem_id=" & "'" & Trim(輔助核算編碼) & "'"
    End If
   
    Set rst = New ADODB.Recordset
    With rst
        .ActiveConnection = conn
        .Open csqlstr
    End With
   
    If IsNumeric(rst.Fields(0).Value) = True Then
    If Left(Trim(科目代碼), 1) <> "2" And Left(Trim(科目代碼), 1) <> "3" Then
        qm = rst.Fields(0).Value
    Else
        qm = -rst.Fields(0).Value
    End If
    End If
    Set rst = Nothing
   
    ''+發(fā)生
    csqlstr = "select sum(md-mc) FROM gl_accvouch where iperiod >= 1 and iperiod <=" & 月份 & " AND iflag is null AND ccode "
    If ifbend(conn, 科目代碼) = 1 Then
    csqlstr = csqlstr & "=" & SqlStr(科目代碼)
    Else
        csqlstr = csqlstr & "like " & SqlStr(科目代碼 & "%")
    End If
       
    '注意輔助編碼若以0開(kāi)頭,必須加上引號(hào)
    If Trim(輔助核算方式) = "" And Trim(輔助核算編碼) = "" Then
    csqlstr = csqlstr
    ElseIf Trim(輔助核算方式) = "客戶" Then
    csqlstr = csqlstr & "and ccus_id=" & "'" & Trim(輔助核算編碼) & "'"
    ElseIf Trim(輔助核算方式) = "供應(yīng)商" Then
    csqlstr = csqlstr & "and csup_id=" & "'" & Trim(輔助核算編碼) & "'"
    ElseIf Trim(輔助核算方式) = "個(gè)人" Then
    csqlstr = csqlstr & "and cperson_id=" & "'" & Trim(輔助核算編碼) & "'"
    ElseIf Trim(輔助核算方式) = "項(xiàng)目" Then
    csqlstr = csqlstr & "and citem_id=" & "'" & Trim(輔助核算編碼) & "'"
    End If
   
    Set rst = New ADODB.Recordset
    With rst
        .ActiveConnection = conn
        .Open csqlstr
    End With
    If IsNumeric(rst.Fields(0).Value) = True Then
    If Left(Trim(科目代碼), 1) <> "2" And Left(Trim(科目代碼), 1) <> "3" Then
        qm = qm + rst.Fields(0).Value
    Else
        qm = qm - rst.Fields(0).Value
    End If
    End If
    Set rst = Nothing
   
Else ''如果不包含未記賬
   
    csqlstr = "SELECT SUM((CASE WHEN a.cendd_c <> '貸' THEN a.me ELSE - a.me END))" & _
              " AS SumVal " & _
              " FROM code b INNER JOIN " & _
              " gl_accass a ON b.ccode = a.ccode " & _
              " WHERE a.iperiod = " & 月份 & " AND a.ccode = " & SqlStr(科目代碼)
   
    '注意輔助編碼若以0開(kāi)頭,必須加上引號(hào)
    If Trim(輔助核算方式) = "" And Trim(輔助核算編碼) = "" Then
    csqlstr = csqlstr
    ElseIf Trim(輔助核算方式) = "客戶" Then
    csqlstr = csqlstr & "and ccus_id=" & "'" & Trim(輔助核算編碼) & "'"
    ElseIf Trim(輔助核算方式) = "供應(yīng)商" Then
    csqlstr = csqlstr & "and csup_id=" & "'" & Trim(輔助核算編碼) & "'"
    ElseIf Trim(輔助核算方式) = "個(gè)人" Then
    csqlstr = csqlstr & "and cperson_id=" & "'" & Trim(輔助核算編碼) & "'"
    ElseIf Trim(輔助核算方式) = "項(xiàng)目" Then
    csqlstr = csqlstr & "and citem_id=" & "'" & Trim(輔助核算編碼) & "'"
    End If
   
    Set rst = New ADODB.Recordset
    With rst
        .ActiveConnection = conn
        .Open csqlstr
    End With
    If IsNumeric(rst.Fields(0).Value) = True Then
    If Left(Trim(科目代碼), 1) <> "2" And Left(Trim(科目代碼), 1) <> "3" Then
        qm = rst.Fields(0).Value
    Else
        qm = -rst.Fields(0).Value
    End If
    End If
    Set rst = Nothing
End If
    conn.Close
    Set conn = Nothing
End Function
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
vb 處理數(shù)據(jù)庫(kù)重復(fù)打開(kāi)方法
備份還原 sql server 進(jìn)度條
股票類別查詢函數(shù)
用ASP實(shí)現(xiàn)支持附件的EMail系統(tǒng)
報(bào)價(jià)小程序設(shè)計(jì)第3課--密碼修改
008.計(jì)算某種稅金
更多類似文章 >>
生活服務(wù)
熱點(diǎn)新聞
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服