upc ce0206

Discussão em 'EMS , HCM e Totvs 11' iniciado por Marcos Gomes, Junho 1, 2023.

  1. Marcos Gomes

    Marcos Gomes Membro Participativo

    preciso criar um upc no ce0206 para ele sugerir a data de transação de acordo com um regra...

    ---------------------------
    Informacao
    ---------------------------
    DBName: mgmov
    Table: movto-estoq
    Name: dt-trans
    Type: DATE
    Format: 99/99/9999
    Transaction: no
    Program: invwr/v12in218.w

    ---------------------------
    OK
    ---------------------------


    mais nao consigo me posicionar no objeto dt-trans para poder alterar o valor...

    to tentando o codigo abaixo... mais nao chega :(

    wh-objeto = p-wgh-frame:FIRST-CHILD.
    DO WHILE VALID-HANDLE(wh-objeto):

    DISP "Evento " p-ind-event SKIP
    "Objeto " p-ind-object SKIP
    "Nome obj " c-objeto SKIP
    "Frame " p-wgh-frame:NAME SKIP
    "Tabela " p-cod-table SKIP
    "ROWID " STRING(p-row-table) SKIP
    'l-executa - ' l-executa.

    IF wh-objeto:NAME = "f-main" THEN DO:
    ASSIGN wh-objeto = wh-objeto:FIRST-CHILD.
    NEXT.
    END.

    IF wh-objeto:TYPE = 'field-group' THEN
    ASSIGN wh-objeto = wh-objeto:FIRST-CHILD.
    ELSE
    ASSIGN wh-objeto = wh-objeto:NEXT-SIBLING.

    END.
  2. jdchaves

    jdchaves Membro Participativo

  3. Marcos Gomes

    Marcos Gomes Membro Participativo

    esse é justamente o problema, tenho uma rotina que da os nomes... mais o nome nao é listado porque esse campo é direto para tabela.
  4. bootstrapmaster

    bootstrapmaster Moderator Moderador Equipe de Suporte

    Código:
    Programa findWidget.p
    
    define input  parameter c-widget-name  as char   no-undo.
    define input  parameter c-widget-type  as char   no-undo.
    define input  parameter h-start-widget as handle no-undo.
    define output parameter h-widget       as handle no-undo.
    
    do while valid-handle(h-start-widget):
    
        if h-start-widget:type = c-widget-type and
           (h-start-widget:name = c-widget-name or
            (h-start-widget:type = 'LITERAL':u and
             h-start-widget:screen-value = c-widget-name)) then do:
    
            assign h-widget = h-start-widget:handle.
    
            leave.
        end.
    
        if h-start-widget:type = "field-group":u or
           h-start-widget:type = "frame":u or
           h-start-widget:type = "dialog-box":u then do:
    
            run utils/findWidget.p (input  c-widget-name,
                                    input  c-widget-type,
                                    input  h-start-widget:first-child,
                                    output h-widget).
    
            if valid-handle(h-widget) then
                leave.
        end.
    
        assign h-start-widget = h-start-widget:next-sibling.
    end.
    
    Código:
    upc para ce0206 .....
        define input parameter p-ind-event  as character     no-undo.
        define input parameter p-ind-object as character     no-undo.
        define input parameter p-wgh-object as handle        no-undo.
        define input parameter p-wgh-frame  as widget-handle no-undo.
        define input parameter p-cod-table  as character     no-undo.
        define input parameter p-row-table  as rowid         no-undo.
    
        define variable c-objeto            as character     no-undo.
    
        define variable dtTrans             as handle        no-undo.
        define variable nroDocto            as handle        no-undo.
    
        /* main */
    
        assign c-objeto = entry(num-entries(p-wgh-object:private-data,'~/'), p-wgh-object:private-data,'~/').
    
        if not valid-handle(dtTrans)  then run utils/findWidget.p('dt-trans' , 'fill-in', p-wgh-frame, output dtTrans).
        if not valid-handle(nroDocto) then run utils/findWidget.p('nro-docto', 'fill-in', p-wgh-frame, output nroDocto).
    
        if valid-handle(nroDocto) and
           valid-handle(dtTrans)  then on 'leave' of dtTrans persistent run upc/upc-ce0206Evt.p(dtTrans, nroDocto).
    
    jdchaves curtiu isso.
  5. jdchaves

    jdchaves Membro Participativo

    Provavelmente vc terá que criar um campo(fill-in) falso por cima para tratar.
  6. bootstrapmaster

    bootstrapmaster Moderator Moderador Equipe de Suporte

    Não precisa, tendo o handle do campo dt-trans, ele pode fazer dt-trans:screen-value = string(today) por exemplo ou dt-trans:input-value pra ler o campo.
    rafael.andrade e jdchaves curtiram isso.

Compartilhe esta Página