From 2acc7787e73c966c3fc1794d77dd758a3f56b566 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 27 Jul 2016 21:29:57 +0200 Subject: Offer: use Model --- nav.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nav.php') diff --git a/nav.php b/nav.php index 29fd1b2..027b4b1 100644 --- a/nav.php +++ b/nav.php @@ -46,17 +46,17 @@ $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) - $list[str_pad($percentage, 3, '0', STR_PAD_LEFT) . $offer->getStartDate()] = array( + $list[str_pad($percentage, 3, '0', STR_PAD_LEFT) . $offer->start_date] = array( 'start' => $start, 'end' => $end, - 'id' => $offer->getId(), + 'id' => $offer->id, 'contactClientName' => $offer->getContact()->getClient()->name, 'percentage' => $percentage, 'price' => Constants::invoice_valuta . $offer->calculate(offer::SUBTOTAL) -- cgit v1.2.3