if ($accountSavings->budget == null) { // suppress Unspent from asset accounts with no budget $unspent = ''; $budgetPercent = ''; } } if (!$showBalance) { // RHS / expenses $balanceTitle = ''; if ($accountSavings->savingsParentId > 0) { // Savings account is present for this expense account $balanceTitle = "Savings balance: {$accountSavings->savingsBalance}"; } echo "\t\t<td title='{$accountSavings->savingsName}' style='text-align: right;'>" . format_currency($accountSavings->getSaved()) . "</td> \n" . "\t\t<td title='{$balanceTitle}' class='numeric'>" . format_currency($accountSavings->getToSave()) . "</td> \n"; } echo "\t\t<td class='numeric'>" . format_currency($unspent) . "</td> \n" . "\t\t<td class='numeric'>" . format_percent($budgetPercent, 0) . "</td> \n" . "\t</tr> \n"; } // End budget loop $balanceTotalString = format_currency($balanceTotal); $budgetTotalString = format_currency($budgetTotal); $transactionTotalString = format_currency($transactionTotal); $unspentTotalString = format_currency($unspentTotal); $savedTotalString = format_currency($savedTotal); $toSaveTotalString = format_currency($toSaveTotal); echo "\t<tr> \n" . "\t\t<td style='border-top: 1px solid black; border-bottom: 1px solid black;' " . " colspan=\"7\"> </td> \n" . "\t</tr> \n\n" . "\t<tr> \n" . "\t\t<td>Total</td> \n" . "\t\t<td class='total'>{$budgetTotalString}</td> \n" . "\t\t<td class='total'>{$transactionTotalString}</td> \n"; if ($showBalance) { echo "\t\t<td class='total'>{$balanceTotalString}</td> \n"; } if (!$showBalance) { echo "\t\t<td class='total'>{$savedTotalString}</td> \n" . "\t\t<td class='total'>{$toSaveTotalString}</td> \n"; }
function printISPTableEntry($category, $tip1, $tip2, $count, $total, $indent, $strong) { print "<tr>"; print "<th class='subhead'>"; print "<span class='tip' title='" . $tip1 . "'>"; print $indent . "<span class='tippy'>"; if ($strong) { print "<strong>"; } print $category; if ($strong) { print "</strong>"; } print "</span>"; print "</span>"; print "</th>"; print "<td class='right_td'>"; if ($strong) { print "<strong>"; } print try_number_format($count); print "</td>"; print "<td class='right_td'>"; print "<span class='tip_r' title='" . $tip2 . "'><span class='tippy'> "; if ($strong) { print "<strong>"; } print format_percent($count / $total, $count); if ($strong) { print "</strong>"; } print "</span></span></td>"; print "</tr>"; }
function summary_diff($curr = 0, $prev = 0) { $crawl_summary['curr'] = $curr; $crawl_summary['last'] = $prev; if ($crawl_summary['curr'] > $crawl_summary['last'] && $crawl_summary['last']) { $diff_tmp = format_percent(($crawl_summary['curr'] / $crawl_summary['last'] - 1) * 100); $crawl_summary['diff'] = '<span style="color:green;font-weight:bold;">↑ ' . $diff_tmp . '%</span>'; } else { if ($crawl_summary['curr'] < $crawl_summary['last'] && $crawl_summary['last']) { $diff_tmp = format_percent((1 - $crawl_summary['curr'] / $crawl_summary['last']) * 100); $crawl_summary['diff'] = '<span style="color:red;font-weight:bold;">↓ ' . $diff_tmp . '%</span>'; } else { $crawl_summary['diff'] = '—'; } } return $crawl_summary; }
$page_title = 'Receipt | Budget'; $alt_menu = getAddButton() . getBackButton(); // add Item form $addModel = new AddModel('Add', 'add_receipt_item'); $addModel->addRow('item_name', 'Item'); $addModel->addRow('amount', 'Amount'); $addModel->addRow('qty', 'Qty', 1); $addModel->addRow('category', 'Category'); $addModel->addRow('brand', 'Brand'); $addModel->addRow('size', 'Size'); $addModel->addRow('size_unit', 'Units'); $addModel->addRow('sale', 'Sale'); $addModel->addOptionBox('tax', 'Tax', ['13%', '0%']); $addModel->addRow('budget_id', 'budget_id', $id); // build items table model $itemsModel = new TableModel('Items', 'budget'); $itemsModel->addRow(array(TableView2::createCell('total', 'total', 'th'), TableView2::createCell('qty', 'qty', 'th'), TableView2::createCell('tax', 'tax', 'th'), TableView2::createCell('amount', 'Amount', 'th'), TableView2::createCell('item_name', 'Item', 'th'), TableView2::createCell('category', 'Category', 'th'), TableView2::createCell('brand', 'Brand', 'th'), TableView2::createCell('size', 'Size', 'th'), TableView2::createCell('units', 'units', 'th'), TableView2::createCell('sale', 'sale', 'th'), TableView2::createCell())); while (($items_row = mysql_fetch_array($items)) != null) { $item_total = $items_row['amount'] * $items_row['qty'] * (1 + $items_row['tax']); $itemsModel->addRow(array(TableView2::createCell('total', format_currency($item_total)), TableView2::createCell('qty', $items_row['qty']), TableView2::createCell('tax', format_percent($items_row['tax'])), TableView2::createCell('amount', format_currency($items_row['amount'])), TableView2::createCell('item_name', $items_row['item_name']), TableView2::createCell('category', $items_row['category']), TableView2::createCell('brand', $items_row['brand']), TableView2::createCell('size', $items_row['size']), TableView2::createCell('units', $items_row['size_unit']), TableView2::createCell('sale', $items_row['sale']), TableView2::createEdit($items_row['BUDGET_ITEM_ID'], 'editItem.php'))); $receipt_total += $item_total; } // build budget table model $budgetModel = new TableModel('', 'budget'); $budgetModel->addRow(array(TableView2::createCell('total', 'Total', 'th'), TableView2::createCell('store', 'Store', 'th'), TableView2::createCell('date', 'Date', 'th'))); $budgetModel->addRow(array(TableView2::createCell('amount', format_currency($receipt_total)), TableView2::createCell('store', $spending_history_data['store']), TableView2::createCell('date', $spending_history_data['date']))); $views_to_load[] = ' ' . AddView2::render($addModel); $views_to_load[] = ' ' . TableView2::render($budgetModel); $views_to_load[] = ' ' . TableView2::render($itemsModel); include $relative_base_path . 'views/_generic.php'; }
public function getChangePercent($formated = false) { return $formated ? format_percent($this->change_percent) : $this->change_percent; }