Exemplo n.º 1
0
function print_work_order_listing()
{
    global $path_to_root, $wo_types_array;
    $item = $_POST['PARAM_0'];
    $location = $_POST['PARAM_1'];
    $open_only = $_POST['PARAM_2'];
    $comments = $_POST['PARAM_3'];
    $orientation = $_POST['PARAM_4'];
    $destination = $_POST['PARAM_5'];
    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';
    if ($item == '') {
        $items = _('All');
    } else {
        $row = get_item($item);
        $items = $row['description'];
    }
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    $open = $open_only == 1 ? _('Yes') : _('No');
    $cols = array(0, 100, 120, 165, 210, 275, 315, 375, 385, 440, 495, 555);
    $headers = array(_('Type'), '#', 'Reference', _('Location'), _('Item'), _('Required'), _('Manufactured'), ' ', _('Date'), _('Required By'), _('Closed'));
    $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'left', 'left', 'left', 'left');
    $params = array(0 => $comments, 1 => array('text' => _('Items'), 'from' => $items, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 3 => array('text' => _('Open Only'), 'from' => $open, 'to' => ''));
    $rep = new FrontReport(_('Work Order Listing'), "WorkOrderListing", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($item, $open_only, $location);
    while ($trans = db_fetch($res)) {
        $rep->TextCol(0, 1, $wo_types_array[$trans['type']]);
        $rep->TextCol(1, 2, $trans['id'], -1);
        $rep->TextCol(2, 3, $trans['wo_ref'], -1);
        $rep->TextCol(3, 4, $trans['location_name'], -1);
        $rep->TextCol(4, 5, $trans['description'], -1);
        $dec = get_qty_dec($trans['stock_id']);
        $rep->AmountCol(5, 6, $trans['units_reqd'], $dec);
        $rep->AmountCol(6, 7, $trans['units_issued'], $dec);
        $rep->TextCol(7, 8, '', -1);
        $rep->TextCol(8, 9, sql2date($trans['date_']), -1);
        $rep->TextCol(9, 10, sql2date($trans['required_by']), -1);
        $rep->TextCol(10, 11, $trans['closed'] ? ' ' : _('No'), -1);
        $rep->NewLine();
    }
    $rep->Line($rep->row);
    $rep->End();
}
Exemplo n.º 2
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();
}
Exemplo n.º 3
0
function inventory_movements()
{
    global $path_to_root;
    $from_date = $_POST['PARAM_0'];
    $to_date = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $comments = $_POST['PARAM_4'];
    $orientation = $_POST['PARAM_5'];
    $destination = $_POST['PARAM_6'];
    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';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    $cols = array(0, 60, 130, 160, 185, 215, 250, 275, 305, 340, 365, 395, 430, 455, 485, 520);
    $headers = array(_('Category'), _('Description'), _('UOM'), '', '', _('OpeningStock'), '', '', _('StockIn'), '', '', _('Delivery'), '', '', _('ClosingStock'));
    $headers2 = array("", "", "", _("QTY"), _("Rate"), _("Value"), _("QTY"), _("Rate"), _("Value"), _("QTY"), _("Rate"), _("Value"), _("QTY"), _("Rate"), _("Value"));
    $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from_date, 'to' => $to_date), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(_('Costed Inventory Movements'), "CostedInventoryMovements", user_pagesize(), 8, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $totval_open = $totval_in = $totval_out = $totval_close = 0;
    $result = fetch_items($category);
    $dec = user_price_dec();
    $catgor = '';
    while ($myrow = db_fetch($result)) {
        if ($catgor != $myrow['description']) {
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['category_id'] . " - " . $myrow['description']);
            $catgor = $myrow['description'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $myrow['stock_id']);
        $rep->TextCol(1, 2, $myrow['name']);
        $rep->TextCol(2, 3, $myrow['units']);
        $qoh_start = get_qoh_on_date($myrow['stock_id'], $location, add_days($from_date, -1));
        $qoh_end = get_qoh_on_date($myrow['stock_id'], $location, $to_date);
        $inward = trans_qty($myrow['stock_id'], $location, $from_date, $to_date);
        $outward = trans_qty($myrow['stock_id'], $location, $from_date, $to_date, false);
        $openCost = avg_unit_cost($myrow['stock_id'], $location, $from_date);
        $unitCost = avg_unit_cost($myrow['stock_id'], $location, add_days($to_date, 1));
        $rep->AmountCol(3, 4, $qoh_start, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(4, 5, $openCost, $dec);
        $openCost *= $qoh_start;
        $totval_open += $openCost;
        $rep->AmountCol(5, 6, $openCost);
        if ($inward > 0) {
            $rep->AmountCol(6, 7, $inward, get_qty_dec($myrow['stock_id']));
            $unitCost_in = trans_qty_unit_cost($myrow['stock_id'], $location, $from_date, $to_date);
            $rep->AmountCol(7, 8, $unitCost_in, $dec);
            $unitCost_in *= $inward;
            $totval_in += $unitCost_in;
            $rep->AmountCol(8, 9, $unitCost_in);
        }
        if ($outward > 0) {
            $rep->AmountCol(9, 10, $outward, get_qty_dec($myrow['stock_id']));
            $unitCost_out = trans_qty_unit_cost($myrow['stock_id'], $location, $from_date, $to_date, false);
            $rep->AmountCol(10, 11, $unitCost_out, $dec);
            $unitCost_out *= $outward;
            $totval_out += $unitCost_out;
            $rep->AmountCol(11, 12, $unitCost_out);
        }
        $rep->AmountCol(12, 13, $qoh_end, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(13, 14, $unitCost, $dec);
        $unitCost *= $qoh_end;
        $totval_close += $unitCost;
        $rep->AmountCol(14, 15, $unitCost);
        $rep->NewLine(0, 1);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine(2);
    $rep->TextCol(0, 1, _("Total"));
    $rep->AmountCol(5, 6, $totval_open);
    $rep->AmountCol(8, 9, $totval_in);
    $rep->AmountCol(11, 12, $totval_out);
    $rep->AmountCol(14, 15, $totval_close);
    $rep->Line($rep->row - 4);
    $rep->End();
}
Exemplo n.º 4
0
function print_stock_check()
{
    global $path_to_root, $pic_height;
    $category = $_POST['PARAM_0'];
    $location = $_POST['PARAM_1'];
    $pictures = $_POST['PARAM_2'];
    $check = $_POST['PARAM_3'];
    $shortage = $_POST['PARAM_4'];
    $no_zeros = $_POST['PARAM_5'];
    $like = $_POST['PARAM_6'];
    $comments = $_POST['PARAM_7'];
    $orientation = $_POST['PARAM_8'];
    $destination = $_POST['PARAM_9'];
    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';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == ALL_TEXT) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    if ($shortage) {
        $short = _('Yes');
        $available = _('Shortage');
    } else {
        $short = _('No');
        $available = _('Available');
    }
    if ($no_zeros) {
        $nozeros = _('Yes');
    } else {
        $nozeros = _('No');
    }
    if ($check) {
        $cols = array(0, 75, 225, 250, 295, 345, 390, 445, 515);
        $headers = array(_('Stock ID'), _('Description'), _('UOM'), _('Quantity'), _('Check'), _('Demand'), $available, _('On Order'));
        $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right', 'right');
    } else {
        $cols = array(0, 75, 225, 250, 315, 380, 445, 515);
        $headers = array(_('Stock ID'), _('Description'), _('UOM'), _('Quantity'), _('Demand'), $available, _('On Order'));
        $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right');
    }
    $params = array(0 => $comments, 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 3 => array('text' => _('Only Shortage'), 'from' => $short, 'to' => ''), 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
    if ($pictures) {
        $user_comp = user_company();
    } else {
        $user_comp = "";
    }
    $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location, $like);
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($location == 'all') {
            $loc_code = "";
        } else {
            $loc_code = $location;
        }
        $demandqty = get_demand_qty($trans['stock_id'], $loc_code);
        $demandqty += get_demand_asm_qty($trans['stock_id'], $loc_code);
        $onorder = get_on_porder_qty($trans['stock_id'], $loc_code);
        $flag = get_mb_flag($trans['stock_id']);
        if ($flag == 'M') {
            $onorder += get_on_worder_qty($trans['stock_id'], $loc_code);
        }
        if ($no_zeros && $trans['QtyOnHand'] == 0 && $demandqty == 0 && $onorder == 0) {
            continue;
        }
        if ($shortage && $trans['QtyOnHand'] - $demandqty >= 0) {
            continue;
        }
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 2, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $rep->NewLine();
        $dec = get_qty_dec($trans['stock_id']);
        $rep->TextCol(0, 1, $trans['stock_id']);
        $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
        $rep->TextCol(2, 3, $trans['units']);
        $rep->AmountCol(3, 4, $trans['QtyOnHand'], $dec);
        if ($check) {
            $rep->TextCol(4, 5, "_________");
            $rep->AmountCol(5, 6, $demandqty, $dec);
            $rep->AmountCol(6, 7, $trans['QtyOnHand'] - $demandqty, $dec);
            $rep->AmountCol(7, 8, $onorder, $dec);
        } else {
            $rep->AmountCol(4, 5, $demandqty, $dec);
            $rep->AmountCol(5, 6, $trans['QtyOnHand'] - $demandqty, $dec);
            $rep->AmountCol(6, 7, $onorder, $dec);
        }
        if ($pictures) {
            $image = company_path() . '/images/' . item_img_name($trans['stock_id']) . '.jpg';
            if (file_exists($image)) {
                $rep->NewLine();
                if ($rep->row - $pic_height < $rep->bottomMargin) {
                    $rep->NewPage();
                }
                $rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, 0, $pic_height);
                $rep->row -= $pic_height;
                $rep->NewLine();
            }
        }
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
Exemplo n.º 5
0
function print_inventory_planning()
{
    global $path_to_root;
    $category = $_POST['PARAM_0'];
    $location = $_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';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == ALL_TEXT) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    $cols = array(0, 50, 150, 180, 210, 240, 270, 300, 330, 390, 435, 480, 525);
    $per0 = strftime('%b', mktime(0, 0, 0, date('m'), 1, date('Y')));
    $per1 = strftime('%b', mktime(0, 0, 0, date('m') - 1, 1, date('Y')));
    $per2 = strftime('%b', mktime(0, 0, 0, date('m') - 2, 1, date('Y')));
    $per3 = strftime('%b', mktime(0, 0, 0, date('m') - 3, 1, date('Y')));
    $per4 = strftime('%b', mktime(0, 0, 0, date('m') - 4, 1, date('Y')));
    $headers = array(_('Category'), '', $per4, $per3, $per2, $per1, $per0, '3*M', _('QOH'), _('Cust Ord'), _('Supp Ord'), _('Sugg Ord'));
    $aligns = array('left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(_('Inventory Planning Report'), "InventoryPlanning", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location);
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 2, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        if ($location == 'all') {
            $loc_code = "";
        } else {
            $loc_code = $location;
        }
        $custqty = get_demand_qty($trans['stock_id'], $loc_code);
        $custqty += get_demand_asm_qty($trans['stock_id'], $loc_code);
        $suppqty = get_on_porder_qty($trans['stock_id'], $loc_code);
        $suppqty += get_on_worder_qty($trans['stock_id'], $loc_code);
        $period = getPeriods($trans['stock_id'], $trans['loc_code']);
        $rep->NewLine();
        $dec = get_qty_dec($trans['stock_id']);
        $rep->TextCol(0, 1, $trans['stock_id']);
        $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
        $rep->AmountCol(2, 3, $period['prd0'], $dec);
        $rep->AmountCol(3, 4, $period['prd1'], $dec);
        $rep->AmountCol(4, 5, $period['prd2'], $dec);
        $rep->AmountCol(5, 6, $period['prd3'], $dec);
        $rep->AmountCol(6, 7, $period['prd4'], $dec);
        $MaxMthSales = Max($period['prd0'], $period['prd1'], $period['prd2'], $period['prd3']);
        $IdealStockHolding = $MaxMthSales * 3;
        $rep->AmountCol(7, 8, $IdealStockHolding, $dec);
        $rep->AmountCol(8, 9, $trans['qty_on_hand'], $dec);
        $rep->AmountCol(9, 10, $custqty, $dec);
        $rep->AmountCol(10, 11, $suppqty, $dec);
        $SuggestedTopUpOrder = $IdealStockHolding - $trans['qty_on_hand'] + $custqty - $suppqty;
        if ($SuggestedTopUpOrder < 0.0) {
            $SuggestedTopUpOrder = 0.0;
        }
        $rep->AmountCol(11, 12, $SuggestedTopUpOrder, $dec);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
    echo "";
}
?>
    </ul>
    
  </div>
	<!-- /菜单 -->


	<!-- 主体 -->
	<div  class="wrapper">

  
<div class="main">
<div class="main_nav"><a rel="nofollow" href="/">首页</a>&gt;<?php 
echo get_location_name($info["category_id"]);
?>
&gt;<p  id="tit"><a class="red fwb"href="<?php 
echo U('Article/detail?id=' . $info['id']);
?>
"><?php 
echo $info["title"];
?>
</a></p></div>
<div class="details">
<div class="details_left">
<!-- 商品描述-->
<div class="details_left_top">
<!-- jqzoom-->
<div id=wwwzzjsnet>
	<div class=jqzoom id=spec-n1 ><IMG height="350" src="<?php 
Exemplo n.º 7
0
function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $fromcust = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $orientation = $_POST['PARAM_6'];
    $destination = $_POST['PARAM_7'];
    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';
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    if ($fromcust == '') {
        $fromc = _('All');
    } else {
        $fromc = get_customer_name($fromcust);
    }
    $cols = array(0, 75, 175, 250, 300, 375, 450, 515);
    $headers = array(_('Category'), _('Description'), _('Customer'), _('Qty'), _('Sales'), _('Cost'), _('Contribution'));
    if ($fromcust != '') {
        $headers[2] = '';
    }
    $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 4 => array('text' => _('Customer'), 'from' => $fromc, 'to' => ''));
    $rep = new FrontReport(_('Inventory Sales Report'), "InventorySalesReport", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location, $fromcust, $from, $to);
    $total = $grandtotal = 0.0;
    $total1 = $grandtotal1 = 0.0;
    $total2 = $grandtotal2 = 0.0;
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->NewLine(2, 3);
                $rep->TextCol(0, 4, _('Total'));
                $rep->AmountCol(4, 5, $total, $dec);
                $rep->AmountCol(5, 6, $total1, $dec);
                $rep->AmountCol(6, 7, $total2, $dec);
                $rep->Line($rep->row - 2);
                $rep->NewLine();
                $rep->NewLine();
                $total = $total1 = $total2 = 0.0;
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 6, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $curr = get_customer_currency($trans['debtor_no']);
        $rate = get_exchange_rate_from_home_currency($curr, sql2date($trans['tran_date']));
        $trans['amt'] *= $rate;
        $cb = $trans['amt'] - $trans['cost'];
        $rep->NewLine();
        $rep->fontSize -= 2;
        $rep->TextCol(0, 1, $trans['stock_id']);
        if ($fromcust == ALL_TEXT) {
            $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
            $rep->TextCol(2, 3, $trans['debtor_name']);
        } else {
            $rep->TextCol(1, 3, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
        }
        $rep->AmountCol(3, 4, $trans['qty'], get_qty_dec($trans['stock_id']));
        $rep->AmountCol(4, 5, $trans['amt'], $dec);
        $rep->AmountCol(5, 6, $trans['cost'], $dec);
        $rep->AmountCol(6, 7, $cb, $dec);
        $rep->fontSize += 2;
        $total += $trans['amt'];
        $total1 += $trans['cost'];
        $total2 += $cb;
        $grandtotal += $trans['amt'];
        $grandtotal1 += $trans['cost'];
        $grandtotal2 += $cb;
    }
    $rep->NewLine(2, 3);
    $rep->TextCol(0, 4, _('Total'));
    $rep->AmountCol(4, 5, $total, $dec);
    $rep->AmountCol(5, 6, $total1, $dec);
    $rep->AmountCol(6, 7, $total2, $dec);
    $rep->Line($rep->row - 2);
    $rep->NewLine();
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 4, _('Grand Total'));
    $rep->AmountCol(4, 5, $grandtotal, $dec);
    $rep->AmountCol(5, 6, $grandtotal1, $dec);
    $rep->AmountCol(6, 7, $grandtotal2, $dec);
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
Exemplo n.º 8
0
function print_order_status_list()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $backorder = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $orientation = $_POST['PARAM_6'];
    $destination = $_POST['PARAM_7'];
    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';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($location == ALL_TEXT) {
        $location = null;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == null) {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    if ($backorder == 0) {
        $back = _('All Orders');
    } else {
        $back = _('Back Orders Only');
    }
    $cols = array(0, 60, 150, 260, 325, 385, 450, 515);
    $headers2 = array(_('Order'), _('Customer'), _('Branch'), _('Customer Ref'), _('Ord Date'), _('Del Date'), _('Loc'));
    $aligns = array('left', 'left', 'right', 'right', 'right', 'right', 'right');
    $headers = array(_('Code'), _('Description'), _('Ordered'), _('Delivered'), _('Outstanding'), '');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 4 => array('text' => _('Selection'), 'from' => $back, 'to' => ''));
    $aligns2 = $aligns;
    $rep = new FrontReport(_('Order Status Listing'), "OrderStatusListing", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $cols2 = $cols;
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
    $rep->NewPage();
    $orderno = 0;
    $result = GetSalesOrders($from, $to, $category, $location, $backorder);
    while ($myrow = db_fetch($result)) {
        $rep->NewLine(0, 2, false, $orderno);
        if ($orderno != $myrow['order_no']) {
            if ($orderno != 0) {
                $rep->Line($rep->row);
                $rep->NewLine();
            }
            $rep->TextCol(0, 1, $myrow['order_no']);
            $rep->TextCol(1, 2, get_customer_name($myrow['debtor_no']));
            $rep->TextCol(2, 3, get_branch_name($myrow['branch_code']));
            $rep->TextCol(3, 4, $myrow['customer_ref']);
            $rep->DateCol(4, 5, $myrow['ord_date'], true);
            $rep->DateCol(5, 6, $myrow['delivery_date'], true);
            $rep->TextCol(6, 7, $myrow['from_stk_loc']);
            $rep->NewLine(2);
            $orderno = $myrow['order_no'];
        }
        $rep->TextCol(0, 1, $myrow['stk_code']);
        $rep->TextCol(1, 2, $myrow['description']);
        $dec = get_qty_dec($myrow['stk_code']);
        $rep->AmountCol(2, 3, $myrow['quantity'], $dec);
        $rep->AmountCol(3, 4, $myrow['qty_sent'], $dec);
        $rep->AmountCol(4, 5, $myrow['quantity'] - $myrow['qty_sent'], $dec);
        if ($myrow['quantity'] - $myrow['qty_sent'] > 0) {
            $rep->Font('italic');
            $rep->TextCol(5, 6, _('Outstanding'));
            $rep->Font();
        }
        $rep->NewLine();
    }
    $rep->Line($rep->row);
    $rep->End();
}
Exemplo n.º 9
0
function print_inventory_purchase()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $fromsupp = $_POST['PARAM_4'];
    $item = $_POST['PARAM_5'];
    $comments = $_POST['PARAM_6'];
    $orientation = $_POST['PARAM_7'];
    $destination = $_POST['PARAM_8'];
    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';
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    if ($fromsupp == '') {
        $froms = _('All');
    } else {
        $froms = get_supplier_name($fromsupp);
    }
    if ($item == '') {
        $itm = _('All');
    } else {
        $itm = $item;
    }
    $cols = array(0, 60, 180, 225, 275, 400, 420, 465, 520);
    $headers = array(_('Category'), _('Description'), _('Date'), _('#'), _('Supplier'), _('Qty'), _('Unit Price'), _('Total'));
    if ($fromsupp != '') {
        $headers[4] = '';
    }
    $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 4 => array('text' => _('Supplier'), 'from' => $froms, 'to' => ''), 5 => array('text' => _('Item'), 'from' => $itm, 'to' => ''));
    $rep = new FrontReport(_('Inventory Purchasing Report'), "InventoryPurchasingReport", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location, $fromsupp, $item, $from, $to);
    $total = $total_supp = $grandtotal = 0.0;
    $total_qty = 0.0;
    $catt = $stock_description = $stock_id = $supplier_name = '';
    while ($trans = db_fetch($res)) {
        if ($stock_description != $trans['description']) {
            if ($stock_description != '') {
                if ($supplier_name != '') {
                    $rep->NewLine(2, 3);
                    $rep->TextCol(0, 1, _('Total'));
                    $rep->TextCol(1, 4, $stock_description);
                    $rep->TextCol(4, 5, $supplier_name);
                    $rep->AmountCol(5, 7, $total_qty, get_qty_dec($stock_id));
                    $rep->AmountCol(7, 8, $total_supp, $dec);
                    $rep->Line($rep->row - 2);
                    $rep->NewLine();
                    $total_supp = $total_qty = 0.0;
                    $supplier_name = $trans['supplier_name'];
                }
            }
            $stock_id = $trans['stock_id'];
            $stock_description = $trans['description'];
        }
        if ($supplier_name != $trans['supplier_name']) {
            if ($supplier_name != '') {
                $rep->NewLine(2, 3);
                $rep->TextCol(0, 1, _('Total'));
                $rep->TextCol(1, 4, $stock_description);
                $rep->TextCol(4, 5, $supplier_name);
                $rep->AmountCol(5, 7, $total_qty, get_qty_dec($stock_id));
                $rep->AmountCol(7, 8, $total_supp, $dec);
                $rep->Line($rep->row - 2);
                $rep->NewLine();
                $total_supp = $total_qty = 0.0;
            }
            $supplier_name = $trans['supplier_name'];
        }
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->NewLine(2, 3);
                $rep->TextCol(0, 1, _('Total'));
                $rep->TextCol(1, 7, $catt);
                $rep->AmountCol(7, 8, $total, $dec);
                $rep->Line($rep->row - 2);
                $rep->NewLine();
                $rep->NewLine();
                $total = 0.0;
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 6, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $curr = get_supplier_currency($trans['supplier_id']);
        $rate = get_exchange_rate_from_home_currency($curr, sql2date($trans['tran_date']));
        $trans['price'] *= $rate;
        $rep->NewLine();
        $trans['supp_reference'] = get_supp_inv_reference($trans['supplier_id'], $trans['stock_id'], $trans['tran_date']);
        $rep->fontSize -= 2;
        $rep->TextCol(0, 1, $trans['stock_id']);
        if ($fromsupp == ALL_TEXT) {
            $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
            $rep->TextCol(2, 3, sql2date($trans['tran_date']));
            $rep->TextCol(3, 4, $trans['supp_reference']);
            $rep->TextCol(4, 5, $trans['supplier_name']);
        } else {
            $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
            $rep->TextCol(2, 3, sql2date($trans['tran_date']));
            $rep->TextCol(3, 4, $trans['supp_reference']);
        }
        $rep->AmountCol(5, 6, $trans['qty'], get_qty_dec($trans['stock_id']));
        $rep->AmountCol(6, 7, $trans['price'], $dec);
        $amt = $trans['qty'] * $trans['price'];
        $rep->AmountCol(7, 8, $amt, $dec);
        $rep->fontSize += 2;
        $total += $amt;
        $total_supp += $amt;
        $grandtotal += $amt;
        $total_qty += $trans['qty'];
    }
    if ($stock_description != '') {
        if ($supplier_name != '') {
            $rep->NewLine(2, 3);
            $rep->TextCol(0, 1, _('Total'));
            $rep->TextCol(1, 4, $stock_description);
            $rep->TextCol(4, 5, $supplier_name);
            $rep->AmountCol(5, 7, $total_qty, get_qty_dec($stock_id));
            $rep->AmountCol(7, 8, $total_supp, $dec);
            $rep->Line($rep->row - 2);
            $rep->NewLine();
            $rep->NewLine();
            $total_supp = $total_qty = 0.0;
            $supplier_name = $trans['supplier_name'];
        }
    }
    if ($supplier_name != '') {
        $rep->NewLine(2, 3);
        $rep->TextCol(0, 1, _('Total'));
        $rep->TextCol(1, 4, $stock_description);
        $rep->TextCol(4, 5, $supplier_name);
        $rep->AmountCol(5, 7, $total_qty, get_qty_dec($stock_id));
        $rep->AmountCol(7, 8, $total_supp, $dec);
        $rep->Line($rep->row - 2);
        $rep->NewLine();
        $rep->NewLine();
    }
    $rep->NewLine(2, 3);
    $rep->TextCol(0, 1, _('Total'));
    $rep->TextCol(1, 7, $catt);
    $rep->AmountCol(7, 8, $total, $dec);
    $rep->Line($rep->row - 2);
    $rep->NewLine();
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 7, _('Grand Total'));
    $rep->AmountCol(7, 8, $grandtotal, $dec);
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
Exemplo n.º 10
0
function inventory_movements()
{
    global $path_to_root;
    $from_date = $_POST['PARAM_0'];
    $to_date = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $comments = $_POST['PARAM_4'];
    $orientation = $_POST['PARAM_5'];
    $destination = $_POST['PARAM_6'];
    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';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    //	if ($location == ALL_TEXT)
    //		$location = '';
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    //$cols = array(0, 100, 300, 365, 440, 540, 640, 715);
    $cols = array(0, 60, 220, 240, 310, 380, 450, 520);
    $headers = array(_('Category'), _('Description'), _('UOM'), _('Opening'), _('Quantity In'), _('Quantity Out'), _('Balance'));
    $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from_date, 'to' => $to_date), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(_('Inventory Movements'), "InventoryMovements", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $result = fetch_items($category);
    $catgor = '';
    while ($myrow = db_fetch($result)) {
        if ($catgor != $myrow['description']) {
            $rep->Line($rep->row - $rep->lineHeight);
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['category_id'] . " - " . $myrow['description']);
            $catgor = $myrow['description'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $myrow['stock_id']);
        $rep->TextCol(1, 2, $myrow['name']);
        $rep->TextCol(2, 3, $myrow['units']);
        $qoh_start = $inward = $outward = $qoh_end = 0;
        $qoh_start += get_qoh_on_date($myrow['stock_id'], $location, add_days($from_date, -1));
        $qoh_end += get_qoh_on_date($myrow['stock_id'], $location, $to_date);
        $inward += trans_qty($myrow['stock_id'], $location, $from_date, $to_date);
        $outward += trans_qty($myrow['stock_id'], $location, $from_date, $to_date, false);
        $rep->AmountCol(3, 4, $qoh_start, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(4, 5, $inward, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(5, 6, $outward, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(6, 7, $qoh_end, get_qty_dec($myrow['stock_id']));
        $rep->NewLine(0, 1);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
Exemplo n.º 11
0
include 'header.php';
?>
<div id='content'>
<!-- Display Item information here -->
<h1 style="font-size: 42pt;">Item Information - <?php 
if ($data != -1) {
    echo $data['item'];
}
?>
</h1>
<span style="font-size:18pt"><b>Status: </b><?php 
echo ucwords($data['status']);
?>
</span><br>
<?php 
echo "Near {$data['room']} in " . get_location_name($dbc, $data['location_id']);
?>
<br><br>

<h2>Description</h2>
<?php 
echo $data['description'];
?>
<br><br><br>

<i><h2>Contact Information</h2></i>
<span style="margin-right:4em"><b>Name: </b ><?php 
echo $data['owner'] . $data['finder'];
?>
</span>
<span style="margin-right:4em"><b>Phone: </b><?php 
Exemplo n.º 12
0
require 'includes/item_helper.php';
if (isset($_GET['status']) && $_GET['status'] == 'update') {
    if (!isset($_SESSION['username'])) {
        Header('Location: /searchreport.php');
        die;
    }
    $data = search_item_by_id($dbc, $_GET['id']);
    if ($data == -1) {
        # If no id matches, redirect to the search page
        header("Location: /searchreport.php");
        die;
    }
    $_POST['item'] = $data['item'];
    $_POST['phone'] = $data['phone'];
    $_POST['email'] = $data['email'];
    $_POST['building'] = get_location_name($dbc, $data['location_id']);
    $_POST['room'] = $data['room'];
    $_POST['description'] = $data['description'];
    if (isset($data['owner'])) {
        $_POST['owner'] = $data['owner'];
    }
    if (isset($data['finder'])) {
        $_POST['finder'] = $data['finder'];
    }
    $_SERVER['REQUEST_METHOD'] = 'POST';
}
# If lost/found is not specified, set the status to lost
if (!isset($_GET['status'])) {
    $_GET['status'] = 'lost';
}
$page_status = $_GET['status'];
Exemplo n.º 13
0
function print_inventory_valuation_report()
{
    global $path_to_root;
    $date = $_POST['PARAM_0'];
    $category = $_POST['PARAM_1'];
    $location = $_POST['PARAM_2'];
    $detail = $_POST['PARAM_3'];
    $comments = $_POST['PARAM_4'];
    $orientation = $_POST['PARAM_5'];
    $destination = $_POST['PARAM_6'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $detail = !$detail;
    $dec = user_price_dec();
    $orientation = $orientation ? 'L' : 'P';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == ALL_TEXT) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    $cols = array(0, 75, 225, 250, 350, 450, 515);
    $headers = array(_('Category'), '', _('UOM'), _('Quantity'), _('Unit Cost'), _('Value'));
    $aligns = array('left', 'left', 'left', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('End Date'), 'from' => $date, 'to' => ''), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(_('Inventory Valuation Report'), "InventoryValReport", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location, $date);
    $total = $grandtotal = 0.0;
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                if ($detail) {
                    $rep->NewLine(2, 3);
                    $rep->TextCol(0, 4, _('Total'));
                }
                $rep->AmountCol(5, 6, $total, $dec);
                if ($detail) {
                    $rep->Line($rep->row - 2);
                    $rep->NewLine();
                }
                $rep->NewLine();
                $total = 0.0;
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 2, $trans['cat_description']);
            $catt = $trans['cat_description'];
            if ($detail) {
                $rep->NewLine();
            }
        }
        if ($detail) {
            $rep->NewLine();
            $rep->fontSize -= 2;
            $rep->TextCol(0, 1, $trans['stock_id']);
            $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
            $rep->TextCol(2, 3, $trans['units']);
            $rep->AmountCol(3, 4, $trans['QtyOnHand'], get_qty_dec($trans['stock_id']));
            $dec2 = 0;
            price_decimal_format($trans['UnitCost'], $dec2);
            $rep->AmountCol(4, 5, $trans['UnitCost'], $dec2);
            $rep->AmountCol(5, 6, $trans['ItemTotal'], $dec);
            $rep->fontSize += 2;
        }
        $total += $trans['ItemTotal'];
        $grandtotal += $trans['ItemTotal'];
    }
    if ($detail) {
        $rep->NewLine(2, 3);
        $rep->TextCol(0, 4, _('Total'));
    }
    $rep->Amountcol(5, 6, $total, $dec);
    if ($detail) {
        $rep->Line($rep->row - 2);
        $rep->NewLine();
    }
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 4, _('Grand Total'));
    $rep->AmountCol(5, 6, $grandtotal, $dec);
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
            echo $location["name"];
            ?>
</td><td>&nbsp;<?php 
            echo $location["h_name"];
            ?>
</td><td>&nbsp;<?php 
            echo $location["h_tel"];
            ?>
</td><td>&nbsp;<?php 
            echo to_date($location["create_time"]);
            ?>
</td><td>&nbsp;<?php 
            echo $location["h_user_name"];
            ?>
</td><td>&nbsp;<?php 
            echo get_location_name($location["location_id"]);
            ?>
</td><td>&nbsp;<?php 
            echo get_status($location["is_publish"]);
            ?>
</td><td><a href="javascript:edit('<?php 
            echo $location["id"];
            ?>
')">查看</a>&nbsp;<a href="javascript: foreverdel('<?php 
            echo $location["id"];
            ?>
')"><?php 
            echo L("FOREVERDEL");
            ?>
</a>&nbsp;</td></tr><?php 
        }
function print_inventory_history()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $detail = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $destination = $_POST['PARAM_6'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $detail = !$detail;
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == ALL_TEXT) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    //$cols = array(0, 65, 210, 235, 300, 365, 430, 495, 560, 625, 690,	755);
    $cols = array(0, 65, 220, 245, 305, 365, 425, 485, 545, 605, 665, 725);
    $headers = array(_('Category'), '', _('UOM'), _('Adjustment'), _('Production'), _('GRN'), _('SuppCredit'), _('Transfer'), _('Delivery'), _('CustCredit'), _('QOH'));
    $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(_('Inventory History'), "InventoryHistory", user_pagesize(), 10, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location, $fromcust, $from, $to);
    $total = $grandtotal = 0.0;
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                if ($detail) {
                    $rep->NewLine(2, 3);
                    $rep->TextCol(0, 4, _('Total'));
                }
                $rep->AmountCol(10, 11, $total, $dec);
                if ($detail) {
                    $rep->Line($rep->row - 2);
                    $rep->NewLine();
                }
                $rep->NewLine();
                $total = 0.0;
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 2, $trans['cat_description']);
            $catt = $trans['cat_description'];
            if ($detail) {
                $rep->NewLine();
            }
        }
        if ($detail) {
            $rep->NewLine();
            $rep->fontSize -= 2;
            $rep->TextCol(0, 1, $trans['stock_id']);
            $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
            $rep->TextCol(2, 3, $trans['units']);
            $rep->AmountCol(3, 4, $trans['peny_brg'], get_qty_dec($trans['stock_id']));
            $rep->AmountCol(4, 5, $trans['pro_brg'], get_qty_dec($trans['stock_id']));
            $rep->AmountCol(5, 6, $trans['beli_brg'], get_qty_dec($trans['stock_id']));
            $rep->AmountCol(6, 7, -$trans['rtrspl_brg'], get_qty_dec($trans['stock_id']));
            $rep->AmountCol(7, 8, $trans['mutasi_brg'], get_qty_dec($trans['stock_id']));
            $rep->AmountCol(8, 9, -$trans['penjualan'], get_qty_dec($trans['stock_id']));
            $rep->AmountCol(9, 10, $trans['retur_brg'], get_qty_dec($trans['stock_id']));
            $rep->AmountCol(10, 11, $trans['saldo'], get_qty_dec($trans['stock_id']));
            $rep->fontSize += 2;
        }
        $total += $trans['saldo'];
        $grandtotal += $trans['saldo'];
    }
    if ($detail) {
        $rep->NewLine(2, 3);
        $rep->TextCol(0, 4, _('Total'));
    }
    $rep->Amountcol(10, 11, $total, $dec);
    if ($detail) {
        $rep->Line($rep->row - 2);
        $rep->NewLine();
    }
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 4, _('Grand Total'));
    $rep->AmountCol(10, 11, $grandtotal, $dec);
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
Exemplo n.º 16
0
function print_stock_check()
{
    global $comp_path, $path_to_root, $pic_height;
    $rep_date = $_POST['PARAM_0'];
    $category = $_POST['PARAM_1'];
    $location = $_POST['PARAM_2'];
    $comments = $_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";
    }
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == ALL_TEXT) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    $cols = array(0, 100, 250, 315);
    $headers = array(_('Stock ID'), _('Description'), _('Quantity'));
    $aligns = array('left', 'left', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 2 => array('text' => _('Date'), 'from' => $rep_date, 'to' => ''));
    $user_comp = "";
    $rep = new FrontReport(_('Dated Stock Sheet'), "DatedStockSheet", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location, date2sql($rep_date));
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($location == 'all') {
            $loc_code = "";
        } else {
            $loc_code = $location;
        }
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 2, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $rep->NewLine();
        $dec = get_qty_dec($trans['stock_id']);
        $rep->TextCol(0, 1, $trans['stock_id']);
        $rep->TextCol(1, 2, $trans['description']);
        $rep->AmountCol(2, 3, $trans['QtyOnHand'], $dec);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}