<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="08/20/2012 15:14:53" ReportInfo.Modified="12/05/2015 17:19:46" ReportInfo.CreatorVersion="2013.2.5.0">
  <ScriptText>using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;

namespace FastReport
{
  public class ReportScript
  {
    public string convertToChineseMoney(decimal num)
    {
      string strChina = &quot;零壹贰叁肆伍陆柒捌玖&quot;;    //0-9所对应的汉字
      string strUnit = &quot;万仟佰拾亿仟佰拾万仟佰拾元角分&quot;; //数字位所对应的汉字
      string strSingleNum = &quot;&quot;;    //从原num值中取出的值
      string strNum = &quot;&quot;; //数字的字符串形式
      string strResult = &quot;&quot;;    //人民币大写金额形式
      string chChina = &quot;&quot;;    //数字的汉语读法
      string chUnit = &quot;&quot;;    //数字位的汉语读法
      int i;    //循环变量
      int lenth;    //num的值乘以100的字符串长度
      int nZero = 0;    //用来计算连续的零值是几个
      int temp;    //从原num值中取出的值
      num = Math.Round(Math.Abs(num), 2);    //将num取绝对值并四舍五入取2位小数
      strNum = ((long)(num * 100)).ToString();    //将num乘100并转换成字符串形式
      lenth = strNum.Length;    //找出最高位
      if (lenth &gt; 15)
      {
        return &quot;位数过大，无法转换！&quot;;
      }
      //取出对应位数的strUnit的值。如：200.55,lenth为5所以strUnit=佰拾元角分
      strUnit = strUnit.Substring(15 - lenth);
      //循环取出每一位需要转换的值
      for (i = 0; i &lt; lenth; i++)
      {
        strSingleNum = strNum.Substring(i, 1);    //取出需转换的某一位的值
        temp = Convert.ToInt32(strSingleNum);    //转换为数字
        if (i != (lenth - 3) &amp;&amp; i != (lenth - 7) &amp;&amp; i != (lenth - 11) &amp;&amp; i != (lenth - 15))
        {
          //当所取位数不为元、万、亿、万亿上的数字时
          if (strSingleNum == &quot;0&quot;)
          {
            chChina = &quot;&quot;;
            chUnit = &quot;&quot;;
            nZero = nZero + 1;
          }
          else
          {
            if (strSingleNum != &quot;0&quot; &amp;&amp; nZero != 0)
            {
              chChina = &quot;零&quot; + strChina.Substring(temp, 1);
              chUnit = strUnit.Substring(i, 1);
              nZero = 0;
            }
            else
            {
              chChina = strChina.Substring(temp, 1);
              chUnit = strUnit.Substring(i, 1);
              nZero = 0;
            }
          }
        }
        else
        {
          //该位是万亿，亿，万，元位等关键位
          if (strSingleNum != &quot;0&quot; &amp;&amp; nZero != 0)
          {
            chChina = &quot;零&quot; + strChina.Substring(temp, 1);
            chUnit = strUnit.Substring(i, 1);
            nZero = 0;
          }
          else
          {
            if (strSingleNum != &quot;0&quot; &amp;&amp; nZero == 0)
            {
              chChina = strChina.Substring(temp, 1);
              chUnit = strUnit.Substring(i, 1);
              nZero = 0;
            }
            else
            {
              if (strSingleNum == &quot;0&quot; &amp;&amp; nZero &gt;= 3)
              {
                chChina = &quot;&quot;;
                chUnit = &quot;&quot;;
                nZero = nZero + 1;
              }
              else
              {
                if (lenth &gt;= 11)
                {
                  chChina = &quot;&quot;;
                  nZero = nZero + 1;
                }
                else
                {
                  chChina = &quot;&quot;;
                  chUnit = strUnit.Substring(i, 1);
                  nZero = nZero + 1;
                }
              }
            }
          }
        }
        if (i == (lenth - 11) || i == (lenth - 3))
        {
          //如果该位是亿位或元位，则必须写上
          chUnit = strUnit.Substring(i, 1);
        }
        strResult = strResult + chChina + chUnit;
        if (i == lenth - 1 &amp;&amp; strSingleNum == &quot;0&quot;)
        {
          //最后一位（分）为0时，加上“整”
          strResult = strResult + '整';
        }
      }
      if (num == 0)
      {
        strResult = &quot;零元整&quot;;
      }
      return strResult;
    }
  }
}
</ScriptText>
  <Dictionary>
    <TableDataSource Name="其它收费单" ReferenceName="Data.其它收费单" DataType="System.Int32" Enabled="true">
      <Column Name="ID" DataType="System.String"/>
      <Column Name="AID" DataType="System.String"/>
      <Column Name="COSTTYPE" DataType="System.String"/>
      <Column Name="REGDATE" DataType="System.String"/>
      <Column Name="MONEY" DataType="System.Decimal"/>
      <Column Name="CAPTION" DataType="System.String"/>
      <Column Name="CONTENT" DataType="System.String"/>
      <Column Name="REGER" DataType="System.String"/>
      <Column Name="TYPENAME" DataType="System.String"/>
    </TableDataSource>
  </Dictionary>
  <ReportPage Name="Page1" PaperHeight="100" FirstPageSource="1" OtherPagesSource="1">
    <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="37.8">
      <TextObject Name="Text1" Width="718.2" Height="37.8" Text="[其它收费单.TYPENAME]收费单" HorzAlign="Center" VertAlign="Center" Font="宋体, 14pt, style=Bold"/>
      <TextObject Name="Text8" Left="500.85" Top="18.9" Width="217.35" Height="18.9" Text="打单时间：[Date]" HorzAlign="Right" Font="宋体, 9pt"/>
    </ReportTitleBand>
    <PageHeaderBand Name="PageHeader1" Top="41.8" Width="718.2"/>
    <DataBand Name="Data1" Top="45.8" Width="718.2" Height="189" DataSource="">
      <TextObject Name="Text2" Width="500.85" Height="28.35" Border.Lines="All" Text="收费日期：[其它收费单.REGDATE]" VertAlign="Center" Font="宋体, 10pt"/>
      <TextObject Name="Text3" Top="28.35" Width="718.2" Height="28.35" Border.Lines="All" Text="收费名称：[其它收费单.CAPTION]" VertAlign="Center" Font="宋体, 10pt"/>
      <TextObject Name="Text4" Left="500.85" Width="217.35" Height="28.35" Border.Lines="All" Text="收费金额：[其它收费单.MONEY]" VertAlign="Center" Font="宋体, 10pt"/>
      <TextObject Name="Text5" Top="56.7" Width="718.2" Height="103.95" Border.Lines="All" Text="收费说明：&#13;&#10;[其它收费单.CONTENT]" Padding="2, 5, 2, 0" Font="宋体, 10pt" LineHeight="22.68"/>
      <TextObject Name="Text6" Top="160.65" Width="500.85" Height="28.35" Border.Lines="All" Text="金额：（大写[convertToChineseMoney([其它收费单.MONEY])]）" VertAlign="Center" Font="宋体, 10pt"/>
      <TextObject Name="Text7" Left="500.85" Top="160.65" Width="217.35" Height="28.35" Border.Lines="All" Text="收费员：[其它收费单.REGER]" VertAlign="Center" Font="宋体, 10pt"/>
    </DataBand>
    <PageFooterBand Name="PageFooter1" Top="238.8" Width="718.2" Height="18.9"/>
  </ReportPage>
</Report>
