Rewritten bank deposit/payment related files, added ajax.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 29 Jun 2008 21:18:25 +0000 (21:18 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 29 Jun 2008 21:18:25 +0000 (21:18 +0000)
applications/generalledger.php
gl/gl_bank.php [new file with mode: 0644]
gl/gl_deposit.php [deleted file]
gl/gl_journal.php
gl/gl_payment.php [deleted file]
gl/includes/db/gl_db_banking.inc
gl/includes/ui/gl_bank_ui.inc [new file with mode: 0644]
gl/includes/ui/gl_payment_ui.inc [deleted file]
manufacturing/search_work_orders.php

index 3a7158241388c7cbfc621ebcccba6fe8a79d7356..b610f841e291f69f46eb62bddb0868bfb1be1934 100644 (file)
@@ -9,8 +9,8 @@
                        $this->application("GL",_("Banking and General Ledger"));
 
                        $this->add_module(_("Transactions"));
-                       $this->add_lapp_function(0, _("Payments"),"gl/gl_payment.php?NewPayment=Yes");
-                       $this->add_lapp_function(0, _("Deposits"),"gl/gl_deposit.php?NewDeposit=Yes");
+                       $this->add_lapp_function(0, _("Payments"),"gl/gl_bank.php?NewPayment=Yes");
+                       $this->add_lapp_function(0, _("Deposits"),"gl/gl_bank.php?NewDeposit=Yes");
                        $this->add_lapp_function(0, _("Bank Account Transfers"),"gl/bank_transfer.php?");
                        $this->add_rapp_function(0, _("Journal Entry"),"gl/gl_journal.php?NewJournal=Yes");
                        $this->add_rapp_function(0, _("Budget Entry"),"gl/gl_budget.php?");
diff --git a/gl/gl_bank.php b/gl/gl_bank.php
new file mode 100644 (file)
index 0000000..b035587
--- /dev/null
@@ -0,0 +1,298 @@
+<?php
+
+$page_security = 3;
+$path_to_root="..";
+include_once($path_to_root . "/includes/ui/items_cart.inc");
+include_once($path_to_root . "/includes/session.inc");
+
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+
+include_once($path_to_root . "/gl/includes/ui/gl_bank_ui.inc");
+include_once($path_to_root . "/gl/includes/gl_db.inc");
+include_once($path_to_root . "/gl/includes/gl_ui.inc");
+
+$js = '';
+if ($use_popup_windows)
+       $js .= get_js_open_window(800, 500);
+if ($use_date_picker)
+       $js .= get_js_date_picker();
+
+if (isset($_GET['NewPayment'])) {
+       $_SESSION['page_title'] = _("Bank Account Payment Entry");
+       handle_new_order(systypes::bank_payment());
+
+} else if(isset($_GET['NewDeposit'])) {
+       $_SESSION['page_title'] = _("Bank Account Deposit Entry");
+       handle_new_order(systypes::bank_deposit());
+}
+page($_SESSION['page_title'], false, false, '', $js);
+
+//-----------------------------------------------------------------------------------------------
+check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
+
+check_db_has_bank_trans_types(_("There are no bank payment types defined in the system."));
+
+//--------------------------------------------------------------------------------------------------
+function line_start_focus() {
+  global       $Ajax;
+
+  $Ajax->activate('items_table');
+  set_focus('_code_id_edit');
+}
+
+//-----------------------------------------------------------------------------------------------
+
+if (isset($_GET['AddedID']))
+{
+       $trans_no = $_GET['AddedID'];
+       $trans_type = systypes::bank_payment();
+
+       display_notification_centered(_("Payment has been entered"));
+
+       display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Postings for this Payment")));
+
+       hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter Another Payment"));
+
+       display_footer_exit();
+}
+
+if (isset($_GET['AddedDep']))
+{
+       $trans_no = $_GET['AddedDep'];
+       $trans_type = systypes::bank_deposit();
+
+       display_notification_centered(_("Deposit has been entered"));
+
+       display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Postings for this Deposit")));
+
+       hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter Another Deposit"));
+
+       display_footer_exit();
+}
+
+//--------------------------------------------------------------------------------------------------
+
+function copy_to_py()
+{
+       $_SESSION['pay_items']->from_loc = $_POST['bank_account'];
+       $_SESSION['pay_items']->tran_date = $_POST['date_'];
+       $_SESSION['pay_items']->transfer_type = $_POST['type'];
+       $_SESSION['pay_items']->increase = $_POST['PayType'];
+       if (!isset($_POST['person_id']))
+               $_POST['person_id'] = "";
+       $_SESSION['pay_items']->person_id = $_POST['person_id'];
+       if (!isset($_POST['PersonDetailID']))
+               $_POST['PersonDetailID'] = "";
+       $_SESSION['pay_items']->branch_id = $_POST['PersonDetailID'];
+       $_SESSION['pay_items']->memo_ = $_POST['memo_'];
+}
+
+//--------------------------------------------------------------------------------------------------
+
+function copy_from_py()
+{
+       $_POST['bank_account'] = $_SESSION['pay_items']->from_loc;
+       $_POST['date_'] = $_SESSION['pay_items']->tran_date;
+       $_POST['type'] = $_SESSION['pay_items']->transfer_type;
+       $_POST['PayType'] = $_SESSION['pay_items']->increase;
+       $_POST['person_id'] = $_SESSION['pay_items']->person_id;
+       $_POST['PersonDetailID'] = $_SESSION['pay_items']->branch_id;
+       $_POST['memo_'] = $_SESSION['pay_items']->memo_;
+}
+
+//-----------------------------------------------------------------------------------------------
+
+function handle_new_order($type)
+{
+       if (isset($_SESSION['pay_items']))
+       {
+               $_SESSION['pay_items']->clear_items();
+               unset ($_SESSION['pay_items']);
+       }
+
+       session_register("pay_items");
+
+       $_SESSION['pay_items'] = new items_cart($type);
+
+       $_POST['date_'] = Today();
+       if (!is_date_in_fiscalyear($_POST['date_']))
+               $_POST['date_'] = end_fiscalyear();
+       $_SESSION['pay_items']->tran_date = $_POST['date_'];
+}
+
+//-----------------------------------------------------------------------------------------------
+
+if (isset($_POST['Process']))
+{
+
+       $input_error = 0;
+
+       if ($_SESSION['pay_items']->count_gl_items() < 1) {
+               display_error(_("You must enter at least one payment line."));
+               set_focus('code_id');
+               $input_error = 1;
+       }
+
+       if (!references::is_valid($_POST['ref']))
+       {
+               display_error( _("You must enter a reference."));
+               set_focus('ref');
+               $input_error = 1;
+       }
+       elseif (!is_new_reference($_POST['ref'], $_SESSION['pay_items']->trans_type))
+       {
+               display_error( _("The entered reference is already in use."));
+               set_focus('ref');
+               $input_error = 1;
+       }
+       if (!is_date($_POST['date_']))
+       {
+               display_error(_("The entered date for the payment is invalid."));
+               set_focus('date_');
+               $input_error = 1;
+       }
+       elseif (!is_date_in_fiscalyear($_POST['date_']))
+       {
+               display_error(_("The entered date is not in fiscal year."));
+               set_focus('date_');
+               $input_error = 1;
+       }
+
+       if ($input_error == 1)
+               unset($_POST['Process']);
+}
+
+if (isset($_POST['Process']))
+{
+       
+       $trans = add_bank_transaction(
+               $_SESSION['pay_items']->trans_type, $_POST['bank_account'],
+               $_SESSION['pay_items'], $_POST['date_'],
+               $_POST['PayType'], $_POST['person_id'], get_post('PersonDetailID'),
+               $_POST['type'], $_POST['ref'], $_POST['memo_']);
+
+       $trans_type = $trans[0];
+       $trans_no = $trans[1];
+
+       $_SESSION['pay_items']->clear_items();
+       unset($_SESSION['pay_items']);
+
+       meta_forward($_SERVER['PHP_SELF'], $trans_type==systypes::bank_payment() ? 
+               "AddedID=$trans_no" : "AddedDep=$trans_no");
+
+} /*end of process credit note */
+
+//-----------------------------------------------------------------------------------------------
+
+function check_item_data()
+{
+       if (!check_num('amount', 0))
+       {
+               display_error( _("The amount entered is not a valid number or is less than zero."));
+               set_focus('amount');
+               return false;
+       }
+
+       if ($_POST['code_id'] == $_POST['bank_account'])
+       {
+               display_error( _("The source and destination accouts cannot be the same."));
+               set_focus('code_id');
+               return false;
+       }
+
+       if (is_bank_account($_POST['code_id']))
+       {
+               if ($_SESSION['pay_items']->trans_type == systypes::bank_payment())
+                       display_error( _("You cannot make a payment to a bank account. Please use the transfer funds facility for this."));
+               else
+                       display_error( _("You cannot make a deposit from a bank account. Please use the transfer funds facility for this."));
+               set_focus('code_id');
+               return false;
+       }
+
+       return true;
+}
+
+//-----------------------------------------------------------------------------------------------
+
+function handle_update_item()
+{
+       $amount = ($_SESSION['pay_items']->trans_type==systypes::bank_payment() ? 1:-1) * input_num('amount');
+    if($_POST['UpdateItem'] != "" && check_item_data())
+    {
+       $_SESSION['pay_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'],
+               $_POST['dimension2_id'], $amount , $_POST['LineMemo']);
+    }
+       line_start_focus();
+}
+
+//-----------------------------------------------------------------------------------------------
+
+function handle_delete_item($id)
+{
+       $_SESSION['pay_items']->remove_gl_item($id);
+       line_start_focus();
+}
+
+//-----------------------------------------------------------------------------------------------
+
+function handle_new_item()
+{
+       if (!check_item_data())
+               return;
+       $amount = ($_SESSION['pay_items']->trans_type==systypes::bank_payment() ? 1:-1) * input_num('amount');
+       $_SESSION['pay_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'],
+               $_POST['dimension2_id'], $amount, $_POST['LineMemo']);
+       line_start_focus();
+}
+
+//-----------------------------------------------------------------------------------------------
+$id = find_submit('Delete');
+if ($id != -1) {
+       copy_from_py();
+       handle_delete_item($id);
+}
+if (isset($_POST['AddItem']) || isset($_POST['UpdateItem'])) {
+       copy_to_py();
+       line_start_focus();
+}
+
+if (isset($_POST['AddItem']))
+       handle_new_item();
+
+if (isset($_POST['UpdateItem']))
+       handle_update_item();
+
+if (isset($_POST['CancelItemChanges'])) {
+       line_start_focus();
+}
+
+//-----------------------------------------------------------------------------------------------
+
+start_form(false, true);
+
+display_bank_header($_SESSION['pay_items']);
+
+start_table("$table_style2 width=90%", 10);
+start_row();
+echo "<td>";
+display_gl_items($_SESSION['pay_items']->trans_type==systypes::bank_payment() ? 
+       _("Payment Items"):_("Deposit Items"), $_SESSION['pay_items']);
+gl_options_controls();
+echo "</td>";
+end_row();
+end_table(1);
+
+submit_center_first('Update', _("Update"), '', null);
+submit_center_last('Process', $_SESSION['pay_items']->trans_type==systypes::bank_payment() ? 
+       _("Process Payment"):_("Process Deposit"), '', true);
+
+end_form();
+
+//------------------------------------------------------------------------------------------------
+
+end_page();
+
+?>
diff --git a/gl/gl_deposit.php b/gl/gl_deposit.php
deleted file mode 100644 (file)
index cdc4910..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-<?php
-
-$page_security = 3;
-$path_to_root="..";
-include_once($path_to_root . "/includes/ui/items_cart.inc");
-include_once($path_to_root . "/includes/session.inc");
-
-include_once($path_to_root . "/includes/date_functions.inc");
-include_once($path_to_root . "/includes/data_checks.inc");
-
-include_once($path_to_root . "/gl/includes/ui/gl_deposit_ui.inc");
-include_once($path_to_root . "/gl/includes/gl_db.inc");
-include_once($path_to_root . "/gl/includes/gl_ui.inc");
-
-$js = '';
-if ($use_popup_windows)
-       $js .= get_js_open_window(800, 500);
-if ($use_date_picker)
-       $js .= get_js_date_picker();
-
-page(_("Bank Account Deposit Entry"), false, false, '', $js);
-
-//-----------------------------------------------------------------------------------------------
-
-check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
-
-check_db_has_bank_trans_types(_("There are no bank payment types defined in the system."));
-
-//-----------------------------------------------------------------------------------------------
-
-if (isset($_GET['AddedID']))
-{
-       $trans_no = $_GET['AddedID'];
-       $trans_type = systypes::bank_deposit();
-
-       display_notification_centered(_("Deposit has been entered"));
-
-       display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Postings for this Deposit")));
-
-       hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter Another Deposit"));
-
-       display_footer_exit();
-}
-
-//--------------------------------------------------------------------------------------------------
-
-function copy_to_py()
-{
-       $_SESSION['deposit_items']->from_loc = $_POST['bank_account'];
-       $_SESSION['deposit_items']->tran_date = $_POST['date_'];
-       $_SESSION['deposit_items']->transfer_type = $_POST['type'];
-       $_SESSION['deposit_items']->increase = $_POST['PayType'];
-       if (!isset($_POST['person_id']))
-               $_POST['person_id'] = "";
-       $_SESSION['deposit_items']->person_id = $_POST['person_id'];
-       if (!isset($_POST['PersonDetailID']))
-               $_POST['PersonDetailID'] = "";
-       $_SESSION['deposit_items']->branch_id = $_POST['PersonDetailID'];
-       $_SESSION['deposit_items']->memo_ = $_POST['memo_'];
-}
-
-//--------------------------------------------------------------------------------------------------
-
-function copy_from_py()
-{
-       $_POST['bank_account'] = $_SESSION['deposit_items']->from_loc;
-       $_POST['date_'] = $_SESSION['deposit_items']->tran_date;
-       $_POST['type'] = $_SESSION['deposit_items']->transfer_type;
-       $_POST['PayType'] = $_SESSION['deposit_items']->increase;
-       $_POST['person_id'] = $_SESSION['deposit_items']->person_id;
-       $_POST['PersonDetailID'] = $_SESSION['deposit_items']->branch_id;
-       $_POST['memo_'] = $_SESSION['deposit_items']->memo_;
-}
-
-//-----------------------------------------------------------------------------------------------
-
-function handle_new_order()
-{
-       if (isset($_SESSION['deposit_items']))
-       {
-               $_SESSION['deposit_items']->clear_items();
-               unset ($_SESSION['deposit_items']);
-       }
-
-       session_register("deposit_items");
-
-       $_SESSION['deposit_items'] = new items_cart;
-       $_POST['date_'] = Today();
-       if (!is_date_in_fiscalyear($_POST['date_']))
-               $_POST['date_'] = end_fiscalyear();
-       $_SESSION['deposit_items']->tran_date = $_POST['date_'];
-}
-
-//-----------------------------------------------------------------------------------------------
-
-if (isset($_POST['Process']))
-{
-
-       $input_error = 0;
-
-       if (!references::is_valid($_POST['ref']))
-       {
-               display_error( _("You must enter a reference."));
-               set_focus('ref');
-               $input_error = 1;
-       }
-       elseif (!is_new_reference($_POST['ref'], systypes::bank_deposit()))
-       {
-               display_error( _("The entered reference is already in use."));
-               set_focus('ref');
-               $input_error = 1;
-       }
-
-       if (!is_date($_POST['date_']))
-       {
-               display_error(_("The entered date for the deposit is invalid."));
-               set_focus('date_');
-               $input_error = 1;
-       }
-
-       if (!is_date_in_fiscalyear($_POST['date_']))
-       {
-               display_error(_("The entered date is not in fiscal year."));
-               set_focus('date_');
-               $input_error = 1;
-       }
-
-       if ($input_error == 1)
-               unset($_POST['Process']);
-}
-
-//-----------------------------------------------------------------------------------------------
-
-if (isset($_POST['Process']))
-{
-
-       $trans = add_bank_deposit($_POST['bank_account'],
-               $_SESSION['deposit_items'], $_POST['date_'],
-               $_POST['PayType'], $_POST['person_id'], $_POST['PersonDetailID'],
-               $_POST['type'], $_POST['ref'], $_POST['memo_']);
-
-       $trans_type = $trans[0];
-       $trans_no = $trans[1];
-
-       $_SESSION['deposit_items']->clear_items();
-       unset($_SESSION['deposit_items']);
-
-       meta_forward($_SERVER['PHP_SELF'], "AddedID=$trans_no");
-
-} /*end of process credit note */
-
-//-----------------------------------------------------------------------------------------------
-
-function check_item_data()
-{
-       if (!check_num('amount', 0))
-       {
-               display_error( _("The amount entered is not a valid number or is less than zero."));
-               set_focus('amount');
-               return false;
-       }
-
-       if ($_POST['code_id'] == $_POST['bank_account'])
-       {
-               display_error( _("The source and destination accouts cannot be the same."));
-               set_focus('code_id');
-               return false;
-       }
-
-       if (is_bank_account($_POST['code_id']))
-       {
-               display_error( _("You cannot make a deposit from a bank account. Please use the transfer funds facility for this."));
-               set_focus('code_id');
-               return false;
-       }
-
-       return true;
-}
-
-//-----------------------------------------------------------------------------------------------
-
-function handle_update_item()
-{
-    if($_POST['UpdateItem'] != "" && check_item_data())
-    {
-       $_SESSION['deposit_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'],
-                 $_POST['dimension2_id'], -input_num('amount'), $_POST['LineMemo']);
-    }
-}
-
-//-----------------------------------------------------------------------------------------------
-
-function handle_delete_item()
-{
-       $_SESSION['deposit_items']->remove_gl_item($_GET['Delete']);
-}
-
-//-----------------------------------------------------------------------------------------------
-
-function handle_new_item()
-{
-       if (!check_item_data())
-               return;
-
-       $_SESSION['deposit_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'],
-         $_POST['dimension2_id'], -input_num('amount'), $_POST['LineMemo']);
-}
-
-//-----------------------------------------------------------------------------------------------
-if (isset($_GET['Edit'])) {
-       copy_from_py();
-       set_focus('dimension_id');
-}
-if (isset($_GET['Delete'])) {
-       copy_from_py();
-       handle_delete_item();
-       set_focus('_code_id_edit');
-}
-if (isset($_POST['AddItem'])) {
-       copy_to_py();
-       handle_new_item();
-       set_focus('_code_id_edit');
-}
-if (isset($_POST['UpdateItem'])) {
-       copy_to_py();
-       handle_update_item();
-       set_focus('_code_id_edit');
-}
-if (isset($_POST['CancelItemChanges']))
-       set_focus('_code_id_edit');
-
-if (isset($_POST['EditItem']))
-       set_focus('dimension_id');
-
-//-----------------------------------------------------------------------------------------------
-
-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(_("Deposit Items"), $_SESSION['deposit_items']);
-gl_options_controls();
-echo "</td>";
-end_row();
-end_table(1);
-
-if (!isset($_POST['Process']))
-{
-       if ($_SESSION['deposit_items']->count_gl_items() >= 1)
-       {
-       submit_center_first('Update', _("Update"));
-           submit_center_last('Process', _("Process Deposit"));
-       }
-       else
-       submit_center('Update', _("Update"));
-}
-
-end_form();
-
-//------------------------------------------------------------------------------------------------
-
-end_page();
-
-?>
index 1e820f5f393c336f1baf4455587cc3fb77f85b47..9d42cdad89f2537a5c8de63d9386b743b4d4304a 100644 (file)
@@ -67,7 +67,7 @@ function handle_new_order()
 
     session_register("journal_items");
 
