Cp1251
DOC
foreground = lightgray 
document_width = 1200
document_height = 900
document_title = "Спецификация продукции"
style = "style/group.st"
preloadscript="
(global.num_sd = 'Новый')
(global.loading = 1)
(global.id_active = -999)
(global.kod_name_search = ' and active.id_active = -999999999 ')
(global.no_combo_action = 0)
(global.iii = 0)
(global.create = 0)
(global.add_mode = 1)
"
postloadscript = "
($X
   (global.loading = 0)
   (global.id_active = ($try (g.id_active) $catch ('Any')(-999)) )


   ($g.self@doAction 'retrieve combo1')


   ($ret '')
)
"

{DSCollection
   alias = ds
   initQuery = "select head_sq.nextval, sysdate, id_personal from personal where login = user"
   aliases = "hpk,date,idp"
   SeqQuery = "select spc_sq.nextval from dual"
   seqnames = "spk"
   initAction ="($X
                   (global.create = 1)
                   ($G.ds_copy@retrieve)
                   (sz = ($G.ds_copy@size))
                   ($if (sz != 0)
                     (
                       ($G.gridds01@setvalue 'head.id_active' ($g.ds_copy@getValue 'head.id_active'))
                       ($G.gridds01@setvalue 'name_active' ($g.ds_copy@getValue 'active_prod.name_active'))
                       ($G.gridds01@setvalue 'head.id_unit' ($g.ds_copy@getValue 'head.id_unit'))
                       ($G.gridds01@setvalue 'name_unit' ($g.ds_copy@getValue 'active_prod_pseudo_unit.name_pseudo_unit'))
                       ($G.gridds01@setvalue 'head.comment_sd' ($g.ds_copy@getValue 'head.comment_sd'))

                       ($if (($try ($g.ds_copy@getValue 'spc.id_active') $catch ('NullException')(0)) != 0)
                         (
                           (i = 0)
                           ($while (i < sz)
                             (
                               ($g.ds_copy@SetCurRow i)
                               ($G.gridds03@newRow)
                               ($G.gridds03@setvalue 'spc.id_active' ($g.ds_copy@getValue 'spc.id_active'))
                               ($G.gridds03@setvalue 'active.name_active' ($g.ds_copy@getValue 'active.name_active'))
                               ($G.gridds03@setvalue 'spc.q1_spc' ($g.ds_copy@getValue 'spc.q1_spc'))
                               ($G.gridds03@setvalue 'spc.id_unit' ($g.ds_copy@getValue 'spc.id_unit'))
                               ($G.gridds03@setvalue 'active_pseudo_unit.name_pseudo_unit' ($g.ds_copy@getValue 'active_pseudo_unit.name_pseudo_unit'))
                               ($G.gridds03@setvalue 'spc.work_type' ($g.ds_copy@getValue 'spc.work_type'))
                               ($G.gridds03@setvalue 'work_stage.name_work_stage' ($g.ds_copy@getValue 'work_stage.name_work_stage'))
                               ($G.gridds03@setvalue 'spc.comments' ($g.ds_copy@getValue 'spc.comments'))
                               (i += 1)
                             )
                           )
                           ($G.gridds03@notifyViews)
                         )
                       )
                     )
                   )	            
                   ($ret '')
                )"
}

{datastore
 alias = default_unit
 query = "select active_pseudo_unit.id_pseudo_unit, active_pseudo_unit.name_pseudo_unit
            from active_pseudo_unit
           where id_active = ~global.id_active~
             and priz = 1"
}
{datastore
 alias = ds_active
 query = "select active.proc1
            from active
           where id_active = ~global.id_active~"
}

{datastore 
 alias = ds_copy
 query = "select head.id_active, head.id_unit, head.comment_sd, head.accept, active_prod_pseudo_unit.name_pseudo_unit, active_prod.name_active,
                 spc.id_head, spc.id_unit, spc.id_active, active.name_active, spc.q1_spc, spc.work_type, active_pseudo_unit.name_pseudo_unit,
                 spc.comments, work_stage.name_work_stage
            from head, spc, active active_prod, active_pseudo_unit active_prod_pseudo_unit, active_pseudo_unit, active, work_stage
           where head.id_head = ~($try (ARGUMENTS.1) $catch ('Any')(-1))~
             and head.id_unit = active_prod_pseudo_unit.id_pseudo_unit (+)
             and head.id_active = active_prod.id_active
             and head.id_head = spc.id_head (+)
             and spc.id_active = active.id_active (+)
             and spc.work_type = work_stage.id_work_stage (+)
             and spc.id_unit = active_pseudo_unit.id_pseudo_unit (+)
           --order by work_stage.name_work_stage, active.name_active
           order by spc.id_spc"
} // end of ds

