From: Janusz Dobrowolski Date: Mon, 23 Jun 2008 21:01:28 +0000 (+0000) Subject: Ajax additions X-Git-Tag: v2.4.2~19^2~1978 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=c16b7a0f7aa17722568a0695e2fd03a362998372;p=fa-stable.git Ajax additions --- diff --git a/purchasing/allocations/supplier_allocate.php b/purchasing/allocations/supplier_allocate.php index 7ca1a764..995b2735 100644 --- a/purchasing/allocations/supplier_allocate.php +++ b/purchasing/allocations/supplier_allocate.php @@ -1,17 +1,15 @@ allocs); unset($_SESSION['alloc']); } - session_register("alloc"); } - //-------------------------------------------------------------------------------- function check_data() { $total_allocated = 0; - for ($counter=0; $counter < $_POST["TotalNumberOfAllocs"]; $counter++) + for ($counter = 0; $counter < $_POST["TotalNumberOfAllocs"]; $counter++) { - if (!check_num('amount' . $counter, 0)) { display_error(_("The entry for one or more amounts is invalid or negative.")); - set_focus('amount'); + set_focus('amount'.$counter); return false; } @@ -115,7 +109,6 @@ if (isset($_POST['Process'])) handle_process(); $_POST['Cancel'] = 1; } - $Ajax->update('_page_body'); } //-------------------------------------------------------------------------------- @@ -125,10 +118,6 @@ if (isset($_POST['Cancel'])) clear_allocations(); meta_forward($path_to_root . "/purchasing/allocations/supplier_allocation_main.php"); } -if (isset($_POST['UpdateDisplay'])) -{ - $Ajax->update('_page_body'); -} //-------------------------------------------------------------------------------- function get_allocations_for_transaction($type, $trans_no) @@ -190,6 +179,7 @@ function edit_allocations_for_transaction($type, $trans_no) echo "
"; + div_start('alloc_tbl'); if (count($_SESSION['alloc']->allocs) > 0) { start_table($table_style); @@ -210,20 +200,15 @@ function edit_allocations_for_transaction($type, $trans_no) amount_cell($alloc_item->amount); amount_cell($alloc_item->amount_allocated); - if (!isset($_POST['amount' . $counter]) || $_POST['amount' . $counter] == "") - $_POST['amount' . $counter] = price_format($alloc_item->current_allocated); + $_POST['amount' . $counter] = price_format($alloc_item->current_allocated); amount_cells(null, "amount" . $counter, price_format('amount' . $counter)); $un_allocated = round($alloc_item->amount - $alloc_item->amount_allocated, 6); - //hidden("un_allocated" . $counter, $un_allocated); amount_cell($un_allocated); label_cell("" . _("All") . ""); label_cell("" . _("None") . "".hidden("un_allocated" . $counter, $un_allocated, false)); - -// label_cell("" . _("All") . ""); -// label_cell("" . _("None") . ""); end_row(); $total_allocated += input_num('amount' . $counter); @@ -245,22 +230,20 @@ function edit_allocations_for_transaction($type, $trans_no) end_table(); hidden('TotalNumberOfAllocs', $counter); -// hidden('left_to_allocate', $left_to_allocate); - echo "
"; - submit('UpdateDisplay', _("Update"), true, '', true); - echo " "; - submit('Process', _("Process"), true, '', true); - echo " "; + + submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true); + submit('Process', _("Process"), true, _('Process allocations'), true); + submit_center_last('Cancel', _("Back to Allocations"), + _('Abandon allocations and return to selection of allocatable amounts'), true); } else { display_note(_("There are no unsettled transactions to allocate."), 0, 1); - echo "
"; + submit_center('Cancel', _("Back to Allocations"), true, + _('Abandon allocations and return to selection of allocatable amounts'), true); } - submit('Cancel', _("Back to Allocations"), true, '', true); - echo "


