zoukankan      html  css  js  c++  java
  • RDLC中使用VB自定义函数实现金额的大写转换

    金额的大写转化

    Function CNMoney(money As Double) as String
    Dim str_Money = money.ToString()
    Dim str_China as [String]()={"分","角","元","拾","佰","仟","万","拾","佰","仟","亿","拾","佰","仟","兆","拾","佰","仟"}
    Dim str_Number as [String]()={"零","壹","貮","叁","肆","伍", "陆","柒","捌","玖"}
    Dim M as [string]=""
    Dim isPoint as Boolean=False
    If str_Money.IndexOf(".") >= 0 then
    str_Money.Remove(str_Money.IndexOf("."),1)
    isPoint=True
    End If
    For i As Integer=str_Money.Length To 1 Step -1
    Dim MyData As Integer=Convert.ToInt16(str_Money(str_Money.Length-i).ToString())
    M += str_Number(MyData)
    If isPoint=True then
    M += str_China(i-1)
    Else M += str_China(i+1)
    End If
    Next
    Return M
    End Function

    以上是函数体,使用方法:在报表页面点击空白处,然后点击菜单栏的“报表”,“属性”--代码,然后将以上代码粘贴上去,保存。

    在使用时直接用“code.CNMoney(14)”即可,需要注意的是,以上操作完成后,编译是可能会出现错误,原因是你的代码写的格式不正确,

    VB代码有严格的块级分布,每一行不能与其他行写在同一行中。

    注意:if 判断条件 then 执行语句块 end if
    使用时执行语句块的程序代码不能紧跟Then,必须放到下一行中,这是块状结构的决定。

  • 相关阅读:
    数据结构之队列
    设计模式之策略模式的使用
    搭建一个高可用的redis环境
    Linux遗忘命令
    重温几种排序算法之希尔排序、归并排序、快速排序
    HashMap的简单实现
    Java GC基础
    2016年年终总结
    Shell 备忘录
    Openstack Grizzily 单节点测试机安装( All In One CentOS/RHEL)
  • 原文地址:https://www.cnblogs.com/lvfeilong/p/jghdjd.html
Copyright © 2011-2022 走看看