var Table :ttable;
    ChCnt :integer;
    strval :string;
begin
   // comment
   Table := TTable.create(selfscript);
   with tmywait.create1('Èäåò ïðîâåðêà øòðèõêîäîâ',selfscript) do
   begin
     table.databasename := 'dbkassa';
     table.tablename := 'pr_tovar';
     table.open;
     progressbarmax := table.recordcount;
     table.first;
     chcnt := 1;
     while not table.eof do
     begin
        if (table.fieldbyname('barcode').asstring>'')
        then begin
          strval := CorrectBarCode(table.fieldbyname('barcode').asstring,
                           false,true,false,false);
          if table.fieldbyname('barcode').asstring <> strval
          then begin
            table.edit;
            table.fieldbyname('barcode').asstring :=
              CorrectBarCode(table.fieldbyname('barcode').asstring,
                             false,true,false,false);

            table.post;
            inc(chcnt);
            advancedtext := 'Çàìåíåíî: '+inttostr(chcnt)+' øòðèõêîäîâ';
          end;
        end;
        incprogress;
        table.next;
        application.processmessages;
     end;
   end;
end.
