|
 |
|
ทำอย่างไรให้เลข PO ไม่บวกเพิ่มถ้าต้องการเพิ่มรถคันต่อไปในเลขบิลเดิม |
|
 |
|
|
 |
 |
|

การเพิ่มข้อมูลรถ ทำอย่างไรให้เลขPO ไม่บวกเพิ่มถ้าต้องการเพิ่มรถคันต่อไปในเลขบิลเดิม
ถ้ากดรีเฟรชเลข PO ก้อจะบวกเพิ่มไปเรื่อยๆ ทั้งที่ไม่เพิ่มข้อมูล
Code (PHP)
<? session_start(); ?>
<? include "s1.php"; ?>
<? include "script.php"; ?>
<? include "pref.php"; ?>
<? include "connect.php"; ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="main_style.css" rel="stylesheet" type="text/css">
<title>บันทึกใบ PO รถจักรยานยนต์</title>
<div id="right_block1" align="right"><? include"show_user.php";?></div>
<div id="left_block1" align="left"><? include"menu.php";?></div>
<body>
<form action="4.php" method="post">
<br /><br />
<div id="right_block">
<table width="940" style="font-size: 13px; text-align: left;">
<tr>
<td height="40"> </td>
<td> </td>
<td>เลขที่ใบรับรถ</td>
<td>
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("motor");
$strSQL = "SELECT * FROM pref WHERE 1 ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$objResult = mysql_fetch_array($objQuery);
$PO = $objResult["keyname"];
$po = $PO.'-'.$strNextSeq;
?>
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("motor");
$strSQL = "SELECT * FROM stock_mas ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResuut = mysql_fetch_array($objQuery))
{
$po_id = $objResuut["po_id"];
}
if($po_id != $po)
{
?><input name="txtpo_id" type="text" class="tbl_box7" id="txtpo_id" value="<?=$po;?>"> <?
}else
{
?><input name="txtpo_id" type="text" class="tbl_box7" id="txtpo_id" value="<?=$po_id;?>"><?
}
?>
</td>
<td align="right">วันที่รับรถ</td>
<td><input type="text" name="txtdate_receive" id="txtdate_receive"></td>
</tr>
<tr>
<td align="right">รับรถจากสาขา</td>
<td colspan="3" align="left">
<select name="txtbranch" id="txtbranch">
<option value="">------------ เลือก -----------</option>
<?
$strSQL = "SELECT * FROM branch ORDER BY branch_id ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["branch_no"];?>" size="14">
<?=$objResuut["branch_no"]." - ".$objResuut["branch_name"];?>
</option>
<?
}
?>
</select>
</td>
<td align="right" height="40">ผู้รับรถ</td>
<?
$fname = "$prefix$fname $lname";
?>
<td><input type="text" name="txtreceive_name" id="txtreceive_name" value="<?=$fname;?>"></td>
</tr>
<tr>
<td height="12" colspan="6"><hr></td>
</tr>
<tr>
<td widtd="91" height="40" align="right">ยี่ห้อ</td>
<td>
<select id="txtbrand" name="txtbrand">
<option value="">------------ เลือก -----------</option>
<?php
$result = mysql_query("
SELECT
brand_id,
brand_name
FROM
brand
ORDER BY CONVERT(brand_id USING TIS620) ASC;
");
while($row = mysql_fetch_assoc($result))
{
echo '<option value="', $row['brand_id'], '">', $row['brand_name'],'</option>';
}
?>
</select>
</td>
<td widtd="91" align="right">รุ่น</td>
<td>
<select id="txtclass" name="txtclass">
<option value="">------------ เลือก -----------</option>
</select><span id="waitClass"></span>
</td>
<td widtd="98" align="right">แบบ</td>
<td>
<select id="txttype" name="txttype">
<option value="">------------ เลือก -----------</option>
</select><span id="waitType"></span>
</td>
</tr>
<tr>
<td align="right" height="40">สี</td>
<td>
<select name="txtcolor" id="txtcolor">
<option value="">------------ เลือก -----------</option>
<?
$strSQL = "SELECT * FROM color ORDER BY color_id ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["color_id"];?>"><?=$objResuut["color_name"];?></option>
<?
}
?>
</select>
</td>
<td widtd="91" align="right">เลขเครื่อง</td>
<td><input type="text" name="txtmachine_id" id="txtmachine_id"></td>
<td widtd="98" align="right">เลขถัง</td>
<td><input type="text" name="txtchassis_id" id="txtchassis_id"></td>
</tr>
<tr>
<td widtd="198" align="right" height="40">ป้ายทะเบียน</td>
<td><input type="text" name="txtplate" id="txtplate"></td>
<td widtd="198" align="right">จังหวัด</td>
<td>
<select name="txtprovince" id="txtprovince">
<option value="">------------ เลือก -----------</option>
<?
$strSQL = "SELECT * FROM province ORDER BY province_id ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["province_id"];?>"><?=$objResuut["province_name"];?></option>
<?
}
?>
</select>
</td>
<td widtd="97" align="right"> ปีที่จดทะเบียน</td>
<td><select name="txtregis_year" id="txtregis_year">
<option value="">------------ เลือก -----------</option>
<option value="2545">2545</option>
<option value="2546">2546</option>
<option value="2547">2547</option>
<option value="2548">2548</option>
<option value="2549">2549</option>
<option value="2550">2550</option>
<option value="2551">2551</option>
<option value="2552">2552</option>
<option value="2553">2553</option>
<option value="2554">2554</option>
<option value="2555">2555</option>
<option value="2556">2556</option>
</select>
</td>
</tr>
<tr>
<td widtd="59" align="right" height="40"> </td>
<td > </td>
<td widtd="59" align="right">ราคาขาย</td>
<td ><input type="text" name="txtsell" id="txtsell" OnChange="JavaScript:chkNum(this)"></td>
<td widtd="71" align="right">ราคาซื้อ</td>
<td><input type="text" name="txtbuy" id="txtbuy" OnChange="JavaScript:chkNum(this)"></td>
</tr>
</table>
</div>
<div align="center">
<input type="submit" name="btnAdd" id="btnAdd" value="เพิ่มข้อมูล">
</div>
<br><br>
</form>
Tag : PHP, MySQL

|
ประวัติการแก้ไข 2013-05-07 15:36:28
|
 |
 |
 |
 |
Date :
2013-05-07 15:34:09 |
By :
lookpla26 |
View :
836 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
 หายหมดเลย
|
ประวัติการแก้ไข 2013-05-07 16:34:41
 |
 |
 |
 |
Date :
2013-05-07 15:51:04 |
By :
lookpla26 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|