home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / truegrid / disk1 / genledgr / genledgr.$ / GENLEDGR.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-17  |  6.3 KB  |  181 lines

  1. VERSION 2.00
  2. Begin Form Main 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "General Ledger"
  5.    ClientHeight    =   5250
  6.    ClientLeft      =   1035
  7.    ClientTop       =   1740
  8.    ClientWidth     =   8475
  9.    Height          =   5940
  10.    Icon            =   GENLEDGR.FRX:0000
  11.    Left            =   975
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5250
  14.    ScaleWidth      =   8475
  15.    Top             =   1110
  16.    Width           =   8595
  17.    Begin CommandButton Command1 
  18.       Caption         =   "Add Account"
  19.       Height          =   315
  20.       Left            =   2250
  21.       TabIndex        =   1
  22.       Top             =   4800
  23.       Width           =   1995
  24.    End
  25.    Begin TrueGrid Table1 
  26.       AllowArrows     =   -1  'True
  27.       AllowTabs       =   -1  'True
  28.       BackColor       =   &H0080FFFF&
  29.       DataSource      =   "Data1"
  30.       Editable        =   -1  'True
  31.       EditDropDown    =   -1  'True
  32.       ExposeCellMode  =   1  'Expose upon editing
  33.       FetchMode       =   0  'By cell
  34.       FontBold        =   0   'False
  35.       FontItalic      =   0   'False
  36.       FontName        =   "MS Sans Serif"
  37.       FontSize        =   8.25
  38.       FontStrikethru  =   0   'False
  39.       FontUnderline   =   0   'False
  40.       HeadingHeight   =   1
  41.       Height          =   4635
  42.       HorzLines       =   1  'Single
  43.       Layout          =   GENLEDGR.FRX:073A
  44.       Left            =   75
  45.       LinesPerRow     =   1
  46.       MarqueeUnique   =   -1  'True
  47.       SplitPropsGlobal=   0   'False
  48.       SplitTabMode    =   1  'Tab across splits
  49.       TabCapture      =   0   'False
  50.       TabIndex        =   0
  51.       Top             =   75
  52.       UseBookmarks    =   -1  'True
  53.       Width           =   8295
  54.       WrapCellPointer =   0   'False
  55.    End
  56.    Begin Data Data1 
  57.       Caption         =   "Data1"
  58.       Connect         =   ""
  59.       DatabaseName    =   "GENLEDGR.MDB"
  60.       Exclusive       =   0   'False
  61.       Height          =   315
  62.       Left            =   75
  63.       Options         =   0
  64.       ReadOnly        =   0   'False
  65.       RecordSource    =   "select * from Accounts order by AccountID"
  66.       Top             =   4800
  67.       Width           =   1995
  68.    End
  69.    Begin Menu ExitMenuOption 
  70.       Caption         =   "E&xit!"
  71.    End
  72.    Begin Menu HelpMenuOption 
  73.       Caption         =   "&Help"
  74.       Begin Menu mHelpOption 
  75.          Caption         =   "&Index"
  76.          Index           =   1
  77.       End
  78.       Begin Menu mHelpOption 
  79.          Caption         =   "&Using Help"
  80.          Index           =   2
  81.       End
  82.       Begin Menu mHelpOption 
  83.          Caption         =   "-"
  84.          Index           =   3
  85.       End
  86.       Begin Menu mHelpOption 
  87.          Caption         =   "&About General Ledger..."
  88.          Index           =   4
  89.       End
  90.    End
  91. ' ---------------------------------------------------------
  92. '       Copyright (C) 1993 Apex Software Corporation
  93. ' You have a royalty-free right to use, modify, reproduce,
  94. ' and distribute the True Grid sample application files
  95. ' (and/or any modified version) in any way you find useful,
  96. ' provided that you agree that Apex Software Corporation
  97. ' has no warranty, obligations, or liability for any sample
  98. ' application files.
  99. ' ---------------------------------------------------------
  100. Option Explicit
  101. Const COL_BALANCE = 2
  102. Dim col_account As Integer
  103. Sub CenterForm (F As Form)
  104. ' Center the specified form within the screen
  105.     F.Move (Screen.Width - F.Width) \ 2, (Screen.Height - F.Height) \ 2
  106. End Sub
  107. Sub Command1_Click ()
  108.     ' Bring up the "Add Account" form
  109.     AddForm.Show MODAL
  110. End Sub
  111. Sub ExitMenuOption_Click ()
  112.     Unload AddForm
  113.     Unload Main
  114.     End
  115. End Sub
  116. Function FindCol (hdtxt As String) As Integer
  117.     ' Given a text string, this routine finds the column
  118.     ' which contains the given text in the heading.  This
  119.     ' is often more convenient than coordinating column numbers
  120.     ' from design mode.
  121.     Dim i As Integer
  122.     For i = 1 To Table1.Columns
  123.         If Table1.ColumnName(i) = hdtxt Then
  124.             FindCol = i
  125.             Exit Function
  126.         End If
  127.     Next
  128.     FindCol = 0
  129. End Function
  130. Sub Form_Load ()
  131.     Dim dbdir As String
  132.     ' Set the database property of the data control
  133.     dbdir = App.Path
  134.     Data1.DatabaseName = dbdir + "\genledgr.mdb"
  135.     ' In the leftmost split, set the general ledger number
  136.     ' so that any value which contains solely numbers (no
  137.     ' decimals) will appear in boldface
  138.     Table1.SplitIndex = 1
  139.     Table1.ParamFontStyle = 2      ' bold
  140.     Table1.ColumnAddRegexAttr(FindCol("GL#")) = "^[0-9]+$"
  141.     ' For the center split, turn margin fetching on for the
  142.     ' account title
  143.     Table1.SplitIndex = 2
  144.     col_account = FindCol("Account")
  145.     Table1.ColumnFetchMargins(col_account) = True
  146.     'Center Form on Application
  147.     CenterForm Main
  148. End Sub
  149. Sub mHelpOption_Click (index As Integer)
  150.     'This event calls the WinHelp EXE and a location to goto based on which selection the user has chosen
  151.     'Case 4 shows the about box for True Browser
  152.     Select Case index
  153.         Case 1
  154.             HelpContext Main, HELP_GENERALEDGER
  155.         Case 2
  156.             HelpOnHelp Main
  157.         Case 4
  158.             About.Show 1
  159.     End Select
  160. End Sub
  161. Sub Table1_FetchMargins (Split As Integer, Row As Long, Col As Integer, InsetLeft As Integer, InsetRight As Integer)
  162.     ' If there is a GL subcode in the GL# column, then set
  163.     ' the left indent for the cell to 2 characters (20 units)
  164.     If InStr(Table1.ColumnText(1), ".") <> 0 Then InsetLeft = 20
  165. End Sub
  166. Sub Table1_Update (Row As Long, Col As Integer, Value As String)
  167.     ' When updating the Debit and Credit columns in split 3,
  168.     ' update the actual field (the hidden balance column) with
  169.     ' either a postitive or negative number and also update the
  170.     ' last posting field.
  171.     If Table1.SplitIndex = 3 Then
  172.         If Table1.ColumnName(Col) = "Debit" Then
  173.             Table1.ColumnText(COL_BALANCE) = Val(Value)
  174.             Table1.ColumnText(FindCol("LastPosting")) = Now
  175.         ElseIf Table1.ColumnName(Col) = "Credit" Then
  176.             Table1.ColumnText(COL_BALANCE) = -Val(Value)
  177.             Table1.ColumnText(FindCol("LastPosting")) = Now
  178.         End If
  179.     End If
  180. End Sub
  181.