&ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI ADM2 &ANALYZE-RESUME &Scoped-define WINDOW-NAME CURRENT-WINDOW &Scoped-define FRAME-NAME gTReorgPreise {adecomm/appserv.i} &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS gTReorgPreise /*------------------------------------------------------------------------ File: Description: from cntnrdlg.w - ADM2 SmartDialog Template Input Parameters: Output Parameters: Author: Created: ------------------------------------------------------------------------*/ /* This .W file was created with the Progress AppBuilder. */ /*----------------------------------------------------------------------*/ /* 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 ************************** */ /* Parameters Definitions --- */ /* Local Variable Definitions --- */ { incl/dlgdefinition.i } { src/adm2/widgetprto.i } /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK /* ******************** Preprocessor Definitions ******************** */ &Scoped-define PROCEDURE-TYPE SmartDialog &Scoped-define DB-AWARE no &Scoped-define ADM-CONTAINER DIALOG-BOX &Scoped-define ADM-SUPPORTED-LINKS Data-Target,Data-Source,Page-Target,Update-Source,Update-Target /* Name of designated FRAME-NAME and/or first browse and/or first query */ &Scoped-define FRAME-NAME gTReorgPreise /* Standard List Definitions */ &Scoped-Define ENABLED-OBJECTS RECT-2 F_bisDatum Btn_OK Btn_Cancel &Scoped-Define DISPLAYED-OBJECTS F_bisDatum /* Custom List Definitions */ /* List-1,List-2,List-3,List-4,List-5,List-6 */ /* _UIB-PREPROCESSOR-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "SmartDialogCues" gTReorgPreise _INLINE /* Actions: adecomm/_so-cue.w ? adecomm/_so-cued.p ? adecomm/_so-cuew.p */ /* SmartDialog,ab,49267 Destroy on next read */ /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME /* *********************** Control Definitions ********************** */ /* Define a dialog box */ /* Definitions of the field level widgets */ DEFINE BUTTON Btn_Cancel AUTO-END-KEY LABEL "abbrechen" SIZE 15 BY 1. DEFINE BUTTON Btn_OK AUTO-GO LABEL "OK" SIZE 15 BY 1. DEFINE VARIABLE F_bisDatum AS DATE FORMAT "99.99.9999":U INITIAL ? LABEL "bis gültig ab Datum" VIEW-AS FILL-IN NATIVE SIZE 16 BY 1 BGCOLOR 15 NO-UNDO. DEFINE RECTANGLE RECT-2 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL SIZE 60 BY 4. /* ************************ Frame Definitions *********************** */ DEFINE FRAME gTReorgPreise F_bisDatum AT ROW 2 COL 30 COLON-ALIGNED WIDGET-ID 4 Btn_OK AT ROW 6 COL 13.8 Btn_Cancel AT ROW 6 COL 35 "alle inaktiven Preise werden definitiv gelöscht" VIEW-AS TEXT SIZE 54 BY 1 AT ROW 4 COL 6 WIDGET-ID 6 BGCOLOR 12 FONT 6 RECT-2 AT ROW 1.48 COL 3 WIDGET-ID 2 SPACE(1.99) SKIP(2.32) WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER SIDE-LABELS NO-UNDERLINE THREE-D SCROLLABLE TITLE "Löschen von inaktiven Preisen" CANCEL-BUTTON Btn_Cancel WIDGET-ID 100. /* *********************** Procedure Settings ************************ */ &ANALYZE-SUSPEND _PROCEDURE-SETTINGS /* Settings for THIS-PROCEDURE Type: SmartDialog Allow: Basic,Browse,DB-Fields,Query,Smart Container Links: Data-Target,Data-Source,Page-Target,Update-Source,Update-Target Design Page: 1 Other Settings: COMPILE APPSERVER */ &ANALYZE-RESUME _END-PROCEDURE-SETTINGS &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB gTReorgPreise /* ************************* Included-Libraries *********************** */ {src/adm2/containr.i} /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME /* *********** Runtime Attributes and AppBuilder Settings *********** */ &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES /* SETTINGS FOR DIALOG-BOX gTReorgPreise FRAME-NAME */ ASSIGN FRAME gTReorgPreise:SCROLLABLE = FALSE FRAME gTReorgPreise:HIDDEN = TRUE. /* _RUN-TIME-ATTRIBUTES-END */ &ANALYZE-RESUME /* Setting information for Queries and Browse Widgets fields */ &ANALYZE-SUSPEND _QUERY-BLOCK DIALOG-BOX gTReorgPreise /* Query rebuild information for DIALOG-BOX gTReorgPreise _Options = "SHARE-LOCK" _Query is NOT OPENED */ /* DIALOG-BOX gTReorgPreise */ &ANALYZE-RESUME /* ************************ Control Triggers ************************ */ &Scoped-define SELF-NAME gTReorgPreise &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL gTReorgPreise gTReorgPreise ON END-ERROR OF FRAME gTReorgPreise /* Löschen von inaktiven Preisen */ DO: RUN ENDE. RETURN NO-APPLY. END. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL gTReorgPreise gTReorgPreise ON WINDOW-CLOSE OF FRAME gTReorgPreise /* Löschen von inaktiven Preisen */ DO: RUN ENDE. RETURN NO-APPLY. END. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &Scoped-define SELF-NAME Btn_Cancel &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_Cancel gTReorgPreise ON CHOOSE OF Btn_Cancel IN FRAME gTReorgPreise /* abbrechen */ DO: RUN ENDE. RETURN NO-APPLY. END. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &Scoped-define SELF-NAME Btn_OK &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_OK gTReorgPreise ON CHOOSE OF Btn_OK IN FRAME gTReorgPreise /* OK */ DO: btnOK = TRUE. ASSIGN F_bisDatum NO-ERROR. IF ERROR-STATUS:ERROR THEN DO: APPLY 'ENTRY' TO F_bisDatum. RETURN NO-APPLY. END. IF F_bisDatum > (TODAY - 30) THEN DO: APPLY 'ENTRY' TO F_bisDatum. RETURN NO-APPLY. END. SESSION:SET-WAIT-STATE('GENERAL'). RUN LOESCHEN. SESSION:SET-WAIT-STATE(''). RUN ENDE. RETURN NO-APPLY. END. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &UNDEFINE SELF-NAME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK gTReorgPreise /* *************************** Main Block *************************** */ { incl/dlgmainblock.i } {src/adm2/dialogmn.i} /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME /* ********************** Internal Procedures *********************** */ &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects gTReorgPreise _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: ------------------------------------------------------------------------------*/ END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI gTReorgPreise _DEFAULT-DISABLE PROCEDURE disable_UI : /*------------------------------------------------------------------------------ Purpose: DISABLE the User Interface Parameters: 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. ------------------------------------------------------------------------------*/ /* Hide all frames. */ HIDE FRAME gTReorgPreise. END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enableObject gTReorgPreise PROCEDURE enableObject : /*------------------------------------------------------------------------------ Purpose: Super Override Parameters: Notes: ------------------------------------------------------------------------------*/ F_bisDatum = TODAY - 60. { incl/dlgenableobject.i } END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI gTReorgPreise _DEFAULT-ENABLE PROCEDURE enable_UI : /*------------------------------------------------------------------------------ Purpose: ENABLE the User Interface Parameters: 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. ------------------------------------------------------------------------------*/ DISPLAY F_bisDatum WITH FRAME gTReorgPreise. ENABLE RECT-2 F_bisDatum Btn_OK Btn_Cancel WITH FRAME gTReorgPreise. VIEW FRAME gTReorgPreise. {&OPEN-BROWSERS-IN-QUERY-gTReorgPreise} END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE ENDE gTReorgPreise PROCEDURE ENDE : /*------------------------------------------------------------------------------ Purpose: Parameters: Notes: ------------------------------------------------------------------------------*/ IF btnOK THEN DO: END. { incl/dlgende.i } END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE LOESCHEN gTReorgPreise PROCEDURE LOESCHEN : /*------------------------------------------------------------------------------ Purpose: Parameters: Notes: ------------------------------------------------------------------------------*/ FOR EACH ArtPreis WHERE ArtPreis.Firma = Firma AND ArtPreis.Aktiv = FALSE AND ArtPreis.ab_Datum <= F_bisDatum : IF ArtPreis.Aktion THEN DO: FIND AktPreis WHERE AktPreis.Firma = ArtPreis.Firma AND AktPreis.Artnr = ArtPreis.Artnr AND AktPreis.Inhalt = ArtPreis.Inhalt AND AktPreis.Jahr = ArtPreis.Jahr AND AktPreis.ab_Datum = ArtPreis.ab_Datum AND AktPreis.Grp = ArtPreis.Preis_Grp NO-ERROR. IF AVAILABLE AktPreis THEN DELETE AktPreis. END. DELETE ArtPreis. END. FOR EACH AktPreis WHERE AktPreis.Firma = ArtPreis.Firma AND AktPreis.bis_Datum <= F_bisDatum: FIND ArtPreis WHERE ArtPreis.Firma = AktPreis.Firma AND ArtPreis.Artnr = AktPreis.Artnr AND ArtPreis.Inhalt = AktPreis.Inhalt AND ArtPreis.Jahr = AktPreis.Jahr AND ArtPreis.ab_Datum = AktPreis.ab_Datum AND ArtPreis.Preis_Grp = AktPreis.Grp NO-ERROR. IF AVAILABLE ArtPreis THEN NEXT. DELETE AktPreis. END. END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME