<?php
$availableTableColumns = array_keys($tableColumns);

// PREPROCESS FILTERS /////////////////////////////////////////////////////////////////////////////

// cleanup order date
$reportFilters['orderDate']['startDate'] = standard2mysqlDateConversion($reportFilters['orderDate']['startDate']);
$reportFilters['orderDate']['endDate'] = standard2mysqlDateConversion($reportFilters['orderDate']['endDate']);

// cleanup orderStartDate
$reportFilters['orderStartDate']['startDate'] = standard2mysqlDateConversion($reportFilters['orderStartDate']['startDate']);
$reportFilters['orderStartDate']['endDate'] = standard2mysqlDateConversion($reportFilters['orderStartDate']['endDate']);

// cleanup orderEndDate
$reportFilters['orderEndDate']['startDate'] = standard2mysqlDateConversion($reportFilters['orderEndDate']['startDate']);
$reportFilters['orderEndDate']['endDate'] = standard2mysqlDateConversion($reportFilters['orderEndDate']['endDate']);

$reportFilters['idMiceProject'] = $reportFilters['miceProject']['id'];
$reportFilters['orderStatusOp'] = (array)$reportFilters['orderStatusOp'];
$reportFilters['orderStatusFin'] = (array)$reportFilters['orderStatusFin'];

try {

	// EXCUTE MAIN SQLs ---------------------------------------------------------------------------
	include(__DIR__."/reportData_executeSQL.php");

	// FILL IN OTHER FIELDS -----------------------------------------------------------------------
	include(__DIR__."/reportData_otherFields.php");

	// LOOP RECORDS -------------------------------------------------------------------------------
	include(__DIR__."/reportData_loopRecords.php");

} catch (\DBException $e) {
	killReport("Could not run SQL in report. SQL error: ".$e->getMessage());
} catch (\Exception $e) {
	killReport("Could not process report. Error: ".$e->getMessage());
}
