forked from SimonT-STHS/STHS-DynamicWebsite-Production
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFinance.php
321 lines (293 loc) · 22.4 KB
/
Finance.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php include "Header.php";
If ($lang == "fr"){include 'LanguageFR-Stat.php';}else{include 'LanguageEN-Stat.php';}
$HistoryOutput = (boolean)False;
$LeagueName = (string)"";
$TypeText = "Pro";
If (file_exists($DatabaseFile) == false){
Goto STHSErrorFinance;
}else{try{
$TypeText = (string)"Pro";$TitleType = $DynamicTitleLang['Pro'];
if(isset($_GET['Farm'])){$TypeText = "Farm";$TitleType = $DynamicTitleLang['Farm'];}
$Playoff = (boolean)False;
$PlayoffString = (string)"False";
$Year = (integer)0;
if(isset($_GET['Playoff'])){$Playoff=True;$PlayoffString="True";}
if(isset($_GET['Year'])){$Year = filter_var($_GET['Year'], FILTER_SANITIZE_NUMBER_INT);}
If($Year > 0 AND file_exists($CareerStatDatabaseFile) == true){ /* CareerStat */
$db = new SQLite3($CareerStatDatabaseFile);
$CareerDBFormatV2CheckCheck = $db->querySingle("SELECT Count(name) AS CountName FROM sqlite_master WHERE type='table' AND name='LeagueGeneral'",true);
If ($CareerDBFormatV2CheckCheck['CountName'] == 1){
$HistoryOutput = True;
$Query = "Select FarmEnable from LeagueSimulation WHERE Year = " . $Year . " And Playoff = '" . $PlayoffString. "'";
$LeagueSimulationMenu = $db->querySingle($Query,true);
$Query = "Select Name, OutputName, ProScheduleTotalDay, ScheduleNextDay from LeagueGeneral WHERE Year = " . $Year . " And Playoff = '" . $PlayoffString. "'";
$LeagueGeneral = $db->querySingle($Query,true);
//Confirm Valid Data Found
$CareerDBFormatV2CheckCheck = $db->querySingle("Select Count(Name) As CountName from LeagueGeneral WHERE Year = " . $Year . " And Playoff = '" . $PlayoffString. "'",true);
If ($CareerDBFormatV2CheckCheck['CountName'] == 1){$LeagueName = $LeagueGeneral['Name'];}else{$Year = (integer)0;$HistoryOutput = (boolean)False;Goto RegularSeason;}
If ($TypeText == "Farm"){
$Query = "SELECT TeamFarmFinanceHistory.*, TeamFarmStatHistory.HomeGP, 0 AS TeamThemeID FROM (TeamFarmFinanceHistory LEFT JOIN TeamFarmStatHistory ON TeamFarmFinanceHistory.Number = TeamFarmStatHistory.Number AND TeamFarmFinanceHistory.Year = " . $Year . " AND TeamFarmStatHistory.Year = " . $Year . " AND TeamFarmFinanceHistory.Playoff = '" . $PlayoffString. "' = " . $Year . " AND TeamFarmStatHistory.Playoff = '" . $PlayoffString. "') LEFT JOIN TeamFarmInfoHistory ON TeamFarmFinanceHistory.Number = TeamFarmInfoHistory.Number AND TeamFarmFinanceHistory.Year = " . $Year . " AND TeamFarmInfoHistory.Year = " . $Year . " AND TeamFarmFinanceHistory.Playoff = '" . $PlayoffString. "' AND TeamFarmInfoHistory.Playoff = '" . $PlayoffString. "' WHERE TeamFarmFinanceHistory.Year = " . $Year . " AND TeamFarmFinanceHistory.Playoff = '" . $PlayoffString. "' ORDER BY TeamFarmFinanceHistory.Name";
}else{
$Query = "SELECT TeamProFinanceHistory.*, TempTable.EstimatedSeasonExpense AS FarmEstimatedSeasonExpense, TempTable.HomeGP AS HomeGP, 0 As TeamThemeID FROM TeamProFinanceHistory INNER JOIN (SELECT TeamFarmFinanceHistory.Number, TeamFarmFinanceHistory.Year, TeamFarmFinanceHistory.Playoff, TeamFarmFinanceHistory.EstimatedSeasonExpense,TeamProStatHistory.HomeGP FROM TeamProStatHistory INNER JOIN TeamFarmFinanceHistory ON TeamProStatHistory.Number = TeamFarmFinanceHistory.Number AND TeamProStatHistory.Year = " . $Year . " AND TeamFarmFinanceHistory.Year = " . $Year . " AND TeamProStatHistory.Playoff = '" . $PlayoffString. "' AND TeamFarmFinanceHistory.Playoff = '" . $PlayoffString. "') AS TempTable ON TeamProFinanceHistory.Number = TempTable.Number AND TeamProFinanceHistory.Year = " . $Year . " AND TempTable.Year = " . $Year . " AND TeamProFinanceHistory.Playoff = '" . $PlayoffString. "' AND TempTable.Playoff = '" . $PlayoffString. "' LEFT JOIN TeamProInfoHistory ON TeamProFinanceHistory.Number = TeamProInfoHistory.Number AND TeamProFinanceHistory.Year = '" . $Year . "' AND TeamProInfoHistory.Year = " . $Year . " AND TeamProFinanceHistory.Playoff = '" . $PlayoffString. "' AND TeamProInfoHistory.Playoff = '" . $PlayoffString. "' AND TeamProFinanceHistory.Year = " . $Year . " AND TeamProFinanceHistory.Playoff = '" . $PlayoffString. "' ORDER by TeamProFinanceHistory.Name";
}
$Finance = $db->query($Query);
$Query = "Select SalaryCapOption, ProSalaryCapValue, ProMinimumSalaryCap, CurrentFundMinimumWarning from LeagueFinance WHERE Year = " . $Year . " And Playoff = '" . $PlayoffString. "'";
$LeagueFinance = $db->querySingle($Query,true);
$LeagueName = $LeagueGeneral['Name'];
$Title = $LeagueName . " - " . $TeamLang['Finance'] . " - " . $Year;
If ($Playoff == True){$Title = $Title . $TopMenuLang['Playoff'];}
}else{
Goto RegularSeason;
}
}else{
/* Regular Season */
RegularSeason:
$db = new SQLite3($DatabaseFile);
If ($TypeText == "Farm"){
$Query = "SELECT TeamFarmFinance.*, TeamFarmStat.HomeGP, TeamFarmInfo.TeamThemeID FROM (TeamFarmFinance LEFT JOIN TeamFarmStat ON TeamFarmFinance.Number = TeamFarmStat.Number) LEFT JOIN TeamFarmInfo ON TeamFarmFinance.Number = TeamFarmInfo.Number ORDER BY TeamFarmFinance.Name;";
}else{
$Query = "SELECT TeamProFinance.*, TempTable.EstimatedSeasonExpense AS FarmEstimatedSeasonExpense, TempTable.HomeGP AS HomeGP, TeamProInfo.TeamThemeID FROM TeamProFinance INNER JOIN (SELECT TeamFarmFinance.Number, TeamFarmFinance.EstimatedSeasonExpense,TeamProStat.HomeGP FROM TeamProStat INNER JOIN TeamFarmFinance ON TeamProStat.Number = TeamFarmFinance.Number) AS TempTable ON TeamProFinance.Number = TempTable.Number LEFT JOIN TeamProInfo ON TeamProFinance.Number = TeamProInfo.Number ORDER by TeamProFinance.Name";
}
$Finance = $db->query($Query);
$Query = "Select SalaryCapOption, ProSalaryCapValue, ProMinimumSalaryCap, CurrentFundMinimumWarning from LeagueFinance";
$LeagueFinance = $db->querySingle($Query,true);
$Query = "Select Name, OutputName, ProScheduleTotalDay, ScheduleNextDay from LeagueGeneral";
$LeagueGeneral = $db->querySingle($Query,true);
$LeagueName = $LeagueGeneral['Name'];
$Title = $TypeText . " " . $TeamLang['Finance'];
}
} catch (Exception $e) {
STHSErrorFinance:
$LeagueName = $DatabaseNotFound;
$Finance = Null;
$Title = $DatabaseNotFound;
$LeagueFinance = Null;
}}
echo "<title>" . $LeagueName . " - " . $Title . "</title>";
?>
</head><body>
<?php include "Menu.php";?>
<script>
$(function() {
$.tablesorter.addWidget({ id: "numbering",format: function(table) {var c = table.config;$("tr:visible", table.tBodies[0]).each(function(i) {$(this).find('td').eq(0).text(i + 1);});}});
$(".STHSPHPFinance_Table").tablesorter({
widgets: ['numbering','columnSelector', 'stickyHeaders', 'filter', 'output'],
widgetOptions : {
columnSelector_container : $('#tablesorter_ColumnSelector'),
columnSelector_layout : '<label><input type="checkbox">{name}</label>',
columnSelector_name : 'title',
columnSelector_mediaquery: true,
columnSelector_mediaqueryName: 'Automatic',
columnSelector_mediaqueryState: true,
columnSelector_mediaqueryHidden: true,
columnSelector_breakpoints : [ '20em', '40em', '60em', '80em', '90em', '95em' ],
filter_columnFilters: true,
filter_placeholder: { search : '<?php echo $TableSorterLang['Search'];?>' },
filter_searchDelay : 500,
filter_reset: '.tablesorter_Reset',
output_delivery: 'd',
output_saveFileName: 'STHSFinance.CSV'
}
});
$('.download').click(function(){
var $table = $('.STHSPHPFinance_Table'),
wo = $table[0].config.widgetOptions;
$table.trigger('outputTable');
return false;
});
});
</script>
<div style="width:99%;margin:auto;">
<?php echo "<h1>" . $Title . "</h1>";
If($HistoryOutput == True){
echo "<div id=\"ReQueryDiv\" style=\"display:none;\">";include "SearchHistorySub.php";include "SearchHistoryFinance.php";echo "</div>";
echo "<button class=\"tablesorter_Output\" style=\"margin-left:15px\" id=\"ReQuery\">" . $SearchLang['ChangeSearch'] . "</button>";
}?>
<div class="tablesorter_ColumnSelectorWrapper">
<input id="tablesorter_colSelect1" type="checkbox" class="hidden">
<label class="tablesorter_ColumnSelectorButton" for="tablesorter_colSelect1"><?php echo $TableSorterLang['ShoworHideColumn'];?></label>
<button class="tablesorter_Output download" type="button">Output</button>
<div id="tablesorter_ColumnSelector" class="tablesorter_ColumnSelector"></div>
<?php include "FilterTip.php";?>
</div>
</div>
<table class="STHSPHPFinance_Table tablesorter"><thead><tr>
<th class="sorter-false" colspan="2"></th>
<?php
$ColsPan = 2;
if ($TypeText == "Pro"){$ColsPan="5";}
?>
<th class="sorter-false" colspan="<?php echo $ColsPan . "\">" . $TeamLang['ArenaCapacity'];?></th>
<th class="sorter-false" colspan="<?php echo $ColsPan . "\">" . $TeamLang['TicketPrice'];?></th>
<th class="sorter-false" colspan="<?php echo $ColsPan . "\">" . $TeamLang['Attendance'];?></th>
<th class="sorter-false" colspan="<?php echo $ColsPan . "\">" . $TeamLang['AttendancePCT'];?></th>
<th class="sorter-false" colspan="6"><?php echo $TeamLang['Income'];?></th>
<th class="sorter-false" colspan="<?php if ($TypeText == "Pro"){echo "9";}else{echo "7";}?>"><?php echo $TeamLang['Expenses'];?></th>
<th class="sorter-false" colspan="4"><?php echo $TeamLang['Estimate'];?></th>
<?php if ($TypeText == "Pro" AND isset($LeagueFinance)){
echo "<th class=\"sorter-false\" colspan=\"";
if ($LeagueFinance['SalaryCapOption'] > 0){echo "7";}else{echo "3";}
echo "\">" . $TeamLang['TeamTotalEstime'] . "</th>";}
?>
</tr><tr>
<th data-priority="1" title="Order Number" class="STHSW10 sorter-false">#</th>
<th data-priority="critical" title="Team Name" class="STHSW200"><?php echo $TeamLang['TeamName'];?></th>
<?php
echo "<th data-priority=\"6\" title=\"Arena Capacity Level 1\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "1</th>";
echo "<th data-priority=\"6\" title=\"Arena Capacity Level 2\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "2</th>";
if ($TypeText == "Pro"){
echo "<th data-priority=\"6\" title=\"Arena Capacity Level 3\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "3</th>";
echo "<th data-priority=\"6\" title=\"Arena Capacity Level 4\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "4</th>";
echo "<th data-priority=\"6\" title=\"Arena Capacity Luxury\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Luxury'] . "</th>";
}
echo "<th data-priority=\"6\" title=\"Ticket Price Level 1\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "1</th>";
echo "<th data-priority=\"6\" title=\"Ticket Price Level 2\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "2</th>";
if ($TypeText == "Pro"){
echo "<th data-priority=\"6\" title=\"Ticket Price Level 3\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "3</th>";
echo "<th data-priority=\"6\" title=\"Ticket Price Level 4\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "4</th>";
echo "<th data-priority=\"6\" title=\"Ticket Price Luxury\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Luxury'] . "</th>";
}
echo "<th data-priority=\"6\" title=\"Attendance Level 1\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "1</th>";
echo "<th data-priority=\"6\" title=\"Attendance Level 2\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "2</th>";
if ($TypeText == "Pro"){
echo "<th data-priority=\"6\" title=\"Attendance Level 3\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "3</th>";
echo "<th data-priority=\"6\" title=\"Attendance Level 4\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "4</th>";
echo "<th data-priority=\"6\" title=\"Attendance Luxury\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Luxury'] . "</th>";
}
echo "<th data-priority=\"6\" title=\"Attendance PCT Level 1\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "1</th>";
echo "<th data-priority=\"6\" title=\"Attendance PCT Level 2\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "2</th>";
if ($TypeText == "Pro"){
echo "<th data-priority=\"6\" title=\"Attendance PCT Level 3\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "3</th>";
echo "<th data-priority=\"6\" title=\"Attendance PCT Level 4\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Level'] . "4</th>";
echo "<th data-priority=\"6\" title=\"Attendance PCT Luxury\" class=\"columnSelector-false STHSW25\">" . $TeamLang['Luxury'] . "</th>";
}
?>
<th data-priority="5" title="Home Games Left" class="columnSelector-false STHSW25"><?php echo $TeamLang['HomeGamesLeft'];?></th>
<th data-priority="6" title="Average Attendance PCT" class="columnSelector-false STHSW75"><?php echo $TeamLang['AverageAttendancePCT'];?></th>
<th data-priority="4" title="Average Income per Game" class="STHSW75"><?php echo $TeamLang['AverageIncomeperGame'];?></th>
<th data-priority="3" title="Year to Date Revenue" class="STHSW75"><?php echo $TeamLang['YeartoDateRevenue'];?></th>
<th data-priority="5" title="Arena Capacity" class="columnSelector-false STHSW75"><?php echo $TeamLang['ArenaCapacity'];?></th>
<th data-priority="6" title="Team Popularity" class="columnSelector-false STHSW35"><?php echo $TeamLang['TeamPopularity'];?></th>
<th data-priority="3" title="Players Total Salaries" class="STHSW75"><?php echo $TeamLang['PlayersTotalSalaries'];?></th>
<th data-priority="3" title="Players Total Average Salaries" class="STHSW75"><?php echo $TeamLang['PlayersTotalAverageSalaries'];?></th>
<?php if ($TypeText == "Pro"){echo "<th data-priority=\"5\" title=\"Special Salary Cap Value\" class=\"columnSelector-false STHSW75\">" . $TeamLang['SpecialSalaryCapValue']. "</th>";}?>
<th data-priority="2" title="Year To Date Expenses" class="STHSW75"><?php echo $TeamLang['YearToDateExpenses'];?></th>
<th data-priority="2" title="Salary Cap Per Days" class="<?php if(isset($LeagueFinance)){if ($LeagueFinance['SalaryCapOption'] == 0){echo "columnSelector-false ";}}?>STHSW75"><?php echo $TeamLang['SalaryCapPerDays'];?></th>
<th data-priority="2" title="Salary Cap To Date" class="<?php if(isset($LeagueFinance)){if ($LeagueFinance['SalaryCapOption'] == 0){echo "columnSelector-false ";}}?>STHSW75" style="min-width:55px;"><?php echo $TeamLang['SalaryCapToDate'];?></th>
<th data-priority="5" title="Players In Salary Cap" class="STHSW35"><?php echo $TeamLang['PlayerInSalaryCap'];?></th>
<th data-priority="5" title="Players Out of Salary Cap" class="STHSW35"><?php echo $TeamLang['PlayerOutofSalaryCap'];?></th>
<?php if ($TypeText == "Pro"){echo "<th data-priority=\"5\" title=\"Luxury Taxe Total\" class=\"columnSelector-false STHSW75\">" . $TeamLang['LuxuryTaxeTotal'] . "</th>";}?>
<th data-priority="4" title="Estimated Season Revenue" class="STHSW75"><?php echo $TeamLang['EstimatedSeasonRevenue'];?></th>
<th data-priority="5" title="Remaining Season Days" class="columnSelector-false STHSW35"><?php echo $TeamLang['RemainingSeasonDays'];?></th>
<th data-priority="2" title="Expenses Per Days" class="STHSW75"><?php echo $TeamLang['ExpensesPerDays'];?></th>
<th data-priority="2" title="Estimated Season Expenses" class="STHSW75"><?php echo $TeamLang['EstimatedSeasonExpenses'];?></th>
<?php if ($TypeText == "Pro" AND isset($LeagueFinance)){
echo "<th data-priority=\"1\" title=\"Estimated Season Expenses\" class=\"STHSW75\">" . $TeamLang['EstimatedSeasonExpenses']. "</th>";
if ($LeagueFinance['SalaryCapOption'] > 0){
echo "<th data-priority=\"1\" title=\"Estimated Season Salary Cap\" class=\"STHSW75\">" . $TeamLang['EstimatedSeasonSalaryCap']. "</th>";
echo "<th data-priority=\"6\" title=\"Over Minimum Salary Cap\" class=\"STHSW75\">" . $TeamLang['OverMinimumSalaryCap'] . " of " . number_Format($LeagueFinance['ProMinimumSalaryCap'],0) . "$</th>\n";
echo "<th data-priority=\"4\" title=\"Maximum Salary Cap\" class=\"columnSelector-false STHSW75\">" . $TeamLang['MaximumSalaryCap']. "</th>";
echo "<th data-priority=\"2\" title=\"Available Salary Cap\" class=\"STHSW75\">" . $TeamLang['AvailableSalaryCap']. "</th>";
}
echo "<th data-priority=\"1\" title=\"Current Bank Account\" class=\"STHSW75\" style=\"min-width:65px;\">" . $TeamLang['CurrentBankAccount']. "</th>";
echo "<th data-priority=\"1\" title=\"Projected Bank Account\" class=\"STHSW75\" style=\"min-width:65px;\">" . $TeamLang['ProjectedBankAccount']. "</th>";
}?>
</tr></thead>
<tbody>
<?php
$Order = 0;
$NoSort = (boolean)FALSE;
if (empty($Finance) == false){while ($Row = $Finance ->fetchArray()) {
$Order +=1;
If ($Row['Number'] <= 100){
echo "<tr><td>" . $Order ."</td><td>";
If ($Row['TeamThemeID'] > 0){echo "<img src=\"" . $ImagesCDNPath . "/images/" . $Row['TeamThemeID'] .".png\" alt=\"\" class=\"STHSPHPFinanceTeamImage\" />";}
echo "<a href=\"" . $TypeText . "Team.php?Team=" . $Row['Number'] . "\">" . $Row['Name'] . "</a></td>";
}else{
If ($NoSort == False){echo "</tbody><tbody class=\"tablesorter-no-sort\">";$NoSort=True;}
echo "<tr><td></td>";
echo "<td>" . $Row['Name'] . "</td>";
}
echo "<td>" . $Row['ArenaCapacityL1'] . "</td>";
echo "<td>" . $Row['ArenaCapacityL2'] . "</td>";
if ($TypeText == "Pro"){
echo "<td>" . $Row['ArenaCapacityL3'] . "</td>";
echo "<td>" . $Row['ArenaCapacityL4'] . "</td>";
echo "<td>" . $Row['ArenaCapacityLuxury'] . "</td>";
}
echo "<td>" . $Row['TicketPriceL1'] . "</td>";
echo "<td>" . $Row['TicketPriceL2'] . "</td>";
if ($TypeText == "Pro"){
echo "<td>" . $Row['TicketPriceL3'] . "</td>";
echo "<td>" . $Row['TicketPriceL4'] . "</td>";
echo "<td>" . $Row['TicketPriceLuxury'] . "</td>";
}
echo "<td>" . $Row['AttendanceL1'] . "</td>";
echo "<td>" . $Row['AttendanceL2'] . "</td>";
if ($TypeText == "Pro"){
echo "<td>" . $Row['AttendanceL3'] . "</td>";
echo "<td>" . $Row['AttendanceL4'] . "</td>";
echo "<td>" . $Row['AttendanceLuxury'] . "</td>";
}
echo "<td>";if ($Row['ArenaCapacityL1'] > 0 AND $Row['HomeGP'] > 0){echo number_format(($Row['AttendanceL1'] / ($Row['ArenaCapacityL1'] * $Row['HomeGP'])) *100 ,2) . "%";} else { echo "0%";} echo "</td>";
echo "<td>";if ($Row['ArenaCapacityL2'] > 0 AND $Row['HomeGP'] > 0){echo number_format(($Row['AttendanceL2'] / ($Row['ArenaCapacityL2'] * $Row['HomeGP'])) *100 ,2) . "%";} else { echo "0%";} echo "</td>";
if ($TypeText == "Pro"){
echo "<td>";if ($Row['ArenaCapacityL3'] > 0 AND $Row['HomeGP'] > 0){echo number_format(($Row['AttendanceL3'] / ($Row['ArenaCapacityL3'] * $Row['HomeGP'])) *100 ,2) . "%";} else { echo "0%";} echo "</td>";
echo "<td>";if ($Row['ArenaCapacityL4'] > 0 AND $Row['HomeGP'] > 0){echo number_format(($Row['AttendanceL4'] / ($Row['ArenaCapacityL4'] * $Row['HomeGP'])) *100 ,2) . "%";} else { echo "0%";} echo "</td>";
echo "<td>";if ($Row['ArenaCapacityLuxury'] > 0 AND $Row['HomeGP'] > 0){echo number_format(($Row['AttendanceLuxury'] / ($Row['ArenaCapacityLuxury'] * $Row['HomeGP'])) *100 ,2) . "%";} else { echo "0%";} echo "</td>";
}
$TotalArenaCapacity = 0;
if ($TypeText == "Pro"){
$TotalArenaCapacity = ($Row['ArenaCapacityL1'] + $Row['ArenaCapacityL2'] + $Row['ArenaCapacityL3'] + $Row['ArenaCapacityL4'] + $Row['ArenaCapacityLuxury']);
}else{
$TotalArenaCapacity = ($Row['ArenaCapacityL1'] + $Row['ArenaCapacityL2']);
}
If ($Row['ScheduleHomeGameInAYear'] > 0){echo "<td>" . ($Row['ScheduleHomeGameInAYear'] - $Row['HomeGP'] ). "</td>\n";}else{echo "<td>" . (($Row['ScheduleGameInAYear'] / 2) - $Row['HomeGP']) . "</td>\n";}
if ($Row['HomeGP'] > 0){echo "<td>" . Round($Row['TotalAttendance'] / $Row['HomeGP']) . " - ";echo number_Format(($Row['TotalAttendance'] / ($TotalArenaCapacity * $Row['HomeGP'])) *100,2) . "%</td>\n";
}else{echo "<td>0 - 0%</td>";}
if ($Row['HomeGP'] > 0){echo "<td>" . number_format($Row['TotalIncome'] / $Row['HomeGP'],0) . "$</td>";}else{echo "<td>0$</td>";}
echo "<td>" . number_format($Row['TotalIncome'],0) . "$</td>";
echo "<td>" . $TotalArenaCapacity . "</td>";
echo "<td>" . $Row['TeamPopularity'] . "</td>";
echo "<td>" . number_Format($Row['TotalPlayersSalaries'],0) . "$</td>\n";
echo "<td>" . number_Format($Row['TotalPlayersSalariesAverage'],0) . "$</td>\n";
if ($TypeText == "Pro"){echo "<td>" . number_Format($Row['SpecialSalaryCapY1'],0) . "$</td>\n";}
echo "<td>" . number_Format(($Row['ExpenseThisSeason']),0) . "$</td>\n";
echo "<td>" . number_Format($Row['SalaryCapPerDay'],0) . "$</td>\n";
echo "<td>" . number_Format($Row['SalaryCapToDate'],0) . "$</td>\n";
echo "<td>" . $Row['PlayerInSalaryCap'] . "</td>\n";
echo "<td>" . $Row['PlayerOutofSalaryCap'] . "</td>\n";
if ($TypeText == "Pro"){echo "<td>" . number_Format($Row['LuxuryTaxeTotal'],0) . "$</td>\n";}
echo "<td>" . number_Format($Row['EstimatedRevenue'],0) . "$</td>\n";
$Remaining = ($LeagueGeneral['ProScheduleTotalDay'] - $LeagueGeneral['ScheduleNextDay'] + 1);
echo "<td>";if($Remaining > 0){echo $Remaining;}else{echo "0";}echo "</td>\n";
echo "<td>" . number_Format($Row['ExpensePerDay'],0) . "$</td>\n";
echo "<td>" . number_Format($Row['EstimatedSeasonExpense'],0) . "$</td>\n";
if ($TypeText == "Pro"){
echo "<td>" . number_Format(($Row['EstimatedSeasonExpense'] + $Row['FarmEstimatedSeasonExpense']) ,0) . "$</td>\n";
if ($LeagueFinance['SalaryCapOption'] > 0){
$TeamSalaryCap = 0;
if ($LeagueFinance['SalaryCapOption'] == 0){
$TeamSalaryCap = 2147483647;
}elseif($LeagueFinance['SalaryCapOption'] == 2 OR $LeagueFinance['SalaryCapOption'] == 5){
$TeamSalaryCap = $Row['CurrentBankAccount'] + $LeagueFinance['ProSalaryCapValue'];
}else{
$TeamSalaryCap = $LeagueFinance['ProSalaryCapValue'];
}
If ($Row['TotalSalaryCap'] > $TeamSalaryCap OR $Row['TotalSalaryCap'] < $LeagueFinance['ProMinimumSalaryCap']){
echo "<td><span style=\"color:red\">" . number_Format($Row['TotalSalaryCap'],0) . "$</span></td>\n";
}else{
echo "<td>" . number_Format($Row['TotalSalaryCap'],0) . "$</td>\n";
}
echo "<td>" . number_Format($Row['TotalSalaryCap'] - $LeagueFinance['ProMinimumSalaryCap'],0) . "$</td>\n";
echo "<td>" . number_Format($TeamSalaryCap,0) . "$</td>\n";
echo "<td>" . number_Format($TeamSalaryCap - $Row['TotalSalaryCap'],0) . "$</td>\n";
}
if ($LeagueFinance['CurrentFundMinimumWarning'] > $Row['CurrentBankAccount']){echo "<td><span style=\"color:red\">" . number_Format($Row['CurrentBankAccount'],0) . "$</span></td>\n";}else{echo "<td>" . number_Format($Row['CurrentBankAccount'],0) . "$</td>\n";}
if ($LeagueFinance['CurrentFundMinimumWarning'] > $Row['ProjectedBankAccount']){echo "<td><span style=\"color:red\">" . number_Format($Row['ProjectedBankAccount'],0) . "$</span></td>\n";}else{echo "<td>" . number_Format($Row['ProjectedBankAccount'],0) . "$</td>\n";}
}
echo "</tr>\n"; /* The \n is for a new line in the HTML Code */
}}
?>
</tbody></table>
<?php include "Footer.php";?>