Varias Impressões no Relatório

Discussão em 'Progress 4GL' iniciado por turks, Março 23, 2010.

  1. turks

    turks Membro Participativo

    Galera, alguem pode me ajudar com o seguinte problema:

    Criei um campo no relatório que o valor que eu preencher no campo, deve ser a quantidade de impressões que deve ser feita, Exemplo:

    Coloquei nº 2 no campo, quero que imprima 2 arquivos.

    Valeu Gente!
  2. mcarril

    mcarril Membro Participativo

    Você pode me enviar o código por favor ?
    Não esta claro, você quer que imprima duas cópias ?
  3. turks

    turks Membro Participativo

    Marly, o que eu fiz foi o seguinte:

    - Criei um campo no .w da tela do relatório, um campo do tipo numérico.
    - Quando eu colocar um numero nesse campo, ele vai imprimir a quantidade de etiquetas que eu pedir.

    Exp. Se eu colocar o numero 2 no campo do .w ele vai imprimir 2 etiquetas.
    Entendeu?

    Obrigado!! :D
  4. mcarril

    mcarril Membro Participativo

    Tá então você tem uma variável "qt-copia" definida como numérica.

    Não dá para colocar no bloco que já manda imprimir uma cópia a instrução:

    Do x = 1 to qt-copia:


    (envio de impressão)


    end.
  5. turks

    turks Membro Participativo

    Bom Dia!

    Marly, estou enviando o código aqui abaixo, veja por favor se pode me instruir em como prosseguir.

    .p

    Código:
    /*--------- include de controle de versão ----------*/
    {include/i-prgvrs.i ies0014RP 2.06.00.000}
    
    /* Pré-processador para ativar ou não a saída para RTF*/
    &GLOBAL-DEFINE RTF NO
    
    /*------- Definição de Tabela Temporárias ----------*/
    define temp-table tt-param no-undo
        field destino          as integer
        field arquivo          as char format "x(35)"
        field usuario          as char format "x(12)"
        field data-exec        as date
        field hora-exec        as integer
        FIELD codigo--        AS CHARACTER FORMAT "X(15)"
        FIELD cliente          AS INTEGER
        FIELD modelo           AS CHARACTER FORMAT "X(45)"
        FIELD data-p           AS DATE
        FIELD data-e           AS DATE
        FIELD qt-imprimir      AS INTEGER.
    
    def temp-table tt-raw-digita
        field raw-digita      as raw.
    /*--------------------- recebimento de parâmetros -----------------*/
    DEFINE INPUT PARAMETER raw-param AS RAW NO-UNDO.  /*variável com conteúdo tt-param*/
    DEFINE INPUT PARAMETER TABLE FOR tt-raw-digita.
    
    /*-------------------- carrega parametros--------------------------*/
    CREATE tt-param.
    RAW-TRANSFER raw-param TO tt-param.
    
    /*----------- include padrão para variáveis de relatório ----------*/
    {include/i-rpvar.i}
    
    /*------------------ Definição de Variaveis------------------------*/
    
    DEFINE VARIABLE h-acomp         AS HANDLE     NO-UNDO. /* variavel deve ser sempre definida*/
    
    /*-------------- include padrão para output de relatórios----------*/
    {include/i-rpout.i &STREAM="stream str-rp"}
    
    /*-------------------- bloco principal do programa---------------- */
    ASSIGN c-programa 	  = "FES0004"
           c-versao	      = "2.04"
           c-revisao	  = ".00.000"
           c-empresa      = "Fiberbus"
           c-titulo-relat = "Emissão de Etiqueta".
    
    RUN utp/ut-acomp.p PERSISTENT SET h-acomp.
    {utp/ut-liter.i Imprimindo *}
    RUN pi-inicializar IN h-acomp ('Listagem de Pedidos').
    
    /* ---------------Definição do Form, ou cabeçalho----------------- */
    
    
    
    /* -------------------Lógica do Relatório------------------------- */
    
    
    
    FIND FIRST emitente NO-LOCK WHERE emitente.cod-emitente = cliente NO-ERROR.
    FIND FIRST ITEM NO-LOCK WHERE ITEM.it-codigo = codigo-- NO-ERROR.
    
    PUT STREAM str-rp
        " ------------------------------------------------------------ "  SKIP
        "|Descrição                                                   |" SKIP
        "|" ITEM.desc-item                                           "|" SKIP
        "|--------------+---------------------------------------------|" SKIP
        "|Código        |" codigo--    "                              |" SKIP 
        "|Data Produção |" data-p "                                     |"  SKIP
        "|Cliente       |" emitente.nome-abrev  "                                 |" SKIP
        "|Modelo        |" modelo               "|"                    SKIP
        "|Data Entrega  |" data-e "                                     |"  SKIP
        "|--------------+---------------+--------------+--------------|" SKIP
        "|RE Acabador   |               |RE Liberação  |              |" SKIP
        " --------------+---------------+--------------+-------------- ".
    
    
    RUN pi-finalizar IN h-acomp.
    
    
    .w

    Código:
    &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI ADM1
    &ANALYZE-RESUME
    &Scoped-define WINDOW-NAME w-relat
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS w-relat 
    /*:T*******************************************************************************
    ** Copyright DATASUL S.A. (1997)
    ** Todos os Direitos Reservados.
    **
    ** Este fonte e de propriedade exclusiva da DATASUL, sua reproducao
    ** parcial ou total por qualquer meio, so podera ser feita mediante
    ** autorizacao expressa.
    *******************************************************************************/
    {include/i-prgvrs.i FES0004 2.04.00.000}
    
    /* Create an unnamed pool to store all the widgets created 
         by this procedure. This is a good default which assures
         that this procedure's triggers and internal procedures 
         will execute in this procedure's storage, and that proper
         cleanup will occur on deletion of the procedure. */
    
    CREATE WIDGET-POOL.
    
    /* ***************************  Definitions  ************************** */
    
    /*:T Preprocessadores do Template de Relatório                            */
    /*:T Obs: Retirar o valor do preprocessador para as páginas que não existirem  */
    
    &GLOBAL-DEFINE PGSEL f-pg-sel
    &GLOBAL-DEFINE PGIMP f-pg-imp
    
    &GLOBAL-DEFINE RTF   NO
      
    /* Parameters Definitions ---                                           */
    
    /* Temporary Table Definitions ---                                      */
    
    define temp-table tt-param no-undo
        field destino          as integer
        field arquivo          as char format "x(35)"
        field usuario          as char format "x(12)"
        field data-exec        as date
        field hora-exec        as integer
        FIELD codigo--        AS CHARACTER FORMAT "X(15)"
        FIELD cliente          AS INTEGER
        FIELD modelo           AS CHARACTER FORMAT "X(45)"
        FIELD data-p           AS DATE
        FIELD data-e           AS DATE
        FIELD qt-imprimir      AS INTEGER.
    
    /*define temp-table tt-digita no-undo
        field ordem            as integer   format ">>>>9"
        field exemplo          as character format "x(30)"
        index id ordem.
    
    define buffer b-tt-digita for tt-digita.*/
    
    /* Transfer Definitions */
    
    def var raw-param        as raw no-undo.
    
    def temp-table tt-raw-digita
       field raw-digita      as raw.
                        
    /* Local Variable Definitions ---                                       */
    
    def var l-ok               as logical no-undo.
    def var c-arq-digita       as char    no-undo.
    def var c-terminal         as char    no-undo.
    def var c-rtf              as char    no-undo.
    def var c-modelo-default   as char    no-undo.
    
    /*15/02/2005 - tech1007 - Variavel definida para tratar se o programa está rodando no WebEnabler*/
    DEFINE SHARED VARIABLE hWenController AS HANDLE NO-UNDO.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK 
    
    /* ********************  Preprocessor Definitions  ******************** */
    
    &Scoped-define PROCEDURE-TYPE w-relat
    &Scoped-define DB-AWARE no
    
    /* Name of designated FRAME-NAME and/or first browse and/or first query */
    &Scoped-define FRAME-NAME f-pg-imp
    
    /* Standard List Definitions                                            */
    &Scoped-Define ENABLED-OBJECTS RECT-7 RECT-9 rs-destino bt-arquivo ~
    bt-config-impr c-arquivo rs-execucao 
    &Scoped-Define DISPLAYED-OBJECTS rs-destino c-arquivo rs-execucao 
    
    /* Custom List Definitions                                              */
    /* List-1,List-2,List-3,List-4,List-5,List-6                            */
    
    /* _UIB-PREPROCESSOR-BLOCK-END */
    &ANALYZE-RESUME
    
    
    
    /* ***********************  Control Definitions  ********************** */
    
    /* Define the widget handle for the window                              */
    DEFINE VAR w-relat AS WIDGET-HANDLE NO-UNDO.
    
    /* Definitions of the field level widgets                               */
    DEFINE BUTTON bt-arquivo 
         IMAGE-UP FILE "image\im-sea":U
         IMAGE-INSENSITIVE FILE "image\ii-sea":U
         LABEL "" 
         SIZE 4 BY 1.
    
    DEFINE BUTTON bt-config-impr 
         IMAGE-UP FILE "image\im-cfprt":U
         LABEL "" 
         SIZE 4 BY 1.
    
    DEFINE VARIABLE c-arquivo AS CHARACTER 
         VIEW-AS EDITOR MAX-CHARS 256
         SIZE 40 BY .88
         BGCOLOR 15  NO-UNDO.
    
    DEFINE VARIABLE text-destino AS CHARACTER FORMAT "X(256)":U INITIAL " Destino" 
          VIEW-AS TEXT 
         SIZE 8.57 BY .63 NO-UNDO.
    
    DEFINE VARIABLE text-modo AS CHARACTER FORMAT "X(256)":U INITIAL "Execução" 
          VIEW-AS TEXT 
         SIZE 10.86 BY .63 NO-UNDO.
    
    DEFINE VARIABLE rs-destino AS INTEGER INITIAL 2 
         VIEW-AS RADIO-SET HORIZONTAL
         RADIO-BUTTONS 
              "Impressora", 1,
    "Arquivo", 2,
    "Terminal", 3
         SIZE 44 BY 1.08 NO-UNDO.
    
    DEFINE VARIABLE rs-execucao AS INTEGER INITIAL 1 
         VIEW-AS RADIO-SET HORIZONTAL
         RADIO-BUTTONS 
              "On-Line", 1,
    "Batch", 2
         SIZE 27.72 BY .92 NO-UNDO.
    
    DEFINE RECTANGLE RECT-7
         EDGE-PIXELS 2 GRAPHIC-EDGE  NO-FILL   
         SIZE 46.29 BY 2.79.
    
    DEFINE RECTANGLE RECT-9
         EDGE-PIXELS 2 GRAPHIC-EDGE  NO-FILL   
         SIZE 46.29 BY 1.71.
    
    DEFINE VARIABLE cliente AS INTEGER FORMAT ">>>>>>9":U INITIAL 3 
         LABEL "Cliente" 
         VIEW-AS FILL-IN 
         SIZE 15 BY .88 NO-UNDO.
    
    DEFINE VARIABLE codigo-- AS CHARACTER FORMAT "X(15)":U 
         LABEL "Código" 
         VIEW-AS FILL-IN 
         SIZE 15 BY .88 NO-UNDO.
    
    DEFINE VARIABLE data-e AS DATE FORMAT "99/99/9999":U 
         LABEL "Data Entrega" 
         VIEW-AS FILL-IN 
         SIZE 15 BY .88 NO-UNDO.
    
    DEFINE VARIABLE data-p AS DATE FORMAT "99/99/9999":U 
         LABEL "Data Produção" 
         VIEW-AS FILL-IN 
         SIZE 15 BY .88 NO-UNDO.
    
    DEFINE VARIABLE modelo AS CHARACTER FORMAT "X(50)":U 
         LABEL "Modelo" 
         VIEW-AS FILL-IN 
         SIZE 15 BY .88 NO-UNDO.
    
    DEFINE VARIABLE qt-imprimir AS INTEGER FORMAT "->,>>>,>>9":U INITIAL 0 
         LABEL "Quantidade a Imprimir" 
         VIEW-AS FILL-IN 
         SIZE 15 BY .88 NO-UNDO.
    
    DEFINE BUTTON bt-ajuda 
         LABEL "Ajuda" 
         SIZE 10 BY 1.
    
    DEFINE BUTTON bt-cancelar AUTO-END-KEY 
         LABEL "Fechar" 
         SIZE 10 BY 1.
    
    DEFINE BUTTON bt-executar 
         LABEL "Executar" 
         SIZE 10 BY 1.
    
    DEFINE IMAGE im-pg-imp
         FILENAME "image\im-fldup":U
         SIZE 15.72 BY 1.21.
    
    DEFINE IMAGE im-pg-sel
         FILENAME "image\im-fldup":U
         SIZE 15.72 BY 1.21.
    
    DEFINE RECTANGLE RECT-1
         EDGE-PIXELS 2 GRAPHIC-EDGE    
         SIZE 79 BY 1.42
         BGCOLOR 7 .
    
    DEFINE RECTANGLE RECT-6
         EDGE-PIXELS 0    
         SIZE 78.72 BY .13
         BGCOLOR 7 .
    
    DEFINE RECTANGLE rt-folder
         EDGE-PIXELS 1 GRAPHIC-EDGE  NO-FILL   
         SIZE 79 BY 11.38
         FGCOLOR 0 .
    
    DEFINE RECTANGLE rt-folder-left
         EDGE-PIXELS 0    
         SIZE .43 BY 11.21
         BGCOLOR 15 .
    
    DEFINE RECTANGLE rt-folder-right
         EDGE-PIXELS 0    
         SIZE .43 BY 11.17
         BGCOLOR 7 .
    
    DEFINE RECTANGLE rt-folder-top
         EDGE-PIXELS 0    
         SIZE 78.72 BY .13
         BGCOLOR 15 .
    
    
    /* ************************  Frame Definitions  *********************** */
    
    DEFINE FRAME f-relat
         bt-executar AT ROW 14.54 COL 3 HELP
              "Dispara a execução do relatório"
         bt-cancelar AT ROW 14.54 COL 14 HELP
              "Fechar"
         bt-ajuda AT ROW 14.54 COL 70 HELP
              "Ajuda"
         RECT-1 AT ROW 14.29 COL 2
         RECT-6 AT ROW 13.75 COL 2.14
         rt-folder-top AT ROW 2.54 COL 2.14
         rt-folder-right AT ROW 2.67 COL 80.43
         rt-folder-left AT ROW 2.54 COL 2.14
         rt-folder AT ROW 2.5 COL 2
         im-pg-imp AT ROW 1.5 COL 18
         im-pg-sel AT ROW 1.5 COL 2.14
        WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY 
             SIDE-LABELS NO-UNDERLINE THREE-D 
             AT COL 1 ROW 1
             SIZE 81 BY 15
             DEFAULT-BUTTON bt-executar WIDGET-ID 100.
    
    DEFINE FRAME f-pg-imp
         rs-destino AT ROW 1.63 COL 3.29 HELP
              "Destino de Impressão do Relatório" NO-LABEL
         bt-arquivo AT ROW 2.71 COL 43.29 HELP
              "Escolha do nome do arquivo"
         bt-config-impr AT ROW 2.71 COL 43.29 HELP
              "Configuração da impressora"
         c-arquivo AT ROW 2.75 COL 3.29 HELP
              "Nome do arquivo de destino do relatório" NO-LABEL
         rs-execucao AT ROW 5.25 COL 2.86 HELP
              "Modo de Execução" NO-LABEL
         text-destino AT ROW 1.04 COL 3.86 NO-LABEL
         text-modo AT ROW 4.5 COL 1.14 COLON-ALIGNED NO-LABEL
         RECT-7 AT ROW 1.33 COL 2.14
         RECT-9 AT ROW 4.71 COL 2
        WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY 
             SIDE-LABELS NO-UNDERLINE THREE-D 
             AT COL 3 ROW 3
             SIZE 73.72 BY 10.5 WIDGET-ID 100.
    
    DEFINE FRAME f-pg-sel
         codigo-- AT ROW 2 COL 22 COLON-ALIGNED
         cliente AT ROW 3.25 COL 22 COLON-ALIGNED WIDGET-ID 2
         modelo AT ROW 4.5 COL 22 COLON-ALIGNED WIDGET-ID 4
         data-p AT ROW 6.25 COL 22 COLON-ALIGNED WIDGET-ID 6
         data-e AT ROW 6.25 COL 57 COLON-ALIGNED WIDGET-ID 8
         qt-imprimir AT ROW 8.25 COL 22 COLON-ALIGNED WIDGET-ID 10
        WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY 
             SIDE-LABELS NO-UNDERLINE THREE-D 
             AT COL 3 ROW 2.85
             SIZE 76.86 BY 10.62 WIDGET-ID 100.
    
    
    /* *********************** Procedure Settings ************************ */
    
    &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
    /* Settings for THIS-PROCEDURE
       Type: w-relat
       Allow: Basic,Browse,DB-Fields,Window,Query
       Add Fields to: Neither
     */
    &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
    
    /* *************************  Create Window  ************************** */
    
    &ANALYZE-SUSPEND _CREATE-WINDOW
    IF SESSION:DISPLAY-TYPE = "GUI":U THEN
      CREATE WINDOW w-relat ASSIGN
             HIDDEN             = YES
             TITLE              = "<Title>"
             HEIGHT             = 15
             WIDTH              = 81.14
             MAX-HEIGHT         = 22.33
             MAX-WIDTH          = 114.29
             VIRTUAL-HEIGHT     = 22.33
             VIRTUAL-WIDTH      = 114.29
             RESIZE             = yes
             SCROLL-BARS        = no
             STATUS-AREA        = yes
             BGCOLOR            = ?
             FGCOLOR            = ?
             KEEP-FRAME-Z-ORDER = yes
             THREE-D            = yes
             MESSAGE-AREA       = no
             SENSITIVE          = yes.
    ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
    /* END WINDOW DEFINITION                                                */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB w-relat 
    /* ************************* Included-Libraries *********************** */
    
    {src/adm/method/containr.i}
    {include/w-relat.i}
    {utp/ut-glob.i}
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    
    
    /* ***********  Runtime Attributes and AppBuilder Settings  *********** */
    
    &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
    /* SETTINGS FOR WINDOW w-relat
      VISIBLE,,RUN-PERSISTENT                                               */
    /* SETTINGS FOR FRAME f-pg-imp
       FRAME-NAME                                                           */
    /* SETTINGS FOR FILL-IN text-destino IN FRAME f-pg-imp
       NO-DISPLAY NO-ENABLE ALIGN-L                                         */
    ASSIGN 
           text-destino:PRIVATE-DATA IN FRAME f-pg-imp     = 
                    "Destino".
    
    /* SETTINGS FOR FILL-IN text-modo IN FRAME f-pg-imp
       NO-DISPLAY NO-ENABLE                                                 */
    ASSIGN 
           text-modo:PRIVATE-DATA IN FRAME f-pg-imp     = 
                    "Execução".
    
    /* SETTINGS FOR FRAME f-pg-sel
                                                                            */
    /* SETTINGS FOR FRAME f-relat
                                                                            */
    /* SETTINGS FOR RECTANGLE RECT-1 IN FRAME f-relat
       NO-ENABLE                                                            */
    /* SETTINGS FOR RECTANGLE RECT-6 IN FRAME f-relat
       NO-ENABLE                                                            */
    /* SETTINGS FOR RECTANGLE rt-folder IN FRAME f-relat
       NO-ENABLE                                                            */
    /* SETTINGS FOR RECTANGLE rt-folder-left IN FRAME f-relat
       NO-ENABLE                                                            */
    /* SETTINGS FOR RECTANGLE rt-folder-right IN FRAME f-relat
       NO-ENABLE                                                            */
    /* SETTINGS FOR RECTANGLE rt-folder-top IN FRAME f-relat
       NO-ENABLE                                                            */
    IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(w-relat)
    THEN w-relat:HIDDEN = no.
    
    /* _RUN-TIME-ATTRIBUTES-END */
    &ANALYZE-RESUME
    
    
    /* Setting information for Queries and Browse Widgets fields            */
    
    &ANALYZE-SUSPEND _QUERY-BLOCK FRAME f-pg-imp
    /* Query rebuild information for FRAME f-pg-imp
         _Query            is NOT OPENED
    */  /* FRAME f-pg-imp */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _QUERY-BLOCK FRAME f-pg-sel
    /* Query rebuild information for FRAME f-pg-sel
         _Query            is NOT OPENED
    */  /* FRAME f-pg-sel */
    &ANALYZE-RESUME
    
     
    
    
    
    /* ************************  Control Triggers  ************************ */
    
    &Scoped-define SELF-NAME w-relat
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL w-relat w-relat
    ON END-ERROR OF w-relat /* <Title> */
    OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
      /* This case occurs when the user presses the "Esc" key.
         In a persistently run window, just ignore this.  If we did not, the
         application would exit. */
       RETURN NO-APPLY.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL w-relat w-relat
    ON WINDOW-CLOSE OF w-relat /* <Title> */
    DO:
      /* This event will close the window and terminate the procedure.  */
      APPLY "CLOSE":U TO THIS-PROCEDURE.
      RETURN NO-APPLY.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define FRAME-NAME f-relat
    &Scoped-define SELF-NAME bt-ajuda
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL bt-ajuda w-relat
    ON CHOOSE OF bt-ajuda IN FRAME f-relat /* Ajuda */
    DO:
       {include/ajuda.i}
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define FRAME-NAME f-pg-imp
    &Scoped-define SELF-NAME bt-arquivo
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL bt-arquivo w-relat
    ON CHOOSE OF bt-arquivo IN FRAME f-pg-imp
    DO:
        {include/i-rparq.i}
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define FRAME-NAME f-relat
    &Scoped-define SELF-NAME bt-cancelar
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL bt-cancelar w-relat
    ON CHOOSE OF bt-cancelar IN FRAME f-relat /* Fechar */
    DO:
       apply "close":U to this-procedure.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define FRAME-NAME f-pg-imp
    &Scoped-define SELF-NAME bt-config-impr
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL bt-config-impr w-relat
    ON CHOOSE OF bt-config-impr IN FRAME f-pg-imp
    DO:
       {include/i-rpimp.i}
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define FRAME-NAME f-relat
    &Scoped-define SELF-NAME bt-executar
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL bt-executar w-relat
    ON CHOOSE OF bt-executar IN FRAME f-relat /* Executar */
    DO:
       do  on error undo, return no-apply:
           run pi-executar.
       end.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define SELF-NAME im-pg-imp
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL im-pg-imp w-relat
    ON MOUSE-SELECT-CLICK OF im-pg-imp IN FRAME f-relat
    DO:
        run pi-troca-pagina.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define SELF-NAME im-pg-sel
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL im-pg-sel w-relat
    ON MOUSE-SELECT-CLICK OF im-pg-sel IN FRAME f-relat
    DO:
        run pi-troca-pagina.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define FRAME-NAME f-pg-imp
    &Scoped-define SELF-NAME rs-destino
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL rs-destino w-relat
    ON VALUE-CHANGED OF rs-destino IN FRAME f-pg-imp
    DO:
    /*Alterado 15/02/2005 - tech1007 - Evento alterado para correto funcionamento dos novos widgets
      utilizados para a funcionalidade de RTF*/
    do  with frame f-pg-imp:
        case self:screen-value:
            when "1" then do:
                assign c-arquivo:sensitive    = no
                       bt-arquivo:visible     = no
                       bt-config-impr:visible = YES
                       /*Alterado 17/02/2005 - tech1007 - Realizado teste de preprocessador para
                         verificar se o RTF está ativo*/
                       &IF "{&RTF}":U = "YES":U &THEN
                       l-habilitaRtf:sensitive  = NO
                       l-habilitaRtf:SCREEN-VALUE IN FRAME f-pg-imp = "No"
                       l-habilitaRtf = NO
                       &endif
                       /*Fim alteracao 17/02/2005*/
                       .
            end.
            when "2" then do:
                assign c-arquivo:sensitive     = yes
                       bt-arquivo:visible      = yes
                       bt-config-impr:visible  = NO
                       /*Alterado 17/02/2005 - tech1007 - Realizado teste de preprocessador para
                         verificar se o RTF está ativo*/
                       &IF "{&RTF}":U = "YES":U &THEN
                       l-habilitaRtf:sensitive  = YES
                       &endif
                       /*Fim alteracao 17/02/2005*/
                       .
            end.
            when "3" then do:
                assign c-arquivo:sensitive     = no
                       bt-arquivo:visible      = no
                       bt-config-impr:visible  = no
                       /*Alterado 17/02/2005 - tech1007 - Realizado teste de preprocessador para
                         verificar se o RTF está ativo*/
                       &IF "{&RTF}":U = "YES":U &THEN
                       l-habilitaRtf:sensitive  = YES
                       &endif
                       /*Fim alteracao 17/02/2005*/
                       .
                /*Alterado 15/02/2005 - tech1007 - Teste para funcionar corretamente no WebEnabler*/
                &IF "{&RTF}":U = "YES":U &THEN
                IF VALID-HANDLE(hWenController) THEN DO:
                    ASSIGN l-habilitaRtf:sensitive  = NO
                           l-habilitaRtf:SCREEN-VALUE IN FRAME f-pg-imp = "No"
                           l-habilitaRtf = NO.
                END.
                &endif
                /*Fim alteracao 15/02/2005*/
            end.
        end case.
    end.
    &IF "{&RTF}":U = "YES":U &THEN
    RUN pi-habilitaRtf.
    &endif
    /*Fim alteracao 15/02/2005*/
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define SELF-NAME rs-execucao
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL rs-execucao w-relat
    ON VALUE-CHANGED OF rs-execucao IN FRAME f-pg-imp
    DO:
       {include/i-rprse.i}
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &UNDEFINE SELF-NAME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK w-relat 
    
    
    /* ***************************  Main Block  *************************** */
    
    /* Set CURRENT-WINDOW: this will parent dialog-boxes and frames.        */
    ASSIGN CURRENT-WINDOW                = {&WINDOW-NAME} 
           THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.
    
    /*{utp/ut9000.i "FES0004" "2.04.00.000"}*/
    
    /*:T inicializações do template de relatório */
    {include/i-rpini.i}
    
    /* The CLOSE event can be used from inside or outside the procedure to  */
    /* terminate it.                                                        */
    ON CLOSE OF THIS-PROCEDURE 
       RUN disable_UI.
    
    {include/i-rplbl.i}
    
    /* Best default for GUI applications is...                              */
    PAUSE 0 BEFORE-HIDE.
    
    /* Now enable the interface and wait for the exit condition.            */
    /* (NOTE: handle ERROR and END-KEY so cleanup code will always fire.    */
    MAIN-BLOCK:
    DO  ON ERROR   UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
        ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
    
        RUN enable_UI.
        
        {include/i-rpmbl.i}
      
        IF  NOT THIS-PROCEDURE:PERSISTENT THEN
            WAIT-FOR CLOSE OF THIS-PROCEDURE.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    /* **********************  Internal Procedures  *********************** */
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects w-relat  _ADM-CREATE-OBJECTS
    PROCEDURE adm-create-objects :
    /*------------------------------------------------------------------------------
      Purpose:     Create handles for all SmartObjects used in this procedure.
                   After SmartObjects are initialized, then SmartLinks are added.
      Parameters:  <none>
    ------------------------------------------------------------------------------*/
    
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available w-relat  _ADM-ROW-AVAILABLE
    PROCEDURE adm-row-available :
    /*------------------------------------------------------------------------------
      Purpose:     Dispatched to this procedure when the Record-
                   Source has a new row available.  This procedure
                   tries to get the new row (or foriegn keys) from
                   the Record-Source and process it.
      Parameters:  <none>
    ------------------------------------------------------------------------------*/
    
      /* Define variables needed by this internal procedure.             */
      {src/adm/template/row-head.i}
    
      /* Process the newly available records (i.e. display fields,
         open queries, and/or pass records on to any RECORD-TARGETS).    */
      {src/adm/template/row-end.i}
    
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI w-relat  _DEFAULT-DISABLE
    PROCEDURE disable_UI :
    /*------------------------------------------------------------------------------
      Purpose:     DISABLE the User Interface
      Parameters:  <none>
      Notes:       Here we clean-up the user-interface by deleting
                   dynamic widgets we have created and/or hide 
                   frames.  This procedure is usually called when
                   we are ready to "clean-up" after running.
    ------------------------------------------------------------------------------*/
      /* Delete the WINDOW we created */
      IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(w-relat)
      THEN DELETE WIDGET w-relat.
      IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI w-relat  _DEFAULT-ENABLE
    PROCEDURE enable_UI :
    /*------------------------------------------------------------------------------
      Purpose:     ENABLE the User Interface
      Parameters:  <none>
      Notes:       Here we display/view/enable the widgets in the
                   user-interface.  In addition, OPEN all queries
                   associated with each FRAME and BROWSE.
                   These statements here are based on the "Other 
                   Settings" section of the widget Property Sheets.
    ------------------------------------------------------------------------------*/
      ENABLE im-pg-imp im-pg-sel bt-executar bt-cancelar bt-ajuda 
          WITH FRAME f-relat IN WINDOW w-relat.
      {&OPEN-BROWSERS-IN-QUERY-f-relat}
      DISPLAY codigo-- cliente modelo data-p data-e qt-imprimir 
          WITH FRAME f-pg-sel IN WINDOW w-relat.
      ENABLE codigo-- cliente modelo data-p data-e qt-imprimir 
          WITH FRAME f-pg-sel IN WINDOW w-relat.
      {&OPEN-BROWSERS-IN-QUERY-f-pg-sel}
      DISPLAY rs-destino c-arquivo rs-execucao 
          WITH FRAME f-pg-imp IN WINDOW w-relat.
      ENABLE RECT-7 RECT-9 rs-destino bt-arquivo bt-config-impr c-arquivo 
             rs-execucao 
          WITH FRAME f-pg-imp IN WINDOW w-relat.
      {&OPEN-BROWSERS-IN-QUERY-f-pg-imp}
      VIEW w-relat.
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-exit w-relat 
    PROCEDURE local-exit :
    /* -----------------------------------------------------------
      Purpose:  Starts an "exit" by APPLYing CLOSE event, which starts "destroy".
      Parameters:  <none>
      Notes:    If activated, should APPLY CLOSE, *not* dispatch adm-exit.   
    -------------------------------------------------------------*/
       APPLY "CLOSE":U TO THIS-PROCEDURE.
       
       RETURN.
           
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pi-executar w-relat 
    PROCEDURE pi-executar :
    /*------------------------------------------------------------------------------
      Purpose:     
      Parameters:  <none>
      Notes:       
    ------------------------------------------------------------------------------*/
    define var r-tt-digita as rowid no-undo.
    
    do on error undo, return error on stop  undo, return error:
        {include/i-rpexa.i}
        /*14/02/2005 - tech1007 - Alterada condicao para não considerar mai o RTF como destino*/
        if input frame f-pg-imp rs-destino = 2 and
           input frame f-pg-imp rs-execucao = 1 then do:
            run utp/ut-vlarq.p (input input frame f-pg-imp c-arquivo).
            
            if return-value = "NOK":U then do:
                run utp/ut-msgs.p (input "show":U, input 73, input "").
                
                apply "MOUSE-SELECT-CLICK":U to im-pg-imp in frame f-relat.
                apply "ENTRY":U to c-arquivo in frame f-pg-imp.
                return error.
            end.
        end.
    
        /*14/02/2005 - tech1007 - Teste efetuado para nao permitir modelo em branco*/
      /*  &IF "{&RTF}":U = "YES":U &THEN
        IF ( INPUT FRAME f-pg-imp c-modelo-rtf = "" AND
             INPUT FRAME f-pg-imp l-habilitaRtf = "Yes" ) OR
           ( SEARCH(INPUT FRAME f-pg-imp c-modelo-rtf) = ? AND
             input frame f-pg-imp rs-execucao = 1 AND
             INPUT FRAME f-pg-imp l-habilitaRtf = "Yes" )
             THEN DO:
            run utp/ut-msgs.p (input "show":U, input 73, input "").        
            apply "MOUSE-SELECT-CLICK":U to im-pg-imp in frame f-relat.
            /*30/12/2004 - tech1007 - Evento removido pois causa problemas no WebEnabler*/
            /*apply "CHOOSE":U to bt-modelo-rtf in frame f-pg-imp.*/
            return error.
        END.
        &endif */
        /*Fim teste Modelo*/
        
        /*:T Coloque aqui as validações da página de Digitação, lembrando que elas devem
           apresentar uma mensagem de erro cadastrada, posicionar nesta página e colocar
           o focus no campo com problemas */
        /*browse br-digita:SET-REPOSITIONED-ROW (browse br-digita:DOWN, "ALWAYS":U).*/
        
        /*:T Coloque aqui as validações das outras páginas, lembrando que elas devem 
           apresentar uma mensagem de erro cadastrada, posicionar na página com 
           problemas e colocar o focus no campo com problemas */
        
        /*:T Aqui são gravados os campos da temp-table que será passada como parâmetro
           para o programa RP.P */
        
        create tt-param.
        assign tt-param.usuario         = c-seg-usuario
               tt-param.destino         = input frame f-pg-imp rs-destino
               tt-param.data-exec       = today
               tt-param.hora-exec       = time.
        
        /*Alterado 14/02/2005 - tech1007 - Alterado o teste para verificar se a opção de RTF está selecionada*/
        if tt-param.destino = 1 
        then assign tt-param.arquivo = "".
        else if  tt-param.destino = 2
             then assign tt-param.arquivo = input frame f-pg-imp c-arquivo.
             else assign tt-param.arquivo = session:temp-directory + c-programa-mg97 + ".tmp":U.
        /*Fim alteracao 14/02/2005*/
    
        /*:T Coloque aqui a/lógica de gravação dos demais campos que devem ser passados
           como parâmetros para o programa RP.P, através da temp-table tt-param */
    
             /*------------------- Artur------------------------*/ 
    
             ASSIGN tt-param.codigo--     = INPUT FRAME f-pg-sel codigo--   
                    tt-param.cliente      = INPUT FRAME f-pg-sel cliente
                    tt-param.modelo       = INPUT FRAME f-pg-sel modelo 
                    tt-param.data-p       = INPUT FRAME f-pg-sel data-p
                    tt-param.data-e       = INPUT FRAME f-pg-sel data-e
                    tt-param.qt-imprimir  = INPUT FRAME f-pg-sel qt-imprimir.
    
    
    
        
        /*:T Executar do programa RP.P que irá criar o relatório */
        {include/i-rpexb.i}
        
        SESSION:SET-WAIT-STATE("general":U).
        
        {include/i-rprun.i Artur\esp\IBP\FES0004rp.p}
        
        {include/i-rpexc.i}
        
        SESSION:SET-WAIT-STATE("":U).
        
        {include/i-rptrm.i}
    end.
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pi-troca-pagina w-relat 
    PROCEDURE pi-troca-pagina :
    /*:T------------------------------------------------------------------------------
      Purpose: Gerencia a Troca de Página (folder)   
      Parameters:  <none>
      Notes:       
    ------------------------------------------------------------------------------*/
    
    {include/i-rptrp.i}
    
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records w-relat  _ADM-SEND-RECORDS
    PROCEDURE send-records :
    /*------------------------------------------------------------------------------
      Purpose:     Send record ROWID's for all tables used by
                   this file.
      Parameters:  see template/snd-head.i
    ------------------------------------------------------------------------------*/
    
      /* SEND-RECORDS does nothing because there are no External
         Tables specified for this w-relat, and there are no
         tables specified in any contained Browse, Query, or Frame. */
    
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed w-relat 
    PROCEDURE state-changed :
    /* -----------------------------------------------------------
      Purpose:     
      Parameters:  <none>
      Notes:       
    -------------------------------------------------------------*/
      DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
      DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
      
      run pi-trata-state (p-issuer-hdl, p-state).
      
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
  6. mcarril

    mcarril Membro Participativo

    A alteração tem que ser no rp.p !!!
    Tem aí ?

Compartilhe esta Página