var
  Storage :integer; // ñêëàä, èñïîëüçóåìûé ïðè ôèëüòðàöèè äàííûõ
  DATASET :TDataset; // ñîáñòâåííî, òàáëèöà

  maxbarcode :integer = 0;


  FileName :string = 'c:\temp\cas.txt';
  FileBody :string;
  //IntValue :integer;
  StrValue :string;
  StrValue1 :string;
  StrValue2 :string;
begin



  dataset.disablecontrols;
  try
    FileBody := '';
    dataset.first;
    while not dataset.eof do
    begin

       if (maxbarcode = 0)
          or (strtointprotected(dataset.fieldbyname('barcode').asstring)<=maxbarcode)
       then begin

           StrVAlue := //conversionString(
             dataset.fieldbyname('name').asstring
             //,ctANSI2OEM)
             ;

           StrValue1 := copy(StrValue,1,28);

           if length(StrValue) <=28
           then StrValue2 := ''
           else StrValue2 :=  copy(StrValue,29,1000);

           FileBody := FileBody
              + dataset.fieldbyname('barcode').asstring+';'
              + dataset.fieldbyname('cena').asstring+';'
              + dataset.fieldbyname('barcode').asstring+';'
              + StrValue1+';'
              + StrValue2+';'
              + '0;0;0;2'+#13+#10;

                //1;108,00;1001;ÑÛÐ âåñ ÀÄÛÃÅÉÑÊÈÉ ÂÀËÓÉÑÊ;_;0;0;0;2
       end;
       dataset.next;
    end;

    StringToFile(Filename,FileBody);

  finally
    dataset.enablecontrols;
  end;


  createHint('Ôàéë "'+FileName+ '" ñôîðìèðîâàí.');
end.