{ datastore
  alias = last_update
  query = "select last_update
             from (
           select parameters.d last_update
             from parameters 
            where parameters.id = 10
                  )"
}
{ datastore
  alias = check_privileges
  query = "select id_group
             from personal
            where UPPER(login) = UPPER(user)"
}


{toolbar   BACKGROUND = "LIGHTGRAY"
{splitpanel type=horizontal     percent=15
{form
  { label left = 10 top = 10 width = 120 height = 20  font_size = 14
    value = "Готовая продукция"
  }
  { field left = 130 top = 10 width = 300 height = 30  font_size = 14 alias = name_active  target = name_active
    editable = handbook
    edit = "opennew find_choose.rml 1, 0"
    editexp = "($X
                (g.name_active=store.active.name_active)
                (g.id_active=store.active.id_active)
                (global.id_active=store.active.id_active)
                ($g.default_unit@retrieve)
                (g.id_unit = ($g.default_unit@getValue 'active_pseudo_unit.id_pseudo_unit'))
                (g.name_unit= ($g.default_unit@getValue 'active_pseudo_unit.name_pseudo_unit'))
                ($ret '')
              )"
  }
  { field left = 130 top = 10 width = 300 height = 30  font_size = 16 alias = id_active  target = head.id_active  visible = no
    editable = no
  }
  { label left = 450 top = 10 width = 70 height = 20  font_size = 14
    value = "Ед. изм."
  }
  { field left = 520 top = 10 width = 70 height = 30  font_size = 16 alias = name_unit  target = name_unit
    editable = handbook
    edit = "opennew psevdo_units.rml ~global.id_active~"
    editexp = "($X
                (g.name_unit=store.active_pseudo_unit.name_pseudo_unit)
                (g.id_unit=store.active_pseudo_unit.id_pseudo_unit)
                ($ret '')
            )"
  }
  { label left = 600 top = 10 width = 50 height = 20  font_size = 14
    value = "Дата"
  }
  { field left = 650 top = 10 width = 100 height = 30  font_size = 16 target = head.date_sd
  }
  { field left = 130 top = 10 width = 300 height = 30  font_size = 16 alias = id_unit  target = head.id_unit  visible = no
    editable = no
  }
  { label left = 10 top = 50 width = 120 height = 20  font_size = 14
    value = "Примечание"
  }
  { field left = 130 top = 50 width = 300 height = 30  font_size = 16 alias = comment_sd  target = head.comment_sd
  }
   {datastore 
           alias = GRIDDS01
           query = "select head.id_head, head.sort, head.accept, head.num_sd, head.date_sd, head.id_type_doc, head.id_active, head.id_personal, head.id_department1,
                           head.id_unit, name1_dep, head.comment_sd,
                           doc_sum, accept, name_active, name_unit, last_changed
                      from (
                    select head.id_head, head.sort, head.accept, head.num_sd, head.date_sd, head.id_personal, head.id_type_doc, head.id_active, head.id_unit,
                           head.id_department1, department.name1_dep, head.comment_sd,
                           util.doc_sum(head.id_head) doc_sum,
                           --decode(head.accept, 0, '', 1, 'X', 'ХЗ') accept,
                           active.name_active, active_pseudo_unit.name_pseudo_unit name_unit,
                           personal.sname||' '||personal.fname last_changed
                      from head, department, active, active_pseudo_unit, personal
                     where head.id_department1 = department.id_department (+)                 
                       and head.id_active = active.id_active (+)
                       and head.id_head = ~($try (ARGUMENTS.0) $catch ('Any')(-1))~
                       and head.id_unit = active_pseudo_unit.id_pseudo_unit (+)
                       and head.last_changed = personal.id_personal (+)
                           ) head
                     order by sort"
              editable = yes
                  head = yes
                unique = "('head','head.id_head')"
               default = "head.id_head=~ds.hpk~,
                          head.id_type_doc=~10~,
                          head.date_sd=~ds.date~,
                          head.id_personal=~ds.idp~,
                          head.num_sd=~global.num_sd~,
                          head.id_active=~-999~,
                          head.accept=~3~"
   } // end of ds
} // end of form
{ splitpanel type = vertical percent = 25
{ splitpanel type = horizontal percent = 30
{ form

  {field type = string alias = find_field
   left = 10 top = 10 width = 150 height = 30 font_size = 16 font_color = "BLUE"  firstfocus = yes
  }

  {button
   left=170   height=30       width=100   top =10  font_size = 16
   label = "Найти"
   shortcut = "Enter"
   aaction="~($X
               (nameware = 'upper(active.name_active)')
               ($if (($try (g.find_field) $catch ('NullException')(0)) == 0)
                 (
                   (global.kod_name_search = ' ')
                 )
                $else
                 (
                   (find = ($reg2ora g.find_field))
                   (find = ($find@toUpperCase))
                   ($debug 'find:' + find)
                   (global.kod_name_search = ' and ' + nameware + ' like \'%' + find + '%\'')
                 )
               )         
               ($g.gridds_search@retrieve)
               ($g.self@focus g.grid_search)
               ($ret '')
             )~"
  }

  { label left = 10 top = 50 width = 100 height = 20 font_size = 14 value = "Добавлять в" }

     {combobox
      left = 120     top = 50      width = 150        height = 30 
      alias = combo1               border = box
      target = work_stage.name_work_stage
      action = "~($X
                  ($debug 'combo1')
                  ($if (global.no_combo_action == 0)
                    (
                      ($g.data_ds1@setCurRow ($g.combo1@getSelectedIndex))
                      ($debug 'combo1, index: ' + ($g.combo1@getSelectedIndex) + ', value: ' ($g.data_ds1@getValue 'work_stage.name_work_stage'))
                    )
                  )
                  ($ret '')
                )~"

      {datastore
       alias = data_ds1
       query = "select work_stage.id_work_stage, work_stage.name_work_stage
                      from work_stage
                     where work_stage.id_work_stage != 0
                     order by work_stage.name_work_stage"
      }
   }

     {checkgroup
       top=90 left=10
       {checkbox  label="показывать закрытые карточки"
         alias=check_closed
         onvalue="1"
         offvalue = "0"
       }
     }

  {button
    left = 10 top = 120 width = 150 height = 30 font_size = 12
    label = "Выгрузка в Excel"

       action = "($X
                     (global.grid_name = 'GRID3')
                     ($g.self@calculate 'js:js_file:/docs/print_grid.js')
                     ($ret '')
                  )"
  }
  
  {datastore
     alias = ddd
     query = "select user from dual"
  }
} // form
{grid
    alias = GRID_SEARCH
    buttonbar_font_family = 0              buttonbar_font_size = 12
    buttonbar_size = 30                    titlebar_size = 18
    multiselect = no                      editable = no
    rowsize = 20
    del = ""
    edit = "~($X
                ($debug ' --- copy to spec --- ')
                # проверим, нет ли уже такого актива в спецификации
                (sz = ($g.gridds03@size)) (i = 0) (found = 0) (id = ($g.gridds_search@getValue 'active.id_active'))
                #($debug 'DS size: ' + sz + ', checking: ' + sz + ' rows')
                ($while (i < sz)
                  (
                    ($g.gridds03@FastSetCurRow i)
                    #($debug 'row ' + i + '  id_active ' + ($g.gridds03@getValue 'spc.id_active'))
                    ($if (($g.gridds03@getValue 'spc.id_active') == id) 
                       (
                         (found = 1)
                         (found_row = (i+1))
                         (i = sz)
                       )
                    )
                    (i += 1)
                  )
                )
                ($if (found != 0)
                  (
                    (v = ($@validator))
                    ($v@SetType 'NUMBER')
                    ($v@SetMask '##0.')
                    #($g.self@sure 'Такой материал уже есть в спецификации, в строке ' + ($v@toString found_row) 1)
                    ($if (($g.self@sure 'Такой актив уже есть в спецификации, в строке ' + ($v@toString found_row) + '. Хотите добавить еще раз?' 0) == 0)
                      ($ret '')
                    )
                  )
                )
                ($g.gridds03@newRow)
                ($g.gridds03@setValue 'spc.id_active' ($g.gridds_search@getValue 'active.id_active'))
                ($g.gridds03@setValue 'active.name_active' ($g.gridds_search@getValue 'active.name_active'))
                ($g.gridds03@setValue 'spc.id_unit' ($g.gridds_search@getValue 'active_pseudo_unit.id_pseudo_unit'))
                ($g.gridds03@setValue 'active_pseudo_unit.name_pseudo_unit' ($g.gridds_search@getValue 'active_pseudo_unit.name_pseudo_unit'))
                ($g.gridds03@setValue 'spc.work_type' ($g.data_ds1@getValue 'work_stage.id_work_stage'))
                ($g.gridds03@setValue 'work_stage.name_work_stage' ($g.data_ds1@getValue 'work_stage.name_work_stage'))
                ($g.gridds03@notifyViews)
                ($ret '')
             )~"

   {column size=200             title="Наименование"
        target=active.name_active
        alias = name_active_component
        title_font_family=2        title_font_color="#000000"
        halignment=left            font_size = 12          font_family=0
   }                  
   {column size=55             title="Ед. изм."
        target=active_pseudo_unit.name_pseudo_unit
        alias = name_unit_component
        title_font_family=2        title_font_color="#000000"
        halignment=left            font_size = 12          font_family=0
   }                  

  {datastore 
           alias = GRIDDS_SEARCH
           query = "select active.id_active, active.name_active, active_pseudo_unit.name_pseudo_unit, active_pseudo_unit.id_pseudo_unit, active_pseudo_unit.obozn
                      from active, active_pseudo_unit
                     where active.id_active = active_pseudo_unit.id_active(+)
                       ~global.kod_name_search~
                ~($if (($g.check_closed@getValue) == '1')
                  ('')
                 $else 
                  (' and active.closed = 0 ')
                )~

                     order by active.name_active"
   } // end of ds

} // grid_search
} // split
{grid
    alias = GRID3
    buttonbar_font_family = 0              buttonbar_font_size = 12
    buttonbar_size = 30                    titlebar_size = 40
    multiselect = no                      editable = yes
    rowsize = 20

    add = "~($X
                ($if (global.add_mode == 1)
                  ($ret 'opennew find_choose.rml 1, 0')
                 $else
                  ($ret 'opennew find_choose_many.rml')
                )
             )~"

    addexp="($X

     ($debug '================ addexp =================')
     (g.name_active_component = store.active.name_active)
     (g.id_active_component=store.active.id_active)
     (global.id_active = store.active.id_active)
     (g.spc__work__stage = ($g.data_ds1@getValue 'work_stage.id_work_stage'))
     (g.name__work__stage = ($g.data_ds1@getValue 'work_stage.name_work_stage'))
     (g.spc__work__type = 0)
     (g.name__work__type = '.')
     # проверим, нет ли уже такого актива в спецификации
     (sz = ($g.gridds03@size) - 1) (i = 0) (found = 0)
     #($debug 'DS size: ' + (sz +  1) + ', checking: ' + sz + ' rows')
     ($while (i < sz)
       (
         #($debug 'row ' + i + '  id_active ' + ($g.gridds03@getValue 'spc.id_active'))
         ($g.gridds03@FastSetCurRow i)
         ($if (($g.gridds03@getValue 'spc.id_active') == global.id_active) 
            (
              (found = 1)
              (found_row = (i+1))
              (i = sz)
            )
         )
         (i += 1)
       )
     )
     ($if (found != 0)
       (
         (v = ($@validator))
         ($v@SetType 'NUMBER')
         ($v@SetMask '##0.')
         ($if (($g.self@sure 'Такой актив уже есть в спецификации, в строке ' + ($v@toString found_row) + '. Хотите добавить еще раз?' 0) == 0)
           (
             ($g.gridds03@delRow ($g.gridds03@size)-1)
             ($g.gridds03@notifyViews)
             ($ret '')
           )
         )


         #($g.self@sure 'Такой материал уже есть в спецификации, в строке ' + ($v@toString found_row) 1)
         #($g.gridds03@delRow ($g.gridds03@size)-1)
         #($g.gridds03@notifyViews)
         ($ret '')
       )
     )
     # проставим основную единицу измерения
     ($g.gridds03@FastSetCurRow ($g.gridds03@size)-1)
     ($g.default_unit@retrieve)
     ($if (($g.default_unit@size) > 0)
       (
         #(g.name_unit_component = ($g.default_unit@getValue 'active_pseudo_unit.name_pseudo_unit'))

         ($g.gridds03@setValue 'active_pseudo_unit.name_pseudo_unit' ($g.default_unit@getValue 'active_pseudo_unit.name_pseudo_unit'))

         #(g.id_unit_component = ($g.default_unit@getValue 'active_pseudo_unit.id_pseudo_unit'))
         ($g.gridds03@setValue 'spc.id_unit' ($g.default_unit@getValue 'active_pseudo_unit.id_pseudo_unit'))
       )
     )
     ($ret '') 
 )"


del = "~($X
          ($g.gridds03@delRow ($g.gridds03@getCurRow))
          ($g.gridds03@notifyViews)

          #(r = ($($g.grid3@getDatastore)@getCurRow))
          #($($g.grid3@getDatastore)@setValue 'spc.q2_spc' 1)
          #($($g.grid3@getDatastore)@setCurRow r)
          #($($g.grid3@getDatastore)@notifyViews)

          ($ret '') 
       )~"

   {menu
        {item label = "Добавить материал"
          action="~($X
                      (global.add_mode = 1)
                      ($g.grid3@addRow)
                      ($ret '') 
                   )~"
        }
        {item label = "-"}
        {item label = "Добавить набор материалов (нарезку)"
          action="~($X
                      (global.add_mode = 100)
                      ($g.grid3@addRow)
                      ($ret '') 
                   )~"
        }
        //{item label = "Удалить компонент"
        //   action = "~($X
        //                 ($g.gridds03@delRow ($g.gridds03@getCurRow))
        //                 #($g.gridds03@update)
        //                 #($g.self@doAction 'execute exec commit')
        //                 ($g.gridds03@notifyViews)
        //                 ($ret '') 
        //              )~"
        //}
   }
   {column size=100             title="spc.id_spc"  visible = no    font_size = 12
        target=spc.id_spc       font_size = 12          font_family=0
        editable = no
        editmask = "##0."
   }                  
   {column size=100             title="spc.work_type"  visible = no    font_size = 12
        target=spc.work_type    font_size = 12          font_family=0
        alias = spc__work__stage
   }                  
   {column size=80             title="<html>Этап<br>производства"
        target=work_stage.name_work_stage
        alias = name__work__stage
        title_font_family=2        title_font_color="#000000"
        halignment=left            font_size = 12          font_family=0
        editable = handbook
        edit = "opennew sprav/sprav_work_stages_readonly.rml"
        editexp = "($X
                      ($debug 'store.work_stage.name_work_stage: ' + ($try (store.work_stage.name_work_stage) $catch ('NullException')('NULL')))
                      ($if (($try (store.work_stage.name_work_stage) $catch ('NullException')('NULL')) == 'NULL') ($ret '') )
                      (g.name__work__stage=store.work_stage.name_work_stage)
                      (g.spc__work__stage=store.work_stage.id_work_stage)
                      ($ret '')
                   )"
   }                  
   {column size=100             title="spc.id_department"  visible = no    font_size = 12
        target=spc.id_department    font_size = 12          font_family=0
        alias = spc__work__type
   }                  
   {column size=80             title="<html>Вид<br>сборки"
        target=work_type.name_type
        alias = name__work__type
        title_font_family=2        title_font_color="#000000"
        halignment=left            font_size = 12          font_family=0
        editable = handbook
        edit = "opennew sprav/sprav_work_types_readonly.rml"
        editexp = "($X
                      ($if (($try (store.work_type.name_type) $catch ('NullException')('NULL')) == 'NULL') ($ret '') )
                      (g.name__work__type=store.work_type.name_type)
                      (g.spc__work__type=store.work_type.id_work_type)
                      ($ret '')
                   )"
   }                  
   {column size=100             title="spc.id_active"  visible = no    font_size = 12
        target=spc.id_active    font_size = 12          font_family=0
        alias = id_active_component
   }                  
   {column size=250             title="Наименование"
        target=active.name_active
        alias = name_active_component
        title_font_family=2        title_font_color="#000000"
        halignment=left            font_size = 12          font_family=0
        editable = handbook
        edit = "opennew find_choose.rml 1, 0"
        editexp = "($X
                      (g.name_active_component=store.active.name_active)
                      (g.id_active_component=store.active.id_active)
                      (global.id_active = store.active.id_active)
                      ($g.default_unit@retrieve)
                      ($if (($g.default_unit@size) > 0)
                        (
                          (g.name_unit_component = ($g.default_unit@getValue 'active_pseudo_unit.name_pseudo_unit'))
                          (g.id_unit_component = ($g.default_unit@getValue 'active_pseudo_unit.id_pseudo_unit'))
                        )
                      )
                      ($ret '')
                   )"
   }                  
   {column size=70             title="Кол-во"
        target=spc.q1_spc
        title_font_family=2        title_font_color="#000000"
        halignment=right            font_size = 12          font_family=0         editmask = "# #0.000"
        editexp = "($X
                      (global.id_active = ($g.gridds03@getValue 'spc.id_active'))
                      ($g.ds_active@retrieve)
                      ($if (($g.ds_active@getValue 'active.proc1') > 0)
                        (
                          ($g.gridds03@setValue 'spc.q1_spc' ($g.gridds03@getValue 'spc.q1_spc')* (1 + ($g.ds_active@getValue 'active.proc1')/100))
                          ($g.gridds03@notifyViews)
                        )
                      )
                      ($ret '')
                   )"
   }                  
   {column size=100             title="spc.id_unit"  visible = no
        target=spc.id_unit      font_size = 12          font_family=0
        alias = id_unit_component
   }                  
   {column size=50             title="<html>ед.<br>изм."
        target=active_pseudo_unit.name_pseudo_unit
        alias = name_unit_component
        title_font_family=2        title_font_color="#000000"
        halignment=left            font_size = 12          font_family=0
        editable = handbook
        edit = "opennew psevdo_units.rml ~($g.gridds03@getValue 'spc.id_active')~"
        editexp = "($X
                      (g.name_unit_component=store.active_pseudo_unit.name_pseudo_unit)
                      (g.id_unit_component=store.active_pseudo_unit.id_pseudo_unit)
                      ($ret '')
                   )"
   }                  
   {column size=180             title="Примечание"
        target=spc.comments        title_font_family=2     title_font_color="#000000"
        halignment=left          font_size = 12          font_family=0
        editexp = "($X
                      ($ret '')
                   )"
   }
   {column size=90             title="<html>Последнее<br>изменение"
        target=util.get_last_date_mod(spc.id_spc)       title_font_family=2     title_font_color="#000000"
        halignment=left          font_size = 12          font_family=0
        editable = readonly
   }

  {datastore 
           alias = GRIDDS03
           query = "select spc.id_spc, spc.parent_id_spc, spc.id_head, spc.id_unit, spc.id_active, spc.id_department, active.name_active, spc.q1_spc, spc.q2_spc, spc.work_type, active_pseudo_unit.name_pseudo_unit,
                           work_stage.name_work_stage, work_type.name_type,
                           spc.comments, util.get_last_date_mod(spc.id_spc)
                      from spc, active, active_pseudo_unit, work_stage, work_type
                     where spc.id_head = ~($try (ARGUMENTS.0) $catch ('Any')(-1))~
                       and spc.id_active = active.id_active
                       and spc.work_type = work_stage.id_work_stage (+)
                       and spc.id_unit = active_pseudo_unit.id_pseudo_unit (+)
                       and spc.id_department = work_type.id_work_type (+)
                     order by spc.id_spc"
              editable = yes
                unique = "('spc','spc.id_spc')"
               default = "spc.id_spc=~ds.spk~,spc.id_active=~-999~,spc.id_head=~($g.gridds01@getValue 'head.id_head')~, spc.q1_spc=~0~"
   } // end of ds
} // end of grid
} // end of split2
} // end of split1
{button
  BACKGROUND = "LIGHTGRAY"    foreground="#000000"
  label = "Сохранить (F2)"
  action = "($X
                ($g.check_privileges@retrieve)
                ($debug 'ID_GROUP = ' + ($g.check_privileges@GetValue 'ID_GROUP'))	     
                ($if (($g.check_privileges@GetValue 'ID_GROUP') > 4)
                  (
                    ($g.self@sure 'Недостаточно привилегий, у вас есть доступ только на просмотр.' 1)
                    ($ret '')
                  )
                )                        

                ($g.self@actSave)

                ($ret '')
            )"
  shortcut = "F2"
}
{button
  BACKGROUND = "LIGHTGRAY"    foreground="#000000"
  label = "Сохранить и выйти (F3)"
  action = "($X
                  
                ($g.check_privileges@retrieve)
                ($debug 'ID_GROUP = ' + ($g.check_privileges@GetValue 'ID_GROUP'))	     
                ($if (($g.check_privileges@GetValue 'ID_GROUP') > 4)
                  (
                    ($g.self@sure 'Недостаточно привилегий, у вас есть доступ только на просмотр.' 1)
                    ($ret '')
                  )
                )                        
                ($g.self@actDok)
                ($ret '')
            )"
  shortcut = "F3"
}
{button
  BACKGROUND = "LIGHTGRAY"    foreground="#000000"
  label = "Выход (ESC)"
  action = "($g.self@actcancel)"
  shortcut = "escape"
}

} // toolbar
