使用Crystal Report以印度格式的单词数量

时间:2017-07-20 08:34:59

标签: c# crystal-reports windows-applications

在Crystal Report中,sum{Total}等于1128725.62

现在我使用以下代码将钱转换为金额

numberVar x :=(Sum({Command.Total}))- Int (Sum({Command.Total})) ;
    ProperCase (ToWords (Int (Sum({Command.Total})),0) + ', and ' + ToWords ((x * 100),0) + ' Paise Only')

它会将结果显示为

One Million On Hundred Twenty-Eight Thousand Seven Hundred Twenty-Five , And Sixty-two Paise Only

哪个不是印度格式,我实际上需要输出为

Eleven Lakh Twenty-Eight Thousand Seven Hundred Twenty-Five , And Sixty-two Paise Only

我需要做出哪些改变才能获得任何帮助。

2 个答案:

答案 0 :(得分:0)

由于我不知道使用印度数字系统的任何自动方式,我建议你创建一个公式,其中某些权力符号的因子将被明确计算(通过除以10的幂)并将被引用除了每次适当的名字。

我举一个例子来说明十万分之一和千万分之一,如果你将来会遇到更多数字,你可以坚持下去

(如果我对数字准确性有误,请原谅我,我不熟悉印度数字系统)

numberVar crorecount := Int(Sum({Command.Total})/10000000) ; //count of crores
numberVar lakhcount := Int(Int(Sum({Command.Total}) - (crorecount*10000000))/100000); //count of lakhs
numberVar decimal :=(Sum({Command.Total}))- Int (Sum({Command.Total})) ; //decimal part

stringvar croreSubStr := iif(crorecount>0,ToWords(crorecount,0)+' crore',''); //string you will add at the final result if number is greater of 10000000
stringvar lakhSubStr := iif(lakhcount>0,ToWords(lakhcount,0)+' lakh',''); //string you will add at the final result if number is greater of 100000

ProperCase (croreSubStr+' '+lakhSubStr+' '+ToWords (Int (Sum({Command.Total})-(crorecount*10000000)-(lakhcount*100000)),0) + ', and ' + ToWords ((decimal * 100),0) + ' Paise Only')

答案 1 :(得分:0)

numberVar crorecount := Int({@Netamt}/10000000) ; //count of crores
numberVar lakhcount := Int(Int({@Netamt} - (crorecount*10000000))/100000); //count of lakhs
////numberVar decimal :=({@Netamt})- Int ({@Netamt}) ; //decimal part
stringvar croreSubStr := iif(crorecount>0,ToWords(crorecount,0)+' crore',''); //string you will add at the final result if number is greater of 10000000
stringvar lakhSubStr := iif(lakhcount>0,ToWords(lakhcount,0)+' lakh',''); //string you will add at the final result if number is greater of 100000
ProperCase (croreSubStr+' '+lakhSubStr+' '+ToWords (Int ({@Netamt})-(crorecount*10000000)-(lakhcount*100000),0)) +  'Only'