I have a database with food orders. I need a cronjob to run every Monday and generate invoices for each merchant for the week that just finished (Monday to Sunday and the script will run the next day, Monday morning).
The invoice will have only 2 entries/lines, Delivery and Pickup. Will only show the total amount of the orders for each type, how many orders on each type of order and our commission rate and amount
all the order data is on the table already calculated
And on a different table are the merchant details that can be pulled with the merchant ID
example of the invoice I need check the photo uploaded
Generate the pdf invoices for each merchant and save them to a table in the databe.
I will provide the SQL file with the tables and data