<?php
########################################################################
#
# Project: Grocery List
# URL: http://sourceforge.net/projects/grocery-list/
#
# Copyright: (C) 2007, James Campbell
# License: GNU General Public License Version 3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Filename: $URL: https://grocery-list.svn.sourceforge.net/svnroot/grocery-list/releases/1.0/GL_printitem_Form.php $
# Last Updated: $Date: 2010-03-06 00:03:07 -0800 (Sat, 06 Mar 2010) $
# Author(s): James Campbell
#
########################################################################
$title = 'Print';
$onload = 'list.Item.focus();';
include_once("include/header.php");
?>
<p>Select Columns and Options for Printing</p>
<?php
$func = isset($_GET["func"]) ? $_GET["func"] : "";
$numchx = isset($_GET["numchx"]) ? $_GET["numchx"] : "";
$cb = isset($_GET["cb"]) ? $_GET["cb"] : "";
echo "<form name=\"delete\" action=\"printGLitem.php\">";
echo "<TABLE BORDER=1 align=\"center\">";
echo "<TR><TH><input name=\"colitemid\" value=1 type=\"checkbox\"></TH><TH><input name=\"colquantity\" value=1 type=\"checkbox\" checked></TH><TH><input name=\"colname\" value=1 type=\"checkbox\" checked></TH><TH><input name=\"colsize\" value=1 type=\"checkbox\" checked></TH><TH><input name=\"colmfctr\" value=1 type=\"checkbox\"></TH><TH><input name=\"colnotes\" value=1 type=\"checkbox\"></TH><TH><input name=\"coltimeadded\" value=1 type=\"checkbox\"></TH></TR>";
echo "<TR><TH>Item ID</TH><TH>Quantity</TH><TH>Name</TH><TH>Size</TH><TH>Mfctr</TH><TH>Notes</TH><TH>Time Added</TH></TR>";
$connection = dbconnect();
$start = 0;
for($i = 0; $i<$numchx; $i++)
{
$end = strpos($cb, ",", $start);
$id = substr($cb, $start, $end-$start);
$start = $end+1;
$ids= $ids . $id . " ";
$sql = "select * from groceries where itemid = $id";
//$sql_result = mysql_query($sql, $connection) or die ("Couldn't execute query.");
$sql_result = $connection->query($sql);
$row = $sql_result->fetch();
$itemid = $row["itemid"];
$quan = $row["quantity"];
$name = $row["itemname"];
$size = $row["size"];
$units = $row["units"];
$mfctr = $row["manufacturer"];
$notes = $row["notes"];
$time = $row["time"];
echo "<TR><TH>$itemid</TH><TH>$quan</TH><TH>$name</TH><TH>$size $units</TH><TH>$mfctr</TH><TH>$notes</TH><TH>$time</TH></TR>";
//mysql_free_result($sql_result);
}
echo "</TABLE>";
//mysql_close($connection);
$connection = NULL;
echo "<input name=\"smalltext\" value=1 type=\"checkbox\">Small Text<br>";
echo "<input name=\"table\" value=1 type=\"checkbox\" checked>Display In Table Format<br>";
echo "<input type=\"submit\" name=\"confirm\" value=\"Print\">";
echo "<input type=\"submit\" name=\"confirm\" value=\"Cancel\">";
echo "<input type=\"hidden\" name=\"ids\" value=\"$ids\">";
echo "<input type=\"hidden\" name=\"numchx\" value=\"$numchx\">";
echo "</form>";
include_once($WEBROOT . "/include/footer.php");
?>