Registry::get('view')->assign('destinations', fn_get_destinations(CART_LANGUAGE));
    // Locations
    Registry::get('view')->assign('destinations', fn_get_destinations(CART_LANGUAGE));
    if (!empty($_REQUEST['table_id'])) {
        $table_data = fn_get_report_data($_REQUEST['report_id'], $_REQUEST['table_id']);
        $conditions = fn_get_table_condition($_REQUEST['table_id']);
        if (empty($conditions)) {
            $conditions = array();
        }
        Registry::get('view')->assign('conditions', $conditions);
        Registry::get('view')->assign('table', $table_data);
    }
    // Delete report table
} elseif ($mode == 'delete_table') {
    if (!empty($_REQUEST['table_id'])) {
        fn_delete_report_data('table', $_REQUEST['table_id']);
    }
    return array(CONTROLLER_STATUS_REDIRECT, "sales_reports.update?report_id={$_REQUEST['report_id']}&selected_section=tables");
    // Clear table conditions
} elseif ($mode == 'clear_conditions') {
    db_query("DELETE FROM ?:sales_reports_table_conditions WHERE table_id = ?i", $_REQUEST['table_id']);
    fn_set_notification('N', __('notice'), __('text_conditions_cleared'));
    return array(CONTROLLER_STATUS_REDIRECT, "sales_reports.update_table?report_id={$_REQUEST['report_id']}&table_id={$_REQUEST['table_id']}");
    // View report
} elseif ($mode == 'view') {
    $report_id = empty($_REQUEST['report_id']) ? db_get_field("SELECT report_id FROM ?:sales_reports WHERE status = 'A' ORDER BY position ASC LIMIT 1") : $_REQUEST['report_id'];
    $table_id = empty($_REQUEST['table_id']) ? db_get_field("SELECT table_id FROM ?:sales_reports_tables WHERE report_id = ?i ORDER BY position ASC LIMIT 1", $report_id) : intval($_REQUEST['table_id']);
    $reports = fn_get_order_reports(true, $report_id);
    // If some reports defined calculate data for them
    if (!empty($reports)) {
        $report = $reports[$report_id];
Beispiel #2
0
    if ($mode == 'delete_table') {
        if (!empty($_REQUEST['table_id'])) {
            fn_delete_report_data('table', $_REQUEST['table_id']);
        }
        $suffix = ".update?report_id={$_REQUEST['report_id']}&selected_section=tables";
    }
    // Clear table conditions
    if ($mode == 'clear_conditions') {
        db_query("DELETE FROM ?:sales_reports_table_conditions WHERE table_id = ?i", $_REQUEST['table_id']);
        fn_set_notification('N', __('notice'), __('text_conditions_cleared'));
        $suffix = ".update_table?report_id={$_REQUEST['report_id']}&table_id={$_REQUEST['table_id']}";
    }
    // Delete single report
    if ($mode == 'delete') {
        if (!empty($_REQUEST['report_id'])) {
            fn_delete_report_data('report', $_REQUEST['report_id']);
        }
        $suffix = '.manage';
    }
    return array(CONTROLLER_STATUS_OK, 'sales_reports' . $suffix);
}
$depend_items = fn_get_depended();
// The list of all reports
if ($mode == 'manage') {
    Tygh::$app['view']->assign('reports', fn_get_order_reports());
    // Edit report
} elseif ($mode == 'update' || $mode == 'add') {
    Registry::set('navigation.tabs.general', array('title' => __('general'), 'js' => true));
    if (!empty($_REQUEST['report_id'])) {
        Registry::set('navigation.tabs.tables', array('title' => __('charts'), 'js' => true));
        $report_data = fn_get_report_data($_REQUEST['report_id']);