Function total (ls as number) as string

dim dx_sz as string

dim dx_dw as string

dim str_int as string

dim str_dec as string

dim dx_str as string

dim fu as string

dim a as string

dim b as string

dim c as string

dim d as string

dim b2 as string

dim num_int as number

dim num_dec as number

dim len_int as number

dim i as number

dim a_int as number

dim pp as number

dx_sz="零壹贰叁肆伍陆柒捌玖"

dx_dw="万仟佰拾亿仟佰拾万仟佰拾圆"

if ls=0 then dx_str="零圆整"

if ls<0 then

ls=abs(ls)

fu="负"

else

fu=""

end if

dx_str=CStr (ls)

dx_str=Replace (dx_str,"¥","")

dx_str=replace(dx_str,",","")

if (ls>=0) and (ls<1) then dx_str="0"+dx_str

pp=InStr (dx_str,".")

if pp>0 then

str_int=mid(dx_str,1,instr(dx_str,".")-1)

else

str_int=dx_str

end if

num_int=ToNumber (str_int)

if (ls>0) and (ls<1) then

num_dec =  ls*100

else

num_dec=(ls-num_int)*100

end if

str_dec=totext(num_dec)

str_dec=replace(str_dec,"¥","")

len_int=len(str_int)

dx_str=""

for i=1 to len_int

a=mid(str_int,i,1)

a_int=tonumber(a)

b=mid(dx_sz,(a_int+1),1)

c=mid(dx_dw,(13-len_int+i),1)

if dx_str<>"" then

d=mid(dx_str,len(dx_str)-1,1)

else

d=""

end if

if(b="零") and ((d="零") or (b=b2) or (c="圆") or (c="万") or (c="亿")) then b=""

if(a="0") and (c<>"圆") and (c<>"万") and (c<>"亿") then c=""

if((c="圆") or (c="万") or (c="亿")) and (d="零") and (a="0") then

dx_str=mid(dx_str,1,len(dx_str)-2)

d=mid(dx_str,len(dx_str)-1,2)

if((c="圆") and (d="万"))or((c="万") and (d="亿")) then c=""

end if

dx_str=dx_str+b+c

b2=b

next i

'处理金额小于1的情况

if len(dx_str)<=2 then dx_str=""

if(num_dec<10)and(ls>0) then

a_int=tonumber(str_dec)

b=mid(dx_sz,(a_int+1),1)

if num_dec=0 then dx_str=dx_str+"整"

if num_dec>0 then dx_str=dx_str+"零"+b+"分"

end if

if num_dec>=10 then

a_int=tonumber(mid(str_dec,1,1))

a=mid(dx_sz,(a_int+1),1)

a_int=tonumber(mid(str_dec,2,1))

b=mid(dx_sz,(a_int+1),1)

if a<>"零" then a=a+"角"

if b<>"零" then b=b+"分" else b=""

dx_str=dx_str+a+b

end if

dx_str=fu+dx_str

dx_str=replace(dx_str,"零亿","亿")

dx_str=replace(dx_str,"零万","万")

dx_str=replace(dx_str,"零千","千")

dx_str=replace(dx_str,"零圆","圆")

total =dx_str

End Function

