VERSION 5.00 Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "Crystl32.OCX" Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx" Object = "{8DDE6232-1BB0-11D0-81C3-0080C7A2EF7D}#3.0#0"; "Flp32a30.ocx" Begin VB.Form frmPOWOLot Caption = "WorkOrders & PO For Billing" ClientHeight = 4845 ClientLeft = 60 ClientTop = 345 ClientWidth = 11850 KeyPreview = -1 'True LinkTopic = "Form1" ScaleHeight = 4845 ScaleWidth = 11850 StartUpPosition = 3 'Windows Default Begin VB.TextBox txtZIP Height = 315 Left = 4965 MaxLength = 5 TabIndex = 13 Top = 1755 Width = 930 End Begin VB.TextBox txtSTATE Height = 315 Left = 3690 MaxLength = 2 TabIndex = 12 Top = 1755 Width = 585 End Begin VB.CheckBox chkLOOK Caption = "LOOK" Height = 375 Left = 2400 TabIndex = 60 Top = 90 Visible = 0 'False Width = 825 End Begin VB.TextBox txtSC_DESC Height = 300 Left = 5025 TabIndex = 59 TabStop = 0 'False Top = 3240 Visible = 0 'False Width = 1050 End Begin VB.TextBox txtSalesCode Height = 315 Left = 3480 TabIndex = 14 Top = 3225 Width = 1485 End Begin LpLib.fpCombo cboSalesCode Height = 315 Left = 2220 TabIndex = 22 TabStop = 0 'False Top = 2925 Visible = 0 'False Width = 3945 _Version = 196608 _ExtentX = 6959 _ExtentY = 556 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 Text = "" Columns = 2 Sorted = 1 SelDrawFocusRect= -1 'True ColumnSeparatorChar= 9 ColumnSearch = 0 ColumnWidthScale= 2 RowHeight = -1 WrapList = 0 'False WrapWidth = 0 AutoSearch = 2 SearchMethod = 2 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 DataFieldList = "" ColumnEdit = -1 ColumnBound = -1 Style = 2 MaxDrop = 8 ListWidth = -1 EditHeight = -1 GrayAreaColor = -2147483633 ListLeftOffset = 0 ComboGap = -2 MaxEditLen = 150 VirtualPageSize = 0 VirtualPagesAhead= 0 ExtendCol = 0 ColumnLevels = 1 ListGrayAreaColor= -2147483637 GroupHeaderHeight= -1 GroupHeaderShow = 0 'False AllowGrpResize = 0 AllowGrpDragDrop= 0 MergeAdjustView = 0 'False ColumnHeaderShow= 0 'False ColumnHeaderHeight= -1 GrpsFrozen = 0 BorderGrayAreaColor= -2147483637 ExtendRow = 0 EnableClickEvent= -1 'True ListPosition = 0 ButtonThreeDAppearance= 0 OLEDragMode = 0 OLEDropMode = 0 Redraw = -1 'True AutoSearchFill = -1 'True AutoSearchFillDelay= 500 EditMarginLeft = 1 EditMarginTop = 1 EditMarginRight = 0 EditMarginBottom= 3 ResizeRowToFont = 0 'False TextTipMultiLine= 0 AutoMenu = -1 'True EditAlignH = 0 EditAlignV = 0 ColDesigner = "frmPOWOLot.frx":0000 End Begin Crystal.CrystalReport crREPAIR Left = 8550 Top = 165 _ExtentX = 741 _ExtentY = 741 _Version = 348160 PrintFileLinesPerPage= 60 End Begin VB.CommandButton cmdPrint Caption = "Invoice" 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 = 10590 TabIndex = 54 TabStop = 0 'False Top = 1260 Width = 1155 End Begin VB.TextBox txtJC Height = 315 Left = 3480 TabIndex = 15 Top = 3555 Width = 1485 End Begin VB.TextBox txtRepID Alignment = 2 'Center Appearance = 0 'Flat BackColor = &H80000000& BorderStyle = 0 'None Height = 270 Left = 1515 TabIndex = 52 TabStop = 0 'False Top = 105 Width = 780 End Begin VB.CheckBox chkADD Caption = "ADD" Height = 315 Left = 615 TabIndex = 51 Top = 120 Visible = 0 'False Width = 870 End Begin VB.TextBox txtCMSCust Height = 315 Left = 3480 TabIndex = 17 Top = 4200 Width = 1485 End Begin VB.TextBox txtInvNo Height = 315 Left = 3480 TabIndex = 16 Top = 3885 Width = 1485 End Begin VB.TextBox txtHOName Height = 315 Left = 3675 TabIndex = 9 Top = 825 Width = 3000 End Begin VB.TextBox txtTAX Height = 315 Left = 960 TabIndex = 8 Top = 4470 Width = 735 End Begin VB.CommandButton cmdProforma Caption = "Proforma Invoice" 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 = 9325 TabIndex = 45 TabStop = 0 'False Top = 1260 Width = 1155 End Begin MSComCtl2.DTPicker dtpRepair Height = 315 Left = 960 TabIndex = 0 Top = 840 Width = 1215 _ExtentX = 2143 _ExtentY = 556 _Version = 393216 DateIsNull = -1 'True Format = 96075777 CurrentDate = 43132 End Begin VB.CommandButton cmdExit Caption = "&Exit" 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 = 8060 TabIndex = 27 TabStop = 0 'False Top = 1260 Width = 1155 End Begin VB.CommandButton cmdSave Caption = "&Save" 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 = 6795 TabIndex = 26 TabStop = 0 'False Top = 1260 Width = 1155 End Begin VB.TextBox txtNotes Height = 1335 Left = 6165 MultiLine = -1 'True TabIndex = 21 Top = 3450 Width = 5595 End Begin VB.TextBox txtDesc Height = 1035 Left = 6165 MaxLength = 150 MultiLine = -1 'True TabIndex = 20 Top = 2415 Width = 5595 End Begin VB.TextBox txtBPhone Alignment = 1 'Right Justify Height = 315 Left = 960 MaxLength = 14 TabIndex = 2 Top = 2280 Width = 1215 End Begin VB.TextBox txtBCWho Height = 315 Left = 8265 MaxLength = 20 TabIndex = 19 Top = 2070 Width = 3495 End Begin VB.Frame frmRepair Caption = "Work Type" Height = 1125 Left = 9930 TabIndex = 30 Top = 105 Width = 1875 Begin VB.CheckBox chkBC Caption = "Back Charge:" Height = 255 Left = 225 TabIndex = 23 Top = 795 Width = 1400 End Begin VB.CheckBox chkWarrenty Caption = "Purchase Order" Height = 255 Left = 225 TabIndex = 24 Top = 540 Width = 1455 End Begin VB.CheckBox chkWO Caption = "WorkOrder:" Height = 255 Left = 225 TabIndex = 25 Top = 285 Width = 1400 End End Begin VB.TextBox txtVWPSuper Height = 315 Left = 8400 MaxLength = 14 TabIndex = 18 Top = 840 Width = 1215 End Begin VB.TextBox txtHAddress Height = 315 Left = 3675 MaxLength = 30 TabIndex = 10 Top = 1125 Width = 3000 End Begin VB.TextBox txtHName Height = 315 Left = 3675 MaxLength = 20 TabIndex = 11 Top = 1440 Width = 3000 End Begin VB.TextBox txtBillAmt Alignment = 1 'Right Justify Height = 315 Left = 960 MaxLength = 10 TabIndex = 7 Top = 4080 Width = 1215 End Begin VB.TextBox txtBillDate Alignment = 1 'Right Justify Height = 315 Left = 960 MaxLength = 10 TabIndex = 6 Top = 3720 Width = 1215 End Begin VB.CheckBox chkBilled Alignment = 1 'Right Justify Caption = "Billed:" Height = 195 Left = 420 TabIndex = 5 Top = 3420 Width = 1035 End Begin VB.TextBox txtBPOAmt Alignment = 1 'Right Justify Height = 315 Left = 960 MaxLength = 10 TabIndex = 4 Top = 3000 Width = 1215 End Begin VB.TextBox txtBPO Height = 315 Left = 960 MaxLength = 15 TabIndex = 3 Top = 2655 Width = 1215 End Begin VB.TextBox txtBContact Height = 315 Left = 960 MaxLength = 20 TabIndex = 1 Top = 1920 Width = 2175 End Begin VB.Label lblADD Caption = "ADD" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 1710 TabIndex = 63 Top = 390 Width = 540 End Begin VB.Label lblZIP Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "ZIP:" Height = 195 Left = 4635 TabIndex = 62 Top = 1815 Width = 300 End Begin VB.Label lblState Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "State:" Height = 195 Left = 3180 TabIndex = 61 Top = 1815 Width = 420 End Begin VB.Label lblSalesCode Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Sales Code:" Height = 195 Left = 2595 TabIndex = 58 Top = 3300 Width = 855 End Begin VB.Label lblLetters Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Max Characters - 120" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 4290 TabIndex = 57 Top = 2655 Width = 1830 End Begin VB.Label txtINV Height = 255 Left = 780 TabIndex = 56 Top = 1320 Visible = 0 'False Width = 825 End Begin VB.Label txtRepairID Height = 315 Left = 2445 TabIndex = 55 Top = 435 Visible = 0 'False Width = 525 End Begin VB.Label lblJC AutoSize = -1 'True Caption = "Job Cost:" Height = 195 Left = 2790 TabIndex = 53 Top = 3615 Width = 660 End Begin VB.Label lblBuilder Alignment = 2 'Center BorderStyle = 1 'Fixed Single Caption = " " Height = 315 Left = 2205 TabIndex = 50 Top = 4530 Width = 3345 End Begin VB.Label lblCMSCust Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "CMS Cust. #:" Height = 195 Left = 2460 TabIndex = 49 Top = 4260 Width = 945 End Begin VB.Label lblInvNo Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Inv. No: " Height = 195 Left = 2835 TabIndex = 48 Top = 3945 Width = 615 End Begin VB.Label lblHO Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "HomeOwner:" Height = 195 Left = 2670 TabIndex = 47 Top = 885 Width = 930 End Begin VB.Label lblTaxCode AutoSize = -1 'True Caption = "Tax Code: " Height = 195 Left = 75 TabIndex = 46 Top = 4530 Width = 780 End Begin VB.Label lblNotes Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Notes:" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = 5430 TabIndex = 44 Top = 3555 Width = 690 End Begin VB.Label lblDesc Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Description of Work:" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 4350 TabIndex = 43 Top = 2445 Width = 1770 End Begin VB.Label lblBPhone Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Telephone:" Height = 195 Left = 30 TabIndex = 42 Top = 2340 Width = 810 End Begin VB.Label lblBCWho Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Back Charge Whom:" Height = 195 Left = 6705 TabIndex = 41 Top = 2130 Width = 1485 End Begin VB.Label lblVWPSuper Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "VWP Superintendent:" Height = 195 Left = 6840 TabIndex = 40 Top = 960 Width = 1545 End Begin VB.Label lblHAddress Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Address:" Height = 195 Left = 2985 TabIndex = 39 Top = 1170 Width = 615 End Begin VB.Label lblHName Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "City:" Height = 195 Left = 3300 TabIndex = 38 Top = 1485 Width = 300 End Begin VB.Label lblBillDate Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Billed Date:" Height = 195 Left = 30 TabIndex = 37 Top = 3840 Width = 810 End Begin VB.Label lblBillAmt Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Billed Amt:" Height = 195 Left = 105 TabIndex = 36 Top = 4200 Width = 735 End Begin VB.Label lblHOInfo Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Lot Information:" Height = 195 Left = 3300 TabIndex = 35 Top = 600 Width = 1095 End Begin VB.Label lblBAmt Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Amount:" Height = 195 Left = 255 TabIndex = 34 Top = 3120 Width = 585 End Begin VB.Label lblBPO Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "P.O. #:" Height = 195 Left = 330 TabIndex = 33 Top = 2760 Width = 510 End Begin VB.Label lblBContact Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Contact:" Height = 195 Left = 240 TabIndex = 32 Top = 2040 Width = 600 End Begin VB.Label lblBuilderInfo AutoSize = -1 'True Caption = "Builder Information:" Height = 195 Left = 960 TabIndex = 31 Top = 1650 Width = 1350 End Begin VB.Label lblScheduled Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "PO Date:" Height = 195 Left = 270 TabIndex = 29 Top = 960 Width = 660 End Begin VB.Label lblProjectLot Alignment = 2 'Center BorderStyle = 1 'Fixed Single Height = 315 Left = 3300 TabIndex = 28 Top = 120 Width = 5055 End End Attribute VB_Name = "frmPOWOLot" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim moRSRepair As Recordset, moRSC As Recordset Dim moRS As Recordset, moRSProj As Recordset Dim moRSInvINFO As Recordset Dim mboolSHOW As Boolean, mboolAdding As Boolean, mboolEDIT As Boolean Dim mintREPAIRID As Integer, mlngINVID As Long, mboolNOSAVE As Boolean Dim mstrPROJLOT As String, mboolLOOK As Boolean Private Sub cboSalesCode_DblClick() cboSalesCode.col = 0 cboSalesCode.ColText = txtSalesCode cboSalesCode.col = 1 txtSC_DESC = cboSalesCode.ColText End Sub Private Sub chkBilled_LostFocus() If chkBilled = vbChecked Then ' cmdPrint.Enabled = False Else ' cmdPrint.Enabled = True End If End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdPrint_Click() On Error GoTo Error_EH Call FormSave Call InvPrint gboolPRINT = False Exit Sub Error_EH: gstrMODULE = gstrMODULE & " Form POWOLot - Module cmdPrint" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub cmdProforma_Click() On Error GoTo Error_EH Call FormSave Call ProformaPrint gboolPRINT = False Exit Sub Error_EH: gstrMODULE = gstrMODULE & " Form POWOLot - Module cmdProforma" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub ProformaPrint() Dim strSQL As String, mdblORDAMT As Double, strSELECT As String Dim oRS As Recordset, oRSS As Recordset Dim strPRICE As String, lngRepID As String Dim strYARD As String, intYN As Integer On Error GoTo Error_EH: strSELECT = "SELECT * FROM tblPOWO WHERE Repair_ID = " & txtRepairID Set oRS = New Recordset oRS.Open strSELECT, goConn, adOpenKeyset, adLockOptimistic oRS.Close If gintCOCODE = 0 Then crREPAIR.ReportFileName = App.Path & "\InvoicePRep.rpt" End If strSQL = "{tblPOWO.Repair_ID} = " & CLng(txtRepairID) crREPAIR.ReplaceSelectionFormula (strSQL) crREPAIR.CopiesToPrinter = 1 intYN = MsgBox("Do You Want To Print To A Printer?", vbYesNo, "Use Printer") If intYN = vbNo Then crREPAIR.Destination = crptToWindow Else crREPAIR.Destination = crptToPrinter End If crREPAIR.Action = 1 crREPAIR.Reset Exit Sub Error_EH: gstrMODULE = "Form POWOLot - Module ProformaPrint" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub InvPrintXXX() Dim strSQL As String, mdblORDAMT As Double, strSELECT As String Dim oRS As Recordset, oRSS As Recordset Dim strPRICE As String, lngRepID As String Dim strYARD As String On Error GoTo Error_EH: strSELECT = "SELECT * FROM tblPOWO WHERE Repair_ID = " & txtRepairID Set oRS = New Recordset oRS.Open strSELECT, goConn, adOpenKeyset, adLockOptimistic oRS.Close If gintCOCODE = 0 Then crREPAIR.ReportFileName = App.Path & "\InvoiceRep.rpt" End If strSQL = "{tblPOWO.Repair_ID} = " & CLng(txtRepairID) crREPAIR.ReplaceSelectionFormula (strSQL) crREPAIR.CopiesToPrinter = 1 crREPAIR.Destination = crptToWindow ' crREPAIR.Destination = crptToPrinter crREPAIR.Action = 1 crREPAIR.Reset Exit Sub Error_EH: gstrMODULE = "Form POWOLot - Module InvPrint" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub cmdSave_Click() Call FormSave Unload Me End Sub Private Function FormFindPO() As Boolean Dim strSQL As String On Error GoTo Error_EH strSQL = "SELECT * FROM tblPOWO WHERE REPAIR_Id = " & gintREPAIRID Set moRSRepair = New Recordset moRSRepair.Open strSQL, goConn, adOpenKeyset, adLockPessimistic If moRSRepair.EOF Then FormFindPO = False Else FormFindPO = True ' Call FormShowPO End If Exit Function Error_EH: gstrMODULE = "formPOWOLot - Module FormFindPO" Call ErrorHandler2 gstrMODULE = "" Exit Function End Function Private Sub FormShowPO() On Error GoTo Error_EH ' mboolSHOW = True With moRSRepair txtRepairID = Field2Str(!repair_id) txtHOName = Field2Str(!HOName) txtHAddress = Field2Str(!Owner_address) txtHName = Field2Str(!Owner_Name) txtVWPSuper = Field2Str(!VWP_Super) txtBCWho = Field2Str(!bc_who) txtDesc = Field2Str(!Desc) txtNotes = Field2Str(!notes) txtCMSCust = Field2Str(!Builder_NO) If Len(txtCMSCust) = 0 Then txtCMSCust = Field2Str(moRSProj!ar) End If lblBuilder = Field2Str(moRSC!Name) txtZIP = Field2Str2(!zip) txtSTATE = Field2Str(!State) ' cboSalesCode.col = 1 txtSalesCode = Field2Str(!sales_code) If Len(txtSalesCode) = 0 Then cboSalesCode.Enabled = True Else cboSalesCode.Enabled = False End If cboSalesCode.ColumnSearch = 0 cboSalesCode.SearchText = txtSalesCode cboSalesCode.Action = ActionSearch If Len(txtCMSCust) <> 0 Then lblBuilder = Field2Str(moRSC!Name) End If txtSC_DESC = Field2Str(!SC_Description) txtInvNo = Field2Str(!invoice_no) txtTAX = Field2Str(!tax_code) If IsNull(txtTAX) Or txtTAX = "" Then txtTAX = Field2Str(moRSProj!taxcode) End If txtBillAmt = Format(Field2Str(!bill_amt), "#,#.00") txtBillDate = Field2Str2(!bill_date) txtBPOAmt = Format(Field2Str(!PO_Amt), "#,#.00") txtBPO = Field2Str(!builder_PO) txtBPhone = Field2Str(!builder_phone) txtBContact = Field2Str(!builder_contact) dtpRepair = Field2Str(!scheduled) chkWO = Field2CheckBox(!wo) chkBilled = Field2CheckBox(!billed) If chkBilled = vbChecked Then chkBilled.Enabled = False cmdPrint.Enabled = False Else chkBilled.Enabled = True cmdPrint.Enabled = True End If chkWarrenty = Field2CheckBox(!repair) If Len(!job_number) > 0 Then txtJC = Field2Str(!job_number) Else txtJC = Field2Str(moRS!jobcost) End If chkBC = Field2CheckBox(!backcharge) End With Exit Sub Error_EH: gstrMODULE = "Form POWOInfo - Module FormShowPO" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub Form_Activate() Dim strTEST As String, intYN As Integer ' Call CrewLoad dtpRepair.Value = Date Call GetLotInfo ' If moRSRepair!Save_Accpt Then '***** Still need to complete this logic ' mboolNOSAVE = True ' End If If chkADD = vbChecked Then mboolAdding = True lblADD.Visible = True txtCMSCust = Field2Str(moRSProj!ar) lblBuilder = Field2Str(moRSC!Name) ' Call GetLotInfo Else mboolAdding = False lblADD.Visible = False If FormFindPO() Then Call FormShowPO End If End If ' Call GetLotInfo txtRepID = gintREPAIRID If chkLOOK = vbChecked Then mboolLOOK = True End If If mboolLOOK Or chkBilled = vbChecked Then cmdSave.Enabled = False cmdPrint.Enabled = False cmdProforma.Enabled = False chkWO.Enabled = False chkWarrenty.Enabled = False chkBC.Enabled = False txtVWPSuper.Enabled = False txtDesc.Enabled = False txtNotes.Enabled = False txtCMSCust.Enabled = False txtInvNo.Enabled = False txtJC.Enabled = False cboSalesCode.Enabled = False txtSalesCode.Enabled = False txtBCWho.Enabled = False txtHName.Enabled = False txtHAddress.Enabled = False txtHOName.Enabled = False txtTAX.Enabled = False txtZIP.Enabled = False txtSTATE.Enabled = False txtBillAmt.Enabled = False txtBillDate.Enabled = False chkBilled.Enabled = False txtBPOAmt.Enabled = False txtBPO.Enabled = False dtpRepair.Enabled = False txtBContact.Enabled = False txtBPhone.Enabled = False Else cmdSave.Enabled = True ' If Not chkBilled = vbChecked Then ' cmdPrint.Enabled = True ' Else ' cmdPrint.Enabled = False ' End If cmdPrint.Enabled = True cmdProforma.Enabled = True chkWO.Enabled = True chkWarrenty.Enabled = True chkBC.Enabled = True txtVWPSuper.Enabled = True txtDesc.Enabled = True txtNotes.Enabled = True txtCMSCust.Enabled = True txtInvNo.Enabled = True txtJC.Enabled = True cboSalesCode.Enabled = True txtSalesCode.Enabled = True txtBCWho.Enabled = True txtHName.Enabled = True txtHAddress.Enabled = True txtHOName.Enabled = True txtTAX.Enabled = True txtBillAmt.Enabled = True txtBillDate.Enabled = True ' If Not chkBilled = vbChecked Then ' chkBilled.Enabled = True ' Else ' chkBilled.Enabled = False ' End If chkBilled.Enabled = True txtBPOAmt.Enabled = True txtBPO.Enabled = True dtpRepair.Enabled = True txtBContact.Enabled = True txtBPhone.Enabled = True End If End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Dim ShiftDown, AltDown, CtrlDown Dim oRSSS As Recordset, strSQL As String If Shift = 4 Then Exit Sub End If ShiftDown = (Shift And vbShiftMask) > 0 AltDown = (Shift And vbAltMask) > 0 CtrlDown = (Shift And vbCtrlMask) > 0 If KeyCode = vbKeyB And gbytSECURITY < 3 Then ' Allow Print of Stone If CtrlDown Then strSQL = "SELECT * FROM tblPOWO WHERE Repair_ID = " & CInt(txtRepID) Set oRSSS = New Recordset oRSSS.Open strSQL, goConn, adOpenKeyset, adLockOptimistic cmdPrint.Enabled = True oRSSS!billed = vbUnchecked chkBilled = vbUnchecked chkBilled.Enabled = True oRSSS.Update Exit Sub End If End If End Sub Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" KeyAscii = 0 End If End Sub Private Sub Form_Load() Dim strTEST As String ', mboolLOOK As Boolean On Error GoTo Error_EH txtRepID = 0 mboolLOOK = False Call FormClear Call SCLoad Exit Sub Error_EH: gstrMODULE = "Form POWOLot - Module Form_Load" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub FieldsSave() Dim strLOT As String On Error GoTo Error_EH If mboolAdding Then moRSRepair.AddNew End If If moRSRepair.EOF Then End If With moRSRepair !scheduled = dtpRepair.Value !builder_contact = Str2Field(txtBContact) !builder_phone = Str2Field(txtBPhone) !builder_PO = Str2Field(txtBPO) !PO_Amt = Str2Field(txtBPOAmt) !bill_date = Date2Field(txtBillDate) ' !bill_date = Str2Field(txtBillDate) !bill_amt = Str2Field(txtBillAmt) !zip = Field2Str2(txtZIP) !State = Field2Str(txtSTATE) !Owner_Name = Str2Field(txtHName) !Owner_address = Str2Field(txtHAddress) !VWP_Super = Str2Field(txtVWPSuper) !bc_who = Str2Field(txtBCWho) !Desc = Str2Field(txtDesc) !notes = Str2Field(txtNotes) !billed = Field2CheckBox(chkBilled) !wo = Field2CheckBox(chkWO) !repair = Field2CheckBox(chkWarrenty) !backcharge = Field2CheckBox(chkBC) !job_number = Field2Str(txtJC) !UpdateUser = gstrLOGIN !Updated = Date !proj_lot = lblProjectLot.Caption !createuser = gstrLOGIN !PROJ_ID = gintPROJID !Lot_ID = gintLOTID !project = Field2Str(moRSProj!Proj_Desc) !lot_no = moRS!lot_no !projcode = Field2Str(moRSProj!Proj_Code) !CodeDesc = Field2Str(moRSProj!Proj_Code) & " " & Field2Str(moRSProj!Proj_Desc) !sales_code = txtSalesCode !SC_Description = txtSC_DESC If Len(txtSalesCode) > 0 Then !qty = 1 Else !qty = 0 End If !Builder_NO = Field2Str(txtCMSCust) If Len(txtInvNo) = 0 Then !invoice_no = Trim(txtINV) & Trim(Field2Str(moRS!lot_no)) Else !invoice_no = Field2Str(txtInvNo) End If !tax_code = Str2Field(txtTAX) If Not moRSC.EOF Then !c_add1 = Field2Str(moRSC!Name) !c_add2 = Field2Str(moRSC!Address1) If Field2Str(moRSC!Address2) = "" Then !c_add3 = Trim(Field2Str(moRSC!City)) & ", " & Field2Str(moRSC!State) & " " & Field2Str(moRSC!ZipCode) Else !c_add3 = Field2Str(moRSC!Address2) End If If Field2Str(moRSC!Address2) = "" Then !c_add4 = "" Else !c_add4 = Trim(Field2Str(moRSC!City)) & ", " & Field2Str(moRSC!State) & " " & Field2Str(moRSC!ZipCode) End If Else !c_add1 = "" !c_add2 = "" !c_add3 = "" !c_add4 = "" End If !HOName = Field2Str(txtHOName) End With moRSRepair.Update If mboolAdding Then Call GetRepID End If Exit Sub Error_EH: If Err.Number = -2147467259 Then Resume Next End If gstrMODULE = "Form RepairLot - Module FieldsSave" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub FormClear() txtBContact = "" txtBPhone = "" txtBPO = "" txtBPOAmt = 0 txtBillDate = "00/00/0000" txtBillAmt = 0 txtHName = "" txtZIP = "" txtSTATE = "" txtHAddress = "" txtVWPSuper = "" txtBCWho = "" txtDesc = "" txtNotes = "" ' cboDArea.ListIndex = -1 chkBilled = vbUnchecked chkWO = vbUnchecked chkWarrenty = vbUnchecked chkBC = vbUnchecked ' cboRCrew.ListIndex = -1 lblProjectLot = "" End Sub Private Sub FormSave() On Error GoTo Error_EH ' Store the controls to the recordset Call FieldsSave Exit Sub Error_EH: Call ErrorHandler(moRSRepair.ActiveConnection) Exit Sub End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) On Error GoTo Error_EH If moRSRepair.State = adStateOpen Then moRSRepair.Close End If frmWOList.chkQUIT = vbChecked Exit Sub Error_EH: If Err = 3219 Then Resume Next End If End Sub Private Sub txtBContact_GotFocus() Call FieldSelect(txtBContact) End Sub Private Sub txtBContact_LostFocus() txtBContact = UCase(txtBContact) End Sub Private Sub txtBCWho_GotFocus() Call FieldSelect(txtBCWho) End Sub Private Sub txtBCWho_LostFocus() txtBCWho = UCase(txtBCWho) End Sub Private Sub txtBillAmt_GotFocus() Call FieldSelect(txtBillAmt) End Sub Private Sub txtBillAmt_LostFocus() txtBillAmt = Format(txtBillAmt, "#,#.00") End Sub Private Sub txtBillDate_GotFocus() Call FieldSelect(txtBillDate) End Sub Private Sub txtBillDate_LostFocus() Dim lngPOS As Long lngPOS = InStr(1, txtBillDate, "/", 1) If lngPOS = 0 Then If Len(txtBillDate) > 0 Then txtBillDate = Format(txtBillDate, "00/00/####") If Not IsDate(txtBillDate) Then MsgBox "The Date You Entered is not Valid - ReEnter" txtBillDate.SetFocus ElseIf CDate(txtBillDate) < (Date - 90) Then MsgBox "The Date Cannot Be Earlier Than 90 Days Before Today - ReEnter" txtBillDate.SetFocus ElseIf CDate(txtBillDate) > (Date + 366) Then MsgBox "The Date Cannot Be More Than 1 Year From Today - ReEnter" txtBillDate.SetFocus End If End If Else MsgBox "Invalid Date Format, Enter as 12312009", , "Invalid Date - ReEnter" txtBillDate.SetFocus End If End Sub Private Sub txtBPhone_GotFocus() Call FieldSelect(txtBPhone) End Sub Private Sub txtBPO_GotFocus() Call FieldSelect(txtBPO) End Sub Private Sub txtBPO_LostFocus() txtBPO = UCase(txtBPO) End Sub Private Sub txtBPOAmt_GotFocus() Call FieldSelect(txtBPOAmt) End Sub Private Sub txtBPOAmt_LostFocus() txtBPOAmt = Format(txtBPOAmt, "#,#.00") End Sub Private Sub txtCMSCust_GotFocus() Call FieldSelect(txtCMSCust) End Sub Private Sub txtCMSCust_LostFocus() txtCMSCust = UCase(txtCMSCust) lblBuilder = Field2Str(moRSC!Name) End Sub Private Sub txtDesc_GotFocus() ' cboSalesCode.col = 1 If mboolAdding Then txtDesc = "REPAIR - " & txtDesc End If txtDesc.SelStart = 120 ' If Len(txtDesc) = 0 And Len(cboSalesCode.ColText) > 0 Then ' txtDesc = cboSalesCode.ColText ' End If ' Call FieldSelect(txtDesc) End Sub Private Sub txtDesc_LostFocus() txtDesc = UCase(txtDesc) ' If mboolAdding Then ' txtDesc = "REPAIR - " & txtDesc ' End If If Len(txtDesc) > 120 Then MsgBox "The Text In This Box Is Too Long. Move Anything Over 120 Characters To Notes", vbOKOnly, "Over 30 Characters" Exit Sub End If End Sub Private Sub txtHAddress_GotFocus() Call FieldSelect(txtHAddress) End Sub Private Sub txtHAddress_LostFocus() txtHAddress = UCase(txtHAddress) End Sub Private Sub txtHName_GotFocus() Call FieldSelect(txtHName) End Sub Private Sub txtHName_LostFocus() txtHName = UCase(txtHName) End Sub Private Sub txtHOName_GotFocus() Call FieldSelect(txtHOName) End Sub Private Sub txtHOName_LostFocus() txtHOName = UCase(txtHOName) End Sub Private Sub txtInvNo_GotFocus() If Len(txtInvNo) = 0 Then txtInvNo = Trim(txtINV) & Trim(Field2Str(moRS!lot_no)) End If Call FieldSelect(txtInvNo) End Sub Private Sub txtInvNo_LostFocus() txtInvNo = UCase(txtInvNo) End Sub Private Sub txtNotes_GotFocus() ' txtNotes.MaxLength = Len(txtNotes) ' Call FieldSelect(txtNotes) End Sub Private Sub txtNotes_LostFocus() txtNotes = UCase(txtNotes) End Sub Private Sub txtSalesCode_GotFocus() Call FieldSelect(txtSalesCode) End Sub Private Sub txtSalesCode_LostFocus() txtSalesCode = UCase(txtSalesCode) ' Call cboSalesCode_DblClick ' txtSC_DESC = CBFindString(cboSalesCode, txtSalesCode) End Sub Private Sub txtState_GotFocus() Call FieldSelect(txtSTATE) End Sub Private Sub txtState_LostFocus() txtSTATE = UCase(txtSTATE) End Sub Private Sub txtTax_GotFocus() Call FieldSelect(txtTAX) End Sub Private Sub txtTax_LostFocus() If IsNull(txtTAX) Or txtTAX = "" Then txtTAX = Field2Str(moRSProj!taxcode) End If txtTAX = UCase(txtTAX) End Sub Private Sub txtVWPSuper_GotFocus() Call FieldSelect(txtVWPSuper) End Sub Private Sub txtVWPSuper_LostFocus() txtVWPSuper = UCase(txtVWPSuper) End Sub Private Sub GetRepID() Dim oRSMAX As Recordset Dim strSQL As String On Error GoTo Error_EH strSQL = "SELECT Max(Repair_ID) as MAXRepID from tblPOWO" Set oRSMAX = New Recordset oRSMAX.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly txtRepID = oRSMAX!MAXRepID oRSMAX.Close Exit Sub Error_EH: gstrMODULE = "Form POWOLot - Module GetRepID" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub GetLotInfo() Dim strSQL As String, strSELECT As String, strREPAIR As String, strSQL4 As String If chkADD = vbChecked Then strREPAIR = "SELECT * FROM tblPOWO WHERE Repair_id = 1" Set moRSRepair = New Recordset moRSRepair.Open strREPAIR, goConn, adOpenKeyset, adLockOptimistic End If ' If moRSRepair.EOF Then ' End If strSQL = "SELECT * FROM tblLotInfo WHERE lot_id = " & gintLOTID Set moRS = New Recordset moRS.Open strSQL, goConn, adOpenForwardOnly, adLockOptimistic If Not moRS.EOF Then strSELECT = "SELECT * FROM tblProject WHERE proj_id = " & Field2Long(moRS!PROJ_ID) Set moRSProj = New Recordset moRSProj.Open strSELECT, goConn, adOpenForwardOnly, adLockOptimistic If moRSProj!cocode = 0 Then strSQL4 = "SELECT * FROM tblARMaster where Cust_no = '" & Field2Str(moRSProj!ar) & "'" ElseIf moRSProj!cocode = 1 Then strSQL4 = "SELECT * FROM tblARMasterM where Cust_no = '" & Field2Str(moRSProj!ar) & "'" End If Set moRSC = New Recordset moRSC.Open strSQL4, goConn, adOpenForwardOnly, adLockReadOnly End If mstrPROJLOT = Trim(Field2Str(moRSProj!Proj_Desc)) & " - " & Trim(Field2Str(moRS!lot_no)) lblProjectLot = mstrPROJLOT txtHName = Field2Str(moRS!Owner) txtHAddress = Field2Str(moRS!address) txtINV = moRSProj!inv If chkADD = vbChecked Then txtJC = Field2Str(moRS!jobcost) End If End Sub Private Sub InvPrint() Dim oRS As Recordset, oRSS As Recordset, oRSO As Recordset, oRSP As Recordset, oRSC As Recordset, oRSPO As Recordset Dim strSQL As String, strSELECT As String, strSql2 As String, strSQL4 As String Dim strSQLE As String, oRSE As Recordset Dim strSQL1 As String, strSQL3 As String, intDay As Integer Dim intYear As Integer, intMonth As Integer, strDate As String Dim dblINVTOTAL As Double, dblRETENTION As Double Dim strADD3 As String, strADD4 As String, strSQLINFO As String Dim intCMonth As Integer, intCDay As Integer, strCDate As String, intCYear As Integer Dim strTEST2 As String, strMSG As String, strLEN As String Dim dblBillAmt As Double, dblWAmt As Double, intYN As Integer On Error GoTo Error_EH strSQL = "SELECT * FROM tblARINVOICE where Trans_ID = 1" Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenKeyset, adLockPessimistic strSELECT = "SELECT * FROM tblPOWO WHERE Repair_ID = " & Field2Str2(txtRepID) Set oRSPO = New Recordset oRSPO.Open strSELECT, goConn, adOpenKeyset, adLockOptimistic dblBillAmt = 0 dblINVTOTAL = 0 dblRETENTION = 0 strSQLINFO = "SELECT * FROM tblTABLE_INFO" Set moRSInvINFO = New Recordset moRSInvINFO.Open strSQLINFO, goConn, adOpenDynamic, adLockPessimistic mlngINVID = moRSInvINFO!ARINVOICE_TRANS_ID With oRS .AddNew !Trans_ID = mlngINVID !Lot_ID = gintLOTID !PROJ_ID = gintPROJID !project = Field2Str(oRSPO!project) !lot_no = Field2Str(oRSPO!lot_no) !address = Field2Str(oRSPO!Owner_address) !inv_type = "R" !customer_no = Field2Str(oRSPO!Builder_NO) !ship_date = Field2Str(oRSPO!bill_date) !projcode = Field2Str(oRSPO!projcode) !CodeDesc = Field2Str(oRSPO!projcode) & "-" & Trim(Field2Str(moRSProj!Proj_Desc)) !ProjLot = Trim(Field2Str(moRSProj!Proj_Desc)) & " LOT " & Field2Str(moRS!lot_no) !invoice_no = oRSPO!invoice_no !zip = Field2Str2(oRSPO!zip) !State = Field2Str(oRSPO!State) !City = Field2Str(oRSPO!Owner_Name) !invoice_date = Field2Str(oRSPO!bill_date) !job_number = Field2Str(oRSPO!job_number) !inv_due_date = DateAdd("d", 33, oRSPO!bill_date) !disc_due_date = DateAdd("d", 3, oRSPO!bill_date) !sales_code = Field2Str(oRSPO!sales_code) If IsNull(moRSProj!taxcode) Or moRSProj!taxcode = "" Then !taxcode = "AZ" Else !taxcode = Field2Str(oRSPO!tax_code) End If !Description = Field2Str(oRSPO!Desc) !price = Field2Str2(oRSPO!bill_amt) !amount = Field2Str2(oRSPO!bill_amt) !header = vbChecked !c_add1 = Field2Str(oRSPO!c_add1) !c_add2 = Field2Str(oRSPO!c_add2) !c_add3 = Field2Str(oRSPO!c_add3) !c_add4 = Field2Str(oRSPO!c_add4) !po_num = Field2Str(oRSPO!builder_PO) oRS!non_tax_amt = Field2Str2(oRSPO!bill_amt) oRS!retention_amt = 0 .Update gstrMODULE = "Before mlngINVID update" mlngINVID = mlngINVID + 1 strSQLINFO = "SELECT * FROM tblTABLE_INFO" Set moRSInvINFO = New Recordset moRSInvINFO.Open strSQLINFO, goConn, adOpenDynamic, adLockPessimistic moRSInvINFO!ARINVOICE_TRANS_ID = mlngINVID moRSInvINFO.Update End With strSELECT = "SELECT * FROM tblPOWO WHERE Repair_ID = " & txtRepID Set oRS = New Recordset oRS.Open strSELECT, goConn, adOpenKeyset, adLockOptimistic If gintCOCODE = 0 Then crREPAIR.ReportFileName = App.Path & "\InvoiceRep.rpt" End If strSQL = "{tblPOWO.Repair_ID} = " & Field2Integer(txtRepID) ' strSQL = "{tblPOWO.Repair_ID} = " & CLng(txtRepID) crREPAIR.ReplaceSelectionFormula (strSQL) crREPAIR.CopiesToPrinter = 1 intYN = MsgBox("Do You Want To Print To A Printer?", vbYesNo, "Use Printer") If intYN = vbNo Then crREPAIR.Destination = crptToWindow Else crREPAIR.Destination = crptToPrinter End If crREPAIR.Action = 1 crREPAIR.Reset cmdPrint.Enabled = False chkBilled = vbChecked cboSalesCode.Enabled = False chkBilled.Enabled = False oRSPO!billed = Field2CheckBox(chkBilled) ' If moRSProj!cocode = 0 Then oRSPO.Update Exit Sub Error_EH: gstrMODULE = "Form LotInfo - Module InvPrint" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub SCLoad() Dim oRS As Recordset Dim strSQL As String, intRows As Integer, strLine As String Dim row, col As Long On Error GoTo Error_EH cboSalesCode.Clear strSQL = "SELECT * FROM tblCBOSalesCode" ' strSQL = "SELECT Bill_Id, Cust_no, Name FROM tblARMaster" Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly Do Until oRS.EOF strLine = Field2Str(oRS!SalesCode) & vbTab & Field2Str(oRS!SC_DESC) ' & vbTab & Field2Str(oRS!Name) & vbTab & Field2Str(oRS!Name) & vbTab & Field2Str(oRS!Name) ' strLine = Field2Str2(oRS!SC_ID) & vbTab & Field2Str(oRS!SalesCode) & vbTab & Field2Str(oRS!SC_DESC) ' & vbTab & Field2Str(oRS!Name) & vbTab & Field2Str(oRS!Name) & vbTab & Field2Str(oRS!Name) cboSalesCode.AddItem strLine ' cboARCode.ItemData(cboARCode.NewIndex) = Field2Long(oRS!bill_id) oRS.MoveNext Loop oRS.Close ' cboAPCode.ListIndex = 0 ' cboSalesCode.ListIndex = -1 Exit Sub Error_EH: gstrMODULE = "Form POWOLot - Module SCLoad" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub txtZip_GotFocus() Call FieldSelect(txtZIP) End Sub