Пример #1
0
 /**
  * The constructor of AddModel
  */
 public function __construct()
 {
     try {
         AddModel::init();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
Пример #2
0
         break;
     case 'delete_item_by_id':
         $id = BudgetManager::getBudgetIdFromItemId($item_id);
         $db_delete_success = BudgetManager::deleteItemRecord($item_id);
         break;
     case 'add_budget_item':
         $id = BudgetManager::addRecord($store, $date);
         break;
 }
 $spending_history_data = BudgetManager::getRecord($id);
 $items = BudgetManager::getItems($id);
 $receipt_total = 0;
 $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']);
Пример #3
0
 $startdate = request_isset('startdate');
 $enddate = request_isset('enddate');
 switch ($page_action) {
     case 'update_by_id':
         $db_update_success = BudgetManager::updateRecurringRecord($id, $amount, $category, $store, $items, $startdate, $enddate);
         break;
     case 'add_budget_item':
         $db_add_success = BudgetManager::addRecurringRecord($amount, $category, $store, $items, $startdate, $enddate);
         break;
     case 'delete_by_id':
         $db_delete_success = BudgetManager::deleteRecurringRecord($id);
         break;
 }
 $page_title = 'Recurring | Budget';
 $alt_menu = getAddButton() . getBackButton();
 $addModel = new AddModel('Add', 'add_budget_item');
 $addModel->addRow('amount', 'Amount');
 $addModel->addRow('category', 'Category');
 $addModel->addRow('store', 'Store');
 $addModel->addRow('items', 'Items');
 $addModel->addRow('startdate', 'Start Date', 'CURRENT_TIMESTAMP');
 $addModel->addRow('enddate', 'End Date', '2037-12-31 23:59:59');
 // build recurring table model
 $recurringModel = new TableModel('Recurring items', 'recurring');
 $recurringModel->addRow(array(TableView2::createCell('amount', 'Amount', 'th'), TableView2::createCell('category', 'Category', 'th'), TableView2::createCell('store', 'Store', 'th'), TableView2::createCell('items', 'Items', 'th'), TableView2::createCell()));
 $recurring_items_data = BudgetManager::getAllRecurring();
 while (($recurring_items_row = mysql_fetch_array($recurring_items_data)) != null) {
     $amount = $recurring_items_row['amount'];
     $category = $recurring_items_row['category'];
     $recurringModel->addRow(array(TableView2::createCell('amount', format_currency($amount)), TableView2::createCell('category', $category), TableView2::createCell('store', $recurring_items_row['store']), TableView2::createCell('items', $recurring_items_row['items']), TableView2::createEdit($recurring_items_row['RECURRING_ID'], 'editRecurring.php')));
     $total_spent += $amount;
Пример #4
0
     case 'update_by_id':
         $db_update_success = BookmarkManager::updateRecord($id, $title, $url);
         break;
     case 'add_bookmark':
         $db_update_success = BookmarkManager::addRecord($title, $url);
         break;
     case 'delete_by_id':
         $db_delete_success = BookmarkManager::deleteRecord($id);
         break;
 }
 $page_title = 'Bookmarks';
 $search_target = 'bookmarks';
 $bookmark_data = BookmarkManager::getAllRecords();
 $alt_menu = getAddButton() . getSearchButton();
 $searchModel = new SearchModel($search_target);
 $addModel = new AddModel('Add', 'add_bookmark');
 $addModel->addRow('title', 'Title');
 $addModel->addRow('url', 'URL');
 $bookmarkModel = new TableModel('', $search_target);
 /*$bookmarkModel->addRow ( array (
 			TableView2::createCell ('site', 'Site', 'th'),
 			TableView2::createCell ()
 		));*/
 while (($bookmark_row = mysql_fetch_array($bookmark_data)) != null) {
     $target = $sbookmark ? ' target="_blank"' : '';
     $bookmarkModel->addRow(array(TableView2::createCell('bookmark', '<a href="' . $bookmark_row['url'] . '" ' . $target . '>' . $bookmark_row['title'] . '</a>'), TableView2::createEdit($bookmark_row['BOOKMARK_ID'])));
 }
 $views_to_load = array();
 $views_to_load[] = ' ' . AddView2::render($addModel);
 $views_to_load[] = ' ' . SearchView::render($searchModel);
 $views_to_load[] = ' ' . TableView2::render($bookmarkModel);
Пример #5
0
         break;
 }
 $spending_history_data = BudgetManager::getAllRecords($year, $month);
 $filterDOM = '';
 if ($year != null) {
     $filterDOM .= "<input type='hidden' name='year' value='{$year}' />";
 }
 if ($month != null) {
     $filterDOM .= "<input type='hidden' name='month' value='{$month}' />";
 }
 $page_title = 'Budget';
 if (!(isset($_REQUEST['year']) && isset($_REQUEST['month']))) {
     $meta = "<meta http-equiv='refresh' content='0;url=index.php?year=" . date("Y") . "&month=" . date("m") . "' />";
 }
 $alt_menu = getAddButton() . ButtonView::render(new ButtonModel(IconView::render(new IconModel('arrows-ccw', 'Recurring')), 'recurring.php', 'recurring'));
 $addModel = new AddModel('Add', 'add_budget_item', 'receipt.php');
 $addModel->addRow('store', 'Store');
 $addModel->addRadioOption('dateOption-current', 'CURRENT_TIMESTAMP', 'dateOption', 'checked="checked"');
 $addModel->addRadioOption('dateOption-selectTime', 'Date/Time', 'dateOption');
 $addModel->addRow('selectTime-date', 'Date', '', 'YYYY-MM-DD');
 $addModel->addRow('selectTime-time', 'Time', '', 'HH:MM:SS');
 // build recurring table model
 $recurringModel = new TableModel('Recurring items', 'recurring');
 $recurringModel->addRow(array(TableView2::createCell('amount', 'Amount', 'th'), TableView2::createCell('category', 'Category', 'th'), TableView2::createCell('store', 'Store', 'th'), TableView2::createCell('items', 'Items', 'th')));
 $recurring_items_data = BudgetManager::getAllRecurringByMonth($year, $month);
 while (($recurring_items_row = mysql_fetch_array($recurring_items_data)) != null) {
     $amount = $recurring_items_row['amount'];
     $category = $recurring_items_row['category'];
     $recurringModel->addRow(array(TableView2::createCell('amount', format_currency($amount)), TableView2::createCell('category', $category), TableView2::createCell('store', $recurring_items_row['store']), TableView2::createCell('items', $recurring_items_row['items'])));
     $total_spent += $amount;
     $category_normalized = strtolower($category);