*-----------------------------------------------------------
* Date:13/02/2016
* Specification taken from : http://www.jtbarton.com/Barcodes/Code128.aspx2
* Also: copy the barcode font from this web site
* Coded in Alaska xBase by Nestor G. Torre
*------------------------------------------------------------------
PROCEDURE Main
Code128("BarCode")
Return 

Function Code128(cPre_Barcode_String)
  Local cCode128, nString_Len, nCheckSum, nWeighting_value, nModulus, I
  cCode128 := ""
  nString_Len:=Len(cPre_Barcode_String)
  nCheckSum:=0
  cCode128:=CHR(104) /* Start Character */
  nWeighting_value:=104 /* Same value as start Character */
  For I = 1 to nString_Len
    cCode128:=cCode128+CHR(ASC(Substr(cPre_Barcode_String,I,1))-32) 
	nWeighting_value:=nWeighting_value+((ASC(Substr(cPre_Barcode_String,I,1))-32)*I)
  Next I
  nModulus:=103
  nCheckSum:=MOD(nWeighting_value,nModulus)
  // msgbox(str(nCheckSum)) /* checksum displayed the same as for example on specification website */ 
  cCode128:=cCode128+CHR(nCheckSum)+CHR(106) /* add checksum and stop characters */

RETURN cCode128
