Jump to content

Need help in setFilterGrid with total at the lat row


newphpcoder

Recommended Posts

Hi...Good day!I already had codes on setFilterGrid on my table, now I need to add the total qty at the row which is i don't have any idea if it is possible using javascript and how. I want to happen is every time I filter the item code the Quantity will SUM and display on the last row.here is my code:

<?php							   include('connection.php');	?><html><title>Raw Materials Inventory</title><head><link rel="stylesheet" type="text/css" href="css/kanban.css" /><script language="javascript" type="text/javascript" src="tablefilter.js"></script> <style>table {    font: 14px/28px Verdana, Arial, Helvetica, sans-serif;    border-collapse: collapse;    }th {    padding: 0 0.6em;    text-align: left;    }tr.yellow th {    border-top: 1px solid #FB7A31;    border-bottom: 1px solid #FB7A31;    background: #FFC;    }td {    border-bottom: 1px solid #CCC;    padding: 0 0.6em;    }td+td {    border-left: 1px solid #CCC;    text-align: center;    }</style></head><body><form><?php$current = "in";include("menu.php");echo "<div style='clear: both;'> </div><div style='clear: both;'> </div>";$result = mysql_query("SELECT s.bin_location, s.shelved_qty, s.issued_qty, r.wh_code, m.component, m.mat_code, m.description, m.uom FROM wms_shelving AS s LEFT JOIN wms_receiving AS r ON s.rm_id = r.rm_id LEFT JOIN bom_material AS m ON r.uid_mat = m.uid_mat WHERE s.shelved_qty > s.issued_qty OR ISNULL(s.issued_qty) ORDER BY m.component, m.mat_code");echo "<table id='inventory'>";echo "<tr class='yellow'><th>Component</th><th>Item Code</th><th>Description</th><th>WH Location</th><th>UoM</th><th>Quantity</th></tr>";while($row = mysql_fetch_array($result))    {	    $component = $row['component'];	    $itemcode = $row['mat_code'];	    $description = $row['description'];	    $wh_location = $row['bin_location'];	    $uom = $row['uom'];	    $remaining_qty = $row["shelved_qty"] - $row["issued_qty"];echo "<tr>";echo "<td>$component</td>";echo "<td>$itemcode</td>";echo "<td>$description</td>";echo "<td>$wh_location</td>";echo "<td>$uom</td>";echo "<td>$remaining_qty</td>";echo "</tr>" ;    }echo "</table>";?></form><script language="javascript" type="text/javascript">    var fnsFilters = {	    sort_select: true,	    loader: true,	    col_5: "none",	    col_4: "none",	    col_3: "select",	    col_2: "none",	    col_1: "select", 	    col_0: "select",	    on_change: true,	    display_all_text: "Filter",	    rows_counter: false,	    btn_reset: false,	    alternate_rows: false,	    btn_reset_text: "Display Existing Item Code",	    col_width: ["auto","auto","auto", "auto", "auto", "auto"]    }    setFilterGrid("inventory",fnsFilters);</script></body></html>

Any help is highly appreciated.Thank you so much.

Link to comment
Share on other sites

Hi..I found code that has a sum below from this link :http://tablefilter.free.fr/ex.php#tbl9Sample Table 7:

<script language="javascript" type="text/javascript">//<![CDATA[var totRowIndex = tf_Tag(tf_Id('table7'),"tr").length; var table7_Props =  {	 rows_counter: true,	 loader: true,	 loader_text: "Filtering data...",	 col_operation: {		id: ["table8Tot1","table8Tot2"],		col: [2,4],		operation: ["sum","sum"],		write_method: ["innerHTML","setValue"],		exclude_row: [totRowIndex],		decimal_precision: [1,0]	   },	 rows_always_visible: [totRowIndex]	  	};var tf7 = setFilterGrid( "table7",table7_Props );//*** Note ***//You can also write operation results in elements outside the table. //]]></script>

Honestly, I cannot understand the whole code because it has no html code or sample code of table.So it's to hard for me to adopt that code in my present code:

<html><title>Raw Materials Inventory</title><head><link rel="stylesheet" type="text/css" href="css/kanban.css" /><script language="javascript" type="text/javascript" src="tablefilter.js"></script>  <style>table {    font: 14px/28px Verdana, Arial, Helvetica, sans-serif;    border-collapse: collapse;    } th {    padding: 0 0.6em;    text-align: left;    } tr.yellow th {    border-top: 1px solid #FB7A31;    border-bottom: 1px solid #FB7A31;    background: #FFC;    } td {    border-bottom: 1px solid #CCC;    padding: 0 0.6em;    } td+td {    border-left: 1px solid #CCC;    text-align: center;    }</style></head><body><form><!--<div id="ddcolortabs"><ul><li> <a href="SalesOrder.php" title="Sales Order"><span>Order Management</span></a></li> <li> <a href="ParameterSettings.php" title="Parameter Settings"><span>Parameter Settings</span></a></li><li style="margin-left: 1px"><a href="kanban_report.php" title="WIP Report"><span>Wip Report</span></a></li><li><a href="fsn.php" title="Finished Stock Note"><span>WMS FG</span></a></li><li id="current"><a href="ReceivingMaterials.php" title="WMS RM"><span>WMS RM</span></a></li><li><a href="StockRequisition1.php" title="Stock Requisition"><span>Stock Requisition</span></a></li>   <li><a href="calendar_days.php" title="Calendar Days"><span>Calendar Days</span></a></li></ul></div>--><div id="ddcolortabs1"><ul><li><a href="ReceivingMaterials.php" title="Raw Materials"><span>Raw Materials</span></a></li><li><a href="Shelving.php" title="Shelving"><span>Shelving</span></a></li><li><a href="Picking.php" title="Picking"><span>Picking</span></a></li><li><a href="Issuance.php" title="Issuance"><span>Issuance</span></a></li><li id="current"><a href="wmsinventory.php" title="Inventory"><span>Inventory</span></a></li</ul></div><div style='clear: both;'> </div><div style='clear: both;'> </div><table id='inventory'><tr class='yellow'><th>Component</th><th>Item Code</th><th>Description</th><th>WH Location</th><th>UoM</th><th>Quantity</th></tr><tr><td>Chemicals</td><td>MAT-CHE-0010</td><td>Barium Sulfate, 25kg./bag</td><td>WAREHOUSE 1</td><td>kg</td><td>200</td></tr><tr><td>Chemicals</td><td>MAT-CHE-0075 </td><td>Kaolin Clay</td><td>WAREHOUSE 1</td><td>kg</td><td>200</td></tr><tr><td>Chemicals</td><td>MAT-CHE-0080</td><td>Light Magnesium Carbonate</td><td>WAREHOUSE 2</td><td>kg</td><td>325</td></tr><tr><td>Chemicals</td><td>MAT-CHE-0080</td><td>Light Magnesium Carbonate</td><td>WAREHOUSE 2</td><td>kg</td><td>250</td></tr><tr><td>Ringpull</td><td>PAC-EZO-0050</td><td>Ringpull, SONOCO 300dia; EOE part # 115-0356-56</td><td>WAREHOUSE 2</td><td>pc</td><td>151800</td></tr><tr><td>Sticker</td><td>PAC-STK-0080A</td><td>Blank Label Sticker, 3"X4",sheet form (additional carton label for SHIREBROOK order)</td><td>WAREHOUSE 3</td><td>pc</td><td>464</td></tr><tr><td>Tin Can/PET/P-bag</td><td>PAC-PET-0000</td><td>PET 3B-DSPI</td><td>WAREHOUSE 1</td><td>pc</td><td>94500</td></tr></table><table id=''></form><script language="javascript" type="text/javascript">    var fnsFilters = {	    sort_select: true,	    loader: true,	    col_5: "none",	    col_4: "none",	    col_3: "select",	    col_2: "none",	    col_1: "select", 	    col_0: "select",	    on_change: true,			   	    display_all_text: "Filter",	    rows_counter: false,	    btn_reset: false,	    alternate_rows: false,	    btn_reset_text: "Display Existing Item Code",	    col_width: ["auto","auto","auto", "auto", "auto", "auto"]    }    setFilterGrid("inventory",fnsFilters);</script></body> </html>

I hope somebody can help me. To merge the two javascript. So that after I filter the Item Code below the Quantiy will display the SUM.Thank you so much

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...