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

📄 frmaccountinit.frm

📁 金算盘软件代码
💻 FRM
📖 第 1 页 / 共 5 页
字号:
VERSION 5.00
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form frmAccountInit 
   Caption         =   "科目期初余额"
   ClientHeight    =   4065
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8445
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   4065
   ScaleWidth      =   8445
   Begin VB.PictureBox picInit 
      BackColor       =   &H80000005&
      Height          =   2595
      Left            =   210
      ScaleHeight     =   2535
      ScaleWidth      =   4425
      TabIndex        =   15
      Top             =   600
      Width           =   4485
   End
   Begin VB.CommandButton cmdAccountInit 
      Height          =   375
      Index           =   3
      Left            =   2505
      Style           =   1  'Graphical
      TabIndex        =   7
      Tag             =   "1012"
      Top             =   3600
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.CommandButton cmdAccountInit 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Index           =   2
      Left            =   5640
      Style           =   1  'Graphical
      TabIndex        =   4
      Tag             =   "1017"
      ToolTipText     =   "再找"
      Top             =   100
      UseMaskColor    =   -1  'True
      Width           =   300
   End
   Begin VB.CommandButton cmdAccountInit 
      Caption         =   "试算平衡(&Q)"
      Height          =   375
      Index           =   1
      Left            =   1280
      TabIndex        =   6
      Top             =   3600
      Width           =   1215
   End
   Begin VB.CommandButton cmdAccountInit 
      Caption         =   "筛 选"
      Height          =   375
      Index           =   0
      Left            =   50
      TabIndex        =   5
      Top             =   3600
      Width           =   1215
   End
   Begin VB.ComboBox cboFind 
      Height          =   300
      Left            =   840
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   120
      Width           =   1600
   End
   Begin VB.TextBox txtFind 
      Height          =   300
      Left            =   3930
      TabIndex        =   3
      Top             =   120
      Width           =   2175
   End
   Begin VB.Label Label1 
      Caption         =   "辅助科目"
      Height          =   195
      Index           =   7
      Left            =   6420
      TabIndex        =   14
      Top             =   3720
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "末级科目"
      Height          =   195
      Index           =   6
      Left            =   5460
      TabIndex        =   13
      Top             =   3720
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "非末级科目"
      Height          =   195
      Index           =   5
      Left            =   4320
      TabIndex        =   12
      Top             =   3720
      Width           =   915
   End
   Begin VB.Label Label1 
      BackColor       =   &H00C0FFFF&
      Height          =   135
      Index           =   4
      Left            =   6240
      TabIndex        =   11
      Top             =   3720
      Width           =   135
   End
   Begin VB.Label Label1 
      BackColor       =   &H80000005&
      Height          =   135
      Index           =   3
      Left            =   5280
      TabIndex        =   10
      Top             =   3720
      Width           =   135
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFF00&
      Height          =   135
      Index           =   2
      Left            =   4140
      TabIndex        =   9
      Top             =   3720
      Width           =   135
   End
   Begin MSForms.CheckBox chkAccountInit 
      Height          =   255
      Left            =   7140
      TabIndex        =   8
      Top             =   3660
      Width           =   1275
      BackColor       =   -2147483633
      ForeColor       =   -2147483630
      DisplayStyle    =   4
      Size            =   "2249;450"
      Value           =   "0"
      Caption         =   "编辑列锁定"
      FontName        =   "宋体"
      FontHeight      =   180
      FontCharSet     =   134
      FontPitchAndFamily=   34
   End
   Begin VB.Label Label1 
      Caption         =   "内容(&C)"
      Height          =   255
      Index           =   1
      Left            =   3200
      TabIndex        =   2
      Top             =   150
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "查找(&B)"
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   150
      Width           =   735
   End
End
Attribute VB_Name = "frmAccountInit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Compare Text
Private WithEvents mclsMainControl As MainControl               '主控对象
Attribute mclsMainControl.VB_VarHelpID = -1
Private mclsListSet As ListSet                                  '列表设置对象

Private mintYear As Integer, mbytPeriod As Byte                 '会计年度,会计期间
Private mstrDate As String                                      '会计年度第一天
Private mstrQuantityDec As String                               '数量小数位数格式化字符串
Private mstrDec As String                                       '本位币小数位数格式化字符串

