if (!$start_date || !$end_date || !$date_target || !$detail_level || !$output_format) {
        $messageStack->add_session(ERROR_MISSING_REQ_INFO . '<br />' . $_GET['start_date'] . '<br />' . $_GET['end_date'], 'error');
        zen_redirect(zen_href_link(FILENAME_STATS_SALES_REPORT, zen_get_all_get_params(array('output_format')), 'NONSSL'));
    }
    // build the report array
    if ($output_format != 'none') {
        require DIR_WS_CLASSES . 'sales_report.php';
        //  (* = required)
        $sr = new sales_report($timeframe, $start_date, $end_date, $date_target, $date_status, $payment_method, $current_status, $manufacturer, $detail_level, $output_format);
        //* how to display the results
        if ($output_format == 'csv') {
            mb_http_output('SJIS');
            ob_start('mb_output_handler');
            // we have to pass the sorting values of the form since
            // the class instantiation does not require them
            $sr->output_csv($csv_header, $timeframe_sort, $li_sort_a, $li_sort_order_a, $li_sort_b, $li_sort_order_b);
            exit;
        }
    }
    // END if ($output_format != 'none')
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>