| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501 |
- &ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI ADM2
- &ANALYZE-RESUME
- /* Connected Databases
- anadat PROGRESS
- */
- &Scoped-define WINDOW-NAME CURRENT-WINDOW
- {adecomm/appserv.i}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS dTables
- /*------------------------------------------------------------------------
- File:
- Description: from DATA.W - Template For SmartData objects in the ADM
- Input Parameters:
- <none>
- Output Parameters:
- <none>
- Modified: February 24, 1999
- ------------------------------------------------------------------------*/
- /* 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 --- */
- DEF VAR iKnr AS INT NO-UNDO.
- &SCOPED-DEFINE Tabelle Artbw
- &SCOPED-DEFINE TabWhere /* USE-INDEX Benutzer-k1 ~
- WHERE {&Tabelle}.Benutzer = tRowObject.Benutzer
- */
- { incl/datdefinition.i }
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
- /* ******************** Preprocessor Definitions ******************** */
- &Scoped-define PROCEDURE-TYPE SmartDataObject
- &Scoped-define DB-AWARE yes
- &Scoped-define ADM-SUPPORTED-LINKS Data-Source,Data-Target,Navigation-Target,Update-Target,Commit-Target,Filter-Target
- /* Db-Required definitions. */
- &IF DEFINED(DB-REQUIRED) = 0 &THEN
- &GLOBAL-DEFINE DB-REQUIRED TRUE
- &ENDIF
- &GLOBAL-DEFINE DB-REQUIRED-START &IF {&DB-REQUIRED} &THEN
- &GLOBAL-DEFINE DB-REQUIRED-END &ENDIF
- &Scoped-define QUERY-NAME Query-Main
- /* Internal Tables (found by Frame, Query & Browse Queries) */
- &Scoped-define INTERNAL-TABLES Artbw
- /* Definitions for QUERY Query-Main */
- &Scoped-Define ENABLED-FIELDS Artnr Inhalt Jahr Bez1 Datum Menge VGeb_Me GGeb_Me Rab_Art Rab_Wert Aktion~
- Preis Net_Betr Aufnr Faknr Fak_Dat DokNr Lag_Buch
- &Scoped-define ENABLED-FIELDS-IN-Artbw Artnr Inhalt Jahr Bez1 Datum Menge ~
- VGeb_Me GGeb_Me Rab_Art Rab_Wert Aktion Preis Net_Betr Aufnr Faknr Fak_Dat ~
- Lag_Buch
- &Scoped-Define DATA-FIELDS Artnr Inhalt Jahr Bez1 Datum Menge VGeb_Me GGeb_Me Rab_Art Rab_Wert Aktion~
- Preis Net_Betr Aufnr Faknr Fak_Dat DokNr Lag_Buch
- &Scoped-define DATA-FIELDS-IN-Artbw Artnr Inhalt Jahr Bez1 Datum Menge ~
- VGeb_Me GGeb_Me Rab_Art Rab_Wert Aktion Preis Net_Betr Aufnr Faknr Fak_Dat ~
- Lag_Buch
- &Scoped-Define MANDATORY-FIELDS
- &Scoped-Define APPLICATION-SERVICE
- &Scoped-Define ASSIGN-LIST
- &Scoped-Define DATA-FIELD-DEFS "d-kunbw.i"
- &Scoped-define QUERY-STRING-Query-Main FOR EACH Artbw NO-LOCK INDEXED-REPOSITION
- {&DB-REQUIRED-START}
- &Scoped-define OPEN-QUERY-Query-Main OPEN QUERY Query-Main FOR EACH Artbw NO-LOCK INDEXED-REPOSITION.
- {&DB-REQUIRED-END}
- &Scoped-define TABLES-IN-QUERY-Query-Main Artbw
- &Scoped-define FIRST-TABLE-IN-QUERY-Query-Main Artbw
- /* Custom List Definitions */
- /* List-1,List-2,List-3,List-4,List-5,List-6 */
- /* _UIB-PREPROCESSOR-BLOCK-END */
- &ANALYZE-RESUME
- /* ************************ Function Prototypes ********************** */
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD openQuery dTables _DB-REQUIRED
- FUNCTION openQuery RETURNS LOGICAL
- ( /* parameter-definitions */ ) FORWARD.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- /* *********************** Control Definitions ********************** */
- {&DB-REQUIRED-START}
- /* Query definitions */
- &ANALYZE-SUSPEND
- DEFINE QUERY Query-Main FOR
- Artbw SCROLLING.
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- /* ************************ Frame Definitions *********************** */
- /* *********************** Procedure Settings ************************ */
- &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
- /* Settings for THIS-PROCEDURE
- Type: SmartDataObject
- Allow: Query
- Frames: 0
- Add Fields to: Neither
- Other Settings: PERSISTENT-ONLY COMPILE APPSERVER DB-AWARE
- */
- /* This procedure should always be RUN PERSISTENT. Report the error, */
- /* then cleanup and return. */
- IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
- MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
- VIEW-AS ALERT-BOX ERROR BUTTONS OK.
- RETURN.
- END.
- &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
- /* ************************* Create Window ************************** */
- &ANALYZE-SUSPEND _CREATE-WINDOW
- /* DESIGN Window definition (used by the UIB)
- CREATE WINDOW dTables ASSIGN
- HEIGHT = 1.62
- WIDTH = 56.4.
- /* END WINDOW DEFINITION */
- */
- &ANALYZE-RESUME
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB dTables
- /* ************************* Included-Libraries *********************** */
- {src/adm2/data.i}
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- /* *********** Runtime Attributes and AppBuilder Settings *********** */
- &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
- /* SETTINGS FOR WINDOW dTables
- VISIBLE,,RUN-PERSISTENT */
- /* _RUN-TIME-ATTRIBUTES-END */
- &ANALYZE-RESUME
- /* Setting information for Queries and Browse Widgets fields */
- &ANALYZE-SUSPEND _QUERY-BLOCK QUERY Query-Main
- /* Query rebuild information for SmartDataObject Query-Main
- _TblList = "AnaDat.Artbw"
- _Options = "NO-LOCK INDEXED-REPOSITION"
- _FldNameList[1] > AnaDat.Artbw.Artnr
- "Artnr" "Artnr" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes ""
- _FldNameList[2] > AnaDat.Artbw.Inhalt
- "Inhalt" "Inhalt" ? ? "integer" ? ? ? ? ? ? yes ? no 5.2 yes ""
- _FldNameList[3] > AnaDat.Artbw.Jahr
- "Jahr" "Jahr" ? ? "integer" ? ? ? ? ? ? yes ? no 4.8 yes ""
- _FldNameList[4] > AnaDat.Artbw.Bez1
- "Bez1" "Bez1" ? ? "character" ? ? ? ? ? ? yes ? no 30 yes ""
- _FldNameList[5] > AnaDat.Artbw.Datum
- "Datum" "Datum" ? ? "date" ? ? ? ? ? ? yes ? no 10.8 yes ""
- _FldNameList[6] > AnaDat.Artbw.Menge
- "Menge" "Menge" ? ? "decimal" ? ? ? ? ? ? yes ? no 8.8 yes ""
- _FldNameList[7] > AnaDat.Artbw.VGeb_Me
- "VGeb_Me" "VGeb_Me" ? "zzz9.99-" "decimal" ? ? ? ? ? ? yes ? no 9.6 yes ""
- _FldNameList[8] > AnaDat.Artbw.GGeb_Me
- "GGeb_Me" "GGeb_Me" ? "zz9.99-" "decimal" ? ? ? ? ? ? yes ? no 9.8 yes ""
- _FldNameList[9] > AnaDat.Artbw.Rab_Art
- "Rab_Art" "Rab_Art" ? ? "integer" ? ? ? ? ? ? yes ? no 7.8 yes ""
- _FldNameList[10] > AnaDat.Artbw.Rab_Wert
- "Rab_Wert" "Rab_Wert" ? "zz9.999-" "decimal" ? ? ? ? ? ? yes ? no 9.8 yes ""
- _FldNameList[11] > AnaDat.Artbw.Aktion
- "Aktion" "Aktion" ? "J/N" "logical" ? ? ? ? ? ? yes ? no 6 yes ""
- _FldNameList[12] > AnaDat.Artbw.Preis
- "Preis" "Preis" ? "zzz9.999" "decimal" ? ? ? ? ? ? yes ? no 8.4 yes ""
- _FldNameList[13] > AnaDat.Artbw.Net_Betr
- "Net_Betr" "Net_Betr" ? "zzz,zz9.999-" "decimal" ? ? ? ? ? ? yes ? no 11.6 yes ""
- _FldNameList[14] > AnaDat.Artbw.Aufnr
- "Aufnr" "Aufnr" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes ""
- _FldNameList[15] > AnaDat.Artbw.Faknr
- "Faknr" "Faknr" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes ""
- _FldNameList[16] > AnaDat.Artbw.Fak_Dat
- "Fak_Dat" "Fak_Dat" ? ? "date" ? ? ? ? ? ? yes ? no 10.8 yes ""
- _FldNameList[17] > "_<CALC>"
- "IF (RowObject.Faknr > 0) THEN ('F' + TRIM(STRING(RowObject.Faknr,'zzzz999999'))) ELSE ('A' + TRIM(STRING(RowObject.Aufnr,'zzzz999999')))" "DokNr" "DokNr" "x(8)" "character" ? ? ? ? ? ? yes ? no 8 no ?
- _FldNameList[18] > AnaDat.Artbw.Lag_Buch
- "Lag_Buch" "Lag_Buch" ? ? "logical" ? ? ? ? ? ? yes ? no 9.8 yes ?
- _Design-Parent is WINDOW dTables @ ( 1.14 , 2.6 )
- */ /* QUERY Query-Main */
- &ANALYZE-RESUME
-
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK dTables
- /* *************************** Main Block *************************** */
- { incl/datmainblock.i }
- fOpen = FALSE.
- &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
- RUN initializeObject.
- &ENDIF
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- /* ********************** Internal Procedures *********************** */
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE DATA.CALCULATE dTables DATA.CALCULATE _DB-REQUIRED
- PROCEDURE DATA.CALCULATE :
- /*------------------------------------------------------------------------------
- Purpose: Calculate all the Calculated Expressions found in the
- SmartDataObject.
- Parameters: <none>
- ------------------------------------------------------------------------------*/
- ASSIGN
- rowObject.DokNr = (IF (RowObject.Faknr > 0) THEN ('F' + TRIM(STRING(RowObject.Faknr,'zzzz999999'))) ELSE ('A' + TRIM(STRING(RowObject.Aufnr,'zzzz999999'))))
- .
- END PROCEDURE.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE dataAvailable dTables _DB-REQUIRED
- PROCEDURE dataAvailable :
- /*------------------------------------------------------------------------------
- Purpose: Super Override
- Parameters:
- Notes:
- ------------------------------------------------------------------------------*/
- { incl/datdataavailable.i }
- END PROCEDURE.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI dTables _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.
- ------------------------------------------------------------------------------*/
- /* Hide all frames. */
- IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
- END PROCEDURE.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE initializeObject dTables _DB-REQUIRED
- PROCEDURE initializeObject :
- /*------------------------------------------------------------------------------
- Purpose: Super Override
- Parameters:
- Notes:
- ------------------------------------------------------------------------------*/
- { incl/datinitialize.i }
- END PROCEDURE.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REPOS dTables _DB-REQUIRED
- PROCEDURE REPOS :
- /*------------------------------------------------------------------------------
- Purpose:
- Parameters: <none>
- Notes:
- ------------------------------------------------------------------------------*/
- DEF INPUT PARAMETER ipRecid AS RECID NO-UNDO.
- FIND Artbw WHERE RECID(Artbw) = ipRecid NO-LOCK NO-ERROR.
- IF NOT AVAILABLE Artbw THEN RETURN.
- DYNAMIC-FUNCTION('fetchRowIdent':U, INPUT STRING(ROWID(Artbw)), INPUT ? ).
- END PROCEDURE.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REPOS_TABELLE dTables _DB-REQUIRED
- PROCEDURE REPOS_TABELLE :
- /*------------------------------------------------------------------------------
- Purpose:
- Parameters: <none>
- Notes:
- ------------------------------------------------------------------------------*/
- { incl/datrepos.i }
- END PROCEDURE.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_FILTER dTables _DB-REQUIRED
- PROCEDURE SET_FILTER :
- /*------------------------------------------------------------------------------
- Purpose:
- Parameters: <none>
- Notes:
- ------------------------------------------------------------------------------*/
- { incl/datsetfilter.i }
- END PROCEDURE.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_OPENFLAG dTables _DB-REQUIRED
- PROCEDURE SET_OPENFLAG :
- /*------------------------------------------------------------------------------
- Purpose:
- Parameters: <none>
- Notes:
- ------------------------------------------------------------------------------*/
- { incl/datsetopenflag.i }
- END PROCEDURE.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_SORT dTables _DB-REQUIRED
- PROCEDURE SET_SORT :
- /*------------------------------------------------------------------------------
- Purpose:
- Parameters: <none>
- Notes:
- ------------------------------------------------------------------------------*/
- { incl/datsetsort.i }
- END PROCEDURE.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
- /* ************************ Function Implementations ***************** */
- {&DB-REQUIRED-START}
- &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION openQuery dTables _DB-REQUIRED
- FUNCTION openQuery RETURNS LOGICAL
- ( /* parameter-definitions */ ) :
- /*------------------------------------------------------------------------------
- Purpose: Super Override
- Notes:
- ------------------------------------------------------------------------------*/
- DEF VAR Felder AS CHAR NO-UNDO.
- DEF VAR Inhalt AS CHAR NO-UNDO.
- DEF VAR ix AS INT NO-UNDO.
- DEF VAR cFeld AS CHAR NO-UNDO.
- DEF VAR lVerkauf AS LOG NO-UNDO.
- DEF VAR lEinkauf AS LOG NO-UNDO.
- DEF VAR iVonArt AS INT NO-UNDO.
- DEF VAR iBisArt AS INT NO-UNDO.
- IF NOT fOpen THEN RETURN FALSE.
- xWhere = ''.
- xSort = ''.
- xString = ''.
- Felder = DYNAMIC-FUNCTION('getForeignFields':U) NO-ERROR.
- Inhalt = DYNAMIC-FUNCTION('getForeignValues':U) NO-ERROR.
-
- iVonArt = 1.
- iBisArt = 20.
- lVerkauf = DYNAMIC-FUNCTION('getHistorieVerkaeufe':U) NO-ERROR.
- lEinkauf = DYNAMIC-FUNCTION('getHistorieEinkaeufe':U) NO-ERROR.
-
- IF NOT lEinkauf THEN iBisArt = 10.
- IF NOT lVerkauf THEN iVonArt = 11.
- ix = LOOKUP('Knr', Felder, ',') / 2.
- iKnr = INTEGER(ENTRY (ix, Inhalt, CHR(01))).
- /* xWhere = 'Aufko.Firma = ' + QUOTER(Firma) + ' AND ' */
- /* + 'Aufko.Auf_Sta = ' + STRING(Auf_Sta) + ' '. */
- xString = 'FOR EACH Artbw WHERE Artbw.Firma = "&1" '
- + 'AND Artbw.Knr = &2 '
- + 'AND Artbw.Tr_Art >= &3 '
- + 'AND Artbw.Tr_Art <= &4 '.
- xString = SUBSTITUTE(xString, Firma, iKnr, iVonArt, iBisArt ).
- xString = xString + ' NO-LOCK INDEXED-REPOSITION '.
-
- IF cSort = '' THEN DO:
- cSort = 'Datum'.
- fDesc = TRUE.
- END.
- { incl/datopenquery.i }
- IF xWhere <> '' THEN DYNAMIC-FUNCTION('setQueryWhere':U , INPUT xWhere ).
- IF xString <> '' THEN DYNAMIC-FUNCTION('setQueryString':U, INPUT xString).
- IF LOOKUP('Datum', xSort, ',') = 0 THEN DO:
- xSort = xSort + ' BY Datum DESCENDING '.
- END.
- IF xSort <> '' THEN DYNAMIC-FUNCTION('setQuerySort':U , INPUT xSort ).
- RETURN SUPER( ).
- END FUNCTION.
- /* _UIB-CODE-BLOCK-END */
- &ANALYZE-RESUME
- {&DB-REQUIRED-END}
|