ASP写的判断Money各个位值的函数

来源:互联网 发布:怎样做好淘宝网店 编辑:程序博客网 时间:2024/06/05 16:43

  最近在公司做一个帐务报销系统。

  需要把一个MONEY值的个位十位百位千位还有角啊分啊的单独取出来生成表格。mjeko.com

  于是写了一个得到此值的 Function ,放到这里共享。如果你看到有写得不妥的地方,请给我来 killhand007@163.com 指正交流。

  Function Moneynm(n,m)

  checkPoint = InstrRev(n,".")

  If n>9999.99 Then

  Response.write"数据超过限制,请确定您的报销金额在9999.99元以内!"ksncu.com

  Else

  If (checkPoint <> 0) Then

  leftNum = Mid(n,1,checkPoint-1)

  rightNum = Mid(n,checkPoint+1,Len(n))

  Else

  leftNum = n

  End If

  gw = Mid(leftNum,Len(leftNum),Len(leftNum))

  sw = 0

  bw = 0

  qw = 0

  jw = 0

  fw = 0

  If Len(leftNum)>1 Then

  sw = Mid(leftNum,Len(leftNum)-1,1)

  End If

  If Len(leftNum)>2 Then

  bw = Mid(leftNum,Len(leftNum)-2,1)

  End If

  If Len(leftNum)>3 Then

  qw = Mid(leftNum,Len(leftNum)-3,1)

  End If

  If Len(rightNum)>0 Then

  jw = Mid(rightNum,1,1)

  End If

  If Len(rightNum)>1 Then

  fw = Mid(rightNum,2,1)

0 0
原创粉丝点击