The next part of the table is dynamically generated based on the retrieved data. First, PHP checks to see if the returned results are greater than zero. If they are, it then matches and lists the data from the database to the table headings: <? The action column is in itself very dynamic, in that it compares the invoice due date with today’s date and based on the result, shows an email reminder link. An invoice becomes overdue if it is 30 days late, in which case a red flag is displayed alongside the reminder link. You will also notice another query. This query interrogates the clientinvoice table to get the invoice description and totals. This query is located where it is because it needs the invoice ID of the current invoice in the "while loop." Finally, if the value in the $num_invoices() is less than one, then no rows have been returned by the query, so an appropriate message is shown: <? } Another feature of the "action’"column is that it displays a PDF logo. When you click on it, you automatically create a pdf invoice, that will have the name of the client and current date as its name, which you can then use to email to the client. I’ve not automated the process of emailing the PDF, as I’ve already dealt with emailing clients when an invoice is "unpaid" or overdue. Below is a screenshot of what our invoice is going to look like:
blog comments powered by Disqus |