"; - + div_end(); end_form(); } @@ -270,6 +253,14 @@ if (isset($_GET['trans_no']) && isset($_GET['trans_type'])) { get_allocations_for_transaction($_GET['trans_type'], $_GET['trans_no']); } +if(get_post('UpdateDisplay')) +{ + $trans_no = $_SESSION['alloc']->trans_no; + $type = $_SESSION['alloc']->type; + clear_allocations(); + get_allocations_for_transaction($type, $trans_no); + $Ajax->activate('alloc_tbl'); +} if (isset($_SESSION['alloc'])) { diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index b583553f..6b3a0a12 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -178,12 +178,15 @@ function display_gl_items(&$supp_trans, $mode=0) echo "$heading"; if ($mode == 0) { - submit_cells('InvGL', _("Edit"), "align=right"); + submit_cells('InvGL', _("Edit"), "align=right", + _('Moves to additional costs posting page'), true); } echo ""; echo ""; // ouer table + start_form(); + div_start('gl_items'); echo ""; $dim = get_company_pref('use_dimension'); @@ -221,7 +224,8 @@ function display_gl_items(&$supp_trans, $mode=0) label_cell($entered_gl_code->memo_); if ($mode == 1) - delete_link_cell(SID . "Delete=" . $entered_gl_code->Counter); + edit_button_cell("Delete" . $entered_gl_code->Counter, _("Delete"), + _('Remove line from document')); end_row(); @@ -245,7 +249,8 @@ function display_gl_items(&$supp_trans, $mode=0) echo ""; end_table(); // outertable - + end_form(); + div_end(); return $total_gl_value; } @@ -281,17 +286,19 @@ function display_grn_items(&$supp_trans, $mode=0) $heading = _("Received Items Charged on this Invoice"); else $heading = _("Received Items Credited on this Note"); - echo "
"; echo ""; if ($mode == 0) { - submit_cells('InvGRN', _("Edit"), "align=right"); + submit_cells('InvGRN', _("Edit"), "align=right", + _('Moves to GRN selection page'), true); } echo "
$heading
"; echo ""; // outer table + div_start('grn_items'); + start_form(); echo ""; $th = array(_("Delivery Sequence #"), _("Item"), _("Description"), _("Quantity"), _("Price"), _("Line Value")); @@ -316,7 +323,8 @@ function display_grn_items(&$supp_trans, $mode=0) amount_cell( round($entered_grn->chg_price * abs($entered_grn->this_quantity_inv)), user_price_dec()); if ($mode == 1) - delete_link_cell(SID . "Delete=" . $entered_grn->id); + edit_button_cell("Delete" . $entered_grn->id, _("Delete"), + _('Remove item from document')); end_row(); @@ -335,11 +343,11 @@ function display_grn_items(&$supp_trans, $mode=0) label_row(_("Total"), price_format($total_grn_value), "colspan=5 align=right", "nowrap align=right"); echo "
"; - + end_form(); + div_end(); echo ""; end_table(); // outertable - return $total_grn_value; } diff --git a/purchasing/po_receive_items.php b/purchasing/po_receive_items.php index 039355e4..d79a5af7 100644 --- a/purchasing/po_receive_items.php +++ b/purchasing/po_receive_items.php @@ -47,6 +47,8 @@ if ((!isset($_GET['PONumber']) || $_GET['PONumber'] == 0) && !isset($_SESSION['P function display_po_receive_items() { global $table_style; + + div_start('grn_items'); start_table("colspan=7 $table_style width=90%"); $th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"), _("Outstanding"), _("This Delivery"), _("Price"), _("Total")); @@ -101,6 +103,7 @@ function display_po_receive_items() label_row(_("Total value of items received"), $display_total, "colspan=8 align=right", "nowrap align=right"); end_table(); + div_end(); } //-------------------------------------------------------------------------------------------------- @@ -215,7 +218,7 @@ function can_process() function process_receive_po() { - global $path_to_root; + global $path_to_root, $Ajax; if (!can_process()) return; @@ -229,6 +232,7 @@ function process_receive_po() unset($_SESSION['PO']->line_items); unset($_SESSION['PO']); unset($_POST['ProcessGoodsReceived']); + $Ajax->activate('_page_body'); exit; } @@ -276,6 +280,7 @@ if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived'])) $_SESSION['PO']->line_items[$line->line_no]->item_description = $_POST[$line->stock_id . "Desc"]; } } + $Ajax->activate('grn_items'); } //-------------------------------------------------------------------------------------------------- @@ -293,11 +298,9 @@ display_grn_summary($_SESSION['PO'], true); display_heading(_("Items to Receive")); display_po_receive_items(); -echo "
"; -submit('Update', _("Update")); -echo " "; -submit('ProcessGoodsReceived', _("Process Receive Items")); -echo "
"; +echo '
'; +submit_center_first('Update', _("Update"), '', true); +submit_center_last('ProcessGoodsReceived', _("Process Receive Items"), _("Clear all GL entry fields"), true); end_form(); diff --git a/purchasing/supplier_credit.php b/purchasing/supplier_credit.php index c16211be..8ae4e574 100644 --- a/purchasing/supplier_credit.php +++ b/purchasing/supplier_credit.php @@ -168,7 +168,7 @@ echo ""; end_table(1); // outer table -submit_center('PostCreditNote', _("Enter Credit Note")); +submit_center('PostCreditNote', _("Enter Credit Note"), true, '', true); echo "

