I'm trying to read some invoices (XML files) and handle them based on certain criteria. In this case, I'm checking the grand total of each one.
If the total is a positive number: continue with the rest of the script.
If the total is zero or a negative number: report it, stop processing this particular file and move on to the next one.
I have two problems with the bit of code below:
1. When I encounter a zero or negative amount in the subroutine, how do I stop processing this file and move on to the the next one? (I'm calling the subroutine from within a For/Next loop)
2. Isn't there a "cleaner" way of determining if the total is positive/negative/zero? The nested If..Then stuff just seems a bit crude.
If the total is a positive number: continue with the rest of the script.
If the total is zero or a negative number: report it, stop processing this particular file and move on to the next one.
I have two problems with the bit of code below:
1. When I encounter a zero or negative amount in the subroutine, how do I stop processing this file and move on to the the next one? (I'm calling the subroutine from within a For/Next loop)
2. Isn't there a "cleaner" way of determining if the total is positive/negative/zero? The nested If..Then stuff just seems a bit crude.
Code:
Sub subCreditMemo
If strTotal > 1 Then
'continue
Else
If strTotal = 0 Then
rptFile.WriteLine strInvoiceNumber & " (" & Left(strCompany, 3) & ") " & strStore & " - This invoice has a grand total of zero."
Else
If strTotal < 0 Then
rptFile.WriteLine strInvoiceNumber & " (" & Left(strCompany, 3) & ") " & strStore & " - This invoice should be converted to a credit invoice."
Else
End If
End if
End if
End Sub