d-kubes.w 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  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. &SCOPED-DEFINE Tabelle KuBes
  30. &SCOPED-DEFINE TabWhere /* USE-INDEX KuBes-k1 ~
  31. WHERE {&Tabelle}.KuBes = tRowObject.KuBes
  32. */
  33. { incl/datdefinition.i }
  34. DEF VAR iKnr AS INT INIT 0 NO-UNDO.
  35. DEF VAR iVertr AS INT INIT 999999 NO-UNDO.
  36. DEF VAR lAuf AS LOG INIT FALSE NO-UNDO.
  37. DEF VAR qSort AS INT INIT 1 NO-UNDO.
  38. /* _UIB-CODE-BLOCK-END */
  39. &ANALYZE-RESUME
  40. &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
  41. /* ******************** Preprocessor Definitions ******************** */
  42. &Global-define DATA-LOGIC-PROCEDURE .p
  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 KuBes
  55. /* Definitions for QUERY Query-Main */
  56. &Scoped-Define ENABLED-FIELDS Firma Knr Vertr Datum_1 Art Datum_2 Abgeschl Beschreibung Spesen Adr_01~
  57. Adr_02 Adr_03 Adr_04 Kontakt Ind Kunde Datum Suchbe
  58. &Scoped-define ENABLED-FIELDS-IN-KuBes Firma Knr Vertr Datum_1 Art Datum_2 ~
  59. Abgeschl Beschreibung Spesen Adr_01 Adr_02 Adr_03 Adr_04 Kontakt Ind
  60. &Scoped-Define DATA-FIELDS Firma Knr Vertr Datum_1 Art Datum_2 Abgeschl Beschreibung Spesen Adr_01~
  61. Adr_02 Adr_03 Adr_04 Kontakt Ind Kunde Datum Suchbe
  62. &Scoped-define DATA-FIELDS-IN-KuBes Firma Knr Vertr Datum_1 Art Datum_2 ~
  63. Abgeschl Beschreibung Spesen Adr_01 Adr_02 Adr_03 Adr_04 Kontakt Ind
  64. &Scoped-Define MANDATORY-FIELDS
  65. &Scoped-Define APPLICATION-SERVICE
  66. &Scoped-Define ASSIGN-LIST
  67. &Scoped-Define DATA-FIELD-DEFS "d-kubes.i"
  68. &Scoped-Define DATA-TABLE-NO-UNDO NO-UNDO
  69. &Scoped-define QUERY-STRING-Query-Main FOR EACH KuBes NO-LOCK INDEXED-REPOSITION
  70. {&DB-REQUIRED-START}
  71. &Scoped-define OPEN-QUERY-Query-Main OPEN QUERY Query-Main FOR EACH KuBes NO-LOCK INDEXED-REPOSITION.
  72. {&DB-REQUIRED-END}
  73. &Scoped-define TABLES-IN-QUERY-Query-Main KuBes
  74. &Scoped-define FIRST-TABLE-IN-QUERY-Query-Main KuBes
  75. /* Custom List Definitions */
  76. /* List-1,List-2,List-3,List-4,List-5,List-6 */
  77. /* _UIB-PREPROCESSOR-BLOCK-END */
  78. &ANALYZE-RESUME
  79. /* ************************ Function Prototypes ********************** */
  80. {&DB-REQUIRED-START}
  81. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD getCurrentKuBes dTables _DB-REQUIRED
  82. FUNCTION getCurrentKuBes RETURNS HANDLE
  83. ( /* parameter-definitions */ ) FORWARD.
  84. /* _UIB-CODE-BLOCK-END */
  85. &ANALYZE-RESUME
  86. {&DB-REQUIRED-END}
  87. {&DB-REQUIRED-START}
  88. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD getQueryBuffer dTables _DB-REQUIRED
  89. FUNCTION getQueryBuffer RETURNS HANDLE
  90. ( /* parameter-definitions */ ) FORWARD.
  91. /* _UIB-CODE-BLOCK-END */
  92. &ANALYZE-RESUME
  93. {&DB-REQUIRED-END}
  94. {&DB-REQUIRED-START}
  95. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD openQuery dTables _DB-REQUIRED
  96. FUNCTION openQuery RETURNS LOGICAL
  97. ( /* parameter-definitions */ ) FORWARD.
  98. /* _UIB-CODE-BLOCK-END */
  99. &ANALYZE-RESUME
  100. {&DB-REQUIRED-END}
  101. {&DB-REQUIRED-START}
  102. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD setKnr dTables _DB-REQUIRED
  103. FUNCTION setKnr RETURNS LOGICAL
  104. ( ipKnr AS INT ) FORWARD.
  105. /* _UIB-CODE-BLOCK-END */
  106. &ANALYZE-RESUME
  107. {&DB-REQUIRED-END}
  108. /* *********************** Control Definitions ********************** */
  109. {&DB-REQUIRED-START}
  110. /* Query definitions */
  111. &ANALYZE-SUSPEND
  112. DEFINE QUERY Query-Main FOR
  113. KuBes SCROLLING.
  114. &ANALYZE-RESUME
  115. {&DB-REQUIRED-END}
  116. /* ************************ Frame Definitions *********************** */
  117. /* *********************** Procedure Settings ************************ */
  118. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  119. /* Settings for THIS-PROCEDURE
  120. Type: SmartDataObject
  121. Allow: Query
  122. Frames: 0
  123. Add Fields to: Neither
  124. Other Settings: PERSISTENT-ONLY COMPILE APPSERVER DB-AWARE
  125. */
  126. /* This procedure should always be RUN PERSISTENT. Report the error, */
  127. /* then cleanup and return. */
  128. IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
  129. MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
  130. VIEW-AS ALERT-BOX ERROR BUTTONS OK.
  131. RETURN.
  132. END.
  133. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  134. /* ************************* Create Window ************************** */
  135. &ANALYZE-SUSPEND _CREATE-WINDOW
  136. /* DESIGN Window definition (used by the UIB)
  137. CREATE WINDOW dTables ASSIGN
  138. HEIGHT = 1.71
  139. WIDTH = 66.8.
  140. /* END WINDOW DEFINITION */
  141. */
  142. &ANALYZE-RESUME
  143. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB dTables
  144. /* ************************* Included-Libraries *********************** */
  145. {src/adm2/data.i}
  146. /* _UIB-CODE-BLOCK-END */
  147. &ANALYZE-RESUME
  148. /* *********** Runtime Attributes and AppBuilder Settings *********** */
  149. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  150. /* SETTINGS FOR WINDOW dTables
  151. VISIBLE,,RUN-PERSISTENT */
  152. /* _RUN-TIME-ATTRIBUTES-END */
  153. &ANALYZE-RESUME
  154. /* Setting information for Queries and Browse Widgets fields */
  155. &ANALYZE-SUSPEND _QUERY-BLOCK QUERY Query-Main
  156. /* Query rebuild information for SmartDataObject Query-Main
  157. _TblList = "AnaDat.KuBes"
  158. _Options = "NO-LOCK INDEXED-REPOSITION"
  159. _FldNameList[1] > AnaDat.KuBes.Firma
  160. "Firma" "Firma" ? ? "character" ? ? ? ? ? ? yes ? no 8 yes ?
  161. _FldNameList[2] > AnaDat.KuBes.Knr
  162. "Knr" "Knr" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes ?
  163. _FldNameList[3] > AnaDat.KuBes.Vertr
  164. "Vertr" "Vertr" ? "999" "integer" ? ? ? ? ? ? yes ? no 4.4 yes ?
  165. _FldNameList[4] > AnaDat.KuBes.Datum_1
  166. "Datum_1" "Datum_1" ? ? "date" ? ? ? ? ? ? yes ? no 10.8 yes ?
  167. _FldNameList[5] > AnaDat.KuBes.Art
  168. "Art" "Art" ? ? "character" ? ? ? ? ? ? yes ? no 4 yes ?
  169. _FldNameList[6] > AnaDat.KuBes.Datum_2
  170. "Datum_2" "Datum_2" ? ? "date" ? ? ? ? ? ? yes ? no 10.8 yes ?
  171. _FldNameList[7] > AnaDat.KuBes.Abgeschl
  172. "Abgeschl" "Abgeschl" ? "Ja/Nein" "logical" ? ? ? ? ? ? yes ? no 8.8 yes ?
  173. _FldNameList[8] > AnaDat.KuBes.Beschreibung
  174. "Beschreibung" "Beschreibung" ? ? "character" ? ? ? ? ? ? yes ? no 1000 yes ?
  175. _FldNameList[9] > AnaDat.KuBes.Spesen
  176. "Spesen" "Spesen" ? ? "decimal" ? ? ? ? ? ? yes ? no 10.4 yes ?
  177. _FldNameList[10] > AnaDat.KuBes.Adr_01
  178. "Adr_01" "Adr_01" ? ? "character" ? ? ? ? ? ? yes ? no 30 yes ?
  179. _FldNameList[11] > AnaDat.KuBes.Adr_02
  180. "Adr_02" "Adr_02" ? ? "character" ? ? ? ? ? ? yes ? no 30 yes ?
  181. _FldNameList[12] > AnaDat.KuBes.Adr_03
  182. "Adr_03" "Adr_03" ? ? "character" ? ? ? ? ? ? yes ? no 30 yes ?
  183. _FldNameList[13] > AnaDat.KuBes.Adr_04
  184. "Adr_04" "Adr_04" ? ? "character" ? ? ? ? ? ? yes ? no 30 yes ?
  185. _FldNameList[14] > AnaDat.KuBes.Kontakt
  186. "Kontakt" "Kontakt" ? ? "character" ? ? ? ? ? ? yes ? no 30 yes ?
  187. _FldNameList[15] > AnaDat.KuBes.Ind
  188. "Ind" "Ind" ? ? "integer" ? ? ? ? ? ? yes ? no 3 yes ?
  189. _FldNameList[16] > "_<CALC>"
  190. "IF sAktiv THEN DYNAMIC-FUNCTION('getAdressAnzeige':U, RowObject.Knr) ELSE ''" "Kunde" "Kunde" "x(60)" "Character" ? ? ? ? ? ? yes ? no 60 no ?
  191. _FldNameList[17] > "_<CALC>"
  192. "(IF RowObject.Datum_2 <> ? THEN RowObject.Datum_2 ELSE RowObject.Datum_1)" "Datum" "Datum" "99.99.9999" "Date" ? ? ? ? ? ? yes ? no 10.8 no ?
  193. _FldNameList[18] > "_<CALC>"
  194. "DYNAMIC-FUNCTION('getAdresseSuchbe':U, RowObject.Knr)" "Suchbe" "Suchbegriff" "x(15)" "character" ? ? ? ? ? ? yes ? no 15 no ?
  195. _Design-Parent is WINDOW dTables @ ( 1.14 , 2.6 )
  196. */ /* QUERY Query-Main */
  197. &ANALYZE-RESUME
  198. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK dTables
  199. /* *************************** Main Block *************************** */
  200. { incl/datmainblock.i }
  201. fOpen = FALSE.
  202. SUBSCRIBE TO 'VERTRETERWECHSEL' ANYWHERE.
  203. &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
  204. RUN initializeObject.
  205. &ENDIF
  206. /* _UIB-CODE-BLOCK-END */
  207. &ANALYZE-RESUME
  208. /* ********************** Internal Procedures *********************** */
  209. {&DB-REQUIRED-START}
  210. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE DATA.CALCULATE dTables DATA.CALCULATE _DB-REQUIRED
  211. PROCEDURE DATA.CALCULATE :
  212. /*------------------------------------------------------------------------------
  213. Purpose: Calculate all the Calculated Expressions found in the
  214. SmartDataObject.
  215. Parameters: <none>
  216. ------------------------------------------------------------------------------*/
  217. ASSIGN
  218. rowObject.Datum = ((IF RowObject.Datum_2 <> ? THEN RowObject.Datum_2 ELSE RowObject.Datum_1))
  219. rowObject.Kunde = (IF sAktiv THEN DYNAMIC-FUNCTION('getAdressAnzeige':U, RowObject.Knr) ELSE '')
  220. rowObject.Suchbe = (DYNAMIC-FUNCTION('getAdresseSuchbe':U, RowObject.Knr))
  221. .
  222. END PROCEDURE.
  223. /* _UIB-CODE-BLOCK-END */
  224. &ANALYZE-RESUME
  225. {&DB-REQUIRED-END}
  226. {&DB-REQUIRED-START}
  227. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE dataAvailable dTables _DB-REQUIRED
  228. PROCEDURE dataAvailable :
  229. /*------------------------------------------------------------------------------
  230. Purpose: Super Override
  231. Parameters:
  232. Notes:
  233. ------------------------------------------------------------------------------*/
  234. { incl/datdataavailable.i }
  235. END PROCEDURE.
  236. /* _UIB-CODE-BLOCK-END */
  237. &ANALYZE-RESUME
  238. {&DB-REQUIRED-END}
  239. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI dTables _DEFAULT-DISABLE
  240. PROCEDURE disable_UI :
  241. /*------------------------------------------------------------------------------
  242. Purpose: DISABLE the User Interface
  243. Parameters: <none>
  244. Notes: Here we clean-up the user-interface by deleting
  245. dynamic widgets we have created and/or hide
  246. frames. This procedure is usually called when
  247. we are ready to "clean-up" after running.
  248. ------------------------------------------------------------------------------*/
  249. /* Hide all frames. */
  250. IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
  251. END PROCEDURE.
  252. /* _UIB-CODE-BLOCK-END */
  253. &ANALYZE-RESUME
  254. {&DB-REQUIRED-START}
  255. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE INAKTIVIEREN dTables _DB-REQUIRED
  256. PROCEDURE INAKTIVIEREN :
  257. /*------------------------------------------------------------------------------
  258. Purpose:
  259. Parameters: <none>
  260. Notes:
  261. ------------------------------------------------------------------------------*/
  262. { incl/datinaktivieren.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 initializeObject dTables _DB-REQUIRED
  269. PROCEDURE initializeObject :
  270. /*------------------------------------------------------------------------------
  271. Purpose: Super Override
  272. Parameters:
  273. Notes:
  274. ------------------------------------------------------------------------------*/
  275. { incl/datinitialize.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 NEUER_EINTRAG dTables _DB-REQUIRED
  282. PROCEDURE NEUER_EINTRAG :
  283. /*------------------------------------------------------------------------------
  284. Purpose:
  285. Parameters: <none>
  286. Notes:
  287. ------------------------------------------------------------------------------*/
  288. DEF VAR cRowId AS CHAR NO-UNDO.
  289. RUN REPOS_TABELLE.
  290. FIND FIRST tRowObject.
  291. FIND KuBes OF tRowObject NO-LOCK.
  292. cRowid = STRING(ROWID(KuBes)) NO-ERROR.
  293. DYNAMIC-FUNCTION('openQuery':U) NO-ERROR.
  294. DYNAMIC-FUNCTION('fetchRowIdent':U, INPUT cRowid, INPUT ? ).
  295. END PROCEDURE.
  296. /* _UIB-CODE-BLOCK-END */
  297. &ANALYZE-RESUME
  298. {&DB-REQUIRED-END}
  299. {&DB-REQUIRED-START}
  300. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REAKTIVIEREN dTables _DB-REQUIRED
  301. PROCEDURE REAKTIVIEREN :
  302. /*------------------------------------------------------------------------------
  303. Purpose:
  304. Parameters: <none>
  305. Notes:
  306. ------------------------------------------------------------------------------*/
  307. { incl/datreaktivieren.i }
  308. END PROCEDURE.
  309. /* _UIB-CODE-BLOCK-END */
  310. &ANALYZE-RESUME
  311. {&DB-REQUIRED-END}
  312. {&DB-REQUIRED-START}
  313. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REPOS dTables _DB-REQUIRED
  314. PROCEDURE REPOS :
  315. /*------------------------------------------------------------------------------
  316. Purpose:
  317. Parameters: <none>
  318. Notes:
  319. ------------------------------------------------------------------------------*/
  320. DEF INPUT PARAMETER ipRecid AS RECID NO-UNDO.
  321. DEF VAR cRowid AS CHAR NO-UNDO.
  322. FIND KuBes WHERE RECID(KuBes) = ipRecid NO-LOCK NO-ERROR.
  323. IF NOT AVAILABLE KuBes THEN RETURN.
  324. cRowid = STRING(ROWID(KuBes)).
  325. DYNAMIC-FUNCTION('fetchRowIdent':U, INPUT cRowid, INPUT ? ).
  326. END PROCEDURE.
  327. /* _UIB-CODE-BLOCK-END */
  328. &ANALYZE-RESUME
  329. {&DB-REQUIRED-END}
  330. {&DB-REQUIRED-START}
  331. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REPOS_TABELLE dTables _DB-REQUIRED
  332. PROCEDURE REPOS_TABELLE :
  333. /*------------------------------------------------------------------------------
  334. Purpose:
  335. Parameters: <none>
  336. Notes:
  337. ------------------------------------------------------------------------------*/
  338. { incl/datrepos.i }
  339. END PROCEDURE.
  340. /* _UIB-CODE-BLOCK-END */
  341. &ANALYZE-RESUME
  342. {&DB-REQUIRED-END}
  343. {&DB-REQUIRED-START}
  344. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_FILTER dTables _DB-REQUIRED
  345. PROCEDURE SET_FILTER :
  346. /*------------------------------------------------------------------------------
  347. Purpose:
  348. Parameters: <none>
  349. Notes:
  350. ------------------------------------------------------------------------------*/
  351. { incl/datsetfilter.i }
  352. END PROCEDURE.
  353. /* _UIB-CODE-BLOCK-END */
  354. &ANALYZE-RESUME
  355. {&DB-REQUIRED-END}
  356. {&DB-REQUIRED-START}
  357. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_OPENFLAG dTables _DB-REQUIRED
  358. PROCEDURE SET_OPENFLAG :
  359. /*------------------------------------------------------------------------------
  360. Purpose:
  361. Parameters: <none>
  362. Notes:
  363. ------------------------------------------------------------------------------*/
  364. { incl/datsetopenflag.i }
  365. END PROCEDURE.
  366. /* _UIB-CODE-BLOCK-END */
  367. &ANALYZE-RESUME
  368. {&DB-REQUIRED-END}
  369. {&DB-REQUIRED-START}
  370. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_SORT dTables _DB-REQUIRED
  371. PROCEDURE SET_SORT :
  372. /*------------------------------------------------------------------------------
  373. Purpose:
  374. Parameters: <none>
  375. Notes:
  376. ------------------------------------------------------------------------------*/
  377. { incl/datsetsort.i }
  378. END PROCEDURE.
  379. /* _UIB-CODE-BLOCK-END */
  380. &ANALYZE-RESUME
  381. {&DB-REQUIRED-END}
  382. {&DB-REQUIRED-START}
  383. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE VERTRETERWECHSEL dTables _DB-REQUIRED
  384. PROCEDURE VERTRETERWECHSEL :
  385. /*------------------------------------------------------------------------------
  386. Purpose:
  387. Parameters: <none>
  388. Notes:
  389. ------------------------------------------------------------------------------*/
  390. DEF INPUT PARAMETER ipVertr AS INT NO-UNDO.
  391. iVertr = ipVertr.
  392. fOpen = TRUE.
  393. DYNAMIC-FUNCTION('openQuery':U) NO-ERROR.
  394. END PROCEDURE.
  395. /* _UIB-CODE-BLOCK-END */
  396. &ANALYZE-RESUME
  397. {&DB-REQUIRED-END}
  398. /* ************************ Function Implementations ***************** */
  399. {&DB-REQUIRED-START}
  400. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION getCurrentKuBes dTables _DB-REQUIRED
  401. FUNCTION getCurrentKuBes RETURNS HANDLE
  402. ( /* parameter-definitions */ ) :
  403. /*------------------------------------------------------------------------------
  404. Purpose:
  405. Notes:
  406. ------------------------------------------------------------------------------*/
  407. RUN dataAvailable ('SAME').
  408. FIND FIRST tRowObject.
  409. RETURN DYNAMIC-FUNCTION('getQueryBuffer':U).
  410. END FUNCTION.
  411. /* _UIB-CODE-BLOCK-END */
  412. &ANALYZE-RESUME
  413. {&DB-REQUIRED-END}
  414. {&DB-REQUIRED-START}
  415. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION getQueryBuffer dTables _DB-REQUIRED
  416. FUNCTION getQueryBuffer RETURNS HANDLE
  417. ( /* parameter-definitions */ ) :
  418. /*------------------------------------------------------------------------------
  419. Purpose:
  420. Notes:
  421. ------------------------------------------------------------------------------*/
  422. RETURN BUFFER rowObject:HANDLE.
  423. END FUNCTION.
  424. /* _UIB-CODE-BLOCK-END */
  425. &ANALYZE-RESUME
  426. {&DB-REQUIRED-END}
  427. {&DB-REQUIRED-START}
  428. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION openQuery dTables _DB-REQUIRED
  429. FUNCTION openQuery RETURNS LOGICAL
  430. ( /* parameter-definitions */ ) :
  431. /*------------------------------------------------------------------------------
  432. Purpose: Super Override
  433. Notes:
  434. ------------------------------------------------------------------------------*/
  435. DEF VAR Felder AS CHAR NO-UNDO.
  436. DEF VAR Inhalt AS CHAR NO-UNDO.
  437. DEF VAR ix AS INT NO-UNDO.
  438. DEF VAR cFeld AS CHAR NO-UNDO.
  439. DEF VAR iSort AS INT NO-UNDO.
  440. IF NOT fOpen THEN RETURN FALSE.
  441. xWhere = ''.
  442. xSort = ''.
  443. xString = ''.
  444. Felder = DYNAMIC-FUNCTION('getForeignFields':U) NO-ERROR.
  445. Inhalt = DYNAMIC-FUNCTION('getForeignValues':U) NO-ERROR.
  446. CASE qSort:
  447. WHEN 1 THEN DO:
  448. IF iVertr = 999999 THEN DO:
  449. IF NOT lAuf THEN iSort = 3.
  450. ELSE iSort = 1.
  451. END.
  452. ELSE DO:
  453. IF NOT lAuf THEN iSort = 4.
  454. ELSE iSort = 2.
  455. END.
  456. END.
  457. WHEN 2 THEN DO:
  458. IF iVertr = 999999 THEN DO:
  459. IF NOT lAuf THEN iSort = 7.
  460. ELSE iSort = 8.
  461. END.
  462. ELSE DO:
  463. IF NOT lAuf THEN iSort = 5.
  464. ELSE iSort = 6.
  465. END.
  466. END.
  467. END.
  468. /* ix = LOOKUP('Feld', Felder, ',') / 2. */
  469. /* cFeld = ENTRY (ix , Inhalt, CHR(01)). */
  470. xWhere = 'FOR EACH KuBes USE-INDEX KuBes-k&1 '
  471. + 'WHERE KuBes.Firma = "&2" '.
  472. xString = SUBSTITUTE(xWhere, iSort, Firma).
  473. IF iKnr <> 0 THEN DO:
  474. xWhere = SUBSTITUTE('AND KuBes.Knr = &1 ', iKnr).
  475. xString = xString + xWhere.
  476. END.
  477. IF iVertr <> 999999 THEN DO:
  478. xWhere = SUBSTITUTE('AND KuBes.Vertr = &1 ', iVertr).
  479. xString = xString + xWhere.
  480. END.
  481. xString = xString + ' NO-LOCK INDEXED-REPOSITION '.
  482. xWhere = ''.
  483. { incl/datopenquery.i }
  484. IF xWhere <> '' THEN DYNAMIC-FUNCTION('setQueryWhere':U , INPUT xWhere ).
  485. IF xString <> '' THEN DYNAMIC-FUNCTION('setQueryString':U, INPUT xString).
  486. IF xSort <> '' THEN DYNAMIC-FUNCTION('setQuerySort':U , INPUT xSort ).
  487. RETURN SUPER( ).
  488. END FUNCTION.
  489. /* _UIB-CODE-BLOCK-END */
  490. &ANALYZE-RESUME
  491. {&DB-REQUIRED-END}
  492. {&DB-REQUIRED-START}
  493. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION setKnr dTables _DB-REQUIRED
  494. FUNCTION setKnr RETURNS LOGICAL
  495. ( ipKnr AS INT ) :
  496. /*------------------------------------------------------------------------------
  497. Purpose:
  498. Notes:
  499. ------------------------------------------------------------------------------*/
  500. iKnr = ipKnr.
  501. DYNAMIC-FUNCTION('openQuery':U) NO-ERROR.
  502. RETURN TRUE.
  503. END FUNCTION.
  504. /* _UIB-CODE-BLOCK-END */
  505. &ANALYZE-RESUME
  506. {&DB-REQUIRED-END}