Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Print Invoice


Message #1 by william.sze@s... on Fri, 18 Jan 2002 08:53:13 -0500

Hi,



I have generated an invoice using ASP. It is fine for printing a one page

invoice by directly pressing the print button in browser. However, for

invoice that is longer than one page, I need the same top half (co. name,

bill to , ship to, ship via ...etc info) appears in the second, third page

...



Would anyone please give me an advise or a link on this printing issue.



Thanks

William



Message #2 by william.sze@s... on Fri, 18 Jan 2002 09:10:15 -0500

Hi all,



I have generated an invoice using ASP. It is fine for printing a one page

invoice by directly pressing the print button in browser. However, for

invoice that is longer than one page, I need the same top half (co. name,

bill to , ship to, ship via ...etc info) appears in the second, third page

...



Would anyone please give me an advise or a link on this printing issue.



Thanks

William



Message #3 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Fri, 18 Jan 2002 16:26:09 -0000
There is no intrinsic way of doing this.  What you need to do is figure out

a way of identifying where the page breaks are going to be, by counting

table rows or whatever.  Then use the onbeforeprint event to insert a copy

of the DIV which contains your header in each of these points in the page.

Then use the onafterprint event to remove these headers again.



Although I'm not certain if browsers other than IE support those events.



-----Original Message-----

From: william.sze@s... [mailto:william.sze@s...]

Sent: 18 January 2002 14:10

To: ASP Web HowTo

Subject: [asp_web_howto] Print Invoice







Hi all,



I have generated an invoice using ASP. It is fine for printing a one page

invoice by directly pressing the print button in browser. However, for

invoice that is longer than one page, I need the same top half (co. name,

bill to , ship to, ship via ...etc info) appears in the second, third page

...



Would anyone please give me an advise or a link on this printing issue.



Thanks

William








$subst('Email.Unsub').



________________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com



Headquarters Address & Contact Numbers



150 Broomielaw

5 Atlantic Quay

Glasgow

G2 8LU.

Tel:  +44 (0) 141 248 2700.

Fax:  +44 (0)141 221 3217



 This message is sent in confidence for the addressee only.

It may contain legally privileged information. The contents are not to

be disclosed to anyone other than the addressee. Unauthorised recipients

are requested to preserve this confidentiality and to advise the sender

immediately of any error in transmission.





Message #4 by william.sze@s... on Mon, 21 Jan 2002 09:27:18 -0500

Hi Alex,



Thanks for your reply. I read a few articles on onbeforeprint and

onafterprint, like



http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events/onbeforeprint.asp



 but still cannot figure out a solution. Can you give me more advise?



Thanks

William





                                                                                                                      

                    "Alex Shiell,                                                                                     

                    ITS, EC, SE"            To:     "ASP Web HowTo" <asp_web_howto@p...>                      

                    <alex.shiell@s...       cc:                                                                       

                    ent.co.uk>              Subject:     [asp_web_howto] RE: Print Invoice                            

                                                                                                                      

                    01/18/2002 11:26                                                                                  

                    AM                                                                                                

                    Please respond to                                                                                 

                    "ASP Web HowTo"                                                                                   

                                                                                                                      

                                                                                                                      









There is no intrinsic way of doing this.  What you need to do is figure out

a way of identifying where the page breaks are going to be, by counting

table rows or whatever.  Then use the onbeforeprint event to insert a copy

of the DIV which contains your header in each of these points in the page.

Then use the onafterprint event to remove these headers again.



Although I'm not certain if browsers other than IE support those events.



-----Original Message-----

From: william.sze@s... [mailto:william.sze@s...]

Sent: 18 January 2002 14:10

To: ASP Web HowTo

Subject: [asp_web_howto] Print Invoice







Hi all,



I have generated an invoice using ASP. It is fine for printing a one page

invoice by directly pressing the print button in browser. However, for

invoice that is longer than one page, I need the same top half (co. name,

bill to , ship to, ship via ...etc info) appears in the second, third page

...



Would anyone please give me an advise or a link on this printing issue.



Thanks

William








$subst('Email.Unsub').



________________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com



Headquarters Address & Contact Numbers



150 Broomielaw

5 Atlantic Quay

Glasgow

G2 8LU.

Tel:  +44 (0) 141 248 2700.

Fax:  +44 (0)141 221 3217



 This message is sent in confidence for the addressee only.

It may contain legally privileged information. The contents are not to

