-
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:7k
源码类别:

企业管理

开发平台:

Visual Basic

  1. Attribute VB_Name = "XtsyModule"
  2. '系统私有模块用来放置一些子系统独有的过程与函数
  3. Public str_Code As String                               '存储列内容参数
  4. '银行对帐公共变量
  5. Public Type Glo_Yhdz
  6.     Unload_TF As Boolean     '窗体是否卸载
  7.     YH_XTXZ  As String       '银行窗体选择
  8. End Type
  9. Public Glo_Variable As Glo_Yhdz     '银行对帐变量
  10. Public Glo_VouchSource As String          '凭证来源,转帐中用的公用变量
  11. Public Glo_FormulaString As String
  12. Public CZ_CenterCode As String                          '成本中心参照
  13. Public Glo_NonceCenter As String                        '当前成本中心
  14. Public Glo_NonceItem As String                          '当前成本项目
  15. Public Glo_Year As Integer
  16. Public Glo_Period As Integer
  17. Type Glo_ObjectId
  18.     ONum() As String
  19.     OId() As String
  20. End Type
  21. Public Glo_ObjectId1 As Glo_ObjectId
  22. Public Sub Drxtztcs()                                   '读入系统帐套参数
  23.     
  24.     Dim Ztcsbrec As New ADODB.Recordset
  25.     Dim RecTemp As New ADODB.Recordset
  26.     Dim Sqlstr As String
  27.     
  28.     
  29.     Sqlstr = "Select ForeignCurrCode,ForeignCurrName from Gy_ForeignCurrency where StandardFlag=1"
  30.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  31.     XtSCurrCode = Trim(RecTemp.Fields("ForeignCurrCode"))
  32.     XtSCurrName = Trim(RecTemp.Fields("ForeignCurrName"))
  33.     
  34.     With Ztcsbrec
  35.         '金额总位数
  36.         .Open "Select * From Gy_AccInformation Where SystemCode='cwzz'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  37.         .MoveFirst
  38.         .Find "itemcode='cwjezws'"
  39.         If Not Ztcsbrec.EOF Then
  40.             Xtjezws = Val(Trim(Ztcsbrec.Fields("itemvalue")))
  41.         End If
  42.         
  43.         '数量总位数
  44.         .MoveFirst
  45.         .Find "itemcode='cwslzws'"
  46.         If Not Ztcsbrec.EOF Then
  47.             Xtslzws = Val(Trim(Ztcsbrec.Fields("itemvalue")))
  48.         End If
  49.         
  50.         '单价总位数
  51.         .MoveFirst
  52.         .Find "itemcode='cwdjzws'"
  53.         If Not Ztcsbrec.EOF Then
  54.             Xtdjzws = Val(Trim(Ztcsbrec.Fields("itemvalue")))
  55.         End If
  56.         
  57.         '金额小数位数
  58.         .MoveFirst
  59.         .Find "itemcode='cwjexsws'"
  60.         If Not Ztcsbrec.EOF Then
  61.             Xtjexsws = Val(Trim(Ztcsbrec.Fields("itemvalue")))
  62.         End If
  63.         
  64.         '数量小数位数
  65.         .MoveFirst
  66.         .Find "itemcode='cwslxsws'"
  67.         If Not Ztcsbrec.EOF Then
  68.             Xtslxsws = Val(Trim(Ztcsbrec.Fields("itemvalue")))
  69.         End If
  70.         
  71.         '单价小数位数
  72.         .MoveFirst
  73.         .Find "itemcode='cwdjxsws'"
  74.         If Not Ztcsbrec.EOF Then
  75.             Xtdjxsws = Val(Trim(Ztcsbrec.Fields("itemvalue")))
  76.         End If
  77.         .Close
  78.     End With
  79.     
  80. End Sub
  81. Public Function Fn_Replace(SourceStr As String, int_Book As Integer) As String     '替代用户自定义公式字符串
  82.     
  83.     Dim rs_fn As New ADODB.Recordset
  84.     Dim Sqlstr As String
  85.     Dim i As Integer
  86.     Dim j As Integer
  87.     
  88.     SourceStr = Replace(SourceStr, "本年", Xtyear)
  89.     SourceStr = Replace(SourceStr, "本月", Xtmm)
  90.     
  91.     
  92.     Sqlstr = "select FnAlias, FnName,fnflag from cwzz_UserDefineFn where fnflag>0"
  93.     Set rec_fn = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  94.     
  95.     With rec_fn
  96.         Do While Not .EOF
  97.             Select Case .Fields("fnflag")
  98.             Case 9
  99.                 i = 1
  100.                 Do While InStr(i, SourceStr, Trim(.Fields("fnalias"))) <> 0
  101.                     
  102.                     i = InStr(i, SourceStr, Trim(.Fields("fnalias")))
  103.                     j = InStr(i, SourceStr, ")")
  104.                     
  105.                     SourceStr = Mid(SourceStr, 1, j - 1) & "," & CStr(int_Book) & Mid(SourceStr, j, Len(SourceStr) - j + 1)
  106.                     i = j
  107.                 Loop
  108.                 
  109.             End Select
  110.             .MoveNext
  111.         Loop
  112.     End With
  113.     
  114.     If rec_fn.RecordCount <> 0 Then rec_fn.MoveFirst
  115.     
  116.     With rec_fn
  117.         Do While Not .EOF
  118.             SourceStr = Replace(SourceStr, Trim(.Fields("fnalias")), Trim(.Fields("fnname")))
  119.             .MoveNext
  120.         Loop
  121.     End With
  122.     Fn_Replace = SourceStr
  123.     
  124. End Function
  125. Public Sub fill_tv(tv As TreeView, flbm As ADODB.Recordset, field1 As String, field2 As String, field3 As String, bmjc_bz As Boolean, tree_name As String, Treeprant As String, Treechr As String)
  126. '---------------------------------------------
  127. '填充TREEVIEW
  128. Dim fllb, lsbl(), lsbl1(), remlayer, nodX, tem, count
  129.    On Error GoTo ERRORCL
  130.     tv.Nodes.Clear
  131.     flbm.Requery
  132.     If flbm.EOF Then
  133.         Set nodX = tv.Nodes.Add(, 4, "r", tree_name, Treeprant)
  134.         Exit Sub
  135.     Else
  136.         Set nodX = tv.Nodes.Add(, 4, "r", tree_name, Treeprant)
  137.     End If
  138.     flbm.MoveFirst
  139.     count = 1
  140.     If bmjc_bz Then
  141.         Do While Not flbm.EOF
  142.              fllb = "(" + Trim(flbm.Fields(field1)) + ")" + Trim(flbm.Fields(field2))
  143.              remlayer = flbm.Fields("code_level")
  144.              tem = Trim(flbm.Fields(field3))
  145.              Select Case remlayer
  146.                Case 1
  147.                   ReDim Preserve lsbl(remlayer)
  148.                   ReDim Preserve lsbl1(remlayer)
  149.                   lsbl(remlayer) = "p" & tem
  150.                   Set nodX = tv.Nodes.Add("r", 4, lsbl(remlayer), fllb, Treechr)
  151.                   tv.Nodes(count).Expanded = True
  152.                Case 2
  153.                    ReDim Preserve lsbl1(remlayer)
  154.                    ReDim Preserve lsbl1(remlayer)
  155.                   lsbl1(remlayer) = "p" & tem
  156.                   Set nodX = tv.Nodes.Add(lsbl(remlayer - 1), tvwChild, lsbl1(remlayer), fllb, Treechr)
  157.                Case 3
  158.                    ReDim Preserve lsbl(remlayer)
  159.                    ReDim Preserve lsbl1(remlayer)
  160.                   lsbl(remlayer) = lsbl1(remlayer - 1)
  161.                   lsbl1(remlayer) = "p" & tem
  162.                   Set nodX = tv.Nodes.Add(lsbl(remlayer), tvwChild, lsbl1(remlayer), fllb, Treechr)
  163.                Case Else
  164.                    ReDim Preserve lsbl(remlayer)
  165.                    ReDim Preserve lsbl1(remlayer)
  166.                   lsbl(remlayer) = lsbl1(remlayer - 1)
  167.                   lsbl1(remlayer) = "p" & tem
  168.                   Set nodX = tv.Nodes.Add(lsbl(remlayer), tvwChild, lsbl1(remlayer), fllb, Treechr)
  169.                End Select
  170.               count = count + 1
  171.               flbm.MoveNext
  172.         Loop
  173.     Else
  174.         Do While Not flbm.EOF
  175.             fllb = "(" + Trim(flbm.Fields(field1)) + ")" + Trim(flbm.Fields(field2))
  176.             tem = Trim(flbm.Fields("flbm"))
  177.             lsbl(remlayer) = "p" & tem
  178.             Set nodX = tv.Nodes.Add(, 4, lsbl(remlayer), fllb)
  179.             flbm.MoveNext
  180.         Loop
  181.     End If
  182.     Exit Sub
  183. ERRORCL:
  184.     MsgBox "程序出现错误", vbExclamation, Title_Bar
  185.     Exit Sub
  186. End Sub