Продукция фирмы

rem Макрос обработки запроса к документам в архиве,
rem созданных в определенном временном интервале

Function Query()

rem Начальная инициализация значений
t0=Now()
table = "resultTable"
used = 0
cap=0
alldate=0
начало = 0
конец = 0
SetupTable( table )

rem Установка области поиска
SetQueryArea( "ARCHIVE" )

cap = GetQueryAreaCapacity()

rem Определение временного интервала документов
if date1="" or date2="" then
alldate=1
else
начало = Date(date1)
конец = Date(date2)
end if


CreateProgress( 0, "" )
StartCursor()
b=CurrentCursor()

count = 0
while b<>0
count = count + 1
SetProgress( count, "Working...", cap )
LoadDocument( CurrentCursor(), 1 )
pull = GetPullItem(1)

startTime = [pull].GetStartTime()
if alldate=1 OR startTime > начало AND startTime < конец then
used = used+1
dead = [pull].GetCurrentDeadLine()

doc = [pull].GetDocumentName()
[table].SetCell(used,1,doc)

author = MailName( [pull].GetHistory(0) )
[table].SetCell( used,2,author )
nHistory = [pull].GetHistoryCount()
[table].SetCell( used,3,MailName( [pull].GetHistory(nHistory-1) ) )

[table].SetCell(used,4,FormatDate(startTime, "dd/mm/yy") )

if dead<>0 then
[table].SetCell( used, 5, formatdate( dead, "dd/mm/yy" ) )
endif

last = [pull].GetLastModifyTime()
[table].SetCell(used,6,FormatDate(last, "dd/mm/yy") )
endif

MoveCursor( 1 )
b=CurrentCursor()
end while

KillProgress()



t1=Now()

rem фиксация отчета о результатах работы запроса
resmes = "Использовано " + str(used)
resmes = resmes + " документов из "
resmes = resmes + str(cap)
resmes = resmes + ". Длительность "
resmes = resmes + str(t1-t0) + " сек."
processed = resmes

rem Выравнивание столбцов таблицы результатов
fh = [table].GetCharHeight()*used
[table].h = 50 + fh

rem установка размеров страницы для "влезания" на нее таблицы
SetPageHeight( 1, fh+160+70 )

end function



function min( a as double, b as double ) as double
if a < b then
min = a
else
min = b
end if
end function


function SetupTable( table as string )


rem Выравнивание столбцов таблицы результатов

[table].x = 10
[table].y = 150
[table].w = 620

[table].SetColWidth(1, 180)
[table].SetColHeader(1, "Название документа")

[table].SetColWidth(2, 120)
[table].SetColHeader(2, "Автор документа")

[table].SetColWidth(3, 120)
[table].SetColHeader(3, "Исполнитель")

[table].SetColWidth(4, 50)
[table].SetColHeader(4, "Создан")

[table].SetColWidth(5, 50)
[table].SetColHeader(5, "Обработать до")

[table].SetColWidth(6, 50)
[table].SetColHeader(6, "Редактировался")

[table].frame = 0

end function


Фирма 1С. Страничка модифицировалась: 11 авг 1999