<?php
// Declare everything to be output before the table
$before = <<<BEFORE
BEFORE;
// Declare everything to be output after the table
$after = <<<AFTER
<div class="table-legend">
<h4>Activity Codes key:</h4>
<ol class="legend-list three-col">
<li>Civil engineering and buildings</li>
<li>Electrical engineering and energy</li>
<li>Electronics (including radiofrequency equipment)</li>
<li>Computer systems and communication, including rental and maintenance</li>
<li>Mechanical structures - Supplies & manufacturing techniques</li>
<li>Vacuum and low-temperature technology</li>
<li>Particle detectors</li>
<li>Miscellaneous (insurances, photoequipment, gases, vehicles, petrol, tools, furniture, office supplies, publications)</li>
<li>Design studies - Miscellaneous supplies</li>
</ol>
<ul><li><sup>1</sup> Including commitments carried forward from previous years and excluding commitments for future years.
Ratio between the percentage of expenditure in an individual Member State for the above-mentioned period and that Member State's percentage contribution to the Budget <em>(TARGET for 2013: 0.91)</em>.</li>
<li><sup>2</sup> Additional special contributions from France (excluding in-kind) and Switzerland were included in the calculation. Excluding individual purchase orders < 1 000 CHF from 1 July 2013</li>
<!--<li><sup>3</sup> See Table V of document <em>CERN/FC/5722/RA</em></li>--></ul>
</div>
AFTER;
// fixme: this formats are obsolete, since data transform has been moved to 'body'
// Formats for numbers. ### is a wildcard for 'current column'
$to_french_number = "TO_CHAR(###, '999G999G999', 'NLS_NUMERIC_CHARACTERS = '', ''')";
$to_percent = "TO_CHAR(ROUND(###, 2), '90.00')";
$table_template = array(
'db' => array(
'from' => 'PURCHASING_REPORT_TABLE_0',
'select' => array(
'MS' => FALSE,
'COUNTRY_ISO' => FALSE,
'COUNTRY_NAME' => NULL,
'SUPPLIES_1' => '###',
'SUPPLIES_2' => '###',
'SUPPLIES_3' => '###',
'SUPPLIES_4' => '###',
'SUPPLIES_5' => '###',
'SUPPLIES_6' => '###',
'SUPPLIES_7' => '###',
'SUPPLIES_8' => '###',
'SUPPLIES_9' => '###',
'SUPPLIES_TOTAL' => '###',
'SUPPLIES_RATIO' => '###',
'IR_PREV_YEAR' => '###',
),
'where' => array(
'MS' => array('LIKE', '%'),
'COUNTRY_ISO' => array('LIKE', '%')
),
),
'filters' => array(
'country_iso' => array(
'type' => 'country',
'description' => 'Country',
'where' => array(
'COUNTRY_ISO' => array('LIKE', '%'),
),
),
'ms' => array(
'type' => 'ms',
'description' => 'Member State',
'where' => array(
'MS' => array('LIKE', '%'),
),
),
),
'dynamic' => TRUE,
'editable' => FALSE,
'number' => 1,
'title' => "Payments and oustanding commitments in 2013 for Supplies<br><small>(Excluding visiting research teams and collaborations)</small>",
'subtitle' => "by country and by category of supplies",
'graph' => array(
'dynamic' => FALSE,
),
'headers' => array(
array(
'from_db' => FALSE, // fixme: UNUSED
'layout' => array(
0 => array( 'colspan' => 11, 'class' => "text-center" ),
1 => array( 'rowspan' => 2, 'class' => "text-center border-left" ),
2 => array( 'rowspan' => 2, 'class' => "text-center border-left" ),
),
'data' => array(
0 => "<h3>Payments per activity code <small>(rounded kCHF)</small></h3>",
1 => "<h4>Industrial return<sup>2</sup><br><small>2013</small></h4>",
2 => "<h4>Return coefficient<br><small>2009 – 2012<!--<sup>3</sup>--></small></h4>",
),
),
array(
// fixme: unused
'from_db' => TRUE,
'layout' => array(
'SUPPLIES_1' => array( 'class' => "text-center" ),
'SUPPLIES_2' => array( 'class' => "text-center" ),
'SUPPLIES_3' => array( 'class' => "text-center" ),
'SUPPLIES_4' => array( 'class' => "text-center" ),
'SUPPLIES_5' => array( 'class' => "text-center" ),
'SUPPLIES_6' => array( 'class' => "text-center" ),
'SUPPLIES_7' => array( 'class' => "text-center" ),
'SUPPLIES_8' => array( 'class' => "text-center" ),
'SUPPLIES_9' => array( 'class' => "text-center" ),
'SUPPLIES_TOTAL' => array( 'class' => "text-center" ),
'SUPPLIES_RATIO' => array( 'class' => "text-center border-left" ),
'IR_PREV_YEAR' => array( 'class' => "text-center border-left" ),
),
'data' => array(
'MS' => FALSE,
'COUNTRY_ISO' => FALSE,
'COUNTRY_NAME' => "",
'SUPPLIES_1' => "1",
'SUPPLIES_2' => "2",
'SUPPLIES_3' => "3",
'SUPPLIES_4' => "4",
'SUPPLIES_5' => "5",
'SUPPLIES_6' => "6",
'SUPPLIES_7' => "7",
'SUPPLIES_8' => "8",
'SUPPLIES_9' => "9",
'SUPPLIES_TOTAL' => "Total",
'SUPPLIES_RATIO' => FALSE,
'IR_PREV_YEAR' => FALSE,
),
),
),
'body' => array(
'layout' => array(
'COUNTRY_NAME' => array( 'class' => "text-left" ),
'SUPPLIES_1' => array( 'class' => "text-right no-wrap" ),
'SUPPLIES_2' => array( 'class' => "text-right no-wrap" ),
'SUPPLIES_3' => array( 'class' => "text-right no-wrap" ),
'SUPPLIES_4' => array( 'class' => "text-right no-wrap" ),
'SUPPLIES_5' => array( 'class' => "text-right no-wrap" ),
'SUPPLIES_6' => array( 'class' => "text-right no-wrap" ),
'SUPPLIES_7' => array( 'class' => "text-right no-wrap" ),
'SUPPLIES_8' => array( 'class' => "text-right no-wrap" ),
'SUPPLIES_9' => array( 'class' => "text-right no-wrap" ),
'SUPPLIES_TOTAL' => array( 'class' => "text-center no-wrap" ),
'SUPPLIES_RATIO' => array( 'class' => "text-center border-left" ),
'IR_PREV_YEAR' => array( 'class' => "text-center border-left" ),
),
'format' => array(
'SUPPLIES_1' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_2' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_3' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_4' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_5' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_6' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_7' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_8' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_9' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_TOTAL' => array('format_french_number', 'format_no_decimals'),
'SUPPLIES_RATIO' => 'format_french_number',
'IR_PREV_YEAR' => 'format_french_number',
),
),
// TODO: Implement footers with custom queries and formatting
'footers' => array(
array(
// fixme: unused
'from_db' => TRUE,
// fixme: this is not used, and should go
'exclude' => array( 'MS' => "Others" ),
'layout' => array(
'COUNTRY_NAME' => array( 'class' => "text-right" )
),
'data' => array(
'COUNTRY_NAME' => array( 'text' => "Sub-Total member states" ),
'SUPPLIES_1' => array( 'SUM' => "SUPPLIES_1" ),
'SUPPLIES_2' => array( 'SUM' => "SUPPLIES_2" ),
'SUPPLIES_3' => array( 'SUM' => "SUPPLIES_3" ),
'SUPPLIES_4' => array( 'SUM' => "SUPPLIES_4" ),
'SUPPLIES_5' => array( 'SUM' => "SUPPLIES_5" ),
'SUPPLIES_6' => array( 'SUM' => "SUPPLIES_6" ),
'SUPPLIES_7' => array( 'SUM' => "SUPPLIES_7" ),
'SUPPLIES_8' => array( 'SUM' => "SUPPLIES_8" ),
'SUPPLIES_9' => array( 'SUM' => "SUPPLIES_9" ),
'SUPPLIES_TOTAL' => array( 'SUM' => "SUPPLIES_TOTAL" ),
'SUPPLIES_RATIO' => false,
'IR_PREV_YEAR' => false,
),
),
array(
'from_db' => TRUE,
'exclude' => array( 'MS' => "Others" ),
'layout' => array(
'*' => array( 'class' => "text-italic text-bold" )
),
'data' => array(
'COUNTRY_NAME' => "",
'SUPPLIES_1' => array( 'PERCENT' => array( 'SUPPLIES_1', 'SUPPLIES_TOTAL' )),
'SUPPLIES_2' => array( 'PERCENT' => array( 'SUPPLIES_2', 'SUPPLIES_TOTAL' )),
'SUPPLIES_3' => array( 'PERCENT' => array( 'SUPPLIES_3', 'SUPPLIES_TOTAL' )),
'SUPPLIES_4' => array( 'PERCENT' => array( 'SUPPLIES_4', 'SUPPLIES_TOTAL' )),
'SUPPLIES_5' => array( 'PERCENT' => array( 'SUPPLIES_5', 'SUPPLIES_TOTAL' )),
'SUPPLIES_6' => array( 'PERCENT' => array( 'SUPPLIES_6', 'SUPPLIES_TOTAL' )),
'SUPPLIES_7' => array( 'PERCENT' => array( 'SUPPLIES_7', 'SUPPLIES_TOTAL' )),
'SUPPLIES_8' => array( 'PERCENT' => array( 'SUPPLIES_8', 'SUPPLIES_TOTAL' )),
'SUPPLIES_9' => array( 'PERCENT' => array( 'SUPPLIES_9', 'SUPPLIES_TOTAL' )),
'SUPPLIES_TOTAL' => array( 'PERCENT' => array( 'SUPPLIES_TOTAL', 'SUPPLIES_TOTAL' )),
'SUPPLIES_RATIO' => false,
'IR_PREV_YEAR' => false,
),
),
array(
'from_db' => TRUE,
'exclude' => array(
'MS' => "Member States",
),
'layout' => array(
'COUNTRY_NAME' => array( 'class' => "text-right" )
),
'data' => array(
'COUNTRY_NAME' => array( 'text' => "Sub-Total other" ),
'SUPPLIES_1' => array( 'SUM' => "SUPPLIES_1" ),
'SUPPLIES_2' => array( 'SUM' => "SUPPLIES_2" ),
'SUPPLIES_3' => array( 'SUM' => "SUPPLIES_3" ),
'SUPPLIES_4' => array( 'SUM' => "SUPPLIES_4" ),
'SUPPLIES_5' => array( 'SUM' => "SUPPLIES_5" ),
'SUPPLIES_6' => array( 'SUM' => "SUPPLIES_6" ),
'SUPPLIES_7' => array( 'SUM' => "SUPPLIES_7" ),
'SUPPLIES_8' => array( 'SUM' => "SUPPLIES_8" ),
'SUPPLIES_9' => array( 'SUM' => "SUPPLIES_9" ),
'SUPPLIES_TOTAL' => array( 'SUM' => "SUPPLIES_TOTAL" ),
'SUPPLIES_RATIO' => false,
'IR_PREV_YEAR' => false,
),
),
array(
'from_db' => TRUE,
'layout' => array(
'COUNTRY_NAME' => array( 'class' => "text-right" )
),
'data' => array(
'COUNTRY_NAME' => array( 'text' => "Total" ),
'SUPPLIES_1' => array( 'SUM' => "SUPPLIES_1" ),
'SUPPLIES_2' => array( 'SUM' => "SUPPLIES_2" ),
'SUPPLIES_3' => array( 'SUM' => "SUPPLIES_3" ),
'SUPPLIES_4' => array( 'SUM' => "SUPPLIES_4" ),
'SUPPLIES_5' => array( 'SUM' => "SUPPLIES_5" ),
'SUPPLIES_6' => array( 'SUM' => "SUPPLIES_6" ),
'SUPPLIES_7' => array( 'SUM' => "SUPPLIES_7" ),
'SUPPLIES_8' => array( 'SUM' => "SUPPLIES_8" ),
'SUPPLIES_9' => array( 'SUM' => "SUPPLIES_9" ),
'SUPPLIES_TOTAL' => array( 'SUM' => "SUPPLIES_TOTAL" ),
'SUPPLIES_RATIO' => false,
'IR_PREV_YEAR' => false,
),
),
),
'html' => array(
'before' => $before,
'after' => $after,
),
);
echo json_encode($table_template);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/cEuHU
function name: (null)
number of ops: 24
compiled vars: !0 = $before, !1 = $after, !2 = $to_french_number, !3 = $to_percent, !4 = $table_template
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > ASSIGN !0, ''
7 1 ASSIGN !1, '%3Cdiv+class%3D%22table-legend%22%3E%0A%09%3Ch4%3EActivity+Codes+key%3A%3C%2Fh4%3E%0A%09%3Col+class%3D%22legend-list+three-col%22%3E%0A%09%09%3Cli%3ECivil+engineering+and+buildings%3C%2Fli%3E%0A%09%09%3Cli%3EElectrical+engineering+and+energy%3C%2Fli%3E%0A%09%09%3Cli%3EElectronics+%28including+radiofrequency+equipment%29%3C%2Fli%3E%0A%09%09%3Cli%3EComputer+systems+and+communication%2C+including+rental+and+maintenance%3C%2Fli%3E%0A%09%09%3Cli%3EMechanical+structures+-+Supplies+%26amp%3B+manufacturing+techniques%3C%2Fli%3E%0A%09%09%3Cli%3EVacuum+and+low-temperature+technology%3C%2Fli%3E%0A%09%09%3Cli%3EParticle+detectors%3C%2Fli%3E%0A%09%09%3Cli%3EMiscellaneous+%28insurances%2C+photoequipment%2C+gases%2C+vehicles%2C+petrol%2C+tools%2C+furniture%2C+office+supplies%2C+publications%29%3C%2Fli%3E%0A%09%09%3Cli%3EDesign+studies+-+Miscellaneous+supplies%3C%2Fli%3E%0A%09%3C%2Fol%3E%0A%09%3Cul%3E%3Cli%3E%3Csup%3E1%3C%2Fsup%3E+Including+commitments+carried+forward+from+previous+years+and+excluding+commitments+for+future+years.%0A%09Ratio+between+the+percentage+of+expenditure+in+an+individual+Member+State+for+the+above-mentioned+period+and+that+Member+State%27s+percentage+contribution+to+the+Budget+%3Cem%3E%28TARGET+for+2013%3A+0.91%29%3C%2Fem%3E.%3C%2Fli%3E%0A%09%3Cli%3E%3Csup%3E2%3C%2Fsup%3E+Additional+special+contributions+from+France+%28excluding+in-kind%29+and+Switzerland+were+included+in+the+calculation.+Excluding+individual+purchase+orders+%26lt%3B+1+000+CHF+from+1+July+2013%3C%2Fli%3E%0A%09%3C%21--%3Cli%3E%3Csup%3E3%3C%2Fsup%3E+See+Table+V+of+document+%3Cem%3ECERN%2FFC%2F5722%2FRA%3C%2Fem%3E%3C%2Fli%3E--%3E%3C%2Ful%3E%0A%3C%2Fdiv%3E'
30 2 ASSIGN !2, 'TO_CHAR%28%23%23%23%2C+%27999G999G999%27%2C+%27NLS_NUMERIC_CHARACTERS+%3D+%27%27%2C+%27%27%27%29'
31 3 ASSIGN !3, 'TO_CHAR%28ROUND%28%23%23%23%2C+2%29%2C+%2790.00%27%29'
35 4 INIT_ARRAY ~9 <array>, 'db'
5 ADD_ARRAY_ELEMENT ~9 <array>, 'filters'
6 ADD_ARRAY_ELEMENT ~9 <true>, 'dynamic'
7 ADD_ARRAY_ELEMENT ~9 <false>, 'editable'
76 8 ADD_ARRAY_ELEMENT ~9 1, 'number'
77 9 ADD_ARRAY_ELEMENT ~9 'Payments+and+oustanding+commitments+in+2013+for+Supplies%3Cbr%3E%3Csmall%3E%28Excluding+visiting+research+teams+and+collaborations%29%3C%2Fsmall%3E', 'title'
78 10 ADD_ARRAY_ELEMENT ~9 'by+country+and+by+category+of+supplies', 'subtitle'
35 11 ADD_ARRAY_ELEMENT ~9 <array>, 'graph'
12 ADD_ARRAY_ELEMENT ~9 <array>, 'headers'
13 ADD_ARRAY_ELEMENT ~9 <array>, 'body'
14 ADD_ARRAY_ELEMENT ~9 <array>, 'footers'
258 15 INIT_ARRAY ~10 !0, 'before'
259 16 ADD_ARRAY_ELEMENT ~10 !1, 'after'
17 ADD_ARRAY_ELEMENT ~9 ~10, 'html'
33 18 ASSIGN !4, ~9
262 19 INIT_FCALL 'json_encode'
20 SEND_VAR !4
21 DO_ICALL $12
22 ECHO $12
23 > RETURN 1
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
155.44 ms | 1400 KiB | 15 Q