..:: MX Studio Fóruns ::..: boleto da Caixa CEF com PDF - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

boleto da Caixa CEF com PDF

#1 User is offline   xanburzum 

  • Group: Administrador
  • Posts: 2072
  • Joined: 04-November 08

Posted 15 August 2011 - 07:15 PM

boleto da Caixa


Sub WBarCode( Valor )

    Dim f, f1, f2, i
    Dim texto
    Const fino = 1
    Const largo = 3
    Const altura = 50
    Dim BarCodes(99)

    if isempty(BarCodes(0)) then
        BarCodes(0) = "00110"
        BarCodes(1) = "10001"
        BarCodes(2) = "01001"
        BarCodes(3) = "11000"
        BarCodes(4) = "00101"
        BarCodes(5) = "10100"
        BarCodes(6) = "01100"
        BarCodes(7) = "00011"
        BarCodes(8) = "10010"
        BarCodes(9) = "01010"
        for f1 = 9 to 0 step -1
            for f2 = 9 to 0 Step -1
                f = f1 * 10 + f2
                texto = ""
                for i = 1 To 5
                    texto = texto & mid(BarCodes(f1), i, 1) + mid(BarCodes(f2), i, 1)
                next
                BarCodes(f) = texto
            next
        next
    end if
%>
<img src="imagens/p.gif" width="<%=fino%>" height="<%=altura%>" border="0" /><img 
src="imagens/b.gif" width="<%=fino%>" height="<%=altura%>" border="0" /><img 
src="imagens/p.gif" width="<%=fino%>" height="<%=altura%>" border="0" /><img 
src="imagens/b.gif" width="<%=fino%>" height="<%=altura%>" border="0" /><img 
<%
texto = valor
if len( texto ) mod 2 <> 0 then
    texto = "0" & texto
end if

'Draw dos dados
do while len(texto) > 0
    i = cint( left( texto, 2) )
    texto = right( texto, len( texto ) - 2)
    f = BarCodes(i)
    for i = 1 to 10 step 2
        if mid(f, i, 1) = "0" then
            f1 = fino
        else
            f1 = largo
        end if
        %>
        src="imagens/p.gif" width="<%=f1%>" height="<%=altura%>" border="0" /><img 
        <%
        if mid(f, i + 1, 1) = "0" Then
            f2 = fino
        else
            f2 = largo
        end if
        %>
        src="imagens/b.gif" width="<%=f2%>" height="<%=altura%>" border="0" /><img 
        <%
    next
loop
%>
src="imagens/p.gif" width="<%=largo%>" height="<%=altura%>" border="0" /><img 
src="imagens/b.gif" width="<%=fino%>" height="<%=altura%>" border="0" /><img 
src="imagens/p.gif" width="<%=1%>" height="<%=altura%>" border="0" />
<%
end sub
%>




Aqui o boleto em PDF, usando o FPDF.

Sub fbarcode(Valor)
        Dim f, f1, f2, i
        Dim texto
    Dim p11
    p11=11
        Const fino = 0.4
        Const largo = 0.7
        Dim BarCodes(99)
        if isempty(BarCodes(0)) then
                BarCodes(0) = "00110"
                BarCodes(1) = "10001"
                BarCodes(2) = "01001"
                BarCodes(3) = "11000"
                BarCodes(4) = "00101"
                BarCodes(5) = "10100"
                BarCodes(6) = "01100"
                BarCodes(7) = "00011"
                BarCodes(8) = "10010"
                BarCodes(9) = "01010"
                for f1 = 9 to 0 step -1
                        for f2 = 9 to 0 Step -1
                                f = f1 * 10 + f2
                                texto = ""
                                for i = 1 To 5
                                        texto = texto & mid(BarCodes(f1), i, 1) + mid(BarCodes(f2), i, 1)
                                next
                                BarCodes(f) = texto
                        next
                next
        end if

    xPos=14
    p201=233
    pdf.rect xPos, p201, fino, p11, "F"
    xPos = xPos + fino + fino
    pdf.rect xPos, p201, fino, p11, "F"
    xpos = xpos + fino + fino
    For n = 1 To Len(valor_barras) Step 2
        cASC = cint(Mid(valor_barras, n, 2))
        For i = 1 To 10 Step 2
            If Mid(BarCodes(cASC), i, 1) = "0" Then
                F = fino
            Else
                F = largo
            End If
            pdf.rect xpos, p201, F, p11, "F"
            xpos = xpos + F
            If Mid(BarCodes(cASC), i + 1, 1) = "0" Then
                xpos = xpos + fino
            Else
                xpos = xpos + largo
            End If
        Next
    Next

    pdf.rect xpos, p201, largo, p11, "F"
    xpos = xpos + fino + largo
    pdf.rect xpos, p201, fino, p11, "F"

end Sub

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)