VERSION 5.00 Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "Crystl32.OCX" Object = "{8DDE6232-1BB0-11D0-81C3-0080C7A2EF7D}#3.0#0"; "Flp32a30.ocx" Begin VB.Form frmAPMaster Caption = "AP Master List" ClientHeight = 3780 ClientLeft = 60 ClientTop = 345 ClientWidth = 10590 KeyPreview = -1 'True LinkTopic = "Form1" ScaleHeight = 3780 ScaleWidth = 10590 StartUpPosition = 3 'Windows Default Begin VB.TextBox txtZip Height = 345 Left = 6120 MaxLength = 5 TabIndex = 8 Top = 2805 Width = 1470 End Begin VB.TextBox txtState Height = 315 Left = 6120 MaxLength = 2 TabIndex = 7 Top = 2475 Width = 465 End Begin VB.CommandButton cmdAdd Caption = "Add" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 5250 TabIndex = 15 Top = 3225 Width = 1275 End Begin VB.TextBox txtAddress1 Height = 315 Left = 6120 MaxLength = 30 TabIndex = 2 Top = 1425 Width = 4395 End Begin LpLib.fpList lstHeader Height = 3675 Left = 180 TabIndex = 13 Top = 45 Width = 5010 _Version = 196608 _ExtentX = 8837 _ExtentY = 6482 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Enabled = -1 'True MousePointer = 0 Object.TabStop = 0 'False BackColor = -2147483643 ForeColor = -2147483640 Columns = 3 Sorted = 1 LineWidth = 1 SelDrawFocusRect= -1 'True ColumnSeparatorChar= 9 ColumnSearch = 2 ColumnWidthScale= 2 RowHeight = -1 MultiSelect = 0 WrapList = 0 'False WrapWidth = 0 SelMax = -1 AutoSearch = 2 SearchMethod = 0 VirtualMode = 0 'False VRowCount = 0 DataSync = 3 ThreeDInsideStyle= 1 ThreeDInsideHighlightColor= -2147483633 ThreeDInsideShadowColor= -2147483627 ThreeDInsideWidth= 1 ThreeDOutsideStyle= 1 ThreeDOutsideHighlightColor= -2147483628 ThreeDOutsideShadowColor= -2147483632 ThreeDOutsideWidth= 1 ThreeDFrameWidth= 0 BorderStyle = 0 BorderColor = -2147483642 BorderWidth = 1 ThreeDOnFocusInvert= 0 'False ThreeDFrameColor= -2147483633 Appearance = 2 BorderDropShadow= 0 BorderDropShadowColor= -2147483632 BorderDropShadowWidth= 3 ScrollHScale = 2 ScrollHInc = 0 ColsFrozen = 0 ScrollBarV = 1 NoIntegralHeight= 0 'False HighestPrecedence= 0 AllowColResize = 0 AllowColDragDrop= 0 ReadOnly = 0 'False VScrollSpecial = 0 'False VScrollSpecialType= 0 EnableKeyEvents = -1 'True EnableTopChangeEvent= -1 'True DataAutoHeadings= -1 'True DataAutoSizeCols= 2 SearchIgnoreCase= -1 'True ScrollBarH = 1 VirtualPageSize = 0 VirtualPagesAhead= 0 ExtendCol = 0 ColumnLevels = 1 ListGrayAreaColor= -2147483637 GroupHeaderHeight= -1 GroupHeaderShow = 0 'False AllowGrpResize = 0 AllowGrpDragDrop= 0 MergeAdjustView = 0 'False ColumnHeaderShow= -1 'True ColumnHeaderHeight= 300 GrpsFrozen = 0 BorderGrayAreaColor= -2147483637 ExtendRow = 0 DataField = "" OLEDragMode = 0 OLEDropMode = 0 EnableClickEvent= -1 'True Redraw = -1 'True ResizeRowToFont = 0 'False TextTipMultiLine= 0 ColDesigner = "frmAPMaster.frx":0000 End Begin Crystal.CrystalReport crAR Left = 9555 Top = 2625 _ExtentX = 741 _ExtentY = 741 _Version = 348160 WindowControlBox= -1 'True WindowMaxButton = -1 'True WindowMinButton = -1 'True WindowState = 2 PrintFileLinesPerPage= 60 End Begin VB.CommandButton cmdExit Caption = "E&xit" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 9300 TabIndex = 12 Top = 3225 Width = 1275 End Begin VB.CommandButton cmdSave Caption = "&Save" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 7275 TabIndex = 10 Top = 3225 Width = 1275 End Begin VB.TextBox txtName Height = 315 Left = 6120 MaxLength = 30 TabIndex = 1 Top = 1065 Width = 4395 End Begin VB.TextBox txtCity Height = 315 Left = 6120 MaxLength = 20 TabIndex = 6 Top = 2130 Width = 4395 End Begin VB.TextBox txtAddress2 Height = 315 Left = 6120 MaxLength = 30 TabIndex = 4 Top = 1785 Width = 4395 End Begin VB.TextBox txtCustNo Enabled = 0 'False Height = 315 Left = 6120 MaxLength = 7 TabIndex = 0 Top = 720 Width = 1200 End Begin VB.Label lblCNum Caption = "This Field Must Match CMS Vendor No" BeginProperty Font Name = "Arial" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FF0000& Height = 255 Left = 7320 TabIndex = 19 Top = 780 Width = 3225 End Begin VB.Label lblInstr Caption = "Fill out the information on this screen completely. Especially the Vendor No which must match CMS." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 630 Left = 5370 TabIndex = 18 Top = 60 Width = 5145 End Begin VB.Label lblZip Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "ZipCode: " Height = 195 Left = 5415 TabIndex = 17 Top = 2910 Width = 690 End Begin VB.Label blbState Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "State: " Height = 195 Left = 5640 TabIndex = 16 Top = 2535 Width = 465 End Begin VB.Label lblInvType Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Address1: " Height = 195 Left = 5355 TabIndex = 14 Top = 1545 Width = 750 End Begin VB.Label lblSalesCode Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "City: " Height = 195 Left = 5760 TabIndex = 11 Top = 2235 Width = 345 End Begin VB.Label lblItemAmt Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Vend Name:" Height = 195 Left = 5220 TabIndex = 9 Top = 1170 Width = 885 End Begin VB.Label lblDueDate Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Address2: " Height = 195 Left = 5355 TabIndex = 5 Top = 1890 Width = 750 End Begin VB.Label lblInvDate Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Vendor No: " Height = 195 Left = 5250 TabIndex = 3 Top = 840 Width = 855 End End Attribute VB_Name = "frmAPMaster" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim moRSHeader As Recordset Dim moRSProj As Recordset Dim mboolSHOW As Boolean, mboolUPDATE As Boolean, mstrType As String Dim mstrINVNO As String, mstrPROJLOT As String, mboolADD As Boolean Dim mlngINVID As Long, mintBOOKMARK As Integer, mintBOOK As Integer Dim msglItemAmt As Single, msglInvTotal As Single Private Sub HeaderLoad() Dim oRS As Recordset Dim strSQL As String, strVend As String, strAMOUNT As String Dim strLine As String On Error GoTo Error_EH strSQL = "SELECT * FROM tblAPMaster" Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly lstHeader.Clear Do Until oRS.EOF With lstHeader strLine = Field2Str2(oRS!Bill_ID) & vbTab & Field2Str(oRS!Cust_NO) & vbTab & Field2Str(oRS!Name) ' & vbTab ' strLine = strLine & Field2Str(oRS!Address1) & vbTab & Field2Str(oRS!Address2) & vbTab & Field2Str(oRS!InvoiceType) & vbTab ' strLine = strLine & Field2Str(oRS!InvoiceDate) & vbTab & Field2Str(oRS!JobNumber) & vbTab & Format(strAMOUNT, "Currency") ' & " " & Format(Field2Str2(oRS!Lot_id), "000000") .AddItem strLine End With oRS.MoveNext Loop oRS.Close If lstHeader.ListCount Then lstHeader.ListIndex = 0 Else lstHeader.ListIndex = -1 End If Exit Sub Error_EH: gstrMODULE = "Form APMaster - Module HeaderLoad" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub cmdAdd_Click() cmdSave.Enabled = True cmdExit.Enabled = True mboolADD = True txtCustNo.Enabled = True Call FormClear Call FormSave End Sub Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" KeyAscii = 0 End If End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If Shift = 4 Then Exit Sub End If If Not cmdSave.Enabled Then End If End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Dim intResponse As Integer, strMSG As String On Error GoTo Error_EH If cmdSave.Enabled Then strMSG = "Data Has Been Changed" strMSG = strMSG & Chr(13) & Chr(10) strMSG = strMSG & "Save Changes ?" intResponse = MsgBox(strMSG, vbQuestion + vbYesNoCancel, Me.Caption) Select Case intResponse Case vbYes Call FormSave Case vbNo Case vbCancel Cancel = True Exit Sub End Select End If If moRSHeader.State = adStateOpen Then moRSHeader.Close End If Exit Sub Error_EH: If Err.Number = 91 Then Resume Next End If gstrMODULE = "Form Repair - Module Form QueryUnload" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub cmdSave_Click() mintBOOK = lstHeader.ListIndex cmdExit.Enabled = True cmdSave.Enabled = False cmdAdd.Enabled = True txtCustNo.Enabled = False Call FormSave lstHeader.ListIndex = mintBOOK mintBOOKMARK = 0 End Sub Private Sub Form_Load() Call HeaderLoad mboolADD = False End Sub Private Sub FormShow() On Error GoTo Error_EH mboolSHOW = True With moRSHeader txtCustNo = Field2Str(!Cust_NO) txtNAME = Field2Str(!Name) txtAddress1 = Field2Str(!Address1) txtAddress2 = Field2Str(!Address2) txtCity = Field2Str(!City) txtSTATE = Field2Str(!State) txtZIP = Field2Str(!ZipCode) End With mboolSHOW = False Exit Sub Error_EH: gstrMODULE = "Form APMaster - Module FormShow" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub FormSave() Dim strName As String On Error GoTo Error_EH Call FieldsSave Exit Sub Error_EH: gstrMODULE = "Form APMaster - Module FormSave" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Function FormFind() As Boolean Dim strSQL As String, strID As String On Error GoTo Error_EH lstHeader.col = 0 strID = lstHeader.ColText strSQL = "SELECT * FROM tblAPMaster WHERE Bill_id = " & strID Set moRSHeader = New Recordset moRSHeader.Open strSQL, goConn, adOpenDynamic, adLockOptimistic If moRSHeader.EOF Then FormFind = False Call FormClear Else FormFind = True End If Exit Function Error_EH: gstrMODULE = "Form APMaster - Module FormFind" Call ErrorHandler2 gstrMODULE = "" Exit Function End Function Private Sub lstHeader_Click() If lstHeader.ListIndex <> -1 Then If FormFind() Then Call FormShow End If End If End Sub Private Sub FieldsSave() Dim strSQL As String Dim oRS As Recordset, sglTOTAL As Single On Error GoTo Error_EH With moRSHeader If mboolADD = True Then .AddNew mboolADD = False End If !Cust_NO = Field2Str(txtCustNo) !Name = Field2Str(txtNAME) !Address1 = Field2Str(txtAddress1) !Address2 = Field2Str(txtAddress2) !City = Field2Str(txtCity) !State = Field2Str(txtSTATE) !ZipCode = Field2Str(txtZIP) .Update End With Call HeaderLoad Exit Sub Error_EH: gstrMODULE = "Form APMaster - Module FieldsSave" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub Form_Activate() Dim intResponse As Integer Dim strSQL As String End Sub Private Sub FormClear() txtCustNo = "" txtNAME = "" txtAddress1 = "" txtAddress2 = "" txtCity = "" txtSTATE = "" txtZIP = "" End Sub Private Sub lstHeader_DblClick() cmdSave.Enabled = True txtNAME.SetFocus End Sub Private Sub txtAddress1_GotFocus() Call FieldSelect(txtAddress1) End Sub Private Sub txtAddress1_LostFocus() txtAddress1 = UCase(txtAddress1) End Sub Private Sub txtAddress2_GotFocus() Call FieldSelect(txtAddress2) End Sub Private Sub txtAddress2_LostFocus() txtAddress2 = UCase(txtAddress2) End Sub Private Sub txtCity_GotFocus() Call FieldSelect(txtCity) End Sub Private Sub txtCity_LostFocus() txtCity = UCase(txtCity) End Sub Private Sub txtCustNo_GotFocus() Call FieldSelect(txtCustNo) End Sub Private Sub txtCustNo_LostFocus() Dim lngPOS As Long txtCustNo = UCase(txtCustNo) End Sub Private Sub cmdPrint_Click() Dim oRS As Recordset, strSQL As String, strSELECT As String, strCUST As String On Error GoTo Error_EH gintCOPY = 1 strSQL = "SELECT * FROM ARN_InvHistoryHeader WHERE CustomerNumber = '" & strCUST & "'" Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly strSELECT = "{ARN_InvHistoryHeader.CustomerNumber}= '" & strCUST & "' and {ARN_InvHistoryHeader.JobNumber} = ''" crAR.ReportFileName = App.Path & "\arblanks.rpt" crAR.ReplaceSelectionFormula (strSELECT) crAR.CopiesToPrinter = 1 crAR.Destination = crptToWindow crAR.Action = 1 Exit Sub Error_EH: gstrMODULE = "Form APMaster - Module Print" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub txtNAME_GotFocus() Call FieldSelect(txtNAME) End Sub Private Sub txtNAME_LostFocus() txtNAME = UCase(txtNAME) End Sub Private Sub txtState_GotFocus() Call FieldSelect(txtSTATE) End Sub Private Sub txtState_LostFocus() txtSTATE = UCase(txtSTATE) End Sub Private Sub txtZip_GotFocus() Call FieldSelect(txtZIP) End Sub