• 获取金额的大写格式


    $PBExportHeader$gf_getmoney.srf
    $PBExportComments$获取金额的大写格式
    global type gf_getmoney from function_object
    end type
    forward prototypes
    global function string gf_getmoney (decimal dsum)
    end prototypes
    global function string gf_getmoney (decimal dsum);
    /*---------------------------------
    --功能描述:获取一个金额的大写格式
    --参数及返回值说明:dsum:decimal类型
    -- returnvaleu:string类型
    ---------------------------------*/
    boolean digit = false
    int     i,n,length
    string  temp,temp1,temp2,upper1,upper2,upper = ""
    upper1 = '零壹贰叁肆伍陆柒捌玖'
    upper2 = '元拾佰仟万拾佰仟亿'
    temp = string(dsum,"###.##")
    length = len(temp)
    if pos(temp,".")>0 then
       temp1 = left(temp,pos(temp,".") - 1)
       temp2 = right(temp,length - pos(temp,"."))
    if integer(temp2) = 0 then temp2=""
    else
    temp1 = temp
    temp2 =""
    end if
    length = len(temp1)
    temp  = ""
    for i = 1 to length
       n = integer(mid(temp1, i, 1))
    if n=0 then    //digit: true 表示上一数字为0
    digit = true
    continue
    end if
    if digit then temp = "零" + mid(upper1, n * 2 + 1, 2) else temp = mid(upper1, n * 2 + 1, 2)
    digit = false
       upper = upper + temp +  mid(upper2, (length - i) * 2 + 1, 2)
    next
    if digit then upper = upper + "元"
    temp=""
    length = len(temp2)
    choose case length
    case 2
    n=integer(right(temp2,1))
    if n>0 then temp= mid(upper1,n*2+1,2) +"分"
    i=integer(left(temp2,1))
    if i>0 then upper = upper + mid(upper1,i*2+1,2) +"角" else upper = upper + mid(upper1,i*2+1,2) 
    upper = upper + temp
    case 1
    i=integer(left(temp2,1))
    if i>0 then upper = upper + mid(upper1,i*2+1,2) +"角"
    end choose
    return upper + "整"
    end function
  • 相关阅读:
    flex布局
    cookie设置、获取、删除
    使用Object对象的toString()方法自定义判断数据类型方法
    git使用汇总
    闭包和面向对象
    闭包
    java8之一文彻底弄懂lambda表达式
    正确理解MESI协议
    二叉树中的节点删除-----按照最底层最右边的节点收缩
    按层次插入二叉树
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/2001058.html
Copyright © 2020-2023  润新知