Private mblnClose As Boolean                                    '结帐标志
Private mintCol As Integer, mlngRow As Long                     '录入框所在行,列
Private mintStart As Integer
Private mblnIsArrow As Boolean
Private Const lngViewId As Long = 95                            '科目期初视图ID
Private mstrWhere As String                                     '筛选条件
Private mblnFinish As Boolean
Private mintOldRow As Integer
Private WithEvents mGrid As WINCTRLLib.DBGridCtrl
Attribute mGrid.VB_VarHelpID = -1
Private mrstData As rdoResultset
Private mlngLastPosition As Long                                '上次记录集位置
Private mblnNotFind As Boolean
Private mblnLoad As Boolean

'得到会计年度及会计期间
Private Function GetYearPeriod()
    mstrDec = IIf(gclsBase.NaturalCurDec = 0, "#,###,###,###", "#,###,###,##0." + String(gclsBase.NaturalCurDec, "0"))
    mstrQuantityDec = IIf(gclsBase.QuantityDec = 0, "#,###,###,###", "#,###,###,##0." + String(gclsBase.QuantityDec, "0"))
    mintYear = gclsBase.BeginYear
    mbytPeriod = gclsBase.BeginPeriod
    mstrDate = Format(DateAdd("D", -1, gclsBase.BeginDate), "yyyy-mm-dd")
    mblnClose = gclsBase.PeriodIsClosed(mintYear, mbytPeriod)
End Function

'得到科目期初列表记录集
Private Sub GetList()
  Dim strSql As String, strWhere As String
  Dim strGroup As String, strOrder As String, strSelect As String

    mGrid.Clear
