$end_date = $_POST['end_date']; $net_multiplier = (int) $_POST['net_multiplier']; } $account1_id = $_POST['account1_id']; $account2_id = $_POST['account2_id']; } // Add or subtract display vars $net_sign = ' – '; // long dash $net_txt = 'Diff'; if ($net_multiplier != -1) { $net_sign = ' + '; $net_txt = 'Sum'; } // build account dropdowns $account_list = Account::Get_account_list($_SESSION['login_id']); $account1_dropdown = Build_dropdown($account_list, 'account1_id', $account1_id); $account2_dropdown = Build_dropdown($account_list, 'account2_id', $account2_id); // plus / minus dropdown $sum_list = array('-1' => 'Subtract', '1' => 'Add'); $sum_dropdown = Build_dropdown($sum_list, 'net_multiplier', $net_multiplier); // Get summary data $summary_list = array(); $error = Account::Get_summary_list($account1_id, $account2_id, $start_date, $end_date, $summary_list); $fuel_list = array(); if ($error == '') { // Get fuel consumption data $error = Account::Get_gas_totals($fuel_list); } ?>
$account = new Account(); $account->Load_account($account_id); // Show balance field for Assets, Liabilities and -99 (Checking - Liabilities) $showBalance = $account_id == -99 || $account->get_equation_side() == 'L'; $balanceHeader = ''; $savingsHeader = ''; if ($showBalance) { $balanceHeader = '<th onclick="sortBalance();">Balance</th>'; } else { $savingsHeader = "<th style='text-align: right;' onclick='sortSaved();'>Saved</th> \n" . "\t\t<th style='text-align: right;' onclick='sortToSave();'>To Save</th>"; } $activeOnlyChecked = $activeOnly ? 'checked="checked"' : ''; $startDateText = $startDate->format('m/d/Y'); $endDateText = $endDate->format('m/d/Y'); // build account dropdowns: include inactive, and only show top 2 tiers $account_list = Account::Get_account_list($login_id, '', -1, false, false, true, true); // Add special Checking - Liabilities option $top_item_array = array(); $top_item_array[-99] = 'Checking - Credit Cards'; $account_list = $top_item_array + $account_list; $account_dropdown = Build_dropdown($account_list, 'account_id', $account_id); $minDate = $startDate; if ($showBalance) { // when showing balance, we need to go back to the beginning. $minDate = new DateTime('0001-01-01'); } // Build main data list $account_list = array(); // pass by reference if ($error == '') { if ($account_id == -99) {
} if ($error == '') { $t3 = microtime(true); $pdo->commit(); $t4 = microtime(true); $txTime += $t2 - $t1 + $t4 - $t3; $message = 'Successfully saved ' . count($accountIds) . ' budget record(s)'; } else { // $pdo->rollBack(); } $pdo = NULL; $ps = NULL; } $budgetDateText = $budgetDate->format('m/Y'); // build account dropdowns: include inactive, and only show top 2 tiers $account_list = Account::Get_account_list($_SESSION['login_id'], '', -1, false, false, true, true); $account_dropdown = Build_dropdown($account_list, 'account_id', $account_id); // Build main data list $budget_list = array(); // pass by reference if ($error == '') { $error = Account::Get_account_budgets($budgetDate, $account_id, $budget_list); } // Get income transactions $income_list = array(); // pass by ref if ($error == '') { $error = Account::Get_income($budgetDate, $login_id, $income_list); } // Get total income $totalIncome = 0.0;
$login = new Login(); $login_id = -1; } } } elseif ($mode == 'select' && $fixed_login_id == -1) { $login_id = $_POST['login_id']; } if ($fixed_login_id > -1 || $mode == 'select' && $login_id > -1) { // fixed login OR new login selected $login->Load_login($login_id); } // Build dropdowns $login_list = Login::Get_login_list(); $login_list = array('-1' => '--Select login--') + $login_list; $login_input = Build_dropdown($login_list, 'login_id', $login_id); $acc_list = Account::Get_account_list($login_id); $acc_list = array('-1' => '--Select Account--') + $acc_list; $defAcc_dropdown = Build_dropdown($acc_list, 'default_account_id', $login->get_default_account_id()); $summ1_dropdown = Build_dropdown($acc_list, 'default_summary1', $login->get_default_summary1()); $summ2_dropdown = Build_dropdown($acc_list, 'default_summary2', $login->get_default_summary2()); $car_dropdown = Build_dropdown($acc_list, 'car_account_id', $login->get_car_account_id()); $admin_list = array('0' => 'Normal user', '1' => 'Account manager', '2' => 'System manager'); $admin_input = Build_dropdown($admin_list, 'login_admin', $login->get_login_admin()); $active_input = '<input type="checkbox" name="active" value="1"'; if ($login->get_active() == 1) { $active_input .= ' CHECKED'; } $active_input .= '>'; if ($fixed_login_id > -1) { // replace dropdown with fixed text $login_input = $login->get_login_user() . ' (' . $login->get_display_name() . ') <input type="hidden" ' . 'name="login_id" value="' . $fixed_login_id . '">';
} elseif ($sec_account_id != -1) { $error = $account->Load_account($sec_account_id); } elseif ($top_account_id != -1) { $error = $account->Load_account($top_account_id); } else { $error = 'Please select an account to edit'; } } // Build the account list dropdown $top_list = Account::Get_account_list($_SESSION['login_id'], '', NULL); $top_list = array('-1' => '--Select account--') + $top_list; $top_dropdown = Build_dropdown($top_list, 'top_account_id', $top_account_id, 'select_account()'); $sec_list = Account::Get_account_list($_SESSION['login_id'], '', $top_account_id, true); $sec_list = array('-1' => '--Select account--') + $sec_list; $sec_dropdown = Build_dropdown($sec_list, 'sec_account_id', $sec_account_id, 'select_account()'); $ter_list = Account::Get_account_list($_SESSION['login_id'], '', $sec_account_id, true); $ter_list = array('-1' => '--Select account--') + $ter_list; $ter_dropdown = Build_dropdown($ter_list, 'ter_account_id', $ter_account_id); // Build account_debit dropdown $debit_list = array('1' => 'Debit (assets, expenses)', '-1' => 'Credit (liabilities, income)'); $debit_dropdown = Build_dropdown($debit_list, 'account_debit', $account->get_account_debit()); // Build Equation side dropdown $side_list = array('L' => 'LHS (assets)', 'R' => 'RHS (revenue)'); $side_dropdown = Build_dropdown($side_list, 'equation_side', $account->get_equation_side()); // Savings account dropdown $savings_list = array(); $error = Account::Get_savings_accounts($_SESSION['login_id'], $savings_list); $savings_list = array('-1' => '--Select--') + $savings_list; $savings_dropdown = Build_dropdown($savings_list, 'savings_account_id', $account->get_savings_account_id()); // Active checkbox if ($account->get_active() == 1) {
<th>RHS Accounts</th> <th>RHS $</th> <th>RHS Accounts</th> <th>RHS $</th> </tr> <?php $show_inactive = 0; // only show inactive accounts when editing if ($editClick == 1) { $show_inactive = 1; } // Transaction dropdowns (account_id,account_debit as the key) $acctL_list = Account::Get_account_list($_SESSION['login_id'], 'L', -1, false, true, $show_inactive); $acctL_list = array('-1' => '--Select--') + $acctL_list; $acctR_list = Account::Get_account_list($_SESSION['login_id'], 'R', -1, false, true, $show_inactive); $acctR_list = array('-1' => '--Select--') + $acctR_list; // Get all the values from the LHS & RHS arrays // 0=ledger_id, 1=account_id/account_debit, 2=amount $j = 0; $listL = $trans->get_ledgerL_list(); $listR = $trans->get_ledgerR_list(); // create 5 rows of ledger adjustments (1 LHS column, 2 RHS columns) for ($i = 0; $i < 5; $i++) { // LHS $ledger = GetLedger($listL, $i); echo "\t<tr>\n" . ' <td><input type="hidden" name="ledgerL_id[]"' . " value='" . $ledger->ledgerId . "'> \n"; // Build account dropdown $acct_drop = Build_dropdown($acctL_list, 'accountL_id[]', $ledger->getAccountIdDebitString()); echo $acct_drop . "</td>\n" . "\t\t<td><input type='text' size='8' maxlength='10' " . "name='amountL[]' value='" . $ledger->amount . "'> </td> \n"; //RHS