summaryrefslogtreecommitdiff
path: root/pkle2018.php
diff options
context:
space:
mode:
Diffstat (limited to 'pkle2018.php')
-rw-r--r--pkle2018.php588
1 files changed, 588 insertions, 0 deletions
diff --git a/pkle2018.php b/pkle2018.php
new file mode 100644
index 0000000..a851ead
--- /dev/null
+++ b/pkle2018.php
@@ -0,0 +1,588 @@
+<?php
+$tabpkl = array();
+$typ = 0;
+$rng = 0;
+$xrng = 0;
+$iuc = 0;
+$izw = 0;
+$swk = 0;
+$tab = 0;
+$minpkl = 0;
+
+$min1 = 200;
+$min2 = 150;
+$min3 = 75;
+$min4 = 50;
+$min5 = 0;
+$min6 = 0;
+$min7 = 0;
+$min8 = 0;
+
+$min1_ = 300;
+$min2_ = 200;
+$min3_ = 100;
+$min4_ = 70;
+$min5_ = 0;
+$min6_ = 0;
+$min7_ = 0;
+$min8_ = 0;
+
+// regulamin
+$progu0 = 0;
+$progp0 = 100;
+
+$progu1 = 2; // dla pierwszych progu1% uczestników
+$progp1 = 90; // ostatni dostaje progp1% maximum punktów
+
+$progu2 = 20; // dla kolejnych (progu2-progu1)% uczestników
+$progp2 = 20; // ostatni dostaje 10*progp2% maximum punktów
+
+$progu3 = 50; // dla kolejnych (progu3-progu2)% uczestników
+$progp3 = 0; // ostatni dostaje 10*progp3% maximum punktów
+
+
+$rgg = 25; // OTP****
+$rgp = 15; // OTP***
+$rot = 10; // OTP**
+$rok1 = 7; // OTP*
+$rok = 5; // OTP
+$rtp = 4; // RTP
+$rto = 2; // okregowy
+$rtk = 1; // klubowy
+
+$rgg_ = 40; // OTP****
+$rgp_ = 25; // OTP***
+$rot_ = 15; // OTP**
+$rok1_ = 10; // OTP*
+$rok_ = 7; // OTP
+$rtp_ = 5; // RTP
+$rto_ = 3; // okregowy
+$rtk_ = 2; // klubowy
+
+$zaw = 0.05;
+$dajp = 0;
+
+/*if( $_SERVER['REQUEST_METHOD'] == 'GET' ){
+// ?typtur=[1,2,4]&uczest=IU&sumawk=SWK&ranga=[1..9]
+// I P T GP..KLUB
+ $l = 0;
+ $rozdan = $_GET['rozdan'];
+ if( isset($_GET['typtur']) ){
+ $typ = $_GET['typtur'];
+ $l = 1;
+ }
+ if( isset($_GET['uczest']) ){
+ $iuc = $_GET['uczest'];
+ $l = $l + 1;
+ }
+ if( isset($_GET['sumawk']) ){
+ $swk = $_GET['sumawk'];
+ $l = $l + 1;
+ }
+ if( isset($_GET['ranga']) ){
+ $rng = $_GET['ranga'];
+ switch( $rng ){
+ case 1:
+ $rng = $rgg;
+ $xrng = $xrgg;
+ $minpkl = $min1;
+ break;
+ case 2:
+ $rng = $rgp;
+ $xrng = $xrgp;
+ $minpkl = $min2;
+ break;
+ case 3:
+ $rng = $rot;
+ $xrng = $xrot;
+ $minpkl = $min3;
+ break;
+ case 4:
+ $rng = $rok;
+ $xrng = $xrok;
+ $minpkl = $min4;
+ break;
+ case 5:
+ $rng = $r40;
+ $xrng = $xr40;
+ $minpkl = $min5;
+ break;
+ case 6:
+ $rng = $rtp;
+ $xrng = $xrtp;
+ $minpkl = $min6;
+ break;
+ case 7:
+ $rng = $rtd;
+ $xrng = $xrtd;
+ $minpkl = $mind;
+ break;
+ case 8:
+ $rng = $rtr;
+ $xrng = $xrtr;
+ $minpkl = $min7;
+ break;
+ case 9:
+ $rng = $rto;
+ $xrng = $xrto;
+ $minpkl = $min8;
+ break;
+ case 10:
+ $rng = $rtk;
+ $xrng = $xrtk;
+ $minpkl = $min9;
+ break;
+ }
+ if( $rng ) $l = $l + 1;
+ }
+ if( $typ>2 ) $typ = 4;
+ $izw = $typ*$iuc;
+ if( $izw > 99 ){
+ $dajp = 1;
+ }
+ if( $l > 3 ) $tab = 1;
+}
+else*/if( $_SERVER['REQUEST_METHOD'] == 'POST' ){
+ $rozdan = $_POST['rozdan'];
+
+ $progu1 = $_POST['pru1']; // dla pierwszych progu1% uczestników
+ $progp1 = $_POST['prp1']; // ostatni dostaje progp1% maximum punktów
+ $progu2 = $_POST['pru2']; // dla kolejnych (progu2-progu1)% uczestników
+ $progp2 = $_POST['prp2']; // ostatni dostaje 10*progp2% maximum punktów
+ $progu3 = $_POST['pru3']; // dla kolejnych (progu3-progu2)% uczestników
+ $rgg = $_POST['rgg'];
+ $rgp = $_POST['rgp'];
+ $rot = $_POST['rot'];
+ $rok1 = $_POST['rok1'];
+ $rok = $_POST['rok'];
+ $rtp = $_POST['rtp'];
+ $rto = $_POST['rto'];
+ $rtk = $_POST['rtk'];
+ $rgg_ = $_POST['rgg_'];
+ $rgp_ = $_POST['rgp_'];
+ $rot_ = $_POST['rot_'];
+ $rok1_ = $_POST['rok1_'];
+ $rok_ = $_POST['rok_'];
+ $rtp_ = $_POST['rtp_'];
+ $rto_ = $_POST['rto_'];
+ $rtk_ = $_POST['rtk_'];
+
+ $typ = $_POST['typ'];
+ $rng = $_POST['rng'];
+ $zaw = $_POST['zaw'];
+ $min1 = $_POST['min1'];
+ $min2 = $_POST['min2'];
+ $min3 = $_POST['min3'];
+ $min4 = $_POST['min4'];
+ $min5 = $_POST['min5'];
+ $min6 = $_POST['min6'];
+ $min7 = $_POST['min7'];
+ $min8 = $_POST['min8'];
+ $min1_ = $_POST['min1_'];
+ $min2_ = $_POST['min2_'];
+ $min3_ = $_POST['min3_'];
+ $min4_ = $_POST['min4_'];
+ $min5_ = $_POST['min5_'];
+ $min6_ = $_POST['min6_'];
+ $min7_ = $_POST['min7_'];
+ $min8_ = $_POST['min8_'];
+ if(!$rozdan):
+ switch( $rng ){
+ case 1:
+ $rng = $rgg;
+ $minpkl = $min1;
+ break;
+ case 2:
+ $rng = $rgp;
+ $minpkl = $min2;
+ break;
+ case 3:
+ $rng = $rot;
+ $minpkl = $min3;
+ break;
+ case 4:
+ $rng = $rok1;
+ $minpkl = $min4;
+ break;
+ case 5:
+ $rng = $rok;
+ $minpkl = $min5;
+ break;
+ case 6:
+ $rng = $rtp;
+ $minpkl = $min6;
+ break;
+ case 7:
+ $rng = $rto;
+ $minpkl = $min7;
+ break;
+ case 8:
+ $rng = $rtk;
+ $minpkl = $min8;
+ break;
+ }
+ else:
+ switch( $rng ){
+ case 1:
+ $rng = $rgg_;
+ $minpkl = $min1_;
+ break;
+ case 2:
+ $rng = $rgp_;
+ $minpkl = $min2_;
+ break;
+ case 3:
+ $rng = $rot_;
+ $minpkl = $min3_;
+ break;
+ case 4:
+ $rng = $rok1_;
+ $minpkl = $min4_;
+ break;
+ case 5:
+ $rng = $rok_;
+ $minpkl = $min5_;
+ break;
+ case 6:
+ $rng = $rtp_;
+ $minpkl = $min6_;
+ break;
+ case 7:
+ $rng = $rto_;
+ $minpkl = $min7_;
+ break;
+ case 8:
+ $rng = $rtk_;
+ $minpkl = $min8_;
+ break;
+ }
+ endif;
+ $iuc = $_POST['iuc'];
+ if( $typ>2 ) $typ = 4;
+ $izw = $typ*$iuc;
+ if( $izw > 99 ){
+ $dajp = 1;
+ }
+ $swk = $_POST['swk'];
+ $tab = 1;
+}
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>Kargulator PKLi</title>
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="icon" href="images/favicon.ico" type="image/x-icon">
+<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
+<script type="text/javascript">
+<!--
+function valiuc(x,y){
+ if( !(x.value==null || x.value=='') ){
+ x.value = x.value.replace(',','.');
+ if( isFinite(x.value)){
+ if( y==1 ){
+ if( document.getElementsByName("typ")[0].checked ){
+ document.getElementById("izw").value = x.value;
+ } else {
+ if( document.getElementsByName("typ")[1].checked ){
+ document.getElementById("izw").value = 2 * x.value;
+ } else {
+ if( document.getElementsByName("typ")[2].checked ){
+ document.getElementById("izw").value = 4 * x.value;
+ }
+ }
+ }
+ }
+ if( y==3 ){
+ var z = document.getElementById('izw');
+ if( valiuc(z,2) ){
+ var srednieWk = x.value/z.value;
+ if(srednieWk < 0.15) srednieWk = 0.15;
+ document.getElementById('srd').value = srednieWk;
+ }
+ }
+ return true;
+ } else {
+ alert(x.value+' to nie liczba!');
+ x.select();
+ x.focus();
+ return false;
+ }
+ }
+}
+
+function typtur(x){
+ var t = document.getElementById("iuc");
+ var z = document.getElementById("izw");
+ if( t.value!=null && t.value!='' && isFinite(t.value) ){
+ z.value = x * t.value;
+ }
+}
+
+function submitit(){
+ if( document.getElementsByName("typ")[0].checked ||
+ document.getElementsByName("typ")[1].checked ||
+ document.getElementsByName("typ")[2].checked ){
+ if( document.getElementsByName("rng")[0].checked ||
+ document.getElementsByName("rng")[1].checked ||
+ document.getElementsByName("rng")[2].checked ||
+ document.getElementsByName("rng")[3].checked ||
+ document.getElementsByName("rng")[4].checked ||
+ document.getElementsByName("rng")[5].checked ||
+ document.getElementsByName("rng")[6].checked ||
+ document.getElementsByName("rng")[7].checked ||
+ document.getElementsByName("rng")[8].checked ||
+ document.getElementsByName("rng")[9].checked ){
+ var t = document.getElementById("iuc")
+ if( t.value!=null && t.value!='' && isFinite(t.value) ){
+ t = document.getElementById("izw");
+ if( t.value!=null && t.value!='' && isFinite(t.value) ){
+ t = document.getElementById("swk");
+ if( t.value!=null && t.value!='' && isFinite(t.value) ){
+
+ document.getElementById("pkl").submit();
+
+ } else {
+ alert('Brak sumy WK!');
+ t.select();
+ }
+ } else {
+ alert('Brak liczby zawodników!');
+ t.select();
+ }
+ } else {
+ alert('Brak liczby uczestników!');
+ t.select();
+ }
+ } else {
+ alert('Wybierz rangę turnieju');
+ document.getElementsByName("rng")[0].select();
+ }
+ } else {
+ alert('Wybierz typ turnieju');
+ document.getElementsByName("typ")[0].select();
+ }
+}
+-->
+</script>
+</head>
+<body style="background-color: #F0F0F0; background-image: none">
+<form id="pkl" method="post" action="pkle2018.php">
+<table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><img src="images/logo_pzbs.gif"></td>
+ <td colspan="3" align="center"><h3>KALKULATOR PKLI W TURNIEJACH PZBS<br>
+ zgodny z <span style="color:#d00">nowym regulaminem (obowiązującym od 01.11.2018)</span></h3>
+ Przejdź do <a href="pkle2014.php"><b>kalkulatora zgodnego ze starym regulaminem</b></a>!
+ <br><br>
+ Możesz eksperymentować ze wszystkimi (prawie) parametrami.<br>
+ Dla przywrócenia stanu regulaminowego otwórz ponownie stronę.</td>
+ <td><img src="images/logo_pzbs.gif"></td>
+ </tr>
+ <tr><td colspan="5">&nbsp;</td></tr>
+ <tr>
+ <td align="center" colspan="2"><b>turniej do 39 rozdań</b></td>
+ <td align="center" colspan="2"><b>turniej od 40 rozdań</b></td>
+ </tr>
+ <tr>
+ <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td>
+ <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td>
+ <td align="left" colspan="3">WSP:</td>
+ </tr>
+ <tr>
+ <td align="right" rowspan="3">
+ OTP<sup>&lowast;&lowast;&lowast;&lowast;</sup>: <input type="text" id="rgg" name="rgg" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg.'"'; ?>><br />
+ OTP<sup>&lowast;&lowast;&lowast;</sup>: <input type="text" id="rgp" name="rgp" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp.'"'; ?>><br />
+ OTP<sup>&lowast;&lowast;</sup>: <input type="text" id="rot" name="rot" maxlength="3" style="width:30px" value=<?php echo '"'.$rot.'"'; ?>><br />
+ OTP<sup>&lowast;</sup>: <input type="text" id="rok1" name="rok1" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1.'"'; ?>><br />
+ OTP: <input type="text" id="rok" name="rok" maxlength="3" style="width:30px" value=<?php echo '"'.$rok.'"'; ?>><br />
+ Regionalny: <input type="text" id="rtp" name="rtp" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp.'"'; ?>><br />
+ Okręgowy: <input type="text" id="rto" name="rto" maxlength="3" style="width:30px" value=<?php echo '"'.$rto.'"'; ?>><br />
+ Klubowy: <input type="text" id="rtk" name="rtk" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk.'"'; ?>></td>
+ <td align="left" rowspan="3">
+ <input type="text" id="min1" name="min1" maxlength="3" style="width:30px" value=<?php echo '"'.$min1.'"'; ?>><br />
+ <input type="text" id="min2" name="min2" maxlength="3" style="width:30px" value=<?php echo '"'.$min2.'"'; ?>><br />
+ <input type="text" id="min3" name="min3" maxlength="3" style="width:30px" value=<?php echo '"'.$min3.'"'; ?>><br />
+ <input type="text" id="min4" name="min4" maxlength="3" style="width:30px" value=<?php echo '"'.$min4.'"'; ?>><br />
+ <input type="text" id="min5" name="min5" maxlength="3" style="width:30px" value=<?php echo '"'.$min5.'"'; ?>><br />
+ <input type="text" id="min6" name="min6" maxlength="3" style="width:30px" value=<?php echo '"'.$min6.'"'; ?>><br />
+ <input type="text" id="min7" name="min7" maxlength="3" style="width:30px" value=<?php echo '"'.$min7.'"'; ?>><br />
+ <input type="text" id="min8" name="min8" maxlength="3" style="width:30px" value=<?php echo '"'.$min8.'"'; ?>></td>
+ <td align="right" rowspan="3">
+ OTP<sup>&lowast;&lowast;&lowast;&lowast;</sup>: <input type="text" id="rgg_" name="rgg_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg_.'"'; ?>><br />
+ OTP<sup>&lowast;&lowast;&lowast;</sup>: <input type="text" id="rgp_" name="rgp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp_.'"'; ?>><br />
+ OTP<sup>&lowast;&lowast;</sup>: <input type="text" id="rot_" name="rot_" maxlength="3" style="width:30px" value=<?php echo '"'.$rot_.'"'; ?>><br />
+ OTP<sup>&lowast;</sup>: <input type="text" id="rok1_" name="rok1_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1_.'"'; ?>><br />
+ OTP: <input type="text" id="rok_" name="rok_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok_.'"'; ?>><br />
+ Regionalny: <input type="text" id="rtp_" name="rtp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp_.'"'; ?>><br />
+ Okręgowy: <input type="text" id="rto_" name="rto_" maxlength="3" style="width:30px" value=<?php echo '"'.$rto_.'"'; ?>><br />
+ Klubowy: <input type="text" id="rtk_" name="rtk_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk_.'"'; ?>></td>
+ <td align="left" rowspan="3">
+ <input type="text" id="min1_" name="min1_" maxlength="3" style="width:30px" value=<?php echo '"'.$min1_.'"'; ?>><br />
+ <input type="text" id="min2_" name="min2_" maxlength="3" style="width:30px" value=<?php echo '"'.$min2_.'"'; ?>><br />
+ <input type="text" id="min3_" name="min3_" maxlength="3" style="width:30px" value=<?php echo '"'.$min3_.'"'; ?>><br />
+ <input type="text" id="min4_" name="min4_" maxlength="3" style="width:30px" value=<?php echo '"'.$min4_.'"'; ?>><br />
+ <input type="text" id="min5_" name="min5_" maxlength="3" style="width:30px" value=<?php echo '"'.$min5_.'"'; ?>><br />
+ <input type="text" id="min6_" name="min6_" maxlength="3" style="width:30px" value=<?php echo '"'.$min6_.'"'; ?>><br />
+ <input type="text" id="min7_" name="min7_" maxlength="3" style="width:30px" value=<?php echo '"'.$min7_.'"'; ?>><br />
+ <input type="text" id="min8_" name="min8_" maxlength="3" style="width:30px" value=<?php echo '"'.$min8_.'"'; ?>></td>
+ <td align="left" valign="top"><input type="text" id="zaw" name="zaw" maxlength="5" style="width:30px" value=<?php echo '"'.$zaw.'"'; ?>></td>
+ <td valign="top" colspan="2">PKL za 1 m = <b>śr.WK&times;WAGA + il.zaw&times;WSP</b></td>
+ </tr>
+ <tr>
+ <td align="right" valign="top"><br /><br /><br /><br /><input type="text" id="prp1" name="prp1" style="width:18px" value=<?php echo '"'.$progp1.'"'; ?>>%<br /><input type="text" id="prp2" name="prp2" style="width:18px" value=<?php echo '"'.$progp2.'"'; ?>>%</td>
+ <td colspan="2" align="left"><img src="images/pkle.png"></td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td colspan="2"><table cellspacing="0" cellpadding="0"><tr><td align="right" style="width:50px"><input type="text" id="pru1" name="pru1" style="width:18px" value=<?php echo '"'.$progu1.'"'; ?>>%</td><td align="right" style="width:25px"><input type="text" id="pru2" name="pru2" style="width:18px" value=<?php echo '"'.$progu2.'"'; ?>>%</td><td align="right" style="width:55px"><input type="text" id="pru3" name="pru3" style="width:18px" value=<?php echo '"'.$progu3.'"'; ?>>%</td></tr></table></td>
+ </tr>
+
+ <tr><td colspan="5">&nbsp;</td></tr>
+ <tr>
+ <td valign=top rowspan="2">TYP ZAWODÓW<br />
+ <input type="radio" name="typ" id="tp1" value="1" onclick="typtur(1)"<?php if( $typ==1 ){ echo ' checked="checked"';}?>><label for="tp1">&nbsp;Indywiduel</label><br />
+ <input type="radio" name="typ" id="tp2" value="2" onclick="typtur(2)"<?php if( $typ==2 ){ echo ' checked="checked"';}?>><label for="tp2">&nbsp;Pary</label><br />
+ <input type="radio" name="typ" id="tp3" value="4" onclick="typtur(4)"<?php if( $typ==4 ){ echo ' checked="checked"';}?>><label for="tp3">&nbsp;Teamy</label>
+ <br><br>LICZBA ROZDAŃ<br>
+ <input type="radio" name="rozdan" id="rozdan0" value="0"<?php if( !$rozdan ){ echo ' checked="checked"';}?>><label for="rozdan0">&nbsp;do 39</label><br />
+ <input type="radio" name="rozdan" id="rozdan1" value="1"<?php if( $rozdan ){ echo ' checked="checked"';}?>><label for="rozdan1">&nbsp;od 40</label>
+ </td>
+ <td valign=top rowspan="2">RANGA ZAWODÓW<br />
+ <input type="radio" name="rng" id="rg1" value="1"<?php if( $_POST['rng']==1 ){echo ' checked="checked"';}?>><label for="rg1">&nbsp;OTP<sup>&lowast;&lowast;&lowast;&lowast;</sup></label><br />
+ <input type="radio" name="rng" id="rg2" value="2"<?php if( $_POST['rng']==2 ){echo ' checked="checked"';}?>><label for="rg2">&nbsp;OTP<sup>&lowast;&lowast;&lowast;</sup></label><br />
+ <input type="radio" name="rng" id="rg3" value="3"<?php if( $_POST['rng']==3 ){echo ' checked="checked"';}?>><label for="rg3">&nbsp;OTP<sup>&lowast;&lowast;</sup></label><br />
+ <input type="radio" name="rng" id="rg4" value="4"<?php if( $_POST['rng']==4 ){echo ' checked="checked"';}?>><label for="rg4">&nbsp;OTP<sup>&lowast;</sup></label><br />
+ <input type="radio" name="rng" id="rg5" value="5"<?php if( $_POST['rng']==5 ){echo ' checked="checked"';}?>><label for="rg5">&nbsp;OTP</label><br />
+ <input type="radio" name="rng" id="rg6" value="6"<?php if( $_POST['rng']==6 ){echo ' checked="checked"';}?>><label for="rg6">&nbsp;Regionalny</label><br />
+ <input type="radio" name="rng" id="rg7" value="7"<?php if( $_POST['rng']==7 ){echo ' checked="checked"';}?>><label for="rg7">&nbsp;Okręgowy</label><br />
+ <input type="radio" name="rng" id="rg8" value="8"<?php if( $_POST['rng']==8 ){echo ' checked="checked"';}?>><label for="rg8">&nbsp;Klubowy</label></td>
+ <td align="CENTER" valign=top>UCZESTNIKÓW<br />
+ <input type="text" id="iuc" name="iuc" maxlength="3" style="width:50px" onblur="valiuc(this,1)"<?php if( $iuc>0 ){echo ' value="'.$iuc.'"';}?>><br />
+ <small>W zależności od typu<br />ilość indywidualistów,<br />par lub teamów</small></td>
+ <td align="CENTER" valign=top>ZAWODNIKÓW<br />
+ <input type="text" id="izw" name="izw" readonly="readonly" maxlength="4" style="width:50px" onblur="valiuc(this,2)"<?php if( $izw>0 ){echo ' value="'.$izw.'"';}?>><br />
+ <small>To pole jest wyliczane<br />automatycznie.</small></td>
+ <td align="CENTER" valign=top>SUMA WK<br />
+ <input type="text" id="swk" name="swk" maxlength="7" style="width:70px" onblur="valiuc(this,3)"<?php if( $swk>0 ){echo ' value="'.$swk.'"';}?>><br />
+ <small>Suma WK wszystkich<br />zawodników.</small></td>
+ </tr>
+ <tr>
+ <td align="CENTER" colspan="3">Średnie WK zawodnika w turnieju:&nbsp;
+ <input type="text" id="srd" name="srd" readonly="readonly"<?php if( $izw>0 ){echo ' value="'.($swk/$izw > 0.15 ? $swk/$izw : 0.15).'"';}?>><br />
+ </td>
+ </tr>
+ <tr><td colspan="5">&nbsp;</td></tr>
+ <tr>
+ <td align="CENTER" colspan="2">
+ <input type="button" value="Policz PKLe" onclick="submitit()"></td>
+ <td colspan="3">
+<?php
+if( $tab>0 ){
+ echo '<input type="button" value="SQL dla JFR Pary" onclick="document.getElementById(\'outsql\').style.display=(document.getElementById(\'outsql\').style.display==\'none\') ? \'block\' : \'none\';">
+ <input type="button" value="SQL dla JFR Teamy" onclick="document.getElementById(\'outsql2\').style.display=(document.getElementById(\'outsql2\').style.display==\'none\') ? \'block\' : \'none\';">';
+} else {
+ echo '&nbsp;';
+}
+?>
+ </td>
+ </tr>
+ <tr><td colspan="2" align="center">
+<?php
+if( $tab>0 ){
+ unset( $tabpkl );
+ $lasti = 0;
+ echo '<table><tr><td class="t">Miejsce</td><td class="t">&nbsp;&nbsp;&nbsp;PKL&nbsp;&nbsp;&nbsp;</td>';
+ echo '</tr>';
+ // #zmiany2018 - poprzednie brzmienie: $max = ceil(($swk/$izw)*$rng + $izw*$zaw);
+ $max = ($swk/$izw)*$rng + $izw*$zaw;
+ if($typ == 4) $max = $max*1.25; // mnożnik 1.25 dla teamów UCHWAŁA Zarządu NR 52/2018/2016–2020
+ $max = ceil($max);
+ // #zmiany2018 - koniec zmienionego fragmentu
+ if( $max<$minpkl ) $max = $minpkl;
+ $prem = 0;
+ $zni = 1;
+ switch( $typ ){
+ case 2:
+ $zni = 2;
+ break;
+ case 4:
+ $zni = 4;
+ break;
+ }
+ if( $prem>0 ){
+ $d = 2;
+ } else {
+ $d = 0;
+ }
+ $maxold = ceil($prcold*$izw + 0.05*$swk);
+ $progu1 = $progu1*$iuc*0.01+1;
+ $progu2 = $progu2*$iuc*0.01+1;
+ $progu3 = $progu3*$iuc*0.01+1; // 0 pkl za ostatnie punktowane+1
+ $progp1 = $max*$progp1*0.01;
+ $progp2 = $max*$progp2*0.01;
+ $sumn = 0 ;
+ $sumo = 0;
+ $i = 0;
+ $dok = 1 - 1e-6; // unikamy błędu ceil(2)=3;
+ do{
+ $i++;
+ if( $i<=$progu1 ){
+ $p = $progp1+($max-$progp1)*($progu1-$i)/($progu1-1);
+ }
+ elseif( $i<=$progu2 ){
+ $p = $progp2+($progp1-$progp2)*($progu2-$i)/($progu2-$progu1);
+ }
+ elseif( $i<$progu3 ){
+ $p = $progp3+($progp2-$progp3)*($progu3-$i)/($progu3-$progu2);
+ }
+ else $p=1; // #zmiany2018 - zmiana wartości z 0 na 1, UCHWAŁA Zarządu NR 67/2018/2016–2020
+ if( ($p>0) ){
+ echo '<tr><td class="t">'.$i.'</td>';
+ if( $p>0 ){
+ $pkl_temp = ceil($p);
+ if (($pkl_temp - $p) < $dok){
+ $p = $pkl_temp;
+ } else {
+ $p = round($p);
+ }
+ $tabkl[$i] = $p;
+ $lasti = $i;
+ echo '<td class="t">'.$p.'</td>';
+ $sumn = $sumn + $p;
+ } else {
+ echo '<td class="p">&nbsp;</td>';
+ }
+ echo '</tr>';
+ }
+ } while( (($p>0) || ($maxold>0)) && ($i<$iuc) );
+ echo '<tr><td class="p">SUMA PKL</td><td class="t">'.$typ*$sumn.'</td></tr>';
+ echo '</table>';
+} else {
+ echo '&nbsp;';
+}
+?>
+</td><td colspan="3" valign="top"><span id="outsql" style="display: none">
+<?php
+echo "UPDATE `dodatki` SET `pkl`=0;<br />\r\n";
+for( $i=1; $i<=$lasti; $i++){
+ echo "UPDATE `dodatki` SET `pkl`=".$tabkl[$i]." WHERE `miejsce`=".$i.";<br />\r\n";
+}
+?>
+</span></td>
+<td colspan="3" valign="top"><span id="outsql2" style="display: none">
+<?php
+echo "UPDATE `addons` SET `mastr`=0;<br />\r\n";
+for( $i=1; $i<=$lasti; $i++){
+ echo "UPDATE `addons` SET `mastr`=".$tabkl[$i]." WHERE `place`=".$i.";<br />\r\n";
+}
+?>
+</span></td></tr>
+<tr><td colspan="5" class="copyright">&copy;'2009, Jan Romański dla PZBS</td></tr>
+</table>
+</form>
+</body>
+</html>