you both are right i am doing somethig wrong.
i don’t mean to bore you with a lota code but i’d better be detailed to eliminate confusion and get this issue pinned down.
here is the code.
[code]Dim Clip As New Clipboard
Dim ClipSaveFile As String = “Inv_” + ReplaceAll(CusAddress.Text, " ", “_”) + “.pdf”
Clip.SetText ClipSaveFile
Dim HTMLinvoice As String
Dim row, col, ct As Integer
Dim wdate, Service, Units As String
Dim RtnArr(30) As String
Dim LeafLabor, Grass, Tree, Brush, Branch, RemovalFee, Hours As String
Dim cashamt, rtn, rtnval As String
Dim DiscountAmt As Integer
Dim discountTotalAllowed As Integer
Dim Amount As Integer
Dim discountMultiplier As String
Dim subtotal As Integer = 0
Dim Total As Integer
Dim displaysubtotal As String
Dim BillingAddress, PleaseFind As String
Dim detStr, PaidAmt_Credit As String
Dim InCash As String
Dim TOS As String
Dim TotalOther As Integer = 0
Dim hRate As String
Dim PreService As String
Dim StaticRate, Threshold, ThresholdIncrement, OverThreshold As String
Dim SnowArr(20) As String
Dim NL As String = Chr(13)
Dim BRK As String = “
”
Dim InvoiceType As String
Dim OverBalanceWarning As String
Dim OverBalanceMinPayment As String
Dim SendInvoiceByEmail As String
InvoiceType = Str(1)
if InvoiceID.Text = “” Then
MsgBox “No Invoice Created or Selected”
Return
End if
For ct = 0 To JobDetails.ListCount - 1
if CmpPattern(JobDetails.Cell(ct, 1), “Fee|Equipment|Transportation|Pre Bal|Previous Balance|Payment|Materials|Salt|Waist|Waste|Parts|Equipment|Rental|Equ Rent|Rental Fee|Discount”) = True or JobDetails.Cell(ct, 1) = “” then
JobDetails.Cell(ct, 4) = “-”
End If
Next ct
HTMLinvoice = MkHTMLInvoiceHeader(" - Landscape/Design - I n v o i c e", True) + “” + _
“” + NL
For row = 0 To JobDetails.ListCount - 1
wdate = JobDetails.Cell(row, 0)
Service = JobDetails.Cell(row, 1)
Units = JobDetails.Cell(row, 2)
Amount = val(JobDetails.Cell(row, 3))
TOS = JobDetails.Cell(row, 4)
If Amount > 0 or Amount < 0 Then
subtotal = Amount
Else
subtotal = 0
End If
If TOS = “-” Then
TotalOther = TotalOther + Amount
Else
discountTotalAllowed = discountTotalAllowed + subtotal
End If
displaysubtotal = Format(subtotal, “$0.00”)
If CmpPattern(Service, “Snow”) = False Then
if CmpPattern(Units, “%”) = true Then
elseif CmpPattern(Units, “ck|chk”) = True Then
else
Units = “”
end if
End If
’ blank entry
If wdate = “” And Service = “” Then
subtotal = 0
displaysubtotal = “”
End If
Total = Total + subtotal
HTMLinvoice = HTMLinvoice + “
” + NL
Next row
////////////////////
OverBalanceWarning = “
The amount shown is due 30 days from the date of this invoice
”
If Total > Val(CreditLimit.Text) or Total = Val(CreditLimit.Text) Then
OverBalanceWarning = “
Alert: Your Balance is past due. To avoid interruption in services and/or late fees please pay the amount indicated
The amount shown is due 30 days from the date of this invoice
”
End If
If BillEmail.Text <> “” Then
SendInvoiceByEmail = “
Our Records Show You Have an Email On File,
If you wish to recieve your future invoices by email please check this box [ ]
and return a copy of this printed invoice along with your payment
”
Else
SendInvoiceByEmail = “”
End If
HTMLinvoice = HTMLinvoice + “
” + NL
HTMLinvoice = HTMLinvoice + "” + NL
HTMLinvoice = HTMLinvoice + “
DATE |
SERVICE |
UNITS |
AMT |
TOS |
” + wdate + “ |
” + Service + “ |
” + Units + “ |
” + displaysubtotal + “ |
” + TOS + “ |
=============================================================== |
Total Charge: $" + Format(Total, “0.00”) + " " + InCash + “ |
=============================================================== |
” + NL + _
“
”
HTMLinvoice = HTMLinvoice + OverBalanceWarning
If Discount.Text <> “” And Val(Discount.Text) <> 0 and Total > 0 and discountTotalAllowed > 0 Then
If InStr(Discount.Text, “30%”) > 0 Then
discountMultiplier = “0.7”
ElseIf InStr(Discount.Text, “25%”) > 0 Then
discountMultiplier = “0.75”
ElseIf InStr(Discount.Text, “20%”) > 0 Then
discountMultiplier = “0.8”
ElseIf InStr(Discount.Text, “20%”) > 0 Then
discountMultiplier = “0.85”
ElseIf InStr(Discount.Text, “10%”) > 0 Then
discountMultiplier = “0.9”
End If
DiscountAmt = (discountTotalAllowed * Val(discountMultiplier)) + TotalOther
//MsgBox "Discount Price: " + Str(DiscountAmt) + " Reg Price: " + Str(Total)
HTMLinvoice = HTMLinvoice + “
If paying this invoice in full in cash within 30 days of the invoice date, your discount offer will be: " + Discount.Text + " for a balance of: $” + Format(DiscountAmt, “$0.00”) + BRK + _
BRK + “Please Note: Discounts are not applied to Materials, Parts, Transportation, Equipment Fees, Disposal, Rentals, or Delivery Fees ”
End If
HTMLinvoice = HTMLinvoice + BRK + “
We accept Visa, M/C, Discover and American Express by Phone M-F 6pm - 8pm,” + BRK + _
“There is a %4 additional charge for credit card payments. which would bring your total to: $” + Format((Total * 0.04) + Total, “$0.00”) + _
BRK + BRK + “If paying by check please make payable to ‘Cullins Service’ for the amount of: $” + Format(Total, “$0.00”) + NL + BRK + “and mail to Cullins Service PO BOX 620-003 Newton Lower Falls, MA 02462 ” + _
BRK + “( please make check ledgible, do not bend or fold check, do not write over the account information )” + _
SendInvoiceByEmail
HTMLinvoice = HTMLinvoice + BRK + BRK + "Thank You For Your Business
|
"
SaveToFile(HTMLinvoice, GetSettingsFolder.Child(“HTMLinvoice.html”))
GoToURLPath(GetSettingsPath + “/HTMLinvoice.html”)
// mark the current invoice as billed if flag has not been previously set
if ShowBillFlag = “” and DontMarkBilledChk.State = CheckBox.CheckedStates.Unchecked then
MarkAsBilled
end if
[/code]