d-rabtab.w 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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 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 RabTab
  49. /* Definitions for QUERY Query-Main */
  50. &Scoped-Define ENABLED-FIELDS Firma Ku_Rab KuRabGrp Art_Rab ArRabGrp Proz_Betr Rab_Art Wert Rab_Summ~
  51. Add_Art
  52. &Scoped-define ENABLED-FIELDS-IN-RabTab Firma Ku_Rab Art_Rab Proz_Betr ~
  53. Rab_Art Wert Rab_Summ Add_Art
  54. &Scoped-Define DATA-FIELDS Firma Ku_Rab KuRabGrp Art_Rab ArRabGrp Proz_Betr Rab_Art Wert Rab_Summ~
  55. Add_Art
  56. &Scoped-define DATA-FIELDS-IN-RabTab Firma Ku_Rab Art_Rab Proz_Betr Rab_Art ~
  57. Wert Rab_Summ Add_Art
  58. &Scoped-Define MANDATORY-FIELDS
  59. &Scoped-Define APPLICATION-SERVICE
  60. &Scoped-Define ASSIGN-LIST
  61. &Scoped-Define DATA-FIELD-DEFS "d-rabtab.i"
  62. {&DB-REQUIRED-START}
  63. &Scoped-define OPEN-QUERY-Query-Main OPEN QUERY Query-Main FOR EACH RabTab NO-LOCK INDEXED-REPOSITION.
  64. {&DB-REQUIRED-END}
  65. &Scoped-define TABLES-IN-QUERY-Query-Main RabTab
  66. &Scoped-define FIRST-TABLE-IN-QUERY-Query-Main RabTab
  67. /* Custom List Definitions */
  68. /* List-1,List-2,List-3,List-4,List-5,List-6 */
  69. /* _UIB-PREPROCESSOR-BLOCK-END */
  70. &ANALYZE-RESUME
  71. /* ************************ Function Prototypes ********************** */
  72. {&DB-REQUIRED-START}
  73. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD ARTIRABGRP dTables _DB-REQUIRED
  74. FUNCTION ARTIRABGRP RETURNS CHARACTER
  75. ( ipGrp AS INT ) FORWARD.
  76. /* _UIB-CODE-BLOCK-END */
  77. &ANALYZE-RESUME
  78. {&DB-REQUIRED-END}
  79. {&DB-REQUIRED-START}
  80. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD KUNDRABGRP dTables _DB-REQUIRED
  81. FUNCTION KUNDRABGRP RETURNS CHARACTER
  82. ( ipGrp AS INT ) 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 openQuery dTables _DB-REQUIRED
  88. FUNCTION openQuery RETURNS LOGICAL
  89. ( /* parameter-definitions */ ) FORWARD.
  90. /* _UIB-CODE-BLOCK-END */
  91. &ANALYZE-RESUME
  92. {&DB-REQUIRED-END}
  93. /* *********************** Control Definitions ********************** */
  94. {&DB-REQUIRED-START}
  95. /* Query definitions */
  96. &ANALYZE-SUSPEND
  97. DEFINE QUERY Query-Main FOR
  98. RabTab SCROLLING.
  99. &ANALYZE-RESUME
  100. {&DB-REQUIRED-END}
  101. /* ************************ Frame Definitions *********************** */
  102. /* *********************** Procedure Settings ************************ */
  103. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  104. /* Settings for THIS-PROCEDURE
  105. Type: SmartDataObject
  106. Allow: Query
  107. Frames: 0
  108. Add Fields to: Neither
  109. Other Settings: PERSISTENT-ONLY COMPILE APPSERVER DB-AWARE
  110. */
  111. /* This procedure should always be RUN PERSISTENT. Report the error, */
  112. /* then cleanup and return. */
  113. IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
  114. MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
  115. VIEW-AS ALERT-BOX ERROR BUTTONS OK.
  116. RETURN.
  117. END.
  118. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  119. /* ************************* Create Window ************************** */
  120. &ANALYZE-SUSPEND _CREATE-WINDOW
  121. /* DESIGN Window definition (used by the UIB)
  122. CREATE WINDOW dTables ASSIGN
  123. HEIGHT = 1.62
  124. WIDTH = 46.6.
  125. /* END WINDOW DEFINITION */
  126. */
  127. &ANALYZE-RESUME
  128. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB dTables
  129. /* ************************* Included-Libraries *********************** */
  130. {src/adm2/data.i}
  131. /* _UIB-CODE-BLOCK-END */
  132. &ANALYZE-RESUME
  133. /* *********** Runtime Attributes and AppBuilder Settings *********** */
  134. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  135. /* SETTINGS FOR WINDOW dTables
  136. VISIBLE,,RUN-PERSISTENT */
  137. /* _RUN-TIME-ATTRIBUTES-END */
  138. &ANALYZE-RESUME
  139. /* Setting information for Queries and Browse Widgets fields */
  140. &ANALYZE-SUSPEND _QUERY-BLOCK QUERY Query-Main
  141. /* Query rebuild information for SmartDataObject Query-Main
  142. _TblList = "AnaDat.RabTab"
  143. _Options = "NO-LOCK INDEXED-REPOSITION"
  144. _FldNameList[1] > AnaDat.RabTab.Firma
  145. "Firma" "Firma" ? ? "character" ? ? ? ? ? ? yes ? no 8 yes
  146. _FldNameList[2] > AnaDat.RabTab.Ku_Rab
  147. "Ku_Rab" "Ku_Rab" "Ku.Rabgrp." ? "integer" ? ? ? ? ? ? yes ? no 7.8 yes
  148. _FldNameList[3] > "_<CALC>"
  149. "DYNAMIC-FUNCTION('KUNDRABGRP':U, INPUT RowObject.Ku_Rab)" "KuRabGrp" "Rabattgruppe Kunde" "x(20)" "Character" ? ? ? ? ? ? yes ? no 20 no
  150. _FldNameList[4] > AnaDat.RabTab.Art_Rab
  151. "Art_Rab" "Art_Rab" "Art.Rabgrp." ? "integer" ? ? ? ? ? ? yes ? no 7.8 yes
  152. _FldNameList[5] > "_<CALC>"
  153. "DYNAMIC-FUNCTION('ARTIRABGRP':U, INPUT RowObject.Art_Rab)" "ArRabGrp" "Rabattgruppe Artikel" "x(20)" "character" ? ? ? ? ? ? yes ? no 20 no
  154. _FldNameList[6] > AnaDat.RabTab.Proz_Betr
  155. "Proz_Betr" "Proz_Betr" ? ? "logical" ? ? ? ? ? ? yes ? no 9.2 yes
  156. _FldNameList[7] > AnaDat.RabTab.Rab_Art
  157. "Rab_Art" "Rab_Art" "Rab-Art" ? "integer" ? ? ? ? ? ? yes ? no 7.8 yes
  158. _FldNameList[8] > AnaDat.RabTab.Wert
  159. "Wert" "Wert" ? ? "decimal" ? ? ? ? ? ? yes ? no 6.8 yes
  160. _FldNameList[9] > AnaDat.RabTab.Rab_Summ
  161. "Rab_Summ" "Rab_Summ" "RabSumme" ? "integer" ? ? ? ? ? ? yes ? no 11 yes
  162. _FldNameList[10] > AnaDat.RabTab.Add_Art
  163. "Add_Art" "Add_Art" "Add-Art" ? "integer" ? ? ? ? ? ? yes ? no 7.6 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. &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
  174. RUN initializeObject.
  175. &ENDIF
  176. /* _UIB-CODE-BLOCK-END */
  177. &ANALYZE-RESUME
  178. /* ********************** Internal Procedures *********************** */
  179. {&DB-REQUIRED-START}
  180. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE DATA.CALCULATE dTables DATA.CALCULATE _DB-REQUIRED
  181. PROCEDURE DATA.CALCULATE :
  182. /*------------------------------------------------------------------------------
  183. Purpose: Calculate all the Calculated Expressions found in the
  184. SmartDataObject.
  185. Parameters: <none>
  186. ------------------------------------------------------------------------------*/
  187. ASSIGN
  188. rowObject.ArRabGrp = (DYNAMIC-FUNCTION('ARTIRABGRP':U, INPUT RowObject.Art_Rab))
  189. rowObject.KuRabGrp = (DYNAMIC-FUNCTION('KUNDRABGRP':U, INPUT RowObject.Ku_Rab))
  190. .
  191. END PROCEDURE.
  192. /* _UIB-CODE-BLOCK-END */
  193. &ANALYZE-RESUME
  194. {&DB-REQUIRED-END}
  195. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI dTables _DEFAULT-DISABLE
  196. PROCEDURE disable_UI :
  197. /*------------------------------------------------------------------------------
  198. Purpose: DISABLE the User Interface
  199. Parameters: <none>
  200. Notes: Here we clean-up the user-interface by deleting
  201. dynamic widgets we have created and/or hide
  202. frames. This procedure is usually called when
  203. we are ready to "clean-up" after running.
  204. ------------------------------------------------------------------------------*/
  205. /* Hide all frames. */
  206. IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
  207. END PROCEDURE.
  208. /* _UIB-CODE-BLOCK-END */
  209. &ANALYZE-RESUME
  210. /* ************************ Function Implementations ***************** */
  211. {&DB-REQUIRED-START}
  212. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION ARTIRABGRP dTables _DB-REQUIRED
  213. FUNCTION ARTIRABGRP RETURNS CHARACTER
  214. ( ipGrp AS INT ) :
  215. /*------------------------------------------------------------------------------
  216. Purpose:
  217. Notes:
  218. ------------------------------------------------------------------------------*/
  219. FIND Tabel USE-INDEX Tabel-k2
  220. WHERE Tabel.Firma = Firma
  221. AND Tabel.RecArt = 'ARABGRP'
  222. AND Tabel.CodeI = ipGrp
  223. AND Tabel.CodeC = ''
  224. AND Tabel.Sprcd = 1 NO-LOCK NO-ERROR.
  225. IF AVAILABLE Tabel THEN RETURN Tabel.Bez1.
  226. ELSE RETURN "??????????".
  227. END FUNCTION.
  228. /* _UIB-CODE-BLOCK-END */
  229. &ANALYZE-RESUME
  230. {&DB-REQUIRED-END}
  231. {&DB-REQUIRED-START}
  232. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION KUNDRABGRP dTables _DB-REQUIRED
  233. FUNCTION KUNDRABGRP RETURNS CHARACTER
  234. ( ipGrp AS INT ) :
  235. /*------------------------------------------------------------------------------
  236. Purpose:
  237. Notes:
  238. ------------------------------------------------------------------------------*/
  239. FIND Tabel USE-INDEX Tabel-k2
  240. WHERE Tabel.Firma = Firma
  241. AND Tabel.RecArt = 'RABGRP'
  242. AND Tabel.CodeI = ipGrp
  243. AND Tabel.CodeC = ''
  244. AND Tabel.Sprcd = 1 NO-LOCK NO-ERROR.
  245. IF AVAILABLE Tabel THEN RETURN Tabel.Bez1.
  246. ELSE RETURN "??????????".
  247. END FUNCTION.
  248. /* _UIB-CODE-BLOCK-END */
  249. &ANALYZE-RESUME
  250. {&DB-REQUIRED-END}
  251. {&DB-REQUIRED-START}
  252. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION openQuery dTables _DB-REQUIRED
  253. FUNCTION openQuery RETURNS LOGICAL
  254. ( /* parameter-definitions */ ) :
  255. /*------------------------------------------------------------------------------
  256. Purpose: Super Override
  257. Notes:
  258. ------------------------------------------------------------------------------*/
  259. xWhere = 'RabTab.Firma = "' + Firma + '" '.
  260. DYNAMIC-FUNCTION('setQueryWhere':U, INPUT xWhere).
  261. /* xSort = ''. */
  262. /* DYNAMIC-FUNCTION('setQuerySort':U, INPUT xSort). */
  263. /* xWhere = ''. */
  264. /* DYNAMIC-FUNCTION('setQueryString':U, INPUT xWhere). */
  265. RETURN SUPER( ).
  266. END FUNCTION.
  267. /* _UIB-CODE-BLOCK-END */
  268. &ANALYZE-RESUME
  269. {&DB-REQUIRED-END}