Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help to create HTML Style Invoice

Status
Not open for further replies.

ltleforge

Technical User
Oct 11, 2003
7
0
0
GB
I need some help to create a HTML style invoice.

I have created a registration page register.asp which posts the info to another asp form that contains the variables necessary to update a database and send an email containing the form data using CDONTS. The register.asp form also contains products and prices.

How can I post this information so that it also creates a HTML invoice to attach to the CDONTS email. If you get what I mean.

This has taken me hours to figure out but still can't

Please please please help!

Chris
 
write the body using HTML and set the body format and mail format as follows...

with objEmail
.From = emailRS("eFrom")
.To = emailRS("eTo")
if not isNull(emailRS("eCC")) then
.CC = emailRS("eCC")
end if
.Subject = emailRS("subject")
.Body = emailRS("body")
if not isNull(emailRS("value")) then
.Value("Reply-To") =emailRS("value")
end if
.bodyFormat = 0 'HTML'
.mailFormat = 0 'MIME Format'

.send
end with

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Thanks for your comment. Its not the writing of an email object I have trouble with but how to compile an invoice in html format and send it as an attachment. Where can it get its values from based on what the person has selected in the checkboxes.

 
Here you go, I am giving all the code,
from here you have to improve,add.
As is it is working fine.

from: chinnababureddy@hotmail.com
--------------------------------------

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>

<html>
<head>
<title>Invoice</title>
</head>

<body>
<% if request.form(&quot;company&quot;) = &quot;&quot; then%>
<form action=&quot;invoice.asp&quot; method=&quot;post&quot;>
<table>
<tr>
<td>Comany Name</td>
<td><input type=&quot;text&quot; name=&quot;company&quot; value=&quot;your company&quot;></td>
</tr>
<tr>
<td>Email</td>
<td><input type=&quot;text&quot; name=&quot;email&quot; value=&quot;chinnababureddy@hotmail.com&quot;></td>
</tr>
<tr>
<td>Amount</td>
<td><input type=&quot;text&quot; name=&quot;amount&quot; value=&quot;10000&quot;></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type=&quot;reset&quot; value=&quot;Reset&quot;>&nbsp;<input type=&quot;submit&quot;
value=&quot;Submit&quot;></td>
</tr>
</table>
</form>

<% else %>

<% company=request.form(&quot;company&quot;)%>
<% response.write &quot;Company - &quot; & company %>
<br>
<% email=request.form(&quot;email&quot;)%>
<% response.write &quot;Email - &quot; & email %>
<br>
<% amount=request.form(&quot;amount&quot;)%>
<% response.write &quot;Amount - &quot; & amount %>
<br>
<% response.write &quot;Email has been sent out with attachment.&quot; %>
<br>
<%

Const ForReading = 1, ForWriting = 2, ForAppending = 8
dim strFileName, objFSO, objMenuPage

Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)

strFileName = &quot;c:\temp\invoice.htm&quot;
Set objMenuPage = objFSO.createtextFile(strFileName, forWriting, True)

'write the HTML page
objMenuPage.WriteLine &quot;<html><head><title>Invoice</title></title></head>&quot;
objMenuPage.WriteLine &quot;<body><b><center>ASP - Invoice<br><hr color='blue' width='100%' size='1'></center></b>&quot;
objMenuPage.WriteLine Now()
objMenuPage.WriteLine &quot;<br>&quot;
objMenuPage.WriteLine &quot;<br>&quot;
objMenuPage.WriteLine &quot;Company - &quot; & company
objMenuPage.WriteLine &quot;<br>&quot;
objMenuPage.WriteLine &quot;Email - &quot; & email
objMenuPage.WriteLine &quot;<br>&quot;
objMenuPage.WriteLine &quot;Amount - &quot; & amount
objMenuPage.WriteLine &quot;<br>&quot;
objMenuPage.WriteLine &quot;</body></html>&quot;
objMenuPage.Close
%>


<%

Dim objMail
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

objMail.From = &quot;webserver&quot;
objMail.Subject = &quot;Your Invoice&quot;
objMail.AttachFile(&quot;c:\temp\invoice.htm&quot;)
objMail.To = email
objMail.Body = &quot;See attachment, your invoice.&quot;
objMail.Send

set objMail = nothing
%>

<% end if %>

</body>
</html>
 
I tried the code and I keep getting a compilation error. Do you think it might be a good idea if I email the code to you to have a look. Just so you can get an idea of what I am trying to achieve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top