1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| Unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, Mask, DBCtrls, Buttons, ExtCtrls, ESBRtns;
type
TForm1 = class (TForm)
ADOConnection1: TADOConnection;
adtBC128: TADOTable;
adtBC128Value: TFloatField;
adtBC128CodeSetB: TWideStringField;
adtBC128BarSpacePattern: TWideStringField;
adtCalcVal: TADOTable;
adtCalcValPackageId: TFloatField;
adtCalcValCP: TIntegerField;
adtCalcValModulo103: TWIdeStringField;
adtCalcValCodeComplet: TWideStringField;
Label1: TLabel;
DBEdit1: TDBEdit;
DataSource1: TDataSource;
Label2: TLabel;
DBEdit2: TDBEdit;
Label3: TLabel;
DBEdit3: TDBEdit;
Label4: TLabel;
DBEdit4:TDBEdit;
DBNavigator1: TDBNavigator;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
CalcValue: string;
i, tot, modulo : integer;
begin
NumPadCH := '0';
i := 0;
with adtCalcVal do
begin
First;
while not EOF do
begin
CalcValue := '';
CalcValue := CalcValue + 'JJBEA30';
CalcValue := CalcValue + LInt2Str(FieldValues['CP'],4);
CalcValue := CalcValue + '40280';
CalcValue := CalcValue + Double2Str(FieldValues['PackageId'],11,0);
Tot := 104;
for i := 1 to 27 do
begin
if adtBC128.Locate('CodeSetB', copy(CalcValue,i,1),[]) then
Tot := Tot + (i * adtBC128.FieldValues['Value']);
end;
modulo := tot mod 103;
adtBC128. Locate('Value', modulo, []);
Edit;
FieldValues['Modulo103'] := adtBC128.FieldValues['CodeSetB'];
FieldValues['CodeComplet'] := CalcValue;
Post;
Next;
end;
end;
end;
end. |
Partager