[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 868
  • Last Modified:

Dynamic Invoice Creation and Export

HI

I have created an online invoice system, which stores details of all of our invoices, we need to develop a system for veiewing them online (which will be a simple php dynamic page) and also for exporting them.

I have looked at a few options, like creating and excel file but cant seem to find the right avenue to follow.

I am looking for as much advice as possible on possible ways of dealing with this.  

We have our invoice template (currently in excel) which fits an a4 sheet, we only really need 2 results, 1 the invoice we can view online (easy with php) and an excel or pdf version file that we can store on a local directory and print hard a hard copy from.

We have talked about creating a version online which could be printed but really we are a bit lost with regards the bes way to go about this, any advice would be much appriciated

Many thanks

-s-
0
socross
Asked:
socross
  • 2
1 Solution
 
SamsonChungCommented:
One word.

TABLE.

an excel spreadshit is nothing more then a <table></table>

If you display your contents inside a table, and have php output the file name as xls, Windows would automatically associate that generated file with Excel.

remember the following lines

header( "content-type: text/xml" );

If you want the simple method, use <table><th></thj> ...

If you want to do it with the completely compatible version of Excel following this link
http://www-128.ibm.com/developerworks/opensource/library/os-phpexcel/

I would suggest you do it the simple way first. because the ibm page involves lots of MS documents related text input and coding. It'll be difficult to see your errors in this situation if all that hassle was caused by a typo.


0
 
socrossAuthor Commented:
Ok Sounds Good
Couple of questions

Our Invoice Template does contain a couple of images but could easily be creatd using tables.

COuld you be a bit clearer with regads the steps involved.

So

1 Dynamically generate invoice based on table the layout you reccomened (woud this need to be based on an a4 sheet).

Then What? COuld yu run through what steps would be required (i need a verison online and a version i can pdf)
If i can create an excel version server side, is it possible to automatically pdf it before i download it??

Thanks for your quick responce.

-s-
0
 
SamsonChungCommented:
you are now mixing technologies.

if you really want to pdf something on the server side, you might want to call up MS Office scripting.

Basically, you tell the server to start Excel, fill in all the data, (this includes where to click), print it to pdf, where to safe the pdf, and then provides a link to the pdf in php.

that's a more complicated method, since it involves way more things then expected. I strong advise against it unless you are sure of either of the following.

1, you site's traffic is so light that no two person can create a pdf at the same time.  Else one might be forced to wait while the other gets all the attention, and their file is wiped once the 2nd one starts to run.

2. you generate pdfs and store them on your web server. and would only remove them after a certain time. Then just use a cron system, it is way better.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now