All pastes #502852 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-22 17:06 UTC
rendered paste body
// GET ALL SPECIALS ON THE SELECTED DATE
function getSpecialsForDate($year, $month, $day) {
?>
<style>
#specialstitle {font-size:16px; font-weight: bold; border-bottom: 1px solid #ccc; margin: 0px 10px 10px 10px;}
</style>
<?

$sql = "SELECT * FROM tbl_specials_scheduler WHERE YEAR(spsc_date) = '$year' AND MONTH(spsc_date) = '$month' AND DAY(spsc_date) = '$day' ORDER by spsc_id ASC";
$result = dbQuery($sql);
	$numfields = mysql_num_rows($result);
	$numfieldsLeft = (6 - $numfields);
	
if ($numfields <= 6)  {
	$numfieldsLeft = (6 - $numfields);
	echo "<div id=\"specialstitle\">Specials Management:</div>";
	
	
		if ($numfields >= 0) {
		?>
		<table class="admin" align="center" width="690px">
        <CAPTION><h1>You have set  <em><? echo $numfields; ?> out of 6 </em>specials:</h1> supnotesish </CAPTION>
        <thead>
        <tr align="center"> 
   		<td width="400px">Title</td>
   		<td width="80px">Type</td>
   		<td width="80px">Price</td>
   		<td width="10px">Bev</td>
   		<td width="10px">Sal</td>
   		<td align="center" width="80px">Modify</td>
        <td align="center" width="80px">Delete</td>
  		</tr>
        </thead>
        <tbody>
  		<?
		}
		
	if ($numfields >= 1) {
	while($row = mysql_fetch_array($result)){
	extract($row);
	?>
	<tr> 
    <td><? echo $sp_title; ?></td>
    <td><? echo $sp_cat; ?></td>
    <td><? echo $sp_price; ?></td>
    <td><? echo $sp_beverage; ?></td>
   	<td><? echo $sp_salad; ?></td>
    <td align="center">Modify</td>
    <td align="center"><a href="javascript:deleteScheduleSpecial(<?php echo $spsc_id.",".$year.",".$month.",".$day; ?>);">Delete</a></td>
    </tr>
    <?
	}
	}
	else if ($numfields == 0) {
	?>
	<TR>
    <TD colspan="7">
    You have not set any specials for this date.
    </TD>
    </TR>
    <?
	}
    
	
	echo "</tbody>";
}
	echo "</table>";
	echo "<br />";
	echo "<br />";
	
	
	if ($numfieldsLeft >= 1) {

$sql = "SELECT sp_id, sp_title, sp_cat, sp_price, sp_beverage, sp_salad, sp_price
        FROM tbl_specials_presets
		ORDER BY sp_id";
$result     = dbQuery($sql);
?>
   <table class="admin" align="center" width="690px">
   <CAPTION><h1>You may add up to <? echo $numfieldsLeft; ?> more specials from your presets:</h1> </CAPTION>
   <thead>
   <tr align="center"> 
   <td>Title</td>
   <td width="80px">Type</td>
   <td width="80px">Price</td>
   <td width="20px">Bev</td>
   <td width="20px">Sal</td>
   <td width="60px">Add</td>
  </tr>
  </thead>
  <tbody>
  <?
  while($row = mysql_fetch_array($result)){
  extract($row);
	?>
	<tr>
    <td><? echo $sp_title; ?></td>
    <td><? echo $sp_cat; ?></td>
    <td><? echo $sp_price; ?></td>
    <td><? echo $sp_beverage; ?></td>
   	<td><? echo $sp_salad; ?></td>
    <td align="center"><a href="javascript:addScheduleSpecial(<?php echo $sp_id.",".$year.",".$month.",".$day; ?>);">Add</a></td>
    </tr>
    
    <?
	}
	echo " </tbody></table>";
	}
    
    else if ($numfieldsLeft == 0) {

$sql = "SELECT sp_id, sp_title, sp_cat, sp_price, sp_beverage, sp_salad, sp_price
        FROM tbl_specials_presets
		ORDER BY sp_id";
$result     = dbQuery($sql);
?>
 <table class="admin" align="center" width="690px">
   <CAPTION><h1>Add Presets:</h1><em>* You have used all <? echo $numfields; ?> slots;</em> you must delete a set special from the table above before you can add another preset from below: </CAPTION>
   <thead>
   <tr align="center">
   <td>Title</td>
   <td width="80px">Type</td>
   <td width="80px">Price</td>
   <td width="20px">Bev</td>
   <td width="20px">Sal</td>
   <td width="60px">Add</td>
  </tr>
  </thead>
  <TBODY>
  <?
  while($row = mysql_fetch_array($result)){
  extract($row);
	?>
	<tr>
    <td><? echo $sp_title; ?></td>
    <td><? echo $sp_cat; ?></td>
    <td><? echo $sp_price; ?></td>
    <td><? echo $sp_beverage; ?></td>
   	<td><? echo $sp_salad; ?></td>
    <td id="presetbutt" align="center">Add</td>
    </tr>
    
    <?
	}
	echo " </TBODY></table>";
	}
	?>


<br />
<br />
<style>
#quickHead {color:#121844; font-size:12px; font-weight:bold; }
#custom td {border: 1px solid #ccc;}
#customhead {background: #ccc;}
</style>

<div id="quickHead">Quick add:</div> (it is suggeststed you manage your presets through the menu admin.. specials submitted with quick add cannot contain options and will only be used once (for the date that its inserted) )

<form action="processSpecial.php?action=addSpecial" method="post">
  <table id="custom" width="100%" border="0" align="center" cellpadding="5" cellspacing="1">
  <tr id="customhead"><td colspan="2">Add Special</td></tr>
  
  <tr> 
   <td width="150">Special Type?</td>
   <td> <input name="txtType" type="radio" id="txtType" value="lunchMeal" checked="checked"> Lunch Special (meal)
<br>
<input name="txtType" type="radio" id="txtType" value="lunchSoup"> Lunch Special (soup)
    </td>
  </tr>
  
  
  <tr> 
   <td width="150">Special Title</td>
   <td> <input name="txtName" type="text" class="box" id="txtName" size="80" maxlength="150"></td>
  </tr>
  
  
  <tr> 
   <td width="150">Includes Beverage?</td>
   <td> <input name="txtBeverage" type="radio" id="txtBeverage" value="yes"> Yes
<br>
<input name="txtBeverage" type="radio" id="txtBeverage" value="no" checked="checked"> No
    </td>
  </tr>
  
  
  <tr> 
   <td width="150">Includes Side Salad?</td>
   <td> <input name="txtSalad" type="radio" id="txtSalad" value="yes"> Yes
<br>
<input name="txtSalad" type="radio" id="txtSalad" value="no" checked="checked"> No
   </td>
  </tr>
  
  
  
  
  
  
  
  
   <td width="150">Price</td>
   <td><input name="txtPrice" type="text" id="txtPrice" size="10" maxlength="7" class="box" onKeyUp="checkNumber(this);"> </td>
  </tr>
 </table>
 <p align="right"> 
  <input name="btnAddCusSpecial" type="button" id="btnAddCusSpecial" value="Add Special" onClick="checkAddCusSpecialForm();" class="box">
 </p>
</form>
<?
}
?>