-//--------------------------------------------------------------------------------------
-
-function clear_globals()
-{
- if (isset($_SESSION['Items']))
- {
- unset($_SESSION['Items']->line_items);
- unset($_SESSION['Items']);
- }
- unset($_SESSION['InvoiceToCredit']);
-}
-
-//--------------------------------------------------------------------------------------
-
-function process_credit()
-{
- global $path_to_root;
- if (can_process())
- {
- $credit_no = credit_invoice($_SESSION['Items'], $_SESSION['InvoiceToCredit'],
- $_SESSION['Order'], $_POST['CreditDate'], $_POST['CreditType'],
- $_POST['tax_group_id'], $_POST['ChargeFreightCost'], $_POST['ref'],
- $_POST['CreditText'], $_POST['WriteOffGLCode']);
-
- clear_globals();
-
- meta_forward($_SERVER['PHP_SELF'], "AddedID=$credit_no");
- }
-}
-
-//--------------------------------------------------------------------------------------
-
-if (isset($_GET['InvoiceNumber']) && $_GET['InvoiceNumber'] > 0)
-{
-
- clear_globals();
-
- $_SESSION['InvoiceToCredit'] = $_GET['InvoiceNumber'];
- $_SESSION['Items'] = new cart;