This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Form1 - 1 VERSION 5.00Begin VB.Form Form1 Caption = "Form1" ClientHeight = 8385 ClientLeft = 60 ClientTop = 345 ClientWidth = 8055 LinkTopic = "Form1" ScaleHeight = 8385 ScaleWidth = 8055 StartUpPosition = 3 'Windows Default Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 581 TabIndex = 4 Top = 0 Width = 8715 Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 6 Top = 360 Width = 3900 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Payments" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 5 Top = 30 Width = 1395 End Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB&
Form1 - 2 Height = 7005 Left = -30 ScaleHeight = 467 ScaleMode = 3 'Pixel ScaleWidth = 463 TabIndex = 0 Top = 570 Width = 6945 Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 1 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 240 ScaleHeight = 30 ScaleWidth = 5985 TabIndex = 2 Top = 6060 Width = 5985 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165 Left = 9450 TabIndex = 3 Top = 3030 Width = 45 End EndEnd
PaymentsFill all fields or fields with '*' then click 'Save' button to update.
Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean Dim i As Long ' Loop Counter Dim rc As Long ' Return Code Dim hKey As Long ' Handle To An Open Registry Key Dim hDepth As Long ' Dim KeyValType As Long ' Data Type Of A Registry Key Dim tmpVal As String ' Tempory Storage For A Registry Key Value Dim KeyValSize As Long ' Size Of Registry Key Variable '------------------------------------------------------------ ' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...} '------------------------------------------------------------ rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ' Open Registry Key If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Error... tmpVal = String$(1024, 0) ' Allocate Variable Space KeyValSize = 1024 ' Mark Variable Size '------------------------------------------------------------ ' Retrieve Registry Key Value... '------------------------------------------------------------ rc = RegQueryValueEx(hKey, SubKeyRef, 0, _ KeyValType, tmpVal, KeyValSize) ' Get/Create Key Value If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Errors If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then ' Win95 Adds Null Terminated String... tmpVal = Left(tmpVal, KeyValSize - 1) ' Null Found, Extract From String Else ' WinNT Does NOT Null Terminate String... tmpVal = Left(tmpVal, KeyValSize) ' Null Not Found, Extract String Only End If '------------------------------------------------------------ ' Determine Key Value Type For Conversion... '------------------------------------------------------------ Select Case KeyValType ' Search Data Types... Case REG_SZ ' String Registry Key Data Type KeyVal = tmpVal ' Copy String Value Case REG_DWORD ' Double Word Registry Key Data Type For i = Len(tmpVal) To 1 Step -1 ' Convert Each Bit KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1))) ' Build Value Char. By Char. Next KeyVal = Format$("&h" + KeyVal) ' Convert Double Word To String End Select GetKeyValue = True ' Return Success rc = RegCloseKey(hKey) ' Close Registry Key Exit Function ' Exit GetKeyError: ' Cleanup After An Error Has Occured... KeyVal = "" ' Set Return Val To Empty String GetKeyValue = False ' Return Failure rc = RegCloseKey(hKey) ' Close Registry KeyEnd Function
frmAbout - 1 VERSION 5.00Begin VB.Form frmAbout BorderStyle = 3 'Fixed Dialog Caption = "About 3JNet" ClientHeight = 3555 ClientLeft = 2340 ClientTop = 1935 ClientWidth = 5730 ClipControls = 0 'False LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2453.724 ScaleMode = 0 'User ScaleWidth = 5380.766 ShowInTaskbar = 0 'False StartUpPosition = 2 'CenterScreen Begin VB.TextBox Text1 Appearance = 0 'Flat Height = 1095 Left = 1050 MultiLine = -1 'True TabIndex = 6 Top = 1200 Width = 4095 End Begin VB.PictureBox picIcon AutoSize = -1 'True ClipControls = 0 'False Height = 540 Left = 240 Picture = (Icon) ScaleHeight = 337.12 ScaleMode = 0 'User ScaleWidth = 337.12 TabIndex = 1 Top = 240 Width = 540 End Begin VB.CommandButton cmdOK Cancel = -1 'True Caption = "OK" Default = -1 'True Height = 345 Left = 4245 TabIndex = 0 Top = 2625 Width = 1260 End Begin VB.CommandButton cmdSysInfo Caption = "&System Info..." Height = 345 Left = 4260 TabIndex = 2 Top = 3075 Width = 1245 End Begin VB.Line Line1 BorderColor = &H00808080& BorderStyle = 6 'Inside Solid Index = 1 X1 = 84.515 X2 = 5309.398 Y1 = 1687.583 Y2 = 1687.583 End Begin VB.Label lblTitle Caption = "Application Title" ForeColor = &H00000000& Height = 480 Left = 1050 TabIndex = 4 Top = 240 Width = 3885 End Begin VB.Line Line1 BorderColor = &H00FFFFFF&
frmAbout - 2 BorderWidth = 2 Index = 0 X1 = 98.6 X2 = 5309.398 Y1 = 1697.936 Y2 = 1697.936 End Begin VB.Label lblVersion Caption = "Version" Height = 225 Left = 1050 TabIndex = 5 Top = 780 Width = 3885 End Begin VB.Label lblDisclaimer Caption = "Warning: Unauthorized reproduction or distribution of this program, or an ForeColor = &H00000000& Height = 825 Left = 255 TabIndex = 3 Top = 2625 Width = 3870 EndEnd
Warning: Unauthorized reproduction or distribution of
this program, or any portion of it is strictly prohibited.
Version
Application Title
frmAccountReceiva Public PK Public Company Public Balance Public AmountPaid
Dim cIRowCount Dim Amount
Private Sub btnRe 'Remove selec With Grid
frmAccountReceivable - 2
Public Sub cmdSave_Click() Dim rsPayments As New Recordset
rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM [Accounts Receivable] WHERE AccRecID=" & PK, CN, adOpenStatic, adLockOptimistic With rsPayments .Fields("Debit") = txtAmountPaid.Text .Update End With DeleteItems Dim rsPaymentRec As New Recordset rsPaymentRec.CursorLocation = adUseClient rsPaymentRec.Open "SELECT * FROM [Payments Received] WHERE AccRecID=" & PK, CN, adOpenStatic, adLockOptimistic
Dim c As Integer With Grid 'Save the details of the records For c = 1 To cIRowCount .Row = c If .TextMatrix(c, 1) = "" Then rsPaymentRec.AddNew rsPaymentRec![AccRecID] = PK Else rsPaymentRec.Filter = "RecievedPaymentID = " & toNumber(.TextMatrix(c, 1)) ' If rsPaymentRec.RecordCount = 0 Then' rsPaymentRec.AddNew'' rsPaymentRec![AccRecID] = PK' End If End If
'Clear variables c = 0 Set rsPayments = Nothing Set rsPaymentRec = Nothing Unload frmAccountReceivableEnd Sub
Private Sub cmdUpdate_Click() If Trim(txtAmount.Text) = "0.00" Then Exit Sub txtBalance.Text = toMoney(txtBalance.Text) + Amount txtAmountPaid.Text = toMoney(txtAmountPaid.Text) - Amount
txtBalance.Text = toMoney(toNumber(txtBalance.Text) - toNumber(txtAmount.Text)) txtAmountPaid.Text = toMoney(toNumber(txtAmountPaid.Text) + toNumber(txtAmount.Text)) With Grid .TextMatrix(.RowSel, 2) = dtpDate.Value .TextMatrix(.RowSel, 3) = dcPaymentType.BoundText .TextMatrix(.RowSel, 4) = dcPaymentType.Text .TextMatrix(.RowSel, 5) = toMoney(txtAmount.Text) End With
Call Grid_Click Call ResetFields
frmAccountReceivable - 3 End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() Call InitGrid bind_dc "SELECT * FROM [Payment Type]", "PaymentType", dcPaymentType, "paymentTypeID", True
txtCompany.Text = Company txtBalance.Text = toMoney(Balance) txtAmountPaid.Text = toMoney(AmountPaid) dtpDate.Value = Date DisplayForEditing If Balance = "0.00" Then Grid.Height = 3000 Grid.Top = 2160 dtpDate.Visible = False dcPaymentType.Visible = False txtAmount.Visible = False cmdAdd.Visible = False cmdUpdate.Visible = False lblPaid.Visible = True End IfEnd Sub
'Procedure used to initialize the gridPrivate Sub InitGrid() cIRowCount = 0 With Grid .Clear .ClearStructure .Rows = 2 .FixedRows = 1 .FixedCols = 1 .Cols = 6 .ColSel = 5 'Initialize the column size .ColWidth(0) = 315 .ColWidth(1) = 0 .ColWidth(2) = 1200 .ColWidth(3) = 0 .ColWidth(4) = 1200 .ColWidth(5) = 1200
'Initialize the column name .TextMatrix(0, 0) = "" .TextMatrix(0, 1) = "RecievedPaymentID" .TextMatrix(0, 2) = "Date" .TextMatrix(0, 3) = "Payment Type ID" .TextMatrix(0, 4) = "Payment Type" .TextMatrix(0, 5) = "Amount" End WithEnd Sub
Private Sub Form_Unload(Cancel As Integer) frmAccountReceivableList.RefreshRecords Set frmAccountReceivable = NothingEnd Sub
frmAccountReceivable - 4 If Grid.Rows = 2 And Grid.TextMatrix(1, 2) = "" Then btnRemove.Visible = False Else btnRemove.Visible = True btnRemove.Top = (Grid.CellTop + Grid.Top) - 20 btnRemove.Left = Grid.Left + 50 End If End WithEnd Sub
Private Sub ResetFields() txtAmount.Text = "" txtAmount.SetFocusEnd Sub
Private Sub DisplayForEditing() On Error GoTo err 'Display the details Dim rsPayments As New Recordset
cIRowCount = 0 rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM [qry_Payment_Received] WHERE AccRecID=" & PK, CN, adOpenStatic, adLockOptimistic If rsPayments.RecordCount > 0 Then rsPayments.MoveFirst While Not rsPayments.EOF cIRowCount = cIRowCount + 1 'increment With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsPayments!RecievedPaymentID .TextMatrix(1, 2) = rsPayments!Date .TextMatrix(1, 3) = rsPayments!PaymentTypeID .TextMatrix(1, 4) = rsPayments!PaymentType .TextMatrix(1, 5) = toMoney(rsPayments!Amount) Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsPayments!RecievedPaymentID .TextMatrix(.Rows - 1, 2) = rsPayments!Date .TextMatrix(.Rows - 1, 3) = rsPayments!PaymentTypeID .TextMatrix(.Rows - 1, 4) = rsPayments!PaymentType .TextMatrix(.Rows - 1, 5) = toMoney(rsPayments!Amount) End If End With ' AmountPaid = rsPayments!Amount rsPayments.MoveNext Wend Grid.Row = 1 Grid.ColSel = 5 'Set fixed cols
Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If
rsPayments.Close 'Clear variables Set rsPayments = Nothing
Exit Suberr: If err.Number = 94 Then Resume Next prompt_err err, Name, "DisplayForEditing" Screen.MousePointer = vbDefaultEnd Sub
Private Sub DeleteItems() Dim CurrRow As Integer Dim rsPayments As New Recordset
frmAccountReceivable - 5 rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM [Payments Received] WHERE AccRecID=" & PK, CN, adOpenStatic, adLockOptimistic If rsPayments.RecordCount > 0 Then rsPayments.MoveFirst While Not rsPayments.EOF CurrRow = getFlexPos(Grid, 1, rsPayments!RecievedPaymentID) 'Add to grid With Grid If CurrRow < 0 Then 'Delete record if doesnt exist in flexgrid DelRecwSQL "Payments", "RecievedPaymentID", "", True, rsPayments!RecievedPaymentID End If End With rsPayments.MoveNext Wend End IfEnd Sub
Private Sub txtAmount_GotFocus() HLText txtAmountEnd Sub
Private Sub txtAmount_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtAmount_Validate(Cancel As Boolean) txtAmount.Text = toMoney(txtAmount.Text)End Sub
frmAccountReceivable - 5 TabIndex = 25 Top = 3030 Width = 45 End Begin VB.Label Label6 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Amount" Height = 195 Left = 4050 TabIndex = 24 Top = 1680 Width = 540 End Begin VB.Label Label5 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Date" Height = 195 Left = 270 TabIndex = 23 Top = 1650 Width = 345 End Begin VB.Label Label3 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Amount Paid" Height = 195 Left = 3450 TabIndex = 22 Top = 780 Width = 900 End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Balance" Height = 195 Left = 120 TabIndex = 21 Top = 810 Width = 585 End Begin VB.Label Label7 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Payment Type" Height = 195 Left = 2160 TabIndex = 20 Top = 1680 Width = 1020 End Begin VB.Label Label1 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Company" Height = 195 Left = 120 TabIndex = 19 Top = 300 Width = 660 End EndEnd
Company
Payment Type
Balance Amount Paid
Date Amount
PAIDPAIDPAIDPAID
6
PaymentsFill all fields or fields with '*' then click 'Save' button to update.
frmAccountReceiva Option Explicit
Dim CURR_COL As IDim rsAccRec As NDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmAccountReceivableList - 2 MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsAccRec If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmAccountReceivableList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Company,FolioNumber,Total,AmountPaid,Balance,AccRecID" .Tables = "[qry_Account_Receivable]" .SortOrder = "Company ASC" .SaveStatement End With rsAccRec.CursorLocation = adUseClient rsAccRec.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsAccRec, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsAccRec, RecordPage.PageStart, RecordPage.PageEnd, 5, 2, False, True, , , , "AccRecID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmAccountReceivableList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then
frmAccountReceivableList - 4 btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmAccountReceivableList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmAccountReceivableList Caption = "Account Receivable" ClientHeight = 5880 ClientLeft = 60 ClientTop = 345 ClientWidth = 8445 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5880 ScaleWidth = 8445 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8445 TabIndex = 2 Top = 5505 Width = 8445 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Business Source] WHERE BusinessSourceID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmBusinessSourceList.RefreshRecords End If End If Set frmBusinessSource = NothingEnd Sub
frmBusinessSource - 1 VERSION 5.00Begin VB.Form frmBusinessSource BorderStyle = 1 'Fixed Single Caption = "Business Source" ClientHeight = 1725 ClientLeft = 45 ClientTop = 330 ClientWidth = 5655 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1725 ScaleWidth = 5655 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox b8Line1 Height = 30 Left = 150 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 5 Top = 870 Width = 5205 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 330 TabIndex = 3 Top = 1155 Width = 1680 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3870 TabIndex = 2 Top = 1155 Width = 1335 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2430 TabIndex = 1 Top = 1155 Width = 1335 End Begin VB.TextBox txtEntry Height = 285 Left = 1770 MaxLength = 100 TabIndex = 0 Tag = "Category" Top = 240 Width = 3030 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Business Source" Height = 240 Left = 450 TabIndex = 4 Top = 240 Width = 1215 EndEnd
Business
Source
frmBusinessSource Option Explicit
Dim CURR_COL As IDim rsBusinessSouDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmBusinessSourceList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsBusinessSource If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmBusinessSourceList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "BusinessSource,BusinessSourceID" .Tables = "[Business Source]" .SortOrder = "BusinessSource ASC" .SaveStatement End With rsBusinessSource.CursorLocation = adUseClient rsBusinessSource.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsBusinessSource, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsBusinessSource, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "BusinessSourceID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmBusinessSourceList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmBusinessSourceList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmBusinessSourceList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmBusinessSourceList Caption = "Business Source" ClientHeight = 6840 ClientLeft = 60 ClientTop = 345 ClientWidth = 9510 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 6840 ScaleWidth = 9510 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9510 TabIndex = 9 Top = 6450 Width = 9510 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9510 TabIndex = 8 Top = 6435 Width = 9510 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9510 TabIndex = 0 Top = 6465 Width = 9510 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmBusinessSourceList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = -30 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Business Source" BeginProperty Font Name = "Tahoma"
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Charge Type] WHERE ChargeTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmChargeTypeList.RefreshRecords End If End If Set frmChargeType = NothingEnd Sub
frmChargeType - 1 VERSION 5.00Begin VB.Form frmChargeType BorderStyle = 1 'Fixed Single Caption = "Charge Type" ClientHeight = 1845 ClientLeft = 45 ClientTop = 330 ClientWidth = 5460 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1845 ScaleWidth = 5460 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1710 MaxLength = 100 TabIndex = 4 Tag = "Category" Top = 180 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2370 TabIndex = 3 Top = 1095 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3810 TabIndex = 2 Top = 1095 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 270 TabIndex = 1 Top = 1095 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 90 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 0 Top = 810 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Charge Type" Height = 240 Left = 390 TabIndex = 5 Top = 180 Width = 1215 EndEnd
Charge Type
frmChargeTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsChargeType Dim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmChargeTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsChargeType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmChargeTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "ChargeType,ChargeTypeID" .Tables = "[Charge Type]" .SortOrder = "ChargeType ASC" .SaveStatement End With rsChargeType.CursorLocation = adUseClient rsChargeType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsChargeType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsChargeType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "ChargeTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmChargeTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmChargeTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmChargeTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmChargeTypeList Caption = "Charge Type" ClientHeight = 6330 ClientLeft = 60 ClientTop = 345 ClientWidth = 9105 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 6330 ScaleWidth = 9105 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9105 TabIndex = 2 Top = 5955 Width = 9105 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmChargeTypeList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9105 TabIndex = 1 Top = 5940 Width = 9105 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9105 TabIndex = 0 Top = 5925 Width = 9105 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Charge Type" BeginProperty Font Name = "Tahoma"
Public State Public PK Public PopupPK Public Room Public AmountPaidPublic OtherChargPublic blnChangeR
Dim HaveAction
frmCheckIn - 2 End Sub
Private Sub cmdCancel_Click()On Error GoTo err
CN.BeginTrans CN.Execute "DELETE FolioNumber " & _ "From [Rate Per Period] " & _ "WHERE FolioNumber='" & txtFolioNumber.Text & "'" CN.Execute "INSERT INTO [Rate Per Period] " & _ "SELECT [Rate Per Period Temp].* " & _ "FROM [Rate Per Period Temp] " & _ "Where ((([Rate Per Period Temp].FolioNumber) = '" & txtFolioNumber.Text & "')) " & _ "ORDER BY [Rate Per Period Temp].Date;"
CN.CommitTrans Unload Me Exit Sub err: CN.RollbackTrans prompt_err err, Name, "CmdCancel_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub ResetFields()' clearText Me'' txtEntry(15).Text = "0.00"' txtEntry(1).SetFocusEnd Sub
Private Sub CmdChangeRoom_Click()On Error GoTo err
Dim OldRoomNumber As Integer CN.BeginTrans With frmChangeRoom OldRoomNumber = txtRoomNumber.Text .txtFrom = OldRoomNumber .Show vbModal End With If blnChangeRoom = False Then Exit Sub ChangeValue CN, "Rooms", "RoomStatusID", 2, True, "WHERE RoomNumber = " & txtRoomNumber.Text ChangeValue CN, "Rooms", "RoomStatusID", 3, True, "WHERE RoomNumber = " & OldRoomNumber CN.Execute "UPDATE [Inventory] SET [Inventory].RoomNumber = " & txtRoomNumber.Text & " " & _ "WHERE RoomNumber=" & OldRoomNumber & " AND ID='" & txtFolioNumber.Text & "' AND Status='Check In'"
CN.CommitTrans
Exit Sub err: CN.RollbackTrans prompt_err err, Name, "CmdChangeRoom_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub cmdCheckInOut_Click() Dim strCaption As String Dim RoomNumber As Integer strCaption = cmdCheckInOut.Caption RoomNumber = txtRoomNumber.Text
frmCheckIn - 3 Call SaveAdd
If HaveAction = False Then Exit Sub End If If State = adStateAddMode Then MsgBox "New record has been successfully saved.", vbInformation
Unload frmCheckIn Else MsgBox "Changes in record has been successfully saved.", vbInformation Unload frmCheckIn End If
If strCaption = "Check Out" Then With frmCheckOut .RoomNumber = RoomNumber .AutoCheckOut = False .Show vbModal End With End IfEnd Sub
Private Sub SaveAdd()On Error GoTo err Dim rsCustomers As New Recordset Dim CustomerID As Integer Dim CompanyID As Integer If Trim(txtLastName.Text) = "" Or Trim(txtFirstName.Text) = "" Then MsgBox "Please complete the name of a guest.", vbInformation Exit Sub End If CN.BeginTrans
'Save customer's record With rsCustomers .Open "SELECT * FROM Customers WHERE LastName = '" & txtLastName.Text & "' AND FirstName = '" & txtFirstName.Text & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtLastName.Tag = .Fields("CustomerID") Else .AddNew CustomerID = getIndex("Customers") txtLastName.Tag = CustomerID .Fields("CustomerID") = CustomerID .Fields("LastName") = txtLastName.Text .Fields("FirstName") = txtFirstName.Text .Update End If .Close If txtCompany.Text = "" Then GoSub ContinueSave 'Save company's record .Open "SELECT * FROM Company WHERE Company = '" & txtCompany.Text & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtCompany.Tag = .Fields("CompanyID") Else .AddNew
.Update End With '---------------------------- 'Delete record from Inventory and add a new check in/out date CN.Execute "DELETE ID, Status " & _ "From [Inventory] " & _ "WHERE ID='" & txtFolioNumber.Text & "' AND Status='Check In'" Dim dtpStartDate As Date dtpStartDate = dtpDateIn.Value Do Until dtpStartDate = dtpDateOut.Value CN.Execute "INSERT INTO [Inventory] ( ID, RoomNumber, [Date], CustomerID, Status ) " & _ "VALUES ('" & txtFolioNumber.Text & "', " & txtRoomNumber.Text & ", #" & dtpStartDate & "#, " & txtLastName.Tag & ", 'Check In')"
dtpStartDate = dtpStartDate + 1 Loop '---------------------------- ChangeValue CN, "Rooms", "RoomStatusID", 2, True, "WHERE RoomNumber = " & txtRoomNumber.Text Call frmPayment.cmdSave_Click Call frmOtherCharges.cmdSave_Click If txtCompany.Text <> "" Then Dim rsAccRec As New Recordset
frmCheckIn - 5 With rsAccRec .Open "SELECT * FROM [Accounts Receivable] WHERE CompanyID = " & txtCompany.Tag & " AND FolioNumber = '" & txtFolioNumber & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then .Fields("Debit") = txtBalance.Text Else .AddNew .Fields("CompanyID") = txtCompany.Tag .Fields("FolioNumber") = txtFolioNumber.Text .Fields("Credit") = txtBalance.Text End If .Update End With ElseIf State = adStateEditMode Then 'delete record from accounts receivable table since the company field becomes blank. CN.Execute "DELETE [Accounts Receivable].FolioNumber " & _ "From [Accounts Receivable] " & _ "WHERE FolioNumber= '" & txtFolioNumber.Text & "'" End If CN.CommitTrans
HaveAction = True Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "cmdSave_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub cmdLookupComp_Click() With frmCompanyLookup Set .RefForm = Me .Show vbModal End WithEnd Sub
Private Sub cmdLookupCust_Click() With frmCustomerLookup Set .RefForm = Me .Show vbModal End WithEnd Sub
Private Sub CmdPrint_Click() If State = adStatePopupMode Then GoSub JumpHere End If If MsgBox("This will save the record before printing a folio. " & vbCrLf & vbCrLf & "Are you sure you want to continue?", vbYesNo + vbInformation) = vbYes Then Call SaveAdd Else Exit Sub End If
JumpHere: With frmReports .strReport = "Folio" If State = adStatePopupMode Then .strWhere = "{qry_RPT_Customers.FolioNumber} = '" & txtFolioNumber.Text & "' AND {qry_RPT_Customers.Status} = 'Check Out'" Else .strWhere = "{qry_RPT_Customers.FolioNumber} = '" & txtFolioNumber.Text & "' AND {qry_RPT_Customers.Status} = 'Check In'" End If
frmCheckIn - 6 frmReports.Show vbModal End WithEnd Sub
Private Sub cmdUpdateDelete_Click() If cmdUpdateDelete.Caption = "Update" Then Call SaveAdd If State = adStateAddMode Then MsgBox "New record has been successfully saved.", vbInformation ' Unload frmCheckIn Else MsgBox "Changes in record has been successfully saved.", vbInformation ' Unload frmCheckIn End If End IfEnd Sub
Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub dcRateType_Click(Area As Integer)On Error GoTo err
Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & txtRoomNumber.Text & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Text = !NoofPerson hsAdults.Min = !NoofPerson hsAdults.Value = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With rsRoomRates.Close Call ComputeRate Exit Sub err: CN.RollbackTrans prompt_err err, Name, "dcRateType_Click" Screen.MousePointer = vbDefaultEnd Sub
frmCheckIn - 7
Private Sub dtpDateIn_Change() Call dtpDateOut_ChangeEnd Sub
Public Sub dtpDateOut_Change() If dtpDateOut.Value <= dtpDateIn.Value Then dtpDateOut.Value = dtpDateIn.Value + 1 End If txtDays.Text = dtpDateOut.Value - dtpDateIn.Value hsDays.Value = txtDays.Text Call ComputeRateEnd Sub
Private Sub dtpDateOut_LostFocus() If dtpDateOut.Value < dtpDateIn.Value Then MsgBox "Date Out must be greater than Date In.", vbExclamation: dtpDateOut.SetFocusEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load()On Error GoTo err
RS.CursorLocation = adUseClient
CN.BeginTrans
bind_dc "SELECT * FROM Countries", "Country", dcCountry, "CountryID", True bind_dc "SELECT * FROM [ID Type]", "IDType", dcIDType, "IDTypeID", True bind_dc "SELECT * FROM [Rate Type]", "RateType", dcRateType, "RateTypeID", True bind_dc "SELECT * FROM [Business Source]", "BusinessSource", dcBusSource, "BusinessSourceID", True bind_dc "SELECT * FROM [Vehicles]", "Vehicle", dcVehicle, "VehicleID", False dcCountry.Text = "Philippines" Dim rsRoomRates As New ADODB.Recordset 'Check the form state If State = adStateAddMode Then RS.Open "SELECT * FROM Transactions WHERE FolioNumber = '" & PK & "'", CN, adOpenStatic, adLockOptimistic cmdUsrHistory.Enabled = False txtRoomNumber.Text = Room dtpDateIn.Value = Date dtpDateOut.Value = dtpDateIn.Value + 1 GeneratePK rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & txtRoomNumber.Text & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Text = !NoofPerson hsAdults.Min = !NoofPerson hsAdults.Value = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
Call txtDays_Change Call ComputeRate ElseIf State = adStateEditMode Then RS.Open "SELECT * FROM Transactions WHERE RoomNumber = " & PK & " AND Status = 'Check In'",
frmCheckIn - 8 CN, adOpenStatic, adLockOptimistic rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & PK & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) hsAdults.Min = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
DisplayForEditing cmdCheckInOut.Caption = "Check Out" CmdChangeRoom.Enabled = True cmdUpdateDelete.Enabled = True CmdPrint.Visible = True Call txtDays_Change Call ComputeRate Else 'adStatePopupMode RS.Open "SELECT * FROM Transactions WHERE FolioNumber = '" & PopupPK & "'", CN, adOpenStatic, adLockOptimistic rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & PK & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) hsAdults.Min = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
CN.Execute "INSERT INTO [Rate Per Period Temp] " & _ "SELECT [Rate Per Period].* " & _ "From [Rate Per Period] " & _ "WHERE FolioNumber='" & txtFolioNumber.Text & "'" CN.CommitTrans Exit Sub err: CN.RollbackTrans prompt_err err, Name, "Form_Load" Screen.MousePointer = vbDefaultEnd Sub
frmCheckIn - 9 'Procedure used to generate PKPrivate Sub GeneratePK() PK = getIndex("Transactions") txtFolioNumber.Text = GenerateID(PK, Format$(Date, "yy") & "-", "00000")End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) lblAmountPaid.FontUnderline = False lblRatePerPeriod.FontUnderline = False lblOtherCharges.FontUnderline = FalseEnd Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then frmRoomsWindow.RefreshRecords End If Unload frmRatePerPeriod Unload frmOtherCharges Unload frmPayment Set frmRatePerPeriod = Nothing Set frmOtherCharges = Nothing Set frmPayment = Nothing Set frmCheckIn = NothingEnd Sub
Private Sub ResetEntry()' txtBranch.Text = ""' txtAcctNo.Text = ""' txtAcctName.Text = ""End Sub
Private Sub hsAdults_Change() txtAdults.Text = hsAdults.Value Call ComputeAdultsRate Call ComputeRateEnd Sub
Private Sub hsChildrens_Change() txtChildrens.Text = hsChildrens.Value Call ComputeChildrensRate Call ComputeRateEnd Sub
Private Sub hsDays_Change() dtpDateOut.Value = dtpDateIn.Value + hsDays.Value txtDays.Text = hsDays.Value Call ComputeRateEnd Sub
Private Sub lblAmountPaid_Click() With frmPayment .FolioNumber = txtFolioNumber.Text .GuestName = txtFirstName.Text & " " & txtLastName.Text .Balance = txtBalance.Text .RefreshBalance Set .RefForm = Me .Show vbModal txtAmountPaid.Text = toMoney(AmountPaid) End WithEnd Sub
frmCheckIn - 10
Private Sub lblAmountPaid_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblAmountPaid.FontUnderline = TrueEnd Sub
Private Sub lblOtherCharges_Click() With frmOtherCharges .FolioNumber = txtFolioNumber.Text .GuestName = txtFirstName.Text & " " & txtLastName.Text Set .RefForm = Me .Show vbModal txtOtherCharges.Text = toMoney(OtherCharges) End With Call ComputeRateEnd Sub
Private Sub lblOtherCharges_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblOtherCharges.FontUnderline = TrueEnd Sub
Private Sub lblRatePerPeriod_Click() With frmRatePerPeriod .FolioNumber = txtFolioNumber.Text .Show vbModal Call ComputeRate End WithEnd Sub
Private Sub lblRatePerPeriod_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblRatePerPeriod.FontUnderline = TrueEnd Sub
Private Sub ComputeAdultsRate()On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset
If txtAdults.Tag = "" Then Exit Sub CN.BeginTrans Dim intAdults As Integer If txtAdults.Text = hsAdults.Min Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - hsAdults.Min End If
With rsRatePerPeriod .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtFolioNumber.Text & "' AND [Date] = #" & dtpDateOut.Value - 1 & "#", CN, adOpenStatic, adLockOptimistic If .RecordCount = 1 Then .Fields("Adults") = txtAdults.Tag * intAdults .Update End If End With CN.CommitTrans rsRatePerPeriod.Close
Private Sub ComputeChildrensRate()On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset
If txtChildrens.Tag = "" Then Exit Sub CN.BeginTrans With rsRatePerPeriod .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtFolioNumber.Text & "' AND [Date] = #" & dtpDateOut.Value - 1 & "#", CN, adOpenStatic, adLockOptimistic If .RecordCount = 1 Then .Fields("Childrens") = txtChildrens.Tag * txtChildrens.Text .Update End If End With CN.CommitTrans rsRatePerPeriod.Close
Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "ComputeChildrensRate" Screen.MousePointer = vbDefaultEnd Sub
Private Sub txtAmountPaid_Change() txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
Private Sub txtDays_Change()On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset Dim tmpDate As Date
tmpDate = dtpDateIn.Value If txtAdults.Tag = "" Then Exit Sub CN.BeginTrans CN.Execute "DELETE [Date] " & _ "FROM [Rate Per Period] " & _ "WHERE [Date]>#" & dtpDateOut - 1 & "#"
Dim intAdults As Integer If txtAdults.Text = hsAdults.Min Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - hsAdults.Min End If
With rsRatePerPeriod .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtFolioNumber.Text & "' ORDER BY [Date]", CN, adOpenStatic, adLockOptimistic
Do Until tmpDate > dtpDateOut.Value - 1 .Filter = "[Date] = #" & tmpDate & "#" If .RecordCount = 0 Then .AddNew .Fields("FolioNumber") = txtFolioNumber.Text
frmCheckIn - 12 .Fields("Date") = tmpDate .Fields("RoomNumber") = txtRoomNumber.Text .Fields("RateTypeID") = dcRateType.BoundText .Fields("Rate") = txtRate.Text .Fields("Adults") = txtAdults.Tag * intAdults .Fields("Childrens") = toMoney(txtChildrens.Tag) * toNumber(txtChildrens.Text) .Update End If tmpDate = tmpDate + 1 Loop End With CN.CommitTrans rsRatePerPeriod.Close
Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "txtDays_Change" Screen.MousePointer = vbDefaultEnd Sub
Private Sub txtDiscount_Change() Call ComputeRateEnd Sub
Private Function ComputeRatePerPeriod() As CurrencyOn Error GoTo err
Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtFolioNumber.Text & "'", CN, adOpenStatic, adLockOptimistic Do Until .EOF ComputeRatePerPeriod = ComputeRatePerPeriod + toMoney(!Rate) + toMoney(!Adults) + toMoney(!Childrens) .MoveNext Loop End With rsRoomRates.Close Exit Function
err: CN.RollbackTrans prompt_err err, Name, "ComputeRatePerPeriod" Screen.MousePointer = vbDefaultEnd Function
Private Sub txtDiscount_GotFocus() HLText txtDiscountEnd Sub
Private Sub txtDiscount_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtDiscount_Validate(Cancel As Boolean) txtDiscount.Text = toMoney(txtDiscount.Text)End Sub
Private Sub txtRate_GotFocus() HLText txtRateEnd Sub
Private Sub txtRate_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtRate_Validate(Cancel As Boolean)
frmCheckIn - 13 txtRate.Text = toMoney(txtRate.Text)End Sub
frmCheckIn - 2 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 37 Top = 360 Width = 3900 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Check In" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 36 Top = 30 Width = 1260 End Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 7395 Left = -30 ScaleHeight = 493 ScaleMode = 3 'Pixel ScaleWidth = 775 TabIndex = 38 Top = 540 Width = 11625 Begin VB.TextBox txtRCardNo Height = 345 Left = 1680 TabIndex = 1 Top = 1050 Width = 1815 End Begin VB.CommandButton CmdPrint Caption = "&Print" Height = 315 Left = 6810 TabIndex = 80 Top = 6630 Visible = 0 'False Width = 1335 End Begin VB.CommandButton cmdLookupComp Caption = ">>" Height = 315 Left = 3540 TabIndex = 8 TabStop = 0 'False Top = 3270
frmCheckIn - 3 Width = 375 End Begin VB.CommandButton cmdLookupCust Caption = ">>" Height = 315 Left = 3540 TabIndex = 3 TabStop = 0 'False Top = 1500 Width = 375 End Begin VB.TextBox txtNotes Height = 1485 Left = 4530 TabIndex = 29 Top = 4500 Width = 3045 End Begin VB.TextBox txtPlateNo Height = 345 Left = 1650 TabIndex = 13 Top = 6210 Width = 1815 End Begin VB.TextBox txtVehicleModel Height = 345 Left = 1650 TabIndex = 12 Top = 5790 Width = 1815 End Begin VB.TextBox txtTotal Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 26 Text = "0.00" Top = 3600 Width = 1815 End Begin VB.TextBox txtSubTotal Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 24 Text = "0.00" Top = 2760 Width = 1815 End Begin VB.TextBox txtOtherCharges Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 23 Text = "0.00" Top = 2340 Width = 1815 End Begin VB.CommandButton cmdUpdateDelete Caption = "Update" Enabled = 0 'False Height = 315 Left = 8160 TabIndex = 32 Top = 7020 Width = 1335 End Begin VB.CommandButton cmdChangeRoom Caption = "Change Room" Enabled = 0 'False Height = 315 Left = 8160 TabIndex = 30
frmCheckIn - 4 Top = 6630 Width = 1335 End Begin VB.TextBox txtFolioNumber Appearance = 0 'Flat Height = 345 Left = 1680 TabIndex = 0 Top = 600 Width = 1815 End Begin VB.TextBox txtLastName Height = 345 Left = 1680 TabIndex = 2 Top = 1500 Width = 1815 End Begin VB.TextBox txtFirstName Height = 345 Left = 1680 TabIndex = 4 Top = 1950 Width = 1815 End Begin VB.TextBox txtAddress Height = 345 Left = 1680 TabIndex = 5 Top = 2400 Width = 1815 End Begin VB.TextBox txtCompany Height = 345 Left = 1680 TabIndex = 7 Top = 3270 Width = 1815 End Begin VB.TextBox txtIDNumber Height = 345 Left = 1680 TabIndex = 10 Top = 4650 Width = 1815 End Begin VB.TextBox txtRoomNumber Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5760 Locked = -1 'True TabIndex = 45 Top = 630 Width = 825 End Begin VB.TextBox txtRate Alignment = 1 'Right Justify Height = 345 Left = 9090 TabIndex = 21 Text = "0.00" Top = 1500 Width = 1815 End Begin VB.TextBox txtDiscount Alignment = 1 'Right Justify Height = 345 Left = 9090 TabIndex = 25 Text = "0.00" Top = 3180 Width = 1575 End Begin VB.TextBox txtDays Alignment = 2 'Center Height = 345
frmCheckIn - 5 Left = 5760 Locked = -1 'True TabIndex = 16 Text = "1" Top = 1920 Width = 465 End Begin VB.TextBox txtAdults Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 17 Text = "1" Top = 2340 Width = 465 End Begin VB.TextBox txtChildrens Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 18 Text = "0" Top = 2760 Width = 465 End Begin VB.CommandButton cmdCheckInOut Caption = "Check In" Height = 315 Left = 9510 TabIndex = 31 Top = 6630 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 9510 TabIndex = 33 Top = 7020 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 420 TabIndex = 34 Top = 6660 Width = 1680 End Begin VB.TextBox txtTotalCharges Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 22 Text = "0.00" Top = 1920 Width = 1815 End Begin VB.TextBox txtAmountPaid Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 27 Text = "0.00" Top = 4050 Width = 1815 End Begin VB.TextBox txtBalance Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 28
frmCheckIn - 6 Text = "0.00" Top = 4440 Width = 1815 End Begin VB.HScrollBar hsDays Height = 315 Left = 6330 Min = 1 TabIndex = 44 Top = 1920 Value = 1 Width = 495 End Begin VB.HScrollBar hsChildrens Height = 315 Left = 6330 TabIndex = 43 Top = 2760 Width = 495 End Begin VB.HScrollBar hsAdults Height = 315 Left = 6330 Min = 1 TabIndex = 42 Top = 2340 Value = 1 Width = 495 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 39 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 270 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 41 Top = 6570 Width = 11595 End Begin MSDataListLib.DataCombo dcCountry Height = 315 Left = 1680 TabIndex = 6 Top = 2850 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSComCtl2.DTPicker dtpDateIn Height = 345 Left = 5760 TabIndex = 14 Top = 1080 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin VB.PictureBox b8GradLine1 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700
frmCheckIn - 7 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 180 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 46 Top = 240 Width = 3495 End Begin VB.PictureBox b8GradLine3 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 210 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 47 Top = 3780 Width = 3495 End Begin VB.PictureBox b8GradLine4 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 4050 ScaleHeight = 180 ScaleWidth = 4545 TabIndex = 48 Top = 240 Width = 4605 End Begin MSComCtl2.DTPicker dtpDateOut Height = 345 Left = 9090 TabIndex = 20 Top = 1050 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin MSDataListLib.DataCombo dcIDType Height = 315 Left = 1680 TabIndex = 9 Top = 4230 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcRateType Height = 315
frmCheckIn - 8 Left = 5760 TabIndex = 15 Top = 1530 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcBusSource Height = 315 Left = 5760 TabIndex = 19 Top = 3210 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.PictureBox b8GradLine2 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 240 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 75 Top = 5100 Width = 3495 End Begin MSDataListLib.DataCombo dcVehicle Height = 315 Left = 1650 TabIndex = 11 Top = 5370 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.Label Label7 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "R Card No." Height = 300 Left = 240 TabIndex = 81 Top = 1050 Width = 1395 End Begin VB.Label Label16 BackStyle = 0 'Transparent Caption = "Notes" Height = 285 Left = 4530 TabIndex = 79 Top = 4230 Width = 585 End Begin VB.Label Label29 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Plate No." Height = 300
frmCheckIn - 9 Left = 210 TabIndex = 78 Top = 6210 Width = 1395 End Begin VB.Label Label28 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Vehicle Make" Height = 300 Left = 210 TabIndex = 77 Top = 5370 Width = 1395 End Begin VB.Label Label23 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Model" Height = 300 Left = 210 TabIndex = 76 Top = 5790 Width = 1395 End Begin VB.Label Label9 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 74 Top = 3630 Width = 1395 End Begin VB.Label Label24 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Balance" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 73 Top = 4470 Width = 1395 End Begin VB.Label lblAmountPaid Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Amount Paid" ForeColor = &H00FF0000& Height = 300 Left = 7650 TabIndex = 72 Top = 4080 Width = 1395 End Begin VB.Label Label8 Alignment = 1 'Right Justify BackStyle = 0 'Transparent
frmCheckIn - 10 Caption = "Sub Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 71 Top = 2790 Width = 1395 End Begin VB.Label lblOtherCharges Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Other Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FF0000& Height = 300 Left = 7650 TabIndex = 70 Top = 2370 Width = 1395 End Begin VB.Line Line1 BorderStyle = 3 'Dot X1 = 516 X2 = 516 Y1 = 44 Y2 = 274 End Begin VB.Label Label25 BackStyle = 0 'Transparent Caption = "%" Height = 315 Left = 10680 TabIndex = 68 Top = 3180 Width = 165 End Begin VB.Label Label1 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Folio Number" Height = 300 Left = 240 TabIndex = 67 Top = 630 Width = 1395 End Begin VB.Label Label2 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Last Name" Height = 300 Left = 240 TabIndex = 66 Top = 1530 Width = 1395 End Begin VB.Label Label3 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "First name" Height = 300
frmCheckIn - 11 Left = 240 TabIndex = 65 Top = 1980 Width = 1395 End Begin VB.Label Label4 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Address" Height = 300 Left = 240 TabIndex = 64 Top = 2430 Width = 1395 End Begin VB.Label Label5 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Company" Height = 300 Left = 240 TabIndex = 63 Top = 3300 Width = 1395 End Begin VB.Label Label6 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Country" Height = 300 Left = 240 TabIndex = 62 Top = 2850 Width = 1395 End Begin VB.Label Label10 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "ID Number" Height = 300 Left = 240 TabIndex = 61 Top = 4650 Width = 1395 End Begin VB.Label Label11 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "ID Type" Height = 300 Left = 240 TabIndex = 60 Top = 4230 Width = 1395 End Begin VB.Label Label12 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Room Number" Height = 300 Left = 4320 TabIndex = 59 Top = 660 Width = 1395 End Begin VB.Label Label13 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date In" Height = 300 Left = 4320 TabIndex = 58 Top = 1110 Width = 1395 End Begin VB.Label Label14 Alignment = 1 'Right Justify
frmCheckIn - 12 BackStyle = 0 'Transparent Caption = "Date Out" Height = 300 Left = 7650 TabIndex = 57 Top = 1080 Width = 1395 End Begin VB.Label Label15 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate Type" Height = 300 Left = 4320 TabIndex = 56 Top = 1530 Width = 1395 End Begin VB.Label lblRatePerPeriod Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate/Period" ForeColor = &H00FF0000& Height = 300 Left = 7650 TabIndex = 55 Top = 1500 Width = 1395 End Begin VB.Label Label17 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Discount" Height = 300 Left = 7650 TabIndex = 54 Top = 3210 Width = 1395 End Begin VB.Label Label18 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Days" Height = 300 Left = 4320 TabIndex = 53 Top = 1950 Width = 1395 End Begin VB.Label Label19 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Adults" Height = 300 Left = 4320 TabIndex = 52 Top = 2370 Width = 1395 End Begin VB.Label Label20 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Childrens" Height = 300 Left = 4320 TabIndex = 51 Top = 2790 Width = 1395 End Begin VB.Label Label21 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Business Source" Height = 300 Left = 4320 TabIndex = 50 Top = 3210
frmCheckIn - 13 Width = 1395 End Begin VB.Label Label22 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 49 Top = 1950 Width = 1395 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165 Left = 9450 TabIndex = 40 Top = 3030 Width = 45 End EndEnd
Total Charges
Business Source
No. of Childrens
No. of Adults
No. of Days
Discount
Rate/PeriodRate Type
Date OutDate In
Room Number
ID Type
ID Number
Country
Company
Address
First name
Last Name
Folio Number
%
Other Charges
Sub Total
Amount Paid
Balance
Total
Model
Vehicle Make
Plate No.
Notes
R Card No.
6
6
6
6
6
Check InFill all fields or fields with '*' then click 'Save' button to update.
frmCheckInList - 1 Dim CURR_COL As I
Dim rsTransactionDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub Filter SQLParser.Res SQLParser.wCo
frmCheckInList - 2 Exit Sub 'Trap the errorerr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Else MsgBox err.Number & " " & err.Description End If Me.MousePointer = vbDefaultEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsTransactions If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub btnRecOp_Click() frmCustomerRecOp.Show vbModalEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "fftfttt"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
frmCheckInList - 3
Private Sub Form_Load()' mdiMain.AddToWin Me.Caption, Name 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "[Name], RoomNumber, DateIn, DateOut, FolioNumber" .Tables = "qry_CheckIn" .wCondition = "Status = 'Check Out'" .SortOrder = "Name ASC" .SaveStatement End With If rsTransactions.State = 1 Then rsTransactions.Close rsTransactions.CursorLocation = adUseClient Debug.Print CN rsTransactions.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsTransactions, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsTransactions, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "FolioNumber") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCheckInList = NothingEnd Sub
frmCheckInList - 4 Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)' lvList.ToolTipText = lvList.SelectedItem.SubItems(2)End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmCheckInList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCheckInList Caption = "Check In List" ClientHeight = 6120 ClientLeft = 120 ClientTop = 420 ClientWidth = 9195 LinkTopic = "Form1" MDIChild = -1 'True ScaleHeight = 6120 ScaleWidth = 9195 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9195 TabIndex = 9 Top = 5730 Width = 9195 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9195 TabIndex = 8 Top = 5715 Width = 9195 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9195 TabIndex = 0 Top = 5745 Width = 9195 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmCheckInList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 420 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 5 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Name" Object.Width = 4701 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Room" Object.Width = 2240 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmCheckInList - 3 SubItemIndex = 2 Text = "Date In" Object.Width = 3863 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Date Out" Object.Width = 4762 EndProperty BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 4 Text = "Folio Number" Object.Width = 2424 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Check In List" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 120 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 120 Width = 6915 EndEnd
Check In List
Selected Record: 0 0 - 0 of 0
frmCheckOut - 1 Public RoomNumberPublic AmountPaidPublic OtherChargPublic AutoCheckO
Dim RS
Private Sub cmdCaOn Error GoTo err
CN.BeginTrans
frmCheckOut - 2 Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "cmdCheckOut_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub PrintFolio() With frmReports .strReport = "Folio" .strWhere = "{qry_RPT_Customers.FolioNumber} = '" & txtGuestName.Tag & "' AND {qry_RPT_Customers.Status} = 'Check Out'"
frmReports.Show vbModal End WithEnd Sub
Private Sub dtpDateOut_Change() txtDays.Text = dtpDateOut.Value - CDate(txtDateIn.Text) Call ComputeRateEnd Sub
Private Sub dtpDateOut_LostFocus() If CDate(txtDateIn.Text) > dtpDateOut.Value Then MsgBox "Check In date must be below check out date. Please enter another check out date.", vbInformation dtpDateOut.SetFocus End IfEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load()On Error GoTo err
CN.BeginTrans
RS.CursorLocation = adUseClient RS.Open "SELECT * FROM Transactions WHERE RoomNumber = " & RoomNumber & " AND Status = 'Check In'", CN, adOpenStatic, adLockOptimistic
bind_dc "SELECT * FROM [Rate Type]", "RateType", dcRateType, "RateTypeID", True
txtRoomNumber.Text = RoomNumber With RS txtGuestName.Tag = .Fields("FolioNumber") txtGuestName.Text = getValueAt("SELECT [Name] FROM qry_CheckIn WHERE FolioNumber = '" & .Fields("FolioNumber") & " '", "Name") txtDateIn.Text = .Fields("DateIn") If AutoCheckOut = True Then If .Fields("DateOut") >= Date Then dtpDateOut.Value = .Fields("DateOut") Else dtpDateOut.Value = Date End If Else dtpDateOut.Value = .Fields("DateOut") End If dcRateType.BoundText = .Fields("RateType") txtDays.Text = dtpDateOut.Value - CDate(txtDateIn.Text) txtAdults.Text = .Fields("Adults") txtChildrens.Text = .Fields("Childrens") txtRate.Text = toMoney(.Fields("Rate")) txtOtherCharges.Text = toMoney(.Fields("OtherCharges")) txtDiscount.Text = toMoney(.Fields("Discount")) txtAmountPaid.Text = toMoney(.Fields("AmountPaid")) End With
'Compute additional rate (no. of days & childrens)Private Sub ComputeAddRate() Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & RoomNumber & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With rsRoomRates.CloseEnd Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) lblRatePerPeriod.FontUnderline = False lblAmountPaid.FontUnderline = False lblOtherCharges.FontUnderline = FalseEnd Sub
Private Sub Form_Unload(Cancel As Integer) frmRoomsWindow.RefreshRecords Unload frmPayment Set frmPayment = Nothing Set frmCheckOut = NothingEnd Sub
Private Sub lblAmountPaid_Click() With frmPayment .FolioNumber = txtGuestName.Tag .GuestName = txtGuestName.Text .Balance = txtBalance.Text .RefreshBalance Set .RefForm = Me .Show vbModal txtAmountPaid.Text = toMoney(AmountPaid)
frmCheckOut - 4 End WithEnd Sub
Private Sub lblAmountPaid_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblAmountPaid.FontUnderline = TrueEnd Sub
Private Function ComputeRatePerPeriod() As Currency Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtGuestName.Tag & "'", CN, adOpenStatic, adLockOptimistic Do Until .EOF ComputeRatePerPeriod = ComputeRatePerPeriod + toMoney(!Rate) + toMoney(!Adults) + toMoney(!Childrens) .MoveNext Loop End With rsRoomRates.CloseEnd Function
Private Sub lblOtherCharges_Click() With frmOtherCharges .FolioNumber = txtGuestName.Tag .GuestName = txtGuestName.Text Set .RefForm = Me .Show vbModal txtOtherCharges.Text = toMoney(OtherCharges) End WithEnd Sub
Private Sub lblOtherCharges_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblOtherCharges.FontUnderline = TrueEnd Sub
Private Sub lblRatePerPeriod_Click() With frmRatePerPeriod .FolioNumber = txtGuestName.Tag .Show vbModal Call ComputeRate End WithEnd Sub
Private Sub lblRatePerPeriod_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblRatePerPeriod.FontUnderline = TrueEnd Sub
Private Sub txtAmountPaid_Change() txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
Private Sub txtDays_Change()On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset Dim tmpDate As Date Dim minNoofPerson As Integer tmpDate = txtDateIn.Text If txtAdults.Tag = "" Then Exit Sub CN.BeginTrans
Dim intAdults As Integer minNoofPerson = getValueAt("SELECT * FROM [Room Rates] WHERE RoomNumber = " & RoomNumber & " AND RateTypeID = " & dcRateType.BoundText, "NoofPerson") If txtAdults.Text = minNoofPerson Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - minNoofPerson End If
With rsRatePerPeriod .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtGuestName.Tag & "' ORDER BY [Date]", CN, adOpenStatic, adLockOptimistic
Do Until tmpDate > dtpDateOut.Value - 1 .Filter = "[Date] = #" & tmpDate & "#" If .RecordCount = 0 Then .AddNew .Fields("FolioNumber") = txtGuestName.Tag .Fields("Date") = tmpDate .Fields("RoomNumber") = txtRoomNumber.Text .Fields("RateTypeID") = dcRateType.BoundText .Fields("Rate") = txtRate.Text .Fields("Adults") = txtAdults.Tag * intAdults .Fields("Childrens") = toMoney(txtChildrens.Tag) * toNumber(txtChildrens.Text) .Update End If tmpDate = tmpDate + 1 Loop End With CN.CommitTrans rsRatePerPeriod.Close
Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "txtDays_Change" Screen.MousePointer = vbDefaultEnd Sub
frmCheckOut - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmCheckOut BorderStyle = 1 'Fixed Single Caption = "Check Out" ClientHeight = 6615 ClientLeft = 45 ClientTop = 330 ClientWidth = 8130 ControlBox = 0 'False KeyPreview = -1 'True LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 6615 ScaleWidth = 8130 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 6075 Left = 0 ScaleHeight = 405 ScaleMode = 3 'Pixel ScaleWidth = 541 TabIndex = 21 Top = 540 Width = 8115 Begin VB.TextBox txtGuestName Appearance = 0 'Flat Height = 375 Left = 1620 TabIndex = 1 Top = 630 Width = 3015 End Begin VB.TextBox txtTotal Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 13 Text = "0.00" Top = 3930 Width = 1815 End Begin VB.TextBox txtSubTotal Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 11 Text = "0.00" Top = 3090 Width = 1815 End Begin VB.TextBox txtOtherCharges Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 10 Text = "0.00" Top = 2670 Width = 1815 End Begin VB.TextBox txtRoomNumber Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 0 Top = 210 Width = 825
frmCheckOut - 2 End Begin VB.TextBox txtRate Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5070 TabIndex = 8 Text = "0.00" Top = 1830 Width = 1815 End Begin VB.TextBox txtDiscount Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 12 Text = "0.00" Top = 3510 Width = 1575 End Begin VB.TextBox txtDays Alignment = 2 'Center Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 4 Text = "1" Top = 2250 Width = 465 End Begin VB.TextBox txtAdults Alignment = 2 'Center Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 5 Text = "1" Top = 2670 Width = 465 End Begin VB.TextBox txtChildrens Alignment = 2 'Center Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 6 Text = "0" Top = 3090 Width = 465 End Begin VB.TextBox txtTotalCharges Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 9 Text = "0.00" Top = 2250 Width = 1815 End Begin VB.TextBox txtAmountPaid Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 14 Text = "0.00" Top = 4350 Width = 1815 End Begin VB.TextBox txtBalance Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 15
frmCheckOut - 3 Text = "0.00" Top = 4770 Width = 1815 End Begin VB.TextBox txtDateIn Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 2 Top = 1410 Width = 1245 End Begin VB.CommandButton cmdCheckOut Appearance = 0 'Flat Caption = "Check Out" Height = 315 Left = 4860 TabIndex = 16 Top = 5520 Width = 1335 End Begin VB.CommandButton cmdCancel Appearance = 0 'Flat Caption = "Cancel" Height = 315 Left = 6150 TabIndex = 17 Top = 5520 Width = 1335 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 22 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 240 ScaleHeight = 30 ScaleWidth = 7425 TabIndex = 23 Top = 5280 Width = 7425 End Begin MSComCtl2.DTPicker dtpDateOut Height = 345 Left = 5040 TabIndex = 7 Top = 1380 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin MSDataListLib.DataCombo dcRateType Height = 315 Left = 1620 TabIndex = 3 Top = 1860 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Appearance = 0 Style = 2 Text = "" End Begin VB.Label Label25 BackStyle = 0 'Transparent Caption = "%" Height = 315
frmCheckOut - 4 Left = 6630 TabIndex = 41 Top = 3540 Width = 165 End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Guest Name" Height = 195 Left = 690 TabIndex = 40 Top = 660 Width = 885 End Begin VB.Label Label9 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 3600 TabIndex = 39 Top = 3960 Width = 1395 End Begin VB.Label Label24 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Balance" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 3600 TabIndex = 38 Top = 4800 Width = 1395 End Begin VB.Label lblAmountPaid Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Amount Paid" ForeColor = &H00FF0000& Height = 300 Left = 3600 TabIndex = 37 Top = 4410 Width = 1395 End Begin VB.Label Label8 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Sub Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty
frmCheckOut - 5 Height = 300 Left = 3600 TabIndex = 36 Top = 3120 Width = 1395 End Begin VB.Label lblOtherCharges Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Other Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FF0000& Height = 300 Left = 3600 TabIndex = 35 Top = 2700 Width = 1395 End Begin VB.Line Line1 BorderStyle = 3 'Dot X1 = 248 X2 = 248 Y1 = 90 Y2 = 340 End Begin VB.Label Label12 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Room Number" Height = 300 Left = 180 TabIndex = 34 Top = 240 Width = 1395 End Begin VB.Label Label13 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date In" Height = 300 Left = 180 TabIndex = 33 Top = 1440 Width = 1395 End Begin VB.Label Label14 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date Out" Height = 300 Left = 3600 TabIndex = 32 Top = 1410 Width = 1395 End Begin VB.Label Label15 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate Type" Height = 300 Left = 180 TabIndex = 31 Top = 1860 Width = 1395 End Begin VB.Label lblRatePerPeriod Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate/Period"
frmCheckOut - 6 ForeColor = &H00FF0000& Height = 300 Left = 3600 TabIndex = 30 Top = 1860 Width = 1395 End Begin VB.Label Label17 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Discount" Height = 300 Left = 3600 TabIndex = 29 Top = 3540 Width = 1395 End Begin VB.Label Label18 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Days" Height = 300 Left = 180 TabIndex = 28 Top = 2280 Width = 1395 End Begin VB.Label Label19 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Adults" Height = 300 Left = 180 TabIndex = 27 Top = 2700 Width = 1395 End Begin VB.Label Label20 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Childrens" Height = 300 Left = 180 TabIndex = 26 Top = 3120 Width = 1395 End Begin VB.Label Label22 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 3600 TabIndex = 25 Top = 2280 Width = 1395 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False
frmCheckOut - 7 EndProperty Height = 165 Left = 9450 TabIndex = 24 Top = 3030 Width = 45 End End Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 479 TabIndex = 18 Top = 0 Width = 7185 Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Check Out" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 20 Top = 30 Width = 1470 End Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 19 Top = 360 Width = 3900 End EndEnd
Fill all fields or fields with '*' then click 'Save' button to update.
Check Out
Total Charges
No. of Childrens
No. of Adults
No. of Days
Discount
Rate/PeriodRate Type
Date OutDate In
Room Number
Other Charges
Sub Total
Amount Paid
Balance
Total
Guest Name
%
6
frmCloseShift - 1 Dim RS As New Rec
Private Sub CmdCl Unload MeEnd Sub
Private Sub CmdCl mdiMain.Unloa CurrUser.USER CurrUser.USER
Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM Company WHERE CompanyID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False PK = getIndex("Company") Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmCompanyList.RefreshRecords End If End If Set frmCompany = NothingEnd Sub
Private Sub txtEntry_GotFocus(Index As Integer) HLText txtEntry(Index)End Sub
frmCompany - 1 VERSION 5.00Begin VB.Form frmCompany BorderStyle = 1 'Fixed Single Caption = "Company" ClientHeight = 4335 ClientLeft = 45 ClientTop = 330 ClientWidth = 6405 KeyPreview = -1 'True LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 4335 ScaleWidth = 6405 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Index = 0 Left = 1680 MaxLength = 100 TabIndex = 0 Tag = "Company" Top = 180 Width = 2415 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 765 TabIndex = 10 Top = 3690 Width = 1680 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 4605 TabIndex = 9 Top = 3675 Width = 1335 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 3165 TabIndex = 8 Top = 3675 Width = 1335 End Begin VB.TextBox txtEntry Height = 285 Index = 2 Left = 1680 MaxLength = 100 TabIndex = 2 Top = 975 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 1 Left = 1680 MaxLength = 100 TabIndex = 1 Top = 600 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 3 Left = 1680 MaxLength = 100 TabIndex = 3 Top = 1365 Width = 3840 End
frmCompany - 2 Begin VB.TextBox txtEntry Height = 285 Index = 5 Left = 1680 MaxLength = 100 TabIndex = 5 Top = 2115 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 4 Left = 1680 MaxLength = 100 TabIndex = 4 Top = 1740 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 7 Left = 1680 MaxLength = 100 TabIndex = 7 Top = 2835 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 6 Left = 1680 MaxLength = 100 TabIndex = 6 Top = 2460 Width = 2415 End Begin VB.PictureBox b8Line1 Height = 30 Left = 495 ScaleHeight = 30 ScaleWidth = 5415 TabIndex = 11 Top = 3450 Width = 5415 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Company" Height = 240 Index = 7 Left = 480 TabIndex = 19 Top = 180 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Lastname" Height = 240 Index = 1 Left = 480 TabIndex = 18 Top = 600 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Firstname" Height = 240 Index = 0 Left = 480 TabIndex = 17 Top = 975 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify
frmCompany - 3 Caption = "Address" Height = 240 Index = 2 Left = 480 TabIndex = 16 Top = 1365 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Email Address" Height = 240 Index = 3 Left = 480 TabIndex = 15 Top = 1740 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Tel No" Height = 240 Index = 4 Left = 480 TabIndex = 14 Top = 2115 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Mobile No" Height = 240 Index = 5 Left = 480 TabIndex = 13 Top = 2460 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Fax No" Height = 240 Index = 6 Left = 480 TabIndex = 12 Top = 2835 Width = 1140 EndEnd
Fax No
Mobile No
Tel No
Email Address
Address
Firstname
Lastname
Company
frmCompanyList - 1 Option Explicit
Dim CURR_COL As IDim rsCompany As Dim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmCompanyList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsCompany If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmCompanyList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Company,LastName,FirstName,Address,EmailAddress,TelNo,MobileNo,FaxNo,CompanyID" .Tables = "[Company]" .SortOrder = "LastName ASC" .SaveStatement End With rsCompany.CursorLocation = adUseClient rsCompany.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCompany, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCompany, RecordPage.PageStart, RecordPage.PageEnd, 8, 2, False, True, , , , "CompanyID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCompanyList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmCompanyList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmCompanyList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCompanyList Caption = "Company" ClientHeight = 6000 ClientLeft = 60 ClientTop = 345 ClientWidth = 8100 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 6000 ScaleWidth = 8100 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8100 TabIndex = 9 Top = 5610 Width = 8100 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8100 TabIndex = 8 Top = 5595 Width = 8100 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8100 TabIndex = 0 Top = 5625 Width = 8100 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmCompanyList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 510 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 9 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Company" Object.Width = 6288 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Lastname" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Company, LastName, FirstName, Address, TelNo, CompanyID" .Tables = "Company" .SortOrder = "Company ASC" .SaveStatement End With If rsCompany.State = 1 Then rsCompany.Close rsCompany.CursorLocation = adUseClient Debug.Print CN rsCompany.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCompany, 75 FillList 1 End With
cboField.ListIndex = 0End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCompany, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "CompanyID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize1() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer)' mdiMain.RemToWin Me.Caption' mdiMain.HideTBButton "", True Set frmCustomerLookup = NothingEnd Sub
Private Sub SetNavigation() With RecordPage
frmCompanyLookup - 3 If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() RefForm.txtCompany.Text = lvList.SelectedItem Unload MeEnd Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)' If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
Private Sub txtSearch_Change() If txtSearch.Text = "" Then RefreshRecords FilterRecord "[" & cboField.Text & "] Like '" & txtSearch.Text & "%'"End Sub
frmCompanyLookup - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCompanyLookup BorderStyle = 1 'Fixed Single Caption = "Company" ClientHeight = 5355 ClientLeft = 45 ClientTop = 330 ClientWidth = 7500 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5355 ScaleWidth = 7500 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 7500 TabIndex = 6 Top = 4980 Width = 7500 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 7 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 11 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 10 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 9 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 8 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 12
frmCompanyLookup - 2 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 13 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 7500 TabIndex = 5 Top = 4950 Width = 7500 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 7500 TabIndex = 4 Top = 4965 Width = 7500 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 375 Left = 6510 TabIndex = 3 Top = 4440 Width = 735 End Begin VB.CommandButton cmdOK Caption = "OK" Height = 375 Left = 5640 TabIndex = 2 Top = 4440 Width = 795 End Begin VB.TextBox txtSearch Height = 315 Left = 3180 TabIndex = 1 Top = 120 Width = 1515 End Begin VB.ComboBox cboField Height = 315 Left = 1560 Style = 2 'Dropdown List TabIndex = 0 Top = 120 Width = 1515 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 30 TabIndex = 14 Top = 900 Width = 7260
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Countries] WHERE CountryID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmCountriesList.RefreshRecords End If End If Set frmCountries = NothingEnd Sub
frmCountries - 1 VERSION 5.00Begin VB.Form frmCountries BorderStyle = 1 'Fixed Single Caption = "Countries" ClientHeight = 1740 ClientLeft = 45 ClientTop = 330 ClientWidth = 5640 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1740 ScaleWidth = 5640 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 330 TabIndex = 3 Top = 1125 Width = 1680 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3870 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2430 TabIndex = 1 Top = 1125 Width = 1335 End Begin VB.TextBox txtEntry Height = 285 Left = 1770 MaxLength = 100 TabIndex = 0 Tag = "Category" Top = 210 Width = 3030 End Begin VB.PictureBox b8Line1 Height = 30 Left = 150 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 4 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Country" Height = 240 Left = 450 TabIndex = 5 Top = 210 Width = 1215 EndEnd
Country
frmCountriesList - 1 Option Explicit
Dim CURR_COL As IDim rsCountry As Dim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmCountriesList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsCountry If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmCountriesList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Country,CountryID" .Tables = "[Countries]" .SortOrder = "Country ASC" .SaveStatement End With rsCountry.CursorLocation = adUseClient rsCountry.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCountry, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCountry, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "CountryID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCountriesList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmCountriesList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmCountriesList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCountriesList Caption = "Countries" ClientHeight = 5985 ClientLeft = 60 ClientTop = 345 ClientWidth = 8610 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5985 ScaleWidth = 8610 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8610 TabIndex = 9 Top = 5580 Width = 8610 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8610 TabIndex = 8 Top = 5595 Width = 8610 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8610 TabIndex = 0 Top = 5610 Width = 8610 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmCountriesList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 450 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Countries" BeginProperty Font Name = "Tahoma"
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "LastName, FirstName, Address, TelNo, CustomerID" .Tables = "Customers" .SortOrder = "LastName ASC" .SaveStatement End With If rsCustomers.State = 1 Then rsCustomers.Close rsCustomers.CursorLocation = adUseClient Debug.Print CN rsCustomers.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCustomers, 75 FillList 1 End With
cboField.ListIndex = 0End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCustomers, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "CustomerID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize1() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer)' mdiMain.RemToWin Me.Caption' mdiMain.HideTBButton "", True Set frmCustomerLookup = NothingEnd Sub
Private Sub SetNavigation() With RecordPage
frmCustomerLookup - 3 If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() RefForm.txtLastName.Text = lvList.SelectedItem RefForm.txtFirstName.Text = lvList.SelectedItem.SubItems(1) Unload MeEnd Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)' If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
Private Sub txtSearch_Change() If txtSearch.Text = "" Then RefreshRecords FilterRecord "[" & cboField.Text & "] Like '" & txtSearch.Text & "%'"End Sub
frmCustomerLookup - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCustomerLookup BorderStyle = 1 'Fixed Single Caption = "Customers" ClientHeight = 5355 ClientLeft = 45 ClientTop = 330 ClientWidth = 7500 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5355 ScaleWidth = 7500 StartUpPosition = 2 'CenterScreen Begin VB.ComboBox cboField Height = 315 Left = 1560 Style = 2 'Dropdown List TabIndex = 16 Top = 90 Width = 1515 End Begin VB.TextBox txtSearch Height = 315 Left = 3180 TabIndex = 14 Top = 90 Width = 1515 End Begin VB.CommandButton cmdOK Caption = "OK" Height = 375 Left = 5640 TabIndex = 13 Top = 4410 Width = 795 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 375 Left = 6510 TabIndex = 12 Top = 4410 Width = 735 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 7500 TabIndex = 9 Top = 4950 Width = 7500 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 7500 TabIndex = 8 Top = 4965 Width = 7500 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0
frmCustomerLookup - 2 ScaleHeight = 375 ScaleWidth = 7500 TabIndex = 0 Top = 4980 Width = 7500 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 30 TabIndex = 10 Top = 870 Width = 7260
Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM Customers WHERE CustomerID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False PK = getIndex("Customers") Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmCustomersList.RefreshRecords End If End If Set frmCustomers = NothingEnd Sub
Private Sub txtEntry_GotFocus(Index As Integer) HLText txtEntry(Index)End Sub
frmCustomers - 1 VERSION 5.00Begin VB.Form frmCustomers BorderStyle = 1 'Fixed Single Caption = "Customers" ClientHeight = 4050 ClientLeft = 45 ClientTop = 330 ClientWidth = 6405 KeyPreview = -1 'True LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 4050 ScaleWidth = 6405 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Index = 5 Left = 1605 MaxLength = 100 TabIndex = 5 Top = 2190 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 6 Left = 1605 MaxLength = 100 TabIndex = 6 Top = 2565 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 3 Left = 1605 MaxLength = 100 TabIndex = 3 Top = 1470 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 4 Left = 1605 MaxLength = 100 TabIndex = 4 Top = 1845 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 2 Left = 1605 MaxLength = 100 TabIndex = 2 Top = 1095 Width = 3840 End Begin VB.TextBox txtEntry Height = 285 Index = 0 Left = 1605 MaxLength = 100 TabIndex = 0 Tag = "Lastname" Top = 330 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 1 Left = 1605 MaxLength = 100 TabIndex = 1 Tag = "Firstname"
frmCustomers - 2 Top = 705 Width = 2415 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 3090 TabIndex = 7 Top = 3405 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 4530 TabIndex = 8 Top = 3405 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 690 TabIndex = 9 Top = 3420 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 420 ScaleHeight = 30 ScaleWidth = 5415 TabIndex = 10 Top = 3180 Width = 5415 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Fax No" Height = 240 Index = 6 Left = 405 TabIndex = 17 Top = 2565 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Mobile No" Height = 240 Index = 5 Left = 405 TabIndex = 16 Top = 2190 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Tel No" Height = 240 Index = 4 Left = 405 TabIndex = 15 Top = 1845 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Email Address" Height = 240 Index = 3 Left = 405 TabIndex = 14 Top = 1470 Width = 1140 End
frmCustomers - 3 Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Address" Height = 240 Index = 2 Left = 405 TabIndex = 13 Top = 1095 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Firstname" Height = 240 Index = 0 Left = 405 TabIndex = 12 Top = 705 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Lastname" Height = 240 Index = 1 Left = 405 TabIndex = 11 Top = 330 Width = 1140 EndEnd
Lastname
Firstname
Address
Email Address
Tel No
Mobile No
Fax No
frmCustomersList - 1 Option Explicit
Dim CURR_COL As IDim rsCustomers ADim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmCustomersList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsCustomers If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmCustomersList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "LastName,FirstName,Address,EmailAddress,TelNo,MobileNo,FaxNo,CustomerID" .Tables = "[Customers]" .SortOrder = "LastName ASC" .SaveStatement End With rsCustomers.CursorLocation = adUseClient rsCustomers.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCustomers, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCustomers, RecordPage.PageStart, RecordPage.PageEnd, 8, 2, False, True, , , , "CustomerID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCustomersList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmCustomersList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmCustomersList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCustomersList Caption = "Customers" ClientHeight = 5940 ClientLeft = 60 ClientTop = 345 ClientWidth = 7515 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5940 ScaleWidth = 7515 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 7515 TabIndex = 2 Top = 5565 Width = 7515 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [ID Type] WHERE IDTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmIDTypeList.RefreshRecords End If End If Set frmIDType = NothingEnd Sub
frmIDType - 1 VERSION 5.00Begin VB.Form frmIDType BorderStyle = 1 'Fixed Single Caption = "Form2" ClientHeight = 1725 ClientLeft = 45 ClientTop = 330 ClientWidth = 5550 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1725 ScaleWidth = 5550 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1710 MaxLength = 100 TabIndex = 3 Tag = "Category" Top = 210 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2370 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3810 TabIndex = 1 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 270 TabIndex = 0 Top = 1125 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 90 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 4 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "ID Type" Height = 240 Left = 390 TabIndex = 5 Top = 210 Width = 1215 EndEnd
ID Type
frmIDTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsIDType As NDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmIDTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsIDType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmIDTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "IDType,IDTypeID" .Tables = "[ID Type]" .SortOrder = "IDType ASC" .SaveStatement End With rsIDType.CursorLocation = adUseClient rsIDType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsIDType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsIDType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "IDTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmIDTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmIDTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmIDTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmIDTypeList BorderStyle = 1 'Fixed Single Caption = "ID Type" ClientHeight = 5565 ClientLeft = 45 ClientTop = 330 ClientWidth = 7710 LinkTopic = "Form2" MaxButton = 0 'False MDIChild = -1 'True MinButton = 0 'False ScaleHeight = 5565 ScaleWidth = 7710 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 7710 TabIndex = 2 Top = 5190 Width = 7710 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8
frmIDTypeList - 2 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 7710 TabIndex = 1 Top = 5175 Width = 7710 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 7710 TabIndex = 0 Top = 5160 Width = 7710 End Begin MSComctlLib.ListView lvList Height = 3435 Left = -30 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent
frmIDTypeList - 3 Caption = "ID Type" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 45 TabIndex = 11 Top = 150 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = -30 Top = 150 Width = 6915 EndEnd
ID Type
Selected Record: 0 0 - 0 of 0
frmInventoryView - 1 Option Explicit
Dim CURR_COL As IDim rsInventory ADim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmInventoryView - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsInventory If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub CmdChange_Click() Call UpdateDate FilterRecord "Format([Date],'m') = " & cbMonth.ListIndex + 1End Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load()
frmInventoryView - 3 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With cbMonth.ListIndex = Month(Date) - 1 txtYear.Text = Year(Date) Call UpdateDate Dim rsRooms As New Recordset With rsRooms .Open "SELECT RoomNumber FROM Rooms", CN, adOpenStatic, adLockOptimistic lvList.ColumnHeaders.Add , , "Date" If .RecordCount > 0 Then Do While Not .EOF lvList.ColumnHeaders.Add , , .Fields("RoomNumber") .MoveNext Loop End If End With With SQLParser '.Fields = "[Date],[201],[202],203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321" .Fields = "*" .Tables = "[qry_Inventory_View]" .wCondition = "Format([Date],'m') = " & cbMonth.ListIndex + 1 .SortOrder = "[Date] ASC" .SaveStatement End With rsInventory.CursorLocation = adUseClient rsInventory.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsInventory, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsInventory, RecordPage.PageStart, RecordPage.PageEnd, 40, 2, False, True, , , , "Date") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195
frmInventoryView - 4 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmInventoryView = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidth
frmInventoryView - 5 End Sub
Private Sub UpdateDate() On Error Resume Next CN.Execute "UPDATE DateTemp SET DateTemp.[Date] = '" & cbMonth.ListIndex + 1 & "' & '/' & Day([Date]) & '/' & '" & txtYear.Text & "'"End Sub
frmInventoryView - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmInventoryView Caption = "Inventory View" ClientHeight = 7170 ClientLeft = 60 ClientTop = 345 ClientWidth = 9375 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 7170 ScaleWidth = 9375 Begin VB.CommandButton CmdChange Caption = "Change" Height = 315 Left = 5070 TabIndex = 16 Top = 90 Width = 1245 End Begin VB.TextBox txtYear Height = 315 Left = 3300 TabIndex = 13 Top = 90 Width = 1515 End Begin VB.ComboBox cbMonth Height = 315 Left = 840 Style = 2 'Dropdown List TabIndex = 12 Top = 90 Width = 1725 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9375 TabIndex = 2 Top = 6795 Width = 9375 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5
frmInventoryView - 2 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9375 TabIndex = 1 Top = 6780 Width = 9375 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9375 TabIndex = 0 Top = 6765 Width = 9375 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 870 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1"
frmInventoryView - 3 ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 0 End Begin VB.Label Label2 AutoSize = -1 'True Caption = "Year" Height = 195 Left = 2850 TabIndex = 15 Top = 120 Width = 330 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Month" Height = 195 Left = 240 TabIndex = 14 Top = 120 Width = 450 End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Inventory View" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 570 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 570 Width = 6915 EndEnd
Inventory View
Month Year
Selected Record: 0 0 - 0 of 0
frmLocate - 1 Option Explicit
Private Sub cmdBr dlgOpen.ShowOpen txtPath.Text = End Sub
Private Sub cmdCa If CN.State = 1 EndEnd Sub
frmLocate - 1 VERSION 5.00Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"Begin VB.Form frmLocate BorderStyle = 1 'Fixed Single Caption = "Locate Database" ClientHeight = 2295 ClientLeft = 45 ClientTop = 345 ClientWidth = 4980 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2295 ScaleWidth = 4980 StartUpPosition = 3 'Windows Default Begin VB.TextBox txtPath Height = 315 Left = 600 TabIndex = 3 Top = 1320 Width = 3615 End Begin VB.CommandButton cmdBrowse Caption = "..." Height = 345 Left = 4260 TabIndex = 2 Top = 1320 Width = 375 End Begin VB.CommandButton cmdOK Caption = "OK" Height = 315 Left = 2490 TabIndex = 1 Top = 1770 Width = 1035 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3600 TabIndex = 0 Top = 1770 Width = 1035 End Begin MSComDlg.CommonDialog dlgOpen Left = 3000 Top = 270 _ExtentX = 847 _ExtentY = 847 _Version = 393216 End Begin VB.Frame Frame1 Caption = "Data Provider" Height = 1005 Left = 90 TabIndex = 4 Top = 150 Width = 4605 Begin VB.OptionButton optJet4 Caption = "Microsoft Jet OLEDB 4.0" Height = 285 Left = 150 TabIndex = 6 Top = 300 Value = -1 'True Width = 2655 End Begin VB.OptionButton Option1 Caption = "ODBC" Enabled = 0 'False Height = 285 Left = 150 TabIndex = 5 Top = 630 Width = 2655
frmLocate - 2 End End Begin VB.Label Label1 Caption = "Path" Height = 285 Left = 90 TabIndex = 7 Top = 1350 Width = 765 EndEnd
Path
frmLogin - 1 Option Explicit
Private Sub cmdCa modMain.Close Unload MeEnd Sub
Private Sub cmdLo 'Verify If dcUser.Tex If txtPass.Te
frmOtherCharges - 1 Public FolioNumbePublic GuestName Public RefForm
Dim OtherCharges Dim cIRowCount
Private Sub btnRe 'Remove selec With Grid 'Update t
frmOtherCharges - 2
Public Sub cmdSave_Click() Dim rsOtherCharges As New Recordset
rsOtherCharges.CursorLocation = adUseClient rsOtherCharges.Open "SELECT * FROM [Other Charges] WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic DeleteItems Dim c As Integer With Grid 'Save the details of the records For c = 1 To cIRowCount .Row = c If .TextMatrix(c, 1) = "" Then rsOtherCharges.AddNew rsOtherCharges![FolioNumber] = FolioNumber Else rsOtherCharges.Filter = "OtherChargesID = " & toNumber(.TextMatrix(c, 1)) If rsOtherCharges.RecordCount = 0 Then rsOtherCharges.AddNew rsOtherCharges![FolioNumber] = FolioNumber End If End If
OtherCharges = OtherCharges + .TextMatrix(c, 6) Next c End With
'Clear variables c = 0 Set rsOtherCharges = Nothing Unload frmOtherChargesEnd Sub
Private Sub cmdUpdate_Click() With Grid .TextMatrix(.RowSel, 3) = dtpDate.Value .TextMatrix(.RowSel, 4) = dcChargeType.Text .TextMatrix(.RowSel, 5) = txtDescription.Text .TextMatrix(.RowSel, 6) = toMoney(txtAmount.Text) End WithEnd Sub
Private Sub Form_Activate() OtherCharges = 0End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() Call InitGrid bind_dc "SELECT * FROM [Charge Type]", "ChargeType", dcChargeType, "ChargeTypeID", True
txtGuestName.Text = GuestName dtpDate.Value = Date
frmOtherCharges - 3 DisplayForEditingEnd Sub
'Procedure used to initialize the gridPrivate Sub InitGrid() cIRowCount = 0 With Grid .Clear .ClearStructure .Rows = 2 .FixedRows = 1 .FixedCols = 1 .Cols = 7 .ColSel = 6 'Initialize the column size .ColWidth(0) = 315 .ColWidth(1) = 0 .ColWidth(2) = 0 .ColWidth(3) = 1200 .ColWidth(4) = 1500 .ColWidth(5) = 1700 .ColWidth(6) = 1200
'Initialize the column name .TextMatrix(0, 0) = "" .TextMatrix(0, 1) = "Other Charges ID" .TextMatrix(0, 2) = "Folio Number" .TextMatrix(0, 3) = "Date" .TextMatrix(0, 4) = "Charge Type" .TextMatrix(0, 5) = "Description" .TextMatrix(0, 6) = "Amount" End WithEnd Sub
Private Sub Form_Unload(Cancel As Integer) Set frmPayment = NothingEnd Sub
Private Sub Grid_Click() With Grid If .TextMatrix(.RowSel, 3) = "" Then Exit Sub dtpDate.Value = .TextMatrix(.RowSel, 3) dcChargeType.Text = .TextMatrix(.RowSel, 4) txtDescription.Text = .TextMatrix(.RowSel, 5) txtAmount.Text = .TextMatrix(.RowSel, 6) If Grid.Rows = 2 And Grid.TextMatrix(1, 2) = "" Then '1 = Folio Number btnRemove.Visible = False Else btnRemove.Visible = True btnRemove.Top = (Grid.CellTop + Grid.Top) - 20 btnRemove.Left = Grid.Left + 50 End If End WithEnd Sub
Private Sub ResetFields() txtAmount.Text = "" dcChargeType.SetFocusEnd Sub
Private Sub DisplayForEditing() On Error GoTo err 'Display the details Dim rsOtherCharges As New Recordset
cIRowCount = 0 rsOtherCharges.CursorLocation = adUseClient rsOtherCharges.Open "SELECT * FROM qry_Other_Charges WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic If rsOtherCharges.RecordCount > 0 Then
frmOtherCharges - 4 rsOtherCharges.MoveFirst While Not rsOtherCharges.EOF cIRowCount = cIRowCount + 1 'increment With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsOtherCharges!OtherChargesID .TextMatrix(1, 2) = rsOtherCharges!FolioNumber .TextMatrix(1, 3) = rsOtherCharges!Date .TextMatrix(1, 4) = rsOtherCharges!ChargeType .TextMatrix(1, 5) = rsOtherCharges!Description .TextMatrix(1, 6) = toMoney(rsOtherCharges!Amount) Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsOtherCharges!OtherChargesID .TextMatrix(.Rows - 1, 2) = rsOtherCharges!FolioNumber .TextMatrix(.Rows - 1, 3) = rsOtherCharges!Date .TextMatrix(.Rows - 1, 4) = rsOtherCharges!ChargeType .TextMatrix(.Rows - 1, 5) = rsOtherCharges!Description .TextMatrix(.Rows - 1, 6) = toMoney(rsOtherCharges!Amount) End If End With rsOtherCharges.MoveNext Wend Grid.Row = 1 Grid.ColSel = 6 'Set fixed cols If State = adStateEditMode Then Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If End If
rsOtherCharges.Close 'Clear variables Set rsOtherCharges = Nothing
Exit Suberr: If err.Number = 94 Then Resume Next prompt_err err, Name, "DisplayForEditing" Screen.MousePointer = vbDefaultEnd Sub
Private Sub DeleteItems() Dim CurrRow As Integer Dim rsOtherCharges As New Recordset
rsOtherCharges.CursorLocation = adUseClient rsOtherCharges.Open "SELECT * FROM [Other Charges] WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic If rsOtherCharges.RecordCount > 0 Then rsOtherCharges.MoveFirst While Not rsOtherCharges.EOF CurrRow = getFlexPos(Grid, 1, rsOtherCharges!OtherChargesID) 'Add to grid With Grid If CurrRow < 0 Then 'Delete record if doesnt exist in flexgrid DelRecwSQL "[Other Charges]", "OtherChargesID", "", True, rsOtherCharges!OtherChargesID End If End With rsOtherCharges.MoveNext Wend End IfEnd Sub
Private Sub txtAmount_GotFocus() HLText txtAmountEnd Sub
Private Sub txtAmount_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
frmOtherCharges - 5
Private Sub txtAmount_Validate(Cancel As Boolean) txtAmount.Text = toMoney(txtAmount.Text)End Sub
frmOtherCharges - 2 Height = 345 Left = 600 TabIndex = 10 Top = 30 Width = 2055 End Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End End Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid Height = 2220 Left = 240 TabIndex = 21 Top = 2010 Width = 8205 _ExtentX = 14473 _ExtentY = 3916 _Version = 393216 Rows = 0 FixedRows = 0 FixedCols = 0 RowHeightMin = 275 ForeColorFixed = -2147483640 BackColorSel = 1091552 ForeColorSel = 16777215 BackColorBkg = -2147483643 GridColor = -2147483633 GridColorFixed = -2147483633 GridColorUnpopulated= -2147483633 AllowBigSelection= 0 'False FocusRect = 0 SelectionMode = 1 AllowUserResizing= 3 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty _NumberOfBands = 1 _Band(0).Cols = 2 _Band(0).GridLinesBand= 1 _Band(0).TextStyleBand= 0 _Band(0).TextStyleHeader= 0 End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 4485 Left = 0 ScaleHeight = 299 ScaleMode = 3 'Pixel ScaleWidth = 579 TabIndex = 12 Top = 570 Width = 8685 Begin VB.TextBox txtDescription Height = 315 Left = 3750 TabIndex = 2 Top = 990 Width = 1485 End Begin VB.CommandButton cmdSave Caption = "Save" Height = 375 Left = 6480
frmOtherCharges - 3 TabIndex = 7 Top = 3930 Visible = 0 'False Width = 885 End Begin VB.CommandButton cmdUpdate Caption = "Update" Height = 375 Left = 7740 TabIndex = 6 Top = 930 Width = 795 End Begin VB.CommandButton cmdClose Caption = "Close" Height = 375 Left = 7470 TabIndex = 8 Top = 3930 Width = 1005 End Begin VB.CommandButton cmdAdd Caption = "Add" Height = 375 Left = 6840 TabIndex = 5 Top = 930 Width = 825 End Begin VB.TextBox txtAmount Alignment = 1 'Right Justify Height = 315 Left = 5310 TabIndex = 4 Text = "0.00" Top = 990 Width = 1455 End Begin VB.TextBox txtGuestName Appearance = 0 'Flat Height = 315 Left = 1080 Locked = -1 'True TabIndex = 0 TabStop = 0 'False Top = 120 Width = 1815 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 13 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 150 ScaleHeight = 30 ScaleWidth = 8355 TabIndex = 14 Top = 3780 Width = 8355 End Begin MSComCtl2.DTPicker dtpDate Height = 315 Left = 240 TabIndex = 3 TabStop = 0 'False Top = 990 Width = 1515 _ExtentX = 2672 _ExtentY = 556 _Version = 393216 Format = 104136705
frmOtherCharges - 4 CurrentDate = 39539 End Begin MSDataListLib.DataCombo dcChargeType Height = 315 Left = 1860 TabIndex = 1 Top = 990 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Description" Height = 195 Left = 3810 TabIndex = 22 Top = 750 Width = 795 End Begin VB.Label Label5 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Date" Height = 195 Left = 270 TabIndex = 19 Top = 750 Width = 345 End Begin VB.Label Label9 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Amount" Height = 195 Left = 5370 TabIndex = 18 Top = 720 Width = 540 End Begin VB.Label Label7 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Charge Type" Height = 195 Left = 1890 TabIndex = 17 Top = 750 Width = 915 End Begin VB.Label Label1 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Guest Name" Height = 195 Left = 90 TabIndex = 16 Top = 150 Width = 885 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False
frmOtherCharges - 5 EndProperty Height = 165 Left = 9450 TabIndex = 15 Top = 3030 Width = 45 End EndEnd
Guest Name
Charge Type AmountDate Description
6
Other ChargesFill all fields or fields with '*' then click 'Save' button to update.
frmPayment - 1 Public FolioNumbePublic GuestName Public Balance Public RefForm
Dim AmountPaid Dim cIRowCount
Private Sub btnRe 'Remove selec With Grid
frmPayment - 2 End Sub
Private Sub CmdClose_Click() Dim c As Integer With Grid 'Save the details of the records For c = 1 To cIRowCount .Row = c AmountPaid = AmountPaid + .TextMatrix(c, 8) Next c End With
'Clear variables c = 0 RefForm.AmountPaid = AmountPaid Me.HideEnd Sub
Public Sub cmdSave_Click() Dim rsPayments As New Recordset
rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM Payments WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic DeleteItems Dim c As Integer With Grid 'Save the details of the records For c = 1 To cIRowCount .Row = c If .TextMatrix(c, 1) = "" Then rsPayments.AddNew rsPayments![FolioNumber] = FolioNumber Else rsPayments.Filter = "PaymentID = " & toNumber(.TextMatrix(c, 1)) If rsPayments.RecordCount = 0 Then rsPayments.AddNew rsPayments![FolioNumber] = FolioNumber End If End If
AmountPaid = AmountPaid + .TextMatrix(c, 8) Next c End With
'Clear variables c = 0 Set rsPayments = Nothing Unload frmPaymentEnd Sub
Private Sub cmdUpdate_Click() With Grid .TextMatrix(.RowSel, 3) = dtpDate.Value .TextMatrix(.RowSel, 4) = dcPaymentType.Text .TextMatrix(.RowSel, 5) = txtCardNumber.Text
frmPayment - 3 .TextMatrix(.RowSel, 6) = txtAuthCode.Text .TextMatrix(.RowSel, 7) = txtValidTill.Text .TextMatrix(.RowSel, 8) = toMoney(txtAmountPaid.Text) End WithEnd Sub
Private Sub dcPaymentType_Click(Area As Integer) If dcPaymentType.Text = "Cash Refund" Then If txtAmountPaid.Text > 0 Then txtAmountPaid.Text = toMoney(toNumber(-txtAmountPaid.Text)) End IfEnd Sub
Private Sub Form_Activate() AmountPaid = 0End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() Call InitGrid bind_dc "SELECT * FROM [Payment Type] ORDER BY PaymentType", "PaymentType", dcPaymentType, "paymentTypeID", False dcPaymentType.Text = "Cash" dtpDate.Value = Date txtGuestName.Text = GuestName DisplayForEditingEnd Sub
Private Sub Form_Unload(Cancel As Integer) Set frmPayment = NothingEnd Sub
Private Sub Grid_Click() With Grid
frmPayment - 4 If .TextMatrix(.RowSel, 3) = "" Then Exit Sub dtpDate.Value = .TextMatrix(.RowSel, 3) dcPaymentType.Text = .TextMatrix(.RowSel, 4) txtCardNumber.Text = .TextMatrix(.RowSel, 5) txtAuthCode.Text = .TextMatrix(.RowSel, 6) txtValidTill.Text = .TextMatrix(.RowSel, 7) txtAmountPaid.Text = .TextMatrix(.RowSel, 8) If Grid.Rows = 2 And Grid.TextMatrix(1, 2) = "" Then btnRemove.Visible = False Else btnRemove.Visible = True btnRemove.Top = (Grid.CellTop + Grid.Top) - 20 btnRemove.Left = Grid.Left + 50 End If End WithEnd Sub
Private Sub ResetFields() txtAmountPaid.Text = "" txtCardNumber.Text = "" txtAuthCode.Text = "" txtAmountPaid.SetFocusEnd Sub
Private Sub DisplayForEditing() On Error GoTo err 'Display the details Dim rsPayments As New Recordset
cIRowCount = 0 rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM qry_Payments WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic If rsPayments.RecordCount > 0 Then rsPayments.MoveFirst While Not rsPayments.EOF cIRowCount = cIRowCount + 1 'increment With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsPayments!PaymentID .TextMatrix(1, 2) = rsPayments!FolioNumber .TextMatrix(1, 3) = rsPayments!Date .TextMatrix(1, 4) = rsPayments!PaymentType .TextMatrix(1, 5) = rsPayments!CardNumber .TextMatrix(1, 6) = rsPayments!AuthorityNumber .TextMatrix(1, 7) = rsPayments!ValidTill .TextMatrix(1, 8) = toMoney(rsPayments!Amount) Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsPayments!PaymentID .TextMatrix(.Rows - 1, 2) = rsPayments!FolioNumber .TextMatrix(.Rows - 1, 3) = rsPayments!Date .TextMatrix(.Rows - 1, 4) = rsPayments!PaymentType .TextMatrix(.Rows - 1, 5) = rsPayments!CardNumber .TextMatrix(.Rows - 1, 6) = rsPayments!AuthorityNumber .TextMatrix(.Rows - 1, 7) = rsPayments!ValidTill .TextMatrix(.Rows - 1, 8) = toMoney(rsPayments!Amount) End If End With ' AmountPaid = rsPayments!Amount rsPayments.MoveNext Wend Grid.Row = 1 Grid.ColSel = 8 'Set fixed cols If State = adStateEditMode Then Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If
frmPayment - 5 End If
rsPayments.Close 'Clear variables Set rsPayments = Nothing
Exit Suberr: If err.Number = 94 Then Resume Next prompt_err err, Name, "DisplayForEditing" Screen.MousePointer = vbDefaultEnd Sub
Private Sub DeleteItems() Dim CurrRow As Integer Dim rsPayments As New Recordset ' If State = adStateAddMode Then Exit Sub rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM Payments WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic If rsPayments.RecordCount > 0 Then rsPayments.MoveFirst While Not rsPayments.EOF CurrRow = getFlexPos(Grid, 1, rsPayments!PaymentID) 'Add to grid With Grid If CurrRow < 0 Then 'Delete record if doesnt exist in flexgrid DelRecwSQL "Payments", "PaymentID", "", True, rsPayments!PaymentID End If End With rsPayments.MoveNext Wend End IfEnd Sub
Public Sub RefreshBalance() txtBalance.Text = toMoney(Balance)End Sub
Private Sub txtAmountPaid_GotFocus() HLText txtAmountPaidEnd Sub
Private Sub txtAmountPaid_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtAmountPaid_Validate(Cancel As Boolean) txtAmountPaid.Text = toMoney(txtAmountPaid.Text)End Sub
frmPayment - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"Begin VB.Form frmPayment BorderStyle = 1 'Fixed Single Caption = "Amount Paid Details" ClientHeight = 6000 ClientLeft = 45 ClientTop = 345 ClientWidth = 9000 ControlBox = 0 'False KeyPreview = -1 'True LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 6000 ScaleWidth = 9000 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtValidTill Height = 315 Left = 4950 TabIndex = 7 Top = 2490 Width = 1245 End Begin VB.CommandButton cmdSave Caption = "Save" Height = 375 Left = 6750 TabIndex = 10 Top = 5460 Visible = 0 'False Width = 885 End Begin VB.TextBox txtAuthCode Height = 315 Left = 3660 TabIndex = 6 Top = 2490 Width = 1245 End Begin VB.CommandButton cmdUpdate Caption = "Update" Height = 375 Left = 7260 TabIndex = 9 Top = 2460 Width = 795 End Begin VB.CommandButton cmdClose Caption = "Close" Height = 375 Left = 7740 TabIndex = 11 Top = 5460 Width = 1005 End Begin VB.CommandButton cmdAdd Caption = "Add" Height = 375 Left = 6330 TabIndex = 8 Top = 2460 Width = 825 End Begin VB.TextBox txtAmountPaid Alignment = 1 'Right Justify Height = 315 Left = 4410 TabIndex = 3 Text = "0.00" Top = 1320 Width = 1815 End Begin VB.TextBox txtBalance
frmPayment - 2 Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 315 Left = 1080 Locked = -1 'True TabIndex = 1 TabStop = 0 'False Top = 1290 Width = 1815 End Begin VB.TextBox txtCardNumber Height = 315 Left = 2160 TabIndex = 5 Top = 2490 Width = 1455 End Begin VB.TextBox txtGuestName Appearance = 0 'Flat Height = 315 Left = 1080 Locked = -1 'True TabIndex = 0 TabStop = 0 'False Top = 840 Width = 1815 End Begin VB.CommandButton btnRemove Height = 275 Left = 300 Picture = (Icon) Style = 1 'Graphical TabIndex = 18 ToolTipText = "Remove" Top = 3030 Visible = 0 'False Width = 275 End Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 581 TabIndex = 12 Top = 0 Width = 8715 Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Payments" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 14 Top = 30 Width = 1395
frmPayment - 3 End Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 13 Top = 360 Width = 3900 End End Begin VB.PictureBox b8Line5 Height = 30 Left = 180 ScaleHeight = 30 ScaleWidth = 8625 TabIndex = 19 Top = 5340 Width = 8625 End Begin MSComCtl2.DTPicker dtpDate Height = 375 Left = 4410 TabIndex = 2 TabStop = 0 'False Top = 840 Width = 1515 _ExtentX = 2672 _ExtentY = 661 _Version = 393216 Format = 104136705 CurrentDate = 39539 End Begin VB.PictureBox b8GradLine2 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 180 ScaleHeight = 180 ScaleWidth = 8445 TabIndex = 20 Top = 1830 Width = 8505 End Begin MSDataListLib.DataCombo dcPaymentType Height = 315 Left = 270 TabIndex = 4 Top = 2490 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "Cash" End Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid Height = 2220
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Payment Type] WHERE PaymentTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmPaymentTypeList.RefreshRecords End If End If Set frmPaymentType = NothingEnd Sub
frmPaymentType - 1 VERSION 5.00Begin VB.Form frmPaymentType BorderStyle = 1 'Fixed Single Caption = "Payment Type" ClientHeight = 1815 ClientLeft = 45 ClientTop = 330 ClientWidth = 5565 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1815 ScaleWidth = 5565 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1680 MaxLength = 100 TabIndex = 4 Tag = "Category" Top = 210 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2340 TabIndex = 3 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3780 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 240 TabIndex = 1 Top = 1125 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 60 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 0 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Payment Type" Height = 240 Left = 360 TabIndex = 5 Top = 210 Width = 1215 EndEnd
Payment Type
frmPaymentTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsPaymentTypeDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmPaymentTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsPaymentType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmPaymentTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "PaymentType,PaymentTypeID" .Tables = "[Payment Type]" .SortOrder = "PaymentType ASC" .SaveStatement End With rsPaymentType.CursorLocation = adUseClient rsPaymentType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsPaymentType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsPaymentType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "PaymentTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmPaymentTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmPaymentTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmPaymentTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmPaymentTypeList Caption = "Payment Type" ClientHeight = 5835 ClientLeft = 60 ClientTop = 345 ClientWidth = 8730 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5835 ScaleWidth = 8730 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8730 TabIndex = 2 Top = 5460 Width = 8730 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmPaymentTypeList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8730 TabIndex = 1 Top = 5445 Width = 8730 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8730 TabIndex = 0 Top = 5430 Width = 8730 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Payment Type" BeginProperty Font Name = "Tahoma"
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Rate Type] WHERE RateTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmRateTypeList.RefreshRecords End If End If Set frmRateType = NothingEnd Sub
frmRateType - 1 VERSION 5.00Begin VB.Form frmRateType BorderStyle = 1 'Fixed Single Caption = "Rate Type" ClientHeight = 1755 ClientLeft = 45 ClientTop = 330 ClientWidth = 5670 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1755 ScaleWidth = 5670 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1740 MaxLength = 100 TabIndex = 0 Tag = "Category" Top = 210 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2400 TabIndex = 1 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3840 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 300 TabIndex = 3 Top = 1125 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 120 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 4 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Rate Type" Height = 240 Left = 420 TabIndex = 5 Top = 210 Width = 1215 EndEnd
Rate Type
frmRateTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsRateType AsDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmRateTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRateType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmRateTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "RateType,RateTypeID" .Tables = "[Rate Type]" .SortOrder = "RateType ASC" .SaveStatement End With rsRateType.CursorLocation = adUseClient rsRateType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRateType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRateType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "RateTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmRateTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmRateTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRateTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRateTypeList BorderStyle = 1 'Fixed Single Caption = "Rate Type" ClientHeight = 5805 ClientLeft = 45 ClientTop = 330 ClientWidth = 8580 LinkTopic = "Form2" MaxButton = 0 'False MDIChild = -1 'True MinButton = 0 'False ScaleHeight = 5805 ScaleWidth = 8580 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8580 TabIndex = 2 Top = 5430 Width = 8580 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8
frmRateTypeList - 2 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8580 TabIndex = 1 Top = 5400 Width = 8580 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8580 TabIndex = 0 Top = 5415 Width = 8580 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 450 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent
frmRateTypeList - 3 Caption = "Rate Type" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 150 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 150 Width = 6915 EndEnd
Rate Type
Selected Record: 0 0 - 0 of 0
frmReports - 1 Option Explicit
Public strReport Public PK Public strYear Public blnPaid Public strWhere
Dim mTest As CRAXDim mReport As CRDim SubReport As
frmReports - 2 mParam.Item(2).AddCurrentValue CurrBiz.BUSINESS_ADDRESS mParam.Item(3).AddCurrentValue CurrBiz.BUSINESS_CONTACT_INFO Case "Due Reservation" Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Due_Reservation.rpt")
mReport.RecordSelectionFormula = strWhere
Set mParam = mReport.ParameterFields mParam.Item(1).AddCurrentValue CurrBiz.BUSINESS_NAME mParam.Item(2).AddCurrentValue CurrBiz.BUSINESS_ADDRESS mParam.Item(3).AddCurrentValue CurrBiz.BUSINESS_CONTACT_INFO Case "Guest List" Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Guest_List.rpt")
Set mParam = mReport.ParameterFields mParam.Item(1).AddCurrentValue CurrBiz.BUSINESS_NAME mParam.Item(2).AddCurrentValue CurrBiz.BUSINESS_ADDRESS mParam.Item(3).AddCurrentValue CurrBiz.BUSINESS_CONTACT_INFO Case "Room History" Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Room_History.rpt")
mReport.RecordSelectionFormula = strWhere
Set mParam = mReport.ParameterFields mParam.Item(1).AddCurrentValue CurrBiz.BUSINESS_NAME mParam.Item(2).AddCurrentValue CurrBiz.BUSINESS_ADDRESS mParam.Item(3).AddCurrentValue CurrBiz.BUSINESS_CONTACT_INFO Case "Reservation" Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Reservation.rpt")
mReport.RecordSelectionFormula = strWhere End Select Screen.MousePointer = vbHourglass CR.ReportSource = mReport CR.ViewReport Screen.MousePointer = vbDefault Exit Sub err_Form_Load: prompt_err err, Name, "Form_Load" Screen.MousePointer = vbDefaultEnd Sub
Private Sub Form_Resize() With CR .Top = 0 .Left = 0 .Height = ScaleHeight .Width = ScaleWidth End WithEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name Set frmReports = NothingEnd Sub
Private Sub CmdCheckIn_Click()On Error GoTo err Dim intCount As Integer If dcRoomNumber.BoundText = "" Then MsgBox "Please select Room number.", vbCritical Exit Sub End If Call Save_Record If HaveAction = False Then Exit Sub If MsgBox("Are you sure?", vbYesNo + vbInformation) = vbYes Then Dim FolioNumber As String FolioNumber = getIndex("Transactions") FolioNumber = GenerateID(FolioNumber, Format$(Date, "yy") & "-", "00000")
CN.CommitTrans Unload Me End If Exit Sub err: CN.RollbackTrans prompt_err err, Name, "CmdCheckIn_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub AddRatePerPeriod(FolioNumber As String)On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset Dim tmpDate As Date
tmpDate = dtpDateIn.Value If txtAdults.Tag = "" Then Exit Sub Dim intAdults As Integer If txtAdults.Text = hsAdults.Min Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - hsAdults.Min End If
With rsRatePerPeriod
frmReservation - 3 .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & FolioNumber & "' ORDER BY [Date]", CN, adOpenStatic, adLockOptimistic
Do Until tmpDate > dtpDateOut.Value - 1' .Filter = "[Date] = #" & tmpDate & "#" ' If .RecordCount = 0 Then .AddNew .Fields("FolioNumber") = FolioNumber .Fields("Date") = tmpDate .Fields("RoomNumber") = dcRoomNumber.BoundText .Fields("RateTypeID") = dcRateType.BoundText .Fields("Rate") = txtRate.Text .Fields("Adults") = txtAdults.Tag * intAdults .Fields("Childrens") = toMoney(txtChildrens.Tag) * toNumber(txtChildrens.Text) .Update' End If tmpDate = tmpDate + 1 Loop End With rsRatePerPeriod.Close
Exit Sub
err: prompt_err err, Name, "AddRatePerPeriod" Screen.MousePointer = vbDefaultEnd Sub
Private Sub CmdClose_Click() Unload MeEnd Sub
Private Sub ResetFields()' clearText Me'' txtEntry(15).Text = "0.00"' txtEntry(1).SetFocusEnd Sub
Private Sub cmdLookupComp_Click() With frmCompanyLookup Set .RefForm = Me .Show vbModal End WithEnd Sub
Private Sub cmdLookupCust_Click() With frmCustomerLookup Set .RefForm = Me .Show vbModal End WithEnd Sub
Private Sub CmdPrint_Click() With frmReports .strReport = "Reservation" .strWhere = "{qry_rpt_Reservation.ReservationNo} = '" & txtReservationNo.Text & "'" frmReports.Show vbModal End WithEnd Sub
Private Sub Save_Record()On Error GoTo err Dim rsCustomers As New Recordset Dim CustomerID As Integer Dim CompanyID As Integer
If Trim(txtLastName.Text) = "" Or Trim(txtFirstName.Text) = "" Then
frmReservation - 4 MsgBox "Please complete the name of a guest.", vbInformation Exit Sub End If CN.BeginTrans
With rsCustomers .Open "SELECT * FROM Customers WHERE LastName = '" & txtLastName.Text & "' AND FirstName = '" & txtFirstName.Text & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtLastName.Tag = .Fields("CustomerID") Else .AddNew CustomerID = getIndex("Customers") txtLastName.Tag = CustomerID .Fields("CustomerID") = CustomerID .Fields("LastName") = txtLastName.Text .Fields("FirstName") = txtFirstName.Text .Update End If .Close If txtCompany.Text = "" Then GoSub ContinueSave .Open "SELECT * FROM Company WHERE Company = '" & txtCompany.Text & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtCompany.Tag = .Fields("CompanyID") Else .AddNew
CompanyID = getIndex("Company") txtCompany.Tag = CompanyID .Fields("CompanyID") = CompanyID .Fields("Company") = txtCompany.Text .Update End If .Close End With ContinueSave:
If State = adStateAddMode Then RS.AddNew RS.Fields("ReservationNo") = txtReservationNo.Text RS.Fields("ReservedBy") = CurrUser.USER_PK RS.Fields("AddedByFK") = CurrUser.USER_PK Else RS.Fields("DateModified") = Now RS.Fields("LastUserFK") = CurrUser.USER_PK End If With RS .Fields("CustomerID") = txtLastName.Tag .Fields("Address") = txtAddress.Text .Fields("CountryID") = dcCountry.BoundText .Fields("CompanyID") = IIf(txtCompany.Tag = "", Null, txtCompany.Tag) .Fields("IDTypeID") = dcIDType.BoundText .Fields("IDNumber") = txtIDNumber.Text .Fields("RoomNumber") = dcRoomNumber.BoundText .Fields("DateIn") = dtpDateIn.Value .Fields("DateOut") = dtpDateOut.Value .Fields("RateType") = dcRateType.BoundText .Fields("Rate") = txtRate.Text .Fields("OtherCharges") = txtOtherCharges.Text .Fields("Discount") = txtDiscount.Text
err: CN.RollbackTrans prompt_err err, Name, "cmdSave_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub cmdSave_Click() Call Save_Record If State = adStateAddMode And HaveAction = True Then MsgBox "New record has been successfully saved.", vbInformation
' Unload frmReservation ElseIf State = adStateEditMode And HaveAction = True Then MsgBox "Changes in record has been successfully saved.", vbInformation ' Unload frmReservation End IfEnd Sub
Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _
Private Sub dcRateType_Click(Area As Integer)On Error GoTo err
Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & dcRoomNumber.BoundText & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Text = !NoofPerson hsAdults.Min = !NoofPerson hsAdults.Value = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With rsRoomRates.Close Call ComputeRate Exit Sub err: CN.RollbackTrans prompt_err err, Name, "dcRateType_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub dcRoomNumber_Click(Area As Integer) dcRateType_Click 0End Sub
Public Sub dtpDateOut_Change() If dtpDateOut.Value < dtpDateIn.Value Then Exit Sub txtDays.Text = dtpDateOut.Value - dtpDateIn.Value hsDays.Value = txtDays.Text Call ComputeRateEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load()On Error GoTo err
RS.CursorLocation = adUseClient
bind_dc "SELECT * FROM qry_Available_Rooms", "AvailableRoom", dcRoomNumber, "RoomNumber", True bind_dc "SELECT * FROM Countries", "Country", dcCountry, "CountryID", True bind_dc "SELECT * FROM [ID Type]", "IDType", dcIDType, "IDTypeID", True bind_dc "SELECT * FROM [Rate Type]", "RateType", dcRateType, "RateTypeID", True bind_dc "SELECT * FROM [Business Source]", "BusinessSource", dcBusSource, "BusinessSourceID", True bind_dc "SELECT * FROM [Vehicles]", "Vehicle", dcVehicle, "VehicleID", False dcCountry.Text = "Philippines"
Dim rsRoomRates As New ADODB.Recordset
'Check the form state
frmReservation - 7 If State = adStateAddMode Then RS.Open "SELECT * FROM Reservation WHERE ReservationNo = '" & PK & "'", CN, adOpenStatic, adLockOptimistic
cmdUsrHistory.Enabled = False
dtpDateIn.Value = Date dtpDateOut.Value = dtpDateIn.Value + 1
GeneratePK
rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & dcRoomNumber.BoundText & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic
With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Text = !NoofPerson hsAdults.Min = !NoofPerson hsAdults.Value = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
dcBusSource.BoundText = 2
' Call txtDays_Change
Call ComputeRate Else RS.Open "SELECT * FROM Reservation WHERE ReservationNo = '" & PK & "'", CN, adOpenStatic, adLockOptimistic
rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & RightSplitUF(dcRoomNumber.Tag) & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic
With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) hsAdults.Min = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
DisplayForEditing CmdCheckIn.Visible = True CmdPrint.Visible = True CmdCancel.Visible = True Call ComputeRate End If
rsRoomRates.Close
Exit Sub err: prompt_err err, Name, "Form_Load" Screen.MousePointer = vbDefaultEnd Sub
'Procedure used to generate PKPrivate Sub GeneratePK() PK = getIndex("Reservation") txtReservationNo.Text = GenerateID(PK, Format$(Date, "yy") & "-", "00000")End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True And Shortcut = False Then frmReservationList.RefreshRecords End If Set frmReservation = NothingEnd Sub
frmReservation - 8
Private Sub hsAdults_Change() txtAdults.Text = hsAdults.Value ' Call ComputeAdultsRate Call ComputeRateEnd Sub
Private Sub hsChildrens_Change() txtChildrens.Text = hsChildrens.Value ' Call ComputeChildrensRate Call ComputeRateEnd Sub
Private Sub hsDays_Change() dtpDateOut.Value = dtpDateIn.Value + hsDays.Value txtDays.Text = hsDays.Value Call ComputeRateEnd Sub
Private Sub ComputeRate() If txtAdults.Tag = "" Then Exit Sub Dim intAdults As Integer If txtAdults.Text = hsAdults.Min Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - hsAdults.Min End If txtTotalCharges.Text = (toMoney(txtRate.Text) * toNumber(txtDays.Text)) + (toMoney(txtAdults.Tag) * intAdults) + (toMoney(txtChildrens.Tag) * toNumber(txtChildrens.Text)) txtTotalCharges.Text = toMoney(txtTotalCharges.Text) txtSubTotal.Text = toMoney(toNumber(txtTotalCharges.Text) + toNumber(txtOtherCharges.Text)) txtTotal.Text = toMoney(toNumber(txtSubTotal.Text) - (toNumber(txtSubTotal.Text) * toNumber(txtDiscount.Text) / 100)) txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
Private Sub txtAmountPaid_Change() txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
Private Sub txtDiscount_Change() Call ComputeRateEnd Sub
Private Sub txtDiscount_GotFocus() HLText txtDiscountEnd Sub
Private Sub txtDiscount_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtDiscount_Validate(Cancel As Boolean) txtDiscount.Text = toMoney(txtDiscount.Text)End Sub
Private Sub txtRate_GotFocus() HLText txtRateEnd Sub
Private Sub txtRate_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtRate_Validate(Cancel As Boolean) txtRate.Text = toMoney(txtRate.Text)End Sub
frmReservation - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmReservation BorderStyle = 1 'Fixed Single Caption = "Reservation" ClientHeight = 7845 ClientLeft = 45 ClientTop = 330 ClientWidth = 11265 KeyPreview = -1 'True LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 7845 ScaleWidth = 11265 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 7005 Left = 0 ScaleHeight = 467 ScaleMode = 3 'Pixel ScaleWidth = 775 TabIndex = 4 Top = 540 Width = 11625 Begin VB.CommandButton CmdCheckIn Caption = "Check In" Height = 315 Left = 6780 TabIndex = 79 Top = 6150 Visible = 0 'False Width = 1335 End Begin VB.CommandButton CmdCancel Caption = "Cancel Reservation" Height = 315 Left = 6780 TabIndex = 78 Top = 6540 Visible = 0 'False Width = 2685 End Begin VB.HScrollBar hsAdults Height = 315 Left = 6330 Min = 1 TabIndex = 33 Top = 2340 Value = 1 Width = 495 End Begin VB.HScrollBar hsChildrens Height = 315 Left = 6330 TabIndex = 32 Top = 2760 Width = 495 End Begin VB.HScrollBar hsDays Height = 315 Left = 6330 Min = 1 TabIndex = 31 Top = 1920 Value = 1 Width = 495 End Begin VB.TextBox txtBalance Alignment = 1 'Right Justify Height = 345
frmReservation - 2 Left = 9090 Locked = -1 'True TabIndex = 30 Text = "0.00" Top = 4440 Width = 1815 End Begin VB.TextBox txtAmountPaid Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 29 Text = "0.00" Top = 4050 Width = 1815 End Begin VB.TextBox txtTotalCharges Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 28 Text = "0.00" Top = 1920 Width = 1815 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 420 TabIndex = 27 Top = 6180 Width = 1680 End Begin VB.CommandButton cmdClose Caption = "Close" Height = 315 Left = 9480 TabIndex = 26 Top = 6540 Width = 1335 End Begin VB.TextBox txtChildrens Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 25 Text = "0" Top = 2760 Width = 465 End Begin VB.TextBox txtAdults Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 24 Text = "1" Top = 2340 Width = 465 End Begin VB.TextBox txtDays Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 23 Text = "1" Top = 1920 Width = 465 End Begin VB.TextBox txtDiscount Alignment = 1 'Right Justify Height = 345 Left = 9090
frmReservation - 3 TabIndex = 22 Text = "0.00" Top = 3180 Width = 1575 End Begin VB.TextBox txtRate Alignment = 1 'Right Justify Height = 345 Left = 9090 TabIndex = 21 Text = "0.00" Top = 1500 Width = 1815 End Begin VB.TextBox txtIDNumber Height = 345 Left = 1680 TabIndex = 20 Top = 4200 Width = 1815 End Begin VB.TextBox txtCompany Height = 345 Left = 1680 TabIndex = 19 Top = 2820 Width = 1815 End Begin VB.TextBox txtAddress Height = 345 Left = 1680 TabIndex = 18 Top = 1950 Width = 1815 End Begin VB.TextBox txtFirstName Height = 345 Left = 1680 TabIndex = 17 Top = 1500 Width = 1815 End Begin VB.TextBox txtLastName Height = 345 Left = 1680 TabIndex = 16 Top = 1050 Width = 1815 End Begin VB.TextBox txtReservationNo Appearance = 0 'Flat Height = 345 Left = 1680 TabIndex = 15 Top = 600 Width = 1815 End Begin VB.CommandButton cmdSave Caption = "Save" Height = 315 Left = 9480 TabIndex = 14 Top = 6150 Width = 1335 End Begin VB.TextBox txtOtherCharges Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 13 Text = "0.00" Top = 2340 Width = 1815 End Begin VB.TextBox txtSubTotal Alignment = 1 'Right Justify
frmReservation - 4 Height = 345 Left = 9090 Locked = -1 'True TabIndex = 12 Text = "0.00" Top = 2760 Width = 1815 End Begin VB.TextBox txtTotal Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 11 Text = "0.00" Top = 3600 Width = 1815 End Begin VB.TextBox txtVehicleModel Height = 345 Left = 1650 TabIndex = 10 Top = 5340 Width = 1815 End Begin VB.TextBox txtPlateNo Height = 345 Left = 1650 TabIndex = 9 Top = 5760 Width = 1815 End Begin VB.TextBox txtNotes Height = 1485 Left = 4530 TabIndex = 8 Top = 4500 Width = 3045 End Begin VB.CommandButton cmdLookupCust Caption = ">>" Height = 315 Left = 3540 TabIndex = 7 Top = 1050 Width = 375 End Begin VB.CommandButton cmdLookupComp Caption = ">>" Height = 315 Left = 3540 TabIndex = 6 Top = 2820 Width = 375 End Begin VB.CommandButton CmdPrint Caption = "&Print" Height = 315 Left = 8130 TabIndex = 5 Top = 6150 Visible = 0 'False Width = 1335 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 34 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 240 ScaleHeight = 30
frmReservation - 5 ScaleWidth = 11595 TabIndex = 35 Top = 6060 Width = 11595 End Begin MSDataListLib.DataCombo dcCountry Height = 315 Left = 1680 TabIndex = 36 Top = 2400 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSComCtl2.DTPicker dtpDateIn Height = 345 Left = 5760 TabIndex = 37 Top = 1080 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin VB.PictureBox b8GradLine1 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 180 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 38 Top = 240 Width = 3495 End Begin VB.PictureBox b8GradLine3 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 210 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 39 Top = 3330 Width = 3495 End Begin VB.PictureBox b8GradLine4 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty
frmReservation - 6 ForeColor = &H00404040& Height = 240 Left = 4050 ScaleHeight = 180 ScaleWidth = 4545 TabIndex = 40 Top = 240 Width = 4605 End Begin MSComCtl2.DTPicker dtpDateOut Height = 345 Left = 9090 TabIndex = 41 Top = 1050 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin MSDataListLib.DataCombo dcIDType Height = 315 Left = 1680 TabIndex = 42 Top = 3780 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcRateType Height = 315 Left = 5760 TabIndex = 43 Top = 1530 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcBusSource Height = 315 Left = 5760 TabIndex = 44 Top = 3210 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.PictureBox b8GradLine2 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 240 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 45 Top = 4650 Width = 3495 End Begin MSDataListLib.DataCombo dcVehicle
frmReservation - 7 Height = 315 Left = 1650 TabIndex = 46 Top = 4920 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcRoomNumber Height = 315 Left = 5760 TabIndex = 77 Top = 660 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165 Left = 9450 TabIndex = 76 Top = 3030 Width = 45 End Begin VB.Label Label22 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 75 Top = 1950 Width = 1395 End Begin VB.Label Label21 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Business Source" Height = 300 Left = 4320 TabIndex = 74 Top = 3210 Width = 1395 End Begin VB.Label Label20 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Childrens" Height = 300 Left = 4320 TabIndex = 73
frmReservation - 8 Top = 2790 Width = 1395 End Begin VB.Label Label19 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Adults" Height = 300 Left = 4320 TabIndex = 72 Top = 2370 Width = 1395 End Begin VB.Label Label18 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Days" Height = 300 Left = 4320 TabIndex = 71 Top = 1950 Width = 1395 End Begin VB.Label Label17 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Discount" Height = 300 Left = 7650 TabIndex = 70 Top = 3210 Width = 1395 End Begin VB.Label lblRatePerPeriod Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate/Period" ForeColor = &H00000000& Height = 300 Left = 7650 TabIndex = 69 Top = 1500 Width = 1395 End Begin VB.Label Label15 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate Type" Height = 300 Left = 4320 TabIndex = 68 Top = 1530 Width = 1395 End Begin VB.Label Label14 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date Out" Height = 300 Left = 7650 TabIndex = 67 Top = 1080 Width = 1395 End Begin VB.Label Label13 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date In" Height = 300 Left = 4320 TabIndex = 66 Top = 1110 Width = 1395 End Begin VB.Label Label12 Alignment = 1 'Right Justify BackStyle = 0 'Transparent
frmReservation - 9 Caption = "Room Number" Height = 300 Left = 4320 TabIndex = 65 Top = 660 Width = 1395 End Begin VB.Label Label11 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "ID Type" Height = 300 Left = 240 TabIndex = 64 Top = 3780 Width = 1395 End Begin VB.Label Label10 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "ID Number" Height = 300 Left = 240 TabIndex = 63 Top = 4200 Width = 1395 End Begin VB.Label Label6 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Country" Height = 300 Left = 240 TabIndex = 62 Top = 2400 Width = 1395 End Begin VB.Label Label5 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Company" Height = 300 Left = 240 TabIndex = 61 Top = 2850 Width = 1395 End Begin VB.Label Label4 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Address" Height = 300 Left = 240 TabIndex = 60 Top = 1980 Width = 1395 End Begin VB.Label Label3 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "First name" Height = 300 Left = 240 TabIndex = 59 Top = 1530 Width = 1395 End Begin VB.Label Label2 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Last name" Height = 300 Left = 240 TabIndex = 58 Top = 1080 Width = 1395 End
frmReservation - 10 Begin VB.Label Label1 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Reservation No" Height = 300 Left = 240 TabIndex = 57 Top = 630 Width = 1395 End Begin VB.Label Label25 BackStyle = 0 'Transparent Caption = "%" Height = 315 Left = 10680 TabIndex = 56 Top = 3180 Width = 165 End Begin VB.Line Line1 BorderStyle = 3 'Dot X1 = 516 X2 = 516 Y1 = 44 Y2 = 274 End Begin VB.Label lblOtherCharges Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Other Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 300 Left = 7650 TabIndex = 55 Top = 2370 Width = 1395 End Begin VB.Label Label8 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Sub Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 54 Top = 2790 Width = 1395 End Begin VB.Label lblAmountPaid Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Amount Paid" ForeColor = &H00000000& Height = 300 Left = 7650 TabIndex = 53 Top = 4080 Width = 1395 End Begin VB.Label Label24
frmReservation - 11 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Balance" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 52 Top = 4470 Width = 1395 End Begin VB.Label Label9 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 51 Top = 3630 Width = 1395 End Begin VB.Label Label23 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Model" Height = 300 Left = 210 TabIndex = 50 Top = 5340 Width = 1395 End Begin VB.Label Label28 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Vehicle Make" Height = 300 Left = 210 TabIndex = 49 Top = 4920 Width = 1395 End Begin VB.Label Label29 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Plate No." Height = 300 Left = 210 TabIndex = 48 Top = 5760 Width = 1395 End Begin VB.Label Label16 BackStyle = 0 'Transparent Caption = "Notes" Height = 285 Left = 4530 TabIndex = 47 Top = 4230 Width = 585 End End
frmReservation - 12 Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 30 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 687 TabIndex = 1 Top = 0 Width = 10305 Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Reservation" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 3 Top = 30 Width = 1710 End Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 2 Top = 360 Width = 3900 End End Begin MSComctlLib.StatusBar StatusBar1 Align = 2 'Align Bottom Height = 375 Left = 0 TabIndex = 0 Top = 7470 Width = 11265 _ExtentX = 19870 _ExtentY = 661 _Version = 393216 BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} NumPanels = 3 BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} AutoSize = 1 Object.Width = 6588 Text = "Reserved By:"
Fill all fields or fields with '*' then click 'Save' button to update.
Reservation
Notes
Plate No.
Vehicle Make
Model
Total
Balance
Amount Paid
Sub Total
Other Charges
%
Reservation No
Last name
First name
Address
Company
Country
ID Number
ID Type
Room Number
Date In Date Out
Rate Type Rate/Period
Discount
No. of Days
No. of Adults
No. of Childrens
Business Source
Total Charges
6
6
6
6
6
6
frmReservationList - 1 Dim CURR_COL As I
Dim rsRooms As NeDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub Filter SQLParser.Res SQLParser.wCo
frmReservationList - 2 Exit Sub 'Trap the errorerr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Else MsgBox err.Number & " " & err.Description End If Me.MousePointer = vbDefaultEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRooms If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "ttfftttt", False Call lvList_ClickEnd Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load()
frmReservationList - 3 ' mdiMain.AddToWin Me.Caption, Name 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "ReservationNo, Customer, Company, Address, DateIn, ReservationNo" .Tables = "qry_Reservation" .wCondition = "Status = 'Reserved'" .SortOrder = "ReservationNo ASC" .SaveStatement End With If rsRooms.State = 1 Then rsRooms.Close rsRooms.CursorLocation = adUseClient Debug.Print CN rsRooms.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRooms, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRooms, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "ReservationNo") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmReservationList = NothingEnd Sub
Private Sub SetNavigation()
frmReservationList - 4 With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) If lvList.SelectedItem.SubItems(2) = "Occupied" Then mdiMain.tbMenu.Buttons(2).Visible = False Else mdiMain.tbMenu.Buttons(2).Visible = True End If Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)' MsgBox lvList.SelectedItem.SubItems(2) DoEvents' lvList.ToolTipText = lvList.SelectedItem.SubItems(2)End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)' If Button = 2 Then PopupMenu mnuActionEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmReservationList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmReservationList Caption = "Reservation" ClientHeight = 7095 ClientLeft = 60 ClientTop = 345 ClientWidth = 9495 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 7095 ScaleWidth = 9495 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9495 TabIndex = 9 Top = 6705 Width = 9495 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9495 TabIndex = 8 Top = 6690 Width = 9495 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9495 TabIndex = 0 Top = 6720 Width = 9495 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmReservationList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = -30 TabIndex = 10 Top = 450 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 5 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Reservation No" Object.Width = 4701 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Customer" Object.Width = 4004 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmReservationList - 3 SubItemIndex = 2 Text = "Company" Object.Width = 4304 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Address" Object.Width = 3863 EndProperty BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 4 Text = "Date Reserved" Object.Width = 0 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Reservation" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 45 TabIndex = 11 Top = 150 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = -30 Top = 150 Width = 6915 EndEnd
Reservation
Selected Record: 0 0 - 0 of 0
frmRooms - 1 Public State Public PK
Dim RS Dim cIRowCount
Private Sub btnRe 'Remove selec With Grid 'Update t cIRowCoun
frmRooms - 2
rsRoomRates.Update End If Next c End With
'Save last rate entry to rate templates If State = adStateAddMode Then CN.Execute "DELETE RoomTypeID " & _ "From [Rate Templates] " & _ "WHERE RoomTypeID=" & dcRoomType.BoundText CN.Execute "INSERT INTO [Rate Templates] ( RoomTypeID, RateTypeID, RoomRate, NoofPerson, ExtraAdultRate ) " & _ "SELECT Rooms.RoomTypeID, [Room Rates].RateTypeID, [Room Rates].RoomRate, [Room Rates].NoofPerson, [Room Rates].ExtraAdultRate " & _ "FROM [Room Rates] INNER JOIN Rooms ON [Room Rates].RoomNumber = Rooms.RoomNumber " & _ "WHERE [Room Rates].RoomNumber=" & txtRoomNumber.Text End If
'Clear variables c = 0 Set rsRoomRates = Nothing CN.CommitTrans Unload frmRooms
Exit Sub err: CN.RollbackTrans prompt_err err, Name, "cmdSave_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub cmdUpdate_Click() With Grid .TextMatrix(.RowSel, 1) = dcRateType.BoundText .TextMatrix(.RowSel, 2) = dcRateType.Text .TextMatrix(.RowSel, 3) = toMoney(txtRoomRate.Text) .TextMatrix(.RowSel, 4) = txtNoofPerson.Text .TextMatrix(.RowSel, 5) = toMoney(txtAdults.Text) .TextMatrix(.RowSel, 6) = toMoney(txtChildrens.Text) End WithEnd Sub
Private Sub AddRoomRates()On Error GoTo err
CN.BeginTrans If State = adStateAddMode Then CN.Execute "INSERT INTO [Room Rates] ( RoomNumber, RateTypeID ) " & _ "SELECT " & txtRoomNumber.Text & ", [Rate Type].RateTypeID " & _ "FROM [Rate Type]" Else Dim rsRateType As New Recordset With rsRateType .Open "SELECT RateTypeID FROM [Rate Type]", CN, adOpenStatic, adLockOptimistic Do While Not .EOF If .Fields("RateTypeID") <> getValueAt("SELECT RateTypeID FROM [Room Rates] WHERE RoomNumber = " & txtRoomNumber.Text & " AND RateTypeID = " & .Fields("RateTypeID"), "RateTypeID") Then CN.Execute "INSERT INTO [Room Rates] ( RoomNumber, RateTypeID ) " & _ "SELECT " & txtRoomNumber.Text & ", " & .Fields("RateTypeID") .Update End If .MoveNext Loop .Close End With
frmRooms - 3 End If CN.CommitTrans Exit Sub err: CN.RollbackTrans prompt_err err, Name, "AddRoomRates" Screen.MousePointer = vbDefaultEnd Sub
Private Sub dcRoomType_Click(Area As Integer) AddFromRateTemplates' Call AddRoomRates' Call DisplayForEditingEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
RS.Open "SELECT * FROM Rooms WHERE RoomNumber = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then AddFromRateTemplates
cmdUsrHistory.Enabled = False Else With RS txtRoomNumber.Text = PK dcRoomType.BoundText = .Fields("RoomTypeID") dcRoomStatus.BoundText = .Fields("RoomStatusID") End With Call AddRoomRates DisplayForEditing End If Exit Sub err: CN.RollbackTrans prompt_err err, Name, "cmdSave_Click" Screen.MousePointer = vbDefaultEnd Sub
'Procedure used to initialize the gridPrivate Sub InitGrid() cIRowCount = 0 With Grid .Clear .ClearStructure .Rows = 2 .FixedRows = 1 .FixedCols = 1 .Cols = 7 .ColSel = 6 'Initialize the column size .ColWidth(0) = 315 .ColWidth(1) = 0 .ColWidth(2) = 1200 .ColWidth(3) = 1200 .ColWidth(4) = 1200
'Initialize the column name .TextMatrix(0, 0) = "" .TextMatrix(0, 1) = "Rate Type ID" .TextMatrix(0, 2) = "Rate Type" .TextMatrix(0, 3) = "Room Rate" .TextMatrix(0, 4) = "No. of Person" .TextMatrix(0, 5) = "Extra Adult's Rate" .TextMatrix(0, 6) = "Extra Children's Rate" End WithEnd Sub
Private Sub Form_Unload(Cancel As Integer) frmRoomsList.RefreshRecords Set frmRooms = NothingEnd Sub
Private Sub Grid_Click() With Grid dcRateType.BoundText = .TextMatrix(.RowSel, 1) txtRoomRate.Text = .TextMatrix(.RowSel, 3) txtNoofPerson.Text = .TextMatrix(.RowSel, 4) txtAdults.Text = .TextMatrix(.RowSel, 5) txtChildrens.Text = .TextMatrix(.RowSel, 6) If Grid.Rows = 2 And Grid.TextMatrix(1, 2) = "" Then btnRemove.Visible = False Else btnRemove.Visible = True btnRemove.Top = (Grid.CellTop + Grid.Top) - 20 btnRemove.Left = Grid.Left + 50 End If End WithEnd Sub
Private Sub ResetFields() txtRoomNumber.Text = "" txtRoomNumber.SetFocusEnd Sub
Private Sub DisplayForEditing()On Error GoTo err 'Display the details Dim rsRoomRates As New Recordset
cIRowCount = 0 rsRoomRates.CursorLocation = adUseClient rsRoomRates.Open "SELECT * FROM qry_Room_Rates WHERE RoomNumber=" & PK, CN, adOpenStatic, adLockOptimistic If rsRoomRates.RecordCount > 0 Then rsRoomRates.MoveFirst While Not rsRoomRates.EOF cIRowCount = cIRowCount + 1 'increment With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsRoomRates!RateTypeID .TextMatrix(1, 2) = rsRoomRates!RateType .TextMatrix(1, 3) = toMoney(rsRoomRates!RoomRate) .TextMatrix(1, 4) = rsRoomRates!NoofPerson .TextMatrix(1, 5) = toMoney(rsRoomRates!ExtraAdultRate) .TextMatrix(1, 6) = toMoney(rsRoomRates!ExtraChildRate) Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsRoomRates!RateTypeID .TextMatrix(.Rows - 1, 2) = rsRoomRates!RateType .TextMatrix(.Rows - 1, 3) = toMoney(rsRoomRates!RoomRate) .TextMatrix(.Rows - 1, 4) = rsRoomRates!NoofPerson .TextMatrix(.Rows - 1, 5) = toMoney(rsRoomRates!ExtraAdultRate) .TextMatrix(.Rows - 1, 6) = toMoney(rsRoomRates!ExtraChildRate) End If
frmRooms - 5 End With rsRoomRates.MoveNext Wend Grid.Row = 1 Grid.ColSel = 6 'Set fixed cols If State = adStateEditMode Then Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If End If
rsRoomRates.Close 'Clear variables Set rsRoomRates = Nothing
Exit Suberr: If err.Number = 94 Then Resume Next prompt_err err, Name, "DisplayForEditing" Screen.MousePointer = vbDefaultEnd Sub
Private Sub AddFromRateTemplates() Dim rsRateType As New Recordset Dim rsRateTemplates As New Recordset
Grid.Clear InitGrid cIRowCount = 0 rsRateTemplates.CursorLocation = adUseClient rsRateTemplates.Open "SELECT [Rate Templates].RoomTypeID, [Rate Templates].RateTypeID, [Rate Templates].RoomRate, [Rate Templates].NoofPerson, [Rate Templates].ExtraAdultRate " & _ "From [Rate Templates] " & _ "WHERE RoomTypeID= " & dcRoomType.BoundText, CN, adOpenStatic, adLockOptimistic rsRateType.CursorLocation = adUseClient rsRateType.Open "SELECT RateTypeID, RateType FROM [Rate Type]", CN, adOpenStatic, adLockOptimistic If rsRateType.RecordCount > 0 Then rsRateType.MoveFirst While Not rsRateType.EOF cIRowCount = cIRowCount + 1 'increment rsRateTemplates.Filter = "[RateTypeID]=" & rsRateType!RateTypeID With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsRateType!RateTypeID .TextMatrix(1, 2) = rsRateType!RateType If rsRateTemplates.RecordCount > 0 Then .TextMatrix(1, 3) = toMoney(rsRateTemplates!RoomRate) .TextMatrix(1, 4) = rsRateTemplates!NoofPerson .TextMatrix(1, 5) = toMoney(rsRateTemplates!ExtraAdultRate) End If .TextMatrix(1, 6) = 0 Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsRateType!RateTypeID .TextMatrix(.Rows - 1, 2) = rsRateType!RateType If rsRateTemplates.RecordCount > 0 Then .TextMatrix(.Rows - 1, 3) = toMoney(rsRateTemplates!RoomRate) .TextMatrix(.Rows - 1, 4) = rsRateTemplates!NoofPerson .TextMatrix(.Rows - 1, 5) = toMoney(rsRateTemplates!ExtraAdultRate) End If .TextMatrix(.Rows - 1, 6) = 0 End If End With rsRateType.MoveNext Wend Grid.Row = 1 Grid.ColSel = 6 'Set fixed cols
frmRooms - 6 If State = adStateEditMode Then Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If End If rsRateType.Close rsRateTemplates.Close Set rsRateType = Nothing Set rsRateTemplates = NothingEnd Sub
Private Sub txtAdults_GotFocus() HLText txtAdultsEnd Sub
Private Sub txtAdults_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtAdults_Validate(Cancel As Boolean) txtAdults.Text = toMoney(txtAdults.Text)End Sub
Private Sub txtChildrens_GotFocus() HLText txtChildrensEnd Sub
Private Sub txtChildrens_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtChildrens_Validate(Cancel As Boolean) txtChildrens.Text = toMoney(txtChildrens.Text)End Sub
Private Sub txtNoofPerson_GotFocus() HLText txtNoofPersonEnd Sub
Private Sub txtNoofPerson_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtNoofPerson_Validate(Cancel As Boolean) txtNoofPerson.Text = toNumber(txtNoofPerson.Text)End Sub
Private Sub txtRoomRate_GotFocus() HLText txtRoomRateEnd Sub
Private Sub txtRoomRate_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtRoomRate_Validate(Cancel As Boolean) txtRoomRate.Text = toMoney(txtRoomRate.Text)End Sub
No. of Person Children's RateAdult's RateRoom RateRate Type
Room Status
Room Type
Room Number
6
6
6
RoomsFill all fields or fields with '*' then click 'Save' button to update.
frmRoomsList - 1 Dim CURR_COL As I
Dim rsRooms As NeDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub Filter SQLParser.Res SQLParser.wCo
frmRoomsList - 2 Exit Sub 'Trap the errorerr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Else MsgBox err.Number & " " & err.Description End If Me.MousePointer = vbDefaultEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRooms If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub btnRecOp_Click() frmCustomerRecOp.Show vbModalEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttttt", False Call lvList_ClickEnd Sub
Private Sub Form_Deactivate()
frmRoomsList - 3 mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load()' mdiMain.AddToWin Me.Caption, Name 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "RoomNumber, RoomType, Status, RoomNumber" .Tables = "qry_Rooms_Window" .SortOrder = "RoomNumber ASC" .SaveStatement End With If rsRooms.State = 1 Then rsRooms.Close rsRooms.CursorLocation = adUseClient Debug.Print CN rsRooms.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRooms, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRooms, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "RoomNumber") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCheckInList = NothingEnd Sub
frmRoomsList - 4
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) ' If lvList.SelectedItem.SubItems(2) = "Occupied" Then' mdiMain.tbMenu.Buttons(2).Visible = False' Else' mdiMain.tbMenu.Buttons(2).Visible = True' End If Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)' MsgBox lvList.SelectedItem.SubItems(2) DoEvents lvList.ToolTipText = lvList.SelectedItem.SubItems(2)End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)' If Button = 2 Then PopupMenu mnuActionEnd Sub
Private Sub mnuCheckOut_Click() With frmCheckOut .RoomNumber = CLng(LeftSplitUF(lvList.SelectedItem.Tag)) .AutoCheckOut = True
frmRoomsList - 5 .Show vbModal End WithEnd Sub
Private Sub mnuRoomRate_Click() With frmRooms .PK = CLng(LeftSplitUF(lvList.SelectedItem.Tag)) .Show vbModal End WithEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRoomsList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRoomsList Caption = "Rooms" ClientHeight = 7140 ClientLeft = 60 ClientTop = 345 ClientWidth = 10005 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 7140 ScaleWidth = 10005 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 10005 TabIndex = 9 Top = 6750 Width = 10005 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 10005 TabIndex = 8 Top = 6735 Width = 10005 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 10005 TabIndex = 0 Top = 6765 Width = 10005 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmRoomsList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 420 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 4 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Room Number" Object.Width = 4701 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Room Type" Object.Width = 2240 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmRoomsList - 3 SubItemIndex = 2 Text = "Status" Object.Width = 3863 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Room Number" Object.Width = 0 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Rooms" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 120 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 120 Width = 6915 EndEnd
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Room Status] WHERE StatusID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmRoomStatusList.RefreshRecords End If End If Set frmRoomStatus = NothingEnd Sub
frmRoomStatus - 1 VERSION 5.00Begin VB.Form frmRoomStatus BorderStyle = 1 'Fixed Single Caption = "Room Status" ClientHeight = 1800 ClientLeft = 45 ClientTop = 330 ClientWidth = 5640 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1800 ScaleWidth = 5640 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1830 MaxLength = 100 TabIndex = 4 Tag = "Category" Top = 180 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2490 TabIndex = 3 Top = 1095 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3930 TabIndex = 2 Top = 1095 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 390 TabIndex = 1 Top = 1095 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 210 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 0 Top = 810 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Room Status" Height = 240 Left = 510 TabIndex = 5 Top = 180 Width = 1215 EndEnd
Room Status
frmRoomStatusList - 1 Option Explicit
Dim CURR_COL As IDim rsStatus As NDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmRoomStatusList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsStatus If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmRoomStatusList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Status,StatusID" .Tables = "[Room Status]" .SortOrder = "Status ASC" .SaveStatement End With rsStatus.CursorLocation = adUseClient rsStatus.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsStatus, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsStatus, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "StatusID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmRoomStatusList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmRoomStatusList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRoomStatusList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRoomStatusList Caption = "Room Status" ClientHeight = 5880 ClientLeft = 60 ClientTop = 345 ClientWidth = 8940 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5880 ScaleWidth = 8940 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8940 TabIndex = 2 Top = 5505 Width = 8940 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmRoomStatusList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8940 TabIndex = 1 Top = 5475 Width = 8940 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8940 TabIndex = 0 Top = 5490 Width = 8940 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 450 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Room Status" BeginProperty Font Name = "Tahoma"
Dim rsRooms As NeDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub Filter SQLParser.Res SQLParser.wCo
frmRoomsWindow - 2 Else MsgBox "No record to delete.", vbExclamation End If Case "Refresh" RefreshRecords Case "Print" Case "Close" Unload Me End Select Exit Sub 'Trap the errorerr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Else MsgBox err.Number & " " & err.Description End If Me.MousePointer = vbDefaultEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRooms If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub btnRecOp_Click() frmCustomerRecOp.Show vbModal
frmRoomsWindow - 3 End Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "ttfftttt", False Call lvList_ClickEnd Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load()' mdiMain.AddToWin Me.Caption, Name 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "RoomNumber, RoomType, Status, RoomNumber" .Tables = "qry_Rooms_Window" .SortOrder = "RoomNumber ASC" .SaveStatement End With If rsRooms.State = 1 Then rsRooms.Close rsRooms.CursorLocation = adUseClient Debug.Print CN rsRooms.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRooms, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRooms, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "RoomNumber") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top
frmRoomsWindow - 4 End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCheckInList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) If lvList.SelectedItem.SubItems(2) = "Occupied" Then mdiMain.tbMenu.Buttons(2).Visible = False Else mdiMain.tbMenu.Buttons(2).Visible = True End If Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)' MsgBox lvList.SelectedItem.SubItems(2) DoEvents lvList.ToolTipText = lvList.SelectedItem.SubItems(2)
frmRoomsWindow - 5 End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mnuActionEnd Sub
Private Sub mnuCheckOut_Click() With frmCheckOut .RoomNumber = CLng(LeftSplitUF(lvList.SelectedItem.Tag)) .AutoCheckOut = True .Show vbModal End WithEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRoomsWindow - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRoomsWindow Caption = "Rooms" ClientHeight = 7110 ClientLeft = 120 ClientTop = 420 ClientWidth = 9750 LinkTopic = "Form1" MDIChild = -1 'True ScaleHeight = 7110 ScaleWidth = 9750 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9750 TabIndex = 2 Top = 6735 Width = 9750 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Room Type] WHERE RoomTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmRoomTypeList.RefreshRecords End If End If Set frmRoomType = NothingEnd Sub
frmRoomType - 1 VERSION 5.00Begin VB.Form frmRoomType BorderStyle = 1 'Fixed Single Caption = "Room Type" ClientHeight = 1740 ClientLeft = 45 ClientTop = 330 ClientWidth = 5505 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1740 ScaleWidth = 5505 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1740 MaxLength = 100 TabIndex = 4 Tag = "Category" Top = 210 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2400 TabIndex = 3 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3840 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 300 TabIndex = 1 Top = 1125 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 120 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 0 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Business Source" Height = 240 Left = 420 TabIndex = 5 Top = 210 Width = 1215 EndEnd
Business
Source
frmRoomTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsRoomType AsDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmRoomTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRoomType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmRoomTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "RoomType,RoomTypeID" .Tables = "[Room Type]" .SortOrder = "RoomType ASC" .SaveStatement End With rsRoomType.CursorLocation = adUseClient rsRoomType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRoomType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRoomType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "RoomTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmRoomTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmRoomTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRoomTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRoomTypeList Caption = "Room Type" ClientHeight = 5805 ClientLeft = 60 ClientTop = 345 ClientWidth = 8940 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5805 ScaleWidth = 8940 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8940 TabIndex = 2 Top = 5430 Width = 8940 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmRoomTypeList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8940 TabIndex = 1 Top = 5400 Width = 8940 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8940 TabIndex = 0 Top = 5415 Width = 8940 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Room Type" BeginProperty Font Name = "Tahoma"
frmRPTAccRec - 1 Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor frmReport End With
frmRPTAccRec - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Begin VB.Form frmRPTAccRec BorderStyle = 1 'Fixed Single Caption = "Account Receivable" ClientHeight = 2190 ClientLeft = 45 ClientTop = 330 ClientWidth = 4680 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2190 ScaleWidth = 4680 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3450 TabIndex = 2 Top = 1500 Width = 945 End Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2340 TabIndex = 1 Top = 1500 Width = 945 End Begin VB.PictureBox b8Line1 Height = 30 Left = 240 ScaleHeight = 30 ScaleWidth = 4185 TabIndex = 4 Top = 1260 Width = 4185 End Begin MSDataListLib.DataCombo dcCompany Height = 315 Left = 1590 TabIndex = 0 Top = 540 Width = 2295 _ExtentX = 4048 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Company" Height = 195 Left = 840 TabIndex = 3 Top = 600 Width = 660 EndEnd
Company 6
frmRPTCheckOut - 1 Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor .strWhere
frmReport
frmRPTCheckOut - 1 VERSION 5.00Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmRPTCheckOut BorderStyle = 1 'Fixed Single Caption = "Check Out Report" ClientHeight = 2175 ClientLeft = 45 ClientTop = 330 ClientWidth = 4680 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2175 ScaleWidth = 4680 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2280 TabIndex = 3 Top = 1560 Width = 945 End Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3390 TabIndex = 2 Top = 1560 Width = 945 End Begin MSComCtl2.DTPicker dtpCheckOut Height = 375 Left = 1920 TabIndex = 0 Top = 360 Width = 1875 _ExtentX = 3307 _ExtentY = 661 _Version = 393216 Format = 104136705 CurrentDate = 39592 End Begin VB.PictureBox b8Line1 Height = 30 Left = 180 ScaleHeight = 30 ScaleWidth = 4185 TabIndex = 4 Top = 1320 Width = 4185 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Check Out Date" Height = 195 Left = 630 TabIndex = 1 Top = 390 Width = 1155 EndEnd
Check Out Date
frmRPTDueReservat Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor .strWhere
frmReport
frmRPTDueReservation - 1 VERSION 5.00Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmRPTDueReservation BorderStyle = 1 'Fixed Single Caption = "Due Reservation" ClientHeight = 2175 ClientLeft = 45 ClientTop = 330 ClientWidth = 4680 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2175 ScaleWidth = 4680 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3360 TabIndex = 1 Top = 1560 Width = 945 End Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2250 TabIndex = 0 Top = 1560 Width = 945 End Begin MSComCtl2.DTPicker dtpCheckIn Height = 375 Left = 1890 TabIndex = 2 Top = 360 Width = 1875 _ExtentX = 3307 _ExtentY = 661 _Version = 393216 Format = 104136705 CurrentDate = 39592 End Begin VB.PictureBox b8Line1 Height = 30 Left = 150 ScaleHeight = 30 ScaleWidth = 4185 TabIndex = 3 Top = 1320 Width = 4185 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Check Out Date" Height = 195 Left = 600 TabIndex = 4 Top = 390 Width = 1155 EndEnd
Check Out Date
frmRPTOtherCharges - 1 Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor If dcChar .strWrpt_Other_Charges
frmRPTOtherCharges - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmRPTOtherCharges BorderStyle = 1 'Fixed Single Caption = "Other Charges" ClientHeight = 2895 ClientLeft = 45 ClientTop = 330 ClientWidth = 5220 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2895 ScaleWidth = 5220 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2460 TabIndex = 1 Top = 2250 Width = 945 End Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3570 TabIndex = 0 Top = 2250 Width = 945 End Begin VB.PictureBox b8Line1 Height = 30 Left = 360 ScaleHeight = 30 ScaleWidth = 4395 TabIndex = 2 Top = 1890 Width = 4395 End Begin MSComCtl2.DTPicker dtpBegDate Height = 375 Left = 1230 TabIndex = 3 Top = 1170 Width = 1605 _ExtentX = 2831 _ExtentY = 661 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 39156 End Begin MSComCtl2.DTPicker dtpEndDate Height = 375 Left = 2910 TabIndex = 4 Top = 1170 Width = 1605 _ExtentX = 2831 _ExtentY = 661 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 39156 End Begin MSDataListLib.DataCombo dcChargeType Height = 315 Left = 2010 TabIndex = 8 Top = 330 Width = 2085 _ExtentX = 3678 _ExtentY = 556 _Version = 393216
frmRPTOtherCharges - 2 Style = 2 Text = "" End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Other Charges" Height = 195 Left = 960 TabIndex = 9 Top = 360 Width = 1020 End Begin VB.Label Label4 Caption = "To" Height = 255 Left = 2940 TabIndex = 7 Top = 900 Width = 825 End Begin VB.Label Label3 Alignment = 1 'Right Justify Caption = "Date" Height = 315 Left = 630 TabIndex = 6 Top = 1200 Width = 525 End Begin VB.Label Label2 Caption = "From" Height = 255 Left = 1230 TabIndex = 5 Top = 930 Width = 825 EndEnd
From
Date
To
Other Charges6
frmRPTRoomHistory - 1 Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor If cboRoo .strWDate.Value & "# O
frmRPTRoomHistory - 1 VERSION 5.00Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmRPTRoomHistory BorderStyle = 1 'Fixed Single Caption = "Room History" ClientHeight = 2820 ClientLeft = 45 ClientTop = 330 ClientWidth = 4680 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2820 ScaleWidth = 4680 StartUpPosition = 2 'CenterScreen Begin VB.ComboBox cboRoomNumber Height = 315 Left = 1770 Style = 2 'Dropdown List TabIndex = 9 Top = 270 Width = 1815 End Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3240 TabIndex = 1 Top = 2160 Width = 945 End Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2130 TabIndex = 0 Top = 2160 Width = 945 End Begin VB.PictureBox b8Line1 Height = 30 Left = 30 ScaleHeight = 30 ScaleWidth = 4395 TabIndex = 2 Top = 1800 Width = 4395 End Begin MSComCtl2.DTPicker dtpBegDate Height = 375 Left = 900 TabIndex = 3 Top = 1080 Width = 1605 _ExtentX = 2831 _ExtentY = 661 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 39156 End Begin MSComCtl2.DTPicker dtpEndDate Height = 375 Left = 2580 TabIndex = 4 Top = 1080 Width = 1605 _ExtentX = 2831 _ExtentY = 661 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 39156 End Begin VB.Label Label2 Caption = "From"
frmRPTRoomHistory - 2 Height = 255 Left = 900 TabIndex = 8 Top = 840 Width = 825 End Begin VB.Label Label3 Alignment = 1 'Right Justify Caption = "Date" Height = 315 Left = 300 TabIndex = 7 Top = 1110 Width = 525 End Begin VB.Label Label4 Caption = "To" Height = 255 Left = 2610 TabIndex = 6 Top = 810 Width = 825 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Room" Height = 195 Left = 1200 TabIndex = 5 Top = 270 Width = 420 EndEnd
Room
To
Date
From
frmSearch - 1 ''***************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Ph'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE,''***************
frmSearch - 2 End If Select Case cmbOperation(1).ListIndex Case 0: strFilter = strFilter & " LIKE '%" & txtFilter(1).Text & "%'" Case 1: strFilter = strFilter & " = '" & txtFilter(1).Text & "'" Case 2: strFilter = strFilter & " <> '" & txtFilter(1).Text & "'" Case 3: strFilter = strFilter & " > '" & txtFilter(1).Text & "'" Case 4: strFilter = strFilter & " >= '" & txtFilter(1).Text & "'" Case 5: strFilter = strFilter & " < '" & txtFilter(1).Text & "'" Case 6: strFilter = strFilter & " <= '" & txtFilter(1).Text & "'" Case 7: strFilter = strFilter & " BETWEEN #" & dtpDate(2).Value & "# AND #" & dtpDate(3).Value & "#" End Select End If 'InputBox "", , strFilter 'Pass the condition to filtered records srcForm.FilterRecord strFilter 'Clear used variables strFilter = vbNullString Unload Me Exit Suberr: If err.Number = -2147352571 Then MsgBox "Invalid search operation.", vbExclamation Unload Me ElseIf err.Number = 3001 Then Resume Next Else prompt_err err, "frmFilter", "cmdOk_Click" End IfEnd Sub
Private Sub Form_Load() 'Initialize values dtpDate(0).Value = Date dtpDate(1).Value = Date dtpDate(2).Value = Date dtpDate(3).Value = Date 'Set the images for the controls With mdiMain Image1.Picture = .i16x16.ListImages(7).Picture Image2.Picture = .i16x16.ListImages(7).Picture End With Dim i As Integer If srcNoOfCol = 0 Then srcNoOfCol = srcColumnHeaders.Count For i = 1 To srcNoOfCol If srcColumnHeaders(i).Text <> "" Then cmbFields.AddItem srcColumnHeaders(i).Text Next i i = 0 cmbFields.ListIndex = 0 cmbOperation(0).ListIndex = 0 End Sub
Private Sub Form_Unload(Cancel As Integer) Set frmSearch = NothingEnd Sub
Private Sub txtFilter_GotFocus(Index As Integer) HLText txtFilter(Index)End Sub
frmSearch - 1 VERSION 5.00Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmSearch BorderStyle = 1 'Fixed Single Caption = "Search Records" ClientHeight = 3015 ClientLeft = 45 ClientTop = 435 ClientWidth = 6870 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Icon = (Icon) LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3015 ScaleWidth = 6870 StartUpPosition = 2 'CenterScreen Begin VB.ComboBox cmbFields Height = 315 Left = 1800 Style = 2 'Dropdown List TabIndex = 0 Top = 120 Width = 4995 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 5520 TabIndex = 13 Top = 2520 Width = 1215 End Begin VB.CommandButton cmdOk Caption = "OK" Default = -1 'True Height = 315 Left = 4200 TabIndex = 12 Top = 2520 Width = 1215 End Begin VB.Frame Frame1 Caption = " Condition " Height = 1695 Left = 120 TabIndex = 1 Top = 600 Width = 6615 Begin VB.TextBox txtFilter Height = 285 Index = 0 Left = 3120 TabIndex = 3 Top = 360 Width = 3255 End Begin VB.TextBox txtFilter Height = 285 Index = 1 Left = 3120 TabIndex = 9 Top = 1080 Width = 3255 End Begin MSComCtl2.DTPicker dtpDate Height = 285 Index = 0 Left = 3120
frmSearch - 2 TabIndex = 4 Top = 360 Visible = 0 'False Width = 1335 _ExtentX = 2355 _ExtentY = 503 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 38207 End Begin VB.OptionButton Option2 Caption = "Or" Height = 255 Left = 1560 TabIndex = 7 Top = 720 Width = 735 End Begin VB.OptionButton Option1 Caption = "And" Height = 255 Left = 840 TabIndex = 6 Top = 720 Value = -1 'True Width = 615 End Begin VB.ComboBox cmbOperation Height = 315 Index = 1 Left = 240 Style = 2 'Dropdown List TabIndex = 8 Top = 1080 Width = 2470 End Begin VB.ComboBox cmbOperation Height = 315 Index = 0 Left = 240 Style = 2 'Dropdown List TabIndex = 2 Top = 360 Width = 2470 End Begin MSComCtl2.DTPicker dtpDate Height = 285 Index = 1 Left = 5040 TabIndex = 5 Top = 360 Visible = 0 'False Width = 1335 _ExtentX = 2355 _ExtentY = 503 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 38207 End Begin MSComCtl2.DTPicker dtpDate Height = 285 Index = 2 Left = 3120 TabIndex = 10 Top = 1080 Visible = 0 'False Width = 1335 _ExtentX = 2355 _ExtentY = 503 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 38207 End Begin MSComCtl2.DTPicker dtpDate
frmSearch - 3 Height = 285 Index = 3 Left = 5040 TabIndex = 11 Top = 1080 Visible = 0 'False Width = 1335 _ExtentX = 2355 _ExtentY = 503 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 38207 End Begin VB.Label Label3 Alignment = 2 'Center Caption = "And" Height = 255 Left = 4560 TabIndex = 16 Top = 1110 Width = 375 End Begin VB.Label Label2 Alignment = 2 'Center Caption = "And" Height = 255 Left = 4560 TabIndex = 15 Top = 390 Width = 375 End Begin VB.Image Image2 Height = 240 Left = 2760 Stretch = -1 'True Top = 1080 Width = 240 End Begin VB.Image Image1 Height = 240 Left = 2760 Stretch = -1 'True Top = 360 Width = 240 End End Begin VB.Label Label1 BackStyle = 0 'Transparent Caption = "Show Records Where?" Height = 255 Index = 0 Left = 120 TabIndex = 14 Top = 120 Width = 1935 EndEnd
Show Records Where?
And
And
frmSplash - 1 Option Explicit
'API for Top Most formPrivate Declare F (ByVal hWnd A ByVal X As Lo ByVal cy As LPrivate Const HWNPrivate Const SWPPrivate Const SWPPrivate Const FLA
frmSplash - 1 VERSION 5.00Begin VB.Form frmSplash BorderStyle = 0 'None Caption = "Form1" ClientHeight = 4440 ClientLeft = 0 ClientTop = 0 ClientWidth = 7380 LinkTopic = "Form1" ScaleHeight = 4440 ScaleWidth = 7380 ShowInTaskbar = 0 'False StartUpPosition = 2 'CenterScreen Begin VB.Image Image1 Height = 3465 Left = 30 Picture = (Bitmap) Top = 210 Width = 4635 End Begin VB.Label Label1 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "This programmed is licensed to:" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C0C0C0& Height = 195 Left = 5010 TabIndex = 3 Top = 15 Width = 2880 End Begin VB.Shape Shape2 BorderColor = &H00C0C0C0& BorderWidth = 2 Height = 4425 Left = 15 Top = 0 Width = 7365 End Begin VB.Label Label2 BackStyle = 0 'Transparent Caption = "ABC" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00808080& Height = 615 Left = 5640 TabIndex = 2 Top = 255 Width = 1515 End Begin VB.Image Image4 Height = 150 Left = 6270 Picture = (Bitmap) Top = 3915 Width = 1005 End Begin VB.Image Image3 Height = 270 Left = 2970
Private Sub cboAl If KeyAscii = listProdP listProdP End IfEnd Sub
Private Sub CmdCl Unload Me
frmUserPermission - 2
Private Sub listProdPack_RequestUpdate(Row As Long, Col As Long, NewValue As String, Cancel As Boolean) 'default Cancel = True 'validate' If (NewValue <> "True" Or NewValue <> "False") Then' MsgBox "Please enter valid value. It must True or False", vbExclamation' Exit Sub' End If ' NewValue = FormatNumber(GetTxtVal(NewValue), 2) NewValue = cboAllowOpen.Text If ChangePermission(listProdPack.CellText(Row, 1), NewValue) Then listProdPack.CellText(Row, Col) = NewValue listProdPack.Refresh Else 'WriteErrorLog Me.Name, "listProdPack_RequestUpdate", "Failed on: 'modRSSup.SetSupBegAP(GetTxtVal(listProdPack.celltext(Row, 1)), GetTxtVal(NewValue)) = True'" 'refresh list RefreshProdPack strUser End If Cancel = FalseEnd Sub
frmUserPermission - 1 VERSION 5.00Begin VB.Form frmUserPermission BorderStyle = 1 'Fixed Single Caption = "User Permission" ClientHeight = 6510 ClientLeft = 45 ClientTop = 330 ClientWidth = 6270 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 6510 ScaleWidth = 6270 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton cmdClose Caption = "&Close" Height = 465 Left = 4590 TabIndex = 1 Top = 5940 Width = 1245 End Begin VB.ComboBox cboAllowOpen Height = 315 Left = 1410 Style = 2 'Dropdown List TabIndex = 0 Top = 1890 Visible = 0 'False Width = 1455 End Begin VB.PictureBox listProdPack BorderStyle = 0 'None BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 5565 Left = 330 ScaleHeight = 5565 ScaleWidth = 5445 TabIndex = 2 Top = 240 Width = 5445 End Begin VB.Shape Shape2 BorderColor = &H00C0C0C0& FillColor = &H00808080& Height = 4905 Left = 330 Top = 210 Width = 5475 EndEnd
frmUsers - 1
Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ
frmUsers - 2 Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM Users WHERE PK = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False PK = getIndex("Users") Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmUsersList.CommandPass 5 End If End If Set frmUsers = NothingEnd Sub
Private Sub txtEntry_GotFocus(Index As Integer) HLText txtEntry(Index)End Sub
Public Sub AddPermission() Dim vRS As New ADODB.Recordset Dim sSQL As String sSQL = "INSERT INTO [User Permission] ( UserID, FormID ) " _ & "SELECT '" & Me.txtEntry(0).Text & "', Form.FormID " _ & "FROM Form"
CN.Execute sSQL Exit Sub RAE: Set vRS = NothingEnd Sub
frmUsers - 1 VERSION 5.00Begin VB.Form frmUsers BorderStyle = 1 'Fixed Single Caption = "Users" ClientHeight = 2550 ClientLeft = 45 ClientTop = 330 ClientWidth = 5610 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2550 ScaleWidth = 5610 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox b8Line1 Height = 30 Left = 90 ScaleHeight = 30 ScaleWidth = 5415 TabIndex = 10 Top = 1770 Width = 5415 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 210 TabIndex = 6 Top = 1995 Width = 1680 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 4200 TabIndex = 5 Top = 1995 Width = 1335 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2760 TabIndex = 4 Top = 1995 Width = 1335 End Begin VB.TextBox txtEntry Height = 285 Index = 1 Left = 1335 MaxLength = 100 TabIndex = 3 Tag = "Password" Top = 495 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 0 Left = 1335 MaxLength = 100 TabIndex = 2 Tag = "Username" Top = 120 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 2 Left = 1335 MaxLength = 100 TabIndex = 1 Tag = "Complete Name" Top = 945 Width = 3840
frmUsers - 2 End Begin VB.CheckBox Check1 Caption = "Admin" Height = 240 Left = 1335 TabIndex = 0 Top = 1320 Width = 990 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Username" Height = 240 Index = 1 Left = 285 TabIndex = 9 Top = 120 Width = 990 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Password" Height = 240 Index = 0 Left = 360 TabIndex = 8 Top = 495 Width = 915 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Complete Name" Height = 240 Index = 2 Left = 135 TabIndex = 7 Top = 945 Width = 1140 EndEnd
Complete Name
Password
Username
frmUsersList - 1 Option Explicit
Dim RS As New Rec
Private Sub Form_ 'Set the grap 'Set the grap With mdiMain 'For listview Set lvLis Set lvLis
frmUsersList - 2 Case 4 If CLng(lvList.SelectedItem.Tag) = CurrUser.USER_PK Then MsgBox "You cannot remove your own record because you currently using it.", vbExclamation Exit Sub Else If lvList.ListItems.Count > 0 Then If isRecordExist("Users", "PK", CLng(lvList.SelectedItem.Tag)) = False Then MsgBox "This record has been removed by other user.Click 'OK' button to refresh the records.", vbExclamation RefreshRecords Exit Sub Else Dim ANS As Integer ANS = MsgBox("Are you sure you want to delete the selected record?" & vbCrLf & vbCrLf & "WARNING: You cannot undo this operation.", vbCritical + vbYesNo, "Confirm Record Delete") Me.MousePointer = vbHourglass If ANS = vbYes Then DelRecwSQL "Users", "PK", "", True, CLng(lvList.SelectedItem.Tag) RefreshRecords MsgBox "Record has been successfully deleted.", vbInformation, "Confirm" End If ANS = 0 Me.MousePointer = vbDefault End If Else MsgBox "No record to delete.", vbExclamation End If End If 'Reload Case 5: RefreshRecords Case 6: With frmUserPermission .strUser = Me.lvList.SelectedItem.Text .Show 1 End With 'Close Case 7: Unload Me End Select Exit Suberr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault End IfEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Vehicles] WHERE VehicleID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmVehiclesList.RefreshRecords End If End If Set frmVehicles = NothingEnd Sub
frmVehicles - 1 VERSION 5.00Begin VB.Form frmVehicles Caption = "Vehicles" ClientHeight = 1620 ClientLeft = 60 ClientTop = 345 ClientWidth = 5610 LinkTopic = "Form2" ScaleHeight = 1620 ScaleWidth = 5610 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1710 MaxLength = 100 TabIndex = 3 Tag = "Category" Top = 150 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2370 TabIndex = 2 Top = 1065 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3810 TabIndex = 1 Top = 1065 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 270 TabIndex = 0 Top = 1065 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 90 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 4 Top = 780 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Vehicle" Height = 240 Left = 390 TabIndex = 5 Top = 150 Width = 1215 EndEnd
Vehicle
frmVehiclesList - 1 Option Explicit
Dim CURR_COL As IDim rsVehicle As Dim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmVehiclesList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsVehicle If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmVehiclesList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Vehicle,VehicleID" .Tables = "[Vehicles]" .SortOrder = "Vehicle ASC" .SaveStatement End With rsVehicle.CursorLocation = adUseClient rsVehicle.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsVehicle, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsVehicle, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "VehicleID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmVehiclesList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmVehiclesList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmVehiclesList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmVehiclesList Caption = "Vehicles" ClientHeight = 5445 ClientLeft = 60 ClientTop = 345 ClientWidth = 8100 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5445 ScaleWidth = 8100 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8100 TabIndex = 2 Top = 5070 Width = 8100 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmVehiclesList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8100 TabIndex = 1 Top = 5055 Width = 8100 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8100 TabIndex = 0 Top = 5040 Width = 8100 End Begin MSComctlLib.ListView lvList Height = 3435 Left = -30 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Vehicles" BeginProperty Font Name = "Tahoma"
mdiMain - 2 Select Case Index Case m_TabSearch 'search 'resize txtSearchWhat.Move 150, txtSearchWhat.Top, b8ST(Index).Width - 300 cmbLookIn.Move 150, cmbLookIn.Top, txtSearchWhat.Width cmdSearch.Move b8ST(Index).Width - cmdSearch.Width - 150 Case m_TabFilterDate 'filter date b8DateP.Move 150, b8DateP.Top, b8ST(Index).Width - 300 Case m_TabShowQuickLaunch listQL.Move 150, listQL.Top, b8ST(Index).Width - 300
End Select
End Sub
Private Sub b8ST_CompleteExpand(Index As Integer) Dim i As Integer For i = 0 To b8ST.UBound If Index <> i Then If b8ST(i).AutoContract = True Then b8ST(i).Expanded = False End If End If NextEnd Sub
Private Sub b8ST_Resize(Index As Integer) Dim i As Integer For i = 1 To b8ST.UBound b8ST(i).Move b8ST(i).Left, (b8ST(i - 1).Top + b8ST(i - 1).Height) - 15 Next If b8ST(Index).Expanded = True Then Select Case Index Case m_TabSearch 'search 'resize txtSearchWhat.Move 150, txtSearchWhat.Top, b8ST(Index).Width - 300 cmbLookIn.Move 150, cmbLookIn.Top, txtSearchWhat.Width cmdSearch.Move b8ST(Index).Width - cmdSearch.Width - 150 Case m_TabFilterDate 'filter date b8DateP.Move 150, b8DateP.Top, b8ST(Index).Width - 300 Case m_TabShowQuickLaunch listQL.Move 150, listQL.Top, b8ST(Index).Width - 300 End Select End If
End Sub
Private Sub listQL_DblClick()
Dim selItem As ListItem On Error GoTo RAE Set selItem = listQL.SelectedItem Select Case selItem.Key Case "reservation" 'Manage Products" If allowOpen("frmReservation", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If With frmReservation .Shortcut = True .Show vbModal End With
mdiMain - 3 Case "rooms_windows" 'Manage Supliers" If allowOpen("frmRoomsWindow", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
LoadForm frmRoomsWindow Case "cust" 'Manage Customers" If allowOpen("frmAllCustomer", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
' frmAllCustomer.ShowForm Case "poad" 'New P.O." If allowOpen("frmPOEntry", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
' frmPOEntry.ShowAdd Case "sale" 'New Sales Entry" If allowOpen("frmSIEntry", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
' frmSIEntry.ShowAdd Case "ppm" 'Purchases/Payments Mon." If allowOpen("frmAllPPM", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
' frmAllPPM.ShowForm Case "sicpm" 'Sales/Cust.Payments Mon." If allowOpen("frmAllSICPM", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmAllSICPM.ShowForm Case "void" 'Void Products Mon." If allowOpen("frmAllVoid", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmAllVoid.ShowForm Case "stock" 'Stock Inventory" If allowOpen("frmAllStockInv", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmAllStockInv.ShowForm Case "checkcust" 'Manage Due Checks (Cust.)" If allowOpen("frmAllCustPayDueCheck", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation
mdiMain - 4 Exit Sub End If ' frmAllCustPayDueCheck.ShowForm Case "checksupp" 'Manage Due Checks (Supp.)" If allowOpen("frmAllPTSDueCheck", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmAllPTSDueCheck.ShowForm End Select
RAE: Set selItem = NothingEnd Sub
Private Sub MDIForm_Load() 'show weclome frmWelcome.ShowForm 'set menus' Set b8Menus(0).Menu = Me.mnuSystem' Set b8Menus(1).Menu = Me.mnuRecords' Set b8Menus(2).Menu = Me.mnuMonitoring' Set b8Menus(3).Menu = Me.mnuTools' Set b8Menus(4).Menu = Me.mnuRecA' Set b8Menus(5).Menu = Me.mnuReports' Set b8Menus(6).Menu = Me.mnuHelp 'add quick launch items listQL.ListItems.Add , "reservation", "New Reservation", 1, 1 listQL.ListItems.Add , "rooms_windows", "Rooms", 1, 1
DisplayUserInfo
HideTBButton "", True frmWelcome.ActiveEnd Sub
Private Sub mnuAccountReceivables_Click() If allowOpen("frmAccountReceivableList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmAccountReceivableListEnd Sub
Private Sub mnuBackupDatabase_Click() If allowOpen("frmDBBackup", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmDBBackup.ShowFormEnd Sub
Private Sub mnuBusinessSource_Click() If allowOpen("frmBusinessSourceList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmBusinessSourceListEnd Sub
Private Sub mnuChangeDeskClerk_Click()
mdiMain - 5 frmCloseShift.Show 1End Sub
Private Sub mnuChargeType_Click() If allowOpen("frmChargeTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmChargeTypeListEnd Sub
Private Sub mnuCheckInHistory_Click() If allowOpen("frmCheckInList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmCheckInListEnd Sub
Private Sub mnuCompany_Click() If allowOpen("frmCompanyList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmCompanyListEnd Sub
Private Sub mnuCountries_Click() If allowOpen("frmCountriesList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmCountriesListEnd Sub
Private Sub mnuCustomers_Click() If allowOpen("frmCustomersList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmCustomersListEnd Sub
Private Sub mnuDatabaseRestore_Click()' If allowOpen("frmRestore", CurrUser.USER_NAME) = False Then' MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _' "Please ask permission from your administrator.", vbInformation'' Exit Sub' End If'' frmRestore.ShowFormEnd Sub
Private Sub mnuDueReservation_Click() If allowOpen("frmRPTDueReservation", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
mdiMain - 6 frmRPTDueReservation.Show vbModalEnd Sub
Private Sub mnuExit_Click() Unload MeEnd Sub
Private Sub mnuIDType_Click() If allowOpen("frmIDTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmIDTypeListEnd Sub
Private Sub mnuLogOff_Click() If MsgBox("Are you sure you want to log out?", vbQuestion + vbYesNo) = vbNo Then Exit Sub
Private Sub mnuManageUser_Click() frmUsersList.Show vbModalEnd Sub
Private Sub mnuNewReservation_Click() If allowOpen("frmReservation", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmReservation.Show vbModalEnd Sub
Private Sub mnuPaymentType_Click() If allowOpen("frmPaymentTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmPaymentTypeListEnd Sub
Private Sub mnuPreferences_Click()' If allowOpen("frmPref", CurrUser.USER_NAME) = False Then' MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _' "Please ask permission from your administrator.", vbInformation'' Exit Sub' End If'' frmPref.ShowForm 0End Sub
Private Sub mnuRateType_Click() If allowOpen("frmRateTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _
mdiMain - 7 "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmRateTypeListEnd Sub
Private Sub mnuReservations_Click() If allowOpen("frmReservationList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmReservationListEnd Sub
Private Sub mnuRooms_Click() If allowOpen("frmRoomsList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
LoadForm frmRoomsListEnd Sub
Private Sub mnuRoomStatus_Click() If allowOpen("frmRoomStatusList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmRoomStatusListEnd Sub
Private Sub mnuRoomType_Click() If allowOpen("frmRoomTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmRoomTypeListEnd Sub
Private Sub mnuRPTAccRec_Click() If allowOpen("frmRPTAccRec", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmRPTAccRec.Show vbModalEnd Sub
Private Sub mnuRPTCheckedInGuest_Click() If allowOpen("rpt_CheckIn_Guest", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If With frmReports .strReport = "CheckIn Guest"
frmReports.Show vbModal End WithEnd Sub
mdiMain - 8
Private Sub mnuRPTCheckOut_Click() If allowOpen("frmRPTCheckOut", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmRPTCheckOut.Show vbModalEnd Sub
Private Sub mnuRPTGuestList_Click() If allowOpen("rpt_Guest_List", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If With frmReports .strReport = "Guest List"
frmReports.Show vbModal End WithEnd Sub
Private Sub mnuRPTOtherCharges_Click() If allowOpen("frmRPTOtherCharges", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmRPTOtherCharges.Show vbModalEnd Sub
Private Sub mnuInventoryView_Click() If allowOpen("frmInventoryView", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmInventoryViewEnd Sub
Private Sub mnuRPTRoomHistory_Click() If allowOpen("frmRPTRoomHistory", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmRPTRoomHistory.Show 1End Sub
Private Sub mnuVehicles_Click() If allowOpen("frmVehiclesList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmVehiclesListEnd Sub
Private Sub tbMenu_ButtonClick(ByVal Button As MSComctlLib.Button) ActiveForm.CommandPass Button.KeyEnd Sub
Private Sub timeUpdateDate_Timer() lblDate.Caption = FormatDateTime(Now, vbGeneralDate)
mdiMain - 9 End Sub
'Private Sub txtSearchWhat_KeyPress(KeyAscii As Integer)' If KeyAscii = vbKeyReturn Then' Call cmdSearch_Click' End If'End Sub
'Private Sub cmdSearch_Click()' Form_Search'End Sub
'-----------------------------------------------------------' end Control Procedures
' MDI Form procedures'-----------------------------------------------------------Private Sub MDIForm_Resize() Dim frm As Form On Error Resume Next 'resize header menus bg 'bgHeaderMenu.Left = b8SBC.Width / Screen.TwipsPerPixelX 'resize bg Record Opt bgRecOpt.Move b8SBC.Width / Screen.TwipsPerPixelX 'resize childs If GetActiveChildCount > 0 Then For Each frm In Forms If frm.Name <> Me.Name Then If frm.MDIChild = True Then If frm.Name = Me.ActiveForm.Name Then ResizeMdiChildForm frm Else frm.Visible = False End If End If End If Next End If Set frm = NothingEnd Sub
Private Sub MDIForm_Unload(Cancel As Integer) EndEnd Sub'Get Opened MDI Child Forms CountPublic Function GetActiveChildCount() As Integer Dim frm As Form Dim iCount As Integer iCount = 0 For Each frm In Forms If frm.Name <> Me.Name Then If frm.MDIChild = True Then iCount = iCount + 1 End If End If Next GetActiveChildCount = iCount Set frm = Nothing End Function
'-----------------------------------------------------------' >> End MDI Form procedures'------------------------------------------------------------
mdiMain - 10
'------------------------------------------------------------' Parent To Child procedures'------------------------------------------------------------
Public Sub AddChild(ByRef CFrm As Form)
'load form modFuncChild.LoadForm CFrm End Sub
Public Sub ActivateChild(ByRef CFrm As Form)
'activate form Me.b8CW.SetActiveWindow CFrm.Name 'refresh record operation buttons' Form_CanAdd' Form_CanEdit' Form_CanDelete' Form_CanRefresh' Form_CanPrint' Form_CanSearch' Form_SetSearch
End Sub
Public Sub RemoveChild(ByVal sFormName As String) 'remove form Me.b8CW.RemoveChildWindow sFormName End Sub
'Record Operation
'Public Function Form_CanAdd() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanAdd'' b8RecOpt(0).Enabled = bReturn'' Form_CanAdd = bReturn'' err.Clear''End Function
'Public Function Form_CanEdit() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanEdit'' b8RecOpt(1).Enabled = bReturn'' Form_CanEdit = bReturn'' err.Clear''End Function
'Public Function Form_Edit()'' If Form_CanEdit Then' Me.ActiveForm.Form_Edit' End If
mdiMain - 11 ''End Function
'Public Function Form_CanDelete() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanDelete'' b8RecOpt(2).Enabled = bReturn'' Form_CanDelete = bReturn'' err.Clear''End Function
'Public Function Form_Delete()'' If Form_CanDelete Then' Me.ActiveForm.Form_Delete' End If''End Function
'Public Function Form_CanRefresh() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanRefresh'' b8RecOpt(3).Enabled = bReturn'' Form_CanRefresh = bReturn'' err.Clear''End Function
'Public Function Form_Refresh()'' If Form_CanRefresh Then' Me.ActiveForm.Form_Refresh' End If''End Function
'Public Function Form_CanPrint() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanPrint'' b8RecOpt(4).Enabled = bReturn'' Form_CanPrint = bReturn'' err.Clear''End Function
'Public Function Form_Print()
mdiMain - 12 ' If Form_CanPrint Then' Me.ActiveForm.Form_Print' End If'End Function
'Public Function Form_CanSearch() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanSearch'' Form_CanSearch = bReturn'' err.Clear''End Function
Public Function Form_ShowQuickLaunch()
'expand side bar If b8SBT.SizeState <> ssContracted Then b8SBT.SizeState = ssContracted End If
'expand search tab If b8ST(m_TabShowQuickLaunch).Expanded = False Then b8ST(m_TabShowQuickLaunch).Expanded = True End If On Error Resume Next b8ST(m_TabShowQuickLaunch).SetFocus 'HLTxt txtSearchWhat err.Clear End Function
'Public Function Form_ShowSearch()'' 'expand side bar' If b8SBT.SizeState <> ssContracted Then' b8SBT.SizeState = ssContracted' End If'' 'expand search tab' If b8ST(m_TabSearch).Expanded = False Then' b8ST(m_TabSearch).Expanded = True' End If'' On Error Resume Next' b8ST(m_TabSearch).SetFocus' HLTxt txtSearchWhat' err.Clear''End Function
Public Function Form_ShowDateFilter()
'expand side bar If b8SBT.SizeState <> ssContracted Then b8SBT.SizeState = ssContracted End If
'expand search tab If b8ST(m_TabFilterDate).Expanded = False Then b8ST(m_TabFilterDate).Expanded = True End If On Error Resume Next b8ST(m_TabFilterDate).SetFocus b8DateP.SetFocus
mdiMain - 13 err.Clear End Function
Public Function Form_SetSearch() Dim bReturn As Boolean Dim sFields() As String Dim i As Integer 'clear txtSearchWhat.Text = "" cmbLookIn.Clear On Error Resume Next bReturn = False bReturn = Me.ActiveForm.Form_SetSearch(sFields)
txtSearchWhat.Enabled = bReturn cmbLookIn.Enabled = bReturn cmdSearch.Enabled = bReturn If bReturn = True Then cmbLookIn.AddItem "All Fields" cmbLookIn.ListIndex = 0 If UBound(sFields) >= 0 Then For i = 0 To UBound(sFields) cmbLookIn.AddItem sFields(i) Next End If Else 'contract search tab if it was expanded If b8ST(m_TabSearch).Expanded = True Then b8ST(m_TabSearch).Expanded = False End If End If Form_SetSearch = bReturn err.ClearEnd Function
'Public Function Form_Search()'' Dim bResult As Boolean'' 'default' bResult = False''' On Error GoTo errh'' If txtSearchWhat.Text = "Enter text here" Then' txtSearchWhat.Text = ""' End If'' If Len(Trim(txtSearchWhat.Text)) <= 0 Then' MsgBox "Please enter text to search.", vbExclamation' txtSearchWhat.Text = "Enter text here"' HLTxt txtSearchWhat' GoTo errh' End If'' If Len(Trim(cmbLookIn.Text)) <= 0 Then' MsgBox "Please enter valid field.", vbExclamation' cmbLookIn.SetFocus' GoTo errh' End If''' bResult = Me.ActiveForm.Form_Search(Trim(txtSearchWhat.Text), Trim(cmbLookIn.Text))'' If bResult = False Then' MsgBox "Cannot find '" & txtSearchWhat.Text & "'", vbExclamation
mdiMain - 14 ' HLTxt txtSearchWhat' End If''errh:' err.Clear''End Function
Public Sub Form_DateChange()
On Error GoTo errh Me.ActiveForm.Form_DateChangeerrh:End Sub
Public Function Form_StartBussy() Me.MousePointer = vbHourglassEnd Function
Public Function Form_EndBussy() Me.MousePointer = vbDefaultEnd Function
Public Sub AFForm_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 83 And Shift = 4 Then b8Menus(0).ShowPopUp ElseIf KeyCode = 82 And Shift = 4 Then b8Menus(1).ShowPopUp ElseIf KeyCode = 77 And Shift = 4 Then b8Menus(2).ShowPopUp ElseIf KeyCode = 84 And Shift = 4 Then b8Menus(3).ShowPopUp ElseIf KeyCode = 72 And Shift = 4 Then b8Menus(4).ShowPopUp ElseIf KeyCode = 81 And Shift = 2 Then 'Ctrl + Q Me.Form_ShowQuickLaunch ElseIf KeyCode = 68 And Shift = 2 Then 'Ctrl + D Me.Form_ShowDateFilter End If 'MsgBox KeyCode & " - " & ShiftEnd Sub'------------------------------------------------------------' >>> Parent To Child procedures
'Member variables propertyPublic Property Get TabSearchIndex() As Integer TabSearchIndex = m_TabSearchEnd Property
Public Sub HideTBButton(ByVal srcPatern As String, Optional srcAllButton As Boolean) If srcAllButton = True Then srcPatern = "ttttttt" If Mid$(srcPatern, 1, 1) = "t" Then tbMenu.Buttons(2).Visible = False: mnuRACN.Visible = False If Mid$(srcPatern, 2, 1) = "t" Then tbMenu.Buttons(3).Visible = False: mnuRAES.Visible = False If Mid$(srcPatern, 3, 1) = "t" Then tbMenu.Buttons(4).Visible = False: mnuRAS.Visible = False If Mid$(srcPatern, 4, 1) = "t" Then tbMenu.Buttons(5).Visible = False: mnuRADS.Visible = False If Mid$(srcPatern, 5, 1) = "t" Then tbMenu.Buttons(6).Visible = False: mnuRARR.Visible = False If Mid$(srcPatern, 6, 1) = "t" Then tbMenu.Buttons(7).Visible = False: mnuRAP.Visible = False If Mid$(srcPatern, 7, 1) = "t" Then tbMenu.Buttons(8).Visible = False: mnuRAC.Visible = False' If mnuRAC.Visible = False Then mnuRASep2.Visible = FalseEnd Sub
Public Sub ShowTBButton(ByVal srcPatern As String, Optional srcAllButton As Boolean) 'Highligh active form in opened form list If srcAllButton = True Then srcPatern = "ttttttt" If Mid$(srcPatern, 1, 1) = "t" Then tbMenu.Buttons(2).Visible = True: mnuRACN.Visible = True If Mid$(srcPatern, 2, 1) = "t" Then tbMenu.Buttons(3).Visible = True: mnuRAES.Visible = True If Mid$(srcPatern, 3, 1) = "t" Then tbMenu.Buttons(4).Visible = True: mnuRAS.Visible = True If Mid$(srcPatern, 4, 1) = "t" Then tbMenu.Buttons(5).Visible = True: mnuRADS.Visible = True If Mid$(srcPatern, 5, 1) = "t" Then tbMenu.Buttons(6).Visible = True: mnuRARR.Visible = True If Mid$(srcPatern, 6, 1) = "t" Then tbMenu.Buttons(7).Visible = True: mnuRAP.Visible = True If Mid$(srcPatern, 7, 1) = "t" Then tbMenu.Buttons(8).Visible = True: mnuRAC.Visible = True
mdiMain - 15 ' If mnuRAC.Visible = True Then mnuRASep2.Visible = TrueEnd Sub
Public Sub UnloadChilds()''Unload all active forms Dim Form As Form For Each Form In Forms ''Unload all active childs If Form.Name <> Me.Name And Form.Name <> "frmShortcuts" Then Unload Form Next Form Set Form = NothingEnd Sub
Private Sub DisplayUserInfo() 'Display the current user info' If CurrUser.USER_ISADMIN = True Then' StatusBar1.Panels(4).Text = "Admin"' Else' StatusBar1.Panels(4).Text = "Operator"' End If' StatusBar1.Panels(3).Text = CurrUser.USER_NAME Dim RS As New Recordset RS.Open "SELECT * FROM [Business Info]", CN, adOpenStatic, adLockReadOnly CurrBiz.BUSINESS_NAME = RS.Fields(0) CurrBiz.BUSINESS_ADDRESS = RS.Fields(1) CurrBiz.BUSINESS_CONTACT_INFO = RS.Fields(2) Set RS = NothingEnd Sub
mdiMain - 15 Key = "" EndProperty EndProperty End Begin VB.Menu mnuSystem Caption = "&System" Begin VB.Menu mnuManageUser Caption = "&Manage Users" End Begin VB.Menu mnuChangeDeskClerk Caption = "Change Desk Clerk" End Begin VB.Menu mnuS01 Caption = "-" End Begin VB.Menu mnuLogOff Caption = "&Log Off" Visible = 0 'False End Begin VB.Menu mnuExit Caption = "E&xit" End End Begin VB.Menu mnuRecords Caption = "&Records" Begin VB.Menu mnuNewReservation Caption = "&New Reservation" End Begin VB.Menu mnuCheckInHistory Caption = "Check &In History" End Begin VB.Menu mnuS02 Caption = "-" End Begin VB.Menu mnuCustomers Caption = "&Customers" End Begin VB.Menu mnuCompany Caption = "Com&pany" End Begin VB.Menu mnuAccountReceivables Caption = "Account Receivables" End End Begin VB.Menu mnuMonitoring Caption = "&Monitoring" Begin VB.Menu mnuRoomS Caption = "Rooms" End Begin VB.Menu mnuReservations Caption = "Reservations" End Begin VB.Menu mnuInventoryView Caption = "Inventory View" End Begin VB.Menu mnuBusinessSource Caption = "Business Source" End Begin VB.Menu mnuChargeType Caption = "Charge Type" End Begin VB.Menu mnuCountries Caption = "Countries" End Begin VB.Menu mnuIDType Caption = "ID Type" End Begin VB.Menu mnuPaymentType Caption = "Payment Type" End Begin VB.Menu mnuRateType Caption = "Rate Type" End Begin VB.Menu mnuRoomStatus Caption = "Room Status" End Begin VB.Menu mnuRoomType
mdiMain - 16 Caption = "Room Type" End Begin VB.Menu mnuVehicles Caption = "Vehicles" End End Begin VB.Menu mnuTools Caption = "&Tools" Begin VB.Menu mnuPreferences Caption = "&Preferences" End Begin VB.Menu mnuDatabaseUtilities Caption = "&Database Utilities" Begin VB.Menu mnuBackupDatabase Caption = "&Backup Database" End Begin VB.Menu mnuDatabaseRestore Caption = "Database &Restore" End End End Begin VB.Menu mnuRecA Caption = "&Action" Begin VB.Menu mnuRACN Caption = "Create &New" End Begin VB.Menu mnuRAES Caption = "&Edit Selected" End Begin VB.Menu mnuRAS Caption = "&Search" End Begin VB.Menu mnuRADS Caption = "&Delete Selected" End Begin VB.Menu mnuRARR Caption = "&Refresh" End Begin VB.Menu mnuRAP Caption = "&Print" End Begin VB.Menu mnuRASep2 Caption = "-" End Begin VB.Menu mnuRAC Caption = "&Close" End End Begin VB.Menu mnuReports Caption = "&Reports" Begin VB.Menu mnuRPTAccRec Caption = "Accounts Receivable" End Begin VB.Menu mnuRPTOtherCharges Caption = "Other Charges" End Begin VB.Menu mnuRPTCheckedInGuest Caption = "Checked In Guest" End Begin VB.Menu mnuRPTCheckOut Caption = "Check Out Report" End Begin VB.Menu mnuDueReservation Caption = "Due Reservation" End Begin VB.Menu mnuRPTGuestList Caption = "Guest List Report" End Begin VB.Menu mnuRPTRoomHistory Caption = "Room History Report" End End Begin VB.Menu mnuHelp Caption = "&Help" EndEnd
Today is ---
Welcome, ---
Programmed by: jaYPee
modADO - 1 ''***************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Ph'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE,''***************
modADO - 2 'Function used to get the sum of fieldsPublic Function getSumOfFields(ByVal sTable As String, ByVal sField As String, ByRef sCN As ADODB.Connection, Optional inclField As String, Optional sCondition As String) As Double On Error GoTo err Dim RS As New ADODB.Recordset
RS.CursorLocation = adUseClient If sCondition <> "" Then sCondition = " GROUP BY " & inclField & " HAVING(" & sCondition & ")" If inclField <> "" Then inclField = "," & inclField RS.Open "SELECT Sum(" & sTable & "." & sField & ") AS fTotal" & inclField & " FROM " & sTable & sCondition, sCN, adOpenStatic, adLockOptimistic If RS.RecordCount > 0 Then RS.MoveFirst Do While Not RS.EOF getSumOfFields = getSumOfFields + RS.Fields("fTotal") RS.MoveNext Loop Else getSumOfFields = 0 End If Set RS = Nothing Exit Functionerr: 'Error when incounter a null value If err.Number = 94 Then getSumOfFields = 0: Resume NextEnd Function
'Procedure used to remove DSNPublic Sub RemoveDSN()On Error Resume NextKill App.Path & "\rptCN.dsn"End Sub
modApp - 1 Option Explicit
Private Const sAS_AutoBackup As String = "AutoBackup"
'Public Function WriteErrorLog(sModuleName As String, sRoutineName As String, sDetail As String)' frmErrMsg.ShowForm sModuleName, sRoutineName, sDetail'End Function
Public Function SetAutoBackup(ByVal NewValue As Boolean)
Dim sValue As String SaveSetting App.Title, "AppSetting", sAS_AutoBackup, IIf(NewValue, "T", "F")
End Function
Public Function GetAutoBackup() As Boolean Dim sValue As String 'default GetAutoBackup = -1 sValue = GetSetting(App.Title, "AppSetting", sAS_AutoBackup, "T")
GetAutoBackup = IIf(sValue = "T", True, False)
End Function
modDSN - 1 Private Const ODBC_ADD_SYS_DSN = 4 ' Add data sourcePrivate Const ODBC_CONFIG_DSN = 2 ' Configure (edit) data SourcePrivate Const ODBC_REMOVE_DSN = 3 ' Remove data sourcePrivate Const vbAPINull As Long = vbNull ' NULL Pointer
'Function DeclarePrivate Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" _ (ByVal hwndParent As Long, ByVal fRequest As Long, _ ByVal lpszDriver As String, ByVal lpszAttributes As String) _ As Long
Public Sub createDSN() 'Creating the DSN
#If Win32 Then Dim intRet As Long #Else Dim intRet As Integer #End If
Dim strDriver As String Dim strAttributes As String
Private Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
' RectanglePrivate Type RECT Left As Long ' Left of the rectangle Top As Long ' Top of the rectangle Right As Long ' Right of the rectangle Bottom As Long ' Bottom of the rectangleEnd Type
Public Sub LoadForm(ByRef CFrm As Form) Dim R As RECT CFrm.Visible = False CFrm.WindowState = vbNormal
GetClientRect mdiMain.hWnd, R 'set client size 'right If mdiMain.b8SBC.Visible = True Then R.Right = R.Right - (mdiMain.b8SBC.Width / Screen.TwipsPerPixelX) End If 'bottom R.Bottom = R.Bottom - ((mdiMain.b8CW.Height / Screen.TwipsPerPixelY) + (mdiMain.bgHeader.Height / Screen.TwipsPerPixelY)) - R.Top mdiMain.b8CW.LoadChildWindow mdiMain.hWnd, CFrm.hWnd, CFrm.Name, CFrm.Caption, R.Top, R.Left, R.Right, R.Bottom
CFrm.Visible = True CFrm.Show CFrm.SetFocus ResizeMdiChildForm CFrmEnd Sub
Public Sub ResizeMdiChildForm(ByRef CFrm As Form)
Dim R As RECT GetClientRect mdiMain.hWnd, R 'set client size 'right If mdiMain.b8SBC.Visible = True Then R.Right = R.Right - (mdiMain.b8SBC.Width / Screen.TwipsPerPixelX) End If 'bottom R.Bottom = R.Bottom - ((mdiMain.b8CW.Height / Screen.TwipsPerPixelY) + (mdiMain.bgHeader.Height / Screen.TwipsPerPixelY)) - R.Top
Public Sub ActivateMDIChildForm(ByVal sFormName As String) Dim frm As Form For Each frm In Forms If frm.Name = sFormName Then 'activate form ResizeMdiChildForm frm frm.Visible = True frm.Show frm.SetFocus 'set tab active window mdiMain.b8CW.SetActiveWindow sFormName Exit For End If Next
modFuncChild - 2 Set frm = NothingEnd Sub
modFunction - 1 ''*****************************************************************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
'Function used to format recordsetPublic Function FormatRS(ByVal srcField As Field, Optional AllowNewLine As Boolean) As String Dim strRet As String With srcField If AllowNewLine = True Then strRet = srcField Else strRet = Replace(srcField, vbCrLf, " ", , , vbTextCompare) End If 'If srcField.Type = adCurrency Or srcField.Type = adDouble Then If srcField.Type = adCurrency Then strRet = Format$(srcField, "#,##0.00") ElseIf srcField.Type = adDate Then strRet = Format$(srcField, "MMM-dd-yyyy") Else strRet = srcField End If End With FormatRS = strRet strRet = vbNullStringEnd Function
'Function that will format return a generated idPublic Function GenerateID(ByVal srcNo As String, ByVal src1stStr As String, ByVal src2ndStr As String) As String If Len(src2ndStr) <= Len(srcNo) Then GenerateID = src1stStr & srcNo Else GenerateID = src1stStr & Left$(src2ndStr, Len(src2ndStr) - Len(srcNo)) & srcNo End IfEnd Function
'Function used to check if the record exit or not.Public Function isRecordExist(ByVal sTable As String, ByVal sField As String, ByVal sStr As String, Optional isString As Boolean) As Boolean Dim RS As New Recordset
RS.CursorLocation = adUseClient If isString = False Then RS.Open "Select * From " & sTable & " Where " & sField & " = " & sStr, CN, adOpenStatic, adLockOptimistic Else RS.Open "Select * From " & sTable & " Where " & sField & " = '" & sStr & "'", CN, adOpenStatic, adLockOptimistic End If If RS.RecordCount < 1 Then isRecordExist = False Else isRecordExist = True End If Set RS = NothingEnd Function
'Function used to check if the Ascii is a number or not (return 0 if number)Public Function isNumber(ByVal sKeyAscii) As Integer
modFunction - 2 If Not ((sKeyAscii >= 48 And sKeyAscii <= 57) Or sKeyAscii = 8 Or sKeyAscii = 46) Then isNumber = 0 Else isNumber = sKeyAscii End IfEnd Function
'Function used to check if the record exist in Flex gridPublic Function isRecExistInFlex(ByVal srcFlexGrd As MSHFlexGrid, ByVal srcWhatCol As Integer, ByVal srcFindWhat As String) As Boolean isRecExistInFlex = False Dim i As Long For i = 1 To srcFlexGrd.Rows - 1 If srcFlexGrd.TextMatrix(i, srcWhatCol) = srcFindWhat Then isRecExistInFlex = True: Exit For Next i i = 0End Function
'Function used to check if the record exist in Flex gridPublic Function getFlexPos(ByVal srcFlexGrd As MSHFlexGrid, ByVal srcWhatCol As Integer, ByVal srcFindWhat As String) As Integer Dim R As Long, ret As Integer ret = -1 'Means not found For R = 0 To srcFlexGrd.Rows - 1 If srcFlexGrd.TextMatrix(R, srcWhatCol) = srcFindWhat Then ret = R: Exit For Next R getFlexPos = ret R = 0: ret = 0End Function
'Function used to left split user fieldsPublic Function LeftSplitUF(ByVal srcUF As String) As String If srcUF = "*~~~~~*" Then LeftSplitUF = "": Exit Function Dim i As Integer Dim t As String For i = 1 To Len(srcUF) If Mid$(srcUF, i, 7) = "*~~~~~*" Then Exit For Else t = t & Mid$(srcUF, i, 1) End If Next i LeftSplitUF = t i = 0 t = ""End Function
'Function used to right split user fieldsPublic Function RightSplitUF(ByVal srcUF As String) As String If srcUF = "*~~~~~*" Then RightSplitUF = "": Exit Function Dim i As Integer Dim t As String For i = (InStr(1, srcUF, "*~~~~~*", vbTextCompare) + 7) To Len(srcUF) t = t & Mid$(srcUF, i, 1) Next i RightSplitUF = t i = 0 t = ""End Function
'Function that return true if the control is emptyPublic Function is_empty(ByRef sText As Variant, Optional UseTagValue As Boolean) As Boolean On Error Resume Next If sText.Text = "" Then is_empty = True If UseTagValue = True Then MsgBox "The field '" & sText.Tag & "' is required.Please check it!", vbExclamation Else MsgBox "The field is required.Please check it!", vbExclamation End If sText.SetFocus Else is_empty = False End If
modFunction - 3 End Function
'Function used to change the yes/no valuePublic Function changeYNValue(ByVal srcStr As String) As String Select Case srcStr Case "Y": changeYNValue = "1" Case "N": changeYNValue = "0" Case "1": changeYNValue = "Y" Case "0": changeYNValue = "N" End SelectEnd Function
'Function used to change the true/false valuePublic Function changeTFValue(ByVal srcStr As String) As String Select Case srcStr Case "True": changeTFValue = "1" Case "False": changeTFValue = "0" Case "1": changeTFValue = "True" Case "0": changeTFValue = "False" End SelectEnd Function
'Function that return true if the control is numericPublic Function is_numeric(ByRef sText As String) As Boolean If IsNumeric(sText) = False Then is_numeric = False MsgBox "The field required a numeric input.Please check it!", vbExclamation Else is_numeric = True End IfEnd Function
'Function that return the value of a certain fieldPublic Function getValueAt(ByVal srcSQL As String, ByVal whichField As String) As String Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockReadOnly If RS.RecordCount > 0 Then getValueAt = RS.Fields(whichField) Set RS = NothingEnd Function
'Convert string to number'I create this istead of val() co'z val return incorrect value'ex. Try to see the output of val("3,800")'It did not support characters like , and etc.Public Function toNumber(ByVal srcCurrency As String, Optional RetZeroIfNegative As Boolean) As Double If srcCurrency = "" Then toNumber = 0 Else Dim retValue As Double If InStr(1, srcCurrency, ",") > 0 Then retValue = Val(Replace(srcCurrency, ",", "", , , vbTextCompare)) Else retValue = Val(srcCurrency) End If If RetZeroIfNegative = True Then If retValue < 1 Then retValue = 0 End If toNumber = retValue retValue = 0 End IfEnd Function
'Function that return the count of the rows in the tablePublic Function getRecordCount(ByVal srcTable As String, Optional srcCondition As String, Optional isFormatted As Boolean) As String If srcCondition <> "" Then srcCondition = " " & srcCondition Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open "SELECT COUNT(PK) as TCount FROM " & srcTable & srcCondition, CN, adOpenStatic, adLockReadOnly If isFormatted = True Then getRecordCount = Format$(RS![TCount], "#,##0")
modFunction - 4 Else getRecordCount = RS![TCount] End If Set RS = NothingEnd Function
'Function that will return a currenct formatPublic Function toMoney(ByVal srcCurr As String) As String toMoney = Format$(IIf(Trim(srcCurr) = "", 0, srcCurr), "#,##0.00")End Function
'Function used to determine if the object has been setPublic Function isObjectSet(srcObject As Object) As Boolean On Error GoTo err 'I use tag because almost all controls have this srcObject.Tag = srcObject.Tag isObjectSet = True Exit Functionerr: isObjectSet = FalseEnd Function
'Function used to get the end day number of a cetain monthPublic Function getEndDay(ByVal srcDate As Date) As Byte Dim h1 As String h1 = Format(srcDate, "mm") On Error GoTo err Select Case h1 Case Is = "01": getEndDay = 31 Case Is = "02": getEndDay = Day(h1 & "/29/" & Format(srcDate, "yy")) Case Is = "03": getEndDay = 31 Case Is = "04": getEndDay = 30 Case Is = "05": getEndDay = 31 Case Is = "06": getEndDay = 30 Case Is = "07": getEndDay = 31 Case Is = "08": getEndDay = 31 Case Is = "09": getEndDay = 30 Case Is = "10": getEndDay = 31 Case Is = "11": getEndDay = 30 Case Is = "12": getEndDay = 31 End Select h1 = "" Exit Functionerr: If err.Number = 13 Then getEndDay = 28: h1 = "" 'Day if encounter not a left-yearEnd Function
Public Function getUnitID(ByVal sUnit As String) As Long Dim RS As New ADODB.Recordset Dim sql As String sql = "SELECT UnitID From Unit WHERE (((Unit)='" & Replace(sUnit, "'", "''") & "'))" RS.Open sql, CN, adOpenDynamic, adLockOptimistic If Not RS.EOF Then getUnitID = RS!UnitID Else getUnitID = 0 End If RS.Close Set RS = NothingEnd Function
Function GetINI(strMain As String, strSub As String) As String Dim strBuffer As String Dim lngLen As Long Dim lngRet As Long strBuffer = Space(100) lngLen = Len(strBuffer) lngRet = GetPrivateProfileString(strMain, strSub, vbNullString, strBuffer, lngLen, App.Path & "\config.txt") GetINI = Left(strBuffer, lngRet)End Function
modFunction - 5 'Function to determine user's permissionPublic Function allowOpen(frmForm As String, ByRef User As String) As Boolean Dim RS As New Recordset Dim srcSQL As String srcSQL = "SELECT * FROM qry_User WHERE Form = '" & frmForm & "' AND UserID = '" & User & "'" RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockReadOnly If RS.RecordCount > 0 Then allowOpen = True Set RS = NothingEnd Function
Public Function ChangePermission(ByVal UserPermID As Long, ByVal bNewPermission As Boolean) As Boolean Dim vRS As New ADODB.Recordset Dim sSQL As String 'default ChangePermission = False sSQL = "SELECT *" & _ " From [User Permission]" & _ " WHERE UserPermissionID=" & UserPermID vRS.Open sSQL, CN, adOpenStatic, adLockOptimistic On Error GoTo RAE vRS.MoveFirst vRS.Fields("AllowOpen").Value = bNewPermission vRS.Update ChangePermission = True RAE: Set vRS = NothingEnd Function
modMain - 1 Option Explicit
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
'api declarationsPublic Declare Function InitCommonControls Lib "comctl32.dll" () As LongPrivate Declare Function GetTickCount Lib "kernel32" () As Long
Public CloseMe As Boolean
Public Sub Main() 'use system appearance style InitCommonControls frmSplash.Show frmSplash.Refresh
DBPath = GetINI("Configuration", "Path") 'get path from file If Trim(DBPath) = "" Or IsNull(DBPath) ThenJumpHere: frmLocate.Show 1 'browse database End If If OpenDB = vbRetry Then GoTo JumpHere 'create DSN for reports createDSN
' Load mdiMain Delay 2
frmLogin.Show 1 If CloseMe = True Then End
mdiMain.Show Unload frmSplash Set frmSplash = NothingEnd Sub
'Public Sub Main_AfterSD()''' 'Open Database File' If OpenDB = False Then' Exit Sub' End If''' 'TestUnit' mdiMain.ShowForm'End Sub
Public Sub SetINI(strMain As String, strSub As String, strvalue As String) WritePrivateProfileString strMain, strSub, strvalue, App.Path & "\config.txt"End Sub
Public Sub Delay(PauseTime) Dim Start, Finish, TotalTime
Start = Timer ' Set start time. Do While Timer < Start + PauseTime DoEvents ' Yield to other processes. LoopEnd Sub
modProcedure - 1 ''*****************************************************************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
'Public Sub LoadForm(ByRef srcForm As Form)'On Error Resume Next' srcForm.Show' srcForm.WindowState = vbMaximized' srcForm.SetFocus'End Sub
'Used to locate the key in opened formPublic Sub HighlightInWin(ByVal srcKey As String)' With mdiMain.lvWin' If .ListItems.Count > 0 Then' If .SelectedItem.Key <> srcKey Then' Dim c As Integer' For c = 1 To .ListItems.Count' If .ListItems(c).Key = srcKey Then' .ListItems(c).Selected = True' .ListItems(c).EnsureVisible' Exit For' End If' Next c' End If' End If' End WithEnd Sub
'Procedure used to custom move the recordset cursorPublic Sub customMove(ByRef sRS As Recordset, ByVal isNum As Boolean, ByVal findStr As String, ByVal sField As String) If sRS.RecordCount < 1 Then Exit Sub Dim old_pos As Long sRS.MoveFirst old_pos = sRS.AbsolutePosition If isNum = True Then sRS.Find sField & " = " & findStr Else sRS.Find sField & " = '" & findStr & "'" End If If sRS.EOF Then sRS.AbsolutePosition = old_pos old_pos = 0End Sub'This code is also available in .NET version with ADO.NET'Procedure used to fill list viewPublic Sub FillListView(ByRef sListView As ListView, ByRef sRecordSource As Recordset, ByVal sNumOfFields As Byte, ByVal sNumIco As Byte, ByVal with_num As Boolean, ByVal show_first_rec As Boolean, Optional srcHiddenField As String) Dim X As Variant Dim i As Byte On Error Resume Next sListView.ListItems.Clear If sRecordSource.RecordCount < 1 Then Exit Sub sRecordSource.MoveFirst Do While Not sRecordSource.EOF If with_num = True Then Set X = sListView.ListItems.Add(, , sRecordSource.AbsolutePosition, sNumIco, sNumIco) Else Set X = sListView.ListItems.Add(, , "" & sRecordSource.Fields(0), sNumIco, sNumIco) End If If srcHiddenField <> "" Then X.Tag = sRecordSource.Fields(srcHiddenField) For i = 1 To sNumOfFields - 1
modProcedure - 2 If show_first_rec = True Then If with_num = True Then If sRecordSource.Fields(CInt(i) - 1).Type = adDouble Then X.SubItems(i) = FormatRS(sRecordSource.Fields(CInt(i) - 1)) Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i) - 1)) End If Else If sRecordSource.Fields(CInt(i)).Type = adDouble Then X.SubItems(i) = FormatRS(sRecordSource.Fields(CInt(i))) Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i))) End If End If Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i) + 1)) End If Next i sRecordSource.MoveNext Loop i = 0 Set X = NothingEnd Sub
'Procedure used to promp unexpected errorsPublic Sub prompt_err(ByVal sError As ErrObject, ByVal ModuleName As String, ByVal OccurIn As String) MsgBox "Error From: " & ModuleName & vbNewLine & _ "Occur In: " & OccurIn & vbNewLine & _ "Error Number: " & sError.Number & vbNewLine & _ "Description: " & sError.Description, vbCritical, "Application Error" 'Save the error log (The save error log will be display later on in the program) Open App.Path & "\Error.log" For Append As #1 Print #1, Format(Date, "MMM-dd-yyyy") & "~~~~~" & Time & "~~~~~" & sError.Number & "~~~~~" & sError.Description & "~~~~~" & ModuleName & "~~~~~" & OccurIn Close #1End Sub
'Procedure used to delete record with SQLPublic Sub DelRecwSQL(ByVal sTable As String, ByVal sField As String, ByVal sString As String, ByVal isNumber As Boolean, ByVal snum As Long) If isNumber = True Then CN.Execute "DELETE FROM " & sTable & " WHERE " & sField & " =" & snum Else CN.Execute "DELETE FROM " & sTable & " WHERE " & sField & " ='" & sString & "'" End IfEnd Sub
'Procedure used to fill the listview in paging methodPublic Sub pageFillListView(ByRef sListView As ListView, ByRef sRecordSource As Recordset, ByVal pos_start As Long, ByVal pos_end As Long, ByVal sNumOfFields As Byte, ByVal sNumIco As Byte, ByVal with_num As Boolean, ByVal show_first_rec As Boolean, Optional match_field As String, Optional match_str As String, Optional match_ico As Byte, Optional srcHiddenField As String)
Dim X As ListItem Dim i As Byte, c As Long, old_pt As Long sListView.ListItems.Clear If sRecordSource.RecordCount < 1 Then Exit Sub sRecordSource.AbsolutePosition = pos_start On Error Resume Next old_pt = Screen.MousePointer Screen.MousePointer = vbHourglass DoEvents Do If match_field = "" Then If with_num = True Then Set X = sListView.ListItems.Add(, , "" & sRecordSource.AbsolutePosition, sNumIco, sNumIco) Else Set X = sListView.ListItems.Add(, , "" & FormatRS(sRecordSource.Fields(0)), sNumIco, sNumIco) End If Else If sRecordSource.Fields(match_field) = match_str Then If with_num = True Then Set X = sListView.ListItems.Add(, , "" & sRecordSource.AbsolutePosition, match_ico, match_ico)
modProcedure - 3 Else Set X = sListView.ListItems.Add(, , "" & FormatRS(sRecordSource.Fields(0)), match_ico, match_ico) End If Else If with_num = True Then Set X = sListView.ListItems.Add(, , "" & sRecordSource.AbsolutePosition, sNumIco, sNumIco) Else Set X = sListView.ListItems.Add(, , "" & FormatRS(sRecordSource.Fields(0)), sNumIco, sNumIco) End If End If End If If srcHiddenField <> "" Then X.Tag = sRecordSource.Fields(srcHiddenField) & "*~~~~~*" & c + pos_start Else X.Tag = c + pos_start End If For i = 1 To sNumOfFields - 1 If show_first_rec = True Then If with_num = True Then X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i) - 1)) Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i))) End If Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i) + 1)) End If Next i If sRecordSource.AbsolutePosition >= pos_end Then Exit Do Else sRecordSource.MoveNext c = c + 1 End If Loop Screen.MousePointer = old_pt i = 0: c = 0: old_pt = 0 Set X = NothingEnd Sub
'Procedure used to highlight text when focusPublic Sub HLText(ByRef sText) On Error Resume Next With sText .SelStart = 0 .SelLength = Len(sText.Text) End WithEnd Sub
'Procedure used to bind data comboPublic Sub bind_dc(ByVal srcSQL As String, ByVal srcBindField As String, ByRef srcDC As DataCombo, Optional srcColBound As String, Optional ShowFirstRec As Boolean) Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockOptimistic With srcDC .ListField = srcBindField .BoundColumn = srcColBound Set .RowSource = RS 'Display the first record If ShowFirstRec = True Then If Not RS.RecordCount < 1 Then .BoundText = RS.Fields(srcColBound) .Tag = RS.RecordCount & "*~~~~~*" & RS.Fields(srcColBound) Else .Tag = "0*~~~~~*0" End If End If End With Set RS = NothingEnd Sub
modProcedure - 4 'Procedure used to bind data listPublic Sub bind_dl(ByVal srcSQL As String, ByVal srcBindField As String, ByRef srcDL As DataList, Optional srcColBound As String, Optional ShowFirstRec As Boolean) Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockOptimistic With srcDL .ListField = srcBindField .BoundColumn = srcColBound Set .RowSource = RS 'Display the first record If ShowFirstRec = True Then If Not RS.RecordCount < 1 Then .BoundText = RS.Fields(srcColBound) .Tag = RS.RecordCount & "*~~~~~*" & RS.Fields(srcColBound) Else .Tag = "0*~~~~~*0" End If End If End With Set RS = NothingEnd Sub
'Procedure used to clear the text contentPublic Sub clearText(ByRef sForm As Form) Dim Control As Control For Each Control In sForm.Controls If (TypeOf Control Is TextBox) Then Control = vbNullString Next Control Set Control = NothingEnd Sub
'Procedure used to clear the text contentPublic Sub LockInput(ByRef sForm As Form, ByVal bolLock As Boolean, Optional bolTabStop As Boolean) On Error Resume Next Dim Control As Control For Each Control In sForm.Controls Control.Locked = bolLock Next Control Set Control = NothingEnd Sub
'Procedure that will change the value at oncePublic Sub ChangeValue(ByRef srcCN As Connection, ByVal srcTable As String, ByVal srcField As String, ByVal srcValue As String, Optional isNumber As Boolean, Optional srcCondition As String) If srcCondition <> vbNullString Then srcCondition = " " & srcCondition If isNumber = True Then srcCN.Execute "UPDATE " & srcTable & " SET " & srcField & " =" & srcValue & " " & srcCondition Else srcCN.Execute "UPDATE " & srcTable & " SET " & srcField & " ='" & srcValue & "'" & srcCondition End IfEnd Sub
Public Sub FillFlex(ByRef srcFlex As MSHFlexGrid, ByVal srcSQL As String, ByVal srcNoOfCol As Integer) Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockReadOnly If RS.RecordCount < 1 Then Exit Sub RS.MoveFirst Dim i As Long, c As Long srcFlex.Rows = (srcFlex.Rows + RS.RecordCount) - 1 For i = 1 To RS.RecordCount For c = 0 To srcNoOfCol - 1 srcFlex.TextMatrix(i, c) = RS.Fields(c) Next c RS.MoveNext Next i i = 0 c = 0 Set RS = NothingEnd Sub
modProcedure - 5 'Procedure used to search in listviewPublic Sub search_in_listview(ByRef sListView As ListView, ByVal sFindText As String) Dim tmp_listtview As ListItem Set tmp_listtview = sListView.FindItem(sFindText, lvwSubItem) If Not tmp_listtview Is Nothing Then tmp_listtview.EnsureVisible tmp_listtview.Selected = True End IfEnd Sub
'Procedure used to center formPublic Sub centerForm(ByRef sForm As Form, ByVal sHeight As Integer, ByVal sWidth As Integer) sForm.Move (sWidth - sForm.Width) / 2, (sHeight - sForm.Height) / 2End Sub'Procedure used to center object horizontalPublic Sub center_obj_horizontal(ByVal sParentObj As Variant, ByRef sMoveObj As Variant) sMoveObj.Left = (sParentObj - sMoveObj.Width) / 2End Sub'Procedure used to center verticalPublic Sub center_obj_vertical(ByVal sParentObj As Variant, ByRef sMoveObj As Variant) sMoveObj.Top = (sParentObj.Height - sMoveObj.Height) / 2End Sub
'Public Sub SetINI(strMain As String, strSub As String, strvalue As String)' WritePrivateProfileString strMain, strSub, strvalue, App.Path & "\VTM.txt"'End Sub
Public Sub SetHandCur(Hand As Boolean) If Hand = True Then SetCursor LoadCursor(0, IDC_HAND) Else SetCursor LoadCursor(0, IDC_ARROW) End IfEnd Sub
modPublicVar - 1 ''*****************************************************************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
Public CurrUser As USER_INFOPublic DBPath As StringPublic Enc As New clsBlowfishPublic CurrBiz As BUSINESS_INFO
Public CN As New Connection
Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Public Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long Public Const IDC_HAND = 32649& Public Const IDC_ARROW = 32512&
modVarType - 1
'Variable structure for userPublic Type USER_INFO USER_PK As Long USER_NAME As String USER_ISADMIN As BooleanEnd Type
'Enumerator for form statePublic Enum FormState adStateAddMode = 0 adStateEditMode = 1 adStatePopupMode = 2 adStateViewMode = 3End Enum
Public Type BUSINESS_INFO BUSINESS_NAME As String BUSINESS_ADDRESS As String BUSINESS_CONTACT_INFO As StringEnd Type
clsBlowfish - 1 Option Explicit
' Visual Basic Blowfish Implementation' Algorithm Author: Bruce Schneier' VB Implementation: David Midkiff ([email protected])'' Standard Blowfish implementation with file support, Base64 conversion,' and overall optimisations for Visual Basic. Blowfish is considered one' of the strongest encryption algorithms on the market and is much faster' than the IDEA cipher. It supports variable length keys up to 448-bits. I' would recommend this cipher for high security risk related solutions since' it is unpatented and free for use.'' Information on the Blowfish algorithm can be found at:' http://www.counterpane.com/blowfish.html
Private Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Event Progress(Percent As Long)
Private Const Rounds = 16
Private m_pBox(0 To Rounds + 1) As LongPrivate m_sBox(0 To 3, 0 To 255) As LongPrivate m_KeyValue As StringPrivate m_RunningCompiled As BooleanPrivate m_bytIndex(0 To 63) As BytePrivate m_bytReverseIndex(0 To 255) As Byte
Private Const k_bytEqualSign As Byte = 61Private Const k_bytMask1 As Byte = 3Private Const k_bytMask2 As Byte = 15Private Const k_bytMask3 As Byte = 63Private Const k_bytMask4 As Byte = 192Private Const k_bytMask5 As Byte = 240Private Const k_bytMask6 As Byte = 252Private Const k_bytShift2 As Byte = 4Private Const k_bytShift4 As Byte = 16Private Const k_bytShift6 As Byte = 64Private Const k_lMaxBytesPerLine As Long = 152Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As Long, ByVal Source As Long, ByVal Length As Long)
Public Function Decode64(sInput As String) As String If sInput = "" Then Exit Function Decode64 = StrConv(DecodeArray64(sInput), vbUnicode)End Function
Public Function DecodeArray64(sInput As String) As Byte() If m_bytReverseIndex(47) <> 63 Then Initialize64 Dim bytInput() As Byte Dim bytWorkspace() As Byte Dim bytResult() As Byte Dim lInputCounter As Long Dim lWorkspaceCounter As Long bytInput = Replace(Replace(sInput, vbCrLf, ""), "=", "") ReDim bytWorkspace(LBound(bytInput) To (UBound(bytInput) * 2)) As Byte lWorkspaceCounter = LBound(bytWorkspace) For lInputCounter = LBound(bytInput) To UBound(bytInput) bytInput(lInputCounter) = m_bytReverseIndex(bytInput(lInputCounter)) Next lInputCounter For lInputCounter = LBound(bytInput) To (UBound(bytInput) - ((UBound(bytInput) Mod 8) + 8)) Step 8 bytWorkspace(lWorkspaceCounter) = (bytInput(lInputCounter) * k_bytShift2) + (bytInput(lInputCounter + 2) \ k_bytShift4) bytWorkspace(lWorkspaceCounter + 1) = ((bytInput(lInputCounter + 2) And k_bytMask2) * k_bytShift4) + (bytInput(lInputCounter + 4) \ k_bytShift2) bytWorkspace(lWorkspaceCounter + 2) = ((bytInput(lInputCounter + 4) And k_bytMask1) * k_bytShift6) + bytInput(lInputCounter + 6) lWorkspaceCounter = lWorkspaceCounter + 3 Next lInputCounter Select Case (UBound(bytInput) Mod 8): Case 3: bytWorkspace(lWorkspaceCounter) = (bytInput(lInputCounter) * k_bytShift2) + (bytInput(lInputCounter + 2) \ k_bytShift4) Case 5: bytWorkspace(lWorkspaceCounter) = (bytInput(lInputCounter) * k_bytShift2) + (bytInput(lInputCounter + 2) \ k_bytShift4) bytWorkspace(lWorkspaceCounter + 1) = ((bytInput(lInputCounter + 2) And k_bytMask2) * k_bytShift4) + (bytInput(lInputCounter + 4) \ k_bytShift2) lWorkspaceCounter = lWorkspaceCounter + 1 Case 7: bytWorkspace(lWorkspaceCounter) = (bytInput(lInputCounter) * k_bytShift2) + (bytInput(lInputCounter + 2) \ k_bytShift4) bytWorkspace(lWorkspaceCounter + 1) = ((bytInput(lInputCounter + 2) And k_bytMask2) * k_bytShift4) + (bytInput(lInputCounter + 4) \ k_bytShift2) bytWorkspace(lWorkspaceCounter + 2) = ((bytInput(lInputCounter + 4) And k_bytMask1) * k_bytShift6) + bytInput(lInputCounter + 6) lWorkspaceCounter = lWorkspaceCounter + 2 End Select ReDim bytResult(LBound(bytWorkspace) To lWorkspaceCounter) As Byte If LBound(bytWorkspace) = 0 Then lWorkspaceCounter = lWorkspaceCounter + 1 CopyMemory VarPtr(bytResult(LBound(bytResult))), VarPtr(bytWorkspace(LBound(bytWorkspace))), lWorkspaceCounter DecodeArray64 = bytResult
clsBlowfish - 4 End Function
Public Function Encode64(ByRef sInput As String) As String If sInput = "" Then Exit Function Dim bytTemp() As Byte bytTemp = StrConv(sInput, vbFromUnicode) Encode64 = EncodeArray64(bytTemp)End Function
Public Function EncodeArray64(ByRef bytInput() As Byte) As String On Error GoTo ErrorHandler If m_bytReverseIndex(47) <> 63 Then Initialize64 Dim bytWorkspace() As Byte, bytResult() As Byte Dim bytCrLf(0 To 3) As Byte, lCounter As Long Dim lWorkspaceCounter As Long, lLineCounter As Long Dim lCompleteLines As Long, lBytesRemaining As Long Dim lpWorkSpace As Long, lpResult As Long Dim lpCrLf As Long
If UBound(bytInput) < 1024 Then ReDim bytWorkspace(LBound(bytInput) To (LBound(bytInput) + 4096)) As Byte Else ReDim bytWorkspace(LBound(bytInput) To (UBound(bytInput) * 4)) As Byte End If
lWorkspaceCounter = LBound(bytWorkspace)
For lCounter = LBound(bytInput) To (UBound(bytInput) - ((UBound(bytInput) Mod 3) + 3)) Step 3 bytWorkspace(lWorkspaceCounter) = m_bytIndex((bytInput(lCounter) \ k_bytShift2)) bytWorkspace(lWorkspaceCounter + 2) = m_bytIndex(((bytInput(lCounter) And k_bytMask1) * k_bytShift4) + ((bytInput(lCounter + 1)) \ k_bytShift4)) bytWorkspace(lWorkspaceCounter + 4) = m_bytIndex(((bytInput(lCounter + 1) And k_bytMask2) * k_bytShift2) + (bytInput(lCounter + 2) \ k_bytShift6)) bytWorkspace(lWorkspaceCounter + 6) = m_bytIndex(bytInput(lCounter + 2) And k_bytMask3) lWorkspaceCounter = lWorkspaceCounter + 8 Next lCounter
Select Case (UBound(bytInput) Mod 3): Case 0: bytWorkspace(lWorkspaceCounter) = m_bytIndex((bytInput(lCounter) \ k_bytShift2)) bytWorkspace(lWorkspaceCounter + 2) = m_bytIndex((bytInput(lCounter) And k_bytMask1) * k_bytShift4) bytWorkspace(lWorkspaceCounter + 4) = k_bytEqualSign bytWorkspace(lWorkspaceCounter + 6) = k_bytEqualSign Case 1: bytWorkspace(lWorkspaceCounter) = m_bytIndex((bytInput(lCounter) \ k_bytShift2)) bytWorkspace(lWorkspaceCounter + 2) = m_bytIndex(((bytInput(lCounter) And k_bytMask1) * k_bytShift4) + ((bytInput(lCounter + 1)) \ k_bytShift4)) bytWorkspace(lWorkspaceCounter + 4) = m_bytIndex((bytInput(lCounter + 1) And k_bytMask2) * k_bytShift2) bytWorkspace(lWorkspaceCounter + 6) = k_bytEqualSign Case 2: bytWorkspace(lWorkspaceCounter) = m_bytIndex((bytInput(lCounter) \ k_bytShift2)) bytWorkspace(lWorkspaceCounter + 2) = m_bytIndex(((bytInput(lCounter) And k_bytMask1) * k_bytShift4) + ((bytInput(lCounter + 1)) \ k_bytShift4)) bytWorkspace(lWorkspaceCounter + 4) = m_bytIndex(((bytInput(lCounter + 1) And k_bytMask2) * k_bytShift2) + ((bytInput(lCounter + 2)) \ k_bytShift6)) bytWorkspace(lWorkspaceCounter + 6) = m_bytIndex(bytInput(lCounter + 2) And k_bytMask3) End Select
lWorkspaceCounter = lWorkspaceCounter + 8
If lWorkspaceCounter <= k_lMaxBytesPerLine Then EncodeArray64 = Left$(bytWorkspace, InStr(1, bytWorkspace, Chr$(0)) - 1) Else bytCrLf(0) = 13 bytCrLf(1) = 0 bytCrLf(2) = 10 bytCrLf(3) = 0 ReDim bytResult(LBound(bytWorkspace) To UBound(bytWorkspace)) lpWorkSpace = VarPtr(bytWorkspace(LBound(bytWorkspace))) lpResult = VarPtr(bytResult(LBound(bytResult))) lpCrLf = VarPtr(bytCrLf(LBound(bytCrLf))) lCompleteLines = Fix(lWorkspaceCounter / k_lMaxBytesPerLine) For lLineCounter = 0 To lCompleteLines
clsBlowfish - 5 CopyMemory lpResult, lpWorkSpace, k_lMaxBytesPerLine lpWorkSpace = lpWorkSpace + k_lMaxBytesPerLine lpResult = lpResult + k_lMaxBytesPerLine CopyMemory lpResult, lpCrLf, 4& lpResult = lpResult + 4& Next lLineCounter lBytesRemaining = lWorkspaceCounter - (lCompleteLines * k_lMaxBytesPerLine) If lBytesRemaining > 0 Then CopyMemory lpResult, lpWorkSpace, lBytesRemaining EncodeArray64 = Left$(bytResult, InStr(1, bytResult, Chr$(0)) - 1) End If Exit Function
ErrorHandler: Erase bytResult EncodeArray64 = bytResultEnd Function
Private Static Sub DecryptBlock(Xl As Long, Xr As Long) Dim i As Long, j As Long, K As Long K = Xr Xr = Xl Xor m_pBox(Rounds + 1) Xl = K Xor m_pBox(Rounds) j = Rounds - 2 For i = 0 To (Rounds \ 2 - 1) Xl = Xl Xor f(Xr) Xr = Xr Xor m_pBox(j + 1) Xr = Xr Xor f(Xl) Xl = Xl Xor m_pBox(j) j = j - 2 NextEnd SubPrivate Static Sub EncryptBlock(Xl As Long, Xr As Long) Dim i As Long, j As Long, Temp As Long j = 0 For i = 0 To (Rounds \ 2 - 1) Xl = Xl Xor m_pBox(j) Xr = Xr Xor f(Xl) Xr = Xr Xor m_pBox(j + 1) Xl = Xl Xor f(Xr) j = j + 2 Next Temp = Xr Xr = Xl Xor m_pBox(Rounds) Xl = Temp Xor m_pBox(Rounds + 1)End SubPublic Sub EncryptByte(byteArray() As Byte, Optional Key As String) Dim Offset As Long, OrigLen As Long, LeftWord As Long, RightWord As Long, CipherLen As Long, CipherLeft As Long, CipherRight As Long, CurrPercent As Long, NextPercent As Long If (Len(Key) > 0) Then Me.Key = Key OrigLen = UBound(byteArray) + 1 CipherLen = OrigLen + 12 If (CipherLen Mod 8 <> 0) Then CipherLen = CipherLen + 8 - (CipherLen Mod 8) ReDim Preserve byteArray(CipherLen - 1) Call CopyMem(byteArray(12), byteArray(0), OrigLen) Call CopyMem(byteArray(8), OrigLen, 4) Call Randomize Call CopyMem(byteArray(0), CLng(2147483647 * Rnd), 4) Call CopyMem(byteArray(4), CLng(2147483647 * Rnd), 4) For Offset = 0 To (CipherLen - 1) Step 8 Call GetWord(LeftWord, byteArray(), Offset) Call GetWord(RightWord, byteArray(), Offset + 4) LeftWord = LeftWord Xor CipherLeft RightWord = RightWord Xor CipherRight Call EncryptBlock(LeftWord, RightWord) Call PutWord(LeftWord, byteArray(), Offset) Call PutWord(RightWord, byteArray(), Offset + 4) CipherLeft = LeftWord CipherRight = RightWord If (Offset >= NextPercent) Then CurrPercent = Int((Offset / CipherLen) * 100) NextPercent = (CipherLen * ((CurrPercent + 1) / 100)) + 1 RaiseEvent Progress(CurrPercent) End If Next If (CurrPercent <> 100) Then RaiseEvent Progress(100)End Sub
clsBlowfish - 6 Public Function EncryptString(Text As String, Optional Key As String, Optional OutputIn64 As Boolean) As String Dim byteArray() As Byte byteArray() = StrConv(Text, vbFromUnicode) Call EncryptByte(byteArray(), Key) EncryptString = StrConv(byteArray(), vbUnicode) If OutputIn64 = True Then EncryptString = Encode64(EncryptString) Erase byteArray(): Key = "": Text = ""End FunctionPublic Function DecryptString(Text As String, Optional Key As String, Optional IsTextIn64 As Boolean) As String Dim byteArray() As Byte If IsTextIn64 = True Then Text = Decode64(Text) byteArray() = StrConv(Text, vbFromUnicode) Call DecryptByte(byteArray(), Key) DecryptString = StrConv(byteArray(), vbUnicode) Erase byteArray(): Key = "": Text = ""End FunctionPublic Sub DecryptByte(byteArray() As Byte, Optional Key As String) On Error GoTo ErrorHandler Dim Offset As Long, OrigLen As Long, LeftWord As Long, RightWord As Long, CipherLen As Long, CipherLeft As Long, CipherRight As Long, CurrPercent As Long, NextPercent As Long If (Len(Key) > 0) Then Me.Key = Key CipherLen = UBound(byteArray) + 1 For Offset = 0 To (CipherLen - 1) Step 8 Call GetWord(LeftWord, byteArray(), Offset) Call GetWord(RightWord, byteArray(), Offset + 4) Call DecryptBlock(LeftWord, RightWord) LeftWord = LeftWord Xor CipherLeft RightWord = RightWord Xor CipherRight Call GetWord(CipherLeft, byteArray(), Offset) Call GetWord(CipherRight, byteArray(), Offset + 4) Call PutWord(LeftWord, byteArray(), Offset) Call PutWord(RightWord, byteArray(), Offset + 4) If Offset >= NextPercent Then CurrPercent = Int((Offset / CipherLen) * 100) NextPercent = (CipherLen * ((CurrPercent + 1) / 100)) + 1 RaiseEvent Progress(CurrPercent) End If Next Call CopyMem(OrigLen, byteArray(8), 4) If (CipherLen - OrigLen > 19) Or (CipherLen - OrigLen < 12) Then Call err.Raise(vbObjectError, , "Incorrect size descriptor in Blowfish decryption") Call CopyMem(byteArray(0), byteArray(12), OrigLen) ReDim Preserve byteArray(OrigLen - 1) If CurrPercent <> 100 Then RaiseEvent Progress(100)
ErrorHandler:End SubPrivate Static Function f(ByVal X As Long) As Long Dim xb(0 To 3) As Byte Call CopyMem(xb(0), X, 4) If (m_RunningCompiled) Then f = (((m_sBox(0, xb(3)) + m_sBox(1, xb(2))) Xor m_sBox(2, xb(1))) + m_sBox(3, xb(0))) Else f = UnsignedAdd((UnsignedAdd(m_sBox(0, xb(3)), m_sBox(1, xb(2))) Xor m_sBox(2, xb(1))), m_sBox(3, xb(0)))End FunctionPrivate Static Sub GetWord(LongValue As Long, CryptBuffer() As Byte, Offset As Long) Dim bb(0 To 3) As Byte bb(3) = CryptBuffer(Offset) bb(2) = CryptBuffer(Offset + 1) bb(1) = CryptBuffer(Offset + 2) bb(0) = CryptBuffer(Offset + 3) Call CopyMem(LongValue, bb(0), 4)End SubPrivate Static Sub PutWord(LongValue As Long, CryptBuffer() As Byte, Offset As Long) Dim bb(0 To 3) As Byte Call CopyMem(bb(0), LongValue, 4) CryptBuffer(Offset) = bb(3) CryptBuffer(Offset + 1) = bb(2) CryptBuffer(Offset + 2) = bb(1) CryptBuffer(Offset + 3) = bb(0)End SubPrivate Static Function UnsignedAdd(ByVal Data1 As Long, Data2 As Long) As Long Dim x1(0 To 3) As Byte, x2(0 To 3) As Byte, xx(0 To 3) As Byte, Rest As Long, Value As Long, a As Long Call CopyMem(x1(0), Data1, 4) Call CopyMem(x2(0), Data2, 4)
clsBlowfish - 7 Rest = 0 For a = 0 To 3 Value = CLng(x1(a)) + CLng(x2(a)) + Rest xx(a) = Value And 255 Rest = Value \ 256 Next Call CopyMem(UnsignedAdd, xx(0), 4)End FunctionPrivate Function UnsignedDel(Data1 As Long, Data2 As Long) As Long Dim x1(0 To 3) As Byte, x2(0 To 3) As Byte, xx(0 To 3) As Byte, Rest As Long, Value As Long, a As Long Call CopyMem(x1(0), Data1, 4) Call CopyMem(x2(0), Data2, 4) Call CopyMem(xx(0), UnsignedDel, 4) For a = 0 To 3 Value = CLng(x1(a)) - CLng(x2(a)) - Rest If (Value < 0) Then Value = Value + 256 Rest = 1 Else Rest = 0 End If xx(a) = Value Next Call CopyMem(UnsignedDel, xx(0), 4)End FunctionPublic Property Let Key(New_Value As String) Dim i As Long, j As Long, K As Long, dataX As Long, datal As Long, datar As Long, Key() As Byte, KeyLength As Long Class_Initialize If (m_KeyValue = New_Value) Then Exit Property m_KeyValue = New_Value KeyLength = Len(New_Value) Key() = StrConv(New_Value, vbFromUnicode) j = 0 For i = 0 To (Rounds + 1) dataX = 0 For K = 0 To 3 Call CopyMem(ByVal VarPtr(dataX) + 1, dataX, 3) dataX = (dataX Or Key(j)) j = j + 1 If (j >= KeyLength) Then j = 0 Next m_pBox(i) = m_pBox(i) Xor dataX Next datal = 0: datar = 0 For i = 0 To (Rounds + 1) Step 2 Call EncryptBlock(datal, datar) m_pBox(i) = datal m_pBox(i + 1) = datar Next For i = 0 To 3 For j = 0 To 255 Step 2 Call EncryptBlock(datal, datar) m_sBox(i, j) = datal m_sBox(i, j + 1) = datar Next NextEnd PropertyPrivate Sub Class_Initialize()On Local Error Resume Next m_RunningCompiled = ((2147483647 + 1) < 0) m_pBox(0) = &H243F6A88 m_pBox(1) = &H85A308D3 m_pBox(2) = &H13198A2E m_pBox(3) = &H3707344 m_pBox(4) = &HA4093822 m_pBox(5) = &H299F31D0 m_pBox(6) = &H82EFA98 m_pBox(7) = &HEC4E6C89 m_pBox(8) = &H452821E6 m_pBox(9) = &H38D01377 m_pBox(10) = &HBE5466CF m_pBox(11) = &H34E90C6C m_pBox(12) = &HC0AC29B7 m_pBox(13) = &HC97C50DD
Public Function EncryptFile(InFile As String, OutFile As String, Overwrite As Boolean, Optional Key As String, Optional OutputIn64 As Boolean) As Boolean Class_Initialize If FileExist(InFile) = False Then EncryptFile = False Exit Function End If If FileExist(OutFile) = True And Overwrite = False Then EncryptFile = False Exit Function End If Dim Buffer() As Byte, FileO As Integer FileO = FreeFile Open InFile For Binary As #FileO ReDim Buffer(0 To LOF(FileO) - 1) Get #FileO, , Buffer() Close #FileO Call EncryptByte(Buffer(), Key) If FileExist(OutFile) = True Then Kill OutFile FileO = FreeFile Open OutFile For Binary As #FileO If OutputIn64 = True Then Put #FileO, , EncodeArray64(Buffer()) Else Put #FileO, , Buffer() End If Close #FileO EncryptFile = True Erase Buffer(): Key = "": InFile = "": OutFile = "" Exit Function
ErrorHandler: Erase Buffer(): Key = "": InFile = "": OutFile = "" EncryptFile = FalseEnd FunctionPublic Function DecryptFile(InFile As String, OutFile As String, Overwrite As Boolean, Optional Key As String, Optional IsFileIn64 As Boolean) As Boolean On Error GoTo ErrorHandler If FileExist(InFile) = False Then DecryptFile = False Exit Function End If If FileExist(OutFile) = True And Overwrite = False Then DecryptFile = False Exit Function End If
clsBlowfish - 22 Dim Buffer() As Byte, FileO As Integer FileO = FreeFile Open InFile For Binary As #FileO ReDim Buffer(0 To LOF(FileO) - 1) Get #FileO, , Buffer() Close #FileO If IsFileIn64 = True Then Buffer() = DecodeArray64(StrConv(Buffer(), vbUnicode)) Call DecryptByte(Buffer(), Key) If FileExist(OutFile) = True Then Kill OutFile Open OutFile For Binary As #FileO Put #FileO, , Buffer() Close #FileO DecryptFile = True Erase Buffer(): Key = "": InFile = "": OutFile = "" Exit Function
ErrorHandler: Erase Buffer(): Key = "": InFile = "": OutFile = "" DecryptFile = FalseEnd FunctionPrivate Function FileExist(FilePath As String) As Boolean On Error GoTo ErrorHandler Call FileLen(FilePath) FileExist = True Exit Function
ErrorHandler: FileExist = FalseEnd Function
clsPaging - 1 ''*****************************************************************'' File Name: clsPaging.cls'' Purpose: Class used for paging recordset'' Required Files: NONE'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created: Dec-20-04 10:55 AM'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
Private m_PAGE_CURRENT As Long 'Store current pagePrivate m_PAGE_PREV As Long 'Store the previous pagePrivate m_PAGE_NEXT As Long 'Store the next pagePrivate m_PAGE_TOTAL As Long 'Store the total page count
Private m_Recordset As Recordset 'Reference recordset where we will perform the paging
Private m_PageBy As Long 'Store the how many record display per pagePrivate m_PageStart As Long 'Store the starting record positionPrivate m_PageEnd As Long 'Store the ending record position
Private PageInformation As String 'Store the page information
'Return the current positionPublic Property Get CurrentPosition() As Long MsgBox m_PAGE_CURRENT CurrentPosition = m_PAGE_CURRENTEnd Property'Set the current positionPublic Property Let CurrentPosition(ByVal whichPage As Long) m_PAGE_CURRENT = whichPage PageRecordsetEnd Property
'Procedure used to refresh pagesPublic Sub Refresh() PageRecordsetEnd Sub
'Start the class and get all the input neededPublic Sub Start(ByRef srcRecordset, ByVal srcPageBy As Long)Set m_Recordset = srcRecordset m_Recordset.CacheSize = srcPageBy m_PageBy = srcPageByEnd Sub
Private Sub Class_Terminate() 'Clear all variables m_PAGE_CURRENT = 0 m_PAGE_NEXT = 0 m_PAGE_PREV = 0 m_PAGE_TOTAL = 0 m_PageBy = 0 m_PageStart = 0 m_PageEnd = 0 PageInformation = vbNullString Set m_Recordset = NothingEnd Sub
'Procedure for paging the recordsetPrivate Sub PageRecordset() If m_Recordset.RecordCount < 1 Then m_PAGE_NEXT = 0 m_PAGE_PREV = 0 m_PAGE_TOTAL = 1 m_PageStart = 0 m_PageEnd = 0
clsPaging - 2 PageInformation = "0 - 0 of 0" Exit Sub End If 'Initialize the paging variables m_PAGE_TOTAL = Fix(m_Recordset.RecordCount / m_PageBy) If InStr(1, (m_Recordset.RecordCount / m_PageBy), ".") > 0 Then m_PAGE_TOTAL = m_PAGE_TOTAL + 1 End If If m_PAGE_TOTAL = 0 Then m_PAGE_TOTAL = m_PAGE_TOTAL + 1 'Page the records m_PAGE_NEXT = m_PAGE_CURRENT + 1 m_PAGE_PREV = m_PAGE_CURRENT - 1 If m_PAGE_TOTAL = 1 Then m_PageStart = 1 m_PageEnd = m_Recordset.RecordCount ElseIf m_PAGE_CURRENT = 1 And m_PAGE_TOTAL > 1 Then m_PageStart = 1 m_PageEnd = m_PageBy ElseIf m_PAGE_CURRENT = m_PAGE_TOTAL And m_PAGE_CURRENT > 1 Then m_PageStart = ((m_PAGE_CURRENT - 1) * m_PageBy) + 1 m_PageEnd = m_Recordset.RecordCount Else m_PageStart = ((m_PAGE_CURRENT - 1) * m_PageBy) + 1 m_PageEnd = (m_PAGE_NEXT - 1) * m_PageBy End If 'Set the page information PageInformation = m_PageStart & " - " & m_PageEnd & " of " & m_Recordset.RecordCountEnd Sub
'Return the current pagePublic Function PAGE_CURRENT() As Long PAGE_CURRENT = m_PAGE_CURRENTEnd Function'Return the previous pagePublic Function PAGE_PREVIOUS() As Long PAGE_PREVIOUS = m_PAGE_PREVEnd Function'Return the next pagePublic Function PAGE_NEXT() As Long PAGE_NEXT = m_PAGE_NEXTEnd Function'Return the page totalPublic Function PAGE_TOTAL() As Long PAGE_TOTAL = m_PAGE_TOTALEnd Function
'Return the starting record positionPublic Function PageStart() As Long PageStart = m_PageStartEnd Function'Return the ending record positionPublic Function PageEnd() As Long PageEnd = m_PageEndEnd Function'Return the page informationPublic Function PageInfo() As String PageInfo = PageInformationEnd Function
clsSQLSelectParser - 1 ''*****************************************************************'' File Name: clsSQLSelectParser.cls'' Purpose: Class used to parse SELECT SQL statement'' Required Files: NONE'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created: Dec-20-04 1:55 AM'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
'Variables for SQL statementPrivate m_Fields As StringPrivate m_Tables As StringPrivate m_wCondition As StringPrivate m_GroupOrder As StringPrivate m_hCondition As StringPrivate m_SortOrder As String
'Variables for storing saved statementPrivate def_Fields As StringPrivate def_Tables As StringPrivate def_wCondition As StringPrivate def_GroupOrder As StringPrivate def_hCondition As StringPrivate def_SortOrder As String
'Return the fieldsPublic Property Get Fields() As String Fields = m_FieldsEnd Property
'Set the fieldsPublic Property Let Fields(ByVal srcFields As String) m_Fields = srcFieldsEnd Property
'Return the tablesPublic Property Get Tables() As String Tables = m_TablesEnd Property
'Set the tablesPublic Property Let Tables(ByVal srcTables As String) m_Tables = srcTablesEnd Property
'Return the where conditionPublic Property Get wCondition() As String wCondition = m_wConditionEnd Property
'Set the where conditionPublic Property Let wCondition(ByVal srcwCondition As String) m_wCondition = srcwConditionEnd Property
'Return the group orderPublic Property Get GroupOrder() As String GroupOrder = m_GroupOrderEnd Property
'Set the group orderPublic Property Let GroupOrder(ByVal srcGroupOrder As String) m_GroupOrder = srcGroupOrderEnd Property
'Return the having conditionPublic Property Get hCondition() As String hCondition = m_hConditionEnd Property
'Set the having conditionPublic Property Let hCondition(ByVal srchCondition As String)
'Return the sort orderPublic Property Get SortOrder() As String SortOrder = m_SortOrderEnd Property
'Set the sort orderPublic Property Let SortOrder(ByVal srcSortOrder As String) m_SortOrder = srcSortOrderEnd Property
'Return the SQL statementPublic Property Get SQLStatement() As String 'Required statement SQLStatement = "SELECT " & m_Fields & " FROM " & m_Tables 'Optional statement If m_wCondition <> "" Then SQLStatement = SQLStatement & " WHERE " & m_wCondition If m_GroupOrder <> "" Then SQLStatement = SQLStatement & " GROUP BY " & m_GroupOrder If m_hCondition <> "" Then SQLStatement = SQLStatement & " HAVING " & m_hCondition If m_SortOrder <> "" Then SQLStatement = SQLStatement & " ORDER BY " & m_SortOrder Debug.Print SQLStatementEnd Property
'Save the statementPublic Sub SaveStatement() def_Fields = m_Fields def_Tables = m_Tables def_wCondition = m_wCondition def_GroupOrder = m_GroupOrder def_hCondition = m_hCondition def_SortOrder = m_SortOrderEnd Sub
'Restore the statementPublic Sub RestoreStatement() m_Fields = def_Fields m_Tables = def_Tables m_wCondition = def_wCondition m_GroupOrder = def_GroupOrder m_hCondition = def_hCondition m_SortOrder = def_SortOrderEnd Sub