473,382 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to sum the total after filtering the data?

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $current = "in";
  3. include("menu.php");
  4.  
  5. echo "<div style='clear: both;'>&nbsp;</div><div style='clear: both;'>&nbsp;</div>";
  6. $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");
  7.  
  8. /*
  9. echo "\n<table id= 'inventory'>";
  10. echo "\n\t<tr class=\"yellow\">\n\t\t<th>Component</th>\n\t\t<th>Item Code</th>\n\t\t<th>Description</th>\n\t\t<th>Bin Location</th>\n\t\t<th>UoM</th>\n\t\t<th>Quantity</th>\n\t</tr>";
  11. while($row = mysql_fetch_array($result))
  12.     {
  13.     echo "\n\t<tr>";
  14.     echo "\n\t\t<td>" . $row["component"] . "</td>";
  15.     echo "\n\t\t<td>" . $row["mat_code"] . "</td>";
  16.     echo "\n\t\t<td>" . $row["description"] . "</td>";
  17.     echo "\n\t\t<td>" . $row["bin_location"] . "</td>";
  18.     echo "\n\t\t<td>" . $row["uom"] . "</td>";
  19.     $remaining_qty = $row["shelved_qty"] - $row["issued_qty"];
  20.     echo "\n\t\t<td>" . $remaining_qty . "</td>";
  21.     echo "\n\t</tr>";
  22.     }
  23. echo "\n</table>";
  24. */
  25.  
  26. echo "<table id='inventory'>";
  27. echo "<tr class='yellow'>
  28. <th>Component</th>
  29. <th>Item Code</th>
  30. <th>Description</th>
  31. <th>WH Location</th>
  32. <th>UoM</th>
  33. <th>Quantity</th>
  34. </tr>";
  35. while($row = mysql_fetch_array($result))
  36.     {
  37.         $component = $row['component'];
  38.         $itemcode = $row['mat_code'];
  39.         $description = $row['description'];
  40.         $wh_location = $row['bin_location'];
  41.         $uom = $row['uom'];
  42.         $remaining_qty = $row["shelved_qty"] - $row["issued_qty"]; 
  43.       //  $quantity = $row['remaining_qty'];
  44. echo "<tr>";
  45. echo "<td>$component</td>";
  46. echo "<td>$itemcode</td>";
  47. echo "<td>$description</td>";
  48. echo "<td>$wh_location</td>";
  49. echo "<td>$uom</td>";
  50. echo "<td>$remaining_qty</td>";
  51. echo "</tr>" ;
  52.     }
  53. echo "</table>";
  54. ?>
  55. </form>
  56. <script language="javascript" type="text/javascript">
  57.     var fnsFilters = {
  58.         sort_select: true,
  59.         loader: true,
  60.         col_5: "none",
  61.         col_4: "none",
  62.         col_3: "select",
  63.         col_2: "none",
  64.         col_1: "select",  
  65.         col_0: "select",
  66.         on_change: true,
  67.         display_all_text: "Filter",
  68.         rows_counter: false,
  69.         btn_reset: false,
  70.         alternate_rows: false,
  71.         btn_reset_text: "Display Existing Item Code",
  72.         col_width: ["auto","auto","auto", "auto", "auto", "auto"]
  73.     }
  74.     setFilterGrid("inventory",fnsFilters);
  75.  
  76. </script>
  77. </body>
  78.  
  79. </html>
Mar 20 '13 #1
7 1993
r035198x
13,262 8TB
Which total? If it's for your data values like total remaining_qty then just create a variable before the while initialized to zero and add each record's remaining_qty inside the while.
Mar 20 '13 #2
i want the total of the remaining_qty.. Sample image below.. [IMG]C:\Documents and Settings\markanthony.uy\Desktop\samp\total2.JPG[/IMG]
Mar 20 '13 #3
r035198x
13,262 8TB
So did you try what I suggested above?
Mar 20 '13 #4
yes sir i tried it last time but it doesn't complete my requirements, I study by myself and Im new in coding im so confused kindly help me sir? i can't attached the image can i get your email? so i can send you the image for my output and the image that i want to happen.. i dont really gets some of the code, the code above was coded by other and it was turnover to me for some changes. Thank you sir for your reply and help! really appreciate it more power..
Mar 20 '13 #5
r035198x
13,262 8TB
1.) You need to read more so that you can understand the code you are trying to change.
2.) You need to be able to describe the output you got and the output you expected using just words. All programmers need some level of ability to communicate ideas with others
3.) If I send you my email address then it will open up random videos of Justin Beiber, perform defenestrations on your neighbors' pets with a computer recorded audio shouting "belly button!" at uneven intervals, that wouldn't be nice now would it?
Mar 20 '13 #6
ok sir, thanks for your tips.. i do some changes that is close to what i expected.. one more question is it possible to have a barcode generator that is coded in PHP and connected to mySQL?
Mar 20 '13 #7
r035198x
13,262 8TB
Yes it's possible. There are even open source versions created for the task. You'll have to do some reading on them and how to use them. More questions about them should be a new thread though not this one.
Mar 20 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: A_Rodrigues | last post by:
Hi Given a form with a date formated text box on it, which will serve as an input box for dates, how can I write a VBA sentence in order to apply a filter with that input? Suppose text box is...
1
by: Raffle | last post by:
Hi all, I'm still fairly new to Access and I was hoping to get some assistance with something I have yet to accomplish. The desired result is a form where users can enter data but for a few...
1
by: New User | last post by:
I have a xml file for datasource.e.g <Persons> <Person> <Name>User1</Name> <State>NJ</State> </Person> <Person> <Name>User2</Name> <State>WA</State> </Person>
3
by: TS | last post by:
Hi all, In my windows form, I need the user to select a client name from a combo box and click on a button that opens another form having CRViewer showing the data for that client selected. I...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
2
by: Brian Henry | last post by:
say i have a dataset called dv and i have a boolean value i want to filter by "b_DoesWork" while the column name in the data view that i want to filter on is called "Works" how would i filter...
3
by: Shawn Ramirez | last post by:
As with most web applications speed is a huge deal to me in my applications. My customers don't really care if my app is a true 3 tier application or not, they just want it to be faster then it was...
5
by: AtCor | last post by:
SELECT , Date, , Time FROM (SELECT ISNULL(t9., t8.) AS , ISNULL(t9.Date, t8.Date) AS Date, ISNULL(t9.Rows, t8.Rows) AS Rows, c., c.Time, ROW_NUMBER() OVER (PARTITION BY ISNULL(t9., t8.),...
6
by: nairda | last post by:
Hi there, I need help processing data from Excel in VB. I have a MSHFlexgrid to show data extracted from Excel. I'm able to show a range of cells from Excel table to my Flexgrid, but that's it. The...
3
by: Toshi Trivedi | last post by:
Hi, I am using a data grid which is filled up with the data from the table. I have given two choices to the user. One a combobox is given having four columns in the list from which user can select...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.