home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbpxen / checkout.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-10-23  |  8.0 KB  |  280 lines

  1. VERSION 2.00
  2. Begin Form Checkout 
  3.    Caption         =   "Check Out"
  4.    ClientHeight    =   4875
  5.    ClientLeft      =   1050
  6.    ClientTop       =   1485
  7.    ClientWidth     =   5280
  8.    Height          =   5280
  9.    Left            =   990
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   4875
  15.    ScaleWidth      =   5280
  16.    Top             =   1140
  17.    Width           =   5400
  18.    Begin TextBox tapenumber 
  19.       Height          =   375
  20.       Index           =   4
  21.       Left            =   120
  22.       TabIndex        =   5
  23.       Text            =   " "
  24.       Top             =   4320
  25.       Width           =   1095
  26.    End
  27.    Begin TextBox tapenumber 
  28.       Height          =   375
  29.       Index           =   3
  30.       Left            =   120
  31.       TabIndex        =   4
  32.       Text            =   " "
  33.       Top             =   3840
  34.       Width           =   1095
  35.    End
  36.    Begin TextBox tapenumber 
  37.       Height          =   375
  38.       Index           =   2
  39.       Left            =   120
  40.       TabIndex        =   3
  41.       Text            =   " "
  42.       Top             =   3360
  43.       Width           =   1095
  44.    End
  45.    Begin TextBox tapenumber 
  46.       Height          =   375
  47.       Index           =   1
  48.       Left            =   120
  49.       TabIndex        =   2
  50.       Text            =   " "
  51.       Top             =   2880
  52.       Width           =   1095
  53.    End
  54.    Begin TextBox tapenumber 
  55.       Height          =   375
  56.       Index           =   0
  57.       Left            =   120
  58.       TabIndex        =   1
  59.       Text            =   " "
  60.       Top             =   2400
  61.       Width           =   1095
  62.    End
  63.    Begin TextBox custnumber 
  64.       Height          =   375
  65.       Left            =   120
  66.       TabIndex        =   0
  67.       Text            =   " "
  68.       Top             =   1440
  69.       Width           =   1095
  70.    End
  71.    Begin CommandButton ButtonCancel 
  72.       Caption         =   "&Cancel"
  73.       Height          =   615
  74.       Left            =   1920
  75.       TabIndex        =   7
  76.       Top             =   120
  77.       Width           =   1095
  78.    End
  79.    Begin CommandButton ButtonOK 
  80.       Caption         =   "&OK"
  81.       FontBold        =   -1  'True
  82.       FontItalic      =   0   'False
  83.       FontName        =   "MS Sans Serif"
  84.       FontSize        =   9.75
  85.       FontStrikethru  =   0   'False
  86.       FontUnderline   =   0   'False
  87.       Height          =   615
  88.       Left            =   240
  89.       TabIndex        =   6
  90.       Top             =   120
  91.       Width           =   1095
  92.    End
  93.    Begin Label tapetitle 
  94.       BorderStyle     =   1  'Fixed Single
  95.       Caption         =   " "
  96.       Height          =   375
  97.       Index           =   4
  98.       Left            =   1560
  99.       TabIndex        =   15
  100.       Top             =   4320
  101.       Width           =   3615
  102.    End
  103.    Begin Label tapetitle 
  104.       BorderStyle     =   1  'Fixed Single
  105.       Caption         =   " "
  106.       Height          =   375
  107.       Index           =   3
  108.       Left            =   1560
  109.       TabIndex        =   14
  110.       Top             =   3840
  111.       Width           =   3615
  112.    End
  113.    Begin Label tapetitle 
  114.       BorderStyle     =   1  'Fixed Single
  115.       Caption         =   " "
  116.       Height          =   375
  117.       Index           =   2
  118.       Left            =   1560
  119.       TabIndex        =   13
  120.       Top             =   3360
  121.       Width           =   3615
  122.    End
  123.    Begin Label tapetitle 
  124.       BorderStyle     =   1  'Fixed Single
  125.       Caption         =   " "
  126.       Height          =   375
  127.       Index           =   1
  128.       Left            =   1560
  129.       TabIndex        =   12
  130.       Top             =   2880
  131.       Width           =   3615
  132.    End
  133.    Begin Label tapetitle 
  134.       BorderStyle     =   1  'Fixed Single
  135.       Height          =   375
  136.       Index           =   0
  137.       Left            =   1560
  138.       TabIndex        =   11
  139.       Top             =   2400
  140.       Width           =   3615
  141.    End
  142.    Begin Label Label2 
  143.       Caption         =   "Tape number:"
  144.       Height          =   255
  145.       Left            =   120
  146.       TabIndex        =   9
  147.       Top             =   1920
  148.       Width           =   1335
  149.    End
  150.    Begin Label custname 
  151.       BorderStyle     =   1  'Fixed Single
  152.       Caption         =   " "
  153.       Height          =   375
  154.       Left            =   1560
  155.       TabIndex        =   10
  156.       Top             =   1440
  157.       Width           =   2535
  158.    End
  159.    Begin Label Label1 
  160.       Caption         =   "Customer number:"
  161.       Height          =   375
  162.       Left            =   120
  163.       TabIndex        =   8
  164.       Top             =   960
  165.       Width           =   1695
  166.    End
  167. Sub ButtonCancel_Click ()
  168.     custnumber.text = " "
  169.     For i% = 0 To 4
  170.         tapenumber(i%).text = " "
  171.         tapetitle(i%).caption = " "
  172.     Next i%
  173.     custnumber.SetFocus
  174.     checkout.Hide
  175. End Sub
  176. Sub ButtonExit_Click ()
  177.     checkout.Hide
  178. End Sub
  179. Sub ButtonOK_Click ()
  180.     Dim iNumTapes As Integer
  181.     '
  182.     '  Make the customer rec is there
  183.     '  But do not update it yet
  184.     '
  185.     screen.MousePointer = POINTER_HOURGLASS
  186.     custrec.custnumber = custnumber.text
  187.     ' rc = GetCustomerRec(DBKEYED)
  188.     rc = 0
  189.     If rc Then
  190.         custnumber.SetFocus
  191.         custname.caption = " "
  192.         screen.MousePointer = POINTER_DEFAULT
  193.         Exit Sub
  194.     End If
  195.     '
  196.     '  Get each tape and update
  197.     '
  198.     iNumTapes = 0
  199.     For i% = 0 To 4
  200.         If tapenumber(i%).text <> " " Then
  201.             itemrec.itemnumber = tapenumber(i%).text
  202.             rc = GetItemRec(DBKEYED)
  203.             If rc Then
  204.                 msg$ = "Tape " + tapenumber(i%).text + " deleted! "
  205.                 MsgBox msg$, MB_ICONEXLAMATION
  206.             Else
  207.                 inout$ = Left$(itemrec.inout_code, 1)
  208.                 If inout$ = "O" Then
  209.                     msg$ = "Tape is already out, number: " + itemrec.itemnumber
  210.                     MsgBox msg$, MB_ICONEXCLAMATION
  211.                     tapetitle(i%).caption = "Already out"
  212.                 Else
  213.                     itemrec.custnum = custrec.custnumber
  214.                     itemrec.inout_code = "OUT"
  215.                     rc = UpdateItemRec()
  216.                     tapetitle(i%).caption = "OK"
  217.                     iNumTapes = iNumTapes + 1
  218.                 End If
  219.             End If
  220.         End If
  221.     Next i%
  222.     '
  223.     '  Get the customer again and update as quickly
  224.     '  as possible.  Should lock it, but requires more code
  225.     '
  226.     rc = GetCustomerRec(DBKEYED)
  227.     custrec.tapes_out = custrec.tapes_out + iNumTapes
  228.     rc = UpdateCustomerRec()
  229.     '
  230.     '  Clear the screen for the next checkout
  231.     '
  232.     custnumber.text = " "
  233.     For i% = 0 To 4
  234.         tapenumber(i%).text = " "
  235.         '  ***  tapetitle(i%).caption = " "
  236.     Next i%
  237.     custnumber.SetFocus
  238.     screen.MousePointer = POINTER_DEFAULT
  239.     Exit Sub
  240. End Sub
  241. Sub custnumber_LostFocus ()
  242.     If custnumber.text = " " Then
  243.         Exit Sub
  244.     End If
  245.     custrec.custnumber = custnumber.text
  246.     rc = GetCustomerRec(DBKEYED)
  247.     If rc Then
  248.         custnumber.SetFocus
  249.         custname.caption = " "
  250.         Exit Sub
  251.     End If
  252.     '
  253.     '  need to trim trailing blanks from the last name
  254.     '
  255.     TheFullName$ = custrec.lastname + ", " + custrec.firstname
  256.     custname.caption = TheFullName$
  257. End Sub
  258. Sub Form_Load ()
  259.     custnumber.text = " "
  260.     custname.caption = " "
  261.     For i% = 0 To 4
  262.         tapenumber(i%).text = " "
  263.         tapetitle(i%).caption = " "
  264.     Next i%
  265.     ' ??  whats wrong with this -  custnumber.SetFocus
  266. End Sub
  267. Sub tapenumber_LostFocus (i As Integer)
  268.     If tapenumber(i).text = " " Then
  269.         Exit Sub
  270.     End If
  271.     itemrec.itemnumber = tapenumber(i).text
  272.     rc = GetItemRec(DBKEYED)
  273.     If rc Then
  274.         tapenumber(i).SetFocus
  275.         tapetitle(i).caption = " "
  276.         Exit Sub
  277.     End If
  278.     tapetitle(i).caption = itemrec.itemdesc
  279. End Sub
  280.