Need a php script that will be passed a job number, get date from several mysql tables, display an html order form with data to browser (html will be provided), save a pdf copy of form to file folder on webserver, email pdf file to recipients from mysql. PHP will need to be commented so that I can understand the php code (not pdf conversion). Script will need to run on a shared host linux server.
## Deliverables
Script will be passed a job_name (CO09-1001)
query jobs table for job info
query orders table for order info
query order_items table for order items
query user, vendor and customer tables for contact information and email addresses
This is not an invoice and the script does not need to calculate totals or tax, etc..
Script will display order page in browser and offer the user a small button to press to accept the page, and a small button for the user to cancel the page which will send the user one page back in there browser.
If accepted, the button will cause a PDF file to be created (the PDF page should not contain the user buttons and otherwise be identical to the html display).
The PDF file will be saved in a server directory outside of /public_html in a directory which has sub-directories for each job_name. If the sub-directory for a given job_name does not already exist, the script should create the sub-directory based on the job_name. The filename for the PDF file will be based on jobs.job_name, orders.otype. If an identical filename exists, the user will be prompted to select 1) "replace" existing file 2) "add a postfix" to the filename (ie. 1, 2, 3, 4) 3) "cancel" the script and go back one page in the browser.
An email will be sent to the emails addresses contained in users and customers, who's key values (id) are held in [login to view URL] and [login to view URL] and look to [login to view URL] and then [login to view URL] which looks to [login to view URL] . The email will have the PDF file just created as an attachment. And I will provide text for subject and body of email.
The jobfiles table will be updated with a record for the newly created file.
The user will be flashed with a 2 second complete message and they will be returned back one page in there browser.
Done!