home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 February / PCWK0297.iso / lotus / english / lotus036.dsk / SCHEDULE.MPR / SCRIPT / ApproachDoc / Reservation / Body / btnDone.s (.txt) < prev    next >
Encoding:
Null Bytes Alternating  |  1995-11-10  |  4.5 KB  |  74 lines

  1. '++LotusScript Development Environment:2:5:(Options):0:66
  2.  
  3. '++LotusScript Development Environment:2:5:(Forward):0:1
  4. Declare Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
  5.  
  6. '++LotusScript Development Environment:2:5:(Declarations):0:2
  7.  
  8. '++LotusScript Development Environment:2:2:BindEvents:1:129
  9. Private Sub BindEvents(Byval Objectname_ As String)
  10.     Static Source As BUTTON
  11.     Set Source = Bind(Objectname_)
  12.     On Event Click From Source Call Click
  13. End Sub
  14.  
  15. '++LotusScript Development Environment:2:2:Click:1:12
  16. Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
  17.     Dim d As String
  18.     Dim txt As String
  19.     Dim st As String    
  20.     Dim ft As String    
  21.     Dim roomID As Integer
  22.     Dim roomName As String
  23.     Dim start As Double
  24.     Dim finish As Double
  25.     Dim note As String
  26.     Dim OK As Integer
  27.     Dim msg As String
  28.     
  29.     OK = False
  30.     d = source.fbxDate.text
  31.     txt = source.fbxReservedBy.text
  32.     st = source.ddbStart.text
  33.     ft = source.ddbEnd.text    
  34.     roomName = source.ddbRoom.text
  35.     note = source.fbxNotes.text
  36.     If (txt <>"") And (d <> "") And (roomName <> "") And (st <> "") And (ft <> "")Then
  37.         OK = True
  38.     Else
  39.         OK = False
  40.         Messagebox "Invalid request.  Be sure the entire reservation form is complete."
  41.     End If
  42.     
  43.     If OK Then
  44.         start = Timevalue(Trim(source.ddbStart.text)) *  24
  45.         finish = Timevalue(Trim(source.ddbEnd.text)) * 24
  46.         If start < finish Then
  47.             Select Case source.text
  48.             Case "Reserve"
  49.                 If modifySchedule(d, roomName, txt, start, finish, note, 1) Then
  50.                     currentwindow.close
  51.                     clearDisplay
  52.                     readBlock d
  53.                     currentview.body.fbxDateDisplay.text = d
  54.                 Else
  55.                     msg = "Room " + roomName + " is not available from " +source.ddbStart.text+" to " + source.ddbEnd.text + " on " + d + "."
  56.                     Messagebox msg, 0,"Schedule Conflict"
  57.                 End If
  58.             Case "Remove"
  59.                 If modifySchedule(d, roomName, "", start, finish, "", -1) Then
  60.                     currentwindow.close
  61.                     clearDisplay
  62.                     readBlock d
  63.                     currentview.body.fbxDateDisplay.text = d
  64.                 Else
  65.                     msg = "Room " + roomName + " is not scheduled from " + source.ddbStart.text+" to " + source.ddbEnd.text + " on " + d + "."
  66.                     Messagebox msg, 0, "Room Not Scheduled"
  67.                 End If    
  68.             End Select
  69.         Else
  70.             msg = "End time must be greater than Start time."
  71.             Messagebox msg , 0, "Invalid Times Entered"
  72.         End If
  73.     End If    
  74. End Sub