d-artbw-artikel.w 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  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 iLager AS INTEGER NO-UNDO.
  30. DEFINE VARIABLE iArtnr AS INTEGER NO-UNDO INIT 0.
  31. DEFINE VARIABLE iInhalt AS INTEGER NO-UNDO INIT 0.
  32. DEFINE VARIABLE iJahr AS INTEGER NO-UNDO INIT 0.
  33. DEFINE VARIABLE iTage AS INTEGER NO-UNDO INIT 999999.
  34. &SCOPED-DEFINE Tabelle Artbw
  35. &SCOPED-DEFINE TabWhere /* USE-INDEX Benutzer-k1 ~
  36. WHERE {&Tabelle}.Benutzer = tRowObject.Benutzer
  37. */
  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 Artbw
  56. /* Definitions for QUERY Query-Main */
  57. &Scoped-Define ENABLED-FIELDS Firma Artnr Inhalt Jahr Knr Datum Aufnr Faknr Menge KGeb_Cd VGeb_Cd GGeb_Cd~
  58. Rab_Art Rab_Wert Aktion Preis Bru_Betr Net_Betr Lager Lag_Buch Tr_Art~
  59. Fak_Dat Fak_Art Fak_Knr WuCd Kunde DokNr GGeb_Me KGeb_Me VGeb_Me Trnr
  60. &Scoped-define ENABLED-FIELDS-IN-Artbw Firma Artnr Inhalt Jahr Knr Datum ~
  61. Aufnr Faknr Menge KGeb_Cd VGeb_Cd GGeb_Cd Rab_Art Rab_Wert Aktion Preis ~
  62. Bru_Betr Net_Betr Lager Lag_Buch Tr_Art Fak_Dat Fak_Art Fak_Knr WuCd ~
  63. GGeb_Me KGeb_Me VGeb_Me Trnr
  64. &Scoped-Define DATA-FIELDS Firma Artnr Inhalt Jahr Knr Datum Aufnr Faknr Menge KGeb_Cd VGeb_Cd GGeb_Cd~
  65. Rab_Art Rab_Wert Aktion Preis Bru_Betr Net_Betr Lager Lag_Buch Tr_Art~
  66. Fak_Dat Fak_Art Fak_Knr WuCd Kunde DokNr GGeb_Me KGeb_Me VGeb_Me Trnr
  67. &Scoped-define DATA-FIELDS-IN-Artbw Firma Artnr Inhalt Jahr Knr Datum Aufnr ~
  68. Faknr Menge KGeb_Cd VGeb_Cd GGeb_Cd Rab_Art Rab_Wert Aktion Preis Bru_Betr ~
  69. Net_Betr Lager Lag_Buch Tr_Art Fak_Dat Fak_Art Fak_Knr WuCd GGeb_Me KGeb_Me ~
  70. VGeb_Me Trnr
  71. &Scoped-Define MANDATORY-FIELDS Firma
  72. &Scoped-Define APPLICATION-SERVICE
  73. &Scoped-Define ASSIGN-LIST
  74. &Scoped-Define DATA-FIELD-DEFS "d-artbw-artikel.i"
  75. &Scoped-Define DATA-TABLE-NO-UNDO NO-UNDO
  76. &Scoped-define QUERY-STRING-Query-Main FOR EACH Artbw NO-LOCK INDEXED-REPOSITION
  77. {&DB-REQUIRED-START}
  78. &Scoped-define OPEN-QUERY-Query-Main OPEN QUERY Query-Main FOR EACH Artbw NO-LOCK INDEXED-REPOSITION.
  79. {&DB-REQUIRED-END}
  80. &Scoped-define TABLES-IN-QUERY-Query-Main Artbw
  81. &Scoped-define FIRST-TABLE-IN-QUERY-Query-Main Artbw
  82. /* Custom List Definitions */
  83. /* List-1,List-2,List-3,List-4,List-5,List-6 */
  84. /* _UIB-PREPROCESSOR-BLOCK-END */
  85. &ANALYZE-RESUME
  86. /* ************************ Function Prototypes ********************** */
  87. {&DB-REQUIRED-START}
  88. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD getCurrentRecid dTables _DB-REQUIRED
  89. FUNCTION getCurrentRecid RETURNS RECID
  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 getQueryBuffer dTables _DB-REQUIRED
  96. FUNCTION getQueryBuffer RETURNS HANDLE
  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 openQuery dTables _DB-REQUIRED
  103. FUNCTION openQuery RETURNS LOGICAL
  104. ( /* parameter-definitions */ ) FORWARD.
  105. /* _UIB-CODE-BLOCK-END */
  106. &ANALYZE-RESUME
  107. {&DB-REQUIRED-END}
  108. {&DB-REQUIRED-START}
  109. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD setLager dTables _DB-REQUIRED
  110. FUNCTION setLager RETURNS LOGICAL
  111. ( ipLager AS INTEGER ) FORWARD.
  112. /* _UIB-CODE-BLOCK-END */
  113. &ANALYZE-RESUME
  114. {&DB-REQUIRED-END}
  115. /* *********************** Control Definitions ********************** */
  116. {&DB-REQUIRED-START}
  117. /* Query definitions */
  118. &ANALYZE-SUSPEND
  119. DEFINE QUERY Query-Main FOR
  120. Artbw SCROLLING.
  121. &ANALYZE-RESUME
  122. {&DB-REQUIRED-END}
  123. /* ************************ Frame Definitions *********************** */
  124. /* *********************** Procedure Settings ************************ */
  125. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  126. /* Settings for THIS-PROCEDURE
  127. Type: SmartDataObject
  128. Allow: Query
  129. Frames: 0
  130. Add Fields to: Neither
  131. Other Settings: PERSISTENT-ONLY COMPILE APPSERVER DB-AWARE
  132. */
  133. /* This procedure should always be RUN PERSISTENT. Report the error, */
  134. /* then cleanup and return. */
  135. IF NOT THIS-PROCEDURE:PERSISTENT THEN
  136. DO:
  137. MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
  138. VIEW-AS ALERT-BOX ERROR BUTTONS OK.
  139. RETURN.
  140. END.
  141. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  142. /* ************************* Create Window ************************** */
  143. &ANALYZE-SUSPEND _CREATE-WINDOW
  144. /* DESIGN Window definition (used by the UIB)
  145. CREATE WINDOW dTables ASSIGN
  146. HEIGHT = 1.62
  147. WIDTH = 70.2.
  148. /* END WINDOW DEFINITION */
  149. */
  150. &ANALYZE-RESUME
  151. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB dTables
  152. /* ************************* Included-Libraries *********************** */
  153. {src/adm2/data.i}
  154. /* _UIB-CODE-BLOCK-END */
  155. &ANALYZE-RESUME
  156. /* *********** Runtime Attributes and AppBuilder Settings *********** */
  157. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  158. /* SETTINGS FOR WINDOW dTables
  159. VISIBLE,,RUN-PERSISTENT */
  160. /* _RUN-TIME-ATTRIBUTES-END */
  161. &ANALYZE-RESUME
  162. /* Setting information for Queries and Browse Widgets fields */
  163. &ANALYZE-SUSPEND _QUERY-BLOCK QUERY Query-Main
  164. /* Query rebuild information for SmartDataObject Query-Main
  165. _TblList = "AnaDat.Artbw"
  166. _Options = "NO-LOCK INDEXED-REPOSITION"
  167. _FldNameList[1] > AnaDat.Artbw.Firma
  168. "Firma" "Firma" ? ? "character" ? ? ? ? ? ? yes ? yes 8 yes ?
  169. _FldNameList[2] > AnaDat.Artbw.Artnr
  170. "Artnr" "Artnr" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes ?
  171. _FldNameList[3] > AnaDat.Artbw.Inhalt
  172. "Inhalt" "Inhalt" ? ? "integer" ? ? ? ? ? ? yes ? no 5.2 yes ?
  173. _FldNameList[4] > AnaDat.Artbw.Jahr
  174. "Jahr" "Jahr" ? ? "integer" ? ? ? ? ? ? yes ? no 4.8 yes ?
  175. _FldNameList[5] > AnaDat.Artbw.Knr
  176. "Knr" "Knr" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes ?
  177. _FldNameList[6] > AnaDat.Artbw.Datum
  178. "Datum" "Datum" ? ? "date" ? ? ? ? ? ? yes ? no 10.8 yes ?
  179. _FldNameList[7] > AnaDat.Artbw.Aufnr
  180. "Aufnr" "Aufnr" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes ?
  181. _FldNameList[8] > AnaDat.Artbw.Faknr
  182. "Faknr" "Faknr" ? "zzz,zzz,zzz" "integer" ? ? ? ? ? ? yes ? no 10.2 yes ?
  183. _FldNameList[9] > AnaDat.Artbw.Menge
  184. "Menge" "Menge" ? ? "decimal" ? ? ? ? ? ? yes ? no 8.8 yes ?
  185. _FldNameList[10] > AnaDat.Artbw.KGeb_Cd
  186. "KGeb_Cd" "KGeb_Cd" ? ? "character" ? ? ? ? ? ? yes ? no 9.2 yes ?
  187. _FldNameList[11] > AnaDat.Artbw.VGeb_Cd
  188. "VGeb_Cd" "VGeb_Cd" ? ? "character" ? ? ? ? ? ? yes ? no 9.2 yes ?
  189. _FldNameList[12] > AnaDat.Artbw.GGeb_Cd
  190. "GGeb_Cd" "GGeb_Cd" ? ? "character" ? ? ? ? ? ? yes ? no 9.4 yes ?
  191. _FldNameList[13] > AnaDat.Artbw.Rab_Art
  192. "Rab_Art" "Rab_Art" ? ? "integer" ? ? ? ? ? ? yes ? no 7.8 yes ?
  193. _FldNameList[14] > AnaDat.Artbw.Rab_Wert
  194. "Rab_Wert" "Rab_Wert" ? ? "decimal" ? ? ? ? ? ? yes ? no 9.8 yes ?
  195. _FldNameList[15] > AnaDat.Artbw.Aktion
  196. "Aktion" "Aktion" ? ? "logical" ? ? ? ? ? ? yes ? no 6 yes ?
  197. _FldNameList[16] > AnaDat.Artbw.Preis
  198. "Preis" "Preis" ? ? "decimal" ? ? ? ? ? ? yes ? no 11 yes ?
  199. _FldNameList[17] > AnaDat.Artbw.Bru_Betr
  200. "Bru_Betr" "Bru_Betr" ? ? "decimal" ? ? ? ? ? ? yes ? no 15.2 yes ?
  201. _FldNameList[18] > AnaDat.Artbw.Net_Betr
  202. "Net_Betr" "Net_Betr" ? ? "decimal" ? ? ? ? ? ? yes ? no 15.2 yes ?
  203. _FldNameList[19] > AnaDat.Artbw.Lager
  204. "Lager" "Lager" ? ? "integer" ? ? ? ? ? ? yes ? no 5.4 yes ?
  205. _FldNameList[20] > AnaDat.Artbw.Lag_Buch
  206. "Lag_Buch" "Lag_Buch" ? "J/N" "logical" ? ? ? ? ? ? yes ? no 9.8 yes ?
  207. _FldNameList[21] > AnaDat.Artbw.Tr_Art
  208. "Tr_Art" "Tr_Art" ? ? "integer" ? ? ? ? ? ? yes ? no 5.8 yes ?
  209. _FldNameList[22] > AnaDat.Artbw.Fak_Dat
  210. "Fak_Dat" "Fak_Dat" ? ? "date" ? ? ? ? ? ? yes ? no 10.8 yes ?
  211. _FldNameList[23] > AnaDat.Artbw.Fak_Art
  212. "Fak_Art" "Fak_Art" ? ? "integer" ? ? ? ? ? ? yes ? no 7.4 yes ?
  213. _FldNameList[24] > AnaDat.Artbw.Fak_Knr
  214. "Fak_Knr" "Fak_Knr" ? ? "integer" ? ? ? ? ? ? yes ? no 8 yes ?
  215. _FldNameList[25] > AnaDat.Artbw.WuCd
  216. "WuCd" "WuCd" ? ? "integer" ? ? ? ? ? ? yes ? no 6 yes ?
  217. _FldNameList[26] > "_<CALC>"
  218. "IF sAktiv THEN (IF (RowObject.Knr > 0) THEN (DYNAMIC-FUNCTION('getAdressAnzeige':U, RowObject.Knr)) ELSE (DYNAMIC-FUNCTION('getLagerTransArt':U, RowObject.Tr_Art))) ELSE ''" "Kunde" "Kunde" "x(60)" "Character" ? ? ? ? ? ? yes ? no 60 no ?
  219. _FldNameList[27] > "_<CALC>"
  220. "IF (RowObject.Faknr <> 0) THEN ('F' + TRIM(STRING(RowObject.Faknr,'>>999999'))) ELSE ('A' + TRIM(STRING(RowObject.Aufnr,'>>999999')))" "DokNr" "DokNr" "x(10)" "Character" ? ? ? ? ? ? yes ? no 10 no ?
  221. _FldNameList[28] > AnaDat.Artbw.GGeb_Me
  222. "GGeb_Me" "GGeb_Me" ? ? "decimal" ? ? ? ? ? ? yes ? no 10.4 yes ?
  223. _FldNameList[29] > AnaDat.Artbw.KGeb_Me
  224. "KGeb_Me" "KGeb_Me" ? ? "decimal" ? ? ? ? ? ? yes ? no 10.4 yes ?
  225. _FldNameList[30] > AnaDat.Artbw.VGeb_Me
  226. "VGeb_Me" "VGeb_Me" ? ? "decimal" ? ? ? ? ? ? yes ? no 10.4 yes ?
  227. _FldNameList[31] > AnaDat.Artbw.Trnr
  228. "Trnr" "Trnr" ? ? "integer" ? ? ? ? ? ? yes ? no 9.6 yes ?
  229. _Design-Parent is WINDOW dTables @ ( 1.14 , 2.6 )
  230. */ /* QUERY Query-Main */
  231. &ANALYZE-RESUME
  232. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK dTables
  233. /* *************************** Main Block *************************** */
  234. fOpen = FALSE.
  235. { incl/datmainblock.i }
  236. &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
  237. RUN initializeObject.
  238. &ENDIF
  239. /* _UIB-CODE-BLOCK-END */
  240. &ANALYZE-RESUME
  241. /* ********************** Internal Procedures *********************** */
  242. {&DB-REQUIRED-START}
  243. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE DATA.CALCULATE dTables DATA.CALCULATE _DB-REQUIRED
  244. PROCEDURE DATA.CALCULATE :
  245. /*------------------------------------------------------------------------------
  246. Purpose: Calculate all the Calculated Expressions found in the
  247. SmartDataObject.
  248. Parameters: <none>
  249. ------------------------------------------------------------------------------*/
  250. ASSIGN
  251. rowObject.DokNr = (IF (RowObject.Faknr <> 0) THEN ('F' + TRIM(STRING(RowObject.Faknr,'>>999999'))) ELSE ('A' + TRIM(STRING(RowObject.Aufnr,'>>999999'))))
  252. rowObject.Kunde = (IF sAktiv THEN (IF (RowObject.Knr > 0) THEN (DYNAMIC-FUNCTION('getAdressAnzeige':U, RowObject.Knr)) ELSE (DYNAMIC-FUNCTION('getLagerTransArt':U, RowObject.Tr_Art))) ELSE '')
  253. .
  254. END PROCEDURE.
  255. /* _UIB-CODE-BLOCK-END */
  256. &ANALYZE-RESUME
  257. {&DB-REQUIRED-END}
  258. {&DB-REQUIRED-START}
  259. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE dataAvailable dTables _DB-REQUIRED
  260. PROCEDURE dataAvailable :
  261. /*------------------------------------------------------------------------------
  262. Purpose: Super Override
  263. Parameters:
  264. Notes:
  265. ------------------------------------------------------------------------------*/
  266. { incl/datdataavailable.i }
  267. END PROCEDURE.
  268. /* _UIB-CODE-BLOCK-END */
  269. &ANALYZE-RESUME
  270. {&DB-REQUIRED-END}
  271. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI dTables _DEFAULT-DISABLE
  272. PROCEDURE disable_UI :
  273. /*------------------------------------------------------------------------------
  274. Purpose: DISABLE the User Interface
  275. Parameters: <none>
  276. Notes: Here we clean-up the user-interface by deleting
  277. dynamic widgets we have created and/or hide
  278. frames. This procedure is usually called when
  279. we are ready to "clean-up" after running.
  280. ------------------------------------------------------------------------------*/
  281. /* Hide all frames. */
  282. IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
  283. END PROCEDURE.
  284. /* _UIB-CODE-BLOCK-END */
  285. &ANALYZE-RESUME
  286. {&DB-REQUIRED-START}
  287. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE INAKTIVIEREN dTables _DB-REQUIRED
  288. PROCEDURE INAKTIVIEREN :
  289. /*------------------------------------------------------------------------------
  290. Purpose:
  291. Parameters: <none>
  292. Notes:
  293. ------------------------------------------------------------------------------*/
  294. { incl/datinaktivieren.i }
  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 initializeObject dTables _DB-REQUIRED
  301. PROCEDURE initializeObject :
  302. /*------------------------------------------------------------------------------
  303. Purpose: Super Override
  304. Parameters:
  305. Notes:
  306. ------------------------------------------------------------------------------*/
  307. iTage = DYNAMIC-FUNCTION ('getArtbwVonDatum':U) NO-ERROR.
  308. { incl/datinitialize.i }
  309. END PROCEDURE.
  310. /* _UIB-CODE-BLOCK-END */
  311. &ANALYZE-RESUME
  312. {&DB-REQUIRED-END}
  313. {&DB-REQUIRED-START}
  314. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REAKTIVIEREN dTables _DB-REQUIRED
  315. PROCEDURE REAKTIVIEREN :
  316. /*------------------------------------------------------------------------------
  317. Purpose:
  318. Parameters: <none>
  319. Notes:
  320. ------------------------------------------------------------------------------*/
  321. { incl/datreaktivieren.i }
  322. END PROCEDURE.
  323. /* _UIB-CODE-BLOCK-END */
  324. &ANALYZE-RESUME
  325. {&DB-REQUIRED-END}
  326. {&DB-REQUIRED-START}
  327. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REPOS dTables _DB-REQUIRED
  328. PROCEDURE REPOS :
  329. /*------------------------------------------------------------------------------
  330. Purpose:
  331. Parameters: <none>
  332. Notes:
  333. ------------------------------------------------------------------------------*/
  334. DEFINE INPUT PARAMETER ipRecid AS RECID NO-UNDO.
  335. FIND Artbw WHERE RECID(Artbw) = ipRecid NO-LOCK NO-ERROR.
  336. IF NOT AVAILABLE Artbw THEN RETURN.
  337. DYNAMIC-FUNCTION('fetchRowIdent':U, INPUT STRING(ROWID(Artbw)), INPUT ? ).
  338. END PROCEDURE.
  339. /* _UIB-CODE-BLOCK-END */
  340. &ANALYZE-RESUME
  341. {&DB-REQUIRED-END}
  342. {&DB-REQUIRED-START}
  343. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE REPOS_TABELLE dTables _DB-REQUIRED
  344. PROCEDURE REPOS_TABELLE :
  345. /*------------------------------------------------------------------------------
  346. Purpose:
  347. Parameters: <none>
  348. Notes:
  349. ------------------------------------------------------------------------------*/
  350. { incl/datrepos.i }
  351. END PROCEDURE.
  352. /* _UIB-CODE-BLOCK-END */
  353. &ANALYZE-RESUME
  354. {&DB-REQUIRED-END}
  355. {&DB-REQUIRED-START}
  356. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_FILTER dTables _DB-REQUIRED
  357. PROCEDURE SET_FILTER :
  358. /*------------------------------------------------------------------------------
  359. Purpose:
  360. Parameters: <none>
  361. Notes:
  362. ------------------------------------------------------------------------------*/
  363. { incl/datsetfilter.i }
  364. END PROCEDURE.
  365. /* _UIB-CODE-BLOCK-END */
  366. &ANALYZE-RESUME
  367. {&DB-REQUIRED-END}
  368. {&DB-REQUIRED-START}
  369. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_OPENFLAG dTables _DB-REQUIRED
  370. PROCEDURE SET_OPENFLAG :
  371. /*------------------------------------------------------------------------------
  372. Purpose:
  373. Parameters: <none>
  374. Notes:
  375. ------------------------------------------------------------------------------*/
  376. { incl/datsetopenflag.i }
  377. END PROCEDURE.
  378. /* _UIB-CODE-BLOCK-END */
  379. &ANALYZE-RESUME
  380. {&DB-REQUIRED-END}
  381. {&DB-REQUIRED-START}
  382. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_SORT dTables _DB-REQUIRED
  383. PROCEDURE SET_SORT :
  384. /*------------------------------------------------------------------------------
  385. Purpose:
  386. Parameters: <none>
  387. Notes:
  388. ------------------------------------------------------------------------------*/
  389. { incl/datsetsort.i }
  390. END PROCEDURE.
  391. /* _UIB-CODE-BLOCK-END */
  392. &ANALYZE-RESUME
  393. {&DB-REQUIRED-END}
  394. {&DB-REQUIRED-START}
  395. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_SORT_KNR dTables _DB-REQUIRED
  396. PROCEDURE SET_SORT_KNR :
  397. /*------------------------------------------------------------------------------
  398. Purpose:
  399. Parameters: <none>
  400. Notes:
  401. ------------------------------------------------------------------------------*/
  402. ASSIGN
  403. cSort = 'Knr'
  404. fDesc = FALSE.
  405. cRowid = ?.
  406. DYNAMIC-FUNCTION('openQuery':U).
  407. END PROCEDURE.
  408. /* _UIB-CODE-BLOCK-END */
  409. &ANALYZE-RESUME
  410. {&DB-REQUIRED-END}
  411. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE SET_ZEITDAUER dTables
  412. PROCEDURE SET_ZEITDAUER:
  413. /*------------------------------------------------------------------------------
  414. Purpose:
  415. Notes:
  416. ------------------------------------------------------------------------------*/
  417. DEFINE INPUT PARAMETER ipiTage AS INTEGER NO-UNDO.
  418. IF ipiTage = iTage THEN RETURN.
  419. iTage = ipiTage.
  420. fOpen = TRUE.
  421. DYNAMIC-FUNCTION ('openQuery':U) NO-ERROR.
  422. RETURN NO-APPLY.
  423. END PROCEDURE.
  424. /* _UIB-CODE-BLOCK-END */
  425. &ANALYZE-RESUME
  426. /* ************************ Function Implementations ***************** */
  427. {&DB-REQUIRED-START}
  428. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION getCurrentRecid dTables _DB-REQUIRED
  429. FUNCTION getCurrentRecid RETURNS RECID
  430. ( /* parameter-definitions */ ) :
  431. /*------------------------------------------------------------------------------
  432. Purpose:
  433. Notes:
  434. ------------------------------------------------------------------------------*/
  435. fData = TRUE.
  436. RUN dataAvailable ( 'SAME' ).
  437. FIND FIRST tRowObject NO-ERROR.
  438. IF tRowObject.Artnr = 0 THEN RETURN ?.
  439. FIND Artbw NO-LOCK
  440. WHERE Artbw.Firma = tRowObject.Firma
  441. AND Artbw.Trnr = tRowObject.Trnr NO-ERROR.
  442. IF NOT AVAILABLE Artbw THEN RETURN ?.
  443. ELSE RETURN RECID(Artbw).
  444. END FUNCTION.
  445. /* _UIB-CODE-BLOCK-END */
  446. &ANALYZE-RESUME
  447. {&DB-REQUIRED-END}
  448. {&DB-REQUIRED-START}
  449. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION getQueryBuffer dTables _DB-REQUIRED
  450. FUNCTION getQueryBuffer RETURNS HANDLE
  451. ( /* parameter-definitions */ ) :
  452. /*------------------------------------------------------------------------------
  453. Purpose:
  454. Notes:
  455. ------------------------------------------------------------------------------*/
  456. RETURN BUFFER rowObject:HANDLE.
  457. END FUNCTION.
  458. /* _UIB-CODE-BLOCK-END */
  459. &ANALYZE-RESUME
  460. {&DB-REQUIRED-END}
  461. {&DB-REQUIRED-START}
  462. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION openQuery dTables _DB-REQUIRED
  463. FUNCTION openQuery RETURNS LOGICAL
  464. ( /* parameter-definitions */ ) :
  465. /*------------------------------------------------------------------------------
  466. Purpose: Super Override
  467. Notes:
  468. ------------------------------------------------------------------------------*/
  469. DEFINE VARIABLE Felder AS CHARACTER NO-UNDO.
  470. DEFINE VARIABLE Inhalt AS CHARACTER NO-UNDO.
  471. DEFINE VARIABLE ix AS INTEGER NO-UNDO.
  472. DEFINE VARIABLE cFeld AS CHARACTER NO-UNDO.
  473. DEFINE VARIABLE cString AS CHARACTER NO-UNDO.
  474. DEFINE VARIABLE dVonDatum AS DATE NO-UNDO.
  475. DEFINE VARIABLE dBisDatum AS DATE NO-UNDO.
  476. IF NOT fOpen THEN RETURN FALSE.
  477. IF Firma = '' THEN RETURN FALSE.
  478. xWhere = ''.
  479. xSort = ''.
  480. xString = ''.
  481. Felder = DYNAMIC-FUNCTION('getForeignFields':U) NO-ERROR.
  482. Inhalt = DYNAMIC-FUNCTION('getForeignValues':U) NO-ERROR.
  483. dVonDatum = TODAY - iTage.
  484. dBisDatum = TODAY + 999999.
  485. ix = LOOKUP('Artnr', Felder, ',') / 2.
  486. iArtnr = INTEGER(ENTRY (ix, Inhalt, CHR(01))).
  487. ix = LOOKUP('Inhalt', Felder, ',') / 2.
  488. iInhalt = INTEGER(ENTRY (ix, Inhalt, CHR(01))).
  489. ix = LOOKUP('Jahr', Felder, ',') / 2.
  490. iJahr = INTEGER(ENTRY (ix, Inhalt, CHR(01))).
  491. /* xWhere = 'Aufko.Firma = ' + QUOTER(Firma) + ' AND ' */
  492. /* + 'Aufko.Auf_Sta = ' + STRING(Auf_Sta) + ' '. */
  493. xString = 'FOR EACH Artbw NO-LOCK WHERE Artbw.Firma = "&1" '
  494. + 'AND Artbw.Artnr = &2 AND Artbw.Inhalt = &3 AND Artbw.Jahr = &4 '.
  495. xString = SUBSTITUTE(xString, Firma, iArtnr, iInhalt, iJahr ).
  496. IF iLager <> 999999 THEN
  497. xString = xString + SUBSTITUTE('AND Artbw.Lager = &1 ', iLager ).
  498. IF iTage <> 999999 THEN DO:
  499. xString = xString + SUBSTITUTE('AND Artbw.Datum <= &1 AND Artbw.Datum >= &2 ', dBisDatum, dVonDatum ).
  500. IF cSort = '' THEN DO:
  501. cSort = 'Datum'.
  502. fDesc = TRUE.
  503. END.
  504. END.
  505. IF cSort = '' THEN
  506. DO:
  507. cSort = 'Datum'.
  508. fDesc = TRUE.
  509. END.
  510. IF cSort = 'Datum' THEN
  511. DO:
  512. IF fDesc THEN cString = ' USE-INDEX Artbw-k9 '.
  513. ELSE cString = ' USE-INDEX Artbw-k2 '.
  514. ix = INDEX(xString, ' WHERE').
  515. xString = SUBSTRING(xString, 01, ix)
  516. + cString
  517. + SUBSTRING(xString, ix).
  518. END.
  519. xString = xString + ' INDEXED-REPOSITION '.
  520. { incl/datopenquery.i }
  521. IF xWhere <> '' THEN DYNAMIC-FUNCTION('setQueryWhere':U , INPUT xWhere ).
  522. IF xString <> '' THEN DYNAMIC-FUNCTION('setQueryString':U, INPUT xString).
  523. IF LOOKUP('Datum', xSort, ' ') = 0 THEN
  524. DO:
  525. xSort = xSort + ' BY Datum DESCENDING '.
  526. END.
  527. IF xSort <> '' THEN DYNAMIC-FUNCTION('setQuerySort':U, INPUT xSort ).
  528. RETURN SUPER( ).
  529. END FUNCTION.
  530. /* _UIB-CODE-BLOCK-END */
  531. &ANALYZE-RESUME
  532. {&DB-REQUIRED-END}
  533. {&DB-REQUIRED-START}
  534. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION setLager dTables _DB-REQUIRED
  535. FUNCTION setLager RETURNS LOGICAL
  536. ( ipLager AS INTEGER ) :
  537. /*------------------------------------------------------------------------------
  538. Purpose:
  539. Notes:
  540. ------------------------------------------------------------------------------*/
  541. iLager = ipLager.
  542. RETURN DYNAMIC-FUNCTION('openQuery':U).
  543. END FUNCTION.
  544. /* _UIB-CODE-BLOCK-END */
  545. &ANALYZE-RESUME
  546. {&DB-REQUIRED-END}