SAP B1:水晶报表中用Code128制作条型码的方法

摘要:
3、 在中创建新函数,在代码框中输入以下代码:FunctionfncGetCd128SetBASStringDimintLoopAsNumberDimintPositionasNumberTimintTotalValasNumbedDimstOutasStringDimstSpChrasStringDimistEndChrasString DimintEndNoasNumberstOut=“”forintLoop=0toLen-1intPosition=intLoop+1strSpChr=MidintTotalVal=intTotalVal+*intPositionnextinTotalVal=intTotalVal+104intTotalValue=intToalValmod103IfintTotalVal˃=95ThenSelectCaseintTotalValCase95strEndChr=“”Case96strEndChr=““”Case 97strEndCHr=“EndChr=“”EndSelectElseintTotalVal=intTotalVal+32strEndChr=ChrEndEffncGetCd128SetB=“”+strIn+strEndChr+“”EndFunction选择编译并保存。选择要转换的数据库字段。

一、在【文件系统】中新建一个【Fonts文件夹】,然后添加【Code128.ttf】文件。

二、在水晶报表里的【字段资源管理器】的【公式字段】中新建一个公式字段。点击【使用编辑器】之后弹出【公式工作室】。

三、在【公式工作室】中的【报表自定义函数】新建一个函数,在代码框中输入如下代码(VB代码):

Function fncGetCd128SetB ( strIn As string ) As String
    
    Dim intLoop As Number
    Dim intPosition as Number
    Dim intTotalVal as Number
    Dim strOut as String
    Dim strSpChr as String
    Dim strEndChr as String
    Dim intEndNo as Number
    
    strOut = ""
    
    for  intLoop = 0 to Len(strIn) - 1
        intPosition = intLoop + 1
        strSpChr = Mid(strIn, intPosition, 1)
        intTotalVal = intTotalVal + (Asc(strSpChr) - 32) * intPosition
    next
    
    intTotalVal = intTotalVal + 104
    
    intTotalVal = intTotalVal mod 103
    
    If intTotalVal >= 95 Then 
        Select Case intTotalVal 
            Case 95 
                strEndChr = "Ã" 
            Case 96 
                strEndChr = "Ä" 
            Case 97 
                strEndChr = "Å" 
            Case 98 
                strEndChr = "Æ" 
            Case 99 
                strEndChr = "Ç" 
            Case 100 
                strEndChr = "È" 
            Case 101 
                strEndChr = "É" 
            Case 102 
                strEndChr = "Ê" 
        End Select 
    Else 
        intTotalVal = intTotalVal + 32 
        strEndChr = Chr(intTotalVal) 
    End If 

    fncGetCd128SetB = "Ì" + strIn + strEndChr + "Î"

End Function

选择【Basic语法】进行编译保存。

四、点击新建的公式字段,在自定义函数选择框内,选择刚新建的自定义函数。在【函数参数】的【值】中选择你要转换的数据库字段。

五、将公式字段拖动到报表设计视图之后检查字体类型是否为Code 128。

参考:https://blog.csdn.net/ychchhy/article/details/6902876

免责声明:文章转载自《SAP B1:水晶报表中用Code128制作条型码的方法》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇在ServU配置ODBC过程记录(一)Loadrunner原理及基准测试下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Java 权限框架 Shiro 实战一:理论基础

Apache Shiro 官网地址:http://shiro.apache.org/ Apache Shiro is a powerful and easy-to-use Java security framework that performs authentication, authorization, cryptography, and sessio...

c#下怎么判断一个字符串是否可以转换为double类型

using System.Text.RegularExpressions; //引入Regex命名空间bool a = Regex.IsMatch(string, @"^[+-]?d*[.]?d*$"); //这个方法会返回一个布尔值,如果string字符串可以转换为double,则返回True,反之为False。bool b = Regex.IsMatc...

Microsoft Orleans构建高并发、分布式的大型应用程序框架

Microsoft Orleans 在.net用简单方法构建高并发、分布式的大型应用程序框架。 原文:http://dotnet.github.io/orleans/ 在线文档:http://dotnet.github.io/orleans/What's-new-in-Orleans 源码地址:https://github.com/dotnet/orlea...

Jsr303数据校验

空检查 @Null 验证对象是否为null @NotNull 验证对象是否不为null, 无法查检长度为0的字符串 @NotBlank 检查约束字符串是不是Null还有被Trim的长度是否大于0,只对字符串,且会去掉前后空格. @NotEmpty 检查约束元素是否为NULL或者是EMPTY. Booelan检查 @AssertTrue 验证 Boolean...

Servlet第四篇【request对象常用方法、应用】

什么是HttpServletRequest HttpServletRequest**对象代表客户端的请求,当客户端通过HTTP协议访问服务器时,**HTTP请求头中的所有信息都封装在这个对象中,开发人员通过这个对象的方法,可以获得客户这些信息。 简单来说,要得到浏览器信息,就找HttpServletRequest对象 HttpServletRequest...

使用jquery刷新当前页面

如何使用jquery刷新当前页面 下面介绍全页面刷新方法:有时候可能会用到 window.location.reload()刷新当前页面. parent.location.reload()刷新父亲对象(用于框架) opener.location.reload()刷新父窗口对象(用于单开窗口) top.location.reload()刷新最顶端对象(用于...