ÿÿ  CHHVBScriptEngine       ÿþÿ( A l l g e m e i n )    ÿþÿ( D e k l a r a t i o n e n ) ÿþÿ' ( D e k l a r a t i o n e n )  
 ÿþÿÿºr 
 '   C O N V E R T - W I N L I N E _ D O C U M E N T _ O R D E R _ T O _ D E L I V E R Y N  
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 '   W i r d   v o m   P a c k t i s c h - M o d u l   a u f g e r u f e n ,   w e n n   d e r   L i e f e r s c h e i n   e i n   o d e r   m e h r e r e  
 '   S p ä t - A u s p r ä g u n g e n   e n t h ä l t .   D i e s e   k ö n n e n   n i c h t   p e r   W e b S e r v i c e   e r z e u g t   w e r d e n .  
 '  
 '   E r g e b n i s   d e s   M a c r o s :   E i n   ( T e i l - ) L i e f e r s c h e i n - B e l e g  
 '    
 '   R e t u r n s :   -  
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 '   C o p y r i g h t   ( c )   2 0 2 1   b y   D i g i t a l   D a t a   G m b H  
 '  
 '   D i g i t a l   D a t a   G m b H   "   L u d w i g - R i n n - S t r a s s e   1 6   "   D - 3 5 4 5 2   H e u c h e l h e i m  
 '   T e l . :   0 6 4 1 / 2 0 2 3 6 0   "   E - M a i l :   i n f o - f l o w ( a t ) d i g i t a l d a t a . w o r k s  
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 '   C r e a t i o n   D a t e   /   A u t h o r :       0 1 . 0 7 . 2 0 2 0   /   M K  
 '   V e r s i o n   D a t e   /   E d i t o r :         0 8 . 0 9 . 2 0 2 1   /   M P  
 '   V e r s i o n   N u m b e r :                       3 . 0 . 0 . 5  
  
 O n   E r r o r   R e s u m e   N e x t  
  
 ' # # # # # # # # # #   S e t   C u s t o m i z a b l e   C o n s t a n t s   # # # # # # # # #  
  
 	 '   E X I M   D a t e n b a n k n a m e  
 	 S Q L D a t a b a s e _ E X I M 	 =   " [ E X I M _ M E D A C O M ] "  
 	 	  
 	 '   Z u s a t z f e l d e r   i m   M a n d a n t e n s t a m m   ( F e l d n u m m e r n   b e g i n n e n   m i t   2 0 0   f ü r   d a s   1 .   F e l d )  
 	 '   M o d u l e - P f a d  
 	 M D F L D N O _ M O D U L E _ P A T H   =   2 0 9 	 	 '   D e f a u l t :   2 0 9   =   1 0 .   M D - Z u s a t z f e l d  
  
 	 '   Z u s a t z f e l d e r   i m   A r t i k e l s t a m m   ( F e l d n u m m e r n   b e g i n n e n   m i t   2 0 0   f ü r   d a s   1 .   F e l d )  
 	 A R T F L D N O _ S N _ R E G E X   =   2 2 2 	 	 	 '   D e f a u l t :   2 2 2   =   2 2 .   A r t i k e l - Z u s a t z f e l d  
 	  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
  
 ' # # # # # # # # # #   g e t   p a r a m e t e r   # # # # # # # # #  
  
 	 ' N e c e s s a r y   t o   g e t   p a r a m e t e r s   i n   t h e   c o d e .   D o   n o t   c h a n g e !  
 	 p a r a m s   =   M P a r a m e t e r s  
  
 	 ' P a r a m e t e r   1   t o   1 9   a r e   r e s e r v e d   b y   W i n L i n e   i n t e r a l   f u n c t i o n  
  
 	 ' F i r s t   c a l l   p a r a m e t e r   =   c o n t r o l   d e b u g   m o d e  
 	 p a r a m D e b u g M o d e 	 	 =   p a r a m s ( 2 0 )  
  
 	 ' S e c o n d   c a l l   p a r a m e t e r   =   B e l e g n u m m e r   d e s   A u f t r a g s  
 	 p a r a m D o c N u m b e r 	 	 =   p a r a m s ( 2 1 )  
  
 	 ' T h i r d   c a l l   p a r a m e t e r   =   K o n t o n u m m e r  
 	 p a r a m A c c o u n t N u m b e r 	 =   p a r a m s ( 2 2 )  
 	  
 	 ' F o u r t h   c a l l   p a r a m e t e r   =   L a u f n u m m e r  
 	 p a r a m R u n n i n g N u m b e r 	 =   p a r a m s ( 2 3 )  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
  
 ' # # # # # # # # # #   s e t   c o n s t a n t s   # # # # # # # # #  
  
 	 ' G e t   c u r r e n t   M a n d a n t o r N r ,   l i k e   " 5 0 0 M " .  
 	 W i n L i n e C u r r e n t M a n d a t o r N r   =   C W L S t a r t . C u r r e n t C o m p a n y . N r  
  
 	 ' G e t   c u r r e n t   m e s o   y e a r ,   l i k e   1 4 4 0   ( ( 2 0 2 0   -   1 9 0 0 )   *   1 2   =   1 4 4 0 ) .  
 	 W i n L i n e C u r r e n t Y e a r   =   C W L S t a r t . C u r r e n t C o m p a n y . C o m p a n y Y e a r  
  
 	 ' G e t   c u r r e n t   u s e r n a m e   l i k e   " m e s o " .  
 	 W i n L i n e C u r r e n t U s e r   =   C W L S t a r t . C u r r e n t U s e r . A c c o u n t  
  
 	 ' G e t   c u r r e n t   W i n L i n e   e x e   p a t h  
 	 W i n L i n e A p p P a t h   =   C W L S t a r t . A p p l i c a t i o n . A p p P a t h  
  
 	 ' G e t   c u r r e n t   d a t e   a n d   t i m e .  
 	 T i m e s t a m p   =   N o w  
  
 	 ' B a s i c   S Q L   w h e r e   f o r   m a n d a t o r   a n d   c u r r e n t   m e s o y e a r  
 	 S Q L Q u e r y _ B a s i c W h e r e     =   "   a n d   ( m e s o c o m p   =   ' "   &   W i n L i n e C u r r e n t M a n d a t o r N r   & " ' )   a n d   ( m e s o y e a r   =   "   &   W i n L i n e C u r r e n t Y e a r   &   " ) "  
 	  
 	 ' O r d e r   S Q L   w h e r e   f o r   m a n d a t o r   a n d   c u r r e n t   a n d   p r e v i o u s   m e s o y e a r  
 	 S Q L Q u e r y _ O r d e r W h e r e     =   "   a n d   ( m e s o c o m p   =   ' "   &   W i n L i n e C u r r e n t M a n d a t o r N r   & " ' )   a n d   ( m e s o y e a r   =   "   &   W i n L i n e C u r r e n t Y e a r   &   "   o r   m e s o y e a r   =   "   &   ( W i n L i n e C u r r e n t Y e a r   -   1 2 )   &   " ) "  
 	  
 	 ' P r e p a r e   A r r a y   f o r   m o d u l e s   t o   l o a d   ( A r r a y s   a r e   z e r o   b a s e d ! )  
 	 M o d u l e s   =   A r r a y ( " A d d D e b u g L i n e " , " S h o w D e b u g B o x " , " G e t W i n L i n e P r o d u c t I n f o B y P r o d u c t N u m b e r " , " G e t W i n L i n e D o c D e l i v e r y N o t e B y U n s p l i t t e d P r o d u c t s " , " S h o w W i n L i n e M a n d a t o r A n d W i n L i n e Y e a r " , " S h o w W i n L i n e D o c O v e r v i e w " , " S h o w W i n L i n e D o c F o r E d i t i n g " , " S w i t c h W i n L i n e G o T o M a c r o s " )  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
  
 ' # # # # # # # # # #   s e t   v a r i a b l e s   # # # # # # # # #  
  
 	 ' D e b u g   ( D e b u g   M e l d u n g e n   a n z e i g e n )  
 	 D E B U G _ O N   =   F a l s e  
 	 D E B U G _ M E S S A G E   =   " "  
 	 D e b u g M o d e   =   p a r a m D e b u g M o d e  
 	  
 	 ' S e t   p a t h   f o r   D i g i t a l   D a t a   M o d u l e s .   D e f a u l t :   M a n d a t o r   a d d i t i o n a l   f i e l d   1 0   ( I F - M o d u l P f a d - D i g i t a l D a t a )   =   C W L S t a r t . C u r r e n t C o m p a n y . V a l u e ( 2 0 9 )  
 	 M o d u l e D e f a u l t S o u r c e P a t h   =   C W L S t a r t . C u r r e n t C o m p a n y . V a l u e ( M D F L D N O _ M O D U L E _ P A T H )  
  
 	 D o c N u m b e r   	 	 =   p a r a m D o c N u m b e r  
 	 A c c o u n t N u m b e r   	 =   p a r a m A c c o u n t N u m b e r  
 	 R u n n i n g N u m b e r 	 =   p a r a m R u n n i n g N u m b e r  
  
 	 ' B u i l d   u n i q u e   k e y   f o r   t h e   d o c  
 	 D o c A c c o u n t A n d R u n n i n g N r   =   p a r a m A c c o u n t N u m b e r   &   " - "   &   p a r a m R u n n i n g N u m b e r  
 	  
 	 ' S e t   S Q L   T a b l e   a n d   Q u e r y   f o r   D o c H e a d .   D e f a u l t :   " T 0 2 5 "  
 	 S Q L T a b l e _ D o c H e a d   =   " [ T 0 2 5 ] "  
 	 S Q L Q u e r y _ D o c H e a d   =   " c 0 0 0   =   ' "   &   D o c A c c o u n t A n d R u n n i n g N r   &   " ' "   &   S Q L Q u e r y _ O r d e r W h e r e 	  
  
 	 ' S e t   S Q L   T a b l e   a n d   Q u e r y   f o r   D o c B o d y .   D e f a u l t :   " T 0 2 6 "  
 	 ' c 0 5 5   =   c o l u m n   f o r   " F l a g   H a u p t a r t i k e l   m i t   C h a r g e / I d e n t "  
 	 S Q L T a b l e _ D o c M i d   =   " [ T 0 2 6 ] "  
 	 S Q L Q u e r y _ D o c M i d   =   " c 0 0 0   L I K E   ' "   &   D o c A c c o u n t A n d R u n n i n g N r   &   " - % ' "   &   "   a n d   [ c 0 5 5 ]   i n   ( 0 ,   2 ,   1 2 ) "   &   S Q L Q u e r y _ O r d e r W h e r e  
  
 	 D o c W i n d o w I D 	 	 	 	 	 	 =   2 4 5  
 	 D o c W i n d o w G r i d I D 	 	 	 	 	 =   3 0 0  
 	 D o c W i n d o w G r i d P r o d u c t C o l u m n 	 	 =   2  
 	 D o c W i n d o w G r i d L i n e N u m b e r C o l u m n 	 =   8 1  
 	 D o c W i n d o w G r i d A m o u n t C o l u m n 	 	 =   4  
  
 	 D o c S h a p e W i n d o w I D 	 	 	 	 =   2 5 1  
 	 D o c S h a p e W i n d o w G r i d I D 	 	 	 =   1 0 0  
 	 D o c S h a p e W i n d o w G r i d I d e n t C o l u m n 	 =   5  
 	 D o c S h a p e W i n d o w G r i d A m o u n t C o l u m n 	 =   6  
 	 D o c S h a p e W i n d o w G r i d B e l e g C o l u m n 	 =   5 0  
 	  
 	 S Q L T a b l e _ E X I M H e a d 	 	 	 	 =   S Q L D a t a b a s e _ E X I M   &   " . [ d b o ] . [ I M _ B e l e g _ P a c k t i s c h L i e f e r s c h e i n _ V K _ K o p f ] "  
 	 S Q L Q u e r y _ E X I M H e a d 	 	 	 	 =   " S E L E C T   T O P   1   B E L E G K E Y   F R O M   "   &   S Q L T a b l e _ E X I M H e a d   &   "   ( N O L O C K )   W H E R E   [ A u f t r a g s n u m m e r ]   =   ' " &   D o c N u m b e r   & " '   O R D E R   B Y   [ B E L E G K E Y ]   D E S C "  
  
 	 S Q L T a b l e _ E X I M M i d d l e 	 	 	 	 =   S Q L D a t a b a s e _ E X I M   &   " . [ d b o ] . [ I M _ B e l e g _ P a c k t i s c h L i e f e r s c h e i n _ V K _ M i t t e ] "  
 	  
 	 S Q L T e m p l a t e _ E X I M M i d d l e C o u n t 	 	 =   " "  
 	 S Q L T e m p l a t e _ E X I M M i d d l e C o u n t 	 	 =   S Q L T e m p l a t e _ E X I M M i d d l e C o u n t   &   " S E L E C T   c o u n t ( B E L E G K E Y )   A s   [ c 9 9 9 ]   "  
 	 S Q L T e m p l a t e _ E X I M M i d d l e C o u n t 	 	 =   S Q L T e m p l a t e _ E X I M M i d d l e C o u n t   &   " F R O M   "   &   S Q L T a b l e _ E X I M M i d d l e   &   "   ( N O L O C K )   "  
 	 S Q L T e m p l a t e _ E X I M M i d d l e C o u n t 	 	 =   S Q L T e m p l a t e _ E X I M M i d d l e C o u n t   &   " W H E R E   [ Z e i l e n n u m m e r ]   I s   N o t   N u l l   A n d   B E L E G K E Y   =   ' % S Q L R e s u l t _ B e l e g k e y % '   a n d   [ H a u p t a r t i k e l n u m m e r ]   =   ' % P r o d u c t N u m b e r % '   "  
  
 	 S Q L T e m p l a t e _ E X I M M i d d l e 	 	 	 =   " "    
 	 S Q L T e m p l a t e _ E X I M M i d d l e 	 	 	 =   S Q L T e m p l a t e _ E X I M M i d d l e   &   " S E L E C T   [ C h a r g e I d e n t n u m m e r ] ,   [ M e n g e g e l i e f e r t ] ,   [ L a g e r o r t ] ,   [ E i n z e l p r e i s ]   "  
 	 S Q L T e m p l a t e _ E X I M M i d d l e 	 	 	 =   S Q L T e m p l a t e _ E X I M M i d d l e   &   " F R O M   "   &   S Q L T a b l e _ E X I M M i d d l e   &   "   ( N O L O C K )   "  
 	 S Q L T e m p l a t e _ E X I M M i d d l e 	 	 	 =   S Q L T e m p l a t e _ E X I M M i d d l e   &   " W H E R E   B E L E G K E Y   =   ' % S Q L R e s u l t _ B e l e g k e y % '   a n d   [ H a u p t a r t i k e l n u m m e r ]   =   ' % P r o d u c t N u m b e r % '   "  
  
 	 '   R E G E X - F e l d   i m   A r t i k e l s t a m m   f ü r   S p ä t e   A u s p r ä g u n g e n  
 	 A R T _ R E G E X _ F L D B E Z   =   " C "   &   A R T F L D N O _ S N _ R E G E X  
 	  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
  
 ' # # # # # # # # # #   f u n c t i o n s   a n d   s u b s   # # # # # # # # #  
  
 ' F u n c t i o n   t o   l o a d   V B S   m o d u l e s    
 P u b l i c   F u n c t i o n   L o a d V B S M o d u l e ( V B S M o d u l e P a r a m s )  
  
 	 ' S Y N O P S I S  
 	 	 ' F u n c t i o n   w i l l   l o a d   e x t e r n a l   -   a d d i t i o n a l   -   V B S   M o d u l e s   i n t o   c u r r e n t   S c r i p t .  
  
 	 ' D E S C R I P T I O N  
 	 	 ' B y   w o r k i n g   W i t h   M o d u l e s ,   t h i s   F u n c t i o n   I s   n e c e s s a r y   T o   l o a d   e x t e r n a l   M o d u l   F u n c t i o n s   i n t o   t h e   c u r r e n t   V B - S c r i p t .  
 	 	 ' C a l l   p a r a m e t e r   m u s t   b e   a n   a r r a y ,   b e c a u s e   V B - S c r i p t   f u n c t i o n s   c a n n o t   h a n d l e   o p t i o n a l   P a r a m e t e r s .  
 	 	 ' I n   d e v e l e p m e n t   a n d   T e s t   E n v i r o m e n t   i t   i s   p o s s i b l e ,   t o   w o r k   w i t h   d i s t r i b u t e d   F o l d e r s   w i t h   d i f f e r e n t   M o d u l e s .   T h e r e f o r   t h e   P a r a m e t e r  
 	 	 ' " V B S M o d u l e P a r a m s ( 1 ) "   ( w h i c h   i s   t h e   M o d u l e O v e r r i d e S o u r c e P a t h )   a n d   t h e   p r e s e t   V a r i a b l e   " M o d u l e D e f a u l t S o u r c e P a t h "   a r e   m a d e   f o r .  
                 ' A f t e r   a   s u c c e s s f u l   I m p o r t   o f   a   M o d u l e ,   F u n c t i o n   w i l l   R e t u r n   T r u e ,   o t h e r w i s e   a   F a l s e .  
  
 	 ' R E Q U I R E M E N T   G e n e r a l  
 	 	 ' V B S   m u s t   b e   e n a b l e d  
  
 	 ' R E Q U I R E M E N T   A s s e m b l y  
 	 	 ' < N O N E >  
  
 	 ' R E Q U I R E M E N T   V a r i a b l e s  
 	 	 ' F S O M o d u l e ,   M o d u l e ,   M o d u l e C o d e  
  
 	 ' R E Q U I R E M E N T   V a r i a b l e s   p r e S e t  
 	 	 ' < N O N E >  
  
 	 ' R E Q U I R E M E N T   F u n c t i o n s  
 	 	 ' < N O N E >  
  
 	 ' V E R S I O N  
 	 	 ' N u m b e r :   1 . 3 . 0 . 0   /   D a t e :   2 5 . 0 8 . 2 0 2 0  
  
 	 ' P A R A M E T E R   V B S M o d u l e P a r a m s ( 0 )   =   M o d u l e N a m e  
 	 	 ' G i v e   t h e   M o d u l e   N a m e ,   y o u   w a n t   t o   l o a d   i n t o   t h e   c u r r e n t   V B - S c r i p t .  
  
 	 ' P A R A M E T E R   V B S M o d u l e P a r a m s ( 1 )   =   M o d u l e O v e r r i d e S o u r c e P a t h  
 	 	 ' O p t i o n a l   P a r a m e t e r .   B y   g i v i n g   t h e   M o d u l e O v e r r i d e S o u r c e P a t h ,   F u n c t i o n   w i l l   n o t   c h e c k   o t h e r   P a t h s   f o r   t h e   F u n c t i o n   y o u   w a n t   t o   l o a d . 	 	  
  
 	 ' E X A M P L E  
 	 	 ' D i m   V B S M o d u l e P a r a m s  
 	 	 ' R e d i m   V B S M o d u l e P a r a m s ( 0 )  
 	 	 ' V B S M o d u l e P a r a m s ( 0 )   =   M o d u l e  
 	 	 ' L o a d V B S M o d u l e ( V B S M o d u l e P a r a m s )  
  
 	 ' E X A M P L E  
 	 	 ' D i m   V B S M o d u l e P a r a m s  
 	 	 ' R e d i m   V B S M o d u l e P a r a m s ( 1 )  
 	 	 ' V B S M o d u l e P a r a m s ( 0 )   =   M o d u l e  
 	 	 ' V B S M o d u l e P a r a m s ( 1 )   =   " D : \ S c r i p t F i l e s \ M o d u l e s " 	 	  
 	 	 ' L o a d V B S M o d u l e ( V B S M o d u l e P a r a m s )  
  
 	 O n   E r r o r   R e s u m e   N e x t  
  
 	 ' C l e a r   E r r o r   V a r i a b l e  
 	 E r r . C l e a r  
  
     	 D i m   F S O M o d u l e ,   M o d u l e ,   M o d u l e N a m e ,   M o d u l e C o d e ,   M o d u l e P a t h ,   W s h S h e l l ,   M o d u l e A u t o S o u r c e P a t h  
 	 S e t   F S O M o d u l e   =   C r e a t e O b j e c t ( " S c r i p t i n g . F i l e S y s t e m O b j e c t " ) 	  
  
 	 ' H o w   m a n y   p a r a m e t e r s   a r e   g i v e n   i n   t h e   a r r a y  
 	 I f   ( U B o u n d ( V B S M o d u l e P a r a m s )   =   0 )   T h e n  
  
 	 	 M o d u l e N a m e   =   V B S M o d u l e P a r a m s ( 0 )  
  
 	 	 I f   F S O M o d u l e . F o l d e r E x i s t s ( M o d u l e D e f a u l t S o u r c e P a t h )   T h e n  
 	 	  
 	 	 	 ' I f   g l o b a l   v a r   i s   s e t ,   t a k e   i t !  
 	 	 	 M o d u l e P a t h   =   M o d u l e D e f a u l t S o u r c e P a t h  
 	 	  
 	 	 E L S E  
  
 	 	 	 ' G e t t i n g   t h e   c u r r e n t   d i r ,   w h e n   M o d u l e D e f a u l t S o u r c e P a t h   d o e s   n o t   e x i s t  
 	 	 	 S e t   W s h S h e l l   =   C r e a t e O b j e c t ( " W S c r i p t . S h e l l " )  
 	 	 	 M o d u l e A u t o S o u r c e P a t h   =   W s h S h e l l . C u r r e n t D i r e c t o r y  
  
 	 	 	 ' B y   t h i s   p a r a m e t e r   w a y   t h e   p a t h   i s   m o r e   v a r i a b l e  
 	 	 	 M o d u l e P a t h   =   M o d u l e A u t o S o u r c e P a t h   &   " \ "   &   " M o d u l e s "  
  
 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
 	 	 	 	 M S G B O X 	 " P a r a m e t e r 1   =   "   &   V B S M o d u l e P a r a m s ( 0 )   &   v b C r l f   &   _  
 	 	 	 	 	 	 " M o d u l e D e f a u l t S o u r c e P a t h   =   "   &   M o d u l e D e f a u l t S o u r c e P a t h , , " D E B U G   I n f o :   P a r a m e t e r   V a l u e s   i n   A r r a y   -   V B S M o d u l e P a r a m s "  
 	 	 	 E n d   I f  
 	 	  
 	 	 E n d   i f  
  
 	 E l s e I f   ( U B o u n d ( V B S M o d u l e P a r a m s )   =   1 )   T h e n  
  
 	 	 M o d u l e N a m e   =   V B S M o d u l e P a r a m s ( 0 )  
 	 	 M o d u l e P a t h   =   V B S M o d u l e P a r a m s ( 1 )  
  
 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
 	 	 	 M S G B O X 	 " P a r a m e t e r 1   =   "   &   V B S M o d u l e P a r a m s ( 0 )   &   v b C r l f   &   _  
 	 	 	 	 	 " P a r a m e t e r 2   =   "   &   V B S M o d u l e P a r a m s ( 1 ) , , " D E B U G   I n f o :   P a r a m e t e r   V a l u e s   i n   A r r a y   -   V B S M o d u l e P a r a m s "  
 	 	 E n d   I f  
 	  
 	 E l s e  
  
 	 	 m s g b o x 	 " I n v a l i d   f u n c t i o n   c a l l ! "   	 	 &   v b C r l f   &   _  
 	 	 	 	 " P l e a s e   c h e c k   t h e   p a r a m e t e r s ! " 	 &   v b C r l f   &   _    
 	 	 	 	 " . . . t h e n   r e s t a r t   t h i s   S c r i p t ! " , v b E x c l a m a t i o n   , " L o a d V B S M o d u l e :   P a r a m e t e r   E r r o r ! "  
  
 	 E n d   i f  
  
 	 ' C h e c k i n g   f o l d e r   p a t h s 	 ' C h e c k   i f   g i v e n   p a t h   i s   v a l i d ,   i f   n o t   c r e a t e   i t  
 	 I f   N o t   F S O M o d u l e . F o l d e r E x i s t s ( M o d u l e P a t h )   T h e n  
  
 	 	 F S O M o d u l e . C r e a t e F o l d e r ( M o d u l e P a t h )  
 	 	 m s g b o x 	 " T h e   M o d u l e P a t h   d o e s n t   e x i s t ,   t r y i n g   t o   c r e a t e ! "   &   v b C r l f   &   _  
 	 	 	 	 " P l e a s e   p l a c e   y o u r   M o d u l e s   t h e r e :   "   &   v b C r l f   &   _    
 	 	 	 	 M o d u l e P a t h   &   v b C r l f   &   v b C r l f   &   _  
 	 	 	 	 " . . . t h e n   r e s t a r t   t h i s   S c r i p t ! " , v b E x c l a m a t i o n   , " L o a d V B S M o d u l e :   M o d u l e s   /   M o d u l e P a t h   i s   m i s s i n g ! "  
 	 E l s e  
  
 	 	 ' C l e a r   E r r o r   V a r i a b l e  
 	 	 E r r . C l e a r  
  
 	 	 ' B u i l d i n g   f u l l   m o d u l e   p a t h   a n d   n a m e  
 	 	 M o d u l e F u l l N a m e   =   M o d u l e P a t h   &   " \ "   &   M o d u l e n a m e   &   " . v b s "  
  
 	 	 ' d o e s   t h e   f i l e   e x i s t ?  
 	 	 I f   N o t   F S O M o d u l e . F i l e E x i s t s ( M o d u l e F u l l N a m e )   T h e n  
 	 	 	 I f   E r r . N u m b e r   < >   0   T h e n  
 	 	 	 	 M S G B O X   	 " E r r o r   C o d e :   " &   E r r . N u m b e r   &   v b C r l f   &   _  
 	 	 	 	 	 	 " E r r o r   D e s c r i p t i o n :   " &   E r r . D e s c r i p t i o n , , " E R R O R :   M o d u l e   d o e s   n o t   e x i s t !   "  
 	 	 	 	 E r r . C l e a r  
 	 	 	 	 L o a d V B S M o d u l e   =   " F a l s e "  
 	 	 	 E n d   I f  
  
 	 	 E l s e  
  
 	 	 	 ' O p e n   f i l e  
 	 	 	 S e t   M o d u l e   =   F S O M o d u l e . O p e n T e x t F i l e ( M o d u l e F u l l N a m e ,   1 )  
  
 	 	 	 ' G e t   f i l e   c o n t e n t  
 	 	 	 M o d u l e C o d e   =   M o d u l e . R e a d A l l  
  
 	 	 	 ' C l o s e   f i l e   h a n d l e  
 	 	 	 M o d u l e . C l o s e  
  
 	 	 	 ' E x e c u t e   t h e   f i l e   c o n t e n t  
 	 	 	 E x e c u t e G l o b a l   M o d u l e C o d e  
  
 	 	 	 I f   E r r . N u m b e r   < >   0   T h e n  
 	 	 	 	 M S G B O X   	 " E r r o r   C o d e :   " &   E r r . N u m b e r   &   v b C r l f   &   _  
 	 	 	 	 	 	 " E r r o r   D e s c r i p t i o n :   " &   E r r . D e s c r i p t i o n , , " E R R O R :   M o d u l e   c a n n o t   b e   l o a d e d ! "  
 	 	 	 	 E r r . C l e a r  
 	 	 	 	 L o a d V B S M o d u l e   =   " F a l s e "  
 	 	 	 E l s e  
 	 	 	 	 L o a d V B S M o d u l e   =   " T r u e "  
 	 	 	 E n d   I f  
  
 	 	 E n d   I f  
  
 	 E n d   I f  
  
 E n d   F u n c t i o n   ' L o a d V B S M o d u l e  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
  
 ' # # # # # # # # #   p r e p a r i n g   p a r t   # # # # # # # # #  
  
 ' R e s e t   E r r o r   V a r  
 E r r . C l e a r  
  
 ' D i s p l a y   d e b u g   i n f o s ,   i f   e n a b l e d  
 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
 	 A d d D e b u g L i n e   " C u r r e n t U s e r :   "   &   C u r r e n t U s e r  
 	 A d d D e b u g L i n e   " M a n d a t o r N r :     "   &   M a n d a t o r N r  
 	 A d d D e b u g L i n e   " C u r r e n t Y e a r :   "   &   C u r r e n t Y e a r  
 	 A d d D e b u g L i n e   " T i m e s t a m p :       "   &   T i m e s t a m p  
  
 	 S h o w D e b u g B o x   " R u n t i m e   V a r i a b l e s "  
  
 	 C R L F   =   c h r ( 1 3 )   &   c h r ( 1 0 )    
 	 m s g   =   " P a r a m e t e r : "   &   C R L F    
 	    
 	 F o r   i   =   1   T o   U b o u n d ( p a r a m s )    
 	 	 m s g   =   m s g   &   i   &   " . :   "   &   p a r a m s ( i )   &   C R L F    
 	 N e x t    
  
 	 m s g b o x   m s g   , ,   " M a c r o   N a m e :   "   &   C W L M a c r o . M N a m e  
 E n d   I f  
  
 D i m   M o d u l e  
  
 ' L o a d   e x t e r n a l   M o d u l e s .  
 F o r   E a c h   M o d u l e   I n   M o d u l e s  
  
 	 ' C r e a t e   t h e   a r r a y   t o   p a s s   i n   t o   o u r   f u n c t i o n  
 	 D i m   V B S M o d u l e P a r a m s  
  
 	 ' C a l l   t h e   s u b r o u t i n e   w i t h   t w o   a r g u m e n t s  
 	 R e d i m   V B S M o d u l e P a r a m s ( 0 )   ' C h a n g e   t o   1 ,   f o r   2   v a l u e s  
 	 V B S M o d u l e P a r a m s ( 0 )   =   M o d u l e  
 	 ' V B S M o d u l e P a r a m s ( 1 )   =   " "  
  
         L o a d V B S M o d u l e R e s u l t   =   L o a d V B S M o d u l e ( V B S M o d u l e P a r a m s )  
  
         I f   ( L o a d V B S M o d u l e R e s u l t   < >   " T r u e " )   T h e n  
  
 	 	 ' S e t   W S c r i p t   =   C r e a t e O b j e c t ( " W S c r i p t . S h e l l " )  
                 M S G B O X   " M o d u l e :   "   &   M o d u l e   &   "   w a s   N o t   s u c c e s f u l   b e e n   l o a d e d ! "   &   v b C r l f   &   _  
 	 	 	       " P l e a s e   l o a d   t h e   M o d u l e   a n d   t r y   a g a i n ,   r u n n i n g   t h i s   F u n c t i o n / M o d u l e ! "   &   v b C r l f   &   _  
 	 	 	       " E x i t i n g ,   b e c a u s e   o f   t h i s   I s s u e . "   &   v b C r l f   &   _  
                 	       E r r . D e s c r i p t i o n ,   v b C r i t i c a l ,   " D E B U G   I n f o :   C a n n o t   l o a d   M o d u l e ! "  
                 ' W S c r i p t . Q u i t   =   n o t   p o s s i b l e   i n   W i n l i n e   e n v i r o m e n t  
  
         E n d   I f  
  
 N e x t   ' e n d   f o r   e a c h  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
  
 ' # # # # # # # # # # #   m a i n   p a r t   # # # # # # # # # # # #  
  
 ' C h e c k   i f   n e c e s s a r y   p a r a m e t e r   a r e   g i v e n  
 I f   ( p a r a m D o c N u m b e r   < >   " " )   A n d   ( p a r a m A c c o u n t N u m b e r   < >   " " )   A n d   ( p a r a m R u n n i n g N u m b e r   < >   " " )   T h e n  
  
 	 ' Q u e r y   t o   g e t   t h e   r e l e v a n t   d o c  
 	 S e t   S Q L R e s u l t _ D o c H e a d   =   C W L S t a r t . C u r r e n t C o m p a n y . S e a r c h R e c o r d ( S Q L T a b l e _ D o c H e a d ,   S Q L Q u e r y _ D o c H e a d )  
  
 	 I f   E r r . N u m b e r   < >   0   T h e n  
 	 	 M S G B O X   	 " E r r o r   C o d e :   "   	 	 	 &   E r r . N u m b e r   	 	 &   v b C r l f   &   _  
 	 	 	 	 " E r r o r   D e s c r i p t i o n :   " 	 &   E r r . D e s c r i p t i o n 	 &   v b C r l f   &   v b C r l f   &   _  
 	 	 	 	 " S Q L - T a b l e :   " 	 	 	 &   S Q L T a b l e _ D o c H e a d 	 &   v b C r l f   &   _  
 	 	 	 	 " S Q L - Q u e r y :   " 	 	 	 &   S Q L Q u e r y _ D o c H e a d   , , " E r r o r :   G e t t i n g   d o c   f r o m   D B   T a b l e ! "  
 	 	 E r r . C l e a r  
 	 E l s e  
  
 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
 	 	 	 M S G B O X 	 " S Q L - L i n e s :   "       &   S Q L R e s u l t _ D o c H e a d . R o w C o u n t 	 &   v b C r l f   &   _  
 	 	 	 	 	 " S Q L - C o l u m n s :   "   &   S Q L R e s u l t _ D o c H e a d   	 	 	 &   v b C r l f   &   v b C r l f   &   _  
 	 	 	 	 	 " S Q L - T a b l e :   "       &   S Q L T a b l e _ D o c H e a d       	 	 	 &   v b C r l f   &   _  
 	 	 	 	 	 " S Q L - Q u e r y :   "       &   S Q L Q u e r y _ D o c H e a d , , " D E B U G   -   I n f o :   G e t t i n g   d o c   f r o m   D B   T a b l e ! "  
 	 	 E n d   I f  
 	  
 	 	 I f   ( S Q L R e s u l t _ D o c H e a d . R o w C o u n t   =   0 )   O r   ( S Q L R e s u l t _ D o c H e a d . R o w C o u n t   =   - 1 )   T h e n  
 	  
 	 	 	 ' M S G B O X 	 " E s   w u r d e n   k e i n e   r e l e v a n t e   B e l e g e   g e f u n d e n , "   &   v b C r l f   &   _  
 	 	 	 ' 	 	 " w e l c h e   z u   A u f t r ä g e n   u m g e w a n d e l t   w e r d e n   k ö n n t e n . " ,   v b O k o n l y + v b I n f o r m a t i o n ,   D E F A U L T _ T I T L E   &   "   -   h a t   L a n g e w e i l e ! "  
  
 	 	 E l s e i f   ( S Q L R e s u l t _ D o c H e a d . R o w C o u n t   >   1 )   T h e n  
 	 	  
 	 	 E l s e  
  
 	 	 	 ' G e t   c o u n t   f o r   m a i n   p r o d u c t s   o n   t h e   d o c  
 	 	 	 S e t   S Q L R e s u l t _ D o c M i d   =   C W L S t a r t . C u r r e n t C o m p a n y . S e a r c h R e c o r d ( S Q L T a b l e _ D o c M i d ,   S Q L Q u e r y _ D o c M i d )  
  
 	 	 	 I f   E r r . N u m b e r   < >   0   T h e n  
 	 	 	 	 M S G B O X   	 " E r r o r   C o d e :   "   	 	 	 &   E r r . N u m b e r   	 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 " E r r o r   D e s c r i p t i o n :   " 	 &   E r r . D e s c r i p t i o n 	 &   v b C r l f   &   v b C r l f   &   _  
 	 	 	 	 	 	 " S Q L - T a b l e :   " 	 	 	 &   S Q L T a b l e _ D o c M i d 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 " S Q L - Q u e r y :   " 	 	 	 &   S Q L Q u e r y _ D o c M i d   , , " E r r o r :   G e t t i n g   d o c   f r o m   D B   T a b l e ! "  
 	 	 	 	 E r r . C l e a r  
 	 	 	 E l s e  
  
 	 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
 	 	 	 	 	 M S G B O X 	 " S Q L - L i n e s :   "       &   S Q L R e s u l t _ D o c H e a d . R o w C o u n t 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 " S Q L - C o l u m n s :   "   &   S Q L R e s u l t _ D o c H e a d   	 	 	 &   v b C r l f   &   v b C r l f   &   _  
 	 	 	 	 	 	 	 " S Q L - T a b l e :   "       &   S Q L T a b l e _ D o c M i d       	 	 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 " S Q L - Q u e r y :   "       &   S Q L Q u e r y _ D o c M i d , , " D E B U G   -   I n f o :   G e t t i n g   d o c   f r o m   D B   T a b l e ! "  
 	 	 	 	 E n d   I f  
  
 	 	 	 	 I f   ( S Q L R e s u l t _ D o c M i d . R o w C o u n t   =   0 )   O r   ( S Q L R e s u l t _ D o c M i d . R o w C o u n t   =   - 1 )   T h e n  
  
 	 	 	 	 	 ' M S G B O X 	 " E s   w u r d e n   k e i n e   r e l e v a n t e n   A r t i k e l   a u f   d e m   B e l e g e   g e f u n d e n , "   &   v b C r l f   &   _  
 	 	 	 	 	 ' 	 	 " w e l c h e   z u   A u f t r ä g e n   u m g e w a n d e l t   w e r d e n   k ö n n t e n . " ,   v b O k o n l y + v b I n f o r m a t i o n ,   D E F A U L T _ T I T L E   &   "   -   h a t   L a n g e w e i l e ! "  
  
 	 	 	 	 E l s e  
  
 	 	 	 	 	 ' C l o s e   a l l   W i n d o w s  
 	 	 	 	 	 M P u s h B u t t o n   4 5 ,   9 9 ,   0  
 	 	 	 	 	 M A c t i v a t e W i n d o w   5 1 0  
  
 	 	 	 	 	 ' C a l l   G U I   t o   g e t   i n t o   d o c  
 	 	 	 	 	 ' S h o w W i n L i n e M a n d a t o r A n d W i n L i n e Y e a r   W i n L i n e C u r r e n t M a n d a t o r N r ,   W i n L i n e C u r r e n t Y e a r  
 	 	 	 	 	 S h o w W i n L i n e D o c O v e r v i e w   D o c N u m b e r ,   A c c o u n t N u m b e r ,   R u n n i n g N u m b e r  
 	 	 	 	 	 S h o w W i n L i n e D o c F o r E d i t i n g  
  
 	 	 	 	 	 S e t   D o c W i n d o w   	 	 =   C W L S t a r t . C u r r e n t M o d u l e . W i n d o w s . I t e m ( D o c W i n d o w I D )  
 	 	 	 	 	 S e t   D o c W i n d o w G r i d   	 =   D o c W i n d o w . C o n t r o l s . I t e m ( D o c W i n d o w G r i d I D ) . G r i d  
  
 	 	 	 	 	 P r o d u c t C o u n t   =   S Q L R e s u l t _ D o c M i d . r o w c o u n t  
 	 	 	 	 	  
 	 	 	 	 	 ' l o o p   f o r   e v e r y   P r o d u c t N u m b e r   o n   t h e   d o c  
 	 	 	 	 	 F o r   P r o d u c t C o u n t e r   =   1   T o   P r o d u c t C o u n t  
  
 	 	 	 	 	 	 P r o d u c t N u m b e r   =   S Q L R e s u l t _ D o c M i d . v a l u e ( 1 )  
  
 	 	 	 	 	 	 ' l o o p   t o   s e a r c h   f o r   t h e   p r o d u c t n u m b e r   i n   e v e r y   d o c   l i n e  
 	 	 	 	 	 	 F o r   D o c L i n e C o u n t e r   =   1   T o   D o c W i n d o w G r i d . L i n e C o u n t  
  
 	 	 	 	 	 	 	 C e l l V a l u e   =   D o c W i n d o w G r i d . G e t C e l l V a l u e ( D o c L i n e C o u n t e r ,   D o c W i n d o w G r i d P r o d u c t C o l u m n )  
  
 	 	 	 	 	 	 	 ' I f   p r o d u c t n u m b e r   w a s   f o u n d   i n   c u r r e n t   l i n e   o f   t h e   d o c  
 	 	 	 	 	 	 	 I f   ( U C A S E ( C e l l V a l u e )   =   U C A S E ( P r o d u c t N u m b e r ) )   T h e n  
  
 	 	 	 	 	 	 	 	 ' Q u e r y   t o   g e t   a l l   I d e n t   n u m b e r s   f o r   t h e   c u r r e n t   p r o d u c t  
 	 	 	 	 	 	 	 	 D i m   M C o n n ,   S Q L R e s u l t _ E X I M H e a d ,   S Q L R e s u l t _ E X I M M i d d l e C o u n t ,   S Q L R e s u l t _ E X I M M i d d l e ,   P r o d u c t S e r i a l N u m b e r  
 	 	 	 	 	 	 	 	 S e t   M C o n n   =   C W L S t a r t . C u r r e n t C o m p a n y . C o n n e c t i o n  
  
 	 	 	 	 	 	 	 	 S e t   W i n L i n e P r o d u c t I n f o   =   G e t W i n L i n e P r o d u c t I n f o B y P r o d u c t N u m b e r ( P r o d u c t N u m b e r ,   W i n L i n e C u r r e n t M a n d a t o r N r ,   W i n L i n e C u r r e n t Y e a r )  
 	 	 	 	 	 	 	 	 P r o d u c t T y p e   	 	 =   W i n L i n e P r o d u c t I n f o . v a l u e ( 3 9 ) 	 ' c 0 1 4   f r o m   v 0 2 1   =   A u s p r ä g u n g s f l a g   |   0   =   H a u p t a r t i k e l   o h n e   I d e n t ;   1   =   H a u p t a r t i k e l   m i t   i d e n t ;   2   =   A u s p r ä g u n g s a r t i k e l  
 	 	 	 	 	 	 	 	 P r o d u c t I d e n t T y p e 	 =   W i n L i n e P r o d u c t I n f o . v a l u e ( A R T _ R E G E X _ F L D B E Z ) 	 ' c 2 2 2   f r o m   v 0 2 1   =   Z u s a t z f e l d   R e g e x   P r ü f u n g   ( 2 0 4   F e l d   i n   v 2 1 )  
  
 	 	 	 	 	 	 	 	 ' Q u e r y   t o   g e t   u n i q u e   k e y   f r o m   h e a d   t a b l e ,   t o   f i n d   m u l t i p l e   l i n e s   i n   m i d d l e / p o s   t a b l e  
 	 	 	 	 	 	 	 	 S e t   S Q L R e s u l t _ E X I M H e a d   =   M C o n n . S e l e c t ( S Q L Q u e r y _ E X I M H e a d )  
 	 	 	 	 	 	 	 	 S Q L R e s u l t _ B e l e g k e y   =   S Q L R e s u l t _ E X I M H e a d . v a l u e ( " B E L E G K E Y " )  
 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 ' m u s s   n o c h   r e i n :   I F   ( S Q L R e s u l t _ B e l e g k e y   >   0 )   T h e n  
  
 	 	 	 	 	 	 	 	 S Q L Q u e r y _ E X I M M i d d l e   =   " "  
 	 	 	 	 	 	 	 	 S Q L Q u e r y _ E X I M M i d d l e   =   R E P L A C E ( S Q L T e m p l a t e _ E X I M M i d d l e ,   " % S Q L R e s u l t _ B e l e g k e y % " ,   S Q L R e s u l t _ B e l e g k e y )  
 	 	 	 	 	 	 	 	 S Q L Q u e r y _ E X I M M i d d l e   =   R E P L A C E ( S Q L Q u e r y _ E X I M M i d d l e ,   " % P r o d u c t N u m b e r % " ,   P r o d u c t N u m b e r )  
 	 	 	 	 	 	 	 	 S e t   S Q L R e s u l t _ E X I M M i d d l e   =   M C o n n . S e l e c t ( S Q L Q u e r y _ E X I M M i d d l e )  
 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 P r o d u c t A m o u n t   	 	 =   S Q L R e s u l t _ E X I M M i d d l e . v a l u e ( " M e n g e g e l i e f e r t " )  
 	 	 	 	 	 	 	 	 P r o d u c t S h a p e C o d e 1 	 =   S Q L R e s u l t _ E X I M M i d d l e . v a l u e ( " A u s p r . 1 " )  
 	 	 	 	 	 	 	 	 P r o d u c t S t o r a g e I D 	 =   S Q L R e s u l t _ E X I M M i d d l e . v a l u e ( " L a g e r o r t " ) 	  
 	 	 	 	 	 	 	 	 P r o d u c t E i n z e l p r e i s 	 =   S Q L R e s u l t _ E X I M M i d d l e . v a l u e ( " E i n z e l p r e i s " )  
 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
  
 	 	 	 	 	 	 	 	 	 m s g b o x 	 " P r o d u c t C o u n t e r :           " 	 &   P r o d u c t C o u n t e r 	 	 &   "   o f   "   &   P r o d u c t C o u n t   &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	 	 	 " P r o d u c t N u m b e r :             " 	 &   P r o d u c t N u m b e r 	 	 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	 	 	 " P r o d u c t T y p e :                 " 	 &   P r o d u c t T y p e 	 	 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	 	 	 " P r o d u c t S h a p e C o d e 1 : 	   " 	 &   P r o d u c t S h a p e C o d e 1   	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	 	 	 " P r o d u c t S t o r a g e I D :       " 	 &   P r o d u c t S t o r a g e I D 	 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	   	 	 " P r o d u c t A m o u n t :             " 	 &   P r o d u c t A m o u n t 	 	 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	   	 	 " P r o d u c t E i n z e l p r e i s :   " 	 &   P r o d u c t E i n z e l p r e i s 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	   	 	 " L i n e :                               " 	 &   D o c L i n e C o u n t e r 	 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	   	 	 " S Q L R e s u l t _ B e l e g k e y :   " 	 &   S Q L R e s u l t _ B e l e g k e y 	 &   v b C r l f   &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	   	 	 " S Q L - Q u e r y :                     " 	 &   S Q L Q u e r y _ E X I M M i d d l e 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	   	 	 " " ,   v b O k a y o n l y + v b I n f o r m a t i o n ,   " L o o p   o f   p r o d u c t s "  
  
 	 	 	 	 	 	 	 	 E n d   I f  
 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 I f   P r o d u c t A m o u n t   >   0   T h e n  
 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 ' P r o d u c t   w i t h o u t   I d e n t   n u m b e r  
 	 	 	 	 	 	 	 	 	 I f   ( P r o d u c t T y p e   =   0 )   T h e n  
  
 	 	 	 	 	 	 	 	 	 	 ' F a l l b a c k   V a l u e  
 	 	 	 	 	 	 	 	 	 	 I F   ( P r o d u c t A m o u n t   =   " " )   T h e n  
  
 	 	 	 	 	 	 	 	 	 	 	 P r o d u c t A m o u n t   =   0  
  
 	 	 	 	 	 	 	 	 	 	 E n d   i f  
  
 	 	 	 	 	 	 	 	 	 	 ' S e t   a r t i c l e   a m o u n t  
 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 M S e t G r i d V a l u e   D o c W i n d o w I D ,   3 0 0 ,   D o c L i n e C o u n t e r ,   D o c W i n d o w G r i d A m o u n t C o l u m n ,   P r o d u c t A m o u n t  
 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 '   S e t   E i n z e l p r e i s   ( M P   0 4 0 5 2 1 )  
 	 	 	 	 	 	 	 	 	 	 I f   L e n ( P r o d u c t E i n z e l p r e i s )   >   0   T h e n  
 	 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 	 M S e t G r i d V a l u e   D o c W i n d o w I D ,   3 0 0 ,   D o c L i n e C o u n t e r ,   5 ,   P r o d u c t E i n z e l p r e i s  
 	 	 	 	 	 	 	 	 	 	 E n d   I f  
  
 	 	 	 	 	 	 	 	 	 ' P r o d u c t   w i t h   I d e n t   n u m b e r  
 	 	 	 	 	 	 	 	 	 E l s e i f   ( P r o d u c t T y p e   =   1 )   T h e n  
 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 ' O p e n   P r o d u c t   S h a p e   W i n d o w   ( A r t i k e l a u s p r ä g u n g )  
 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 M G r i d D b l C l i c k   D o c W i n d o w I D ,   3 0 0 ,   D o c L i n e C o u n t e r ,   7 2  
 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 M S e t F i e l d F o c u s   D o c S h a p e W i n d o w I D ,   4 7 0  
 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
 	 	 	 	 	 	 	 	 	 	 	 m s g b o x 	 " P r o d u c t I d e n t T y p e :   "   &   P r o d u c t I d e n t T y p e  
 	 	 	 	 	 	 	 	 	 	 E n d   I f  
 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 ' P r o d u c t   w i t h o u t   k n o w n   I d e n t   n u m b e r  
 	 	 	 	 	 	 	 	 	 	 I f   ( P r o d u c t I d e n t T y p e   < >   " " )   T h e n  
 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 ' G e t   d e l i v e r y   n o t e s   F o r   i n c o m i n g   g o o d s ,   w h i c h   w e r e   N o t   s e l e c t e d  
 	 	 	 	 	 	 	 	 	 	 	 S e t   D e l i v e r y N o t e U n s p l i t t e d   =   G e t W i n L i n e D o c D e l i v e r y N o t e B y U n s p l i t t e d P r o d u c t s ( P r o d u c t N u m b e r , W i n L i n e C u r r e n t M a n d a t o r N r , W i n L i n e C u r r e n t Y e a r )  
 	 	 	 	 	 	 	 	 	 	 	 D o c D e l i v e r y N o t e U n s p l i t t e d P r o d u c t A m o u n t   =   D e l i v e r y N o t e U n s p l i t t e d . v a l u e ( " c 9 9 5 " )  
 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
 	 	 	 	 	 	 	 	 	 	 	 	 m s g b o x 	 " D o c D e l i v e r y N o t e U n s p l i t t e d P r o d u c t A m o u n t :   "   &   D o c D e l i v e r y N o t e U n s p l i t t e d P r o d u c t A m o u n t  
 	 	 	 	 	 	 	 	 	 	 	 E n d   I f  
 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 ' S e t   T e m p l a t e   f o r   n e w   p r o d u c t s   i d e n t   n u m b e r s  
 	 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 	 M C o m b o S e l c h a n g e   D o c S h a p e W i n d o w I D ,   4 7 0 ,   " N e u e r f a s s u n g "  
 	 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 	 M S e t F i e l d V a l u e   D o c S h a p e W i n d o w I D ,   4 7 0 ,   " N e u e r f a s s u n g "  
 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 ' P r o d u c t   w i t h   k n o w n   I d e n t   n u m b e r  
 	 	 	 	 	 	 	 	 	 	 E l s e  
 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 ' S e t   T e m p l a t e   f o r   e x i s t i n g   p r o d u c t   i d e n t   n u m b e r s  
 	 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 	 M C o m b o S e l c h a n g e   D o c S h a p e W i n d o w I D ,   4 7 0 ,   " A r t i k e l   m i t   L a g e r s t a n d "  
 	 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 	 M S e t F i e l d V a l u e   D o c S h a p e W i n d o w I D ,   4 7 0 ,   " A r t i k e l   m i t   L a g e r s t a n d "  
 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 E n d   I f  
  
 	 	 	 	 	 	 	 	 	 	 ' G e t   m a n y   i d e n t   p r o d u c t s   a r e   i n   t h e   E X I M   T a b l e  
 	 	 	 	 	 	 	 	 	 	 S Q L Q u e r y _ E X I M M i d d l e C o u n t   =   " "  
 	 	 	 	 	 	 	 	 	 	 S Q L Q u e r y _ E X I M M i d d l e C o u n t   =   R E P L A C E ( S Q L T e m p l a t e _ E X I M M i d d l e C o u n t , " % S Q L R e s u l t _ B e l e g k e y % " , S Q L R e s u l t _ B e l e g k e y )  
 	 	 	 	 	 	 	 	 	 	 S Q L Q u e r y _ E X I M M i d d l e C o u n t   =   R E P L A C E ( S Q L Q u e r y _ E X I M M i d d l e C o u n t ,       " % P r o d u c t N u m b e r % " ,           P r o d u c t N u m b e r )  
 	 	 	 	 	 	 	 	 	 	 S e t   S Q L R e s u l t _ E X I M M i d d l e C o u n t   =   M C o n n . S e l e c t ( S Q L Q u e r y _ E X I M M i d d l e C o u n t )  
  
 	 	 	 	 	 	 	 	 	 	 ' G e t   h o w   m a n y   i d e n t   n u m b e r s   w e r e   f o u n d   i n   m i d d l e / p o s   t a b l e  
 	 	 	 	 	 	 	 	 	 	 E X I M M i d d l e C o u n t   =   S Q L R e s u l t _ E X I M M i d d l e C o u n t . v a l u e ( " c 9 9 9 " )  
 	 	 	 	 	 	 	 	 	 	 ' m s g b o x   " E X I M M i d d l e C o u n t :   "   &   E X I M M i d d l e C o u n t  
  
 	 	 	 	 	 	 	 	 	 	 S Q L Q u e r y _ E X I M M i d d l e   =   " "  
 	 	 	 	 	 	 	 	 	 	 S Q L Q u e r y _ E X I M M i d d l e   =   R E P L A C E ( S Q L T e m p l a t e _ E X I M M i d d l e , " % S Q L R e s u l t _ B e l e g k e y % " , S Q L R e s u l t _ B e l e g k e y )  
 	 	 	 	 	 	 	 	 	 	 S Q L Q u e r y _ E X I M M i d d l e   =   R E P L A C E ( S Q L Q u e r y _ E X I M M i d d l e ,       " % P r o d u c t N u m b e r % " ,           P r o d u c t N u m b e r )  
 	 	 	 	 	 	 	 	 	 	 S e t   S Q L R e s u l t _ E X I M M i d d l e   =   M C o n n . S e l e c t ( S Q L Q u e r y _ E X I M M i d d l e )  
  
 	 	 	 	 	 	 	 	 	 	 S e t   D o c S h a p e W i n d o w   	 	 =   C W L S t a r t . C u r r e n t M o d u l e . W i n d o w s . I t e m ( D o c S h a p e W i n d o w I D )  
 	 	 	 	 	 	 	 	 	 	 S e t   D o c S h a p e W i n d o w G r i d   	 =   D o c S h a p e W i n d o w . C o n t r o l s . I t e m ( D o c S h a p e W i n d o w G r i d I D ) . G r i d  
  
 	 	 	 	 	 	 	 	 	 	 '   M a c h t   d i e   S p a l t e   " B e l e g "   f ü r   E i n g a n g s l i e f e r s c h e i n e   s i c h t b a r ,   7 . 9 . 2 1   M P  
 	 	 	 	 	 	 	 	 	 	 D o c S h a p e W i n d o w G r i d . S e t C o l u m n W i d t h   D o c S h a p e W i n d o w G r i d B e l e g C o l u m n ,   1 0  
  
 	 	 	 	 	 	 	 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
 	 	 	 	 	 	 	 	 	 	 	 m s g b o x 	 " E X I M M i d d l e C o u n t :           " 	 &   E X I M M i d d l e C o u n t  
 	 	 	 	 	 	 	 	 	 	 E n d   I f  
  
 	 	 	 	 	 	 	 	 	 	 ' l o o p   f o r   e v e r y   f o u n d   i d e n t   n u m b e r   i n   m i d d l e / p o s   t a b l e  
 	 	 	 	 	 	 	 	 	 	 F o r   E X I M M i d d l e C o u n t e r   =   1   T o   E X I M M i d d l e C o u n t  
  
 	 	 	 	 	 	 	 	 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
  
 	 	 	 	 	 	 	 	 	 	 	 	 m s g b o x 	 E X I M M i d d l e C o u n t e r   &   "   o f   "   &   E X I M M i d d l e C o u n t   	 	 	 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 " S Q L Q u e r y _ E X I M M i d d l e C o u n t :   " 	 &   S Q L Q u e r y _ E X I M M i d d l e C o u n t 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 " S Q L Q u e r y _ E X I M M i d d l e :   " 	 	 	 &   S Q L Q u e r y _ E X I M M i d d l e 	 	 &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 " " ,   v b O k a y o n l y + v b I n f o r m a t i o n ,   " L o o p   f o r   e v e r y   i d e n t   n u m b e r "  
  
 	 	 	 	 	 	 	 	 	 	 	 e n d   I f  
  
 	 	 	 	 	 	 	 	 	 	 	 ' G e t   a n d   s e t   v a l u e s   f o r   t h i s   l o o p  
 	 	 	 	 	 	 	 	 	 	 	 P r o d u c t S e r i a l N u m b e r   =   S Q L R e s u l t _ E X I M M i d d l e . v a l u e ( " C h a r g e I d e n t n u m m e r " )  
  
 	 	 	 	 	 	 	 	 	 	 	 C u r r e n t L i n e C o u n t 	 =   D o c S h a p e W i n d o w G r i d . L i n e C o u n t  
 	 	 	 	 	 	 	 	 	 	 	 N e w L i n e C o u n t 	 	 =   C u r r e n t L i n e C o u n t   +   1 	 	 	 	 	 	 	 	 	 	  
  
 	 	 	 	 	 	 	 	 	 	 	 ' F a l l b a c k   V a l u e  
 	 	 	 	 	 	 	 	 	 	 	 I F   ( P r o d u c t S h a p e   =   " " )   T h e n  
  
 	 	 	 	 	 	 	 	 	 	 	 	 P r o d u c t S h a p e   =   " A "  
  
 	 	 	 	 	 	 	 	 	 	 	 E n d   I f  
  
 	 	 	 	 	 	 	 	 	 	 	 I f   P r o d u c t S e r i a l N u m b e r   < >   " "   T h e n  
 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 ' P r o d u c t   w i t h o u t   k n o w n   I d e n t   n u m b e r  
 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( P r o d u c t I d e n t T y p e   < >   " " )   T h e n  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 m s g b o x   " P r o d u c t   w i t h   u n k n o w n   I d e n t   n u m b e r ,   P r o d u c t S e r i a l N u m b e r :   "   &   P r o d u c t S e r i a l N u m b e r  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 E n d   i f  
 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 ' n e w   l i n e   i n   w i n d o w   f o r   p r o d u c t   i d e n t   n r  
 	 	 	 	 	 	 	 	 	 	 	 	 	 M P u s h B u t t o n   D o c S h a p e W i n d o w I D ,   9 0 4 ,   0  
 	 	 	 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( P r o d u c t S h a p e   < >   " " )   T h e n  
 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 M S e t G r i d V a l u e   D o c S h a p e W i n d o w I D ,   1 0 0 ,   N e w L i n e C o u n t ,   3 ,   P r o d u c t S h a p e  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 	 	 	 E n d   I f 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( D e l i v e r y N o t e U n s p l i t t e d   >   0 )   T h e n  
 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( D e l i v e r y N o t e U n s p l i t t e d . v a l u e ( " c 9 9 8 " ) )   < >   " "   T h e n  
 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' I n v o i c e   n r  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 D o c D e l i v e r y N o t e U n s p l i t t e d   =   D e l i v e r y N o t e U n s p l i t t e d . v a l u e ( " c 9 9 8 " )  
 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 E l s e  
 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' O r d e r   n r  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 D o c D e l i v e r y N o t e U n s p l i t t e d   =   D e l i v e r y N o t e U n s p l i t t e d . v a l u e ( " c 9 9 9 " )  
 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 E n d   I f    
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 D o c D e l i v e r y N o t e U n s p l i t t e d P r o d u c t A m o u n t   =   D e l i v e r y N o t e U n s p l i t t e d . v a l u e ( " c 9 9 5 " )  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 E l s e  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' J o n a t h a n   J e n n e :   0 1 . 1 0 . 2 0 2 0 :  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' A d d e d   u n s e t   v a r i a b l e s  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 D o c D e l i v e r y N o t e U n s p l i t t e d P r o d u c t A m o u n t   =   0  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 D o c D e l i v e r y N o t e U n s p l i t t e d   =   " "  
 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 E n d   I f  
 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 '   V o r   s e t z e n   d e s   E i n g a n g s l i e f e r s c h e i n s    
 	 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 m s g b o x 	 " D o c D e l i v e r y N o t e U n s p l i t t e d P r o d u c t A m o u n t :           " 	 &   D o c D e l i v e r y N o t e U n s p l i t t e d P r o d u c t A m o u n t   &   v b C r l f   &   _  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 " D o c D e l i v e r y N o t e U n s p l i t t e d :                                     " 	 &   D o c D e l i v e r y N o t e U n s p l i t t e d  
 	 	 	 	 	 	 	 	 	 	 	 	 	 E n d   I f  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 M S e t G r i d V a l u e   D o c S h a p e W i n d o w I D ,   1 0 0 ,   N e w L i n e C o u n t ,   5 ,   P r o d u c t S e r i a l N u m b e r  
 	 	 	 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 	 	 	 ' M C h a n g e G r i d C e l l   D o c S h a p e W i n d o w I D ,   1 0 0 ,   3 9 3 2 2 2  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( D o c D e l i v e r y N o t e U n s p l i t t e d P r o d u c t A m o u n t   >   0 )   A n d   ( D o c D e l i v e r y N o t e U n s p l i t t e d   < >   " " )   T h e n 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 '   S e t z t   E i n g a n g s l i e f e r s c h e i n - N u m m e r   i n   d a s   F e l d   " B e l e g "  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 M S e t G r i d V a l u e   D o c S h a p e W i n d o w I D ,   1 0 0 ,   N e w L i n e C o u n t ,   D o c S h a p e W i n d o w G r i d B e l e g C o l u m n ,   D o c D e l i v e r y N o t e U n s p l i t t e d 	  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 '   S e t z t   d e n   F o c u s   a u f   d a s   M e n g e n   F e l d ,   u m   d a s   F e l d   " B e l e g "   a k t i v   z u   v e r l a s s e n  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 D o c S h a p e W i n d o w G r i d . S e t C u r r e n t C e l l   N e w L i n e C o u n t ,   6  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 '   M P ,   0 8 0 9 :   W i r d   h i e r   n i c h t   b e n ö t i g t ,   v e r m u t l i c h  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' D E B U G 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' C W L M a c r o . M S t o p  
 	 	 	 	 	 	 	 	 	 	 	 	 	 E n d   I f  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 '   S e t z t   d i e   M e n g e   a u f   1 . 0 0  
 	 	 	 	 	 	 	 	 	 	 	 	 	 M S e t G r i d V a l u e   D o c S h a p e W i n d o w I D ,   1 0 0 ,   N e w L i n e C o u n t ,   6 ,   " 1 . 0 0 "  
 	 	 	 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 ' T a k e   n e x t   d o c   ( E i n g a n g s l i e f e r s c h e i n ) ,   i f   a m o u n t   o f   c u r r e n t   d o c   w a s   r e a c h e d  
 	 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( D o c D e l i v e r y N o t e U n s p l i t t e d P r o d u c t A m o u n t   = <   E X I M M i d d l e C o u n t e r )   T h e n  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 D e l i v e r y N o t e U n s p l i t t e d . N e x t R e c o r d  
 	 	 	 	 	 	 	 	 	 	 	 	 	 E n d   I f 	 	 	 	 	 	 	 	 	 	 	  
  
 	 	 	 	 	 	 	 	 	 	 	 	 ' P r o d u c t   w i t h   k n o w n   I d e n t   n u m b e r  
 	 	 	 	 	 	 	 	 	 	 	 	 E l s e  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( D E B U G _ O N   =   T r u e )   O r   ( D e b u g M o d e   =   " E n a b l e d " )   T h e n  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 m s g b o x   " P r o d u c t   w i t h   k n o w n   I d e n t   n u m b e r ,   P r o d u c t S e r i a l N u m b e r :   "   &   P r o d u c t S e r i a l N u m b e r  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 e n d   i f  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 S e t   D o c S h a p e W i n d o w   	 	 =   C W L S t a r t . C u r r e n t M o d u l e . W i n d o w s . I t e m ( D o c S h a p e W i n d o w I D )  
 	 	 	 	 	 	 	 	 	 	 	 	 	 S e t   D o c S h a p e W i n d o w G r i d   	 =   D o c W i n d o w . C o n t r o l s . I t e m ( D o c S h a p e W i n d o w G r i d I D ) . G r i d  
 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 ' l o o p   t o   s e a r c h   f o r   t h e   p r o d u c t n u m b e r   i n   e v e r y   d o c   l i n e  
 	 	 	 	 	 	 	 	 	 	 	 	 	 F o r   D o c S h a p e L i n e C o u n t e r   =   1   T o   D o c S h a p e W i n d o w G r i d . L i n e C o u n t  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' m s g b o x   " D o c S h a p e L i n e C o u n t e r :   "   &   D o c S h a p e L i n e C o u n t e r   "   o f   "   &   D o c S h a p e W i n d o w G r i d . L i n e C o u n t  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 S h a p e C e l l V a l u e   =   D o c S h a p e W i n d o w G r i d . G e t C e l l V a l u e ( D o c S h a p e L i n e C o u n t e r , D o c S h a p e W i n d o w G r i d I d e n t C o l u m n )  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' I f   p r o d u c t n u m b e r   w a s   f o u n d   i n   c u r r e n t   l i n e   o f   t h e   d o c  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 I f   ( U C A S E ( S h a p e C e l l V a l u e )   =   U C A S E ( P r o d u c t S e r i a l N u m b e r ) )   T h e n  
 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ' I n   c a s e   o f   i d e n t   p r o d u c t ,   a m o u n t   m u s t   b e   " 1 "  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 M S e t G r i d V a l u e   D o c S h a p e W i n d o w I D ,   1 0 0 ,   D o c S h a p e L i n e C o u n t e r ,   D o c S h a p e W i n d o w G r i d A m o u n t C o l u m n ,   " 1 "  
  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 E x i t   F o r  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 	 E n d   i f  
 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 	 N e x t   ' D o c S h a p e W i n d o w G r i d . L i n e C o u n t  
 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	 E n d   I f 	 	 	  
  
 	 	 	 	 	 	 	 	 	 	 	 E n d   I f  
 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 S Q L R e s u l t _ E X I M M i d d l e . N e x t R e c o r d  
  
 	 	 	 	 	 	 	 	 	 	 N e x t  
  
 	 	 	 	 	 	 	 	 	 	 '   J e t z t   s i n d   a l l e   I d e n t   N u m m e r n   e i n g e t r a g e n   f ü r   e i n e n   A r t i k e l 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 ' P r e s s   F 5   /   o k a y   a f t e r   a l l   i d e n t   n u m b e r s   w e r e   s e t   f o r   t h i s   p r o d u c t  
 	 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 M P u s h B u t t o n   D o c S h a p e W i n d o w I D ,   9 8 ,   0  
 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 ' D E B U G  
 	 	 	 	 	 	 	 	 	 	 ' C W L M a c r o . M S t o p  
 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 E n d   i f   ' P r o d u c t T y p e  
  
 	 	 	 	 	 	 	 	 E l s e  
 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 ' S e t   a m o u n t   t o   0  
 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 M S e t G r i d V a l u e   D o c W i n d o w I D ,   3 0 0 ,   D o c L i n e C o u n t e r ,   D o c W i n d o w G r i d A m o u n t C o l u m n ,   " 0 "  
 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 ' C l o s e   A u s p r ä g u n g s f e n s t e r   i f   i t   i s   o p e n e d  
 	 	 	 	 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 M P u s h B u t t o n   D o c S h a p e W i n d o w I D ,   9 9 ,   0  
 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 ' M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 ' M G r i d L e f t C l i c k   2 4 5 ,   3 0 0 ,   D o c L i n e C o u n t e r ,   D o c W i n d o w G r i d L i n e N u m b e r C o l u m n  
 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 	 ' M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 	 	 	 	 ' M P u s h B u t t o n   2 4 5 ,   9 6 6 ,   0  
 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 	 E n d   I f   ' P r o d u c t A m o u n t   =   0  
 	 	 	 	 	 	 	 	  
 	 	 	 	 	 	 	 E n d   I f   ' ( C e l l V a l u e   =   P r o d u c t N u m b e r )  
  
 	 	 	 	 	 	 N e x t  
  
 	 	 	 	 	 	 ' S w i t c h   t o   n e x t   p r o d u c t   i n   t 0 2 6  
 	 	 	 	 	 	 S Q L R e s u l t _ D o c M i d . n e x t R e c o r d  
  
 	 	 	 	 	 N e x t  
 	 	 	 	 	  
 	 	 	 	 	 ' A f t e r   a l l   i d e n t   p r o d u c t   w e r e   p r o c e s s e d ,   c l i c k   " a u t o m a t i s c h   a u f t e i l e n "   f o r   o t h e r   p r o d u c t s  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M P u s h B u t t o n   2 4 5 ,   9 2 0 ,   0  
 	 	 	 	 	  
 	 	 	 	 	 '   C l o s e s   t h e   L a g e r z u o r d n u n g s f e n s t e r   i f   i t   i s   o p e n  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M P u s h B u t t o n   6 7 4 ,   9 9 ,   0  
 	 	 	 	 	  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M P u s h B u t t o n   2 4 5 ,   9 8 ,   0 	 	 	 	  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M P u s h B u t t o n   2 4 8 ,   9 8 ,   0  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M P u s h B u t t o n   2 4 8 ,   9 9 ,   0  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M C o m b o S e l c h a n g e   2 4 9 ,   1 0 5 ,   " 0 "  
 	 	 	 	 	  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M P u s h B u t t o n   2 4 9 ,   9 9 ,   0  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M A c t i v a t e W i n d o w   2 4 8  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M A c t i v a t e W i n d o w   7 7 4  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M P u s h B u t t o n   7 7 4 ,   9 9 ,   0  
  
 	 	 	 	 E n d   I f 	  
  
 	 	 	 E n d   I f 	  
  
 	 	 E n d   I f  
  
 	 E n d   I f  
  
 E n d   I f  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
  
 ' # # # # # # # # # # #   f i n a l   p a r t   # # # # # # # # # # #  
  
 ' i f   D e b u g M o d e   e n a b l e d   o r   D e b u g O n   i s   t r u e ,   g o   t o   t h e   M a c r o   W i n d o w  
 S w i t c h W i n L i n e G o T o M a c r o s  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 	 )  
 ' E ÿþÿ' E n d e   v o n   ( D e k l a r a t i o n e n )  
  
 e   v o n   ( D e k l a r a t i o n e n )  
  
 i n d o w  
 S w i t c h W i n L i n e G o T o M a c r o s  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 	 )  
 ' E ÿþÿ' E n d e   v o n   ( D e k l a r a t i o n e n )  
  
 n d   I f  
  
 E n d   I f  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
  
 ' # # # # # # # # # # #   f i n a l   p a r t   # # # # # # # # # # #  
  
 ' i f   D e b u g M o d e   e n a b l e d   o r   D e b u g O n   i s   t r u e ,   g o   t o   t h e   M a c r o   W i n d o w  
 S w i t c h W i n L i n e G o T o M a c r o s  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 	 )  
 ' E ÿþÿ' E n d e   v o n   ( D e k l a r a t i o n e n )  
  
   ( D e k l a r a t i o n e n )  
  
 4  
 	 	 	 	 	 M L a s t M e s s a g e R e s u l t   =   1  
 	 	 	 	 	 M P u s h B u t t o n   7 7 4 ,   9 9 ,   0  
  
 	 	 	 	 E n d   I f 	  
  
 	 	 	 E n d   I f 	  
  
 	 	 E n d   I f  
  
 	 E n d   I f  
  
 E n d   I f  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
  
 ' # # # # # # # # # # #   f i n a l   p a r t   # # # # # # # # # # #  
  
 ' i f   D e b u g M o d e   e n a b l e d   o r   D e b u g O n   i s   t r u e ,   g o   t o   t h e   M a c r o   W i n d o w  
 S w i t c h W i n L i n e G o T o M a c r o s  
  
 ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 	 )  
 ' E ÿþÿ' E n d e   v o n   ( D e k l a r a t i o n e n )  
  
 