g-gebinderechnung.w 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. &ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI ADM2
  2. &ANALYZE-RESUME
  3. &Scoped-define WINDOW-NAME CURRENT-WINDOW
  4. &Scoped-define FRAME-NAME gGebindeRechnung
  5. {adecomm/appserv.i}
  6. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS gGebindeRechnung
  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. DEF INPUT PARAMETER ipAufnr AS INT NO-UNDO.
  28. /* Local Variable Definitions --- */
  29. DEF VAR iKnr AS INT NO-UNDO.
  30. DEF VAR iAufnr AS INT NO-UNDO.
  31. DEF VAR iFakart AS INT NO-UNDO.
  32. DEF VAR iArtnr AS INT NO-UNDO.
  33. DEF BUFFER bAufko FOR Aufko.
  34. DEF BUFFER bDebst FOR Debst.
  35. DEF BUFFER lDebst FOR Debst.
  36. DEF BUFFER bArtst FOR Artst.
  37. DEF BUFFER bAdresse FOR Adresse.
  38. DEF TEMP-TABLE tAufze LIKE Aufze.
  39. DEF TEMP-TABLE xAufze LIKE Aufze.
  40. { incl/dlgdefinition.i }
  41. { src/adm2/widgetprto.i }
  42. /* _UIB-CODE-BLOCK-END */
  43. &ANALYZE-RESUME
  44. &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
  45. /* ******************** Preprocessor Definitions ******************** */
  46. &Scoped-define PROCEDURE-TYPE SmartDialog
  47. &Scoped-define DB-AWARE no
  48. &Scoped-define ADM-CONTAINER DIALOG-BOX
  49. &Scoped-define ADM-SUPPORTED-LINKS Data-Target,Data-Source,Page-Target,Update-Source,Update-Target
  50. /* Name of designated FRAME-NAME and/or first browse and/or first query */
  51. &Scoped-define FRAME-NAME gGebindeRechnung
  52. /* Standard List Definitions */
  53. &Scoped-Define ENABLED-OBJECTS RECT-2 F_Aufnr F_Knr F_Kunde CB_Fakart ~
  54. F_vondatum F_bisdatum F_Artnr F_Artikel Btn_OK Btn_Cancel
  55. &Scoped-Define DISPLAYED-OBJECTS F_Aufnr F_Knr F_Kunde CB_Fakart F_vondatum ~
  56. F_bisdatum F_Artnr F_Artikel
  57. /* Custom List Definitions */
  58. /* List-1,List-2,List-3,List-4,List-5,List-6 */
  59. &Scoped-define List-6 F_Aufnr F_Knr F_Kunde F_vondatum F_bisdatum F_Artnr ~
  60. F_Artikel
  61. /* _UIB-PREPROCESSOR-BLOCK-END */
  62. &ANALYZE-RESUME
  63. /* ************************ Function Prototypes ********************** */
  64. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD validateArtnr gGebindeRechnung
  65. FUNCTION validateArtnr RETURNS LOGICAL
  66. ( /* parameter-definitions */ ) FORWARD.
  67. /* _UIB-CODE-BLOCK-END */
  68. &ANALYZE-RESUME
  69. /* *********************** Control Definitions ********************** */
  70. /* Define a dialog box */
  71. /* Definitions of the field level widgets */
  72. DEFINE BUTTON Btn_Cancel AUTO-END-KEY
  73. LABEL "abbrechen"
  74. SIZE 15 BY 1.
  75. DEFINE BUTTON Btn_OK AUTO-GO
  76. LABEL "OK"
  77. SIZE 15 BY 1.
  78. DEFINE VARIABLE CB_Fakart AS CHARACTER FORMAT "X(256)":U
  79. LABEL "Fakturaart"
  80. VIEW-AS COMBO-BOX INNER-LINES 5
  81. LIST-ITEM-PAIRS "Item 1","Item 1"
  82. DROP-DOWN-LIST
  83. SIZE 50 BY 1 NO-UNDO.
  84. DEFINE VARIABLE F_Artikel AS CHARACTER FORMAT "X(256)":U
  85. LABEL "/"
  86. VIEW-AS FILL-IN NATIVE
  87. SIZE 80 BY 1
  88. BGCOLOR 15 NO-UNDO.
  89. DEFINE VARIABLE F_Artnr AS INTEGER FORMAT "zzzzzz9":U INITIAL 0
  90. LABEL "Artikel"
  91. VIEW-AS FILL-IN NATIVE
  92. SIZE 12 BY 1
  93. BGCOLOR 15 NO-UNDO.
  94. DEFINE VARIABLE F_Aufnr AS INTEGER FORMAT "zzzzzz9":U INITIAL 0
  95. LABEL "Auftrag"
  96. VIEW-AS FILL-IN NATIVE
  97. SIZE 12 BY 1
  98. BGCOLOR 15 NO-UNDO.
  99. DEFINE VARIABLE F_bisdatum AS DATE FORMAT "99.99.9999":U INITIAL 01/01/20
  100. LABEL "/"
  101. VIEW-AS FILL-IN NATIVE
  102. SIZE 16 BY 1
  103. BGCOLOR 15 NO-UNDO.
  104. DEFINE VARIABLE F_Knr AS INTEGER FORMAT "zzzzzz9":U INITIAL 0
  105. LABEL "Kunde"
  106. VIEW-AS FILL-IN NATIVE
  107. SIZE 12 BY 1
  108. BGCOLOR 15 NO-UNDO.
  109. DEFINE VARIABLE F_Kunde AS CHARACTER FORMAT "X(256)":U
  110. LABEL "/"
  111. VIEW-AS FILL-IN NATIVE
  112. SIZE 80 BY 1
  113. BGCOLOR 15 NO-UNDO.
  114. DEFINE VARIABLE F_vondatum AS DATE FORMAT "99.99.9999":U INITIAL 01/01/20
  115. LABEL "von - bis Datum"
  116. VIEW-AS FILL-IN NATIVE
  117. SIZE 16 BY 1
  118. BGCOLOR 15 NO-UNDO.
  119. DEFINE RECTANGLE RECT-2
  120. EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
  121. SIZE 114 BY 6.67.
  122. /* ************************ Frame Definitions *********************** */
  123. DEFINE FRAME gGebindeRechnung
  124. F_Aufnr AT ROW 2 COL 18 COLON-ALIGNED WIDGET-ID 4 NO-TAB-STOP
  125. F_Knr AT ROW 3 COL 18 COLON-ALIGNED WIDGET-ID 6 NO-TAB-STOP
  126. F_Kunde AT ROW 3 COL 33 COLON-ALIGNED WIDGET-ID 8 NO-TAB-STOP
  127. CB_Fakart AT ROW 4 COL 18 COLON-ALIGNED WIDGET-ID 10
  128. F_vondatum AT ROW 5 COL 18 COLON-ALIGNED WIDGET-ID 12
  129. F_bisdatum AT ROW 5 COL 37 COLON-ALIGNED WIDGET-ID 14
  130. F_Artnr AT ROW 6 COL 18 COLON-ALIGNED WIDGET-ID 18
  131. F_Artikel AT ROW 6 COL 33 COLON-ALIGNED WIDGET-ID 20 NO-TAB-STOP
  132. Btn_OK AT ROW 9 COL 40.6
  133. Btn_Cancel AT ROW 9 COL 61.8
  134. RECT-2 AT ROW 1.48 COL 3 WIDGET-ID 2
  135. SPACE(2.19) SKIP(3.13)
  136. WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER
  137. SIDE-LABELS NO-UNDERLINE THREE-D SCROLLABLE
  138. TITLE "Gebinderechnung"
  139. CANCEL-BUTTON Btn_Cancel WIDGET-ID 100.
  140. /* *********************** Procedure Settings ************************ */
  141. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  142. /* Settings for THIS-PROCEDURE
  143. Type: SmartDialog
  144. Allow: Basic,Browse,DB-Fields,Query,Smart
  145. Container Links: Data-Target,Data-Source,Page-Target,Update-Source,Update-Target
  146. Design Page: 1
  147. Other Settings: COMPILE APPSERVER
  148. */
  149. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  150. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB gGebindeRechnung
  151. /* ************************* Included-Libraries *********************** */
  152. {src/adm2/containr.i}
  153. /* _UIB-CODE-BLOCK-END */
  154. &ANALYZE-RESUME
  155. /* *********** Runtime Attributes and AppBuilder Settings *********** */
  156. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  157. /* SETTINGS FOR DIALOG-BOX gGebindeRechnung
  158. FRAME-NAME */
  159. ASSIGN
  160. FRAME gGebindeRechnung:SCROLLABLE = FALSE
  161. FRAME gGebindeRechnung:HIDDEN = TRUE.
  162. /* SETTINGS FOR FILL-IN F_Artikel IN FRAME gGebindeRechnung
  163. 6 */
  164. ASSIGN
  165. F_Artikel:READ-ONLY IN FRAME gGebindeRechnung = TRUE.
  166. /* SETTINGS FOR FILL-IN F_Artnr IN FRAME gGebindeRechnung
  167. 6 */
  168. /* SETTINGS FOR FILL-IN F_Aufnr IN FRAME gGebindeRechnung
  169. 6 */
  170. ASSIGN
  171. F_Aufnr:READ-ONLY IN FRAME gGebindeRechnung = TRUE.
  172. /* SETTINGS FOR FILL-IN F_bisdatum IN FRAME gGebindeRechnung
  173. 6 */
  174. /* SETTINGS FOR FILL-IN F_Knr IN FRAME gGebindeRechnung
  175. 6 */
  176. ASSIGN
  177. F_Knr:READ-ONLY IN FRAME gGebindeRechnung = TRUE.
  178. /* SETTINGS FOR FILL-IN F_Kunde IN FRAME gGebindeRechnung
  179. 6 */
  180. ASSIGN
  181. F_Kunde:READ-ONLY IN FRAME gGebindeRechnung = TRUE.
  182. /* SETTINGS FOR FILL-IN F_vondatum IN FRAME gGebindeRechnung
  183. 6 */
  184. /* _RUN-TIME-ATTRIBUTES-END */
  185. &ANALYZE-RESUME
  186. /* Setting information for Queries and Browse Widgets fields */
  187. &ANALYZE-SUSPEND _QUERY-BLOCK DIALOG-BOX gGebindeRechnung
  188. /* Query rebuild information for DIALOG-BOX gGebindeRechnung
  189. _Options = "SHARE-LOCK"
  190. _Query is NOT OPENED
  191. */ /* DIALOG-BOX gGebindeRechnung */
  192. &ANALYZE-RESUME
  193. /* ************************ Control Triggers ************************ */
  194. &Scoped-define SELF-NAME gGebindeRechnung
  195. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL gGebindeRechnung gGebindeRechnung
  196. ON END-ERROR OF FRAME gGebindeRechnung /* Gebinderechnung */
  197. DO:
  198. RUN ENDE.
  199. RETURN NO-APPLY.
  200. END.
  201. /* _UIB-CODE-BLOCK-END */
  202. &ANALYZE-RESUME
  203. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL gGebindeRechnung gGebindeRechnung
  204. ON WINDOW-CLOSE OF FRAME gGebindeRechnung /* Gebinderechnung */
  205. DO:
  206. RUN ENDE.
  207. RETURN NO-APPLY.
  208. END.
  209. /* _UIB-CODE-BLOCK-END */
  210. &ANALYZE-RESUME
  211. &Scoped-define SELF-NAME Btn_Cancel
  212. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_Cancel gGebindeRechnung
  213. ON CHOOSE OF Btn_Cancel IN FRAME gGebindeRechnung /* abbrechen */
  214. DO:
  215. RUN ENDE.
  216. RETURN NO-APPLY.
  217. END.
  218. /* _UIB-CODE-BLOCK-END */
  219. &ANALYZE-RESUME
  220. &Scoped-define SELF-NAME Btn_OK
  221. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_OK gGebindeRechnung
  222. ON CHOOSE OF Btn_OK IN FRAME gGebindeRechnung /* OK */
  223. DO:
  224. btnOK = TRUE.
  225. Btn_OK :SENSITIVE = FALSE.
  226. Btn_Cancel:SENSITIVE = FALSE.
  227. SESSION:SET-WAIT-STATE('GENERAL').
  228. RUN GEBINDERECHNUNG.
  229. Btn_OK :SENSITIVE = TRUE.
  230. Btn_Cancel:SENSITIVE = TRUE.
  231. SESSION:SET-WAIT-STATE('').
  232. IF RETURN-VALUE = 'ERROR' THEN RETURN NO-APPLY.
  233. RUN ENDE.
  234. RETURN NO-APPLY.
  235. END.
  236. /* _UIB-CODE-BLOCK-END */
  237. &ANALYZE-RESUME
  238. &Scoped-define SELF-NAME F_Artnr
  239. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL F_Artnr gGebindeRechnung
  240. ON ALT-F OF F_Artnr IN FRAME gGebindeRechnung /* Artikel */
  241. DO:
  242. DEF VAR iRecid AS RECID NO-UNDO.
  243. RUN g-suchen-artikel.w ( '', OUTPUT iRecid) NO-ERROR.
  244. IF iRecid = ? OR
  245. iRecid = 0 THEN RETURN NO-APPLY.
  246. FIND Artst NO-LOCK WHERE RECID(Artst) = iRecid NO-ERROR.
  247. iArtnr = Artst.Artnr.
  248. F_Artnr = Artst.Artnr.
  249. F_Artikel = Artst.Bez.
  250. DO WITH FRAME {&FRAME-NAME}:
  251. DISPLAY F_Artnr F_Artikel.
  252. END.
  253. END.
  254. /* _UIB-CODE-BLOCK-END */
  255. &ANALYZE-RESUME
  256. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL F_Artnr gGebindeRechnung
  257. ON LEAVE OF F_Artnr IN FRAME gGebindeRechnung /* Artikel */
  258. DO:
  259. iArtnr = INTEGER(SELF:SCREEN-VALUE).
  260. IF DYNAMIC-FUNCTION('validateArtnr':U ) THEN RETURN.
  261. APPLY 'ENTRY' TO SELF.
  262. RETURN NO-APPLY.
  263. END.
  264. /* _UIB-CODE-BLOCK-END */
  265. &ANALYZE-RESUME
  266. &UNDEFINE SELF-NAME
  267. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK gGebindeRechnung
  268. /* *************************** Main Block *************************** */
  269. { incl/dlgmainblock.i }
  270. {src/adm2/dialogmn.i}
  271. /* _UIB-CODE-BLOCK-END */
  272. &ANALYZE-RESUME
  273. /* ********************** Internal Procedures *********************** */
  274. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects gGebindeRechnung _ADM-CREATE-OBJECTS
  275. PROCEDURE adm-create-objects :
  276. /*------------------------------------------------------------------------------
  277. Purpose: Create handles for all SmartObjects used in this procedure.
  278. After SmartObjects are initialized, then SmartLinks are added.
  279. Parameters: <none>
  280. ------------------------------------------------------------------------------*/
  281. END PROCEDURE.
  282. /* _UIB-CODE-BLOCK-END */
  283. &ANALYZE-RESUME
  284. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI gGebindeRechnung _DEFAULT-DISABLE
  285. PROCEDURE disable_UI :
  286. /*------------------------------------------------------------------------------
  287. Purpose: DISABLE the User Interface
  288. Parameters: <none>
  289. Notes: Here we clean-up the user-interface by deleting
  290. dynamic widgets we have created and/or hide
  291. frames. This procedure is usually called when
  292. we are ready to "clean-up" after running.
  293. ------------------------------------------------------------------------------*/
  294. /* Hide all frames. */
  295. HIDE FRAME gGebindeRechnung.
  296. END PROCEDURE.
  297. /* _UIB-CODE-BLOCK-END */
  298. &ANALYZE-RESUME
  299. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enableObject gGebindeRechnung
  300. PROCEDURE enableObject :
  301. /*------------------------------------------------------------------------------
  302. Purpose: Super Override
  303. Parameters:
  304. Notes:
  305. ------------------------------------------------------------------------------*/
  306. FIND bAufko NO-LOCK
  307. WHERE bAufko.Firma = Firma
  308. AND bAufko.Aufnr = ipAufnr NO-ERROR.
  309. IF NOT AVAILABLE bAufko THEN DO:
  310. RUN ENDE.
  311. RETURN NO-APPLY.
  312. END.
  313. FIND bDebst NO-LOCK
  314. WHERE bDebst.Firma = bAufko.Firma
  315. AND bDebst.Knr = bAufko.Fak_Knr NO-ERROR.
  316. IF NOT AVAILABLE bDebst THEN DO:
  317. RUN ENDE.
  318. RETURN NO-APPLY.
  319. END.
  320. FIND lDebst NO-LOCK
  321. WHERE lDebst.Firma = bAufko.Firma
  322. AND lDebst.Knr = bAufko.Knr NO-ERROR.
  323. IF NOT AVAILABLE lDebst THEN DO:
  324. RUN ENDE.
  325. RETURN NO-APPLY.
  326. END.
  327. FIND bAdresse NO-LOCK
  328. WHERE bAdresse.Firma = AdFirma
  329. AND bAdresse.Knr = lDebst.Knr NO-ERROR.
  330. IF NOT AVAILABLE bAdresse THEN DO:
  331. RUN ENDE.
  332. RETURN NO-APPLY.
  333. END.
  334. ASSIGN F_Aufnr = bAufko.Aufnr
  335. F_Knr = lDebst.Knr
  336. F_Kunde = bAdresse.Anzeig_Br
  337. iKnr = lDebst.Knr
  338. iAufnr = bAufko.Aufnr.
  339. DO WITH FRAME {&FRAME-NAME}:
  340. RUN COMBO_FAKART ( CB_Fakart:HANDLE ).
  341. iFakart = DYNAMIC-FUNCTION('getGebRgFakart':U, F_Knr ) NO-ERROR.
  342. CB_Fakart:SCREEN-VALUE = STRING(iFakart,'999999') NO-ERROR.
  343. IF ERROR-STATUS:ERROR THEN DO:
  344. CB_Fakart:SCREEN-VALUE = ENTRY(2, CB_Fakart:LIST-ITEM-PAIRS, ';').
  345. END.
  346. iArtnr = DYNAMIC-FUNCTION('getGebRgArtnr':U, F_Knr ) NO-ERROR.
  347. FIND bArtst NO-LOCK
  348. WHERE bArtst.Firma = Firma
  349. AND bArtst.Artnr = iArtnr
  350. AND bArtst.Inhalt = 0
  351. AND bArtst.Jahr = 0 NO-ERROR.
  352. IF AVAILABLE bArtst THEN ASSIGN F_Artnr = bArtst.Artnr
  353. F_Artikel = bArtst.Bez.
  354. FIND LAST GebKontr NO-LOCK USE-INDEX GebKontr-k3
  355. WHERE GebKontr.Firma = Firma
  356. AND GebKontr.Knr = iKnr
  357. AND GebKontr.lAbgerechnet NO-ERROR.
  358. F_vondatum = (IF AVAILABLE GebKontr THEN GebKontr.Datum + 1 ELSE DATE(MONTH(TODAY),01,YEAR(TODAY))).
  359. F_bisdatum = F_vondatum.
  360. DO WHILE TRUE:
  361. IF MONTH(F_bisdatum + 1) <> MONTH(F_bisdatum) THEN LEAVE.
  362. F_bisdatum = F_bisdatum + 1.
  363. END.
  364. END.
  365. { incl/dlgenableobject.i }
  366. END PROCEDURE.
  367. /* _UIB-CODE-BLOCK-END */
  368. &ANALYZE-RESUME
  369. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI gGebindeRechnung _DEFAULT-ENABLE
  370. PROCEDURE enable_UI :
  371. /*------------------------------------------------------------------------------
  372. Purpose: ENABLE the User Interface
  373. Parameters: <none>
  374. Notes: Here we display/view/enable the widgets in the
  375. user-interface. In addition, OPEN all queries
  376. associated with each FRAME and BROWSE.
  377. These statements here are based on the "Other
  378. Settings" section of the widget Property Sheets.
  379. ------------------------------------------------------------------------------*/
  380. DISPLAY F_Aufnr F_Knr F_Kunde CB_Fakart F_vondatum F_bisdatum F_Artnr
  381. F_Artikel
  382. WITH FRAME gGebindeRechnung.
  383. ENABLE RECT-2 F_Aufnr F_Knr F_Kunde CB_Fakart F_vondatum F_bisdatum F_Artnr
  384. F_Artikel Btn_OK Btn_Cancel
  385. WITH FRAME gGebindeRechnung.
  386. VIEW FRAME gGebindeRechnung.
  387. {&OPEN-BROWSERS-IN-QUERY-gGebindeRechnung}
  388. END PROCEDURE.
  389. /* _UIB-CODE-BLOCK-END */
  390. &ANALYZE-RESUME
  391. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE ENDE gGebindeRechnung
  392. PROCEDURE ENDE :
  393. /*------------------------------------------------------------------------------
  394. Purpose:
  395. Parameters: <none>
  396. Notes:
  397. ------------------------------------------------------------------------------*/
  398. IF btnOK THEN DO:
  399. END.
  400. { incl/dlgende.i }
  401. END PROCEDURE.
  402. /* _UIB-CODE-BLOCK-END */
  403. &ANALYZE-RESUME
  404. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE GEBINDERECHNUNG gGebindeRechnung
  405. PROCEDURE GEBINDERECHNUNG :
  406. /*------------------------------------------------------------------------------
  407. Purpose:
  408. Parameters: <none>
  409. Notes:
  410. ------------------------------------------------------------------------------*/
  411. DEF VAR htAufze AS HANDLE NO-UNDO.
  412. DEF VAR iRetVal AS INT NO-UNDO.
  413. DEF VAR lRetVal AS INT NO-UNDO.
  414. DEF VAR iPos AS INT NO-UNDO.
  415. DEF VAR nTotale AS DEC EXTENT 15 NO-UNDO.
  416. DEF VAR iRecid AS RECID NO-UNDO.
  417. DEF VAR lOK AS LOG INIT FALSE NO-UNDO.
  418. DEF BUFFER bArtst FOR Artst.
  419. DEF BUFFER bAufko FOR Aufko.
  420. DO WITH FRAME {&FRAME-NAME}:
  421. ASSIGN {&List-6}.
  422. iFakart = INTEGER(CB_Fakart:SCREEN-VALUE) NO-ERROR.
  423. iArtnr = F_Artnr.
  424. IF NOT DYNAMIC-FUNCTION('validateArtnr':U) THEN DO:
  425. APPLY 'ENTRY' TO F_Artnr.
  426. RETURN 'ERROR'.
  427. END.
  428. DYNAMIC-FUNCTION('setGebRgFakart':U, iKnr, iFakart ) NO-ERROR.
  429. DYNAMIC-FUNCTION('setGebRgArtnr':U , iKnr, iArtnr ) NO-ERROR.
  430. END.
  431. EMPTY TEMP-TABLE xAufze.
  432. htAufze = TEMP-TABLE tAufze:DEFAULT-BUFFER-HANDLE.
  433. FIND LAST Aufze NO-LOCK
  434. WHERE Aufze.Firma = Firma
  435. AND Aufze.Aufnr = iAufnr NO-ERROR.
  436. iPos = (IF NOT AVAILABLE Aufze THEN 5 ELSE Aufze.Pos + 5).
  437. CREATE xAufze.
  438. ASSIGN xAufze.Firma = Firma
  439. xAufze.Aufnr = iAufnr
  440. xAufze.Artnr = 0
  441. xAufze.Inhalt = 0
  442. xAufze.Jahr = 0
  443. xAufze.Pos = iPos
  444. xAufze.Bez1 = ''
  445. xAufze.Bez2 = ''.
  446. iPos = iPos + 5.
  447. CREATE xAufze.
  448. ASSIGN xAufze.Firma = Firma
  449. xAufze.Aufnr = iAufnr
  450. xAufze.Artnr = 0
  451. xAufze.Inhalt = 0
  452. xAufze.Jahr = 0
  453. xAufze.Pos = iPos
  454. xAufze.Bez1 = 'Gebindeabrechnung für die Periode'
  455. xAufze.Bez2 = SUBSTITUTE('vom &1 bis &2',
  456. STRING(F_vondatum,'99.99.9999'), STRING(F_bisdatum,'99.99.9999') ).
  457. iPos = iPos + 5.
  458. CREATE xAufze.
  459. ASSIGN xAufze.Firma = Firma
  460. xAufze.Aufnr = iAufnr
  461. xAufze.Artnr = 0
  462. xAufze.Inhalt = 0
  463. xAufze.Jahr = 0
  464. xAufze.Pos = iPos
  465. xAufze.Bez1 = ''
  466. xAufze.Bez2 = ''
  467. .
  468. REPEAT TRANSACTION ON ERROR UNDO, LEAVE:
  469. FIND bAufko
  470. WHERE bAufko.Firma = Firma
  471. AND bAufko.Aufnr = iAufnr.
  472. ASSIGN bAufko.Fak_Art = iFakart
  473. bAufko.Samm_Nr = 0.
  474. FIND bArtst NO-LOCK
  475. WHERE bArtst.Firma = Firma
  476. AND bArtst.Artnr = iArtnr
  477. AND bArtst.Inhalt = 0
  478. AND bArtst.Jahr = 0 NO-ERROR.
  479. FOR EACH GebKontr NO-LOCK USE-INDEX GebKontr-k3
  480. WHERE GebKontr.Firma = Firma
  481. AND GebKontr.Knr = iKnr
  482. AND GebKontr.lAbgerechnet = FALSE
  483. AND GebKontr.Datum >= F_vondatum
  484. AND GebKontr.Datum <= F_bisdatum
  485. BREAK BY GebKontr.DokNr
  486. BY GebKontr.Geb_Cd
  487. :
  488. FIND GebKonto NO-LOCK
  489. WHERE GebKonto.Firma = Firma
  490. AND GebKonto.Geb_Cd = GebKontr.Geb_Cd NO-ERROR.
  491. IF FIRST-OF ( GebKontr.Doknr ) THEN DO:
  492. iPos = iPos + 5.
  493. CREATE xAufze.
  494. ASSIGN xAufze.Firma = Firma
  495. xAufze.Aufnr = iAufnr
  496. xAufze.Artnr = 0
  497. xAufze.Inhalt = 0
  498. xAufze.Jahr = 0
  499. xAufze.Pos = iPos
  500. xAufze.Bez1 = SUBSTITUTE('Gebindeabrechnung aus Rechnung &1', TRIM(STRING(GebKontr.Doknr,'>>>>>>>9')) )
  501. xAufze.Bez2 = ''.
  502. END.
  503. IF GebKontr.Ausgang <> 0 THEN DO:
  504. iPos = iPos + 5.
  505. EMPTY TEMP-TABLE tAufze.
  506. CREATE tAufze.
  507. ASSIGN tAufze.Firma = Firma
  508. tAufze.Aufnr = iAufnr
  509. tAufze.Artnr = iArtnr
  510. tAufze.Inhalt = 0
  511. tAufze.Jahr = 0
  512. tAufze.Pos = iPos
  513. .
  514. iRetVal = DYNAMIC-FUNCTION('fillAufze':U, INPUT-OUTPUT htAufze) NO-ERROR.
  515. IF iRetVal <> 0 THEN DO:
  516. MESSAGE iRetVal
  517. VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
  518. RETURN 'ERROR'.
  519. END.
  520. FIND FIRST tAufze.
  521. ASSIGN tAufze.Bez1 = GebKonto.Bez
  522. tAufze.Preis = GebKontr.Preis
  523. tAufze.PreisArt = 01
  524. tAufze.KGeb_Be = GebKontr.Ausgang
  525. tAufze.KGeb_Me = GebKontr.Ausgang
  526. tAufze.MBest = GebKontr.Ausgang
  527. tAufze.MGeli = GebKontr.Ausgang
  528. .
  529. lRetVal = DYNAMIC-FUNCTION('calculateZeilenTotal':U, INPUT-OUTPUT htAufze) NO-ERROR.
  530. CREATE xAufze.
  531. BUFFER-COPY tAufze TO xAufze.
  532. END.
  533. IF GebKontr.Eingang <> 0 THEN DO:
  534. iPos = iPos + 5.
  535. EMPTY TEMP-TABLE tAufze.
  536. CREATE tAufze.
  537. ASSIGN tAufze.Firma = Firma
  538. tAufze.Aufnr = iAufnr
  539. tAufze.Artnr = iArtnr
  540. tAufze.Inhalt = 0
  541. tAufze.Jahr = 0
  542. tAufze.Pos = iPos
  543. .
  544. iRetVal = DYNAMIC-FUNCTION('fillAufze':U, INPUT-OUTPUT htAufze) NO-ERROR.
  545. IF iRetVal <> 0 THEN DO:
  546. MESSAGE iRetVal
  547. VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
  548. RETURN 'ERROR'.
  549. END.
  550. FIND FIRST tAufze.
  551. ASSIGN tAufze.Bez1 = GebKonto.Bez
  552. tAufze.Preis = GebKontr.Preis
  553. tAufze.PreisArt = 01
  554. tAufze.KGeb_Be = - GebKontr.Eingang
  555. tAufze.KGeb_Me = - GebKontr.Eingang
  556. tAufze.MBest = - GebKontr.Eingang
  557. tAufze.MGeli = - GebKontr.Eingang
  558. .
  559. lRetVal = DYNAMIC-FUNCTION('calculateZeilenTotal':U, INPUT-OUTPUT htAufze) NO-ERROR.
  560. CREATE xAufze.
  561. BUFFER-COPY tAufze TO xAufze.
  562. END.
  563. IF LAST-OF ( GebKontr.Doknr ) THEN DO:
  564. iPos = iPos + 5.
  565. CREATE xAufze.
  566. ASSIGN xAufze.Firma = Firma
  567. xAufze.Aufnr = iAufnr
  568. xAufze.Artnr = 0
  569. xAufze.Inhalt = 0
  570. xAufze.Jahr = 0
  571. xAufze.Pos = iPos
  572. xAufze.Bez1 = ''
  573. xAufze.Bez2 = ''.
  574. END.
  575. END.
  576. FOR EACH xAufze:
  577. CREATE Aufze.
  578. BUFFER-COPY xAufze TO Aufze.
  579. END.
  580. iRecid = RECID(bAufko).
  581. RELEASE bAufko.
  582. DYNAMIC-FUNCTION('calculateAuftragsTotal':U, Firma, iAufnr, OUTPUT nTotale ) NO-ERROR.
  583. PUBLISH 'reopenAufko' ( iRecid ).
  584. PUBLISH 'refreshAufko'.
  585. PUBLISH 'reopenAufze' ( 0 ).
  586. lOk = TRUE.
  587. LEAVE.
  588. END.
  589. IF lOK THEN DO:
  590. REPEAT TRANSACTION:
  591. FOR EACH GebKontr USE-INDEX GebKontr-k3
  592. WHERE GebKontr.Firma = Firma
  593. AND GebKontr.Knr = iKnr
  594. AND GebKontr.lAbgerechnet = FALSE
  595. AND GebKontr.Datum >= F_vondatum
  596. AND GebKontr.Datum <= F_bisdatum
  597. :
  598. GebKontr.lAbgerechnet = TRUE.
  599. END.
  600. RELEASE GebKontr.
  601. LEAVE.
  602. END.
  603. END.
  604. END PROCEDURE.
  605. /* _UIB-CODE-BLOCK-END */
  606. &ANALYZE-RESUME
  607. /* ************************ Function Implementations ***************** */
  608. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION validateArtnr gGebindeRechnung
  609. FUNCTION validateArtnr RETURNS LOGICAL
  610. ( /* parameter-definitions */ ) :
  611. /*------------------------------------------------------------------------------
  612. Purpose:
  613. Notes:
  614. ------------------------------------------------------------------------------*/
  615. DEF BUFFER bArtst FOR Artst.
  616. FIND bArtst NO-LOCK
  617. WHERE bArtst.Firma = Firma
  618. AND bArtst.Artnr = iArtnr
  619. AND bArtst.Inhalt = 0
  620. AND bArtst.Jahr = 0 NO-ERROR.
  621. IF NOT AVAILABLE bArtst THEN RETURN FALSE.
  622. F_Artikel:SCREEN-VALUE IN FRAME {&FRAME-NAME} = bArtst.Bez.
  623. RETURN TRUE.
  624. END FUNCTION.
  625. /* _UIB-CODE-BLOCK-END */
  626. &ANALYZE-RESUME