Создаю выгрузку при помощи функций File_OpenFile и File_Write. В результате получаю не совсем то, что хочу записать в файл. Например:
Код: Выделить всё
001826; 01.06.2010;
1500.0000;; 0269008334; 40702810706390100519;
048073601; 7740000076; 40702810700000001663;
044525232; 0; 01.06.2010; ; NЗА УСЛУГИ СВЯЗИ ПО СЧ. 1 ОТ 01.06.2010Г НДС (18%) 228-81руб, включен в сумму.; ;
Код: Выделить всё
07 30 30 31 38 32 34 3B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 30 31 2E 30 36 2E 32 30 31 30 3B 00 00 00 00
Код: Выделить всё
f := CreateFileHandle('xxx');
while papka = '' do
{
papka:=GetDirName('Укажите место выгрузки файла');
}
papka:=papka+'\';
maska:=DateToStr(Cur_Date, 'DD')+DateToStr(Cur_Date, 'MM')+DateToStr(Cur_Date, 'YY');
num:='01';
File_OpenFile(papka+maska+num+'sb.333', stCreate, f);
DeleteFileHandle(f);
f := CreateFileHandle('xxx');
File_OpenFile(papka+maska+num+'sb.333', stOpenWrite, f);
ndok:='';
innplat:='';
rsplat:='';
bikplat:='';
innpol:='';
rspol:='';
bikpol:='';
vidpl:='';
ocher:='';
nazn:='';
_loop
{
ndok:=Oem2Ansi(replace(basefin.nodoc, ';', '!'));
File_Write(ndok+';', f);
File_Write(DateToStr(plpor.datvip, 'DD.MM.YYYY')+';', f);
File_Write(DoubleToStr(soprhoz.summa, '\4p666666666666666.8888')+';', f);
innplat:=Oem2Ansi(replace(katorgplat.unn, ';', '!'));
File_Write(innplat+';', f);
rsplat:=Oem2Ansi(replace(katbankplat.schet1, ';', '!'));
File_Write(rsplat+';', f);
bikplat:=Oem2Ansi(replace(katbankplat.mfo1, ';', '!'));
File_Write(bikplat+';', f);
innpol:=Oem2Ansi(replace(katorg.unn, ';', '!'));
File_Write(innpol+';', f);
rspol:=Oem2Ansi(replace(katbank.schet1, ';', '!'));
File_Write(rspol+';', f);
bikpol:=Oem2Ansi(replace(katbank.mfo1, ';', '!'));
File_Write(bikpol+';', f);
vidpl:=plpor.telepost;
File_Write(vidpl+';', f);
File_Write(DateToStr(plpor.datob, 'DD.MM.YYYY')+';', f);
if length(plpor.kodnew) > 0 then
if length(plpor.kodnew) > 2 then
ocher:=Oem2Ansi(replace(substr(plpor.kodnew, length(plpor.kodnew)-1, 2), ';', '!'))
else
ocher:=Oem2Ansi(replace(plpor.kodnew, ';', '!'))
else
ocher:='';
File_Write(ocher+';', f);
nazn:=Oem2Ansi(replace(plpor.namepl1+plpor.namepl2+plpor.namepl3+plpor.namepl4, ';', '!'));
File_Write(nazn+';', f);
File_Write(kodst+';', f);
File_WriteLn(prizn, f);
}
File_Close(f);
DeleteFileHandle(f);