Example #1
0
function edit_allocations_for_transaction($type, $trans_no)
{
    global $systypes_array;
    $cart = $_SESSION['alloc'];
    display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$cart->type], $cart->trans_no));
    display_heading($cart->person_name);
    display_heading2(_("Date:") . " <b>" . $cart->date_ . "</b>");
    display_heading2(_("Total:") . " <b>" . price_format($cart->bank_amount) . ' ' . $cart->currency . "</b>");
    if ($cart->currency != $cart->person_curr) {
        $total = _("Total in clearing currency:") . " <b>" . price_format($cart->amount) . "</b>" . sprintf(" %s (%s %s/%s)", $cart->person_curr, exrate_format($cart->bank_amount / $cart->amount), $cart->currency, $cart->person_curr);
        display_heading2($total);
    }
    echo "<br>";
    start_form();
    div_start('alloc_tbl');
    if (count($cart->allocs) > 0) {
        show_allocatable(true);
        submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
        submit('Process', _("Process"), true, _('Process allocations'), 'default');
        submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    } else {
        display_note(_("There are no unsettled transactions to allocate."), 0, 1);
        submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    }
    div_end();
    end_form();
}
Example #2
0
function voiding_controls()
{
    global $table_style2;
    start_form(false, true);
    start_table($table_style2);
    systypes_list_row(tr("Transaction Type:"), "filterType", null, true);
    text_row(tr("Transaction #:"), 'trans_no', null, 12, 12);
    date_row(tr("Voiding Date:"), 'date_');
    textarea_row(tr("Memo:"), 'memo_', null, 30, 4);
    end_table(1);
    if (!isset($_POST['ProcessVoiding'])) {
        submit_center('ProcessVoiding', tr("Void Transaction"));
    } else {
        display_note(tr("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1);
        submit_center_first('ConfirmVoiding', tr("Proceed"));
        submit_center_last('CancelVoiding', tr("Cancel"));
    }
    end_form();
}
Example #3
0
function edit_allocations_for_transaction($type, $trans_no)
{
    global $systypes_array;
    start_form();
    display_heading(_("Allocation of") . " " . $systypes_array[$_SESSION['alloc']->type] . " # " . $_SESSION['alloc']->trans_no);
    display_heading($_SESSION['alloc']->person_name);
    display_heading2(_("Date:") . " <b>" . $_SESSION['alloc']->date_ . "</b>");
    display_heading2(_("Total:") . " <b>" . price_format(-$_SESSION['alloc']->amount) . "</b>");
    echo "<br>";
    div_start('alloc_tbl');
    if (count($_SESSION['alloc']->allocs) > 0) {
        show_allocatable(true);
        submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
        submit('Process', _("Process"), true, _('Process allocations'), 'default');
        submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    } else {
        display_note(_("There are no unsettled transactions to allocate."), 0, 1);
        submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    }
    div_end();
    end_form();
}
Example #4
0
}
if (isset($_POST['AddItem'])) {
    handle_new_item();
}
if (isset($_POST['UpdateItem'])) {
    handle_update_item();
}
if (isset($_POST['CancelItemChanges'])) {
    line_start_focus();
}
//-----------------------------------------------------------------------------------------------
if (isset($_GET['NewAdjustment']) || !isset($_SESSION['adj_items'])) {
    handle_new_order();
}
//-----------------------------------------------------------------------------------------------
$textcart_mgr = new ItemsAdjTextCartManager();
$textcart_mgr->handle_post_request();
function display_order_in_tab($title, $cart)
{
    display_adjustment_items($title, $cart);
}
start_form();
display_order_header($_SESSION['adj_items']);
start_outer_table(TABLESTYLE, "width=70%", 10);
$textcart_mgr->tab_display(_("Adjustment Items"), $_SESSION['adj_items'], "display_order_in_tab");
adjustment_options_controls();
end_outer_table(1, false);
submit_center_first('Update', _("Update"), '', null);
submit_center_last('Process', _("Process Adjustment"), '', 'default');
end_form();
end_page();
display_po_items($_SESSION['PO']);
start_table(TABLESTYLE2);
textarea_row(_("Memo:"), 'Comments', null, 70, 4);
end_table(1);
div_start('controls', 'items_table');
$process_txt = _("Place Order");
$update_txt = _("Update Order");
$cancel_txt = _("Cancel Order");
if ($_SESSION['PO']->trans_type == ST_SUPPRECEIVE) {
    $process_txt = _("Process GRN");
    $update_txt = _("Update GRN");
    $cancel_txt = _("Cancel GRN");
} elseif ($_SESSION['PO']->trans_type == ST_SUPPINVOICE) {
    $process_txt = _("Process Invoice");
    $update_txt = _("Update Invoice");
    $cancel_txt = _("Cancel Invoice");
}
if ($_SESSION['PO']->order_has_items()) {
    if ($_SESSION['PO']->order_no) {
        submit_center_first('Commit', $update_txt, '', 'default');
    } else {
        submit_center_first('Commit', $process_txt, '', 'default');
    }
    submit_center_last('CancelOrder', $cancel_txt);
} else {
    submit_center('CancelOrder', $cancel_txt, true, false, 'cancel');
}
div_end();
//---------------------------------------------------------------------------------------------------
end_form();
end_page();
Example #6
0
    if (!isset($_POST['OrderDate'])) {
        $_POST['OrderDate'] = $_SESSION['PO']->orig_order_date;
    }
    if (!isset($_POST['Requisition'])) {
        $_POST['Requisition'] = $_SESSION['PO']->requisition_no;
    }
    if (!isset($_POST['Comments'])) {
        $_POST['Comments'] = $_SESSION['PO']->Comments;
    }
}
//---------------------------------------------------------------------------------------------------
start_form(false, true);
display_po_header($_SESSION['PO']);
echo "<br>";
display_po_items($_SESSION['PO']);
start_table($table_style2);
textarea_row(tr("Memo:"), 'Comments', null, 70, 4);
end_table(1);
if ($_SESSION['PO']->order_has_items()) {
    if ($_SESSION['PO']->order_no) {
        submit_center_first('Commit', tr("Update Order"));
    } else {
        submit_center_first('Commit', tr("Place Order"));
    }
    submit_center_last('CancelOrder', tr("Cancel Order"));
} else {
    submit_center('CancelOrder', tr("Cancel Order"));
}
//---------------------------------------------------------------------------------------------------
end_form();
end_page();
Example #7
0
}
if (isset($_POST['AddItem'])) {
    handle_new_item();
}
if (isset($_POST['UpdateItem'])) {
    handle_update_item();
}
//-----------------------------------------------------------------------------------------------
if (isset($_GET['NewDeposit']) || !isset($_SESSION['deposit_items'])) {
    handle_new_order();
}
//-----------------------------------------------------------------------------------------------
start_form(false, true);
display_order_header($_SESSION['deposit_items']);
start_table("{$table_style} width=90%", 10);
start_row();
echo "<td>";
display_gl_items(tr("Deposit Items"), $_SESSION['deposit_items']);
gl_options_controls();
echo "</td>";
end_row();
end_table(1);
if (!isset($_POST['Process'])) {
    submit_center_first('Update', tr("Update"));
    if ($_SESSION['deposit_items']->count_gl_items() >= 1) {
        submit_center_last('Process', tr("Process Deposit"));
    }
}
end_form();
//------------------------------------------------------------------------------------------------
end_page();
Example #8
0
function display_languages()
{
    global $table_style, $installed_languages, $dflt_lang, $GetText;
    $th = array(_("Language"), _("Name"), _("Encoding"), _("Right To Left"), _("Installed"), _("Available"), _("Default"), "", "");
    $currlang = $_SESSION["language"]->code;
    div_start('lang_tbl');
    start_form();
    //
    // select/display system locales support for sites using native gettext
    //
    if (function_exists('gettext')) {
        if (check_value('DisplayAll')) {
            array_insert($th, 7, _("Supported"));
        }
        start_table();
        check_row(_('Display also languages not supported by server locales'), 'DisplayAll', null, true);
        end_table();
    }
    start_table(TABLESTYLE);
    table_header($th);
    $k = 0;
    // get list of all (available and installed) langauges
    $langs = get_languages_list();
    foreach ($langs as $pkg_name => $lng) {
        if ($lng == 'C') {
            // skip default locale (aka no translation)
            continue;
        }
        $lang = $lng['code'];
        $lang_name = $lng['name'];
        $charset = $lng['encoding'];
        $rtl = @$lng['rtl'] == 'yes' || @$lng['rtl'] === true;
        $available = @$lng['available'];
        $installed = @$lng['version'];
        $id = @$lng['local_id'];
        if ($lang == $currlang) {
            start_row("class='stockmankobg'");
        } else {
            alt_table_row_color($k);
        }
        $support = $GetText->check_support($lang, $charset);
        if (function_exists('gettext') && !$support && !get_post('DisplayAll')) {
            continue;
        }
        label_cell($lang);
        label_cell($available ? get_package_view_str($lang, $lang_name) : $lang_name);
        label_cell($charset);
        label_cell($rtl ? _("Yes") : _("No"));
        label_cell($id === null ? _("None") : ($available && $installed ? $installed : _("Unknown")));
        label_cell($available ? $available : _("None"));
        label_cell($id === null ? '' : radio(null, 'CurDflt', $id, $dflt_lang == $lang, true), "align='center'");
        if (function_exists('gettext') && check_value('DisplayAll')) {
            label_cell($support ? _("Yes") : _("No"));
        }
        if (!$available && $lang != 'C') {
            // manually installed language
            button_cell('Edit' . $id, _("Edit"), _('Edit non standard language configuration'), ICON_EDIT);
        } elseif (check_pkg_upgrade($installed, $available)) {
            // outdated or not installed language in repo
            button_cell('Update' . $pkg_name, $installed ? _("Update") : _("Install"), _('Upload and install latest language package'), ICON_DOWN);
        } else {
            label_cell('');
        }
        if ($id !== null && $lang != $currlang && $lang != 'C') {
            delete_button_cell('Delete' . $id, _('Delete'));
            submit_js_confirm('Delete' . $id, sprintf(_("You are about to remove language \\'%s\\'.\nDo you want to continue ?"), $lang_name));
        } else {
            label_cell('');
        }
        end_row();
    }
    end_table();
    display_note(_("The marked language is the current language which cannot be deleted."), 0, 0, "class='currentfg'");
    br();
    submit_center_first('Refresh', _("Update default"), '', null);
    submit_center_last('Add', _("Add new language manually"), '', false);
    end_form();
    div_end();
}
Example #9
0
        label_cell($date_);
        if (!isset($_POST['amount' . $i])) {
            $_POST['amount' . $i] = '0';
        }
        amount_cells(null, 'amount' . $i, null, 15, null, 0);
        if ($showdims) {
            $d = get_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']);
            label_cell(number_format2($d, 0), "nowrap align=right");
            $btotal += $d;
        }
        $lamount = get_gl_trans_from_to(add_years($date_, -1), add_years(end_month($date_), -1), $_POST['account'], $_POST['dim1'], $_POST['dim2']);
        $total += input_num('amount' . $i);
        $ltotal += $lamount;
        label_cell(number_format2($lamount, 0), "nowrap align=right");
        $date_ = add_months($date_, 1);
        end_row();
    }
    start_row();
    label_cell("<b>" . tr("Total") . "</b>");
    label_cell("<b>" . number_format2($total, 0) . "</b>", 'align=right');
    if ($showdims) {
        label_cell("<b>" . number_format2($btotal, 0) . "</b>", "nowrap align=right");
    }
    label_cell("<b>" . number_format2($ltotal, 0) . "</b>", "nowrap align=right");
    end_row();
    end_table(1);
    submit_center_first('add', tr("Save"));
    submit_center_last('delete', tr("Delete"));
}
end_form();
end_page();
Example #10
0
    hidden('cogs_account', $_POST['cogs_account']);
    hidden('adjustment_account', $_POST['adjustment_account']);
}
if (is_manufactured($_POST['mb_flag'])) {
    gl_all_accounts_list_row(tr("Item Assembly Costs Account:"), 'assembly_account', $_POST['assembly_account']);
} else {
    hidden('assembly_account', $_POST['assembly_account']);
}
$dim = get_company_pref('use_dimension');
if ($dim >= 1) {
    table_section_title(tr("Dimensions"));
    dimensions_list_row(tr("Dimension") . " 1", 'dimension_id', null, true, " ", false, 1);
    if ($dim > 1) {
        dimensions_list_row(tr("Dimension") . " 2", 'dimension2_id', null, true, " ", false, 2);
    }
}
if ($dim < 1) {
    hidden('dimension_id', 0);
}
if ($dim < 2) {
    hidden('dimension2_id', 0);
}
end_table(1);
if (!isset($_POST['NewStockID']) || isset($_POST['New']) && $_POST['New'] != "") {
    submit_center('addupdate', tr("Insert New Item"));
} else {
    submit_center_first('addupdate', tr("Update Item"));
    submit_center_last('delete', tr("Delete This Item"));
}
end_form();
end_page();
}
start_form();
hidden('cart_id');
$customer_error = display_order_header($_SESSION['Items'], $_SESSION['Items']->any_already_delivered() == 0, $idate);
if ($customer_error == "") {
    start_table(TABLESTYLE, "width='80%'", 10);
    echo "<tr><td>";
    display_order_summary($orderitems, $_SESSION['Items'], true);
    echo "</td></tr>";
    echo "<tr><td>";
    display_delivery_details($_SESSION['Items']);
    echo "</td></tr>";
    end_table(1);
    if ($_SESSION['Items']->trans_no == 0) {
        submit_center_first('ProcessOrder', $porder, _('Check entered data and save document'), 'default');
        submit_center_last('CancelOrder', $cancelorder, _('Cancels document entry or removes sales order when editing an old document'));
        submit_js_confirm('CancelOrder', _('You are about to void this Document.\\nDo you want to continue?'));
    } else {
        submit_center_first('ProcessOrder', $corder, _('Validate changes and update document'), 'default');
        submit_center_last('CancelOrder', $cancelorder, _('Cancels document entry or removes sales order when editing an old document'));
        if ($_SESSION['Items']->trans_type == ST_SALESORDER) {
            submit_js_confirm('CancelOrder', _('You are about to cancel undelivered part of this order.\\nDo you want to continue?'));
        } else {
            submit_js_confirm('CancelOrder', _('You are about to void this Document.\\nDo you want to continue?'));
        }
    }
} else {
    display_error($customer_error);
}
end_form();
end_page();
table_section_title(_("Employee Informations"));
if (isset($selected_id) && $selected_id != '') {
    label_row(_("Employee ID:"), $_POST['empl_id']);
    hidden('empl_id', $_POST['empl_id']);
}
text_row(_("Employee Name *:"), 'empl_name', null, 28, 80);
textarea_row(_("Present Address:"), 'pre_address', null, 25, 2);
textarea_row(_("Permanent Address:"), 'per_address', null, 25, 2);
date_row(_("Date of Birth") . ":", 'date_of_birth');
text_row(_("Age:"), 'age', null, 3, 10);
text_row(_("Mobile Phone *:"), 'mobile_phone', null, 28, 40);
text_row(_("Email *:"), 'email', null, 28, 40);
table_section(2);
table_section_title(_("Employee Job Info"));
text_row(_("Grade:"), 'grade', null, 28, 10);
text_row(_("Department:"), 'department', null, 28, 40);
text_row(_("Designation:"), 'designation', null, 28, 40);
text_row(_("Gross Salary Per Month *:"), 'gross_salary', null, 28, 40);
text_row(_("Basic Salary Per Month *:"), 'basic_salary', null, 28, 40);
date_row(_("Date of Join") . ":", 'date_of_join');
end_outer_table(1);
if (isset($selected_id) && $selected_id != '') {
    submit_center_first('submit', _("Update Employee"), '', @$_REQUEST['popup'] ? true : 'default');
    submit('delete', _("Delete employee"), true, '', true);
    submit_center_last('cancel', _("Cancel"), _("Cancel Edition"), 'cancel');
} else {
    submit_center('submit', _("Add New Employee"), true, '', 'default');
}
div_end();
end_form();
end_page();
Example #13
0
if (isset($_POST['AddItem'])) {
    handle_new_item();
}
if (isset($_POST['UpdateItem'])) {
    handle_update_item();
}
//-----------------------------------------------------------------------------------------------
if (isset($_GET['NewTransfer']) || !isset($_SESSION['transfer_items'])) {
    handle_new_order();
}
//-----------------------------------------------------------------------------------------------
start_form(false, true);
display_order_header($_SESSION['transfer_items']);
start_table("{$table_style} width=70%", 10);
start_row();
echo "<td>";
display_transfer_items(tr("Items"), $_SESSION['transfer_items']);
transfer_options_controls();
echo "</td>";
end_row();
end_table(1);
if (!isset($_POST['Process'])) {
    if ($_SESSION['transfer_items']->count_items() >= 1) {
        submit_center_first('Update', tr("Update"));
        submit_center_last('Process', tr("Process Transfer"));
    } else {
        submit_center('Update', tr("Update"));
    }
}
end_form();
end_page();
Example #14
0
$k = 0;
$unkn = 0;
foreach (get_reports() as $rep => $descr) {
    alt_table_row_color($k);
    label_cell($rep == '' ? '-' : $rep, 'align=center');
    label_cell($descr == '' ? '???<sup>1)</sup>' : _($descr));
    $_POST['Prn' . $rep] = isset($prints[$rep]) ? $prints[$rep] : '';
    echo '<td>';
    echo printers_list('Prn' . $rep, null, $rep == '' ? _('Browser support') : _('Default'));
    echo '</td>';
    if ($descr == '') {
        $unkn = 1;
    }
    end_row();
}
end_table();
if ($unkn) {
    display_note('<sup>1)</sup>&nbsp;-&nbsp;' . _("no title was found in this report definition file."), 0, 1, '');
} else {
    echo '<br>';
}
div_start('controls');
if (get_post('profile_id') == '') {
    submit_center('submit', _("Add New Profile"), true, '', 'default');
} else {
    submit_center_first('submit', _("Update Profile"), _('Update printer profile'), 'default');
    submit_center_last('delete', _("Delete Profile"), _('Delete printer profile (only if not used by any user)'), true);
}
div_end();
end_form();
end_page();
Example #15
0
    echo "</td>\n";
    echo "</tr\n";
}
$dim = get_company_pref('use_dimension');
start_form(false, false, "", "accrual");
start_table(TABLESTYLE2);
date_row(_("Date"), 'date_', _('First date of Accruals'), true, 0, 0, 0, null, true);
start_row();
label_cell(_("Accrued Balance Account"), "class='label'");
gl_all_accounts_list_cells(null, 'acc_act', null, true, false, false, true);
end_row();
gl_all_accounts_list_row(_("Revenue / Cost Account"), 'res_act', null, true);
if ($dim >= 1) {
    dimensions_list_row(_("Dimension"), 'dimension_id', null, true, " ", false, 1);
}
if ($dim > 1) {
    dimensions_list_row(_("Dimension") . " 2", 'dimension2_id', null, true, " ", false, 2);
}
$url = "gl/view/accrual_trans.php?act=" . get_post('acc_act') . "&date=" . get_post('date_');
amount_row(_("Amount"), 'amount', null, null, viewer_link(_("Search Amount"), $url, "", "", ICON_VIEW));
frequency_list_row(_("Frequency"), 'freq', null);
text_row(_("Periods"), 'periods', null, 3, 3);
textarea_row(_("Memo"), 'memo_', null, 35, 3);
end_table(1);
submit_center_first('show', _("Show GL Rows"));
//,true,false,'process',ICON_SUBMIT);
submit_center_last('go', _("Process Accruals"));
//,true,false,'process',ICON_SUBMIT);
submit_js_confirm('go', _("Are you sure you want to post accruals?"));
end_form();
end_page();
Example #16
0
start_table("class='tablestyle_noborder'");
sales_types_list_row(tr("Sales Type/Price List:"), 'sales_type', $_POST['sales_type']);
$dim = get_company_pref('use_dimension');
if ($dim >= 1) {
    dimensions_list_row(tr("Dimension") . " 1:", 'dimension_id', $_POST['dimension_id'], true, " ", false, 1);
}
if ($dim > 1) {
    dimensions_list_row(tr("Dimension") . " 2:", 'dimension2_id', $_POST['dimension2_id'], true, " ", false, 2);
}
if ($dim < 1) {
    hidden('dimension_id', 0);
}
if ($dim < 2) {
    hidden('dimension2_id', 0);
}
percent_row(tr("Discount Percent:"), 'discount', $_POST['discount']);
percent_row(tr("Prompt Payment Discount Percent:"), 'pymt_discount', $_POST['pymt_discount']);
amount_row(tr("Credit Limit:"), 'credit_limit', $_POST['credit_limit']);
payment_terms_list_row(tr("Payment Terms:"), 'payment_terms', $_POST['payment_terms']);
credit_status_list_row(tr("Credit Status:"), 'credit_status', $_POST['credit_status']);
end_table();
end_table(1);
// outer table
if (isset($_POST['New'])) {
    submit_center('submit', tr("Add New Customer"));
} else {
    submit_center_first('submit', tr("Update Customer"));
    submit_center_last('delete', tr("Delete Customer"));
}
end_form();
end_page();
    if ($_POST['ProductionType'] == 0) {
        $_POST['quantity'] = -$_POST['quantity'];
    }
    $id = work_order_produce($_POST['selected_id'], $_POST['ref'], input_num('quantity'), $_POST['date_'], $_POST['memo_'], $close_wo);
    meta_forward($_SERVER['PHP_SELF'], "AddedID=" . $_POST['selected_id'] . "&date=" . $_POST['date_']);
}
//-------------------------------------------------------------------------------------
display_wo_details($_POST['selected_id']);
//-------------------------------------------------------------------------------------
start_form();
hidden('selected_id', $_POST['selected_id']);
//hidden('WOReqQuantity', $_POST['WOReqQuantity']);
$dec = get_qty_dec($wo_details["stock_id"]);
if (!isset($_POST['quantity']) || $_POST['quantity'] == '') {
    $_POST['quantity'] = qty_format(max($wo_details["units_reqd"] - $wo_details["units_issued"], 0), $wo_details["stock_id"], $dec);
}
start_table(TABLESTYLE2);
br();
ref_row(_("Reference:"), 'ref', '', $Refs->get_next(29));
if (!isset($_POST['ProductionType'])) {
    $_POST['ProductionType'] = 1;
}
yesno_list_row(_("Type:"), 'ProductionType', $_POST['ProductionType'], _("Produce Finished Items"), _("Return Items to Work Order"));
small_qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
date_row(_("Date:"), 'date_');
textarea_row(_("Memo:"), 'memo_', null, 40, 3);
end_table(1);
submit_center_first('Process', _("Process"), '', 'default');
submit_center_last('ProcessAndClose', _("Process And Close Order"), '', true);
end_form();
end_page();
Example #18
0
function edit_allocations_for_transaction($type, $trans_no)
{
    global $table_style;
    start_form(false, true);
    display_heading(sprintf(tr("Allocation of %s # %d"), systypes::name($_SESSION['alloc']->type), $_SESSION['alloc']->trans_no));
    display_heading($_SESSION['alloc']->person_name);
    display_heading2(tr("Date:") . " <b>" . $_SESSION['alloc']->date_ . "</b>");
    display_heading2(tr("Total:") . " <b>" . price_format($_SESSION['alloc']->amount) . "</b>");
    echo "<br>";
    if (count($_SESSION['alloc']->allocs) > 0) {
        start_table($table_style);
        $th = array(tr("Transaction Type"), tr("#"), tr("Date"), tr("Due Date"), tr("Amount"), tr("Other Allocations"), tr("This Allocation"), tr("Left to Allocate"), "", "");
        table_header($th);
        $k = $counter = $total_allocated = 0;
        foreach ($_SESSION['alloc']->allocs as $allocn_item) {
            alt_table_row_color($k);
            label_cell(systypes::name($allocn_item->type));
            label_cell(get_trans_view_str($allocn_item->type, $allocn_item->type_no));
            label_cell($allocn_item->date_, "align=right");
            label_cell($allocn_item->due_date, "align=right");
            amount_cell($allocn_item->amount);
            amount_cell($allocn_item->amount_allocated);
            if (!check_num('amount' . $counter)) {
                $_POST['amount' . $counter] = price_format($allocn_item->current_allocated);
            }
            amount_cells(null, 'amount' . $counter, $_POST['amount' . $counter]);
            $un_allocated = round($allocn_item->amount - $allocn_item->amount_allocated, 6);
            hidden("un_allocated" . $counter, $un_allocated);
            amount_cell($un_allocated);
            label_cell("<a href='#' name=Alloc{$counter} onclick='allocate_all(this.name.substr(5));return true;'>" . tr("All") . "</a>");
            label_cell("<a href='#' name=DeAll{$counter} onclick='allocate_none(this.name.substr(5));return true;'>" . tr("None") . "</a>");
            end_row();
            $total_allocated += input_num('amount' . $counter);
            $counter++;
        }
        label_row(tr("Total Allocated"), price_format($total_allocated), "colspan=6 align=right", "nowrap align=right id='total_allocated'");
        if ($_SESSION['alloc']->amount - $total_allocated < 0) {
            $font1 = "<font color=red>";
            $font2 = "</font>";
        } else {
            $font1 = $font2 = "";
        }
        $left_to_allocate = $_SESSION['alloc']->amount - $total_allocated;
        $left_to_allocate = price_format($left_to_allocate);
        label_row(tr("Left to Allocate"), $font1 . $left_to_allocate . $font2, "colspan=6 align=right ", "nowrap align=right id='left_to_allocate'");
        end_table(1);
        hidden('TotalNumberOfAllocs', $counter);
        //		hidden('left_to_allocate', $left_to_allocate);
        submit_center_first('UpdateDisplay', tr("Update"));
        submit('Process', tr("Process"));
    } else {
        display_note(tr("There are no unsettled transactions to allocate."), 0, 1);
    }
    submit_center_last('Cancel', tr("Back to Allocations"));
    end_form();
}
Example #19
0
            set_focus('name');
        }
        if (!isset($installed_extensions)) {
            $installed_extensions = array();
            update_extensions($installed_extensions);
        }
        subpage_title(_('Company Settings'));
        start_table(TABLESTYLE);
        text_row_ex(_("Company Name:"), 'name', 30);
        text_row_ex(_("Admin Login:"******"Admin Password:"******"Reenter Password:"******"Select Chart of Accounts:"), 'coa');
        languages_list_row(_("Select Default Language:"), 'lang');
        end_table(1);
        submit_center_first('back', _('<< Back'));
        submit_center_last('set_admin', _('Continue >>'));
        break;
    case '6':
        // final screen
        subpage_title(_('SerbizHub Suite ERP has been installed successsfully.'));
        display_note(_('Please do not forget to remove install wizard folder.'));
        session_unset();
        session_destroy();
        hyperlink_no_params($path_to_root . '/index.php', _('Click here to start.'));
        break;
}
hidden('Tests');
hidden('Page');
end_form(1);
end_page(false, false, true);
Example #20
0
    currencies_list_row(tr("Supplier's Currency:"), 'curr_code', null);
}
tax_groups_list_row(tr("Tax Group:"), 'tax_group_id', null);
payment_terms_list_row(tr("Payment Terms:"), 'payment_terms', null);
table_section_title(tr("Accounts"));
gl_all_accounts_list_row(tr("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
gl_all_accounts_list_row(tr("Purchase Account:"), 'purchase_account', $_POST['purchase_account']);
gl_all_accounts_list_row(tr("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
$dim = get_company_pref('use_dimension');
if ($dim >= 1) {
    table_section_title(tr("Dimension"));
    dimensions_list_row(tr("Dimension") . " 1:", 'dimension_id', null, true, " ", false, 1);
    if ($dim > 1) {
        dimensions_list_row(tr("Dimension") . " 2:", 'dimension2_id', null, true, " ", false, 2);
    }
}
if ($dim < 1) {
    hidden('dimension_id', 0);
}
if ($dim < 2) {
    hidden('dimension2_id', 0);
}
end_table(1);
if (!isset($_POST['New'])) {
    submit_center_first('submit', tr("Update Supplier"));
    submit_center_last('delete', tr("Delete Supplier"));
} else {
    submit_center('submit', tr("Add New Supplier Details"));
}
end_form();
end_page();
Example #21
0
function customer_settings($selected_id)
{
    global $SysPrefs, $path_to_root, $auto_create_branch;
    if (!$selected_id) {
        if (list_updated('customer_id') || !isset($_POST['CustName'])) {
            $_POST['CustName'] = $_POST['cust_ref'] = $_POST['address'] = $_POST['tax_id'] = '';
            $_POST['dimension_id'] = 0;
            $_POST['dimension2_id'] = 0;
            $_POST['sales_type'] = -1;
            $_POST['curr_code'] = get_company_currency();
            $_POST['credit_status'] = -1;
            $_POST['payment_terms'] = $_POST['notes'] = '';
            $_POST['discount'] = $_POST['pymt_discount'] = percent_format(0);
            $_POST['credit_limit'] = price_format($SysPrefs->default_credit_limit());
        }
    } else {
        $myrow = get_customer($selected_id);
        $_POST['CustName'] = $myrow["name"];
        $_POST['cust_ref'] = $myrow["debtor_ref"];
        $_POST['address'] = $myrow["address"];
        $_POST['tax_id'] = $myrow["tax_id"];
        $_POST['dimension_id'] = $myrow["dimension_id"];
        $_POST['dimension2_id'] = $myrow["dimension2_id"];
        $_POST['sales_type'] = $myrow["sales_type"];
        $_POST['curr_code'] = $myrow["curr_code"];
        $_POST['credit_status'] = $myrow["credit_status"];
        $_POST['payment_terms'] = $myrow["payment_terms"];
        $_POST['discount'] = percent_format($myrow["discount"] * 100);
        $_POST['pymt_discount'] = percent_format($myrow["pymt_discount"] * 100);
        $_POST['credit_limit'] = price_format($myrow["credit_limit"]);
        $_POST['notes'] = $myrow["notes"];
        $_POST['inactive'] = $myrow["inactive"];
    }
    start_outer_table(TABLESTYLE2);
    table_section(1);
    table_section_title(_("Name and Address"));
    text_row(_("Customer Name:"), 'CustName', $_POST['CustName'], 40, 80);
    text_row(_("Customer Short Name:"), 'cust_ref', null, 30, 30);
    textarea_row(_("Address:"), 'address', $_POST['address'], 35, 5);
    text_row(_("GSTNo:"), 'tax_id', null, 40, 40);
    if (!$selected_id || is_new_customer($selected_id)) {
        currencies_list_row(_("Customer's Currency:"), 'curr_code', $_POST['curr_code']);
    } else {
        label_row(_("Customer's Currency:"), $_POST['curr_code']);
        hidden('curr_code', $_POST['curr_code']);
    }
    sales_types_list_row(_("Sales Type/Price List:"), 'sales_type', $_POST['sales_type']);
    if ($selected_id) {
        record_status_list_row(_("Customer status:"), 'inactive');
    } elseif (isset($auto_create_branch) && $auto_create_branch == 1) {
        table_section_title(_("Branch"));
        text_row(_("Phone:"), 'phone', null, 32, 30);
        text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
        text_row(_("Fax Number:"), 'fax', null, 32, 30);
        email_row(_("E-mail:"), 'email', null, 35, 55);
        sales_persons_list_row(_("Sales Person:"), 'salesman', null);
    }
    table_section(2);
    table_section_title(_("Sales"));
    percent_row(_("Discount Percent:"), 'discount', $_POST['discount']);
    percent_row(_("Prompt Payment Discount Percent:"), 'pymt_discount', $_POST['pymt_discount']);
    amount_row(_("Credit Limit:"), 'credit_limit', $_POST['credit_limit']);
    payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']);
    credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']);
    $dim = get_company_pref('use_dimension');
    if ($dim >= 1) {
        dimensions_list_row(_("Dimension") . " 1:", 'dimension_id', $_POST['dimension_id'], true, " ", false, 1);
    }
    if ($dim > 1) {
        dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', $_POST['dimension2_id'], true, " ", false, 2);
    }
    if ($dim < 1) {
        hidden('dimension_id', 0);
    }
    if ($dim < 2) {
        hidden('dimension2_id', 0);
    }
    if ($selected_id) {
        start_row();
        echo '<td class="label">' . _('Customer branches') . ':</td>';
        hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php", '<b>' . (@$_REQUEST['popup'] ? _("Select or &Add") : _("&Add or Edit ")) . '</b>', "debtor_no=" . $selected_id . (@$_REQUEST['popup'] ? '&popup=1' : ''));
        end_row();
    }
    textarea_row(_("General Notes:"), 'notes', null, 35, 5);
    if (!$selected_id && isset($auto_create_branch) && $auto_create_branch == 1) {
        table_section_title(_("Branch"));
        locations_list_row(_("Default Inventory Location:"), 'location');
        shippers_list_row(_("Default Shipping Company:"), 'ship_via');
        sales_areas_list_row(_("Sales Area:"), 'area', null);
        tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
    }
    end_outer_table(1);
    div_start('controls');
    if (!$selected_id) {
        submit_center('submit', _("Add New Customer"), true, '', 'default');
    } else {
        submit_center_first('submit', _("Update Customer"), _('Update customer data'), @$_REQUEST['popup'] ? true : 'default');
        submit_return('select', $selected_id, _("Select this customer and return to document entry."));
        submit_center_last('delete', _("Delete Customer"), _('Delete customer data if have been never used'), true);
    }
    div_end();
}
Example #22
0
    $tagids = array();
    while ($tag = db_fetch($tags_result)) {
        $tagids[] = $tag['id'];
    }
    $_POST['account_tags'] = $tagids;
    hidden('account_code', $_POST['account_code']);
    hidden('selected_account', $selected_account);
    label_row(_("Account Code:"), $_POST['account_code']);
} else {
    if (!isset($_POST['account_code'])) {
        $_POST['account_tags'] = array();
        $_POST['account_code'] = $_POST['account_code2'] = '';
        $_POST['account_name'] = $_POST['account_type'] = '';
        $_POST['inactive'] = 0;
    }
    text_row_ex(_("Account Code:"), 'account_code', 15);
}
text_row_ex(_("Account Code 2:"), 'account_code2', 15);
text_row_ex(_("Account Name:"), 'account_name', 60);
gl_account_types_list_row(_("Account Group:"), 'account_type', null);
tag_list_row(_("Account Tags:"), 'account_tags', 5, TAG_ACCOUNT, true);
record_status_list_row(_("Account status:"), 'inactive');
end_table(1);
if ($selected_account == "") {
    submit_center('add', _("Add Account"), true, '', 'default');
} else {
    submit_center_first('update', _("Update Account"), '', 'default');
    submit_center_last('delete', _("Delete account"), '', true);
}
end_form();
end_page();
Example #23
0
if (isset($_POST['UpdateItem'])) {
    handle_update_item();
}
if (isset($_POST['CancelItemChanges'])) {
    line_start_focus();
}
//-----------------------------------------------------------------------------------------------
if (isset($_GET['NewTransfer']) || !isset($_SESSION['transfer_items'])) {
    handle_new_order();
}
//-----------------------------------------------------------------------------------------------
$textcart_mgr = new ItemsTransTextCartManager();
$textcart_mgr->handle_post_request();
function display_order_in_tab($title, $cart)
{
    display_transfer_items($title, $cart);
}
start_form();
display_order_header($_SESSION['transfer_items']);
start_table(TABLESTYLE, "width=70%", 10);
start_row();
echo "<td>";
$textcart_mgr->tab_display(_("Items"), $_SESSION['transfer_items'], "display_order_in_tab");
transfer_options_controls();
echo "</td>";
end_row();
end_table(1);
submit_center_first('Update', _("Update"), '', null);
submit_center_last('Process', _("Process Transfer"), '', 'default');
end_form();
end_page();
Example #24
0
function supplier_settings(&$supplier_id)
{
    start_outer_table(TABLESTYLE2);
    table_section(1);
    if ($supplier_id) {
        //SupplierID exists - either passed when calling the form or from the form itself
        $myrow = get_supplier($_POST['supplier_id']);
        $_POST['supp_name'] = $myrow["supp_name"];
        $_POST['supp_ref'] = $myrow["supp_ref"];
        $_POST['address'] = $myrow["address"];
        $_POST['supp_address'] = $myrow["supp_address"];
        $_POST['gst_no'] = $myrow["gst_no"];
        $_POST['website'] = $myrow["website"];
        $_POST['supp_account_no'] = $myrow["supp_account_no"];
        $_POST['bank_account'] = $myrow["bank_account"];
        $_POST['dimension_id'] = $myrow["dimension_id"];
        $_POST['dimension2_id'] = $myrow["dimension2_id"];
        $_POST['curr_code'] = $myrow["curr_code"];
        $_POST['payment_terms'] = $myrow["payment_terms"];
        $_POST['credit_limit'] = price_format($myrow["credit_limit"]);
        $_POST['tax_group_id'] = $myrow["tax_group_id"];
        $_POST['tax_included'] = $myrow["tax_included"];
        $_POST['payable_account'] = $myrow["payable_account"];
        $_POST['purchase_account'] = $myrow["purchase_account"];
        $_POST['payment_discount_account'] = $myrow["payment_discount_account"];
        $_POST['notes'] = $myrow["notes"];
        $_POST['inactive'] = $myrow["inactive"];
    } else {
        $_POST['supp_name'] = $_POST['supp_ref'] = $_POST['address'] = $_POST['supp_address'] = $_POST['tax_group_id'] = $_POST['website'] = $_POST['supp_account_no'] = $_POST['notes'] = '';
        $_POST['dimension_id'] = 0;
        $_POST['dimension2_id'] = 0;
        $_POST['tax_included'] = 0;
        $_POST['sales_type'] = -1;
        $_POST['gst_no'] = $_POST['bank_account'] = '';
        $_POST['payment_terms'] = '';
        $_POST['credit_limit'] = price_format(0);
        $company_record = get_company_prefs();
        $_POST['curr_code'] = $company_record["curr_default"];
        $_POST['payable_account'] = $company_record["creditors_act"];
        $_POST['purchase_account'] = '';
        // default/item's cogs account
        $_POST['payment_discount_account'] = $company_record['pyt_discount_act'];
    }
    table_section_title(_("Basic Data"));
    text_row(_("Supplier Name:"), 'supp_name', null, 42, 40);
    text_row(_("Supplier Short Name:"), 'supp_ref', null, 30, 30);
    text_row(_("GSTNo:"), 'gst_no', null, 42, 40);
    link_row(_("Website:"), 'website', null, 35, 55);
    if ($supplier_id && !is_new_supplier($supplier_id) && (key_in_foreign_table($_POST['supplier_id'], 'supp_trans', 'supplier_id') || key_in_foreign_table($_POST['supplier_id'], 'purch_orders', 'supplier_id'))) {
        label_row(_("Supplier's Currency:"), $_POST['curr_code']);
        hidden('curr_code', $_POST['curr_code']);
    } else {
        currencies_list_row(_("Supplier's Currency:"), 'curr_code', null);
    }
    tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
    text_row(_("Our Customer No:"), 'supp_account_no', null, 42, 40);
    table_section_title(_("Purchasing"));
    text_row(_("Bank Name/Account:"), 'bank_account', null, 42, 40);
    amount_row(_("Credit Limit:"), 'credit_limit', null);
    payment_terms_list_row(_("Payment Terms:"), 'payment_terms', null);
    //
    // tax_included option from supplier record is used directly in update_average_cost() function,
    // therefore we can't edit the option after any transaction waas done for the supplier.
    //
    if (is_new_supplier($supplier_id)) {
        check_row(_("Prices contain tax included:"), 'tax_included');
    } else {
        hidden('tax_included');
        label_row(_("Prices contain tax included:"), $_POST['tax_included'] ? _('Yes') : _('No'));
    }
    table_section_title(_("Accounts"));
    gl_all_accounts_list_row(_("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
    gl_all_accounts_list_row(_("Purchase Account:"), 'purchase_account', $_POST['purchase_account'], false, false, _("Use Item Inventory/COGS Account"));
    gl_all_accounts_list_row(_("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
    if (!$supplier_id) {
        table_section_title(_("Contact Data"));
        text_row(_("Phone Number:"), 'phone', null, 32, 30);
        text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
    }
    table_section(2);
    $dim = get_company_pref('use_dimension');
    if ($dim >= 1) {
        table_section_title(_("Dimension"));
        dimensions_list_row(_("Dimension") . " 1:", 'dimension_id', null, true, " ", false, 1);
        if ($dim > 1) {
            dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', null, true, " ", false, 2);
        }
    }
    if ($dim < 1) {
        hidden('dimension_id', 0);
    }
    if ($dim < 2) {
        hidden('dimension2_id', 0);
    }
    table_section_title(_("Addresses"));
    textarea_row(_("Mailing Address:"), 'address', null, 35, 5);
    textarea_row(_("Physical Address:"), 'supp_address', null, 35, 5);
    table_section_title(_("General"));
    textarea_row(_("General Notes:"), 'notes', null, 35, 5);
    if ($supplier_id) {
        record_status_list_row(_("Supplier status:"), 'inactive');
    } else {
        table_section_title(_("Contact Data"));
        text_row(_("Contact Person:"), 'contact', null, 42, 40);
        text_row(_("Fax Number:"), 'fax', null, 32, 30);
        email_row(_("E-mail:"), 'email', null, 35, 55);
        languages_list_row(_("Document Language:"), 'rep_lang', null, _('System default'));
    }
    end_outer_table(1);
    div_start('controls');
    if ($supplier_id) {
        submit_center_first('submit', _("Update Supplier"), _('Update supplier data'), @$_REQUEST['popup'] ? true : 'default');
        submit_return('select', get_post('supplier_id'), _("Select this supplier and return to document entry."));
        submit_center_last('delete', _("Delete Supplier"), _('Delete supplier data if have been never used'), true);
    } else {
        submit_center('submit', _("Add New Supplier Details"), true, '', 'default');
    }
    div_end();
}
$_POST['ChargeFreightCost'] = get_post('ChargeFreightCost', price_format($_SESSION['Items']->freight_cost));
$colspan = 9;
start_row();
label_cell(_("Shipping Cost"), "colspan={$colspan} align=right");
small_amount_cells(null, 'ChargeFreightCost', $_SESSION['Items']->freight_cost);
end_row();
$inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
$display_sub_total = price_format($inv_items_total + input_num('ChargeFreightCost'));
label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
$taxes = $_SESSION['Items']->get_taxes(input_num('ChargeFreightCost'));
$tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['Items']->tax_included);
$display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total);
label_row(_("Amount Total"), $display_total, "colspan={$colspan} align=right", "align=right");
end_table(1);
if ($has_marked) {
    display_note(_("Marked items have insufficient quantities in stock as on day of delivery."), 0, 1, "class='stockmankofg'");
}
start_table(TABLESTYLE2);
policy_list_row(_("Action For Balance"), "bo_policy", null);
textarea_row(_("Memo"), 'Comments', null, 50, 4);
end_table(1);
div_end();
submit_center_first('Update', _("Update"), _('Refresh document page'), true);
if (isset($_POST['clear_quantity'])) {
    submit('reset_quantity', _('Reset quantity'), true, _('Refresh document page'));
} else {
    submit('clear_quantity', _('Clear quantity'), true, _('Refresh document page'));
}
submit_center_last('process_delivery', _("Process Dispatch"), _('Check entered data and save document'), 'default');
end_form();
end_page();
Example #26
0
                $_POST[$line->line_no] = number_format2(0, get_qty_dec($line->stock_id));
            }
            if (!isset($_POST['DefaultReceivedDate']) || $_POST['DefaultReceivedDate'] == "") {
                $_POST['DefaultReceivedDate'] = new_doc_date();
            }
            $_SESSION['PO']->line_items[$line->line_no]->receive_qty = input_num($line->line_no);
            if (isset($_POST[$line->stock_id . "Desc"]) && strlen($_POST[$line->stock_id . "Desc"]) > 0) {
                $_SESSION['PO']->line_items[$line->line_no]->item_description = $_POST[$line->stock_id . "Desc"];
            }
        }
    }
    $Ajax->activate('grn_items');
}
//--------------------------------------------------------------------------------------------------
if (isset($_POST['ProcessGoodsReceived'])) {
    process_receive_po();
}
//--------------------------------------------------------------------------------------------------
start_form();
edit_grn_summary($_SESSION['PO'], true);
display_heading(_("Items to Receive"));
display_po_receive_items();
echo '<br>';
submit_center_first('Update', _("Update"), '', true);
submit_center_last('ProcessGoodsReceived', _("Process Receive Items"), _("Clear all GL entry fields"), 'default');
end_form();
//--------------------------------------------------------------------------------------------------
end_page();
?>

Example #27
0
if (isset($_POST['AddItem'])) {
    handle_new_item();
}
if (isset($_POST['UpdateItem'])) {
    handle_update_item();
}
if (isset($_POST['CancelItemChanges'])) {
    line_start_focus();
}
if (isset($_POST['go'])) {
    display_quick_entries($_SESSION['pay_items'], $_POST['person_id'], input_num('totamount'), $_SESSION['pay_items']->trans_type == ST_BANKPAYMENT ? QE_PAYMENT : QE_DEPOSIT);
    $_POST['totamount'] = price_format(0);
    $Ajax->activate('totamount');
    line_start_focus();
}
//-----------------------------------------------------------------------------------------------
start_form();
display_bank_header($_SESSION['pay_items']);
start_table(TABLESTYLE2, "width=90%", 10);
start_row();
echo "<td>";
display_gl_items($_SESSION['pay_items']->trans_type == ST_BANKPAYMENT ? _("Payment Items") : _("Deposit Items"), $_SESSION['pay_items']);
gl_options_controls($_SESSION['pay_items']);
echo "</td>";
end_row();
end_table(1);
submit_center_first('Update', _("Update"), '', null);
submit_center_last('Process', $_SESSION['pay_items']->trans_type == ST_BANKPAYMENT ? _("Process Payment") : _("Process Deposit"), '', 'default');
end_form();
//------------------------------------------------------------------------------------------------
end_page();
function voiding_controls()
{
    global $selected_id;
    $not_implemented = array(ST_PURCHORDER, ST_SALESORDER, ST_SALESQUOTE, ST_COSTUPDATE);
    start_form();
    start_table(TABLESTYLE_NOBORDER);
    start_row();
    systypes_list_cells(_("Type:"), 'filterType', null, true, $not_implemented);
    if (list_updated('filterType')) {
        $selected_id = -1;
    }
    if (!isset($_POST['FromTransNo'])) {
        $_POST['FromTransNo'] = "1";
    }
    if (!isset($_POST['ToTransNo'])) {
        $_POST['ToTransNo'] = "999999";
    }
    ref_cells(_("from #:"), 'FromTransNo');
    ref_cells(_("to #:"), 'ToTransNo');
    submit_cells('ProcessSearch', _("Search"), '', '', 'default');
    end_row();
    end_table(1);
    $trans_ref = false;
    $sql = get_sql_for_view_transactions($_POST['filterType'], $_POST['FromTransNo'], $_POST['ToTransNo'], $trans_ref);
    if ($sql == "") {
        return;
    }
    $cols = array(_("#") => array('insert' => true, 'fun' => 'view_link'), _("Reference") => array('fun' => 'ref_view'), _("Date") => array('type' => 'date', 'fun' => 'date_view'), _("GL") => array('insert' => true, 'fun' => 'gl_view'), _("Select") => array('insert' => true, 'fun' => 'select_link'));
    $table =& new_db_pager('transactions', $sql, $cols);
    $table->width = "40%";
    display_db_pager($table);
    start_table(TABLESTYLE2);
    if ($selected_id != -1) {
        hidden('trans_no', $selected_id);
        hidden('selected_id', $selected_id);
    } else {
        hidden('trans_no', '');
        $_POST['memo_'] = '';
    }
    label_row(_("Transaction #:"), $selected_id == -1 ? '' : $selected_id);
    date_row(_("Voiding Date:"), 'date_');
    textarea_row(_("Memo:"), 'memo_', null, 30, 4);
    end_table(1);
    if (!isset($_POST['ProcessVoiding'])) {
        submit_center('ProcessVoiding', _("Void Transaction"), true, '', 'default');
    } else {
        if (!exist_transaction($_POST['filterType'], $_POST['trans_no'])) {
            display_error(_("The entered transaction does not exist or cannot be voided."));
            unset($_POST['trans_no']);
            unset($_POST['memo_']);
            unset($_POST['date_']);
            submit_center('ProcessVoiding', _("Void Transaction"), true, '', 'default');
        } else {
            display_warning(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1);
            br();
            submit_center_first('ConfirmVoiding', _("Proceed"), '', true);
            submit_center_last('CancelVoiding', _("Cancel"), '', 'cancel');
        }
    }
    end_form();
}
    }
    // if unassembling, negate quantity
    if ($_POST['ProductionType'] == 0) {
        $_POST['quantity'] = -$_POST['quantity'];
    }
    $id = work_order_produce($_POST['selected_id'], $_POST['ref'], $_POST['quantity'], $_POST['date_'], $_POST['memo_'], $close_wo);
    meta_forward($_SERVER['PHP_SELF'], "AddedID={$id}");
}
//-------------------------------------------------------------------------------------
display_wo_details($_POST['selected_id']);
//-------------------------------------------------------------------------------------
start_form();
hidden('selected_id', $_POST['selected_id']);
//hidden('WOReqQuantity', $_POST['WOReqQuantity']);
if (!isset($_POST['quantity']) || $_POST['quantity'] == '') {
    $_POST['quantity'] = max($wo_details["units_reqd"] - $wo_details["units_issued"], 0);
}
start_table();
ref_row(tr("Reference:"), 'ref', references::get_next(29));
if (!isset($_POST['ProductionType'])) {
    $_POST['ProductionType'] = 1;
}
yesno_list_row(tr("Type:"), 'ProductionType', $_POST['ProductionType'], tr("Produce Finished Items"), tr("Return Items to Work Order"));
text_row(tr("Quantity:"), 'quantity', $_POST['quantity'], 13, 15);
date_row(tr("Date:"), 'date_');
textarea_row(tr("Memo:"), 'memo_', null, 40, 3);
end_table(1);
submit_center_first('Process', tr("Process"));
submit_center_last('ProcessAndClose', tr("Process And Close Order"));
end_form();
end_page();
        $_POST['ChargeFreightCost'] = price_format(0);
    }
}
$accumulate_shipping = get_company_pref('accumulate_shipping');
if ($is_batch_invoice && $accumulate_shipping) {
    set_delivery_shipping_sum(array_keys($_SESSION['Items']->src_docs));
}
$colspan = 9;
start_row();
label_cell(_("Shipping Cost"), "colspan={$colspan} align=right");
small_amount_cells(null, 'ChargeFreightCost', null);
if ($is_batch_invoice) {
    label_cell('', 'colspan=2');
}
end_row();
$inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
$display_sub_total = price_format($inv_items_total + input_num('ChargeFreightCost'));
label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right", $is_batch_invoice ? 2 : 0);
$taxes = $_SESSION['Items']->get_taxes(input_num('ChargeFreightCost'));
$tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['Items']->tax_included, $is_batch_invoice ? 2 : 0);
$display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total);
label_row(_("Invoice Total"), $display_total, "colspan={$colspan} align=right", "align=right", $is_batch_invoice ? 2 : 0);
end_table(1);
div_end();
start_table(TABLESTYLE2);
textarea_row(_("Memo"), 'Comments', null, 50, 4);
end_table(1);
submit_center_first('Update', _("Update"), _('Refresh document page'), true);
submit_center_last('process_invoice', _("Process Invoice"), _('Check entered data and save document'), 'default');
end_form();
end_page();