<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="10/15/2014 15:59:56" ReportInfo.Modified="08/08/2019 17:36:58" 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"/>
    </TableDataSource>
    <TableDataSource Name="item" ReferenceName="Data.item" DataType="System.Int32" Enabled="true">
      <Column Name="Expr1000" DataType="System.DateTime"/>
    </TableDataSource>
    <TableDataSource Name="comp" ReferenceName="Data.comp" DataType="System.Int32" Enabled="true">
      <Column Name="Expr1000" DataType="System.DateTime"/>
    </TableDataSource>
  </Dictionary>
  <ReportPage Name="Page1" PaperWidth="50" PaperHeight="40" LeftMargin="0" TopMargin="0" RightMargin="0" BottomMargin="0" Guides="0">
    <ReportTitleBand Name="ReportTitle1" Width="189"/>
    <DataBand Name="Data1" Top="4" Width="189" Height="143.64" DataSource="main">
      <BarcodeObject Name="Barcode1" Left="49.25" Top="28.45" Width="130.25" Height="66.15" AutoSize="false" DataColumn="main.'商品编码'"/>
      <TextObject Name="Text1" Left="53.7" Top="97.5" Width="47.25" Height="18.9" Text="尺码：" Font="宋体, 9pt"/>
      <TextObject Name="Text18" Left="98.85" Top="97.15" Width="66.15" Height="18.9" Text="[main.'尺码']" Font="宋体, 9pt, style=Bold"/>
      <TextObject Name="Text19" Left="52.7" Top="118.85" Width="47.25" Height="18.9" Text="价格：" Font="宋体, 9pt"/>
      <TextObject Name="Text20" Left="96.85" Top="118.5" Width="75.6" Height="18.9" Text="[main.'销价']" Font="宋体, 9pt, style=Bold"/>
      <TextObject Name="Text22" Left="39.7" Top="10.45" Width="132.3" Height="18.9" Text="[main.'商品名称']" HorzAlign="Center" Font="宋体, 9pt, style=Bold"/>
    </DataBand>
  </ReportPage>
</Report>