be disclosed to anyone other than the addressee. Unauthorised recipients

are requested to preserve this confidentiality and to advise the sender

immediately of any error in transmission.










$subst('Email.Unsub').









Message #5 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Mon, 21 Jan 2002 15:02:17 -0000
Heres an example of how I use it to hide buttons and search criteria on a

database search screen, also my results appear in a scrollable box of fixed

height which needs to be expanded before printing.



(I've used VBScript rather than JScript just because the client wanted

Yes/No instead of OK/Cancel, all users are on IE anyway)



<BODY ONBEFOREPRINT="list_beforePrint();" ONAFTERPRINT="list_afterPrint();">



here are the functions:



function list_beforePrint()

on error resume next



	Dim sPrompt

	

	sPrompt = "Would you like the Search Criteria to be hidden?"

	

	if MsgBox(sPrompt,4, "Printing") = 6 then

criteria_outerDiv.style.display = "none"



	buttonsDiv.style.display="none"

	sHeight = resultsDiv.style.height

	resultsDiv.style.height="auto"



end function



function list_afterPrint()

on error resume next

	

	criteria_outerDiv.style.display = ""

	buttonsDiv.style.display = ""

	resultsDiv.style.height = sHeight

	sHeight = 0



end function



-----Original Message-----

From: william.sze@s... [mailto:william.sze@s...]

Sent: 21 January 2002 14:27

To: ASP Web HowTo

Subject: [asp_web_howto] RE: Print Invoice







Hi Alex,



Thanks for your reply. I read a few articles on onbeforeprint and

onafterprint, like



http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/ref

erence/events/onbeforeprint.asp



 but still cannot figure out a solution. Can you give me more advise?



Thanks

William





 



                    "Alex Shiell,



                    ITS, EC, SE"            To:     "ASP Web HowTo"

<asp_web_howto@p...>                      

                    <alex.shiell@s...       cc:



                    ent.co.uk>              Subject:     [asp_web_howto] RE:

Print Invoice                            

 



                    01/18/2002 11:26



                    AM



                    Please respond to



                    "ASP Web HowTo"



 



 











There is no intrinsic way of doing this.  What you need to do is figure out

a way of identifying where the page breaks are going to be, by counting

table rows or whatever.  Then use the onbeforeprint event to insert a copy

of the DIV which contains your header in each of these points in the page.

Then use the onafterprint event to remove these headers again.



Although I'm not certain if browsers other than IE support those events.



-----Original Message-----

From: william.sze@s... [mailto:william.sze@s...]

Sent: 18 January 2002 14:10

To: ASP Web HowTo

Subject: [asp_web_howto] Print Invoice







Hi all,



I have generated an invoice using ASP. It is fine for printing a one page

invoice by directly pressing the print button in browser. However, for

invoice that is longer than one page, I need the same top half (co. name,

bill to , ship to, ship via ...etc info) appears in the second, third page

...



Would anyone please give me an advise or a link on this printing issue.



Thanks

William








$subst('Email.Unsub').



________________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com



Headquarters Address & Contact Numbers



150 Broomielaw

5 Atlantic Quay

Glasgow

G2 8LU.

Tel:  +44 (0) 141 248 2700.

Fax:  +44 (0)141 221 3217



 This message is sent in confidence for the addressee only.

It may contain legally privileged information. The contents are not to

be disclosed to anyone other than the addressee. Unauthorised recipients

are requested to preserve this confidentiality and to advise the sender

immediately of any error in transmission.










$subst('Email.Unsub').














$subst('Email.Unsub').



________________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com



Headquarters Address & Contact Numbers



150 Broomielaw

5 Atlantic Quay

Glasgow

G2 8LU.

Tel:  +44 (0) 141 248 2700.

Fax:  +44 (0)141 221 3217



 This message is sent in confidence for the addressee only.

It may contain legally privileged information. The contents are not to

be disclosed to anyone other than the addressee. Unauthorised recipients

are requested to preserve this confidentiality and to advise the sender

immediately of any error in transmission.





Message #6 by william.sze@s... on Tue, 22 Jan 2002 13:18:20 -0500

Thanks so much for Alex and Dana reply, finally I get it done using

onbeforeprint, onafterprint, page-break-after ...to view my invoice in one

page on the web and able to print my invoice on several pages each with

same shipping address, company logo etc as the header.



BTW, is there a way to determine the end of a page is reached, so that a

page-break can be triggered. Currently I am counting the no. of records

