Add lunch options
Change-Id: Ic4569fce73d8b33f5084e95d44797cba735914d5
diff --git a/invoice.php b/invoice.php
index 7537753..d0beef2 100644
--- a/invoice.php
+++ b/invoice.php
@@ -12,7 +12,7 @@
function create_invoice(User $user)
{
- global $SERVICE_ACRONYM, $SERVICE_NAME, $SERVICE_LOGO, $REGULAR_CONFERENCE_FEE, $EARLYBIRD_CONFERENCE_FEE, $STUDENT_DISCOUNT, $CONFERENCE_DINNER;
+ global $SERVICE_ACRONYM, $SERVICE_NAME, $SERVICE_LOGO, $REGULAR_CONFERENCE_FEE, $EARLYBIRD_CONFERENCE_FEE, $STUDENT_DISCOUNT, $CONFERENCE_DINNER, $LUNCH;
$invoice = new InvoicePrinter("A4", "€", "en");
$invoice->lang['product'] = "Item";
@@ -36,6 +36,33 @@
$invoice->addItem('Conference Dinner', 'The conference dinner will take place on 20 July.', 1, false, $CONFERENCE_DINNER, false, $CONFERENCE_DINNER);
/* Add totals */
$invoice->addTotal('Total', $user->total_due);
+ $lunch_count = 0;
+ $lunch_details = "";
+ $i = 0;
+ if ($user->lunch_day_1) {
+ if ($i > 0)
+ $lunch_details .= ", ";
+ $lunch_count++;
+ $lunch_details .= "Day 1: " . $user->lunch_day_1;
+ $i++;
+ }
+ if ($user->lunch_day_2) {
+ if ($i > 0)
+ $lunch_details .= ", ";
+ $lunch_count++;
+ $lunch_details .= "Day 2: " . $user->lunch_day_2;
+ $i++;
+ }
+ if ($user->lunch_day_3) {
+ if ($i > 0)
+ $lunch_details .= ", ";
+ $lunch_count++;
+ $lunch_details .= "Day 3: " . $user->lunch_day_3;
+ $i++;
+ }
+
+ if ($lunch_count > 0)
+ $invoice->addItem('Lunch', $lunch_details, $lunch_count, false, $LUNCH, false, $lunch_count * $LUNCH);
// $invoice->addTotal('Discount', $STUDENT_DISCOUNT);
$invoice->addTotal('Total due', $user->total_due, true);