Подскажите пожалуйста как совместить Галактику и Офис 2007
раньше стоял офис 200. А теперь я поставила 2007 и некоторые отчеты не правильно работают . Как это исправить ?

Модераторы: m0p3e, edward_K, Модераторы
Код: Выделить всё
/* */
Function XLCREATEMATRIX(longint, longint) : boolean; external;
Function XLCLEARMATRIX : boolean; external;
Function XLFREEMATRIX : boolean; external;
Function XLSTWRITETOMATRIX(longint, longint, string) : boolean; external;
Function XLDOWRITETOMATRIX(longint, longint, double) : boolean; external;
Function XLREADFROMMATRIX(longint, longint, var AnyType) : boolean; external;
Function XLWRITEMATRIXTOEXCEL(longint, longint) : boolean; external;
Function XLREADMATRIXFROMEXCEL(longint, longint, longint, longint) : boolean; external;
Const
#INCLUDE excel.inc
ColorSysBlack = 46;
ColorSysBlue = 58;
xlColorBlack = 0;
xlColorWhite = 16777215;
End;
Interface _gt_listorg_podr 'Задолженность по менеджерам' escclose;
//show at(,,70,);
show at(,,33,20);
table struct tdolg
(
dat:date,
cbasedoc:comp,
total:double,
plat:double,
rekl:double)
with index (idx1=cbasedoc, idx2=dat);
create view
var
sum:double;
i,days,delta:longint;
date2,dat2:date;
XlRes: Boolean;
aFileName: String;
as
Select *
From
basedoc basedoc1,
katorg katorg1,
katcity katcity1,
basefin,
stepdoc,
katsopr,
tDolg,
usertune,
x$users
Where
((
usertune.ownname/==x$users.xu$loginname(noindex)
and UserTune.Descr==basedoc.descr
and word(201)==basedoc.viddoc
and dat2>>=basedoc.ddoc
and 2==basedoc.status
and basedoc.nrec == stepdoc.cbasedoc
//and stepdoc.nrec /== katsopr.cstepdoc
and stepdoc.nrec == katsopr.cstepdoc
and basedoc.nrec == basefin.cbasedoc
//and 106 == katsopr.vidsopr //?
and tdolg.cbasedoc==basedoc1.nrec
and basedoc1.corg==katorg1.nrec
and katorg1.ccity==katcity1.nrec
));
//and isvalid(tnkatsopr);
//**********************************************************************
screen params
show at(,,,3);
//show at(,,,20);
fields date2:,noprotect;
buttons
cmOK, default;
cmCancel;
<<
Расчет долгово по .@@@@@@@@@@
<.Формировать.> <. Закрыть .>
>>
end;
panel P1
//show at(1,5,32,10);
show at(,4,,);
browse Bro1
table UserTune;
fields
UserTune.Descr 'Дескриптор':[5],protect;
UserTune.FIO 'Фамилия Имя Отчество':[30],protect;
end;
end;
//panel p02
//show at(2,11,20,);
//browse Base;
//table basedoc;
//fields
//basedoc.descr;
//basedoc.ddoc;
//basedoc.nodoc;
//end;
//end;
//
//panel p02
//show at(21,11,30,);
//browse step;
//table stepdoc;
//fields
//stepdoc.nrec;
//end;
//end;
//
//panel p02
//show at(31,11,40,);
//browse Kats;
//table katsopr;
//fields
//katsopr.nrec;
//end;
//end;
//
//panel p02
//show at(41,11,60,);
//browse tDolg;
//table tDolg;
//fields
//tDolg.total;
//end;
//end;
handleevent
cmInit:
{
date2:=Cur_Date;
// _loop UserTune { if (UserTune.descr = 'TRG') then message(UserTune.descr); }
}
cmOK:
{
dat2:=date2;
delete all tDolg;
StartNewVisual(vtRotateVisual, vfTimer+vfBreak+vfConfirm,'Расчет долгов...', RecordsInTable(#basedoc));
_loop basedoc
{
// if isvalid(tnkatsopr) then
// if getfirst spsopr=tsOk then
if getfirst katsopr=tsOk then
{
// if basedoc.ddoc=date(31,03,2003) then message(basedoc.nodoc);
if GetFirst tDolg where ((basedoc.nrec==tDolg.cbasedoc))<>tsOk
then
{
insert in tDolg set tDolg.cbasedoc:=basedoc.nrec,
tDolg.total:=basedoc.total,
tDolg.dat:=basedoc.ddoc,
tDolg.plat:=0,
tDolg.rekl:=0;
if basedoc.valcurse>0 then tDolg.total:=tDolg.total*basedoc.valcurse;
}
_loop basefin update current tDolg set tDolg.plat:=tDolg.plat+basefin.summa;
_loop katsopr if (katsopr.vidsopr=106) then update current tDolg set tDolg.rekl:=tDolg.rekl+katsopr.summa;
}
if (not nextvisual) break;
}
// message(recordsintable(#tDolg));
i:=4 ;
if getfirst tDolg(idx2)=tsOk then
{
XlRes := True;
aFileName := GetStringParameter('Files','OutputFilesDirectory',0) +'dolg'+trim(UserTune.Descr)+DateToStr(dat2,'DD-MM-YY')+'.xls';
DeleteFile(aFileName);
XlRes := xlCreateExcel((aFileName), True);
if (XlRes) XlRes := xlIsExcelValid;
If (not XlRes)
{
StopVisual('',0);
message('Ошибка создания EXEL файла');
Exit;
}
xlSetSheetName(1, 'Долги');
xlCreateMatrix ( recordsintable(#tDolg)+10, 11 );
// message(recordsintable(#tDolg));
xlSTWriteToMatrix(1,1, 'Задолженность по оплате счетов на '+DateToStr(dat2,'DD.MM.YYг.')+' - '+usertune.fio);
xlSTWriteToMatrix(3,1,'Дата сч.');
xlSTWriteToMatrix(3,2,'№ сч.');
xlSTWriteToMatrix(3,3,'Организация');
xlSTWriteToMatrix(3,4,'Город');
xlSTWriteToMatrix(3,5,'Сумма');
xlSTWriteToMatrix(3,6,'Оплачено');
xlSTWriteToMatrix(3,7,'Возврат');
xlSTWriteToMatrix(3,8,'Остаток');
xlSTWriteToMatrix(3,9,'Дни');
xlSTWriteToMatrix(3,10,'Усл.');
xlSTWriteToMatrix(3,11,'Проср');
_loop tDolg
{
sum:=tdolg.total-tdolg.plat-tdolg.rekl;
if sum<0 then sum:=0;
if sum>0.1 then
{
delta:=0;
case longint(substr(katcity1.tel,length(katcity1.tel),1)) of
1:delta:=6;
2:delta:=8;
3:delta:=4;
4:delta:=9;
5:delta:=3;
6:delta:=1;
end;
days:=to_days(dat2)-to_days(basedoc1.ddoc);
if days<0 then days:=0;
xlSTWriteToMatrix(i,1,DateToStr(basedoc1.ddoc,'DD.MM.YY'));
xlSTWriteToMatrix(i,2,basedoc1.nodoc);
xlSTWriteToMatrix(i,3,katorg1.name);
xlSTWriteToMatrix(i,4,katcity1.name);
xlDOWriteToMatrix(i,5,tdolg.total);
xlDOWriteToMatrix(i,6,tdolg.plat);
xlDOWriteToMatrix(i,7,tdolg.rekl);
xlSTWriteToMatrix(i,8,'=RC[-3]-RC[-2]-RC[-1]');
xlDOWriteToMatrix(i,9,days);
xlDOWriteToMatrix(i,10,basedoc1.koldn);
xlSTWriteToMatrix(i,11,'=ЕСЛИ(RC[-2]-RC[-1]-'+string(delta)+'>0;RC[-2]-RC[-1]-'+string(delta)+';0)');
i:=i+1;
}
}
i:=i+1;
xlSTWriteToMatrix(i,5,'=СУММ(E4:E'+string(i-1)+')');
xlSTWriteToMatrix(i,6,'=СУММ(F4:F'+string(i-1)+')');
xlSTWriteToMatrix(i,7,'=СУММ(G4:G'+string(i-1)+')');
xlSTWriteToMatrix(i,8,'=СУММ(H4:H'+string(i-1)+')');
xlSetActiveSheetByName('Долги');
// if not xlImportModule('c:\GAL582\Modules\page.bas') then message ('Ошибка импорта макроса');
// xlRunMacro('SetPage');
xlWriteMatrixToExcel ( 1, 1 );
xlFreeMatrix;
xlSetNumberFormat ( '# ##0,00', 4, 5, i, 8 );
xlFrameCells ( xlBorderL, xlThin, xlLineStyleNone, xlColorBlack, 3, 1, i, 11 );
xlFrameCells ( xlBorderR, xlThin, xlLineStyleNone, xlColorBlack, 3, 1, i, 11 );
xlFrameCells ( xlBorderT, xlThin, xlLineStyleNone, xlColorBlack, 3, 1, i, 11 );
xlFrameCells ( xlBorderB, xlThin, xlLineStyleNone, xlColorBlack, 3, 1, i, 11 );
xlFrameCells ( xlInsideV, xlThin, xlLineStyleNone, xlColorBlack, 3, 1, i, 11 );
xlFrameCells ( xlInsideH, xlThin, xlLineStyleNone, xlColorBlack, 3, 1, i, 11 );
XLSETBACKCOLOR (16370100, 3 , 1 , 3 , 11);
xlSetFontSize ( 8 , 1 , 1 , MaxExcelRow , MaxExcelCol ); // по всему файлу - шрифт "8"
// xlMergeCells(1,1,1,11);
xlAlignCells(xlCenter,3,1,3,11);
xlSetFontSize ( 11 , 1 , 1 , 1 , 11);
xlSetFontStyle ( xlBold, 1 , 1 , 3 , 11);
xlSetFontStyle ( xlBold, i , 1 , i , 11);
xlFreeze(4,1);
xlAutoFit(4,1,MaxExcelRow , MaxExcelCol);
xlSetColumnWidth(20,1,3,MaxExcelRow,3); // ширина колонки организация
xlKillExcel;
// t2:=cur_time;
}
else message ('Долги отсутствуют');
StopVisual('',0);
// message(timetostr(sub_time(t2,t1),'HH:MM:SS:SSSS'));
}
cmCancel:
{
closeinterface(cmDone);
mtChangeRefCount( #tDolg, -1 );
}
end;
end.