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

  1. VERSION 2.00
  2. Begin Form OESumFrm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Column Summary Sample"
  5.    ClientHeight    =   3345
  6.    ClientLeft      =   1650
  7.    ClientTop       =   1860
  8.    ClientWidth     =   6555
  9.    ForeColor       =   &H00C0C0C0&
  10.    Height          =   4035
  11.    Icon            =   OESUMS.FRX:0000
  12.    Left            =   1590
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   3345
  15.    ScaleWidth      =   6555
  16.    Top             =   1230
  17.    Width           =   6675
  18.    Begin CommandButton Command1 
  19.       Caption         =   "&New Order"
  20.       Height          =   435
  21.       Left            =   180
  22.       TabIndex        =   11
  23.       Top             =   2760
  24.       Width           =   1155
  25.    End
  26.    Begin TextBox TaxPercent 
  27.       Alignment       =   1  'Right Justify
  28.       ForeColor       =   &H00000000&
  29.       Height          =   285
  30.       Left            =   5760
  31.       TabIndex        =   2
  32.       Text            =   "6"
  33.       Top             =   2400
  34.       Width           =   375
  35.    End
  36.    Begin TextBox PieceCount 
  37.       BackColor       =   &H00C0C0C0&
  38.       BorderStyle     =   0  'None
  39.       Height          =   285
  40.       Left            =   180
  41.       TabIndex        =   1
  42.       Text            =   "Text2"
  43.       Top             =   2160
  44.       Width           =   3075
  45.    End
  46.    Begin Data Data1 
  47.       Caption         =   "Data1"
  48.       Connect         =   ";"
  49.       DatabaseName    =   "OESUMS.MDB"
  50.       Exclusive       =   0   'False
  51.       Height          =   270
  52.       Left            =   120
  53.       Options         =   0
  54.       ReadOnly        =   0   'False
  55.       RecordSource    =   "LineItems"
  56.       Top             =   3600
  57.       Width           =   1155
  58.    End
  59.    Begin TrueGrid Table1 
  60.       AllowArrows     =   -1  'True
  61.       AllowTabs       =   -1  'True
  62.       BackColor       =   &H00C0C0C0&
  63.       DataSource      =   "Data1"
  64.       Editable        =   -1  'True
  65.       EditDropDown    =   -1  'True
  66.       ExposeCellMode  =   0  'Expose upon selection
  67.       FetchMode       =   0  'By cell
  68.       FontBold        =   0   'False
  69.       FontItalic      =   0   'False
  70.       FontName        =   "MS Sans Serif"
  71.       FontSize        =   8.25
  72.       FontStrikethru  =   0   'False
  73.       FontUnderline   =   0   'False
  74.       HeadingHeight   =   1
  75.       Height          =   1935
  76.       HorzLines       =   2  '3D
  77.       Layout          =   OESUMS.FRX:0302
  78.       LayoutIndex     =   1
  79.       Left            =   180
  80.       LinesPerRow     =   1
  81.       MarqueeUnique   =   -1  'True
  82.       SplitPropsGlobal=   0   'False
  83.       SplitTabMode    =   0  'Don't tab across splits
  84.       TabCapture      =   0   'False
  85.       TabIndex        =   0
  86.       Top             =   120
  87.       UseBookmarks    =   -1  'True
  88.       Width           =   6195
  89.       WrapCellPointer =   0   'False
  90.    End
  91.    Begin Label Label5 
  92.       Alignment       =   1  'Right Justify
  93.       BackColor       =   &H00C0C0C0&
  94.       Caption         =   "Order Total:"
  95.       FontBold        =   0   'False
  96.       FontItalic      =   0   'False
  97.       FontName        =   "MS Sans Serif"
  98.       FontSize        =   8.25
  99.       FontStrikethru  =   0   'False
  100.       FontUnderline   =   0   'False
  101.       Height          =   255
  102.       Left            =   3660
  103.       TabIndex        =   10
  104.       Top             =   2970
  105.       Width           =   975
  106.    End
  107.    Begin Label Label4 
  108.       Alignment       =   1  'Right Justify
  109.       BackColor       =   &H00C0C0C0&
  110.       Caption         =   "Tax Amount:"
  111.       FontBold        =   0   'False
  112.       FontItalic      =   0   'False
  113.       FontName        =   "MS Sans Serif"
  114.       FontSize        =   8.25
  115.       FontStrikethru  =   0   'False
  116.       FontUnderline   =   0   'False
  117.       Height          =   255
  118.       Left            =   3540
  119.       TabIndex        =   9
  120.       Top             =   2700
  121.       Width           =   1095
  122.    End
  123.    Begin Label Label3 
  124.       Alignment       =   1  'Right Justify
  125.       BackColor       =   &H00C0C0C0&
  126.       Caption         =   "Tax Percent:"
  127.       FontBold        =   0   'False
  128.       FontItalic      =   0   'False
  129.       FontName        =   "MS Sans Serif"
  130.       FontSize        =   8.25
  131.       FontStrikethru  =   0   'False
  132.       FontUnderline   =   0   'False
  133.       Height          =   255
  134.       Left            =   3480
  135.       TabIndex        =   8
  136.       Top             =   2430
  137.       Width           =   1155
  138.    End
  139.    Begin Label Label2 
  140.       Alignment       =   1  'Right Justify
  141.       BackColor       =   &H00C0C0C0&
  142.       Caption         =   "Sub-total:"
  143.       FontBold        =   0   'False
  144.       FontItalic      =   0   'False
  145.       FontName        =   "MS Sans Serif"
  146.       FontSize        =   8.25
  147.       FontStrikethru  =   0   'False
  148.       FontUnderline   =   0   'False
  149.       Height          =   255
  150.       Left            =   3840
  151.       TabIndex        =   7
  152.       Top             =   2160
  153.       Width           =   795
  154.    End
  155.    Begin Label Total 
  156.       Alignment       =   1  'Right Justify
  157.       BackColor       =   &H00808080&
  158.       Caption         =   "Label2"
  159.       ForeColor       =   &H00FFFFFF&
  160.       Height          =   255
  161.       Left            =   4680
  162.       TabIndex        =   6
  163.       Top             =   2940
  164.       Width           =   1455
  165.    End
  166.    Begin Label TaxAmount 
  167.       Alignment       =   1  'Right Justify
  168.       BackColor       =   &H00C0C0C0&
  169.       Caption         =   "Label2"
  170.       Height          =   255
  171.       Left            =   4680
  172.       TabIndex        =   5
  173.       Top             =   2700
  174.       Width           =   1455
  175.    End
  176.    Begin Label SubTotal 
  177.       Alignment       =   1  'Right Justify
  178.       BackColor       =   &H00C0C0C0&
  179.       Caption         =   "Label2"
  180.       Height          =   255
  181.       Left            =   4680
  182.       TabIndex        =   4
  183.       Top             =   2160
  184.       Width           =   1455
  185.    End
  186.    Begin Label Label1 
  187.       BackColor       =   &H00C0C0C0&
  188.       Caption         =   "%"
  189.       Height          =   195
  190.       Left            =   6180
  191.       TabIndex        =   3
  192.       Top             =   2460
  193.       Width           =   255
  194.    End
  195.    Begin Menu ExitMenuOption 
  196.       Caption         =   "E&xit"
  197.    End
  198.    Begin Menu HelpMenuOption 
  199.       Caption         =   "&Help"
  200.       Begin Menu HelpOption 
  201.          Caption         =   "&Index"
  202.          Index           =   1
  203.       End
  204.       Begin Menu HelpOption 
  205.          Caption         =   "&Using Help"
  206.          Index           =   2
  207.       End
  208.       Begin Menu HelpOption 
  209.          Caption         =   "-"
  210.          Index           =   3
  211.       End
  212.       Begin Menu HelpOption 
  213.          Caption         =   "&About Order Entry Summaries..."
  214.          Index           =   4
  215.       End
  216.    End
  217. Option Explicit
  218. Sub CenterForm (F As Form)
  219. ' Center the specified form within the screen
  220.     F.Move (Screen.Width - F.Width) \ 2, (Screen.Height - F.Height) \ 2
  221. End Sub
  222. Sub Command1_Click ()
  223.     ' Add new record
  224.     Data1.Recordset.AddNew
  225. End Sub
  226. Sub ExitMenuOption_Click ()
  227.     'Unload forms and exit
  228.     Unload About
  229.     Unload OESumFrm
  230.     End
  231. End Sub
  232. Sub Form_Load ()
  233.     ' Centers form on screen
  234.     CenterForm OESumFrm
  235.     ' Change Drive and Dir to current path
  236.     ChDir App.Path
  237.     ChDrive App.Path
  238.     ' Enable Column Summary for Qty and Total Columns
  239.     Table1.ColumnSumEnable(5) = True
  240.     Table1.ColumnSumEnable(1) = True
  241. End Sub
  242. Sub HelpOption_Click (index As Integer)
  243.     'This event calls the WinHelp EXE and a location to goto based on which selection the user has chosen
  244.     'Case 4 shows the about box for Column Summary Sample
  245.     Select Case index
  246.     Case 1
  247.     HelpContext OESumFrm, HELP_OESUM
  248.     Case 2
  249.     HelpOnHelp OESumFrm
  250.     Case 4
  251.     About.Show 1
  252.     End Select
  253. End Sub
  254. Sub RecalcTotal ()
  255.     Dim tot As Double
  256.     Dim taxtot As Double
  257.     ' calculate order total
  258.     tot = Table1.ColumnSum(5)
  259.     SubTotal = Format$(tot, "Currency")
  260.     taxtot = tot * Val(TaxPercent) / 100
  261.     TaxAmount = Format$(taxtot, "Currency")
  262.     Total = Format$(taxtot + tot, "Currency")
  263. End Sub
  264. Sub Table1_Append ()
  265.     ' Add new record
  266.     Data1.Recordset.AddNew
  267. End Sub
  268. Sub Table1_ColumnSumChange (Col As Integer)
  269.     '  If the called for the Total column call recalculate function
  270.     If Col = 5 Then
  271.     RecalcTotal
  272.     ElseIf Col = 1 Then
  273.     ' If called for the qty column change text box that displays totals
  274.     PieceCount = Table1.ColumnSum(1) & " pieces in order"
  275.     End If
  276. End Sub
  277. Sub TaxPercent_Change ()
  278.     ' If users changes tax rate call Recalctotal
  279.     RecalcTotal
  280. End Sub
  281.