. */ class Fee implements IExport { public function getDisplayName() { return "Fee per local"; } public function getDescription() { return "This export contains all bodies."; } public function hasAccess() { return in_array("export_fee", $_SESSION['sess_functions']); } /** * Get an array with the column headers. The keys should match with the keys in getData() */ public function getHeaders() { $columns = array(); $columns['BodyCode'] = "Code"; $columns['BodyName'] = "Body"; $columns['CurrencyLocal'] = "Local currency"; $columns['FeeLocal'] = "Membership fee (local currency)"; $columns['FeeEuro'] = "Membership fee (€)"; $columns['Count'] = "Count"; return $columns; } public function getData() { $data = array(); if( @mysql_num_rows( $res=doquery($this->getDataQuery()) )>0 ) { while( $row = mysql_fetch_assoc($res) ) { $row['CurrencyLocal'] = html_entity_decode($row['CurrencyLocal']); $data[] = $row; } } return $data; } private function getDataQuery() { $query = "SELECT `ab_bodies`.`BodyCode`, `ab_bodies`.`BodyName`, "; $query .= " IF(`currencies`.`ISO_2`='EU', '', `currencies`.`short`) AS `CurrencyLocal`, "; $query .= " IF(`currencies`.`ISO_2`='EU', '', `memberlist`.`Fee`) AS `FeeLocal`, "; $query .= " ROUND(`currencies`.`rate`*`memberlist`.`Fee`, 2) AS `FeeEuro`, "; $query .= " COUNT(*) AS `Count` "; $query .= "FROM `memberlist` "; $query .= "INNER JOIN `ab_bodies` ON `ab_bodies`.`BodyCode` = `memberlist`.`BodyCode` "; $query .= "INNER JOIN `currencies` ON `currencies`.`id` = `ab_bodies`.`MemberFeeCurrencyId` "; $query .= "GROUP BY `ab_bodies`.`BodyName`, `memberlist`.`Fee` "; $query .= "ORDER BY `ab_bodies`.`BodyName`, `memberlist`.`Fee`"; return $query; } } ?>