you just need to read the code , the first 50 lines;
if (isset($_GET['ModifyOrderNumber']) && is_numeric($_GET['ModifyOrderNumber'])) {
$_SESSION['page_title'] = _($help_context = "Modify Purchase Order #") . $_GET['ModifyOrderNumber'];
create_new_po(ST_PURCHORDER, $_GET['ModifyOrderNumber']);
copy_from_cart();
} elseif (isset($_GET['NewOrder'])) {
$_SESSION['page_title'] = _($help_context = "Purchase Order Entry");
create_new_po(ST_PURCHORDER, 0);
copy_from_cart();
} elseif (isset($_GET['NewGRN'])) {
$_SESSION['page_title'] = _($help_context = "Direct GRN Entry");
create_new_po(ST_SUPPRECEIVE, 0);
copy_from_cart();
} elseif (isset($_GET['NewInvoice'])) {
$_SESSION['page_title'] = _($help_context = "Direct Purchase Invoice Entry");
create_new_po(ST_SUPPINVOICE, 0);
copy_from_cart();
}
it's a pattern-like: isset($_GET['NewOrder']) tests what is sent next to the url po_entry_items.php?NewInvoice,
if it's true, the code calls the function create_new_po(ST_SUPPINVOICE, 0); which create a purch_order object (see po_class.inc). this class can define three type : order/grn/invoice by changing the $trans_type value.
ST_SUPPINVOICE is defined at the beginning (see set_page_security).
the object display is handled by display_po_items() and display_po_header() which display the $_SESSION['PO'] or $cart based on the value of $trans_type.
ps: @FA_developpers, please use braces when using "if () statement", i have a hard time reading the code.....
abdelghani