unset($_SESSION['supp_trans']);
    meta_forward($_SERVER['PHP_SELF'], "AddedID={$invoice_no}");
}
//--------------------------------------------------------------------------------------------------
if (isset($_POST['PostInvoice'])) {
    handle_commit_invoice();
}
//--------------------------------------------------------------------------------------------------
start_form(false, true);
start_table("{$table_style2} width=80%", 8);
echo "<tr><td valign=center>";
// outer table
echo "<center>";
invoice_header($_SESSION['supp_trans']);
echo "</td></tr><tr><td valign=center>";
// outer table
echo "<center>";
display_grn_items($_SESSION['supp_trans']);
display_gl_items($_SESSION['supp_trans']);
//echo "</td></tr><tr><td align=center colspan=2>"; // outer table
echo "<br>";
invoice_totals($_SESSION['supp_trans']);
echo "</td></tr>";
end_table();
// outer table
echo "<br>";
submit_center('PostInvoice', tr("Enter Invoice"));
echo "<br>";
end_form();
//--------------------------------------------------------------------------------------------------
end_page();
if ($bank_currency != $supplier_currency) {
    amount_row(_("Bank Amount:"), 'bank_amount', null, '', $bank_currency, 2);
}
amount_row(_("Bank Charge:"), 'charge', null, '', $bank_currency);
end_outer_table(1);
div_start('alloc_tbl');
show_allocatable(false);
div_end();
start_table(TABLESTYLE, "width=60%");
amount_row(_("Amount of Discount:"), 'discount', null, '', $supplier_currency);
amount_row(_("Amount of Payment:"), 'payment', null, '', $supplier_currency);
hidden("p2", $_POST['p2']);
textarea_row(_("Memo:"), 'memo_', null, 22, 4);
end_table(1);
br();
if ($_POST['supplier_id'] == '') {
    display_error(_("There is no supplier selected."));
} else {
    $b = str_replace(',', '', get_post('payment'));
    display_gl_items($_SESSION['alloc'], 1);
    div_start('inv_tot');
    invoice_totals($_SESSION['alloc'], $b);
    div_end();
}
if (get_post('AddGLCodeToTrans')) {
    $Ajax->activate('inv_tot');
}
br(2);
submit_center('ProcessSuppPayment', _("Enter Payment"), true, '', 'default');
end_form();
end_page();