|
 |
|
Master-Detail ครับ ฉบับพีเอชพี ก่อนอื่นต้องขอโทษด้วยนะครับที่ให้รอ โพสช้าไปนิด ต้องเคลียงานนิดหน่อยครับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
// ก่อนอื่นต้องขอโทษด้วยนะครับที่ให้รอ โพสช้าไปนิด ต้องเคลียงานนิดหน่อยครับ ไม่ค่อยได้เข้าออฟฟิสครับ
// require("config.inc.php"); //ไฟล์นี้สำหรับคอนเน็คดาต้าเบส และเก็บฟังก์ชั่นต่างๆ ที่ผมต้องใช้ครับ
// require("check-system.inc.php"); //ไฟล์นี้ผมสร้างขึ้นเพื่อตรวจสอบการเข้าระบบครับ รวมถึงช่วงเวลาที่จะทำงานได้ และการตรวจสอบบราวเซอร์ที่จะใช้งานได้
// require("style/style-base.css.php"); //ไฟล์สไตล์ชีตสำหรับเอชทีเอ็มแอลพื้นฐานครับ
// require("style/style-font.css.php"); //ไฟล์สตล์ชีตสำหรับฟอร์นต่างๆ ครับ
// require("style/style-form-object.css.php"); //ไฟล์สไตล์ชีตสำหรับออฟเจ็กของฟอร์มทั้งหมดครับ ตัวสำคัญคือคลาส readonly ใช้กำหนดให้เปลี่ยนสีพื้นของออฟเจ็กเพื่อให้ผู้ใช้ได้รู้ว่าช่องนี้ไม่ต้องป้อนข้อมูล
// require("java/handler.js.php"); //ไฟล์นี้แจกไปแล้วครับ สำหรับตรวจสอบการทำงานหน้าเว็ป เพื่อห้องกันผู้ใช้เปิดทิ้งไว้ครับ
// ============================================================== //
// คราวนี้มาดูโครงสร้างของข้อมูลกันบ้างครับ บริษัทผมมีสาขา 20 สาขาจำหน่ายสินค้าหลายตัว ในแต่ละสาขาก็จะมีคลังสินค้า และมีการจำหน่ายสินค้าที่ไม่เหมือนกับสาขาอื่นก็ได้
// การจำหน่ายสินค้าในแต่ละวันอาจจะจำหน่ายไม่หมด พนักงานขายสามารถนำกลับมาฝากสินค้าไว้กับบริษัทได้ แต่ต้องเบิกสินค้าที่ฝากไว้ในวันตัดไป หรือรอบบิลตัดไป หมายถึงว่าต้องบังคับเบิกที่ฝากไว้นั่นเอง
// ในหนึ่งวันพนักงานขายสามารถเบิกสินค้าได้หลายๆ รอบ ในแต่ละรอบจะมีใบเบิกหนึ่งใบเป็นตัวยืนยัน
// ตารางต่างๆ ประกอบด้วย
// ตารางสินค้า tb_product
// ตารางเบิกสินค้า tb_open + tb_open_detail
// ตารางสินค้าฝาก tb_consign + tb_consign_detail
// ตารางคลังสินค้า tb_inventory
// ตารางเลขที่บิล tb_number
// ตารางบุคคล tb_person //รายชื่อลูกค้า พนักงานทั่วไป พนักงานขายไว้ในนี้ทั้งหมดครับ เพราะโครงสร้างเดียวกัน ผมเลยไม่อยากแยกให้ปวดกะบาลครับ
// เรื่องของเขตข้อมูลทั้งหมด ผมขอไม่เปิดเผยนะครับ ขอเปิดแค่บางส่วน ลองดูเอาจากคำสั่งเอสคิวแอลที่ผมสร้างไว้นะครับ
// ============================================================= //
// ลักษณะการทำงาน เมื่อเข้าสู่หน้าฟอร์มครั้งแรก พนักงานคีย์ข้อมูลจะต้องเลือกผู้รับสินค้าก่อนอันดับแรก โปรแกรมจะทำการส่งผู้รับสินค้าไปประมวลผล เพื่อหาสินค้าที่ฝากไว้แต่ยังไม่ได้เบิกของบุคคลนั้น
// หลังจากที่เลือกผู้รับสินค้าแล้วพนักงานจะป้อนรายละเอียดการเบิกสินค้า ในที่นี้จะมีการคำนวนทันทีที่คีย์ลงไปด้วยจาว่าสคริป
// หลังจากคีย์ข้อมูลเสร็จแล้วก็จะต้องกดปุ่มเซฟ หากมีการป้อนข้อมูลที่ไม่ถูกต้องก็จะแจ้งให้ทราบด้วยจาว่าสคริปอีกเช่นกัน
// ในการป้อนข้อมูลรายละเอียดหากสินค้ารายการใดไม่ได้เบิกก็ปล่อยเว้นว่างไว้ได้ เพราะการแสดงแบบฟอร์มเป็นการดึงข้อมูลมาจากคลังสินค้าที่มีขาย
// หากท่านใดเห็นว่าคลังสินค้ามีจำนวนมาก การแสดงฟร์อมก็มีแท็กบ็อกจำนวนมากเช่นกัน ดังนั้นเราสามารถทำแบบฟอร์มให้เลือกสินค้าที่จะป้อนเท่านั้น
// ก่อนที่จะเข้าหน้านี้ แต่ผมไม่ขอนำเสนอนะครับ หลักการง่ายๆ ลองทำดูครับ
// ผมได้ตัดส่วนของการรับส่งข้อมูลบางส่วนเช่นวิธีการส่งข้อมูลของผมพร้อมไอพีของผู้ป้อนข้อมูล ระยะเวลาป้อนข้อมูล และอื่นๆ เพื่อป้องการการเจาะระบบนะครับ
// หวังว่าตรงส่นนั้นไม่ว่ากันนะครับ งั้นนี้ไม่ได้หวง แต่เพื่อความปลอดภัยของข้อมูลบริษัทครับ
// ส่วนเรื่องของโค้ดนะครับ ผมเวลาน้อยเลยอธิบายไม่หมด หรือหากท่านใดมีแนวคิด ที่จะเสนอแนะ หรือเพิ่มเติมแนะนำด้วยครับ
// มีปัญหาหรือข้อสงสัยตรงไหนก็โพสถามละกันนะครับ
?>
<?
session_start();
?>
<html>
<head>
<title>บริษัท 888 จำกัด</title>
<meta name="Generator" content="">
<meta name="Author" content="นาโน โทโร่">
<meta name="Keywords" content="">
<meta name="Description" content="">
<meta http-equiv="Content-Type" content="text/html; charset=TIS620">
<link rel="shortcut icon" type="image/x-icon" href="image/favicon.ico">
<?
require("config.inc.php");
require("check-system.inc.php");
require("style/style-base.css.php");
require("style/style-font.css.php");
require("style/style-form-object.css.php");
require("java/handler.js.php");
$BraID = $_SESSION['BraID'];
$PerInputData = $_SESSION['PerID'];
$SqlSyntax = "SELECT PerID, PerName FROM tb_person WHERE (PerID = '$PerInputData')";
$Query = mysql_query($SqlSyntax);
$Result = mysql_fetch_array($Query);
$PerInputData = $Result['PerID'] . " - " . $Result['PerName'];
(isset($_POST['Hidden'])) ? $Hidden = $_POST['Hidden'] : $Hidden = "";
(isset($_POST['Event'])) ? $Event = $_POST['Event'] : $Event = "";
(isset($_POST['PerCustomer'])) ? $PerCustomer = $_POST['PerCustomer'] : $PerCustomer = "";
if (($Hidden == "Hidden") and ($Event == "Submit"))
{
(isset($_POST['Vertify'])) ? $Vertify = $_POST['Vertify'] : $Vertify = "";
if ($Vertify != $_SESSION['VertifyValue'])
{
$txtMessage = "รหัสยืนยันการป้อนข้อมูลไม่ถูกต้อง กรุณาตรวจสอบใหม่อีกครั้ง";
} else
{
//เริ่มต้นทรานเซกชั่น (จำเป็นต้องใช้ทรานเซกชั่นเพราะมีการเชื่อมโยงข้อมูลในหลายๆ ตาราง หากมีการผิดพลาดในกำทำงานที่ใดที่หนึ่ง จะได้ยกเลิกการกระทำก่อนหน้าทั้งหมด เพื่อความถูกต้องและสมบูรณ์ของข้อมูล)
mysql_query("BEGIN");
$Error = false; //กำหนดว่ายังไม่มีข้อผิดพลาดใดๆ
//เตรียมข้อมูลเล่มที่เลขที่ใบเบิกสิยค้า
$SqlSyntax = "SELECT NumIDOpen, CatIDOpen, BraID FROM tb_number WHERE BraID = '$BraID'";
$Query = mysql_query($SqlSyntax);
$Result = mysql_fetch_array($Query);
$NumIDOpen = $Result['NumIDOpen'];
$CatIDOpen = $Result['CatIDOpen'];
if ($CatIDOpen == 0) $CatIDOpen = 1;
if ($tNumID == 9999)
{
$NumIDOpen = 1;
$CatIDOpen++;
} else
{
$NumIDOpen++;
}
//เตรียมคำสั่ง เอสคิวแอลสำหรับปรับปรุงเลขที่ เล่มที่ใบเบิกสินค้า
$SqlSyntax = "UPDATE tb_number SET NumIDOpen = $NumIDOpen, CatIDOpen = $CatIDOpen WHERE (BraID = '$BraID')";
$Query = mysql_query($SqlSyntax);
if (!$Query) {$Error = true;}
//เตรียมข้อมูลที่จะบันทึกในตารางโอเพ่น (มาสเตอร์)
$NumIDOpen = set_len_id($NumIDOpen, 4);
$CatIDOpen = set_len_id($CatIDOpen, 4);
$idPerInputData = substr($PerInputData, 0, 5);
$idPerCustomer = substr($PerCustomer, 0, 5);
(isset($_POST['PerStock'])) ? $PerStock = $_POST['PerStock'] : $PerStock = "";
$idPerStock = substr($PerStock, 0, 5);
$OpeDate = date($dFormat, $dtBkk);
(isset($_POST['OpeAmount'])) ? $OpeAmount = doubleval($_POST['OpeAmount']) : $OpeAmount = 0.00;
//เตรียมคำสั่งเอสคิวแอลสำหรับบันทึกข้อมูลในตารางโอเพ่น
$SqlSyntax = "INSERT INTO tb_open (BraID, NumID, CatID, PerIDCus, PerIDStock, PerIDInput, OpeDate, OpeAmount) VALUES ('$BraID', '$NumIDOpen', '$CatIDOpen', '$idPerCustomer', '$idPerStock', '$idPerInputData', '$OpeDate', $OpeAmount)";
$Query = mysql_query($SqlSyntax);
if (!$Query) {$Error = true;}
//รับจำนวนรายการสินค้าที่แสดงในฟอร์ม
(isset($_POST['RecordCount'])) ? $RecordCount = $_POST['RecordCount'] : $RecordCount = 0;
//ทำการรับข้อมูลตาจำนวนรายการสินค้า และสร้างคำสั่งสำหรับบันทึกข้อมูลในตารางโอเพ่นดีเทล
for ($iCount = 0; $iCount < $RecordCount; $iCount++)
{
//รับข้อมูลรายละเอียดการเบิกสินค้า
(isset($_POST['ProID'])) ? $ProID[$iCount] = $_POST['ProID'][$iCount] : $ProID[$iCount] = "";
(isset($_POST['ConQuantity'])) ? $ConQuantity[$iCount] = intval($_POST['ConQuantity'][$iCount]) : $ConQuantity[$iCount] = 0;
(isset($_POST['OpeQuantity'])) ? $OpeQuantity[$iCount] = intval($_POST['OpeQuantity'][$iCount]) : $OpeQuantity[$iCount] = 0;
(isset($_POST['FreQuantity'])) ? $FreQuantity[$iCount] = intval($_POST['FreQuantity'][$iCount]) : $FreQuantity[$iCount] = 0;
(isset($_POST['ProSale'])) ? $ProSale[$iCount] = doubleval($_POST['ProSale'][$iCount]) : $ProSale[$iCount] = 0;
(isset($_POST['ProSaleVat'])) ? $ProSaleVat[$iCount] = doubleval($_POST['ProSaleVat'][$iCount]) : $ProSaleVat[$iCount] = 0;
$OpeTotal[$iCount] = $ConQuantity[$iCount] + $OpeQuantity[$iCount] + $FreQuantity[$iCount];
if ($OpeTotal[$iCount] >= 1)
{
//เตรียมข้อมูลสำหรับปรับปรุงสินค้าคงคลังในตารางอินเว็นทอรี่
$SqlSyntax = "SELECT BraID, ProID, InvStock FROM tb_inventory WHERE (BraID = '$BraID') AND (ProID = '$ProID[$iCount]')";
$Query = mysql_query($SqlSyntax);
$Result = mysql_fetch_array($Query);
$tInvStock = $Result['InvStock'] - $OpeTotal[$iCount];
//สร้างคำสั่งเอสคิวแอลสำหรับปรับปรุงข้อมูลในตารางอินเว็นทอรี่
$SqlSyntax = "UPDATE tb_inventory SET InvStock = $tInvStock WHERE (BraID = '$BraID') AND (ProID = '$ProID[$iCount]')";
$Query = mysql_query($SqlSyntax);
if (!$Query) {$Error = true;}
//สร้างคำสั่งเอสคิวแอลสำหรับบันทึกข้อมูลในตารางโอเพ่นดีเทล
$SqlSyntax = "INSERT INTO tb_open_detail (BraID, NumID, CatID, ProID, ConQuantity, OpeQuantity, FreQuantity, ProSale, ProSaleVat) VALUES ('$BraID', '$NumIDOpen', '$CatIDOpen', '$ProID[$iCount]', $ConQuantity[$iCount], $OpeQuantity[$iCount], $FreQuantity[$iCount], $ProSale[$iCount], $ProSaleVat[$iCount])";
$Query = mysql_query($SqlSyntax);
if (!$Query) {$Error = true;}
//สร้างคำสั่งเอสคิวแอลสำหรับปรับปรุงข้อมูลสินค้าที่ฝากไว้ว่าได้ทำเรื่องเบิกไปแล้ว
if ($ConQuantity[$iCount] >= 1)
{
$SqlSyntax = "UPDATE tb_consign_detail SET ConSta = 'YES' WHERE (BraID = '$BraID') AND (ProID = '$ProID[$iCount]') AND (PerID = '$idPerCustomer')";
$Query = mysql_query($SqlSyntax);
if (!$Query) {$Error = true;}
}
}
}
//ตรวจสอบการทำงานมีข้อผิดพลาดหรือไม่ ถ้าไม่มีให้ทำการยืนยันบันทึกข้อมูลลงฐานข้อมูลจริง ถ้ามีข้อผิดพลาดให้ทำการยกเลิกกระบวนการทั้งหมด
if(!$Error)
{
mysql_query("COMMIT");
//บันทึกข้อมูล
?>
<script language="javascript" type="text/javascript">
alert("บันทึกข้อมูลรายการเลขที่ <?=$NumIDOpen?> เล่มที่ <?=$CatIDOpen?> เรียบร้อยแล้ว")
parent.RightFrame.location.replace("view-open.php");
</script>
<?
} else
{
mysql_query("ROLLBACK");
//ยกเลิก
$txtMessage = "มีข้อผิดพลาดในการบันทึกข้อมูล กรุณาตรวจสอบใหม่อีกครั้ง";
}
}
}
?>
<script language="javascript" type="text/javascript">
var VatRate = <?=vat_rate()?>;
function ChangeCustomer()
{
var Frm = document.AddOpenForm;
Frm.Event.value = "ChangeCustomer";
Frm.submit();
}
function Numbers(e)
{
var keynum;
var keychar;
var numcheck;
if(window.event) // IE
{
keynum = e.keyCode;
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which;
}
keychar = String.fromCharCode(keynum);
numcheck = /\d/;
return numcheck.test(keychar);
}
function CalTotal(i)
{
var Frm = document.AddOpenForm;
var InvStock = Frm.elements["InvStock[" + i + "]"];
var ConQuantity = Frm.elements["ConQuantity[" + i + "]"];
var OpeQuantity = Frm.elements["OpeQuantity[" + i + "]"];
var ProSale = Frm.elements["ProSale[" + i + "]"];
var FreQuantity = Frm.elements["FreQuantity[" + i + "]"];
var PriceTotal = Frm.elements["PriceTotal[" + i + "]"];
var OpeTotal = Frm.elements["OpeTotal[" + i + "]"];
if (((OpeQuantity.value - 0) + (FreQuantity.value - 0)) > (InvStock.value - 0))
{
alert("สินค้าคงคลังมีไม่พอจ่าย กรุณาป้อนใหม่");
OpeQuantity.value = "";
FreQuantity.value = "";
}
var tPriceTotal = ((ConQuantity.value - 0) + (OpeQuantity.value - 0)) * (ProSale.value - 0);
PriceTotal.value = tPriceTotal.toFixed(2);
OpeTotal.value = (ConQuantity.value - 0) + (OpeQuantity.value - 0) + (FreQuantity.value - 0);
var RecordCount = Frm.RecordCount.value;
var NetTotal = 0;
var VatPrice = 0;
var NetPrice = 0;
for (var j = 0; j < RecordCount; j++)
{
var tNetTotal = Frm.elements["PriceTotal[" + j + "]"];
NetTotal = NetTotal + (tNetTotal.value - 0);
}
Frm.NetTotal.value = NetTotal.toFixed(2);
VatPrice = NetTotal * (VatRate / 100);
Frm.VatPrice.value = VatPrice.toFixed(2);
NetPrice = NetTotal - VatPrice;
Frm.NetPrice.value = NetPrice.toFixed(2);
}
function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if (((evt.keyCode == 13) && (node.type=="text")) || ((evt.keyCode == 13) && (node.type=="password"))) {return false;}
}
document.onkeypress = stopRKey;
function SubmitForm()
{
var Frm = document.AddOpenForm;
Frm.Event.value = "Submit";
var RecordCount = Frm.RecordCount.value;
var OpeTotal = 0;
for (var j = 0; j < RecordCount; j++)
{
var ConQuantity = Frm.elements["ConQuantity[" + j + "]"];
var OpeQuantity = Frm.elements["OpeQuantity[" + j + "]"];
var FreQuantity = Frm.elements["FreQuantity[" + j + "]"];
OpeTotal = OpeTotal + (ConQuantity.value - 0) + (OpeQuantity.value - 0) + (FreQuantity.value - 0);
}
if (Frm.PerCustomer.value == "")
{
alert("กรุณากำหนดชื่อผู้รับสินค้าด้วย");
return false;
} else if (Frm.PerStock.value == "")
{
alert("กรุณากำหนดชื่อพนักงานจ่ายสินค้าด้วย");
return false;
} else if (Frm.Vertify.value == "")
{
alert("กรุณาป้อนรหัสยืนยันการเข้าระบบด้วย");
return false;
} else if (OpeTotal <= 0)
{
alert("กรุณาป้อนข้อมูลรายการเบิกสินค้าด้วย");
return false;
} else
{
Frm.submit();
}
}
</script>
</head>
<body onclick="Ehandler()" onkeypress="Ehandler()">
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td width="760" height="650" align="center" valign="top">
<form name="AddOpenForm" action="?" method="post">
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td width="740" height="45" align="center" valign="middle" background="image/head-view.png">
<font class="FontHdata">เพิ่มข้อมูลการเบิกจ่ายสินค้า</font>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td width="590" height="25" align="left" valign="middle">
ผู้รับสินค้า : <select name="PerCustomer" onchange="ChangeCustomer()">
<option value="<?=$PerCustomer?>"><?=$PerCustomer?></option>
<option value="<?=$PerCustomer?>">-</option>
<?
$SqlSyntax = "SELECT PerID, PerName, PerType FROM tb_person WHERE (BraID = '$BraID') AND (PerType LIKE 'ลูกค้า%')";
$Query = mysql_query($SqlSyntax);
$RecCount = mysql_num_rows($Query);
for ($iCount = 0; $iCount < $RecCount; $iCount++)
{
$Result = mysql_fetch_array($Query);
$Person = $Result['PerID'] . " - " . $Result['PerName'];
echo "<option value='$Person'>$Person</option> \n";
}
?>
</select>
</td>
<td width="150" height="25" align="right" valign="middle">
เล่มที่ : <input type="text" value="Auto" name="CatID" size="10" readonly="true" class="readonly">
</td>
</tr>
<tr>
<td width="590" height="25" align="left" valign="middle">
พนง.จ่ายสินค้า : <select name="PerStock">
<option value="<?=$PerStock?>"><?=$PerStock?></option>
<option value="<?=$PerStock?>">-</option>
<?
$SqlSyntax = "SELECT PerID, PerName, PerType FROM tb_person WHERE (BraID = '$BraID') AND (PerType LIKE 'พนักงาน%')";
$Query = mysql_query($SqlSyntax);
$RecCount = mysql_num_rows($Query);
for ($iCount = 0; $iCount < $RecCount; $iCount++)
{
$Result = mysql_fetch_array($Query);
$Person = $Result['PerID'] . " - " . $Result['PerName'];
echo "<option value='$Person'>$Person</option> \n";
}
?>
</select>
</td>
<td width="150" height="25" align="right" valign="middle">
เลขที่ : <input type="text" value="Auto" name="NumID" size="10" readonly="true" class="readonly">
</td>
</tr>
<tr>
<td width="590" height="25" align="left" valign="middle">
พนง.คีย์ข้อมูล : <input type="text" value="<?=$PerInputData?>" name="PerInputData" size="50" readonly="true" class="readonly">
</td>
<td width="150" height="25" align="right" valign="middle">
<?
$OpeDate = thai_date(date($dFormat, $dtBkk));
?>
วันที่ : <input type="text" name="OpeDate" value="<?=$OpeDate?>" size="10" readonly="true" class="readonly">
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="1" border="0" align="center">
<tr>
<th height="25" width="249" valign="middle" align="center">สินค้า</th>
<th height="25" width="69" valign="middle" align="center">คงคลัง</th>
<th height="25" width="69" valign="middle" align="center">เบิกฝาก</th>
<th height="25" width="69" valign="middle" align="center">เบิกใหม่</th>
<th height="25" width="69" valign="middle" align="center">ราคา/@</th>
<th height="25" width="59" valign="middle" align="center">แถม</th>
<th height="25" width="69" valign="middle" align="center">รวมเบิก</th>
<th height="25" width="79" valign="middle" align="center">รวมราคา</th>
</tr>
<?
$SqlSyntax = "SELECT BraID, tb_inventory.ProID, InvStock, tb_product.ProID, ProName, ProTaste, ProWareSize, ProUnitWare, ProSale1, ProSaleVat1 FROM tb_inventory, tb_product WHERE (BraID = '$BraID') AND (tb_product.ProID = tb_inventory.ProID)";
$Query = mysql_query($SqlSyntax);
$RecCount = mysql_num_rows($Query);
$BgColor = "#dddddd";
for ($iCount = 0; $iCount < $RecCount; $iCount++)
{
$Result = mysql_fetch_array($Query);
$ProID[$iCount] = $Result['ProID'];
if ($Result['ProTaste'] == "-ไม่มี-")
{
$ProName[$iCount] = $Result['ProName'] . " " . $Result['ProWareSize'] . " " . $Result['ProUnitWare'];
} else
{
$ProName[$iCount] = $Result['ProName'] . " รส" . $Result['ProTaste'] . " " . $Result['ProWareSize'] . " " . $Result['ProUnitWare'];
}
$ProSale[$iCount] = $Result['ProSale1'];
$ProSaleVat[$iCount] = $Result['ProSaleVat1'];
$InvStock[$iCount] = $Result['InvStock'];
$idPerCustomer = substr($PerCustomer, 0, 5);
$SqlSyntax = "SELECT ProID, BraID, ConQuantity, ConSta FROM tb_consign_detail WHERE (ProID = '$ProID[$iCount]') AND (BraID = '$BraID') AND (ConSta = 'NO') AND (PerID = '$idPerCustomer')";
$Query2 = mysql_query($SqlSyntax);
$Result = mysql_fetch_array($Query2);
$ConQuantity[$iCount] = $Result['ConQuantity'];
?>
<tr bgcolor="<?=$BgColor?>">
<td height="25" width="249" valign="middle" align="left">
<input type="text" value="<?=$ProName[$iCount]?>" size="37" name="ProName[<?=$iCount?>]" readonly="true" class="readonly">
<input type="hidden" value="<?=$ProID[$iCount]?>" name="ProID[<?=$iCount?>]">
</td>
<td height="25" width="69" valign="middle" align="left">
<input type="text" value="<?=$InvStock[$iCount]?>" size="7" name="InvStock[<?=$iCount?>]" dir="RTL" readonly="true" class="readonly">
</td>
<td height="25" width="69" valign="middle" align="left">
<input type="text" value="<?=$ConQuantity[$iCount]?>" size="7" name="ConQuantity[<?=$iCount?>]" dir="RTL" readonly="true" class="readonly">
</td>
<td height="25" width="69" valign="middle" align="left">
<input type="text" value="<?=$OpeQuantity[$iCount]?>" size="7" name="OpeQuantity[<?=$iCount?>]" dir="RTL" onkeyup="CalTotal(<?=$iCount?>)" onkeypress="return Numbers(event)">
</td>
<td height="25" width="69" valign="middle" align="left">
<input type="text" value="<?=$ProSale[$iCount]?>" size="7" name="ProSale[<?=$iCount?>]" dir="RTL" readonly="true" class="readonly">
<input type="hidden" value="<?=$ProSaleVat[$iCount]?>" name="ProSaleVat[<?=$iCount?>]">
</td>
<td height="25" width="59" valign="middle" align="left">
<input type="text" value="<?=$FreQuantity[$iCount]?>" size="5" name="FreQuantity[<?=$iCount?>]" dir="RTL" onkeyup="CalTotal(<?=$iCount?>)" onkeypress="return Numbers(event)">
</td>
<td height="25" width="69" valign="middle" align="left">
<input type="text" value="<?=$OpeTotal[$iCount]?>" size="7" name="OpeTotal[<?=$iCount?>]" dir="RTL" readonly="true" class="readonly">
</td>
<td height="25" width="79" valign="middle" align="left">
<input type="text" value="<?=$PriceTotal[$iCount]?>" size="9" name="PriceTotal[<?=$iCount?>]" dir="RTL" readonly="true" class="readonly">
</td>
</tr>
<?
if ($BgColor == "#dddddd")
{
$BgColor = "#cccccc";
} else
{
$BgColor = "#dddddd";
}
}
?>
<tr>
<td height="35" colspan="7" align="right" valign="middle">
รวมเป็นเงินสุทธิ
</td>
<td height="35" width="79" align="left" valign="middle">
<input type="text" value="<?=$NetTotal?>" size="9" name="NetTotal" dir="RTL" readonly="true" class="readonly">
</td>
</tr>
<tr>
<td height="25" colspan="7" align="right" valign="middle">
ภาษีมูลค่าเพิ่ม
</td>
<td height="25" width="79" align="left" valign="middle">
<input type="text" value="<?=$VatPrice?>" size="9" name="VatPrice" dir="RTL" readonly="true" class="readonly">
</td>
</tr>
<tr>
<td height="25" colspan="7" align="right" valign="middle">
รวมราคา
</td>
<td height="25" width="79" align="left" valign="middle">
<input type="text" value="<?=$NetPrice?>" size="9" name="NetPrice" dir="RTL" readonly="true" class="readonly">
</td>
</tr>
<tr>
<td colspan="8" height="30" align="center" valign="middle">
<font class="Font12RedBold">รหัสยืนยันการป้อนข้อมูล : </font>
<input type="text" size="8" maxlength="8" name="Vertify" tabindex="3" class="input-box-login">
<img src="vertify-image.php" align="absmiddle">
</td>
<tr>
<td colspan="8" height="25" align="center" valign="middle">
<img src="image/save.png" width="49" height="19" name="BtnSave" border="0" alt="บันทึกข้อมูล" style="cursor: hand;" onclick="return SubmitForm()" title="บันทึกข้อมูล">
<img src="image/cancel.png" width="49" height="19" name="BtnSave" border="0" alt="ยกเลิก" style="cursor: hand;" onclick="parent.RightFrame.location.replace('view-open.php')" title="ยกเลิก">
</td>
</tr>
</table>
<input type="hidden" value="<?=$RecCount?>" name="RecordCount">
<input type="hidden" value="Hidden" name="Hidden">
<input type="hidden" value="" name="Event">
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript">
for (var i = 0; i < <?=$RecCount?>; i++)
{
CalTotal(i);
}
if ("<?=$txtMessage?>" != "")
{
alert("<?=$txtMessage?>");
}
</script>
</body>
</html>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-09-24 15:04:13 |
By :
NanoTHoro |
View :
2190 |
Reply :
9 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผลลัพธ์ที่ออกมาจะมีหน้าตาเป็นฟอร์มตามที่เคยโพสไปก่อนหน้านี้นะครับ
|
 |
 |
 |
 |
