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

📄 mdlzz.bas

📁 u8
💻 BAS
📖 第 1 页 / 共 3 页
字号:
         If Not IsNull(citem_class) Then
            sqlQc = sqlQc & " And citem_class = '" & citem_class & "'"
         End If
         
         Set rsQc = dbsZJ.OpenRecordset(sqlQc, dbOpenSnapshot)
         If Not rsQc.EOF Then
            GetKmQC_Fz = IIf(IsNull(rsQc!QcMb), 0, rsQc!QcMb)
         End If
         
   End If
'   Set rsQc = dbsZJ.OpenRecordset(sqlQc, dbOpenSnapshot)
'   If Not rsQc.EOF Then
'      GetKmQC_Fz = IIf(IsNull(rsQc!QcMb), 0, rsQc!QcMb)
'   End If
   
End Function

'********************************************************************
'*函数说明: 取出科目期初余额-纯科目                                    *
'*参    数: cCode         科目编码                                    *
'*          blnPrpty      科目属性                                    *
'*返回值  : 科目期初余额                                               *
'*********************************************************************
'Public Function GetKmQC(cCode As String, blnPrpty As Boolean) As Double                                            'cuidong 对账单+外币 2001.12.04
Public Function GetKmQC(cCode As String, blnPrpty As Boolean, Optional ByVal bMoney_F As Boolean = False) As Double 'cuidong 对账单+外币 2001.12.04
   Dim sqlQc As String
   Dim rsQc As New UfRecordset
   
   GetKmQC = 0
   If bMoney_F Then                                                                    'cuidong 对账单+外币 2001.12.04
      sqlQc = "SELECT Sum(Case When cbegind_c = '借' Then mb_f Else -mb_f End) AS QcMb FROM GL_accsum " & _
              "WHERE ccode = '" & cCode & "' AND iPeriod = " & ZjAccInfo.GLBeginPeriod 'cuidong 对账单+外币 2001.12.04
   Else                                                                                'cuidong 对账单+外币 2001.12.04
      sqlQc = "SELECT Sum(Case When cbegind_c = '借' Then mb Else -mb End) AS QcMb FROM GL_accsum " & _
              "WHERE ccode = '" & cCode & "' AND iPeriod = " & ZjAccInfo.GLBeginPeriod
   End If                                                                              'cuidong 对账单+外币 2001.12.04
   Set rsQc = dbsZJ.OpenRecordset(sqlQc, dbOpenSnapshot)
   If Not rsQc.EOF Then
      GetKmQC = IIf(IsNull(rsQc!QcMb), 0, rsQc!QcMb)
   End If
End Function

'********************************************************************
'*函数说明: 取出科目性质(来源类或占用类)和币别                         *
'*参    数: cCode         科目编码                                    *
'*                                                                   *
'*返回值  : 科目性质                                                *
'*********************************************************************
Public Function GetKmPropty(cCode As String) As Boolean
   Dim sqlPropty As String
   Dim rsPropty As New UfRecordset
   
   sqlPropty = "SELECT bproperty, cexch_name FROM code WHERE ccode = '" & cCode & "'"
   Set rsPropty = dbsZJ.OpenRecordset(sqlPropty, dbOpenSnapshot)
   If Not rsPropty.EOF Then
      GetKmPropty = rsPropty!bProperty
   End If
End Function

'********************************************************************
'*函数说明: 取出项目币别                                             *
'*参    数: iItem_id         项目编码                                 *
'*                                                                   *
'*返回值  : 币别                                                  *
'*********************************************************************
Public Function GetExch(ByVal iItem_id As String) As String
   Dim sqlX As String
   Dim rsX As New UfRecordset
   
   GetExch = ""
   sqlX = "SELECT Count(cexch_name) AS iExch, cexch_name AS cExch FROM FD_AccDef " & _
      "WHERE cAccID IN (SELECT ccode FROM FD_Itemss WHERE iitem_id=" & iItem_id & _
      ") GROUP BY cexch_name"
   Set rsX = dbsZJ.OpenRecordset(sqlX, dbOpenSnapshot)
   If Not rsX.EOF Then
      rsX.MoveLast
      If rsX.RecordCount > 1 Then Exit Function
      rsX.MoveFirst
      GetExch = rsX!cExch
   End If
End Function

'********************************************************************
'*函数说明: 取出项目中包含项目的类型                                  *
'*参    数: iItem_id         项目编码                                 *
'*                                                                   *
'*返回值  : 1-资金类;2-账务类;3-均包括                               *
'*********************************************************************
Public Function GetZhStyle(iItem_id As String) As Byte
   Dim sqlX As String
   Dim rsX As New UfRecordset
   
   sqlX = "SELECT iDataSrc, Count(cAccID) AS AccID FROM FD_AccDef " & _
            "WHERE cAccID IN (SELECT ccode FROM FD_Itemss " & _
            "WHERE iitem_id=" & iItem_id & ") GROUP BY iDataSrc"
   Set rsX = dbsZJ.OpenRecordset(sqlX, dbOpenSnapshot)
   GetZhStyle = 0
   While Not rsX.EOF
      If rsX!iDataSrc = 0 Then GetZhStyle = GetZhStyle + 1
      If rsX!iDataSrc = 1 Then GetZhStyle = GetZhStyle + 2
      rsX.MoveNext
   Wend

