g-reorg-preise.w 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. &ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI ADM2
  2. &ANALYZE-RESUME
  3. &Scoped-define WINDOW-NAME CURRENT-WINDOW
  4. &Scoped-define FRAME-NAME gTReorgPreise
  5. {adecomm/appserv.i}
  6. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS gTReorgPreise
  7. /*------------------------------------------------------------------------
  8. File:
  9. Description: from cntnrdlg.w - ADM2 SmartDialog Template
  10. Input Parameters:
  11. <none>
  12. Output Parameters:
  13. <none>
  14. Author:
  15. Created:
  16. ------------------------------------------------------------------------*/
  17. /* This .W file was created with the Progress AppBuilder. */
  18. /*----------------------------------------------------------------------*/
  19. /* Create an unnamed pool to store all the widgets created
  20. by this procedure. This is a good default which assures
  21. that this procedure's triggers and internal procedures
  22. will execute in this procedure's storage, and that proper
  23. cleanup will occur on deletion of the procedure. */
  24. CREATE WIDGET-POOL.
  25. /* *************************** Definitions ************************** */
  26. /* Parameters Definitions --- */
  27. /* Local Variable Definitions --- */
  28. { incl/dlgdefinition.i }
  29. { src/adm2/widgetprto.i }
  30. /* _UIB-CODE-BLOCK-END */
  31. &ANALYZE-RESUME
  32. &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
  33. /* ******************** Preprocessor Definitions ******************** */
  34. &Scoped-define PROCEDURE-TYPE SmartDialog
  35. &Scoped-define DB-AWARE no
  36. &Scoped-define ADM-CONTAINER DIALOG-BOX
  37. &Scoped-define ADM-SUPPORTED-LINKS Data-Target,Data-Source,Page-Target,Update-Source,Update-Target
  38. /* Name of designated FRAME-NAME and/or first browse and/or first query */
  39. &Scoped-define FRAME-NAME gTReorgPreise
  40. /* Standard List Definitions */
  41. &Scoped-Define ENABLED-OBJECTS RECT-2 F_bisDatum Btn_OK Btn_Cancel
  42. &Scoped-Define DISPLAYED-OBJECTS F_bisDatum
  43. /* Custom List Definitions */
  44. /* List-1,List-2,List-3,List-4,List-5,List-6 */
  45. /* _UIB-PREPROCESSOR-BLOCK-END */
  46. &ANALYZE-RESUME
  47. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "SmartDialogCues" gTReorgPreise _INLINE
  48. /* Actions: adecomm/_so-cue.w ? adecomm/_so-cued.p ? adecomm/_so-cuew.p */
  49. /* SmartDialog,ab,49267
  50. Destroy on next read */
  51. /* _UIB-CODE-BLOCK-END */
  52. &ANALYZE-RESUME
  53. /* *********************** Control Definitions ********************** */
  54. /* Define a dialog box */
  55. /* Definitions of the field level widgets */
  56. DEFINE BUTTON Btn_Cancel AUTO-END-KEY
  57. LABEL "abbrechen"
  58. SIZE 15 BY 1.
  59. DEFINE BUTTON Btn_OK AUTO-GO
  60. LABEL "OK"
  61. SIZE 15 BY 1.
  62. DEFINE VARIABLE F_bisDatum AS DATE FORMAT "99.99.9999":U INITIAL ?
  63. LABEL "bis gültig ab Datum"
  64. VIEW-AS FILL-IN NATIVE
  65. SIZE 16 BY 1
  66. BGCOLOR 15 NO-UNDO.
  67. DEFINE RECTANGLE RECT-2
  68. EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
  69. SIZE 60 BY 4.
  70. /* ************************ Frame Definitions *********************** */
  71. DEFINE FRAME gTReorgPreise
  72. F_bisDatum AT ROW 2 COL 30 COLON-ALIGNED WIDGET-ID 4
  73. Btn_OK AT ROW 6 COL 13.8
  74. Btn_Cancel AT ROW 6 COL 35
  75. "alle inaktiven Preise werden definitiv gelöscht" VIEW-AS TEXT
  76. SIZE 54 BY 1 AT ROW 4 COL 6 WIDGET-ID 6
  77. BGCOLOR 12 FONT 6
  78. RECT-2 AT ROW 1.48 COL 3 WIDGET-ID 2
  79. SPACE(1.99) SKIP(2.32)
  80. WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER
  81. SIDE-LABELS NO-UNDERLINE THREE-D SCROLLABLE
  82. TITLE "Löschen von inaktiven Preisen"
  83. CANCEL-BUTTON Btn_Cancel WIDGET-ID 100.
  84. /* *********************** Procedure Settings ************************ */
  85. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  86. /* Settings for THIS-PROCEDURE
  87. Type: SmartDialog
  88. Allow: Basic,Browse,DB-Fields,Query,Smart
  89. Container Links: Data-Target,Data-Source,Page-Target,Update-Source,Update-Target
  90. Design Page: 1
  91. Other Settings: COMPILE APPSERVER
  92. */
  93. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  94. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB gTReorgPreise
  95. /* ************************* Included-Libraries *********************** */
  96. {src/adm2/containr.i}
  97. /* _UIB-CODE-BLOCK-END */
  98. &ANALYZE-RESUME
  99. /* *********** Runtime Attributes and AppBuilder Settings *********** */
  100. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  101. /* SETTINGS FOR DIALOG-BOX gTReorgPreise
  102. FRAME-NAME */
  103. ASSIGN
  104. FRAME gTReorgPreise:SCROLLABLE = FALSE
  105. FRAME gTReorgPreise:HIDDEN = TRUE.
  106. /* _RUN-TIME-ATTRIBUTES-END */
  107. &ANALYZE-RESUME
  108. /* Setting information for Queries and Browse Widgets fields */
  109. &ANALYZE-SUSPEND _QUERY-BLOCK DIALOG-BOX gTReorgPreise
  110. /* Query rebuild information for DIALOG-BOX gTReorgPreise
  111. _Options = "SHARE-LOCK"
  112. _Query is NOT OPENED
  113. */ /* DIALOG-BOX gTReorgPreise */
  114. &ANALYZE-RESUME
  115. /* ************************ Control Triggers ************************ */
  116. &Scoped-define SELF-NAME gTReorgPreise
  117. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL gTReorgPreise gTReorgPreise
  118. ON END-ERROR OF FRAME gTReorgPreise /* Löschen von inaktiven Preisen */
  119. DO:
  120. RUN ENDE.
  121. RETURN NO-APPLY.
  122. END.
  123. /* _UIB-CODE-BLOCK-END */
  124. &ANALYZE-RESUME
  125. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL gTReorgPreise gTReorgPreise
  126. ON WINDOW-CLOSE OF FRAME gTReorgPreise /* Löschen von inaktiven Preisen */
  127. DO:
  128. RUN ENDE.
  129. RETURN NO-APPLY.
  130. END.
  131. /* _UIB-CODE-BLOCK-END */
  132. &ANALYZE-RESUME
  133. &Scoped-define SELF-NAME Btn_Cancel
  134. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_Cancel gTReorgPreise
  135. ON CHOOSE OF Btn_Cancel IN FRAME gTReorgPreise /* abbrechen */
  136. DO:
  137. RUN ENDE.
  138. RETURN NO-APPLY.
  139. END.
  140. /* _UIB-CODE-BLOCK-END */
  141. &ANALYZE-RESUME
  142. &Scoped-define SELF-NAME Btn_OK
  143. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_OK gTReorgPreise
  144. ON CHOOSE OF Btn_OK IN FRAME gTReorgPreise /* OK */
  145. DO:
  146. btnOK = TRUE.
  147. ASSIGN F_bisDatum NO-ERROR.
  148. IF ERROR-STATUS:ERROR THEN DO:
  149. APPLY 'ENTRY' TO F_bisDatum.
  150. RETURN NO-APPLY.
  151. END.
  152. IF F_bisDatum > (TODAY - 30) THEN DO:
  153. APPLY 'ENTRY' TO F_bisDatum.
  154. RETURN NO-APPLY.
  155. END.
  156. SESSION:SET-WAIT-STATE('GENERAL').
  157. RUN LOESCHEN.
  158. SESSION:SET-WAIT-STATE('').
  159. RUN ENDE.
  160. RETURN NO-APPLY.
  161. END.
  162. /* _UIB-CODE-BLOCK-END */
  163. &ANALYZE-RESUME
  164. &UNDEFINE SELF-NAME
  165. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK gTReorgPreise
  166. /* *************************** Main Block *************************** */
  167. { incl/dlgmainblock.i }
  168. {src/adm2/dialogmn.i}
  169. /* _UIB-CODE-BLOCK-END */
  170. &ANALYZE-RESUME
  171. /* ********************** Internal Procedures *********************** */
  172. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects gTReorgPreise _ADM-CREATE-OBJECTS
  173. PROCEDURE adm-create-objects :
  174. /*------------------------------------------------------------------------------
  175. Purpose: Create handles for all SmartObjects used in this procedure.
  176. After SmartObjects are initialized, then SmartLinks are added.
  177. Parameters: <none>
  178. ------------------------------------------------------------------------------*/
  179. END PROCEDURE.
  180. /* _UIB-CODE-BLOCK-END */
  181. &ANALYZE-RESUME
  182. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI gTReorgPreise _DEFAULT-DISABLE
  183. PROCEDURE disable_UI :
  184. /*------------------------------------------------------------------------------
  185. Purpose: DISABLE the User Interface
  186. Parameters: <none>
  187. Notes: Here we clean-up the user-interface by deleting
  188. dynamic widgets we have created and/or hide
  189. frames. This procedure is usually called when
  190. we are ready to "clean-up" after running.
  191. ------------------------------------------------------------------------------*/
  192. /* Hide all frames. */
  193. HIDE FRAME gTReorgPreise.
  194. END PROCEDURE.
  195. /* _UIB-CODE-BLOCK-END */
  196. &ANALYZE-RESUME
  197. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enableObject gTReorgPreise
  198. PROCEDURE enableObject :
  199. /*------------------------------------------------------------------------------
  200. Purpose: Super Override
  201. Parameters:
  202. Notes:
  203. ------------------------------------------------------------------------------*/
  204. F_bisDatum = TODAY - 60.
  205. { incl/dlgenableobject.i }
  206. END PROCEDURE.
  207. /* _UIB-CODE-BLOCK-END */
  208. &ANALYZE-RESUME
  209. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI gTReorgPreise _DEFAULT-ENABLE
  210. PROCEDURE enable_UI :
  211. /*------------------------------------------------------------------------------
  212. Purpose: ENABLE the User Interface
  213. Parameters: <none>
  214. Notes: Here we display/view/enable the widgets in the
  215. user-interface. In addition, OPEN all queries
  216. associated with each FRAME and BROWSE.
  217. These statements here are based on the "Other
  218. Settings" section of the widget Property Sheets.
  219. ------------------------------------------------------------------------------*/
  220. DISPLAY F_bisDatum
  221. WITH FRAME gTReorgPreise.
  222. ENABLE RECT-2 F_bisDatum Btn_OK Btn_Cancel
  223. WITH FRAME gTReorgPreise.
  224. VIEW FRAME gTReorgPreise.
  225. {&OPEN-BROWSERS-IN-QUERY-gTReorgPreise}
  226. END PROCEDURE.
  227. /* _UIB-CODE-BLOCK-END */
  228. &ANALYZE-RESUME
  229. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE ENDE gTReorgPreise
  230. PROCEDURE ENDE :
  231. /*------------------------------------------------------------------------------
  232. Purpose:
  233. Parameters: <none>
  234. Notes:
  235. ------------------------------------------------------------------------------*/
  236. IF btnOK THEN DO:
  237. END.
  238. { incl/dlgende.i }
  239. END PROCEDURE.
  240. /* _UIB-CODE-BLOCK-END */
  241. &ANALYZE-RESUME
  242. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE LOESCHEN gTReorgPreise
  243. PROCEDURE LOESCHEN :
  244. /*------------------------------------------------------------------------------
  245. Purpose:
  246. Parameters: <none>
  247. Notes:
  248. ------------------------------------------------------------------------------*/
  249. FOR EACH ArtPreis
  250. WHERE ArtPreis.Firma = Firma
  251. AND ArtPreis.Aktiv = FALSE
  252. AND ArtPreis.ab_Datum <= F_bisDatum :
  253. IF ArtPreis.Aktion THEN DO:
  254. FIND AktPreis
  255. WHERE AktPreis.Firma = ArtPreis.Firma
  256. AND AktPreis.Artnr = ArtPreis.Artnr
  257. AND AktPreis.Inhalt = ArtPreis.Inhalt
  258. AND AktPreis.Jahr = ArtPreis.Jahr
  259. AND AktPreis.ab_Datum = ArtPreis.ab_Datum
  260. AND AktPreis.Grp = ArtPreis.Preis_Grp NO-ERROR.
  261. IF AVAILABLE AktPreis THEN DELETE AktPreis.
  262. END.
  263. DELETE ArtPreis.
  264. END.
  265. FOR EACH AktPreis
  266. WHERE AktPreis.Firma = ArtPreis.Firma
  267. AND AktPreis.bis_Datum <= F_bisDatum:
  268. FIND ArtPreis
  269. WHERE ArtPreis.Firma = AktPreis.Firma
  270. AND ArtPreis.Artnr = AktPreis.Artnr
  271. AND ArtPreis.Inhalt = AktPreis.Inhalt
  272. AND ArtPreis.Jahr = AktPreis.Jahr
  273. AND ArtPreis.ab_Datum = AktPreis.ab_Datum
  274. AND ArtPreis.Preis_Grp = AktPreis.Grp NO-ERROR.
  275. IF AVAILABLE ArtPreis THEN NEXT.
  276. DELETE AktPreis.
  277. END.
  278. END PROCEDURE.
  279. /* _UIB-CODE-BLOCK-END */
  280. &ANALYZE-RESUME