} $sql .= "customer_no = " . $idfrom; $addWhere = true; $addAnd = true; } } if ($custName != "undefined" && $custName != "") { if (!$addWhere) { $sql .= " where "; } if ($addAnd) { $sql .= " and "; } $sql .= "name = '" . $custName . "'"; } $maxPageNum = checkTotalPage($sql); $sql .= " limit " . $currentPage . ",10"; $result = mysql_query($sql); $rownum = mysql_num_rows($result); echo "\t<table border='1' id='custContent' class='custContent' width='100%'>\r\n\t\t\t\t<thead><tr>\r\n\t\t\t\t<td width='8%'>行動</td>\r\n\t\t\t\t<td width='10%'>客戶編號</td>\r\n\t\t\t\t<td width='20%'>客戶名稱</td>\r\n \t\t\t\t<td width='25%'>地址</td>\r\n \t\t\t\t<td width='5%'>電話</td>\r\n \t\t\t\t<td width='5%'>傳真</td>\r\n \t\t\t<td width='15%'>電郵</td>\r\n \t\t\t\t<td width='5%'>數期</td>\r\n \t\t\t\t<td width='15%'>備注</td>\r\n\t\t\t\t</tr></thead><tbody>"; if ($rownum != 0 && $page <= $maxPageNum && $page > 0) { while ($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['customer_no'] . " <input type='button' value='Edit' id='editCust' onclick='showWindow(" . $row['customer_no'] . ",\"customer\",this.parentNode.parentNode.rowIndex,null)'></td>"; echo "<td>" . $row['customer_id'] . "</td>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['addr'] . "</td>"; echo "<td>" . $row['phone'] . "</td>"; echo "<td>" . $row['fax'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td>" . $row['period'] . "</td>";
$ainsertItem[] = $d; } for ($i = 0; $i < sizeof($ainsertItem); $i++) { if ($ainsertItem[$i][0] != "") { $sql2 = "insert into podetail(qty,cost,po_no,phonetype_no,acc_no) values(" . $ainsertItem[$i][1] . "," . $ainsertItem[$i][2] . "," . $po_no . ",null," . checkAssNo($ainsertItem[$i][0]) . ")"; mysql_query($sql2); } } } } } break; case "getPo": $page = $_GET['page']; $currentPage = (int) ($page * 10 - 10); $maxPageNum = checkTotalPage("select * from po"); $result = mysql_query("select * from po,postate,staff where po.poState_no = postate.poState_no and staff.staff_no = po.staff_no order by createDate desc,po.poState_no,po_no asc limit " . $currentPage . ",10"); echo "\t<table border='1' class='custContent' width='100%' id='poContent'>\r\n\t\t\t\t<thead>\r\n\t\t\t\t<tr>\r\n\t\t\t\t<td width='30%'>購貨單編號</td>\r\n\t\t\t\t<td width='30%'>日期</td>\r\n\t\t\t\t<td width='20%'>新增者(員工編號)</td>\r\n\t\t\t\t<td width='20%'>狀態</td>\r\n\t\t\t\t</tr></thead><tbody>"; while ($row = mysql_fetch_array($result)) { $tempPoNo = $row['po_no']; $finalPoNo = getPoNo($tempPoNo); echo "<tr>"; echo "<td>" . $finalPoNo; if ($row['poState_no'] == 1) { echo "<input type='button' value='Edit' id='editType' onclick='showWindow(" . $row['po_no'] . ",\"podetail\",this.parentNode.parentNode.rowIndex,\"" . checkEdit($row['poState_no'], $row['po_no'], $row['staff_id']) . "\");clearVal();'></td>"; } else { echo "<input type='button' value='View' id='viewType' onclick='showWindow(" . $row['po_no'] . ",\"podetail\",this.parentNode.parentNode.rowIndex,\"" . viewpo($row['poState_no'], $row['po_no'], $row['staff_id']) . "\");clearVal();'></td>"; } echo "<td>" . $row['createDate'] . "</td>"; echo "<td>" . $row['staff_id'] . "</td>"; echo "<td>" . $row['stateName'] . "</td>";