Jump to content

Need help in setFilterGrid


Recommended Posts

HiGood day!I have form created that I used setFilterGrid in my table, so that I can easily filter the data.Now Every time I filter the item code I need to sum all the quantity , same with if I filter the item code and wh location it also sum the quantiy. Is it possible in javascript?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>

Thank you so much

Link to post
Share on other sites
  • 8 months later...

Hi,

 

I have this code for setFilterGrid and it works fine:

 

 

<form name="material_form" action="<?php echo $PHP_SELF; ?>" method="post" autocomplete="off"><div id="WH_list"><table id="mat_list"><thead><tr><th>DATE ENTRY</th><th>PO NUMBER</th><th>KIND</th><th>ITEM CODE</th><th>DESCRIPTION</th><th>UoM</th><th>SUPPLIER</th><th>QTY</th><th>WH #</th><th>ROW #</th><th>RACK #</th><th>LEVEL</th><th>RECEIVED BY</th></tr></thead><?php$sql = "SELECT m.date_entry, m.po_number, m.kind, r.item_code, r.sup_code, u.uom, s.supplier_name, ";$sql .= "m.qty, w.whse, w.row, w.rack, w.level, o.employee ";$sql .= "FROM material_data_in AS m LEFT JOIN raw_material AS r ON (m.mat_id = r.item_code) ";$sql .= "LEFT JOIN uom_list AS u ON (u.uom_id = m.uom_id) ";$sql .= "LEFT JOIN supplier AS s ON (s.supplier_id = m.supplier_id) ";$sql .= "LEFT JOIN warehouse AS w ON (w.id = warehouse_id) ";$sql .= "LEFT JOIN rm_receiver AS o ON (o.emp_id = m.received_by)";$res = mysql_query($sql);while($row_mat_list = mysql_fetch_assoc($res)){$date_entry           = $row_mat_list['date_entry'];$po_number            = $row_mat_list['po_number'];//$unique_id            = $row_mat_list['unique_id'];$kind                 = $row_mat_list['kind'];$item_code            = $row_mat_list['item_code'];$description          = $row_mat_list['sup_code'];   $uom                  = $row_mat_list['uom'];$supplier             = $row_mat_list['supplier_name'];$qty                  = $row_mat_list['qty'];$qty                  = number_format($qty, 2);$whse                 = $row_mat_list['whse'];$row                  = $row_mat_list['row'];$rack                 = $row_mat_list['rack'];$level                = $row_mat_list['level'];$received_by          = utf8_encode($row_mat_list['employee']);echo "<tr>";echo "<td>$date_entry</td>";echo "<td>$po_number</td>";echo "<td>$kind</td>";echo "<td>$item_code</td>";echo "<td>$description</td>";echo "<td>$uom</td>";echo "<td>$supplier</td>";echo "<td>$qty</td>";echo "<td>$whse</td>";echo "<td>$row</td>";echo "<td>$rack</td>";echo "<td>$level</td>";echo "<td>$received_by</td>";echo "</tr>";}         echo "<tr>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td id='totalHERE' style='color:red;border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "<td style='border:none;'></td>";echo "</tr>";?></table><table id=''></form><script language="javascript" type="text/javascript">var totalRowDex = tf_Tag(tf_Id('mat_list'), "tr").length;var inventProp = {    rows_counter: true,    loader: true,    loader_text: "FilterING DaTa....",    col_operation: {        id: ["totalHERE"],        col: [7],        operation: ["sum"],        write_method: ["innerHTML"],        exclude_row: [totalRowDex],        decimal_precision: [2]    },    rows_always_visible: [totalRowDex]};setFilterGrid("mat_list", inventProp);</script></form>

 

 

now my problem is, how can I make the total qty has a comma every 3 digits. Because the Total = 80000000.00 how can I make it 80,000,000.00

 

I hope somebody can help me.

 

Thank you so much.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...