var
  Storage :integer; // ñêëàä, èñïîëüçóåìûé ïðè ôèëüòðàöèè äàííûõ
  DATASET :TDataset; // ñîáñòâåííî, òàáëèöà

  maxbarcode :integer = 0;

  FileName :string = 'c:\temp\cas.pl6';
  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
              + FORMATFLOAT('0000', strtointprotected( dataset.fieldbyname('barcode').asstring))+#13+#10
              + StrValue1+#13+#10
              + StrValue2+#13+#10
              + FORMATFLOAT('000000', dataset.fieldbyname('cena').asfloat*100)+#13+#10
              + '0'+#13+#10 // ñðîê
              + '0'+#13+#10 // âåñ òàðû
              + FORMATFLOAT('000000', strtointprotected( dataset.fieldbyname('barcode').asstring))+#13+#10
              + '0'+#13+#10 // êîä ãðóïïû
              + '0'+#13+#10 // íîìåð ñîîáùåíèÿ
              + '0'+#13+#10 // ËÎÃÎÒÈÏ
              + '0'+#13+#10; // Çíà÷åíèå PCT
       end;
       dataset.next;
    end;

    StringToFile(Filename,FileBody);

  finally
    dataset.enablecontrols;
  end;


  createHint('Ôàéë "'+FileName+ '" ñôîðìèðîâàí.');
end.
