<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $id_pro=$_REQUEST['id_pro']; $id_picking=$_REQUEST['id_picking']; $id_picking=$_POST['id_picking']; $id_pro=$_POST['id_pro']; include"config.inc.php"; $con = mysql_connect($host,$username,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con); mysql_query("SET NAMES UTF8"); ?> <form action="tran_save.php" method="post" enctype="multipart/form-data" name="form_tran" id="form_tran"> <table width="705" border="3" align="center"> <tr bgcolor="#CCCCCC"> <th width="120" bgcolor="#0066FF" scope="col">เลขที่ใบสั่งซื้อ</th> <th width="139" bgcolor="#0066FF" scope="col">ชื่อสินค้า</th> <th width="132" align="center" valign="middle" bgcolor="#0066FF" scope="col"> </th> <th width="132" align="center" valign="middle" bgcolor="#0066FF" scope="col">จำนวนที่ขาย</th> <th width="144" align="center" valign="middle" bgcolor="#0066FF" scope="col"></th> </tr> <? $sql="select products.*,picking.*,picking_detail.* from(picking inner join picking_detail on picking.id_picking=picking_detail.id_picking)inner join products on picking_detail.id_pro=products.id_pro where picking.id_picking='".$_POST['id_picking']."' order by picking.id_picking desc"; $result = mysql_query($sql)or die(mysql_error()."<br />[$sql]"); $i=0; while($row=mysql_fetch_array($result)){ $re_in=$row[re_in]; $id_picking=$row[id_picking]; $id_pro=$row[id_pro]; $quantity=$row[quantity]; $name_pro=$row[name_pro]; $product_on_hand=$row[product_on_hand]; $id_status_pro=$row[id_status_pro]; ?> <tr bgcolor="<?=$color;?>"> <td><? echo"$id_picking"; ?></td> <td align="center"><? echo"$name_pro"; ?></td> <td align="center" valign="middle"><? echo"$id_status_pro"; ?></td> <td align="center" valign="middle"><? echo"$quantity";?></td> <td align="center" valign="middle"> </td> <? $i++; } ?> </tr> <tr bgcolor="<?=$color;?>"> <td> </td> <td align="center"> </td> <td align="center" valign="middle"> </td> <td align="center" valign="middle"> </td> <td align="center" valign="middle"><input type="submit" name="re_pro" id="re_pro" value="ตรวจสอบสินค้า" /> <input name="id_pro" type="hidden" id="id_pro" value="<? echo"$id_pro";?>" /> <input name="id_picking2" type="hidden" id="id_picking2" value="<? echo"$id_picking";?>" /> <input name="quantity" type="hidden" id="quantity" value="<? echo"$quantity";?>" /> <input name="product_on_hand" type="hidden" id="product_on_hand" value="<? echo"$product_on_hand";?>" /></td> </tr> </table> </form> </body> </html>
<?php //echo"รหัสสินค้า=$id_pro"; //echo"รหัสใบร้องขอ=$id_picking"; //echo"รหัสสินค้า=$quantity"; echo"<pre>"; print_r($_REQUEST); echo"<pre>"; exit; echo"<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />"; include"config.inc.php"; $con = mysql_connect($host,$username,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con); mysql_query("SET NAMES UTF8"); $quantity=$_REQUEST['quantity']; $id_pro=$_REQUEST['id_pro']; $id_picking=$_REQUEST['id_picking']; $sql1="select * from products where id_pro='$id_pro'"; $result1 = mysql_query($sql1)or die(mysql_error()."<br />[$sql]"); $read=mysql_fetch_array($result1); $id_pro=$read[id_pro]; $id_picking=$read[id_picking]; $product_on_hand=$read[product_on_hand]; if($quantity<=$product_on_hand and $product_on_hand!='0'){ echo"<center><h3>สินค้าเพียงพอที่จะเบิก</h></center><br>"; echo"<center><h4>เบิกสินค้า $id_pro ไปจำนวน <font color='#0000CC'><h3>$quantity</h3></font> ชิ้น</h></center>"; $sql="UPDATE picking_detail SET id_status_pro='2' WHERE id_picking='".$_GET["id_picking"]."' and id_pro='$id_pro' "; $result = mysql_query($sql)or die(mysql_error()."<br />[$sql]"); $sql2="update picking set pic_status='2' where id_picking='".$_GET["id_picking"]."' "; $result2 = mysql_query($sql2)or die(mysql_error()."<br />[$sql]"); //$new_product_on_hand=$product_on_hand-$quantity; //$sql2="update products set product_on_hand='$new_product_on_hand' where id_pro='$id_pro'"; //$result2 = mysql_query($sql2)or die(mysql_error()."<br />[$sql]"); }else{ $pro_back=$quantity-$product_on_hand; echo"<center>สินค้าไม่เพียงพอที่จะเบิกขาดอีกจำนวน $pro_back บันทึกได้แค่ $product_on_hand"; $sql="UPDATE picking_detail SET id_status_pro='3' WHERE id_picking='".$_GET["id_picking"]."' and id_pro='$id_pro' "; $result = mysql_query($sql)or die(mysql_error()."<br />[$sql]"); $sql2="update picking set pic_status='3' where id_picking='".$_GET["id_picking"]."' "; //$result2 = mysql_query($sql2)or die(mysql_error()."<br />[$sql2]"); //$new_product_on_hand=$product_on_hand-$quantity; //$sql3="update products set product_on_hand='$new_product_on_hand' where id_pro='$id_pro'"; //$result3 = mysql_query($sql3)or die(mysql_error()."<br />[$sql]"); } if($result){ echo "<center><font color='blue'>บันทึกเรียบร้อยแล้ว<br>"; }else{ echo "<center><font color='red'>ไม่สามารถบันทึกได้<br>"; } //echo"<meta http-equiv='refresh' content='2; url=from_check_product.php?id_pro=$id_pro&id_picking=$id_picking'>"; mysql_close($con); ?>
select s.id, s.balance , count(o.id) as count_order , sum( o.unit) as order_all_unit from stock as s inner join order_detail as o on o.stock_id=s.id group by s.id, s.balance
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง