d-hogauser.w 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. &ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 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. DEFINE VARIABLE cRecArt AS CHARACTER NO-UNDO INIT 'HOGAUSER'.
  30. DEFINE VARIABLE iHogaGrp AS INTEGER NO-UNDO INIT 1.
  31. &SCOPED-DEFINE Tabelle Tabel
  32. &SCOPED-DEFINE TabWhere USE-INDEX Tabel-k1 ~
  33. WHERE {&Tabelle}.Firma = tRowObject.Firma ~
  34. AND {&Tabelle}.RecArt = tRowObject.RecArt ~
  35. AND {&Tabelle}.CodeC = tRowObject.CodeC ~
  36. AND {&Tabelle}.CodeI = tRowObject.CodeI ~
  37. And {&Tabelle}.Sprcd = tRowObject.Sprcd
  38. { incl/datdefinition.i }
  39. /* _UIB-CODE-BLOCK-END */
  40. &ANALYZE-RESUME
  41. &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
  42. /* ******************** Preprocessor Definitions ******************** */
  43. &Global-define DATA-LOGIC-PROCEDURE .p
  44. &Scoped-define PROCEDURE-TYPE SmartDataObject
  45. &Scoped-define DB-AWARE yes
  46. &Scoped-define ADM-SUPPORTED-LINKS Data-Source,Data-Target,Navigation-Target,Update-Target,Commit-Target,Filter-Target
  47. /* Db-Required definitions. */
  48. &IF DEFINED(DB-REQUIRED) = 0 &THEN
  49. &GLOBAL-DEFINE DB-REQUIRED TRUE
  50. &ENDIF
  51. &GLOBAL-DEFINE DB-REQUIRED-START &IF {&DB-REQUIRED} &THEN
  52. &GLOBAL-DEFINE DB-REQUIRED-END &ENDIF
  53. &Scoped-define QUERY-NAME Query-Main
  54. /* Internal Tables (found by Frame, Query & Browse Queries) */
  55. &Scoped-define INTERNAL-TABLES Tabel
  56. /* Definitions for QUERY Query-Main */
  57. &Scoped-Define ENABLED-FIELDS Firma Recart CodeC CodeI Sprcd Int_1 Flag_1 Kunde Int_2
  58. &Scoped-define ENABLED-FIELDS-IN-Tabel Firma Recart CodeC CodeI Sprcd Int_1 ~
  59. Flag_1 Int_2
  60. &Scoped-Define DATA-FIELDS Firma Recart CodeC CodeI Sprcd Int_1 Flag_1 Kunde Int_2
  61. &Scoped-define DATA-FIELDS-IN-Tabel Firma Recart CodeC CodeI Sprcd Int_1 ~
  62. Flag_1 Int_2
  63. &Scoped-Define MANDATORY-FIELDS Firma Recart
  64. &Scoped-Define APPLICATION-SERVICE
  65. &Scoped-Define ASSIGN-LIST
  66. &Scoped-Define DATA-FIELD-DEFS "d-hogauser.i"
  67. &Scoped-Define DATA-TABLE-NO-UNDO NO-UNDO
  68. &Scoped-define QUERY-STRING-Query-Main FOR EACH Tabel NO-LOCK INDEXED-REPOSITION
  69. {&DB-REQUIRED-START}
  70. &Scoped-define OPEN-QUERY-Query-Main OPEN QUERY Query-Main FOR EACH Tabel NO-LOCK INDEXED-REPOSITION.
  71. {&DB-REQUIRED-END}
  72. &Scoped-define TABLES-IN-QUERY-Query-Main Tabel
  73. &Scoped-define FIRST-TABLE-IN-QUERY-Query-Main Tabel
  74. /* Custom List Definitions */
  75. /* List-1,List-2,List-3,List-4,List-5,List-6 */
  76. /* _UIB-PREPROCESSOR-BLOCK-END */
  77. &ANALYZE-RESUME
  78. /* ************************ Function Prototypes ********************** */
  79. {&DB-REQUIRED-START}
  80. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD getCurrentRecid dTables _DB-REQUIRED
  81. FUNCTION getCurrentRecid RETURNS RECID
  82. ( /* parameter-definitions */ ) FORWARD.
  83. /* _UIB-CODE-BLOCK-END */
  84. &ANALYZE-RESUME
  85. {&DB-REQUIRED-END}
  86. {&DB-REQUIRED-START}
  87. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD getQueryBuffer dTables _DB-REQUIRED
  88. FUNCTION getQueryBuffer RETURNS HANDLE
  89. ( /* parameter-definitions */ ) FORWARD.
  90. /* _UIB-CODE-BLOCK-END */
  91. &ANALYZE-RESUME
  92. {&DB-REQUIRED-END}
  93. {&DB-REQUIRED-START}
  94. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD openQuery dTables _DB-REQUIRED
  95. FUNCTION openQuery RETURNS LOGICAL
  96. ( /* parameter-definitions */ ) FORWARD.
  97. /* _UIB-CODE-BLOCK-END */
  98. &ANALYZE-RESUME
  99. {&DB-REQUIRED-END}
  100. /* *********************** Control Definitions ********************** */
  101. {&DB-REQUIRED-START}
  102. /* Query definitions */
  103. &ANALYZE-SUSPEND
  104. DEFINE QUERY Query-Main FOR
  105. Tabel SCROLLING.
  106. &ANALYZE-RESUME
  107. {&DB-REQUIRED-END}
  108. /* ************************ Frame Definitions *********************** */
  109. /* *********************** Procedure Settings ************************ */
  110. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  111. /* Settings for THIS-PROCEDURE
  112. Type: SmartDataObject
  113. Allow: Query
  114. Frames: 0
  115. Add Fields to: Neither
  116. Other Settings: PERSISTENT-ONLY COMPILE APPSERVER DB-AWARE
  117. */
  118. /* This procedure should always be RUN PERSISTENT. Report the error, */
  119. /* then cleanup and return. */
  120. IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
  121. MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
  122. VIEW-AS ALERT-BOX ERROR BUTTONS OK.
  123. RETURN.
  124. END.
  125. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  126. /* ************************* Create Window ************************** */
  127. &ANALYZE-SUSPEND _CREATE-WINDOW
  128. /* DESIGN Window definition (used by the UIB)
  129. CREATE WINDOW dTables ASSIGN
  130. HEIGHT = 1.62
  131. WIDTH = 46.6.
  132. /* END WINDOW DEFINITION */
  133. */
  134. &ANALYZE-RESUME
  135. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB dTables
  136. /* ************************* Included-Libraries *********************** */
  137. {src/adm2/data.i}
  138. /* _UIB-CODE-BLOCK-END */
  139. &ANALYZE-RESUME
  140. /* *********** Runtime Attributes and AppBuilder Settings *********** */
  141. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  142. /* SETTINGS FOR WINDOW dTables
  143. VISIBLE,,RUN-PERSISTENT */
  144. /* _RUN-TIME-ATTRIBUTES-END */
  145. &ANALYZE-RESUME
  146. /* Setting information for Queries and Browse Widgets fields */
  147. &ANALYZE-SUSPEND _QUERY-BLOCK QUERY Query-Main
  148. /* Query rebuild information for SmartDataObject Query-Main
  149. _TblList = "AnaDat.Tabel"
  150. _Options = "NO-LOCK INDEXED-REPOSITION"
  151. _FldNameList[1] > AnaDat.Tabel.Firma
  152. "Firma" "Firma" ? ? "character" ? ? ? ? ? ? yes ? yes 8 yes ?
  153. _FldNameList[2] > AnaDat.Tabel.Recart
  154. "Recart" "Recart" ? ? "character" ? ? ? ? ? ? yes ? yes 12 yes ?
  155. _FldNameList[3] > AnaDat.Tabel.CodeC
  156. "CodeC" "CodeC" "Gruppe" "x(20)" "character" ? ? ? ? ? ? yes ? no 20 yes ?
  157. _FldNameList[4] > AnaDat.Tabel.CodeI
  158. "CodeI" "CodeI" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes ?
  159. _FldNameList[5] > AnaDat.Tabel.Sprcd
  160. "Sprcd" "Sprcd" ? ? "integer" ? ? ? ? ? ? yes ? no 5.6 yes ?
  161. _FldNameList[6] > AnaDat.Tabel.Int_1
  162. "Int_1" "Int_1" "Knr" ? "integer" ? ? ? ? ? ? yes ? no 6.8 yes ?
  163. _FldNameList[7] > AnaDat.Tabel.Flag_1
  164. "Flag_1" "Flag_1" "Aktiv" ? "logical" ? ? ? ? ? ? yes ? no 6.4 yes ?
  165. _FldNameList[8] > "_<CALC>"
  166. "DYNAMIC-FUNCTION('getAdressAnzeige':U, RowObject.Int_1)" "Kunde" "Kunde" "x(60)" "character" ? ? ? ? ? ? yes ? no 60 no ?
  167. _FldNameList[9] > AnaDat.Tabel.Int_2
  168. "Int_2" "Int_2" "HogaNr" "zzzzzzz9" "integer" ? ? ? ? ? ? yes ? no 8.2 yes ?
  169. _Design-Parent is WINDOW dTables @ ( 1.14 , 2.6 )
  170. */ /* QUERY Query-Main */
  171. &ANALYZE-RESUME
  172. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK dTables
  173. /* *************************** Main Block *************************** */
  174. { incl/datmainblock.i }
  175. fOpen = FALSE.
  176. &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
  177. RUN initializeObject.
  178. &ENDIF
  179. /* _UIB-CODE-BLOCK-END */
  180. &ANALYZE-RESUME
  181. /* ********************** Internal Procedures *********************** */
  182. {&DB-REQUIRED-START}
  183. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE DATA.CALCULATE dTables DATA.CALCULATE _DB-REQUIRED
  184. PROCEDURE DATA.CALCULATE :
  185. /*------------------------------------------------------------------------------
  186. Purpose: Calculate all the Calculated Expressions found in the
  187. SmartDataObject.
  188. Parameters: <none>
  189. ------------------------------------------------------------------------------*/
  190. ASSIGN
  191. rowObject.Kunde = (DYNAMIC-FUNCTION('getAdressAnzeige':U, RowObject.Int_1))
  192. .
  193. END PROCEDURE.
  194. /* _UIB-CODE-BLOCK-END */
  195. &ANALYZE-RESUME
  196. {&DB-REQUIRED-END}
  197. {&DB-REQUIRED-START}
  198. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE dataAvailable dTables _DB-REQUIRED
  199. PROCEDURE dataAvailable :
  200. /*------------------------------------------------------------------------------
  201. Purpose: Super Override
  202. Parameters:
  203. Notes:
  204. ------------------------------------------------------------------------------*/
  205. { incl/datdataavailable.i }
  206. END PROCEDURE.
  207. /* _UIB-CODE-BLOCK-END */
  208. &ANALYZE-RESUME
  209. {&DB-REQUIRED-END}
  210. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI dTables _DEFAULT-DISABLE
  211. PROCEDURE disable_UI :
  212. /*------------------------------------------------------------------------------
  213. Purpose: DISABLE the User Interface
  214. Parameters: <none>
  215. Notes: Here we clean-up the user-interface by deleting
  216. dynamic widgets we have created and/or hide
  217. frames. This procedure is usually called when
  218. we are ready to "clean-up" after running.
  219. ------------------------------------------------------------------------------*/
  220. /* Hide all frames. */
  221. IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
  222. END PROCEDURE.
  223. /* _UIB-CODE-BLOCK-END */
  224. &ANALYZE-RESUME
  225. {&DB-REQUIRED-START}
  226. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE INAKTIVIEREN dTables _DB-REQUIRED
  227. PROCEDURE INAKTIVIEREN :
  228. /*------------------------------------------------------------------------------
  229. Purpose:
  230. Parameters: <none>
  231. Notes:
  232. ------------------------------------------------------------------------------*/
  233. { incl/datinaktivieren.i }
  234. END PROCEDURE.
  235. /* _UIB-CODE-BLOCK-END */
  236. &ANALYZE-RESUME
  237. {&DB-REQUIRED-END}
  238. {&DB-REQUIRED-START}
  239. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE initializeObject dTables _DB-REQUIRED
  240. PROCEDURE initializeObject :
  241. /*------------------------------------------------------------------------------*/
  242. /* Purpose: Super Override */
  243. /* Parameters: */
  244. /* Notes: */
  245. /*------------------------------------------------------------------------------*/
  246. { incl/datinitialize.i }
  247. iHogagrp = DYNAMIC-FUNCTION ('getHogagrp':U IN hKontainer) NO-ERROR.
  248. IF iHogagrp = ? THEN iHogagrp = 1.
  249. RUN SET_OPENFLAG ( TRUE ).
  250. END PROCEDURE.
  251. /* _UIB-CODE-BLOCK-END */
  252. &ANALYZE-RESUME
  253. {&DB-REQUIRED-END}
  254. {&DB-REQUIRED-START}
  255. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REAKTIVIEREN dTables _DB-REQUIRED
  256. PROCEDURE REAKTIVIEREN :
  257. /*------------------------------------------------------------------------------
  258. Purpose:
  259. Parameters: <none>
  260. Notes:
  261. ------------------------------------------------------------------------------*/
  262. { incl/datreaktivieren.i }
  263. END PROCEDURE.
  264. /* _UIB-CODE-BLOCK-END */
  265. &ANALYZE-RESUME
  266. {&DB-REQUIRED-END}
  267. {&DB-REQUIRED-START}
  268. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REPOS_TABELLE dTables _DB-REQUIRED
  269. PROCEDURE REPOS_TABELLE :
  270. /*------------------------------------------------------------------------------
  271. Purpose:
  272. Parameters: <none>
  273. Notes:
  274. ------------------------------------------------------------------------------*/
  275. { incl/datrepos.i }
  276. END PROCEDURE.
  277. /* _UIB-CODE-BLOCK-END */
  278. &ANALYZE-RESUME
  279. {&DB-REQUIRED-END}
  280. {&DB-REQUIRED-START}
  281. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_FILTER dTables _DB-REQUIRED
  282. PROCEDURE SET_FILTER :
  283. /*------------------------------------------------------------------------------
  284. Purpose:
  285. Parameters: <none>
  286. Notes:
  287. ------------------------------------------------------------------------------*/
  288. { incl/datsetfilter.i }
  289. END PROCEDURE.
  290. /* _UIB-CODE-BLOCK-END */
  291. &ANALYZE-RESUME
  292. {&DB-REQUIRED-END}
  293. {&DB-REQUIRED-START}
  294. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_OPENFLAG dTables _DB-REQUIRED
  295. PROCEDURE SET_OPENFLAG :
  296. /*------------------------------------------------------------------------------
  297. Purpose:
  298. Parameters: <none>
  299. Notes:
  300. ------------------------------------------------------------------------------*/
  301. { incl/datsetopenflag.i }
  302. END PROCEDURE.
  303. /* _UIB-CODE-BLOCK-END */
  304. &ANALYZE-RESUME
  305. {&DB-REQUIRED-END}
  306. {&DB-REQUIRED-START}
  307. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_SORT dTables _DB-REQUIRED
  308. PROCEDURE SET_SORT :
  309. /*------------------------------------------------------------------------------
  310. Purpose:
  311. Parameters: <none>
  312. Notes:
  313. ------------------------------------------------------------------------------*/
  314. { incl/datsetsort.i }
  315. END PROCEDURE.
  316. /* _UIB-CODE-BLOCK-END */
  317. &ANALYZE-RESUME
  318. {&DB-REQUIRED-END}
  319. /* ************************ Function Implementations ***************** */
  320. {&DB-REQUIRED-START}
  321. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION getCurrentRecid dTables _DB-REQUIRED
  322. FUNCTION getCurrentRecid RETURNS RECID
  323. ( /* parameter-definitions */ ) :
  324. /*------------------------------------------------------------------------------
  325. Purpose:
  326. Notes:
  327. ------------------------------------------------------------------------------*/
  328. { incl/datgetcurrentrecid.i }
  329. END FUNCTION.
  330. /* _UIB-CODE-BLOCK-END */
  331. &ANALYZE-RESUME
  332. {&DB-REQUIRED-END}
  333. {&DB-REQUIRED-START}
  334. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION getQueryBuffer dTables _DB-REQUIRED
  335. FUNCTION getQueryBuffer RETURNS HANDLE
  336. ( /* parameter-definitions */ ) :
  337. /*------------------------------------------------------------------------------
  338. Purpose:
  339. Notes:
  340. ------------------------------------------------------------------------------*/
  341. RETURN BUFFER rowObject:HANDLE.
  342. END FUNCTION.
  343. /* _UIB-CODE-BLOCK-END */
  344. &ANALYZE-RESUME
  345. {&DB-REQUIRED-END}
  346. {&DB-REQUIRED-START}
  347. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION openQuery dTables _DB-REQUIRED
  348. FUNCTION openQuery RETURNS LOGICAL
  349. ( /* parameter-definitions */ ) :
  350. /*------------------------------------------------------------------------------
  351. Purpose: Super Override
  352. Notes:
  353. ------------------------------------------------------------------------------*/
  354. DEFINE VARIABLE Felder AS CHARACTER NO-UNDO.
  355. DEFINE VARIABLE Inhalt AS CHARACTER NO-UNDO.
  356. DEFINE VARIABLE ix AS INTEGER NO-UNDO.
  357. DEFINE VARIABLE cFeld AS CHARACTER NO-UNDO.
  358. IF NOT fOpen THEN RETURN FALSE.
  359. xWhere = ''.
  360. xSort = ''.
  361. xString = ''.
  362. Felder = DYNAMIC-FUNCTION('getForeignFields':U) NO-ERROR.
  363. Inhalt = DYNAMIC-FUNCTION('getForeignValues':U) NO-ERROR.
  364. iHogagrp = DYNAMIC-FUNCTION ('getHogagrp':U IN hKontainer) NO-ERROR.
  365. IF iHogagrp = ? THEN iHogagrp = 1.
  366. /* ix = LOOKUP('Feld', Felder, ',') / 2. */
  367. /* cFeld = ENTRY (ix , Inhalt, CHR(01)). */
  368. CASE iHogaGrp:
  369. WHEN 999999 THEN
  370. DO:
  371. xString = SUBSTITUTE('Tabel.Firma = "&1" AND Tabel.RecArt = "&2" AND Tabel.Sprcd = 1 ', Firma, cRecArt).
  372. END.
  373. OTHERWISE
  374. DO:
  375. xString = SUBSTITUTE('Tabel.Firma = "&1" AND Tabel.RecArt = "&2" AND Tabel.CodeC = "&3" AND Tabel.Sprcd = 1 ', Firma, cRecArt, STRING(iHogagrp,'999999')).
  376. END.
  377. END CASE.
  378. xString = 'FOR EACH Tabel WHERE ' + xString + ' NO-LOCK INDEXED-REPOSITION '.
  379. /* xWhere = 'Tabel.Firma = ' + QUOTER(Firma) + ' AND ' */
  380. /* + 'Tabel.RecArt = ' + STRING(Auf_Sta) + ' '. */
  381. /* xString = 'FOR EACH Debop ' + xSort + 'WHERE ' */
  382. /* + 'Debop.Firma = "' + Firma + '" AND ' */
  383. /* + 'Debop.Knr = ' + STRING(Knr) + ' ' */
  384. /* + 'NO-LOCK BY Debop.FakDat DESCENDING INDEXED-REPOSITION '. */
  385. { incl/datopenquery.i }
  386. IF xWhere <> '' THEN DYNAMIC-FUNCTION('setQueryWhere':U , INPUT xWhere ).
  387. IF xSort <> '' THEN DYNAMIC-FUNCTION('setQuerySort':U , INPUT xSort ).
  388. IF xString <> '' THEN DYNAMIC-FUNCTION('setQueryString':U, INPUT xString).
  389. RETURN SUPER( ).
  390. END FUNCTION.
  391. /* _UIB-CODE-BLOCK-END */
  392. &ANALYZE-RESUME
  393. {&DB-REQUIRED-END}