欢迎来到飞鸟慕鱼博客,开始您的技术之旅!
当前位置: 首页知识笔记正文

Title: RMB capitalization function in [Other] Crystal Report

墨初 知识笔记 128阅读

Function RMB (ls is currency) is a string, Dim dblAmount is a double Dim (14) is a string, MA2(14) is a string, x is a string, y is a string, and are numbers, Dim NS is a number, NS0 is the currency Dim i is the number DBM lamount=CDbl(ls)(1)=' Minute (2)=' Angle (3)=' Yuan (4)=' Hundred (6)=' Thousand (7)=' Ten thousand (5).=' thousand (11)=' hundred million (12)=' hundred (13)=' thousand (14)=' thousand MA2(1)=' one MA2(2)=' two MA2(3)=nbsp

;  "叁"  
      MA2(4)   =   "肆"  
      MA2(5)   =   "伍"  
      MA2(6)   =   "陆"  
      MA2(7)   =   "柒"  
      MA2(8)   =   "捌"  
      MA2(9)   =   "玖"  
   
      x   =   "整"  
      y   =   replace(Trim(CStr(dblAmount)),",","")  
     
   
      If   InStr(y,   ".")   =   0   Then  
          y   =   y   +   "00"  
          Else  
                 =   InStr(y,".")  
              y   =   Left(y,      -   1)   +   Left(Mid(y,      +   1)   +   "00",   2)  
      End   If  
   
      NS0   =   0  
         =Len(y)  
      For   i   =   1   To     
             =   Mid(y,      -   i   +   1,   1)  
          NS   =   val()  
          If   NS   <>   0   Then  
              x   =MA2(NS)   +   (i)   +x  
          ElseIf   (i)   =   "元"   Or   (i)   =   "万"   Then  
              x   =   (   i)   +   x  
          End   If  
          If   i   <=   2   Then  
              NS0   =   0  
          ElseIf   NS   =   0   And   NS0   <>   0   Then  
              x   =   "零"   +   x  
              NS0   =   0  
          ElseIf   i   =   6   Then  
              NS0   =   0  
          Else  
              NS0   =   NS  
          End   If  
      Next   i  
      If   dblAmount   <   0   Then  
          x   =   "负"   +   Right(x,   Len(x)   -   1)  
      End   If  
      If   x   =   "元整"   Then  
          x   =   "零"   +   x  
      End   If  

      RMB   =   x  
End Function

/p>

标签:
声明:无特别说明,转载请标明本文来源!