Jump to content

newphpcoder

Members
  • Posts

    254
  • Joined

  • Last visited

Everything posted by newphpcoder

  1. Hi, It's my first time to used foreach loop to display data from database and also used foreach loop to display textboxes Now, I felt difficulties in saving data from the textboxes displayed by foreach. Here is my code: <html> <head> </head> <body> <form name="operator_report" action="" method="post" autocomplete="off"> <?php ob_start(); include "connection.php"; $save = isset($_POST['save']); //insert data to database if($save) { $compound_type = $_POST['compound_type']; $op_output = $_POST['output']; $c_output = $_POST['output']; $reject_type[] = $_POST['reject_type']; $reject[] = $_POST['reject']; for($s = 0; $s < count($compound_type) ; $s++) { //---save operators output to op_output, in this part i don't have problem in saving the data saved correctly if ($op_output[$s] !="") { $sql = "INSERT INTO op_output (op_number, process_id, shift_id, shift_date, shift_type, compound_type, compound_output) VALUES ('001', '4', '1','2013-07-16', '1', '$compound_type[$s]', '$op_output[$s]')"; $result = mysql_query($sql, $con); } //---this part I need help in saving reject. //---I guess i have the problem here in looping ... //---this code did not work.. for($i = 0; $i < count($reject_type[$s]) ; $i++) { if($reject[$i] != "") { $sql_re = "INSERT INTO op_reject (op_number, compound_type, reject_type, reject) VALUES ('001','$compound_type[$s]', '$reject_type[$i]', '$reject[$i]')"; $result_re = mysql_query($sql_re, $con); } } } } $id = 'Final Mix'; if($id == 'Final Mix') { echo "<fieldset>"; echo "<legend><H1> Operator's Output and Reject</H1></legend>"; echo "<table>"; echo "<tr>"; echo "<th>Compound</th>"; echo "<th>Output</th>"; //query to select reject acronym $sql = "select r.reject_acro, r.reject_id from process_list AS p LEFT JOIN reject_list AS r ON p.reject_id = r.reject_process_id where p.process_name LIKE '" .$id. "%'"; $rsd = mysql_query($sql); while($rs = mysql_fetch_assoc($rsd)) { $reject[] = $rs['reject_acro']; $reject_id[] = $rs['reject_id']; } if(empty($reject)) { echo""; } else { //display reject acronym as header foreach ($reject as $reject) { echo "<th style='border:none;'><input type='text' name='reject_type[]' id='reject_type' value='$reject' style='border:none; font-weight: bold; ' size='5'></th>"; } echo "</tr>"; } //query select compound_type $sql_comp = "SELECT compound_id, compound_type FROM compound_list ORDER BY compound_type ASC"; $res = mysql_query($sql_comp); echo "<tr>"; while($comp = mysql_fetch_assoc($res)){ $compound_type = $comp['compound_type']; //---display compound_type echo "<td style='border:none;'><input type='text' name='compound_type[]' id='compound_type' value='$compound_type' style='border:none;' size='10'readonly='readonly'></td>"; //---input box for output echo "<td style='border:none;'><input type='text' name='output[]' id='output' value='' size='7'></td>"; //----i used foreach to loop textbox in every reject acronym. foreach($reject_id AS $reject) { echo "<td style='border:none;'><input type='text' name='reject[]' id='reject' value='' size='7'></td>"; } echo "</tr>"; } echo "</table>"; echo "</fieldset>"; } ?> <input type="submit" name="save" id="save" value="Save"> </form> </body> </html> I also attached my sample output screenshots and the database. Here is the sample scenario. Compound Type---Output---SC---SP---SH--- P28--------------10-------------1-----2 P32--------------20--------5--------------- P32NW--------------------------3---------- I need to save data on op_reject like this: op_number---compound_type----reject_type---reject 001----------P28---------------SP------------1 001----------P28---------------SH------------2 001----------P32---------------SC------------5 001----------P32NW------------SP------------3 Sad to say in my code in saving using forloop it did not work. I post it because i am hoping somebody can help me, but I also tried my best to fixed this. Any help is highly appreciated. Thank you so much. sample.zip
  2. Hi, I have data: shift_id = 1---2---3---4---5 compound_output = 5---10--20--50--10 process_id = 7 compound_type = P28 and now I need to create a query that sum the value of (1+3+(5/ 2)) and (2+4+(5/ 2)) here is my query: SELECT process_id, compound_type, CASE WHEN (shift_id IS NOT NULL AND (shift_id = 1 OR shift_id = 3 OR shift_id = 5)) THEN SUM((compound_output)/2) when (shift_id IS NOT NULL AND (shift_id = 2 OR shift_id = 4 OR shift_id = 5)) THEN SUM((compound_output)/2) END AS val FROM op_output WHERE process_id = 7 and compound_type = 'P28' HAVING val IS NOT NULL and the output of this is: val = 47.500000 but it should be: 7---P28--30 7---P28--65 Thank you so much.. I hope somebody can help me to get the correct values. Thank you so much.
  3. Hi, I have form that displaying report per week. First thing to do is choose what week then automatically display the date/shift that week ranges. here is my weekly_report.php <?php error_reporting(0); session_start(); ob_start(); date_default_timezone_set("Asia/Singapore"); include('connection.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <title>Weekly Report</title> <head> <link rel="stylesheet" type="text/css" href="op_report.css" /> <script type="text/javascript" src="jquery.js"></script> <script type='text/javascript' src='jquery.autocomplete.js'></script> <link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" /> <script type="text/javascript"> //----auto complete week--// $().ready(function() { $("#week_selected").autocomplete("get_week_list.php", { width: 115, matchContains: true, mustMatch: true, selectFirst: false }); $("#week_selected").result(function(event, data, formatted) { $("#week_number").val(data[1]); }); }); /*AJAX*/ function AJAX(){ var xmlHttp; try{ xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari return xmlHttp; } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer return xmlHttp; } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); return xmlHttp; } catch (e){ alert("Your browser does not support AJAX!"); return false; } } } } //-----get weekdata from week---// function getweekdata() { // if (window.event.keyCode==13 || window.event.keyCode==10) { divid = "week_data"; var url = "get_weekly_data.php"; var str = "id=" + document.getElementById("week_number").value; var xmlHttp = AJAX(); xmlHttp.onreadystatechange = function(){ if(xmlHttp.readyState > 0 && xmlHttp.readyState < 4){ // document.getElementById(divid).innerHTML=loadingmessage; } if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { var jsonart = xmlHttp.responseText; document.getElementById(divid).innerHTML = jsonart; } } } xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp.setRequestHeader("Content-length", str.length); xmlHttp.setRequestHeader("Connection", "close"); xmlHttp.send(str); // } } </script> </head> <body onload=document.getElementById("week_selected").focus();> <form name="weekly_report" action="" method="post"> <div id="ddcolortabs"> <ul> <li> <a href="index.php" title="Operator's Shift Report"><span>Operator's Shift Report</span></a></li> <li id="current"> <a href="weekly_report.php" title="Reports"><span>Reports</span></a></li> </ul> </div> <br/> <div> <table> <tr> <td style="border: none;">Type Week:</td> <td><input type="text" name="week_selected" id="week_selected" value="" size="15" onkeyup="getweekdata();"></td> </tr> </table> </div> <input type="hidden" name="week_number" id="week_number"> <div id='week_data'> </div> </form> </body> </html> //get_week_list.php <?php ob_start(); include "connection.php"; $q = strtolower($_GET["q"]); if ($q == '') { header("HTTP/1.0 404 Not Found", true, 404); } //else (!$q) return; else{ $sql = "select week_id, week_number from week_list where week_number LIKE '$q%'"; $rsd = mysql_query($sql); $cnt = mysql_num_rows($rsd); if($cnt > 0) { while($rs = mysql_fetch_array($rsd)) { $pid = $rs['week_id']; $pname = $rs['week_number']; echo "$pname|$pid\n"; } } else { header("HTTP/1.0 404 Not Found", true, 404); } } ?> and here is my get_weekly_data.php // which display the data for that week. <?php ob_start(); include "connection.php"; if($_POST["id"]) { $sql = "select r.report_date, s.shift_type FROM op_reports AS r, shift_list AS s WHERE WEEK(report_date) + 1 = '" . ($_POST["id"]) . "' GROUP BY shift_type ORDER BY shift_id ASC"; $res = mysql_query($sql); echo "<table>"; echo "<tr>"; echo "<th>Comp</th>"; while($row = mysql_fetch_assoc($res)) { $report_date = $row['report_date']; $report_shift = $row['shift_type']; echo "<th>$report_date/$report_shift</th>"; } echo "</tr>"; $sql_r = "select r.report_date, s.shift_type FROM op_reports AS r, shift_list AS s WHERE WEEK(report_date) + 1 = '" . ($_POST["id"]) . "' GROUP BY shift_type ORDER BY shift_type DESC"; $res_r = mysql_query($sql_r); echo "<tr>"; echo "<th></th>"; while($r = mysql_fetch_assoc($res_r)){ echo "<th>Output</th>"; } echo "</tr>"; $sql_comp = "SELECT DISTINCT p.process_name , r.process_id, r.report_shift FROM op_reports AS r JOIN process_list AS p ON (p.process_id = r.process_id) WHERE WEEK(report_date) + 1 = '" . ($_POST["id"]) . "' GROUP BY process_name ORDER BY p.process_name ASC"; $res_comp = mysql_query($sql_comp); echo "<tr>"; while($row_comp = mysql_fetch_assoc($res_comp)) { $process = $row_comp['process_name']; $process_id = $row_comp['process_id']; echo "<td>$process</td>"; $comp = "SELECT DISTINCT o.compound_type, o.process_id, o.shift_date FROM op_output AS o WHERE process_id = '$process_id' GROUP BY o.shift_id, compound_type ORDER BY compound_type ASC"; $c = mysql_query($comp); echo "<tr>"; while($co = mysql_fetch_assoc($c)) { $compound_type = $co['compound_type']; $process_i = $co['process_id']; $shift_date = $co['shift_date']; echo "<td>$compound_type</td>"; $sql_output = "SELECT DISTINCT o.compound_type, SUM(o.compound_output) AS compound_output, o.process_id, o.shift_id, o.shift_date FROM op_output AS o WHERE process_id = '$process_id' AND o.compound_type = '$compound_type' GROUP BY o.shift_id, o.shift_date, compound_type ORDER BY o.shift_id ASC"; $res_output = mysql_query($sql_output); while($row_output = mysql_fetch_assoc($res_output)) { $compound_output = $row_output['compound_output']; $shift = $row_output['shift_id']; $compound = $row_output['compound_type']; $date = $row_output['shift_date']; if($shift == 1 && $date == $shift_date) { echo"<td>$compound_output</td>"; } else { echo "<td></td>"; } if($shift == 2 && $date == $shift_date) { echo"<td>$compound_output</td>"; } else { echo "<td></td>"; } if($shift == 3 && $date == $shift_date) { echo"<td>$compound_output</td>"; } else { echo "<td></td>"; } if($shift == 4 && $date == $shift_date) { echo"<td>$compound_output</td>"; } else { echo "<td></td>"; } if($shift == 5 && $date == $shift_date) { echo"<td>$compound_output</td>"; } else { echo "<td></td>"; } } echo "</tr>"; } } echo "</tr>"; echo "</table>"; } ?> I attached my sample screenshots that display by this code and also a format that I need to display and the database. My problem now is on displaying of output per date/shift. It's been todays that I tried to fixed this. I hope somebody can help me. Thank you so much sample updated.zip
  4. Hi.. I have 2 tables for week and calendar days. first I have so_week fields: from_week to_week second is calendar_days fields: month_name working_days sample data: from_week : 33 to_week: 36 month_name: Jan Feb Mar Apr May and so on working_days: 23 22 25 25 23 now I need to get the working days based on from_week to week for example from 33 to 36 the month is aug, sep, sep, sep i need to get the working days for that month. any help is highly appreciated.. Thank you so much
  5. Theirs a data output but not my expected output. Thank you
  6. Hi.. I have problem in my select query statement with case statement to compute the qty and I tried evetything to resolved my problem. here is my query: first I tried the requirement qty is less than in balance qty. @rqty = requirement qty @q= balalce qty set @t = 0; set @rqty = 900; set @r = 563; set @q = 966; SELECT SUBSTR(d.LOT_CODE, 9,4) as pcode, d.LOT_CODE as code, d.OUTPUT_QTY, d.DATE_ENTRY, CASE WHEN d.LOT_CODE = j.lotcode AND @rqty > j.bal_qty THEN j.bal_qty WHEN d.LOT_CODE = j.lotcode AND @rqty < j.bal_qty THEN @rqty WHEN @rqty < @t + d.OUTPUT_QTY THEN (@rqty - @q) WHEN @t+d.OUTPUT_QTY > @rqty THEN (@rqty - @q) ELSE d.OUTPUT_QTY END as qty, @t := @t + d.OUTPUT_QTY as cumulative FROM dipping_dump d, dependency c, jo_last j WHERE NOT EXISTS (SELECT j.lotcode, j.pcode FROM jo_dump j WHERE j.lotcode = d.LOT_CODE AND j.pcode = SUBSTR(d.LOT_CODE, 9,4) AND j.qty = d.OUTPUT_QTY) AND c.LOT_CODE = d.LOT_CODE AND c.DATE_ENTRY = d.DATE_ENTRY AND c.TERMINAL_ID = '5' AND c.ACTIVE = '1' AND SUBSTR(d.LOT_CODE, 9,4) = 'P35' AND (@t < @rqty) AND j.STATUS = '1' ORDER BY d.DATE_ENTRY ASC; I attached the sample image output. I got a problem when the requirement qty is less than output qty and greater balance qty. I hope this time someone can understand and help me. Thank you so much..
  7. Hi... I need to get data from two tables but i need to based first on jo_last to check if theirs an bal_qty so that I need to get first the bal_qty before I get the output qty from dipping_dump table to get my req qty. here is my query where the rqty is > OUTPUT_QTY : set @t = 0; set @rqty =2401; set @r = 563; set @q = 966; SELECT SUBSTR(d.LOT_CODE, 9,4) as pcode, d.LOT_CODE as code, d.OUTPUT_QTY, d.DATE_ENTRY, CASE WHEN d.LOT_CODE = j.lotcode AND @rqty > j.bal_qty THEN j.bal_qty WHEN d.LOT_CODE = j.lotcode AND @rqty < j.bal_qty THEN @rqty WHEN @t+d.OUTPUT_QTY > @rqty THEN (@rqty - @q) WHEN d.LOT_CODE = j.lotcode AND @rqty > j.bal_qty AND @rqty < d.OUTPUT_QTY THEN j.bal_qty ELSE d.OUTPUT_QTY END as qty, @t := @t + d.OUTPUT_QTY as cumulative FROM dipping_dump d, dependency c, jo_last j WHERE NOT EXISTS (SELECT j.lotcode, j.pcode FROM jo_dump j WHERE j.lotcode = d.LOT_CODE AND j.pcode = SUBSTR(d.LOT_CODE, 9,4) AND j.qty = d.OUTPUT_QTY) AND c.LOT_CODE = d.LOT_CODE AND c.DATE_ENTRY = d.DATE_ENTRY AND c.TERMINAL_ID = '5' AND c.ACTIVE = '1' AND SUBSTR(d.LOT_CODE, 9,4) = 'P35' AND (@t < @rqty) AND j.STATUS = '1' ORDER BY d.DATE_ENTRY ASC; in this example the output is correct: pcode----code-------------OUTPUT_QTY-DATE_ENTRY------------qty-----cumulative P35------ 10172710P35- 2000.00-------2012-07-11 09:46:18-966.00-2000.00 P35------ 027723883P35-2000.00------2012-07-11 09:46:44-1435----2000.00 this output is correct this code : 10172710P35 has a balance 966.00 so right that i get first this 966 in jo_last and the lack i get in dipping_dump to get the total req qty 2401. and here is the sample where the rqty is < to bal_qty set @t = 0; set @rqty =900; set @r = 563; set @q = 966; SELECT SUBSTR(d.LOT_CODE, 9,4) as pcode, d.LOT_CODE as code, d.OUTPUT_QTY, d.DATE_ENTRY, CASE WHEN d.LOT_CODE = j.lotcode AND @rqty > j.bal_qty THEN j.bal_qty WHEN d.LOT_CODE = j.lotcode AND @rqty < j.bal_qty THEN @rqty WHEN @t+d.OUTPUT_QTY > @rqty THEN (@rqty - @q) WHEN d.LOT_CODE = j.lotcode AND @rqty > j.bal_qty AND @rqty < d.OUTPUT_QTY THEN j.bal_qty ELSE d.OUTPUT_QTY END as qty, @t := @t + d.OUTPUT_QTY as cumulative FROM dipping_dump d, dependency c, jo_last j WHERE NOT EXISTS (SELECT j.lotcode, j.pcode FROM jo_dump j WHERE j.lotcode = d.LOT_CODE AND j.pcode = SUBSTR(d.LOT_CODE, 9,4) AND j.qty = d.OUTPUT_QTY) AND c.LOT_CODE = d.LOT_CODE AND c.DATE_ENTRY = d.DATE_ENTRY AND c.TERMINAL_ID = '5' AND c.ACTIVE = '1' AND SUBSTR(d.LOT_CODE, 9,4) = 'P35' AND (@t < @rqty) AND j.STATUS = '1' ORDER BY d.DATE_ENTRY ASC; and the output is correct: pcode----code-------------OUTPUT_QTY-DATE_ENTRY------------qty-----cumulative P35------ 10172710P35- 2000.00-------2012-07-11 09:46:18-900.00-2000.00 as you can see same query i only change the rqty to check if the output is correct. but when i tried this: set @t = 0; set @rqty =1501; set @r = 563; set @q = 966; SELECT SUBSTR(d.LOT_CODE, 9,4) as pcode, d.LOT_CODE as code, d.OUTPUT_QTY, d.DATE_ENTRY, CASE WHEN d.LOT_CODE = j.lotcode AND @rqty > j.bal_qty THEN j.bal_qty WHEN d.LOT_CODE = j.lotcode AND @rqty < j.bal_qty THEN @rqty WHEN @t+d.OUTPUT_QTY > @rqty THEN (@rqty - @q) WHEN d.LOT_CODE = j.lotcode AND @rqty > j.bal_qty AND @rqty < d.OUTPUT_QTY THEN j.bal_qty ELSE d.OUTPUT_QTY END as qty, @t := @t + d.OUTPUT_QTY as cumulative FROM dipping_dump d, dependency c, jo_last j WHERE NOT EXISTS (SELECT j.lotcode, j.pcode FROM jo_dump j WHERE j.lotcode = d.LOT_CODE AND j.pcode = SUBSTR(d.LOT_CODE, 9,4) AND j.qty = d.OUTPUT_QTY) AND c.LOT_CODE = d.LOT_CODE AND c.DATE_ENTRY = d.DATE_ENTRY AND c.TERMINAL_ID = '5' AND c.ACTIVE = '1' AND SUBSTR(d.LOT_CODE, 9,4) = 'P35' AND (@t < @rqty) AND j.STATUS = '1' ORDER BY d.DATE_ENTRY ASC; the output is: pcode----code-------------OUTPUT_QTY-DATE_ENTRY------------qty-----cumulative P35------ 10172710P35- 2000.00-------2012-07-11 09:46:18-966.00-2000.00 and this correct but lack of output. it should be: pcode----code-------------OUTPUT_QTY-DATE_ENTRY------------qty-----cumulative P35------ 10172710P35- 2000.00-------2012-07-11 09:46:18-966.00-2000.00 P35------ 027723883P35-2000.00------2012-07-11 09:46:44-535----2000.00 to get the 1501 rqty. I tried to fix it, yet the output is wrong so I decided to post my problem in forum. Any help is highly appreciated. Thank you so much
  8. Hi.. Now, I have select query with if condition, that if null the table data <td> will have background-color : red here is my code: $sql = "SELECT DISTINCT IF(ISNULL(a.LOG_IN), 'rdc', '') AS LOGIN_CLASS, IF(ISNULL(a.LOG_OUT), 'rdc', '') AS LOGOUT_CLASS, a.EMP_ID, a.LOG_IN, a.LOG_OUT, CONCAT(LNAME, ',' , FNAME, ' ', MI, '.') AS FULLNAME FROM hrdb.attendance AS a JOIN hris.employment em ON (a.EMP_ID = em.EMP_NO AND em.STATUS = 'Reg Operatives') JOIN hris.personal AS p ON p.EMP_ID = em.EMP_ID WHERE ATTENDANCE_DATE BETWEEN '2012-06-01' AND '2012-06-15' OR ATTENDANCE_DATE = '0000-00-00' OR ISNULL(a.LOG_IN) OR ISNULL(a.LOG_OUT) ORDER BY FULLNAME, a.LOG_IN, a.LOG_OUT"; $DTR = $conn3->GetAll($sql); $smarty->assign('attendance', $DTR); .rdc {background-color:#ff0000;} {section name=att loop=$attendance} <table> <tr> <td colspan="2" class="{$attendance[att].LOGIN_CLASS}">{$attendance[att].LOG_IN}</td> <td colspan="2" class="{$attendance[att].LOGOUT_CLASS}">{$attendance[att].LOG_OUT}</td> {sectionelse} <tr><td colspan="1">No DATA</td></tr> {/section} Now.. I need to revise my select if condition, because now the LOG_IN and LOG_OUT has no possibilities to have NULL values but now It will have 0000-00-00 00:00:00 values. So I need to put background color if the LOG_IN is 0000-00-00 00:00:00 also with LOG_OUT. Thank you so much
  9. Hi.. I have 2 tables with Cloth column. sales_order table Cloth -column sample data of Cloth 3392 3520 3392 Yellow/White 3392 BLUE 3392 RED 3392 Orange cloth_parameter - table Cloth -column sample Cloth 3392N 3520 3392Yellow/White 3392 Blue 3392 Red 3392Orange How can I equal the two data eventhough the format of data has difference using like. Thank you
  10. Thank you for your suggested links, but sorry, it's a jquery and I also dont have any idea about jquery, my goal today is to resolve this problem that I encountered. Thank you so much. I think my issue is on how can I get using ajax the value of selected option. Thank you
  11. Hi... It's my first time to use ajax and I used it to get the bin_loc per lot_number where I choose in select option per ItemCode. And now I get the bin_loc but the problem is I only get the bin_loc of the first select option the rest was not. Here is my code of PickingForm.php <?php session_start(); error_reporting(0); date_default_timezone_set("Asia/Singapore"); //set the time zone $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); $Date_Shelve =date('Y-m-d H:i:s'); ?> <html> <title>Picking</title> <head> <link href="kanban.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> var xmlhttp; // Give the function a unique name, this is what your HTML will call to run the AJAX function select_code() { // This is all just setting up the variable, ignore it if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { //alert(xmlhttp.responseText); // alert(xmlhttp.readyState+" "+xmlhttp.status); // alert(xmlhttp.readyState+" "+xmlhttp.status); document.getElementById("bin_loc").innerHTML = xmlhttp.responseText; //var mydata=xmlhttp.responseText; } }; var val = document.getElementById("lot_number"); var lot_number = val.options[val.selectedIndex].text; //alert(lot_number); var parameters = "lot_number=" + lot_number; xmlhttp.open("POST", "PickingFormTest.php", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(parameters); //var mydata=xmlhttp.responseText; } </script> </head> <body> <div id="SR_date"> <label>Date :</label> <input type="text" name="date_pick" value="<?php echo $Date_Shelve; ?>" size="16" readonly="readonly" style="border: none;"> </div> <div id="Picking"> <?php $sr_num_ = $_POST['sr_num_']; //$sql = "SELECT sr_number " $sql = "SELECT sr_number, Items, DemandedQty, uom FROM sr_main WHERE sr_number = '$sr_num_'"; $res_sr_main = mysql_query($sql, $con); $row_num = mysql_num_rows($res_sr_main); if($row_num > 0){ while($row_sr_main = mysql_fetch_assoc($res_sr_main)){ $sr_number_ = $row_sr_main['sr_number']; $items = $row_sr_main['Items']; $demandedqty = $row_sr_main['DemandedQty']; $uom = $row_sr_main['uom']; echo "<label> SR # :</label>"; echo "<input type='text' readonly='readonly' style='border:none;' id='sr_number_' name='sr_number_' value='$sr_number_'>"; echo "<table>"; echo "<th>Items</th> <th> Item Code </th> <th> Demanded Qty </th> <th> UoM </th> <th> Description </th> <th> Lot Number </th> <th> Bin Location </th> <th> Picked By </th> <th> Approved</th>"; echo "<tr> <td>$items</td> <td></td> <td style='text-align:right;'>$demandedqty</td> <td>$uom</td> </tr>"; $sql_sub = "SELECT s.sr_number, s.Items, s.ItemCode, s.SubQty, s.UoM, s.Description FROM sr_submain s WHERE s.sr_number = '$sr_num_' and s.Items = '$items' AND NOT EXISTS(SELECT w.stock_item FROM wms w WHERE s.ItemCode = w.stock_item AND w.sr_number = s.sr_number AND (w.qty_withdraw !='0.00' OR w.qty_withdraw = 'NULL'))"; $res_sub = mysql_query($sql_sub, $con); while($row_sub = mysql_fetch_assoc($res_sub)){ echo "<form name='picking_lotnum' action='PickingForm.php?sr_num_=".$sr_num_."' method='POST' enctype='multipart/form-data' target='_self'>"; $sr_num = $row_sub['sr_number']; $Items = $row_sub['Items']; $ItemCode = $row_sub['ItemCode']; $SubQty = $row_sub['SubQty']; $UoM = $row_sub['UoM']; $Description = $row_sub['Description']; $query = "SELECT lot_number from wms WHERE (date_shelve IS NOT NULL) AND stock_item = '$ItemCode' AND (qty = orig_qty OR qty != '0.00') AND qty >= '$SubQty' ORDER BY qty"; $rows = mysql_query($query, $con); echo "<tr> <td></td> <td><input type='text' name='ItemCode' id='ItemCode' value='$ItemCode' readonly='readonly' style='border:none;font-family: Arial, Helvetica, sans-serif; font-size: .9em;'></td> <td><input type='text' name='SubQty' id='SubQty' value='$SubQty' readonly = 'readonly' style='border:none; text-align:right;font-family: Arial, Helvetica, sans-serif; font-size: .9em;'></td> <td>$UoM</td> <td>$Description</td>"; echo "<td><select name = 'lot_number' id='lot_number' onChange='select_code();'>"; echo "<option></option>"; while ($record = mysql_fetch_array($rows)) { echo "<option value = '{$record['lot_number']}'"; if ($lot_number == $record['lot_number']) echo "selected = 'selected'"; echo ">{$record['lot_number']}</option>"; } echo "</select>"; echo "</td>"; echo "<td id='bin_loc'></td>"; echo "<td> <input type='text' name='picked_by' id='picked_by' size='20' value=''> </td>"; echo "<td><input type='submit' name='priority' value='Approved' id='priority'></td>"; echo "</tr>"; echo "<input type='hidden' name='date_pick' value='$Date_Shelve' size='16' style='border: none;'>"; echo "<input type='hidden' readonly='readonly' style='border:none;' id='sr_num_' name='sr_num_' value='$sr_number_'>"; echo "</form>"; } } } echo "</table>"; echo "</div>"; ?> </body> </html> and here is the PickingFormTest.php <?php session_start(); error_reporting(0); date_default_timezone_set("Asia/Singapore"); //set the time zone $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); $lot_number = $_POST['lot_number']; //echo $lot_number; // $q=$_GET["lot_number"]; $sql_bin = "SELECT bin_loc FROM wms WHERE lot_number = '$lot_number'"; $res_bin = mysql_query($sql_bin, $con); while($row_bin = mysql_fetch_assoc($res_bin)){ $bin_loc = $row_bin['bin_loc']; echo "<input type='text' value='$bin_loc' id='bin_loc'>"; } ?> I attach the sample form Thank you so much
  12. Hi.. It's my first time to use ajax, and now I used ajax to get the value from select option then use that value. here is my ajax code: <script type="text/javascript"> var xmlhttp; // Give the function a unique name, this is what your HTML will call to run the AJAX function select_code() { // This is all just setting up the variable, ignore it if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { //alert(xmlhttp.responseText); // alert(xmlhttp.readyState+" "+xmlhttp.status); document.getElementById("rows").innerHTML = xmlhttp.responseText; //var mydata=xmlhttp.responseText; } }; var val = document.getElementById("lot_number"); var lot_number = val.options[val.selectedIndex].text; var parameters = "lot_number=" + lot_number; xmlhttp.open("POST", "PickingForm.php", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(parameters); //var mydata=xmlhttp.responseText; } </script> nad here is my PickingForm.php where the select option was in. $query = "SELECT lot_number from wms WHERE (date_shelve IS NOT NULL) AND stock_item = '$ItemCode' AND (qty = orig_qty OR qty != '0.00') AND qty >= '$SubQty' ORDER BY qty"; $rows = mysql_query($query, $con); echo "<td><select name = 'lot_number' id='lot_number' onChange='select_code();'>"; //echo "<select name='lot_number' id='lot_number' onchange='MM_jumpMenu('parent',this,0)'>"; echo "<option></option>"; while ($record = mysql_fetch_array($rows)) { echo "<option value = '{$record['lot_number']}'"; if ($lot_number == $record['lot_number']) echo "selected = 'selected'"; echo ">{$record['lot_number']}</option>"; } echo "</select>"; echo "</td>"; $lot_number = $_POST['lot_number']; $sql_bin = "SELECT bin_loc FROM wms WHERE lot_number = '$lot_number'"; $res_bin = mysql_query($sql_bin, $con); while($row_bin = mysql_fetch_assoc($res_bin)){ $bin_loc = $row_bin['bin_loc']; echo "<td><input type='text' name='bin_loc' id='bin_loc' value='$bin_loc'></td>"; } and when I select lot_code in select option: I got an error: document.getElementById() is null or not an object... I don't know how can I solve this error:( Thank you
  13. Thank you.. I don't know about ajax can you help me:( Thank you
  14. how can I do that?can you give me a example: here is my whole code: <?php session_start(); error_reporting(0); date_default_timezone_set("Asia/Singapore"); //set the time zone $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); $Date_Shelve =date('Y-m-d H:i:s'); ?> <html> <title>Picking</title> <head> <link href="kanban.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> function getText(){ var x=document.getElementById("lot_number") //alert(x.options[x.selectedIndex].text); var lot_number = (x.options[x.selectedIndex].text); document.picking_form.action="PickingForm.php?lot_number="+lot_number; document.picking_form.submit(); } </script> </head> <body> <?php $Approved = isset($_POST['priority']); if ($Approved) { $lot_number = $_POST['lot_number']; $sr_num_ = $_POST['sr_num_']; $SubQty = $_POST['SubQty']; $ItemCode = $_POST['ItemCode']; $picked_by = $_POST['picked_by']; $date_pick = $_POST['date_pick']; $sql = "SELECT stock_item, qty FROM wms WHERE stock_item = '" . $ItemCode . "' AND lot_number = '" . $lot_number . "'"; $res = mysql_query($sql, $con) or die( "Query : [$sql]<br/>\nError : ". mysql_error($con)); $row = mysql_fetch_assoc($res); $stock_item = $row['stock_item']; $qty = $row['qty']; if($qty >= $SubQty){ $output = $qty - $SubQty; $qty_withdraw = '0.00'; } else{ $output = '0.00'; $qty_withdraw = $SubQty - $qty; } $sql_up = "UPDATE wms SET qty = '$output', sr_number = '$sr_num_', picked_by = '$picked_by', qty_withdraw = '$qty_withdraw', date_pick = '$date_pick' WHERE lot_number = '$lot_number' AND stock_item = '$ItemCode'"; //echo $sql_up; //exit; $res_up = mysql_query($sql_up, $con) or die( "Query : [$sql_up]<br/>\nError : ". mysql_error($con)); } else{ } ?> <div id="SR_date"> <label>Date :</label> <input type="text" name="date_pick" value="<?php echo $Date_Shelve; ?>" size="16" readonly="readonly" style="border: none;"> </div> <div id="Picking"> <!--<label class="LLabellot">Select SR # :</label>--> <?php $sr_num_ = $_POST['sr_num_']; $sql = "SELECT sr_number, Items, DemandedQty, uom FROM sr_main WHERE sr_number = '$sr_num_'"; $res_sr_main = mysql_query($sql, $con); $row_num = mysql_num_rows($res_sr_main); if($row_num > 0){ while($row_sr_main = mysql_fetch_assoc($res_sr_main)){ $sr_number_ = $row_sr_main['sr_number']; $items = $row_sr_main['Items']; $demandedqty = $row_sr_main['DemandedQty']; $uom = $row_sr_main['uom']; echo "<label> SR # :</label>"; echo "<input type='text' readonly='readonly' style='border:none;' id='sr_number_' name='sr_number_' value='$sr_number_'>"; echo "<table>"; echo "<th>Items</th> <th> Item Code </th> <th> Demanded Qty </th> <th> UoM </th> <th> Description </th> <th> Lot Number </th> <th> Bin Location </th> <th> Picked By </th> <th> Approved</th>"; echo "<tr> <td>$items</td> <td></td> <td style='text-align:right;'>$demandedqty</td> <td>$uom</td> </tr>"; $sql_sub = "SELECT s.sr_number, s.Items, s.ItemCode, s.SubQty, s.UoM, s.Description FROM sr_submain s WHERE s.sr_number = '$sr_num_' and s.Items = '$items' AND NOT EXISTS(SELECT w.stock_item FROM wms w WHERE s.ItemCode = w.stock_item AND w.sr_number = s.sr_number AND (w.qty_withdraw !='0.00' OR w.qty_withdraw = 'NULL'))"; $res_sub = mysql_query($sql_sub, $con); while($row_sub = mysql_fetch_assoc($res_sub)){ echo "<form name='picking_lotnum' action='PickingForm.php?sr_num_=".$sr_num_."' method='POST'>"; $sr_num = $row_sub['sr_number']; $Items = $row_sub['Items']; $ItemCode = $row_sub['ItemCode']; $SubQty = $row_sub['SubQty']; $UoM = $row_sub['UoM']; $Description = $row_sub['Description']; $query = "SELECT lot_number from wms WHERE (date_shelve IS NOT NULL) AND stock_item = '$ItemCode' AND (qty = orig_qty OR qty != '0.00') AND qty >= '$SubQty' ORDER BY qty"; $rows = mysql_query($query, $con); echo "<tr> <td></td> <td><input type='text' name='ItemCode' id='ItemCode' value='$ItemCode' readonly='readonly' style='border:none;font-family: Arial, Helvetica, sans-serif; font-size: .9em;'></td> <td><input type='text' name='SubQty' id='SubQty' value='$SubQty' readonly = 'readonly' style='border:none; text-align:right;font-family: Arial, Helvetica, sans-serif; font-size: .9em;'></td> <td>$UoM</td> <td>$Description</td>"; echo "<td><select name = 'lot_number' id='lot_number'>"; echo "<option></option>"; while ($record = mysql_fetch_array($rows)) { echo "<option value = '{$record['lot_number']}'"; if ($lot_number == $record['lot_number']) echo "selected = 'selected'"; echo ">{$record['lot_number']}</option>"; } echo "</select>"; echo "</td>"; $lot_number = $_POST[lot_number]; $sql_bin = "SELECT bin_loc FROM wms WHERE lot_number = '$lot_number'"; $res_bin = mysql_query($sql_bin); $row_bin = mysql_fetch_assoc($res_bin); $bin_loc = $row_bin['bin_loc']; echo $bin_loc; echo "<td>$bin_loc</td>"; //echo "<td>$bin_loc</td>"; echo "<td> <input type='text' name='picked_by' id='picked_by' size='20' value=''> </td>"; // echo "<td><input type='checkbox' name='chk_[]' value='$ItemCode' onclick = 'chk();' id='chk_'></td> echo "<td><input type='submit' name='priority' value='Approved' id='priority'></td>"; echo "</tr>"; echo "<input type='hidden' name='date_pick' value='$Date_Shelve' size='16' style='border: none;'>"; echo "<input type='hidden' readonly='readonly' style='border:none;' id='sr_num_' name='sr_num_' value='$sr_number_'>"; echo "</form>"; } } } echo "</table>"; echo "</div>"; ?> </body> </html> Thank you so much.. I tried this: if(isset($_POST['lot_number'])) { $lot_number=mysql_real_escape_string($_POST['lot_number']); echo $lot_number; $sql_bin = "SELECT bin_loc FROM wms WHERE lot_number = '$lot_number'"; echo $sql; $res_bin = mysql_query($sql_bin, $con); $row_bin = mysql_fetch_assoc($res_bin); $bin_loc = $row_bin['bin_loc']; echo $bin_loc; but no output display Thank you
  15. Hi.. I have a select option where the data came from database and I use php codes for displaying the data to select option. And it works, now I need to display bin_loc base on what lot_number that I choose. I want to happen is after I choose lot number the bin_loc for that lot_number will also displayed. here is my code in displaying lot_number: $query = "SELECT lot_number from wms WHERE (date_shelve IS NOT NULL) AND stock_item = '$ItemCode' AND (qty = orig_qty OR qty != '0.00') AND qty >= '$SubQty' ORDER BY qty"; $rows = mysql_query($query, $con); echo "<td><select name = 'lot_number' id='lot_number'>"; echo "<option></option>"; while ($record = mysql_fetch_array($rows)) { echo "<option value = '{$record['lot_number']}'"; if ($lot_number == $record['lot_number']) echo "selected = 'selected'"; echo ">{$record['lot_number']}</option>"; } echo "</select>"; echo "</td>"; now I need to display bin_loc in <td></td> after the lot_number; I tried this: $sql = "SELECT bin_loc FROM wms WHERE lot_number = '$lot_number'"; but it did not work cause I can get the value of option that I selected. I hope someone can Help in automatically displaying bin_loc. Thank you so much
  16. The value of $ItemCode = 'MAT-CHE-0040' <td><input type='text' name='ItemCode' id='ItemCode' value='$ItemCode' readonly='readonly' style='border:none;'></td> I also tried this: $sql = "SELECT stock_item, qty FROM wms WHERE stock_item = '" . $ItemCode . "' AND lot_number = '" . $lot_number . "'"; Still same error Thank you
  17. Hi.. I have this code: $Approved = isset($_POST['priority']); if ($Approved) { $lot_number = $_POST['lot_number']; $sr_number_ = $_POST['sr_number_']; $SubQty = $_POST['SubQty']; $ItemCode = $_POST['ItemCode']; $picked_by = $_POST['picked_by']; $sql = "SELECT stock_item, qty FROM wms WHERE stock_item = '$ItemCode' AND lot_number = '$lot_number'"; $res = mysql_query($sql, $con) or die(mysql_error()); $row = mysql_fetch_assoc($res); $stock_item = $row['stock_item']; $qty = $row['qty']; if($qty >= $SubQty){ $output = $qty - $SubQty; $qty_withdraw = '0.00'; } else{ $output = '0.00'; $qty_withdraw = $SubQty - $qty; } } error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAT-CHE-0040'' at line 2 but when I echo the $sql; the output is: SELECT stock_item, qty FROM wms WHERE stock_item = 'MAT-CHE-0040' AND lot_number = 'LO120601002'; and it works. I don't know why in php the sql query got an error: How can I remove that error? Thank you so much
  18. Hi.. I have form for picking and now I got encountered problem in getting the value of lot_number where in select option: here is my code: <?php error_reporting(0); date_default_timezone_set("Asia/Singapore"); //set the time zone $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); $Date_Shelve =date('Y-m-d H:i:s'); ?> <html> <title>Picking</title> <head> <link href="kanban.css" rel="stylesheet" type="text/css"> </head> <body> <form name='picking_form' action='' method='post'> <?php $Approved = isset($_POST['priority']); if ($Approved) { $lot_number = $_POST['lot_number']; $sr_number_ = $_POST['sr_number_']; $SubQty = $_POST['SubQty']; $ItemCode = $_POST['ItemCode']; $picked_by = $_POST['picked_by']; $sql = "SELECT stock_item, qty FROM wms WHERE stock_item = '$ItemCode' AND lot_number = '$lot_number'"; $res = mysql_query($sql, $con) or die(mysql_error()); $row = mysql_fetch_assoc($res); $stock_item = $row['stock_item']; $qty = $row['qty']; if($qty >= $SubQty){ $output = $qty - $SubQty; $qty_withdraw = '0.00'; } else{ $output = '0.00'; $qty_withdraw = $SubQty - $qty; } echo "<br/><br/><br/>"; echo $lot_number; echo $sr_number_; echo $picked_by; echo $output; echo $qty_withdraw; } ?> <div id="SR_date"> <label>Date :</label> <input type="text" name="date_pick" value="<?php echo $Date_Shelve; ?>" size="16" readonly="readonly" style="border: none;"> </div> <div id="Picking"> <label class="LLabellot">Select SR # :</label> <?php $query = "SELECT DISTINCT m.sr_number FROM sr_main m JOIN sr_submain s ON (m.sr_number = s.sr_number) ORDER BY sr_number"; $rows = mysql_query($query, $con); echo "<select name = 'sr_number' onchange='get_option();'>"; echo "<option>Select</option>"; while ($record = mysql_fetch_array($rows)) { echo "<option value = '{$record['sr_number']}'"; if ($lot_number == $record['sr_number']) echo "selected = 'selected'"; echo ">{$record['sr_number']}</option>"; } echo "</select>"; echo "<br/><br/>"; $sr_number = $_POST['sr_number']; $sql = "SELECT sr_number, Items, DemandedQty, uom FROM sr_main WHERE sr_number = '$sr_number'"; $res_sr_main = mysql_query($sql, $con); $row_num = mysql_num_rows($res_sr_main); if($row_num > 0){ while($row_sr_main = mysql_fetch_assoc($res_sr_main)){ echo "<form name='picking_lotnum' action='' method='post'>"; $sr_number_ = $row_sr_main['sr_number']; $items = $row_sr_main['Items']; $demandedqty = $row_sr_main['DemandedQty']; $uom = $row_sr_main['uom']; echo "<label> SR # :</label>"; echo "<input type='text' readonly='readonly' style='border:none;' id='sr_number_' name='sr_number_' value='$sr_number_'>"; echo "<table>"; echo "<th>Items</th> <th> Item Code </th> <th> Demanded Qty </th> <th> UoM </th> <th> Description </th> <th> Lot Number </th> <th> Picked By </th> <th> Approved</th>"; echo "<tr> <td>$items</td> <td></td> <td style='text-align:right;'>$demandedqty</td> <td>$uom</td> </tr>"; $sql_sub = "SELECT sr_number, Items, ItemCode, SubQty, UoM, Description FROM sr_submain WHERE sr_number = '$sr_number' and Items = '$items'"; $res_sub = mysql_query($sql_sub, $con); while($row_sub = mysql_fetch_assoc($res_sub)){ $sr_num = $row_sub['sr_number']; $Items = $row_sub['Items']; $ItemCode = $row_sub['ItemCode']; $SubQty = $row_sub['SubQty']; $UoM = $row_sub['UoM']; $Description = $row_sub['Description']; $query = "SELECT lot_number from wms WHERE (date_shelve IS NOT NULL) AND stock_item = '$ItemCode' ORDER BY lot_number"; $rows = mysql_query($query, $con); echo "<tr> <td></td> <td id='ItemCode'>$ItemCode</td> <td style='text-align:right;' id='SubQty'>$SubQty</td> <td>$UoM</td> <td>$Description</td>"; echo "<td id='lot_number'><select name = 'lot_number' id='lot_number'>"; echo "<option> Select </option>"; while ($record = mysql_fetch_array($rows)) { echo "<option value = '{$record['lot_number']}'"; if ($lot_number == $record['lot_number']) echo "selected = 'selected'"; echo ">{$record['lot_number']}</option>"; } echo "</select>"; echo "</td>"; echo "<td> <input type='text' name='picked_by' id='picked_by' size='20' value=''> </td>"; echo "<td><input type='submit' name='priority' value='Approved' id='priority'></td>"; echo "</tr>"; } } echo "</form>"; } echo "</table>"; echo "</form>"; echo "</div>"; ?> </body> </html> when I echo the $lot_number: the result is Select. it did not get the data selected. Thank you...
  19. Hi, I created picking module and now I need help in subtract/minus Demanded Qty to the Qty from the wms table based on the lot number selected and it will happen only when the checkbox was check. Here is the flow: 1. Select SR # 2. After Select SR # data will display below 3. Choose Lot Number 4. Check the beside textbox to subtract/minus the demanded qty to the lot number qty from wms table 5. When the check box was check and after subtract the select option will be only display the lot number you selected. I am new in using checkbox. Here is my code: <?php error_reporting(0); date_default_timezone_set("Asia/Singapore"); //set the time zone $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); $Date_Shelve =date('Y-m-d H:i:s'); ?> <html> <title>Picking</title> <head> <link href="kanban.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> function get_option(elm){ var elm = document.getElementById('sr_number'); sr_number = elm.options[elm.selectedIndex].value; document.picking_form.action="Picking.php?sr_number="+sr_number; document.picking_form.submit(); } </script> </head> <body> <div id="SR_date"> <label>Date :</label> <input type="text" name="date_pick" value="<?php echo $Date_Shelve; ?>" size="16" readonly="readonly" style="border: none;"> </div> <div id="Picking"> <label class="LLabellot">Select SR # :</label> <?php $query = "SELECT DISTINCT m.sr_number FROM sr_main m JOIN sr_submain s ON (m.sr_number = s.sr_number) ORDER BY sr_number"; $rows = mysql_query($query, $con); echo "<select name = 'sr_number' onchange='get_option();'>"; echo "<option> Select </option>"; while ($record = mysql_fetch_array($rows)) { echo "<option value = '{$record['sr_number']}'"; if ($lot_number == $record['sr_number']) echo "selected = 'selected'"; echo ">{$record['sr_number']}</option>"; } echo "</select>"; echo "<br/><br/>"; $sr_number = $_POST['sr_number']; $sql = "SELECT sr_number, Items, DemandedQty, uom FROM sr_main WHERE sr_number = '$sr_number'"; $res_sr_main = mysql_query($sql, $con); $row_num = mysql_num_rows($res_sr_main); if($row_num > 0){ while($row_sr_main = mysql_fetch_assoc($res_sr_main)){ $sr_number = $row_sr_main['sr_number']; $items = $row_sr_main['Items']; $demandedqty = $row_sr_main['DemandedQty']; $uom = $row_sr_main['uom']; echo "<form name='picking_form' action='' method='post'> "; echo "<label> SR # :</label>"; echo $sr_number; echo "<table>"; echo "<th>Items</th> <th> Item Code </th> <th> Demanded Qty </th> <th> UoM </th> <th> Description </th> <th> Lot Number </th> <th> Approve</th>"; echo "<tr> <td>$items</td> <td></td> <td style='text-align:right;'>$demandedqty</td> <td>$uom</td> </tr>"; $sql_sub = "SELECT sr_number, Items, ItemCode, SubQty, UoM, Description FROM sr_submain WHERE sr_number = '$sr_number' and Items = '$items'"; $res_sub = mysql_query($sql_sub, $con); while($row_sub = mysql_fetch_assoc($res_sub)){ $sr_num = $row_sub['sr_number']; $Items = $row_sub['Items']; $ItemCode = $row_sub['ItemCode']; $SubQty = $row_sub['SubQty']; $UoM = $row_sub['UoM']; $Description = $row_sub['Description']; $query = "SELECT lot_number from wms WHERE (date_shelve IS NOT NULL) ORDER BY lot_number"; $rows = mysql_query($query, $con); echo "<tr> <td></td> <td>$ItemCode</td> <td style='text-align:right;'>$SubQty</td> <td>$UoM</td> <td>$Description</td>"; echo "<td><select name = 'lot_number'>"; echo "<option> Select </option>"; while ($record = mysql_fetch_array($rows)) { echo "<option value = '{$record['lot_number']}'"; if ($lot_number == $record['lot_number']) echo "selected = 'selected'"; echo ">{$record['lot_number']}</option>"; } echo "</select>"; echo "<td><input type='checkbox' name='chk' value=''></td> </tr>"; } } } ?> </div> </form> </body> </html> Thank you so much
  20. Hi.. I need help in moving focus to the next textfield after I input data to the first textfield. Now in my code when I have data to stock_item textfield it did not move the cursor or focus on the next textfield which is lot_no. here is my code: <?php error_reporting(0); date_default_timezone_set("Asia/Singapore"); //set the time zone $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); ?> <html> <title>Picking</title> <head> <link href="kanban.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> function StockItemFocus() { if (!document.getElementById('stock_item').disabled) { if (document.activeElement.name='stock_item') { document.getElementById('stock_item').focus(); } } } </script> <script type="text/javascript"> var ajaxTimeOut = null; var ajaxTimeOutOperator = null; var responsePHP; // = "no_reply" var responsePHPOperator; var changeFocus; //= false; var transactionWasSaved; function remoteRequestObject() { var ajaxRequest = false; try { ajaxRequest = new XMLHttpRequest(); } catch(err) { try{ ajaxRequest = new ActiveXObject("MSxml2.XMLHTTP"); } catch(err) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch(err){ // --> change to DOM alert("Not Supported Browser") + err.description; notify('Not Supported Browser.'); return false; } } } return ajaxRequest; } var ajaxRequest; // = remoteRequestObject(); //var ajaxRequest = remoteRequestObject(); var ajaxRequestOperator; </script> <script type="text/javascript"> function lotIdCheck(element) { //var lotCodeStr; var suffix; if (window.event.keyCode==13 || window.event.keyCode==10) { var txtElementID = element; if (txtElementID.value == "") { return false; } capture(txtElementID); } } function sequence() { document.getElementById('stock_item').focus(); document.getElementById('lot_no').disabled = true; document.getElementById('sr_no').disabled = true; document.getElementById('bin_loc').disabled = true; document.getElementById('picked_by').disabled = true; var txt = document.getElementById('lot_no'); if (txt.attachEvent) { txt.attachEvent ("onkeypress", function () {lotIdCheck(txt)}); } document.getElementById('stock_item').focus(); document.attachEvent('onmousewheel', function(e){ if (!e) var e = window.event; e.returnValue = false; e.cancelBubble = true; return false; }, false); } </script> </head> <body onload="sequence();" oncontextmenu="return false;" onselectstart="return false;" onmousemove="StockItemFocus();" onclick="StockItemFocus();"> <div class='stock_item_label'> <label> Stock Item : </label> </div> <div class='stock_item_field'> <input type='text' name='stock_item' id='stock_item' value='' size='30'> </div> <div class='lot_label'> <label> Lot # : </label> </div> <div class='lot_field'> <input type='text' name='lot_no' id='lot_no' value='' size='30' > </div> <div class='sr_label'> <label> SR # : </label> </div> <div class='sr_field'> <input type='text' name='sr_no' id='sr_no' value='' size='30'> </div> <div class='bin_label'> <label> Bin Loc : </label> </div> <div class='bin_field'> <input type='text' name='bin_loc' id='bin_loc' value='' size='30' > </div> <div class='pick_label'> <label> Picked By :</label> </div> <div class='pick_field'> <input type='text' name='picked_by' id='picked_by' value='' size='30'> </div> </form> </body> </html> Thank you
  21. Hi... I just want to know how can I compute the Total Maximum Dozen while I'm input number in the textboxes from Maximum Lot. Now, in my code: When I input in textbox from Maximum lot it computes the Maximum Dozen and Total Maximum Lot, and the Total Maximum Dozen was only compute or change when I press the key on the textbox from Maximum Dozen. I want to happen is:when I input in Maximum Lot textboxes the total Maximum Lot, Maximum Dozen, and Total Maximum Dozen will compute. Here is my code: <html> <head> <title>Half Shell</title> <link rel="stylesheet" type="text/css" href="kanban.css" /> <script type="text/javascript"> //=========auto compute Total Max=====// function autocalearn(oText) { var P28_max_lot = document.getElementById("P28_max_lot").value; var P28_bch_wt = document.getElementById("P28_bch_wt").value; var P28_plug_wt = document.getElementById("P28_plug_wt").value; var P28_max_convert = (parseFloat(P28_max_lot) * ((parseFloat(P28_bch_wt))* parseFloat(1000)) / parseFloat(P28_plug_wt) / parseFloat(12)); if( !isNaN(P28_max_convert) ){ var P28_max_doz = document.getElementById("P28_max_doz").value = P28_max_convert.toFixed(2); } var P30_max_lot = document.getElementById("P30_max_lot").value; var P30_bch_wt = document.getElementById("P30_bch_wt").value; var P30_plug_wt = document.getElementById("P30_plug_wt").value; var P30_max_convert = (parseFloat(P30_max_lot) * ((parseFloat(P30_bch_wt))* parseFloat(1000)) / parseFloat(P30_plug_wt) / parseFloat(12)); if( !isNaN(P30_max_convert) ){ var P30_max_doz = document.getElementById("P30_max_doz").value = P30_max_convert.toFixed(2); } var P32_max_lot = document.getElementById("P32_max_lot").value; var P32_bch_wt = document.getElementById("P32_bch_wt").value; var P32_plug_wt = document.getElementById("P32_plug_wt").value; var P32_max_convert = (parseFloat(P32_max_lot) * ((parseFloat(P32_bch_wt))* parseFloat(1000)) / parseFloat(P32_plug_wt) / parseFloat(12)); if( !isNaN(P32_max_convert) ){ var P32_max_doz = document.getElementById("P32_max_doz").value = P32_max_convert.toFixed(2); } var P33_max_lot = document.getElementById("P33_max_lot").value; var P33_bch_wt = document.getElementById("P33_bch_wt").value; var P33_plug_wt = document.getElementById("P33_plug_wt").value; var P33_max_convert = (parseFloat(P33_max_lot) * ((parseFloat(P33_bch_wt))* parseFloat(1000)) / parseFloat(P33_plug_wt) / parseFloat(12)); if( !isNaN(P33_max_convert) ){ var P33_max_doz = document.getElementById("P33_max_doz").value = P33_max_convert.toFixed(2); } var P35_max_lot = document.getElementById("P35_max_lot").value; var P35_bch_wt = document.getElementById("P35_bch_wt").value; var P35_plug_wt = document.getElementById("P35_plug_wt").value; var P35_max_convert = (parseFloat(P35_max_lot) * ((parseFloat(P35_bch_wt))* parseFloat(1000)) / parseFloat(P35_plug_wt) / parseFloat(12)); if( !isNaN(P35_max_convert) ){ var P35_max_doz = document.getElementById("P35_max_doz").value = P35_max_convert.toFixed(2); } var P35M_max_lot = document.getElementById("P35M_max_lot").value; var P35M_bch_wt = document.getElementById("P35M_bch_wt").value; var P35M_plug_wt = document.getElementById("P35M_plug_wt").value; var P35M_max_convert = (parseFloat(P35M_max_lot) * ((parseFloat(P35M_bch_wt))* parseFloat(1000)) / parseFloat(P35M_plug_wt) / parseFloat(12)); if( !isNaN(P35M_max_convert) ){ var P35M_max_doz = document.getElementById("P35M_max_doz").value = P35M_max_convert.toFixed(2); } var P35W_max_lot = document.getElementById("P35W_max_lot").value; var P35W_bch_wt = document.getElementById("P35W_bch_wt").value; var P35W_plug_wt = document.getElementById("P35W_plug_wt").value; var P35W_max_convert = (parseFloat(P35W_max_lot) * ((parseFloat(P35W_bch_wt))* parseFloat(1000)) / parseFloat(P35W_plug_wt) / parseFloat(12)); if( !isNaN(P35W_max_convert) ){ var P35W_max_doz = document.getElementById("P35W_max_doz").value = P35W_max_convert.toFixed(2); } var P38_max_lot = document.getElementById("P38_max_lot").value; var P38_bch_wt = document.getElementById("P38_bch_wt").value; var P38_plug_wt = document.getElementById("P38_plug_wt").value; var P38_max_convert = (parseFloat(P38_max_lot) * ((parseFloat(P38_bch_wt))* parseFloat(1000)) / parseFloat(P38_plug_wt) / parseFloat(12)); if( !isNaN(P38_max_convert) ){ var P38_max_doz = document.getElementById("P38_max_doz").value = P38_max_convert.toFixed(2); } var P40_max_lot = document.getElementById("P40_max_lot").value; var P40_bch_wt = document.getElementById("P40_bch_wt").value; var P40_plug_wt = document.getElementById("P40_plug_wt").value; var P40_max_convert = (parseFloat(P40_max_lot) * ((parseFloat(P40_bch_wt))* parseFloat(1000)) / parseFloat(P40_plug_wt) / parseFloat(12)); if( !isNaN(P40_max_convert) ){ var P40_max_doz = document.getElementById("P40_max_doz").value = P40_max_convert.toFixed(2); } var P41_max_lot = document.getElementById("P41_max_lot").value; var P41_bch_wt = document.getElementById("P41_bch_wt").value; var P41_plug_wt = document.getElementById("P41_plug_wt").value; var P41_max_convert = (parseFloat(P41_max_lot) * ((parseFloat(P41_bch_wt))* parseFloat(1000)) / parseFloat(P41_plug_wt) / parseFloat(12)); if( !isNaN(P41_max_convert) ){ var P41_max_doz = document.getElementById("P41_max_doz").value = P41_max_convert.toFixed(2); } var P42_max_lot = document.getElementById("P42_max_lot").value; var P42_bch_wt = document.getElementById("P42_bch_wt").value; var P42_plug_wt = document.getElementById("P42_plug_wt").value; var P42_max_convert = (parseFloat(P42_max_lot) * ((parseFloat(P42_bch_wt))* parseFloat(1000)) / parseFloat(P42_plug_wt) / parseFloat(12)); if( !isNaN(P42_max_convert) ){ var P42_max_doz = document.getElementById("P42_max_doz").value = P42_max_convert.toFixed(2); } var P43_max_lot = document.getElementById("P43_max_lot").value; var P43_bch_wt = document.getElementById("P43_bch_wt").value; var P43_plug_wt = document.getElementById("P43_plug_wt").value; var P43_max_convert = (parseFloat(P43_max_lot) * ((parseFloat(P43_bch_wt))* parseFloat(1000)) / parseFloat(P43_plug_wt) / parseFloat(12)); if( !isNaN(P43_max_convert) ){ var P43_max_doz = document.getElementById("P43_max_doz").value = P43_max_convert.toFixed(2); } var P46_max_lot = document.getElementById("P46_max_lot").value; var P46_bch_wt = document.getElementById("P46_bch_wt").value; var P46_plug_wt = document.getElementById("P46_plug_wt").value; var P46_max_convert = (parseFloat(P46_max_lot) * ((parseFloat(P46_bch_wt))* parseFloat(1000)) / parseFloat(P46_plug_wt) / parseFloat(12)); if( !isNaN(P46_max_convert) ){ var P46_max_doz = document.getElementById("P46_max_doz").value = P46_max_convert.toFixed(2); } var P47_max_lot = document.getElementById("P47_max_lot").value; var P47_bch_wt = document.getElementById("P47_bch_wt").value; var P47_plug_wt = document.getElementById("P47_plug_wt").value; var P47_max_convert = (parseFloat(P47_max_lot) * ((parseFloat(P47_bch_wt))* parseFloat(1000)) / parseFloat(P47_plug_wt) / parseFloat(12)); if( !isNaN(P47_max_convert) ){ var P47_max_doz = document.getElementById("P47_max_doz").value = P47_max_convert.toFixed(2); } if (isNaN(oText.value)) //filter input { alert('Numbers only!'); oText.value = ''; } var field, val, oForm = oText.form, Total_max_lot = a = 0; for (a; a < arguments.length; ++a) //loop through text elements { field = arguments[a]; val = parseFloat(field.value); //get value if (!isNaN(val)) //number? { Total_max_lot += val; //accumulate } } oForm.Total_max_lot.value = Total_max_lot.toFixed(2); //out } </script> <script type="text/javascript"> //Auto convert to Doz and auto compute total max doz=====//// function doz(oText){ if (isNaN(oText.value)) //filter input { //alert('Numbers only!'); oText.value = ''; } var field, val, oForm = oText.form, Total_max_doz = a = 0; for (a; a < arguments.length; ++a) //loop through text elements { field = arguments[a]; val = parseFloat(field.value); //get value if (!isNaN(val)) //number? { Total_max_doz += val; //accumulate } } oForm.Total_max_doz.value = Total_max_doz.toFixed(2); //out } </script> <script type="text/javascript"> //=========auto convert mindoz and auto compute total min doz=====// function dozmin(oText){ if (isNaN(oText.value)) //filter input { //alert('Numbers only!'); oText.value = ''; } var field, val, oForm = oText.form, Total_min_doz = a = 0; for (a; a < arguments.length; ++a) //loop through text elements { field = arguments[a]; val = parseFloat(field.value); //get value if (!isNaN(val)) //number? { Total_min_doz += val; //accumulate } } oForm.Total_min_doz.value = Total_min_doz.toFixed(2); //out } </script> </head> <?php error_reporting(0); date_default_timezone_set("Asia/Singapore"); //set the time zone $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); ?> <body> <form name="loading_kanban" action="" method="post" onSubmit="return false"> <div id="fieldset_PS"> <table> <th>Compounds</th> <th>Max</th> <th>UoM</th> <th>Max</th> <th>UoM</th> <tr> <td><input type="text" name="P28" id="P28" value="P28" style="text-align: left; border: none;" size="6" maxlength="7" readonly="readonly"></td> <td><input type="text" name="P28_max_lot" id="P28_max_lot" size="8" maxlength="7" style="text-align: right;" value="<?php echo $P28_max_lot; ?>" onkeyup="return autocalearn(this, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P28_max_lot_uom" id="P28_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P28_max_doz" id="P28_max_doz" value="<?php echo $P28_max_doz;?>" onkeyup="return doz(P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz, P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)" ></b></td> <td><input type="text" name="P28_max_doz_uom" id="P28_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P30" id="P30" value="P30" ></td> <td><input type="text" name="P30_max_lot" id="P30_max_lot" value="<?php echo $P30_max_lot;?>" onkeyup="return autocalearn(this, P28_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P30_max_lot_uom" id="P30_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P30_max_doz" id="P30_max_doz" value="<?php echo $P30_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P32_max_doz, P33_max_doz, P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P30_max_doz_uom" id="P30_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P32" id="P32" value="P32" ></td> <td><input type="text" name="P32_max_lot" id="P32_max_lot" value="<?php echo $P32_max_lot ;?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P32_max_lot_uom" id="P32_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P32_max_doz" id="P32_max_doz" value="<?php echo $P32_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P33_max_doz, P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P32_max_doz_uom" id="P32_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P33" id="P33" value="P33" ></td> <td><input type="text" name="P33_max_lot" id="P33_max_lot" value="<?php echo $P33_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P33_max_lot_uom" id="P33_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P33_max_doz" id="P33_max_doz" value="<?php echo $P33_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P33_max_doz_uom" id="P33_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P35" id="P35" value="P35"></td> <td><input type="text" name="P35_max_lot" id="P35_max_lot" value="<?php echo $P35_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P35_max_lot_uom" id="P35_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P35_max_doz" id="P35_max_doz" value="<?php echo $P35_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P35_max_doz_uom" id="P35_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P35M" id="P35M" value="P35M"></td> <td><input type="text" name="P35M_max_lot" id="P35M_max_lot" value="<?php echo $P35M_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P35M_max_lot_uom" id="P35M_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P35M_max_doz" id="P35M_max_doz" value="<?php echo $P35M_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P35M_max_doz_uom" id="P35M_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P35W" id="P35W" value="P35W"></td> <td><input type="text" name="P35W_max_lot" id="P35W_max_lot" value="<?php echo $P35W_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P35W_max_lot_uom" id="P35W_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P35W_max_doz" id="P35W_max_doz" value="<?php echo $P35W_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P35W_max_doz_uom" id="P35W_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P38" id="P38" value="P38" ></td> <td><input type="text" name="P38_max_lot" id="P38_max_lot" value="<?php echo $P38_max_lot; ?>" size="8" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P38_max_lot_uom" id="P38_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P38_max_doz" id="P38_max_doz" value="<?php echo $P38_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P35W_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P38_max_doz_uom" id="P38_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P40" id="P40" value="P40" ></td> <td><input type="text" name="P40_max_lot" id="P40_max_lot" value="<?php echo $P40_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P40_max_lot_uom" id="P40_max_lot_uom" value="Lot" > </td> <td><b><input type="text" name="P40_max_doz" id="P40_max_doz" value="<?php echo $P40_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"><b></td> <td><input type="text" name="P40_max_doz_uom" id="P40_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P41" id="P41" value="P41" ></td> <td><input type="text" name="P41_max_lot" id="P41_max_lot" value="<?php echo $P41_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P42_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P41_max_lot_uom" id="P41_max_lot_uom" value="Lot" > </td> <td><b><input type="text" name="P41_max_doz" id="P41_max_doz" value="<?php echo $P41_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P42_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"><b></td> <td><input type="text" name="P41_max_doz_uom" id="P41_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P42" id="P42" value="P42" ></td> <td><input type="text" name="P42_max_lot" id="P42_max_lot" value="<?php echo $P42_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P43_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P42_max_lot_uom" id="P42_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P42_max_doz" id="P42_max_doz" value="<?php echo $P42_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P43_max_doz, P46_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P42_max_doz_uom" id="P42_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P43" id="P43" value="P43" ></td> <td><input type="text" name="P43_max_lot" id="P43_max_lot" value="<?php echo $P43_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P46_max_lot, P47_max_lot)" ></td> <td><input type="text" name="P43_max_lot_uom" id="P43_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P43_max_doz" id="P43_max_doz" value="<?php echo $P43_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P46_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P43_max_doz_uom" id="P43_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P46" id="P46" value="P46" ></td> <td><input type="text" name="P46_max_lot" id="P46_max_lot" maxlength="7" value="<?php echo $P46_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P47_max_lot)" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P47_max_doz)"></td> <td><input type="text" name="P46_max_lot_uom" id="P46_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P46_max_doz" id="P46_max_doz" value="<?php echo $P46_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P47_max_doz)"></b></td> <td><input type="text" name="P46_max_doz_uom" id="P46_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="P47" id="P47" value="P47" ></td> <td><input type="text" name="P47_max_lot" id="P47_max_lot" value="<?php echo $P47_max_lot; ?>" onkeyup="return autocalearn(this, P28_max_lot, P30_max_lot, P32_max_lot, P33_max_lot, P35_max_lot, P35M_max_lot, P35W_max_lot, P38_max_lot, P40_max_lot, P41_max_lot, P42_max_lot, P43_max_lot, P46_max_lot)" ></td> <td><input type="text" name="P47_max_lot_uom" id="P47_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="P47_max_doz" id="P47_max_doz" value="<?php echo $P47_max_doz; ?>" onkeyup="return doz(this, P28_max_doz, P30_max_doz, P32_max_doz, P33_max_doz,P35_max_doz, P35M_max_doz, P35W_max_doz, P38_max_doz, P40_max_doz, P41_max_doz, P42_max_doz, P43_max_doz, P46_max_doz)"></b></td> <td><input type="text" name="P47_max_doz_uom" id="P47_max_doz_uom" value="Doz" ></td> </tr> <tr> <td><input type="text" name="Total" id="Total" value="Total" ></td> <td><input type="text" name="Total_max_lot" id="Total_max_lot" value="<?php echo $Total_max_lot; ?>" ></td> <td><input type="text" name="Total_max_lot_uom" id="Total_max_lot_uom" value="Lot" ></td> <td><b><input type="text" name="Total_max_doz" id="Total_max_doz" value="<?php echo $Total_max_doz; ?>"></b></td> <td><input type="text" name="Total_max_doz_uom" id="Total_max_doz_uom" value="Doz" ></td> </tr> </table> </div> </form> </body> </html> Thank you so much. Can you do me additional favor?If you have time kindly visit this site:http://www.topmovietrailers2012.blogspot.com/ Thank you so much
  22. when I input the lotcode to textbox and I press the enter key it disabled the textbox and when I press F5 to refresh the forms the textbox was enabled and displayed the save data. I want to happen is after I press the entey key it will alert the (Transaction has been saved) then clear the value of textbox. Thank you
  23. Hi.. I have ajax code for saving data to database here is my ajax code: <script type="text/javascript"> var ajaxTimeOut = null; var ajaxTimeOutOperator = null; var responsePHP; // = "no_reply" var responsePHPOperator; var changeFocus; //= false; var transactionWasSaved; function remoteRequestObject() { var ajaxRequest = false; try { ajaxRequest = new XMLHttpRequest(); } catch(err) { try{ ajaxRequest = new ActiveXObject("MSxml2.XMLHTTP"); } catch(err) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch(err){ // --> change to DOM alert("Not Supported Browser") + err.description; notify('Not Supported Browser.'); return false; } } } return ajaxRequest; } //var ajaxRequest; // = remoteRequestObject(); var ajaxRequest = remoteRequestObject(); var ajaxRequestOperator; </script> <script type="text/javascript"> function lotIdCheck(element) { if (window.event.keyCode==13 || window.event.keyCode==10) { var txtElementID = element; if (txtElementID.value == "") { return false; } // alert(txtElementID.value); if (ifMatch(txtElementID.value, document.getElementById('txtLotCode').value)) { capture(element); } else { txtElementID.value = ""; txtElementID.focus(); notify("Lot ID mismatch.Scan again"); //box instead of this... } } } function timeOut(object) { if (ajaxTimeOut != null) { window.clearTimeout(ajaxTimeOut); } //alert("this is the reponse " + responsePHP) if (changeFocus = false || responsePHP == "no_reply" || ajaxRequest.readyState != 4 && ajaxRequest.readyState != 0) { //alert('ajaxRequest not ready'); ajaxRequest.onreadystatechange = function() {}; ajaxRequest.abort(); document.getElementById(object).disabled = false; document.getElementById(object).value = ""; changeInputType(document.getElementById(object),'password'); document.getElementById(object).focus(); document.getElementById(object).focus(); var txt = document.getElementById(object); if (txt.attachEvent) { txt.attachEvent ("onkeypress", function () {lotIdCheck(txt)}); } //notify("Please Scan again."); alert("Please Scan again."); } else { return false; } } function timeOutOperator() { if (ajaxTimeOutOperator !== null) { window.clearTimeout(ajaxTimeOutOperator); } if (transactionWasSaved = false || responsePHPOperator == "no_reply" || ajaxRequestOperator.readyState != 4 && ajaxRequestOperator.readyState != 0) { //alert('ajaxRequest not ready'); ajaxRequestOperator.onreadystatechange = function() {}; ajaxRequestOperator.abort(); document.getElementById('txtLotCode').disabled = false; document.getElementById('txtLotCode').value = ""; document.getElementById('txtLotCode').focus(); document.getElementById('txtLotCode').focus(); //notify("Please Scan again."); alert("Please Scan again."); } else { return false; } } function clearTiming() { changeFocus = true; if (ajaxTimeOut !== null) { window.clearTimeout(ajaxTimeOut); } } function clearTimingOperator() { transactionWasSaved = true; if (ajaxTimeOutOperator !== null) { window.clearTimeout(ajaxTimeOutOperator); } } function postSet() { if (window.event.keyCode==13 || window.event.keyCode==10) { document.getElementById('txtLotCode').disabled = true; verifyLotcode(); } } //------------------------------------------------------------------------------------------------------------------ function verifyLotcode() { responsePHPOperator = "no_reply"; transactionWasSaved = false; ajaxRequestOperator = remoteRequestObject(); ajaxRequestOperator.onreadystatechange = function () { if (ajaxRequestOperator.readyState==4 && ajaxRequestOperator.status==200) { //var result = ajaxRequestOperator.responseText; responsePHPOperator = ajaxRequestOperator.responseText; // alert(responsePHPOperator); if (responsePHPOperator == "failed") { document.getElementById('txtLotCode').disabled = false; document.getElementById('txtLotCode').value = ""; document.getElementById('txtLotCode').focus(); // notify("Please scan again."); alert("Please scan again."); } if (responsePHPOperator == "0") { //->> change to DOM alert("Unauthorized operator"); // notify("Unauthorized operator.<br />Scan Again."); alert("Unauthorized operator.<br/>Scan Again."); if (document.getElementById('txtLotCode').disabled) { document.getElementById('txtLotCode').disabled = false; } document.getElementById('txtLotCode').value = ""; document.getElementById('txtLotCode').focus(); } else { // alert ('correct'); save(); // notify("Transaction has been saved."); // reset(); } } } var str = document.getElementById('txtLotCode').value; var url = "validate_lotcode.php?q="+str; ajaxRequestOperator.open("GET",url , true ); // force i.e. not to cache ajaxRequestOperator.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); //--------------------------- ajaxRequestOperator.send(null); ajaxTimeOutOperator = window.setTimeout("timeOutOperator();", 100000000); } function save() { // ajaxRequest = remoteRequestObject(); ajaxRequest.onreadystatechange = function () { if (ajaxRequest.readyState==4 && ajaxRequest.status==200) { var result = ajaxRequest.responseText; // alert (result); if (result == "failed") { // alert (result); document.getElementById('txtLotCode').disabled = false; document.getElementById('txtLotCode').value = ""; document.getElementById('txtLotCode').focus(); //notify("Please scan again."); alert("Please scan again"); } if (result == "saved|saved" || result == "saved|saved|saved") { //alert(result); alert("Transaction has been saved."); //notify("Transaction has been saved."); // reset(); } } } var parameters = "txtLotCode=" + encodeURI(document.getElementById('txtLotCode').value); var url = "update_dependency.php"; ajaxRequest.open("POST", url, true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ajaxRequest.setRequestHeader("Content-length", parameters.length); ajaxRequest.setRequestHeader("Connection", "close"); ajaxRequest.send(parameters); } </script> <script type="text/javascript"> function reset() { // alert ('reset'); //enable elements document.getElementById('txtLotCode').disabled = false; //reset document.getElementById('txtLotCode').value = ""; } </script> I got problem in function save, even it satisfied this code: if (result == "saved|saved" || result == "saved|saved|saved") { but it did not post alert and also not go to reset function. I don't know why? Thank you
  24. I tried to think on how can i resolved it, how can I code it to resolve this problem and yet I can't figured out or think what code should resolve my problem. Thank you for your effort to help me..Sorry im not good in logic and coding
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.