Advertisement
Amakesh

Untitled

Jun 1st, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.12 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL ^ E_DEPRECATED);
  3. ini_set('display_errors', 0);
  4.  
  5. $owner_id = $_POST['owner'];
  6.  
  7. function get_options_mld($select, $owner_id){
  8.     include ('//db_joomla.php');
  9.     $price = "Obiadokolacja";
  10.     $types_mld = array();
  11.     $index = 0;
  12.     $types_mld[0]= 0;
  13.     $index = 1;
  14.     $query_disp = "SELECT * FROM jos_program_prices WHERE owner_id = '$owner_id ' AND pricefor= '$price'";
  15.  
  16.         $resultSet = mysql_query($query_disp, $con);
  17.  
  18.      while($row = mysql_fetch_array($resultSet)) {
  19.  
  20.         $type =$row['type'];    
  21.     $pricefor =$row['pricefor'];
  22.          $price_mld=$row['price'];
  23.  
  24.      $types_mld[$type." : ".$price_mld] = $type." : ".$price_mld;
  25.      $index++;
  26.      }
  27.  
  28.          $options =' ';
  29.          while(list($k, $v)=each($types_mld)){
  30.  
  31.                  if($select==$k){
  32.                  $options.='<option value=" '.$k.' "selected> ' .$v. ' </option>';
  33.              }
  34.              else{
  35.              $options.='<option value=" '.$k.' "> ' .$v. ' </option>';
  36.              }
  37.          }
  38.          return $options;
  39.      }
  40.  
  41. function get_options_mb($select, $owner_id){
  42.     include ('//db_joomla.php');
  43.     $price = "Śniadanie";
  44.     $types_mb = array();
  45.     $index = 0;
  46.     $types_mb[0]= 0;
  47.     $index = 1;
  48.     $query_disp = "SELECT * FROM jos_program_prices WHERE owner_id = '$owner_id ' AND pricefor= '$price'";
  49.  
  50.         $resultSet = mysql_query($query_disp, $con);
  51.  
  52.      while($row = mysql_fetch_array($resultSet)) {
  53.  
  54.         $type =$row['type'];    
  55.     $pricefor =$row['pricefor'];
  56.          $price_mb=$row['price'];
  57.  
  58.      $types_mb[$type." : ".$price_mb] = $type." : ".$price_mb;
  59.      $index++;
  60.      }
  61.  
  62.          $options =' ';
  63.          while(list($k, $v)=each($types_mb)){
  64.  
  65.                  if($select==$k){
  66.                  $options.='<option value=" '.$k.' "selected> ' .$v. ' </option>';
  67.              }
  68.              else{
  69.              $options.='<option value=" '.$k.' "> ' .$v. ' </option>';
  70.              }
  71.          }
  72.          return $options;
  73.      }
  74.  
  75. function get_options_ml($select, $owner_id){
  76.     include ('//db_joomla.php');
  77.     $price = "Obiad";
  78.     $types_ml = array();
  79.     $index = 0;
  80.     $types_ml[0]= 0;
  81.     $index = 1;
  82.     $query_disp = "SELECT * FROM jos_program_prices WHERE owner_id = '$owner_id ' AND pricefor= '$price'";
  83.  
  84.         $resultSet = mysql_query($query_disp, $con);
  85.  
  86.      while($row = mysql_fetch_array($resultSet)) {
  87.  
  88.         $type =$row['type'];    
  89.     $pricefor =$row['pricefor'];
  90.          $price_ml=$row['price'];
  91.  
  92.      $types_ml[$type." : ".$price_ml] = $type." : ".$price_ml;
  93.      $index++;
  94.      }
  95.  
  96.          $options =' ';
  97.          while(list($k, $v)=each($types_ml)){
  98.  
  99.                  if($select==$k){
  100.                  $options.='<option value=" '.$k.' "selected> ' .$v. ' </option>';
  101.              }
  102.              else{
  103.              $options.='<option value=" '.$k.' "> ' .$v. ' </option>';
  104.              }
  105.          }
  106.          return $options;
  107.      }
  108.  
  109. function get_options_md($select, $owner_id){
  110.     include ('//db_joomla.php');
  111.     $price = "Kolacja";
  112.     $types_md = array();
  113.     $index = 0;
  114.     $types_md[0]= 0;
  115.     $index = 1;
  116.     $query_disp = "SELECT * FROM jos_program_prices WHERE owner_id = '$owner_id ' AND pricefor= '$price'";
  117.  
  118.         $resultSet = mysql_query($query_disp, $con);
  119.  
  120.      while($row = mysql_fetch_array($resultSet)) {
  121.  
  122.         $type =$row['type'];    
  123.     $pricefor =$row['pricefor'];
  124.          $price_md=$row['price'];
  125.  
  126.      $types_md[$type." : ".$price_md] = $type." : ".$price_md;
  127.      $index++;
  128.      }
  129.  
  130.          $options =' ';
  131.          while(list($k, $v)=each($types_md)){
  132.  
  133.                  if($select==$k){
  134.                  $options.='<option value=" '.$k.' "selected> ' .$v. ' </option>';
  135.              }
  136.              else{
  137.              $options.='<option value=" '.$k.' "> ' .$v. ' </option>';
  138.              }
  139.          }
  140.          return $options;
  141.      }
  142.  
  143. $date1 = $_POST['data1'];
  144. $date2 = $_POST['data2'];
  145.  
  146. $range = strtotime($date2)-strtotime($date1);
  147. $range = floor($range/(60*60*24));
  148.  
  149. $tmp0 = array();
  150. $tmp4 = "";
  151. $index = 0;
  152.  
  153. $result = '<div id="resg_s2"><a href="#"><span class="icon-question-sign" style="color: white;font-size: 1.4em;position: relative;left: 510px;top: 13px;"></span></a></div></br></br>         <div id="mres-form41" style="position:relative; width:240px;"><label for="types_mb">*CENA ŚNIADANIA</br>(zł/porcja):</label> <select  name = "types_mb"  id ="types_mb" style="width: 210px;" required>'.get_options_mb($selected, $owner_id).'</select></div><div id="mres-form42" style="position:relative; width: 220px;left: 219px;top: -78px;"><label for="types_ml">*CENA OBIADU</br>(zł/porcja):</label><select  name = "types_ml"  id ="types_ml" style="width: 210px;" required>'.get_options_ml($selected, $owner_id).'</select></div><div id="mres-form43" style="position:relative; width: 240px;left: 424px;top: -156px;"><label for="types_md">*CENA KOLACJI </br>(zł/porcja):</label> <select  name = "types_md"  id ="types_md" style="width: 210px;" required>'.get_options_md($selected, $owner_id).'</select></div><div id="mres-form44" style="position:relative; width: 240px;left: 635px;top: -234px;"><label for="types_mld">*CENA OBIADOKOLACJI</br>(zł/porcja):</label> <select  name = "types_mld" id ="types_mld" style="width: 210px;" required>'.get_options_mld($selected, $owner_id).'</select></div></br><table name="table" id="table_food" border="1" style="color:1c4e93; position:relative; top:-240px; border-bottom:none; background:Transparent; border-color: #d4d2d2; color: #08C;"><thead><th class = "th" style="background-color: #57c7da;border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25); width:70px;"><input type="hidden" name="lp" value="lp" />DZIEŃ</th><th class = "th" style="width: 70px; background-color: #57c7da;border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="type" value="type" />ŚNIADANIE</th><th class = "th" style="width: 45px; background-color: #57c7da;border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="vac" value="vac" />ŚNIADANIE</br>PÓŁ PORCJI</th><th class = "th" style="width:60px; background-color: #57c7da;border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name=" " value=" " />OBIAD</th><th class = "th" style="width: 60px; background-color: #57c7da;border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="blc" value="blc" />OBIAD</br>PÓŁ PORCJI</th><th class ="th" style="width: 40px; background-color: #57c7da; border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="room_nr" value="" />KOLACJA</th><th class = "th" style="width: 40px; background-color: #57c7da;border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="floor" value="" />KOLACJA</br> PÓŁ PORCJI</th><th class = "th" style="width: 55px; background-color: #57c7da; border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="dost" value="" />OBIADO-</br>KOLACJA</th><th class = "th" style="width: 55px; background-color: #57c7da; border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="dost" value="" />OBIADO-</br>KOLACJA</br>PÓŁ PORCJI</th><th class = "th" style="width: 55px; background-color: #57c7da; border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="dost" value="" />ŁACZNIE</br>PEŁNYCH</br>POSIŁKÓW</th><th class = "th" style="width: 55px; background-color: #57c7da; border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="dost" value="" />ŁACZNIE</br>PÓŁ PORCJI</br>POSIŁKÓW</th><th class = "th" style="width: 55px; background-color: #57c7da; border-color: #d4d2d2; color: #fff;text-shadow: 0 -1px 0 rgba(0,0,0,0.25);"><input type="hidden" name="dost" value="" />ŁĄCZNA</br>CENA</th></thead><tbody>';
  154.  
  155. for($i=0; $i<$range+1; $i++){
  156.      $result.='<tr><td class="container_rom" width = "40px;"><center><b>'.date("Y-m-d", strtotime($date1."+".$i."day")).'</b></td><td class="container_rom" ><div style="text-align: center; width:70px;"><input type="number" name="breakfastf[]" value="0" style="width: 60px;" min="0"/></div></td><td class="container_rom"><div class="td_div" style="text-align: center; width:80px;"><input type="number" name="breakfasth[]" value="0" style="width: 60px;" min="0"/></div></td><td class="container_rom"><div style="text-align: center; width:60px;"><input type="number" name="lunchf[]" value="0" style="width: 55px;" min="0"/></div></td><td class="container_rom"><div style="text-align: center; width:70px;"><input type="number" name="lunchh[]" value="0" style="width: 55px;" min="0"/></div></td><td class="container_rom"><div style="text-align: center; width:60px;"><input type="number" name="dinnerf[]" value="0" style="width: 50px;" min="0"/></div></td><td class="container_rom"><div style="text-align: center; width:75px;"><input type="number" name="dinnerh[]" value="0" style="width: 60px;" min="0"/></div></td><td class="container_rom"><div style="text-align: center; width:70px;"><input type="number" name="ldinnerf[]" value="0" min="0" style="width: 60px;"></div></td><td class="container_rom"><div style="text-align: center; width:70px;"><input type="number" name="ldinnerh[]" value="0" style="width: 60px;" min="0"/></div></td><td class="container_rom"><div style="text-align: center; width:70px;"><input type="number" name="fmeals_total[]" id="meals_tf'.$i.'" value="0" style="width: 55px;" readonly="readonly"/></div></td><td class="container_rom"><div style="text-align: center; width:70px;"><input type="number" name="hmeals_total[]" id="meals_th'.$i.'" value="0" style="width: 55px;" readonly="readonly"/></div></td><td class="container_rom"><div style="text-align: center; width:70px;"><input style="width: 60px;" type="number" name="meals_price[]" id="meals_p'.$i.'" value="0" readonly="readonly"/></div></td></tr>';
  157.  
  158. }
  159.  
  160. $result.='</tbody></table>';
  161. echo $result;
  162. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement