<?php require_once dirname(dirname(__FILE__)) . '/config.php'; require_once 'Common/pdf/ResultPDF.inc.php'; require_once 'Common/Fun_FormatText.inc.php'; if (!isset($isCompleteResultBook)) { $pdf = new ResultPDF(get_text('Birthdays', 'Tournament')); } $Select = "SELECT\r\n\tCONCAT(upper(EnFirstName), ' ', EnName) as Athlete, DATE_FORMAT(EnDob,'" . get_text('DateFmtDB') . "') as DoB, CoCode, CoName, SesName, DATE_FORMAT(EnDob,'%d') as Day, DATE_FORMAT(EnDob,'%m') as Month, \r\n\tSUBSTRING(QuTargetNo,1,1) AS Session, SUBSTRING(QuTargetNo,2) AS TargetNo\r\n\tFROM Entries\r\n\tINNER JOIN Qualifications ON EnId=QuId\r\n\tINNER JOIN Countries on EnCountry=CoId\r\n\tINNER JOIN Session ON SesTournament=EnTournament AND QuSession=SesOrder AND SesType='Q'\r\n\tWHERE EnTournament=" . StrSafe_DB($_SESSION['TourId']) . "\r\n\tAND DATE_FORMAT(EnDob,'%m%d') BETWEEN DATE_FORMAT(" . StrSafe_DB($_SESSION['TourRealWhenFrom']) . ",'%m%d') AND DATE_FORMAT(" . StrSafe_DB($_SESSION['TourRealWhenTo']) . ",'%m%d')\r\n\tORDER BY DATE_FORMAT(EnDob,'%m%d') ASC, EnName, EnFirstName"; $Rs = safe_r_sql($Select); $CurDate = ''; if ($Rs && safe_num_rows($Rs) > 0) { $pdf->SetFont($pdf->FontStd, 'B', 16); $pdf->Cell(190, 15, get_text('Birthdays', 'Tournament'), 0, 1, 'C'); while ($MyRow = safe_fetch($Rs)) { if ($CurDate != $MyRow->Month . $MyRow->Day) { if ($CurDate != '') { $pdf->Cell(190, 3, '', 0, 1); } $pdf->SetFont($pdf->FontStd, 'B', 16); $pdf->Cell(190, 8, get_text($MyRow->Month . '_Short', 'DateTime') . " " . $MyRow->Day, 0, 1, 'L'); } $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell(10, 8, '', 0, 0); $pdf->Cell(70, 6, $MyRow->Athlete . ' (' . $MyRow->DoB . ')', 0, 0); $pdf->Cell(50, 6, $MyRow->CoCode . ' - ' . $MyRow->CoName, 0, 0); $pdf->Cell(60, 6, $MyRow->Session . ' - ' . $MyRow->TargetNo . ($MyRow->SesName ? ' (' . $MyRow->SesName . ')' : ''), 0, 1); $CurDate = $MyRow->Month . $MyRow->Day; } } if (!isset($isCompleteResultBook)) {
// $Fasi[0]=get_text('24_Phase'); if ($MyRow->EvFinalFirstPhase == 48) { $Fasi[0] = get_text('48_Phase'); $Fasi[1] = get_text('24_Phase'); } elseif ($MyRow->EvFinalFirstPhase == 24) { $Fasi[1] = get_text('24_Phase'); } if ($RowNo++ != 0) { $pdf->AddPage(); } $WhereX = $WhereStartX; $WhereY = $WhereStartY; //Intestazione Atleta $pdf->SetY($pdf->GetPageHeight() * 0.2 - 23); $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell($pdf->GetPageWidth() * 0.1, 6, get_text('Athlete') . ': ', 'TL', 0, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell($pdf->GetPageWidth() * 0.8 - 20, 6, $MyRow->Athlete, 'T', 1, 'L', 0); $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell($pdf->GetPageWidth() * 0.1, 6, get_text('Country') . ': ', 'L', 0, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell($pdf->GetPageWidth() * 0.8 - 20, 6, $MyRow->CoName . (strlen($MyRow->CoCode) > 0 ? ' (' . $MyRow->CoCode . ')' : ''), 0, 1, 'L', 0); $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell($pdf->GetPageWidth() * 0.1, 6, get_text('DivisionClass') . ': ', 'LB', 0, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell($pdf->GetPageWidth() * 0.8 - 20, 6, get_text($MyRow->EvEventName, '', '', true), 'B', 1, 'L', 0); $pdf->SetXY($pdf->GetPageWidth() * 0.9 - 10, $pdf->GetY() - 18); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell($pdf->GetPageWidth() * 0.1, 6, get_text('Rank'), 'TLR', 1, 'C', 1); $pdf->SetXY($pdf->GetPageWidth() * 0.9 - 10, $pdf->GetY()); $pdf->SetFont($pdf->FontStd, 'B', 25);
} if ($NoPhoto) { $MyQuery .= "AND (length(PhPhoto)='' or PhPhoto is null) "; } $MyQuery .= "ORDER BY CoCode, Name, CoName, FirstName, TargetNo "; //debug_svela($MyQuery); $Rs = safe_r_sql($MyQuery); if ($Rs) { $ShowStatusLegend = false; $FirstTime = true; $OldTeam = '#@#@#'; while ($MyRow = safe_fetch($Rs)) { $pdf->SetDefaultColor(); if ($FirstTime || !$pdf->SamePage(4)) { $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(54, 4, get_text('Country'), 1, 0, 'L', 1); $pdf->Cell(7, 4, get_text('SessionShort', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(11, 4, get_text('Target'), 1, 0, 'C', 1); $pdf->Cell(10, 4, get_text('Code', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(41, 4, get_text('Athlete'), 1, 0, 'L', 1); $pdf->Cell(11, 4, get_text('AgeCl'), 1, 0, 'C', 1); $pdf->Cell(8, 4, get_text('SubCl', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(12, 4, get_text('Division'), 1, 0, 'C', 1); $pdf->Cell(12, 4, get_text('Cl'), 1, 0, 'C', 1); //Disegna i Pallini $pdf->DrawParticipantHeader(); $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(10, 4, get_text('Status', 'Tournament'), 1, 1, 'C', 1); $OldTeam = ''; $FirstTime = false; }
$RowTournament = NULL; /*$MySql = "SELECT ToCode, ToName, ToCommitee, ToComDescr, ToWhere, UNIX_TIMESTAMP(ToWhenFrom) AS DtFrom, UNIX_TIMESTAMP(ToWhenTo) AS DtTo, TtName " . "FROM Tournament " . "INNER JOIN Tournament*Type ON ToType=TtId " . "WHERE ToId=" . StrSafe_DB($_SESSION['TourId']);*/ $MySql = "SELECT" . " ToCode," . " ToName," . " ToCommitee," . " ToComDescr," . " ToWhere," . " date_format(ToWhenFrom, '" . get_text('DateFmtDB') . "') AS DtFrom," . " date_format(ToWhenTo, '" . get_text('DateFmtDB') . "') AS DtTo," . " ToTypeName AS TtName " . "FROM Tournament " . "WHERE ToId=" . StrSafe_DB($_SESSION['TourId']); $Rs = safe_r_sql($MySql); if (safe_num_rows($Rs) == 1) { $RowTournament = safe_fetch($Rs); safe_free_result($Rs); } $AllQuestions = isset($_REQUEST["All"]); $pdf = new ResultPDF(get_text('FinalReportTitle', 'Tournament')); //Intestazione $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell(190, 7, get_text('FinalReportTitle', 'Tournament'), 1, 1, 'C', 1); //Codice Gara & Tipo $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell(40, 7, get_text('TourCode', 'Tournament') . ": ", 'LT', 0, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell(50, 7, $RowTournament->ToCode, 'T', 0, 'L', 0); $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell(30, 7, get_text('TourType', 'Tournament') . ": ", 'T', 0, 'R', 0); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell(70, 7, get_text($RowTournament->TtName, 'Tournament'), 'TR', 1, 'L', 0); //Denominazione $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell(40, 7, get_text('TourName', 'Tournament') . ": ", 'L', 0, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell(150, 7, $RowTournament->ToName, 'R', 1, 'L', 0); //Organizzazione
$Rs = safe_r_sql($MyQuery); if ($Rs) { $ShowStatusLegend = false; $FirstTime = true; $OldTeam = '#@#@#'; $OldSession = ''; while ($MyRow = safe_fetch($Rs)) { if ($OldSession != $MyRow->DivCode and !$FirstTime) { $pdf->AddPage(); $FirstTime = true; $OldTeam = '#@#@#'; } $OldSession = $MyRow->DivCode; if ($FirstTime || !$pdf->SamePage(4)) { $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(54, 4, get_text('Country'), 1, 0, 'L', 1); $pdf->Cell(7, 4, get_text('SessionShort', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(11, 4, get_text('Target'), 1, 0, 'C', 1); $pdf->Cell(10, 4, get_text('Code', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(41, 4, get_text('Athlete'), 1, 0, 'L', 1); if (!HideCols) { $pdf->Cell(11, 4, get_text('AgeCl'), 1, 0, 'C', 1); $pdf->Cell(8, 4, get_text('SubCl', 'Tournament'), 1, 0, 'C', 1); } $pdf->Cell(12 + (HideCols == true ? 22 : 0), 4, get_text('Division'), 1, 0, 'C', 1); $pdf->Cell(12 + (HideCols == true ? 21 : 0), 4, HideCols == true ? get_text('Class') : get_text('Cl'), 1, 0, 'C', 1); //Disegna i Pallini if (!HideCols) { $pdf->DrawParticipantHeader(); $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(10, 4, get_text('Status', 'Tournament'), 1, 0, 'C', 1);
$RowY = 0; $RowX = 0; $MaxHeight = 0; // $pdf->SetAutoPageBreak(false); while ($MyRow = safe_fetch($Rs)) { if ($OldDiv != $MyRow->DivCode && !$pdf->SamePage($MaxHeight + 20)) { $OldTeam = '#@#@#'; } //Cambio di Squadra if ($OldTeam != $MyRow->NationCode) { if (!$FirstTime) { $pdf->AddPage(); } $pdf->SetXY(10, $pdf->GetY() + 5); $pdf->SetFont($pdf->FontStd, 'B', 20); $pdf->Cell(190, 8, $MyRow->Nation . ' (' . $MyRow->NationCode . ')', 0, 0, 'L', 1); $FirstTime = false; $RowNo = 0; $ColNo = 0; $MaxHeight = 0; $OldTeam = $MyRow->NationCode; $OldDiv = '#@#@#'; } //Cambio di divisione if ($OldDiv != $MyRow->DivCode) { $RowX = 15; $pdf->SetXY($RowX, $pdf->GetY() + 10); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell(185, 7, $MyRow->DivDescription, 0, 1, 'L', 0); $RowY = $pdf->GetY() + 1; $MaxHeight = 0;
. ' GROUP BY QuSession, DATE_FORMAT(AEWhen,\''.get_text('DateFmtDB').'\')' . ' ORDER BY Data ASC, Turno ASC'; */ $MyQuery = 'SELECT DATE_FORMAT(AEWhen,\'' . get_text('DateFmtDB') . '\') as Data, QuSession as Turno, COUNT(EnId) as Accreditati, IF(EnPays=0,"NoPay",ifnull(APPrice,0)) as Prezzo, SUM(IF(EnPays=1,APPrice,0)) as Totale' . ' FROM AccEntries' . ' INNER JOIN Entries ON AEId=EnId /*AND EnPays=1*/ AND AETournament = EnTournament' . ' INNER JOIN Qualifications ON EnId=QuId' . ' LEFT JOIN AccPrice ON EnTournament=APTournament AND CONCAT(EnDivision,EnClass) LIKE APDivClass' . ' WHERE AETournament = ' . StrSafe_DB($_SESSION['TourId']) . ' AND AEOperation = (SELECT AOTId FROM AccOperationType WHERE AOTDescr=' . StrSafe_DB($OpDetails) . ')' . ' GROUP BY QuSession, EnPays, IF(EnPays=0,"NoPay",ifnull(APPrice,0)), DATE_FORMAT(AEWhen,\'' . get_text('DateFmtDB') . '\')' . ' ORDER BY Data ASC, Turno ASC, EnPays DESC, APPrice DESC'; //echo $MyQuery;exit; $Rs = safe_r_sql($MyQuery); if ($Rs) { $TotalDay = 0; $Total = 0; $OldDate = ''; $isFirstTime = true; while ($MyRow = safe_fetch($Rs)) { if ($OldDate != $MyRow->Data) { if ($OldDate != '') { $pdf->SetFont($pdf->FontStd, '', 8); $pdf->Cell(30, 6, '', 0, 0, 'L', 0); $pdf->Cell(115, 6, get_text('Total') . " " . $OldDate, 0, 0, 'R', 0); $pdf->SetFont($pdf->FontStd, 'B', 8); $pdf->Cell(45, 6, NumFormat($TotalDay, 2) . " " . $pdf->writeCurrency(), 1, 1, 'R', 0); } $isFirstTime = true; $pdf->SetY($pdf->GetY() + 5); $pdf->SetFont($pdf->FontStd, 'B', 8); $pdf->Cell(30, 7, '', 0, 0, 'C', 0); $pdf->Cell(30, 7, get_text('TourWhen', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(25, 7, get_text('SessionShort', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(30, 7, get_text('Number'), 1, 0, 'C', 1); $pdf->Cell(30, 7, get_text('Price', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(45, 7, get_text('Total'), 1, 1, 'C', 1); $pdf->SetFont($pdf->FontStd, '', 1); $pdf->Cell(190, 0.5, '', 0, 1, 'C', 0);
if ($CurGroup != "....") { $pdf->SetXY(10, $pdf->GetY() + 5); } } if ($CurGroup != $MyRow->TeEvent) { $TmpSegue = false; } $CurGroup = $MyRow->TeEvent; $pdf->SetFont($pdf->FontStd, 'B', 10); $TmpTitle; if (!is_null($MyRow->DivDescription) && !is_null($MyRow->ClDescription)) { $TmpTitle = get_text($MyRow->DivDescription, '', '', true) . " - " . get_text($MyRow->ClDescription, '', '', true); } else { $TmpTitle = get_text($MyRow->TeEvent, '', '', true); } $pdf->Cell(190, 6, $TmpTitle, 1, 1, 'C', 1); if ($TmpSegue) { $pdf->SetXY(170, $pdf->GetY() - 6); $pdf->SetFont($pdf->FontStd, '', 6); $pdf->Cell(30, 6, get_text('Continue'), 0, 1, 'R', 0); } else { $MyRank = 1; $MyPos = 0; $MyScoreOld = 0; $MyGoldOld = 0; $MyXNineOld = 0; $CurTeam = ""; } $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(20, 4, get_text('Medal'), 1, 0, 'C', 1); $pdf->Cell(85, 4, get_text('Country'), 1, 0, 'L', 1);
$SqlEmpty = $Sql; $Sql .= "ClId " . "FROM Classes " . "LEFT JOIN Entries ON TRIM(ClId) = TRIM(EnClass) AND ClTournament=EnTournament " . "LEFT JOIN Qualifications ON EnId = QuId " . "WHERE EnTournament = " . StrSafe_DB($_SESSION['TourId']) . " " . "GROUP BY ClId " . "ORDER BY ClViewOrder"; $SqlEmpty .= "'--' AS ClId " . "FROM Entries " . "LEFT JOIN Qualifications ON EnId = QuId " . "WHERE EnTournament = " . StrSafe_DB($_SESSION['TourId']) . " AND EnClass='' " . "GROUP BY EnClass "; $Rs = safe_r_sql($Sql); $RsEmpty = safe_r_sql($SqlEmpty); if ($Rs && count($DivArray) > 0) { $ShowStatusLegend = false; $FirstTime = true; $DivSize = ($pdf->getPageWidth() - 35) / count($DivArray); $SesSize = $DivSize / (count($SesArray) + 1); while ($MyRow = safe_fetch($Rs)) { if ($FirstTime || !$pdf->SamePage(16)) { $TmpSegue = !$pdf->SamePage(16); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->SetXY(25, $pdf->GetY() + 5); $pdf->Cell($pdf->getPageWidth() - 35, 6, get_text('StatClasses', 'Tournament'), 1, 1, 'C', 1); if ($TmpSegue) { $pdf->SetXY($pdf->getPageWidth() - 40, $pdf->GetY() - 6); $pdf->SetFont($pdf->FontStd, 'I', 6); $pdf->Cell(30, 6, get_text('Continue'), 0, 1, 'R', 0); } $pdf->SetX(25); $pdf->SetFont($pdf->FontStd, 'B', 10); foreach ($DivArray as $Value) { $pdf->Cell($DivSize, 6, $Value, 1, 0, 'C', 1); } $pdf->Cell(0.1, 6, '', 0, 1, 'C', 0); $pdf->SetX(25); $pdf->SetFont($pdf->FontStd, 'B', 8); for ($i = 0; $i < count($DivArray); $i++) { foreach ($SesArray as $Value) {
// set the target dimention $DimTarget = min(10, ($pdf->GetPageWidth() - 20 - ColName) / ($SesRow->TargetMax - $SesRow->TargetMin + 1)); // checks if there is enough space for at least 1 distance if (!$pdf->SamePage(RowH + 25)) { $pdf->AddPage(); //Al cambio di data aggiungo una pagina $TopPos = 35; } else { $TopPos += RowH; } // prints the session $pdf->SetFillColor(0); $pdf->SetTextColor(255); $pdf->SetXY(10, $TopPos); $pdf->SetFont($pdf->FontStd, 'B', 14); $pdf->Cell($pdf->GetPageWidth() - 20, 8, get_text('Session') . ": " . $SesRow->QuSession, 0, 0, "C", 1); $TopPos += 8; $pdf->SetFillColor(240); $pdf->SetTextColor(0); for ($n = 1; $n <= $SesRow->ToNumDist; $n++) { // gets the different distances for each Event and target type $Sql = "select distinct cast(substr(QuTargetNo,2) as unsigned) TargetNo, IFNULL(Td{$n},'.{$n}.') as Distance, TarDescr, TarDim from\r\nEntries\r\ninner join Qualifications on EnId=QuId\r\nleft join TournamentDistances on concat(trim(EnDivision),trim(EnClass)) like TdClasses and EnTournament=TdTournament\r\nleft join (select TfId, TarDescr, TfW{$n} as TarDim, TfTournament from TargetFaces inner join Targets on TfT{$n}=TarId) tf on TfTournament=EnTournament and TfId=EnTargetFace\r\nwhere EnTournament={$_SESSION['TourId']} and QuSession={$SesRow->QuSession}\r\norder by Distance desc, TargetNo, TarDescr, TarDim"; $Rows = array(); $OldDist = 0; $OldTarg = 0; $OldDim = 0; $q = safe_r_sql($Sql); while ($r = safe_fetch($q)) { if ($r->Distance == '-') { continue; }
$ShowStatusLegend = false; $CurSession = -1; $OldTarget = ''; while ($MyRow = safe_fetch($Rs)) { $pdf->SetDefaultColor(); if ($CurSession != $MyRow->Session || !$pdf->SamePage(4) || strtoupper(substr($MyRow->TargetNo, -1, 1)) == 'A' && !$pdf->SamePage(16)) { $TmpSegue = !$pdf->SamePage(4); if (strtoupper(substr($MyRow->TargetNo, -1, 1)) == 'A' && !$pdf->SamePage(16)) { $TmpSegue = true; $pdf->AddPage(); } elseif ($CurSession != -1) { $pdf->SetXY(10, $pdf->GetY() + 5); } $CurSession = $MyRow->Session; $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell(190, 6, get_text('Session') . " " . $CurSession . " (" . get_text($OpDetails, 'Tournament') . ")", 1, 1, 'C', 1); if ($TmpSegue) { $pdf->SetXY(170, $pdf->GetY() - 6); $pdf->SetFont($pdf->FontStd, 'I', 6); $pdf->Cell(30, 6, get_text('Continue'), 0, 1, 'R', 0); } $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(11, 4, get_text('Target'), 1, 0, 'C', 1); $pdf->Cell(10, 4, get_text('Code', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(44, 4, get_text('Athlete'), 1, 0, 'L', 1); $pdf->Cell(56, 4, get_text('Country'), 1, 0, 'L', 1); $pdf->Cell(12, 4, get_text('AgeCl'), 1, 0, 'C', 1); $pdf->Cell(9, 4, get_text('SubCl', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(12, 4, get_text('Division'), 1, 0, 'C', 1); $pdf->Cell(12, 4, get_text('Cl'), 1, 0, 'C', 1); //Disegna i Pallini
$MyQuery .= "WHERE EnAthlete=1 AND EnTournament = " . StrSafe_DB($_SESSION['TourId']) . " "; $MyQuery .= "AND (EnStatus!=0 OR (EnIndClEvent=0 AND EnTeamClEvent=0 AND EnIndFEvent=0 AND EnIndFEvent=0) OR EnCountry=0 OR DivId is null OR c1.ClId is null OR c2.ClId is null OR LOCATE(c2.ClId, c1.ClValidClass)=0) "; if (isset($_REQUEST["Session"]) && is_numeric($_REQUEST["Session"])) { $MyQuery .= "AND QuSession = " . StrSafe_DB($_REQUEST["Session"]) . " "; } $MyQuery .= "ORDER BY Name, FirstName, TargetNo "; $Rs = safe_r_sql($MyQuery); if ($Rs) { $ShowStatusLegend = false; $FirstTime = true; while ($MyRow = safe_fetch($Rs)) { if ($FirstTime || !$pdf->SamePage(4)) { $TmpSegue = !$pdf->SamePage(4); $StartLetter = substr($MyRow->Name, 0, 1); $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell(190, 6, get_text('PartecipantListError', 'Tournament'), 1, 1, 'C', 1); if ($TmpSegue) { $pdf->SetXY(170, $pdf->GetY() - 6); $pdf->SetFont($pdf->FontStd, 'I', 6); $pdf->Cell(30, 6, get_text('Continue'), 0, 1, 'R', 0); } $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(10, 4, get_text('Code', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(41, 4, get_text('Athlete'), 1, 0, 'L', 1); $pdf->Cell(54, 4, get_text('Country'), 1, 0, 'L', 1); $pdf->Cell(7, 4, get_text('SessionShort', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(11, 4, get_text('Target'), 1, 0, 'C', 1); $pdf->Cell(11, 4, get_text('AgeCl'), 1, 0, 'C', 1); $pdf->Cell(8, 4, get_text('SubCl', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(12, 4, get_text('Division'), 1, 0, 'C', 1); $pdf->Cell(12, 4, get_text('Cl'), 1, 0, 'C', 1);
$listClDiv[$MyRow->Classe][$MyRow->Divisione]["I"] = $MyRow->QuantiInd; $listClDiv[$MyRow->Classe][$MyRow->Divisione]["S"] = $MyRow->QuantiSq; } } //debug_svela($listClDiv); $FirstTime = true; $DivSize = ($pdf->getPageWidth() - 35) / count($DivArray); foreach ($listClDiv as $cl => $singleClass) { if ($FirstTime || !$pdf->SamePage(16)) { $TmpSegue = !$pdf->SamePage(16); if ($TmpSegue) { $pdf->AddPage(); } $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->SetXY(25, $pdf->GetY() + 5); $pdf->Cell($pdf->getPageWidth() - 35, 6, get_text('StatEvents', 'Tournament'), 1, 1, 'C', 1); if ($TmpSegue) { $pdf->SetXY($pdf->getPageWidth() - 40, $pdf->GetY() - 6); $pdf->SetFont($pdf->FontStd, 'I', 6); $pdf->Cell(30, 6, get_text('Continue'), 0, 1, 'R', 0); } $pdf->SetX(25); $pdf->SetFont($pdf->FontStd, 'B', 10); foreach ($DivArray as $Value) { $pdf->Cell($DivSize - 0.5, 6, $Value, 1, 0, 'C', 1); $pdf->Cell(0.5, 6, '', 1, 0, 'C', 1); } $pdf->Cell(0.1, 6, '', 0, 1, 'C', 0); $pdf->SetX(25); $pdf->SetFont($pdf->FontStd, '', 7); foreach ($DivArray as $Value) {
} $TopPos = 35; $DimTarget = min(10, ($pdf->getpagewidth() - 20 - ColName) / ($LastTarget - $FirstTarget + 1)); } else { if ($OldDate) { $pdf->SetLineStyle(array('width' => 0.5, 'color' => array(128))); $pdf->Line(10, $TopPos + RowH + $DistGap - 1, $pdf->getPageWidth() - 10, $TopPos + RowH + $DistGap - 1); $pdf->SetLineStyle(array('width' => 0.1, 'color' => array(0))); } $TopPos += RowH + $DistGap + 2; } $DistGap = 3; $pdf->SetTextColor(0); $pdf->SetXY(10, $TopPos - 1); $pdf->SetFont($pdf->FontStd, 'B', 14); $pdf->Cell(ColName, 3, isset($_REQUEST["HideTime"]) ? '' : $MyRow->SchTime, 0, 0, "C"); // data e ora $pdf->SetXY(10, $TopPos + ($MyRow->EvMatchArrowsNo == '--' ? 7 : 4)); $pdf->SetFont($pdf->FontStd, 'I', 8); //$pdf->Cell(ColName,5,date( get_text('DateFmt'), $MyRow->SchDate),0,0,"C"); $pdf->Cell(ColName, 5, dateRenderer($MyRow->FSScheduledDate, get_text('DateFmt')), 0, 0, "C"); if ($MyRow->EvMatchArrowsNo != '--') { // numero frecce $nARR = $MyRow->arrows . 'x' . $MyRow->ends; // Numero di frecce if ($MyRow->EvMaxTeamPerson > 1) { $nARR = "(" . $MyRow->EvMaxTeamPerson . 'x' . $MyRow->arrows / $MyRow->EvMaxTeamPerson . ")x" . $MyRow->ends; } $pdf->SetXY(10, $TopPos + 7); $pdf->SetFont($pdf->FontStd, 'I', 7); $pdf->Cell(ColName, 5, get_text('Arrows4End', 'Tournament', $nARR), 0, 0, "C");
if ($Rs) { $ShowStatusLegend = false; $CurSession = -1; $OldTarget = ''; while ($MyRow = safe_fetch($Rs)) { if ($CurSession != $MyRow->Session || !$pdf->SamePage(4) || $MyRow->TargetLetter == 'A' && !$pdf->SamePage(16)) { $TmpSegue = !$pdf->SamePage(4); if ($MyRow->TargetLetter == 'A' && !$pdf->SamePage(16)) { $TmpSegue = true; $pdf->AddPage(); } elseif ($CurSession != -1) { $pdf->SetXY(10, $pdf->GetY() + 5); } $CurSession = $MyRow->Session; $pdf->SetFont($pdf->FontStd, 'B', 10); $pdf->Cell(190, 6, get_text('Session') . " " . $CurSession . " - " . get_text('Distance', 'HTT') . " " . $_REQUEST["Distance"], 1, 1, 'C', 1); if ($TmpSegue) { $pdf->SetXY(170, $pdf->GetY() - 6); $pdf->SetFont($pdf->FontStd, 'I', 6); $pdf->Cell(30, 6, get_text('Continue'), 0, 1, 'R', 0); } $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(11, 4, get_text('Target'), 1, 0, 'C', 1); $pdf->Cell(10, 4, get_text('Code', 'Tournament'), 1, 0, 'C', 1); $pdf->Cell(44, 4, get_text('Athlete'), 1, 0, 'L', 1); $pdf->Cell(16, 4, get_text('Country'), 1, 0, 'L', 1); if (!HideCols) { $pdf->Cell(12, 4, get_text('AgeCl'), 1, 0, 'C', 1); $pdf->Cell(9, 4, get_text('SubCl', 'Tournament'), 1, 0, 'C', 1); } $pdf->Cell(12 + (HideCols == true ? 23 : 0), 4, get_text('Division'), 1, 0, 'C', 1);
} if (count($Filter) > 0) { $Filter = "AND (" . implode(" OR ", $Filter) . ") "; } else { $Filter = ""; } $Select = "\r\n\tSELECT ti.*, it.*,IF(ItJudge!=0,'CatJudge',IF(ItDoS!=0,'CatDos',IF(ItJury!=0,'CatJury','CatOC'))) AS `Category` \r\n\tFROM TournamentInvolved AS ti LEFT JOIN InvolvedType AS it ON ti.TiType=it.ItId \r\n\tWHERE ti.TiTournament={$Ses} AND it.ItId IS NOT NULL {$Filter}\r\n\tORDER BY IF(ItJudge!=0,1,IF(ItDoS!=0,2,IF(ItJury!=0,3,4))) ASC, IF(ItJudge!=0,ItJudge,IF(ItDoS!=0,ItDoS,IF(ItJury!=0,ItJury,ItOC))) ASC,ti.TiName ASC\r\n"; //print $Select;Exit; $Rs = safe_r_sql($Select); $CurCategory = ''; if ($Rs && safe_num_rows($Rs) > 0) { while ($MyRow = safe_fetch($Rs)) { if ($CurCategory != $MyRow->Category) { $pdf->Ln(10); $pdf->SetFont($pdf->FontStd, 'B', 14); $pdf->Cell(190, 8, get_text($MyRow->Category, 'Tournament'), 0, 1, 'L'); } $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell(10, 8, '', 0, 0); $pdf->Cell(180, 6, $MyRow->TiName . ' - ' . get_text($MyRow->ItDescription, 'Tournament'), 0, 1); $CurCategory = $MyRow->Category; } } if (!isset($isCompleteResultBook)) { if (isset($_REQUEST['ToFitarco'])) { $Dest = 'D'; if (isset($_REQUEST['Dest'])) { $Dest = $_REQUEST['Dest']; } $pdf->Output($_REQUEST['ToFitarco'], $Dest); } else {
if ($TmpWhere != "") { $MyQuery .= "AND (" . $TmpWhere . ")"; } $MyQuery .= "ORDER BY CoCode, Name, CoName, FirstName, TargetNo "; //echo $MyQuery;exit; $Rs = safe_r_sql($MyQuery); if ($Rs) { $ShowStatusLegend = false; $OldTeam = '#@#@#'; $isFirstTime = true; $TotalPrice = 0; while ($MyRow = safe_fetch($Rs)) { if ($OldTeam != $MyRow->NationCode) { if (!$isFirstTime) { $pdf->SetFont($pdf->FontStd, '', 8); $pdf->Cell(165, 15, get_text('Cash', 'Tournament') . ":", 0, 0, 'R', 0); $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->Cell(25, 15, NumFormat($TotalPrice, 2) . " " . $pdf->writeCurrency(), 0, 1, 'R', 0); $pdf->AddPage(); } $isFirstTime = false; $pdf->SetXY(10, $pdf->GetY() + 5); $pdf->SetFont($pdf->FontStd, '', 8); $pdf->Cell($pdf->GetStringWidth(get_text('Country')) + 5, 10, get_text('Country'), 0, 0, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->Cell(15, 10, $MyRow->NationCode, 0, 0, 'C', 0); $pdf->Cell(50, 10, $MyRow->Nation, 0, 1, 'L', 0); $pdf->SetFont($pdf->FontStd, '', 8); $pdf->Cell(19, 10, get_text('Partecipants'), 0, 1, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(10, 4, '', 0, 0, 'C', 0);
//Cambio di Sessione e/o Distanza if ($MyRow->Dist == '-') { $MyRow = safe_fetch($Rs); continue; } if ($OldSession != $MyRow->Session . $MyRow->Dist) { if (!$pdf->SamePage(RowH + 5) or $OldTrueSession != $MyRow->Session and !$pdf->SamePage(2 * RowH + 15)) { $pdf->AddPage(); //Al cambio di data aggiungo una pagina $TopPos = 35; } else { $TopPos += RowH; } $pdf->SetXY(10, $TopPos + 3); $pdf->SetFont($pdf->FontStd, 'B', 14); $pdf->Cell(ColName, 8, $MyRow->Dist, 0, 0, "C"); $pdf->SetXY(10, $TopPos + 9); $pdf->SetFont($pdf->FontStd, 'I', 8); $pdf->Cell(ColName, 5, get_text('Session') . ": " . $MyRow->Session, 0, 0, "C"); $pdf->SetTextColor(0); $pdf->SetXY(10 + ColName, $TopPos + 2); $pdf->SetFont($pdf->FontFix, 'B', 7); $pdf->SetFillColor(240); for ($i = $FirstTarget; $i <= $LastTarget; $i++) { $pdf->Cell($DimTarget, 4, $i, 'LRB', 0, "C", 1); } $OldSession = $MyRow->Session . $MyRow->Dist; $OldDist = ''; $OldTarget = ''; } $TgTop = $TopPos + 6;