End Function

'********************************************************************
'*函数说明: 取出账户币别                                             *
'*参    数: strZhID         账户号                                   *
'*                                                                   *
'*返回值  : 币别                                                      *
'*********************************************************************
Public Function GetzhExch(strZhID As String) As String
   Dim sqlZhExch As String
   Dim rsZhExch As New UfRecordset
   
   GetzhExch = ""
   sqlZhExch = "SELECT cexch_name FROM FD_AccDef WHERE cAccID = '" & strZhID & "'"
   Set rsZhExch = dbsZJ.OpenRecordset(sqlZhExch, dbOpenSnapshot)
   If Not rsZhExch.EOF Then
      GetzhExch = rsZhExch!cexch_name
   End If
End Function

'********************************************************************
'*函数说明: 取出账户余额                                             *
'*参    数: strZhID         账户号                                   *
'*          dDate           日期                                     *
'*返回值  : 账户余额                                                  *
'*********************************************************************
Public Function GetZhYe(strZhID As String, dDate As Date, Optional IncludeUnCheck As Boolean = False) As Double
   Dim sqlYe      As String
   Dim rsYe       As New UfRecordset
   Dim strDate    As String
   Dim strBdate   As String
   Dim oOption    As COption
   Dim strStartDate As String
   
   Set oOption = New COption
   oOption.Init dbsZJ
   strDate = FormatDate(dDate)
   strBdate = FormatDate(oOption.Option1)
   strStartDate = FormatDate(ZjAccInfo.zjStartdate)
   
'   sqlYe = "SELECT Sum(mmoney) AS Mye FROM FD_Cred WHERE cAccID='" & _
'         strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_Return WHERE " & _
'         "cAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_CreAcrRcp WHERE " & _
'         "cAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(mmoney) FROM FD_UnwDeb WHERE " & _
'         "cGAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_UnwDeb WHERE " & _
'         "cPAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(mmoney) FROM FD_UnwRet WHERE " & _
'         "cGAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_UnwRet WHERE " & _
'         "cPAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(mmoney) FROM FD_UnwAcrRcp WHERE " & _
'         "cGAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_UnwAcrRcp WHERE " & _
'         "cPAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(mmoney) FROM FD_SettAcc WHERE " & _
'         "cGAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' AND Left(cSetID,2)='15' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_SettAcc WHERE " & _
'         "cPAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' AND Left(cSetID,2)='15' And dbill_date >= '" & strBdate & "' "
'
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(case when igp_flag=0 then mmoney else -mmoney end) FROM FD_SettAcc WHERE " & _
'         "cGAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' AND Left(cSetID,2)='14' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(case when igp_flag=0 then mmoney else -mmoney end) FROM FD_SettAcc WHERE " & _
'         "cPAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' AND Left(cSetID,2)='14' And dbill_date >= '" & strBdate & "' "
'
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(mmoney) FROM FD_CadAcr WHERE " & _
'         "cGAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' " & _
'         "AND iDanType=0 And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_CadAcr WHERE " & _
'         "cPAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' " & _
'         "AND iDanType=0 And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(mmoney) FROM FD_Sav WHERE " & _
'         "cAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
'   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_Fetch WHERE " & _
'         "cAccID='" & strZhID & "' AND dbill_date<'" & strDate & "' And dbill_date >= '" & strBdate & "' "
If IncludeUnCheck Then
   sqlYe = "SELECT Sum(mmoney) AS Mye FROM FD_Cred WHERE cAccID='" & _
         strZhID & "' AND dbill_date<='" & strDate & "' And dbill_date>='" & strStartDate & "' "
   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_Return WHERE " & _
         "cAccID='" & strZhID & "' AND dbill_date<='" & strDate & "' And dbill_date>='" & strStartDate & "' "
   sqlYe = sqlYe & "UNION ALL SELECT Sum(-mmoney) FROM FD_CreAcrRcp WHERE " & _
         "cAccID='" & strZhID & "' AND dbill_date<='" & strDate & "' And dbill_date>='" & strStartDate & "' "
   sqlYe = sqlYe & "UNION ALL SELECT Sum(mmoney) FROM FD_UnwDeb WHERE " & _
         "cGAccID='" & strZhID & "' AND dbill_date<='" & strDate & "' And dbill_date>='" & strStartDate & "' "

⌨️ 快捷键说明

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