Example #1
0
function print_bill_of_material()
{
    global $path_to_root;
    $frompart = $_POST['PARAM_0'];
    $topart = $_POST['PARAM_1'];
    $comments = $_POST['PARAM_2'];
    $orientation = $_POST['PARAM_3'];
    $destination = $_POST['PARAM_4'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $cols = array(0, 50, 305, 375, 445, 515);
    $headers = array(_('Component'), _('Description'), _('Loc'), _('Wrk Ctr'), _('Quantity'));
    $aligns = array('left', 'left', 'left', 'left', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Component'), 'from' => $frompart, 'to' => $topart));
    $rep = new FrontReport(_('Bill of Material Listing'), "BillOfMaterial", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($frompart, $topart);
    $parent = '';
    while ($trans = db_fetch($res)) {
        if ($parent != $trans['parent']) {
            if ($parent != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 1, $trans['parent']);
            $desc = get_item($trans['parent']);
            $rep->TextCol(1, 2, $desc['description']);
            $parent = $trans['parent'];
            $rep->NewLine();
        }
        $rep->NewLine();
        $dec = get_qty_dec($trans['component']);
        $rep->TextCol(0, 1, $trans['component']);
        $rep->TextCol(1, 2, $trans['CompDescription']);
        //$rep->TextCol(2, 3, $trans['loc_code']);
        //$rep->TextCol(3, 4, $trans['workcentre_added']);
        $wc = get_work_centre($trans['workcentre_added']);
        $rep->TextCol(2, 3, get_location_name($trans['loc_code']));
        $rep->TextCol(3, 4, $wc['name']);
        $rep->AmountCol(4, 5, $trans['quantity'], $dec);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
Example #2
0
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["name"]);
    label_cell($myrow["description"]);
    inactive_control_cell($myrow["id"], $myrow["inactive"], 'workcentres', 'id');
    edit_button_cell("Edit" . $myrow['id'], _("Edit"));
    delete_button_cell("Delete" . $myrow['id'], _("Delete"));
    end_row();
}
inactive_control_row($th);
end_table(1);
//-----------------------------------------------------------------------------------
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing status code
        $myrow = get_work_centre($selected_id);
        $_POST['name'] = $myrow["name"];
        $_POST['description'] = $myrow["description"];
    }
    hidden('selected_id', $selected_id);
}
text_row_ex(_("Name:"), 'name', 40);
text_row_ex(_("Description:"), 'description', 50);
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
//------------------------------------------------------------------------------------
end_page();