水晶报表分页汇总后如何将汇总值转成大写数字
在水晶报表公式中使用:页头:
whileprintingrecords
currencyvar n:=0
明细:
currencyvar n
whileprintingrecords
n:=n + {合计字段名}
页脚:
currencyvar n
whileprintingrecords
通过以上几步后分页汇总的功能算是实现了,可问题是客户还要求分页合计中还得显示大写人民币,这下就不知道怎么实现了,转大写的函数也写好了,可就是没法转,再定义一个公式吧,把那个公页合计公式做为参数提示参数必须为数字,直接在函数的参数里选吧又只有几个表字段可选。 --------------------编程问答-------------------- 已经解决了,将currencyvar改为数字型的就行了 --------------------编程问答--------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace KySoft
{
public class cls转换金额
{
public cls转换金额()
{
}
public static string Get大写金额(double dblNumeric)
{
string N2S = "";
string strPlace_1 = "";
string strPlace_2 = "";
string strPlace_4 = "";
string strPlace_5 = "";
string strPlace_6 = "";
string strPlace_7 = "";
double intLen = 0;
strPlace_1 = "零壹贰叁肆伍陆柒捌玖";
strPlace_2 = "仟佰拾万仟佰拾元角分";
strPlace_4 = (dblNumeric * 100).ToString().Trim();
if (strPlace_4.Length > 10 && dblNumeric > 0 && dblNumeric < 99999999.99)
{
intLen = Convert.ToInt32(dblNumeric * 100) / 100;
if (dblNumeric - intLen >= 0.005)
{
intLen = intLen + 0.01;
}
strPlace_4 = (intLen * 100).ToString().Trim();
}
if (strPlace_4.Length > 10 || dblNumeric < 0)
N2S = "大于等于 99999999.99 的数值不能转换";
else
{
//strPlace_4 = GetFillString(10 - strPlace_4.Length," ") + strPlace_4;
strPlace_4 = strPlace_4.PadLeft(10, ' ');
N2S = "";
for (int i = 0; i < 10; i++)
{
strPlace_5 = Convert.ToString(strPlace_4[i]);
if (strPlace_5 != " ")
{
strPlace_6 = Convert.ToString(strPlace_1[Convert.ToInt32(strPlace_5)]);
strPlace_7 = Convert.ToString(strPlace_2[i]);
if (strPlace_5 == "0" && i != 3 && i != 7)
strPlace_7 = "";
if ((i == 8 && strPlace_4.Substring(i, 2) == "00") || (strPlace_5 == "0" && (i == 3 || i == 7 || i == 9)))
strPlace_6 = "";
N2S = N2S + strPlace_6 + strPlace_7;
if (Convert.ToString(strPlace_4[i]) == "0" && strPlace_4[i] != '0' && (i == 3 || i == 7))
N2S = N2S + "零";
}
}
if (strPlace_5 == "0" && N2S != "")
N2S = N2S + "整";
}
return N2S;
}
}
}
我是用代码来转换的,嘿嘿...
接分接分...
补充:.NET技术 , C#