-    $_SESSION['journal_items'] = new items_cart;
+    $_SESSION['journal_items'] = new items_cart(systypes::journal_entry());
 
        $_POST['date_'] = Today();
        if (!is_date_in_fiscalyear($_POST['date_']))
diff --git a/gl/gl_payment.php b/gl/gl_payment.php
deleted file mode 100644 (file)
index 60efb8a..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-<?php
-
-$page_security = 3;
-$path_to_root="..";
-include_once($path_to_root . "/includes/ui/items_cart.inc");
-include_once($path_to_root . "/includes/session.inc");
-
-include_once($path_to_root . "/includes/date_functions.inc");
-include_once($path_to_root . "/includes/data_checks.inc");
-
-include_once($path_to_root . "/gl/includes/ui/gl_payment_ui.inc");
-include_once($path_to_root . "/gl/includes/gl_db.inc");
-include_once($path_to_root . "/gl/includes/gl_ui.inc");
-
-$js = '';
-if ($use_popup_windows)
-       $js .= get_js_open_window(800, 500);
-if ($use_date_picker)
-       $js .= get_js_date_picker();
-
-page(_("Bank Account Payment Entry"), false, false, '', $js);
-
-//-----------------------------------------------------------------------------------------------
-
-check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
-
-check_db_has_bank_trans_types(_("There are no bank payment types defined in the system."));
-
-//-----------------------------------------------------------------------------------------------
-
-if (isset($_GET['AddedID']))
-{
-       $trans_no = $_GET['AddedID'];
-       $trans_type = systypes::bank_payment();
-
-       display_notification_centered(_("Payment has been entered"));
-
-       display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Postings for this Payment")));
-
-       hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter Another Payment"));
-
-       display_footer_exit();
-}
-
-//--------------------------------------------------------------------------------------------------
-
-function copy_to_py()
-{
-       $_SESSION['pay_items']->from_loc = $_POST['bank_account'];
-       $_SESSION['pay_items']->tran_date = $_POST['date_'];
-       $_SESSION['pay_items']->transfer_type = $_POST['type'];
-       $_SESSION['pay_items']->increase = $_POST['PayType'];
-       if (!isset($_POST['person_id']))
-               $_POST['person_id'] = "";
-       $_SESSION['pay_items']->person_id = $_POST['person_id'];
-       if (!isset($_POST['PersonDetailID']))
-               $_POST['PersonDetailID'] = "";
-       $_SESSION['pay_items']->branch_id = $_POST['PersonDetailID'];
-       $_SESSION['pay_items']->memo_ = $_POST['memo_'];
-}
-
-//--------------------------------------------------------------------------------------------------
-
-function copy_from_py()
-{
-       $_POST['bank_account'] = $_SESSION['pay_items']->from_loc;
-       $_POST['date_'] = $_SESSION['pay_items']->tran_date;
-       $_POST['type'] = $_SESSION['pay_items']->transfer_type;
-       $_POST['PayType'] = $_SESSION['pay_items']->increase;
-       $_POST['person_id'] = $_SESSION['pay_items']->person_id;
-       $_POST['PersonDetailID'] = $_SESSION['pay_items']->branch_id;
-       $_POST['memo_'] = $_SESSION['pay_items']->memo_;
-}
-
-//-----------------------------------------------------------------------------------------------
-
-function handle_new_order()
-{
-       if (isset($_SESSION['pay_items']))
-       {
-               $_SESSION['pay_items']->clear_items();
-               unset ($_SESSION['pay_items']);
-       }
-
-       session_register("pay_items");
-
-       $_SESSION['pay_items'] = new items_cart;
-
-       $_POST['date_'] = Today();
-       if (!is_date_in_fiscalyear($_POST['date_']))
-               $_POST['date_'] = end_fiscalyear();
-       $_SESSION['pay_items']->tran_date = $_POST['date_'];
-}
-
-//-----------------------------------------------------------------------------------------------
-
-if (isset($_POST['Process']))
-{
-
-       $input_error = 0;
-
-       if (!references::is_valid($_POST['ref']))
-       {
-               display_error( _("You must enter a reference."));
-               set_focus('ref');
-               $input_error = 1;
-       }
-       elseif (!is_new_reference($_POST['ref'], systypes::bank_payment()))
-       {
-               display_error( _("The entered reference is already in use."));
-               set_focus('ref');
-               $input_error = 1;
-       }
-       elseif (!is_date($_POST['date_']))
-       {
-               display_error(_("The entered date for the payment is invalid."));
-               set_focus('date_');
-               $input_error = 1;
-       }
-       elseif (!is_date_in_fiscalyear($_POST['date_']))
-       {
-               display_error(_("The entered date is not in fiscal year."));
-               set_focus('date_');
-               $input_error = 1;
-       }
-
-       if ($input_error == 1)
-               unset($_POST['Process']);
-}
-
-if (isset($_POST['Process']))
-{
-
-       $trans = add_bank_payment($_POST['bank_account'],
-               $_SESSION['pay_items'], $_POST['date_'],
-               $_POST['PayType'], $_POST['person_id'], $_POST['PersonDetailID'],
-               $_POST['type'], $_POST['ref'], $_POST['memo_']);
-
-       $trans_type = $trans[0];
-       $trans_no = $trans[1];
-
-       $_SESSION['pay_items']->clear_items();
-       unset($_SESSION['pay_items']);
-
-       meta_forward($_SERVER['PHP_SELF'], "AddedID=$trans_no");
-
-} /*end of process credit note */
-
-//-----------------------------------------------------------------------------------------------
-
-function check_item_data()
-{
-       if (!check_num('amount', 0))
-       {
-               display_error( _("The amount entered is not a valid number or is less than zero."));
-               set_focus('amount');
-               return false;
-       }
-
-       if ($_POST['code_id'] == $_POST['bank_account'])
-       {
-               display_error( _("The source and destination accouts cannot be the same."));
-               set_focus('code_id');
-               return false;
-       }
-
-       if (is_bank_account($_POST['code_id']))
-       {
-               display_error( _("You cannot make a payment to a bank account. Please use the transfer funds facility for this."));
-               set_focus('code_id');
-               return false;
-       }
-
-       return true;
-}
-
-//-----------------------------------------------------------------------------------------------
-
-function handle_update_item()
-{
-    if($_POST['UpdateItem'] != "" && check_item_data())
-    {
-       $_SESSION['pay_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'],
-               $_POST['dimension2_id'], input_num('amount'), $_POST['LineMemo']);
-    }
-       set_focus('_code_id_edit');
-}
-
-//-----------------------------------------------------------------------------------------------
-
-function handle_delete_item()
-{
-       $_SESSION['pay_items']->remove_gl_item($_GET['Delete']);
-}
-
-//-----------------------------------------------------------------------------------------------
-
-function handle_new_item()
-{
-       if (!check_item_data())
-               return;
-
-       $_SESSION['pay_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'],
-               $_POST['dimension2_id'], input_num('amount'), $_POST['LineMemo']);
-}
-
-//-----------------------------------------------------------------------------------------------
-
-if (isset($_GET['Edit'])) {
-       copy_from_py();
-       set_focus('dimension_id');
-}
-if (isset($_GET['Delete'])) {
-       copy_from_py();
-       handle_delete_item();
-       set_focus('_code_id_edit');
-}
-if (isset($_POST['AddItem'])) {
-       copy_to_py();
-       handle_new_item();
-       set_focus('_code_id_edit');
-}
-if (isset($_POST['UpdateItem'])) {
-       copy_to_py();
-       handle_update_item();
-       set_focus('_code_id_edit');
-}
-if (isset($_POST['CancelItemChanges']))
-       set_focus('_code_id_edit');
-
-if (isset($_POST['EditItem']))
-       set_focus('dimension_id');
-
-//-----------------------------------------------------------------------------------------------
-
-if (isset($_GET['NewPayment']) || !isset($_SESSION['pay_items']))
-{
-       handle_new_order();
-}
-
-//-----------------------------------------------------------------------------------------------
-
-start_form(false, true);
-
-display_order_header($_SESSION['pay_items']);
-
-start_table("$table_style2 width=90%", 10);
-start_row();
-echo "<td>";
-display_gl_items(_("Payment Items"), $_SESSION['pay_items']);
-gl_options_controls();
-echo "</td>";
-end_row();
-end_table(1);
-
-if (!isset($_POST['Process']))
-{
-       if ($_SESSION['pay_items']->count_gl_items() >= 1)
-       {
-       submit_center_first('Update', _("Update"));
-           submit_center_last('Process', _("Process Payment"));
-       }
-       else
-       submit_center('Update', _("Update"));
-}
-
-end_form();
-
-//------------------------------------------------------------------------------------------------
-
-end_page();
-
-?>
index 4711babae0765b4f500aa34c0caa701c419e5ab4..a5fe71ad2250ee84ee1d05764b9d153aa925025d 100644 (file)
@@ -137,23 +137,4 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_,
 
 //----------------------------------------------------------------------------------------
 
