Public Sub basReadRtn()
Dim NoRec(18) As String
Dim NoRecFlg(19) As Boolean
Dim MyLine As String
Dim Idx As Integer
Dim MyRtnRec As RtnRec
Dim MyFldLen As Integer
Dim Pblshr(25) As String
Dim MyPubCode As String
Pblshr(0) = "ACAD"
Pblshr(1) = "" 'Pierson Education
Pblshr(2) = "PH"
Pblshr(3) = "Norton"
Pblshr(5) = "VHPS"
Pblshr(6) = "" '"St. Martins"
Pblshr(7) = "Freeman"
Pblshr(8) = "Worth"
Pblshr(9) = "Henry"
Pblshr(10) = "Bedford"
Pblshr(11) = "ITP"
Pblshr(12) = "" '"Delaware"
Pblshr(13) = "WAD"
Pblshr(14) = "" 'Heinley-Heinley"
Pblshr(15) = "" 'S. Western"
Pblshr(16) = "" 'Brooks And Cole"
Pblshr(17) = "" '"Course Tech"
Pblshr(18) = "" 'Milady"
Pblshr(19) = "" 'PWF"
Pblshr(20) = "" 'Duxbury"
Pblshr(21) = "Westl"
Pblshr(22) = "AB" 'Allan Bacon
Pblshr(23) = "AW" 'Addison-Wesley
Pblshr(24) = ""
Pblshr(25) = ""
Dim RtnFlds(10) As Integer
RtnFlds(1) = 1 'Auth Start
RtnFlds(2) = 16 'Auth End/ISBN Start
RtnFlds(3) = 26 'ISBN End/Title Start
RtnFlds(4) = 74 'Title End/Edition Start
RtnFlds(5) = 83 'Edition End/MyYear Start
RtnFlds(6) = 103 'MyYear End/Returned Start
RtnFlds(7) = 113 'Returned End/Net Start
RtnFlds(8) = 126 'Net End/Extended Start
RtnFlds(9) = 132 'Extended End
NoRec(0) = "Page"
NoRec(1) = "Actual Return List"
NoRec(2) = "Charge Back"
NoRec(3) = "Authorization"
NoRec(4) = "Warehouse"
NoRec(5) = "Warehous"
NoRec(6) = "Books Returned"
NoRec(7) = "Author"
NoRec(8) = "ISBN"
NoRec(9) = "Title"
NoRec(10) = "Reason:"
NoRec(11) = "====="
NoRec(12) = "Bill to Address"
NoRec(13) = "CUBPaC, Inc"
NoRec(14) = "Dobbin Road"
NoRec(15) = "Columbia, MD"
NoRec(16) = "Fax:"
NoRec(17) = "Total Cost"
NoRec(18) = "Total Retail"
basChData
Open "C:\Oberlin\Nick.Txt" For Input As #1
Open "C:\Oberlin\Rtns.Txt" For Output As #2
While Not EOF(1)
Line Input #1, MyLine 'Get Input
'Check for non-record line Indicators
For Idx = 0 To UBound(NoRec)
'Set a flag for each text indicator
NoRecFlg(Idx) = InStr(UCase(MyLine), UCase(NoRec(Idx)))
Next Idx
NoRecFlg(UBound(NoRec) + 1) = (Len(MyLine) < 5)
'Check NoRec Flags and Skip if Set
If (NoRecFlg(0) And NoRecFlg(1)) Then
GoTo NotRec
End If
If (NoRecFlg(2) And NoRecFlg(3)) Then
GoTo NotRec
End If
If (NoRecFlg(4) And NoRecFlg(5) And NoRecFlg(6)) Then
GoTo NotRec
End If
If (NoRecFlg(7) And NoRecFlg(8) And NoRecFlg(9)) Then
GoTo NotRec
End If
If (NoRecFlg(10) Or NoRecFlg(11) Or NoRecFlg(12)) Then
GoTo NotRec
End If
If (NoRecFlg(11) Or NoRecFlg(12) Or NoRecFlg(13) Or NoRecFlg(14)) Then
GoTo NotRec
End If
If (NoRecFlg(15) Or NoRecFlg(16) Or NoRecFlg(17)) Then
GoTo NotRec
End If
'Only get here w/ a valid Record.
For Idx = 1 To 8
MyFldLen = RtnFlds(Idx + 1) - RtnFlds(Idx)
Select Case Idx
Case Is = 1 'Author
MyRtnRec.AUTH = Mid(MyLine, RtnFlds(Idx), MyFldLen)
MyRtnRec.AUTH = Trim(MyRtnRec.AUTH)
Case Is = 2 'ISBN
MyRtnRec.ISBN = Mid(MyLine, RtnFlds(Idx), MyFldLen)
MyRtnRec.AUTH = Trim(MyRtnRec.AUTH)
Case Is = 3 'Title
MyRtnRec.TITLE = Mid(MyLine, RtnFlds(Idx), MyFldLen)
MyRtnRec.AUTH = Trim(MyRtnRec.AUTH)
Case Is = 4 'Edition
MyRtnRec.Edition = Mid(MyLine, RtnFlds(Idx), MyFldLen)
MyRtnRec.AUTH = Trim(MyRtnRec.AUTH)
Case Is = 5 'Year
MyRtnRec.MyYear = Val(Mid(MyLine, RtnFlds(Idx), MyFldLen))
Case Is = 6 'Returned
MyRtnRec.Rtnd = Mid(MyLine, RtnFlds(Idx), MyFldLen)
MyRtnRec.AUTH = Trim(MyRtnRec.AUTH)
Case Is = 7 'Net
MyRtnRec.Net = Val(Mid(MyLine, RtnFlds(Idx), MyFldLen))
Case Is = 8 'Extended
MyRtnRec.Ext = Val(Mid(MyLine, RtnFlds(Idx), MyFldLen))
End Select
Next Idx
'Need to "LookUp" the Publisher from the ISBN. _
If Pub Matches the "List", we Keep the Record, Else Just Skip it
intStatus = BKM.BtEqual(MyRtnRec.ISBN)
If (intStatus = 0) Then 'Found the Book in the MasterFile
MyPubCode = BKM.PUBCD8
intStatus = Pub.BtEqual(MyPubCode)
If (intStatus = 0) Then
'Found the Publisher in the Pub File
'For Idx = 0 To UBound(Pblshr)
'If (Pub.PubName = Pblshr(Idx)) Then
Print #2, MyRtnRec.AUTH; Chr(9);
Print #2, MyRtnRec.ISBN; Chr(9);
Print #2, MyRtnRec.TITLE; Chr(9);
Print #2, MyRtnRec.Edition; Chr(9);
Print #2, MyRtnRec.MyYear; Chr(9);
Print #2, MyRtnRec.Rtnd; Chr(9);
Print #2, MyRtnRec.Net; Chr(9);
Print #2, MyRtnRec.Ext; Chr(9);
Print #2, Pub.PubName; Chr(9);
Print #2, Pub.PUBCD8;
strKey = Chr(1) & MKL(BKM.BOOKNO) & MKS(0#)
intStatus = RVD.BtLessEqu(strKey)
If (intStatus = 0) Then
If (RVD.BOOKNO = BKM.BOOKNO) Then
'Good Match
Print #2, Chr(9);
Print #2, RVD.PNo; Chr(9);
Print #2, RVD.Seq
Else
Print #2, ""
End If
Else
Print #2, ""
End If
'Else
GoTo NotRec
'End If
'Next Idx
End If
Else
GoTo NotRec
End If
NotRec:
Wend
Close #1
Close #2
basRestData
End Sub