Date :
2009-09-24 15:06:55 |
By :
NanoTHoro |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอขอบคุณ คุณ A-mac สำหรับฟังก์ชั่นเช็คตัวเลขด้วยจาว่าสคริป (Numbers) ช่วยลดขั้นตอนการทำงานของสคริปลงไปได้เยอะเลยครับ
|
 |
 |
 |
 |
Date :
2009-09-24 15:13:55 |
By :
NanoTHoro |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยาวมากมาย เหนื่อยแทน แง่มๆ
|
 |
 |
 |
 |
Date :
2009-09-24 15:41:53 |
By :
gummezaka |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตัดออกไปล้วนะน้องมีมี่ ไม่อย่างนั้น ยาวกว่านี้อีก 200 บรรทัด  
|
 |
 |
 |
 |
Date :
2009-09-24 15:49:51 |
By :
NanoTHoro |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โว้วๆ มาแล้ว
|
 |
 |
 |
 |
Date :
2009-09-24 18:18:09 |
By :
lozomac |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คนที่ขอๆ กันไว้มาเอากันบ้างหรือยังครับ หวังว่าคงจะประยุกต์ใช้ได้นะครับ และคงมีประโยชน์สำหรับบางท่านนะครับ
|
 |
 |
 |
 |
Date :
2009-09-24 23:48:22 |
By :
NanoTHoro |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โอ๊ยจัดไปตั้งแต่โพส์แล้วเพ่ไม่รอช้า อิอิอิอิ
|
 |
 |
 |
 |
Date :
2009-09-24 23:50:40 |
By :
somparn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
  
ดูแล้วเป็นไงบ้างครับคุณสมภาร (ใช่หรือเปล่า เรียกผิดขออภัยด้วย) มีอะไรแนะนำ เพิ่มเติมบ้างครับ
|
 |
 |
 |
 |
Date :
2009-09-24 23:56:54 |
By :
NanoTHoro |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
   
|
 |
 |
 |
 |
Date :
2009-09-25 00:31:32 |
By :
giroo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|