Exemplo n.º 1
0
}
//-----------------------------------------------------------------------------
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;
    }
}
//-----------------------------------------------------------------------------
start_form(false, true);
$customer_error = display_credit_header($_SESSION['Items']);
if ($customer_error == "") {
    start_table("{$table_style} width=80%", 10);
    echo "<tr><td>";
    display_credit_items(tr("Credit Note Items"), $_SESSION['Items']);
    credit_options_controls();
    echo "</td></tr>";
    end_table();
} else {
    display_error($customer_error);
}
echo "<br><center><table><tr>";
submit_cells('Update', tr("Update"));
submit_cells('ProcessCredit', tr("Process Credit Note"));
echo "</tr></table>";
end_form();
end_page();
    div_start('options');
    start_table(TABLESTYLE2);
    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 "</table>";
    div_end();
}
//-----------------------------------------------------------------------------
if (get_post('Update')) {
    $Ajax->activate('credit_items');
}
//-----------------------------------------------------------------------------
display_credit_items();
display_credit_options();
echo "<br><center>";
submit('Update', _("Update"), true, _('Update credit value for quantities entered'), true);
echo "&nbsp";
submit('ProcessCredit', _("Process Credit Note"), true, '', 'default');
echo "</center>";
end_form();
end_page();