<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="05/04/2014 17:10:35" ReportInfo.Modified="04/12/2017 11:01:56" ReportInfo.CreatorVersion="2014.3.1.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 int AmtLength = 2;
    public int PriceLength = 2;
    public int QtyLength = 2;
    public string ToUpper(string m)
    {       
      string cm;
      if(m==&quot;&quot;)
      {
        cm=&quot;0&quot;;
      }
      else
      {
        cm=m;
      }
      Decimal d=decimal.Parse(cm);
      if (d == 0)
        return &quot;零元整&quot;;

      string je = d.ToString(&quot;####.00&quot;);
      if (je.Length &gt; 15)
        return &quot;&quot;;
      je = new String('0', 15 - je.Length) + je; //若小于15位长，前面补0 

      string stry = je.Substring(0, 4); //取得 '亿 '单元 
      string strw = je.Substring(4, 4); //取得 '万 '单元 
      string strg = je.Substring(8, 4); //取得 '元 '单元 
      string strf = je.Substring(13, 2); //取得小数部分 

      string str1 = &quot;&quot;;
      string str2 = &quot;&quot;;
      string str3 = &quot;&quot;;

      str1 = this.getupper(stry, &quot;亿&quot;); //亿单元的大写 
      str2 = this.getupper(strw, &quot;万&quot;); //万单元的大写 
      str3 = this.getupper(strg, &quot;元&quot;); //元单元的大写 


      string str_y = &quot;&quot;;
      string str_w = &quot;&quot;;
      if (je[3] == '0' || je[4] == '0') //亿和万之间是否有0 
        str_y = &quot;零&quot;;
      if (je[7] == '0' || je[8] == '0') //万和元之间是否有0 
        str_w = &quot;零&quot;;


      string ret = str1 + str_y + str2 + str_w + str3; //亿，万，元的三个大写合并 

      for (int i = 0; i &lt; ret.Length; i++) //去掉前面的 &quot;零 &quot; 
      {
        if (ret[i] != '零')
        {
          ret = ret.Substring(i);
          break;
        }

      }
      for (int i = ret.Length - 1; i &gt; -1; i--) //去掉最后的 &quot;零 &quot; 
      {
        if (ret[i] != '零')
        {
          ret = ret.Substring(0, i + 1);
          break;
        }
      }

      if (ret[ret.Length - 1] != '元') //若最后不位不是 '元 '，则加一个 '元 '字 
        ret = ret + &quot;元&quot;;

      if (ret == &quot;零零元&quot;) //若为零元，则去掉 &quot;元数 &quot;，结果只要小数部分 
        ret = &quot;&quot;;

      if (strf == &quot;00&quot;) //下面是小数部分的转换 
      {
        ret = ret + &quot;整&quot;;
      }
      else
      {
        string tmp = &quot;&quot;;
        tmp = this.getint(strf[0]);
        if (tmp == &quot;零&quot;)
          ret = ret + tmp;
        else
          ret = ret + tmp + &quot;角&quot;;

        tmp = this.getint(strf[1]);
        if (tmp == &quot;零&quot;)
          ret = ret + &quot;整&quot;;
        else
          ret = ret + tmp + &quot;分&quot;;
      }

      if (ret[0] == '零')
      {
        ret = ret.Substring(1); //防止0.03转为 &quot;零叁分 &quot;，而直接转为 &quot;叁分 &quot; 
      }

      return ret; //完成，返回 


    }

    private string getupper(string str, string strDW)
    {
      if (str == &quot;0000&quot;)
        return &quot;&quot;;

      string ret = &quot;&quot;;
      string tmp1 = this.getint(str[0]);
      string tmp2 = this.getint(str[1]);
      string tmp3 = this.getint(str[2]);
      string tmp4 = this.getint(str[3]);
      if (tmp1 != &quot;零&quot;)
      {
        ret = ret + tmp1 + &quot;仟&quot;;
      }
      else
      {
        ret = ret + tmp1;
      }

      if (tmp2 != &quot;零&quot;)
      {
        ret = ret + tmp2 + &quot;佰&quot;;
      }
      else
      {
        if (tmp1 != &quot;零&quot;) //保证若有两个零 '00 '，结果只有一个零，下同 
          ret = ret + tmp2;
      }

      if (tmp3 != &quot;零&quot;)
      {
        ret = ret + tmp3 + &quot;拾&quot;;
      }
      else
      {
        if (tmp2 != &quot;零&quot;)
          ret = ret + tmp3;
      }

      if (tmp4 != &quot;零&quot;)
      {
        ret = ret + tmp4;
      }

      if (ret[0] == '零') //若第一个字符是 '零 '，则去掉 
        ret = ret.Substring(1);
      if (ret[ret.Length - 1] == '零') //若最后一个字符是 '零 '，则去掉 
        ret = ret.Substring(0, ret.Length - 1);

      return ret + strDW; //加上本单元的单位
    }

    /// &lt;summary&gt; 
    /// 单个数字转为大写 
    /// &lt;/summary&gt; 
    /// &lt;param name= &quot;c &quot;&gt; 小写阿拉伯数字 0---9 &lt;/param&gt; 
    /// &lt;returns&gt; 大写数字 &lt;/returns&gt; 
    private string getint(char c)
    {
      string str = &quot;&quot;;
      switch (c)
      {
        case '0':
          str = &quot;零&quot;;
          break;
        case '1':
          str = &quot;壹&quot;;
          break;
        case '2':
          str = &quot;贰&quot;;
          break;
        case '3':
          str = &quot;叁&quot;;
          break;
        case '4':
          str = &quot;肆&quot;;
          break;
        case '5':
          str = &quot;伍&quot;;
          break;
        case '6':
          str = &quot;陆&quot;;
          break;
        case '7':
          str = &quot;柒&quot;;
          break;
        case '8':
          str = &quot;捌&quot;;
          break;
        case '9':
          str = &quot;玖&quot;;
          break;
      }
      return str;
    }
    public  void SetPageRowCount(DataBand data, int pageRowCount)
    {
      TableDataSource table = (TableDataSource)data.DataSource;
      table.Table.PrimaryKey = null;
      for(int i=0;i&lt;table.Table.Columns.Count;i++)
      {
        table.Table.Columns[i].AllowDBNull = true;
      }
      while(table.Table.Rows.Count%pageRowCount!=0)
      {
        DataRow row = table.Table.NewRow();
        table.Table.Rows.Add(row);
      }
    }
    public double FormatToDouble(object vText)
    {
      if (vText == null || vText.ToString() == &quot;&quot; || vText.ToString() == &quot;-&quot; || vText.ToString() == &quot;.&quot;)
        return 0;
      else
      {
        try
        {
          return double.Parse(vText.ToString());
        }
        catch
        {
          return 0;
        }
      }
    }
  }
}
</ScriptText>
  <Dictionary>
    <TableDataSource Name="main" ReferenceName="Data.main" DataType="System.Int32" Enabled="true">
      <Column Name="单号" DataType="System.String"/>
      <Column Name="往来单位" DataType="System.String"/>
      <Column Name="支付方式" DataType="System.String"/>
      <Column Name="票据号" DataType="System.String"/>
      <Column Name="经手人" DataType="System.String"/>
      <Column Name="审核状态" DataType="System.String"/>
      <Column Name="审核人" DataType="System.String"/>
      <Column Name="审核时间" DataType="System.String"/>
      <Column Name="时间" DataType="System.String"/>
      <Column Name="备注" DataType="System.String"/>
      <Column Name="金额" DataType="System.String"/>
      <Column Name="结算方式" DataType="System.String"/>
      <Column Name="凭证号" DataType="System.String"/>
      <Column Name="自定义" DataType="System.String"/>
      <Column Name="自定义1" DataType="System.String"/>
      <Column Name="自定义2" DataType="System.String"/>
      <Column Name="制单人" DataType="System.String"/>
    </TableDataSource>
    <TableDataSource Name="item" ReferenceName="Data.item" DataType="System.Int32" Enabled="true">
      <Column Name="金额" DataType="System.String"/>
      <Column Name="备注" DataType="System.String"/>
      <Column Name="收入项目" DataType="System.String"/>
    </TableDataSource>
    <TableDataSource Name="comp" ReferenceName="Data.comp" DataType="System.Int32" Enabled="true">
      <Column Name="公司名称" DataType="System.String"/>
      <Column Name="电话" DataType="System.String"/>
      <Column Name="传真" DataType="System.String"/>
      <Column Name="电子邮箱" DataType="System.String"/>
      <Column Name="开户银行" DataType="System.String"/>
      <Column Name="银行账号" DataType="System.String"/>
      <Column Name="税号" DataType="System.String"/>
      <Column Name="地址" DataType="System.String"/>
      <Column Name="备注" DataType="System.String"/>
    </TableDataSource>
    <Total Name="金额" Expression="[item.金额]" Evaluator="Data1"/>
  </Dictionary>
  <ReportPage Name="Page1">
    <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="110.8">
      <TextObject Name="Text20" Left="19.8" Top="9.45" Width="642.6" Height="22.68" Text="[comp.公司名称]" HorzAlign="Center" Font="宋体, 12pt, style=Bold"/>
      <TextObject Name="Text1" Left="19.8" Top="32.8" Width="642.6" Height="18.9" Text="其他收入单" HorzAlign="Center" Font="宋体, 14pt, style=Bold"/>
      <TextObject Name="Text5" Left="85.95" Top="47.25" Width="141.75" Height="18.9" Text="[main.单号]" Font="宋体, 11pt"/>
      <TextObject Name="Text42" Left="44.15" Top="47.25" Width="75.6" Height="18.9" Text="单号：" Font="宋体, 11pt"/>
      <TextObject Name="Text43" Left="595.25" Top="47.25" Width="103.95" Height="18.9" Text="[main.时间]" Font="宋体, 11pt"/>
      <TextObject Name="Text44" Left="558.45" Top="47.25" Width="75.6" Height="18.9" Text="日期：" Font="宋体, 11pt"/>
      <TextObject Name="Text2" Left="14.8" Top="66.15" Width="94.5" Height="18.9" Text="往来单位：" Font="宋体, 11pt"/>
      <TextObject Name="Text3" Left="85.95" Top="66.15" Width="217.35" Height="18.9" Text="[main.往来单位]" VertAlign="Center" Font="宋体, 11pt"/>
      <TextObject Name="Text54" Left="85.95" Top="85.05" Width="349.65" Height="18.9" Text="[main.备注]" Font="宋体, 11pt"/>
      <TextObject Name="Text55" Left="45.15" Top="85.05" Width="94.5" Height="18.9" Text="备注：" VertAlign="Center" Font="宋体, 11pt"/>
    </ReportTitleBand>
    <PageHeaderBand Name="PageHeader1" Top="114.8" Width="718.2" Height="30.24">
      <TextObject Name="Text7" Left="47.7" Width="311.85" Height="30.24" Border.Lines="All" Text="收入项目" HorzAlign="Center" VertAlign="Center" Font="宋体, 11pt"/>
      <TextObject Name="Text9" Left="359.55" Width="75.6" Height="30.24" Border.Lines="All" Text="金额" HorzAlign="Center" VertAlign="Center" Font="宋体, 11pt"/>
      <TextObject Name="Text49" Left="434.6" Width="274.43" Height="30.24" Border.Lines="All" Text="备注" Format="Number" Format.UseLocale="true" HorzAlign="Center" VertAlign="Center" WordWrap="false" Font="宋体, 11pt" LineHeight="11.34"/>
      <TextObject Name="Text56" Left="10.45" Width="37.8" Height="30.24" Border.Lines="All" Text="单号" HorzAlign="Center" VertAlign="Center" Font="宋体, 9pt"/>
    </PageHeaderBand>
    <DataBand Name="Data1" Top="149.04" Width="718.2" Height="30.24" DataSource="item">
      <TextObject Name="Text6" Left="47.7" Width="311.85" Height="30.24" Border.Lines="All" Text="[item.收入项目]" AutoShrink="FontSize" HorzAlign="Center" VertAlign="Center" Font="宋体, 11pt"/>
      <TextObject Name="Text8" Left="359.55" Width="75.6" Height="30.24" Border.Lines="All" Text="[item.金额]" AutoShrink="FontSize" HorzAlign="Center" VertAlign="Center" Font="宋体, 11pt"/>
      <TextObject Name="Text17" Left="434.6" Width="274.43" Height="30.24" Border.Lines="All" Text="[item.备注]" AutoShrink="FontSize" HorzAlign="Center" VertAlign="Center" Font="宋体, 11pt"/>
      <TextObject Name="Text57" Left="9.9" Width="37.8" Height="30.24" Border.Lines="All" Text="[Row#]" AutoShrink="FontSize" HorzAlign="Center" VertAlign="Center" Font="宋体, 9pt"/>
    </DataBand>
    <ReportSummaryBand Name="ReportSummary1" Top="183.28" Width="718.2" Height="96.24">
      <TextObject Name="Text35" Left="9.9" Top="-0.15" Width="349.65" Height="30.24" Border.Lines="All" Text="合计：（人民币大写）[ToUpper([金额])]" VertAlign="Center" Font="宋体, 11pt" LineHeight="11.34"/>
      <TextObject Name="Text41" Left="360.45" Top="-0.15" Width="348.89" Height="30.24" Border.Lines="All" Text="￥[[金额]]" Format="Number" Format.UseLocale="true" VertAlign="Center" Font="宋体, 11pt" LineHeight="11.34"/>
      <TextObject Name="Text62" Left="5.45" Top="47.25" Width="85.05" Height="18.9" Text="经手人：" Font="宋体, 11pt"/>
      <TextObject Name="Text63" Left="52.7" Top="47.25" Width="113.4" Height="18.9" Text="[main.经手人]" Font="宋体, 11pt"/>
      <TextObject Name="Text64" Left="175.55" Top="47.25" Width="85.05" Height="18.9" Text="制单人：" Font="宋体, 11pt"/>
      <TextObject Name="Text65" Left="232.25" Top="47.25" Width="103.95" Height="18.9" Text="[main.制单人]" Font="宋体, 11pt"/>
      <TextObject Name="Text66" Left="370" Top="47.25" Width="85.05" Height="18.9" Text="审核人：" Font="宋体, 11pt"/>
      <TextObject Name="Text67" Left="425.7" Top="47.25" Width="94.5" Height="18.9" Text="[main.审核人]" Font="宋体, 11pt"/>
      <TextObject Name="Text68" Left="553.55" Top="47.25" Width="85.05" Height="18.9" Text="审核时间：" Font="宋体, 11pt"/>
      <TextObject Name="Text69" Left="619.25" Top="46.25" Width="94.5" Height="18.9" Text="[main.审核时间]" Font="宋体, 11pt"/>
    </ReportSummaryBand>
    <PageFooterBand Name="PageFooter1" Top="283.52" Width="718.2"/>
  </ReportPage>
</Report>
