Example #1
0
function display_po_receive_items()
{
    div_start('grn_items');
    start_table(TABLESTYLE, "colspan=7 width='90%'");
    $th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"), _("Outstanding"), _("This Delivery"), _("Price"), _("Total"));
    table_header($th);
    /*show the line items on the order with the quantity being received for modification */
    $total = 0;
    $k = 0;
    //row colour counter
    if (count($_SESSION['PO']->line_items) > 0) {
        foreach ($_SESSION['PO']->line_items as $ln_itm) {
            alt_table_row_color($k);
            $qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
            if (!isset($_POST['Update']) && !isset($_POST['ProcessGoodsReceived']) && $ln_itm->receive_qty == 0) {
                //If no quantites yet input default the balance to be received
                $ln_itm->receive_qty = $qty_outstanding;
            }
            $line_total = $ln_itm->receive_qty * $ln_itm->price;
            $total += $line_total;
            label_cell($ln_itm->stock_id);
            if ($qty_outstanding > 0) {
                text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
            } else {
                label_cell($ln_itm->item_description);
            }
            $dec = get_qty_dec($ln_itm->stock_id);
            qty_cell($ln_itm->quantity, false, $dec);
            label_cell($ln_itm->units);
            qty_cell($ln_itm->qty_received, false, $dec);
            qty_cell($qty_outstanding, false, $dec);
            if ($qty_outstanding > 0) {
                qty_cells(null, $ln_itm->line_no, number_format2($ln_itm->receive_qty, $dec), "align=right", null, $dec);
            } else {
                label_cell(number_format2($ln_itm->receive_qty, $dec), "align=right");
            }
            amount_decimal_cell($ln_itm->price);
            amount_cell($line_total);
            end_row();
        }
    }
    $colspan = count($th) - 1;
    $display_sub_total = price_format($total);
    label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
    $taxes = $_SESSION['PO']->get_taxes(input_num('freight_cost'), true);
    $tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['PO']->tax_included);
    $display_total = price_format($total + input_num('freight_cost') + $tax_total);
    start_row();
    label_cells(_("Amount Total"), $display_total, "colspan={$colspan} align='right'", "align='right'");
    end_row();
    end_table();
    div_end();
}
Example #2
0
function display_po_receive_items()
{
    global $table_style;
    start_table("colspan=7 {$table_style} width=90%");
    $th = array(tr("Item Code"), tr("Description"), tr("Ordered"), tr("Units"), tr("Received"), tr("Outstanding"), tr("This Delivery"), tr("Price"), tr("Total"));
    table_header($th);
    /*show the line items on the order with the quantity being received for modification */
    $total = 0;
    $k = 0;
    //row colour counter
    if (count($_SESSION['PO']->line_items) > 0) {
        foreach ($_SESSION['PO']->line_items as $ln_itm) {
            alt_table_row_color($k);
            $qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
            if ($ln_itm->receive_qty == 0) {
                //If no quantites yet input default the balance to be received
                $ln_itm->receive_qty = $qty_outstanding;
            }
            $line_total = $ln_itm->receive_qty * $ln_itm->price;
            $total += $line_total;
            label_cell($ln_itm->stock_id);
            if ($qty_outstanding > 0) {
                text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
            } else {
                label_cell($ln_itm->item_description);
            }
            qty_cell($ln_itm->quantity);
            label_cell($ln_itm->units);
            qty_cell($ln_itm->qty_received);
            qty_cell($qty_outstanding);
            if ($qty_outstanding > 0) {
                qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right");
            } else {
                qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right", "disabled");
            }
            amount_cell($ln_itm->price);
            amount_cell($line_total);
            end_row();
        }
    }
    $display_total = number_format2($total, user_price_dec());
    label_row(tr("Total value of items received"), $display_total, "colspan=8 align=right", "nowrap align=right");
    end_table();
}
//-----------------------------------------------------------------------------------------
display_grn_items_for_selection();
//-----------------------------------------------------------------------------------------
if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") {
    $myrow = get_grn_item_detail($_POST['grn_item_id']);
    echo "<br>";
    display_heading2(tr("Delivery Item Selected For Adding To A Supplier Invoice"));
    start_table("{$table_style} width=80%");
    $th = array(tr("Sequence #"), tr("Item"), tr("Description"), tr("Quantity Outstanding"), tr("Quantity to Invoice"), tr("Order Price"), tr("Actual Price"));
    table_header($th);
    start_row();
    label_cell($_POST['grn_item_id']);
    label_cell($myrow['item_code']);
    label_cell($myrow['description']);
    qty_cell($myrow['QtyOstdg']);
    qty_cells(null, 'this_quantity_inv', qty_format($myrow['QtyOstdg']));
    amount_cell($myrow['unit_price']);
    small_amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
    end_row();
    end_table(1);
    submit_center('AddGRNToTrans', tr("Add to Invoice"));
    hidden('GRNNumber', $_POST['grn_item_id']);
    hidden('item_code', $myrow['item_code']);
    hidden('item_description', $myrow['description']);
    hidden('qty_recd', $myrow['qty_recd']);
    hidden('prev_quantity_inv', $myrow['quantity_inv']);
    hidden('order_price', $myrow['unit_price']);
    hidden('std_cost_unit', $myrow['std_cost_unit']);
    hidden('po_detail_item', $myrow['po_detail_item']);
}
//----------------------------------------------------------------------------------------
$result = get_loc_details($_POST['stock_id']);
if (@$_GET['popup']) {
    hidden('_tabs_sel', get_post('_tabs_sel'));
    hidden('popup', @$_GET['popup']);
}
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    if (isset($_POST['UpdateData']) && check_num($myrow["loc_code"])) {
        $myrow["reorder_level"] = input_num($myrow["loc_code"]);
        set_reorder_level($_POST['stock_id'], $myrow["loc_code"], input_num($myrow["loc_code"]));
        display_notification(_("Reorder levels has been updated."));
    }
    $qoh = get_qoh_on_date($_POST['stock_id'], $myrow["loc_code"]);
    label_cell($myrow["location_name"]);
    $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"], $_POST['stock_id'], $dec);
    qty_cell($qoh, false, $dec);
    qty_cells(null, $myrow["loc_code"], null, null, null, $dec);
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
}
end_table(1);
div_end();
submit_center('UpdateData', _("Update"), true, false, 'default');
if (!@$_GET['popup']) {
    end_form();
    end_page(@$_GET['popup'], false, false);
}
Example #5
0
stock_item_heading($_POST['stock_id']);
set_global_stock_item($_POST['stock_id']);
start_table("{$table_style} width=30%");
$th = array(tr("Location"), tr("Quantity On Hand"), tr("Re-Order Level"));
table_header($th);
$j = 1;
$k = 0;
//row colour counter
$result = get_loc_details($_POST['stock_id']);
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    if (isset($_POST['UpdateData']) && check_num($myrow["loc_code"])) {
        $myrow["reorder_level"] = input_num($myrow["loc_code"]);
        set_reorder_level($_POST['stock_id'], $myrow["loc_code"], input_num($myrow["loc_code"]));
    }
    $qoh = get_qoh_on_date($_POST['stock_id'], $myrow["loc_code"]);
    label_cell($myrow["location_name"]);
    $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"]);
    label_cell(number_format2($qoh, user_qty_dec()), "nowrap align='right'");
    qty_cells(null, $myrow["loc_code"]);
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
}
end_table(1);
submit('UpdateData', tr("Update"));
end_form();
end_page();
    }
}
end_table();
//-----------------------------------------------------------------------------------------
if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") {
    $myrow = get_grn_item_detail($_POST['grn_item_id']);
    echo "<br>";
    display_heading2(tr("Delivery Item Selected For Adding To A Supplier Credit Note"));
    start_table("{$table_style} width=80%");
    $th = array(tr("Sequence #"), tr("Item"), tr("Qty Already Invoiced"), tr("Quantity to Credit"), tr("Order Price"), tr("Credit Price"));
    table_header($th);
    start_row();
    label_cell($_POST['grn_item_id']);
    label_cell($myrow['item_code'] . " " . $myrow['description']);
    qty_cell($myrow["quantity_inv"]);
    qty_cells(null, 'This_QuantityCredited', qty_format(max($myrow['quantity_inv'], 0)));
    amount_cell($myrow['unit_price']);
    amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
    end_row();
    end_table(1);
    submit_center('AddGRNToTrans', tr("Add to Credit Note"));
    hidden('GRNNumber', $_POST['grn_item_id']);
    hidden('item_code', $myrow['item_code']);
    hidden('item_description', $myrow['description']);
    hidden('qty_recd', $myrow['qty_recd']);
    hidden('prev_quantity_inv', $myrow['quantity_inv']);
    hidden('order_price', $myrow['unit_price']);
    hidden('std_cost_unit', $myrow['std_cost_unit']);
    hidden('po_detail_item', $myrow['po_detail_item']);
}
end_form();