如何把销售单据中的金额小写显示成大写?
我是用ASP的,在网上找了些金额小写转换大写的代码,不知道怎样调用。比如表格中右边是金额小写,我想在左边直接读取右边的小写金额转换成大写,实现不用手工输入和读取数据而直接能显示,请问代码如何插入呢?
回复 2楼 gupiao175
比如像这样一个表格,我想在左边的大写金额直接调用右边的小写金额进行转换,不用读取数据库,也不用手工输入。表格页面代码如下:程序代码:
<%if request.Cookies("shiwei_username")="" then%> <script language="javascript">top.location.href="../index.asp"</script> <% response.end end if %> <!-- #include file="../conn2.asp" --> <!-- #include file="../const.asp" --> <html> <head> <title><%=gongsi%>-收费单据打印</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <link href="../style2.css" rel="stylesheet" type="text/css"> <script language=javascript> function preview() { bdhtml=window.document.body.innerHTML; sprnstr="<!--startprint-->"; eprnstr="<!--endprint-->"; prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); window.document.body.innerHTML=prnhtml; window.print(); window.document.body.innerHTML=bdhtml; } </script> </HEAD> <BODY> <% set rs_buy=conn.execute("select * from sell where louyu=false and bianhao='"&request("bianhao")&"'") nowid_login=rs_buy("id_login") set rs_login=conn.execute("select * from login where id="&rs_buy("id_login")) if rs_login.eof then nowlogin=rs_buy("login") else nowlogin=rs_login("username")&" ("&rs_login("gonghao")&")" end if set rs_yezhu=conn.execute("select * from yezhu where id="&rs_buy("yezhu")) %> <table width="600" border="0" cellpadding="0" cellspacing="2" align="center"> <tr><td height="25" align="center"><img src="../images/print.jpg" align="absmiddle" style="cursor:hand;" onClick="preview();window.close()"></td> </tr></table> <!--startprint--> <table width="600" border="0" cellpadding="0" cellspacing="2" align="center"> <tr><td height="30" align="center"><font size="5"><b>前台收费单据</b></font></td> </tr> <tr><td height="26" align="left"> 业主名称:<input type="text" value="<%if rs_yezhu.eof=false then%><%=rs_yezhu("username")%><%end if%>" size="7" style="border-bottom:solid 1 #000000;border-top:solid 0 #000000;border-left:solid 0 #000000;border-right:solid 0 #000000;"> 房号:<input type="text" value="<%=rs_yezhu("fanghao")%>" size="5" style="border-bottom:solid 1 #000000;border-top:solid 0 #000000;border-left:solid 0 #000000;border-right:solid 0 #000000;"> 缴费日期:<input type="text" value="<%=rs_buy("selldate")%>" size="10" style="border-bottom:solid 1 #000000;border-top:solid 0 #000000;border-left:solid 0 #000000;border-right:solid 0 #000000;"> 单据编号:<input type="text" value="<%=request("bianhao")%>" size="14" style="border-bottom:solid 1 #000000;border-top:solid 0 #000000;border-left:solid 0 #000000;border-right:solid 0 #000000;"> </td> </tr></table> <table width="600" border="2" cellspacing="0" cellpadding="2" align="center" bordercolor="#000000"> <tr><th width="70">项目代号</th><th height="26">项目名称</th><th>数量</th><th>单位</th><th>单价</th><th>金额</th><th>备注</th></tr> <% totalprice=0 do while rs_buy.eof=false set rs_produit=conn.execute("select * from produit where daihao='"&rs_buy("daihao")&"'") %> <tr><td align="center" height="26"><%if rs_produit.eof then%><%=rs_buy("daihao")%><%else%><%=rs_produit("daihao")%><%end if%></td> <td align="center"><%if rs_produit.eof then%><%=rs_buy("title")%><%else%><%=rs_produit("title")%><%end if%></td> <td align="center"><%=formatnumber(rs_buy("shuliang"),2)%></td> <td align="center"><%if rs_produit.eof=false then%><%=rs_produit("danwei")%><%end if%></td> <td align="center"><%=formatnumber(rs_buy("price1"),2)%></td> <td align="center"><%=formatnumber(rs_buy("price1")*rs_buy("shuliang"),2)%></td> <td align="center"><%=rs_buy("beizhu")%></td> </tr> <% totalprice1=totalprice1+rs_buy("price1")*rs_buy("shuliang") rs_buy.movenext loop %> <tr><td align="center" height="26">总计:</td> <td colspan="6" align="left"> 大写:<%=formatnumber(totalprice1,2)%> 小写:<%=formatnumber(totalprice1,2)%></td> </tr></table> <table width="600" border="0" cellpadding="0" cellspacing="2" align="center"> <tr><td height="25" width="50%"> 收款单位:<input type="text" value="<%=gongsi%>" size="25" style="border-bottom:solid 1 #000000;border-top:solid 0 #000000;border-left:solid 0 #000000;border-right:solid 0 #000000;"></td> <td align="right" width="50%">收款人:<input type="text" value="<%=nowlogin%>" size="11" style="border-bottom:solid 1 #000000;border-top:solid 0 #000000;border-left:solid 0 #000000;border-right:solid 0 #000000;"> </td> </tr></table> <!--endprint--> </body></html>