====== Invoice mailer ====== That a remake of old mailer which was send url to xlsx. Now we make invoice as PDF and send it the email message as attachment. And we keep old way to create invoice. To be sure about the invoices really go out we may review each step in queue to be sure about invoices really go out. ===== Email of cinema ===== Right now we support only one cinema email. That because of the folder name which the script generate to prepare new pdfs. To get invoice be scheduled -- cinema should have valid non-empty email. ===== Sending time ===== Based on dgbos approach we may schedule send moment as some hour::minute along a day. Right now it's 07:00 of the server time (while dgbos uses 08:00). ===== Maker queue ===== Based on server settings each invoice goes through next states -request to generate pdf file -- looks as "BVI15000" for example, a file without of extention -pdf file created, it rename "BVI15000" into "BVI15000.txt" and create the file "BVI15000.pdf" -when the invoice sent out -- the "BVI15000.txt" leaved for history, and "BVI15000.pdf" goes to the "sent" subfolder; new record into the table "invoice_reports" added with details about which email, and sending error if any ===== Preview queue ===== To be sure about the system works ok we have special read-only reviewer to show which invoices scheduled, which sent, or whatever. Available only for admin's by password. https://filmdistributionmanager.com/fdm/index.php/dashboard/ Some explanations *invoice_reports -- the table of all invoices sent out *prepared invoices -- all pdfs ready to send out *scheduled invoices -- invoices which ready to create pdfs (soon after box office sent flag to make it) *idle invoices -- invoices already sent, leaved for history ===== Possible troubles ===== *no free space on hard disk so pdf can not be created -- rare case since we use big hard disk for FDM server *email is wrong or sending bug -- we may see in "invoice_reports" table that is happen *invoices prepared but was not send -- probably because the autobot invoice sender is turned off