Esempio n. 1
0
        // make sure any entered rates are valid
        for ($i = 0; $i < 5; $i++) {
            if (isset($_POST['tax_type_id' . $i]) && $_POST['tax_type_id' . $i] != reserved_words::get_all_numeric() && !check_num('rate' . $i, 0)) {
                display_error(tr("An entered tax rate is invalid or less than zero."));
                $input_error = 1;
                set_focus('rate');
                break;
            }
        }
    }
    if ($input_error != 1) {
        // create an array of the taxes and array of rates
        $taxes = array();
        $rates = array();
        for ($i = 0; $i < 5; $i++) {
            if (isset($_POST['tax_type_id' . $i]) && $_POST['tax_type_id' . $i] != reserved_words::get_any_numeric()) {
                $taxes[] = $_POST['tax_type_id' . $i];
                $rates[] = input_num('rate' . $i);
            }
        }
        if ($selected_id != -1) {
            update_tax_group($selected_id, $_POST['name'], $_POST['tax_shipping'], $taxes, $rates);
        } else {
            add_tax_group($_POST['name'], $_POST['tax_shipping'], $taxes, $rates);
        }
        meta_forward($_SERVER['PHP_SELF']);
    }
}
//-----------------------------------------------------------------------------------
function can_delete($selected_id)
{
Esempio n. 2
0
function display_item_form()
{
    global $table_style2;
    start_table($table_style2, 5, 7);
    echo "<tr><td valign=top>";
    // outer table
    echo "<table>";
    if (!isset($_POST['customer_id'])) {
        $_POST['customer_id'] = get_global_customer(false);
    }
    if (!isset($_POST['DateBanked'])) {
        $_POST['DateBanked'] = Today();
        if (!is_date_in_fiscalyear($_POST['DateBanked'])) {
            $_POST['DateBanked'] = end_fiscalyear();
        }
    }
    customer_list_row(tr("From Customer:"), 'customer_id', null, false, true);
    if (db_customer_has_branches($_POST['customer_id'])) {
        customer_branches_list_row(tr("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
    } else {
        hidden('BranchID', reserved_words::get_any_numeric());
    }
    read_customer_data();
    set_global_customer($_POST['customer_id']);
    if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) {
        echo "</table></table>";
        display_note(tr("This customer account is on hold."), 0, 0, "class='redfb'");
    } else {
        $display_discount_percent = percent_format($_POST['pymt_discount'] * 100) . "%";
        amount_row(tr("Amount:"), 'amount');
        amount_row(tr("Amount of Discount:"), 'discount');
        label_row(tr("Customer prompt payment discount :"), $display_discount_percent);
        date_row(tr("Date of Deposit:"), 'DateBanked');
        echo "</table>";
        echo "</td><td valign=top class='tableseparator'>";
        // outer table
        echo "<table>";
        bank_accounts_list_row(tr("Into Bank Account:"), 'bank_account', null, true);
        $cust_currency = get_customer_currency($_POST['customer_id']);
        $bank_currency = get_bank_account_currency($_POST['bank_account']);
        if ($cust_currency != $bank_currency) {
            exchange_rate_display($cust_currency, $bank_currency, $_POST['DateBanked']);
        }
        bank_trans_types_list_row(tr("Type:"), 'ReceiptType', null);
        text_row(tr("Reference:"), 'ref', null, 20, 40);
        textarea_row(tr("Memo:"), 'memo_', null, 22, 4);
        echo "</table>";
        echo "</td></tr>";
        end_table();
        // outer table
        if ($cust_currency != $bank_currency) {
            display_note(tr("Amount and discount are in customer's currency."));
        }
        echo "<br>";
        submit_center('AddPaymentItem', tr("Add Payment"));
    }
    echo "<br>";
}
Esempio n. 3
0
if (isset($_GET['delete'])) {
    if (can_delete($selected_id)) {
        delete_account_type($selected_id);
        meta_forward($_SERVER['PHP_SELF']);
    }
}
//-----------------------------------------------------------------------------------
$result = get_account_types();
start_table($table_style);
$th = array(tr("Name"), tr("Subgroup Of"), tr("Class Type"), "", "");
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    $bs_text = get_account_class_name($myrow["class_id"]);
    if ($myrow["parent"] == reserved_words::get_any_numeric()) {
        $parent_text = "";
    } else {
        $parent_text = get_account_type_name($myrow["parent"]);
    }
    label_cell($myrow["name"]);
    label_cell($parent_text);
    label_cell($bs_text);
    edit_link_cell("selected_id=" . $myrow["id"]);
    delete_link_cell("selected_id=" . $myrow["id"] . "&delete=1");
    end_row();
}
end_table();
//-----------------------------------------------------------------------------------
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Account Group"));
start_form();