Exemplo n.º 1
0
    if ($input_error != 1) {
        if (isset($_POST['PriceID'])) {
            //editing an existing price
            update_item_price($_POST['PriceID'], $_POST['sales_type_id'], $_POST['curr_abrev'], input_num('price'), input_num('factor'));
            $msg = tr("This price has been updated.");
        } elseif ($input_error != 1) {
            add_item_price($_POST['stock_id'], $_POST['sales_type_id'], $_POST['curr_abrev'], input_num('price'), input_num('factor'));
            display_note(tr("The new price has been added."));
        }
        clear_data();
    }
}
//------------------------------------------------------------------------------------------------------
if (isset($_GET['delete'])) {
    //the link to delete a selected record was clicked
    delete_item_price($_GET['PriceID']);
    echo tr("The selected price has been deleted.");
}
//---------------------------------------------------------------------------------------------------
$mb_flag = get_mb_flag($_POST['stock_id']);
$prices_list = get_prices($_POST['stock_id']);
start_table("{$table_style} width=30%");
$th = array(tr("Currency"), tr("Sales Type"), tr("Price"), tr("Factor"), "", "");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($prices_list)) {
    alt_table_row_color($k);
    label_cell($myrow["curr_abrev"]);
    label_cell($myrow["sales_type"]);
    amount_cell($myrow["price"]);
Exemplo n.º 2
0
        if ($selected_id != -1) {
            //editing an existing price
            update_item_price($selected_id, $_POST['sales_type_id'], $_POST['curr_abrev'], input_num('price'));
            $msg = _("This price has been updated.");
        } else {
            add_item_price($_POST['stock_id'], $_POST['sales_type_id'], $_POST['curr_abrev'], input_num('price'));
            $msg = _("The new price has been added.");
        }
        display_notification($msg);
        $Mode = 'RESET';
    }
}
//------------------------------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    //the link to delete a selected record was clicked
    delete_item_price($selected_id);
    display_notification(_("The selected price has been deleted."));
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
}
if (list_updated('stock_id')) {
    $Ajax->activate('price_table');
    $Ajax->activate('price_details');
}
if (list_updated('stock_id') || isset($_POST['_curr_abrev_update']) || isset($_POST['_sales_type_id_update'])) {
    // after change of stock, currency or salestype selector
    // display default calculated price for new settings.
    // If we have this price already in db it is overwritten later.
    unset($_POST['price']);