Files
claudetools/clients/valleywide/app-modernization/source-code/Full-Project/VWP_Inv/frmMANBILL.frm
Mike Swanson 5359e7c49e feat(valleywide): recover VWP Orders VB6 source from D: backup drive
Recovered Darv's VB6 source for the Valley Wide Plastering Orders
application from the D: backup drive (label "Backup", 8 TB, 5.3 TB used).
This is the first time we've had the actual source — prior session only
had a single frmPayroll.frm from the AD server.

Three project variants identified across two snapshots:
- Full-Project/   (2,129 files, 124 MB) — D:\Office-Estimates\Darv\Full\Project\
- Kingston-Project/ (2,189 files, 130 MB) — D:\Office-Estimates\Darv\Kingston\Project\
- Source/         (170 files, 559 MB)   — D:\Office-Estimates\Darv\Source\ wholesale
- SOURCE-HOLD/    (3 files, 1 MB)       — D:\Office-Estimates\Darv\SOURCE HOLD\

Latest ORDERS_C.vbp date is 2020-06-09 (Kingston snapshot). Production
Orders_10A.exe was live as of April 2024 — open question whether newer
source exists on other backup drives Mike will scan next.

Also includes per-category and per-keyword analysis CSVs from a WizTree
file-list export, plus the analyzer script that produced them
(re-runnable for the next drive's CSV).

VMs (VWIN7-DW.vdi 8.3 GB + XP-for-ORDERS_copy.vdi 2.8 GB), the live
VWP.mdb, and the 393 MB raw WizTree CSV stay on disk only — gitignored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 17:36:27 -07:00

1112 lines
34 KiB
Plaintext

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 frmMANBILL
Caption = "Manual Billing"
ClientHeight = 7020
ClientLeft = 60
ClientTop = 345
ClientWidth = 10740
KeyPreview = -1 'True
LinkTopic = "Form1"
ScaleHeight = 7020
ScaleWidth = 10740
StartUpPosition = 3 'Windows Default
Begin LpLib.fpCombo cboARCode
Height = 315
Left = 6030
TabIndex = 19
Top = 345
Width = 4710
_Version = 196608
_ExtentX = 8308
_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 = 5
Sorted = 0
SelDrawFocusRect= -1 'True
ColumnSeparatorChar= 9
ColumnSearch = -1
ColumnWidthScale= 2
RowHeight = -1
WrapList = 0 'False
WrapWidth = 0
AutoSearch = 1
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
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 = 0 'False
AutoSearchFillDelay= 500
EditMarginLeft = 1
EditMarginTop = 1
EditMarginRight = 0
EditMarginBottom= 3
ResizeRowToFont = 0 'False
TextTipMultiLine= 0
AutoMenu = -1 'True
EditAlignH = 0
EditAlignV = 0
ColDesigner = "frmMANBILL.frx":0000
End
Begin LpLib.fpList lstHeader
Height = 3000
Left = 90
TabIndex = 15
Top = 2685
Width = 4470
_Version = 196608
_ExtentX = 7885
_ExtentY = 5292
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 = 5
Sorted = 1
LineWidth = 1
SelDrawFocusRect= -1 'True
ColumnSeparatorChar= 9
ColumnSearch = -1
ColumnWidthScale= 2
RowHeight = -1
MultiSelect = 0
WrapList = 0 'False
WrapWidth = 0
SelMax = -1
AutoSearch = 1
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= -1
GrpsFrozen = 0
BorderGrayAreaColor= -2147483637
ExtendRow = 0
DataField = ""
OLEDragMode = 0
OLEDropMode = 0
EnableClickEvent= -1 'True
Redraw = -1 'True
ResizeRowToFont = 0 'False
TextTipMultiLine= 0
ColDesigner = "frmMANBILL.frx":03FB
End
Begin VB.TextBox txtTax
Height = 315
Left = 5490
TabIndex = 14
Top = 5100
Width = 495
End
Begin Crystal.CrystalReport crAR
Left = 4650
Top = 5250
_ExtentX = 741
_ExtentY = 741
_Version = 348160
WindowControlBox= -1 'True
WindowMaxButton = -1 'True
WindowMinButton = -1 'True
WindowState = 2
PrintFileLinesPerPage= 60
End
Begin VB.CommandButton cmdPrint
Caption = "RePrint Invoice"
Enabled = 0 'False
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6090
TabIndex = 12
Top = 5775
Width = 1275
End
Begin VB.CommandButton cmdExit
Caption = "E&xit"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6135
TabIndex = 11
Top = 6510
Width = 1275
End
Begin VB.CommandButton cmdSave
Caption = "&Save"
Enabled = 0 'False
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6090
TabIndex = 10
Top = 5055
Width = 1275
End
Begin VB.CheckBox chkReady
Alignment = 1 'Right Justify
Caption = "Ready to Transfer to CMS:"
Height = 255
Left = 5100
TabIndex = 5
Top = 4365
Width = 2205
End
Begin VB.TextBox txtItemAmt
Alignment = 1 'Right Justify
Height = 315
Left = 6150
MaxLength = 10
TabIndex = 4
Top = 4035
Width = 1200
End
Begin VB.TextBox txtSalesCode
Height = 315
Left = 6150
MaxLength = 7
TabIndex = 3
Top = 3615
Width = 1200
End
Begin VB.TextBox txtDueDate
Alignment = 1 'Right Justify
Height = 315
Left = 6150
MaxLength = 10
TabIndex = 2
Top = 3195
Width = 1200
End
Begin VB.TextBox txtInvDate
Alignment = 1 'Right Justify
Height = 315
Left = 6150
MaxLength = 10
TabIndex = 1
Top = 2775
Width = 1200
End
Begin VB.ListBox lstDetail
Height = 1230
Left = 90
TabIndex = 0
Top = 5760
Width = 5895
End
Begin VB.Label lblDone
AutoSize = -1 'True
Caption = "Already Transfered To CMS"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 285
Left = 4620
TabIndex = 18
Top = 4665
Visible = 0 'False
Width = 3135
End
Begin VB.Label lblProjLotDesc
BorderStyle = 1 'Fixed Single
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 = 1245
TabIndex = 17
Top = 45
Width = 9450
End
Begin VB.Label lblProjLot
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Project - Lot"
Height = 195
Left = 195
TabIndex = 16
Top = 75
Width = 855
End
Begin VB.Label lblTax
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Tax Code"
Height = 195
Left = 4740
TabIndex = 13
Top = 5190
Width = 690
End
Begin VB.Label lblSalesCode
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "CMS Sales Code:"
Height = 195
Left = 4830
TabIndex = 9
Top = 3720
Width = 1245
End
Begin VB.Label lblItemAmt
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Item Amount:"
Height = 195
Left = 5145
TabIndex = 8
Top = 4140
Width = 930
End
Begin VB.Label lblDueDate
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Payment Due Date:"
Height = 195
Left = 4680
TabIndex = 7
Top = 3300
Width = 1395
End
Begin VB.Label lblInvDate
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Invoice Date:"
Height = 195
Left = 5100
TabIndex = 6
Top = 2880
Width = 960
End
End
Attribute VB_Name = "frmMANBILL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim moRSDetail As Recordset
Dim moRSProj As Recordset, moRS As Recordset
Dim mstrARCode As String
Dim mboolSHOW As Boolean, mboolUPDATE As Boolean, mstrType As String
Dim mstrINVNO As String, mstrPROJLOT As String
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
'Dim strTYPE As String
Dim strLine As String
On Error GoTo Error_EH
' strTYPE = Trim(Left(cboARCode, 7))
' strSQL = "SELECT Invoice_date, Invoice_no, lot_id, trans_id, header, shipped, customer_no, non_tax_amt from tblARInvoice WHERE shipped and header and customer_no = '" & Trim(Left(cboARCode, 7)) & "' and not done"
' strSQL = "SELECT Invoice_date, Invoice_no, lot_id, trans_id, header, shipped, customer_no, non_tax_amt FROM tblARInvoice WHERE shipped and header and customer_no = '" & Trim(Left(cboARCode, 7)) & "' and not done"
' strSQL = "SELECT * FROM tblARInvoice WHERE shipped and header and customer_no = '" & Trim(Left(cboARCode, 7)) & "' and not done"
strSQL = "SELECT * FROM tblARInvoice WHERE shipped and header and Lot_ID = " & gintLOTID '& "'" ' and not done"
Set oRS = New Recordset
oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly
lstHeader.Clear
' strTYPE = oRS.RecordCount
Do Until oRS.EOF
With lstHeader
strLine = ""
strLine = Field2Str2(oRS!Lot_id) & vbTab & Field2Str(oRS!invoice_no) & vbTab & Field2Str(oRS!invoice_date) & vbTab
strLine = strLine & Format(Field2Str2(oRS!non_tax_amt), "Currency") & vbTab & Format(Field2Str2(oRS!Lot_id), "000000")
' strLine = ""
' strLine = Field2Str(oRS!invoice_no) & " " & Field2Str(oRS!invoice_date) & vbTab
' strLine = strLine & Format(Field2Str2(oRS!non_tax_amt), "Currency") & " " & Format(Field2Str2(oRS!Lot_id), "000000")
.AddItem strLine
' .AddItem strLine
' .ItemData(.NewIndex) = oRS!Trans_ID
' .ItemData(.NewIndex) = oRS!Lot_ID
End With
oRS.MoveNext
Loop
oRS.Close
If lstHeader.ListCount Then
lstHeader.ListIndex = 0
Else
gintLOTID = 0
lstHeader.ListIndex = -1
cmdPrint.Enabled = False
End If
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - Module HeaderLoad"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Sub HMAS90Load()
Dim oRS As Recordset
Dim strSQL As String
'Dim strTYPE As String
Dim strLine As String
On Error GoTo Error_EH
' strTYPE = Trim(Left(cboARCode, 7))
' strSQL = "SELECT Invoice_date, Invoice_no, lot_id, trans_id, header, shipped, customer_no, non_tax_amt from tblARInvoice WHERE shipped and header and customer_no = '" & Trim(Left(cboARCode, 7)) & "' and not done"
' strSQL = "SELECT Invoice_date, Invoice_no, lot_id, trans_id, header, shipped, customer_no, non_tax_amt FROM tblARInvoice WHERE shipped and header and customer_no = '" & Trim(Left(cboARCode, 7)) & "' and not done"
' strSQL = "SELECT * FROM tblARInvoice WHERE shipped and header and customer_no = '" & Trim(Left(cboARCode, 7)) & "' and not done"
' strSQL = "SELECT * FROM tblARInvoice WHERE shipped and header and Lot_ID = " & gintLOTID '& "'" ' and not done"
strSQL = "SELECT * FROM ARN_InvHistoryHeader WHERE Lot_ID = " & gintLOTID '& "'" ' and not done"
Set oRS = New Recordset
oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly
lstHeader.Clear
' strTYPE = oRS.RecordCount
Do Until oRS.EOF
With lstHeader
strLine = ""
strLine = Field2Str2(oRS!Lot_id) & vbTab & Field2Str(oRS!InvoiceNumber) & vbTab & Field2Str(oRS!InvoiceDate) & vbTab
strLine = strLine & Format(Field2Str2(oRS!NonTaxableSalesAmount), "Currency") & vbTab & Format(Field2Str2(oRS!Lot_id), "000000")
' strLine = ""
' strLine = Field2Str(oRS!invoice_no) & " " & Field2Str(oRS!invoice_date) & vbTab
' strLine = strLine & Format(Field2Str2(oRS!non_tax_amt), "Currency") & " " & Format(Field2Str2(oRS!Lot_id), "000000")
.AddItem strLine
' .AddItem strLine
' .ItemData(.NewIndex) = oRS!Trans_ID
' .ItemData(.NewIndex) = oRS!Lot_ID
End With
oRS.MoveNext
Loop
oRS.Close
If lstHeader.ListCount Then
lstHeader.ListIndex = 0
Else
gintLOTID = 0
lstHeader.ListIndex = -1
cmdPrint.Enabled = False
End If
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - Module HMAS90Load"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Sub DetailLoad()
Dim oRS As Recordset
Dim strSQL As String, strLine As String
On Error GoTo Error_EH
lstHeader.col = 1
mstrINVNO = lstHeader.ColText
' strSQL = "SELECT trans_ID, sales_code, lot_id, header, shipped, description, amount from tblARInvoice WHERE shipped and lot_id = " & gintLOTID & " and not done"
strSQL = "SELECT trans_ID, sales_code, lot_id, header, shipped, description, amount from tblARInvoice WHERE shipped and Invoice_no = '" & mstrINVNO & "'" ' and not done"
Set oRS = New Recordset
oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly
' msglInvTotal = 0
lstDetail.Clear
Do Until oRS.EOF
strLine = ""
' msglInvTotal = msglInvTotal + field2single(oRS!amount)
If Len(Format(Field2Str2(oRS!amount), "currency")) > 7 Then
strLine = Field2Str(oRS!sales_code) & vbTab & Format(Field2Str2(oRS!amount), "currency") & vbTab & Field2Str(oRS!Description)
Else
strLine = Field2Str(oRS!sales_code) & vbTab & Format(Field2Str2(oRS!amount), "currency") & vbTab & vbTab & Field2Str(oRS!Description)
End If
lstDetail.AddItem strLine
lstDetail.ItemData(lstDetail.NewIndex) = Field2Long(oRS!Trans_ID)
oRS.MoveNext
Loop
oRS.Close
If lstDetail.ListCount Then
lstDetail.ListIndex = 0
Else
lstDetail.ListIndex = -1
End If
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - Module DetailLoad"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Sub cboARCode_Change()
lstHeader.Clear
lstDetail.Clear
Call HeaderLoad
End Sub
Private Sub cboARCode_Click()
lstHeader.Clear
lstDetail.Clear
Call HeaderLoad
End Sub
Private Sub chkReady_Click()
cmdSave.Enabled = True
End Sub
Private Sub cmdPrint_Click()
Dim oRS As Recordset, strSQL As String, strSELECT As String
On Error GoTo Error_EH
gintCOPY = 1
strSQL = "SELECT trans_id, ProjLot, PO_Num FROM tblARINVOICE WHERE trans_id = " & lstDetail.ItemData(lstDetail.ListIndex)
Set oRS = New Recordset
oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly
gstrPONUM = Field2Str(oRS!po_num)
mstrPROJLOT = Field2Str(oRS!ProjLot)
Call LotChange(mstrPROJLOT, "RePrint AR Invoice")
strSELECT = "{tblARInvoice.po_num} = '" & gstrPONUM & "'"
' strSELECT = "{tblARInvoice.invoice_no}='" & mstrINV & "'"
crAR.ReportFileName = App.Path & "\invoice.rpt"
crAR.ReplaceSelectionFormula (strSELECT)
' crAR.CopiesToPrinter = gintCOPY
crAR.CopiesToPrinter = 1
crAR.Destination = crptToWindow
' crar.Destination = crptToPrinter
crAR.Action = 1
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - Module PrintStoneInv"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
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
' Call DataHasChanged
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 moRSProj.State = adStateOpen Then
moRSProj.Close
End If
If moRSDetail.State = adStateOpen Then
moRSDetail.Close
End If
Exit Sub
Error_EH:
If Err.Number = 91 Then
Resume Next
End If
gstrMODULE = "Form MANBILL - Module Form QueryUnload"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Sub cmdSave_Click()
mintBOOKMARK = lstDetail.ListIndex
mintBOOK = lstHeader.ListIndex
cmdExit.Enabled = True
cmdSave.Enabled = False
Call FormSave
lstHeader.ListIndex = mintBOOK
lstDetail.Enabled = True
lstDetail.ListIndex = mintBOOKMARK
mintBOOKMARK = 0
End Sub
Private Sub Form_Load()
Dim mstrProj, mstrLotNo, mstrProjDesc, mstrLotAddress As String
Call ARCodeLoad
frmMANBILL.Caption = "Manual Billing - " & gstrLOGIN
Call ProjLoad
Call LotLoad
Call HeaderLoad
' Call HMAS90Load
Call DetailLoad
End Sub
Private Sub ProjLoad()
Dim strSQL As String
On Error GoTo Error_EH
strSQL = "SELECT * FROM tblProject where proj_id = " & gintPROJID
Set moRSProj = New Recordset
moRSProj.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - Module ProjLoad"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Sub LotLoad()
Dim strSQL As String
On Error GoTo Error_EH
strSQL = "SELECT * FROM tblLotInfo where Lot_id = " & gintLOTID
Set moRS = New Recordset
moRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly
If Not moRS.EOF Then
' mstrARCode = moRSProj!ar
If Not moRSProj.EOF Then
' mstrARCode = moRS!ar
lblProjLotDesc = Trim(Field2Str(moRSProj!Proj_Code)) & " -- " & Trim(Field2Str(moRS!lot_no)) & " -- "
lblProjLotDesc = lblProjLotDesc & Trim(Field2Str(moRS!model)) & " -- " & Trim(Field2Str(moRS!address))
End If
End If
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - Module LotLoad"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Sub ARCodeLoad()
Dim oRS As Recordset
Dim strSQL As String, intRows As Integer, strLine As String
Dim lngLOTID As Long, strINVNO As String
Dim row, col As Long
On Error GoTo Error_EH
strSQL = "SELECT * FROM ARN_InvHistoryHeader WHERE Lot_ID = " & gintLOTID & " ORDER BY InvoiceNumber"
' strSQL = "SELECT AR_ID, InvoiceNumber, InvoiceDate, JobNumber, NonTaxableSalesAmount FROM ARN_InvHistoryHeader WHERE Lot_ID = " & gintLOTID
' strSQL = "SELECT Bill_Id, Cust_no, Name FROM tblARMaster"
Set oRS = New Recordset
oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly
Do Until oRS.EOF
If Not strINVNO = Field2Str(oRS!InvoiceNumber) And Not lngLOTID = Field2Str2(oRS!Lot_id) Then
strLine = Field2Str(oRS!AR_ID) & vbTab & Field2Str(oRS!InvoiceNumber) & vbTab & Field2Str(oRS!InvoiceDate) & vbTab & Field2Str(oRS!JobNumber) & vbTab & Format(Field2Str(oRS!NonTaxableSalesAmount), "#,#.00")
cboARCode.AddItem strLine
strINVNO = Field2Str(oRS!InvoiceNumber)
lngLOTID = Field2Str2(oRS!Lot_id)
Else
' cboARCode.ItemData(cboARCode.NewIndex) = Field2Long(oRS!Bill_Id)
strINVNO = Field2Str(oRS!InvoiceNumber)
lngLOTID = Field2Str2(oRS!Lot_id)
End If
oRS.MoveNext
Loop
oRS.Close
cboARCode.ListIndex = 0
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - Module ARCodeLoad"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Sub FormShow()
On Error GoTo Error_EH
mboolSHOW = True
With moRSDetail
txtInvDate = Field2Str(!invoice_date)
txtDueDate = Field2Str(!inv_due_date)
txtItemAmt = Format(Field2Str2(!amount), "currency")
txtSalesCode = Field2Str(!sales_code)
If !done Then
lblDone.Visible = True
Else
lblDone.Visible = False
End If
txtTax = Field2Str(!taxcode)
If txtTax = "AZ" Then
txtTax.BackColor = &H80FFFF
txtTax.ForeColor = &HFF&
txtTax.FontBold = True
Else
txtTax.BackColor = &H80000005
txtTax.ForeColor = &H80000008
txtTax.FontBold = False
End If
chkReady = Field2CheckBox(!ready)
End With
mboolSHOW = False
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - 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 MANBILL - Module FormSave"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Function FormFindDetail() As Boolean
Dim strSQL As String
On Error GoTo Error_EH
strSQL = "SELECT * "
strSQL = strSQL & "FROM tblARInvoice "
strSQL = strSQL & "WHERE trans_id = " & lstDetail.ItemData(lstDetail.ListIndex)
Set moRSDetail = New Recordset
moRSDetail.Open strSQL, goConn, adOpenKeyset, adLockPessimistic
If moRSDetail.EOF Then
FormFindDetail = False
Else
FormFindDetail = True
msglInvTotal = moRSDetail!non_tax_amt
mstrType = moRSDetail!inv_type
gintPROJID = moRSDetail!Proj_ID
Call ProjLoad
End If
Exit Function
Error_EH:
gstrMODULE = "Form MANBILL - Module FormFindDetail"
Call ErrorHandler2
gstrMODULE = ""
Exit Function
End Function
Private Sub lblARCode_Click()
End Sub
Private Sub lstDetail_Click()
If lstDetail.ListIndex <> -1 Then
If FormFindDetail() 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 moRSDetail
!invoice_date = Str2Field(txtInvDate)
!inv_due_date = Str2Field(txtDueDate)
!price = Str2Field(txtItemAmt)
!amount = Str2Field(txtItemAmt)
!sales_code = Str2Field(txtSalesCode)
.Update
End With
strSQL = "SELECT sum(amount) as sgltotal FROM tblARInvoice WHERE inv_type = '" & mstrType & "' and lot_id = " & gintLOTID & " and not done"
Set oRS = New Recordset
oRS.Open strSQL, goConn, adOpenKeyset, adLockOptimistic
msglInvTotal = Field2Str2(oRS!sglTOTAL)
strSQL = "SELECT * FROM tblARInvoice WHERE inv_type = '" & mstrType & "' and lot_id = " & gintLOTID
Set oRS = New Recordset
oRS.Open strSQL, goConn, adOpenForwardOnly, adLockOptimistic
Do Until oRS.EOF
With oRS
!invoice_date = Str2Field(txtInvDate)
!inv_due_date = Str2Field(txtDueDate)
!ready = chkReady
!non_tax_amt = msglInvTotal
!taxcode = Str2Field(txtTax)
If Field2Str2(moRSProj!retention) > 0 Then
!retention_amt = Format(((msglInvTotal * Field2Str2(moRSProj!retention) / 100)), "#.00")
Else
!retention_amt = 0
End If
.Update
End With
oRS.MoveNext
Loop
Call HeaderLoad
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - Module FieldsSave"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Sub FormClear()
txtInvDate = ""
txtDueDate = ""
txtSalesCode = ""
txtItemAmt = ""
chkReady = vbUnchecked
End Sub
Private Sub lstDetail_DblClick()
cmdSave.Enabled = True
End Sub
Private Sub lstHeader_Click()
On Error GoTo Error_EH
If lstHeader.ListIndex <> -1 Then
cmdPrint.Enabled = True
lstHeader.col = 4
gintLOTID = lstHeader.ColText
' gintLOTID = lstHeader.ItemData(lstHeader.ListIndex)
Call DetailLoad
If lstDetail.ListIndex <> -1 Then
Else
lstDetail.Clear
Call FormClear
End If
Else
cmdPrint.Enabled = False
End If
Exit Sub
Error_EH:
gstrMODULE = "Form MANBILL - Module lstHeader_Click"
Call ErrorHandler2
gstrMODULE = ""
Exit Sub
End Sub
Private Sub lstHeader_DblClick()
cmdSave.Enabled = True
End Sub
Private Sub txtDueDate_GotFocus()
Call FieldSelect(txtDueDate)
End Sub
Private Sub txtDueDate_LostFocus()
Dim lngPOS As Long
lngPOS = InStr(1, txtDueDate, "/", 1)
If lngPOS = 0 Then
If Len(txtDueDate) > 0 Then
txtDueDate = Format(txtDueDate, "00/00/####")
If Not IsDate(txtDueDate) Then
MsgBox "The Date You Entered is not Valid - ReEnter"
txtDueDate.SetFocus
End If
End If
ElseIf IsDate(txtDueDate) Then
Exit Sub
Else
MsgBox "Invalid Date Format, Enter as 12312009", , "Invalid Date - ReEnter"
txtDueDate.SetFocus
End If
End Sub
Private Sub txtInvDate_GotFocus()
Call FieldSelect(txtInvDate)
End Sub
Private Sub txtInvDate_LostFocus()
Dim lngPOS As Long
lngPOS = InStr(1, txtInvDate, "/", 1)
If lngPOS = 0 Then
If Len(txtInvDate) > 0 Then
txtInvDate = Format(txtInvDate, "00/00/####")
If Not IsDate(txtInvDate) Then
MsgBox "The Date You Entered is not Valid - ReEnter"
txtInvDate.SetFocus
End If
End If
ElseIf IsDate(txtInvDate) Then
Exit Sub
Else
MsgBox "Invalid Date Format, Enter as 12312009", , "Invalid Date - ReEnter"
txtInvDate.SetFocus
End If
End Sub
Private Sub txtItemAmt_GotFocus()
Call FieldSelect(txtItemAmt)
msglItemAmt = Single2Field(txtItemAmt)
End Sub
Private Sub txtItemAmt_LostFocus()
If msglItemAmt < Field2Str2(txtItemAmt) Then
msglInvTotal = msglInvTotal + Field2Str2(txtItemAmt)
txtItemAmt = Format(txtItemAmt, "#,#.00")
ElseIf msglItemAmt > Field2Str2(txtItemAmt) Then
msglInvTotal = msglInvTotal - Field2Str2(txtItemAmt)
txtItemAmt = Format(txtItemAmt, "#,#.00")
ElseIf msglItemAmt = Field2Str(txtItemAmt) Then
txtItemAmt = Format(txtItemAmt, "#,#.00")
End If
End Sub
Private Sub txtSalesCode_GotFocus()
Call FieldSelect(txtSalesCode)
End Sub
Private Sub txtSalesCode_LostFocus()
txtSalesCode = UCase(txtSalesCode)
End Sub
Private Sub txtTax_GotFocus()
Call FieldSelect(txtTax)
End Sub
Private Sub txtTax_LostFocus()
If Not IsNull(txtTax) Or txtTax = "" Then
txtTax = UCase(txtTax)
Else
MsgBox "You Must Enter A Sales Tax Code", vbOKOnly, "No Tax Code"
txtTax.SetFocus
End If
End Sub