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. 征服 Redis + Jedis + Spring (一)—— 配置&常规操作(GET SET DEL)

    有日子没写博客了,真的是忙得要疯掉. 完成项目基础架构搭建工作,解决了核心技术问题,接着需要快速的调研下基于Spring框架下的Redis操作. 相关链接: 征服 Redis 征服 Redis + J ...

  2. 漏洞大爆光:QQ漏洞、飞秋漏洞、360浏览器劫持…

    随着互联网应用的高速发展,信息安全已深入到诸多领域,前段时间发生的"Struts 2"漏洞及"心脏出血"漏洞影响了二亿中国网民的信息安全.原因是程序猿缺少细致的 ...

  3. android109 结构体,联合体,枚举,自定义

    #include <stdio.h> #include <stdlib.h> void study(){ printf("吃饭睡觉打李志\n"); } // ...

  4. patchdiff2 函数比较插件

    https://code.google.com/archive/p/patchdiff2/downloads

  5. Android App用MulticastSocket监听组播,为什么连接到不同路由、在不同手机上跑,有的能收到有的收不到

    ---------------------------!! 转载请注明出处 !!-----------------------   一个项目,利用wifi组播在局域网内发现设备.却发现在有的路由器上能 ...

  6. Apache 80 端口被占用无法重启解决办法

    原文出处 Apache 80 端口被占用无法重启解决办法 www.111cn.net 编辑:tiger 来源:转载使用WEB服务器的朋友都知道80端口是一个用来对外让用户访问的一个端口了,像apach ...

  7. webrtc学习——mediaStream和MediaStreamTrack

    This is an experimental technologyBecause this technology's specification has not stabilized, check ...

  8. Retrofit研究1

    以下为来自Github的retrofit的介绍.话说,翻译还真蛋疼,就这个花了快3个小时. Retrofit 一个在Android和Java上类型安全的HTTP客户端 介绍 Retrofit可以把你的 ...

  9. apparmor介绍

    AppArmor AppArmor 类似于selinux ,主要的作用是设置某个可执行程序的访问控制权限,主要区别就在于apparmor是以路径(path)为基础,而selinux以i节点(inode ...

  10. iOS多线程--NSOperation

    NSOperation是基于GCD的一套多线程实现方案,和GCD一样,线程的生命周期是由系统来自动管理的,不用像NSThread和Pthread一样让程序员手动管理.相对于GCD来说,它更加地面向对象 ...