zoukankan      html  css  js  c++  java
  • SAP B1:水晶报表中用Code128制作条型码的方法

    一、在【文件系统】中新建一个【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

  • 相关阅读:
    NOI2017 退役记
    bzoj2590[Usaco2012 Feb]Cow Coupons
    bzoj2215[POI2011]Conspiracy
    bzoj2115[WC2011]Xor
    bzoj4754[JSOI2016]独特的树叶
    SQL外连接与条件 left outer join + WHERE/AND 区别
    IBM Datastage
    无法在MS SQL SERVER MANAGEMENT中打开SSIS实例-解决办法
    SSIS 教学教程
    SQL SERVER 2019 电子书下载
  • 原文地址:https://www.cnblogs.com/chenshc/p/11827565.html
Copyright © 2011-2022 走看看