<!-- TMPL_INCLUDE NAME="main-top-addbiblio.inc" -->
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav-brief.inc" -->
<script language="javascript" type="text/javascript">

<!--
function update(f){
  //collect values
  quantity=f.quantity.value
  if (quantity ==0) {
  	alert("Quantity must be >0");
  }
  discount=f.discount.value
  listinc=parseInt(f.listinc.value)
  currency=f.currency.value
  applygst=parseInt(f.applygst.value)
  listprice=f.list_price.value
  //  rrp=f.rrp.value
  //  ecost=f.ecost.value  //budgetted cost
  //  GST=f.GST.value
  //  total=f.total.value
  //make useful constants out of the above
  exchangerate=f.elements[currency].value      //get exchange rate
  gst_on=(!listinc && applygst);
  //do real stuff
  rrp=listprice*exchangerate;
  ecost=rrp*(100-discount)/100
  GST=0;
  if (gst_on){
    rrp=rrp*(1+<!-- TMPL_VAR NAME="gstrate" -->);
    GST=ecost*(<!-- TMPL_VAR NAME="gstrate" -->);
  }

  total=(ecost+GST)*quantity

  f.rrp.value=rrp;
  f.ecost.value=ecost;
  f.GST.value=GST;
  f.total.value=total;
  return true;
}

function messenger(X,Y,etc){
	win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
	win.focus();
	win.document.close();
	win.document.write("<body link='#333333' bgcolor='#ffffff' text='#000000'><font size='2'><p><br>");
	win.document.write(etc);
	win.document.write("<center><form><input type=button onclick='self.close()' value='關閉'></form></center>");
	win.document.write("</font></body></html>");
}

function check(f) {
  quantity=f.quantity.value
  title=f.title.value
  if (title == "") {
  	alert("題名不能空白");
	return false;
  }
  if (quantity ==0) {
  	alert("數量必須大於 0");
	return false;
  }
	document.frusin.submit();
}
//-->

