财务上的数字小写转大写,有没有现成的东西可以用的?

mygodness 2003-08-24 11:07:20
以前我自己写过一个类,弄丢了,网上有现成的吗?
...全文
513 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Nicesoft 2003-10-24
  • 打赏
  • 举报
回复
QLDBGrid Suite

特性


中国财务凭证式的金额显示。各显示位之间的分隔线颜色可自行定义,并可在标题行上显示“...万千百十个角分”!!!
支持多种方式的合计行。支持合计、平均、计数、文本等方式的合计行。中国财务凭证式的金额显示在合计行上同样适用。合计行的颜色可自行定义!!!
可在 Grid 的各列上嵌入任意控件来代替默认编辑器,例如可在布尔型字段的列上嵌入 DBCheckBox,在一只读或计算字段的列上嵌入 DBEdit!!!
支持交替式的行颜色显示。奇数行和偶数行可定义不同的颜色
自适应宽度。Grid 中的各列的宽度随 Grid 宽度的改变可自行调整宽度,使其始终填充整个 Grid 客户区域
回车键转换为制表键。可将回车键当作制表键来处理,使用户敲回车键时自动转入下一列或行,输入数据更快速方便
结合 TQLQRDBGridBuilder 自动生成 QuickReport 报表,省去手工制作报表的麻烦!!!
结合 TQLDBLookupComboBox 实现输入内容按拼音码查找(如同速达 E2 中的品名输入方式),而不必在大量的产品目录中来回查找或强迫用户记忆大量的产品代码!!!
继承自标准的 TDBGrid,使用 TDBGrid 或其子类开发的现有程序可实现平滑升级
更多强大的特性....

下载地址:
http://developer.nicesoft.net

http://www.nicesoft.net/downloads/qll.rar
mygodness 2003-08-24
  • 打赏
  • 举报
回复
谢谢了,我先看看,如果没有错,一定给你加分..呵呵
jingrunx 2003-08-24
  • 打赏
  • 举报
回复
//---------------------------------------------------------------------------

#pragma hdrstop

#include <stdio.h>
#include <windows.h>
#include <winnls.h>
#include "ChineseCurrency.h"
//---------------------------------------------------------------------------
CChineseCurrency::CChineseCurrency(void)
: fCurrency(0.0f), enumCase(ccLowerCase)
{
SetCurrency();
}
//---------------------------------------------------------------------------
CChineseCurrency::CChineseCurrency(double value)
: fCurrency(value), enumCase(ccLowerCase)
{
SetCurrency();
}
//---------------------------------------------------------------------------
CChineseCurrency::CChineseCurrency(CurrencyCase cc)
: fCurrency(0.0f), enumCase(cc)
{
SetCurrency();
}
//---------------------------------------------------------------------------
CChineseCurrency::CChineseCurrency(double value, CurrencyCase cc)
: fCurrency(value), enumCase(cc)
{
SetCurrency();
}
//---------------------------------------------------------------------------
void CChineseCurrency::SetCurrency(void)
{
char stmp[20], *p;

if(fCurrency < fMin) throw underflow_error("underflow_error");
if(fCurrency > fMax) throw overflow_error("overflow_error");

sprintf(stmp, "%19.2f", fCurrency);

bool t1/*0变为?*/, t2/*当前为0*/, t3/*上一位为0*/;
for(int i=0; i<4; i++) {
t1 = false;
t3 = false;
for(int j=3; j>=0; j--) {
p = stmp + (i*4 + j);

t3 = t2;
t2 = (*p == '0');

if(!t1) {
t1 = !t2;
}
if(!t1) {
*p = ' ';
}

if(t2 && t3) {
*p = ' ';
}
}
}


wchar_t *ws = wsChineseCurrency, *wsp;

(*ws++) = wcPrefix;

if(fCurrency < 1.0f) goto decimal;

for(int i=0; i<4; i++) {
wsp = ws;
for(int j=0; j<4; j++) {
p = stmp + (i*4 + j);
if(*p != ' ') {
(*ws++) = wcNumber[enumCase][*p - '0'];
if(*p!='0' && j<3) {
(*ws++) = wcInnerSplit[enumCase][j];
}
}
}
if(wsp!=ws || i==3) {
(*ws++) = wcSplit[enumCase][i];
}
}

decimal:
if(fCurrency == 0.0f) { //0元
(*ws++) = wcNumber[enumCase][0];
(*ws++) = wcSplit[enumCase][3];
}

if(stmp[17]=='0' && stmp[18]=='0') { //没有小数
(*ws++) = wcInnerSplit[enumCase][5];
} else { //xx角xx分
(*ws++) = wcNumber[enumCase][stmp[17] - '0'];
(*ws++) = wcInnerSplit[enumCase][3];
(*ws++) = wcNumber[enumCase][stmp[18] - '0'];
(*ws++) = wcInnerSplit[enumCase][4];
}

(*ws++) = L'\0';
}
//---------------------------------------------------------------------------
CChineseCurrency& CChineseCurrency::operator = (double value)
{
fCurrency = value;
SetCurrency();

return *this;
}
//---------------------------------------------------------------------------
CChineseCurrency::operator const char* (void) const
{
UINT cchMultiByte = 0;
static char stmp[80];

cchMultiByte = ::WideCharToMultiByte(CP_ACP, 0,
wsChineseCurrency, wcslen(wsChineseCurrency),
stmp, sizeof(stmp),
NULL, NULL
);
stmp[cchMultiByte] = '\0';

return stmp;
}
//---------------------------------------------------------------------------
CChineseCurrency::operator const wchar_t* (void) const
{
return wsChineseCurrency;
}
//---------------------------------------------------------------------------
ostream& operator << (ostream& os, const CChineseCurrency& arg)
{
return os << (const char*)arg;
}
//---------------------------------------------------------------------------
istream& operator >> (istream& is, CChineseCurrency& arg)
{
double value = 0.0f;

is >> value;
arg = value;

return is;
}
//---------------------------------------------------------------------------
wostream& operator << (wostream& os, const CChineseCurrency& arg)
{
return os << (const wchar_t*)arg;
}
//---------------------------------------------------------------------------
wistream& operator >> (wistream& is, CChineseCurrency& arg)
{
double value = 0.0f;

is >> value;
arg = value;

return is;
}
//---------------------------------------------------------------------------
#pragma package(smart_init)
jingrunx 2003-08-24
  • 打赏
  • 举报
