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']))
//-----------------------------------------------------------------------------------------------
$id = find_submit('Delete');
-if ($id != -1) {
- copy_from_py();
+if ($id != -1)
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'])) {
+if (isset($_POST['CancelItemChanges']))
line_start_focus();
-}
+
//-----------------------------------------------------------------------------------------------
// 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_']);
- }
-
+ exchange_rate_display($bank_currency, $person_currency, $_POST['date_']);
+
echo "</table>"; // inner table
echo "</td><td>";
$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);
+ $item = $order->gl_items[$Index];
+ $_POST['code_id'] = $item->code_id;
+ $_POST['dimension_id'] = $item->dimension_id;
+ $_POST['dimension2_id'] = $item->dimension2_id;
+ $_POST['amount'] = price_format(abs($item->amount));
+ $_POST['description'] = $item->description;
+ $_POST['LineMemo'] = $item->reference;
+
+ hidden('Index', $item->index);
+ hidden('code_id', $item->code_id);
label_cell($_POST['code_id']);
- label_cell($order->gl_items[$Index]->description);
+ label_cell($item->description);
if ($dim >= 1)
dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
if ($dim > 1)
$Ajax->activate('items_table');
set_focus('_stock_id_edit');
}
-//--------------------------------------------------------------------------------------------------
-
-function copy_to_st()
-{
- $_SESSION['adj_items']->from_loc = $_POST['StockLocation'];
- $_SESSION['adj_items']->tran_date = $_POST['AdjDate'];
- $_SESSION['adj_items']->transfer_type = $_POST['type'];
- $_SESSION['adj_items']->increase = $_POST['Increase'];
- $_SESSION['adj_items']->memo_ = $_POST['memo_'];
-}
-//--------------------------------------------------------------------------------------------------
-
-function copy_from_st()
-{
- $_POST['StockLocation'] = $_SESSION['adj_items']->from_loc;
- $_POST['AdjDate'] = $_SESSION['adj_items']->tran_date;
- $_POST['type'] = $_SESSION['adj_items']->transfer_type;
- $_POST['Increase'] = $_SESSION['adj_items']->increase;
- $_POST['memo_'] = $_SESSION['adj_items']->memo_;
-}
-
//-----------------------------------------------------------------------------------------------
function handle_new_order()
if ($id != -1)
handle_delete_item($id);
-if (isset($_POST['AddItem']) || isset($_POST['UpdateItem'])) {
- copy_to_st();
- line_start_focus();
-}
-
if (isset($_POST['AddItem']))
handle_new_item();
$Ajax->activate('items_table');
set_focus('_stock_id_edit');
}
-//--------------------------------------------------------------------------------------------------
-
-function copy_to_st()
-{
- $_SESSION['transfer_items']->from_loc = $_POST['FromStockLocation'];
- $_SESSION['transfer_items']->to_loc = $_POST['ToStockLocation'];
- $_SESSION['transfer_items']->tran_date = $_POST['AdjDate'];
- $_SESSION['transfer_items']->transfer_type = $_POST['type'];
- $_SESSION['transfer_items']->memo_ = $_POST['memo_'];
-}
-//--------------------------------------------------------------------------------------------------
-
-function copy_from_st()
-{
- $_POST['FromStockLocation'] = $_SESSION['transfer_items']->from_loc;
- $_POST['ToStockLocation'] = $_SESSION['transfer_items']->to_loc;
- $_POST['AdjDate'] = $_SESSION['transfer_items']->tran_date;
- $_POST['type'] = $_SESSION['transfer_items']->transfer_type;
- $_POST['memo_'] = $_SESSION['transfer_items']->memo_;
-}
-
//-----------------------------------------------------------------------------------------------
function handle_new_order()
$id = find_submit('Delete');
if ($id != -1)
handle_delete_item($id);
-
-if (isset($_POST['AddItem']) || isset($_POST['UpdateItem'])) {
- copy_to_st();
- line_start_focus();
-}
if (isset($_POST['AddItem']))
handle_new_item();
}
//--------------------------------------------------------------------------------------------------
-function copy_to_po()
-{
- $_SESSION['PO']->supplier_id = $_POST['supplier_id'];
- $_SESSION['PO']->orig_order_date = $_POST['OrderDate'];
- $_SESSION['PO']->reference = $_POST['ref'];
- $_SESSION['PO']->requisition_no = $_POST['Requisition'];
- $_SESSION['PO']->Comments = $_POST['Comments'];
- $_SESSION['PO']->Location = $_POST['StkLocation'];
- $_SESSION['PO']->delivery_address = $_POST['delivery_address'];
-}
-
-//--------------------------------------------------------------------------------------------------
-
-function copy_from_po()
-{
- $_POST['supplier_id'] = $_SESSION['PO']->supplier_id;
- $_POST['OrderDate'] = $_SESSION['PO']->orig_order_date;
- $_POST['Requisition'] = $_SESSION['PO']->requisition_no;
- $_POST['ref'] = $_SESSION['PO']->reference;
- $_POST['Comments'] = $_SESSION['PO']->Comments;
- $_POST['StkLocation'] = $_SESSION['PO']->Location;
- $_POST['delivery_address'] = $_SESSION['PO']->delivery_address;
-}
-
-//--------------------------------------------------------------------------------------------------
-
function unset_form_variables() {
unset($_POST['stock_id']);
unset($_POST['qty']);
if (!$_SESSION['PO']->order_no)
{
- if (!references::is_valid($_SESSION['PO']->reference))
+ if (!references::is_valid(get_post('ref')))
{
display_error(_("There is no reference entered for this purchase order."));
set_focus('ref');
return false;
}
- if (!is_new_reference($_SESSION['PO']->reference, systypes::po()))
+ if (!is_new_reference(get_post('ref'), systypes::po()))
{
display_error(_("The entered reference is already in use."));
set_focus('ref');
}
}
- if ($_SESSION['PO']->delivery_address == "")
+ if (get_post('delivery_address') == '')
{
display_error(_("There is no delivery address specified."));
set_focus('delivery_address');
return false;
}
- if (!isset($_SESSION['PO']->Location) || $_SESSION['PO']->Location == "")
+ if (get_post('StkLocation') == '')
{
display_error(_("There is no location specified to move any items into."));
set_focus('StkLocation');
function handle_commit_order()
{
- copy_to_po();
if (can_commit())
{
+ $_SESSION['PO']->supplier_id = $_POST['supplier_id'];
+ $_SESSION['PO']->orig_order_date = $_POST['OrderDate'];
+ $_SESSION['PO']->reference = $_POST['ref'];
+ $_SESSION['PO']->requisition_no = $_POST['Requisition'];
+ $_SESSION['PO']->Comments = $_POST['Comments'];
+ $_SESSION['PO']->Location = $_POST['StkLocation'];
+ $_SESSION['PO']->delivery_address = $_POST['delivery_address'];
if ($_SESSION['PO']->order_no == 0)
{
if ($id != -1)
handle_delete_item($id);
-if (isset($_POST['Delete']) || isset($_POST['Edit']))
-{
- copy_from_po();
-}
-
if (isset($_POST['Commit']))
{
handle_commit_order();
}
if (isset($_POST['UpdateLine']))
-{
- copy_to_po();
handle_update_item();
-}
+
if (isset($_POST['EnterLine']))
-{
- copy_to_po();
handle_add_new_item();
-}
+
if (isset($_POST['CancelOrder']))
-{
handle_cancel_po();
-}
+
if (isset($_POST['CancelUpdate']))
-{
- copy_to_po();
unset_form_variables();
-}
+
if (isset($_GET['ModifyOrderNumber']) && $_GET['ModifyOrderNumber'] != "")
{
create_new_po();
/*read in all the selected order into the Items cart */
read_po($_SESSION['PO']->order_no, $_SESSION['PO']);
- copy_from_po();
+
+ $_POST['supplier_id'] = $_SESSION['PO']->supplier_id;
+ $_POST['OrderDate'] = $_SESSION['PO']->orig_order_date;
+ $_POST['Requisition'] = $_SESSION['PO']->requisition_no;
+ $_POST['ref'] = $_SESSION['PO']->reference;
+ $_POST['Comments'] = $_SESSION['PO']->Comments;
+ $_POST['StkLocation'] = $_SESSION['PO']->Location;
+ $_POST['delivery_address'] = $_SESSION['PO']->delivery_address;
}
+
if (isset($_POST['CancelUpdate']) || isset($_POST['UpdateLine'])) {
line_start_focus();
}
-//--------------------------------------------------------------------------------
-
if (isset($_GET['NewOrder']))
-{
create_new_po();
-}
-else
-{
- if (!isset($_POST['supplier_id']))
- $_POST['supplier_id'] = $_SESSION['PO']->supplier_id;
- 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;
-}
//---------------------------------------------------------------------------------------------------
if ($id!=-1)
handle_delete_item($id);
-if (isset($_POST['AddItem']) || isset($_POST['UpdateItem']))
- copy_to_cn();
-
if (isset($_POST['AddItem']))
handle_new_item();
if (isset($_POST['UpdateItem']))
handle_update_item();
-if (isset($_POST['CancelItemChanges']) || isset($_POST['UpdateItem']))
+if (isset($_POST['CancelItemChanges']))
line_start_focus();
//-----------------------------------------------------------------------------
if (!processing_active()) {
handle_new_credit();
-} else {
- if (!isset($_POST['customer_id']))
- $_POST['customer_id'] = $_SESSION['Items']->customer_id;
- if (!isset($_POST['branch_id']))
- $_POST['branch_id'] = $_SESSION['Items']->Branch;
}
//-----------------------------------------------------------------------------
input_num('qty'), input_num('price'),
input_num('Disc') / 100 );
}
- copy_from_cart();
line_start_focus();
}
if (isset($_POST['AddItem']))
handle_new_item();
-if (isset($_POST['CancelItemChanges']) || isset($_POST['UpdateItem'])) {
+if (isset($_POST['CancelItemChanges'])) {
line_start_focus();
}