Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2009
    Posts
    115

    Barcodes EAN8/13

    Hi i've created 3 functions to show barcodes EAN8 and EAN13 with addon of 2/5 numbers if needed

    You must use the font that i've attached

    PHP Code:
    function EAN8(chaine)
    if 
    String.Length(chaine) == 7 then
        checksum
    ="";
        
    min 7;
        
    max 1
        
    step = -2
        for 
    count minmaxstep do
            
    checksum=String.ToNumber(checksum)+String.ToNumber(String.Mid(chainecount1));
        
    end
        checksum
    =checksum*3
        min 
    6;
        
    max 1;  
        
    step = -2
        for 
    count minmaxstep do
            
    checksum=String.ToNumber(checksum)+String.Mid(String.ToNumber(chaine), count1);
        
    end
        k1
    =Math.Mod(checksum,10)
        
    chaine=chaine..Math.Mod(10-k1,10)
        
    codebarre=":"
        
    min 1
        
    max 4;   
        for 
    count minmax do
            
    codebarre=codebarre..String.Char(65+String.Mid(chainecount1));
        
    end
        codebarre
    =codebarre.."*"
        
    min 5
        
    max 8
        for 
    count minmax do
            
    codebarre=codebarre..String.Char(97+String.Mid(chainecount1));
        
    end
        codebarre
    =codebarre.."+"
        
    end
        
    return codebarre
    end

      
    function EAN13(chaine)
        if 
    String.Length(chaine)==12 then
        min 
    12
        
    max 1;  
        
    step = -2;  
        
    checksum=""
        
    for count minmaxstep do
            
    checksum=String.ToNumber(checksum)+String.ToNumber(String.Mid(chainecount1));
        
    end
        checksum
    =checksum*3
        min 
    11;
        
    max 1;  
        
    step = -2
        for 
    count minmaxstep do
            
    checksum=String.ToNumber(checksum)+String.ToNumber(String.Mid(chainecount1));
        
    end
        k1
    =Math.Mod(checksum,10)
        
    chaine=chaine..Math.Mod(10-k1,10)

        
    codebarre=String.Left(chaine1)..String.Char(65+String.Mid(chaine21))
        
        
    end
        first
    String.ToNumber(String.Left(chaine1));
        
    min 3;
        
    max 7
        for 
    count minmax do
            
    tablea=false
            
            
    if (count==3then
                
    if (first==or first==or first==or first==3then
                tablea
    =true
                end
            
    elseif (count==4then
                
    if (first==or first==or first==or first==8then
                tablea
    =true
                end
            
    elseif (count==5then
                
    if (first==or first==or first==or first==or first==9then
                tablea
    =true
                end
            
    elseif (count==6then
                
    if (first==or first==or first==or first==or first==7then
                tablea
    =true
                end
            
    elseif (count==7then
                
    if (first==or first==or first==or first==9then
                tablea
    =true
                end
            end
            
            
    if (tablea==truethen
                codebarre
    =codebarre..String.Char(65+String.Mid(chainecount1));
            else
                
    codebarre=codebarre..String.Char(75+String.Mid(chainecount1));
            
    end
            
        end
        codebarre
    =codebarre.."*"
        
    min 8;  
        
    max 13
        for 
    count minmax do
            
    codebarre=codebarre..String.Char(97+String.Mid(chainecount1));
        
    end
        codebarre
    =codebarre.."+"
    return codebarre
    end

    function ADDON(chaine)
        if 
    String.Length(chaine)==or String.Length(chaine)==5 then
            checksum
    =""
            
    if String.Length(chaine)==2 then
                checksum
    =10+Math.Mod(chaine,4);
            else
                
    min 1
                
    max 5;  
                
    step 2
                for 
    count minmaxstep do
                    
    checksum=String.ToNumber(checksum)+String.ToNumber(String.Mid(chainecount1));
                
    end
                checksum
    =Math.Mod(checksum*3+(String.Mid(chaine21)*9)+(String.Mid(chaine41)*9),10)
            
    end
            addon
    ="["
            
    min 1
            
    max String.Length(chaine); 
            for 
    count minmax do
                
    tablea=false;
                if (
    count==1then
                    
    if (checksum==or checksum==or checksum==or checksum==or checksum==or checksum==or checksum==10 or checksum==11then
                    tablea
    =true
                    end
                
    elseif (count==2then
                    
    if (checksum==or checksum==or checksum==or checksum==or checksum==or checksum==or checksum==10 or checksum==12then
                    tablea
    =true
                    end
                
    elseif (count==3then
                    
    if (checksum==or checksum==or checksum==or checksum==or checksum==or checksum==8then
                    tablea
    =true
                    end
                
    elseif (count==4then
                    
    if (checksum==or checksum==or checksum==or checksum==or checksum==or checksum==9then
                    tablea
    =true
                    end
                
    elseif (count==5then
                    
    if (checksum==or checksum==or checksum==or checksum==or checksum==or checksum==7then
                    tablea
    =true
                    end
                end
                
    if (tablea==truethen
                    addon
    =addon..String.Char(65+String.Mid(chaine,count,1))
                else
                    
    addon=addon..String.Char(75+String.Mid(chaine,count,1))
                
    end
                
                
    if (String.Length(chaine)==and count==1) or (String.Length(chaine)==and count<5then
                addon
    =addon..String.Char(92)
                
    end
            end
            
        end
        
    return addon
    end 
    EAN8(code,7) generates an barcode string that can be showed using "Code EAN" Font
    EAN13(code,12) generates an barcode string that can be showed using "Code EAN" Font
    ADDON(code,2/5) generates an addon for barcode string that can be showed using "Code EAN" Font

    I've created a simple app to work with it, tomorrow i will share it (i've created in spanish)
    Attached Files

  2. #2
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014
    Nice job

  3. #3
    Join Date
    Mar 2007
    Location
    México
    Posts
    183
    Nice app

  4. #4
    Join Date
    Jul 2008
    Posts
    88
    yes will be...

  5. #5
    Join Date
    Aug 2007
    Location
    Leon, Mexico.
    Posts
    406

    Great this Good one...

    Waiting to Having a blast with this one...

    Groovy

  6. #6
    Join Date
    Nov 2004
    Location
    Belgium, Leuven
    Posts
    145
    Really COOOL !

  7. #7
    Join Date
    Oct 2009
    Posts
    115
    Srry I don't have time to edit the app for you

    I share it as is

    http://www.zshare.net/download/7079216723e03c58/

    But the idea is that you use in your apps using the functions

    Sorry for the dirty method to get png and jpg, I used a great dll of RizlaUK, that I found on amsuser webpage of intrigued, and I put in the back of phargraph barcode and Input to get his WindowHandle, and take a snapshot of barcode, with very good quality... but the solution is not vry clever
    Last edited by LucasTheDuck; 01-07-2010 at 02:12 AM.

  8. #8
    Join Date
    Sep 2006
    Posts
    9
    please reupload ..my project apz?

  9. #9
    Join Date
    Feb 2007
    Location
    Como, Italy
    Posts
    1,415
    The project is almost there, you have the code in the first post and you have the font to be used with bars.

    You have only to add some input objects able to receive data for the barcode and a Paragraph for the output.

    That's all. Take inspiration from the attached screenshot.
    We are slowly invading your planet to teach lazy humans to read the user manual.
    But don't be scared: we are here to help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts