Cp1251
DOC 
foreground = lightgray
document_width = 700
document_height = 300
document_title = "ZetaSE.Autocomplect/ Аналоги"


{toolbar
{grid
editable = no
alias = GRIDPROD
buttonbar_font_family=0       buttonbar_font_size=12           
buttonbar_size = 30           titlebar_size = 18            rowsize=20
titlebar_height = 30

edit = "~($X
           ($ARGUMENTS.2@setValue 'spc.id_active' ($g.ds_prod@getValue 'id_active'))
           ($ARGUMENTS.2@setValue 'active.name_active' ($g.ds_prod@getValue 'name_active'))
           ($ARGUMENTS.2@setValue 'DOC_LIB.GETRESTBEFOREBEFORE(HEAD.ID_DEPARTMENT1,SPC.ID_ACTIVE,HEAD.SORT)' ($g.ds_prod@getValue 'rest'))
           ($ARGUMENTS.2@setValue 'spc.id_unit' ($g.ds_prod@getValue 'id_unit'))
           ($ARGUMENTS.2@notifyViews)
           ($g.self@actHok)
           ($ret '')
         )~"

del = ""

addexp="($X
          ($ret '')

	)"



 {column size=50     
    title="Код"              font_family=0            editable = readonly 
    target=id_active     title_font_family=0      halignment=center
    font_color="#000000"     font_size=12
    editmask = "##0."
 }
 {column size=250       title="Название"
    target=name_active  title_font_family=0     halignment=left
    font_color="#000000"      font_size=12              font_family=0 font_face = "Tahoma"
    editable = readonly 
 }
 {column size=100       title="Остаток"
    target=rest  title_font_family=0     halignment=right
    font_color="#000000"      font_size=12              font_family=0 font_face = "Tahoma"
    editmask = "# #0.000"
    editable = readonly 
 }
 {datastore 
      alias = ds_prod
      query = "select id_active, name_active, rest, id_unit
                 from (
               select active.id_active, active.name_active,
                      doc_lib.getRestBefore(~ARGUMENTS.1~, active.id_active, 1e20) rest,
                      active_pseudo_unit.id_pseudo_unit id_unit
                 from active, active_pseudo_unit
                where ( active.id_active = ~ARGUMENTS.0~ or active.analog_id = ~ARGUMENTS.0~ or active.id_active in (select analog_id from active where id_active = ~ARGUMENTS.0~) )
                  and active.id_active = active_pseudo_unit.id_active
                  and active_pseudo_unit.priz = 1
                      )
                order by name_active
                  "


} // ds
} //grid
{button
  BACKGROUND = "LIGHTGRAY"    foreground="#000000"
  label = "Выход (ESC)"
  action = "($X
               ($g.self@actcancel)
               ($ret '')
            )"
  shortcut = "escape"
}
} // toolbar