</script>
<div id="main">
<form action="basket.pl" method="get" style="float: right"><input type="hidden" name="basket" value="<!-- TMPL_VAR NAME="basket" -->" /><input type="submit" value="購物籃" class="submit" /></form>
	<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" name="frusin">
	<!-- TMPL_UNLESS name="existing" --><input type="hidden" name="existing" value="no" /><!-- /TMPL_UNLESS -->
	<!-- <!-- TMPL_VAR NAME="title" --> -->
	<input type="hidden" name="ordnum" value="<!-- TMPL_VAR NAME="ordnum" -->" />
	<input type="hidden" name="basketno" value="<!-- TMPL_VAR NAME="basketno" -->" />
	<input type="hidden" name="booksellerid" value="<!-- TMPL_VAR NAME="booksellerid" -->" />
	<input type="hidden" name="biblio" value="<!-- TMPL_VAR NAME="biblio" -->" />
	<input type="hidden" name="bibitemnum" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
	<input type="hidden" name="oldtype" value="<!-- TMPL_VAR NAME="itemtype" -->" />
	<input type="hidden" name="discount" value="<!-- TMPL_VAR NAME="discount" -->" />
	<input type="hidden" name="listinc" value="<!-- TMPL_VAR NAME="listincgst" -->" />
	<input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />
	<input type="hidden" name="applygst" value="<!-- TMPL_VAR NAME="gstreg" -->">
	<input type="hidden" name="suggestionid" value="<!-- TMPL_VAR NAME="suggestionid" -->" />
	<!-- TMPL_LOOP NAME="loop_currencies" -->
		<input type="hidden" name="<!-- TMPL_VAR NAME="currency" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
	<!-- /TMPL_LOOP -->
	
	<h1><!-- TMPL_IF name="ordnum" -->
			修改訂單詳細資料 (行 #<!-- TMPL_VAR NAME="ordnum" -->)
		<!-- TMPL_ELSE -->
			新訂單
		<!-- /TMPL_IF -->
		 <!-- TMPL_IF name="suggestionid" -->(薦購單 #<!-- TMPL_VAR NAME="suggestionid" -->)<!-- /TMPL_IF -->
	</h1>
	<h2>購物籃 <span class="ex"><!-- TMPL_VAR NAME="name" --></span></h2>
	<div class="data">
		<table>
			<caption>目錄詳細說明</caption>
			<tr><th><label for="title">題名 *</label></th><td><!-- TMPL_IF name="biblio" -->
				<input type="hidden" size="20" name="title" value="<!-- TMPL_VAR NAME="title" -->" /><!-- TMPL_VAR NAME="title" -->
			<!-- TMPL_ELSE --><input type="text" size="20" id="title" name="title" value="<!-- TMPL_VAR NAME="title" -->" /><!-- /TMPL_IF --></td></tr>
			<tr><th><label for="author">作者</label></th><td><!-- TMPL_IF name="biblio" -->
				<input type="hidden" size="20" name="author" value="<!-- TMPL_VAR NAME="author" -->" /><!-- TMPL_VAR NAME="author" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" name="author" value="<!-- TMPL_VAR NAME="author" -->" />
			<!-- /TMPL_IF --></td></tr>
			<tr><th><label for="publishercode"> 出版者</label></th><td>			<!-- TMPL_IF name="biblio" -->
				<input type="hidden" size="20" name="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" /><!-- TMPL_VAR NAME="publishercode" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" name="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" />
			<!-- /TMPL_IF --></td></tr>
			<tr><th><label for="copyrightdate">版權日期</label></th><td><!-- TMPL_IF name="biblio" -->
				<input type="hidden" size="20" name="copyrightdate" id="copyrightdate" value="<!-- TMPL_VAR NAME="copyrightdate" -->" /><!-- TMPL_VAR NAME="copyrightdate" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" name="copyrightdate" id="copyrightdate" value="<!-- TMPL_VAR NAME="copyrightdate" -->" />
			<!-- /TMPL_IF --></td></tr>
			<tr><th><label for="itemtype">格式</label></th><td><!-- TMPL_VAR NAME="CGIitemtype" --></td></tr>
			<tr><th><label for="ISBN">國際標準書號（ISBN）</label></th><td><!-- TMPL_IF name="biblio" -->
				<input type="hidden" size="20" name="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" /><!-- TMPL_VAR NAME="isbn" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" name="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" />
			<!-- /TMPL_IF --></td></tr>
		<tr><th><label for="Series">期刊</label></th><td><!-- TMPL_IF name="biblio" -->
				<input type="hidden" size="20" name="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" /><!-- TMPL_VAR NAME="seriestitle" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" name="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" />
			<!-- /TMPL_IF --></td></tr>
		<tr><th><label for="branch">分館</label></th><td><!-- TMPL_VAR NAME="CGIbranch" --></td></tr>
		</table>
	</div>
	
	<div class="data">
		<table>
		<caption>訂單詳細資料</caption>
		<tr><th><label for="quantity">數量</label></th><td><!-- TMPL_IF name="close" -->
				<input type="hidden" name="quantity" id="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" /><!-- TMPL_VAR NAME="quantity" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" id="quantity" name="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" onchange="update(this.form);" />
		  	<!--/TMPL_IF--></td></tr>
		<tr><th><label for="bookfund">書籍經費</label></th><td><!-- TMPL_IF name="close" -->
				<input type="hidden" name="bookfund" value="<!-- TMPL_VAR NAME="bookfundid" -->" /><!-- TMPL_VAR NAME="bookfundname" -->
			<!-- TMPL_ELSE -->
				<!-- TMPL_VAR NAME="CGIbookfund" -->
		  	<!--/TMPL_IF--></td></tr>
		<tr><th><label for="list_price">供應商價錢</label></th><td><!-- TMPL_IF name="close" -->
				<input type="hidden"  name="list_price" value="<!-- TMPL_VAR NAME="listprice" -->" /><!-- TMPL_VAR NAME="listprice" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" id="list_price" name="list_price" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="update(this.form)" />
		  	<!--/TMPL_IF--></td></tr>
		<tr><th><label for="rrp">歸還費用 </label></th><td><!-- TMPL_IF name="close" -->
				<input type="hidden" name="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" /><!-- TMPL_VAR NAME="rrp" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" id="rrp" name="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" />
		  	<!--/TMPL_IF--></td></tr>
		<tr><th><label for="ecost">預算費用</label></th><td><input type="text" size="20" id="ecost" name="ecost" value="<!-- TMPL_VAR NAME="ecost" -->"<!-- TMPL_IF name="close" --> readonly="readonly"<!--/TMPL_IF--> /></td></tr>
		<tr><th><label for="GST">GST 預算</label></th><td><input type="text" size="20" id="GST" name="GST" value=""<!-- TMPL_IF name="close" --> readonly="readonly"<!--/TMPL_IF-->  /></td></tr>
		<tr><th><label for="total"><strong>預算總計</strong></label></th><td><input type="text" size="20" id="total" name="total" value=""<!-- TMPL_IF name="close" --> readonly="readonly"<!--/TMPL_IF--> /></td></tr>
		<tr><th><label for="cost">實際費用</label></th><td><input type="text" size="20" id="cost" name="cost" value="<!-- TMPL_VAR name="ecost"-->"<!-- TMPL_IF name="close" --> readonly="readonly"<!--/TMPL_IF--> /></td></tr>
		<tr><th><label for="invoice">發票號碼 *</label></th><td><input type="text" size="20" id="invoice" name="invoice"  value="<!-- TMPL_VAR name="invoice" -->" /></td></tr>
		<tr><th><label for="notes-details">附註</label></th><td><input type="text" size="20" id="notes-details" name="notes" value="<!-- TMPL_VAR NAME="notes" -->" /></td></tr>
		<tr><th><label for="sort1">排序欄位 1</label></th><td>
		<!-- TMPL_IF Name="CGIsort1" -->
				<!-- TMPL_VAR Name="CGIsort1" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" id="sort1" name="sort1" value="<!-- TMPL_VAR NAME="sort1" -->" />
			<!--/TMPL_IF -->
	</td></tr>
		<tr><th><label for="sort2">排序欄位 2</label></th><td><!-- TMPL_IF Name="CGIsort2" -->
				<!-- TMPL_VAR Name="CGIsort2" -->
			<!-- TMPL_ELSE -->
				<input type="text" size="20" id="sort2" name="sort2" value="<!-- TMPL_VAR NAME="sort2" -->" />
			<!--/TMPL_IF --></td></tr>
		</table></div>
		<p>排序欄位，可以取得你的使用情況。它們可以顯示使用的目的</p>	
		<p>
			<input type="submit" value="送出" class="submit"  onClick="check(this.form); return false;" />
		</p>
		
	</form>
	
</div>
<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->


