d-aufgebko.w 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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. DEF VAR xWhere AS CHAR NO-UNDO.
  30. DEF VAR xSort AS CHAR NO-UNDO.
  31. DEF VAR Firma AS CHAR NO-UNDO.
  32. DEF VAR SAktiv AS LOG NO-UNDO INIT FALSE.
  33. /* _UIB-CODE-BLOCK-END */
  34. &ANALYZE-RESUME
  35. &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
  36. /* ******************** Preprocessor Definitions ******************** */
  37. &Scoped-define PROCEDURE-TYPE SmartDataObject
  38. &Scoped-define DB-AWARE yes
  39. &Scoped-define ADM-SUPPORTED-LINKS Data-Source,Data-Target,Navigation-Target,Update-Target,Commit-Target,Filter-Target
  40. /* Db-Required definitions. */
  41. &IF DEFINED(DB-REQUIRED) = 0 &THEN
  42. &GLOBAL-DEFINE DB-REQUIRED TRUE
  43. &ENDIF
  44. &GLOBAL-DEFINE DB-REQUIRED-START &IF {&DB-REQUIRED} &THEN
  45. &GLOBAL-DEFINE DB-REQUIRED-END &ENDIF
  46. &Scoped-define QUERY-NAME Query-Main
  47. /* Internal Tables (found by Frame, Query & Browse Queries) */
  48. &Scoped-define INTERNAL-TABLES AufGebKo
  49. /* Definitions for QUERY Query-Main */
  50. &Scoped-Define ENABLED-FIELDS Firma Aufnr Geb_Cd Menge Bez Total Sort_Cd Kto_Cd1 Anz_1 Wert_1 Betrag_1~
  51. Kto_Cd2 Anz_2 Wert_2 Betrag_2 Kto_Cd3 Anz_3 Wert_3 Betrag_3
  52. &Scoped-define ENABLED-FIELDS-IN-AufGebKo Firma Aufnr Geb_Cd Menge Sort_Cd ~
  53. Kto_Cd1 Anz_1 Wert_1 Betrag_1 Kto_Cd2 Anz_2 Wert_2 Betrag_2 Kto_Cd3 Anz_3 ~
  54. Wert_3 Betrag_3
  55. &Scoped-Define DATA-FIELDS Firma Aufnr Geb_Cd Menge Bez Total Sort_Cd Kto_Cd1 Anz_1 Wert_1 Betrag_1~
  56. Kto_Cd2 Anz_2 Wert_2 Betrag_2 Kto_Cd3 Anz_3 Wert_3 Betrag_3
  57. &Scoped-define DATA-FIELDS-IN-AufGebKo Firma Aufnr Geb_Cd Menge Sort_Cd ~
  58. Kto_Cd1 Anz_1 Wert_1 Betrag_1 Kto_Cd2 Anz_2 Wert_2 Betrag_2 Kto_Cd3 Anz_3 ~
  59. Wert_3 Betrag_3
  60. &Scoped-Define MANDATORY-FIELDS
  61. &Scoped-Define APPLICATION-SERVICE
  62. &Scoped-Define ASSIGN-LIST
  63. &Scoped-Define DATA-FIELD-DEFS "d-aufgebko.i"
  64. &Scoped-define QUERY-STRING-Query-Main FOR EACH AufGebKo NO-LOCK INDEXED-REPOSITION
  65. {&DB-REQUIRED-START}
  66. &Scoped-define OPEN-QUERY-Query-Main OPEN QUERY Query-Main FOR EACH AufGebKo NO-LOCK INDEXED-REPOSITION.
  67. {&DB-REQUIRED-END}
  68. &Scoped-define TABLES-IN-QUERY-Query-Main AufGebKo
  69. &Scoped-define FIRST-TABLE-IN-QUERY-Query-Main AufGebKo
  70. /* Custom List Definitions */
  71. /* List-1,List-2,List-3,List-4,List-5,List-6 */
  72. /* _UIB-PREPROCESSOR-BLOCK-END */
  73. &ANALYZE-RESUME
  74. /* ************************ Function Prototypes ********************** */
  75. {&DB-REQUIRED-START}
  76. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD getBez dTables _DB-REQUIRED
  77. FUNCTION getBez RETURNS CHARACTER
  78. ( Geb_cd AS CHAR ) FORWARD.
  79. /* _UIB-CODE-BLOCK-END */
  80. &ANALYZE-RESUME
  81. {&DB-REQUIRED-END}
  82. {&DB-REQUIRED-START}
  83. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD openQuery dTables _DB-REQUIRED
  84. FUNCTION openQuery RETURNS LOGICAL
  85. ( /* parameter-definitions */ ) FORWARD.
  86. /* _UIB-CODE-BLOCK-END */
  87. &ANALYZE-RESUME
  88. {&DB-REQUIRED-END}
  89. /* *********************** Control Definitions ********************** */
  90. {&DB-REQUIRED-START}
  91. /* Query definitions */
  92. &ANALYZE-SUSPEND
  93. DEFINE QUERY Query-Main FOR
  94. AufGebKo SCROLLING.
  95. &ANALYZE-RESUME
  96. {&DB-REQUIRED-END}
  97. /* ************************ Frame Definitions *********************** */
  98. /* *********************** Procedure Settings ************************ */
  99. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  100. /* Settings for THIS-PROCEDURE
  101. Type: SmartDataObject
  102. Allow: Query
  103. Frames: 0
  104. Add Fields to: Neither
  105. Other Settings: PERSISTENT-ONLY COMPILE APPSERVER DB-AWARE
  106. */
  107. /* This procedure should always be RUN PERSISTENT. Report the error, */
  108. /* then cleanup and return. */
  109. IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
  110. MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
  111. VIEW-AS ALERT-BOX ERROR BUTTONS OK.
  112. RETURN.
  113. END.
  114. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  115. /* ************************* Create Window ************************** */
  116. &ANALYZE-SUSPEND _CREATE-WINDOW
  117. /* DESIGN Window definition (used by the UIB)
  118. CREATE WINDOW dTables ASSIGN
  119. HEIGHT = 1.62
  120. WIDTH = 46.6.
  121. /* END WINDOW DEFINITION */
  122. */
  123. &ANALYZE-RESUME
  124. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB dTables
  125. /* ************************* Included-Libraries *********************** */
  126. {src/adm2/data.i}
  127. /* _UIB-CODE-BLOCK-END */
  128. &ANALYZE-RESUME
  129. /* *********** Runtime Attributes and AppBuilder Settings *********** */
  130. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  131. /* SETTINGS FOR WINDOW dTables
  132. VISIBLE,,RUN-PERSISTENT */
  133. /* _RUN-TIME-ATTRIBUTES-END */
  134. &ANALYZE-RESUME
  135. /* Setting information for Queries and Browse Widgets fields */
  136. &ANALYZE-SUSPEND _QUERY-BLOCK QUERY Query-Main
  137. /* Query rebuild information for SmartDataObject Query-Main
  138. _TblList = "AnaDat.AufGebKo"
  139. _Options = "NO-LOCK INDEXED-REPOSITION"
  140. _FldNameList[1] > AnaDat.AufGebKo.Firma
  141. "Firma" "Firma" ? ? "character" ? ? ? ? ? ? yes ? no 8 yes ""
  142. _FldNameList[2] > AnaDat.AufGebKo.Aufnr
  143. "Aufnr" "Aufnr" ? ? "integer" ? ? ? ? ? ? yes ? no 7.2 yes ""
  144. _FldNameList[3] > AnaDat.AufGebKo.Geb_Cd
  145. "Geb_Cd" "Geb_Cd" ? ? "character" ? ? ? ? ? ? yes ? no 10 yes ""
  146. _FldNameList[4] > AnaDat.AufGebKo.Menge
  147. "Menge" "Menge" ? ? "decimal" ? ? ? ? ? ? yes ? no 6.6 yes ""
  148. _FldNameList[5] > "_<CALC>"
  149. "DYNAMIC-FUNCTION('getBez':U IN THIS-PROCEDURE, INPUT RowObject.Geb_Cd)" "Bez" "Bezeichnung" "x(30)" "character" ? ? ? ? ? ? yes ? no 30 no ?
  150. _FldNameList[6] > "_<CALC>"
  151. "RowObject.Betrag_1 + RowObject.Betrag_2 + RowObject.Betrag_3" "Total" "Total" "->>>,>>9.999" "Decimal" ? ? ? ? ? ? yes ? no 12.6 no ?
  152. _FldNameList[7] > AnaDat.AufGebKo.Sort_Cd
  153. "Sort_Cd" "Sort_Cd" ? ? "character" ? ? ? ? ? ? yes ? no 7.6 yes ""
  154. _FldNameList[8] > AnaDat.AufGebKo.Kto_Cd1
  155. "Kto_Cd1" "Kto_Cd1" ? ? "character" ? ? ? ? ? ? yes ? no 8.2 yes ""
  156. _FldNameList[9] > AnaDat.AufGebKo.Anz_1
  157. "Anz_1" "Anz_1" ? ? "integer" ? ? ? ? ? ? yes ? no 6 yes ""
  158. _FldNameList[10] > AnaDat.AufGebKo.Wert_1
  159. "Wert_1" "Wert_1" ? ? "decimal" ? ? ? ? ? ? yes ? no 9.4 yes ""
  160. _FldNameList[11] > AnaDat.AufGebKo.Betrag_1
  161. "Betrag_1" "Betrag_1" ? ? "decimal" ? ? ? ? ? ? yes ? no 10.4 yes ""
  162. _FldNameList[12] > AnaDat.AufGebKo.Kto_Cd2
  163. "Kto_Cd2" "Kto_Cd2" ? ? "character" ? ? ? ? ? ? yes ? no 8.2 yes ""
  164. _FldNameList[13] > AnaDat.AufGebKo.Anz_2
  165. "Anz_2" "Anz_2" ? ? "integer" ? ? ? ? ? ? yes ? no 6 yes ""
  166. _FldNameList[14] > AnaDat.AufGebKo.Wert_2
  167. "Wert_2" "Wert_2" ? ? "decimal" ? ? ? ? ? ? yes ? no 9.4 yes ""
  168. _FldNameList[15] > AnaDat.AufGebKo.Betrag_2
  169. "Betrag_2" "Betrag_2" ? ? "decimal" ? ? ? ? ? ? yes ? no 10.4 yes ""
  170. _FldNameList[16] > AnaDat.AufGebKo.Kto_Cd3
  171. "Kto_Cd3" "Kto_Cd3" ? ? "character" ? ? ? ? ? ? yes ? no 8.2 yes ""
  172. _FldNameList[17] > AnaDat.AufGebKo.Anz_3
  173. "Anz_3" "Anz_3" ? ? "integer" ? ? ? ? ? ? yes ? no 6 yes ""
  174. _FldNameList[18] > AnaDat.AufGebKo.Wert_3
  175. "Wert_3" "Wert_3" ? ? "decimal" ? ? ? ? ? ? yes ? no 9.4 yes ""
  176. _FldNameList[19] > AnaDat.AufGebKo.Betrag_3
  177. "Betrag_3" "Betrag_3" ? ? "decimal" ? ? ? ? ? ? yes ? no 10.4 yes ""
  178. _Design-Parent is WINDOW dTables @ ( 1.14 , 2.6 )
  179. */ /* QUERY Query-Main */
  180. &ANALYZE-RESUME
  181. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK dTables
  182. /* *************************** Main Block *************************** */
  183. SAktiv = DYNAMIC-FUNCTION('getSuperAktiv':U) NO-ERROR.
  184. IF SAktiv THEN DO:
  185. Firma = DYNAMIC-FUNCTION('GETMANDANT':U) NO-ERROR.
  186. END.
  187. &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
  188. RUN initializeObject.
  189. &ENDIF
  190. /* _UIB-CODE-BLOCK-END */
  191. &ANALYZE-RESUME
  192. /* ********************** Internal Procedures *********************** */
  193. {&DB-REQUIRED-START}
  194. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE DATA.CALCULATE dTables DATA.CALCULATE _DB-REQUIRED
  195. PROCEDURE DATA.CALCULATE :
  196. /*------------------------------------------------------------------------------
  197. Purpose: Calculate all the Calculated Expressions found in the
  198. SmartDataObject.
  199. Parameters: <none>
  200. ------------------------------------------------------------------------------*/
  201. ASSIGN
  202. rowObject.Bez = (DYNAMIC-FUNCTION('getBez':U IN THIS-PROCEDURE, INPUT RowObject.Geb_Cd))
  203. rowObject.Total = (RowObject.Betrag_1 + RowObject.Betrag_2 + RowObject.Betrag_3)
  204. .
  205. END PROCEDURE.
  206. /* _UIB-CODE-BLOCK-END */
  207. &ANALYZE-RESUME
  208. {&DB-REQUIRED-END}
  209. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI dTables _DEFAULT-DISABLE
  210. PROCEDURE disable_UI :
  211. /*------------------------------------------------------------------------------
  212. Purpose: DISABLE the User Interface
  213. Parameters: <none>
  214. Notes: Here we clean-up the user-interface by deleting
  215. dynamic widgets we have created and/or hide
  216. frames. This procedure is usually called when
  217. we are ready to "clean-up" after running.
  218. ------------------------------------------------------------------------------*/
  219. /* Hide all frames. */
  220. IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
  221. END PROCEDURE.
  222. /* _UIB-CODE-BLOCK-END */
  223. &ANALYZE-RESUME
  224. /* ************************ Function Implementations ***************** */
  225. {&DB-REQUIRED-START}
  226. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION getBez dTables _DB-REQUIRED
  227. FUNCTION getBez RETURNS CHARACTER
  228. ( Geb_cd AS CHAR ) :
  229. /*------------------------------------------------------------------------------
  230. Purpose:
  231. Notes:
  232. ------------------------------------------------------------------------------*/
  233. FIND GebRueck USE-INDEX GebRueck-k1
  234. WHERE GebRueck.Firma = Firma
  235. AND GebRueck.Geb_Cd = Geb_Cd NO-LOCK NO-ERROR.
  236. IF AVAILABLE GebRueck THEN RETURN GebRueck.Bez.
  237. RETURN "??????????".
  238. END FUNCTION.
  239. /* _UIB-CODE-BLOCK-END */
  240. &ANALYZE-RESUME
  241. {&DB-REQUIRED-END}
  242. {&DB-REQUIRED-START}
  243. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION openQuery dTables _DB-REQUIRED
  244. FUNCTION openQuery RETURNS LOGICAL
  245. ( /* parameter-definitions */ ) :
  246. /*------------------------------------------------------------------------------
  247. Purpose: Super Override
  248. Notes:
  249. ------------------------------------------------------------------------------*/
  250. /* xWhere = ''. */
  251. /* DYNAMIC-FUNCTION('setQueryWhere':U, INPUT xWhere). */
  252. xSort = 'AufGebKo.Sort_Cd'.
  253. DYNAMIC-FUNCTION('setQuerySort':U, INPUT xSort).
  254. /* xWhere = ''. */
  255. /* DYNAMIC-FUNCTION('setQueryString':U, INPUT xWhere). */
  256. RETURN SUPER( ).
  257. END FUNCTION.
  258. /* _UIB-CODE-BLOCK-END */
  259. &ANALYZE-RESUME
  260. {&DB-REQUIRED-END}