printed after the header and then trigger thepage-break, onbeforeprint as

suggested by Alex.



Thanks

William







                                                                                                                      

                    "Alex Shiell,                                                                                     

                    ITS, EC, SE"            To:     "ASP Web HowTo" <asp_web_howto@p...>                      

                    <alex.shiell@s...       cc:                                                                       

                    ent.co.uk>              Subject:     [asp_web_howto] RE: Print Invoice                            

                                                                                                                      

                    01/21/2002 10:02                                                                                  

                    AM                                                                                                

                    Please respond to                                                                                 

                    "ASP Web HowTo"                                                                                   

                                                                                                                      

                                                                                                                      









Heres an example of how I use it to hide buttons and search criteria on a

database search screen, also my results appear in a scrollable box of fixed

height which needs to be expanded before printing.



(I've used VBScript rather than JScript just because the client wanted

Yes/No instead of OK/Cancel, all users are on IE anyway)



<BODY ONBEFOREPRINT="list_beforePrint();" ONAFTERPRINT="list_afterPrint

();">



here are the functions:



function list_beforePrint()

on error resume next



           Dim sPrompt



           sPrompt = "Would you like the Search Criteria to be hidden?"



           if MsgBox(sPrompt,4, "Printing") = 6 then

criteria_outerDiv.style.display = "none"



           buttonsDiv.style.display="none"

           sHeight = resultsDiv.style.height

           resultsDiv.style.height="auto"



end function



function list_afterPrint()

on error resume next



           criteria_outerDiv.style.display = ""

           buttonsDiv.style.display = ""

           resultsDiv.style.height = sHeight

           sHeight = 0



end function



-----Original Message-----

From: william.sze@s... [mailto:william.sze@s...]

Sent: 21 January 2002 14:27

To: ASP Web HowTo

Subject: [asp_web_howto] RE: Print Invoice







Hi Alex,



Thanks for your reply. I read a few articles on onbeforeprint and

onafterprint, like



http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/ref



erence/events/onbeforeprint.asp



 but still cannot figure out a solution. Can you give me more advise?



Thanks

William









                    "Alex Shiell,



                    ITS, EC, SE"            To:     "ASP Web HowTo"

<asp_web_howto@p...>

                    <alex.shiell@s...       cc:



                    ent.co.uk>              Subject:     [asp_web_howto]

RE:

Print Invoice





                    01/18/2002 11:26



                    AM



                    Please respond to



                    "ASP Web HowTo"



















There is no intrinsic way of doing this.  What you need to do is figure out

a way of identifying where the page breaks are going to be, by counting

table rows or whatever.  Then use the onbeforeprint event to insert a copy

of the DIV which contains your header in each of these points in the page.

Then use the onafterprint event to remove these headers again.



Although I'm not certain if browsers other than IE support those events.



-----Original Message-----

From: william.sze@s... [mailto:william.sze@s...]

Sent: 18 January 2002 14:10

To: ASP Web HowTo

Subject: [asp_web_howto] Print Invoice







Hi all,



I have generated an invoice using ASP. It is fine for printing a one page

invoice by directly pressing the print button in browser. However, for

invoice that is longer than one page, I need the same top half (co. name,

bill to , ship to, ship via ...etc info) appears in the second, third page

...



Would anyone please give me an advise or a link on this printing issue.



Thanks

William








$subst('Email.Unsub').



________________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com



Headquarters Address & Contact Numbers



150 Broomielaw

5 Atlantic Quay

Glasgow

G2 8LU.

Tel:  +44 (0) 141 248 2700.

Fax:  +44 (0)141 221 3217



 This message is sent in confidence for the addressee only.

It may contain legally privileged information. The contents are not to

be disclosed to anyone other than the addressee. Unauthorised recipients

are requested to preserve this confidentiality and to advise the sender

immediately of any error in transmission.










$subst('Email.Unsub').














$subst('Email.Unsub').



________________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com



Headquarters Address & Contact Numbers



150 Broomielaw

5 Atlantic Quay

Glasgow

G2 8LU.

Tel:  +44 (0) 141 248 2700.

Fax:  +44 (0)141 221 3217



 This message is sent in confidence for the addressee only.

It may contain legally privileged information. The contents are not to

be disclosed to anyone other than the addressee. Unauthorised recipients

are requested to preserve this confidentiality and to advise the sender

immediately of any error in transmission.










$subst('Email.Unsub').










  Return to Index