水晶報表中小寫變大寫的函數-VB的更多相关文章

  1. vb.net 水晶報表CrystalReport 動態設定資料庫來源

    沒有出現CrystalReportViewer時,須安裝CRforVS_13_0. 新增1個數據集,新增1個數據表,添加二列,列名要和資料庫名一樣. 修改目標Framework 修改app.confi ...

  2. Grafana展示報表數據的配置(二)

    一.Grafana以圖表的形式展示KPI報表的結果數據1.按照日期顯示數據達標量與未達標量2.顯示當前報表的最大值.最小值.平均值.總量3.報表結果數據的鏈接分享與頁面嵌入,用戶無需登錄直接訪問報表統 ...

  3. [小技巧]設定Reporting Services 2008 發生報表管理員權限不足

    转载 http://www.dotblogs.com.tw/dorlis.tsao/archive/2011/01/17/20860.aspx 在自己Windows 7 professional的電腦 ...

  4. 水晶易表 Xcelsius 2008 安装指南 完美支持office2010(亲手体验)

    Xcelsius2008水晶易表是一款很好用的软件.网上已经有破解方法,大家能够尝试一下这款经典软件了. 可是网上对于安装破解过程介绍的不详细或者纷乱,今天我汇总了全部的方法最终成功的安装上了,而且支 ...

  5. 【转】Xcelsius2008 水晶易表问题 部分汇总

    要使用 Xcelsius 2008,需要安装 Adobe Flash 吗? 若要正常运行 Xcelsius 2008,必须安装 Adobe Flash Player 版本 9.如果在安装过程中没有安装 ...

  6. SqlServer快速获得表总记录数(大数据量)

    --第1种 执行全表扫描才能获得行数 SELECT count(*) FROM BUS_tb_UserGradePrice --第2种 执行扫描全表id不为空的,获得行数 select count(u ...

  7. Oracle臨時表空間過大問題解決

    查詢資料庫伺服器時,發現資料庫伺服器磁片使用空間達到了98%,分析總共的資料檔案也不可能達到如此大,經過查詢發現原來臨時表空間的使用方式達到了 32G,導致磁碟空間使用緊張.搜索了相應的文檔與資料後, ...

  8. 单表千亿电信大数据场景,使用Spark+CarbonData替换Impala案例

    [背景介绍] 国内某移动局点使用Impala组件处理电信业务详单,每天处理约100TB左右详单,详单表记录每天大于百亿级别,在使用impala过程中存在以下问题: 详单采用Parquet格式存储,数据 ...

  9. 用笛卡尔积来创建一千六百万大表 整体19分钟 大表建成两分钟 设置id13分钟

    昨天拙文中讲述了用自增方式创建一千六百万大表的方案,这回讨论的是用笛卡儿积,实践证明这种方案更快. 2020年3月15日08点58分实验开始 创建仅有四千数据的tb_4thousand1表: SQL& ...

随机推荐

  1. Mac OS X 如何设置默认浏览器

    有时候我们不希望在 Mac 中点击任何连接都打开的是 Safari,这需要修改默认浏览器设置,在 Mac OS X 中如何设置默认浏览器呢? 打开 Safari 的偏好设置,在「通用」选项卡中有「默认 ...

  2. android开发工具类之获得WIFI IP地址或者手机网络IP

    有的时候我们需要获得WIFI的IP地址获得手机网络的IP地址,这是一个工具类,专门解决这个问题,这里需要两个权限: <uses-permission android:name="and ...

  3. Java基础知识强化之集合框架笔记72:集合特点和数据结构总结

    1. 集合 (1)Collection(单列集合) List(有序,可重复):                         ArrayList:底层数据结构是数组,查询块,增删慢.线程不安全,效率 ...

  4. Android(java)学习笔记161:Framework运行环境之启动SystemServer进程

          SystemServer进程是zygote孵化出的第一个进程,该进程是从ZygoteInit.java的main函数中调用startSystemServer()开始的.与启动普通进程的差别 ...

  5. Spring-data-redis操作redis cluster

    Redis 3.X版本引入了集群的新特性,为了保证所开发系统的高可用性项目组决定引用Redis的集群特性.对于Redis数据访问的支持,目前主要有二种方式:一.以直接调用jedis来实现:二.使用sp ...

  6. S-DES加密

    Simplified Data Encryption Standard S-DES 是一个供教学的非安全的加密算法,它与DES的特性和结构类似,但参数小,明文分组为8位,主密钥分组为10位,采用两轮迭 ...

  7. ThinkPHP函数详解:A方法

    A方法用于在内部实例化控制器,调用格式:A('[项目://][分组/]模块','控制器层名称')最简单的用法: $User = A('User'); 复制代码 表示实例化当前项目的UserAction ...

  8. C# HTTP 请求

    public class HttpHelper { /// <summary> /// 创建GET方式的HTTP请求 /// </summary> public static ...

  9. CWnd::UpdateData

    CWnd::UpdateData 格式: BOOL UpdateData( BOOL bSaveAndValidate = TRUE ); 描述:调用该成员函数初始化在对话框中的数据,或检索和验证对话 ...

  10. XMPP适配IPV6 (GCDAsyncSocket适配IPV6)

    苹果公司要求在6月1号之后上架Appstore的应用必须通过ipv6兼容测试. 最近到了八月份,开始发现新上架的app没有通过,查看了下原因,说没有适配IPV6. 首先在本地搭建一个IPV6的测试环境 ...