d-tabel.w 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. &ANALYZE-SUSPEND _VERSION-NUMBER AB_v9r12 GUI ADM2
  2. &ANALYZE-RESUME
  3. /* Connected Databases
  4. anadat PROGRESS
  5. */
  6. &Scoped-define WINDOW-NAME CURRENT-WINDOW
  7. {adecomm/appserv.i}
  8. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS dTables
  9. /*------------------------------------------------------------------------
  10. File:
  11. Description: from DATA.W - Template For SmartData objects in the ADM
  12. Input Parameters:
  13. <none>
  14. Output Parameters:
  15. <none>
  16. Modified: February 24, 1999
  17. ------------------------------------------------------------------------*/
  18. /* This .W file was created with the Progress AppBuilder. */
  19. /*----------------------------------------------------------------------*/
  20. /* Create an unnamed pool to store all the widgets created
  21. by this procedure. This is a good default which assures
  22. that this procedure's triggers and internal procedures
  23. will execute in this procedure's storage, and that proper
  24. cleanup will occur on deletion of the procedure. */
  25. CREATE WIDGET-POOL.
  26. /* *************************** Definitions ************************** */
  27. /* Parameters Definitions --- */
  28. /* Local Variable Definitions --- */
  29. DEF VAR qOpen AS LOG NO-UNDO INIT FALSE.
  30. DEF VAR xWhere AS CHAR NO-UNDO.
  31. DEF VAR xSort AS CHAR NO-UNDO.
  32. DEF VAR Firma AS CHAR NO-UNDO.
  33. DEF VAR SAktiv AS LOG NO-UNDO INIT FALSE.
  34. DEF VAR RecArt AS CHAR NO-UNDO INIT ''.
  35. DEF VAR CodeI AS INT NO-UNDO INIT 0.
  36. DEF VAR CodeC AS CHAR NO-UNDO INIT ''.
  37. DEF VAR Sprcd AS INT NO-UNDO INIT 1.
  38. DEF VAR Art AS INT NO-UNDO INIT 1.
  39. /* _UIB-CODE-BLOCK-END */
  40. &ANALYZE-RESUME
  41. &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
  42. /* ******************** Preprocessor Definitions ******************** */
  43. &Scoped-define PROCEDURE-TYPE SmartDataObject
  44. &Scoped-define DB-AWARE yes
  45. &Scoped-define ADM-SUPPORTED-LINKS Data-Source,Data-Target,Navigation-Target,Update-Target,Commit-Target,Filter-Target
  46. /* Db-Required definitions. */
  47. &IF DEFINED(DB-REQUIRED) = 0 &THEN
  48. &GLOBAL-DEFINE DB-REQUIRED TRUE
  49. &ENDIF
  50. &GLOBAL-DEFINE DB-REQUIRED-START &IF {&DB-REQUIRED} &THEN
  51. &GLOBAL-DEFINE DB-REQUIRED-END &ENDIF
  52. &Scoped-define QUERY-NAME Query-Main
  53. /* Internal Tables (found by Frame, Query & Browse Queries) */
  54. &Scoped-define INTERNAL-TABLES Tabel
  55. /* Definitions for QUERY Query-Main */
  56. &Scoped-Define ENABLED-FIELDS Firma Sprcd RecArt CodeC CodeI Bez1 Bez2 BezL Int_1 Int_2 Int_3 Dec_1 Dec_2~
  57. Dec_3
  58. &Scoped-define ENABLED-FIELDS-IN-Tabel Firma Sprcd RecArt CodeC CodeI Bez1 ~
  59. Bez2 BezL Int_1 Int_2 Int_3 Dec_1 Dec_2 Dec_3
  60. &Scoped-Define DATA-FIELDS Firma Sprcd RecArt CodeC CodeI Bez1 Bez2 BezL Int_1 Int_2 Int_3 Dec_1 Dec_2~
  61. Dec_3
  62. &Scoped-define DATA-FIELDS-IN-Tabel Firma Sprcd RecArt CodeC CodeI Bez1 ~
  63. Bez2 BezL Int_1 Int_2 Int_3 Dec_1 Dec_2 Dec_3
  64. &Scoped-Define MANDATORY-FIELDS Firma RecArt
  65. &Scoped-Define APPLICATION-SERVICE
  66. &Scoped-Define ASSIGN-LIST
  67. &Scoped-Define DATA-FIELD-DEFS "d-tabel.i"
  68. {&DB-REQUIRED-START}
  69. &Scoped-define OPEN-QUERY-Query-Main OPEN QUERY Query-Main FOR EACH Tabel NO-LOCK INDEXED-REPOSITION.
  70. {&DB-REQUIRED-END}
  71. &Scoped-define TABLES-IN-QUERY-Query-Main Tabel
  72. &Scoped-define FIRST-TABLE-IN-QUERY-Query-Main Tabel
  73. /* Custom List Definitions */
  74. /* List-1,List-2,List-3,List-4,List-5,List-6 */
  75. /* _UIB-PREPROCESSOR-BLOCK-END */
  76. &ANALYZE-RESUME
  77. /* ************************ Function Prototypes ********************** */
  78. {&DB-REQUIRED-START}
  79. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD openQuery dTables _DB-REQUIRED
  80. FUNCTION openQuery RETURNS LOGICAL
  81. ( /* parameter-definitions */ ) FORWARD.
  82. /* _UIB-CODE-BLOCK-END */
  83. &ANALYZE-RESUME
  84. {&DB-REQUIRED-END}
  85. /* *********************** Control Definitions ********************** */
  86. {&DB-REQUIRED-START}
  87. /* Query definitions */
  88. &ANALYZE-SUSPEND
  89. DEFINE QUERY Query-Main FOR
  90. Tabel SCROLLING.
  91. &ANALYZE-RESUME
  92. {&DB-REQUIRED-END}
  93. /* ************************ Frame Definitions *********************** */
  94. /* *********************** Procedure Settings ************************ */
  95. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  96. /* Settings for THIS-PROCEDURE
  97. Type: SmartDataObject
  98. Allow: Query
  99. Frames: 0
  100. Add Fields to: Neither
  101. Other Settings: PERSISTENT-ONLY COMPILE APPSERVER DB-AWARE
  102. */
  103. /* This procedure should always be RUN PERSISTENT. Report the error, */
  104. /* then cleanup and return. */
  105. IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
  106. MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
  107. VIEW-AS ALERT-BOX ERROR BUTTONS OK.
  108. RETURN.
  109. END.
  110. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  111. /* ************************* Create Window ************************** */
  112. &ANALYZE-SUSPEND _CREATE-WINDOW
  113. /* DESIGN Window definition (used by the UIB)
  114. CREATE WINDOW dTables ASSIGN
  115. HEIGHT = 1.62
  116. WIDTH = 46.6.
  117. /* END WINDOW DEFINITION */
  118. */
  119. &ANALYZE-RESUME
  120. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB dTables
  121. /* ************************* Included-Libraries *********************** */
  122. {src/adm2/data.i}
  123. /* _UIB-CODE-BLOCK-END */
  124. &ANALYZE-RESUME
  125. /* *********** Runtime Attributes and AppBuilder Settings *********** */
  126. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  127. /* SETTINGS FOR WINDOW dTables
  128. VISIBLE,,RUN-PERSISTENT */
  129. /* _RUN-TIME-ATTRIBUTES-END */
  130. &ANALYZE-RESUME
  131. /* Setting information for Queries and Browse Widgets fields */
  132. &ANALYZE-SUSPEND _QUERY-BLOCK QUERY Query-Main
  133. /* Query rebuild information for SmartDataObject Query-Main
  134. _TblList = "AnaDat.Tabel"
  135. _Options = "NO-LOCK INDEXED-REPOSITION"
  136. _FldNameList[1] > AnaDat.Tabel.Firma
  137. "Firma" "Firma" ? ? "character" ? ? ? ? ? ? yes ? yes 8 yes
  138. _FldNameList[2] > AnaDat.Tabel.Sprcd
  139. "Sprcd" "Sprcd" ? ? "integer" ? ? ? ? ? ? yes ? no 5.6 yes
  140. _FldNameList[3] > AnaDat.Tabel.Recart
  141. "Recart" "RecArt" ? ? "character" ? ? ? ? ? ? yes ? yes 12 yes
  142. _FldNameList[4] > AnaDat.Tabel.CodeC
  143. "CodeC" "CodeC" ? ? "character" ? ? ? ? ? ? yes ? no 8 yes
  144. _FldNameList[5] > AnaDat.Tabel.CodeI
  145. "CodeI" "CodeI" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes
  146. _FldNameList[6] > AnaDat.Tabel.Bez1
  147. "Bez1" "Bez1" ? ? "character" ? ? ? ? ? ? yes ? no 30 yes
  148. _FldNameList[7] > AnaDat.Tabel.Bez2
  149. "Bez2" "Bez2" ? ? "character" ? ? ? ? ? ? yes ? no 30 yes
  150. _FldNameList[8] > AnaDat.Tabel.BezL
  151. "BezL" "BezL" ? ? "character" ? ? ? ? ? ? yes ? no 80 yes
  152. _FldNameList[9] > AnaDat.Tabel.Int_1
  153. "Int_1" "Int_1" ? "zzz,zz9-" "integer" ? ? ? ? ? ? yes ? no 7.4 yes
  154. _FldNameList[10] > AnaDat.Tabel.Int_2
  155. "Int_2" "Int_2" ? "zzz,zz9-" "integer" ? ? ? ? ? ? yes ? no 7.4 yes
  156. _FldNameList[11] > AnaDat.Tabel.Int_3
  157. "Int_3" "Int_3" ? "zzz,zz9-" "integer" ? ? ? ? ? ? yes ? no 7.4 yes
  158. _FldNameList[12] > AnaDat.Tabel.Dec_1
  159. "Dec_1" "Dec_1" ? "zzz,zz9.99-" "decimal" ? ? ? ? ? ? yes ? no 10.4 yes
  160. _FldNameList[13] > AnaDat.Tabel.Dec_2
  161. "Dec_2" "Dec_2" ? "zzz,zz9.99-" "decimal" ? ? ? ? ? ? yes ? no 10.4 yes
  162. _FldNameList[14] > AnaDat.Tabel.Dec_3
  163. "Dec_3" "Dec_3" ? "zzz,zz9.99-" "decimal" ? ? ? ? ? ? yes ? no 10.4 yes
  164. _Design-Parent is WINDOW dTables @ ( 1.14 , 2.6 )
  165. */ /* QUERY Query-Main */
  166. &ANALYZE-RESUME
  167. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK dTables
  168. /* *************************** Main Block *************************** */
  169. SAktiv = DYNAMIC-FUNCTION('getSuperAktiv':U) NO-ERROR.
  170. IF SAktiv THEN DO:
  171. Firma = DYNAMIC-FUNCTION('GETMANDANT':U) NO-ERROR.
  172. END.
  173. RUN SET_QUERY_STRING ( INPUT Firma, INPUT Sprcd, INPUT RecArt, INPUT Art ).
  174. &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
  175. RUN initializeObject.
  176. &ENDIF
  177. /* _UIB-CODE-BLOCK-END */
  178. &ANALYZE-RESUME
  179. /* ********************** Internal Procedures *********************** */
  180. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI dTables _DEFAULT-DISABLE
  181. PROCEDURE disable_UI :
  182. /*------------------------------------------------------------------------------
  183. Purpose: DISABLE the User Interface
  184. Parameters: <none>
  185. Notes: Here we clean-up the user-interface by deleting
  186. dynamic widgets we have created and/or hide
  187. frames. This procedure is usually called when
  188. we are ready to "clean-up" after running.
  189. ------------------------------------------------------------------------------*/
  190. /* Hide all frames. */
  191. IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
  192. END PROCEDURE.
  193. /* _UIB-CODE-BLOCK-END */
  194. &ANALYZE-RESUME
  195. {&DB-REQUIRED-START}
  196. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_QUERY_STRING dTables _DB-REQUIRED
  197. PROCEDURE SET_QUERY_STRING :
  198. /*------------------------------------------------------------------------------
  199. Purpose:
  200. Parameters: <none>
  201. Notes:
  202. ------------------------------------------------------------------------------*/
  203. DEF INPUT PARAMETER ipFirma AS CHAR NO-UNDO.
  204. DEF INPUT PARAMETER ipSprcd AS INT NO-UNDO.
  205. DEF INPUT PARAMETER ipRecArt AS CHAR NO-UNDO.
  206. DEF INPUT PARAMETER ipArt AS INT NO-UNDO.
  207. ASSIGN Firma = ipFirma
  208. Sprcd = ipSprcd
  209. RecArt = ipRecArt
  210. Art = ipArt.
  211. CASE Art:
  212. WHEN 1 THEN DO:
  213. xWhere = 'FOR EACH Tabel USE-INDEX Tabel-k2'
  214. + ' WHERE Tabel.Firma = "' + Firma + '"'
  215. + ' AND Tabel.RecArt = "' + RecArt + '"'
  216. + ' AND Tabel.Sprcd = ' + STRING(Sprcd)
  217. + ' NO-LOCK BY Tabel.Bez1 INDEXED-REPOSITION '.
  218. END.
  219. WHEN 2 THEN DO:
  220. xWhere = 'FOR EACH Tabel USE-INDEX Tabel-k1'
  221. + ' WHERE Tabel.Firma = "' + Firma + '"'
  222. + ' AND Tabel.RecArt = "' + RecArt + '"'
  223. + ' AND Tabel.Sprcd = ' + STRING(Sprcd)
  224. + ' NO-LOCK BY Tabel.Bez1 INDEXED-REPOSITION '.
  225. END.
  226. END CASE.
  227. DYNAMIC-FUNCTION('setQueryString':U, INPUT xWhere) NO-ERROR.
  228. qOpen = TRUE.
  229. DYNAMIC-FUNCTION('openQuery':U) NO-ERROR.
  230. END PROCEDURE.
  231. /* _UIB-CODE-BLOCK-END */
  232. &ANALYZE-RESUME
  233. {&DB-REQUIRED-END}
  234. /* ************************ Function Implementations ***************** */
  235. {&DB-REQUIRED-START}
  236. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION openQuery dTables _DB-REQUIRED
  237. FUNCTION openQuery RETURNS LOGICAL
  238. ( /* parameter-definitions */ ) :
  239. /*------------------------------------------------------------------------------
  240. Purpose: Super Override
  241. Notes:
  242. ------------------------------------------------------------------------------*/
  243. IF qOpen = FALSE THEN RETURN FALSE.
  244. /* xWhere = ''. */
  245. /* DYNAMIC-FUNCTION('setQueryWhere':U, INPUT xWhere). */
  246. /* xSort = ''. */
  247. /* DYNAMIC-FUNCTION('setQuerySort':U, INPUT xSort). */
  248. /* xWhere = ''. */
  249. /* DYNAMIC-FUNCTION('setQueryString':U, INPUT xWhere). */
  250. qOpen = FALSE.
  251. RETURN SUPER( ).
  252. END FUNCTION.
  253. /* _UIB-CODE-BLOCK-END */
  254. &ANALYZE-RESUME
  255. {&DB-REQUIRED-END}