<script type="text/javascript"> $(function(){ var price_per_unit = 10; $(".process").live("click",function(){ var key = $(this).attr("id"); var before_price = $("#before_price"+key).val(); if(isNaN(before_price) || !before_price){ alert('ค่าก่อนไม่ถูก'); return false; } before_price = parseFloat(before_price); var last_price = $("#last_price"+key).val(); if(isNaN(last_price) || !last_price){ alert('ค่าหลังไม่ถูก'); return false; } last_price = parseFloat(last_price); var sum = last_price-before_price; $("#sum"+key).val(sum); var amount = sum * price_per_unit; $("#result"+key).html(amount); }); }); </script>
<center><h1> ส่วนผู้ดูแลระบบ </h1> <table width="846" border="1" cellpadding="0" cellspacing="0"> <tr> <th width="36">ลำดับ</th> <th width="63">บ้านเลขที่</th> <th width="37">หมวด</th> <th width="23">ชื่อ</th> <th width="144">จดครั้งก่อน</th> <th width="144">จดครั้งหลัง</th> <th width="144">จำนวนหน่วย</th> <th width="100">ราคาต่อหน่วย</th> <th width="100">คำนวณ</th> <th width="135">รวมจำนวนเงิน/บาท</th> </tr> <?php $sql=("SELECT * FROM payment " ); $query=query_db($sql); $i=0; while($row=fetch_db($query)){ $i++; ?> <tr height="20" bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#CCCCCC'" onMouseOut="this.style.backgroundColor='#FFFFFF'"> <td><?php echo $row['id_member'] ?></td> <td>22/2</td> <td>บ้านใน</td> <td>ชื่อจริง</td> <td> <input type="text" id="before_price<?php echo $i; ?>" value="<?php echo $row['before_price'] ?>" name="before_price" /> </td> <td> <input type="text" id="last_price<?php echo $i; ?>" value="" size="10" name="last_price"/> </td> <td><input type="text" id="sum<?php echo $i; ?>" name="sum[]" /></td> <td><center>10</center></td> <td><input type="submit" value="คำนวณ" id="<?php echo $i; ?>" class="process"></td> <td id="result<?php echo $i; ?>"></td> </tr> <?php } ?> </table>
<input name="btnButton1" type="button" value="Goto 1" OnClick="JavaScript:fncConfirm();">
<form name="frm" action="index.php?name=payment&file=order" method="post"> <table width="846" border="1" cellpadding="0" cellspacing="0"> <tr> <th width="36">ลำดับ</th> <th width="63">บ้านเลขที่</th> <th width="37">หมวด</th> <th width="23">ชื่อ</th> <th width="144">จดครั้งก่อน</th> <th width="144">จดครั้งหลัง</th> <th width="144">จำนวนหน่วย</th> <th width="100">ราคาต่อหน่วย</th> <th width="100">คำนวณ</th> <th width="135">รวมจำนวนเงิน/บาท</th> </tr> <?php $sql=("SELECT * FROM payment where title='".$_GET['id']."' ORDER BY id ASC " ); $query=query_db($sql); $i=0; while($row=fetch_db($query)){ $data=tabledetail('user',"id_user='".$row['id_member']."'"); $category=tabledetail('user',"id_user='".$data['id_group']."'"); $over="#CCCCCC"; $color="#FFFFFF"; $i++; ?> <tr height="20" bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#CCCCCC'" onMouseOut="this.style.backgroundColor='#FFFFFF'"> <td><?php echo $row['id_member'] ?></td> <td>22/2</td> <td>บ้านใน</td> <td>ชื่อจริง</td> <td> <input type="text" id="before_price<?php echo $i; ?>" value="<?php echo $row['before_price'] ?>" name="before_price" /> </td> <td> <input type="text" id="last_price<?php echo $i; ?>" value="" size="10" name="last_price"/> </td> <td><input type="text" id="sum<?php echo $i; ?>" name="sum[]" /></td> <td><center>10</center></td> <td><input type="button" id="<?php echo $i; ?>" onClick="javascript: function('value');" class="process"> </td> <td id="result<?php echo $i; ?>"></td> </tr> <?php } ?> </table> . <input type="submit" name="submit" value="submit"> <input type="hidden" name="hdnLine" value="<?=$i;?>"> </form>
for($i=0;$i<=$_POST["hdnLine"];$i++){ echo $_POST['before_price'][$i] ."<br>"; echo $_POST['last_price'][$i] ."<br>"; echo $_POST['sum'][$i] ."<br>"; echo $result[$i]; }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง