Location: PHPKode > projects > EzyBiz > ezybiz/invspecialpriceadd.php
<? include('includes/main.php'); ?>
<? include('includes/invfunctions.php'); ?>

<?
     templatetop("Special Price");

     if ($id) {

		if($newprice){
			global $conn, $active_company;
			$recordSet = &$conn->Execute("insert into specials values ('', '" . $id. "', '" . $newprice. "', '" . date('Ymd') . "')");
			echo 'Special price added successful';		
		}
		else{ 
          echo '<form action="invspecialpriceadd.php" method="post"><input type="hidden" name="nonprintable" value="1"><table>';
          echo '<input type="hidden" name="id" value="'.$id.'">';
		  global $conn, $active_company;
	
		$recordSet = &$conn->Execute('SELECT i.itemcode, pl.description, pp.price FROM item i, priceperpriceunit pp, pricelevel pl where i.id = pp.itemid and pl.id = pp.pricelevelid and i.id ='.$id);
		if ($recordSet&&!$recordSet->EOF) {
			echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">Item Code:</td><td><input type="text" name="itemcode" size="30" maxlength="50" value="'.rtrim($recordSet->fields[0]).'"'.INC_TEXTBOX.'></td></tr>';
		}
         while($recordSet&&!$recordSet->EOF) {
			  
			   echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">'.rtrim($recordSet->fields[1]).'</td><td><input type="text" name="itemprice" size="30" maxlength="100" value="'.rtrim($recordSet->fields[2]).'"'.INC_TEXTBOX.'></td></tr>';
			$recordSet->MoveNext();
		 }
		 echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">New Special Price:</td><td><input type="text" name="newprice" size="30" maxlength="100" value="1"'.INC_TEXTBOX.'></td></tr>';
		 /*
         if ($recordSet&&!$recordSet->EOF) {
               echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">Item Code:</td><td><input type="text" name="itemcode" size="30" maxlength="50" value="'.rtrim($recordSet->fields[0]).'"'.INC_TEXTBOX.'></td></tr>';
               echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">New Price:</td><td><input type="text" name="newprice" size="30" maxlength="100" value="'.rtrim($recordSet->fields[1]).'"'.INC_TEXTBOX.'></td></tr>';
		 }
		 */
          //forminvinventoryspecialupdate($id);
          echo '</table><input type="submit" value="'.STR_SAVE_CHANGES.'"></form>';
		}
     } else {
          echo '<form action="invspecialpriceadd.php" method="post"><table>';
          global $conn, $active_company;
          echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">Item:</td><td><select name="id"'.INC_TEXTBOX.'>';
          $recordSet = &$conn->Execute('SELECT i.id, i.itemcode, ic.name, s.products_id FROM itemcategory ic, item i left outer join specials s on i.id = s.products_id where ic.id=i.categoryid and s.products_id is null ORDER BY i.itemcode');
          while ($recordSet&&!$recordSet->EOF) {
               echo '<option value="'.$recordSet->fields[0].'">'.rtrim($recordSet->fields[2]).' - '.rtrim($recordSet->fields[1])."\n";
               $recordSet->MoveNext();
          };
          echo '</select></td></tr>';
        
          //forminvinventoryspecialselect('id');
          echo '</table><input type="submit" value="'.STR_EDIT_SELECTION.'"></form>';
          echo '<a href="invspecialprice.php?list=1">List Special Items</a>';
     };
     templatebottom(); 
?>
<? include('includes/footer.php'); ?>
Return current item: EzyBiz