-function add_bank_payment($from_account, $items, $date_,
-       $person_type_id, $person_id, $person_detail_id, $type, $ref, $memo_)
-{
-       return add_bank_transaction(systypes::bank_payment(), $from_account, $items, $date_,
-               $person_type_id, $person_id, $person_detail_id, $type, $ref, $memo_);
-}
-
-//---------------------------------------------------------------------------------------------
-
-function add_bank_deposit($from_account, $items, $date_,
-       $person_type_id, $person_id, $person_detail_id, $type, $ref, $memo_)
-{
-       return add_bank_transaction(systypes::bank_deposit(), $from_account, $items, $date_,
-               $person_type_id, $person_id, $person_detail_id, $type, $ref, $memo_);
-}
-
-//---------------------------------------------------------------------------------------------
-
-
 ?>
\ No newline at end of file
diff --git a/gl/includes/ui/gl_bank_ui.inc b/gl/includes/ui/gl_bank_ui.inc
new file mode 100644 (file)
index 0000000..7e8c937
--- /dev/null
@@ -0,0 +1,268 @@
+<?php
+
+function display_bank_header(&$order)
+{
+       global $table_style2, $Ajax;
+       $payment = $order->trans_type == systypes::bank_payment();
+
+       div_start('pmt_header');
+       start_table("width=90% $table_style2"); // outer table
+       echo "<tr><td valign=top width=33%>";
+
+       echo "<table>"; // inner table
+
+    bank_accounts_list_row( $payment ? _("From:") : _("To:"), 'bank_account', null, true);
+
+    date_row(_("Date:"), 'date_');
+
+       echo "</table>"; // inner table
+
+       echo "</td><td width=33%>";
+
+       echo "<table>"; // inner table
+
+       if (!isset($_POST['PayType']))
+       {
+               if (isset($_GET['PayType']))
+                       $_POST['PayType'] = $_GET['PayType'];
+               else
+                       $_POST['PayType'] = "";
+       }
+       if (!isset($_POST['person_id']))
+       {
+               if (isset($_GET['PayPerson']))
+                       $_POST['person_id'] = $_GET['PayPerson'];
+               else
+                       $_POST['person_id'] = "";
+       }
+       if (isset($_POST['_PayType_update'])) {
+               $_POST['person_id'] = '';
+               $Ajax->activate('pmt_header');
+               $Ajax->activate('code_id');
+       }
+    payment_person_types_list_row( $payment ? _("Pay To:"):_("From:"),
+                'PayType', $_POST['PayType'], true);
+    switch ($_POST['PayType'])
+    {
+               case payment_person_types::misc() :
+               text_row_ex($payment ?_("To the Order of:"):_("Name:"),
+                                'person_id', 40, 50);
+               break;
+               case payment_person_types::WorkOrder() :
+               workorders_list_row(_("Work Order:"), 'person_id', null);
+               break;
+               case payment_person_types::supplier() :
+               supplier_list_row(_("Supplier:"), 'person_id', null, false, true);
+               break;
+               case payment_person_types::customer() :
+               customer_list_row(_("Customer:"), 'person_id', null, false, true);
+
+               if (db_customer_has_branches($_POST['person_id']))
+               {
+                       customer_branches_list_row(_("Branch:"), $_POST['person_id'], 'PersonDetailID', null, false, true, true);
+               }
+               else
+               {
+                               $_POST['PersonDetailID'] = reserved_words::get_any_numeric();
+                       hidden('PersonDetailID');
+               }
+               break;
+               //case payment_person_types::Project() :
+       //      dimensions_list_row(_("Dimension:"), 'person_id', $_POST['person_id'], false, null, true);
+       //      break;
+    }
+
+       //$homeCurrency = get_company_currency();
+       $person_currency = payment_person_types::person_currency($_POST['PayType'], $_POST['person_id']);
+       $bank_currency = get_bank_account_currency($_POST['bank_account']);
+
+       if ($bank_currency != "" && $bank_currency != $person_currency)
+       {
+               exchange_rate_display($bank_currency, $person_currency, $_POST['date_']);
+       }
+       
+       echo "</table>"; // inner table
+
+       echo "</td><td>";
+
+       echo "<table>"; // inner table
+
+       bank_trans_types_list_row(_("Type:"), 'type', null);
+
+    ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_payment()));
+
+       echo "</table>"; // inner table
+
+       echo "</td></tr>";
+
+       end_table(1); // outer table
+       div_end();
+}
+//---------------------------------------------------------------------------------
+
+function display_gl_items($title, &$order)
+{
+       global $table_style, $path_to_root;
+
+       $dim = get_company_pref('use_dimension');
+       $colspan = ($dim == 2 ? 4 : ($dim == 1 ? 3 : 2));
+       display_heading($title);
+
+    div_start('items_table');
+       start_table("$table_style colspan=7 width=95%");
+
+       if ($dim == 2)
+               $th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1",
+                       _("Dimension")." 2", _("Amount"), _("Memo"));
+       else if ($dim == 1)
+               $th = array(_("Account Code"), _("Account Description"), _("Dimension"),
+                       _("Amount"), _("Memo"));
+       else
+               $th = array(_("Account Code"), _("Account Description"),
+                       _("Amount"), _("Memo"));
+
+       if (count($order->gl_items)) $th[] = '';
+
+       table_header($th);
+       $k = 0;  //row colour counter
+
+       $id = find_submit('Edit');
+       foreach ($order->gl_items as $item)
+       {
+               if ($id != $item->index)
+               {
+               alt_table_row_color($k);
+
+                       label_cell($item->code_id);
+                       label_cell($item->description);
+               if ($dim >= 1)
+                               label_cell(get_dimension_string($item->dimension_id, true));
+               if ($dim > 1)
+                               label_cell(get_dimension_string($item->dimension2_id, true));
+                       amount_cell(abs($item->amount));
+                       label_cell($item->reference);
+
+                       edit_button_cell("Edit$item->index", _("Edit"),
+                               _('Edit document line'));
+                       edit_button_cell("Delete$item->index", _("Delete"),
+                               _('Remove line from document'));
+               end_row();
+               }
+               else
+               {
+                       gl_edit_item_controls($order, $dim, $item->index);
+               }
+       }
+
+       if ($id == -1)
+               gl_edit_item_controls($order, $dim);
+
+       if ($order->count_gl_items())
+               label_row(_("Total"), number_format2(abs($order->gl_items_total()), user_price_dec()),"colspan=" . $colspan . " align=right", "align=right");
+
+    end_table();
+       div_end();
+}
+
+//---------------------------------------------------------------------------------
+
+function gl_edit_item_controls(&$order, $dim, $Index=null)
+{
+       global $Ajax;
+       $payment = $order->trans_type == systypes::bank_payment();
+
+       start_row();
+       $id = find_submit('Edit');
+       if ($Index != -1 && $Index == $id)
+       {
+               $_POST['code_id'] = $order->gl_items[$Index]->code_id;
+               $_POST['dimension_id'] = $order->gl_items[$Index]->dimension_id;
+               $_POST['dimension2_id'] = $order->gl_items[$Index]->dimension2_id;
+               $_POST['amount'] = 
+                       price_format(($payment ? 1 : -1) * $order->gl_items[$Index]->amount);
+               $_POST['description'] = $order->gl_items[$Index]->description;
+               $_POST['LineMemo'] = $order->gl_items[$Index]->reference;
+
+               hidden('Index', $order->gl_items[$Index]->index);
+               hidden('code_id', $order->gl_items[$Index]->code_id);
+               label_cell($_POST['code_id']);
+               label_cell($order->gl_items[$Index]->description);
+               if ($dim >= 1)
+                       dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
+               if ($dim > 1)
+                       dimensions_list_cells(null, 'dimension2_id', null, true, " ", false, 2);
+           $Ajax->activate('items_table');
+       }
+       else
+       {
+               $_POST['amount'] = price_format(0);
+               $_POST['dimension_id'] = 0;
+               $_POST['dimension2_id'] = 0;
+               $_POST['LineMemo'] = "";
+               if(isset($_POST['_code_id_update'])) {
+                           $Ajax->activate('code_id');
+               }
+
+               if ($_POST['PayType'] == payment_person_types::customer())
+               {
+                       $acc = get_branch_accounts($_POST['PersonDetailID']);
+                       $_POST['code_id'] = $acc['receivables_account'];
+               }
+               elseif ($_POST['PayType'] == payment_person_types::supplier())
+               {
+                       $acc = get_supplier_accounts($_POST['person_id']);
+                       $_POST['code_id'] = $acc['payable_account'];
+               }
+               elseif ($_POST['PayType'] == payment_person_types::WorkOrder())
+                       $_POST['code_id'] = get_company_pref('default_assembly_act');
+               else {
+                       $_POST['code_id'] = 
+                               get_company_pref($payment ? 'default_cogs_act':'default_inv_sales_act');
+               }
+               gl_all_accounts_list('code_id', null, true, false, true);
+               if ($dim >= 1)
+                       dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
+               if ($dim > 1)
+                       dimensions_list_cells(null, 'dimension2_id', null, true, " ", false, 2);
+       }
+       if ($dim < 1)
+               hidden('dimension_id', 0);
+       if ($dim < 2)
+               hidden('dimension2_id', 0);
+
+       amount_cells(null, 'amount');
+       text_cells_ex(null, 'LineMemo', 35, 50);
+
+       if ($id != -1)
+       {
+               edit_button_cell('UpdateItem', _("Update"),
+                               _('Confirm changes'));
+               edit_button_cell('CancelItemChanges', _("Cancel"),
+                               _('Cancel changes'));
+               set_focus('amount');
+       }
+       else
+       {
+               submit_cells('AddItem', _("Add Item"), "colspan=2",
+                   _('Add new item to document'), true);
+       }
+
+       end_row();
+}
+
+
+//---------------------------------------------------------------------------------
+
+function gl_options_controls()
+{
+       echo "<br><table align='center'>";
+
+       textarea_row(_("Memo"), 'memo_', null, 50, 3);
+
+       echo "</table>";
+}
+
+
+//---------------------------------------------------------------------------------
+
+?>
\ No newline at end of file
diff --git a/gl/includes/ui/gl_payment_ui.inc b/gl/includes/ui/gl_payment_ui.inc
deleted file mode 100644 (file)
index 0f3b0aa..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-
-include_once($path_to_root . "/includes/ui.inc");
-include_once($path_to_root . "/includes/ui/items_cart.inc");
-
-//--------------------------------------------------------------------------------
-
-function display_order_header(&$order)
-{
-       global $table_style2;
-       start_table("width=90% $table_style2"); // outer table
-       echo "<tr><td valign=top width=33%>";
-
-       echo "<table>"; // inner table
-
-    bank_accounts_list_row(_("From:"), 'bank_account', null, true);
-
-    date_row(_("Date:"), 'date_');
-
-       echo "</table>"; // inner table
-
-       echo "</td><td width=33%>";
-
-       echo "<table>"; // inner table
-
-       if (!isset($_POST['PayType']))
-       {
-               if (isset($_GET['PayType']))
-                       $_POST['PayType'] = $_GET['PayType'];
-               else
-                       $_POST['PayType'] = "";
-       }
-       if (!isset($_POST['person_id']))
-       {
-               if (isset($_GET['PayPerson']))
-                       $_POST['person_id'] = $_GET['PayPerson'];
-               else
-                       $_POST['person_id'] = "";
-       }
-    payment_person_types_list_row(_("Pay To:"), 'PayType', $_POST['PayType'], 'person_id');
-
-    switch ($_POST['PayType'])
-    {
-               case payment_person_types::misc() :
-               text_row_ex(_("To the Order of:"), 'person_id', 40, 50);
-               break;
-               case payment_person_types::WorkOrder() :
-               workorders_list_row(_("Work Order:"), 'person_id', null);
-               break;
-               case payment_person_types::supplier() :
-               supplier_list_row(_("Supplier:"), 'person_id', null, false, true);
-               break;
-               case payment_person_types::customer() :
-               customer_list_row(_("Customer:"), 'person_id', null, false, true);
-
-               if (db_customer_has_branches($_POST['person_id']))
-               {
-                       customer_branches_list_row(_("Branch:"), $_POST['person_id'], 'PersonDetailID', null, false, true, true);
-               }
-               else
-               {
-                       hidden('BranchID', reserved_words::get_any_numeric());
-               }
-               break;
-               //case payment_person_types::Project() :
-       //      dimensions_list_row(_("Dimension:"), 'person_id', $_POST['person_id'], false, null, true);
-       //      break;
-    }
-
-       //$homeCurrency = get_company_currency();
-       $person_currency = payment_person_types::person_currency($_POST['PayType'], $_POST['person_id']);
-       $bank_currency = get_bank_account_currency($_POST['bank_account']);
-
-       if ($bank_currency != "" && $bank_currency != $person_currency)
-       {
-               exchange_rate_display($bank_currency, $person_currency, $_POST['date_']);
-       }
-
-       echo "</table>"; // inner table
-
-       echo "</td><td>";
-
-       echo "<table>"; // inner table
-
-       bank_trans_types_list_row(_("Payment Type:"), 'type', null);
-
-    ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_payment()));
-
-       echo "</table>"; // inner table
-
-       echo "</td></tr>";
-
-       end_table(1); // outer table
-}
-
-//---------------------------------------------------------------------------------
-
-function display_gl_items($title, &$order)
-{
-       global $table_style, $path_to_root;
-
-       $dim = get_company_pref('use_dimension');
-       $colspan = ($dim == 2 ? 4 : ($dim == 1 ? 3 : 2));
-       display_heading($title);
-
-       start_table("$table_style colspan=7 width=95%");
-
-       if ($dim == 2)
-               $th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1",
-                       _("Dimension")." 2", _("Amount"), _("Memo"));
-       else if ($dim == 1)
-               $th = array(_("Account Code"), _("Account Description"), _("Dimension"),
-                       _("Amount"), _("Memo"));
-       else
-               $th = array(_("Account Code"), _("Account Description"),
-                       _("Amount"), _("Memo"));
-
-       if (count($order->gl_items)) $th[] = '';
-
-       table_header($th);
-       $k = 0;  //row colour counter
-
-       foreach ($order->gl_items as $item)
-       {
-               if (!isset($_GET['Edit']) || $_GET['Edit'] != $item->index)
-               {
-               alt_table_row_color($k);
-
-                       label_cell($item->code_id);
-                       label_cell($item->description);
-               if ($dim >= 1)
-                               label_cell(get_dimension_string($item->dimension_id, true));
-               if ($dim > 1)
-                               label_cell(get_dimension_string($item->dimension2_id, true));
-                       amount_cell($item->amount);
-                       label_cell($item->reference);
-
-                       edit_link_cell("Edit=$item->index");
-                       delete_link_cell("Delete=$item->index");
-               end_row();
-               }
-               else
-               {
-                       gl_edit_item_controls($order, $dim, $item->index);
-               }
-       }
-
-       if (!isset($_GET['Edit']))
-               gl_edit_item_controls($order, $dim);
-
-       if ($order->count_gl_items())
-               label_row(_("Total"), number_format2(abs($order->gl_items_total()), user_price_dec()),"colspan=" . $colspan . " align=right", "align=right");
-
-    end_table();
-}
-
-//---------------------------------------------------------------------------------
-
-function gl_edit_item_controls(&$order, $dim, $Index=null)
-{
-       start_row();
-
-       if (isset($_GET['Edit']) && $Index != null)
-       {
-               if (!isset($_POST['code_id']))
-                       $_POST['code_id'] = $order->gl_items[$Index]->code_id;
-               if (!isset($_POST['dimension_id']))
-                       $_POST['dimension_id'] = $order->gl_items[$Index]->dimension_id;
-               if (!isset($_POST['dimension2_id']))
-                       $_POST['dimension2_id'] = $order->gl_items[$Index]->dimension2_id;
-               if (!isset($_POST['amount']) || ($_POST['amount'] == ""))
-                       $_POST['amount'] = price_format($order->gl_items[$Index]->amount);
-               if (!isset($_POST['description']) || ($_POST['description'] == ""))
-                       $_POST['description'] = $order->gl_items[$Index]->description;
-               if (!isset($_POST['LineMemo']) || ($_POST['LineMemo'] == ""))
-                       $_POST['LineMemo'] = $order->gl_items[$Index]->reference;
-
-               hidden('Index', $order->gl_items[$Index]->index);
-               hidden('code_id', $order->gl_items[$Index]->code_id);
-               label_cell($_POST['code_id']);
-               label_cell($order->gl_items[$Index]->description);
-               if ($dim >= 1)
-                       dimensions_list_cells(null, 'dimension_id', $_POST['dimension_id'], true, " ", false, 1);
-               if ($dim > 1)
-                       dimensions_list_cells(null, 'dimension2_id', $_POST['dimension2_id'], true, " ", false, 2);
-       }
-       else
-       {
-               $_POST['amount'] = price_format(0);
-               $_POST['dimension_id'] = 0;
-               $_POST['dimension2_id'] = 0;
-               $_POST['LineMemo'] = "";
-
-               if ($_POST['PayType'] == payment_person_types::customer())
-               {
-                       $acc = get_branch_accounts($_POST['PersonDetailID']);
-                       $_POST['code_id'] = $acc['receivables_account'];
-               }
-               elseif ($_POST['PayType'] == payment_person_types::supplier())
-               {
-                       $acc = get_supplier_accounts($_POST['person_id']);
-                       $_POST['code_id'] = $acc['payable_account'];
-               }
-               elseif ($_POST['PayType'] == payment_person_types::WorkOrder())
-                       $_POST['code_id'] = get_company_pref('default_assembly_act');
-               else
-                       $_POST['code_id'] = get_company_pref('default_cogs_act');
-               gl_all_accounts_list('code_id', null, true, false, true);
-               if ($dim >= 1)
-                       dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
-               if ($dim > 1)
-                       dimensions_list_cells(null, 'dimension2_id', null, true, " ", false, 2);
-       }
-       if ($dim < 1)
-               hidden('dimension_id', 0);
-       if ($dim < 2)
-               hidden('dimension2_id', 0);
-
-       amount_cells(null, 'amount');
-       text_cells_ex(null, 'LineMemo', 35, 50);
-
-       if (isset($_GET['Edit']))
-       {
-       submit_cells('UpdateItem', _("Update"));
-       submit_cells('CancelItemChanges', _("Cancel"));
-       }
-       else
-               submit_cells('AddItem', _("Add Item"), "colspan=2");
-
-       end_row();
-}
-
-
-//---------------------------------------------------------------------------------
-
-function gl_options_controls()
-{
-       echo "<br><table align='center'>";
-
-       textarea_row(_("Memo"), 'memo_', null, 50, 3);
-
-       echo "</table>";
-}
-
-
-//---------------------------------------------------------------------------------
-
-?>
\ No newline at end of file
index dd1813437c7faeaad21f106a4abc2d62e0259853..11ebd0c7ca65a988e6ab7e6954b4874a5d76f661 100644 (file)
@@ -156,7 +156,7 @@ while ($myrow = db_fetch($result))
                {
                        $issue = $path_to_root . "/manufacturing/work_order_issue.php?" . SID . "trans_no=" .$myrow["id"];
                        $add_finished = $path_to_root . "/manufacturing/work_order_add_finished.php?" . SID . "trans_no=" .$myrow["id"];
-                       $costs = $path_to_root . "/gl/gl_payment.php?NewPayment=1&PayType=" . payment_person_types::WorkOrder(). "&PayPerson=" .$myrow["id"];
+                       $costs = $path_to_root . "/gl/gl_bank.php?NewPayment=1&PayType=" . payment_person_types::WorkOrder(). "&PayPerson=" .$myrow["id"];
                        $l2 = "<a href=$issue>" . _("Issue") . "</a>";
                        $l3 = "<a href=$add_finished>" . _("Produce") . "</a>";
                        $l4 = "<a href=$costs>" . _("Costs") . "</a>";