<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="08/20/2012 15:14:53" ReportInfo.Modified="04/13/2016 19:05:51" 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="PDATE" DataType="System.String"/>
      <Column Name="USERID" Alias="开票员编号" DataType="System.String"/>
      <Column Name="CID" DataType="System.String"/>
      <Column Name="DESCRIPT" DataType="System.String"/>
      <Column Name="YH" Alias="优惠金额" DataType="System.Decimal"/>
      <Column Name="ZNJ" Alias="滞纳金" DataType="System.Decimal"/>
      <Column Name="MONEY" Alias="实收金额" DataType="System.Decimal"/>
      <Column Name="PAYSTYLE" Alias="收款方式" DataType="System.String"/>
      <Column Name="PAY" DataType="System.Decimal"/>
      <Column Name="ZERO" DataType="System.Decimal"/>
      <Column Name="TOTALSUM" Alias="应收金额" DataType="System.Decimal"/>
      <Column Name="USEBALANCE" Alias="使用余额" DataType="System.Decimal"/>
      <Column Name="NAME" Alias="小区名称" DataType="System.String"/>
      <Column Name="CNAME" DataType="System.String"/>
      <Column Name="TEL" DataType="System.String"/>
      <Column Name="AID" DataType="System.String"/>
      <Column Name="AREA" DataType="System.Decimal"/>
      <Column Name="STOREY" DataType="System.Int32"/>
      <Column Name="WYSTATE" DataType="System.String"/>
      <Column Name="WYTYPE" DataType="System.String"/>
      <Column Name="INVALID" DataType="System.String"/>
      <Column Name="GROUPNAME" DataType="System.String"/>
      <Column Name="PLOTNAME" DataType="System.String"/>
    </TableDataSource>
    <TableDataSource Name="收费明细情况" ReferenceName="Data.收费明细情况" DataType="System.Int32" Enabled="true">
      <Column Name="ID" DataType="System.String"/>
      <Column Name="CID" DataType="System.String"/>
      <Column Name="BDATE" Alias="起始日期" DataType="System.String"/>
      <Column Name="EDATE" Alias="结束日期" DataType="System.String"/>
      <Column Name="BL" Alias="倍率" DataType="System.Int32"/>
      <Column Name="FID" DataType="System.String"/>
      <Column Name="QTY" Alias="数量" DataType="System.Decimal"/>
      <Column Name="PRICE" Alias="单价" DataType="System.Decimal"/>
      <Column Name="MONEY" Alias="金额" DataType="System.Decimal"/>
      <Column Name="QM" Alias="起码" DataType="System.Decimal"/>
      <Column Name="ZM" Alias="止码" DataType="System.Decimal"/>
      <Column Name="DESCRIPT" Alias="备注" DataType="System.String"/>
      <Column Name="YN" Alias="已收费" DataType="System.Int32"/>
      <Column Name="FDATE" Alias="收费日期" DataType="System.String"/>
      <Column Name="CDATE" Alias="创建日期" DataType="System.String"/>
      <Column Name="PID" Alias="收费凭证号" DataType="System.String"/>
      <Column Name="FEETYPE" Alias="收费类型" DataType="System.String"/>
      <Column Name="YNBACK" Alias="是否退还" DataType="System.Int32"/>
      <Column Name="BACKDATE" Alias="退还日期" DataType="System.String"/>
      <Column Name="BACKID" Alias="退还编号" DataType="System.String"/>
      <Column Name="PLOTID" DataType="System.String"/>
      <Column Name="FEETYPE1" DataType="System.String"/>
      <Column Name="FORMULA" DataType="System.String"/>
      <Column Name="METRICTYPE" DataType="System.String"/>
      <Column Name="PRICE1" DataType="System.Decimal"/>
      <Column Name="FEECLASS" DataType="System.String"/>
      <Column Name="AID" DataType="System.String"/>
      <Column Name="ZJ" DataType="System.Decimal"/>
      <Column Name="INVALID" DataType="System.String"/>
      <Column Name="BLL" DataType="System.Decimal"/>
      <Column Name="FNAME" DataType="System.String"/>
      <Column Name="CUNAME" DataType="System.String"/>
      <Column Name="CUCNAME" DataType="System.String"/>
      <Column Name="TEL" DataType="System.String"/>
      <Column Name="AREA" DataType="System.Decimal"/>
    </TableDataSource>
    <TableDataSource Name="开票员" ReferenceName="Data.开票员" DataType="System.Int32" Enabled="true">
      <Column Name="USERID" DataType="System.String"/>
      <Column Name="USERNAME" DataType="System.String"/>
    </TableDataSource>
  </Dictionary>
  <ReportPage Name="Page1" PaperHeight="94" BottomMargin="5" FirstPageSource="1" OtherPagesSource="1">
    <PageHeaderBand Name="PageHeader1" Width="718.2" Height="85.05">
      <TextObject Name="Text2" Top="47.25" Width="718.2" Height="37.8" Text="门牌号:[开票收款统计.小区名称] 业主姓名:[开票收款统计.CNAME]  建筑面积:[开票收款统计.AREA]㎡  楼层:[开票收款统计.STOREY]  联系电话:[开票收款统计.TEL]  付款方式:[开票收款统计.收款方式]  物业类型:[开票收款统计.WYTYPE]" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text3" Left="557.55" Width="160.65" Height="18.9" Text="单号：[开票收款统计.ID]" Font="宋体, 9pt"/>
      <TextObject Name="Text1" Width="718.2" Height="37.8" Text="[开票收款统计.PLOTNAME]收费单据" HorzAlign="Center" VertAlign="Center" Font="宋体, 16pt, style=Bold"/>
      <TextObject Name="Text6" Left="557.55" Top="18.9" Width="160.65" Height="18.9" Text="收费日期：[开票收款统计.PDATE]" Font="宋体, 9pt"/>
    </PageHeaderBand>
    <ColumnHeaderBand Name="ColumnHeader1" Top="89.05" Width="718.2" Height="28.35">
      <TextObject Name="Text8" Width="198.45" Height="28.35" Border.Lines="All" Text="收费项目" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text10" Left="198.45" Width="75.6" Height="28.35" Border.Lines="All" Text="起始" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text11" Left="274.05" Width="75.6" Height="28.35" Border.Lines="All" Text="结束" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text17" Left="349.65" Width="56.7" Height="28.35" Border.Lines="All" Text="数量" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text18" Left="406.35" Width="56.7" Height="28.35" Border.Lines="All" Text="单价" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text19" Left="463.05" Width="85.05" Height="28.35" Border.Lines="All" Text="金额" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text20" Left="548.1" Width="170.1" Height="28.35" Border.Lines="All" Text="备注" VertAlign="Center" Font="宋体, 9pt"/>
    </ColumnHeaderBand>
    <DataBand Name="Data1" Top="121.4" Width="718.2" Height="28.35" DataSource="收费明细情况">
      <TextObject Name="Text7" Width="198.45" Height="28.35" Border.Lines="All" Text="[收费明细情况.CUNAME][收费明细情况.FNAME]:[收费明细情况.FORMULA]" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text9" Left="198.45" Width="75.6" Height="28.35" Border.Lines="All" Text="[IIf([收费明细情况.收费类型]==&quot;计量收费类&quot;,[收费明细情况.起码],[收费明细情况.起始日期])]" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text12" Left="274.05" Width="75.6" Height="28.35" Border.Lines="All" Text="[IIf([收费明细情况.收费类型]==&quot;计量收费类&quot;,[收费明细情况.止码],[收费明细情况.结束日期])]" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text13" Left="349.65" Width="56.7" Height="28.35" Border.Lines="All" CanShrink="true" GrowToBottom="true" Text="[收费明细情况.数量]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="2" Format.DecimalSeparator="." Format.GroupSeparator="" Format.NegativePattern="1" HorzAlign="Right" VertAlign="Center" WordWrap="false" Font="宋体, 9pt" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text14" Left="406.35" Width="56.7" Height="28.35" Border.Lines="All" Text="[收费明细情况.单价]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="2" Format.DecimalSeparator="." Format.GroupSeparator="" Format.NegativePattern="1" HorzAlign="Right" VertAlign="Center" WordWrap="false" Font="宋体, 9pt" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text15" Left="463.05" Width="85.05" Height="28.35" Border.Lines="All" Text="[收费明细情况.金额]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="2" Format.DecimalSeparator="." Format.GroupSeparator="" Format.NegativePattern="1" HorzAlign="Right" VertAlign="Center" WordWrap="false" Font="宋体, 9pt" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text16" Left="548.1" Width="170.1" Height="28.35" Border.Lines="All" Text="[收费明细情况.备注]" VertAlign="Center" Font="宋体, 9pt"/>
    </DataBand>
    <ReportSummaryBand Name="ReportSummary1" Top="153.75" Width="718.2" Height="75.6">
      <TextObject Name="Text28" Top="28.35" Width="718.2" Height="28.35" Border.Lines="Bottom" Text="优惠金额：[开票收款统计.优惠金额] 滞纳金：[开票收款统计.滞纳金] 使用预存：[开票收款统计.使用余额] 本次应收：[开票收款统计.实收金额] 本次结余：[开票收款统计.ZERO] 实收金额：[开票收款统计.PAY]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="2" Format.DecimalSeparator="." Format.GroupSeparator="" Format.NegativePattern="1" VertAlign="Center" WordWrap="false" Font="宋体, 9pt" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text23" Left="548.1" Width="170.1" Height="28.35" Border.Lines="All" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text21" Width="463.05" Height="28.35" Border.Lines="All" Text="合计：大写（[convertToChineseMoney([开票收款统计.应收金额])]）" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text22" Left="463.05" Width="85.05" Height="28.35" Border.Lines="All" Text="[开票收款统计.应收金额]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="2" Format.DecimalSeparator="." Format.GroupSeparator="" Format.NegativePattern="1" HorzAlign="Right" VertAlign="Center" WordWrap="false" Font="宋体, 9pt" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text5" Top="56.7" Width="718.2" Height="18.9" CanGrow="true" CanShrink="true" GrowToBottom="true" Text="[开票收款统计.DESCRIPT]" VertAlign="Center" Font="宋体, 9pt"/>
    </ReportSummaryBand>
    <PageFooterBand Name="PageFooter1" Top="233.35" Width="718.2" Height="18.9">
      <TextObject Name="Text24" Left="406.35" Width="160.65" Height="18.9" Text="收款人：[开票员.USERNAME]" HorzAlign="Right" Font="宋体, 9pt"/>
      <TextObject Name="Text26" Width="359.1" Height="18.9" Text="第一联：存根（白） 第二联：客户（红） 第三联：记账（黄）" Font="宋体, 9pt"/>
      <TextObject Name="Text4" Left="595.35" Width="122.85" Height="18.9" Text="第[Page#]页/共[TotalPages#]页" HorzAlign="Right" Font="宋体, 9pt"/>
    </PageFooterBand>
  </ReportPage>
</Report>