"; end_form(); diff --git a/purchasing/supplier_credit_grns.php b/purchasing/supplier_credit_grns.php index cb50c66f..632255ed 100644 --- a/purchasing/supplier_credit_grns.php +++ b/purchasing/supplier_credit_grns.php @@ -1,13 +1,13 @@ remove_grn_from_trans($_GET['Delete']); + $_SESSION['supp_trans']->remove_grn_from_trans($id); + $Ajax->activate('grn_items'); + $Ajax->activate('grn_table'); } //----------------------------------------------------------------------------------------- display_grn_items($_SESSION['supp_trans'], 1); - echo "
"; hyperlink_no_params("$path_to_root/purchasing/supplier_credit.php", _("Return to Credit Note Entry")); @@ -104,6 +105,7 @@ if (db_num_rows($result) == 0) /*Set up a table to show the GRN items outstanding for selection */ start_form(false, true); +div_start('grn_table'); start_table("$table_style width=95%"); $th = array(_("Delivery"), _("Sequence #"), _("Order"), _("Item Code"), _("Description"), _("Delivered"), _("Total Qty Received"), _("Qty Already Invoiced"), @@ -128,7 +130,7 @@ while ($myrow = db_fetch($result)) alt_table_row_color($k); label_cell(get_trans_view_str(25, $myrow["grn_batch_id"])); - submit_cells('grn_item_id', $myrow["id"]); + submit_cells('grn_item_id'.$myrow["id"], $myrow["id"], '', '', true); label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"])); label_cell($myrow["item_code"]); label_cell($myrow["description"]); @@ -150,13 +152,27 @@ while ($myrow = db_fetch($result)) } end_table(); +div_end(); //----------------------------------------------------------------------------------------- +$id = find_submit('grn_item_id'); +if ($id || get_post('AddGRNToTrans')) +{ + $Ajax->activate('grn_selector'); +} +if (get_post('AddGRNToTrans')) +{ + $Ajax->activate('grn_table'); + $Ajax->activate('grn_items'); +} + -if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") +div_start('grn_selector'); +$id = find_submit('grn_item_id'); +if ($id != -1) { - $myrow = get_grn_item_detail($_POST['grn_item_id']); + $myrow = get_grn_item_detail($id); echo "
"; display_heading2(_("Delivery Item Selected For Adding To A Supplier Credit Note")); @@ -166,7 +182,7 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") table_header($th); start_row(); - label_cell($_POST['grn_item_id']); + label_cell($id); label_cell($myrow['item_code'] . " " . $myrow['description']); $dec = get_qty_dec($myrow['item_code']); qty_cell($myrow["quantity_inv"], false, $dec); @@ -176,9 +192,9 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") end_row(); end_table(1); - submit_center('AddGRNToTrans', _("Add to Credit Note")); + submit_center('AddGRNToTrans', _("Add to Credit Note"), true, '', true); - hidden('GRNNumber', $_POST['grn_item_id']); + hidden('GRNNumber', $id); hidden('item_code', $myrow['item_code']);; hidden('item_description', $myrow['description']); hidden('qty_recd', $myrow['qty_recd']); @@ -188,7 +204,9 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") hidden('po_detail_item', $myrow['po_detail_item']); } +div_end(); end_form(); -end_page(); +echo '
'; +end_page(false, true); ?> diff --git a/purchasing/supplier_invoice.php b/purchasing/supplier_invoice.php index 915ec27c..64a0850f 100644 --- a/purchasing/supplier_invoice.php +++ b/purchasing/supplier_invoice.php @@ -174,7 +174,7 @@ echo ""; end_table(); // outer table echo "
"; -submit_center('PostInvoice', _("Enter Invoice")); +submit_center('PostInvoice', _("Enter Invoice"), true, '', true); echo "
"; end_form(); diff --git a/purchasing/supplier_invoice_grns.php b/purchasing/supplier_invoice_grns.php index 0adbe8e9..b6d07411 100644 --- a/purchasing/supplier_invoice_grns.php +++ b/purchasing/supplier_invoice_grns.php @@ -2,10 +2,9 @@ $page_security = 5; $path_to_root=".."; -include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc"); +include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc"); include_once($path_to_root . "/includes/session.inc"); - include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc"); include_once($path_to_root . "/purchasing/includes/purchasing_db.inc"); @@ -14,7 +13,6 @@ if ($use_date_picker) $js .= get_js_date_picker(); page(_("Select Received Items to Add"), false, false, "", $js); - if (!isset($_SESSION['supp_trans'])) { display_note("To enter supplier transactions the supplier must first be selected from the supplier selection screen, then the link to enter a supplier credit note must be clicked on.", 1, 0);; @@ -86,11 +84,11 @@ if (isset($_POST['AddGRNToTrans'])) { if (input_num('this_quantity_inv') >= ($_POST['qty_recd'] - $_POST['prev_quantity_inv'])) { - $complete = True; + $complete = true; } else { - $complete = False; + $complete = false; } $_SESSION['supp_trans']->add_grn_to_trans($_POST['GRNNumber'], $_POST['po_detail_item'], @@ -102,17 +100,18 @@ if (isset($_POST['AddGRNToTrans'])) } //----------------------------------------------------------------------------------------- - -if (isset($_GET['Delete'])) +$id = find_submit('Delete'); +if ($id != -1) { - $_SESSION['supp_trans']->remove_grn_from_trans($_GET['Delete']); + $_SESSION['supp_trans']->remove_grn_from_trans($id); + $Ajax->activate('grn_items'); + $Ajax->activate('grn_table'); } //----------------------------------------------------------------------------------------- - display_grn_items($_SESSION['supp_trans'], 1); - echo "
"; + hyperlink_no_params("$path_to_root/purchasing/supplier_invoice.php", _("Back to Supplier Invoice Entry")); echo "
"; @@ -135,7 +134,7 @@ function display_grn_items_for_selection() start_form(false, true); display_heading2(_("Items Received Yet to be Invoiced")); - + div_start('grn_table'); start_table("$table_style colspan=7 width=95%"); $th = array(_("Delivery"), _("Sequence #"), _("P.O."), _("Item"), _("Description"), _("Received On"), _("Quantity Received"), _("Quantity Invoiced"), @@ -145,24 +144,23 @@ function display_grn_items_for_selection() while ($myrow = db_fetch($result)) { - - $grn_already_on_invoice = False; + $grn_already_on_invoice = false; foreach ($_SESSION['supp_trans']->grn_items as $entered_grn) { if ($entered_grn->id == $myrow["id"]) { - $grn_already_on_invoice = True; + $grn_already_on_invoice = true; } } - if ($grn_already_on_invoice == False) + if ($grn_already_on_invoice == false) { alt_table_row_color($k); label_cell(get_trans_view_str(25, $myrow["grn_batch_id"])); //text_cells(null, 'grn_item_id', $myrow["id"]); - submit_cells('grn_item_id', $myrow["id"]); + submit_cells('grn_item_id'.$myrow["id"], $myrow["id"], '', '', true); label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"])); label_cell($myrow["item_code"]); label_cell($myrow["description"]); @@ -186,18 +184,31 @@ function display_grn_items_for_selection() } end_table(); + div_end(); } //----------------------------------------------------------------------------------------- +if (find_submit('grn_item_id') || get_post('AddGRNToTrans')) +{ + $Ajax->activate('grn_selector'); +} +if (get_post('AddGRNToTrans')) +{ + $Ajax->activate('grn_table'); + $Ajax->activate('grn_items'); +} display_grn_items_for_selection(); //----------------------------------------------------------------------------------------- -if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") +div_start('grn_selector'); + +$id = find_submit('grn_item_id'); +if ($id != -1) { - $myrow = get_grn_item_detail($_POST['grn_item_id']); + $myrow = get_grn_item_detail($id); echo "
"; display_heading2(_("Delivery Item Selected For Adding To A Supplier Invoice")); @@ -207,7 +218,7 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") table_header($th); start_row(); - label_cell($_POST['grn_item_id']); + label_cell($id); label_cell($myrow['item_code']); label_cell($myrow['description']); $dec = get_qty_dec($myrow['item_code']); @@ -218,9 +229,9 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") end_row(); end_table(1);; - submit_center('AddGRNToTrans', _("Add to Invoice")); + submit_center('AddGRNToTrans', _("Add to Invoice"), true, '', true); - hidden('GRNNumber', $_POST['grn_item_id']); + hidden('GRNNumber', $id); hidden('item_code', $myrow['item_code']); hidden('item_description', $myrow['description']);; hidden('qty_recd', $myrow['qty_recd']); @@ -230,9 +241,12 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") hidden('po_detail_item', $myrow['po_detail_item']); } +div_end(); //---------------------------------------------------------------------------------------- end_form(); -end_page(); +echo '
'; +end_page(false, true); + ?> diff --git a/purchasing/supplier_trans_gl.php b/purchasing/supplier_trans_gl.php index b2b827fe..b652a1a6 100644 --- a/purchasing/supplier_trans_gl.php +++ b/purchasing/supplier_trans_gl.php @@ -21,27 +21,32 @@ if (!isset($_SESSION['supp_trans'])) } //------------------------------------------------------------------------------------------------ - function clear_fields() { + global $Ajax; + unset($_POST['gl_code']); unset($_POST['dimension_id']); unset($_POST['dimension2_id']); unset($_POST['amount']); unset($_POST['memo_']); - unset($_POST['AcctSelection']); unset($_POST['AddGLCodeToTrans']); + $Ajax->activate('gl_ctrls'); + set_focus('gl_code'); } - //------------------------------------------------------------------------------------------------ +// GL postings are often entered in the same form to two accounts +// so fileds are cleared only on user demand. +// +if (isset($_POST['ClearFields'])) +{ + clear_fields(); +} if (isset($_POST['AddGLCodeToTrans'])){ + $Ajax->activate('gl_items'); $input_error = false; - if (!isset($_POST['gl_code'])) - { - $_POST['gl_code'] = $_POST['AcctSelection']; - } $sql = "SELECT account_code, account_name FROM ".TB_PREF."chart_master WHERE account_code='" . $_POST['gl_code'] . "'"; $result = db_query($sql,"get account information"); @@ -68,16 +73,18 @@ if (isset($_POST['AddGLCodeToTrans'])){ $_SESSION['supp_trans']->add_gl_codes_to_trans($_POST['gl_code'], $gl_act_name, $_POST['dimension_id'], $_POST['dimension2_id'], input_num('amount'), $_POST['memo_']); - clear_fields(); + set_focus('gl_code'); } } //------------------------------------------------------------------------------------------------ -if (isset($_GET['Delete'])) +$id = find_submit('Delete'); +if ($id != -1) { - $_SESSION['supp_trans']->remove_gl_codes_from_trans($_GET['Delete']); + $_SESSION['supp_trans']->remove_gl_codes_from_trans($id); clear_fields(); + $Ajax->activate('gl_items'); } //------------------------------------------------------------------------------------------------ @@ -106,11 +113,12 @@ start_form(false, true); display_heading2(_("Enter a GL Line")); +div_start('gl_ctrls'); start_table($table_style2); $accs = get_supplier_accounts($_SESSION['supp_trans']->supplier_id); -$_POST['AcctSelection'] = $accs['purchase_account']; -gl_all_accounts_list_row(_("GL Account Selection:"), 'AcctSelection', $_POST['AcctSelection']); +$_POST['gl_code'] = $accs['purchase_account']; +gl_all_accounts_list_row(_("GL Account Selection:"), 'gl_code', null); $dim = get_company_pref('use_dimension'); if ($dim >= 1) dimensions_list_row(_("Dimension")." 1", 'dimension_id', null, true, " ", false, 1); @@ -124,13 +132,15 @@ amount_row( _("Amount:"), 'amount'); textarea_row(_("Memo:"), "memo_", null, 40, 2); -end_table();; - -submit_center('AddGLCodeToTrans', _("Add GL Line")); - +end_table(); +div_end(); +echo '
'; +submit_center_first('AddGLCodeToTrans', _("Add GL Line"), '', true); +submit_center_last('ClearFields', _('Reset'), _("Clear all GL entry fields"), true); end_form(); //------------------------------------------------------------------------------------------------ +echo '
'; +end_page(false, true); -end_page(); ?> diff --git a/sales/allocations/customer_allocate.php b/sales/allocations/customer_allocate.php index a3784720..d92cf39a 100644 --- a/sales/allocations/customer_allocate.php +++ b/sales/allocations/customer_allocate.php @@ -38,9 +38,9 @@ function check_data() for ($counter = 0; $counter < $_POST["TotalNumberOfAllocs"]; $counter++) { - if (!check_num('amount' . $counter)) + if (!check_num('amount' . $counter, 0)) { - display_error(_("The entry for one or more amounts is invalid.")); + display_error(_("The entry for one or more amounts is invalid or negative.")); set_focus('amount'.$counter); return false; } @@ -109,7 +109,6 @@ function handle_process() clear_allocations(); } - //-------------------------------------------------------------------------------- if (isset($_POST['Process'])) @@ -120,16 +119,13 @@ if (isset($_POST['Process'])) $_POST['Cancel'] = 1; } } - //-------------------------------------------------------------------------------- if (isset($_POST['Cancel'])) { clear_allocations(); meta_forward($path_to_root . "/sales/allocations/customer_allocation_main.php"); - exit; } - //-------------------------------------------------------------------------------- function get_allocations_for_transaction($type, $trans_no) @@ -155,7 +151,6 @@ function get_allocations_for_transaction($type, $trans_no) 0); // this allocation } - /* Now get trans that might have previously been allocated to by this trans NB existing entries where still some of the trans outstanding entered from above logic will be overwritten with the prev alloc detail below */ @@ -168,9 +163,7 @@ function get_allocations_for_transaction($type, $trans_no) sql2date($myrow["tran_date"]), sql2date($myrow["due_date"]), $myrow["Total"], $myrow["alloc"] - $myrow["amt"], $myrow["amt"]); } - } - //-------------------------------------------------------------------------------- function edit_allocations_for_transaction($type, $trans_no) @@ -187,7 +180,7 @@ function edit_allocations_for_transaction($type, $trans_no) echo "
"; start_form(false, true); - + div_start('alloc_tbl'); if (count($_SESSION['alloc']->allocs) > 0) { start_table($table_style); @@ -210,18 +203,14 @@ function edit_allocations_for_transaction($type, $trans_no) 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]); + $_POST['amount' . $counter] = price_format($allocn_item->current_allocated); + amount_cells(null, 'amount' . $counter, price_format('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("" . _("All") . ""); - //label_cell("" - // . _("None") . ""); label_cell("" . _("None") . "".hidden("un_allocated" . $counter, $un_allocated, false)); end_row(); @@ -246,17 +235,18 @@ function edit_allocations_for_transaction($type, $trans_no) end_table(1); hidden('TotalNumberOfAllocs', $counter); -// hidden('left_to_allocate', $left_to_allocate); - submit_center_first('UpdateDisplay', _("Update")); - submit('Process', _("Process")); - submit_center_last('Cancel', _("Back to Allocations")); + submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true); + submit('Process', _("Process"), true, _('Process allocations'), true); + submit_center_last('Cancel', _("Back to Allocations"),_('Abandon allocations and return to selection of allocatable amounts'), true); } else { display_note(_("There are no unsettled transactions to allocate."), 0, 1); - submit_center('Cancel', _("Back to Allocations")); + + submit_center('Cancel', _("Back to Allocations"), true, + _('Abandon allocations and return to selection of allocatable amounts'), true); } - + div_end(); end_form(); } @@ -266,6 +256,14 @@ if (isset($_GET['trans_no']) && isset($_GET['trans_type'])) { get_allocations_for_transaction($_GET['trans_type'], $_GET['trans_no']); } +if(get_post('UpdateDisplay')) +{ + $trans_no = $_SESSION['alloc']->trans_no; + $type = $_SESSION['alloc']->type; + clear_allocations(); + get_allocations_for_transaction($type, $trans_no); + $Ajax->activate('alloc_tbl'); +} if (isset($_SESSION['alloc'])) { diff --git a/sales/customer_credit_invoice.php b/sales/customer_credit_invoice.php index 2e8bb162..8d5a104a 100644 --- a/sales/customer_credit_invoice.php +++ b/sales/customer_credit_invoice.php @@ -262,6 +262,7 @@ function display_credit_items() end_table(1); // outer table + div_start('credit_items'); start_table("$table_style width=80%"); $th = array(_("Item Code"), _("Item Description"), _("Invoiced Quantity"), _("Units"), _("Credit Quantity"), _("Price"), _("Discount %"), _("Total")); @@ -283,9 +284,8 @@ function display_credit_items() $dec = get_qty_dec($ln_itm->stock_id); qty_cell($ln_itm->quantity, false, $dec); label_cell($ln_itm->units); - - amount_cells(null, 'Line'.$line_no, number_format2($ln_itm->qty_dispatched, $dec)); - + amount_cells(null, 'Line'.$line_no, number_format2($ln_itm->qty_dispatched, $dec), + null, null, $dec); $line_total =($ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent)); amount_cell($ln_itm->price); @@ -317,53 +317,56 @@ function display_credit_items() label_row(_("Credit Note Total"), $display_total, "colspan=7 align=right", "align=right"); end_table(); + div_end(); } //----------------------------------------------------------------------------- - function display_credit_options() { - global $table_style2; - - echo "
"; - start_table($table_style2); - - echo "" . _("Credit Note Type") . ""; - echo ""; - echo""; + global $table_style2, $Ajax; + echo "
"; - if (!isset($_POST['CreditType']) || $_POST['CreditType'] == "Return") { +if (isset($_POST['_CreditType_update'])) + $Ajax->activate('options'); - /*if the credit note is a return of goods then need to know which location to receive them into */ - if (!isset($_POST['Location'])) { - $_POST['Location'] = $_SESSION['Items']->Location; - } + div_start('options'); + start_table("$table_style2"); - locations_list_row(_("Items Returned to Inventory Location"), 'Location', $_POST['Location']); - } else { /* the goods are to be written off to somewhere */ - gl_all_accounts_list_row(_("Write Off the Cost of the Items to"), 'WriteOffGLCode', $_POST['WriteOffGLCode']); - } - textarea_row(_("Memo"), "CreditText", null, 45, 3); - end_table(); + credit_type_list_row(_("Credit Note Type"), 'CreditType', null, true); + + if ($_POST['CreditType'] == "Return") + { + + /*if the credit note is a return of goods then need to know which location to receive them into */ + if (!isset($_POST['Location'])) + $_POST['Location'] = $_SESSION['Items']->Location; + locations_list_row(_("Items Returned to Location"), 'Location', $_POST['Location']); + } + else + { + /* the goods are to be written off to somewhere */ + gl_all_accounts_list_row(_("Write off the cost of the items to"), 'WriteOffGLCode', null); + } + + textarea_row(_("Memo"), "CreditText", null, 51, 3); + echo ""; + div_end(); } +//----------------------------------------------------------------------------- +if (get_post('Update')) +{ + $Ajax->activate('credit_items'); +} //----------------------------------------------------------------------------- display_credit_items(); display_credit_options(); echo "
"; -submit('Update', _("Update")); +submit('Update', _("Update"), true, _('Update credit value for quantities entered'), true); echo " "; -submit('ProcessCredit', _("Process Credit Note")); +submit('ProcessCredit', _("Process Credit Note"), true, '', true); echo "
"; end_form();