Example #1
0
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
$page_security = 'SA_ITEMSTRANSVIEW';
$path_to_root = "../..";
include $path_to_root . "/includes/session.inc";
page(_($help_context = "View Inventory Adjustment"), true);
include_once $path_to_root . "/includes/date_functions.inc";
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/inventory/includes/inventory_db.inc";
if (isset($_GET["trans_no"])) {
    $trans_no = $_GET["trans_no"];
}
display_heading($systypes_array[ST_INVADJUST] . " #{$trans_no}");
br(1);
$adjustment_items = get_stock_adjustment_items($trans_no);
$k = 0;
$header_shown = false;
while ($adjustment = db_fetch($adjustment_items)) {
    if (!$header_shown) {
        $adjustment_type = get_movement_type($adjustment['person_id']);
        start_table(TABLESTYLE2, "width='90%'");
        start_row();
        label_cells(_("At Location"), $adjustment['location_name'], "class='tableheader2'");
        label_cells(_("Reference"), $adjustment['reference'], "class='tableheader2'", "colspan=6");
        label_cells(_("Date"), sql2date($adjustment['tran_date']), "class='tableheader2'");
        label_cells(_("Adjustment Type"), $adjustment_type['name'], "class='tableheader2'");
        end_row();
        comments_display_row(ST_INVADJUST, $trans_no);
        end_table();
        $header_shown = true;
function exist_transaction($type, $type_no)
{
    $void_entry = get_voided_entry($type, $type_no);
    if ($void_entry != null) {
        return false;
    }
    switch ($type) {
        case ST_JOURNAL:
            // it's a journal entry
            if (!exists_gl_trans($type, $type_no)) {
                return false;
            }
            break;
        case ST_BANKPAYMENT:
            // it's a payment
        // it's a payment
        case ST_BANKDEPOSIT:
            // it's a deposit
        // it's a deposit
        case ST_BANKTRANSFER:
            // it's a transfer
            if (!exists_bank_trans($type, $type_no)) {
                return false;
            }
            break;
        case ST_SALESINVOICE:
            // it's a customer invoice
        // it's a customer invoice
        case ST_CUSTCREDIT:
            // it's a customer credit note
        // it's a customer credit note
        case ST_CUSTPAYMENT:
            // it's a customer payment
        // it's a customer payment
        case ST_CUSTDELIVERY:
            // it's a customer dispatch
            if (!exists_customer_trans($type, $type_no)) {
                return false;
            }
            break;
        case ST_LOCTRANSFER:
            // it's a stock transfer
            if (get_stock_transfer_items($type_no) == null) {
                return false;
            }
            break;
        case ST_INVADJUST:
            // it's a stock adjustment
            if (get_stock_adjustment_items($type_no) == null) {
                return false;
            }
            break;
        case ST_PURCHORDER:
            // it's a PO
            return false;
        case ST_SUPPRECEIVE:
            // it's a GRN
            if (exists_grn($type_no)) {
                return false;
            }
            break;
        case ST_SUPPINVOICE:
            // it's a suppler invoice
        // it's a suppler invoice
        case ST_SUPPCREDIT:
            // it's a supplier credit note
        // it's a supplier credit note
        case ST_SUPPAYMENT:
            // it's a supplier payment
            if (!exists_supp_trans($type, $type_no)) {
                return false;
            }
            break;
        case ST_WORKORDER:
            // it's a work order
            if (!get_work_order($type_no, true)) {
                return false;
            }
            break;
        case ST_MANUISSUE:
            // it's a work order issue
            if (!exists_work_order_issue($type_no)) {
                return false;
            }
            break;
        case ST_MANURECEIVE:
            // it's a work order production
            if (!exists_work_order_produce($type_no)) {
                return false;
            }
            break;
        case ST_SALESORDER:
            // it's a sales order
        // it's a sales order
        case ST_SALESQUOTE:
            // it's a sales quotation
            return false;
        case ST_COSTUPDATE:
            // it's a stock cost update
            return false;
            break;
    }
    return true;
}