Forum


I've been using FireBug on my code, and I'm getting the following:
<html xmlns=”http://www.w3.org/1999/xhtml&r.....o;>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>PRODUCT INVENTORY</title>
<link rel=”stylesheet” type=”text/css” media=”screen” href=”themes/basic/grid.css” />
<link rel=”stylesheet” type=”text/css” media=”screen” href=”themes/jqModal.css” />
<style>
BODY {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
}
#sp_1,#sp_2 {
position:relative;
top:3px;
}
</style>
<script src=”js/jquery.js” type=”text/javascript”></script>
<script src=”js/jquery.jqGrid.js” type=”text/javascript”></script>
<script src=”js/jqModal.js” type=”text/javascript”></script>
<script src=”js/jqDnR.js” type=”text/javascript”></script>
<script src=”js/grid.formedit.js” type=”text/javascript”></script>
<script type=”text/javascript”>
jQuery(document).ready(function(){
jQuery(”#list2″).jqGrid({
caption:'Product Inventory',
colModel:[
{name:'iid',index:'iid', width:55,editable:true,editoptions:{size:10}}, // SQL line number
{name:'code',index:'code', width:55,editable:true,editoptions:{readonly:true,size:10}}, // Vendor code
// ln - line number
{name:'price',index:'price', width:55,editable:true,editoptions:{size:10}}, // Base item price
// stran - transaction number
{name:'active',index:'active', width:55,editable:true,edittype:"checkbox",editoptions:{size:10,value:"Yes:No"}}, // Active item?
{name:'itemcd',index:'itemcd', width:55,editable:true,editoptions:{size:10}}, // Item CD
{name:'buycde',index:'buycde', width:55,editable:true,editoptions:{size:10}}, // Buyer code for item
{name:'odate',index:'odate', width:55,editable:true,editoptions:{size:10}}, // Item creation date
{name:'idate',index:'idate', width:55,editable:true,editoptions:{size:10}}, // Date of last sale
{name:'cost',index:'cost', width:55,editable:true,editoptions:{size:10}}, // Item price
{name:'lstcost',index:'lstcost', width:55,editable:true,editoptions:{size:10}}, // Last cost of item
{name:'stdcost',index:'stdcost', width:55,editable:true,editoptions:{size:10}}, // Standard cost
{name:'qtyonh',index:'qtyonh', width:55,editable:true,editoptions:{size:10}}, // Quantity on hand
{name:'qtyall',index:'qtyall', width:55,editable:true,editoptions:{size:10}}, // Quantity allocated
{name:'descr1',index:'descr1', width:55,editable:true,edittype:"textarea",editoptions:{rows:"2",cols:"20"}}, // First desc line
{name:'descr2',index:'descr2', width:55,editable:true,edittype:"textarea",editoptions:{rows:"2",cols:"20"}}, // Second desc line
// costgln - GL account number item is distributed to
// salegln - GL account number item is distributed to
{name:'qtybo',index:'qtybo', width:55,editable:true,editoptions:{size:10}}, // Quantity backordered
{name:'qtyono',index:'qtyono', width:55,editable:true,editoptions:{size:10}}, // Quantity on order
{name:'unitms',index:'unitms', width:55,editable:true,editoptions:{size:10}}, // Unit of measurement
{name:'binloc',index:'binloc', width:55,editable:true,editoptions:{size:10}}, // Bin location code
// loc - location code for this item
// abccd - code for ABC analysis
{name:'reord',index:'reord', width:55,editable:true,editoptions:{size:10}}, // Reorder level
// cyccnt - Cycle count code
// cutqty = Enter cutoff quantity for a physical count
{name:'lcntdat',index:'lcntdat', width:55,editable:true,editoptions:{size:10}}, // Date of last inventory count
// barcd - Enter the barcode value for this item
{name:'catg',index:'catg', width:55,editable:true,editoptions:{size:10}}, // Item category
{name:'weight',index:'weight', width:55,editable:true,editoptions:{size:10}}, // Item weight
// serflag - Does the item require a serial number
{name:'taxflag',index:'taxflag', width:55,editable:true,edittype:"checkbox",editoptions:{size:10,value:"Yes:No"}} // Taxable item?
],
colNames:['iid','Vendor Code','Price','Active?','Item Code','Buyer Code',
'Created','Last Sold','Price','Last Cost','Standard Cost','Quantity',
'Quantity Allocated','Description','Description2','Quantity On Hand','Quantity Backordered',
'Unit of Measurement','Bin Location Code','Reorder Level','Last Inventory Count',
'Item Cateogry','Item Weight','Taxable'],
datatype: 'xml',
imgpath:'themes/basic/images',
mtype:'GET',
pager:jQuery('#pager2'),
rowNum:10, rowList:[10,20,40],
height:175,
sortname:'iid',sortorder:'asc',
url:'as_inventory.php',
editurl:'as_inventory.php',
viewrecords:true,
altRows:true,
loadtext:'Retrieving Data…'
});
jQuery(”#list2″).navGrid('#pager2',
{height:280,reloadAfterSubmit:false,editCaption:'Edit'}, // edit options
{height:280,reloadAfterSubmit:false,addCaption:'Add'}, // add options
{height:280,reloadAfterSubmit:false,caption:'Delete'}, // del options
{reloadAfterSubmit:false} //search options
);
});
</script>
</head>
<body>
<!– the grid definition in html is a table tag with class 'scroll' –>
<table id=”list2″ class=”scroll” cellpadding=”0″ cellspacing=”0″></table>
<!– pager definition. class scroll tels that we want to use the same theme as grid –>
<div id=”pager2″ class=”scroll” style=”text-align:center;”></div>
</body>
</html>
// DB CONNECTOR PARAMETERS
require('as_dbconfig.php');
// DISPLAY GRID
if (($_GET['_search'] == 'false')) {
// Page parameters
$page = $_REQUEST['page'];
$limit = $_REQUEST['rows'];
$sidx = $_REQUEST['sidx'];
$sord = $_REQUEST['sord'];
$db = mysql_connect($dbhost, $dbuser, $dbpassword)
or die(”Connection Error: ” . mysql_error());
mysql_select_db($database) or die(”Error conecting to db.”);
$result = mysql_query(”SELECT COUNT(*) AS count FROM imsim”);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];
if( $count > 0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) {$page = $total_pages;}
$start = $limit * $page - $limit;
if($start < 0) {$start = 0;}
$dsp = “SELECT * FROM imsim ORDER BY $sidx $sord LIMIT $start, $limit”;
// $dsp = “SELECT id,invdate,client_id,amount,tax,total,note,closed,ship_via FROM invheader ORDER BY $sidx $sord LIMIT $start , $limit”;
$result = mysql_query($dsp) or die(”Couldn't execute query.”.mysql_error());
// XML header
if ( stristr($_SERVER["HTTP_ACCEPT"],”application/xhtml+xml”) ) {
header(”Content-type: application/xhtml+xml;charset=utf-8″);
} else {
header(”Content-type: text/xml;charset=utf-8″);
}
echo “<?xml version='1.0' encoding='utf-8'?>”;
echo “<rows>”;
echo “<page>” . $page . “</page>”;
echo “<total>” . $total_pages . “</total>”;
echo “<records>” . $count . “</records>”;
// Put text data in CDATA tags
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo “<row id='”. $row[iid].”'>”;
echo “<cell>” . $row[iid] . “</cell>”;
echo “<cell>” . $row[code] . “</cell>”;
echo “<cell>” . $row[price] . “</cell>”;
echo “<cell>” . $row[active] . “</cell>”;
echo “<cell>” . $row[itemcd] . “</cell>”;
echo “<cell>” . $row[buycde] . “</cell>”;
echo “<cell>” . $row[odate] . “</cell>”;
echo “<cell>” . $row[idate] . “</cell>”;
echo “<cell>” . $row[cost] . “</cell>”;
echo “<cell>” . $row[lstcost] . “</cell>”;
echo “<cell>” . $row[stdcost] . “</cell>”;
echo “<cell>” . $row[qtyonh] . “</cell>”;
echo “<cell>” . $row[qtyall] . “</cell>”;
echo “<cell><![CDATA[" . $row[descr1] . “]]></cell>”;
echo “<cell><![CDATA[" . $row[descr2] . “]]></cell>”;
echo “<cell>” . $row[qtybo] . “</cell>”;
echo “<cell>” . $row[qtyono] . “</cell>”;
echo “<cell>” . $row[unitms] . “</cell>”;
echo “<cell>” . $row[binloc] . “</cell>”;
echo “<cell>” . $row[reord] . “</cell>”;
echo “<cell>” . $row[lcntdat] . “</cell>”;
echo “<cell>” . $row[catg] . “</cell>”;
echo “<cell>” . $row[weight] . “</cell>”;
echo “<cell>” . $row[taxflag] . “</cell>”;
echo “<cell><![CDATA[" . $row[note] . “]]></cell>”;
echo “</row>”;
}
echo “</rows>”;
// SEARCH GRID
} elseif ($_GET['_search'] == 'true') {
// Page parameters
$page = $_REQUEST['page'];
$limit = $_REQUEST['rows'];
$sidx = $_REQUEST['sidx'];
$sord = $_REQUEST['sord'];
// Search parameters
$ssql = “”; // Null out the SQL conditional string
$sdata = $_GET['searchString']; // Reserved variable
$soper = $_GET['searchOper']; // Also reserved
$sfld = $_GET['searchField']; // Ditto
if ($sfld != “”) {
$ssql .= $sfld;
// Case statement for search identifiers
switch ($soper) {
case “bw”: $sdata .= “%”; $ssql .= ” LIKE '” . $sdata . “'”; break;
case “eq”: if (is_numeric($sdata)) {$ssql .= ” = ” . $sdata;} else {$ssql .= ” = '” . $sdata.”'”;} break;
case “ne”: if (is_numeric($sdata)) {$ssql .= ” <> ” . $sdata;} else {$ssql .= ” <> '” . $sdata . “'”;} break;
case “lt”: if (is_numeric($sdata)) {$ssql .= ” < ” . $sdata;} else {$ssql .= ” < '” . $sdata . “'”;} break;
case “le”: if (is_numeric($sdata)) {$ssql .= ” <= ” . $sdata;} else {$ssql .= ” <= '” . $sdata . “'”;} break;
case “gt”: if (is_numeric($sdata)) {$ssql .= ” > ” . $sdata;} else {$ssql .= ” > '” . $sdata.”'”;} break;
case “ge”: if (is_numeric($sdata)) {$ssql .= ” >= ” . $sdata;} else {$ssql .= ” >= '” . $sdata.”'”;} break;
case “ew”: $ssql .= ” LIKE '%” . $sdata . “'”; break;
default: $ssql = “”;
}
}
$db = mysql_connect($dbhost,$dbuser,$dbpassword)
or die(”Connection Error: ” . mysql_error());
mysql_select_db($database) or die(”Error conecting to db.”);
$result = mysql_query(”SELECT COUNT(*) AS count FROM imsim”);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];
if( $count > 0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) {$page = $total_pages;}
$start = $limit * $page - $limit;
if($start < 0) {$start = 0;}
// Once more into the breach, dear friends
$ser = “SELECT * FROM imsim WHERE $ssql”;
$result = mysql_query($ser) or die(”Couldn't execute query.”.mysql_error());
// XML header
if (stristr($_SERVER["HTTP_ACCEPT"],”application/xhtml+xml”)) {
header(”Content-type: application/xhtml+xml;charset=utf-8″);
} else {
header(”Content-type: text/xml;charset=utf-8″);
}
echo “<?xml version='1.0' encoding='utf-8'?>”;
echo “<rows>”;
echo “<page>” . $page . “</page>”;
echo “<total>” . $total_pages . “</total>”;
echo “<records>” . $count . “</records>”;
// Put text data in CDATA tags
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo “<row id='”. $row[iid].”'>”;
echo “<cell>” . $row[iid] . “</cell>”;
echo “<cell>” . $row[code] . “</cell>”;
echo “<cell>” . $row[price] . “</cell>”;
echo “<cell>” . $row[active] . “</cell>”;
echo “<cell>” . $row[itemcd] . “</cell>”;
echo “<cell>” . $row[buycde] . “</cell>”;
echo “<cell>” . $row[odate] . “</cell>”;
echo “<cell>” . $row[idate] . “</cell>”;
echo “<cell>” . $row[cost] . “</cell>”;
echo “<cell>” . $row[lstcost] . “</cell>”;
echo “<cell>” . $row[stdcost] . “</cell>”;
echo “<cell>” . $row[qtyonh] . “</cell>”;
echo “<cell>” . $row[qtyall] . “</cell>”;
echo “<cell><![CDATA[" . $row[descr1] . “]]></cell>”;
echo “<cell><![CDATA[" . $row[descr2] . “]]></cell>”;
echo “<cell>” . $row[qtybo] . “</cell>”;
echo “<cell>” . $row[qtyono] . “</cell>”;
echo “<cell>” . $row[unitms] . “</cell>”;
echo “<cell>” . $row[binloc] . “</cell>”;
echo “<cell>” . $row[reord] . “</cell>”;
echo “<cell>” . $row[lcntdat] . “</cell>”;
echo “<cell>” . $row[catg] . “</cell>”;
echo “<cell>” . $row[weight] . “</cell>”;
echo “<cell>” . $row[taxflag] . “</cell>”;
echo “<cell><![CDATA[" . $row[note] . “]]></cell>”;
echo “</row>”;
}
echo “</rows>”;
// ADD RECORD
} elseif($_POST['oper']=='add') {
// GENERATE ADD QUERY
$new_post = $_POST;
foreach ($_POST as $k=>$v) {
if (($k != 'oper') && ($k != 'id')) { // Eliminate the JQG parameters
$fieldnames .= $k . “,”;
$fieldvalues .= “'” . $v . “',”;
}
}
$fieldnames = substr($fieldnames,0,-1);
$fieldvalues = substr($fieldvalues,0,-1);
$db = mysql_connect($dbhost, $dbuser, $dbpassword)
or die(”Connection Error: ” . mysql_error());
mysql_select_db($database) or die(”DB connection FAILED!”);
echo $ins = “INSERT INTO invheader ($fieldnames) VALUES ($fieldvalues)”;
@mysql_query($ins) or die(”Add has died.”);
// EDIT RECORD
} elseif($_POST['oper']=='edit') {
// GENERATE EDIT QUERY
$new_post = $_POST;
foreach ($_POST as $k=>$v) {
if (($k != 'oper') && ($k != 'id')) { // Eliminate the JQG parameters
$fieldquery .= $k . “='” . $v . “',”;
}
}
$fieldquery = substr($fieldquery,0,-1);
$db = mysql_connect($dbhost, $dbuser, $dbpassword)
or die(”Connection Error: ” . mysql_error());
mysql_select_db($database) or die(”DB connection FAILED!”);
$upd = “UPDATE invheader SET $fieldquery WHERE id='” . $_POST['id'] . “'”;
@mysql_query($upd) or die(”Edit has died.”);
// DELETE RECORD
} elseif($_POST['oper']=='del') {
$id = $_POST['id'];
$db = mysql_connect($dbhost, $dbuser, $dbpassword)
or die(”Connection Error: ” . mysql_error());
mysql_select_db($database) or die(”DB connection FAILED!”);
$SQL = “DELETE FROM invheader WHERE id=$id”;
$res = @mysql_query($SQL) or die(”Delete has died.”);
}
?>
Most Users Ever Online: 715
Currently Online:
81 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66