回复
//---------------------------------------------------------------------------
#ifndef ChineseCurrencyH
#define ChineseCurrencyH

#include <string>
#include <iostream>
using namespace std;
//---------------------------------------------------------------------------
enum CurrencyCase { ccLowerCase, ccUpperCase };

class CChineseCurrency {
static double fMin, fMax;
static wchar_t wcPrefix;
static wchar_t wcInnerSplit[2][6];
static wchar_t wcSplit[2][4];
static wchar_t wcNumber[2][10];
private:
CurrencyCase enumCase;
double fCurrency;
wchar_t wsChineseCurrency[40];
protected:
void SetCurrency(void);
public:
CChineseCurrency(void);
CChineseCurrency(double value);
CChineseCurrency(CurrencyCase cc);
CChineseCurrency(double value, CurrencyCase cc);

CChineseCurrency& operator = (double value);
operator const char* (void) const;
inline operator const wchar_t* (void) const;
};

double CChineseCurrency::fMin = 0.00f;
double CChineseCurrency::fMax = 9999999999999999.99f;
wchar_t CChineseCurrency::wcPrefix = L'币';
wchar_t CChineseCurrency::wcInnerSplit[2][6] = {
{L'千', L'百', L'十', L'角', L'分', L'正'},
{L'仟', L'佰', L'拾', L'角', L'分', L'整'}
};
wchar_t CChineseCurrency::wcSplit[2][4] = {
{L'兆', L'亿', L'万', L'元'},
{L'兆', L'亿', L'万', L'圆'}
};
wchar_t CChineseCurrency::wcNumber[2][10] = {
{L'零', L'一', L'二', L'三', L'四', L'五', L'六', L'七', L'八', L'九'},
{L'零', L'壹', L'贰', L'叁', L'肆', L'伍', L'陆', L'柒', L'捌', L'玖'}
};
ostream& operator << (ostream& os, const CChineseCurrency& arg);
istream& operator >> (istream& is, CChineseCurrency& arg);
wostream& operator << (wostream& os, const CChineseCurrency& arg);
wistream& operator >> (wistream& is, CChineseCurrency& arg);
//---------------------------------------------------------------------------
#endif
mygodness 2003-08-24
  • 打赏
  • 举报
回复
现在怎么好像人气比以前差一些了,没有人知道吗?
asimpleman 2003-08-24
  • 打赏
  • 举报
回复
GZ

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