Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > PHP > PHP Forum > ช่วยหน่อยครับ อยากทำแบบกดยืนยันการเบิก แล้วให้รายการในนี้ เพิ่มไปยุอีกตาราง แล้วลบรายการออกไปจากตารางนี้ คล้ายๆ กับ ตระก้าสินค้า อ่ะครับ แนะนำหน่อย



 

ช่วยหน่อยครับ อยากทำแบบกดยืนยันการเบิก แล้วให้รายการในนี้ เพิ่มไปยุอีกตาราง แล้วลบรายการออกไปจากตารางนี้ คล้ายๆ กับ ตระก้าสินค้า อ่ะครับ แนะนำหน่อย

 



Topic : 090758



โพสกระทู้ ( 55 )
บทความ ( 0 )



สถานะออฟไลน์




หน้ายืนยันการเบิกวัสดุ
<?php require_once('Connections/arunyik.php'); ?>
<?php require_once('Connections/arunyik.php'); ?>
<?php 
ob_start();
require_once('Connections/arunyik.php'); ?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "admin_fail.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?><?php 
ob_start();
require_once('Connections/arunyik.php'); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_arunyik, $arunyik);
$query_Recordset1 = "SELECT * FROM basket ORDER BY b_id ASC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $arunyik) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$query_Recordset2 = "SELECT sum(price_sum)as sumprice FROM basket ";
$Recordset2 = mysql_query($query_Recordset2);
$row_Recordset2 = mysql_fetch_array($Recordset2);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?><!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>ใบยืนยันการเบิกวัสดุ</title>
<style type="text/css">
<!--
.style1 {
	font-size: 18px;
	font-weight: bold;
}
-->
</style>
</head>
<?php
function DoFormatCurrency($theObject,$NumDigitsAfterDecimal,$DecimalSeparator,$GroupDigits,$CurrencySymbol) { 
	$currencyFormat=$CurrencySymbol.number_format($theObject,$NumDigitsAfterDecimal,$DecimalSeparator,$GroupDigits);
	return ($currencyFormat);
}
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
$price_sum=$s_num * $s_price;
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form2")) {
  $updateSQL = sprintf("UPDATE basket SET s_num=%s,price_sum='$price_sum'WHERE b_id='$b_id'",
                       GetSQLValueString($HTTP_POST_VARS['s_num'], "int"));

  mysql_select_db($database_arunyik, $arunyik);
  $Result1 = mysql_query($updateSQL, $arunyik) or die(mysql_error());

  $updateGoTo = "widen_submit.php";
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

mysql_select_db($database_arunyik, $arunyik);
$query_Rs_per = "SELECT * FROM personnel";
$Rs_per = mysql_query($query_Rs_per, $arunyik) or die(mysql_error());
$row_Rs_per = mysql_fetch_assoc($Rs_per);
$totalRows_Rs_per = mysql_num_rows($Rs_per);

