You are here

function uc_reports_sales_custom_form in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_reports/uc_reports.admin.inc \uc_reports_sales_custom_form()
  2. 7.3 uc_reports/uc_reports.admin.inc \uc_reports_sales_custom_form()
1 string reference to 'uc_reports_sales_custom_form'
uc_reports_sales_custom in uc_reports/uc_reports.module

File

uc_reports/uc_reports.module, line 1109
Displays reports on sales, customers, and products to store admin

Code

function uc_reports_sales_custom_form($values, $statuses) {
  $form['search'] = array(
    '#type' => 'fieldset',
    '#title' => t('Customize sales report parameters'),
    '#description' => t('Adjust these values and update the report to build your custom sales summary. Once submitted, the report may be bookmarked for easy reference in the future.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['search']['start_date'] = array(
    '#type' => 'date',
    '#title' => t('Start date'),
    '#default_value' => array(
      'month' => format_date($values['start_date'], 'custom', 'n', 0),
      'day' => format_date($values['start_date'], 'custom', 'j', 0),
      'year' => format_date($values['start_date'], 'custom', 'Y', 0),
    ),
  );
  $form['search']['end_date'] = array(
    '#type' => 'date',
    '#title' => t('End date'),
    '#default_value' => array(
      'month' => format_date($values['end_date'], 'custom', 'n', 0),
      'day' => format_date($values['end_date'], 'custom', 'j', 0),
      'year' => format_date($values['end_date'], 'custom', 'Y', 0),
    ),
  );
  $form['search']['length'] = array(
    '#type' => 'select',
    '#title' => t('Results breakdown'),
    '#description' => t('Large daily reports may take a long time to display.'),
    '#options' => array(
      'day' => t('daily'),
      'week' => t('weekly'),
      'month' => t('monthly'),
      'year' => t('yearly'),
    ),
    '#default_value' => $values['length'],
  );
  $options = array();
  foreach (uc_order_status_list() as $status) {
    $options[$status['id']] = $status['title'];
  }
  if ($statuses === FALSE) {
    $statuses = variable_get('uc_reports_reported_statuses', array(
      'completed',
    ));
  }
  $form['search']['status'] = array(
    '#type' => 'select',
    '#title' => t('Order statuses'),
    '#description' => t('Only orders with selected statuses will be included in the report.') . '<br />' . t('Hold Ctrl + click to select multiple statuses.'),
    '#options' => $options,
    '#default_value' => $statuses,
    '#multiple' => TRUE,
    '#size' => 5,
  );
  $form['search']['detail'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show a detailed list of products ordered.'),
    '#default_value' => $values['detail'],
  );
  $form['search']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update report'),
  );
  return $form;
}