diff options
author | Camil Staps | 2016-07-27 21:29:57 +0200 |
---|---|---|
committer | Camil Staps | 2016-07-27 21:29:57 +0200 |
commit | 2acc7787e73c966c3fc1794d77dd758a3f56b566 (patch) | |
tree | 1def501ec9502dee79f0f54a470434a3b322f6a2 /include/home.php | |
parent | Contact: use Model (diff) |
Offer: use Model
Diffstat (limited to 'include/home.php')
-rw-r--r-- | include/home.php | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/include/home.php b/include/home.php index f90d9d3..0ccff58 100644 --- a/include/home.php +++ b/include/home.php @@ -152,19 +152,19 @@ require('./header.php'); $offers = BusinessAdmin::getOffers($_pdo, array("`accepted`=1", "`start_date` <= CURDATE()", "`end_date` >= CURDATE()")); $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(); + $start = BusinessAdmin::formatDate($offer->start_date, false); + $end = BusinessAdmin::formatDate($offer->end_date, false); + $since = mktime(0,0,0,date("n"),date("j"),date("Y")) - $offer->start_date; + $total = $offer->end_date - $offer->start_date; $percentage = ($total == 0) ? 100 : round($since / $total * 100); // We want to sort on percentage (DESC) and secondly end date (ASC) so start date (DESC) - $base = str_pad($percentage, 3, '0', STR_PAD_LEFT) . $offer->getStartDate(); + $base = str_pad($percentage, 3, '0', STR_PAD_LEFT) . $offer->start_date; for ($i = 0; isset($list["$base-$i"]); $i++); $list["$base-$i"] = array( 'start' => $start, 'end' => $end, - 'id' => $offer->getId(), + 'id' => $offer->id, 'contactClientName' => $offer->getContact()->getClient()->name, 'percentage' => $percentage, 'price_excl' => Constants::invoice_valuta . $offer->calculate(offer::SUBTOTAL), @@ -207,9 +207,9 @@ require('./header.php'); $offers = BusinessAdmin::getOffers($_pdo, array("`accepted`=1", "`end_date` <= CURDATE()", "`invoice_date` IS NULL OR `invoice_date`='1970-01-01' OR `invoice_date`>CURDATE()")); foreach ($offers as $offer) { echo "<tr>"; - echo "<td>{$offer->getId()}</td>"; + echo "<td>{$offer->id}</td>"; echo "<td>{$offer->getContact()->getClient()->name}</td>"; - echo "<td>".BusinessAdmin::formatDate($offer->getEndDate(), false)."</td>"; + echo "<td>".BusinessAdmin::formatDate($offer->end_date, false)."</td>"; echo "</tr>"; } if (count($offers) == 0) { @@ -248,9 +248,9 @@ require('./header.php'); } else { foreach ($offers as $offer) { echo "<tr>"; - echo "<td>{$offer->getId()}</td>"; + echo "<td>{$offer->id}</td>"; echo "<td>{$offer->getContact()->getClient()->name}</td>"; - echo "<td>".BusinessAdmin::formatDate($offer->getInvoiceDate(), false)."</td>"; + echo "<td>".BusinessAdmin::formatDate($offer->invoice_date, false)."</td>"; echo "</tr>"; } } @@ -279,7 +279,7 @@ require('./header.php'); $sort_list = array(); foreach ($offers as $offer) { $temp = array( - 'id' => $offer->getId(), + 'id' => $offer->id, 'contact' => $offer->getContact()->name, 'assignments' => '', 'assignments_header' => '' @@ -288,16 +288,16 @@ require('./header.php'); $temp['assignments'] .= "<b>{$assignment->title}</b><br/><span class='smaller'>(".Constants::invoice_valuta."{$assignment->calculate(assignment::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(assignment::TOTAL)} incl. VAT)</span><br/><p>{$assignment->getHTMLDescription()}</p>"; $temp['assignments_header'] .= "<b>{$assignment->title}</b><br/><span class='smaller'>(".Constants::invoice_valuta."{$assignment->calculate(assignment::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(assignment::TOTAL)} incl. VAT)</span><br/>"; } - $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; + $list[] = array_merge($temp, array('type' => 'start', 'time' => $offer->start_date, 'description' => 'Offer started')); + $sort_list[] = $offer->start_date . $offer->id . 0; + $list[] = array_merge($temp, array('type' => 'end', 'time' => $offer->end_date, 'description' => 'Offer ended')); + $sort_list[] = $offer->end_date . $offer->id . 1; + if ($offer->invoice_date > 0) { + $list[] = array_merge($temp, array('type' => 'invoice', 'time' => $offer->invoice_date, 'description' => 'Invoice sent')); + $sort_list[] = $offer->invoice_date . $offer->id . 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; + $sort_list[] = $offer->getPaymentReceived() . $offer->id . 3; } } } |