I have a php script which is used to generate information for a jeasyUI Grid.
$sql = $db->query(sprintf("SELECT ID, rec_purID, rec_qty, rec_date, p.pur_ID, p.pur_productID, p.pur_supplierID, p.pur_unitPrice, pr.prod_productName, c.cont_fullName, CAST((rec_qty * p.pur_unitPrice) as UNSIGNED) as rec_value FROM receipts inner join purchases p on rec_purID = p.pur_ID inner join products pr on p.pur_productID = pr.prod_productID inner join contacts c on p.pur_supplierID = c.cont_ID")) or SQLError();
while($rec = $sql->fetch_assoc()) {
$group[] = $rec;
}
$smarty->assign('group', $group);If I print_r this array, it appears to be correct:
Array (
[0] => Array ( [ID] => 78 [rec_purID] => 32 [rec_qty] => 1000 [rec_date] => 2016-03-30 [pur_ID] => 32 [pur_productID] => 5 [pur_supplierID] => 41 [pur_unitPrice] => 100.00 [prod_productName] => Acetate Tow [cont_fullName] => DELPACK TRADING (PTY) LTD [rec_val] => 100000 )
[1] => Array ( [ID] => 79 [rec_purID] => 31 [rec_qty] => 2207 [rec_date] => 2016-03-30 [pur_ID] => 31 [pur_productID] => 5 [pur_supplierID] => 41 [pur_unitPrice] => 95.50 [prod_productName] => Acetate Tow [cont_fullName] => DELPACK TRADING (PTY) LTD [rec_val] => 210768.5 )
[2] => Array ( [ID] => 80 [rec_purID] => 31 [rec_qty] => 3000 [rec_date] => 2016-03-31 [pur_ID] => 31 [pur_productID] => 5 [pur_supplierID] => 41 [pur_unitPrice] => 95.50 [prod_productName] => Acetate Tow [cont_fullName] => DELPACK TRADING (PTY) LTD [rec_val] => 286500 )
)
My grid, however will never see the value of "rec_val". Please can someone explain where I have gone wrong.
<table id="dg" class="easyui-datagrid" style="width:100%;height:400px"
url="receipts.php?do=list"
title="Received Goods"
toolbar="#toolbar" pagination="true"
iconCls="icon-edit" showFooter="true"
sortName="ID" sortOrder="asc"
rownumbers="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th field="ID" width="10" sortable="true">Internal ID</th>
<th field="prod_productName" width="80" sortable="true">Product</th>
<th field="cont_fullName" width="80" sortable="true">Supplier</th>
<th field="rec_qty" width="80" sortable="true">Quantity</th>
<th field="pur_unitPrice" width="80">Unit Price</th>
<th field="rec_val" width="80">Value</th>
<th field="rec_date" width="80" sortable="true">Date Received</th>
</tr>
</thead>
</table>
Please open your browser's debug tool to see what data returned from your server. Is the 'rec_val' property value correct?