<?php include "connectdb.php"; $sql = "SELECT serve_id FROM serve where serve_id='$serve_id' "; //echo $sql;exit; $result = mysql_query( $sql ) or die ("เอ็กซิคิวต์คิวรีไม่ได้"); $num = mysql_num_rows ( $result ); if ( $num != 0 ) { echo "<script>alert('เลขที่ใบสั่งซื้อเคมีภัณฑ์นี้มีอยู่แล้ว'); window.history.go(-1);</script>"; exit; } for($i=0;$i<=count($cloth_id);$i++){ $cloth_id1=$cloth_id[$i]; $get_count1=$get_count[$cloth_id1]; $service_charge1=$service_charge[$cloth_id1]; //echo"$p_id1 $get_count1 $get_price1 <BR>"; if(($get_count1<>'')and($get_count1<=0)){ echo "<script>alert('จำนวนต้องมากกว่าศูนย์');window.location.href ='invoice_form.php';</script>"; exit; } } $num=1; for($n=0;$n<=count($cloth_id);$n++){ $cloth_id2=$cloth_id[$n]; $get_count2=$get_count[$cloth_id2]; $service_charge2=$service_charge[$cloth_id2]; if(($get_count2<>'')and($get_count2>0)){ $sum=$get_count2*$service_charge; $serve_total=$serve_total+$sum; $sql1 = "insert into serve_detail (cloth_id,serve_id,serve_count)values('$cloth_id2','$serve_id','$get_count2')"; //echo $sql;exit; $result1 = mysql_query( $sql1 ) or die (mysql_error()); if(($get_count2<>'')and($get_count2>0)and ($num==1)){$num++; $sql = "insert into serve (serve_id,cus_id,serve_date, serve_total)values('$serve_id','$cus_id',CURDATE(),'$serve_total')"; //echo $sql;exit; $result = mysql_query( $sql ) or die ("เอ็กซิคิวต์คิวรีไม่ได้"); } } } echo "<script>alert('บันทึกข้อมูลเรียบร้อยแล้ว'); window.location.href ='invoice_list.php';</script>"; ?> ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง