[RESOLVIDO] CE0220 - TRANSAÇÕES DIVERSAS

Discussão em 'EMS , HCM e Totvs 11' iniciado por mpdelphi, Dezembro 15, 2010.

Status do Tópico:
Não esta aberto para novas mensagens.
  1. mpdelphi

    mpdelphi Membro Participativo

    Bom Dia,


    estou precisando criar um upc no ce0220, transações diversas que gostaria que no momento em que o usuário alterasse o codigo do estabelecimento minha upc preenchesse automaticamente o numero da conta contabil.

    Como eu faço pra executar uma procedure no evento onleave do campo codigo do estabelcimento nessa tela ?
  2. Rodrigo Rossetto

    Rodrigo Rossetto Membro Participativo

    Faz tempo que não mexo, mas geralmente se faz um apontamento de memória (utilizando handle) para o campo. Criavamos uma procedure separada para cada evento, com os handle compartilhados interagiamos com os valores de tela.
    Se você tiver o DDK da datasul, existe o manual deles com alguns exemplos.
    Veja se te ajuda, segue alguns:

    Criar um botão novo em uma window para chamar um subprograma a partir deste:
    Código:
    def input param p-ind-event        as char          no-undo.
    def input param p-ind-object       as char          no-undo.
    def input param p-wgh-object       as handle        no-undo.
    def input param p-wgh-frame        as widget-handle no-undo.
    def input param p-cod-table        as char          no-undo.
    def input param p-row-table        as rowid         no-undo.
    		
    def var wh-button  as widget-handle no-undo.
    def var c-objeto as char no-undo.
    
    assign c-objeto   = entry(num-entries(p-wgh-object:private-data, "~/"), p-wgh-object:private-data, "~/").
    
    if  p-ind-event = "INITIALIZE"
    and p-ind-object = "CONTAINER" then do:
        create button wh-button
               assign frame   = p-wgh-frame
                      width   = 4
           		           height  = 1.25
               row     = 1.26
               label   = "teste"
               col     = 65
                      sensitive = yes
                             visible = yes
                             triggers:
                             ON CHOOSE PERSISTENT RUN upc/testeupc1.p.
                             end triggers.
    end.
    
    Criar um widget novo em uma viewer:
    Código:
    def input param p-ind-event        as char          no-undo.
    def input param p-ind-object       as char          no-undo.
    def input param p-wgh-object       as handle        no-undo.
    def input param p-wgh-frame        as widget-handle no-undo.
    def input param p-cod-table        as char          no-undo.
    def input param p-row-table        as rowid         no-undo.
    
    def new
     global shared var wh-button  as widget-handle no-undo.
    def new global shared var wh-fill    as widget-handle no-undo.
    def new global shared var tx-label   as widget-handle no-undo.
    def var c-objeto as char no-undo.
    
    assign c-objeto   = entry(num-entries(p-wgh-object:private-data, "~/"), p-wgh-object:private-data, "~/").
    
    if  p-ind-event = "BEFORE-INITIALIZE"
    and p-ind-object = "VIEWER" 
    and c-objeto = "v24ad098.w" then do:
        create button wh-button 
            assign frame  = p-wgh-frame
                   width  = 18
                   height = 1
                   label  = "Assistência Técnica"
                   row    = 3.7
                   col    = 67
                   visible = yes
                   sensitive = no
                   triggers:
                       ON CHOOSE PERSISTENT RUN upc/demoupc1.p.
                   end triggers.
        create text tx-label
            assign frame        = p-wgh-frame
                   format       = "x(17)"
                   width        = 6.2
                   screen-value = "Perfil Marketing:"
                   row          = 2.8
                   col          = 59.5
                   fgcolor      = 1
                   visible      = yes.      
        create fill-in wh-fill
            assign frame              = p-wgh-frame
                   side-label-handle  = tx-label:handle
                   format             = "x(20)" 
                   width              = 12
                   height             = 0.88
                   row                = 2.7
                   col                = 71
                   bgcolor            = 1
                   fgcolor            = 15
                   label              = "Perfil Marketing:"
                   visible            = yes
                   sensitive          = no.
    end.
    
    if  p-ind-event = "ENABLE" 
    and p-ind-object = "VIEWER"
    and c-objeto = "v24ad098.w" then do:
        assign wh-button:sensitive = yes
               wh-fill:sensitive   = yes.
    end.
    
    if  p-ind-event = "DISABLE" 
    and p-ind-object = "VIEWER"
    and c-objeto = "v24ad098.w" then do:
        assign wh-button:sensitive = no
               wh-fill:sensitive   = no.
    end.
    Encontrar o handle de um widget
    Código:
    def input param p-ind-event        as char          no-undo.
    def input param p-ind-object       as char          no-undo.
    def input param p-wgh-object       as handle        no-undo.
    def input param p-wgh-frame        as widget-handle no-undo.
    def input param p-cod-table        as char          no-undo.
    def input param p-row-table        as rowid         no-undo.
    
    def new global shared var wh-button  as widget-handle no-undo.
    def new global shared var wh-fill    as widget-handle no-undo.
    def new global shared var tx-label   as widget-handle no-undo.
    def new global shared var h_campo    as widget-handle no-undo.
    def var c-objeto as char no-undo.
    def var h_frame as widget-handle no-undo. 
    
    assign c-objeto   = entry(num-entries(p-wgh-object:private-data, "~/"), p-wgh-object:private-data, "~/").
    
    if  p-ind-event = "DISPLAY"
    and p-ind-object = "VIEWER" 
    and c-objeto = "v24ad098.w" then do:
         
    DO :
      ASSIGN h_Frame = p-wgh-frame:FIRST-CHILD. /* pegando o Field-Group */
      ASSIGN h_Frame = h_Frame:FIRST-CHILD.       /* pegando o 1o. Campo */
      message h_frame:name view-as alert-box.   
      DO WHILE h_Frame <> ? :
         if h_frame:type <> "field-group" then do:  
              IF h_Frame:NAME = "nome-mic-reg" THEN
              DO :
                 assign h_campo = h_Frame.
                 leave.
              END.
              ASSIGN h_Frame = h_Frame:NEXT-SIBLING.
           end. 
           else do:
             assign h_frame = h_frame:first-child.
           end.    
         END.
      END.
    end.
Status do Tópico:
Não esta aberto para novas mensagens.

Compartilhe esta Página