'    If mstrWhere = "" Then
'       strWhere = " And (strDate<'" & gclsBase.BeginDate & "' OR strDate Is Null Or ((Not strDate Is Null) And (dblPostedDebit=0 And dblPostedCredit=0 And dblQuantityPostedDebit=0 And dblQuantityPostedCredit=0))) "
'    Else
'       strWhere = " And (strDate<'" & gclsBase.BeginDate & "' OR strDate Is Null Or ((Not strDate Is Null) And (dblPostedDebit=0 And dblPostedCredit=0 And dblQuantityPostedDebit=0 And dblQuantityPostedCredit=0))) And (" & mstrWhere & ")"
'    End If

    strGroup = " GROUP BY Account.strAccountCode, strAccountName, intDirection, strCurrencyCode, strCurrencyName, strQuantityUnit,WrAcntCurrency.CurrencyID "
    strOrder = " Order BY 科目编码, 科目名称,币种ID"
    
    If gclsBase.BeginDate = gclsBase.FirstDate Then
       strSelect = " Max(Account.lngAccountID) as ID,Account.strAccountCode AS 科目编码, Account.strAccountName AS 科目名称," & _
                 "Decode(intDirection,1,'借','贷') AS 方向, Decode(WrAcntCurrency.CurrencyID,-1,'本位币',Decode(Decode(WrAcntCurrency.CurrencyID," & gclsBase.NaturalCurId & ",1,0)* Decode(Max(Account.blnIsMultCurrency)+Max(Account.blnIsAllCurrency),0,1,0),0,strCurrencyCode || ' ' || strCurrencyName,'')) AS 币种," & _
                 "strQuantityUnit AS 计量单位," & _
                 "Decode(Max(Account.blnIsMultCurrency)+Max(Account.blnIsAllCurrency),0,'-',Decode(Decode(WrAcntCurrency.CurrencyID,-1,0,1)* Decode(WrAcntCurrency.CurrencyID,1,0,1),0,'',Decode(Sign(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,(dblCurrencyPostedDebit-dblCurrencyPostedCredit)*Account.intDirection,0))),0,'',To_char(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,(dblCurrencyPostedDebit-dblCurrencyPostedCredit)*Account.intDirection,0)),Decode(Max(Currencys.bytCurrencyDec),0,'9,999,999,999','9,999,999,990.'|| String1(Max(bytCurrencyDec),'0')))))) AS 年初余额1," & _
                 "Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,(dblPostedDebit-dblPostedCredit)*Account.intDirection,0)) AS 年初余额2," & _
                 "Decode(Max(Account.blnIsQuantity)*Max(Account.blnIsDetail),1,To_Char(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,(dblQuantityPostedDebit-dblQuantityPostedCredit)*Account.intDirection,0))),'-') AS 年初余额3," & _
                 "'' AS 借方累计1,'' AS 借方累计2,'' AS 借方累计3," & _
                 "'' AS 贷方累计1,'' AS 贷方累计2,'' AS 贷方累计3," & _
                 "'' AS 期初余额1,'' AS 期初余额2,'' AS 期初余额3," & _
                 "Max(Currencys.bytCurrencyDec) AS CurencyDec," & _
                 "Decode(Max(Account.blnIsDetail),0,Decode(Min(Account.blnIsMultCurrency)+Min(Account.blnIsAllCurrency),0,1,4),Decode(Max(Account.blnIsMultCurrency)+Max(Account.blnIsAllCurrency),1,Decode(Sign(Max(Account.blnIsCustomer)+Max(Account.blnIsDepartment)+Max(Account.blnIsEmployee)+Max(Account.blnIsClass1)+Max(Account.blnIsClass2)),1,5,Decode(WrAcntCurrency.CurrencyID,-1,4,6)),Decode(Sign(Max(Account.blnIsCustomer)+Max(Account.blnIsDepartment)+Max(Account.blnIsEmployee)+Max(Account.blnIsClass1)+Max(Account.blnIsClass2)),1,2,3))) As 标志," & _
                 "Max(Account.intLevel) As 级数,Max(Account.blnIsInActive),Max(Currencys.lngCurrencyID) as CurrencyID,WrAcntCurrency.CurrencyID As 币种ID "
    Else
        strSelect = " Max(Account.lngAccountID) as ID,Account.strAccountCode AS 科目编码, Account.strAccountName AS 科目名称," & _
                 "Decode(intDirection,1,'借','贷') AS 方向, Decode(WrAcntCurrency.CurrencyID,-1,'本位币',Decode(Decode(WrAcntCurrency.CurrencyID," & gclsBase.NaturalCurId & ",1,0)* Decode(Max(Account.blnIsMultCurrency)+Max(Account.blnIsAllCurrency),0,1,0),0,strCurrencyCode || ' ' || strCurrencyName,'')) AS 币种," & _
                 "strQuantityUnit AS 计量单位," & _
                 "Decode(Max(Account.blnIsMultCurrency)+Max(Account.blnIsAllCurrency),0,'-',Decode(Decode(WrAcntCurrency.CurrencyID,-1,0,1)* Decode(WrAcntCurrency.CurrencyID,1,0,1),0,'',Decode(Sign(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,(dblCurrencyPostedDebit-dblCurrencyPostedCredit)*Account.intDirection,0))),0,'',To_char(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,(dblCurrencyPostedDebit-dblCurrencyPostedCredit)*Account.intDirection,0)),Decode(Max(Currencys.bytCurrencyDec),0,'9,999,999,999','9,999,999,990.'|| String1(Max(bytCurrencyDec),'0')))))) AS 年初余额1," & _
                 "Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,(dblPostedDebit-dblPostedCredit)*Account.intDirection,0)) AS 年初余额2," & _
                 "Decode(Max(Account.blnIsQuantity)*Max(Account.blnIsDetail),1,To_Char(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,(dblQuantityPostedDebit-dblQuantityPostedCredit)*Account.intDirection,0))),'-') AS 年初余额3," & _
                 "Decode(Max(Account.blnIsMultCurrency)+Max(Account.blnIsAllCurrency),0,'-',Decode(Decode(WrAcntCurrency.CurrencyID,-1,0,1)* Decode(WrAcntCurrency.CurrencyID,1,0,1),0,'',Decode(Sign(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,0,dblCurrencyPostedDebit))),1,To_char(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,0,dblCurrencyPostedDebit)),Decode(Max(Currencys.bytCurrencyDec),0,'9,999,999,999','9,999,999,990.'|| String1(Max(bytCurrencyDec),'0'))),''))) AS 借方累计1," & _
                 "Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,0,dblPostedDebit)) AS 借方累计2," & _
                 "Decode(Max(Account.blnIsQuantity)*Max(Account.blnIsDetail),1,To_Char(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,0,dblQuantityPostedDebit))),'-') AS 借方累计3," & _
                 "Decode(Max(Account.blnIsMultCurrency)+Max(Account.blnIsAllCurrency),0,'-',Decode(Decode(WrAcntCurrency.CurrencyID,-1,0,1)* Decode(WrAcntCurrency.CurrencyID,1,0,1),0,'',Decode(Sign(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,0,dblCurrencyPostedCredit))),1,To_char(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,0,dblCurrencyPostedCredit)),Decode(Max(Currencys.bytCurrencyDec),0,'9,999,999,999','9,999,999,990.'|| String1(Max(bytCurrencyDec),'0'))),''))) AS 贷方累计1," & _
                 "Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,0,dblPostedCredit)) AS 贷方累计2," & _
                 "Decode(Max(Account.blnIsQuantity)*Max(Account.blnIsDetail),1,To_Char(Sum(Decode(Sign(To_Date(strDate,'yyyy-mm-dd')-To_Date('" & gclsBase.FirstDate & "','yyyy-mm-dd')),-1,0,dblQuantityPostedCredit))),'-') AS 贷方累计3," & _
                 "Decode(Max(Account.blnIsMultCurrency)+Max(Account.blnIsAllCurrency),0,'-',Decode(Decode(WrAcntCurrency.CurrencyID,-1,0,1)* Decode(WrAcntCurrency.CurrencyID,1,0,1),0,'',Decode(Sign(Sum((dblCurrencyPostedDebit-dblCurrencyPostedCredit)*Account.intDirection)),0,'',To_char(Sum((dblCurrencyPostedDebit-dblCurrencyPostedCredit)*Account.intDirection),Decode(Max(Currencys.bytCurrencyDec),0,'9,999,999,999','9,999,999,990.'|| String1(Max(bytCurrencyDec),'0')))))) AS 期初余额1," & _
                 "Sum((dblPostedDebit-dblPostedCredit)*Account.intDirection) AS 期初余额2," & _
                 "Decode(Max(Account.blnIsQuantity)*Max(Account.blnIsDetail),1,To_Char(Sum((dblQuantityPostedDebit-dblQuantityPostedCredit)*Account.intDirection)),'-') AS 期初余额3," & _
                 "Max(Currencys.bytCurrencyDec) AS CurencyDec," & _
                 "Decode(Max(Account.blnIsDetail),0,Decode(Min(Account.blnIsMultCurrency)+Min(Account.blnIsAllCurrency),0,1,4),Decode(Max(Account.blnIsMultCurrency)+Max(Account.blnIsAllCurrency),1,Decode(Sign(Max(Account.blnIsCustomer)+Max(Account.blnIsDepartment)+Max(Account.blnIsEmployee)+Max(Account.blnIsClass1)+Max(Account.blnIsClass2)),1,5,Decode(WrAcntCurrency.CurrencyID,-1,4,6)),Decode(Sign(Max(Account.blnIsCustomer)+Max(Account.blnIsDepartment)+Max(Account.blnIsEmployee)+Max(Account.blnIsClass1)+Max(Account.blnIsClass2)),1,2,3))) As 标志," & _
                 "Max(Account.intLevel) As 级数,Max(Account.blnIsInActive),Max(Currencys.lngCurrencyID) as CurrencyID,WrAcntCurrency.CurrencyID As 币种ID "
    End If

    strSql = "SELECT " & _
             strSelect & _
             " From Account,WrAcntCurrency,WrAcntDaily,Currencys" & _
             " Where Account.lngAccountID=WrAcntCurrency.lngAccountID(+)" & _
             " And WrAcntCurrency.CurrencyID=WrAcntDaily.lngCurrencyid(+)" & _
             " And WrAcntCurrency.strAccountCode=WrAcntDaily.strAccountCode(+)" & _
             " And WrAcntCurrency.CurrencyID=Currencys.lngCurrencyID(+) And WrAcntCurrency.CurrencyID<>-1 And WrAcntCurrency.blnIsDetail=1" & _
             strWhere & strGroup

    strSql = strSql & " UNION SELECT " & _
             strSelect & _
             " From Account,WrAcntCurrency,WrAcntDaily,Currencys" & _
             " Where Account.lngAccountID=WrAcntCurrency.lngAccountID(+)" & _
             " And WrAcntCurrency.CurrencyID=-1" & _
             " And WrAcntCurrency.strAccountCode=WrAcntDaily.strAccountCode(+)" & _
             " And WrAcntCurrency.CurrencyID=Currencys.lngCurrencyID(+)" & _
             strWhere & strGroup
    
    strSql = strSql & "UNION SELECT " & _
             strSelect & _
             "From Account,WrAcntCurrency,WrAcntDaily,Currencys" & _
             " Where Account.lngAccountID=WrAcntCurrency.lngAccountID(+)" & _

⌨️ 快捷键说明

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