d-kanalabrechnung.w 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI ADM1
  2. &ANALYZE-RESUME
  3. &Scoped-define WINDOW-NAME CURRENT-WINDOW
  4. &Scoped-define FRAME-NAME D-Dialog
  5. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS D-Dialog
  6. /*------------------------------------------------------------------------
  7. File:
  8. Description: from cntnrdlg.w - ADM SmartDialog Template
  9. Input Parameters:
  10. <none>
  11. Output Parameters:
  12. <none>
  13. Author:
  14. Created:
  15. ------------------------------------------------------------------------*/
  16. /* This .W file was created with the Progress UIB. */
  17. /*----------------------------------------------------------------------*/
  18. /* Create an unnamed pool to store all the widgets created
  19. by this procedure. This is a good default which assures
  20. that this procedure's triggers and internal procedures
  21. will execute in this procedure's storage, and that proper
  22. cleanup will occur on deletion of the procedure. */
  23. CREATE WIDGET-POOL.
  24. /* *************************** Definitions ************************** */
  25. /* Parameters Definitions --- */
  26. /* Local Variable Definitions --- */
  27. DEF VAR ok AS LOG NO-UNDO.
  28. DEF VAR VHerst AS INT NO-UNDO.
  29. DEF VAR VWgr AS INT NO-UNDO.
  30. DEF VAR VBiercd AS INT NO-UNDO.
  31. DEF VAR VPreisgrp AS INT NO-UNDO.
  32. DEF VAR VDatum AS DATE NO-UNDO.
  33. DEF VAR BDatum AS DATE NO-UNDO.
  34. DEF TEMP-TABLE TWork FIELD Artnr AS INT
  35. FIELD Inhalt AS INT
  36. FIELD Jahr AS INT
  37. FIELD Eingang AS DEC DECIMALS 4
  38. FIELD EP AS DEC DECIMALS 4
  39. FIELD Ausgang AS DEC DECIMALS 4
  40. FIELD VP AS DEC DECIMALS 4
  41. FIELD RID AS RECID
  42. FIELD Art AS LOG
  43. FIELD Wert AS DEC DECIMALS 4.
  44. /* ---------- Globale Variablen ---------------------------------- */
  45. { v8/globvar.i" " " " "SHARED" }
  46. { v8/debivar.i " " " " "SHARED" }
  47. { v8/artivar.i " " " " "SHARED" }
  48. { v8/contvar.i " " " " "SHARED" }
  49. /* _UIB-CODE-BLOCK-END */
  50. &ANALYZE-RESUME
  51. &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
  52. /* ******************** Preprocessor Definitions ******************** */
  53. &Scoped-define PROCEDURE-TYPE SmartDialog
  54. &Scoped-define DB-AWARE no
  55. &Scoped-define ADM-CONTAINER DIALOG-BOX
  56. /* Name of designated FRAME-NAME and/or first browse and/or first query */
  57. &Scoped-define FRAME-NAME D-Dialog
  58. /* Standard List Definitions */
  59. &Scoped-Define ENABLED-OBJECTS RECT-21 RECT-22 RECT-23 CB_Hersteller ~
  60. CB_Warengrp CB_Vertragsart CB_Preisgruppe F_VonDatum F_BisDatum Btn_Start ~
  61. Btn_Abbrechen
  62. &Scoped-Define DISPLAYED-OBJECTS CB_Hersteller CB_Warengrp CB_Vertragsart ~
  63. CB_Preisgruppe F_VonDatum F_BisDatum
  64. /* Custom List Definitions */
  65. /* List-1,List-2,List-3,List-4,List-5,List-6 */
  66. &Scoped-define List-1 CB_Hersteller CB_Warengrp CB_Vertragsart ~
  67. CB_Preisgruppe F_VonDatum F_BisDatum Btn_Start Btn_Abbrechen
  68. &Scoped-define List-6 CB_Hersteller CB_Warengrp CB_Vertragsart ~
  69. CB_Preisgruppe F_VonDatum F_BisDatum
  70. /* _UIB-PREPROCESSOR-BLOCK-END */
  71. &ANALYZE-RESUME
  72. /* *********************** Control Definitions ********************** */
  73. /* Define a dialog box */
  74. /* Definitions of the field level widgets */
  75. DEFINE BUTTON Btn_Abbrechen
  76. LABEL "&Abbrechen"
  77. SIZE 16 BY 1.
  78. DEFINE BUTTON Btn_Start
  79. LABEL "&Starten"
  80. SIZE 16 BY 1.
  81. DEFINE VARIABLE CB_Hersteller AS CHARACTER FORMAT "X(256)":U
  82. LABEL "Hersteller"
  83. VIEW-AS COMBO-BOX SORT INNER-LINES 5
  84. DROP-DOWN-LIST
  85. SIZE 40 BY 1
  86. BGCOLOR 15 NO-UNDO.
  87. DEFINE VARIABLE CB_Preisgruppe AS CHARACTER FORMAT "X(256)":U
  88. LABEL "Preisgruppe"
  89. VIEW-AS COMBO-BOX INNER-LINES 5
  90. DROP-DOWN-LIST
  91. SIZE 40 BY 1
  92. BGCOLOR 15 NO-UNDO.
  93. DEFINE VARIABLE CB_Vertragsart AS CHARACTER FORMAT "X(256)":U
  94. LABEL "Vertragsart"
  95. VIEW-AS COMBO-BOX INNER-LINES 5
  96. DROP-DOWN-LIST
  97. SIZE 40 BY 1
  98. BGCOLOR 15 NO-UNDO.
  99. DEFINE VARIABLE CB_Warengrp AS CHARACTER FORMAT "X(256)":U
  100. LABEL "Biergruppe"
  101. VIEW-AS COMBO-BOX INNER-LINES 5
  102. DROP-DOWN-LIST
  103. SIZE 40 BY 1
  104. BGCOLOR 15 NO-UNDO.
  105. DEFINE VARIABLE F_BisDatum AS DATE FORMAT "99.99.9999":U
  106. VIEW-AS FILL-IN NATIVE
  107. SIZE 16 BY 1
  108. BGCOLOR 15 NO-UNDO.
  109. DEFINE VARIABLE F_VonDatum AS DATE FORMAT "99.99.9999":U
  110. LABEL "von - bis Datum"
  111. VIEW-AS FILL-IN NATIVE
  112. SIZE 16 BY 1
  113. BGCOLOR 15 NO-UNDO.
  114. DEFINE RECTANGLE RECT-21
  115. EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
  116. SIZE 86.8 BY 3.24.
  117. DEFINE RECTANGLE RECT-22
  118. EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
  119. SIZE 86.8 BY 3.24.
  120. DEFINE RECTANGLE RECT-23
  121. EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
  122. SIZE 86.8 BY 4.38.
  123. /* ************************ Frame Definitions *********************** */
  124. DEFINE FRAME D-Dialog
  125. CB_Hersteller AT ROW 2.05 COL 42 COLON-ALIGNED
  126. CB_Warengrp AT ROW 3.05 COL 42 COLON-ALIGNED
  127. CB_Vertragsart AT ROW 6.05 COL 42 COLON-ALIGNED
  128. CB_Preisgruppe AT ROW 7.1 COL 42 COLON-ALIGNED
  129. F_VonDatum AT ROW 9.86 COL 42 COLON-ALIGNED
  130. F_BisDatum AT ROW 9.86 COL 62 COLON-ALIGNED NO-LABEL
  131. Btn_Start AT ROW 11.57 COL 44
  132. Btn_Abbrechen AT ROW 11.57 COL 64
  133. "(alle ausser)" VIEW-AS TEXT
  134. SIZE 21.2 BY 1 AT ROW 7.05 COL 5.2
  135. "Kundenselektion" VIEW-AS TEXT
  136. SIZE 21.2 BY 1 AT ROW 6.05 COL 5.2
  137. "Artikelselektion" VIEW-AS TEXT
  138. SIZE 21.2 BY 1 AT ROW 2.05 COL 5.2
  139. RECT-21 AT ROW 1.48 COL 2.4
  140. RECT-22 AT ROW 5.48 COL 2.4
  141. RECT-23 AT ROW 9.05 COL 2.4
  142. SPACE(1.59) SKIP(0.46)
  143. WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER
  144. SIDE-LABELS NO-UNDERLINE THREE-D SCROLLABLE
  145. TITLE "Kanalabrechung Feldschlösschen"
  146. DEFAULT-BUTTON Btn_Start CANCEL-BUTTON Btn_Abbrechen.
  147. /* *********************** Procedure Settings ************************ */
  148. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  149. /* Settings for THIS-PROCEDURE
  150. Type: SmartDialog
  151. Allow: Basic,Browse,DB-Fields,Query,Smart
  152. Other Settings: COMPILE
  153. */
  154. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  155. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB D-Dialog
  156. /* ************************* Included-Libraries *********************** */
  157. {src/adm/method/containr.i}
  158. /* _UIB-CODE-BLOCK-END */
  159. &ANALYZE-RESUME
  160. /* *********** Runtime Attributes and AppBuilder Settings *********** */
  161. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  162. /* SETTINGS FOR DIALOG-BOX D-Dialog
  163. FRAME-NAME */
  164. ASSIGN
  165. FRAME D-Dialog:SCROLLABLE = FALSE
  166. FRAME D-Dialog:HIDDEN = TRUE.
  167. /* SETTINGS FOR BUTTON Btn_Abbrechen IN FRAME D-Dialog
  168. 1 */
  169. /* SETTINGS FOR BUTTON Btn_Start IN FRAME D-Dialog
  170. 1 */
  171. /* SETTINGS FOR COMBO-BOX CB_Hersteller IN FRAME D-Dialog
  172. 1 6 */
  173. /* SETTINGS FOR COMBO-BOX CB_Preisgruppe IN FRAME D-Dialog
  174. 1 6 */
  175. /* SETTINGS FOR COMBO-BOX CB_Vertragsart IN FRAME D-Dialog
  176. 1 6 */
  177. /* SETTINGS FOR COMBO-BOX CB_Warengrp IN FRAME D-Dialog
  178. 1 6 */
  179. /* SETTINGS FOR FILL-IN F_BisDatum IN FRAME D-Dialog
  180. 1 6 */
  181. /* SETTINGS FOR FILL-IN F_VonDatum IN FRAME D-Dialog
  182. 1 6 */
  183. /* _RUN-TIME-ATTRIBUTES-END */
  184. &ANALYZE-RESUME
  185. /* Setting information for Queries and Browse Widgets fields */
  186. &ANALYZE-SUSPEND _QUERY-BLOCK DIALOG-BOX D-Dialog
  187. /* Query rebuild information for DIALOG-BOX D-Dialog
  188. _Options = "SHARE-LOCK"
  189. _Query is NOT OPENED
  190. */ /* DIALOG-BOX D-Dialog */
  191. &ANALYZE-RESUME
  192. /* ************************ Control Triggers ************************ */
  193. &Scoped-define SELF-NAME D-Dialog
  194. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL D-Dialog D-Dialog
  195. ON WINDOW-CLOSE OF FRAME D-Dialog /* Kanalabrechung Feldschlösschen */
  196. DO:
  197. /* Add Trigger to equate WINDOW-CLOSE to END-ERROR. */
  198. APPLY "END-ERROR":U TO SELF.
  199. END.
  200. /* _UIB-CODE-BLOCK-END */
  201. &ANALYZE-RESUME
  202. &Scoped-define SELF-NAME Btn_Abbrechen
  203. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_Abbrechen D-Dialog
  204. ON CHOOSE OF Btn_Abbrechen IN FRAME D-Dialog /* Abbrechen */
  205. DO:
  206. APPLY "END-ERROR":U TO FRAME {&FRAME-NAME}.
  207. END.
  208. /* _UIB-CODE-BLOCK-END */
  209. &ANALYZE-RESUME
  210. &Scoped-define SELF-NAME Btn_Start
  211. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_Start D-Dialog
  212. ON CHOOSE OF Btn_Start IN FRAME D-Dialog /* Starten */
  213. DO:
  214. DO WITH FRAME {&FRAME-NAME}:
  215. ASSIGN {&List-6}.
  216. VHerst = INTEGER(SUBSTRING(CB_Hersteller :SCREEN-VALUE,01,03)).
  217. VWgr = INTEGER(SUBSTRING(CB_Warengrp :SCREEN-VALUE,01,03)).
  218. VBiercd = INTEGER(SUBSTRING(CB_Vertragsart:SCREEN-VALUE,01,03)).
  219. VPreisgrp = INTEGER(SUBSTRING(CB_Preisgruppe:SCREEN-VALUE,01,03)).
  220. IF F_VonDatum = ? THEN DO:
  221. APPLY 'ENTRY' TO F_VonDatum.
  222. RETURN NO-APPLY.
  223. END.
  224. IF F_BisDatum = ? THEN DO:
  225. APPLY 'ENTRY' TO F_BisDatum.
  226. RETURN NO-APPLY.
  227. END.
  228. IF F_BisDatum < F_VonDatum THEN DO:
  229. APPLY 'ENTRY' TO F_VonDatum.
  230. RETURN NO-APPLY.
  231. END.
  232. VDatum = F_VonDatum.
  233. BDatum = F_BisDatum.
  234. DISPLAY {&List-6}.
  235. RUN SCHREIBENFWAUSWERTUNGEN ( INPUT 'd-kanalabrechnung',
  236. INPUT FRAME {&FRAME-NAME}:CURRENT-ITERATION ) NO-ERROR.
  237. DISABLE {&List-1}.
  238. RUN BERECHNEN.
  239. ENABLE {&List-1}.
  240. END.
  241. END.
  242. /* _UIB-CODE-BLOCK-END */
  243. &ANALYZE-RESUME
  244. &UNDEFINE SELF-NAME
  245. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK D-Dialog
  246. /* *************************** Main Block *************************** */
  247. CB_Hersteller:DELIMITER = ";".
  248. ok = TRUE.
  249. DO WHILE ok:
  250. ok = CB_Hersteller:DELETE(1).
  251. END.
  252. FOR EACH Tabel USE-INDEX Tabel-k2
  253. WHERE Tabel.Firma = GVFirma
  254. AND Tabel.RecArt = 'HERST' NO-LOCK:
  255. ok = CB_Hersteller:ADD-LAST(STRING(Tabel.CodeI,"999 ") + Tabel.Bez1).
  256. END.
  257. CB_Hersteller:SCREEN-VALUE = CB_Hersteller:ENTRY(1).
  258. CB_Warengrp:DELIMITER = ';'.
  259. ok = TRUE.
  260. DO WHILE ok:
  261. ok = CB_Warengrp:DELETE(1).
  262. END.
  263. FOR EACH WarenGrp USE-INDEX WarenGrp-k1
  264. WHERE WarenGrp.Firma = GVFirma NO-LOCK:
  265. ok = CB_Warengrp:ADD-LAST(STRING(WarenGrp.Wg,"999 ") + WarenGrp.Bez1).
  266. END.
  267. CB_Warengrp:SCREEN-VALUE = CB_Warengrp:ENTRY(1).
  268. CB_Vertragsart:DELIMITER = ";".
  269. ok = TRUE.
  270. DO WHILE ok:
  271. ok = CB_Vertragsart:DELETE(1).
  272. END.
  273. FOR EACH Tabel USE-INDEX Tabel-k2
  274. WHERE Tabel.Firma = GVFirma
  275. AND Tabel.RecArt = 'BIER' NO-LOCK:
  276. ok = CB_Vertragsart:ADD-LAST(STRING(Tabel.CodeI,"999 ") + Tabel.Bez1).
  277. END.
  278. CB_Vertragsart:SCREEN-VALUE = CB_Vertragsart:ENTRY(1).
  279. CB_Preisgruppe:DELIMITER = ";".
  280. ok = TRUE.
  281. DO WHILE ok:
  282. ok = CB_Preisgruppe:DELETE(1).
  283. END.
  284. FOR EACH Tabel USE-INDEX Tabel-k2
  285. WHERE Tabel.Firma = GVFirma
  286. AND Tabel.RecArt = 'PREGRP' NO-LOCK:
  287. ok = CB_Preisgruppe:ADD-LAST(STRING(Tabel.CodeI,"999 ") + Tabel.Bez1).
  288. END.
  289. CB_Preisgruppe:SCREEN-VALUE = CB_Preisgruppe:ENTRY(1).
  290. {src/adm/template/dialogmn.i}
  291. /* _UIB-CODE-BLOCK-END */
  292. &ANALYZE-RESUME
  293. /* ********************** Internal Procedures *********************** */
  294. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects D-Dialog _ADM-CREATE-OBJECTS
  295. PROCEDURE adm-create-objects :
  296. /*------------------------------------------------------------------------------
  297. Purpose: Create handles for all SmartObjects used in this procedure.
  298. After SmartObjects are initialized, then SmartLinks are added.
  299. Parameters: <none>
  300. ------------------------------------------------------------------------------*/
  301. END PROCEDURE.
  302. /* _UIB-CODE-BLOCK-END */
  303. &ANALYZE-RESUME
  304. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available D-Dialog _ADM-ROW-AVAILABLE
  305. PROCEDURE adm-row-available :
  306. /*------------------------------------------------------------------------------
  307. Purpose: Dispatched to this procedure when the Record-
  308. Source has a new row available. This procedure
  309. tries to get the new row (or foriegn keys) from
  310. the Record-Source and process it.
  311. Parameters: <none>
  312. ------------------------------------------------------------------------------*/
  313. /* Define variables needed by this internal procedure. */
  314. {src/adm/template/row-head.i}
  315. /* Process the newly available records (i.e. display fields,
  316. open queries, and/or pass records on to any RECORD-TARGETS). */
  317. {src/adm/template/row-end.i}
  318. END PROCEDURE.
  319. /* _UIB-CODE-BLOCK-END */
  320. &ANALYZE-RESUME
  321. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE BERECHNEN D-Dialog
  322. PROCEDURE BERECHNEN :
  323. /*------------------------------------------------------------------------------
  324. Purpose:
  325. Parameters: <none>
  326. Notes:
  327. ------------------------------------------------------------------------------*/
  328. DEF VAR VProz AS DEC DECIMALS 4 NO-UNDO.
  329. DEF VAR VBetr AS DEC DECIMALS 4 NO-UNDO.
  330. DEF VAR VBetrag AS DEC DECIMALS 4 NO-UNDO.
  331. DEF VAR cVorlage AS CHAR NO-UNDO.
  332. DEF VAR cDaten AS CHAR NO-UNDO.
  333. DEF VAR cDokument AS CHAR NO-UNDO.
  334. DEF VAR cDateiName AS CHAR NO-UNDO.
  335. DEF VAR Zelle AS CHAR NO-UNDO.
  336. DEF VAR excelAppl AS COM-HANDLE NO-UNDO.
  337. DEF VAR ja AS LOG NO-UNDO.
  338. EMPTY TEMP-TABLE TWork .
  339. FOR EACH Artst USE-INDEX Artst-k1
  340. WHERE Artst.Firma = GVFirma
  341. AND Artst.Aktiv = TRUE
  342. AND Artst.Herst = VHerst
  343. AND Artst.Wg_Grp = VWgr NO-LOCK,
  344. LAST ArtKanal USE-INDEX ArtKanal-k1
  345. WHERE ArtKanal.Firma = Artst.Firma
  346. AND ArtKanal.Artnr = Artst.Artnr
  347. AND ArtKanal.Inhalt = Artst.Inhalt
  348. AND ArtKanal.Jahr = Artst.Jahr
  349. AND ArtKanal.Preis_Grp = VPreisgrp
  350. AND ArtKanal.Ab_Datum <= VDatum NO-LOCK:
  351. CREATE TWork.
  352. ASSIGN TWork.Artnr = Artst.Artnr
  353. TWork.Inhalt = Artst.Inhalt
  354. TWork.Jahr = Artst.Jahr
  355. TWork.EP = Artst.Listen_EP
  356. TWork.RID = RECID(Artst)
  357. TWork.Art = ArtKanal.Art
  358. TWork.Wert = ArtKanal.Wert.
  359. END.
  360. FOR EACH TWork:
  361. FIND LAST Artbw USE-INDEX Artbw-k2
  362. WHERE Artbw.Firma = GVFirma
  363. AND Artbw.Artnr = TWork.Artnr
  364. AND Artbw.Inhalt = TWork.Inhalt
  365. AND Artbw.Jahr = TWork.Jahr
  366. AND Artbw.Datum <= BDatum
  367. AND Artbw.Aktion = FALSE
  368. AND Artbw.Tr_Art = 11 NO-LOCK NO-ERROR.
  369. IF AVAILABLE Artbw THEN TWork.EP = Artbw.Preis.
  370. FOR EACH Artbw USE-INDEX Artbw-k2
  371. WHERE Artbw.Firma = GVFirma
  372. AND Artbw.Artnr = TWork.Artnr
  373. AND Artbw.Inhalt = TWork.Inhalt
  374. AND Artbw.Jahr = TWork.Jahr
  375. AND Artbw.Datum >= VDatum
  376. AND Artbw.Datum <= BDatum
  377. AND Artbw.Tr_Art < 11 NO-LOCK:
  378. IF Artbw.Tr_Art = 01 THEN DO:
  379. FIND Debst NO-LOCK USE-INDEX Debst-k1
  380. WHERE Debst.Firma = Artbw.Firma
  381. AND Debst.Knr = Artbw.Knr NO-ERROR.
  382. IF Debst.Bier_Cd = VBiercd AND
  383. Debst.Preis_Grp = VPreisgrp THEN NEXT.
  384. TWork.Ausgang = TWork.Ausgang + Artbw.Menge.
  385. TWork.VP = TWork.VP + (Artbw.Menge * Artbw.Preis).
  386. NEXT.
  387. END.
  388. END.
  389. END.
  390. cVorlage = 'Kanal' + '.xls'.
  391. cDokument = 'Kanal' + '.xls'.
  392. cDaten = 'Kanal' + '.txt'.
  393. cDateiName = cDokument + CHR(01) + cVorlage.
  394. RUN CREATEDATEI ( INPUT cDateiName ).
  395. IF RETURN-VALUE BEGINS 'ERROR' THEN RETURN NO-APPLY.
  396. cDokument = RETURN-VALUE.
  397. RUN CREATEDATEI ( INPUT cDaten ).
  398. IF RETURN-VALUE BEGINS 'ERROR' THEN RETURN NO-APPLY.
  399. cDaten = RETURN-VALUE.
  400. OUTPUT TO VALUE(cDaten).
  401. VBetrag = 0.
  402. FOR EACH TWork WHERE Ausgang <> 0:
  403. FIND Artst WHERE RECID(Artst) = TWork.RID NO-LOCK.
  404. FIND KGebind WHERE KGebinde.Firma = "1000"
  405. AND KGebinde.Geb_Cd = Artst.KGeb_Cd.
  406. IF TWork.Art = TRUE THEN DO:
  407. VProz = TWork.Wert.
  408. VBetr = TWork.EP * VProz / 100.
  409. END.
  410. ELSE DO:
  411. VBetr = TWork.Wert.
  412. VProz = VBetr * 100 / TWork.EP.
  413. END.
  414. Rundbetr = TWork.Ausgang * VBetr.
  415. PUT CONTROL '£'
  416. Artst.Bez '£'
  417. KGebinde.KBez '£'
  418. TRIM(STRING(VProz ,'z9.99')) '£'
  419. TRIM(STRING(TWork.Ausgang,'->>>,>>>,>>9')) '£'
  420. TRIM(STRING(TWork.EP ,'->>>,>>>,>>9.99')) '£'
  421. TRIM(STRING(VBetr ,'->>>,>>>,>>9.99')) '£'
  422. TRIM(STRING(Rundbetr ,'->>>,>>>,>>9.99')) CHR(10).
  423. VBetrag = VBetrag + Rundbetr.
  424. END.
  425. PUT CONTROL '£££££££'
  426. TRIM(STRING(VBetrag,'->>>,>>>,>>9.99')) CHR(10).
  427. OUTPUT CLOSE.
  428. excelAppl = DYNAMIC-FUNCTION('CREATEEXCEL':U) NO-ERROR.
  429. IF NOT VALID-HANDLE(excelAppl) THEN DO:
  430. RUN FEHLER ( INPUT 1035 ).
  431. RETURN.
  432. END.
  433. RUN OPENEXCEL ( INPUT excelAppl, INPUT cDokument, INPUT '', OUTPUT ja ).
  434. IF NOT ja THEN DO:
  435. RUN FEHLER ( INPUT 1040 ).
  436. DYNAMIC-FUNCTION('RELEASEEXCEL':U, INPUT excelAppl ) NO-ERROR.
  437. RETURN NO-APPLY.
  438. END.
  439. Zelle = 'A5'.
  440. excelAppl:Range(Zelle):SELECT.
  441. excelAppl:SELECTION:FormulaR1C1 = 'TEXT;' + cDaten.
  442. excelAppl:APPLICATION:RUN ( 'DateiEinfügen' ).
  443. RUN KOPF ( INPUT excelAppl ).
  444. Zelle = 'A1'.
  445. excelAppl:Range(Zelle):SELECT.
  446. excelAppl:SELECTION:ColumnWidth = 0.3.
  447. DYNAMIC-FUNCTION('RELEASEEXCEL':U, INPUT excelAppl ) NO-ERROR.
  448. APPLY 'CHOOSE' TO Btn_Abbrechen IN FRAME {&FRAME-NAME}.
  449. END PROCEDURE.
  450. /* _UIB-CODE-BLOCK-END */
  451. &ANALYZE-RESUME
  452. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI D-Dialog _DEFAULT-DISABLE
  453. PROCEDURE disable_UI :
  454. /*------------------------------------------------------------------------------
  455. Purpose: DISABLE the User Interface
  456. Parameters: <none>
  457. Notes: Here we clean-up the user-interface by deleting
  458. dynamic widgets we have created and/or hide
  459. frames. This procedure is usually called when
  460. we are ready to "clean-up" after running.
  461. ------------------------------------------------------------------------------*/
  462. /* Hide all frames. */
  463. HIDE FRAME D-Dialog.
  464. END PROCEDURE.
  465. /* _UIB-CODE-BLOCK-END */
  466. &ANALYZE-RESUME
  467. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI D-Dialog _DEFAULT-ENABLE
  468. PROCEDURE enable_UI :
  469. /*------------------------------------------------------------------------------
  470. Purpose: ENABLE the User Interface
  471. Parameters: <none>
  472. Notes: Here we display/view/enable the widgets in the
  473. user-interface. In addition, OPEN all queries
  474. associated with each FRAME and BROWSE.
  475. These statements here are based on the "Other
  476. Settings" section of the widget Property Sheets.
  477. ------------------------------------------------------------------------------*/
  478. DISPLAY CB_Hersteller CB_Warengrp CB_Vertragsart CB_Preisgruppe F_VonDatum
  479. F_BisDatum
  480. WITH FRAME D-Dialog.
  481. ENABLE RECT-21 RECT-22 RECT-23 CB_Hersteller CB_Warengrp CB_Vertragsart
  482. CB_Preisgruppe F_VonDatum F_BisDatum Btn_Start Btn_Abbrechen
  483. WITH FRAME D-Dialog.
  484. VIEW FRAME D-Dialog.
  485. {&OPEN-BROWSERS-IN-QUERY-D-Dialog}
  486. END PROCEDURE.
  487. /* _UIB-CODE-BLOCK-END */
  488. &ANALYZE-RESUME
  489. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE KOPF D-Dialog
  490. PROCEDURE KOPF :
  491. /*------------------------------------------------------------------------------
  492. Purpose:
  493. Parameters: <none>
  494. Notes:
  495. ------------------------------------------------------------------------------*/
  496. DEF INPUT PARAMETER excelAppl AS COM-HANDLE NO-UNDO.
  497. DEF VAR cString AS CHAR NO-UNDO.
  498. cString = 'Abrechnungsperiode '
  499. + STRING(F_VonDatum,'99.99.9999')
  500. + ' bis '
  501. + STRING(F_BisDatum,'99.99.9999').
  502. RUN ZELLEFUELLEN ( INPUT excelAppl, INPUT 'H', INPUT 1, INPUT cString ).
  503. END PROCEDURE.
  504. /* _UIB-CODE-BLOCK-END */
  505. &ANALYZE-RESUME
  506. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-view D-Dialog
  507. PROCEDURE local-view :
  508. /*------------------------------------------------------------------------------
  509. Purpose: Override standard ADM method
  510. Notes:
  511. ------------------------------------------------------------------------------*/
  512. RUN dispatch IN THIS-PROCEDURE ( INPUT 'view':U ) .
  513. RUN LESENFWAUSWERTUNGEN ( INPUT 'd-kanalabrechnung',
  514. INPUT FRAME {&FRAME-NAME}:CURRENT-ITERATION ) NO-ERROR.
  515. END PROCEDURE.
  516. /* _UIB-CODE-BLOCK-END */
  517. &ANALYZE-RESUME
  518. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records D-Dialog _ADM-SEND-RECORDS
  519. PROCEDURE send-records :
  520. /*------------------------------------------------------------------------------
  521. Purpose: Send record ROWID's for all tables used by
  522. this file.
  523. Parameters: see template/snd-head.i
  524. ------------------------------------------------------------------------------*/
  525. /* SEND-RECORDS does nothing because there are no External
  526. Tables specified for this SmartDialog, and there are no
  527. tables specified in any contained Browse, Query, or Frame. */
  528. END PROCEDURE.
  529. /* _UIB-CODE-BLOCK-END */
  530. &ANALYZE-RESUME
  531. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed D-Dialog
  532. PROCEDURE state-changed :
  533. /* -----------------------------------------------------------
  534. Purpose:
  535. Parameters: <none>
  536. Notes:
  537. -------------------------------------------------------------*/
  538. DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
  539. DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
  540. END PROCEDURE.
  541. /* _UIB-CODE-BLOCK-END */
  542. &ANALYZE-RESUME