<head>
<?php
require_once ('../include/tc_calendar.php');
$start = strtotime($_SESSION['supply_date']);
$d = date("d", $start );
$m = date("m", $start );
$y = date("Y", $start );


$table_name = $_SESSION['db_prefix']."_supply_customer_temp";
$line_query = "SELECT *  FROM $table_name WHERE  user =  '".$_SESSION['username']."' ";
$line_result = mySQL_query($line_query);
$line_num = mysql_num_rows($line_result);

?>
<!--style sheets-->
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/upper_case.js"  type="text/javascript"></script>  



<!--jscript-->
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="javascript" src="../jscript/calendar.js"></script>
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>


</head>
<?php include('../include/wait.php') ?>

<body onLoad="MM_showHideLayers('wait','','hide'); <?php if ($_SESSION['error2']==1) {?> alertMessage(1, 'additionalOrderWizbase?s=&p=2', 'You need to make a list of deliveries before you can continue.'); <?php } $_SESSION['error2']=0; ?>;" onBlur="<?php if ($_SESSION['s']=='10') { ?> needToConfirm = false; <?php } ?> " onFocus="MM_showHideLayers('wait','','hide'); ">
<?php $_SESSION['screen']=0 ?>
<div class="page_middle_frame">
<form id="form1" name="form1" method="get" action="additionalOrderWizbase.php">
  <table width=595 border="0" align="left" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td ><div class="wizard_frame">
          <table width="677" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="108" height="30"><label class="label_std">Supply date:</label></td>
              <td width="255"><?php

		$myCalendar = new tc_calendar("supply_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2010, 2030);
		$myCalendar->writeScript();
?></td>
              <td width="105">&nbsp;</td>
              <td width="209">&nbsp;</td>
            </tr>
            <tr>
              <td></td>
              <td></td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
          </table>
      </div></td>
    </tr>
    <tr>
      <td width="525" height="171" valign="top" ><div class="wizard_frame">
          <label class="label_std"><br>
            Click  <img src="../images/line_edit.png" alt="" width="16" height="16" /> to edit, <img src="../images/delete.png" alt="" width="16" height="16" /> to delete.</label>
          <br />
          <br />
          <table width="640" id="table_resume_wizard3">
            <tr>
              <th width="23">&nbsp;</th>
              <th width="36">Line</th>
              <th width="268" align="left">Item</th>
              <th width="58" align="left">Qty</th>
              <th width="194" align="left">Reason for extra supply</th>
              <th width="33" align="center">&nbsp;</th>
            </tr>
            <?php
				$i=0;
				$sub_tot=0;
				$a6_total=0;
				 while ($i<$line_num){
					 $a0 = mysql_result($line_result, $i, "supply_id");
					 $a1 = mysql_result($line_result, $i, "store_item_id");
					 $table_name = $_SESSION['db_prefix']."_store_items";
						$item_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$a1."' ";
						$item_result = mySQL_query($item_query);
						$a1a = mysql_result($item_result, 0, "item_name");
					 $a2 = mysql_result($line_result, $i, "quantity");
					 $a3 = mysql_result($line_result, $i, "notes_text");
										 
				 ?>
            <tr>
              <td valign="top"><a href="" onMouseOver="ddrivetip('Click to edit this line', 110)"; onMouseOut="hideddrivetip()" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', '../edit_windows/job_supply_add_edit.php?supply_id=<?php echo $a0 ?>&type=job', 'Edit quantity.', 'width=500px,height=240px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><img src="../images/line_edit.png" alt="" width="16" height="16" /></a></td>
              <td valign="top"><?php echo $i+1 ?></td>
              <td valign="top"><?php echo $a1a ?></td>
              <td valign="top"><?php echo $a2 ?></td>
              <td align="left" valign="top"><?php echo $a3 ?></td>
              <td align="right" valign="top"><a href="additionalOrderWizbase.php?p=2&s=12&supply_id=<?php echo $a0?>" onMouseOver="ddrivetip('Click to delete this line', 110)"; onMouseOut="hideddrivetip()"><img src="../images/delete.png" alt="" width="16" height="16" onClick="needToConfirm = false;" /></a></td>
            </tr>
            <?php 
			   // $a6_total=$a6_total+$a6;
				$i++;
				 }
				 $_SESSION['list2']=$i;
				 ?>
            <tr>
              <td height="34" colspan="3" valign="bottom"><input name="add_bracing_button" type="submit" class="imagebutton" id="add_bracing_button" value="Add"  onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', '../edit_windows/job_supply_add.php?category=&sub_category=&type=job', 'Add item', 'width=500px,height=260px,center=1,resize=0,scrolling=0')
needToConfirm = false; editwindow.onclose=function(){return window}; return false;" ></td>
              <td align="right" valign="bottom">&nbsp;</td>
              <td align="right" valign="bottom">&nbsp;</td>
              <td align="right" valign="bottom">&nbsp;</td>
            </tr>
          </table>
        </div></td>
    </tr>
    <tr>
      <td><table width="590" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117"><input type="button" name="prev_button" class="imagebutton" value="Prev" onClick="needToConfirm = false;   MM_showHideLayers('wait','','show'); MM_goToURL('parent','additionalOrderWizbase.php?s=&p=1');return document.MM_returnValue" tabindex="2"/></td>
            <td width="115">&nbsp;</td>
            <td width="99"><span class="wizard">
              <input name="error" type="hidden" id="error" value="0" />
              <input name="p" type="hidden" id="p" value="2" />
              <input name="s" type="hidden" id="s" value="2" />
              <input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="javascript:cancel_confirmation(1, '../store/store_main.php'); needToConfirm = false;" value="Cancel" tabindex="4"/>
            </span></td>
            <td width="125" align="left"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" tabindex="1"/></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
</div>
<!--form validation-->
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("receipt_no_text","req","Please enter receipt no.");
</script>
</body>
