Example #1
0
$link_fmt = 'store.edit.php?win=inventory&productid=%d';
$link_vals = array('product_id');
$def_orby = 'title';
// determine order column and direction
$orby = $def_orby;
if (isset($_GET['by']) and in_array($_GET['by'], array_keys($header_row))) {
    $orby = $_GET['by'];
}
$order_dir = (empty($_GET['dir']) or $_GET['dir'] == 'A') ? 'ASC' : 'DESC';
if (isset($_GET['op_csv'])) {
    // this will generate a CSV file to downlaod all of the current inventory items in the system
    // get all of the products joined with the inventory levels, colors, sizes, etc
    // organized: title, sku, size, color way, qty in stock
    $inv = $prod->fetch_inventory_report(null, 'title', 'asc', 0, 999000);
    $cols = array('title', 'sku', 'size_code', 'color_name', 'qty');
    $csv = new CSV_Table_Fu();
    $csv->show_cols = $cols;
    $csv->print_csv_headers(SITE_DOMAIN_NAME . '-inventory_dump.csv');
    $csv->dumpall($inv);
    exit;
}
$range = 50;
$offset = isset($_GET['page']) ? ($_GET['page'] - 1) * $range : 0;
/** go get im **/
$report = $prod->fetch_inventory_report($pid, $orby, $order_dir, $offset, $range, $filter_cat_id);
/** list all cm_categories in one big ass dump using HTML_Table **/
$table = new fu_HTML_Table(array('width' => '90%', 'align' => 'center', 'style' => 'padding-top: 25px'));
$table->setAutoGrow(true);
$table->setAutoFill("-");
$xgets = $mosh->make_get_params($_GET, array('by', 'dir'));
$table->addSortRow($header_row, $orby, null, 'TH', $xgets, $order_dir);
Example #2
0
    // used for template only
}
if (empty($orby)) {
    $orby = isset($fake_orby) ? $fake_orby : $def_orby;
}
if (!isset($fake_orby)) {
    $fake_orby = $def_orby;
}
$order_dir = (empty($_GET['dir']) or $_GET['dir'] == 'D') ? 'DESC' : 'ASC';
$sql = sprintf($sql, $orby, $order_dir);
/** go get im **/
$res = $pdb->query($sql);
/** list all cm_categories in one big ass dump using HTML_Table **/
/** list all cm_categories in one big ass dump using HTML_Table **/
if (isset($_GET['op_csv'])) {
    $table = new CSV_Table_Fu();
    $csv_headers = array();
    foreach ($header_row as $k => $v) {
        $csv_headers[] = preg_replace('/<[^>]+>/', " ", $v);
    }
    $table->addSortRow(array_values($csv_headers));
} else {
    $table = new fu_HTML_Table(array("id" => "reports"));
    $table->setAutoGrow(true);
    $table->setAutoFill("-");
    $xgets[] = "report={$ACTION}";
    $table->addSortRow($header_row, $fake_orby, null, 'TH', join('&', $xgets), $order_dir);
    #$tfoot = $table->getFooter();
    #$tfoot->addRow(array_values($header_row));
    $sep = strpos($_SERVER['REQUEST_URI'], '?') === false ? '?' : '&';
    $csv_link = $_SERVER['REQUEST_URI'] . $sep . 'op_csv';