I have created my first php system, it basically is a list of customers which the user can select and log work for which generates a PDF work record.
I want to extend it to generate an invoice every Thursday midnight and send it to the business, eg:
User 1 has worked:
Customer a – 1 hour
Customer c – 2 hours
Customer D – 4 hours
Total 7 hours at (Chargeable rate).
Now in my head it seems pretty straight forward but I want to sense check it with people it possible:
When the PDF is generated I need to store the information in a new table, User ID, Customer name, Hours worked, Time & date. Then each Thursday I need a script to run which will transfer the entries from the database (over the past X days – could I say from ID X which was the last ID to be ran in the previous pdf?) to a PDF, save the pdf to the server and email it to me.
A few questions:
Would It be beneficial to clear this data after X day so the DB doesn’t get too big?
What is the best way to ensure that an entry doesn’t get missed? I will most likely run the script every thursday at midnight, but I’m guessing theres room for error there if somebody submits an entry at the same time? (slim chance but possible)
I’ll be using mPDF for the invoice generation which I already use.