29. Juni 2022 08:58
29. Juni 2022 09:27
29. Juni 2022 10:32
29. Juni 2022 13:58
#region Barcode
Procedure CreateValueEAN13(InString: text[13]) BarCodeString: Text
var
i: Integer;
Workstring: Text;
checksum: integer;
first: Integer;
Table: Integer;
begin
if InString = '' then
exit('');
FOR i := 1 TO 12 DO
IF CharToInt(InString[i]) > -1 THEN BEGIN
WorkString[i] := InString[i];
END;
FOR i := 2 TO 12 DO BEGIN
checksum := checksum + (CharToInt(InString[i]));
i := i + 1;
END;
checksum := checksum * 3;
FOR i := 1 TO 11 DO BEGIN
checksum := checksum + (CharToInt(InString[i]));
i := i + 1;
END;
WorkString[13] := IntToChar((10 - checksum MOD 10) MOD 10);
first := CharToInt(InString[1]);
BarCodeString[1] := IntToChar(first);
BarCodeString[2] := (65 + CharToInt(WorkString[2]));
FOR i := 3 TO 7 DO BEGIN
Table := 0;
CASE i OF
3:
BEGIN
IF (first < 4) AND (first > 1) THEN
Table := 1;
END;
4:
BEGIN
IF (first = 0) OR (first = 4) OR (first = 7) OR (first = 8) THEN
Table := 1;
END;
5:
BEGIN
IF (first = 0) OR (first = 1) OR (first = 4) OR (first = 5) OR (first = 9) THEN
Table := 1;
END;
6:
BEGIN
IF (first = 0) OR (first = 2) OR (first = 5) OR (first = 6) OR (first = 7) THEN
Table := 1;
END;
7:
BEGIN
IF (first = 0) OR (first = 3) OR (first = 6) OR (first = 8) OR (first = 9) THEN
Table := 1;
END;
END;
IF Table = 1 THEN
BarCodeString[i] := (65 + CharToInt(WorkString[i]))
ELSE
BarCodeString[i] := (75 + CharToInt(WorkString[i]));
END;
BarCodeString[8] := '*';
FOR i := 8 TO 13 DO
BarCodeString[i + 1] := (97 + CharToInt(WorkString[i]));
BarCodeString[15] := '+';
exit(BarCodeString);
end;
local procedure CharToInt(c: Char) n: Integer
begin
CASE c OF
'0':
BEGIN
n := 0;
EXIT;
END;
'1':
BEGIN
n := 1;
EXIT;
END;
'2':
BEGIN
n := 2;
EXIT;
END;
'3':
BEGIN
n := 3;
EXIT;
END;
'4':
BEGIN
n := 4;
EXIT;
END;
'5':
BEGIN
n := 5;
EXIT;
END;
'6':
BEGIN
n := 6;
EXIT;
END;
'7':
BEGIN
n := 7;
EXIT;
END;
'8':
BEGIN
n := 8;
EXIT;
END;
'9':
BEGIN
n := 9;
EXIT;
END;
ELSE BEGIN
n := -1;
EXIT;
END;
END;
end;
local procedure IntToChar(n: Integer) c: Char
begin
CASE n OF
0:
BEGIN
c := '0';
EXIT;
END;
1:
BEGIN
c := '1';
EXIT;
END;
2:
BEGIN
c := '2';
EXIT;
END;
3:
BEGIN
c := '3';
EXIT;
END;
4:
BEGIN
c := '4';
EXIT;
END;
5:
BEGIN
c := '5';
EXIT;
END;
6:
BEGIN
c := '6';
EXIT;
END;
7:
BEGIN
c := '7';
EXIT;
END;
8:
BEGIN
c := '8';
EXIT;
END;
9:
BEGIN
c := '9';
EXIT;
END;
ELSE BEGIN
c := 'X';
EXIT;
END;
END;
end;
#endregion Barcode
29. Juni 2022 15:57
#region Barcode
Procedure CreateValueEAN13(InString: text[13]) BarCodeEncoded: Text
var
i: Integer;
checksum: integer;
first: Integer;
Table: Integer;
begin
IF InString = '' THEN
EXIT('');
first := InString[1]-48;
BarcodeEncoded[1] := InString[1];
BarcodeEncoded[2] := (65 + Instring[2])-48;
FOR i := 3 TO 7 DO BEGIN
Table := 0;
CASE i OF
3: IF (first < 4) AND (first > 1) THEN
Table := 1;
4: IF (first = 0) OR (first = 4) OR (first = 7) OR (first = 8) THEN
Table := 1;
5: IF (first = 0) OR (first = 1) OR (first = 4) OR (first = 5) OR (first = 9) THEN
Table := 1;
6: IF (first = 0) OR (first = 2) OR (first = 5) OR (first = 6) OR (first = 7) THEN
Table := 1;
7: IF (first = 0) OR (first = 3) OR (first = 6) OR (first = 8) OR (first = 9) THEN
Table := 1;
END;
IF Table = 1 THEN
BarcodeEncoded[i] := (65 + Instring[i]-48)
ELSE
BarcodeEncoded[i] := (75 + Instring[i]-48);
END;
BarcodeEncoded[8] := '*';
FOR i := 8 TO 13 DO
BarcodeEncoded[i + 1] := (97 + Instring[i]-48);
BarcodeEncoded[15] := '+';
end;
#endregion Barcode
29. Juni 2022 21:07