|
|
|
ขอความช่วยเหลือหน่อยครับ คือผมจะคิดรวมเงินในช่องรวมเงินอ่ะครับ ผมจะเอาหน่วย ส.ต. มารวมกับบาทต้องคิดยังไงอ่ะครับ |
|
|
|
|
|
|
|
บาท กับ สตางค์ แยกกันหรือครับ? ถ้าไช่ก็นำมารวมกันปกติเลยครับ
|
|
|
|
|
Date :
2012-05-08 10:29:38 |
By :
ALTELMA |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ครับผม แยกกันมาตอนแรกเลยอ่ะครับ แล้วจะมารวมกันช่องสุดท้าย
แล้วต้องเขียนแบบไหนอ่าครับ พอดีผมมือใหม่
|
|
|
|
|
Date :
2012-05-08 10:55:04 |
By :
lekoras |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รับมาเป็น จุดทศนิยมใช่ไหม
ลองแบบนี้
$ar3=100.126;
$newar2=explode(".",$ar3);
for($i=$newar2[1];$i>25;$j++ ){
$i-=25;
$chg=$chg+1;
$chg1=$i;
//echo $chg."AND".$chg1."<br>"; //ไว้ดูค่า
}
//echo $chg."AND".$chg1."<br>"; //ดูค่าตอนออกloop
echo $chg."+".$newar2[1]."=".($newar2[1]+$chg)."บาท".$i."สตางค์";
ลองเอาไปปรับปรุงดูครับ
|
|
|
|
|
Date :
2012-05-08 11:08:49 |
By :
tongspy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ จะลองดูนะครับ
|
|
|
|
|
Date :
2012-05-08 11:11:01 |
By :
lekoras |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พี่ครับผมลืมบอกไป ไม่ได้รับมาเป็นจุดทศนิยมอ่ะครับ
คืออย่างเช่น ช่องA รับค่ามา 200 บาท
ช่องB รับค่ามา 175 สตางค์
คือผมอยากให้ ช่องA + ช่องB แล้วได้ 201.75 บาท อ่ะครับ รบกวนพี่ๆช่วยหน่อยนะครับ
|
|
|
|
|
Date :
2012-05-08 11:36:06 |
By :
lekoras |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$a=200;
$b=175;
$chg=0;
for($i=$b;$i>100;$j++ ){
$i-=100;
$chg=$chg+1;
$chg1=$i;
echo $chg."AND".$chg1."<br>";
}
//echo $chg."AND".$chg1."<br>";
echo $chg."+".$a."=".($a+$chg)."บาท".$chg1."สตางค์";
|
|
|
|
|
Date :
2012-05-08 11:53:14 |
By :
tongspy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณพี่ tongspy มากเลยครับผม
|
|
|
|
|
Date :
2012-05-08 12:01:12 |
By :
lekoras |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จริงๆรับค่าใส่เป้นช่องเดียวแล้ว แล้วเอามา explode ง่ายกว่าครับ
|
|
|
|
|
Date :
2012-05-08 12:33:38 |
By :
tongspy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พี่มีอีเมลไหมอ่ะครับ มีเรื่องจะปรึกษาอ่ะครับผม
|
|
|
|
|
Date :
2012-05-08 13:40:22 |
By :
lekoras |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถามในนี้แระครับเผื่อคนอื่นช่วยๆกันตอบแล้วก็เผื่อเป็นความรู้ให้คนอื่นต่อๆด้วย
|
|
|
|
|
Date :
2012-05-08 14:01:38 |
By :
tongspy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมเข้าใจนะครับ แต่ผมแทนค่าไม่เป็นอ่า โทดทีนะครับผมมือใหม่
|
|
|
|
|
Date :
2012-05-08 14:05:34 |
By :
lekoras |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="th">
<head>
<title>eTravel Form</title>
<meta http-equiv="content-Type" content="text/html; charset=tis-620">
<meta name="author" content="IT Paisart">
<meta name="generator" content="WebDesign">
<script language="JavaScript">
function doCallAjax(usval,frmval) {
//alert(frmval);
HttPRequest = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
HttPRequest = new XMLHttpRequest();
if (HttPRequest.overrideMimeType) {
HttPRequest.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!HttPRequest) {
alert('Cannot create XMLHTTP instance');
return false;
}
var url = 'ajax_getgroup_user.php?usid='+usval;
//alert(url);
// var url = 'get.php?myName='+document.getElementById("txtName").value+'&my2='; // 2 Parameters
HttPRequest.open('GET',url,true);
HttPRequest.send(null);
HttPRequest.onreadystatechange = function()
{
if(HttPRequest.readyState == 3) // Loading Request
{
if(frmval == 'usto'){
document.getElementById("mySpan").innerHTML = "Now is Loading...";
}else if(frmval = 'uscc'){
document.getElementById("mySpanCC").innerHTML = "Now is Loading...";
}
}
if(HttPRequest.readyState == 4) // Return Request
{
if(frmval == 'usto'){
document.getElementById("mySpan").innerHTML = HttPRequest.responseText;
}else if(frmval = 'uscc'){
document.getElementById("mySpanCC").innerHTML = HttPRequest.responseText;
}
}
}
}
</SCRIPT>
<style type="text/css">
#outer {width:200px; height:20px; background:url(file:///D|/Paisart/work/%E0%B8%84%E0%B8%A3%E0%B8%B1%E0%B9%89%E0%B8%87%E0%B8%97%E0%B8%B5%E0%B9%881%20%E0%B8%97%E0%B8%B3%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%9F%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%A1%E0%B9%83%E0%B8%9A%E0%B9%80%E0%B8%9A%E0%B8%B4%E0%B8%81%E0%B8%84%E0%B9%88%E0%B8%B2%E0%B9%80%E0%B8%94%E0%B8%B4%E0%B8%99%E0%B8%97%E0%B8%B2%E0%B8%87%E0%B9%81%E0%B8%A5%E0%B9%89%E0%B8%A7%E0%B8%AA%E0%B9%88%E0%B8%87%E0%B9%84%E0%B8%9B%E0%B8%AB%E0%B8%99%E0%B9%89%E0%B8%B2%20%E0%B8%9B%E0%B8%A3%E0%B8%B4%E0%B9%89%E0%B8%99/clock.jpg) no-repeat right bottom; border:0px solid #ddd; border-width:0px 0px 0px; position:relative;}
#menu {list-style-type:none; width:200px; padding:0; margin:0 auto;}
#menu ul {list-style-type:none; padding:0; margin:0;}
#menu li {float:right; background:#088; margin:1px 1px 0 0;position:relative;}
#menu li.sub {background:#666666;}
#menu li, #menu li a {display:block; color:#fff; font-family:arial, sans-serif; font-size:11px; line-height:24px; width:120px; text-decoration:none; text-align:center; cursor:pointer; font-weight:bold;}
#menu li:hover, #menu li a:hover {background:#c00;}
#menu ul {position:absolute;right:-9999px;width:128px;}
#menu li.click {background:#c00;}
#menu li.click ul{right:0; top:24px; background:url(file:///D|/Paisart/work/%E0%B8%84%E0%B8%A3%E0%B8%B1%E0%B9%89%E0%B8%87%E0%B8%97%E0%B8%B5%E0%B9%881%20%E0%B8%97%E0%B8%B3%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%9F%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%A1%E0%B9%83%E0%B8%9A%E0%B9%80%E0%B8%9A%E0%B8%B4%E0%B8%81%E0%B8%84%E0%B9%88%E0%B8%B2%E0%B9%80%E0%B8%94%E0%B8%B4%E0%B8%99%E0%B8%97%E0%B8%B2%E0%B8%87%E0%B9%81%E0%B8%A5%E0%B9%89%E0%B8%A7%E0%B8%AA%E0%B9%88%E0%B8%87%E0%B9%84%E0%B8%9B%E0%B8%AB%E0%B8%99%E0%B9%89%E0%B8%B2%20%E0%B8%9B%E0%B8%A3%E0%B8%B4%E0%B9%89%E0%B8%99/transparent.gif);} /* the background image is for IE7 */
@media print{
.no-print{ display:none;}
body
#contentarea{ width:100%;}
}
#a1 {
font-family: "Microsoft Sans Serif","MS Sans Serif", Tahoma;
font-size: 14px;
}
#a2 {
font-family: "Microsoft Sans Serif","MS Sans Serif", Tahoma;
font-size: 12px;
}
#t1 {
font-family: "Microsoft Sans Serif","MS Sans Serif", Tahoma;
font-size: 20px;
}
#bt{
background: #222;
font-family:Tahoma, Geneva, sans-serif;
font-size:14px;
padding: 5px 10px 5px 10px;
color: #fff;
font-weight: bold;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
border-bottom: 1px solid rgba(0,0,0,0.25);
cursor: pointer;
border-left:none;
border-top:none;
margin:10px 0 10px 0;
}
#bt:hover{
background: #858585;
}
</style>
<script language="JavaScript1.2" type="text/javascript">
function loadmenu2(){
//alert();
document.getElementById("test").innerHTML='ธุรการแผนก................................................. ผู้อนุมัติ................................................... ผู้รับเงิน...................................................';
}
function loadmenu3(){
//alert();
document.getElementById("test1").innerHTML='เจ้าหน้าที่ยานยนต์.............................. ธุรการแผนก............................... ผู้อนุมัติ................................. ผู้รับเงิน.................................';
}
function loadmenu4(){
//alert();
document.getElementById("test2").innerHTML='เอกสารแนบ...........................................................................';
}
function loadmenu(){
//document.getElementById("test").style.display='';
document.getElementById("Span_menu").innerHTML += '<li class="sub"><a href="#" onclick=" loadmenu4(); loadmenu3(); loadmenu2(); window.print(); return false;">Print Form</a></li>';
document.getElementById('form1').style.display = 'block';
document.getElementById('form2').style.display = 'none';
//เริ่มวัน
var date= new Date();
var day = date.getDate();
var Month = date.getMonth() + 1;
var Year = date.getFullYear()+543;
var usedate = day + "/" + Month + "/" + Year;
document.getElementById("nowdate").value= usedate;
document.getElementById("nowdate1").value= usedate;
//จบวัน
}
function slideit($num){
//alert($num);
if($num==1){
document.getElementById('form1').style.display = 'block';
document.getElementById('form2').style.display = 'none';
}else if($num==2){
document.getElementById('form1').style.display = 'none';
document.getElementById('form2').style.display = 'block';
}
}
//เริ่มหาผลรวม +
function fncSum1()
{
//คำนวน
document.form1.txtNumberG.value = (document.form1.txtNumberA.value*1)+(document.form1.txtNumberB.value*1)+(document.form1.txtNumberC.value*1)+(document.form1.txtNumberD.value*1)+(document.form1.txtNumberE.value*1)+(document.form1.txtNumberF.value*1);
{//ฟังชั่นรับเฉพาะตัวเลข
e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k != 13 && (e_k < 48) || (e_k > 57)) {
event.returnValue = false;
alert("ต้องเป็นตัวเลขเท่านั้น... \nกรุณาตรวจสอบข้อมูลของท่านอีกครั้ง...");
}
}
} //จบหาผลรวม
function fncSum2()
{
//คำนวน
document.form1.txtNumberG1.value = (document.form1.txtNumberA1.value*1)+(document.form1.txtNumberB1.value*1)+(document.form1.txtNumberC1.value*1)+(document.form1.txtNumberD1.value*1)+(document.form1.txtNumberE1.value*1)+(document.form1.txtNumberF1.value*1);
{
e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k != 13 && (e_k < 48) || (e_k > 57)) {
event.returnValue = false;
alert("ต้องเป็นตัวเลขเท่านั้น... \nกรุณาตรวจสอบข้อมูลของท่านอีกครั้ง...");
}
}
} //จบหาผลรวม
function fncSumkm()//หาระยะทาง
{
//คำนวน
document.form2.txtkm.value = (document.form2.txtkm1.value*1)+(document.form2.txtkm2.value*1)+(document.form2.txtkm3.value*1)+(document.form2.txtkm4.value*1)+(document.form2.txtkm5.value*1)+(document.form2.txtkm6.value*1);
{
e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k != 13 && (e_k < 48) || (e_k > 57)) {
event.returnValue = false;
alert("ต้องเป็นตัวเลขเท่านั้น... \nกรุณาตรวจสอบข้อมูลของท่านอีกครั้ง...");
}
}
} //จบหาผลรวม
function Sum()
{
//คำนวน
document.form2.txt.value = (document.form2.txt1.value*1)+(document.form2.txt2.value*1)+(document.form2.txt3.value*1)+(document.form2.txt4.value*1)+(document.form2.txt5.value*1)+(document.form2.txt6.value*1);
{
e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k != 13 && (e_k < 48) || (e_k > 57)) {
event.returnValue = false;
alert("ต้องเป็นตัวเลขเท่านั้น... \nกรุณาตรวจสอบข้อมูลของท่านอีกครั้ง...");
}
}
} //จบหาผลรวม
</script>
</head>
<body onload="loadmenu();">
<div class="no-print">
<td align="center" ><font size="+1" color="#FF0000">*สามารถพิมพ์ข้อมูลลงไปได้เลยครับ</font></td>
<table width="800" border="0"><tr>
<td align="right">
<input name="form_table" type="radio" value="1" checked onChange="slideit(1)">ใบเบิกค่าเดินทาง
<input name="form_table" type="radio" value="2" onChange="slideit(2)">ใบเบิกค่าเดินทาง-รถยนต์ส่วนตัว
</div>
</td>
<td><div align="right" class="no-print">
<div id="outer">
<ul id="menu">
<span id='Span_menu'></span>
</ul>
</div>
</div>
</td></tr>
</table></div>
<!-- Begin of Form 1 -->
<form action="" method="post" name="form1">
<div id="form1">
<table width="800" border="0">
<tr><td>
<table width="800" border="0">
<tr><td width="25%"><div align="center"><img src="http://somo.paisart.co.th/ps-eform/images/original_hat.gif" width="90px" height="80px">
<div id="a2">eF-ACC-06<br>eTravel1.0</td>
<td width="40%" ><div id="t1" align="center"><!--บริษัท ไพศาสตร์ จำกัด</div>
<div align="center"><br>-->ใบเบิกค่าเดินทาง</td>
<td width="35%" ><div align="right"><img src="http://somo.paisart.co.th/ps-eform/images/address_paisart.jpg" width="250px" ></td></tr>
</table><hr color="000000">
</td></tr>
<tr>
<td><div align="right"><div id="a1">วันที่<input type="text" id="nowdate" name="nowdate" style="border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; ">
</div></div></td>
</tr>
<tr>
<td><div id="a1">ชื่อ-สกุล <input type="text" id="name" name="name" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000 dotted; border-top:0px; border-right:0px; border-left:0px; width: 230px;">
แผนก <input type="text" id="name1" name="name1" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000 dotted; border-top:0px; border-right:0px; border-left:0px; width: 200px;">
ตำแหน่ง <input type="text" id="name1" name="name1" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000 dotted; border-top:0px; border-right:0px; border-left:0px; width: 200px;"></div></td>
</tr>
<tr>
<td>
<table width="800" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr height="30">
<td rowspan="2" width="22" ><div align="center" >ที่</td>
<td rowspan="2" width="450"><div align="center">รายละเอียดการเดินทาง</td>
<td colspan="2"><div align="center">จำนวนเงิน</td>
<td rowspan="2"><div align="center">หมายเหตุ</td>
</tr>
<tr>
<td width="120"><div align="center">บาท</td>
<td width="50"><div align="center">ส.ต.</td>
</tr>
<tr height="30">
<td><div align="center">1</td>
<td> <input type="text" id="test11" name="test11" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 98%;"></td>
<td> <input type="text" id="txtNumberA" name="txtNumberA" maxlength="6" value="" onKeyUp="fncSum1();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txtNumberA1" name="txtNumberA1" maxlength="2" value="" onKeyUp="fncSum2();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px;width: 80%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" maxlength="14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%;"></td>
</tr>
<tr height="30">
<td><div align="center">2</td>
<td> <input type="text" id="test11" name="test11" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 98%;"></td>
<td> <input type="text" id="txtNumberB" name="txtNumberB" value="" onKeyUp="fncSum1();" maxlength="6" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txtNumberB1" name="txtNumberB1" maxlength="2" value="" onKeyUp="fncSum2();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px;width: 80%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" maxlength="14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%;"></td>
</tr>
<tr height="30">
<td><div align="center">3</td>
<td> <input type="text" id="test11" name="test11" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 98%;"></td>
<td> <input type="text" id="txtNumberC" name="txtNumberC" maxlength="6" value="" onKeyUp="fncSum1();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txtNumberC1" name="txtNumberC1" maxlength="2" value="" onKeyUp="fncSum2();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px;width: 80%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" maxlength="14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%;"></td>
</tr>
<tr height="30">
<td><div align="center">4</td>
<td> <input type="text" id="test11" name="test11" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 98%;"></td>
<td> <input type="text" id="txtNumberD" name="txtNumberD" maxlength="6" value="" onKeyUp="fncSum1();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txtNumberD1" name="txtNumberD1" maxlength="2" value="" onKeyUp="fncSum2();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px;width: 80%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" maxlength="14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%;"></td>
</tr>
<tr height="30">
<td><div align="center">5</td>
<td> <input type="text" id="test11" name="test11" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 98%;"></td>
<td> <input type="text" id="txtNumberE" name="txtNumberE" maxlength="6" value="" onKeyUp="fncSum1();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txtNumberE1" name="txtNumberE1" maxlength="2" value="" onKeyUp="fncSum2();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px;width: 80%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" maxlength="14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%;"></td>
</tr>
<tr height="30">
<td><div align="center">6</td>
<td> <input type="text" id="test11" name="test11" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 98%;"></td>
<td> <input type="text" id="txtNumberF" name="txtNumberF" maxlength="6" value="" onKeyUp="fncSum1();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txtNumberF1" name="txtNumberF1" maxlength="2" value="" onKeyUp="fncSum2();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px;width: 80%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" maxlength="14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%;"></td>
</tr>
<tr height="30">
<td colspan="2"><div align="center">รวมเป็นเงิน</div></td>
<td> <input type="text" id="txtNumberG" name="txtNumberG" value="" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txtNumberG1" name="txtNumberG1" value="" onKeyUp="fncSum2();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 80%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%;"></td>
</tr>
</table>
</td>
</tr>
<tr height="40">
<td valign="bottom">โดย <input type="checkbox" name="check" value="check"> เงินสด</input></td>
</tr>
<tr height="30">
<td valign="bottom"><div id="a1">
<span id='test' ></span>
</div>
<div class="no-print"><input type="reset" id="bt"/></div>
</td>
</tr>
</table>
</div>
</form>
<!-- End of Form 1 -->
<!-- Begin of Form 2 -->
<form action="" method="post" name="form2">
<div id="form2">
<table width="800" border="0">
<tr><td>
<table width="800" border="0">
<tr><td width="25%"><div align="center"><img src="http://somo.paisart.co.th/ps-eform/images/original_hat.gif" width="90px" height="80px"><br><div id="a2">eF-ACC-07<br>eTravel1.0</td>
<td width="40%"><div id="t1" align="center"><!--บริษัท ไพศาสตร์ จำกัด</div>
<div align="center"><br>-->ใบเบิกค่าเดินทาง-กรณีรถยนต์ส่วนตัว</td>
<td width="35%" ><div align="right"><img src="http://somo.paisart.co.th/ps-eform/images/address_paisart.jpg" width="250px" ></td></tr>
</table><hr color="000000">
</td></tr>
<tr>
<td><div align="right"><div id="a1">วันที่<input type="text" id="nowdate1" name="nowdate1" style="border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; ">
</div></div></td>
</tr>
<tr>
<td><div id="a1">ชื่อ-สกุล <input type="text" id="name" name="name" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000 dotted; border-top:0px; border-right:0px; border-left:0px; width: 230px;">
แผนก <input type="text" id="name1" name="name1" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000 dotted; border-top:0px; border-right:0px; border-left:0px; width: 200px;">
ตำแหน่ง <input type="text" id="name1" name="name1" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000 dotted; border-top:0px; border-right:0px; border-left:0px; width: 200px;"></td>
</tr>
<tr>
<td><!--TABLE START-->
<table width="800" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr height="30">
<td rowspan="2" ><div align="center">ที่</td>
<td colspan="4" width="450"><div align="center">รายละเอียดการเดินทาง</td>
<td rowspan="2" width="80"><div align="center">ระยะทาง<br>KM</td>
<td colspan="2"><div align="center">จำนวนเงิน</td>
</tr>
<tr>
<td width="180"><div align="center">จาก</td>
<td width="180"><div align="center">ถึง</td>
<td width="80"><div align="center">ไมล์เริ่มต้น</td>
<td width="80"><div align="center">ไมล์สิ้นสุด</td>
<td width="110"><div align="center">บาท</td>
<td width="50"><div align="center">ส.ต.</td>
</tr>
<tr height="30">
<td><div align="center">1</td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="txtkm1" name="txtkm1" value="" onKeyUp=" fncSumkm();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txt1" name="txt1" value="" onKeyUp=" Sum();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
</tr>
<tr height="30">
<td><div align="center">2</td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="txtkm2" name="txtkm2" value="" onKeyUp=" fncSumkm();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txt2" name="txt2" value="" onKeyUp=" Sum();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
</tr>
<tr height="30">
<td><div align="center">3</td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="txtkm3" name="txtkm3" value="" onKeyUp=" fncSumkm();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txt3" name="txt3" value="" onKeyUp=" Sum();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
</tr>
<tr height="30">
<td><div align="center">4</td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="txtkm4" name="txtkm4" value="" onKeyUp=" fncSumkm();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txt4" name="txt4" value="" onKeyUp=" Sum();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
</tr>
<tr height="30">
<td><div align="center">5</td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="txtkm5" name="txtkm5" value="" onKeyUp=" fncSumkm();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txt5" name="txt5" value="" onKeyUp=" Sum();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
</tr>
<tr height="30">
<td><div align="center">6</td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 95%;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
<td> <input type="text" id="txtkm6" name="txtkm6" value="" onKeyUp=" fncSumkm();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txt6" name="txt6" value="" onKeyUp=" Sum();" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="test14" name="test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
</tr>
<tr height="30">
<td colspan="5"><div align="right">รวมเป็นเงิน </div></td>
<td> <input type="text" id="txtkm" name="txtkm" value="" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="txt" name="txt" value="" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 90%; text-align:center;"></td>
<td> <input type="text" id="test14" name"test14" style=" font: medium'Tahoma, Geneva, sans-serif'; border-bottom:1px #000000; border-top:0px; border-right:0px; border-left:0px; width: 85%; text-align:center;"></td>
</tr>
</table>
</td>
</tr>
<tr height="40">
<td valign="bottom">โดย <input type="checkbox" name="check" value="check"> เงินสด</input></td>
</tr>
<tr height="30"><td valign="bottom"><div id="a1">
<span id="test1"></span></div>
<!--</td>
</tr>
<tr height="25"><td valign="bottom">-->
<div id="a1">
<span id="test2"></span>
</div>
<div class="no-print"><input type="reset" id="bt"/></div>
</body></td>
</tr>
</table>
</div>
</form>
<!-- End of Form 2 -->
</html>
อันนี้โค้ดของผมนะครับ
คืออยากจะเอาโค้ดที่พี่บอกมาประยุกต์อ่ะครับ แต่ผมแทนค่าไม่ถูก
|
|
|
|
|
Date :
2012-05-08 14:12:26 |
By :
lekoras |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอิ่มแบบว่า ลายตา พอดีไม่ว่างเทส php ให้ ทำ vb อยู่ *0*
ลองอธิบายการทำงานคร่าวๆตอนนี้มาหน่อยสิครับจะได้บอกว่าเอาไปแทรกตรงไหน
เช่น
มีหน้ากรอกข้อมูล การข้อมูลการเดินทาง พร้อม เงิน บาทและ สตางค์ ลง database
แล้วหน้าที่ โชว์ใน คห.1 คือดึงจาก db มาแสดง
ถ้าใช้แบบนี้ก้ให้ เขียนเป้น ฟังชั่น 1 ครับ แล้วก็ ใส่เป็น ตัวแปรส่งค่าไป
เช่น
Code (PHP)
function cal($a,$b) {
$chg=0;
for($i=$b;$i>100;$j++ ){
$i-=100;
$chg=$chg+1;
$chg1=$i;
}
$total=($a+$chg).".".$chg1;
return $total;
}
<input type="text" value="<? echo cal($a,$b)?>" >
|
ประวัติการแก้ไข 2012-05-08 15:18:18
|
|
|
|
Date :
2012-05-08 15:16:57 |
By :
tongspy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับพี่
|
|
|
|
|
Date :
2012-05-08 15:52:01 |
By :
lekoras |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|