Jump to content

newphpcoder

Members
  • Posts

    254
  • Joined

  • Last visited

Everything posted by newphpcoder

  1. I tried your suggested : <html> <head> <title>Half Shell</title> <link rel="stylesheet" type="text/css" href="kanban.css" /> <?php error_reporting(E_ALL ^ E_NOTICE); 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="param" action="" method="post" onSubmit="return false"> <div id="fieldset_PS"> <?php echo "<table>"; $sql = "SELECT DISTINCT s.Comp FROM sales_order s, param_settings p WHERE s.Comp = p.Compounds ORDER BY s.Comp"; $res_comp = mysql_query($sql, $con); while($row_comp = mysql_fetch_assoc($res_comp)){ $Comp[] = $row_comp['Comp']; } echo "<th> </th>"; foreach($Comp AS $Comp){ echo "<th>$Comp</th>"; echo "<tr> <td>Total Kg/Compound</td>"; $sql_sec = "SELECT SUM(TotalKg) AS TotalKg FROM sales_order WHERE Comp = '$Comp' ORDER BY Comp"; $res_sec = mysql_query($sql_sec, $con); while($row_sec = mysql_fetch_assoc($res_sec)){ $TotalKg[] = $row_sec['TotalKg']; } foreach($TotalKg AS $Total){ echo "<tr><td>$Total</td> </tr>"; } } ?> And now I attach the output: Thank you so much for your effort to help me.
  2. Hi... I tried to use foreach in displaying my table header, but I encountered problem when I tried to display data on the first row , my query only display the last Sum for the last Comp. here is my code: <html> <head> <title>Half Shell</title> <link rel="stylesheet" type="text/css" href="kanban.css" /> <?php error_reporting(E_ALL ^ E_NOTICE); 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="param" action="" method="post" onSubmit="return false"> <div id="fieldset_PS"> <?php echo "<table>"; $sql = "SELECT DISTINCT s.Comp FROM sales_order s, param_settings p WHERE s.Comp = p.Compounds ORDER BY s.Comp"; $res_comp = mysql_query($sql, $con); while($row_comp = mysql_fetch_assoc($res_comp)){ $Comp[] = $row_comp['Comp']; } echo "<th> </th>"; foreach($Comp AS $Comp){ echo "<th>$Comp</th>"; } echo "<tr> <td>Total Kg/Compound</td>"; $sql_sec = "SELECT SUM(TotalKg) AS TotalKg FROM sales_order WHERE Comp = '$Comp' ORDER BY Comp"; $res_sec = mysql_query($sql_sec, $con); while($row_sec = mysql_fetch_assoc($res_sec)){ $TotalKg[] = $row_sec['TotalKg']; } foreach($TotalKg AS $TotalKg){ echo "<td>$TotalKg</td> </tr>"; } ?> I also attach the correct output that should be and the result from my code. Thank you
  3. Ok I will try your suggestion to put calculation inside the update. Thank you
  4. I revise my code: $sql_ud = "SELECT CompKg, PlugWt, SKUCode FROM sales_order ORDER BY SKUCode"; $res_ud = mysql_query($sql_ud, $con); while($row_ud = mysql_fetch_assoc($res_ud)){ $SKUCode = $row_ud['SKUCode']; $CompKg = $row_ud['CompKg']; $PlugWt = $row_ud['PlugWt']; $Doz = @(($CompKg * 1000) / $PlugWt) / 12 / 2; $KgDoz = @($CompKg / $Doz); $sqlupdate = "UPDATE sales_order SET Doz = '$Doz', KgDoz = '$KgDoz' WHERE SKUCode = '$SKUCode'"; // echo $sqlupdate; $res_update = mysql_query($sqlupdate, $con); } $sql = "SELECT POReq, Doz, KgDoz, SKUCode FROM sales_order ORDER BY SKUCode"; $res_up1 = mysql_query($sql, $con); while($row_up1 = mysql_fetch_assoc($res_up1)){ $SKUCode = $row_up1['SKUCode']; $POReq = $row_up1['POReq']; $Doz = $row_up1['Doz']; $KgDoz = $row_up1['KgDoz']; $TotalKg = @($POReq * $KgDoz); $BatchNeeded = @($POReq / $Doz); $sqlupdate1 = "UPDATE sales_order SET TotalKg = '$TotalKg', BatchNeeded = '$BatchNeeded' WHERE SKUCode = '$SKUCode'"; $res_update1 = mysql_query($sqlupdate1, $con); } And now I have wrong output in my second update. for TotalKg and BatchNeeded.
  5. Hi... I have table with PO_No POReq CompKg PlugWt Doz KgDoz TotalKg BatchNeeded Now, I have problem in updating field (Doz, KgDoz, TotalKg, BatchNeeded). here is my code: $sql = "SELECT CompKg, PlugWt, POReq FROM sales_order "; $res = mysql_query($sql, $con); while($row = mysql_fetch_assoc($res)){ $CompKg = $row['CompKg']; $PlugWt = $row['PlugWt']; $POReq = $row['POReq']; $Doz = (($CompKg * 1000) / $PlugWt) / 12 / 2; $KgDoz = ($CompKg / $Doz); $TotalKg = ($POReq * $KgDoz); $BatchNeeded = ($POReq / $Doz); } $sqlupdate = "UPDATE sales_order SET Doz = '$Doz', KgDoz = '$KgDoz', TotalKg = '$TotalKg', BatchNeeded = '$BatchNeeded'"; $res_update = mysql_query($sqlupdate, $con); the result are wrong. Thank you
  6. Hi.. I just want to know what would be the query if I just want to select date is the first 3 months. for example. I have month in dates sampe: ETD = April, May, June, July, August. And now I just want to select is the first 3 months and its (April, May, June). Thank you
  7. I just want to get is from april to august. Thankyou
  8. I tried your suggested code: and still all data from march - august was get. I tried to echo $date_now and $ETD_month the output are: $date_now = 04 $ETD_month = 03 04 05 06 07 08. Thank you
  9. I tried your suggested code. Still all data was save Thank you $date_now = date('m'); $ETD = strtotime($ETD); $ETD_month = date("m", $ETD); if($ETD_month!=$date_now){ $sql = "INSERT INTO sales_order (ETD,PO_No,SKUCode,Description,POReq,Comp) VALUES ('$ETD','$PO_No','$SKUCode','$Description','$POReq','$Comp') " or die(mysql_error()); }
  10. Hi... I have codes in uploading .xml file to my database table, now I only need to save or insert only the data where ETD (Month from Date) is not previous Month. ETD = date Actually it's my first time to encounter this and while I'm posting this issue in forums., I also tried to find the answer. here is my code: <?php error_reporting(E_ALL ^ E_NOTICE); date_default_timezone_set("Asia/Singapore"); //set the time zone $data = array(); $con = mysql_connect("localhost", "root",""); if (!$con) { die(mysql_error()); } $db = mysql_select_db("mes", $con); if (!$db) { die(mysql_error()); } $date_now = date('m'); function add_employee($ETD,$PO_No,$SKUCode,$Description,$POReq ,$Comp) { global $data; $con = mysql_connect("localhost", "root",""); if (!$con){ die(mysql_error());} $db = mysql_select_db("mes", $con); if (!$db) { die(mysql_error()); } $ETD= $ETD; $PO_No = $PO_No; $SKUCode = $SKUCode; $Description = $Description; $POReq = $POReq; $Comp = $Comp; $sql = "INSERT INTO sales_order (ETD,PO_No,SKUCode,Description,POReq,Comp) VALUES ('$ETD','$PO_No','$SKUCode','$Description','$POReq','$Comp') " or die(mysql_error()); mysql_query($sql, $con); $data []= array('ETD'=>$ETD,'PO_No'=>$PO_No,'SKUCode'=>$SKUCode,'Description'=>$Description,'POReq'=>$POReq,'Comp'=>$Comp); } if(empty($_FILES['file']['tmp_name'])){ $doc = new DOMDocument(); $dom = $doc->load('Sales1.xml'); $rows = $doc->getElementsByTagName('Row'); global $last_row; $last_row = false; $first_row = true; foreach ($rows as $row) { if ( !$first_row ) { $ETD = ""; $PO_No = ""; $SKUCode = ""; $Description = ""; $POReq = ""; $Comp = ""; $index = 1; $cells = $row->getElementsByTagName( 'Cell' ); foreach( $cells as $cell ) { $ind = $cell->getAttribute( 'Index' ); if ( $ind != null ) $index = $ind; if ( $index == 1 ) $ETD = $cell->nodeValue; if ( $index == 2 ) $PO_No = $cell->nodeValue; if ( $index == 3 ) $SKUCode = $cell->nodeValue; if ( $index == 4 ) $Description = $cell->nodeValue; if ( $index == 5 ) $POReq = $cell->nodeValue; if ( $index == 6 ) $Comp = $cell->nodeValue; $index += 1; } if ($ETD=='' AND $PO_No=='' AND $SKUCode=='' AND $Description=='' AND $POReq=='' AND $Comp=='') { $last_row = true; } else { add_employee($ETD,$PO_No,$SKUCode,$Description, $POReq, $Comp); } } if ($last_row==true) { $first_row = true; } else { $first_row = false; } } } ?> I tried this query: $sql = "INSERT INTO sales_order (ETD,PO_No,SKUCode,Description,POReq,Comp) VALUES ('$ETD','$PO_No','$SKUCode','$Description','$POReq','$Comp') WHERE $ETD_month != '$date_now'" or die(mysql_error()); but still he get date where ETD(month from date) = March. Thank you so much
  11. I tried this: $doc = new DOMDocument(); $dom = $doc->load('SalesOrder.xml'); //$dom->saveXML(); // $dom = DOMDocument::load($_FILES['file']['tmp_name']); // $dom = DOMDocument::__construct(); $rows = $doc->getElementsByTagName('Row'); global $last_row; solved my problem
  12. I tried this: if(empty($_FILES['file']['tmp_name'])){ // $dom = new DOMDocument(); //$dom = DOMDocument::load('SalesOrder.xml'); // $dom = new DOMDocument(); //$dom->load('SalesOrder.xml'); $doc = new DOMDocument; $dom = $doc->load('SalesOrder.xml'); //$dom->saveXML(); // $dom = DOMDocument::load($_FILES['file']['tmp_name']); // $dom = DOMDocument::__construct(); $rows = $dom->getElementsByTagName('Row'); yet I got an error: Fatal error: Call to a member function getElementsByTagName() on a non-object Thank you
  13. Hi... I tried to import to my database an xml file using this code: <?php //ini_set('display_errors', -1); //error_reporting(E_ALL); //error_reporting(-1); error_reporting(E_ALL | E_STRICT); //error_reporting(E_ALL ^ E_NOTICE); date_default_timezone_set("Asia/Singapore"); //set the time zone $data = array(); $con = mysql_connect("localhost", "root",""); if (!$con) { die(mysql_error()); } $db = mysql_select_db("mes", $con); if (!$db) { die(mysql_error()); } function add_employee($ETD,$PO_No,$SKUCode,$Description,$POReq ,$Comp) { global $data; $con = mysql_connect("localhost", "root",""); if (!$con){ die(mysql_error());} $db = mysql_select_db("mes", $con); if (!$db) { die(mysql_error()); } $ETD= $ETD; $PO_No = $PO_No; $SKUCode = $SKUCode; $Description = $Description; $POReq = $POReq; $Comp = $Comp; $sql = "INSERT INTO sales_order (ETD,PO_No,SKUCode,Description,POReq,Comp) VALUES ('$ETD','$PO_No','$SKUCode','$Description','$POReq','$Comp') ON DUPLICATE KEY UPDATE ETD = '$ETD', PO_No = '$PO_No', SKUCode = '$SKUCode', Description = '$Description', POReq = '$POReq', Comp = '$Comp'" or die(mysql_error()); $res = mysql_query($sql, $con); $data []= array('ETD'=>$ETD,'PO_No'=>$PO_No,'SKUCode'=>$SKUCode,'Description'=>$Description,'POReq'=>$POReq,'Comp'=>$Comp); } // if (isset($_FILES['file']['tmp_name'])){ if(empty($_FILES['file']['tmp_name']['error'])){ $dom = new DOMDocument(); $dom = DOMDocument::load('SalesOrder.xml'); //$dom = DOMDocument::load($_FILES['file']['tmp_name']); //$dom = DOMDocument::__construct(); $rows = $dom->getElementsByTagName('Row'); global $last_row; $last_row = false; $first_row = true; foreach ($rows as $row) { if ( !$first_row ) { $ETD = ""; $PO_No = ""; $SKUCode = ""; $Description = ""; $POReq = ""; $Comp = ""; $index = 1; $cells = $row->getElementsByTagName( 'Cell' ); foreach( $cells as $cell ) { $ind = $cell->getAttribute( 'Index' ); if ( $ind != null ) $index = $ind; if ( $index == 1 ) $ETD = $cell->nodeValue; if ( $index == 2 ) $PO_No = $cell->nodeValue; if ( $index == 3 ) $SKUCode = $cell->nodeValue; if ( $index == 4 ) $Description = $cell->nodeValue; if ( $index == 5 ) $POReq = $cell->nodeValue; if ( $index == 6 ) $Comp = $cell->nodeValue; $index += 1; } if ($ETD=='' AND $PO_No=='' AND $SKUCode=='' AND $Description=='' AND $POReq=='' AND $Comp=='') { $last_row = true; } else { add_employee($ETD,$PO_No,$SKUCode,$Description, $POReq, $Comp); } } if ($last_row==true) { $first_row = true; } else { $first_row = false; } } } ?> but I got an error: Strict Standards: Non-static method DOMDocument::load() should not be called statically in this part: $dom = DOMDocument::load('SalesOrder.xml'); I hope somebody can help me...I need to import data from .xml to my database. Thank you so much
  14. You mean I will put my function inside my if condition? Thank you so much
  15. I resolve my problem by changing my code for getting the rendered: when time_to_sec(time(LOGIN)) BETWEEN time_to_sec('10:00:00') AND time_to_sec('10:35:00') AND time_to_sec(time(LOGOUT)) BETWEEN time_to_sec('13:35:00') AND time_to_sec('14:35:00') AND DATE_FORMAT(LOGIN, '%W') IN ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday') then sec_to_time(CEIL((time_to_sec(concat(substr(LOGOUT, 1,10), ' ' , '04:00:00')) + (time_to_sec(LOGOUT) - time_to_sec(concat(substr(LOGOUT, 1,10), ' ' , '14:35:00')))) / 60) * 60) Thank you
  16. Hi.. I have a function for convert to dozen. 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> <head> <title>Job Order</title> <link rel="stylesheet" type="text/css" href="kanban.css" /> </head> <body> <div id="ddcolortabs"> <ul> <li id="current"> <a href="SalesOrder.php" title="Sales Order"><span>Order Management</span></a></li> <li> <a href="ParameterSettings.php" title="Parameter Settings"><span>Parameter Settings</span></a></li> <li style="margin-left: 1px"><a href="kanban_report.php" title="WIP Report"><span>WIP Report</span></a></li> <li><a href="fsn.php" title="Finished Stock Note"><span>WMS FG</span></a></li> <li><a href="ReceivingMaterials.php" title="WMS RM"><span>WMS RM</span></a></li> </ul> </div> <div id="ddcolortabs1"> <ul> <li><a href="SalesOrder.php" title="Sales Order"><span>Sales Order</span></a></li> <li id="current"><a href="JobOrder.php" title="Job Order"><span>Job Order</span></a></li> </ul> </div> <div id="SR_date"> <input type="hidden" name="Date_Shelve" id="Date_Shelve" value="<?php echo $Date_Shelve; ?>" size="16" readonly="readonly" style="border: none;"> </div> <?php //----approve button-----// $Approved = isset($_POST['priority']); if ($Approved) { $PO_No = $_POST['PO_No']; $ETD = $_POST['ETD']; $SKUCode = $_POST['SKUCode']; $Description = $_POST['Description']; $POReq = $_POST['POReq']; $priority = $_POST['priority']; $sql = "SELECT SKUCode, Materials, Comp, Qty FROM bom WHERE SKUCode = '$SKUCode'"; $res = mysql_query($sql, $con); $row = mysql_fetch_assoc($res); $Materials = $row['Materials']; $Qty = $row['Qty']; $Comp = $row['Comp']; $ReqQty = $Qty * $POReq; $sql = "UPDATE bom SET ReqQty = '$ReqQty' WHERE SKUCode = '$SKUCode' AND Materials = '$Materials'"; $resReqQty = mysql_query($sql, $con); $sql = "SELECT SUM(WEIGHING) AS WEIGHING_TOTAL, "; $sql .= "SUM(COMPOUNDING) AS COMPOUNDING_TOTAL, "; $sql .= "SUM(EXTRUSION) AS EXTRUSION_TOTAL, "; $sql .= "SUM(FORMING) AS FORMING_TOTAL, "; $sql .= "SUM(DIPPING) AS DIPPING_TOTAL, "; $sql .= "SUM(MOULDING) AS MOULDING_TOTAL "; $sql .= "FROM MES_REPORT_OPEN WHERE SUBSTRING(LOT_CODE, 9) = '$Comp'"; $result = mysql_query($sql, $con); $weighingTotal = mysql_result($result, 0, "WEIGHING_TOTAL"); $weighingTotal = convertToDozen($weighingTotal, $Comp); $weighingAccum = $weighingAccum + $weighingTotal; $compoundingTotal = mysql_result($result, 0, "COMPOUNDING_TOTAL"); $compoundingTotal = convertToDozen($compoundingTotal, $Comp); $compoundingAccum = $compoundingAccum + $compoundingTotal; $extrusionTotal = mysql_result($result, 0, "EXTRUSION_TOTAL"); $extrusionTotal = convertToDozen($extrusionTotal, $Comp); $extrusionAccum = $extrusionAccum + $extrusionTotal; $formingTotal = mysql_result($result, 0, "FORMING_TOTAL"); $formingTotal = convertToDozen($formingTotal, $Comp); $formingAccum = $formingAccum = $formingTotal; $dippingTotal = mysql_result($result, 0, "DIPPING_TOTAL"); $dippingTotal = convertToDozen($dippingTotal, $Comp); $dippingAccum = $dippingAccum + $dippingTotal; $virtualY = $weighingTotal + $compoundingTotal + $extrusionTotal + $formingTotal; $totalY = $dippingTotal + $virtualY; function convertToDozen ($total, $cmpdType) { switch ($cmpdType) { case "P28" : $convTotal = (($total * 1000) / 22.00) / 12; break; case "P30" : $convTotal = (($total * 1000) / 25.10) / 12; break; case "P32" : $convTotal = (($total * 1000) / 22.50) / 12; break; case "P33" : $convTotal = (($total * 1000) / 25.00) / 12; break; case "P35" : $convTotal = (($total * 1000) / 25.25) / 12; break; case "P35M" : $convTotal = (($total * 1000) / 22.60) / 12; break; case "P35W" : $convTotal = (($total * 1000) / 22.50) / 12; break; case "P38" : $convTotal = (($total * 1000) / 26.70) / 12; break; case "P41" : $convTotal = (($total * 1000) / 24.80) / 12; break; case "P42" : $convTotal = (($total * 1000) / 18.90) / 12; break; case "P43" : $convTotal = (($total * 1000) / 25.00) / 12; break; case "P46" : $convTotal = (($total * 1000) / 27.00) / 12; break; case "P47" : $convTotal = (($total * 1000) / 27.60) / 12; break; } return round($convTotal, 2); } } else{ } $sql = "SELECT jo_number, ETD, PO_No, SKUCode, Description, POQty, Priority FROM job_order ORDER BY jo_number, ETD"; $res = mysql_query($sql,$con); ?> <div id="kanban_table" style="overflow:auto; height:215px;"> <table> <th> JO No.</th> <th> ETD </th> <th> PO No. </th> <th> SKU Code </th> <th> Description </th> <th> PO Req </th> <th> Priority</th> <?php $sql = "SELECT ETD, PO_No, SKUCode, Description, POReq FROM sales_order WHERE NOT EXISTS (SELECT PO_No FROM job_order WHERE job_order.PO_No = sales_order.PO_No) ORDER BY ETD, PO_No "; $res_so = mysql_query($sql, $con); while($row = mysql_fetch_assoc($res_so)){ echo "<form name='joborder_form' action='' method='post'>"; $PO_No = $row['PO_No']; echo "<tr> <td><input type='text' value='' style='border:none;' size='10'></td> <td><input type='text' name='ETD' id='ETD' value='$row[ETD]' style='border:none;' size='10'></td> <td><input type='text' name='PO_No' id='PO_No' value='$row[PO_No]' style='border:none;' size='30'></td> <td><input type='text' name='SKUCode' id='SKUCode' value='$row[sKUCode]' style='border:none;' size='15'></td> <td><input type='text' name='Description' id='Description' value='$row[Description]' style='border:none;' size='35'></td> <td><input type='text' name='POReq' id='POReq' value='$row[POReq]' style='border:none;' size='10'></td> <td><input type='submit' name='priority' value='Approved' id='priority'></td> </tr>"; echo "</form>"; } echo "</table>"; echo "</div>"; echo "<div style='overflow:auto; height:215px;'>"; echo "<table>"; while($row_job = mysql_fetch_assoc($res)){ echo "<tr> <td><input type='text' name='JO_No_' id='JO_No_' value='$row_job[jo_number]' style='border:none;width:auto;' size='10'></td> <td><input type='text' name='ETD_' id='ETD_' value='$row_job[ETD]' style='border:none;width:auto;' size='10'></td> <td><input type='text' name='PO_No_' id='PO_No_' value='$row_job[PO_No]' style='border:none;' size='30'></td> <td><input type='text' name='SKUCode_' id='SKUCode_' value='$row_job[sKUCode]' style='border:none;' size='15'></td> <td><input type='text' name='Description_' id='Description_' value='$row_job[Description]' style='border:none;' size='35'></td> <td><input type='text' name='POReq_' id='POReq_' value='$row_job[POQty]' style='border:none;width:auto;' size='10'></td> <td><input type='text' name='priority_' value='$row_job[Priority]' id='priority_' style='border:none;width:auto;' size='10'></td> </tr>" ; } echo "</table>"; echo "</div>" ?> </body> </html> but I when I echo this: echo $weighingTotal; No result, then when I debug my code I got an error: Call to undefined function. I can’t configured out where in my code was wrong? Any help is highly appreciated. Thank you
  17. Hi.. I notice that I got problem in my code: SELECT sec_to_time(SUM(time_to_sec(Rendered))) FROM reg_att WHERE EMP_NO = '09300139'; in this query the output is : 103:52:27 // total hours. but it's wrong it should only be 103:51 //if did not count the seconds. Now my question is what would be the syntax to correct the result. I post the sample attendance. Thank you so much. 18177_.doc
  18. Hi, I notice that in my query: $result = mysql_query("INSERT INTO payroll.reg_att(EMP_NO, LOGIN, LOGOUT, TotalHours) SELECT DISTINCT a.EMP_NO, a.LOGIN, a.LOGOUT, TIMEDIFF(a.LOGOUT, a.LOGIN) FROM payroll.date_upload d, attendance.employee_attendance a JOIN hris.employment em ON (a.EMP_NO = em.EMP_NO AND em.STATUS = 'Reg Operatives') WHERE DATE(LOGOUT) BETWEEN '$FROM_DATE' AND '$TO_DATE' AND d.EMP_STATUS = 'Reg Operatives' OR ISNULL(LOGIN) OR ISNULL(LOGOUT)") or die(mysql_error()); it did not insert data where LOGOUT is 0000-00-00 00:00:00 i attach my sample file Thank you 18169_.doc
  19. Hi.. I have this code for checking if the date(TIMEOUT) is already exist in nrs table: $EMP_NO = $_GET['EMP_NO']; $DATE_NRS = $_GET['DATE_NRS']; $TIME_IN = strtotime($_GET['TIME_IN']); $TIME_OUT = strtotime($_GET['TIME_OUT']); $APPROVE = $_GET['APPROVE']; $sql = "SELECT EMP_NO, TIME_IN, TIME_OUT, TOTAL_HOURS, NRS_STATUS FROM nrs WHERE EMP_NO = '$EMP_NO' AND DATE(TIME_OUT) = '$TIME_OUT'"; //echo $sql; $RsOtData = $conn2->Execute($sql); $numrows = $RsOtData->RecordCount(); if($numrows > 0){ echo "<script>alert('Transaction cannot be process')</script>"; echo "<script>navigate('NRSEmp.php')</script>"; } else{ $saverec['EMP_NO'] = $EMP_NO; //$saverec['DATE_NRS'] = $DATE_NRS; $saverec['TIME_IN'] = $TIME_IN; $saverec['TIME_OUT'] = $TIME_OUT; $saverec['TOTAL_HOURS'] = $TOTAL_HOURS; $saverec['NRS_STATUS'] = $APPROVE; $insertSQL = $conn2->GetInsertSQL($RsOtData, $saverec); $conn2->Execute($insertSQL); } now I need revise my query to check also if the date from $TIME_OUT is equal to reg_att . for example of reg_att table data: EMP_NO = 00000221 LOGIN = 2012-03-01 05:35:00 LOGOUT = 2012-03-01 13:35:00 if Date from $TIMEOUT = date(LOGOUT) if condition will work. I trid this query SELECT n.EMP_NO, n.TIME_IN, n.TIME_OUT, TOTAL_HOURS, NRS_STATUS FROM nrs n WHERE EMP_NO = '00000221' AND DATE(TIME_OUT) = '2012-03-01' OR DATE(TIME_OUT) = (SELECT DATE(LOGOUT) FROM reg_att r WHERE r.EMP_NO = n.EMP_NO); and i got an error: Error Code : 1242 Subquery returns more than 1 row (0 ms taken) Thank you
  20. I tried some testing: $TAX = ($TotEarn - 7917); // 1920.46 $TAX = ($TAX * . 25); // 480.115 $TAX = round($TAX, 2) // 480.11 but when I tried this: $TAX = (480.115); $TAX = round($TAX , 2); // 480.12 I notice that if the variable is = actual numeric it works but if it is came from variable it did not work I really don't know what to do Thank you
  21. I resolved it using this code: $currentSR = sprintf("JO%s%04d", $currentYMD, $currentSRNum); $currentSR = "JO" . $currentYMD . sprintf("%04d", $currentSRNum); Thank you
×
×
  • 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.