<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="10/15/2014 15:59:56" ReportInfo.Modified="01/20/2017 15:07:29" 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.Replace(&quot;-&quot;,&quot;&quot;);
      }
      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="收货方地址" 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="投保价值" 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="是否提付" DataType="System.String"/>
      <Column Name="是否回单付" DataType="System.String"/>
      <Column Name="是否月结" DataType="System.String"/>
      <Column Name="是否混合支付" 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"/>
      <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>
    <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>
  </Dictionary>
  <ReportPage Name="Page1" PaperWidth="60" PaperHeight="75" LeftMargin="0" TopMargin="0" RightMargin="0" BottomMargin="0" Guides="0">
    <ReportTitleBand Name="ReportTitle1" Width="226.8"/>
    <PageHeaderBand Name="PageHeader1" Top="4" Width="226.8" Height="18.9"/>
    <DataBand Name="Data1" Top="26.9" Width="226.8" Height="256.6" DataSource="main">
      <BarcodeObject Name="Barcode1" Left="7" Top="161.2" Width="205.85" Height="66.15" AutoSize="false" DataColumn="main.运单编号"/>
      <TextObject Name="Text1" Left="7.35" Top="61.5" Width="132.3" Height="18.9" Text="[Date]" Format="Date" Format.Format="yyyy-MM-dd HH:mm" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text3" Left="189.65" Top="38.8" Width="56.7" Height="28.35" Text="[item.件数]" Font="宋体, 9pt, style=Bold"/>
      <TextObject Name="Text2" Left="165.5" Top="33.9" Width="37.8" Height="37.8" Text="件&#13;&#10;数" HideZeros="true" Font="宋体, 9pt, style=Bold"/>
      <TextObject Name="Text4" Left="4.45" Top="79.05" Width="37.8" Height="37.8" Text="始发&#13;&#10;城市" VertAlign="Center" Font="宋体, 9pt, style=Bold"/>
      <TextObject Name="Text5" Left="37.8" Top="89.6" Width="75.6" Height="18.9" Text="[main.始发城市]" Font="宋体, 9pt"/>
      <TextObject Name="Text6" Left="122.85" Top="80.6" Width="37.8" Height="37.8" Text="目的&#13;&#10;城市" VertAlign="Center" Font="宋体, 9pt, style=Bold"/>
      <TextObject Name="Text7" Left="156.2" Top="91.15" Width="75.6" Height="18.9" Text="[main.目的地]" Font="宋体, 9pt"/>
      <TextObject Name="Text8" Left="5.9" Top="118.4" Width="37.8" Height="37.8" Text="始发&#13;&#10;站点" VertAlign="Center" Font="宋体, 9pt, style=Bold"/>
      <TextObject Name="Text9" Left="39.25" Top="129.4" Width="75.6" Height="18.9" Text="[main.发站]" Font="宋体, 9pt"/>
      <TextObject Name="Text10" Left="124.3" Top="119.95" Width="37.8" Height="37.8" Text="目的&#13;&#10;站点" VertAlign="Center" Font="宋体, 9pt, style=Bold"/>
      <TextObject Name="Text11" Left="157.65" Top="130.95" Width="75.6" Height="18.9" Text="[main.到站]" Font="宋体, 9pt"/>
      <TextObject Name="Text12" Left="3.45" Top="228.35" Width="73.8" Height="18.9" Text="配送地址：" VertAlign="Center" Font="宋体, 9pt, style=Bold"/>
      <TextObject Name="Text13" Left="66.15" Top="218.8" Width="149.4" Height="37.8" Text="[main.收货方地址]" VertAlign="Center" Font="宋体, 9pt"/>
      <TextObject Name="Text14" Left="10" Top="77.15" Width="207.9" Height="18.9" Border.Lines="Top" Font="宋体, 9pt"/>
      <TextObject Name="Text15" Left="9" Top="118.4" Width="207.9" Height="18.9" Border.Lines="Top" Font="宋体, 9pt"/>
      <TextObject Name="Text16" Left="10.45" Top="156.75" Width="207.9" Height="18.9" Border.Lines="Top" Font="宋体, 9pt"/>
      <TextObject Name="Text18" Left="8.9" Top="27.9" Width="152.3" Height="28.35" Text="[comp.公司名称]" VertAlign="Center" Font="微软雅黑, 9pt, style=Bold"/>
    </DataBand>
    <PageFooterBand Name="PageFooter1" Top="287.5" Width="226.8" Height="1.1">
      <TextObject Name="Text17" Left="8.9" Top="-17.8" Width="207.9" Height="18.9" Border.Lines="Top" Font="宋体, 9pt"/>
    </PageFooterBand>
  </ReportPage>
</Report>
