From c50a323c25a0787ba2051b19721983776a229615 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 5 Feb 2015 00:40:47 +0100 Subject: Initial commit --- include/home.php | 274 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 include/home.php (limited to 'include/home.php') diff --git a/include/home.php b/include/home.php new file mode 100644 index 0000000..0be5f7e --- /dev/null +++ b/include/home.php @@ -0,0 +1,274 @@ +. + */ + +require_once('index.php'); +require('header.php'); +?> + +
+ + + +
+
+
+

Welcome

+
+ +
+ +
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+ + + +
+
+
+ = CURDATE()", "`invoice_date` IS NULL OR `invoice_date` = '1970-01-01'"))); + ?> +
+
+
+
+ +
+
+
+ +
+
+
+ + + +
+
+
+ '1970-01-01'", "`payment_received` <= '1970-01-01' OR `payment_received` IS NULL"))); + ?> +
+
+
+
+ +
+
+
+ +
+
+
+ + + +
+
+
+ +
+
+
+
+ Currently active offers +
+ +
+ = CURDATE()", "`invoice_date` IS NULL OR `invoice_date` = '1970-01-01'")); + $list = array(); + foreach ($offers as $offer) { + $start = BusinessAdmin::formatDate($offer->getStartDate(), false); + $end = BusinessAdmin::formatDate($offer->getEndDate(), false); + $since = mktime(0,0,0,date("n"),date("j"),date("Y")) - $offer->getStartDate(); + $total = $offer->getEndDate() - $offer->getStartDate(); + $percentage = ($total == 0) ? 100 : round($since / $total * 100); + + // We want to sort on percentage (DESC) and secondly end date (ASC) so start date (DESC) + $list[str_pad($percentage, 3, '0', STR_PAD_LEFT) . $offer->getStartDate()] = array( + 'start' => $start, + 'end' => $end, + 'id' => $offer->getId(), + 'contactClientName' => $offer->getContact()->getClient()->getName(), + 'percentage' => $percentage + ); + } + krsort($list, SORT_STRING); + foreach ($list as $item) { + echo "

#{$item['id']} to {$item['contactClientName']} ({$item['start']} - {$item['end']}){$item['percentage']}% complete

+
+
+
"; + } + if (count($list) == 0) { + echo "There are no currently active offers."; + } + ?> +
+ +
+ +
+
+
+
+ Currently open invoices +
+
+ + + + + + + + + + '1970-01-01'", "`payment_received` <= '1970-01-01' OR `payment_received` IS NULL")); + if (count($offers) == 0) { + echo ""; + } else { + foreach ($offers as $offer) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + } + ?> + +
#ContactInvoice sent
There are no currently open invoices.
{$offer->getId()}{$offer->getContact()->getClient()->getName()}".BusinessAdmin::formatDate($offer->getInvoiceDate(), false)."
+
+ +
+ +
+
+ +
+
+
+
+ Timeline +
+ +
+
    + $offer->getId(), + 'contact' => $offer->getContact()->getName(), + 'assignments' => '', + 'assignments_header' => '' + ); + foreach ($offer->getAssignments() as $assignment) { + $temp['assignments'] .= "{$assignment->getTitle()}
    (".constants::invoice_valuta."{$assignment->calculate(assignment::SUBTOTAL)} excl. VAT, ".constants::invoice_valuta."{$assignment->calculate(assignment::TOTAL)} incl. VAT)

    {$assignment->getDescription()}

    "; + $temp['assignments_header'] .= "{$assignment->getTitle()}
    (".constants::invoice_valuta."{$assignment->calculate(assignment::SUBTOTAL)} excl. VAT, ".constants::invoice_valuta."{$assignment->calculate(assignment::TOTAL)} incl. VAT)
    "; + } + $list[] = array_merge($temp, array('type' => 'start', 'time' => $offer->getStartDate(), 'description' => 'Offer started')); + $sort_list[] = $offer->getStartDate() . $offer->getId() . 0; + $list[] = array_merge($temp, array('type' => 'end', 'time' => $offer->getEndDate(), 'description' => 'Offer ended')); + $sort_list[] = $offer->getEndDate() . $offer->getId() . 1; + if ($offer->getInvoiceDate() > 0) { + $list[] = array_merge($temp, array('type' => 'invoice', 'time' => $offer->getInvoiceDate(), 'description' => 'Invoice sent')); + $sort_list[] = $offer->getInvoiceDate() . $offer->getId() . 2; + if ($offer->getPaymentReceived() > 0) { + $list[] = array_merge($temp, array('type' => 'payment_received', 'time' => $offer->getPaymentReceived(), 'description' => 'Payment received')); + $sort_list[] = $offer->getPaymentReceived() . $offer->getId() . 3; + } + } + } + array_multisort($sort_list, SORT_DESC, $list); + foreach ($list as $item) { + if ($item['time'] > time()) { + continue; + } + echo ""; + switch ($item['type']) { + case 'start': echo "
    "; break; + case 'end': echo "
    "; break; + case 'invoice': echo "
    "; break; + case 'payment_received': echo "
    "; break; + } + echo "
    "; + echo "

    #{$item['id']} to {$item['contact']}: {$item['description']}

    ".BusinessAdmin::formatDate($item['time'],false,true,true)."

    "; + switch ($item['type']) { + case 'start': echo "
    {$item['assignments']}
    "; break; + default: echo "
    {$item['assignments_header']}
    "; + } + echo "
    "; + echo ""; + } + if (count($list) == 0) { + echo '
  • +
    +
    +

    Welcome to BusinessAdmin!

    +
    When you start adding projects, a timeline will appear here.
    +
    +
  • '; + } + ?> +
+
+ +
+ +
+
+
+ + +
+ \ No newline at end of file -- cgit v1.2.3