Show Posts
|
|
Pages: [1]
|
|
1
|
General Category / EasyUI for jQuery / Calculated values from PHP not showing in Grid
|
on: March 30, 2016, 03:24:42 AM
|
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>
|
|
|
|
|
3
|
General Category / EasyUI for jQuery / Re: Json data for column totals
|
on: March 24, 2016, 12:37:24 AM
|
Thank you. my Json Array now looks like this: {"total":[{"total":"6"}],"rows":[{"total":"6"},{"pur_ID":"6","pur_date":"2016-03-22","pur_dueDate":"2016-03-24","pur_productID":"6","pur_qty":"500","pur_supplierID":"42","pur_value":"8.00","pur_supplierInvoice":"12","pur_unitPrice":"17.96","pur_arrivalDate":null,"pur_ref":"12","pur_received":"Received","cont_ID":"42","cont_contactGroup":"2","cont_fullName":"Henkel","cont_countryID":"6","cont_comments":null,"cont_deliveryAddressID":"0","cont_createBy":"Nic","cont_createTime":"2015-10-14 14:54:25","cont_updateTime":"2015-10-14 14:54:25","cont_updateBy":null,"prod_productID":"6","prod_productName":"Triacetin","prod_grossWeight":"240","prod_nettWeight":"0.00","prod_productType":"3","prod_productCost":"0.00","prod_uomID":"2","prod_canSell":"","prod_minLevel":"480.00"},{"pur_ID":"8","pur_date":"2016-03-09","pur_dueDate":"2016-03-22","pur_productID":"7","pur_qty":"500","pur_supplierID":"42","pur_value":"1.00","pur_supplierInvoice":"333","pur_unitPrice":"2000.00","pur_arrivalDate":null,"pur_ref":"33","pur_received":"Pending","cont_ID":"42","cont_contactGroup":"2","cont_fullName":"Henkel","cont_countryID":"6","cont_comments":null,"cont_deliveryAddressID":"0","cont_createBy":"Nic","cont_createTime":"2015-10-14 14:54:25","cont_updateTime":"2015-10-14 14:54:25","cont_updateBy":null,"prod_productID":"7","prod_productName":"Plug Wrap","prod_grossWeight":"0.00","prod_nettWeight":"0.00","prod_productType":"3","prod_productCost":"0.00","prod_uomID":"3","prod_canSell":"","prod_minLevel":"1200.00"},{"pur_ID":"7","pur_date":"2016-03-22","pur_dueDate":"2016-03-24","pur_productID":"6","pur_qty":"500","pur_supplierID":"45","pur_value":"5.00","pur_supplierInvoice":"444","pur_unitPrice":"10.00","pur_arrivalDate":null,"pur_ref":"4","pur_received":"Part Received","cont_ID":"45","cont_contactGroup":"2","cont_fullName":"Corromaster","cont_countryID":"6","cont_comments":"","cont_deliveryAddressID":"0","cont_createBy":"Nic","cont_createTime":"2015-10-19 09:15:25","cont_updateTime":"2015-10-19 09:15:25","cont_updateBy":null,"prod_productID":"6","prod_productName":"Triacetin","prod_grossWeight":"240","prod_nettWeight":"0.00","prod_productType":"3","prod_productCost":"0.00","prod_uomID":"2","prod_canSell":"","prod_minLevel":"480.00"}],"footer":[{"total_value":"14.00"}]}With php as: $rowz = []; $total = []; $footer = []; //Get the total $getRows = $db->query(sprintf("SELECT COUNT(*) as total from purchases")) or SQLError(); while($row = $getRows->fetch_assoc()) { $result[] = $row; } $rowz["total"] = $result; // GET THE ROWS $getRows = $db->query(sprintf("SELECT *, c.cont_ID, c.cont_fullName, p.prod_productID, p.prod_productName FROM purchases inner join contacts c on pur_supplierID = c.cont_ID inner join products p on pur_productID = p.prod_productID ORDER BY $sort $order")) or SQLError(); while($row = $getRows->fetch_assoc()) { $result[] = $row; } $rowz["rows"] = $result; // GET THE FOOTER $getRows = $db->query(sprintf("SELECT SUM(pur_value) as total_value from purchases")) or SQLError(); while($row = $getRows->fetch_assoc()) { $total[] = $row; } $rowz["footer"] = $total; $smarty->assign('rowz', $rowz); echo json_encode($rowz); I am getting some VERY strange results in the grid 
|
|
|
|
|
4
|
General Category / EasyUI for jQuery / Re: Show buttons for specific rows in datagrid [SOLVED]
|
on: March 23, 2016, 05:15:08 AM
|
I have managed. I first defined the column: <th field="pur_received" width="20" formatter="showButton">Action</th> And then rendered the button if the criteria was met. function showButton(val,row){ for(var name in row){ if (row["pur_received"]=="Received") { } else { var s = '<button class="easyui-linkbutton" iconCls="icon-edit" onclick="receive_goods(this)"></button> '; return s; } } }
|
|
|
|
|
6
|
General Category / EasyUI for jQuery / Json data for column totals
|
on: March 22, 2016, 10:32:39 PM
|
I am having some difficulties with the formatting of JSON. My code is below with the result: // total ------------- $rs = $db->query(sprintf("SELECT COUNT(*) as trows from purchases")) or SQLError(); while($rset = $rs->fetch_assoc()) { $r["total"] = $rset["trows"]; } $result["total"] = $r["total"]; // rows --------------- $getRows = $db->query(sprintf("SELECT *, c.cont_ID, c.cont_fullName, p.prod_productID, p.prod_productName FROM purchases inner join contacts c on pur_supplierID = c.cont_ID inner join products p on pur_productID = p.prod_productID GROUP BY pur_ID ORDER BY $sort $order")) or SQLError(); while($row = $getRows->fetch_assoc()) { $result["rows"] = $row; } $getTotal = $db->query(sprintf("SELECT sum(pur_value) as Total from purchases")) or SQLError(); while($row = $getTotal->fetch_assoc()) { $entry = array( 'name' => 'Total', 'Total Value' => $row['Total'], ); $jsonData[] = $entry; } $result["footer"] = $jsonData; echo json_encode($result); {"total":"3","rows":{"pur_ID":"7","pur_date":"2016-03-22","pur_dueDate":"2016-03-24","pur_productID":"6","pur_qty":"500","pur_supplierID":"45","pur_value":"5.00","pur_supplierInvoice":"444","pur_unitPrice":"10.00","pur_arrivalDate":null,"pur_ref":"4","pur_received":null,"cont_ID":"45","cont_contactGroup":"2","cont_fullName":"Corromaster","cont_countryID":"6","cont_comments":"","cont_deliveryAddressID":"0","cont_createBy":"Nic","cont_createTime":"2015-10-19 09:15:25","cont_updateTime":"2015-10-19 09:15:25","cont_updateBy":null,"prod_productID":"6","prod_productName":"Triacetin","prod_grossWeight":"240","prod_nettWeight":"0.00","prod_productType":"3","prod_productCost":"0.00","prod_uomID":"2","prod_canSell":"","prod_minLevel":"480.00"},"footer":[{"name":"Total","Total Value":"14.00"}]}Really appreciate some help.
|
|
|
|
|
8
|
General Category / EasyUI for jQuery / Subgrid buttons
|
on: March 17, 2016, 06:13:51 AM
|
|
I am trying to create buttons for my subgrid but am failing to get the button to show the correct icons.
formatter:function(value,row,index) { var s = '<button class="easyui-linkbutton" iconCls="icon-edit" onclick="editBomDetail(this)"></button> '; return s; }
Is it possible?
|
|
|
|
|
10
|
General Category / EasyUI for jQuery / Re: Datagrid search php mysql
|
on: March 10, 2016, 12:51:57 AM
|
|
I battled for ages with this but have got it working with the code below, hope this helps?
<? require('kernal.php'); $itemid = trim(strip_tags($_REQUEST['id']));
// Get sales $getRows = $db->query(sprintf("SELECT *, p.prod_productID, p.prod_productName FROM sales_detail inner join products p on p.prod_productID = salesd_productID WHERE salesd_salesID = '$itemid' GROUP BY salesd_ID")) or SQLError();
while($row = $getRows->fetch_assoc()) { $rows[] = $row; } $smarty->assign('rowsNum', $total); $smarty->assign('rows', $rows); echo json_encode($rows);
?>
|
|
|
|
|
11
|
General Category / EasyUI for jQuery / Using $_GET with EasyUI not working
|
on: March 09, 2016, 11:45:11 AM
|
|
I want to build an embedded grid. I have success with the master detail but when trying to get the detail records, I don't get a result. I am using PHP Version 5.6.3. My code returns a json_result if I run it on it's own. The code as follows:
<? require('kernal.php');
$itemid=mysqli_real_escape_string($db, $_REQUEST['id']); print $itemid; //print $itemid; //$itemid=$_REQUEST['id']; //print $itemid; // Get sales $getRows = $db->query(sprintf("SELECT *, p.prod_productID, p.prod_productName FROM sales_detail inner join products p on p.prod_productID = salesd_productID WHERE salesd_salesID = '$itemid' GROUP BY salesd_ID")) or SQLError();
while($row = $getRows->fetch_assoc()) { $rows[] = $row; } $smarty->assign('rowsNum', $total); $smarty->assign('rows', $rows); echo json_encode($rows);
?>
I have more or less copied the code from the demo site. Can anyone help me please?
|
|
|
|
|
12
|
General Category / EasyUI for jQuery / Using EasyUI in Smarty Templates
|
on: March 09, 2016, 07:02:44 AM
|
|
I have recently tried the subgrid example and as a standalone, I have got it to work with my data no problem. As soon as I try and integrate with my smarty template, the grid no longer displays. Are there any known issues with smarty and easyui? If not, has anybody got any pointers for me?
|
|
|
|
|