-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();
+//----------------------------------------------------------------------------------------------
+
+start_form();
+
+ hidden('trans_no', $_POST['trans_no']);
+ hidden('old_ref', $old_ref);
+
+ start_outer_table(TABLESTYLE2, "width=60%", 5);
+ table_section(1);
+
+ if ($new)
+ customer_list_row(_("From Customer:"), 'customer_id', null, false, true);
+ else {
+ label_cells(_("From Customer:"), $_POST['customer_name'], "class='label'");
+ hidden('customer_id', $_POST['customer_id']);
+ }
+
+ if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
+ $_SESSION['alloc']->read();
+ $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = '';
+ $Ajax->activate('alloc_tbl');
+ }
+
+ if (!isset($_POST['charge'])) // first page call
+ {
+ //Prepare allocation cart
+ if (isset($_POST['trans_no']) && $_POST['trans_no'] > 0 )
+ $_SESSION['alloc'] = new allocation(ST_CUSTPAYMENT,$_POST['trans_no']);
+ else
+ {
+ $_SESSION['alloc'] = new allocation(ST_CUSTPAYMENT,0);
+ $Ajax->activate('alloc_tbl');