home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form ttrak
- BackColor = &H00C0C0C0&
- Caption = "Project Time Tracking"
- ClientHeight = 4110
- ClientLeft = 1380
- ClientTop = 1230
- ClientWidth = 7545
- Height = 4800
- Icon = TTRAK.FRX:0000
- Left = 1320
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- ScaleHeight = 4110
- ScaleWidth = 7545
- Top = 600
- Width = 7665
- Begin CommandButton printbtn
- Caption = "Print"
- Height = 315
- Left = 1950
- TabIndex = 18
- Top = 3675
- Width = 3540
- End
- Begin CommandButton exitbtn
- Caption = "EXIT"
- Height = 495
- Left = 840
- TabIndex = 6
- Top = 2880
- Width = 1575
- End
- Begin CommandButton delbtn
- Caption = "DELETE"
- Height = 495
- Left = 840
- TabIndex = 5
- Top = 2160
- Width = 1575
- End
- Begin CommandButton addbtn
- Caption = "ADD"
- Default = -1 'True
- Height = 495
- Left = 840
- TabIndex = 4
- Top = 1440
- Width = 1575
- End
- Begin ComboBox project
- BackColor = &H0000FFFF&
- ForeColor = &H00FF0000&
- Height = 300
- Left = 600
- TabIndex = 0
- Text = " "
- Top = 720
- Width = 2415
- End
- Begin Frame Frame1
- BackColor = &H00C0C0C0&
- Caption = "information"
- Height = 1695
- Left = 3720
- TabIndex = 8
- Top = 120
- Width = 3135
- Begin TextBox who
- BackColor = &H0000FFFF&
- ForeColor = &H00FF0000&
- Height = 285
- Left = 1680
- TabIndex = 3
- Text = " "
- Top = 1200
- Width = 975
- End
- Begin TextBox workdate
- BackColor = &H0000FFFF&
- ForeColor = &H00FF0000&
- Height = 285
- Left = 1680
- TabIndex = 2
- Text = " "
- Top = 840
- Width = 975
- End
- Begin TextBox hours
- BackColor = &H0000FFFF&
- ForeColor = &H00FF0000&
- Height = 285
- Left = 1680
- TabIndex = 1
- Text = " "
- Top = 480
- Width = 975
- End
- Begin Label Label4
- BackColor = &H00C0C0C0&
- Caption = "Who"
- Height = 255
- Left = 480
- TabIndex = 11
- Top = 1200
- Width = 615
- End
- Begin Label Label3
- BackColor = &H00C0C0C0&
- Caption = "Date"
- Height = 255
- Left = 480
- TabIndex = 10
- Top = 840
- Width = 615
- End
- Begin Label Label2
- BackColor = &H00C0C0C0&
- Caption = "Hours"
- Height = 255
- Left = 480
- TabIndex = 9
- Top = 480
- Width = 735
- End
- End
- Begin Label tothours
- BackColor = &H0000FFFF&
- BorderStyle = 1 'Fixed Single
- Caption = " "
- ForeColor = &H000000FF&
- Height = 375
- Left = 5520
- TabIndex = 15
- Top = 3000
- Width = 1215
- End
- Begin Label Label5
- BackColor = &H00C0C0C0&
- Caption = "Total Hours"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Serif"
- FontSize = 13.5
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 3600
- TabIndex = 12
- Top = 3000
- Width = 1695
- End
- Begin Label totentry
- BackColor = &H0000FFFF&
- BorderStyle = 1 'Fixed Single
- Caption = " "
- ForeColor = &H000000FF&
- Height = 375
- Left = 5520
- TabIndex = 17
- Top = 2520
- Width = 1215
- End
- Begin Label Label7
- BackColor = &H00C0C0C0&
- Caption = "Total Entries"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Serif"
- FontSize = 13.5
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 3600
- TabIndex = 16
- Top = 2520
- Width = 1815
- End
- Begin Label lastdate
- BackColor = &H0000FFFF&
- BorderStyle = 1 'Fixed Single
- Caption = " "
- ForeColor = &H000000FF&
- Height = 375
- Left = 5520
- TabIndex = 14
- Top = 2040
- Width = 1215
- End
- Begin Label Label6
- BackColor = &H00C0C0C0&
- Caption = "Last Entry"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Serif"
- FontSize = 13.5
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 3600
- TabIndex = 13
- Top = 2025
- Width = 1575
- End
- Begin Label Label1
- BackColor = &H00C0C0C0&
- Caption = "Project"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Serif"
- FontSize = 18
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 495
- Left = 960
- TabIndex = 7
- Top = 120
- Width = 1335
- End
- Begin Menu about
- Caption = "&About..."
- End
- Dim savproj As String
- Dim savhours As Long
- Dim recnbr As Long
- Sub about_Click ()
- ttrakabt.Show
- End Sub
- Sub addbtn_Click ()
- If project.text = "" Then
- rc = MsgBox("Must enter Project Name", 48, "Warning")
- Exit Sub
- End If
- If Get_Header() = PXERR_RECNOTFOUND Then
- Create_Header 1
- End If
- lValue = Val(hours.text)
- savhours = savhours + lValue
- recnbr = recnbr + 1
- Put_Header savhours, recnbr
- Put_Record
- tothours.caption = Str$(savhours)
- lastdate.caption = workdate.text
- totentry.caption = Str$(recnbr)
- End Sub
- Sub Create_Header (addflag As Integer) 'if 1 then add to project list
- aValue = project.text
- PutField ttrakRec, 1, "A"
- lValue = 0
- PutField ttrakRec, 2, "N"
- aValue = "HDR"
- PutField ttrakRec, 5, "A"
- lValue = 0
- PutField ttrakRec, 4, "N"
- recnbr = 0
- lValue = 0
- PutField ttrakRec, 6, "N"
- rc = PXRecAppend(ttrakTbl, ttrakRec)
- PXError
- If addflag = 1 Then
- newproj$ = project.text
- project.AddItem newproj$
- End If
- End Sub
- Sub delbtn_Click ()
- Dim dkey1 As String * 20
- Dim dkey2 As Integer
- dkey1 = RTrim$(project.text)
- rc = PXPutAlpha(ttrakRec, 1, dkey1)
- PXError
- rc = PXSrchKey(ttrakTbl, ttrakRec, 1, SEARCHFIRST)
- Do While rc <> PXERR_RECNOTFOUND And rc <> PXERR_ENDOFTABLE
- rc = PXRecGet(ttrakTbl, ttrakRec)
- PXError
- rc = PXRecDelete(ttrakTbl)
- PXError
- rc = PXPutAlpha(ttrakRec, 1, dkey1)
- rc = PXSrchKey(ttrakTbl, ttrakRec, 1, SEARCHFIRST)
- Loop
- hours.text = ""
- workdate.text = ""
- who.text = ""
- lastdate.caption = ""
- tothours.caption = ""
- totentry.caption = ""
- remove% = project.listindex
- project.RemoveItem remove%
- project.Refresh
- End Sub
- Sub exitbtn_Click ()
- rc = PXTblClose(ttrakTbl)
- rc = PXRecBufClose(ttrakRec)
- rc = PXExit
- End
- End Sub
- Sub Form_Load ()
- If loadFlag <> PX_LOADED Then
- PXInit "timetrak", PXSHARED
- PXError
- loadFlag = PX_LOADED
- End If
- tindex = 0
- savproj = ""
- ' PXOpen "timetrak", ttrakTbl, ttrakRec
- PXOpen DBPATH + "timetrak", ttrakTbl, ttrakRec
- ' Do While project.listcount
- ' project.RemoveItem 0
- ' Loop
- rc = PXRecFirst(ttrakTbl)
- PXError
- rc = PXRecGet(ttrakTbl, ttrakRec)
- PXError
- Do Until rc <> PXSUCCESS
- GetField ttrakRec, 1, "A"
- If returnFld <> savproj Then
- project.AddItem returnFld
- savproj = returnFld
- End If
- PXNext ttrakTbl, ttrakRec
- Loop
- End Sub
- Function Get_Header () As Integer
- Dim key1 As String * 20
- Dim key2 As Integer
- key1 = project.text
- rc = PXPutAlpha(ttrakRec, 1, key1)
- PXError
- key2 = 0
- rc = PXPutShort(ttrakRec, 2, key2)
- PXError
- rc = PXSrchKey(ttrakTbl, ttrakRec, 2, SEARCHFIRST)
- If rc = PXERR_RECNOTFOUND Then
- Get_Header = rc
- Else
- PXError
- rc = PXRecGet(ttrakTbl, ttrakRec)
- Get_Header = rc
- GetField ttrakRec, 6, "N"
- recnbr = lValue
- GetField ttrakRec, 4, "N"
- savhours = lValue
- End If
- End Function
- Sub printbtn_Click ()
- projectName = project.text
- printselect.Show
- End Sub
- Sub project_Change ()
- savhours = 0
- recnbr = 0
- End Sub
- Sub project_Click ()
- hours.text = ""
- who.text = ""
- workdate.text = ""
- savhours = 0
- recnbr = 0
- lastdate.caption = ""
- tothours.caption = ""
- totentry.caption = ""
- If Get_Header() = PXERR_RECNOTFOUND Then
- rc = MsgBox("No Header Rec. Create one?", 49, "Get Header")
- If rc <> MBOK Then
- Exit Sub
- End If
- Create_Header 0
- End If
- GetField ttrakRec, 3, "D"
- lastdate.caption = returnFld
- GetField ttrakRec, 4, "N"
- tothours.caption = returnFld
- savhours = Val(returnFld)
- totentry.caption = Str$(recnbr)
- End Sub
- Sub Put_Header (hrs&, rnbr&)
- vDate$ = workdate.text
- If Gen_Date(vDate$) = 0 Then
- PutField ttrakRec, 3, "D"
- Else
- rc = MsgBox("Invalid Date", 49, "Date Check")
- If rc <> MBOK Then
- Exit Sub
- End If
- End If
- lValue = hrs
- PutField ttrakRec, 4, "N"
- aValue = "HDR"
- PutField ttrakRec, 5, "A"
- lValue = rnbr
- PutField ttrakRec, 6, "N"
- rc = PXRecUpdate(ttrakTbl, ttrakRec)
- PXError
- End Sub
- Sub Put_Record ()
- aValue = project.text
- PutField ttrakRec, 1, "A"
- lValue = recnbr
- PutField ttrakRec, 2, "N"
- vDate$ = workdate.text
- If Gen_Date(vDate$) = 0 Then
- PutField ttrakRec, 3, "D"
- Else
- rc = MsgBox("Invalid Date", 49, "Date Check")
- If rc <> MBOK Then
- Exit Sub
- End If
- End If
- lValue = Val(hours.text)
- PutField ttrakRec, 4, "N"
- aValue = who.text
- PutField ttrakRec, 5, "A"
- lValue = recnbr
- PutField ttrakRec, 6, "N"
- rc = PXRecAppend(ttrakTbl, ttrakRec)
- PXError
- End Sub
-