Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. $col = array();
  2. $col["title"] = "Total ordered";
  3. $col["name"] = "total_order";
  4. $col["search"] = true;
  5. $col["editable"] = false;
  6. $cols[] = $col;
  7.  
  8. // running total calculation
  9. $e = array();
  10. $e["on_data_display"] = array("pre_render","",true);
  11. $g->set_events($e);
  12.  
  13. function pre_render($data)
  14. {
  15.  
  16. foreach($data["params"] as &$d)
  17. {
  18. $mid = $d["material_id"];
  19. $rs = mysql_fetch_assoc(mysql_query("SELECT SUM(material_quantity) as s FROM orders WHERE orders.material_id = $mid "));
  20. $d["total_order"] = $rs["s"];
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement