Cp1251
DOC
foreground = lightgray 
document_width = 750
document_height = 550
document_title = "Журнал заказов"
preloadscript="
(global.retr = 0)
(global.id_h = 0)
(global.no_selaction = 0)
"

{DSCollection
   alias = ds
   SeqQuery  = "select head_sq.nextval,spc_sq.nextval,sysdate,id_personal from personal where upper(login)=user"
   seqnames = "hpk,spk,date,idp"
}

{toolbar   BACKGROUND = "White"
{splitpanel type=horizontal   percent=20 gapsize = 10
{form bg_color="#c0c0c0"
   {label left = 20 top = 10 width = 100 height = 20 font_size = 16
    value = "Материал"
   }
   {field
       type = string   border = box
       left=130     top=10    height=25       width=200
       alias=search         font_size=16    font_family=0    bg_color="#ffffff"

   }  
   {label left = 20 top = 40 width = 100 height = 20 font_size = 16
    value = "Поставщик"
   }
   {field
       type = string   border = box
       left=130     top=40    height=25       width=200
       alias=search         font_size=16    font_family=0    bg_color="#ffffff"

   }  
   { button left = 350 top = 5 width = 100 height = 35
     label = "Поиск"  font_size=16
     shortcut = "Enter"
     action = "($X
                   ($g.self@doAction 'retrieve grid_group1')
                   ($g.self@doAction 'retrieve grid_group2')
                   ($ret '')
                )"
   }
}
{grid
    alias = GRID_GROUP1
    buttonbar_font_family = 0              buttonbar_font_size = 12
    buttonbar_size = 30                    titlebar_size = 18
    multiselect = yes                      editable = yes
    rowsize = 20
    addexp = "($X
              (g.column_id_active = store.active.id_active)
              (g.column_kolvo = 0)
              ($g.self@actSave)
              ($g.self@doAction 'execute exec commit')
              ($ret '')
           )"
    del = "~($X
               (tmp = 'Вы уверены, что хотите удалить заказ ?')
               (m = ($g.self@sure tmp 0))
               ($if (m == 0)
                   ($ret '')
               )
               ($g.self@doAction 'execute exec util.del_doc(' + ($($G.GRID_GROUP1@getDatastore)@getValue 'HEAD.ID_HEAD') + '); retrieve grid_group1')
            ($ret ''))~"

   {menu
        {item label = "Добавить" action="opennew find_choose.rml 1, 0"}
        {item label = "-"}
        {item label = "Удалить"
           action = "~($X
                       ($IF (($($G.GRID_GROUP1@getDatastore)@getValue 'HEAD.ACCEPT' ) == 1)
		             ((tmp = 'Запрещено удалять проведенный документ')
            		      (m = ($g.self@sure tmp 1))
		             )
			$else
		         ((tmp = 'Вы действительно хотите удалить документ №' + ($($G.GRID_GROUP1@getDatastore)@getValue 'HEAD.NUM_SD' ) + '')
	                  (m = ($g.self@sure tmp 0))
		          ($if (m == 0)
                	   ($ret '')
	                  )
	                  ($g.self@doAction 'execute exec util.del_doc(' + ($($G.GRID_GROUP1@getDatastore)@getValue 'HEAD.ID_HEAD') + '); retrieve grid_group1 ; retrieve grid_group2')
			 )
		       )
	              ($ret ''))~"
        }
   }
   {column size=80             title="ID"
        target=head.id_active        title_font_family=2     title_font_color="#000000"
        halignment=right           font_size = 12          font_family=0
        editable = readonly
        alias = column_id_active
   }
   {column size=80            title="Кол-во"
        target=spc.q1_spc title_font_family=2     title_font_color="#000000"
        halignment=right            font_size = 12          font_family=0
        editmask = "# #0.000"
        alias = column_kolvo
        editexp="($X
                    ($g.self@actSave)
                    ($g.self@doAction 'execute exec commit')
                    ($ret '')
                 )"
   }


   {datastore 
           alias = GRIDDS01
           query = "select spc.id_spc, spc.q1_spc, head.id_head, head.id_active, head.id_type_doc
                      from head, spc
                     where head.id_type_doc = 9
                       and head.id_head = spc.id_head (+)"

              editable = yes
                unique = "('head','head.id_head')"
               default = "head.id_head=~ds.hpk~,head.id_type_doc=~9~,spc.id_spc=~ds.spk~"


   } // end of ds
} // end of grid
} // end of horizontal split
{button
  left = 72  width = 50    height = 20
  BACKGROUND = "LIGHTGREEN"    foreground="#000000"
  label = "Выход ESC"
  action = "($g.self@actcancel)"
  shortcut = "escape"
}

} // toolbar
