Пример #1
0
function can_process()
{
    if (!references::is_valid($_POST['ref'])) {
        display_error(tr("You must enter a reference."));
        set_focus('ref');
        return false;
    }
    if (!is_new_reference($_POST['ref'], systypes::inventory_adjustment())) {
        display_error(tr("The entered reference is already in use."));
        set_focus('ref');
        return false;
    }
    if (!is_date($_POST['AdjDate'])) {
        display_error(tr("The entered date for the adjustment is invalid."));
        set_focus('AdjDate');
        return false;
    } elseif (!is_date_in_fiscalyear($_POST['AdjDate'])) {
        display_error(tr("The entered date is not in fiscal year."));
        set_focus('AdjDate');
        return false;
    }
    $failed_item = $_SESSION['adj_items']->check_qoh($_POST['StockLocation'], $_POST['AdjDate'], !$_POST['Increase']);
    if ($failed_item != null) {
        display_error(tr("The adjustment cannot be processed because an adjustment item would cause a negative inventory balance :") . " " . $failed_item->stock_id . " - " . $failed_item->item_description);
        return false;
    }
    return true;
}
Пример #2
0
function can_delete($selected_id)
{
    $sql = "SELECT COUNT(*) FROM stock_moves \n\t\tWHERE type=" . systypes::inventory_adjustment() . " AND person_id={$selected_id}";
    $result = db_query($sql, "could not query stock moves");
    $myrow = db_fetch_row($result);
    if ($myrow[0] > 0) {
        display_error(tr("Cannot delete this inventory movement type because item transactions have been created referring to it."));
        return false;
    }
    return true;
}
Пример #3
0
 $person = $myrow["person_id"];
 $gl_posting = "";
 if ($myrow["type"] == 10 || $myrow["type"] == 11) {
     $cust_row = get_customer_details_from_trans($myrow["type"], $myrow["trans_no"]);
     if (strlen($cust_row['name']) > 0) {
         $person = $cust_row['name'] . " (" . $cust_row['br_name'] . ")";
     }
 } elseif ($myrow["type"] == 25) {
     // get the supplier name
     $sql = "SELECT supp_name FROM suppliers WHERE supplier_id = '" . $myrow["person_id"] . "'";
     $supp_result = db_query($sql, "check failed");
     $supp_row = db_fetch($supp_result);
     if (strlen($supp_row['supp_name']) > 0) {
         $person = $supp_row['supp_name'];
     }
 } elseif ($myrow["type"] == systypes::location_transfer() || $myrow["type"] == systypes::inventory_adjustment()) {
     // get the adjustment type
     $movement_type = get_movement_type($myrow["person_id"]);
     $person = $movement_type["name"];
 } elseif ($myrow["type"] == systypes::work_order() || $myrow["type"] == 28 || $myrow["type"] == 29) {
     $person = "";
 }
 label_cell($person);
 label_cell($myrow["qty"] >= 0 ? $quantity_formatted : "", "nowrap align=right");
 label_cell($myrow["qty"] < 0 ? $quantity_formatted : "", "nowrap align=right");
 label_cell(number_format2($after_qty, user_qty_dec()), "nowrap align=right");
 end_row();
 $j++;
 if ($j == 12) {
     $j = 1;
     table_header($th);
Пример #4
0
$k = 0;
$header_shown = false;
while ($adjustment = db_fetch($adjustment_items)) {
    if (!$header_shown) {
        $adjustment_type = get_movement_type($adjustment['person_id']);
        start_table("{$table_style2} width=90%");
        start_row();
        label_cells(tr("At Location"), $adjustment['location_name'], "class='tableheader2'");
        label_cells(tr("Reference"), $adjustment['reference'], "class='tableheader2'", "colspan=6");
        label_cells(tr("Date"), sql2date($adjustment['tran_date']), "class='tableheader2'");
        label_cells(tr("Adjustment Type"), $adjustment_type['name'], "class='tableheader2'");
        end_row();
        comments_display_row(systypes::inventory_adjustment(), $trans_no);
        end_table();
        $header_shown = true;
        echo "<br>";
        start_table("{$table_style} width=90%");
        $th = array(tr("Item"), tr("Description"), tr("Quantity"), tr("Units"), tr("Unit Cost"));
        table_header($th);
    }
    alt_table_row_color($k);
    label_cell($adjustment['stock_id']);
    label_cell($adjustment['description']);
    qty_cell($adjustment['qty']);
    label_cell($adjustment['units']);
    amount_cell($adjustment['standard_cost']);
    end_row();
}
end_table(1);
is_voided_display(systypes::inventory_adjustment(), $trans_no, tr("This adjustment has been voided."));
end_page(true);