mysql_select_db($database_arunyik, $arunyik);
$query_Rs_bas = "SELECT * FROM basket, personnel WHERE basket.p_id=personnel.p_id AND basket.b_id='$b_id'";
$Rs_bas = mysql_query($query_Rs_bas, $arunyik) or die(mysql_error());
$row_Rs_bas = mysql_fetch_assoc($Rs_bas);
$totalRows_Rs_bas = mysql_num_rows($Rs_bas);
?>
<body>
<p align="center" class="style1">ยืนยันการเบิกวัสดุ</p>
<table width="998" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
  <tr>
    <td width="122">รหัส</td>
    <td width="142" align="center">รายการวัสดุ</td>
    <td width="132" align="center">ขนาด</td>
    <td width="159" align="center">จำนวน</td>
    <td width="124" align="center">หน่วยนับ</td>
    <td width="140" align="center">ราคาต่อ/หน่วย</td>
    <td width="163" align="center">ราคารวม</td>
    <td width="163" align="center">ลบรายการ</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_Recordset1['b_id']; ?></td>
      <td align="center"><?php echo $row_Recordset1['s_name']; ?></td>
      <td align="center"><?php echo $row_Recordset1['s_size']; ?></td>
      <td align="center"><form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
        <label><strong><font size="4" face="AngsanaUPC">
          <input name="s_num" type="text" class="text01" id="s_num" value="<?php echo $row_Recordset1['s_num']; ?>" size="7" />
          </font></strong></label>
        <label>
          <input type="submit" name="Submit2" value="ตกลง" />
          </label>
        <input name="b_id" type="hidden" id="b_id" value="<?php echo $row_Recordset1['b_id']; ?>" />
        <input name="s_price" type="hidden" id="s_price" value="<?php echo $row_Recordset1['s_price']; ?>" />
        <strong><font size="4" face="AngsanaUPC">
          <input type="hidden" name="MM_update" value="form2" />
          </font></strong>
      </form></td>
      <td align="center"><?php echo $row_Recordset1['s_unit']; ?></td>
      <td align="center"><?php echo $row_Recordset1['s_price']; ?></td>
      <td align="center"><?php echo $row_Recordset1['price_sum']; ?></td>
      <td align="center"><a href="widen_submit_delete.php?b_id=<?php echo $row_Recordset1['b_id']; ?>"><img src="image/icon/delete.gif" width="19" height="18" border="0" /></a></td>
    </tr>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  <tr>
    <td height="23" colspan="8"><div align="right">ราคารวม <?php echo "ผลรวมเท่ากับ ".$row_Recordset2["sumprice"];?>บาท </div></td>
  </tr>
  <tr>
    <td colspan="8"><div align="center">
        <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1" id="form1">
          <label> จ่ายให้พนักงาน 
          <select name="select">
            <option value="0">กรุณาเลือกชื่อพนักงาน</option>
            <?php
do {  
?>
            <option value="<?php echo $row_Rs_per['p_id']?>"><?php echo $row_Rs_per['p_fname']?></option>
            <?php
} while ($row_Rs_per = mysql_fetch_assoc($Rs_per));
  $rows = mysql_num_rows($Rs_per);
  if($rows > 0) {
      mysql_data_seek($Rs_per, 0);
	  $row_Rs_per = mysql_fetch_assoc($Rs_per);
  }
?>
          </select>
  </label>
          <select name="select2">
            <option value="0">กรุณาเลือกนามสกุลพนักงาน</option>
            <?php
do {  
?>
            <option value="<?php echo $row_Rs_per['p_id']?>"><?php echo $row_Rs_per['p_lname']?></option>
            <?php
} while ($row_Rs_per = mysql_fetch_assoc($Rs_per));
  $rows = mysql_num_rows($Rs_per);
  if($rows > 0) {
      mysql_data_seek($Rs_per, 0);
	  $row_Rs_per = mysql_fetch_assoc($Rs_per);
  }
?>
          </select>
          <label><br />
          <input type="submit" name="Submit" value="ยืนยันการเบิกวัสดุ" />
          </label>
        </form>
      </div></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($Rs_bas);

mysql_free_result($Rs_per);

mysql_free_result($Recordset1);
?>




Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-02-12 15:56:30 By : natt3021 View : 677 Reply : 2
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ใจความมันอยู่ที่การเลือกข้อมูลเก่ามาแล้วจะ Update/Delete น่ะครับ ลอง Copy เฉพาะ Code ที่คิดว่ามีปัญหาออกมาดูครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-13 06:30:32 By : mr.win
 


 

No. 2



โพสกระทู้ ( 3,844 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์
Twitter Facebook

เอา Concept ไปก่อนน่ะครับ

1. ตอนกดยืนยันให้ส่ง id การจองรายการเบิก ไป select เอาข้อมูล ออกมาครับ
2. นำข้อมูลที่ได้จากการ select มา insert ลงตารางใหม่
3. ถ้า insert ลงตารางใหม่สำเร็จ ก็ใช้ id จากข้อ 1 ลบข้อมูลจากตารางจองรายการเบิกออกครับ
4. ถ้าไม่ผ่านข้อ 3 ให้กลับไปทำตามข้อ 1 อีกรอบครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-14 13:33:59 By : mangkunzo
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยหน่อยครับ อยากทำแบบกดยืนยันการเบิก แล้วให้รายการในนี้ เพิ่มไปยุอีกตาราง แล้วลบรายการออกไปจากตารางนี้ คล้ายๆ กับ ตระก้าสินค้า อ่ะครับ แนะนำหน่อย
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่