Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $col = array();
- $col["title"] = "Total ordered";
- $col["name"] = "total_order";
- $col["search"] = true;
- $col["editable"] = false;
- $cols[] = $col;
- // running total calculation
- $e = array();
- $e["on_data_display"] = array("pre_render","",true);
- $g->set_events($e);
- function pre_render($data)
- {
- foreach($data["params"] as &$d)
- {
- $mid = $d["material_id"];
- $rs = mysql_fetch_assoc(mysql_query("SELECT SUM(material_quantity) as s FROM orders WHERE orders.material_id = $mid "));
- $d["total_order"] = $rs["s"];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement