
setup form !!tmpFRM 
path d
  button .bsetAngAns  'ANGL answer Repair'    callback '!this.anglAnsRepair()'

  button .setDetref at x0  'set Detref'    callback '!this.setdetref()'
  button .setDetrefGPART at x0  'set Detref for GPART'    callback '!this.setdetrefGPART()'
  button .setMATXT at x0  'set MATXT'    callback '!this.setMATXT()'
  
  
  path r
  text .tMAT 'материал' width 4 is string
  path d
  button .bCreateDTSE at x0  'make DTSE'    callback '!this.makedtse()'
exit

define method .anglAnsRepair()
endmethod

define method .makedtse()
   var !dcol collect all dtse for cate
   if !dcol.size() gt 0 then
     !!alert.message('Уже есть DTSE')
     return
   endif

  !name = name of cate & '-DTSE'
  
  cate
  new dtse $!name
  new data
  Dkey WEIG
  Pproperty ( ATTRIB PARA[1 ] )
  Dproperty ( 0 )
  Purpose PARA
  Number 1
  Dtitle 'масса'
  
  var !col collect all scom for cate
  do !J values !col
    $!J
    !!ce.dtref = !name.dbref()
  enddo

endmethod

define method .setdetref()
  var !col collect all spco for ce
  do !J values !col
    $!J
    !!ce.detref = !!ce.catref.owner.name.replace(!!ce.catref.owner.name,!!ce.catref.owner.name + '-OUT').dbref()
	handle any
	$p не удалось присвоить $!J
	endhandle
  enddo

endmethod

define method .setdetrefGPART()
  var !col collect all GPART for ce
  do !J values !col
    $!J
    !!ce.detref = !!ce.catref.owner.name.replace(!!ce.catref.owner.name,!!ce.catref.owner.name + '-OUT').dbref()
  enddo

endmethod

define method .setMATXT()
  var !col collect all spco for ce
  do !J values !col
    $!J
	!MATXTname = '/OSTEC-MAT-ALL-' & !this.tMAT.val
    !!ce.matxt =  !MATXTname.dbref()
  enddo

endmethod

define method .anglAnsRepair()
  var !col collect all spco for ce
  do !J values !col
    $!J
    if QUES of owner eq 'ANGL' and ans eq 0 then $* только если ещё не задавали
	  --!ang = para[8] of catref
	  --!ang = 180 - !ang
	  !ang = 90
	  ans $!ang
	  maxans $!ang
	  tans ''
	endif
	
  enddo

endmethod